@sapienx/agentos 0.6.10 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/bundle/.next/BUILD_ID +1 -1
  2. package/bundle/.next/app-path-routes-manifest.json +2 -2
  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/server/app/_global-error/page_client-reference-manifest.js +1 -1
  7. package/bundle/.next/server/app/_global-error.html +1 -1
  8. package/bundle/.next/server/app/_global-error.rsc +1 -1
  9. package/bundle/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  10. package/bundle/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  11. package/bundle/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  12. package/bundle/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  13. package/bundle/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  14. package/bundle/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  15. package/bundle/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  16. package/bundle/.next/server/app/_not-found.html +1 -1
  17. package/bundle/.next/server/app/_not-found.rsc +2 -2
  18. package/bundle/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  19. package/bundle/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  20. package/bundle/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  21. package/bundle/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  22. package/bundle/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  23. package/bundle/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  24. package/bundle/.next/server/app/accounts/page.js +1 -1
  25. package/bundle/.next/server/app/accounts/page.js.nft.json +1 -1
  26. package/bundle/.next/server/app/accounts/page_client-reference-manifest.js +1 -1
  27. package/bundle/.next/server/app/agents/page.js +1 -1
  28. package/bundle/.next/server/app/agents/page.js.nft.json +1 -1
  29. package/bundle/.next/server/app/agents/page_client-reference-manifest.js +1 -1
  30. package/bundle/.next/server/app/api/accounts/access-rules/route.js.nft.json +1 -1
  31. package/bundle/.next/server/app/api/accounts/browser-profiles/route.js.nft.json +1 -1
  32. package/bundle/.next/server/app/api/accounts/login-targets/route.js.nft.json +1 -1
  33. package/bundle/.next/server/app/api/agents/[agentId]/chat/route.js +2 -2
  34. package/bundle/.next/server/app/api/agents/[agentId]/chat/route.js.nft.json +1 -1
  35. package/bundle/.next/server/app/api/agents/route.js +1 -1
  36. package/bundle/.next/server/app/api/agents/route.js.nft.json +1 -1
  37. package/bundle/.next/server/app/api/diagnostics/route.js +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 +1 -1
  40. package/bundle/.next/server/app/api/gateway/control/route.js.nft.json +1 -1
  41. package/bundle/.next/server/app/api/integrations/[integrationId]/status/route.js.nft.json +1 -1
  42. package/bundle/.next/server/app/api/mission/route.js +2 -2
  43. package/bundle/.next/server/app/api/mission/route.js.nft.json +1 -1
  44. package/bundle/.next/server/app/api/models/catalog/route.js +1 -1
  45. package/bundle/.next/server/app/api/models/catalog/route.js.nft.json +1 -1
  46. package/bundle/.next/server/app/api/models/providers/route.js +1 -1
  47. package/bundle/.next/server/app/api/models/providers/route.js.nft.json +1 -1
  48. package/bundle/.next/server/app/api/onboarding/models/route.js +2 -2
  49. package/bundle/.next/server/app/api/onboarding/models/route.js.nft.json +1 -1
  50. package/bundle/.next/server/app/api/onboarding/route.js +2 -2
  51. package/bundle/.next/server/app/api/onboarding/route.js.nft.json +1 -1
  52. package/bundle/.next/server/app/api/openclaw/capabilities/route.js.nft.json +1 -1
  53. package/bundle/.next/server/app/api/openclaw/compatibility-smoke/route.js.nft.json +1 -1
  54. package/bundle/.next/server/app/api/planner/[planId]/deploy/route.js +1 -1
  55. package/bundle/.next/server/app/api/planner/[planId]/deploy/route.js.nft.json +1 -1
  56. package/bundle/.next/server/app/api/planner/[planId]/document-rewrite/route.js +1 -1
  57. package/bundle/.next/server/app/api/planner/[planId]/document-rewrite/route.js.nft.json +1 -1
  58. package/bundle/.next/server/app/api/planner/[planId]/route.js +1 -1
  59. package/bundle/.next/server/app/api/planner/[planId]/route.js.nft.json +1 -1
  60. package/bundle/.next/server/app/api/planner/[planId]/simulate/route.js +1 -1
  61. package/bundle/.next/server/app/api/planner/[planId]/simulate/route.js.nft.json +1 -1
  62. package/bundle/.next/server/app/api/planner/[planId]/turn/route.js +1 -1
  63. package/bundle/.next/server/app/api/planner/[planId]/turn/route.js.nft.json +1 -1
  64. package/bundle/.next/server/app/api/planner/route.js +1 -1
  65. package/bundle/.next/server/app/api/planner/route.js.nft.json +1 -1
  66. package/bundle/.next/server/app/api/reset/route.js +2 -2
  67. package/bundle/.next/server/app/api/reset/route.js.nft.json +1 -1
  68. package/bundle/.next/server/app/api/runtimes/[runtimeId]/route.js +1 -1
  69. package/bundle/.next/server/app/api/runtimes/[runtimeId]/route.js.nft.json +1 -1
  70. package/bundle/.next/server/app/api/settings/config-pacing/route.js.nft.json +1 -1
  71. package/bundle/.next/server/app/api/settings/gateway/route.js +1 -1
  72. package/bundle/.next/server/app/api/settings/gateway/route.js.nft.json +1 -1
  73. package/bundle/.next/server/app/api/settings/openclaw-binary/route.js +1 -1
  74. package/bundle/.next/server/app/api/settings/openclaw-binary/route.js.nft.json +1 -1
  75. package/bundle/.next/server/app/api/settings/workspace-root/route.js +1 -1
  76. package/bundle/.next/server/app/api/settings/workspace-root/route.js.nft.json +1 -1
  77. package/bundle/.next/server/app/api/snapshot/route.js +1 -1
  78. package/bundle/.next/server/app/api/snapshot/route.js.nft.json +1 -1
  79. package/bundle/.next/server/app/api/stream/route.js +2 -2
  80. package/bundle/.next/server/app/api/stream/route.js.nft.json +1 -1
  81. package/bundle/.next/server/app/api/tasks/[taskId]/abort/route.js +1 -1
  82. package/bundle/.next/server/app/api/tasks/[taskId]/abort/route.js.nft.json +1 -1
  83. package/bundle/.next/server/app/api/tasks/[taskId]/control/route.js +1 -1
  84. package/bundle/.next/server/app/api/tasks/[taskId]/control/route.js.nft.json +1 -1
  85. package/bundle/.next/server/app/api/tasks/[taskId]/stream/route.js +2 -2
  86. package/bundle/.next/server/app/api/tasks/[taskId]/stream/route.js.nft.json +1 -1
  87. package/bundle/.next/server/app/api/update/route.js +2 -2
  88. package/bundle/.next/server/app/api/update/route.js.nft.json +1 -1
  89. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/discovered-groups/route.js +1 -1
  90. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/discovered-groups/route.js.nft.json +1 -1
  91. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/route.js +1 -1
  92. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/route.js.nft.json +1 -1
  93. package/bundle/.next/server/app/api/workspaces/[workspaceId]/edit-draft/route.js +1 -1
  94. package/bundle/.next/server/app/api/workspaces/[workspaceId]/edit-draft/route.js.nft.json +1 -1
  95. package/bundle/.next/server/app/api/workspaces/[workspaceId]/files/route.js.nft.json +1 -1
  96. package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/discovery/route.js +1 -1
  97. package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/discovery/route.js.nft.json +1 -1
  98. package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/reconcile/route.js +1 -1
  99. package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/reconcile/route.js.nft.json +1 -1
  100. package/bundle/.next/server/app/api/workspaces/route.js +2 -2
  101. package/bundle/.next/server/app/api/workspaces/route.js.nft.json +1 -1
  102. package/bundle/.next/server/app/dashboard/page.js +1 -1
  103. package/bundle/.next/server/app/dashboard/page.js.nft.json +1 -1
  104. package/bundle/.next/server/app/dashboard/page_client-reference-manifest.js +1 -1
  105. package/bundle/.next/server/app/files/page.js +1 -1
  106. package/bundle/.next/server/app/files/page.js.nft.json +1 -1
  107. package/bundle/.next/server/app/files/page_client-reference-manifest.js +1 -1
  108. package/bundle/.next/server/app/integrations/page.js +1 -1
  109. package/bundle/.next/server/app/integrations/page.js.nft.json +1 -1
  110. package/bundle/.next/server/app/integrations/page_client-reference-manifest.js +1 -1
  111. package/bundle/.next/server/app/mission-control/page.js +1 -1
  112. package/bundle/.next/server/app/mission-control/page.js.nft.json +1 -1
  113. package/bundle/.next/server/app/mission-control/page_client-reference-manifest.js +1 -1
  114. package/bundle/.next/server/app/models/page.js +1 -1
  115. package/bundle/.next/server/app/models/page.js.nft.json +1 -1
  116. package/bundle/.next/server/app/models/page_client-reference-manifest.js +1 -1
  117. package/bundle/.next/server/app/page.js +1 -1
  118. package/bundle/.next/server/app/page.js.nft.json +1 -1
  119. package/bundle/.next/server/app/page_client-reference-manifest.js +1 -1
  120. package/bundle/.next/server/app/settings/page.js +1 -1
  121. package/bundle/.next/server/app/settings/page.js.nft.json +1 -1
  122. package/bundle/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  123. package/bundle/.next/server/app/tasks/page.js +1 -1
  124. package/bundle/.next/server/app/tasks/page.js.nft.json +1 -1
  125. package/bundle/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
  126. package/bundle/.next/server/app-paths-manifest.json +2 -2
  127. package/bundle/.next/server/chunks/4020.js +2 -2
  128. package/bundle/.next/server/chunks/4391.js +2 -2
  129. package/bundle/.next/server/chunks/4983.js +2 -2
  130. package/bundle/.next/server/chunks/5110.js +1 -1
  131. package/bundle/.next/server/chunks/7092.js +1 -1
  132. package/bundle/.next/server/chunks/7639.js +1 -1
  133. package/bundle/.next/server/chunks/{4767.js → 849.js} +11 -9
  134. package/bundle/.next/server/middleware-build-manifest.js +1 -1
  135. package/bundle/.next/server/middleware-react-loadable-manifest.js +1 -1
  136. package/bundle/.next/server/pages/404.html +1 -1
  137. package/bundle/.next/server/pages/500.html +1 -1
  138. package/bundle/.next/server/server-reference-manifest.json +1 -1
  139. package/bundle/.next/static/chunks/2125-550587dbe8706439.js +3 -0
  140. package/bundle/.next/static/chunks/5922-156b66daaaf768a5.js +174 -0
  141. package/bundle/.next/static/chunks/7197.43cef56b1689bb96.js +1 -0
  142. package/bundle/.next/static/chunks/{7442-f6bbc0b14b5ca5e5.js → 7442-305daba070b016f8.js} +10 -10
  143. package/bundle/.next/static/chunks/webpack-b743b1572b052c61.js +1 -0
  144. package/bundle/.next/static/css/b65c0ec3db2a737c.css +3 -0
  145. package/bundle/public/assets/screenshots/0.jpeg +0 -0
  146. package/bundle/public/assets/screenshots/8.jpeg +0 -0
  147. package/bundle/public/assets/screenshots/hero.jpeg +0 -0
  148. package/package.json +1 -1
  149. package/bundle/.next/static/chunks/2125-ee3186e76863c0c0.js +0 -3
  150. package/bundle/.next/static/chunks/5922-bd40755edb9a1242.js +0 -174
  151. package/bundle/.next/static/chunks/7197.9a3977e98b2a1fe9.js +0 -1
  152. package/bundle/.next/static/chunks/webpack-82d9aaa9ef1f9bdf.js +0 -1
  153. package/bundle/.next/static/css/2f74db4938189dc1.css +0 -3
  154. /package/bundle/.next/static/{9xNgkJTOL7J6_GGDUZWeG → EEOvGgtsvMlezk0mE5jQb}/_buildManifest.js +0 -0
  155. /package/bundle/.next/static/{9xNgkJTOL7J6_GGDUZWeG → EEOvGgtsvMlezk0mE5jQb}/_ssgManifest.js +0 -0
@@ -1,9 +1,9 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7442],{10597:(e,t,a)=>{"use strict";a.d(t,{fl:()=>o,CM:()=>d,Wu:()=>c,kO:()=>u});var s=a(81076),r=a(17669);function n(e){return{id:e.id,name:e.name,identityName:e.name,workspaceId:e.workspaceId,workspacePath:e.workspacePath,modelId:e.modelId,isDefault:!1,status:"standby",sessionCount:0,lastActiveAt:null,currentAction:"Provisioning in OpenClaw",activeRuntimeIds:[],heartbeat:{enabled:!!e.heartbeat.enabled,every:e.heartbeat.every??null,everyMs:null},identity:{emoji:e.emoji,theme:e.theme,source:"agentos-pending-create"},profile:{purpose:"OpenClaw is provisioning this agent. The card will activate when the live snapshot syncs.",operatingInstructions:[],responseStyle:[],outputPreference:null,sourceFiles:[]},skills:e.skills,tools:e.tools,policy:e.policy}}var i=a(72427),l=a(82711);function o(e,t,a,o,m,x,h,g,b,f,w,v,y,j,N,k,C,S,A,I,T,O,R,$,M,_,E,P,L,D,U,F,G,W,z,V,q){let J=Array.isArray(y)?y:[],K=Array.isArray(j)?j:[],B=Array.isArray(N)?N:[],H=x?e.agents.find(e=>e.id===x):null,Z=g?e.tasks.find(e=>e.id===g)??null:null,Y=Z?c(Z):null,X=null!==H,Q=H?.workspaceId??null,ee=X?e.workspaces.filter(e=>e.id===Q):m?e.workspaces.filter(e=>e.id===m):[...e.workspaces].sort((e,t)=>t.activeRuntimeIds.length-e.activeRuntimeIds.length),et=[],ea=[],es=[],er=[],en=42,ei=0,el=new Set(e.agents.map(e=>e.id));ee.forEach((g,y)=>{let j=X?e.agents.filter(e=>e.workspaceId===g.id&&e.id===x):e.agents.filter(e=>e.workspaceId===g.id),N=X?[]:z.filter(e=>e.workspaceId===g.id&&!el.has(e.id)).sort((e,t)=>e.createdAt-t.createdAt).map(n),H=new Set(N.map(e=>e.id)),Z=new Map(z.filter(e=>e.workspaceId===g.id&&e.warning).map(e=>[e.id,e.warning??""])),Q=[...j,...N],eo=X?e.tasks.filter(t=>u(t,e.agents)===g.id&&t.primaryAgentId===x):e.tasks.filter(t=>u(t,e.agents)===g.id),ed=X?[]:eo.filter(e=>!B.includes(e.key)),ec=X?eo:eo.filter(e=>!d(e,J,K,B)),eu=!X&&ed.length>0&&ed.every(e=>d(e,J,K,B)),ep=y%2,em=1160*ep+44,ex=en,eh=ex+118,eg=0,eb=()=>{0!==eg&&(eh+=340,eg=0)};if(Q.forEach((n,d)=>{let u=ec.filter(e=>c(e)===n.id).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0)),y=u.length>0;y&&eb();let j=y?em+52:em+52+318*eg,N=eh+(y?4*d:0),k=em+390,_=w&&f===n.id,z=u.some(e=>v.includes(e.id)),J=Y===n.id||z,K=u.filter(e=>p(e)).length,Q=b===n.id,ee=H.has(n.id),et=V[n.id]??Z.get(n.id)??null,en=function(e,t,a){let s=new Map;for(let r of e.channelRegistry.channels){let e=r.workspaces.find(e=>e.workspaceId===t.id)??null;if(!e)continue;let n=e.groupAssignments.filter(e=>!1!==e.enabled).filter(e=>e.agentId===a.id),i=r.primaryAgentId===a.id,l=!i&&e.agentIds.includes(a.id);if(!i&&!l&&0===n.length)continue;let o=s.get(r.type)??{surfaceIds:new Set,surfaceNames:new Set,primaryCount:0,assistantCount:0,routeCount:0};o.surfaceIds.add(r.id),o.surfaceNames.add(r.name),o.primaryCount+=+!!i,o.assistantCount+=+!!l,o.routeCount+=n.length,s.set(r.type,o)}return Array.from(s.entries()).map(([e,t])=>{let a=(0,i.rY)(e),s=[];t.primaryCount>0&&s.push(`Primary on ${t.primaryCount} ${1===t.primaryCount?"surface":"surfaces"}`),t.routeCount>0&&s.push(`Owns ${t.routeCount} ${1===t.routeCount?"route":"routes"}`),t.assistantCount>0&&s.push(`Assistant on ${t.assistantCount} ${1===t.assistantCount?"surface":"surfaces"}`);let r=t.primaryCount>0&&(t.routeCount>0||t.assistantCount>0)?"mixed":t.primaryCount>0?"primary":t.routeCount>0?"owner":"delegate";return{provider:e,label:a.label,count:t.surfaceIds.size,roleLabel:s.join(" \xb7 "),roleTone:r,accentColor:a.accentColor??null,surfaceNames:Array.from(t.surfaceNames).sort((e,t)=>e.localeCompare(t))}}).sort((e,t)=>e.label.localeCompare(t.label))}(e,g,n),ei=function(e,t,a,s){let r=new Map(e.filter(e=>e.workspaceId===a.id).map(e=>[e.id,e])),n=new Map;for(let e of t){if(e.workspaceId!==a.id||e.agentId!==s.id||"use_browser_profile"!==e.permission)continue;let t=r.get(e.targetId);if(!t)continue;let i=t.serviceId||t.primaryDomain||t.id,l=n.get(i)??{targetIds:new Set,accountNames:new Set,serviceId:t.serviceId,serviceName:t.serviceName,primaryDomain:t.primaryDomain,browserProfileName:t.browserProfileName};l.targetIds.add(t.id),l.accountNames.add(`${t.serviceName} \xb7 ${t.browserProfileName}`),n.set(i,l)}return Array.from(n.entries()).map(([e,t])=>{var a,s;let r;return{id:e,serviceId:t.serviceId,serviceName:t.serviceName,primaryDomain:t.primaryDomain,browserProfileName:t.browserProfileName,count:t.targetIds.size,roleLabel:`Can use ${t.serviceName} via ${t.browserProfileName}`,accentColor:(a=t.serviceId,s=t.primaryDomain,(r=`${a} ${s}`.toLowerCase()).includes("product-hunt")||r.includes("producthunt")?"#da552f":r.includes("gmail")||r.includes("google")?"#ea4335":r.includes("x-twitter")||r.includes("x.com")||r.includes("twitter")?"#ffffff":r.includes("github")?"#f5f5f5":r.includes("discord")?"#5865f2":r.includes("telegram")?"#26a5e4":"#facc15"),accountNames:Array.from(t.accountNames).sort((e,t)=>e.localeCompare(t))}}).sort((e,t)=>e.serviceName.localeCompare(t.serviceName))}(t,a,g,n),el=en.length+ei.length,eo=(0,l.Dl)(n.modelId,e.models),ed=(0,r.rm)((0,r.qW)(n),{x:j,y:N},q,(0,r.VO)(n.id));if(ea.push({id:n.id,type:"agent",draggable:!0,position:ed,zIndex:h===n.id?58:_?55:J?48:K>0?24:10,selected:!1,data:{agent:n,emphasis:!!X||!m||m===g.id,focused:x===n.id,pendingCreation:ee,creationWarning:et,composerFocused:_,taskFocused:J,creationPulse:h===n.id,activeTaskCount:K,chatOpen:Q,relativeTimeReferenceMs:o,modelLabel:eo,surfaceBadges:en,accountBadges:ei,onMessage:ee?void 0:C,onCreateTask:ee?void 0:S,onEdit:ee?void 0:A,onDelete:ee?void 0:I,onFocus:ee?void 0:T,onConfigureModel:ee?void 0:O,onConfigureCapabilities:ee?void 0:R,onInspect:ee?void 0:$,onOpenWorkspaceChannels:ee?void 0:M}}),en.forEach((e,t)=>{es.push({id:(0,s.Wn)(n,e.provider),type:"surface-module",draggable:!1,selectable:!1,width:64,height:64,position:(0,s.mI)(ed,t,el),zIndex:_?55:J?48:18,selected:!1,data:{agent:n,emphasis:!!X||!m||m===g.id,provider:e.provider,variant:"surface",label:e.label,anchorIndex:t+1,anchorCount:el+1,surfaceCount:e.count,surfaceNames:e.surfaceNames??[],roleLabel:e.roleLabel,roleTone:e.roleTone??"primary",accentColor:e.accentColor??null}})}),ei.forEach((e,t)=>{let a=en.length+t;es.push({id:(0,s.Gh)(n,e.id),type:"surface-module",draggable:!1,selectable:!1,width:64,height:64,position:(0,s.mI)(ed,a,el),zIndex:_?55:J?48:18,selected:!1,data:{agent:n,emphasis:!!X||!m||m===g.id,variant:"account",label:e.serviceName,anchorIndex:a+1,anchorCount:el+1,surfaceCount:e.count,surfaceNames:e.accountNames??[],roleLabel:e.roleLabel,roleTone:"delegate",accentColor:e.accentColor??null,accountId:e.id,accountServiceId:e.serviceId,accountServiceName:e.serviceName,accountPrimaryDomain:e.primaryDomain,accountBrowserProfileName:e.browserProfileName}})}),er.push(...u),u.forEach((e,t)=>{let a="string"==typeof e.metadata.bootstrapStage?e.metadata.bootstrapStage:null,s="submitting"===a||"accepted"===a||"waiting-for-heartbeat"===a||"waiting-for-runtime"===a||"runtime-observed"===a,n=v.includes(e.id);ea.push({id:e.id,type:"task",draggable:!0,selectable:!0,position:(0,r.rm)((0,r.ki)(e),{x:k,y:N+420*t+10},q,(0,r.JC)(e.id)),zIndex:s?40:n?28:10,selected:!1,data:{task:e,workspacePath:g.path,emphasis:!!X||!m||m===g.id,relativeTimeReferenceMs:o,pendingCreation:s,justCreated:n,locked:B.includes(e.key),onReply:E,onCopyPrompt:P,onHide:L,onToggleLock:D,onAbortTask:U,onInspect:F,onActiveCardChange:G,onReviewTask:W}})}),y){eh+=Math.max(420,420*u.length+44);return}(eg+=1)>=3&&eb()}),eb(),!X){let e=Math.max(eh-ex+112,700);et.push({id:g.id,type:"workspace",draggable:!1,position:{x:em,y:ex},zIndex:0,style:{width:1060,height:e},selectable:!0,selected:!1,data:{workspace:g,emphasis:!m||m===g.id,taskCardCount:ed.length,taskCardsHidden:eu,onOpenWorkspaceFiles:_,onToggleTaskCards:ed.length>0?()=>k(g.id):void 0}}),ei=Math.max(ei,e),(1===ep||y===ee.length-1)&&(en+=ei+80,ei=0)}});let eo=[...et,...ea,...es];return{nodes:eo,edges:[...function(e,t,a,s,r,n){let i=[],l=new Map(t.map(e=>[e.id,e]));for(let t of e){let e=c(t);if(!e)continue;let o=l.get(e),d=l.get(t.id);o&&d&&i.push({id:`edge:${e}:${t.id}`,source:e,target:t.id,sourceHandle:"source-right",targetHandle:"target-left",type:"simplebezier",zIndex:4,animated:p(t)||t.id===a||s.includes(t.id)||n&&e===r,data:{composerFocused:n&&e===r,taskFocused:t.id===a||s.includes(t.id)},style:{strokeWidth:p(t)&&n&&e===r?3.05:p(t)?2.95:t.id===a||s.includes(t.id)?2.82:n&&e===r?2.8:2.25}})}return i}(er,eo,g,v,f,w),...function(e,t,a){let s=[],r=new Map(e.map(e=>[e.id,e]));for(let n of e){if("surface-module"!==n.type)continue;let e=n.data.agent.id,i=r.get(e),l=r.get(n.id);i&&l&&s.push({id:`edge:${e}:${n.id}`,source:e,target:n.id,sourceHandle:"source-surface",targetHandle:"add"===n.data.variant?"target-surface-action":"target-surface",type:"simplebezier",zIndex:8,animated:!0,data:{surfaceTether:!0,surfaceAccentColor:n.data.accentColor??null,composerFocused:a&&t===e},style:{strokeWidth:a&&t===e?2.2:1.95}})}return s}(eo,f,w)]}}function d(e,t,a,s){let r=Array.isArray(t)?t:[],n=Array.isArray(a)?a:[];return!(Array.isArray(s)?s:[]).includes(e.key)&&(!!n.includes(e.key)||0!==e.runtimeIds.length&&e.runtimeIds.every(e=>r.includes(e)))}function c(e){return e.primaryAgentId||e.agentIds[0]||null}function u(e,t){if(e.workspaceId?.trim())return e.workspaceId;for(let a of[e.primaryAgentId,...e.agentIds].filter(e=>"string"==typeof e&&e.trim().length>0)){let e=t.find(e=>e.id===a)?.workspaceId;if(e)return e}return null}function p(e){return"queued"===e.status||"running"===e.status}},17669:(e,t,a)=>{"use strict";a.d(t,{IY:()=>i,JC:()=>x,JM:()=>s,Kz:()=>r,RW:()=>g,VO:()=>p,h:()=>o,ki:()=>m,nF:()=>n,qW:()=>u,rm:()=>d});let s={};function r(e){let t=h(o(e));if(null!==t)return l(t);if("all"!==e){let e=h("mission-control-node-positions");if(null!==e)return l(e)}return{}}function n(e){return Object.fromEntries(e.filter(c).map(e=>{var t;return["agent"===(t=e).type?u(t.data.agent):m(t.data.task),{x:e.position.x,y:e.position.y}]}))}function i(e,t){let a=Object.entries(e),s=Object.entries(t);return a.length===s.length&&a.every(([e,a])=>{let s=t[e];return s&&s.x===a.x&&s.y===a.y})}function l(e){try{let t=JSON.parse(e);if(!t||"object"!=typeof t)return{};let a=Object.entries(t).filter(([,e])=>"object"==typeof e&&null!==e&&"number"==typeof e.x&&Number.isFinite(e.x)&&"number"==typeof e.y&&Number.isFinite(e.y));return Object.fromEntries(a)}catch{return{}}}function o(e){return`mission-control-node-positions:v3:${e}`}function d(e,t,a,s){let r=a[e]||(s?a[s]:void 0);return r?{x:r.x,y:r.y}:t}function c(e){return"agent"===e.type||"task"===e.type}function u(e){return`agent:${e.workspaceId}:${e.id}`}function p(e){return`agent:${e}`}function m(e){return`task:${e.workspaceId||"global"}:${e.key}`}function x(e){return`task:${e}`}function h(e){let t=globalThis.localStorage;return t&&"function"==typeof t.getItem?t.getItem(e):null}function g(e,t){let a=globalThis.localStorage;a&&"function"==typeof a.setItem&&a.setItem(e,t)}},18027:(e,t,a)=>{"use strict";a.d(t,{j:()=>n});var s=a(70430);let r=[];function n(e,t,a={}){let[i,l]=(0,s.useState)({taskId:null,feed:[],detail:null}),[o,d]=(0,s.useState)(null),[c,u]=(0,s.useState)({taskId:null,message:null}),[p,m]=(0,s.useState)({taskId:null,message:null}),x="string"==typeof a.dispatchId&&a.dispatchId.trim()?a.dispatchId.trim():null,h=e.startsWith("optimistic-task:"),g=t&&h&&!x?a.optimisticFeed??r:null;(0,s.useEffect)(()=>{if(!t||g)return;let a=new URLSearchParams;x&&a.set("dispatchId",x);let s=new EventSource(`/api/tasks/${encodeURIComponent(e)}/stream${a.size>0?`?${a.toString()}`:""}`),r=t=>{try{let a=JSON.parse(t.data);"task"===a.type&&(l({taskId:e,feed:a.detail.liveFeed||[],detail:a.detail}),d(e),u({taskId:e,message:null}))}catch(t){console.error("Failed to parse task stream event",t),u({taskId:e,message:"Unable to parse task feed."})}},n=t=>{try{let a=JSON.parse(t.data);u({taskId:e,message:a.error||"Unknown error"})}catch{u({taskId:e,message:"Stream error"})}},i=t=>{try{let a=JSON.parse(t.data);if("ready"!==a.type)return;let s=a.eventBridge,r=s&&"live"!==s.mode?[s.message,s.recovery].filter(Boolean).join(" "):null;m({taskId:e,message:r})}catch{m({taskId:e,message:null})}};return s.addEventListener("task",r),s.addEventListener("task-error",n),s.addEventListener("ready",i),s.onerror=()=>{u(t=>t.taskId===e&&t.message?t:{taskId:e,message:"Task feed disconnected. Reconnecting…"})},()=>{s.close(),s.removeEventListener("task",r),s.removeEventListener("task-error",n),s.removeEventListener("ready",i)}},[e,t,x,g]);let b=g??(i.taskId===e?i.feed:[]),f=g?null:i.taskId===e?i.detail:null,w=g?null:c.taskId===e?c.message:null,v=g?null:p.taskId===e?p.message:null;return{feed:b,detail:f,loading:!g&&t&&o!==e&&null===w,error:w,streamNotice:v}}},26580:(e,t,a)=>{"use strict";a.d(t,{MissionControlShell:()=>a6});var s=a(36366),r=a(50576),n=a(15411),i=a(70430),l=a(50592),o=a(74213),d=a(47697),c=a(62071),u=a(41880),p=a(95433),m=a(44816),x=a(87408),h=a(87618),g=a(79613),b=a(67882),f=a(6658),w=a(75544),v=a(8120),y=a(19306),j=a(50243),N=a(82711),k=a(23351);let C="mission-control-recent-prompts";function S({snapshot:e,surfaceTheme:t,activeWorkspaceId:a,selectedNodeId:r,composeIntent:n,isComposerActive:l,onTargetAgentChange:o,onTargetAgentSelect:d,onComposerActiveChange:g,onRefresh:M,onOpenWorkspaceCreate:_,onOpenWorkspaceChannels:E,onMissionDispatchStart:P,onMissionDispatchFailure:L,onMissionResponse:D,onAgentCreationPending:U,onAgentCreatedVisible:F}){let G,W,[z,V]=(0,i.useState)(""),[q,J]=(0,i.useState)(""),[K,B]=(0,i.useState)("medium"),[H,Z]=(0,i.useState)(!1),[Y,X]=(0,i.useState)(!1),[Q,ee]=(0,i.useState)(!1),[et,ea]=(0,i.useState)(!1),[es,er]=(0,i.useState)(!1),[en,ei]=(0,i.useState)(!1),[el,eo]=(0,i.useState)(!1),[ed,ec]=(0,i.useState)(null),eu=(0,i.useRef)(null),ep=(0,i.useRef)(null),em=(0,i.useRef)(null),ex=(0,i.useRef)(null),eh=(0,i.useRef)(!1),eg=(0,i.useRef)(null),eb=e.workspaces.find(e=>e.id===a)??e.workspaces[0],ef=e.agents.filter(e=>!eb||e.workspaceId===eb.id),ew=ef.find(e=>e.id===q)??ef[0]??null,ev=ew?(0,N.CK)(ew):null,ey=ew?.id??null,ej=ef.map(e=>({label:(0,N.CK)(e),value:e.id})),eN=$(eb?.id??a??null,ey),ek=!!(z.trim()&&ey&&!H),eC=ev?`Compose for ${ev}...`:"Compose a mission...",eS=((G=[]).push({id:"workspace-create",label:"Create workspace",action:"open-workspace-create"}),W=new Set,G.filter(e=>{let t=`${e.action||"mission"}:${e.mission?.trim().toLowerCase()||e.label.toLowerCase()}`;return!W.has(t)&&(W.add(t),!0)}).slice(0,3)),eA=eS.length>0,eI=!l&&!Q&&0===z.trim().length&&null===ed,eT=et&&(!es||H)&&eI,eO=en&&eI||eT||!et&&!es&&eI;(0,i.useEffect)(()=>{let t=`${a??"all"}:${r??"none"}:${ef.map(e=>e.id).join(",")}`,s=function(e,t,a){let s=e.agents.find(e=>e.id===a);if(s)return s.id;let r=e.tasks.find(e=>e.id===a);if(r?.primaryAgentId)return r.primaryAgentId;let n=e.runtimes.find(e=>e.id===a);if(n?.agentId)return n.agentId;let i=e.agents.filter(e=>t?e.workspaceId===t:e.isDefault);return i.find(e=>e.isDefault)?.id||i[0]?.id||e.agents[0]?.id}(e,a,r),n=em.current;if(n&&ef.some(e=>e.id===n)){q!==n&&J(n),em.current=null;return}ep.current!==t&&(ep.current=t,s&&ef.some(e=>e.id===s))?J(s):ef.some(e=>e.id===q)||J(s&&ef.some(e=>e.id===s)?s:ef[0]?.id??"")},[e,a,r,q,ef]),(0,i.useEffect)(()=>{let e=globalThis.matchMedia("(min-width: 1024px)"),t=()=>{ea(e.matches),e.matches||er(!1)};return t(),e.addEventListener("change",t),()=>{e.removeEventListener("change",t)}},[]),(0,i.useEffect)(()=>{eo(!0)},[]),(0,i.useEffect)(()=>{var e;(e=eu.current)&&(e.style.height="0px",e.style.height=`${Math.min(e.scrollHeight,150)}px`)},[z]),(0,i.useEffect)(()=>{if(!eN||void 0===globalThis.localStorage)return;if(eg.current===eN){eg.current=null;return}let e=function(e){try{var t;let a=globalThis.localStorage.getItem(e);if(!a)return null;let s=JSON.parse(a);if("string"!=typeof s.mission)return null;return{mission:s.mission,thinking:(t=s.thinking,"off"===t||"minimal"===t||"low"===t||"medium"===t||"high"===t)?s.thinking:"medium"}}catch{return null}}(eN);eh.current=!0,V(e?.mission??""),B(e?.thinking??"medium"),ec(null)},[eN]),(0,i.useEffect)(()=>{if(eN&&void 0!==globalThis.localStorage){if(eh.current){eh.current=!1;return}!function(e,t){try{if(!t.mission.trim()&&"medium"===t.thinking)return void globalThis.localStorage.removeItem(e);globalThis.localStorage.setItem(e,JSON.stringify(t))}catch{}}(eN,{mission:z,thinking:K})}},[eN,z,K]),(0,i.useEffect)(()=>{l&&!H&&requestAnimationFrame(()=>{eu.current?.focus();let e=eu.current?.value??"";eu.current?.setSelectionRange(e.length,e.length)})},[l,H,q]),(0,i.useEffect)(()=>{o?.(ey??null)},[ey,o]),(0,i.useEffect)(()=>{if(!n||ex.current===n.id)return;ex.current=n.id;let e=n.mission.trim();if(!e)return;let t=$(eb?.id??a??null,n.agentId??ey);t&&(eg.current=t);let s=0===z.trim().length||z.trim()===e;ec({id:n.id,mission:e,sourceKind:n.sourceKind??"copy",sourceLabel:n.sourceLabel??"selected runtime"}),s&&V(e),n.agentId&&J(n.agentId),requestAnimationFrame(()=>{eu.current?.focus(),s&&eu.current?.setSelectionRange(e.length,e.length)})},[n,z,a,ey,eb?.id]);let eR=async e=>{let t=e.mission.trim();if(!t)return;Z(!0),ei(!0);let s=e.agentId||ey,r=Date.now(),n=globalThis.crypto?.randomUUID?.()||`dispatch:${r}`,i=new AbortController;eh.current=!0,V(""),ec(null),ee(!1),er(!1),g?.(!1),s&&P({requestId:n,mission:t,agentId:s,workspaceId:eb?.id??a??null,submittedAt:r,abortController:i});try{var l;let o=await fetch("/api/mission",{method:"POST",headers:{"Content-Type":"application/json"},signal:i.signal,body:JSON.stringify({...e,mission:t})}),d=await o.json();if(!o.ok||d.error)throw Error(d.error||"OpenClaw rejected the mission.");D(d,{requestId:n}),eN&&void 0!==globalThis.localStorage&&globalThis.localStorage.removeItem(eN),s&&function(e){let t=[e,...(function(){try{let e=globalThis.localStorage.getItem(C);if(!e)return[];let t=JSON.parse(e);if(!Array.isArray(t))return[];return t.filter(e=>"object"==typeof e&&null!==e&&"string"==typeof e.id&&"string"==typeof e.mission&&"string"==typeof e.agentId&&"string"==typeof e.agentName&&"number"==typeof e.submittedAt).slice(0,6)}catch{return[]}})().filter(t=>t.mission.trim()!==e.mission.trim()||t.agentId!==e.agentId||t.workspaceId!==e.workspaceId)].slice(0,6);try{globalThis.localStorage.setItem(C,JSON.stringify(t))}catch{}}({id:globalThis.crypto?.randomUUID?.()||`${r}`,mission:t,agentId:s,agentName:ev??"Agent",workspaceId:eb?.id??a,workspaceName:eb?.name??null,submittedAt:r});let c="string"==typeof d.meta?.outputDirRelative?`${d.status} via ${d.agentId} \xb7 ${d.meta.outputDirRelative}`:`${d.status} via ${d.agentId}`,u="stalled"===d.status&&(l=d.summary,"string"==typeof l&&(/No transcript file was found for this runtime session/i.test(l)||/No transcript entries were found for this runtime/i.test(l)));"stalled"!==d.status||u?j.o.success(u?"Mission is running silently.":"Mission queued in OpenClaw.",{description:u?"AgentOS is waiting for the first transcript update.":c}):j.o.error("Mission could not start.",{description:d.summary||c}),M().catch(()=>null)}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;L(n,e instanceof Error?e.message:"Unknown mission error."),V(t),ec(ed),ee(Q),ei(!1),er(!0),g?.(!0),requestAnimationFrame(()=>{eu.current?.focus(),eu.current?.setSelectionRange(t.length,t.length)}),j.o.error("Mission dispatch failed.",{description:e instanceof Error?e.message:"Unknown mission error."})}finally{Z(!1)}},e$=(e,t={})=>{ei(!1),t.thinking&&B(t.thinking),V(a=>{var s,r;let n,i;return"replace"===t.mode?e:(s=a,r=e,n=s.trim(),i=r.trim(),n?i?`${n}
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7442],{10597:(e,t,a)=>{"use strict";a.d(t,{fl:()=>o,CM:()=>d,Wu:()=>c,kO:()=>u});var s=a(81076),r=a(17669);function n(e){return{id:e.id,name:e.name,identityName:e.name,workspaceId:e.workspaceId,workspacePath:e.workspacePath,modelId:e.modelId,isDefault:!1,status:"standby",sessionCount:0,lastActiveAt:null,currentAction:"Provisioning in OpenClaw",activeRuntimeIds:[],heartbeat:{enabled:!!e.heartbeat.enabled,every:e.heartbeat.every??null,everyMs:null},identity:{emoji:e.emoji,theme:e.theme,source:"agentos-pending-create"},profile:{purpose:"OpenClaw is provisioning this agent. The card will activate when the live snapshot syncs.",operatingInstructions:[],responseStyle:[],outputPreference:null,sourceFiles:[]},skills:e.skills,tools:e.tools,policy:e.policy}}var i=a(72427),l=a(82711);function o(e,t,a,o,m,x,h,g,b,f,w,v,y,j,N,k,C,S,A,I,T,O,_,R,$,M,E,P,L,D,U,F,G,W,z,V,q){let J=Array.isArray(y)?y:[],K=Array.isArray(j)?j:[],B=Array.isArray(N)?N:[],H=x?e.agents.find(e=>e.id===x):null,Z=g?e.tasks.find(e=>e.id===g)??null:null,Y=Z?c(Z):null,X=null!==H,Q=H?.workspaceId??null,ee=X?e.workspaces.filter(e=>e.id===Q):m?e.workspaces.filter(e=>e.id===m):[...e.workspaces].sort((e,t)=>t.activeRuntimeIds.length-e.activeRuntimeIds.length),et=[],ea=[],es=[],er=[],en=42,ei=0,el=new Set(e.agents.map(e=>e.id));ee.forEach((g,y)=>{let j=X?e.agents.filter(e=>e.workspaceId===g.id&&e.id===x):e.agents.filter(e=>e.workspaceId===g.id),N=X?[]:z.filter(e=>e.workspaceId===g.id&&!el.has(e.id)).sort((e,t)=>e.createdAt-t.createdAt).map(n),H=new Set(N.map(e=>e.id)),Z=new Map(z.filter(e=>e.workspaceId===g.id&&e.warning).map(e=>[e.id,e.warning??""])),Q=[...j,...N],eo=X?e.tasks.filter(t=>u(t,e.agents)===g.id&&t.primaryAgentId===x):e.tasks.filter(t=>u(t,e.agents)===g.id),ed=X?[]:eo.filter(e=>!B.includes(e.key)),ec=X?eo:eo.filter(e=>!d(e,J,K,B)),eu=!X&&ed.length>0&&ed.every(e=>d(e,J,K,B)),ep=y%2,em=1160*ep+44,ex=en,eh=ex+118,eg=0,eb=()=>{0!==eg&&(eh+=340,eg=0)};if(Q.forEach((n,d)=>{let u=ec.filter(e=>c(e)===n.id).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0)),y=u.length>0;y&&eb();let j=y?em+52:em+52+318*eg,N=eh+(y?4*d:0),k=em+390,M=w&&f===n.id,z=u.some(e=>v.includes(e.id)),J=Y===n.id||z,K=u.filter(e=>p(e)).length,Q=b===n.id,ee=H.has(n.id),et=V[n.id]??Z.get(n.id)??null,en=function(e,t,a){let s=new Map;for(let r of e.channelRegistry.channels){let e=r.workspaces.find(e=>e.workspaceId===t.id)??null;if(!e)continue;let n=e.groupAssignments.filter(e=>!1!==e.enabled).filter(e=>e.agentId===a.id),i=r.primaryAgentId===a.id,l=!i&&e.agentIds.includes(a.id);if(!i&&!l&&0===n.length)continue;let o=s.get(r.type)??{surfaceIds:new Set,surfaceNames:new Set,primaryCount:0,assistantCount:0,routeCount:0};o.surfaceIds.add(r.id),o.surfaceNames.add(r.name),o.primaryCount+=+!!i,o.assistantCount+=+!!l,o.routeCount+=n.length,s.set(r.type,o)}return Array.from(s.entries()).map(([e,t])=>{let a=(0,i.rY)(e),s=[];t.primaryCount>0&&s.push(`Primary on ${t.primaryCount} ${1===t.primaryCount?"surface":"surfaces"}`),t.routeCount>0&&s.push(`Owns ${t.routeCount} ${1===t.routeCount?"route":"routes"}`),t.assistantCount>0&&s.push(`Assistant on ${t.assistantCount} ${1===t.assistantCount?"surface":"surfaces"}`);let r=t.primaryCount>0&&(t.routeCount>0||t.assistantCount>0)?"mixed":t.primaryCount>0?"primary":t.routeCount>0?"owner":"delegate";return{provider:e,label:a.label,count:t.surfaceIds.size,roleLabel:s.join(" \xb7 "),roleTone:r,accentColor:a.accentColor??null,surfaceNames:Array.from(t.surfaceNames).sort((e,t)=>e.localeCompare(t))}}).sort((e,t)=>e.label.localeCompare(t.label))}(e,g,n),ei=function(e,t,a,s){let r=new Map(e.filter(e=>e.workspaceId===a.id).map(e=>[e.id,e])),n=new Map;for(let e of t){if(e.workspaceId!==a.id||e.agentId!==s.id||"use_browser_profile"!==e.permission)continue;let t=r.get(e.targetId);if(!t)continue;let i=t.serviceId||t.primaryDomain||t.id,l=n.get(i)??{targetIds:new Set,accountNames:new Set,serviceId:t.serviceId,serviceName:t.serviceName,primaryDomain:t.primaryDomain,browserProfileName:t.browserProfileName};l.targetIds.add(t.id),l.accountNames.add(`${t.serviceName} \xb7 ${t.browserProfileName}`),n.set(i,l)}return Array.from(n.entries()).map(([e,t])=>{var a,s;let r;return{id:e,serviceId:t.serviceId,serviceName:t.serviceName,primaryDomain:t.primaryDomain,browserProfileName:t.browserProfileName,count:t.targetIds.size,roleLabel:`Can use ${t.serviceName} via ${t.browserProfileName}`,accentColor:(a=t.serviceId,s=t.primaryDomain,(r=`${a} ${s}`.toLowerCase()).includes("product-hunt")||r.includes("producthunt")?"#da552f":r.includes("gmail")||r.includes("google")?"#ea4335":r.includes("x-twitter")||r.includes("x.com")||r.includes("twitter")?"#ffffff":r.includes("github")?"#f5f5f5":r.includes("discord")?"#5865f2":r.includes("telegram")?"#26a5e4":"#facc15"),accountNames:Array.from(t.accountNames).sort((e,t)=>e.localeCompare(t))}}).sort((e,t)=>e.serviceName.localeCompare(t.serviceName))}(t,a,g,n),el=en.length+ei.length,eo=(0,l.Dl)(n.modelId,e.models),ed=(0,r.rm)((0,r.qW)(n),{x:j,y:N},q,(0,r.VO)(n.id));if(ea.push({id:n.id,type:"agent",draggable:!0,position:ed,zIndex:h===n.id?58:M?55:J?48:K>0?24:10,selected:!1,data:{agent:n,emphasis:!!X||!m||m===g.id,focused:x===n.id,pendingCreation:ee,creationWarning:et,composerFocused:M,taskFocused:J,creationPulse:h===n.id,activeTaskCount:K,chatOpen:Q,relativeTimeReferenceMs:o,modelLabel:eo,surfaceBadges:en,accountBadges:ei,onMessage:ee?void 0:C,onCreateTask:ee?void 0:S,onEdit:ee?void 0:A,onDelete:ee?void 0:I,onFocus:ee?void 0:T,onConfigureModel:ee?void 0:O,onConfigureCapabilities:ee?void 0:_,onInspect:ee?void 0:R,onOpenWorkspaceChannels:ee?void 0:$}}),en.forEach((e,t)=>{es.push({id:(0,s.Wn)(n,e.provider),type:"surface-module",draggable:!1,selectable:!1,width:64,height:64,position:(0,s.mI)(ed,t,el),zIndex:M?55:J?48:18,selected:!1,data:{agent:n,emphasis:!!X||!m||m===g.id,provider:e.provider,variant:"surface",label:e.label,anchorIndex:t+1,anchorCount:el+1,surfaceCount:e.count,surfaceNames:e.surfaceNames??[],roleLabel:e.roleLabel,roleTone:e.roleTone??"primary",accentColor:e.accentColor??null}})}),ei.forEach((e,t)=>{let a=en.length+t;es.push({id:(0,s.Gh)(n,e.id),type:"surface-module",draggable:!1,selectable:!1,width:64,height:64,position:(0,s.mI)(ed,a,el),zIndex:M?55:J?48:18,selected:!1,data:{agent:n,emphasis:!!X||!m||m===g.id,variant:"account",label:e.serviceName,anchorIndex:a+1,anchorCount:el+1,surfaceCount:e.count,surfaceNames:e.accountNames??[],roleLabel:e.roleLabel,roleTone:"delegate",accentColor:e.accentColor??null,accountId:e.id,accountServiceId:e.serviceId,accountServiceName:e.serviceName,accountPrimaryDomain:e.primaryDomain,accountBrowserProfileName:e.browserProfileName}})}),er.push(...u),u.forEach((e,t)=>{let a="string"==typeof e.metadata.bootstrapStage?e.metadata.bootstrapStage:null,s="submitting"===a||"accepted"===a||"waiting-for-heartbeat"===a||"waiting-for-runtime"===a||"runtime-observed"===a,n=v.includes(e.id);ea.push({id:e.id,type:"task",draggable:!0,selectable:!0,position:(0,r.rm)((0,r.ki)(e),{x:k,y:N+420*t+10},q,(0,r.JC)(e.id)),zIndex:s?40:n?28:10,selected:!1,data:{task:e,workspacePath:g.path,emphasis:!!X||!m||m===g.id,relativeTimeReferenceMs:o,pendingCreation:s,justCreated:n,locked:B.includes(e.key),onReply:E,onCopyPrompt:P,onHide:L,onToggleLock:D,onAbortTask:U,onInspect:F,onActiveCardChange:G,onReviewTask:W}})}),y){eh+=Math.max(420,420*u.length+44);return}(eg+=1)>=3&&eb()}),eb(),!X){let e=Math.max(eh-ex+112,700);et.push({id:g.id,type:"workspace",draggable:!1,position:{x:em,y:ex},zIndex:0,style:{width:1060,height:e},selectable:!0,selected:!1,data:{workspace:g,emphasis:!m||m===g.id,taskCardCount:ed.length,taskCardsHidden:eu,onOpenWorkspaceFiles:M,onToggleTaskCards:ed.length>0?()=>k(g.id):void 0}}),ei=Math.max(ei,e),(1===ep||y===ee.length-1)&&(en+=ei+80,ei=0)}});let eo=[...et,...ea,...es];return{nodes:eo,edges:[...function(e,t,a,s,r,n){let i=[],l=new Map(t.map(e=>[e.id,e]));for(let t of e){let e=c(t);if(!e)continue;let o=l.get(e),d=l.get(t.id);o&&d&&i.push({id:`edge:${e}:${t.id}`,source:e,target:t.id,sourceHandle:"source-right",targetHandle:"target-left",type:"simplebezier",zIndex:4,animated:p(t)||t.id===a||s.includes(t.id)||n&&e===r,data:{composerFocused:n&&e===r,taskFocused:t.id===a||s.includes(t.id)},style:{strokeWidth:p(t)&&n&&e===r?3.05:p(t)?2.95:t.id===a||s.includes(t.id)?2.82:n&&e===r?2.8:2.25}})}return i}(er,eo,g,v,f,w),...function(e,t,a){let s=[],r=new Map(e.map(e=>[e.id,e]));for(let n of e){if("surface-module"!==n.type)continue;let e=n.data.agent.id,i=r.get(e),l=r.get(n.id);i&&l&&s.push({id:`edge:${e}:${n.id}`,source:e,target:n.id,sourceHandle:"source-surface",targetHandle:"add"===n.data.variant?"target-surface-action":"target-surface",type:"simplebezier",zIndex:8,animated:!0,data:{surfaceTether:!0,surfaceAccentColor:n.data.accentColor??null,composerFocused:a&&t===e},style:{strokeWidth:a&&t===e?2.2:1.95}})}return s}(eo,f,w)]}}function d(e,t,a,s){let r=Array.isArray(t)?t:[],n=Array.isArray(a)?a:[];return!(Array.isArray(s)?s:[]).includes(e.key)&&(!!n.includes(e.key)||0!==e.runtimeIds.length&&e.runtimeIds.every(e=>r.includes(e)))}function c(e){return e.primaryAgentId||e.agentIds[0]||null}function u(e,t){if(e.workspaceId?.trim())return e.workspaceId;for(let a of[e.primaryAgentId,...e.agentIds].filter(e=>"string"==typeof e&&e.trim().length>0)){let e=t.find(e=>e.id===a)?.workspaceId;if(e)return e}return null}function p(e){return"queued"===e.status||"running"===e.status}},17669:(e,t,a)=>{"use strict";a.d(t,{IY:()=>i,JC:()=>x,JM:()=>s,Kz:()=>r,RW:()=>g,VO:()=>p,h:()=>o,ki:()=>m,nF:()=>n,qW:()=>u,rm:()=>d});let s={};function r(e){let t=h(o(e));if(null!==t)return l(t);if("all"!==e){let e=h("mission-control-node-positions");if(null!==e)return l(e)}return{}}function n(e){return Object.fromEntries(e.filter(c).map(e=>{var t;return["agent"===(t=e).type?u(t.data.agent):m(t.data.task),{x:e.position.x,y:e.position.y}]}))}function i(e,t){let a=Object.entries(e),s=Object.entries(t);return a.length===s.length&&a.every(([e,a])=>{let s=t[e];return s&&s.x===a.x&&s.y===a.y})}function l(e){try{let t=JSON.parse(e);if(!t||"object"!=typeof t)return{};let a=Object.entries(t).filter(([,e])=>"object"==typeof e&&null!==e&&"number"==typeof e.x&&Number.isFinite(e.x)&&"number"==typeof e.y&&Number.isFinite(e.y));return Object.fromEntries(a)}catch{return{}}}function o(e){return`mission-control-node-positions:v3:${e}`}function d(e,t,a,s){let r=a[e]||(s?a[s]:void 0);return r?{x:r.x,y:r.y}:t}function c(e){return"agent"===e.type||"task"===e.type}function u(e){return`agent:${e.workspaceId}:${e.id}`}function p(e){return`agent:${e}`}function m(e){return`task:${e.workspaceId||"global"}:${e.key}`}function x(e){return`task:${e}`}function h(e){let t=globalThis.localStorage;return t&&"function"==typeof t.getItem?t.getItem(e):null}function g(e,t){let a=globalThis.localStorage;a&&"function"==typeof a.setItem&&a.setItem(e,t)}},18027:(e,t,a)=>{"use strict";a.d(t,{j:()=>n});var s=a(70430);let r=[];function n(e,t,a={}){let[i,l]=(0,s.useState)({taskId:null,feed:[],detail:null}),[o,d]=(0,s.useState)(null),[c,u]=(0,s.useState)({taskId:null,message:null}),[p,m]=(0,s.useState)({taskId:null,message:null}),x="string"==typeof a.dispatchId&&a.dispatchId.trim()?a.dispatchId.trim():null,h=e.startsWith("optimistic-task:"),g=t&&h&&!x?a.optimisticFeed??r:null;(0,s.useEffect)(()=>{if(!t||g)return;let a=new URLSearchParams;x&&a.set("dispatchId",x);let s=new EventSource(`/api/tasks/${encodeURIComponent(e)}/stream${a.size>0?`?${a.toString()}`:""}`),r=t=>{try{let a=JSON.parse(t.data);"task"===a.type&&(l({taskId:e,feed:a.detail.liveFeed||[],detail:a.detail}),d(e),u({taskId:e,message:null}))}catch(t){console.error("Failed to parse task stream event",t),u({taskId:e,message:"Unable to parse task feed."})}},n=t=>{try{let a=JSON.parse(t.data);u({taskId:e,message:a.error||"Unknown error"})}catch{u({taskId:e,message:"Stream error"})}},i=t=>{try{let a=JSON.parse(t.data);if("ready"!==a.type)return;let s=a.eventBridge,r=s&&"live"!==s.mode?[s.message,s.recovery].filter(Boolean).join(" "):null;m({taskId:e,message:r})}catch{m({taskId:e,message:null})}};return s.addEventListener("task",r),s.addEventListener("task-error",n),s.addEventListener("ready",i),s.onerror=()=>{u(t=>t.taskId===e&&t.message?t:{taskId:e,message:"Task feed disconnected. Reconnecting…"})},()=>{s.close(),s.removeEventListener("task",r),s.removeEventListener("task-error",n),s.removeEventListener("ready",i)}},[e,t,x,g]);let b=g??(i.taskId===e?i.feed:[]),f=g?null:i.taskId===e?i.detail:null,w=g?null:c.taskId===e?c.message:null,v=g?null:p.taskId===e?p.message:null;return{feed:b,detail:f,loading:!g&&t&&o!==e&&null===w,error:w,streamNotice:v}}},26580:(e,t,a)=>{"use strict";a.d(t,{MissionControlShell:()=>a6});var s=a(36366),r=a(50576),n=a(15411),i=a(70430),l=a(50592),o=a(74213),d=a(47697),c=a(62071),u=a(41880),p=a(95433),m=a(44816),x=a(87408),h=a(87618),g=a(79613),b=a(67882),f=a(6658),w=a(75544),v=a(8120),y=a(19306),j=a(50243),N=a(82711),k=a(23351);let C="mission-control-recent-prompts";function S({snapshot:e,surfaceTheme:t,activeWorkspaceId:a,selectedNodeId:r,composeIntent:n,isComposerActive:l,onTargetAgentChange:o,onTargetAgentSelect:d,onComposerActiveChange:g,onRefresh:$,onOpenWorkspaceCreate:M,onOpenWorkspaceChannels:E,onMissionDispatchStart:P,onMissionDispatchFailure:L,onMissionResponse:D,onAgentCreationPending:U,onAgentCreatedVisible:F}){let G,W,[z,V]=(0,i.useState)(""),[q,J]=(0,i.useState)(""),[K,B]=(0,i.useState)("medium"),[H,Z]=(0,i.useState)(!1),[Y,X]=(0,i.useState)(!1),[Q,ee]=(0,i.useState)(!1),[et,ea]=(0,i.useState)(!1),[es,er]=(0,i.useState)(!1),[en,ei]=(0,i.useState)(!1),[el,eo]=(0,i.useState)(!1),[ed,ec]=(0,i.useState)(null),eu=(0,i.useRef)(null),ep=(0,i.useRef)(null),em=(0,i.useRef)(null),ex=(0,i.useRef)(null),eh=(0,i.useRef)(!1),eg=(0,i.useRef)(null),eb=e.workspaces.find(e=>e.id===a)??e.workspaces[0],ef=e.agents.filter(e=>!eb||e.workspaceId===eb.id),ew=ef.find(e=>e.id===q)??ef[0]??null,ev=ew?(0,N.CK)(ew):null,ey=ew?.id??null,ej=ef.map(e=>({label:(0,N.CK)(e),value:e.id})),eN=R(eb?.id??a??null,ey),ek=!!(z.trim()&&ey&&!H),eC=ev?`Compose for ${ev}...`:"Compose a mission...",eS=((G=[]).push({id:"workspace-create",label:"Create workspace",action:"open-workspace-create"}),W=new Set,G.filter(e=>{let t=`${e.action||"mission"}:${e.mission?.trim().toLowerCase()||e.label.toLowerCase()}`;return!W.has(t)&&(W.add(t),!0)}).slice(0,3)),eA=eS.length>0,eI=!l&&!Q&&0===z.trim().length&&null===ed,eT=et&&(!es||H)&&eI,eO=en&&eI||eT||!et&&!es&&eI;(0,i.useEffect)(()=>{let t=`${a??"all"}:${r??"none"}:${ef.map(e=>e.id).join(",")}`,s=function(e,t,a){let s=e.agents.find(e=>e.id===a);if(s)return s.id;let r=e.tasks.find(e=>e.id===a);if(r?.primaryAgentId)return r.primaryAgentId;let n=e.runtimes.find(e=>e.id===a);if(n?.agentId)return n.agentId;let i=e.agents.filter(e=>t?e.workspaceId===t:e.isDefault);return i.find(e=>e.isDefault)?.id||i[0]?.id||e.agents[0]?.id}(e,a,r),n=em.current;if(n&&ef.some(e=>e.id===n)){q!==n&&J(n),em.current=null;return}ep.current!==t&&(ep.current=t,s&&ef.some(e=>e.id===s))?J(s):ef.some(e=>e.id===q)||J(s&&ef.some(e=>e.id===s)?s:ef[0]?.id??"")},[e,a,r,q,ef]),(0,i.useEffect)(()=>{let e=globalThis.matchMedia("(min-width: 1024px)"),t=()=>{ea(e.matches),e.matches||er(!1)};return t(),e.addEventListener("change",t),()=>{e.removeEventListener("change",t)}},[]),(0,i.useEffect)(()=>{eo(!0)},[]),(0,i.useEffect)(()=>{var e;(e=eu.current)&&(e.style.height="0px",e.style.height=`${Math.min(e.scrollHeight,150)}px`)},[z]),(0,i.useEffect)(()=>{if(!eN||void 0===globalThis.localStorage)return;if(eg.current===eN){eg.current=null;return}let e=function(e){try{var t;let a=globalThis.localStorage.getItem(e);if(!a)return null;let s=JSON.parse(a);if("string"!=typeof s.mission)return null;return{mission:s.mission,thinking:(t=s.thinking,"off"===t||"minimal"===t||"low"===t||"medium"===t||"high"===t)?s.thinking:"medium"}}catch{return null}}(eN);eh.current=!0,V(e?.mission??""),B(e?.thinking??"medium"),ec(null)},[eN]),(0,i.useEffect)(()=>{if(eN&&void 0!==globalThis.localStorage){if(eh.current){eh.current=!1;return}!function(e,t){try{if(!t.mission.trim()&&"medium"===t.thinking)return void globalThis.localStorage.removeItem(e);globalThis.localStorage.setItem(e,JSON.stringify(t))}catch{}}(eN,{mission:z,thinking:K})}},[eN,z,K]),(0,i.useEffect)(()=>{l&&!H&&requestAnimationFrame(()=>{eu.current?.focus();let e=eu.current?.value??"";eu.current?.setSelectionRange(e.length,e.length)})},[l,H,q]),(0,i.useEffect)(()=>{o?.(ey??null)},[ey,o]),(0,i.useEffect)(()=>{if(!n||ex.current===n.id)return;ex.current=n.id;let e=n.mission.trim();if(!e)return;let t=R(eb?.id??a??null,n.agentId??ey);t&&(eg.current=t);let s=0===z.trim().length||z.trim()===e;ec({id:n.id,mission:e,sourceKind:n.sourceKind??"copy",sourceLabel:n.sourceLabel??"selected runtime"}),s&&V(e),n.agentId&&J(n.agentId),requestAnimationFrame(()=>{eu.current?.focus(),s&&eu.current?.setSelectionRange(e.length,e.length)})},[n,z,a,ey,eb?.id]);let e_=async e=>{let t=e.mission.trim();if(!t)return;Z(!0),ei(!0);let s=e.agentId||ey,r=Date.now(),n=globalThis.crypto?.randomUUID?.()||`dispatch:${r}`,i=new AbortController;eh.current=!0,V(""),ec(null),ee(!1),er(!1),g?.(!1),s&&P({requestId:n,mission:t,agentId:s,workspaceId:eb?.id??a??null,submittedAt:r,abortController:i});try{var l;let o=await fetch("/api/mission",{method:"POST",headers:{"Content-Type":"application/json"},signal:i.signal,body:JSON.stringify({...e,mission:t})}),d=await o.json();if(!o.ok||d.error)throw Error(d.error||"OpenClaw rejected the mission.");D(d,{requestId:n}),eN&&void 0!==globalThis.localStorage&&globalThis.localStorage.removeItem(eN),s&&function(e){let t=[e,...(function(){try{let e=globalThis.localStorage.getItem(C);if(!e)return[];let t=JSON.parse(e);if(!Array.isArray(t))return[];return t.filter(e=>"object"==typeof e&&null!==e&&"string"==typeof e.id&&"string"==typeof e.mission&&"string"==typeof e.agentId&&"string"==typeof e.agentName&&"number"==typeof e.submittedAt).slice(0,6)}catch{return[]}})().filter(t=>t.mission.trim()!==e.mission.trim()||t.agentId!==e.agentId||t.workspaceId!==e.workspaceId)].slice(0,6);try{globalThis.localStorage.setItem(C,JSON.stringify(t))}catch{}}({id:globalThis.crypto?.randomUUID?.()||`${r}`,mission:t,agentId:s,agentName:ev??"Agent",workspaceId:eb?.id??a,workspaceName:eb?.name??null,submittedAt:r});let c="string"==typeof d.meta?.outputDirRelative?`${d.status} via ${d.agentId} \xb7 ${d.meta.outputDirRelative}`:`${d.status} via ${d.agentId}`,u="stalled"===d.status&&(l=d.summary,"string"==typeof l&&(/No transcript file was found for this runtime session/i.test(l)||/No transcript entries were found for this runtime/i.test(l)));"stalled"!==d.status||u?j.o.success(u?"Mission is running silently.":"Mission queued in OpenClaw.",{description:u?"AgentOS is waiting for the first transcript update.":c}):j.o.error("Mission could not start.",{description:d.summary||c}),$().catch(()=>null)}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;L(n,e instanceof Error?e.message:"Unknown mission error."),V(t),ec(ed),ee(Q),ei(!1),er(!0),g?.(!0),requestAnimationFrame(()=>{eu.current?.focus(),eu.current?.setSelectionRange(t.length,t.length)}),j.o.error("Mission dispatch failed.",{description:e instanceof Error?e.message:"Unknown mission error."})}finally{Z(!1)}},eR=(e,t={})=>{ei(!1),t.thinking&&B(t.thinking),V(a=>{var s,r;let n,i;return"replace"===t.mode?e:(s=a,r=e,n=s.trim(),i=r.trim(),n?i?`${n}
2
2
 
3
- ${i}`:n:i)}),requestAnimationFrame(()=>{eu.current?.focus();let e=eu.current?.value??"";eu.current?.setSelectionRange(e.length,e.length)})};return(0,s.jsx)("div",{className:(0,k.cn)("mx-auto w-full transition-[width,max-width] duration-300",eO&&"max-w-[360px]",eT&&"lg:w-[360px]"),onMouseEnter:()=>{et&&!H&&er(!0)},onMouseLeave:()=>{et&&!H&&er(!1)},children:(0,s.jsx)(b.N,{initial:!1,mode:"wait",children:eO?(0,s.jsx)(f.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:H,onFocus:()=>{H||er(!0)},onClick:()=>{H||(ei(!1),er(!0),requestAnimationFrame(()=>{eu.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,s.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,s.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:ev||"No agent"}),(0,s.jsx)("p",{className:"min-w-0 flex-1 truncate text-[13px] text-[#f6eee5]/58",children:H?"Creating task...":eC}),(0,s.jsxs)("span",{className:"inline-flex h-8 items-center rounded-full bg-white px-3 text-[12px] font-medium text-slate-950",children:[H?(0,s.jsx)(c.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(u.A,{className:"mr-1.5 h-3.5 w-3.5"}),H?"Creating":"Create task"]})]})},"collapsed"):(0,s.jsxs)(f.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,s.jsx)(b.N,{initial:!1,children:ed?(0,s.jsxs)(f.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,s.jsxs)("span",{className:"truncate",children:["From ",ed.sourceLabel]}),(0,s.jsx)("button",{type:"button",className:"text-slate-200 transition-colors hover:text-white",onClick:()=>e$(ed.mission,{mode:"replace"}),children:"Replace"}),(0,s.jsx)("button",{type:"button",className:"text-slate-200 transition-colors hover:text-white",onClick:()=>e$(ed.mission),children:"Append"}),(0,s.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:()=>ec(null),"aria-label":"Dismiss runtime suggestion",children:(0,s.jsx)(p.A,{className:"h-3.5 w-3.5"})})]}):null}),(0,s.jsxs)("div",{className:(0,k.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",l&&"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:()=>{ei(!1),g?.(!0)},onBlurCapture:e=>{let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||(g?.(!1),et||0!==z.trim().length||Q||null!==ed||er(!1))},children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-2.5 pb-1 pt-2.5",children:[ew?(0,s.jsx)(A,{value:q,options:ej,onChange:e=>{ei(!1),J(e),d?.(e)}}):(0,s.jsx)(R,{children:"No agent"}),(0,s.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,s.jsx)(T,{label:"Refresh AgentOS",onClick:async()=>{X(!0),await M(),X(!1)},children:Y?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(m.A,{className:"h-3.5 w-3.5"})}),(0,s.jsx)(T,{label:"Create workspace",onClick:_,children:(0,s.jsx)(x.A,{className:"h-3.5 w-3.5"})}),(0,s.jsx)(T,{label:"Composer settings",onClick:()=>ee(e=>!e),active:Q||"medium"!==K,children:(0,s.jsxs)("span",{className:"relative inline-flex",children:[(0,s.jsx)(h.A,{className:"h-3.5 w-3.5"}),"medium"!==K?(0,s.jsx)("span",{className:"absolute -right-1 -top-1 h-1.5 w-1.5 rounded-full bg-white/80"}):null]})})]})]}),(0,s.jsx)("div",{className:"px-2.5 pt-0.5",children:(0,s.jsx)(y.T,{ref:eu,value:z,onChange:e=>{ei(!1),V(e.target.value)},onKeyDown:async e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),ek&&ey&&await eR({mission:z,agentId:ey,workspaceId:a??void 0,thinking:K}))},placeholder:eC,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,s.jsxs)("div",{className:"flex items-end justify-between gap-2.5 px-2.5 pb-2.5 pt-1.5",children:[(0,s.jsx)(b.N,{initial:!1,children:eA?(0,s.jsxs)(f.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:[eS.map(e=>(0,s.jsx)(O,{label:e.label,onClick:()=>{"open-workspace-create"===e.action?_():e.mission&&e$(e.mission,{thinking:e.thinking})}},e.id)),eb?(0,s.jsx)(w.O,{snapshot:e,defaultWorkspaceId:eb.id,onRefresh:M,onAgentCreationPending:U,onAgentCreated:e=>{em.current=e,J(e)},onAgentCreatedVisible:F,surfaceTheme:t,trigger:(0,s.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,el&&eb?(0,s.jsx)("button",{type:"button",onClick:()=>E(),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,s.jsx)("div",{})}),(0,s.jsxs)(v.$,{className:"h-9 rounded-full bg-white px-3.5 text-slate-950 shadow-none hover:bg-white/92",disabled:!ek,onClick:async()=>{ey&&await eR({mission:z,agentId:ey,workspaceId:a??void 0,thinking:K})},children:[H?(0,s.jsx)(c.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(u.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Create task"]})]})]}),(0,s.jsx)(b.N,{initial:!1,children:Q?(0,s.jsx)(f.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,s.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,s.jsx)("p",{className:"text-[11px] text-slate-300",children:"Thinking"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(I,{ariaLabel:"Select thinking level",value:K,options:[{label:"off",value:"off"},{label:"minimal",value:"minimal"},{label:"low",value:"low"},{label:"medium",value:"medium"},{label:"high",value:"high"}],onChange:e=>B(e)})}),(0,s.jsx)("button",{type:"button",className:"mt-3 text-[12px] text-slate-400 transition-colors hover:text-white",onClick:()=>{ei(!1),V(""),B("medium"),ec(null),eh.current=!0,eN&&void 0!==globalThis.localStorage&&globalThis.localStorage.removeItem(eN)},children:"Clear draft"})]})}):null})]},"expanded")})})}function A({value:e,options:t,onChange:a}){let r=t.find(t=>t.value===e)??t[0],n=t.length>1;return(0,s.jsxs)("div",{className:"relative inline-flex items-center rounded-full border border-white/[0.08] bg-white/[0.04] text-slate-100",children:[n?(0,s.jsx)("select",{"aria-label":"Select mission agent",value:r?.value??"",onChange:e=>a(e.target.value),className:"h-8 appearance-none bg-transparent pl-3 pr-8 text-[12px] outline-none",children:t.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))}):(0,s.jsx)("span",{className:"px-3 text-[12px]",children:r?.label||"No agent"}),n?(0,s.jsx)(g.A,{className:"pointer-events-none absolute right-3 h-3.5 w-3.5 text-slate-400"}):null]})}function I({ariaLabel:e,value:t,options:a,onChange:r}){let n=a.find(e=>e.value===t)??a[0];return(0,s.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,s.jsx)("select",{"aria-label":e,value:n?.value??"",onChange:e=>r(e.target.value),className:"h-9 w-full appearance-none bg-transparent pl-3 pr-9 text-[12px] outline-none",children:a.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,s.jsx)(g.A,{className:"pointer-events-none absolute right-3 h-3.5 w-3.5 text-slate-400"})]})}function T({label:e,active:t=!1,onClick:a,children:r}){return(0,s.jsx)("button",{type:"button","aria-label":e,title:e,onClick:a,className:(0,k.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",t&&"border-white/[0.08] bg-white/[0.06] text-white"),children:r})}function O({label:e,onClick:t}){return(0,s.jsx)("button",{type:"button",onClick:t,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:e})}function R({children:e}){return(0,s.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:e})}function $(e,t){return e||t?`mission-control-composer-draft:${e??"global"}:${t??"unassigned"}`:null}var M=a(49568),_=a(94766),E=a(37227),P=a(86161),L=a(10910),D=a(46765),U=a(60159),F=a(39582),G=a(90656),W=a(2452),z=a(48583),V=a(91980),q=a(88790),J=a(38436),K=a(93028),B=a(66761),H=a(12842);let Z=["Focus on tests","Prioritize UI polish","Avoid changing public API","Continue from the latest failure"];function Y({className:e,...t}){return(0,s.jsx)(B.E,{...t,className:(0,k.cn)("!h-4 !px-1.5 !py-0 !text-[8px] !leading-none !tracking-[0.1em] !whitespace-nowrap",e)})}function X(e){return(0,s.jsx)(Q,{...e},e.selectedNodeId??"overview")}function Q({snapshot:e,surfaceTheme:t,selectedNodeId:a,activeTaskCard:r,agentDetailFocus:n,lastMission:l,onRefresh:o,onSnapshotChange:d,onConfigureAgentCapabilities:c,onConnectModelProvider:u,onAbortTask:p,collapsed:m,onToggleCollapsed:x,activeTab:h,onActiveTabChange:g}){let w=(0,N.hv)(e.generatedAt),v=e.workspaces.find(e=>e.id===a),y=e.agents.find(e=>e.id===a),j=e.tasks.find(e=>e.id===a),C=j&&r?.taskId===j.id?r:null,S=e.runtimes.find(e=>e.id===a),A=e.models.find(e=>e.id===a),I=!!j?.metadata.optimistic,T=v||y||j||S||A||null,O=S?.id??null,R=j?.id??null,$=j&&"string"==typeof j.dispatchId?j.dispatchId:null,{runtimeOutput:U,runtimeOutputError:F}=function(e){let[t,a]=(0,i.useState)(null),[s,r]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!e)return;let t=new AbortController;return fetch(`/api/runtimes/${encodeURIComponent(e)}`,{signal:t.signal}).then(async e=>{let t=await e.json();if(!e.ok)throw Error(t.error||"Unable to load runtime output.");a(t),r(null)}).catch(s=>{t.signal.aborted||(a(null),r({runtimeId:e,message:s instanceof Error?s.message:"Unable to load runtime output."}))}),()=>t.abort()},[e]),{runtimeOutput:t,runtimeOutputError:s}}(O),G=(0,i.useMemo)(()=>{var e;return I&&j?{task:e=j,runs:[],outputs:[],liveFeed:function(e){let t=new Map;for(let a of[...ex(e.metadata.optimisticEvents),...ex(e.metadata.reviewEvents)])t.set(a.id,a);return[...t.values()].sort((e,t)=>Date.parse(e.timestamp)-Date.parse(t.timestamp))}(e),createdFiles:[],warnings:ej(e)||"stalled"===e.status&&!ey(e.subtitle)?[e.subtitle]:[],integrity:em(e)}:null},[I,j]),W=!!R&&(!I||!!$),{taskDetail:z,taskDetailError:q,taskDetailNotice:K}=function({selectedTaskId:e,canStreamTaskDetail:t,selectedTaskDispatchId:a}){let[s,r]=(0,i.useState)(null),[n,l]=(0,i.useState)(null),[o,d]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!e||!t)return;let s=new URLSearchParams;a&&s.set("dispatchId",a);let n=new EventSource(`/api/tasks/${encodeURIComponent(e)}/stream${s.size>0?`?${s.toString()}`:""}`),i=t=>{try{let e=JSON.parse(t.data);if("task"!==e.type)return;r(e.detail),l(null)}catch(t){l({taskId:e,message:t instanceof Error?t.message:"Unable to parse task feed."})}},o=t=>{try{let a=JSON.parse(t.data);"error"===a.type&&l({taskId:e,message:a.error})}catch{l({taskId:e,message:"Unable to load task detail."})}},c=t=>{try{let a=JSON.parse(t.data);if("ready"!==a.type)return;let s=a.eventBridge,r=s&&"live"!==s.mode?[s.message,s.recovery].filter(Boolean).join(" "):null;d({taskId:e,message:r})}catch{d({taskId:e,message:null})}};return n.addEventListener("task",i),n.addEventListener("task-error",o),n.addEventListener("ready",c),n.onerror=()=>{l(t=>t?.taskId===e?t:{taskId:e,message:"Task feed disconnected. Reconnecting…"})},()=>{n.removeEventListener("task",i),n.removeEventListener("task-error",o),n.removeEventListener("ready",c),n.close()}},[e,t,a]),{taskDetail:s,taskDetailError:n,taskDetailNotice:o}}({selectedTaskId:R,canStreamTaskDetail:W,selectedTaskDispatchId:$}),B=U&&U.runtimeId===O?U:null,H=F?.runtimeId===O?F.message:null,Z=z&&(z.task.id===R||$&&"string"==typeof z.task.dispatchId&&z.task.dispatchId===$)?z:null,X=q?.taskId===R?q.message:null,el=K?.taskId===R?K.message:null,eo=function(e,t){var a,s,r;if(!e||!t||null===t.followUpIndex)return e;let n=function(e,t){let a=e.runId?.trim();if(a){let e=t.filter(e=>{let t;return e.runId===a||e.id===a||("string"==typeof(t=e.metadata.runId)&&t.trim().length>0?t.trim():null)===a});if(e.length>0)return e.sort((e,t)=>ee(t.updatedAt)-ee(e.updatedAt))}let s=e.createdAt?Date.parse(e.createdAt):NaN,r=e.sessionId?.trim();return t.filter(e=>{let t=ee(e.updatedAt),a=Number.isNaN(s)||0===t||t>=s-5e3,n=!r||e.sessionId===r||e.key.includes(r);return a&&n}).sort((e,t)=>ee(t.updatedAt)-ee(e.updatedAt))}(t,e.runs),i=(a=n).find(e=>et(e))??a.find(e=>"completed"===e.status)??a[0]??null,l=e.outputs.filter(e=>n.some(t=>t.id===e.runtimeId)),o=(s=l).find(e=>e.finalText?.trim())??s.find(e=>e.errorMessage?.trim())??s[0]??null,d=function(e,t,a){if(t.length>0){let e=new Set(t.map(e=>e.id));return a.filter(t=>!!(t.runtimeId&&e.has(t.runtimeId)))}let s=e.createdAt?Date.parse(e.createdAt):NaN;return Number.isNaN(s)?[]:a.filter(e=>{let t=Date.parse(e.timestamp);return!Number.isNaN(t)&&t>=s-5e3})}(t,n,e.liveFeed),c=d.length>0?d:[(r=t,{id:`follow-up-${r.cardNumber}-accepted`,kind:"user",timestamp:r.createdAt??new Date().toISOString(),title:"Follow-up accepted",detail:r.message||"OpenClaw accepted the follow-up for the existing session.",runtimeId:r.runId??void 0})],u=l.length>0?eU(l.flatMap(e=>e.createdFiles)):eU(n.flatMap(e=>eL(e))),p=l.length>0?ea(l.flatMap(e=>e.warnings)):ea(n.flatMap(e=>eD(e))),m=function(e,t,a){switch(e){case"queued":case"running":case"idle":case"completed":case"stalled":case"cancelled":return e;default:return t?.finalText||a.summary?"completed":"running"}}(i?.status??t.status,o,t),x=o?.finalText?.trim()||t.summary?.trim()||null,h=ea([...n.flatMap(e=>e.toolNames??[]),...l.flatMap(e=>e.items.map(e=>e.toolName).filter(e=>!!e))]);return{...e,task:{...e.task,title:t.message||`Follow-up ${t.cardNumber-1}`,mission:t.message??e.task.mission,subtitle:x||(i&&et(i)?i.subtitle:null)||("running"===m||"queued"===m?"Follow-up is running in the existing OpenClaw session.":e.task.subtitle),status:m,updatedAt:i?.updatedAt??e.task.updatedAt,primaryRuntimeId:i?.id??e.task.primaryRuntimeId,runtimeIds:n.map(e=>e.id),sessionIds:ea([t.sessionId??"",...n.map(e=>e.sessionId??"")]),runIds:ea([t.runId??"",...n.map(e=>e.runId??"")]),runtimeCount:Math.max(n.length,+!!t.runId),updateCount:c.length,liveRunCount:+("running"===m||"queued"===m),artifactCount:u.length,warningCount:p.length,tokenUsage:function(e){let t=e.map(e=>e.tokenUsage).filter(e=>!!e);if(0!==t.length)return t.reduce((e,t)=>({input:e.input+(t?.input??0),output:e.output+(t?.output??0),total:e.total+(t?.total??0),cacheRead:(e.cacheRead??0)+(t?.cacheRead??0)}),{input:0,output:0,total:0,cacheRead:0})}(n),metadata:{...e.task.metadata,resultPreview:x??(i&&et(i)?i.subtitle:null)??"Waiting for follow-up output.",finalResponseText:x,finalResponseRuntimeId:i?.id??null,turnCount:Math.max(new Set(n.map(e=>e.runId??e.id)).size,+!!t.runId),sessionCount:ea([t.sessionId??"",...n.map(e=>e.sessionId??"")]).length,followUpCardNumber:t.cardNumber,followUpMessage:t.message??null}},runs:n,outputs:l,liveFeed:c,createdFiles:u,warnings:p,integrity:{...e.integrity,finalResponseText:x,finalResponseSource:x?"runtime":"none",outputFileCount:u.length,transcriptTurnCount:l.reduce((e,t)=>e+t.items.length,0)||n.length,matchingTranscriptTurnCount:l.reduce((e,t)=>e+t.items.length,0),toolNames:h,issues:x?[]:e.integrity.issues,status:x?"verified":e.integrity.status}}}(Z??G,C),ep=W&&!Z&&!X,eh=!!O&&!B&&!H,eg=!!y,eb=!!(S||j),ef=!!(S||j),ew=("chat"!==h||eg)&&("output"!==h||eb)&&("files"!==h||ef)?h:"overview",ev="chat"===ew&&!!y,eN=j?"Feed":"Output",eO=v?.name||(y?(0,N.CK)(y):null)||(C?(0,N.$m)(C.message||`Follow-up ${C.cardNumber-1}`,48)||"Follow-up":j?(0,N.$m)(j.title||j.mission||"Task",48)||"Task":null)||(S?(0,N.$m)(S.title||"Run",48)||"Run":null)||A?.name||"Gateway overview",eR=v?"workspace":y?"agent":j?C?`follow-up ${C.cardNumber}`:"task":S?"run":A?"model":"selection",e$=(0,i.useMemo)(()=>[{id:"overview",label:"Overview",icon:M.A,enabled:!0},{id:"chat",label:"Chat",icon:_.A,enabled:eg},{id:"output",label:eN,icon:E.A,enabled:eb},{id:"files",label:"Files",icon:P.A,enabled:ef},{id:"raw",label:"Raw",icon:L.A,enabled:!0}],[eN,eg,ef,eb]);return(0,s.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,s.jsxs)("div",{className:(0,k.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",m?"w-full":"w-[60px] border-l border-white/[0.08]"),children:[(0,s.jsx)(J.A,{label:"Inspector",side:"left",surfaceTheme:t,panelCollapsed:m,children:(0,s.jsx)("button",{type:"button","aria-label":m?"Expand inspector":"Collapse inspector",onClick:x,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,s.jsx)(E.A,{className:"h-3.5 w-3.5 text-cyan-200"})})}),(0,s.jsx)("div",{className:"mt-3.5 flex flex-1 flex-col items-center gap-1",children:e$.map(e=>(0,s.jsx)(eI,{icon:e.icon,label:e.label,active:ew===e.id,surfaceTheme:t,panelCollapsed:m,tooltipSide:"left",disabled:!e.enabled,onClick:()=>{e.enabled&&(g(e.id),m&&x())}},e.id))}),(0,s.jsxs)("div",{className:"mt-1.5 flex flex-col items-center gap-0.5",children:[(0,s.jsx)(Y,{variant:"muted",className:"h-4 min-w-[28px] rounded-full px-1 py-0 text-[8px] leading-none tracking-[0.12em]",children:T?"live":"idle"}),m?(0,s.jsx)("p",{className:"max-w-[44px] truncate text-center text-[8px] uppercase tracking-[0.14em] text-slate-500",children:eR}):null]})]}),m?null:(0,s.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,s.jsxs)("div",{className:(0,k.cn)("mission-scroll flex h-full min-h-0 flex-col overscroll-contain",ev?"overflow-hidden":"overflow-y-auto"),children:[(0,s.jsxs)("div",{className:"shrink-0 border-b border-white/[0.08] px-3 pb-2 pt-3",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"text-[9px] font-medium uppercase tracking-[0.24em] text-slate-500",children:"Inspector"}),(0,s.jsxs)("div",{className:"mt-1 flex min-w-0 items-center gap-1.5",children:[(0,s.jsx)("h2",{className:"min-w-0 truncate font-display text-[1.02rem] leading-5 text-white",children:eO}),(0,s.jsx)(Y,{variant:"muted",className:"shrink-0 h-4 px-1.5 py-0 text-[8px] leading-none tracking-[0.1em]",children:eR})]}),(0,s.jsx)("p",{className:"mt-1 truncate text-[11px] leading-4 text-slate-400",children:j?`${j.runtimeCount} runs \xb7 ${j.liveRunCount} live \xb7 ${(0,N.fw)(j.updatedAt,w)}`:S?`Run ${(0,N.m_)(S.runId||S.id,10)} \xb7 ${S.status} \xb7 ${(0,N.fw)(S.updatedAt,w)}`:y?`${y.activeRuntimeIds.length} active runs`:v?`${v.agentIds.length} agents attached`:A?`${A.provider} model`:"Live gateway context"})]}),(0,s.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,s.jsx)(E.A,{className:"h-3.5 w-3.5"})})]}),(0,s.jsx)("div",{className:"mt-2 flex flex-nowrap gap-1 overflow-x-auto pb-0.5",children:e$.filter(e=>e.enabled).map(e=>(0,s.jsx)(eT,{label:e.label,active:ew===e.id,onClick:()=>g(e.id)},e.id))})]}),(0,s.jsx)("div",{className:(0,k.cn)("flex-1 p-3",ev&&"min-h-0 overflow-hidden"),children:(0,s.jsx)(b.N,{mode:"wait",children:(0,s.jsxs)(f.P.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},className:(0,k.cn)("space-y-3.5",ev&&"flex h-full min-h-0 flex-col space-y-0"),children:["overview"===ew?(0,s.jsxs)(s.Fragment,{children:[v?(0,s.jsx)(er,{snapshot:e,workspaceId:v.id}):null,y?(0,s.jsx)(en,{snapshot:e,agentId:y.id,focusSection:n,onConfigureAgentCapabilities:c}):null,j?(0,s.jsx)(ei,{snapshot:e,task:j,taskId:j.id,taskDetail:eo,taskDetailLoading:ep,taskDetailError:X,taskDetailNotice:el,onAbortTask:p,onControlComplete:o}):null,S?(0,s.jsx)(ek,{snapshot:e,runtimeId:S.id,runtimeOutput:B,runtimeOutputLoading:eh,runtimeOutputError:H}):null,A?(0,s.jsx)(eA,{snapshot:e,modelId:A.id}):null,T?null:(0,s.jsx)(es,{snapshot:e,lastMission:l})]}):null,y?(0,s.jsx)("div",{className:(0,k.cn)("min-h-0 flex-1",ev?"block":"hidden"),"aria-hidden":!ev,children:(0,s.jsx)(V.d,{agent:y,snapshot:e,surfaceTheme:t,isVisible:ev,onRefresh:o,onSnapshotChange:d,onConnectModelProvider:u})}):null,"output"===ew&&j?(0,s.jsx)(ed,{task:j,basePath:eu(e,j,eo?.runs),taskDetail:eo,taskDetailLoading:ep,taskDetailError:X,taskDetailNotice:el,onAbortTask:p,onControlComplete:o}):null,"output"===ew&&S?(0,s.jsx)(eS,{runtime:S,basePath:e.workspaces.find(e=>e.id===S.workspaceId)?.path,runtimeOutput:B,runtimeOutputLoading:eh,runtimeOutputError:H}):null,"files"===ew&&j?(0,s.jsx)(ec,{snapshot:e,task:j,taskDetail:eo}):null,"files"===ew&&S?(0,s.jsx)(eC,{runtime:S,runtimeOutput:B}):null,"raw"===ew?(0,s.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(j&&eo?eo:S&&B?{runtime:S,output:B}:T||e,null,2)}):null]},a||"overview")})}),ev?null:(0,s.jsx)("div",{className:"shrink-0 border-t border-white/[0.08] p-3",children:(0,s.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,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.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,s.jsx)(D.A,{className:"h-4 w-4"})}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"truncate font-display text-[15px] text-white",children:j?`${j.runtimeCount} runs`:S?`Run ${(0,N.m_)(S.runId||S.id,10)}`:y?`${y.activeRuntimeIds.length} active runs`:v?`${v.agentIds.length} agents`:A?A.provider:"Gateway overview"}),(0,s.jsxs)("p",{className:"mt-1 text-[12px] text-slate-400",children:[eR," \xb7"," ",j?`${eo?.liveFeed.length??0} live feed events`:S?`${B?.items.length??0} transcript entries`:y?`${y.activeRuntimeIds.length} tracked runs`:v?`${v.agentIds.length} attached`:`${e.presence.length} live beacons`]})]})]})})})]})})]})}function ee(e){return"number"!=typeof e||!Number.isFinite(e)||e<=0?0:e>1e12?e:1e3*e}function et(e){let t=e.subtitle.trim().toLowerCase();return!!(t&&!["chat","agent","sessions.changed","session.message","openclaw runtime event","gateway runtime event"].includes(t))}function ea(e){return Array.from(new Set(e.map(e=>e.trim()).filter(Boolean)))}function es({snapshot:e,lastMission:t}){let a=(0,N.hv)(e.generatedAt),r=e.diagnostics.runtime.stateWritable&&e.diagnostics.runtime.sessionStoreWritable?"passed"===e.diagnostics.runtime.smokeTest.status?"verified":"pending smoke test":"attention";return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(eO,{icon:D.A,title:"Gateway health",value:e.diagnostics.health,children:[(0,s.jsx)("p",{children:e.diagnostics.gatewayUrl}),(0,s.jsx)("p",{children:e.diagnostics.dashboardUrl})]}),(0,s.jsxs)(eO,{icon:P.A,title:"Runtime preflight",value:r,children:[(0,s.jsx)("p",{className:"font-mono text-xs text-slate-400",children:e.diagnostics.runtime.stateRoot}),(0,s.jsx)("p",{children:e.diagnostics.runtime.sessionStores.length>0?`${e.diagnostics.runtime.sessionStores.filter(e=>e.writable).length}/${e.diagnostics.runtime.sessionStores.length} session stores writable`:"No agent session stores have been probed yet."}),e.diagnostics.runtime.smokeTest.checkedAt?(0,s.jsxs)("p",{children:["Smoke test ",e.diagnostics.runtime.smokeTest.status," \xb7"," ",e.diagnostics.runtime.smokeTest.agentId||"unknown agent"," \xb7"," ",(0,N.fw)(Date.parse(e.diagnostics.runtime.smokeTest.checkedAt),a)]}):(0,s.jsx)("p",{children:"No runtime smoke test has been recorded yet."}),e.diagnostics.runtime.issues[0]?(0,s.jsx)("div",{className:"rounded-[14px] border border-amber-400/15 bg-amber-400/8 px-3 py-2 text-[13px] text-amber-50",children:e.diagnostics.runtime.issues[0]}):null]}),(0,s.jsxs)(eO,{icon:E.A,title:"Presence beacons",value:String(e.presence.length),children:[0===e.presence.length?(0,s.jsx)("p",{children:"No live presence payloads."}):null,e.presence.map(e=>(0,s.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,s.jsx)("div",{className:"text-[13px] text-white",children:e.host}),(0,s.jsxs)("div",{className:"mt-1 text-xs text-slate-400",children:[e.ip," \xb7 ",e.platform," \xb7 ",e.version]})]},e.ts))]}),t?(0,s.jsxs)(eO,{icon:U.A,title:"Last mission",value:t.status,children:[(0,s.jsx)("p",{className:"text-sm text-white",children:t.summary}),(0,s.jsx)("p",{className:"font-mono text-xs text-slate-500",children:t.runId?`Run ${t.runId}`:`Dispatch ${t.dispatchId??"pending"}`}),"string"==typeof t.meta?.outputDirRelative?(0,s.jsx)("p",{className:"font-mono text-xs text-slate-400",children:t.meta.outputDirRelative}):null,t.payloads[0]?.text?(0,s.jsx)("div",{className:"rounded-[14px] border border-cyan-400/15 bg-cyan-400/8 px-3 py-2 text-[13px] text-cyan-50",children:t.payloads[0].text}):null]}):null]})}function er({snapshot:e,workspaceId:t}){let a=(0,N.hv)(e.generatedAt),r=e.workspaces.find(e=>e.id===t),n=e.agents.filter(e=>e.workspaceId===t),i=r?r.modelIds.map(t=>e.models.find(e=>e.id===t)?.name||t):[],l=e.runtimes.filter(e=>e.workspaceId===t||r?.activeRuntimeIds.includes(e.id)).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0));if(!r)return null;let o=l.filter(e=>"running"===e.status||"queued"===e.status||"idle"===e.status),d=l[0]??null,c=eU(l.flatMap(eL)).slice(0,8),u=r.bootstrap.coreFiles.every(e=>e.present)&&r.bootstrap.projectShell.every(e=>e.present)?"ready":r.bootstrap.coreFiles.some(e=>e.present)||r.bootstrap.projectShell.some(e=>e.present)?"partial":"thin",p=Array.from(new Set(n.flatMap(e=>e.observedTools??[]))),m=0===n.length?"no agents":r.capabilities.workspaceOnlyAgentCount===n.length?"workspace-only":0===r.capabilities.workspaceOnlyAgentCount?"open":"mixed";return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(eO,{icon:P.A,title:"Overview",value:r.health,children:[(0,s.jsx)("p",{className:"font-mono text-xs text-slate-400",children:(0,N.$7)(r.path)}),(0,s.jsx)(eM,{items:[{label:"Agents",value:String(n.length)},{label:"Models",value:String(r.modelIds.length)},{label:"Runs",value:String(l.length)},{label:"Sessions",value:String(r.totalSessions)}]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Models"}),(0,s.jsx)(eE,{emptyLabel:"No models attached",items:i,emptyVariant:"muted",itemVariant:"muted"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Team"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:n.map(e=>(0,s.jsx)(Y,{variant:e.isDefault?"default":"muted",children:(0,N.CK)(e)},e.id))})]})]}),(0,s.jsxs)(eO,{icon:U.A,title:"Bootstrap",value:u,children:[(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(Y,{variant:r.bootstrap.template?"default":"muted",children:r.bootstrap.template||"template unknown"}),(0,s.jsx)(Y,{variant:r.bootstrap.sourceMode?"muted":"warning",children:r.bootstrap.sourceMode||"source unknown"}),r.bootstrap.agentTemplate?(0,s.jsx)(Y,{variant:"muted",children:r.bootstrap.agentTemplate}):null]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Core files"}),(0,s.jsx)(e_,{items:r.bootstrap.coreFiles,missingVariant:"warning"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Optional scaffold"}),(0,s.jsx)(e_,{items:[...r.bootstrap.optionalFiles,...r.bootstrap.folders]})]}),r.bootstrap.contextFiles?.length?(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Context docs"}),(0,s.jsx)(e_,{items:r.bootstrap.contextFiles})]}):null,(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Project shell"}),(0,s.jsx)(e_,{items:r.bootstrap.projectShell})]})]}),(0,s.jsxs)(eO,{icon:U.A,title:"Capabilities",value:m,children:[(0,s.jsxs)("p",{children:[r.capabilities.workspaceOnlyAgentCount,"/",n.length," agents are configured with"," ",(0,s.jsx)("span",{className:"font-mono text-xs text-slate-300",children:"fs.workspaceOnly"}),"."]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Skills"}),(0,s.jsx)(eE,{emptyLabel:"No explicit skills",items:r.capabilities.skills,emptyVariant:"muted",itemVariant:"muted"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Local workspace skills"}),(0,s.jsx)(eE,{emptyLabel:"No local SKILL.md scaffolds",items:r.bootstrap.localSkillIds,emptyVariant:"muted",itemVariant:"success"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Declared tools"}),(0,s.jsx)(eE,{emptyLabel:"No explicit tools configured",items:r.capabilities.tools,emptyVariant:"muted",itemVariant:"warning"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Observed tools"}),(0,s.jsx)(eE,{emptyLabel:"No runtime tool calls recovered yet",items:p,emptyVariant:"muted",itemVariant:"default"})]})]}),(0,s.jsxs)(eO,{icon:E.A,title:"Activity",value:`${o.length} live`,children:[(0,s.jsxs)("p",{children:[l.length," tracked runs across ",r.totalSessions," recorded sessions."]}),(0,s.jsx)("p",{children:d?`Latest update ${(0,N.fw)(d.updatedAt,a)}`:"No runtime activity has been recorded yet."}),l.length>0?(0,s.jsx)("div",{className:"space-y-2 pt-1",children:l.slice(0,3).map(e=>(0,s.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,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"truncate text-[13px] text-white",children:e.title}),(0,s.jsxs)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:[e.subtitle," \xb7 ",(0,N.m_)(e.runId||e.id,10)]})]}),(0,s.jsx)(Y,{variant:(0,N.Uu)(e.status),children:e.status})]},e.id))}):null,(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Agent posture"}),(0,s.jsx)("div",{className:"space-y-2",children:n.map(e=>(0,s.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,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"truncate text-[13px] text-white",children:(0,N.CK)(e)}),(0,s.jsx)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:e.currentAction})]}),(0,s.jsx)(Y,{variant:"engaged"===e.status?"default":"offline"===e.status?"danger":"muted",children:e.status})]},e.id))})]})]}),(0,s.jsx)(eO,{icon:L.A,title:"Created files",value:String(c.length),children:(0,s.jsx)(e$,{files:c,basePath:r.path,emptyLabel:"No file artifacts have been detected in recent workspace runs."})})]})}function en({snapshot:e,agentId:t,focusSection:a,onConfigureAgentCapabilities:r}){let n=(0,N.hv)(e.generatedAt),l=e.agents.find(e=>e.id===t),o=e.workspaces.find(e=>e.id===l?.workspaceId),d=e.models.find(e=>e.id===l?.modelId),c=(0,i.useRef)(null),u=(0,i.useRef)(null),p=(0,i.useRef)(null),m=l?.observedTools??[],x=l?.skills??[],h=(l?.tools??[]).filter(e=>"fs.workspaceOnly"!==e),g=l?.tools.includes("fs.workspaceOnly")?["fs.workspaceOnly"]:[],w=l?(0,H.Cf)(l.policy.preset):null,y=x.length>0?x:w?.skillIds??[],j=h.length>0?h:w?.tools??[],C=l?[{label:"Preset",value:(0,H._P)(l.policy.preset)},{label:"Missing tools",value:(0,H.zR)(l.policy.missingToolBehavior)},{label:"Install scope",value:(0,H.UJ)(l.policy.installScope)},{label:"File access",value:(0,H.bQ)(l.policy.fileAccess)},{label:"Network",value:(0,H.Bw)(l.policy.networkAccess)}]:[],S=e.runtimes.filter(e=>l?.activeRuntimeIds.includes(e.id)).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0)),[A,I]=(0,i.useState)(null),T=eU(S.flatMap(eL)).slice(0,8);return((0,i.useEffect)(()=>{if(!a)return;let e="skills"===a?c.current:"tools"===a?u.current:p.current;e?.scrollIntoView({behavior:"smooth",block:"start"})},[a]),l)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(eO,{icon:U.A,title:"Agent identity",value:l.id,children:[(0,s.jsx)("p",{children:(0,N.CK)(l)}),(0,s.jsx)("p",{children:l.identity.emoji?`${l.identity.emoji} \xb7 ${l.identity.theme??"theme unset"}`:"No identity emoji"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[l.isDefault?(0,s.jsx)(Y,{variant:"default",children:"default agent"}):null,(0,s.jsx)(Y,{variant:(0,H.Cf)(l.policy.preset).badgeVariant,children:(0,H._P)(l.policy.preset)}),l.identity.source?(0,s.jsx)(Y,{variant:"muted",children:l.identity.source}):null]})]}),(0,s.jsxs)(eO,{icon:P.A,title:"Workspace",value:o?.name||"n/a",children:[(0,s.jsx)("p",{className:"font-mono text-xs text-slate-400",children:(0,N.$7)(l.workspacePath)}),(0,s.jsxs)("p",{children:[l.sessionCount," recorded sessions"]})]}),(0,s.jsxs)(eO,{icon:U.A,title:"Model assignment",value:d?.name||l.modelId,children:[(0,s.jsx)("p",{children:d?`${d.provider} \xb7 ${(0,N.FO)(d.contextWindow)} ctx`:"Model metadata unavailable"}),(0,s.jsx)("p",{children:d?.available===!1?"Currently unavailable":d?.local?"Local model route":"Remote model route"})]}),(0,s.jsx)(eO,{icon:U.A,title:"Agent summary",value:(0,H._P)(l.policy.preset),actions:(0,s.jsxs)(v.$,{type:"button",variant:"secondary",size:"sm",onClick:()=>{r?.(l.id,"tools"===a?"tools":"skills")},className:"h-7 rounded-full px-2.5 text-[11px]",children:[(0,s.jsx)(F.A,{className:"mr-1 h-3 w-3"}),"Edit"]}),children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Purpose"}),(0,s.jsx)("div",{className:"w-full rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:(0,s.jsx)("p",{className:"text-[13px] leading-5 text-slate-200",children:l.profile.purpose||"No explicit purpose was found in the workspace bootstrap files."})})]}),(0,s.jsxs)("div",{ref:c,className:(0,k.cn)("scroll-mt-4 rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5 transition-all","skills"===a&&"border-cyan-300/25 bg-cyan-400/[0.05] shadow-[0_0_0_1px_rgba(34,211,238,0.08)]"),children:[(0,s.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-2",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Skills"}),(0,s.jsxs)(Y,{variant:"muted",children:[y.length," active"]})]}),(0,s.jsx)(eE,{emptyLabel:"No skills available",items:y,emptyVariant:"muted",itemVariant:"muted"})]}),(0,s.jsxs)("div",{ref:u,className:(0,k.cn)("scroll-mt-4 rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5 transition-all","tools"===a&&"border-cyan-300/25 bg-cyan-400/[0.05] shadow-[0_0_0_1px_rgba(34,211,238,0.08)]"),children:[(0,s.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-2",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Tools"}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[g.length>0?(0,s.jsxs)(Y,{variant:"success",children:[(0,s.jsx)(G.A,{className:"mr-1 h-3 w-3"}),"policy locked"]}):null,(0,s.jsxs)(Y,{variant:"muted",children:[j.length," active"]})]})]}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)(eE,{emptyLabel:"No tools available",items:j,emptyVariant:"muted",itemVariant:"warning"}),g.length>0?(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Policy locked"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:g.map(e=>(0,s.jsxs)(Y,{variant:"success",children:[(0,s.jsx)(G.A,{className:"mr-1 h-3 w-3"}),e]},e))}),(0,s.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,m.length>0?(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Observed"}),(0,s.jsx)(eE,{emptyLabel:"No runtime tool calls recovered yet",items:m,emptyVariant:"muted",itemVariant:"default"})]}):null]})]}),(0,s.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-3",children:[(0,s.jsx)("p",{className:"text-[12px] leading-5 text-slate-400",children:w?.description??"No policy description available."}),(0,s.jsxs)("div",{className:"mt-3 grid gap-1.5 text-[13px] text-slate-300",children:[C.map(e=>(0,s.jsxs)("p",{children:[e.label,": ",(0,s.jsx)("span",{className:"text-white",children:e.value})]},e.label)),l.profile.outputPreference?(0,s.jsxs)("p",{children:["Output preference: ",(0,s.jsx)("span",{className:"text-white",children:l.profile.outputPreference})]}):null]})]})]})}),(0,s.jsxs)(eO,{icon:D.A,title:"Runtime posture",value:l.status,children:[(0,s.jsx)("p",{children:l.currentAction}),(0,s.jsxs)("p",{children:["Last active ",(0,N.fw)(l.lastActiveAt,n)]}),(0,s.jsx)("p",{children:l.heartbeat.enabled?`Heartbeat ${l.heartbeat.every}`:"Heartbeat disabled"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(Y,{variant:l.heartbeat.enabled?"success":"muted",children:l.heartbeat.enabled?"heartbeat on":"heartbeat off"}),"number"==typeof l.heartbeat.everyMs?(0,s.jsxs)(Y,{variant:"muted",children:[Math.round(l.heartbeat.everyMs/1e3),"s interval"]}):null]})]}),(0,s.jsx)("div",{ref:p,className:"scroll-mt-4",children:(0,s.jsxs)(eO,{icon:E.A,title:"Activity history",value:String(S.length),className:(0,k.cn)("sessions"===a&&"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,s.jsxs)("p",{children:[l.sessionCount," recorded sessions overall."]}),(0,s.jsx)("p",{children:S.length>0?`${S.length} history item${1===S.length?"":"s"} recovered from the latest agent activity.`:"No linked runtime records were recovered for this agent in the current snapshot."}),l.sessionCount>S.length?(0,s.jsxs)("p",{className:"text-[12px] text-slate-500",children:[l.sessionCount-S.length," session",l.sessionCount-S.length==1?"":"s"," do not have recovered runtime data yet."]}):null,S.length>0?(0,s.jsx)("div",{className:"space-y-2.5 pt-1",children:S.map(e=>{var t,a;let r=A===e.id,i=function(e){switch(e){case"session":return"Direct chat";case"turn":return"Conversation";case"cron":return"Scheduled";default:return"Unknown source"}}(e.source),l=function(e){if(e.taskId)return"Task";switch(e.source){case"session":return"Chat";case"turn":return"Run";case"cron":return"Scheduled";default:return"Activity"}}(e),o=e.sessionId?`session ${(0,N.m_)(e.sessionId,10)}`:e.runId?`run ${(0,N.m_)(e.runId,10)}`:"session n/a",d="number"!=typeof(t=e.tokenUsage?.total)||Number.isNaN(t)?"0 Tokens":t>=1e3?`${Math.round(t/1e3)}K Tokens`:`${t} Tokens`,c="number"!=typeof(a=e.updatedAt)||Number.isNaN(a)?"No time":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(a));return(0,s.jsxs)("div",{className:(0,k.cn)("overflow-hidden rounded-[14px] border bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] transition-all",r?"border-cyan-300/22 shadow-[0_0_0_1px_rgba(34,211,238,0.08)]":"border-white/[0.08]"),children:[(0,s.jsxs)("button",{type:"button","aria-expanded":r,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:()=>{I(t=>t===e.id?null:e.id)},onPointerDown:e=>e.stopPropagation(),children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,s.jsx)(Y,{variant:(0,N.Uu)(e.status),children:e.status}),(0,s.jsx)(Y,{variant:e.tokenUsage?.total?"default":"muted",children:d})]}),(0,s.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,s.jsx)("p",{className:"line-clamp-2 text-[13px] leading-5 text-white",children:e.title}),(0,s.jsx)("p",{className:"line-clamp-2 text-[12px] leading-5 text-slate-300",children:e.subtitle})]}),(0,s.jsxs)("div",{className:"flex items-end justify-between gap-3",children:[(0,s.jsx)("div",{className:"min-w-0",children:(0,s.jsxs)("p",{className:"truncate text-[9px] uppercase tracking-[0.18em] text-slate-500",children:[l," \xb7 ",o]})}),(0,s.jsx)("p",{className:"shrink-0 text-right text-[9px] uppercase tracking-[0.18em] text-slate-500",children:c})]})]}),(0,s.jsx)(b.N,{initial:!1,children:r?(0,s.jsx)(f.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,s.jsxs)("div",{className:"space-y-3 px-3 py-3",children:[(0,s.jsx)(eM,{items:[{label:"Source",value:i},{label:"Status",value:e.status},{label:"Updated",value:(0,N.fw)(e.updatedAt,n)},{label:"Key",value:(0,N.m_)(e.key,12)}]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[e.sessionId?(0,s.jsxs)(Y,{variant:"muted",children:["session ",(0,N.m_)(e.sessionId,12)]}):null,e.runId?(0,s.jsxs)(Y,{variant:"muted",children:["run ",(0,N.m_)(e.runId,12)]}):null,e.taskId?(0,s.jsxs)(Y,{variant:"muted",children:["task ",(0,N.m_)(e.taskId,12)]}):null,e.modelId?(0,s.jsxs)(Y,{variant:"muted",children:["model ",(0,N.m_)(e.modelId,12)]}):null]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Preview"}),(0,s.jsx)("div",{className:"rounded-[12px] border border-white/[0.08] bg-white/[0.03] px-3 py-2",children:(0,s.jsx)("p",{className:"text-[12px] leading-5 text-slate-200",children:e.subtitle})})]}),e.toolNames?.length?(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Tools"}),(0,s.jsx)(eE,{emptyLabel:"No tool names recorded",items:e.toolNames,emptyVariant:"muted",itemVariant:"warning"})]}):null]})}):null})]},e.id)})}):null]})}),(0,s.jsx)(eO,{icon:L.A,title:"Created files",value:String(T.length),children:(0,s.jsx)(e$,{files:T,basePath:l.workspacePath,emptyLabel:"No file artifacts have been detected for this agent yet."})}),(0,s.jsxs)(eO,{icon:U.A,title:"Capabilities",value:`${l.skills.length} skills`,children:[(0,s.jsx)(eE,{emptyLabel:"No explicit skills",items:l.skills,emptyVariant:"muted",itemVariant:"muted"}),(0,s.jsxs)("div",{className:"pt-1",children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Declared tools"}),(0,s.jsx)(eE,{emptyLabel:"No explicit tools configured",items:l.tools,emptyVariant:"muted",itemVariant:"warning"})]}),(0,s.jsxs)("div",{className:"pt-1",children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Observed tools"}),(0,s.jsx)(eE,{emptyLabel:"No runtime tool calls recovered yet",items:m,emptyVariant:"muted",itemVariant:"default"})]})]})]}):null}function ei({snapshot:e,task:t,taskId:a,taskDetail:r,taskDetailLoading:n,taskDetailError:i,taskDetailNotice:l,onAbortTask:o,onControlComplete:d}){var c,u,p,m,x;let h,g=e.tasks.find(e=>e.id===a)??t,b=r?.task?(c=r.task,u=g,0===Object.keys(h=Object.fromEntries(["reviewStatus","reviewAction","reviewedAt","reviewEvents"].map(e=>[e,u.metadata[e]]).filter(([,e])=>void 0!==e))).length?c:{...c,metadata:{...c.metadata,...h}}):g,f=ej(b),w=r?.runs??e.runtimes.filter(e=>t?.runtimeIds.includes(e.id)).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0)),v=eu(e,b,w),y=ep(e,b,w),j=e.agents.find(e=>e.id===b?.primaryAgentId),k=eU(r?.createdFiles??w.flatMap(e=>eL(e))),C=r?.warnings??[];if(!t)return null;let S=r?.integrity??em(t),A=eh(b),I=("string"==typeof(p=b).metadata.routedMission?p.metadata.routedMission.trim():"")||eh(p),T=(m=A,x=I,ef(m)!==ef(x)),O=eg(b),R=eb(b.metadata.sessionCount,b.sessionIds.length),$=eb(b.metadata.turnCount,w.length),M=(r?.liveFeed??[]).filter(e=>ev(e)).sort((e,t)=>Date.parse(e.timestamp)-Date.parse(t.timestamp)),_=function(e){for(let t of e)if("string"==typeof t.filePath&&"string"==typeof t.displayPath)return{path:t.filePath,displayPath:t.displayPath};return null}(M);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(eO,{icon:P.A,title:"Mission",value:f?"aborted":b.status,children:[(0,s.jsx)(eR,{label:"Original prompt",text:A,basePath:v}),(0,s.jsx)(eR,{label:"Sent to OpenClaw",text:T?I:"Same as original prompt.",basePath:v,subtle:!T}),(0,s.jsx)(eR,{label:"Latest task output",text:O||"Waiting for the first OpenClaw update.",basePath:v,subtle:!O}),(0,s.jsx)(eM,{items:[{label:"Sessions",value:String(R)},{label:"Turns",value:String($)},{label:"Runs",value:String(b.runtimeCount)},{label:"Files",value:String(b.artifactCount)},{label:"Live",value:String(b.liveRunCount)},{label:"Tools",value:String(S.toolNames.length)}]}),(0,s.jsx)(eo,{task:b,onAbortTask:o,onControlComplete:d}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[y?(0,s.jsx)(Y,{variant:"muted",children:y.name}):null,j?(0,s.jsx)(Y,{variant:"default",children:(0,N.CK)(j)}):null,b.dispatchId?(0,s.jsxs)(Y,{variant:"muted",children:["dispatch ",(0,N.m_)(b.dispatchId,8)]}):null,f?(0,s.jsx)(Y,{variant:"danger",children:"aborted"}):null]}),n&&!r?(0,s.jsx)("p",{children:"Connecting live task feed…"}):null,i?(0,s.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:i}):null,l?(0,s.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:l}):null]}),(0,s.jsx)(el,{task:b,integrity:S,basePath:v,latestEvidenceAt:([...r?.liveFeed??[]].reverse().find(e=>"assistant"===e.kind||"tool"===e.kind||"artifact"===e.kind)??null)?.timestamp??null}),(0,s.jsxs)(eO,{icon:E.A,title:"Runner logs",value:String(M.length),children:[_?(0,s.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Log file"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(q.G,{text:_.displayPath,className:"text-[12.5px] leading-5 text-slate-100",filePath:_.path,displayPath:_.displayPath,basePath:v})}),(0,s.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===M.length?(0,s.jsx)("p",{children:"No meaningful dispatch runner diagnostics have been captured for this task yet."}):(0,s.jsx)("div",{className:"max-h-[300px] space-y-2 overflow-y-auto pr-1",children:M.map(e=>(0,s.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,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("div",{className:"flex min-w-0 items-center gap-2",children:(0,s.jsx)(Y,{variant:eF(e.kind,e.isError),children:e.title})}),(0,s.jsx)("span",{className:"shrink-0 text-[10px] uppercase tracking-[0.18em] text-slate-500",children:(0,N.fw)(new Date(e.timestamp).getTime())})]}),(0,s.jsx)("pre",{className:"mt-2 whitespace-pre-wrap break-words font-mono text-[11px] leading-5 text-slate-100",children:e.detail})]},e.id))})]}),(0,s.jsxs)(eO,{icon:E.A,title:"Runs",value:String(w.length),children:[0===w.length?(0,s.jsx)("p",{children:"No OpenClaw runs have been grouped into this task yet."}):null,(0,s.jsx)("div",{className:"space-y-2",children:w.map(e=>(0,s.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,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"truncate text-[13px] text-white",children:e.title}),(0,s.jsx)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:e.subtitle})]}),(0,s.jsx)(Y,{variant:(0,N.Uu)(e.status),children:e.status})]},e.id))})]}),(0,s.jsx)(eO,{icon:L.A,title:"Artifacts",value:String(k.length),children:(0,s.jsx)(e$,{files:k,basePath:v,emptyLabel:"This task has not produced a detectable file artifact yet."})}),C.length>0?(0,s.jsx)(eO,{icon:D.A,title:"Warnings",value:String(C.length),children:(0,s.jsx)(eP,{items:C,emptyLabel:"No warnings detected."})}):null]})}function el({task:e,integrity:t,basePath:a,latestEvidenceAt:r}){let n=ej(e),i=!!e.metadata.optimistic&&!n&&"stalled"!==e.status,l=t.issues.find(e=>"missing-final-response"===e.id),o=t.issues.find(e=>"partial-final-response"===e.id),d=!!(t.finalResponseText||t.outputFileCount>0||t.transcriptTurnCount>0||t.matchingTranscriptTurnCount>0||t.toolNames.length>0),c=(0,K.VL)(e,{hasLiveActivity:"running"===e.status||"queued"===e.status||e.liveRunCount>0,latestEvidenceAt:r}),u=(0,K.kg)(e),p=(0,K.UF)(e),m=c?(0,K.E2)(c):n?"This task was aborted by an operator. Captured evidence may be incomplete.":i?"OpenClaw accepted this task. Session, tool, and file evidence will appear here as soon as the first runtime reports in.":l?l.detail:o?o.detail:"verified"===t.status?"AgentOS found a matching transcript and the captured result looks internally consistent.":t.sessionMismatch?"The linked transcript belongs to a different mission or stale session, so this completion cannot be trusted yet.":t.issues.some(e=>"empty-output-dir"===e.id)?"The task is marked completed, but the expected deliverables are missing from the output folder.":"error"===t.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,s.jsxs)(eO,{icon:D.A,title:"Result integrity",value:c?(0,K.B4)(c):n?"aborted":o?"needs review":"stalled"!==e.status||t.finalResponseText?i?"pending":t.status:d?"needs review":"waiting output",children:[(0,s.jsx)("p",{children:m}),c?(0,s.jsxs)("div",{className:"rounded-[14px] border border-emerald-400/16 bg-emerald-400/[0.06] px-3 py-2.5",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-emerald-100/80",children:"Operator review"}),(0,s.jsxs)("p",{className:"mt-2 text-[12px] leading-5 text-emerald-50",children:[u||(0,K.B4)(c),p?` \xb7 ${(0,N.fw)(Date.parse(p))}`:""]})]}):null,(0,s.jsx)(eM,{items:[{label:"Output files",value:String(t.outputFileCount)},{label:"Transcript turns",value:String(t.transcriptTurnCount)},{label:"Matched turns",value:String(t.matchingTranscriptTurnCount)},{label:"Tools",value:String(t.toolNames.length)},{label:"Emails",value:String(t.emails.length)}]}),t.outputDir||t.outputDirRelative?(0,s.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Output folder"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(q.G,{text:t.outputDirRelative||t.outputDir||"Output folder",className:"text-[12.5px] leading-5 text-slate-100",filePath:t.outputDir,displayPath:t.outputDirRelative||t.outputDir,basePath:a})}),(0,s.jsx)("p",{className:"mt-2 text-[11px] text-slate-400",children:t.outputDirExists?`${t.outputFileCount} file${1===t.outputFileCount?"":"s"} detected in the folder.`:"The output folder is not currently accessible."})]}):null,(0,s.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,s.jsxs)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:["Final response ","none"!==t.finalResponseSource?`(${t.finalResponseSource})`:""]}),o?(0,s.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:o.detail}):null,(0,s.jsx)("div",{className:"mt-2",children:t.finalResponseText?(0,s.jsx)(q.G,{text:t.finalResponseText,className:"text-[12.5px] leading-5 text-slate-100",basePath:a}):(0,s.jsx)("p",{className:"text-[12.5px] leading-5 text-slate-400",children:"No final response was captured."})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Recovered tools"}),t.toolNames.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:t.toolNames.map(e=>(0,s.jsx)(Y,{variant:"muted",children:e},e))}):(0,s.jsx)("p",{children:"No tool calls were recovered from a matching transcript turn."})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Detected emails"}),t.emails.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:t.emails.map(e=>(0,s.jsx)(Y,{variant:"muted",children:e},e))}):(0,s.jsx)("p",{children:"No email addresses were detected in the captured result."})]}),t.dispatchSessionId?(0,s.jsxs)("p",{className:"font-mono text-xs text-slate-400",children:["session ",(0,N.m_)(t.dispatchSessionId,12),t.sessionMismatch?" \xb7 mismatch detected":""]}):null,t.issues.length>0?(0,s.jsxs)("div",{className:"rounded-[14px] border border-amber-400/16 bg-amber-400/[0.06] px-3 py-2.5",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-amber-100/80",children:"Review issues"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(eP,{items:t.issues.map(e=>`${e.title}: ${e.detail}`),emptyLabel:"No integrity issues detected."})})]}):null]})}function eo({task:e,onAbortTask:t,onControlComplete:a}){var r;let[n,l]=(0,i.useState)(null),[o,d]=(0,i.useState)(""),[c,u]=(0,i.useState)(null),p=eN(r=e)||r.liveRunCount>0,m=!!t&&eN(e),x=o.trim();if(!p)return null;let h=e=>{l(t=>t===e?null:e),d("")},g=async()=>{if(n&&x&&!c){u(n);try{let s=await fetch(`/api/tasks/${encodeURIComponent(e.id)}/control`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:n,message:x,dispatchId:e.dispatchId??null})}),r=await s.json().catch(()=>null);if(!s.ok){var t;throw Error(((t=r)&&"object"==typeof t?"string"==typeof t.error?t.error:"string"==typeof t.message?t.message:null:null)||"Unable to update the running task.")}z.oR.success("steer"===n?"Steer request sent.":"Context added to session."),l(null),d(""),a?.()}catch(e){z.oR.error("steer"===n?"Steer request failed.":"Context injection failed.",{description:e instanceof Error?e.message:"Unknown control error."})}finally{u(null)}}};return(0,s.jsxs)("div",{className:"rounded-[14px] border border-cyan-300/12 bg-cyan-400/[0.05] p-2.5",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsxs)(v.$,{type:"button",variant:"destructive",size:"sm",disabled:!m,className:"h-8 gap-1.5 rounded-[10px] px-2.5 text-[11px]",onClick:()=>{m&&t?.(e)},children:[(0,s.jsx)(W.A,{className:"h-3.5 w-3.5"}),"Stop"]}),(0,s.jsxs)(v.$,{type:"button",variant:"steer"===n?"default":"secondary",size:"sm",className:"h-8 gap-1.5 rounded-[10px] px-2.5 text-[11px]",onClick:()=>h("steer"),children:[(0,s.jsx)(F.A,{className:"h-3.5 w-3.5"}),"Steer"]}),(0,s.jsxs)(v.$,{type:"button",variant:"inject"===n?"default":"secondary",size:"sm",className:"h-8 gap-1.5 rounded-[10px] px-2.5 text-[11px]",onClick:()=>h("inject"),children:[(0,s.jsx)(_.A,{className:"h-3.5 w-3.5"}),"Add context"]})]}),n?(0,s.jsxs)("div",{className:"mt-2.5 space-y-2",children:[(0,s.jsx)(y.T,{value:o,disabled:!!c,rows:3,maxLength:4e3,placeholder:"steer"===n?"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:e=>d(e.target.value)}),"steer"===n?(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:Z.map(e=>(0,s.jsx)("button",{type:"button",disabled:!!c,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:()=>d(e),children:e},e))}):null,(0,s.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[(0,s.jsx)(v.$,{type:"button",variant:"ghost",size:"sm",disabled:!!c,className:"h-8 rounded-[10px] px-2.5 text-[11px]",onClick:()=>{l(null),d("")},children:"Cancel"}),(0,s.jsx)(v.$,{type:"button",variant:"default",size:"sm",disabled:!x||!!c,className:"h-8 rounded-[10px] px-2.5 text-[11px]",onClick:()=>void g(),children:c?"Sending...":"steer"===n?"Send steer":"Add context"})]})]}):null]})}function ed({task:e,basePath:t,taskDetail:a,taskDetailLoading:r,taskDetailError:n,taskDetailNotice:i,onAbortTask:l,onControlComplete:o}){if(r&&!a)return(0,s.jsxs)(eO,{icon:E.A,title:"Live feed",value:"connecting",children:[(0,s.jsx)(eo,{task:e,onAbortTask:l,onControlComplete:o}),(0,s.jsx)("p",{children:"Connecting to the task feed…"})]});if(n&&!a)return(0,s.jsxs)(eO,{icon:E.A,title:"Live feed",value:"error",children:[(0,s.jsx)(eo,{task:e,onAbortTask:l,onControlComplete:o}),(0,s.jsx)("p",{children:n})]});let d=(function(...e){let t=new Map;for(let a of e.flat())t.set(a.id,a);return[...t.values()].sort((e,t)=>Date.parse(e.timestamp)-Date.parse(t.timestamp))})(a?.liveFeed??[],ex(e.metadata.reviewEvents)).filter(e=>!ev(e)),c=a?.integrity??em(e);return(0,s.jsxs)(eO,{icon:E.A,title:"Live feed",value:String(d.length),children:[(0,s.jsx)(eo,{task:a?.task??e,onAbortTask:l,onControlComplete:o}),n?(0,s.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:n}):null,i?(0,s.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:i}):null,c.issues.length>0?(0,s.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:c.issues[0]?.detail}):null,0===d.length?(0,s.jsx)("p",{children:"No streamed task events have arrived yet."}):null,(0,s.jsx)("div",{className:"space-y-2",children:d.map(e=>(0,s.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,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,s.jsx)(Y,{variant:eF(e.kind,e.isError),children:e.kind}),(0,s.jsx)("p",{className:"truncate text-[12px] text-white",children:e.title})]}),(0,s.jsx)("span",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:(0,N.fw)(new Date(e.timestamp).getTime())})]}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(q.G,{text:e.detail,className:"text-[12.5px] leading-5 text-slate-100",url:e.url,filePath:e.filePath,displayPath:e.displayPath,basePath:t})})]},e.id))})]})}function ec({snapshot:e,task:t,taskDetail:a}){let r=a?.runs??e.runtimes.filter(e=>t.runtimeIds.includes(e.id)).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0)),n=eU(a?.createdFiles??r.flatMap(e=>eL(e))),i=a?.integrity??em(t),l=eu(e,t,r);return(0,s.jsxs)(eO,{icon:L.A,title:"Files",value:String(n.length),children:[(0,s.jsxs)("p",{children:[r.length," run",1===r.length?"":"s"," contributed to this task."]}),i.outputDir||i.outputDirRelative?(0,s.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Output folder"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(q.G,{text:i.outputDirRelative||i.outputDir||"Output folder",className:"text-[12.5px] leading-5 text-slate-100",filePath:i.outputDir,displayPath:i.outputDirRelative||i.outputDir,basePath:l})}),(0,s.jsx)("p",{className:"mt-2 text-[11px] text-slate-400",children:i.outputDirExists?`${i.outputFileCount} file${1===i.outputFileCount?"":"s"} detected in the folder.`:"The output folder is not currently accessible."})]}):null,(0,s.jsx)(e$,{files:n,basePath:l,emptyLabel:"This task has not produced a detectable file artifact yet."})]})}function eu(e,t,a=[]){return ep(e,t,a)?.path??function(e,t,a=[]){for(let s of[t.primaryAgentId,...a.map(e=>e.agentId)].filter(e=>"string"==typeof e&&e.trim().length>0)){let t=e.agents.find(e=>e.id===s)?.workspacePath;if(t)return t}}(e,t,a)}function ep(e,t,a=[]){for(let s of[t.workspaceId,...a.map(e=>e.workspaceId),t.primaryAgentId?e.agents.find(e=>e.id===t.primaryAgentId)?.workspaceId:void 0,...a.map(t=>t.agentId?e.agents.find(e=>e.id===t.agentId)?.workspaceId:void 0)].filter(e=>"string"==typeof e&&e.trim().length>0)){let t=e.workspaces.find(e=>e.id===s);if(t)return t}return null}function em(e){var t,a;let s,r,n,i=!!e.metadata.optimistic&&!ej(e)&&"stalled"!==e.status,l=(s="string"==typeof(t=e).metadata.finalResponseText?t.metadata.finalResponseText.trim():"",r="string"==typeof t.metadata.resultPreview?t.metadata.resultPreview.trim():"",!!((n=s||r)&&!(ey(a=n)||/waiting for (the first )?(transcript|output)/i.test(a)||/working silently/i.test(a)))),o=ej(e)?[{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"===e.status?[{id:l?"partial-final-response":"stalled-dispatch",severity:"warning",title:l?"Final response came from an incomplete runtime":"Waiting for output evidence",detail:l?"The assistant produced output, but the runtime stalled before the task completed. Treat this as the last captured response, not a verified completion.":ey(e.subtitle)?"AgentOS is still waiting for the first transcript entry from this runtime.":e.subtitle}]:[];return{status:o.some(e=>"error"===e.severity)?"error":i||o.length>0?"warning":"verified",outputDir:"string"==typeof e.metadata.outputDir&&e.metadata.outputDir.trim().length>0?e.metadata.outputDir:null,outputDirRelative:"string"==typeof e.metadata.outputDirRelative&&e.metadata.outputDirRelative.trim().length>0?e.metadata.outputDirRelative:null,outputDirExists:!1,outputFileCount:0,transcriptTurnCount:0,matchingTranscriptTurnCount:0,finalResponseText:l?eg(e):null,finalResponseSource:"none",dispatchSessionId:null,sessionMismatch:!1,toolNames:[],emails:[],issues:o}}function ex(e){return Array.isArray(e)?e.filter(ew):[]}function eh(e){return e.mission?.trim()||e.title.trim()||"Untitled task"}function eg(e){return("string"==typeof e.metadata.resultPreview?e.metadata.resultPreview.trim():"")||e.subtitle.trim()||""}function eb(e,t){return"number"==typeof e&&Number.isFinite(e)?e:t}function ef(e){return e.replace(/\s+/g," ").trim()}function ew(e){return"object"==typeof e&&null!==e&&"string"==typeof e.id&&"string"==typeof e.kind&&"string"==typeof e.timestamp&&"string"==typeof e.title&&"string"==typeof e.detail}function ev(e){return e.id.startsWith("runner-log:")}function ey(e){return"string"==typeof e&&(/No transcript file was found for this runtime session/i.test(e)||/No transcript entries were found for this runtime/i.test(e))}function ej(e){let t="string"==typeof e.metadata.dispatchStatus?e.metadata.dispatchStatus:null,a=e.status;return"cancelled"===t||"aborted"===t||"cancelled"===a||"aborted"===a}function eN(e){if(ej(e))return!1;let t=e.status;return"running"===t||"queued"===t}function ek({snapshot:e,runtimeId:t,runtimeOutput:a,runtimeOutputLoading:r,runtimeOutputError:n}){let i=(0,N.hv)(e.generatedAt),l=e.runtimes.find(e=>e.id===t),o=eU(a?.createdFiles??(l?eL(l):[])),d=a?.warnings??(l?eD(l):[]),c=a?.warningSummary??d[0]??null,u=l?e.workspaces.find(e=>e.id===l.workspaceId)?.path:void 0;return l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(eO,{icon:E.A,title:"Runtime key",value:l.status,children:[(0,s.jsx)("p",{className:"font-mono text-xs text-slate-400",children:l.key}),(0,s.jsxs)("p",{children:["Session ",(0,N.m_)(l.sessionId,12)]}),l.taskId?(0,s.jsxs)("p",{children:["Task ",(0,N.m_)(l.taskId,12)]}):null,l.runId?(0,s.jsxs)("p",{children:["Run ",(0,N.m_)(l.runId,12)]}):null]}),(0,s.jsxs)(eO,{icon:D.A,title:"Activity",value:(0,N.fw)(l.updatedAt,i),children:[(0,s.jsx)("p",{children:l.subtitle}),(0,s.jsxs)("p",{children:[(0,N._y)(l.tokenUsage?.total)," tokens"]})]}),(0,s.jsxs)(eO,{icon:U.A,title:"Latest output",value:a?.stopReason||(r?"loading":"no transcript"),children:[r?(0,s.jsx)("p",{children:"Loading transcript output…"}):null,n?(0,s.jsx)("p",{children:n}):null,r||n?null:(0,s.jsx)(q.G,{text:a?.finalText||a?.errorMessage||"No assistant output has been recorded for this runtime yet.",className:"text-[13px] leading-5 text-slate-100",basePath:u}),c?(0,s.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: ",c]}):null,a?.finalTimestamp?(0,s.jsxs)("p",{className:"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:["Updated ",(0,N.fw)(new Date(a.finalTimestamp).getTime())]}):null]}),(0,s.jsx)(eO,{icon:L.A,title:"Created files",value:String(o.length),children:(0,s.jsx)(e$,{files:o,basePath:e.workspaces.find(e=>e.id===l.workspaceId)?.path,emptyLabel:"This runtime has not produced a detectable file artifact."})})]}):null}function eC({runtime:e,runtimeOutput:t}){let a=eU(t?.createdFiles??eL(e));return(0,s.jsxs)(eO,{icon:L.A,title:"Files",value:String(a.length),children:[(0,s.jsx)("p",{children:e.title}),(0,s.jsx)(e$,{files:a,emptyLabel:"This runtime has not produced a detectable file artifact."})]})}function eS({runtime:e,basePath:t,runtimeOutput:a,runtimeOutputLoading:r,runtimeOutputError:n}){if(r)return(0,s.jsx)(eO,{icon:E.A,title:"Runtime output",value:"loading",children:(0,s.jsxs)("p",{children:["Loading transcript output for ",e.title,"…"]})});if(n)return(0,s.jsx)(eO,{icon:E.A,title:"Runtime output",value:"error",children:(0,s.jsx)("p",{children:n})});if(!a)return(0,s.jsx)(eO,{icon:E.A,title:"Runtime output",value:"missing",children:(0,s.jsx)("p",{children:"No transcript data is available for this runtime."})});let i=eU(a.createdFiles);return(0,s.jsxs)("div",{className:"space-y-3.5",children:[a.warningSummary?(0,s.jsx)(eO,{icon:D.A,title:"Warnings",value:String(a.warnings.length),children:(0,s.jsx)("p",{children:a.warningSummary})}):null,(0,s.jsx)(eO,{icon:L.A,title:"Created files",value:String(i.length),children:(0,s.jsx)(e$,{files:i,basePath:t,emptyLabel:"This runtime transcript does not include a successful file creation."})}),(0,s.jsxs)(eO,{icon:E.A,title:"Final response",value:"stalled"===e.status||"cancelled"===e.status?"stalled"===e.status?"stalled":e.status:a.stopReason||a.status,children:["stalled"===e.status||"cancelled"===e.status?(0,s.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"===e.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,a.errorMessage&&!ey(a.errorMessage)?(0,s.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:a.errorMessage}):null,(0,s.jsx)(q.G,{text:a.finalText||(a.errorMessage&&!ey(a.errorMessage)?a.errorMessage:"Waiting for the first assistant output from this runtime."),className:"text-[13px] leading-5 text-slate-100",basePath:t}),a.finalTimestamp?(0,s.jsx)("p",{className:"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:new Date(a.finalTimestamp).toLocaleString()}):null]}),(0,s.jsxs)(eO,{icon:D.A,title:"Transcript trail",value:String(a.items.length),children:[0===a.items.length?(0,s.jsx)("p",{children:"Waiting for the first transcript entry."}):null,(0,s.jsx)("div",{className:"space-y-2",children:a.items.map(e=>(0,s.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,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(Y,{variant:"assistant"===e.role?e.isError?"danger":"default":"toolResult"===e.role?"warning":"muted",children:e.role}),e.toolName?(0,s.jsx)(Y,{variant:"muted",children:e.toolName}):null]}),(0,s.jsx)("span",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:(0,N.fw)(new Date(e.timestamp).getTime())})]}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(q.G,{text:e.text,className:"text-[12.5px] leading-5 text-slate-100",basePath:t})})]},e.id))})]})]})}function eA({snapshot:e,modelId:t}){let a=e.models.find(e=>e.id===t);return a?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(eO,{icon:U.A,title:"Model routing",value:a.provider,children:[(0,s.jsx)("p",{children:a.name}),(0,s.jsx)("p",{children:a.local?"Local model":"Remote model"})]}),(0,s.jsxs)(eO,{icon:D.A,title:"Capacity",value:`${(0,N.FO)(a.contextWindow)} ctx`,children:[(0,s.jsx)("p",{children:a.input}),(0,s.jsx)("p",{children:!1===a.available?"Unavailable":"Available"}),(0,s.jsxs)("p",{children:[a.usageCount," attached agents"]})]})]}):null}function eI({icon:e,label:t,active:a,surfaceTheme:r,panelCollapsed:n,tooltipSide:i,disabled:l=!1,onClick:o}){return(0,s.jsx)(J.A,{label:t,side:i,surfaceTheme:r,panelCollapsed:n,children:(0,s.jsx)("button",{type:"button","aria-label":t,"aria-disabled":l,tabIndex:l?-1:0,onClick:o,className:(0,k.cn)("inline-flex h-8 w-8 items-center justify-center rounded-[8px] border transition-all",l?"border-white/5 bg-white/[0.02] text-slate-600":a?"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,s.jsx)(e,{className:"h-3 w-3"})})})}function eT({label:e,active:t,onClick:a}){return(0,s.jsx)("button",{type:"button",onClick:a,className:(0,k.cn)("inline-flex items-center rounded-full border px-2.5 py-1.5 text-[10px] uppercase tracking-[0.14em] whitespace-nowrap transition-all",t?"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:e})}function eO({icon:e,title:t,value:a,actions:r,children:n,className:i}){return(0,s.jsxs)("section",{className:(0,k.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",i),children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.24em] text-slate-500",children:t}),(0,s.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,s.jsx)("p",{className:"min-w-0 font-display text-[1rem] text-white",children:a}),r?(0,s.jsx)("div",{className:"shrink-0",children:r}):null]})]}),(0,s.jsx)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/5 p-2 text-slate-300",children:(0,s.jsx)(e,{className:"h-3.5 w-3.5"})})]}),(0,s.jsx)("div",{className:"mt-3 space-y-1.5 text-[12.5px] leading-5 text-slate-300",children:n})]})}function eR({label:e,text:t,basePath:a,subtle:r=!1}){return(0,s.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:e}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(q.G,{text:t,className:(0,k.cn)("text-[12.5px] leading-5",r?"text-slate-400":"text-slate-100"),basePath:a})})]})}function e$({files:e,basePath:t,emptyLabel:a}){let r=eU(e??[]);return 0===r.length?(0,s.jsx)("p",{className:"text-[12px] text-slate-400",children:a}):(0,s.jsx)("div",{className:"space-y-2",children:r.map(e=>{var a;let r="string"==typeof(a=e.path)&&(a.startsWith("/")||/^[A-Za-z]:[\\/]/.test(a))||!!t;return(0,s.jsx)("button",{type:"button",disabled:!r,onClick:()=>void eG(e.path,t),className:(0,k.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",r?"hover:border-cyan-300/28 hover:bg-cyan-400/[0.08]":"cursor-not-allowed opacity-60"),children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"truncate font-mono text-[12px] text-cyan-100",children:e.displayPath}),(0,s.jsx)("p",{className:"truncate text-[11px] text-slate-400",children:(0,N.$7)(e.path)})]}),(0,s.jsx)(Y,{variant:"muted",children:r?"reveal":"relative"})]})},e.path)})})}function eM({items:e}){return(0,s.jsx)("div",{className:"grid grid-cols-2 gap-2",children:e.map(e=>(0,s.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,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:e.label}),(0,s.jsx)("p",{className:"mt-1 text-[13px] text-white",children:e.value})]},e.label))})}function e_({items:e,missingVariant:t="muted"}){return(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map(e=>(0,s.jsx)(Y,{variant:e.present?"success":t,children:e.label},e.id))})}function eE({items:e,emptyLabel:t,itemVariant:a,emptyVariant:r}){return 0===e.length?(0,s.jsx)(Y,{variant:r,children:t}):(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map(e=>(0,s.jsx)(Y,{variant:a,children:e},e))})}function eP({items:e,emptyLabel:t}){return 0===e.length?(0,s.jsx)("p",{className:"text-[12px] text-slate-400",children:t}):(0,s.jsx)("div",{className:"space-y-2",children:e.map(e=>(0,s.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,s.jsx)("p",{className:"text-[12px] leading-5 text-slate-200",children:e})},e))})}function eL(e){let t=e.metadata.createdFiles;return Array.isArray(t)?t.flatMap(e=>{if(!e||"object"!=typeof e)return[];let t="path"in e&&"string"==typeof e.path?e.path:null,a="displayPath"in e&&"string"==typeof e.displayPath?e.displayPath:t;return t&&a?[{path:t,displayPath:a}]:[]}):[]}function eD(e){let t=e.metadata.warnings;return Array.isArray(t)?t.filter(e=>"string"==typeof e&&e.trim().length>0):[]}function eU(e){let t=new Set,a=[];for(let s of Array.isArray(e)?e:[]){let e="string"==typeof s?.path?s.path.trim():"",r="string"==typeof s?.displayPath&&s.displayPath.trim().length>0?s.displayPath.trim():e;!e||t.has(e)||(t.add(e),a.push({path:e,displayPath:r}))}return a}function eF(e,t){if(t)return"danger";switch(e){case"assistant":return"default";case"tool":case"warning":return"warning";case"artifact":return"success";default:return"muted"}}async function eG(e,t){try{let a=await fetch("/api/files/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,basePath:t??null})}),s=await a.json();if(!a.ok)throw Error(s.error||"Unable to reveal file.");z.oR.success("Revealed file.",{description:(0,N.$7)(e)})}catch(e){z.oR.error("Could not reveal file.",{description:e instanceof Error?e.message:"Unknown file reveal error."})}}var eW=a(33494),ez=a(15054),eV=a(64248),eq=a(3342),eJ=a(58386);function eK({snapshot:e,surfaceTheme:t,isInspectorOpen:a,taskAbortRequest:r,taskAbortRunState:n,taskAbortMessage:l,onTaskAbortOpenChange:o,onTaskAbortConfirm:d,updateDialogOpen:u,updateRunState:p,updateStatusMessage:m,updateResultMessage:x,updateLog:h,updateManualCommand:g,activeRuntimeCount:b,updateInstallSummary:f,onUpdateDialogOpenChange:w,onRunOpenClawUpdate:y}){let j="running"===p,N="success"===p||"error"===p,C=(0,eq.Ku)(p),S=(0,eq.SG)(p),[A,I]=(0,i.useState)(!1),T=(0,eJ.T)(g),O=async()=>{if(g)try{await navigator.clipboard.writeText(g),z.oR.success("Command copied.",{description:"Open Terminal and paste it."})}catch(e){z.oR.error("Could not copy command.",{description:e instanceof Error?e.message:"Clipboard access is unavailable."})}},R=async()=>{if(g&&T){I(!0);try{let e=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:g})}),t=await e.json().catch(()=>null);if(!e.ok||t?.error)throw Error(t?.error||"Unable to open Terminal.");z.oR.success("Terminal opened.",{description:"Confirm the update there, then return to AgentOS."})}catch(e){z.oR.error("Could not open Terminal.",{description:e instanceof Error?e.message:"Open Terminal manually and run the command."})}finally{I(!1)}}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eV.lG,{open:null!==r,onOpenChange:e=>{"running"!==n&&o(e)},children:(0,s.jsxs)(eV.Cf,{className:(0,k.cn)("max-w-[480px] gap-5 p-5 sm:p-6","light"===t?"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,s.jsxs)(eV.c7,{children:[(0,s.jsx)(eV.L3,{className:"light"===t?"text-[#3f2f24]":"text-white",children:"Abort task?"}),(0,s.jsx)(eV.rr,{className:"light"===t?"text-[#7e6555]":"text-slate-400",children:"This stops the current OpenClaw dispatch for the selected task. It does not delete captured evidence or files."})]}),r?(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[20px] border px-4 py-4","light"===t?"border-[#e3d4c8] bg-[#fffaf6] text-[#4f3d31]":"border-rose-400/20 bg-rose-400/10 text-rose-50"),children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.24em] text-slate-500",children:"Selected task"}),(0,s.jsx)("p",{className:"mt-2 font-display text-[1.02rem] leading-6 text-inherit",children:r.title}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-sm leading-6","light"===t?"text-[#8b7262]":"text-rose-100/80"),children:r.subtitle}),l?(0,s.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:l}):null]}):null,(0,s.jsxs)(eV.Es,{children:[(0,s.jsx)(v.$,{type:"button",variant:"secondary",disabled:"running"===n,className:"light"===t?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",onClick:()=>{"running"!==n&&o(!1)},children:"Cancel"}),(0,s.jsx)(v.$,{type:"button",variant:"destructive",disabled:!r||"running"===n,onClick:()=>{d()},children:"running"===n?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Aborting..."]}):"Abort task"})]})]})}),a?null:(0,s.jsxs)("div",{className:(0,k.cn)("pointer-events-auto absolute bottom-3 right-[74px] z-30 text-[11px] tracking-[0.04em] lg:bottom-4","light"===t?"text-[#8f7664]":"text-slate-500"),children:["Built on"," ",(0,s.jsx)("a",{href:"https://openclaw.ai/",target:"_blank",rel:"noreferrer",className:(0,k.cn)("transition-colors","light"===t?"text-[#6f5a4b] hover:text-[#4f3d31]":"text-slate-300 hover:text-slate-100"),children:"OpenClaw"})," ","by"," ",(0,s.jsx)("a",{href:"https://sapienx.app/",target:"_blank",rel:"noreferrer",className:(0,k.cn)("transition-colors","light"===t?"text-[#6f5a4b] hover:text-[#4f3d31]":"text-slate-300 hover:text-slate-100"),children:"SapienX"})]}),(0,s.jsx)(eV.lG,{open:u,onOpenChange:e=>{j||w(e)},children:(0,s.jsxs)(eV.Cf,{className:(0,k.cn)("max-h-[calc(100vh-48px)] max-w-[468px] gap-5 overflow-y-auto p-5 sm:p-6","light"===t?"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,s.jsxs)(eV.c7,{children:[(0,s.jsx)(eV.L3,{className:"light"===t?"text-[#3f2f24]":"text-white",children:C}),(0,s.jsx)(eV.rr,{className:"light"===t?"text-[#7e6555]":"text-slate-400",children:S})]}),N?(0,s.jsxs)("div",{className:(0,k.cn)("space-y-4","light"===t?"text-[#4f3d31]":"text-slate-200"),children:[(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[24px] border px-4 py-5",(0,eq.CP)(p,t)),children:[(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("div",{className:(0,k.cn)("flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl border",(0,eq.to)(p,t)),children:"success"===p?(0,s.jsx)(eW.A,{className:"h-5 w-5"}):(0,s.jsx)(W.A,{className:"h-5 w-5"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"font-display text-[1.05rem] leading-6",children:"success"===p?"OpenClaw is up to date":"Update needs attention"}),(0,s.jsx)("p",{className:"mt-1 text-sm leading-6",children:x||("success"===p?"The update finished successfully.":"The update did not finish cleanly.")})]})]}),(0,s.jsxs)("div",{className:"mt-4 grid gap-3 sm:grid-cols-3",children:[(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[18px] border px-3 py-3","light"===t?"border-white/70 bg-white/70":"border-white/10 bg-slate-950/30"),children:[(0,s.jsx)("p",{className:"light"===t?"text-[10px] uppercase tracking-[0.22em] text-[#8d725f]":"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Installed version"}),(0,s.jsxs)("p",{className:"mt-2 font-display text-lg text-inherit",children:["v",e.diagnostics.version||e.diagnostics.latestVersion||"unknown"]})]}),(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[18px] border px-3 py-3","light"===t?"border-white/70 bg-white/70":"border-white/10 bg-slate-950/30"),children:[(0,s.jsx)("p",{className:"light"===t?"text-[10px] uppercase tracking-[0.22em] text-[#8d725f]":"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Latest reported"}),(0,s.jsxs)("p",{className:"mt-2 font-display text-lg text-inherit",children:["v",e.diagnostics.latestVersion||e.diagnostics.version||"unknown"]})]}),(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[18px] border px-3 py-3","light"===t?"border-white/70 bg-white/70":"border-white/10 bg-slate-950/30"),children:[(0,s.jsx)("p",{className:"light"===t?"text-[10px] uppercase tracking-[0.22em] text-[#8d725f]":"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Detected install"}),(0,s.jsx)("p",{className:"mt-2 text-sm font-medium text-inherit",children:f.label}),(0,s.jsx)("p",{className:"light"===t?"mt-1 text-xs text-[#8b7262]":"mt-1 text-xs text-slate-400",children:f.detail})]})]})]}),(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[20px] border","light"===t?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,s.jsxs)("div",{className:(0,k.cn)("flex items-center justify-between border-b px-4 py-3","light"===t?"border-[#eadccf]":"border-white/8"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[10px] uppercase tracking-[0.24em]","light"===t?"text-[#9a7f6c]":"text-slate-500"),children:"Update log"}),(0,s.jsx)("span",{className:"light"===t?"text-xs text-[#8b7262]":"text-xs text-slate-400",children:"success"===p?"Completed":"Failed"})]}),(0,s.jsx)("pre",{className:(0,k.cn)("max-h-[180px] overflow-auto whitespace-pre-wrap break-words px-4 py-3 font-mono text-[11px] leading-5","light"===t?"text-[#4f3d31]":"text-slate-200"),children:h||"No command output was captured."})]}),g?(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[20px] border px-4 py-3","light"===t?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[10px] uppercase tracking-[0.24em]","light"===t?"text-[#9a7f6c]":"text-slate-500"),children:T?"Terminal":"Manual"}),T?(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-sm leading-6","light"===t?"text-[#705b4d]":"text-slate-400"),children:"Open Terminal and run this command to confirm the update."}):null,(0,s.jsx)("p",{className:(0,k.cn)("mt-2 break-all font-mono text-[11px] leading-5","light"===t?"text-[#4f3d31]":"text-slate-200"),children:g}),(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,s.jsxs)(v.$,{type:"button",variant:"secondary",size:"sm",onClick:()=>{O()},className:"light"===t?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",children:[(0,s.jsx)(ez.A,{className:"mr-1.5 h-3 w-3"}),"Copy command"]}),T?(0,s.jsx)(v.$,{type:"button",variant:"secondary",size:"sm",onClick:()=>{R()},disabled:A,className:"light"===t?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",children:A?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(E.A,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}):null]})]}):null]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:(0,k.cn)("grid gap-3 sm:grid-cols-2","light"===t?"text-[#4f3d31]":"text-slate-200"),children:[(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[20px] border px-4 py-4","light"===t?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[10px] uppercase tracking-[0.24em]","light"===t?"text-[#9a7f6c]":"text-slate-500"),children:"Version target"}),(0,s.jsxs)("p",{className:"mt-2 font-display text-[1.1rem] leading-6 text-inherit",children:["v",e.diagnostics.latestVersion||e.diagnostics.version||"unknown"]}),(0,s.jsxs)("p",{className:"light"===t?"mt-1 text-xs text-[#8b7262]":"mt-1 text-xs text-slate-400",children:["Current: v",e.diagnostics.version||"unknown"]})]}),(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[20px] border px-4 py-4","light"===t?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[10px] uppercase tracking-[0.24em]","light"===t?"text-[#9a7f6c]":"text-slate-500"),children:"Detected install"}),(0,s.jsx)("p",{className:"mt-2 text-sm font-medium leading-6 text-inherit",children:f.label}),(0,s.jsx)("p",{className:"light"===t?"mt-1 text-xs text-[#8b7262]":"mt-1 text-xs text-slate-400",children:f.detail})]})]}),(0,s.jsx)("div",{className:(0,k.cn)("rounded-[20px] border px-4 py-3 text-sm",b>0?"light"===t?"border-rose-300/80 bg-rose-50 text-rose-800":"border-rose-300/25 bg-rose-300/10 text-rose-100":"light"===t?"border-[#e3d4c8] bg-[#fffaf6] text-[#745e4f]":"border-white/8 bg-white/[0.03] text-slate-300"),children:b>0?`${b} running or queued runtime${1===b?"":"s"} may be interrupted during the update.`:"No running runtimes are currently tracked, so the update risk is lower."}),j?(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[20px] border","light"===t?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,s.jsxs)("div",{className:(0,k.cn)("flex items-center gap-3 border-b px-4 py-3","light"===t?"border-[#eadccf]":"border-white/8"),children:[(0,s.jsx)("div",{className:(0,k.cn)("flex h-9 w-9 items-center justify-center rounded-2xl border","light"===t?"border-[#dcc6b6] bg-[#f4e8dd] text-[#7b6453]":"border-white/10 bg-white/[0.05] text-slate-200"),children:(0,s.jsx)(c.A,{className:"h-4 w-4 animate-spin"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"light"===t?"text-sm font-medium text-[#4a382c]":"text-sm font-medium text-white",children:"Update in progress"}),(0,s.jsx)("p",{className:"light"===t?"text-xs text-[#8b7262]":"text-xs text-slate-400",children:m||"Streaming OpenClaw output..."})]})]}),(0,s.jsx)("pre",{className:(0,k.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"===t?"text-[#4f3d31]":"text-slate-200"),children:h||"Waiting for command output..."})]}):null]}),(0,s.jsxs)(eV.Es,{children:[(0,s.jsx)(v.$,{type:"button",variant:"secondary",onClick:()=>{w(!1)},className:"light"===t?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",children:j?"Run in background":N?"Done":"Cancel"}),N?null:(0,s.jsx)(v.$,{type:"button",onClick:y,disabled:j,className:(0,k.cn)(e.diagnostics.updateAvailable?"bg-amber-400 text-slate-950 shadow-lg shadow-amber-400/20 hover:bg-amber-300":"","light"!==t||e.diagnostics.updateAvailable?"":"bg-[#c8946f] text-white shadow-[0_12px_28px_rgba(200,148,111,0.24)] hover:bg-[#b88461]"),children:j?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Updating..."]}):"Update now"})]})]})})]})}var eB=a(82625),eH=a(22662),eZ=a(34927),eY=a(38111),eX=a(37176),eQ=a(23169);function e0(e,t){return t?e:"system"}function e1(e,t,a,s,r,n,i,l){return"cli"===e?!l&&t.diagnostics.installed?`Installed${t.diagnostics.version?` \xb7 v${t.diagnostics.version}`:""}`:"installing-cli"===a?"Installing the CLI and local wrapper.":"detecting"===a||l||!t.diagnostics.installed?"Checking whether the CLI is already installed.":"Install the OpenClaw CLI.":"gateway"===e?!l&&t.diagnostics.loaded?"Gateway is already registered.":"installing-gateway"===a?"Registering the gateway service.":"starting-gateway"===a?"Starting the gateway service.":"detecting"===a&&s?"Checking gateway registration.":n||"verifying"===a?"Gateway is up and waiting on RPC.":!l&&t.diagnostics.rpcOk?"Gateway is running directly.":"Register the gateway service once.":i?"RPC, state, and session store are ready.":"verifying"===a?"Verifying RPC, state writes, and session store access.":"starting-gateway"===a?"Starting the gateway and waiting for RPC.":r?"Gateway is up; verify RPC and runtime state.":n?"RPC is online; final runtime checks continue.":"Start the gateway and verify RPC."}function e2(e,t){if(!e.trim())return null;let a=t.find(t=>t.id===e);return a?.name||(0,N.JZ)(e)}function e5(e,t){return e?"complete":t?"current":"pending"}function e3(e){return"light"===e?"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 e8(e){let t=e.trim().toLowerCase();return"openrouter"===t?"OpenRouter":"openai-codex"===t?"ChatGPT":"openai"===t?"OpenAI":"anthropic"===t?"Anthropic":"ollama"===t?"Ollama":"xai"===t?"xAI":"google"===t||"gemini"===t?"Gemini":"deepseek"===t?"DeepSeek":"mistral"===t?"Mistral":e.split("-").map(e=>e?e[0].toUpperCase()+e.slice(1):e).join(" ")}function e4(e){let t=e?.trim();if(!t)return null;let[a]=t.split("/",1);return a||null}function e6(e,t){let a=t?.trim()??"",s=e4(t);return s?"openai"===s&&e9(e,a)?"openai-codex":(0,eQ.a3)(s)?s:null:null}function e9(e,t){if(!(0,eX.jw)(t))return!1;let a=e.diagnostics.modelReadiness.authProviders,s=a.find(e=>"openai-codex"===e.provider),r=a.find(e=>"openai"===e.provider);return!!s?.connected||"openai-codex"===e.diagnostics.modelReadiness.preferredLoginProvider||!!(s?.canLogin&&!r?.connected)}function e7(e){let t=e.diagnostics.modelReadiness.resolvedDefaultModel||e.diagnostics.modelReadiness.defaultModel||null;if(t&&e.diagnostics.modelReadiness.defaultModelReady)return t;let a=e.diagnostics.modelReadiness.recommendedModelId||null;return a&&e.workspaces.length>0?a:null}function te(e,t){return"complete"===e?"light"===t?"border-emerald-200 bg-emerald-50/60":"border-emerald-400/20 bg-emerald-400/8":"current"===e?"light"===t?"border-[#d9c2b3] bg-white/70":"border-white/12 bg-white/[0.05]":"light"===t?"border-[#eadcd0] bg-[#fffaf6]/80":"border-white/6 bg-white/[0.02]"}function tt(e,t){return"complete"===e?"light"===t?"border-emerald-300 bg-emerald-100 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"current"===e?"light"===t?"border-[#d5b9a5] bg-[#f5ebe3] text-[#8b6d5a]":"border-white/12 bg-white/[0.06] text-white":"light"===t?"border-[#e1ccc0] bg-white text-[#9a7f6c]":"border-white/8 bg-white/[0.03] text-slate-400"}function ta(e,t){return"complete"===e?"light"===t?"bg-emerald-100 text-emerald-700":"bg-emerald-300/10 text-emerald-200":"current"===e?"light"===t?"bg-[#efe1d4] text-[#876c5a]":"bg-white/[0.06] text-slate-300":"light"===t?"bg-[#f6ece4] text-[#a08471]":"bg-white/[0.04] text-slate-500"}var ts=a(95372),tr=a(86247),tn=a(66342),ti=a(85844),tl=a(14766),to=a(17327);function td({snapshot:e,selectedModelId:t,onSelectedModelIdChange:a,onOpenAddModels:r,onSnapshotChange:l,autoDiscover:o=!0}){let[d,u]=(0,i.useState)(()=>(function(e,t){let a=e6(e,t);if(a)return a;let s=e.diagnostics.modelReadiness.authProviders.find(e=>e.connected&&(0,eQ.a3)(e.provider))?.provider;if(s)return s;let r=e.diagnostics.modelReadiness.preferredLoginProvider;if((0,eQ.a3)(r))return r;let n=e4(e.diagnostics.modelReadiness.recommendedModelId);return(0,eQ.a3)(n)?n:"openrouter"})(e,t)),[p,m]=(0,i.useState)({}),[x,h]=(0,i.useState)(!1),g=(0,i.useMemo)(()=>Object.values(p).flatMap(e=>e?.models??[]),[p]),b=(0,i.useMemo)(()=>(function(e,t,a=[]){let s=t?.trim();if(!s)return null;let r=a.find(e=>e.id===s&&(0,eQ.a3)(e.provider))?.provider;if((0,eQ.a3)(r))return r;let n=e.models.find(e=>e.id===s&&(0,eQ.a3)(e.provider))?.provider;return(0,eQ.a3)(n)?"openai"===n&&e9(e,s)?"openai-codex":n:e6(e,s)})(e,t,g),[g,t,e]);(0,i.useEffect)(()=>{b&&u(e=>e===b?e:b)},[b]),(0,i.useEffect)(()=>{$(d)},[d]);let f=(0,eQ.W2)(d),w=tu(p[d]),y=w.connection??tp(e,d),N=(0,i.useMemo)(()=>e.models.filter(e=>tm(d,e.id,e.provider)&&!1!==e.available&&!e.missing).map(t=>({id:t.id,name:t.name,provider:t.provider,input:t.input,contextWindow:t.contextWindow,local:!!t.local,available:!1!==t.available,missing:t.missing,alreadyAdded:!0,recommended:t.id===e.diagnostics.modelReadiness.recommendedModelId||t.id===e.diagnostics.modelReadiness.resolvedDefaultModel||t.id===e.diagnostics.modelReadiness.defaultModel,supportsTools:t.tags.includes("tools"),isFree:t.tags.includes("free"),tags:t.tags})),[d,e.diagnostics.modelReadiness.defaultModel,e.diagnostics.modelReadiness.recommendedModelId,e.diagnostics.modelReadiness.resolvedDefaultModel,e.models]),C=w.models.length>0?w.models:N,S=(0,i.useMemo)(()=>{let e=w.search.trim().toLowerCase();return C.slice().sort((e,t)=>{let a=Number(t.recommended)+Number(t.isFree)+Number(t.supportsTools),s=Number(e.recommended)+Number(e.isFree)+Number(e.supportsTools);return a!==s?a-s:e.name.localeCompare(t.name)}).filter(t=>!e||`${t.name} ${t.id} ${t.tags.join(" ")}`.toLowerCase().includes(e))},[C,w.search]),A=e.models.find(e=>e.id===t)?.name||S.find(e=>e.id===t)?.name||t.trim()||null,I="connecting"===w.flowState||"discovering"===w.flowState||w.statusMessage?.startsWith("Checking ")===!0&&!y.connected,T="discovering"===w.flowState?`Discovering ${f.shortLabel} models...`:"connecting"===w.flowState?w.statusMessage||`Connecting ${f.shortLabel}...`:w.statusMessage||`Checking ${f.shortLabel}...`,O=S.length>6||!!f.searchPlaceholder,R=y.connected||S.length>0||!!w.emptyState;async function $(e){let t=tu(p[e]);t.loaded&&t.connection||await P(e)}function M(e,t){m(a=>({...a,[e]:{...tu(a[e]),...t}}))}function _(e,t,a,s){M(e,{flowState:a,connection:t.connection,statusMessage:t.message,errorMessage:null,emptyState:t.emptyState??null,manualCommand:t.manualCommand??null,docsUrl:t.docsUrl??null,models:t.models,loaded:!0,...s})}async function P(e){let t=(0,tl.oZ)(e);M(e,{flowState:"idle",errorMessage:null,statusMessage:`Checking ${e8(e)}...`});try{let a=await t.getConnectionStatus(),s=a.connection.connected&&o&&!F(e);_(e,a,s?"discovering":"idle"),U(a),s&&await D(e,!0)}catch(t){M(e,{flowState:"error",errorMessage:t instanceof Error?t.message:"Provider status could not be loaded.",loaded:!0})}}async function L(e,t){let a=(0,tl.oZ)(e),s=tu(p[e]);M(e,{flowState:"connecting",errorMessage:null,statusMessage:"openai-codex"===e?t?.force?"Refreshing Codex app-server setup...":"Checking Codex app-server setup...":`Connecting ${(0,eQ.W2)(e).shortLabel}...`});try{let r=await a.connect({apiKey:s.apiKey,force:t?.force}),n=r.connection.connected&&!r.manualCommand&&!F(e);_(e,r,n?"discovering":"idle",{apiKey:""}),U(r),n&&await D(e,!0)}catch(t){M(e,{flowState:"error",errorMessage:t instanceof Error?t.message:"Provider connection failed."})}}async function D(e,t=!1){let a=(0,tl.oZ)(e),s=tu(p[e]);if(t||"discovering"!==s.flowState){M(e,{flowState:"discovering",errorMessage:null,statusMessage:"ollama"===e?"Checking the local Ollama runtime...":`Discovering ${(0,eQ.W2)(e).shortLabel} models...`});try{let t=await a.discoverModels();_(e,t,t.models.length>0?"ready":"idle",{search:s.search}),U(t)}catch(t){M(e,{flowState:"error",errorMessage:t instanceof Error?t.message:"Provider discovery failed."})}}}function U(e){e.snapshot&&l?.(e.snapshot)}function F(t){return e.models.some(e=>tm(t,e.id,e.provider)&&!1!==e.available&&!e.missing)}async function G(e){try{await navigator.clipboard.writeText(e),j.o.success("Copied.",{description:"Command copied to your clipboard."})}catch(e){j.o.error("Copy failed.",{description:e instanceof Error?e.message:"Clipboard access is not available."})}}async function W(e){if(!(0,eJ.T)(e))return void await G(e);h(!0);try{let t=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e})}),a=await t.json().catch(()=>null);if(!t.ok||a?.error)throw Error(a?.error||"Unable to open Terminal.");j.o.success("Terminal opened.",{description:"Finish auth there, then refresh this provider."})}catch(e){j.o.error("Could not open Terminal.",{description:e instanceof Error?e.message:"Open Terminal manually and run the command."})}finally{h(!1)}}return(0,s.jsxs)("div",{className:(0,k.cn)("mt-3 rounded-[16px] border px-3 py-3","border-white/8 bg-[rgba(255,255,255,0.03)]"),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("div",{className:"min-w-0",children:(0,s.jsxs)("p",{className:"whitespace-nowrap text-[8px] font-medium text-slate-500",children:["Provider first : ",eQ.y8.length," providers"]})}),(0,s.jsx)("div",{className:"flex shrink-0 flex-wrap gap-1.5",children:A?(0,s.jsx)(B.E,{variant:"default",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Selected"}):null})]}),(0,s.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:eQ.y8.map(t=>{let r=tu(p[t.id]).connection??tp(e,t.id);return(0,s.jsx)("div",{className:"w-[128px] shrink-0 snap-start sm:w-[136px]",children:(0,s.jsx)(tn.I,{descriptor:t,active:d===t.id,compact:!0,micro:!0,connected:r.connected,detail:r.detail,onClick:()=>{u(t.id),b&&b!==t.id&&a("")}})},t.id)})}),(0,s.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,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("div",{children:(0,s.jsx)("p",{className:"font-display text-[0.88rem] text-white",children:f.label})}),(0,s.jsx)(B.E,{variant:y.connected?"success":"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:y.connected?"Connected":"Not connected"})]}),w.statusMessage&&!I?(0,s.jsx)("div",{className:"mt-3 rounded-[16px] border border-white/10 bg-white/[0.04] px-3 py-2",children:(0,s.jsx)("p",{className:"text-[11px] text-slate-200",children:w.statusMessage})}):null,w.errorMessage?(0,s.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:w.errorMessage}):null,"apiKey"!==f.connectKind||y.connected||0!==S.length||I?null:(0,s.jsxs)("div",{className:"mt-4 flex flex-wrap items-end gap-3",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("label",{className:"block text-[9px] uppercase tracking-[0.16em] text-slate-500",children:"API key"}),(0,s.jsx)(ti.p,{type:"password",value:w.apiKey,onChange:e=>M(d,{apiKey:e.target.value}),placeholder:"openrouter"===d?"sk-or-v1-...":"Paste API key",className:"mt-1.5 h-8 text-[11px]"})]}),(0,s.jsx)(v.$,{type:"button",className:"h-8 rounded-full px-3 text-[10px]",disabled:"connecting"===w.flowState||!w.apiKey.trim(),onClick:()=>{L(d)},children:"connecting"===w.flowState?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Connecting..."]}):`Connect ${f.shortLabel}`})]}),"apiKey"===f.connectKind&&w.manualCommand&&!I?(0,s.jsxs)("div",{className:"mt-3 rounded-[16px] border border-cyan-300/15 bg-cyan-300/[0.07] p-3",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-[11px] font-medium text-cyan-50",children:"Finish setup in Terminal"}),(0,s.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,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(v.$,{type:"button",variant:"secondary",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",disabled:x,onClick:()=>{W(w.manualCommand||"")},children:x?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(E.A,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}),(0,s.jsxs)(v.$,{type:"button",variant:"ghost",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:()=>{G(w.manualCommand||"")},children:[(0,s.jsx)(ez.A,{className:"mr-1.5 h-3 w-3"}),"Copy command"]}),(0,s.jsxs)(v.$,{type:"button",variant:"ghost",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:()=>{P(d)},children:[(0,s.jsx)(n.A,{className:"mr-1.5 h-3 w-3"}),"I've connected it"]})]})]}),(0,s.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,s.jsx)("code",{className:"text-[10px] text-slate-200",children:w.manualCommand})})]}):null,I?(0,s.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,s.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,s.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,s.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,s.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,s.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,s.jsxs)("div",{className:"relative flex max-w-[340px] flex-col items-center",children:[(0,s.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,s.jsx)(c.A,{className:"h-8 w-8 animate-spin text-cyan-200"})}),(0,s.jsx)("p",{className:"font-display text-[1.1rem] leading-[1.2rem] tracking-[0.01em] text-white",children:T}),(0,s.jsx)("p",{className:"mt-2 max-w-[280px] text-[11px] leading-[1rem] text-slate-400",children:"discovering"===w.flowState?"Pulling the provider catalog into AgentOS.":"connecting"===w.flowState?"Preparing the provider connection.":"Checking provider status before discovery."}),(0,s.jsxs)("div",{className:"mt-4 flex gap-1.5",children:[(0,s.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-cyan-300/90"}),(0,s.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-cyan-300/60 [animation-delay:120ms]"}),(0,s.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-cyan-300/30 [animation-delay:240ms]"})]})]})]}):null,"oauth"!==f.connectKind||y.connected||0!==S.length||I?null:(0,s.jsxs)("div",{className:"mt-4 rounded-[20px] border border-white/10 bg-white/[0.03] p-3",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-display text-[0.88rem] text-white",children:"Use Codex app-server"}),(0,s.jsxs)("p",{className:"mt-1 max-w-[500px] text-[10px] leading-[0.98rem] text-slate-400",children:["OpenClaw ",to.L," uses the Codex app-server plugin for ChatGPT-backed models."]})]}),(0,s.jsx)(v.$,{type:"button",className:"h-8 rounded-full px-3 text-[10px]",disabled:"connecting"===w.flowState&&!w.manualCommand,onClick:()=>{L(d)},children:"connecting"!==w.flowState||w.manualCommand?"Connect ChatGPT":(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Connecting..."]})}),(0,s.jsx)(v.$,{type:"button",variant:"ghost",className:"h-8 rounded-full px-3 text-[10px]",disabled:"connecting"===w.flowState&&!w.manualCommand,onClick:()=>{L(d,{force:!0})},children:"Refresh app-server"})]}),w.manualCommand?(0,s.jsxs)("div",{className:"mt-3 rounded-[16px] border border-cyan-300/15 bg-cyan-300/[0.07] p-3",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-[11px] font-medium text-cyan-50",children:"Finish setup in Terminal"}),(0,s.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,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(v.$,{type:"button",variant:"secondary",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",disabled:x,onClick:()=>{W(w.manualCommand||"")},children:x?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(E.A,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}),(0,s.jsxs)(v.$,{type:"button",variant:"ghost",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:()=>{G(w.manualCommand||"")},children:[(0,s.jsx)(ez.A,{className:"mr-1.5 h-3 w-3"}),"Copy command"]}),(0,s.jsxs)(v.$,{type:"button",variant:"ghost",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:()=>{P(d)},children:[(0,s.jsx)(n.A,{className:"mr-1.5 h-3 w-3"}),"I've connected it"]})]})]}),(0,s.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,s.jsx)("code",{className:"text-[10px] text-slate-200",children:w.manualCommand})})]}):null]}),R&&!I?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"mt-4 flex flex-nowrap items-center justify-between gap-2 overflow-x-auto pb-1",children:[(0,s.jsx)("p",{className:"shrink-0 whitespace-nowrap text-[9px] uppercase tracking-[0.16em] text-slate-500",children:S.length>0?`Found ${S.length} model${1===S.length?"":"s"}`:"No models found"}),(0,s.jsxs)("div",{className:"flex shrink-0 flex-nowrap gap-1.5",children:[(0,s.jsxs)(v.$,{type:"button",variant:"secondary",size:"sm",onClick:()=>{P(d)},className:"h-6 rounded-full px-2 text-[9px]",children:[(0,s.jsx)(n.A,{className:"mr-1 h-2.5 w-2.5"}),"Refresh"]}),(0,s.jsx)(v.$,{type:"button",variant:"ghost",size:"sm",onClick:()=>r(d),className:"h-6 rounded-full px-2 text-[9px]",children:"Add Models"})]})]}),O?(0,s.jsxs)("div",{className:"relative mt-3",children:[(0,s.jsx)(tr.A,{className:"pointer-events-none absolute left-3 top-1/2 h-3 w-3 -translate-y-1/2 text-slate-500"}),(0,s.jsx)(ti.p,{value:w.search,onChange:e=>M(d,{search:e.target.value}),placeholder:f.searchPlaceholder??"Search models",className:"h-8 pl-8 text-[11px]"})]}):null,w.emptyState?(0,s.jsx)(tc,{emptyState:w.emptyState,onRefresh:()=>{P(d)}}):null,S.length>0?(0,s.jsx)("div",{className:"mt-3 max-h-[min(34vh,260px)] space-y-1 overflow-y-auto pr-1",children:S.map(e=>{let r=t===e.id;return(0,s.jsxs)("button",{type:"button",onClick:()=>{(0,eQ.a3)(e.provider)&&u(e.provider),a(e.id)},className:(0,k.cn)("flex w-full items-start justify-between gap-2 rounded-[14px] border px-2.5 py-2 text-left transition-all",r?"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,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"truncate text-[11px] font-medium text-white",children:e.name}),(0,s.jsx)("p",{className:"mt-0.5 truncate text-[9px] uppercase tracking-[0.16em] text-slate-500",children:e.id}),(0,s.jsxs)("div",{className:"mt-1 flex flex-wrap gap-1.5 text-[9px] text-slate-400",children:[(0,s.jsx)("span",{children:e.input}),e.contextWindow?(0,s.jsxs)("span",{children:[Intl.NumberFormat().format(e.contextWindow)," ctx"]}):null,e.isFree?(0,s.jsx)("span",{children:"free"}):null]})]}),(0,s.jsx)("div",{className:"shrink-0",children:r?(0,s.jsx)(B.E,{variant:"default",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Selected"}):e.recommended?(0,s.jsx)(B.E,{variant:"default",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Recommended"}):e.local?(0,s.jsx)(B.E,{variant:"success",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Local"}):(0,s.jsx)(B.E,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Remote"})})]},e.id)})}):(0,s.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,A&&!I?(0,s.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,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"text-[8px] uppercase tracking-[0.16em] text-emerald-200/75",children:"Selected model"}),(0,s.jsx)("p",{className:"truncate text-[11px] text-emerald-50",children:A})]}),(0,s.jsx)(B.E,{variant:"default",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Selected"})]}):null]})]})}function tc({emptyState:e,onRefresh:t}){return(0,s.jsxs)("div",{className:"mt-3 rounded-[18px] border border-white/10 bg-white/[0.03] p-3",children:[(0,s.jsx)("p",{className:"font-display text-[0.88rem] text-white",children:e.title}),(0,s.jsx)("p",{className:"mt-1 max-w-[520px] text-[11px] leading-[0.98rem] text-slate-400",children:e.description}),(0,s.jsx)("div",{className:"mt-3 flex flex-wrap gap-1.5",children:(0,s.jsxs)(v.$,{type:"button",variant:"secondary",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:t,children:[(0,s.jsx)(n.A,{className:"mr-1.5 h-3 w-3"}),"Refresh provider"]})})]})}function tu(e){return e||{loaded:!1,connection:null,statusMessage:null,errorMessage:null,emptyState:null,manualCommand:null,docsUrl:null,models:[],apiKey:"",search:"",flowState:"idle"}}function tp(e,t){let a=e.diagnostics.modelReadiness.authProviders.find(e=>e.provider===t),s=e.models.filter(e=>tm(t,e.id,e.provider)).length;if("ollama"===t)return{connected:s>0,detail:s>0?`${s} model${1===s?"":"s"} already visible in AgentOS.`:"Detect local models from this machine."};let r=!!a?.connected;return{connected:r,detail:r?a?.detail||(0,eQ.W2)(t).helperText:s>0?`${s} model${1===s?"":"s"} are already saved in AgentOS. Connect ${e8(t)} to use them.`:(0,eQ.W2)(t).helperText}}function tm(e,t,a){return(0,eX.Pr)(e,t,a)}function tx({steps:e,surfaceTheme:t,statusCopy:a,showDetails:r,phaseLabel:n,run:l,gatewayAuthNeedsSetup:o,onOpenGatewayAuthSettings:d}){let[u,p]=(0,i.useState)(!1);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"mt-3",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[7px] uppercase tracking-[0.18em]","light"===t?"text-[#977b69]":"text-slate-500"),children:"Step 1"}),(0,s.jsx)("h2",{className:(0,k.cn)("mt-1 text-[13px] font-medium","light"===t?"text-[#33251c]":"text-white"),children:"System setup"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-[10px] leading-[0.95rem]","light"===t?"text-[#705b4d]":"text-slate-400"),children:"Install the CLI, start the gateway, and verify RPC."})]}),(0,s.jsx)("div",{className:"mt-2.5 space-y-1.5",children:e.map((e,a)=>{let r="runtime"===e.id,n="current"===e.state&&"running"===l.runState,i="complete"===e.state?"Ready":"current"===e.state?n?"Checking":r?"Needs verification":"Pending":"Pending";return(0,s.jsxs)("div",{className:(0,k.cn)("relative flex items-center gap-1.5 overflow-hidden rounded-[12px] border px-2 py-1.5",n?"light"===t?"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)]":"",te(e.state,t)),children:[n?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(f.P.div,{"aria-hidden":"true",className:(0,k.cn)("pointer-events-none absolute inset-y-0 left-0 w-1/3 blur-[1px]","light"===t?"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%",r?"250%":"230%"]},transition:{duration:r?1.45:2.05,repeat:1/0,ease:"linear"}}),(0,s.jsx)(f.P.div,{"aria-hidden":"true",className:(0,k.cn)("pointer-events-none absolute inset-x-2 bottom-0 h-px rounded-full","light"===t?"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:r?1.2:1.65,repeat:1/0,ease:"easeInOut"}})]}):null,(0,s.jsxs)("span",{className:(0,k.cn)("relative mt-0.5 inline-flex h-5 w-5 items-center justify-center overflow-hidden rounded-full border text-[9px] font-medium",tt(e.state,t)),children:[n?(0,s.jsx)(f.P.span,{"aria-hidden":"true",className:(0,k.cn)("absolute inset-0 rounded-full border","light"===t?"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:r?1.5:1.9,repeat:1/0,ease:"easeInOut"}}):null,(0,s.jsx)("span",{className:"relative z-[1]",children:"complete"===e.state?(0,s.jsx)(eB.A,{className:"h-2.5 w-2.5"}):n?(0,s.jsx)(c.A,{className:"h-2.5 w-2.5 animate-spin"}):a+1})]}),(0,s.jsxs)("div",{className:"relative z-[1] min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[11px]","light"===t?"text-[#3e2f24]":"text-white"),children:e.label}),(0,s.jsx)("span",{className:(0,k.cn)("rounded-full px-1.5 py-0.5 text-[6px] uppercase tracking-[0.14em]",ta(e.state,t)),children:i})]}),(0,s.jsx)("p",{className:(0,k.cn)("mt-0.5 text-[8px] leading-[0.82rem]","light"===t?"text-[#8f7664]":"text-slate-500"),children:e.description})]})]},e.id)})}),(0,s.jsx)(tN,{surfaceTheme:t,statusCopy:a,showDetails:r,phaseLabel:n,detailsOpen:u,onDetailsOpenChange:p,run:l}),o?(0,s.jsx)("div",{className:(0,k.cn)("mt-2.5 rounded-[14px] border px-2.5 py-2","light"===t?"border-amber-300 bg-amber-50 text-amber-950":"border-amber-300/22 bg-amber-300/10 text-amber-100"),children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(W.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"text-[10px] font-medium",children:"Native Gateway auth needs an env credential"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-[9px] leading-[0.95rem]","light"===t?"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,s.jsx)(v.$,{type:"button",size:"sm",variant:"secondary",onClick:d,className:(0,k.cn)("mt-2",e3(t)),children:"Configure Gateway auth"})]})]})}):null]})}function th({snapshot:e,surfaceTheme:t,statusCopy:a,showDetails:r,phaseLabel:n,run:l,modelPhase:o,selectedModelId:d,modelSwitchFeedback:c,onSelectedModelIdChange:u,onClearModelSwitchFeedback:p,onOpenAddModels:m,onSnapshotChange:x}){let[h,g]=(0,i.useState)(!0),b=(0,i.useMemo)(()=>e.models.filter(e=>!1!==e.available&&!e.missing),[e.models]),f=(0,i.useMemo)(()=>e2(d,b),[b,d]),w=e.diagnostics.modelReadiness.resolvedDefaultModel||e.diagnostics.modelReadiness.defaultModel||null,v=(0,eY.X2)(e),y=tw(w,b),j=tw(d,b),N=!!(d.trim()&&d.trim()!==(w?.trim()??"")),C=(0,i.useMemo)(()=>(function({statusCopy:e,run:t,selectedModelLabel:a,phase:s}){var r;let n=`${e}
4
- ${t.log}`.toLowerCase(),i=!!t.manualCommand||/terminal|sign-in|login|oauth|api key|provider auth/.test(n),l="verifying"===s&&(/creating a demo workspace/.test(n)||/resolving workspace settings and reserving the target directory/.test(n)||/preparing workspace folder/.test(n)||/checking input and target path/.test(n)||/reserved target directory/.test(n)||/creating a fresh workspace folder/.test(n)||/fresh workspace folder created at/.test(n)||/preparing an empty workspace scaffold/.test(n)||/generating workspace docs/.test(n)||/scaffolding workspace files/.test(n)||/workspace files and starter docs are in place/.test(n)||/workspace bootstrap is wrapping up without a kickoff mission/.test(n)||/creating the first workspace agent/.test(n)||/provisioning the first workspace agent/.test(n)||/creating agent \d+ of \d+/.test(n)||/linked to the workspace/.test(n)||/finalizing workspace bootstrap/.test(n)||/workspace bootstrap finished/.test(n)||/demo workspace is ready/.test(n));if("running"!==t.runState||i||!l)return null;let o=(r=n,/resolving workspace settings/.test(r)||/checking input and target path/.test(r)||/reserved target directory/.test(r)||/creating a demo workspace/.test(r)?1:/preparing workspace folder/.test(r)||/creating a fresh workspace folder/.test(r)||/preparing an empty workspace scaffold/.test(r)||/scaffolding workspace files/.test(r)||/fresh workspace folder created at/.test(r)||/generating workspace docs/.test(r)||/workspace files and starter docs are in place/.test(r)?2:/creating the first workspace agent/.test(r)||/provisioning the first workspace agent/.test(r)||/creating agent \d+ of \d+/.test(r)||/linked to the workspace/.test(r)?3:/finalizing workspace bootstrap/.test(r)||/workspace bootstrap is wrapping up without a kickoff mission/.test(r)||/workspace bootstrap finished/.test(r)||/demo workspace is ready/.test(r)?4:1),d=[{id:"model",label:"Default model",detail:a?`${a} 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((e,t)=>({...e,state:t<o?"done":t===o?"current":"pending"}));return{stepIndex:o,steps:d,logLines:t.log.split(/\r?\n/).map(e=>e.trim().replace(/^>\s*/,"")).filter(e=>!!e).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:a}})({statusCopy:a,run:l,selectedModelLabel:f,phase:o}),[o,l,f,a]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"mt-3",children:(0,s.jsx)("p",{className:(0,k.cn)("text-[11px] font-medium","light"===t?"text-[#33251c]":"text-white"),children:"Step 2: Model setup"})}),C?(0,s.jsx)(tk,{surfaceTheme:t,statusCopy:a,phaseLabel:n,buildScene:C}):"idle"!==c.phase?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(tb,{surfaceTheme:t,feedback:c,defaultModelLabel:tw(c.previousModelId,b),nextModelLabel:tw(c.nextModelId,b),onChangeAgain:p}),(0,s.jsx)(tN,{surfaceTheme:t,statusCopy:a,showDetails:r,phaseLabel:n,detailsOpen:h,onDetailsOpenChange:g,run:l})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(tg,{surfaceTheme:t,defaultModelLabel:y,switchTargetLabel:j,hasPendingModelSwitch:N}),(0,s.jsx)(td,{snapshot:e,selectedModelId:d,onSelectedModelIdChange:u,onOpenAddModels:m,onSnapshotChange:x,autoDiscover:!v}),(0,s.jsx)(tN,{surfaceTheme:t,statusCopy:a,showDetails:r,phaseLabel:n,detailsOpen:h,onDetailsOpenChange:g,run:l})]})]})}function tg({surfaceTheme:e,defaultModelLabel:t,switchTargetLabel:a,hasPendingModelSwitch:r}){return(0,s.jsx)("div",{className:(0,k.cn)("mt-2 rounded-[14px] border px-2.5 py-2","light"===e?"border-[#e8d8ca] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[7px] uppercase tracking-[0.16em]","light"===e?"text-[#9a7a65]":"text-slate-500"),children:"Detected default"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 truncate text-[10px]","light"===e?"text-[#3e2f24]":"text-white"),children:t??"Not set"})]}),r?(0,s.jsxs)("div",{className:"min-w-0 text-right",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[7px] uppercase tracking-[0.16em]","light"===e?"text-[#9a7a65]":"text-slate-500"),children:"Switch to"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 truncate text-[10px]","light"===e?"text-[#7a4d2d]":"text-cyan-100"),children:a})]}):null]})})}function tb({surfaceTheme:e,feedback:t,defaultModelLabel:a,nextModelLabel:r,onChangeAgain:n}){var i;let l,o="light"===e,d="saving"===t.phase,u="success"===t.phase,p="error"===t.phase,m=t.message||(u?"AgentOS will use this route for new actions.":p?"Review the log below, then try again.":"Saving the route, refreshing OpenClaw config, and updating AgentOS."),x=(l=(i=t).message??"","saving"!==i.phase?0:/updating agentos snapshot|snapshot/i.test(l)?3:/verifying selected provider|provider/i.test(l)?2:+!!/refreshing openclaw config|config/i.test(l));return(0,s.jsx)("div",{className:(0,k.cn)("mt-3 overflow-hidden rounded-[22px] border",o?"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,s.jsxs)("div",{className:"relative isolate min-h-[300px] overflow-hidden px-4 py-4 text-center",children:[(0,s.jsx)("div",{"aria-hidden":"true",className:(0,k.cn)("pointer-events-none absolute inset-0",o?"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,s.jsxs)("div",{className:"relative z-[1] flex flex-col items-center",children:[(0,s.jsxs)("div",{className:"relative flex h-20 w-20 items-center justify-center",children:[d?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(f.P.div,{"aria-hidden":"true",className:(0,k.cn)("absolute h-20 w-20 rounded-full border",o?"border-[#d1a98b]":"border-cyan-200/24"),animate:{rotate:360},transition:{duration:8,repeat:1/0,ease:"linear"}}),(0,s.jsx)(f.P.div,{"aria-hidden":"true",className:(0,k.cn)("absolute h-14 w-14 rounded-full border border-dashed",o?"border-[#c8946f]":"border-cyan-200/40"),animate:{rotate:-360},transition:{duration:6,repeat:1/0,ease:"linear"}})]}):null,(0,s.jsx)("span",{className:(0,k.cn)("relative z-[1] inline-flex h-12 w-12 items-center justify-center rounded-full border",u?o?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":p?o?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200":o?"border-[#d7b59a] bg-white text-[#9a6a48]":"border-cyan-300/20 bg-cyan-300/10 text-cyan-100"),children:u?(0,s.jsx)(eB.A,{className:"h-5 w-5"}):d?(0,s.jsx)(c.A,{className:"h-5 w-5 animate-spin"}):(0,s.jsx)(ts.A,{className:"h-5 w-5"})})]}),(0,s.jsx)("p",{className:(0,k.cn)("mt-3 text-[8px] uppercase tracking-[0.22em]",o?"text-[#94735e]":"text-cyan-200/70"),children:"Model route"}),(0,s.jsx)("h3",{className:(0,k.cn)("mt-1 text-[17px] font-medium tracking-[-0.03em]",o?"text-[#2d2118]":"text-white"),children:u?"Default model updated":p?"Default model could not be changed":"Switching default model"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 max-w-[320px] text-[10px] leading-[1rem]",o?"text-[#6d5647]":"text-slate-300"),children:m}),(0,s.jsxs)("div",{className:(0,k.cn)("mt-4 grid w-full gap-2 rounded-[16px] border px-3 py-3 text-left",o?"border-[#ead8c8] bg-white/70":"border-white/8 bg-white/[0.04]"),children:[(0,s.jsx)(tf,{label:"Previous",value:a??"Not set",surfaceTheme:e,muted:!0}),(0,s.jsx)(tf,{label:"New default",value:r??"Not selected",surfaceTheme:e})]}),d?(0,s.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((e,t)=>(0,s.jsxs)("div",{className:(0,k.cn)("flex items-center gap-2 rounded-[12px] border px-2.5 py-2",t===x?o?"border-[#c8946f] bg-[#fff5ed]":"border-cyan-300/24 bg-cyan-300/[0.07]":t<x?o?"border-emerald-200 bg-emerald-50/60":"border-emerald-300/16 bg-emerald-300/[0.05]":o?"border-[#ead8c8] bg-white/55":"border-white/8 bg-white/[0.03]"),children:[(0,s.jsx)("span",{className:(0,k.cn)("inline-flex h-4 w-4 items-center justify-center rounded-full border text-[8px]",t<x?o?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":t===x?o?"border-[#c8946f] bg-[#f8eadf] text-[#8c5d3d]":"border-cyan-300/30 bg-cyan-300/10 text-cyan-100":o?"border-[#e0cec0] bg-white text-[#9a7f6c]":"border-white/10 bg-white/[0.03] text-slate-500"),children:t<x?(0,s.jsx)(eB.A,{className:"h-2.5 w-2.5"}):t+1}),(0,s.jsx)("p",{className:(0,k.cn)("text-[10px]",o?"text-[#5f4b3e]":"text-slate-300"),children:e})]},e))}):null,d?null:(0,s.jsx)(v.$,{type:"button",variant:"secondary",size:"sm",onClick:n,className:(0,k.cn)("mt-4 h-8 rounded-full px-3 text-[10px]",e3(e)),children:"Change again"})]})]})})}function tf({label:e,value:t,surfaceTheme:a,muted:r=!1}){return(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("span",{className:(0,k.cn)("text-[7px] uppercase tracking-[0.16em]","light"===a?"text-[#9a7f6c]":"text-slate-500"),children:e}),(0,s.jsx)("span",{className:(0,k.cn)("min-w-0 truncate text-right text-[10px]",r?"light"===a?"text-[#8a7261]":"text-slate-400":"light"===a?"text-[#3e2f24]":"text-white"),children:t})]})}function tw(e,t){return e?.trim()?e2(e,t)??(0,N.JZ)(e):null}function tv({surfaceTheme:e,workspaceCount:t,agentCount:a,workspaceSetupReady:r,defaultModelLabel:n,createProgress:i,createRunState:l}){let o=t>0,d="running"===l&&!!i,c="error"===l&&!!i,u=!!i&&(d||c),p=o?r?`You already have ${t} workspace${1===t?"":"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.":d?"AgentOS Workspace is being provisioned now. The scaffold and starter agent are being built in the background.":c?"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,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:(0,k.cn)("mt-3 rounded-[16px] border px-3 py-3","light"===e?"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,s.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,s.jsx)("span",{className:(0,k.cn)("mt-0.5 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full border","light"===e?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/10 text-emerald-200"),children:(0,s.jsx)(eB.A,{className:"h-3.5 w-3.5"})}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[7px] uppercase tracking-[0.18em]","light"===e?"text-emerald-700/75":"text-emerald-200/75"),children:"Launchpad"}),(0,s.jsx)("h2",{className:(0,k.cn)("mt-1 text-[13px] font-medium","light"===e?"text-[#2d2118]":"text-white"),children:"OpenClaw is ready."}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-[10px] leading-[0.95rem]","light"===e?"text-[#5f4b3e]":"text-slate-300"),children:p})]})]}),u?null:(0,s.jsxs)("div",{className:"mt-3 grid gap-1.5 sm:grid-cols-2",children:[(0,s.jsx)(tj,{surfaceTheme:e,label:"System",value:"Online",detail:"CLI, gateway, and runtime access verified"}),(0,s.jsx)(tj,{surfaceTheme:e,label:r?"Default model":"Detected default",value:n,detail:r?"Usable model route selected":"Detected on this machine, not yet confirmed by a workspace."}),(0,s.jsx)(tj,{surfaceTheme:e,label:"Runtime",value:"Smoke test passed",detail:"A live agent turn was verified"}),(0,s.jsx)(tj,{surfaceTheme:e,label:o?"Starter agent":"Workspaces",value:o?a>0?"Visible":"Pending":String(t),detail:o?"Required before canvas handoff":"Create one to begin"})]})]}),u?(0,s.jsx)(ty,{surfaceTheme:e,progress:i,runState:l}):(0,s.jsxs)("div",{className:(0,k.cn)("mt-2.5 rounded-[12px] border px-2.5 py-2","light"===e?"border-[#e5d5c9] bg-[#fffaf6]":"border-white/8 bg-[rgba(255,255,255,0.02)]"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[7px] uppercase tracking-[0.16em]","light"===e?"text-[#977b69]":"text-slate-500"),children:"Next step"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-[11px] leading-[1rem]","light"===e?"text-[#5f4b3e]":"text-slate-300"),children:o?"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 ty({surfaceTheme:e,progress:t,runState:a}){let r="light"===e,n=t.steps.find(e=>"active"===e.status)??t.steps[0]??null,i="error"===a;return(0,s.jsxs)("div",{className:(0,k.cn)("relative mt-2.5 overflow-hidden rounded-[18px] border px-2.5 py-2.5",r?i?"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))]":i?"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,s.jsx)("div",{"aria-hidden":"true",className:(0,k.cn)("pointer-events-none absolute inset-0",r?"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%)]":i?"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,s.jsx)(f.P.div,{"aria-hidden":"true",className:(0,k.cn)("pointer-events-none absolute -left-8 top-5 h-24 w-24 rounded-full blur-3xl",r?"bg-[#efc6a8]/20":i?"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,s.jsx)(f.P.div,{"aria-hidden":"true",className:(0,k.cn)("pointer-events-none absolute -right-4 top-8 h-28 w-28 rounded-full blur-3xl",r?"bg-[#f6d9c2]/18":i?"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,s.jsxs)("div",{className:"relative z-[1] flex items-start justify-between gap-2",children:[(0,s.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[(0,s.jsx)(f.P.div,{className:(0,k.cn)("mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full border",r?i?"border-rose-300 bg-white text-rose-700":"border-[#d9b59a] bg-white text-[#8b6d5a]":i?"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:i?(0,s.jsx)(W.A,{className:"h-3.5 w-3.5"}):(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"})}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[7px] uppercase tracking-[0.18em]",r?i?"text-rose-600/75":"text-[#977b69]":i?"text-rose-200/75":"text-cyan-200/70"),children:i?"Needs attention":"Building"}),(0,s.jsx)("h3",{className:(0,k.cn)("mt-1 text-[13px] font-medium",r?i?"text-rose-950":"text-[#281d17]":i?"text-rose-50":"text-white"),children:i?"Workspace creation needs attention":t.title}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-[10px] leading-[0.95rem]",r?i?"text-rose-700":"text-[#6f5a4c]":i?"text-rose-100/80":"text-slate-300"),children:i?"Review the captured output and retry when the workspace state is clean.":t.description})]})]}),(0,s.jsxs)("div",{className:"flex shrink-0 flex-col items-end gap-1",children:[(0,s.jsx)("span",{className:(0,k.cn)("rounded-full border px-2 py-0.5 text-[8px] uppercase tracking-[0.16em]",r?i?"border-rose-200 bg-white text-rose-700":"border-[#dcc7b8] bg-white/75 text-[#8b6f5c]":i?"border-rose-300/20 bg-rose-300/8 text-rose-100":"border-cyan-300/16 bg-cyan-300/10 text-cyan-100"),children:i?"Error":`${t.percent}%`}),n?(0,s.jsx)("span",{className:(0,k.cn)("max-w-[140px] truncate rounded-full border px-2 py-0.5 text-[7px] uppercase tracking-[0.14em]",r?i?"border-rose-200 bg-white text-rose-700":"border-[#e9d7ca] bg-white text-[#8b6f5c]":i?"border-rose-300/18 bg-rose-300/8 text-rose-100":"border-white/10 bg-white/[0.04] text-slate-300"),children:n.label}):null]})]}),(0,s.jsx)("div",{className:"relative z-[1] mt-2.5 h-1.5 overflow-hidden rounded-full bg-white/8",children:(0,s.jsx)(f.P.div,{className:(0,k.cn)("h-full rounded-full transition-[width] duration-500 ease-out",r?i?"bg-rose-300/85":"bg-amber-300/85":i?"bg-rose-300/85":"bg-cyan-300/85"),style:{width:`${t.percent}%`}})}),(0,s.jsxs)("div",{className:(0,k.cn)("relative z-[1] mt-2.5 overflow-hidden rounded-[14px] border px-2.5 py-2",r?"border-[#ead8c8] bg-white/70":"border-white/8 bg-white/[0.04]"),children:[(0,s.jsx)("div",{"aria-hidden":"true",className:(0,k.cn)("absolute inset-0 opacity-60",r?"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,s.jsx)("div",{className:"relative z-[1] flex items-center gap-2",children:["Workspace","Starter agent","Canvas"].map((e,a)=>{let n=0===a?t.percent>=28:1===a?t.percent>=62:t.percent>=88,l=!i&&!n&&(0===a||1===a&&t.percent>=28||2===a&&t.percent>=62);return(0,s.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[(0,s.jsxs)("div",{className:(0,k.cn)("relative flex min-h-[52px] min-w-0 flex-1 flex-col justify-between rounded-[12px] border px-2 py-1.5",n?r?"border-emerald-200 bg-emerald-50/80":"border-emerald-300/20 bg-emerald-300/10":l?r?"border-[#d8b69b] bg-[#fff8f1]":"border-cyan-300/18 bg-cyan-300/[0.06]":r?"border-[#ead8c8] bg-white/65":"border-white/8 bg-white/[0.03]"),children:[l?(0,s.jsx)(f.P.div,{"aria-hidden":"true",className:(0,k.cn)("absolute inset-y-0 left-0 w-1/2",r?"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,s.jsx)("span",{className:(0,k.cn)("relative z-[1] inline-flex h-5 w-5 items-center justify-center rounded-full border text-[8px]",n?r?"border-emerald-300 bg-white text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":r?"border-[#dcc7b8] bg-white text-[#8b6f5c]":"border-white/10 bg-white/[0.05] text-slate-300"),children:n?(0,s.jsx)(eB.A,{className:"h-2.5 w-2.5"}):l?(0,s.jsx)(c.A,{className:"h-2.5 w-2.5 animate-spin"}):a+1}),(0,s.jsx)("span",{className:(0,k.cn)("relative z-[1] truncate text-[8px] leading-[0.9rem]",r?"text-[#5f4b3e]":"text-slate-300"),children:e})]}),a<2?(0,s.jsx)("span",{className:(0,k.cn)("hidden h-px w-4 shrink-0 sm:block",n?r?"bg-emerald-300/70":"bg-emerald-300/45":r?"bg-[#dfcabb]":"bg-white/12")}):null]},e)})})]}),(0,s.jsx)("div",{className:"relative z-[1] mt-2.5 space-y-1.5",children:t.steps.map((e,t)=>{let a="active"===e.status,n="done"===e.status?r?"border-emerald-200 bg-emerald-50/75":"border-emerald-400/20 bg-emerald-400/10":a?r?"border-[#d9bca5] bg-white":"border-cyan-300/18 bg-cyan-300/[0.05]":r?"border-[#eadccc] bg-white/70":"border-white/6 bg-white/[0.03]",l="done"===e.status?r?"border-emerald-300 bg-emerald-100 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":a?r?"border-[#d5b9a5] bg-[#f5ebe3] text-[#8b6d5a]":"border-cyan-200/20 bg-cyan-300/10 text-cyan-100":r?"border-[#e1ccc0] bg-white text-[#9a7f6c]":"border-white/8 bg-white/[0.03] text-slate-400";return(0,s.jsxs)("div",{className:(0,k.cn)("relative overflow-hidden rounded-[12px] border px-2.5 py-1.5",n),children:[a?(0,s.jsx)(f.P.div,{"aria-hidden":"true",className:(0,k.cn)("pointer-events-none absolute inset-y-0 left-0 w-1/3 blur-[1px]",r?"bg-gradient-to-r from-transparent via-[#d9b08d]/24 to-transparent":i?"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,s.jsxs)("div",{className:"relative z-[1] flex items-start gap-1.5",children:[(0,s.jsx)("span",{className:(0,k.cn)("mt-0.5 inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full border text-[9px] font-medium",l),children:"done"===e.status?(0,s.jsx)(eB.A,{className:"h-2.5 w-2.5"}):a?(0,s.jsx)(c.A,{className:"h-2.5 w-2.5 animate-spin"}):t+1}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-1",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[10px]",r?"text-[#3e2f24]":"text-white"),children:e.label}),(0,s.jsxs)("span",{className:(0,k.cn)("text-[7px] tabular-nums",r?"text-[#8f7664]":"text-slate-400"),children:[e.percent,"%"]})]}),(0,s.jsx)("p",{className:(0,k.cn)("mt-0.5 text-[8px] leading-[0.82rem]",r?"text-[#8f7664]":"text-slate-500"),children:e.detail||e.description}),(0,s.jsx)("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-white/8",children:(0,s.jsx)(f.P.div,{className:(0,k.cn)("h-full rounded-full transition-[width] duration-500 ease-out","done"===e.status?"bg-emerald-300/85":a?r?i?"bg-rose-300/85":"bg-amber-300/85":i?"bg-rose-300/85":"bg-cyan-300/85":"bg-transparent"),style:{width:`${Math.max(e.percent,10*!!a)}%`}})}),a&&e.activities.length>0?(0,s.jsx)("div",{className:"mt-1 space-y-0.5",children:e.activities.slice(-2).map(e=>(0,s.jsxs)("div",{className:(0,k.cn)("flex items-start gap-1.5 text-[8px] leading-[0.9rem]",r?"text-[#705b4d]":"text-slate-300"),children:[(0,s.jsx)("span",{className:(0,k.cn)("mt-[5px] h-1.5 w-1.5 shrink-0 rounded-full","done"===e.status&&"bg-emerald-300","active"===e.status&&"bg-cyan-300","error"===e.status&&"bg-rose-300","pending"===e.status&&(r?"bg-[#c9b4a2]":"bg-slate-500"))}),(0,s.jsx)("span",{className:"min-w-0",children:e.message})]},e.id))}):null]})]})]},e.id)})})]})}function tj({surfaceTheme:e,label:t,value:a,detail:r}){return(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[12px] border px-2.5 py-2","light"===e?"border-[#e6d7cb] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[7px] uppercase tracking-[0.16em]","light"===e?"text-[#977b69]":"text-slate-500"),children:t}),(0,s.jsx)("p",{title:a,className:(0,k.cn)("mt-1 truncate text-[10px]","light"===e?"text-[#33251c]":"text-white"),children:a}),(0,s.jsx)("p",{className:(0,k.cn)("mt-0.5 text-[8px] leading-[0.85rem]","light"===e?"text-[#8f7664]":"text-slate-500"),children:r})]})}function tN({surfaceTheme:e,statusCopy:t,showDetails:a,phaseLabel:r,detailsOpen:n,onDetailsOpenChange:l,run:o}){let[d,u]=(0,i.useState)(!1),p=(0,eJ.T)(o.manualCommand),m=async()=>{if(o.manualCommand)try{await navigator.clipboard.writeText(o.manualCommand),j.o.success("Command copied.",{description:"Open Terminal and paste it."})}catch(e){j.o.error("Could not copy command.",{description:e instanceof Error?e.message:"Clipboard access is unavailable."})}},x=async()=>{if(o.manualCommand&&p){u(!0);try{let e=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:o.manualCommand})}),t=await e.json().catch(()=>null);if(!e.ok||t?.error)throw Error(t?.error||"Unable to open Terminal.");j.o.success("Terminal opened.",{description:"Finish auth there, then refresh."})}catch(e){j.o.error("Could not open Terminal.",{description:e instanceof Error?e.message:"Open Terminal manually and run the command."})}finally{u(!1)}}};return(0,s.jsxs)("div",{className:(0,k.cn)("mt-2.5 rounded-[12px] border","light"===e?"border-[#e5d5c9] bg-[#fffaf6]":"border-white/8 bg-[rgba(255,255,255,0.02)]"),children:[(0,s.jsxs)("div",{className:"px-2.5 py-2",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[7px] uppercase tracking-[0.16em]","light"===e?"text-[#977b69]":"text-slate-500"),children:"Status"}),a?(0,s.jsx)("button",{type:"button",onClick:()=>l(!n),className:(0,k.cn)("text-[8px] uppercase tracking-[0.16em] transition-colors","light"===e?"text-[#8f7664] hover:text-[#6f5949]":"text-slate-500 hover:text-slate-300"),children:n?"Hide details":"Show details"}):null]}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-[11px] leading-[1rem]","light"===e?"text-[#5f4b3e]":"text-slate-300"),children:t})]}),a&&n?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:(0,k.cn)("flex items-center justify-between border-y px-2.5 py-1.5","light"===e?"border-[#ebddd2]":"border-white/8"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[8px] uppercase tracking-[0.16em]","light"===e?"text-[#977b69]":"text-slate-500"),children:"Log"}),(0,s.jsx)("span",{className:"light"===e?"text-[10px] text-[#8c7362]":"text-[10px] text-slate-400",children:r})]}),(0,s.jsx)("pre",{className:(0,k.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"===e?"text-[#4f3d31]":"text-slate-200"),children:o.log||"No output yet.\n\nStart the step to stream logs."}),o.manualCommand?(0,s.jsxs)("div",{className:(0,k.cn)("border-t px-2.5 py-2","light"===e?"border-[#ebddd2]":"border-white/8"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[8px] uppercase tracking-[0.16em]","light"===e?"text-[#977b69]":"text-slate-500"),children:p?"Terminal":"Manual"}),p?(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-[9px] leading-[0.95rem]","light"===e?"text-[#705b4d]":"text-slate-400"),children:"Open Terminal and run this command."}):null,(0,s.jsx)("p",{className:(0,k.cn)("mt-1 break-all font-mono text-[9px] leading-[0.92rem]","light"===e?"text-[#4f3d31]":"text-slate-200"),children:o.manualCommand}),(0,s.jsxs)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[(0,s.jsxs)(v.$,{type:"button",variant:"secondary",size:"sm",onClick:m,className:e3(e),children:[(0,s.jsx)(ez.A,{className:"mr-1.5 h-3 w-3"}),"Copy command"]}),p?(0,s.jsx)(v.$,{type:"button",variant:"secondary",size:"sm",onClick:x,disabled:d,className:e3(e),children:d?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(E.A,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}):null]}),o.docsUrl?(0,s.jsxs)("a",{href:o.docsUrl,target:"_blank",rel:"noreferrer",className:(0,k.cn)("mt-2 inline-flex items-center gap-1 text-[9px] underline underline-offset-4","light"===e?"text-[#7f6554]":"text-slate-300"),children:["Setup docs",(0,s.jsx)(eZ.A,{className:"h-2.5 w-2.5"})]}):null]}):null]}):null]})}function tk({surfaceTheme:e,statusCopy:t,phaseLabel:a,buildScene:r}){let n="light"===e;return(0,s.jsx)("div",{className:(0,k.cn)("mt-3 overflow-hidden rounded-[24px] border",n?"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,s.jsxs)("div",{className:"relative isolate min-h-[440px] overflow-hidden px-4 py-4 sm:px-5 sm:py-5",children:[(0,s.jsx)("div",{className:(0,k.cn)("pointer-events-none absolute inset-0",n?"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,s.jsx)(f.P.div,{"aria-hidden":"true",className:(0,k.cn)("pointer-events-none absolute -left-12 top-8 h-36 w-36 rounded-full blur-3xl",n?"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,s.jsx)(f.P.div,{"aria-hidden":"true",className:(0,k.cn)("pointer-events-none absolute right-0 top-24 h-44 w-44 rounded-full blur-3xl",n?"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,s.jsxs)("div",{className:"relative z-[1] flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[9px] uppercase tracking-[0.24em]",n?"text-[#8f6f5d]":"text-cyan-200/70"),children:"Building"}),(0,s.jsx)("h3",{className:(0,k.cn)("mt-1 text-[18px] font-medium tracking-[-0.03em] sm:text-[22px]",n?"text-[#231a15]":"text-white"),children:"Creating your demo workspace"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 max-w-[42rem] text-[11px] leading-[1rem] sm:text-[12px] sm:leading-[1.05rem]",n?"text-[#6f5a4c]":"text-slate-300"),children:t})]}),(0,s.jsxs)("div",{className:"flex shrink-0 flex-col items-end gap-1.5",children:[(0,s.jsx)("span",{className:(0,k.cn)("inline-flex items-center rounded-full border px-2.5 py-1 text-[8px] uppercase tracking-[0.16em]",n?"border-[#d9c3b1] bg-white/70 text-[#8b6f5c]":"border-cyan-300/18 bg-cyan-300/10 text-cyan-100"),children:a}),r.selectedModelLabel?(0,s.jsxs)("span",{className:(0,k.cn)("inline-flex max-w-[220px] truncate rounded-full border px-2.5 py-1 text-[9px]",n?"border-[#ead8c8] bg-white text-[#5a4638]":"border-white/10 bg-white/[0.04] text-slate-200"),children:["Default model: ",r.selectedModelLabel]}):null]})]}),(0,s.jsxs)("div",{className:"relative z-[1] mt-5 grid gap-4 xl:grid-cols-[minmax(0,1.2fr)_minmax(280px,0.8fr)]",children:[(0,s.jsxs)("div",{className:(0,k.cn)("relative min-h-[290px] overflow-hidden rounded-[28px] border",n?"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,s.jsx)("div",{className:(0,k.cn)("absolute inset-0 opacity-80",n?"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,s.jsx)(f.P.div,{"aria-hidden":"true",className:(0,k.cn)("absolute inset-x-0 top-0 h-px",n?"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,s.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,s.jsxs)("div",{className:"relative flex flex-col items-center text-center",children:[(0,s.jsx)(f.P.div,{className:(0,k.cn)("absolute h-56 w-56 rounded-full border",n?"border-[#d8bda5]/45":"border-cyan-200/14"),animate:{rotate:360},transition:{duration:28,repeat:1/0,ease:"linear"}}),(0,s.jsx)(f.P.div,{className:(0,k.cn)("absolute h-40 w-40 rounded-full border",n?"border-[#e2c4ad]/65":"border-cyan-200/16"),animate:{rotate:-360},transition:{duration:18,repeat:1/0,ease:"linear"}}),(0,s.jsx)(f.P.div,{className:(0,k.cn)("absolute h-24 w-24 rounded-full border",n?"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,s.jsx)("div",{className:(0,k.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)]",n?"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,s.jsx)(c.A,{className:"h-10 w-10 animate-spin"})}),(0,s.jsx)("p",{className:(0,k.cn)("mt-5 text-[9px] uppercase tracking-[0.22em]",n?"text-[#9a7d69]":"text-cyan-200/70"),children:"Workspace fabric"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-[18px] font-medium tracking-[-0.03em]",n?"text-[#281d17]":"text-white"),children:r.headline}),(0,s.jsx)("p",{className:(0,k.cn)("mt-2 max-w-[28rem] text-[11px] leading-[1rem]",n?"text-[#6a5547]":"text-slate-300"),children:r.summary}),(0,s.jsxs)("div",{className:"mt-5 flex flex-wrap items-center justify-center gap-2",children:[(0,s.jsxs)("span",{className:(0,k.cn)("inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-[9px]",n?"border-[#dec8b8] bg-white text-[#634d3d]":"border-white/10 bg-white/[0.04] text-slate-200"),children:[(0,s.jsx)("span",{className:(0,k.cn)("h-1.5 w-1.5 rounded-full",n?"bg-[#c98a5f]":"bg-cyan-300")}),"Building workspace"]}),(0,s.jsxs)("span",{className:(0,k.cn)("inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-[9px]",n?"border-[#dec8b8] bg-white text-[#634d3d]":"border-white/10 bg-white/[0.04] text-slate-200"),children:[(0,s.jsx)("span",{className:(0,k.cn)("h-1.5 w-1.5 rounded-full",n?"bg-emerald-500":"bg-emerald-300")}),"Default model locked"]})]})]})}),(0,s.jsx)("div",{className:"absolute inset-x-5 bottom-5",children:(0,s.jsx)("div",{className:(0,k.cn)("relative h-2 overflow-hidden rounded-full border",n?"border-[#dec8b8] bg-white/90":"border-white/10 bg-white/[0.04]"),children:(0,s.jsx)(f.P.div,{className:(0,k.cn)("absolute inset-y-0 left-0 w-1/3 rounded-full",n?"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,s.jsxs)("div",{className:"flex min-h-0 flex-col gap-3",children:[r.steps.map((e,t)=>(0,s.jsx)(f.P.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.35,delay:.05*t},className:(0,k.cn)("rounded-[18px] border px-3 py-2.5","current"===e.state?n?"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"===e.state?n?"border-[#e7d5c6] bg-[rgba(255,255,255,0.76)]":"border-white/10 bg-white/[0.03]":n?"border-[#eadccf] bg-[rgba(255,250,246,0.8)]":"border-white/8 bg-white/[0.02]"),children:(0,s.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,s.jsx)("div",{className:(0,k.cn)("mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full border text-[10px] font-medium","current"===e.state?n?"border-[#c78e61] bg-[#f7e6d7] text-[#6b4d39]":"border-cyan-300/28 bg-cyan-300/12 text-cyan-50":"done"===e.state?n?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/12 text-emerald-200":n?"border-[#e2d4c7] bg-white text-[#9a7f6c]":"border-white/10 bg-white/[0.03] text-slate-400"),children:"done"===e.state?(0,s.jsx)(eB.A,{className:"h-3.5 w-3.5"}):t+1}),(0,s.jsx)("div",{className:"min-w-0 flex-1",children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[11px] font-medium",n?"text-[#2b1f18]":"text-white"),children:e.label}),(0,s.jsx)("p",{className:(0,k.cn)("mt-0.5 text-[9px] leading-[0.95rem]",n?"text-[#7c6554]":"text-slate-400"),children:e.detail})]}),(0,s.jsx)("span",{className:(0,k.cn)("rounded-full px-1.5 py-0.5 text-[7px] uppercase tracking-[0.14em]","current"===e.state?n?"bg-[#f1dfd0] text-[#835f48]":"bg-cyan-300/12 text-cyan-100":"done"===e.state?n?"bg-emerald-100 text-emerald-700":"bg-emerald-300/12 text-emerald-200":n?"bg-[#f6ece3] text-[#a0826e]":"bg-white/[0.04] text-slate-500"),children:"done"===e.state?"Ready":"current"===e.state?"Building":"Queued"})]})})]})},e.id)),(0,s.jsxs)("div",{className:(0,k.cn)("mt-auto rounded-[20px] border p-3",n?"border-[#ead8c8] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[8px] uppercase tracking-[0.18em]",n?"text-[#8f6f5d]":"text-cyan-200/60"),children:"Live build feed"}),(0,s.jsx)("span",{className:(0,k.cn)("text-[9px]",n?"text-[#8a6f5e]":"text-slate-400"),children:a})]}),(0,s.jsx)("div",{className:"mt-2 space-y-1.5",children:r.logLines.length>0?r.logLines.slice(-4).map((e,t)=>(0,s.jsxs)(f.P.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.25,delay:.04*t},className:(0,k.cn)("flex items-start gap-2 rounded-[14px] border px-2.5 py-2 text-[10px] leading-[0.98rem]",t===r.logLines.length-1?n?"border-[#d8b79e] bg-[#fff7f0] text-[#5a4638]":"border-cyan-300/18 bg-cyan-300/[0.06] text-slate-100":n?"border-[#eee0d3] bg-[#fffdfb] text-[#735d4e]":"border-white/8 bg-white/[0.02] text-slate-300"),children:[(0,s.jsx)("span",{className:(0,k.cn)("mt-1 h-1.5 w-1.5 shrink-0 rounded-full",t===r.logLines.length-1?n?"bg-[#c98758]":"bg-cyan-300":n?"bg-[#e3c8b2]":"bg-slate-500")}),(0,s.jsx)("span",{className:"min-w-0",children:e})]},`${e}-${t}`)):(0,s.jsx)("div",{className:(0,k.cn)("rounded-[14px] border border-dashed px-2.5 py-3 text-[10px]",n?"border-[#e8d7c8] text-[#7e6453]":"border-white/10 text-slate-400"),children:"Waiting for the first build signal..."})})]})]})]})]})})}function tC({snapshot:e,surfaceTheme:t,stage:a,systemReady:r,modelReady:n,systemSetupRequired:i,showReadyState:l,systemActionLabel:o,systemActionDescription:d,systemPhase:u,modelPhase:p,systemRun:m,modelRun:h,modelSwitchFeedback:g,selectedModelId:b,discoveredModels:w,onSelectedModelIdChange:y,onClearModelSwitchFeedback:j,onSnapshotChange:N,onRunSystemSetup:C,onRunModelSetDefault:S,onOpenAddModels:A,onOpenGatewayAuthSettings:I,onCreateWorkspace:T,onEnterAgentOS:O,onContinueToModels:R,onBackToSystem:$,onSelectStage:M,launchpadCreateProgress:_,launchpadCreateRunState:E}){var P,L;let D=r??("success"===m.runState||(0,eY.h6)(e)),U=(0,eq.Id)(e),F=n??("success"===g.phase||l||(0,eY.X2)(e)),G=F&&(l||!U||"running"===E||"success"===E||"error"===E),W="running"===E,z=e.workspaces.length,V=e.agents.length,q=z>0,J=e.diagnostics.modelReadiness.resolvedDefaultModel||e.diagnostics.modelReadiness.defaultModel||"Ready",K=e.diagnostics.modelReadiness.resolvedDefaultModel||e.diagnostics.modelReadiness.defaultModel||null,B=[{id:"system",order:1,label:"System setup",description:"CLI, gateway, RPC",state:e5(D,"system"===a&&!D)},{id:"models",order:2,label:"Model setup",description:"Default model, auth",state:e5(F,"models"===a&&!F)}],H=function(e,t,a={}){let s=!0===a.forcePending,r=!s&&e.diagnostics.rpcOk&&!e.diagnostics.loaded,n=!s&&e.diagnostics.installed||"installing-gateway"===t||"starting-gateway"===t||"verifying"===t||"ready"===t,i=!s&&e.diagnostics.loaded||r||"starting-gateway"===t||"verifying"===t||"ready"===t,l=!s&&e.diagnostics.rpcOk||"ready"===t,o=!s&&e.diagnostics.runtime.stateWritable&&e.diagnostics.runtime.sessionStoreWritable||"ready"===t,d=l&&o;return[{id:"cli",label:"OpenClaw CLI",description:e1("cli",e,t,n,i,l,d,s),state:e5(n,!n&&("detecting"===t||"installing-cli"===t))},{id:"gateway",label:"Gateway service",description:e1("gateway",e,t,n,i,l,d,s),state:e5(i,!i&&("installing-gateway"===t||n&&"detecting"===t))},{id:"runtime",label:"Runtime ready",description:e1("runtime",e,t,n,i,l,d,s),state:e5(d,!d&&("starting-gateway"===t||"verifying"===t||i&&"detecting"===t||i||l))}]}(e,D?"ready":u,{forcePending:i}),Z=e2(b,e.models.filter(e=>!1!==e.available&&!e.missing)),Y="system"===a?m:h,X=Y.statusMessage||Y.resultMessage||("system"===a?d:Z?`Selected model: ${Z}.`:"Choose a provider, connect it, and then pick a model."),Q="system"===a?D?"ready":i?"waiting":(0,eY.iN)(e)?"ready":e.diagnostics.rpcOk?"verifying access":e.diagnostics.loaded&&!e.diagnostics.rpcOk?"verifying"===u?"connecting":"starting gateway":u?u.replace("-"," "):"waiting":(0,eY.X2)(e)?"ready":e.diagnostics.modelReadiness.ready&&"passed"!==e.diagnostics.runtime.smokeTest.status?"smoke test":p?p.replace("-"," "):"waiting",ee="idle"!==Y.runState||!!Y.manualCommand||Y.log.trim().length>0||"models"===a&&w.length>0,et=(P=Y.runState,"running"===P?"Running":F?"Ready":"success"===P?"models"===a?"Updated":"Step complete":"error"===P?"Needs attention":"system"===a?"Step 1":"Step 2"),ea=e.diagnostics.issues.some(e=>/gateway\..*auth|redacted secret|AGENTOS_OPENCLAW_GATEWAY_TOKEN|OPENCLAW_GATEWAY_TOKEN/i.test(e)),es=function(e){if("system"===e.stage)return e.systemReady&&e.modelReady?{kind:"dismiss",label:"Enter AgentOS"}:e.systemReady?{kind:"continue",label:"Continue to model setup"}:{kind:"system",label:e.systemActionLabel};let t=e.selectedModelId.trim(),a=e.defaultModelId?.trim()??"";return t?t===a?{kind:"dismiss",label:"Enter AgentOS"}:{kind:"set-default",label:"Set as default"}:e.modelReady?{kind:"dismiss",label:"Enter AgentOS"}:{kind:"select-model",label:"Select a model"}}({stage:a,systemReady:D,modelReady:F,systemActionLabel:o,selectedModelId:b,defaultModelId:K});return(0,s.jsx)(f.P.div,{initial:{opacity:0,backdropFilter:"blur(0px)"},animate:{opacity:1,backdropFilter:"blur(12px)"},exit:{opacity:0,backdropFilter:"blur(0px)"},className:(0,k.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"===t?"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,s.jsx)(f.P.div,{initial:{opacity:0,y:18,scale:.985},animate:{opacity:1,y:0,scale:1},className:(0,k.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",G&&(W||"error"===E)?"max-w-[640px]":"max-w-[420px]","light"===t?"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,s.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,s.jsxs)("div",{className:"px-2.5 py-2.5 sm:px-3 sm:py-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsxs)("span",{className:(0,k.cn)("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[8px] uppercase tracking-[0.18em]","light"===t?"border-[#d8c0b0] bg-[#f3e7dc] text-[#8d725f]":"border-white/10 bg-white/[0.06] text-slate-300"),children:[(0,s.jsx)(x.A,{className:"h-2 w-2"}),G?W?"Opening":"error"===E?"Needs attention":"Launchpad":"Welcome"]}),(0,s.jsx)("span",{className:(0,k.cn)("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.16em]",(L=Y.runState,"error"===L?"light"===t?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200":"success"===L||F?"light"===t?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"running"===L?"light"===t?"border-[#d8c0b0] bg-white/80 text-[#8d725f]":"border-white/10 bg-white/[0.04] text-slate-300":"light"===t?"border-[#d8c0b0] bg-white/80 text-[#8d725f]":"border-white/10 bg-white/[0.04] text-slate-400")),children:et})]}),(0,s.jsx)("div",{className:"mt-3",children:(0,s.jsx)("p",{className:(0,k.cn)("whitespace-nowrap text-[9px] leading-[1rem] tracking-[0.08em]","light"===t?"text-[#33251c]":"text-slate-100"),children:G?W?"AGENTOS : Opening your first workspace.":"error"===E?"AGENTOS : Workspace setup needs attention.":U?"AGENTOS : OpenClaw is ready. Choose your first action below.":q?"AGENTOS : Syncing the first workspace agent.":"AGENTOS : OpenClaw is ready. Create the first workspace below.":"AGENTOS : Bring your local OpenClaw online."})}),(0,s.jsx)("div",{className:"mt-3 grid gap-1.5 sm:grid-cols-2",children:B.map(e=>(0,s.jsx)("button",{type:"button",onClick:()=>M(e.id),className:(0,k.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"===t?"focus-visible:ring-[#c8946f] focus-visible:ring-offset-[#fff7f1]":"focus-visible:ring-white/70 focus-visible:ring-offset-[#060a12]",te(e.state,t)),"aria-pressed":a===e.id,children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:(0,k.cn)("inline-flex h-5 w-5 items-center justify-center rounded-full border text-[9px] font-medium",tt(e.state,t)),children:"complete"===e.state?(0,s.jsx)(eB.A,{className:"h-2.5 w-2.5"}):e.order}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[11px]","light"===t?"text-[#3e2f24]":"text-white"),children:e.label}),(0,s.jsx)("p",{className:(0,k.cn)("mt-0.5 text-[8px] leading-[0.85rem]","light"===t?"text-[#8f7664]":"text-slate-500"),children:e.description})]})]}),(0,s.jsx)("span",{className:(0,k.cn)("rounded-full px-1.5 py-0.5 text-[6px] uppercase tracking-[0.14em]",ta(e.state,t)),children:"complete"===e.state?"Ready":"current"===e.state?"Active":"Pending"})]})},e.id))})]}),(0,s.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:G?(0,s.jsx)(tv,{surfaceTheme:t,workspaceCount:z,agentCount:V,workspaceSetupReady:U,defaultModelLabel:J,createProgress:_,createRunState:E}):"system"===a?(0,s.jsx)(tx,{steps:H,surfaceTheme:t,statusCopy:X,showDetails:ee,phaseLabel:Q,run:Y,gatewayAuthNeedsSetup:ea,onOpenGatewayAuthSettings:I}):(0,s.jsx)(th,{snapshot:e,surfaceTheme:t,statusCopy:X,showDetails:ee,phaseLabel:Q,run:Y,modelPhase:p,selectedModelId:b,modelSwitchFeedback:g,onSelectedModelIdChange:y,onClearModelSwitchFeedback:j,onOpenAddModels:A,onSnapshotChange:N})}),(0,s.jsxs)("div",{className:(0,k.cn)("mt-auto flex flex-wrap items-center justify-between gap-1.5 border-t px-2.5 py-2 sm:px-3","light"===t?"border-[#ebddd2]":"border-white/8"),children:[(0,s.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:G?(0,s.jsx)("span",{className:(0,k.cn)("rounded-full border px-2 py-0.5 text-[8px] uppercase tracking-[0.16em]","light"===t?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/10 text-emerald-200"),children:q?U?"Setup complete":"error"===E?"Needs attention":"Syncing agent":"running"===E?"Building workspace":"error"===E?"Needs attention":"Ready"}):"models"===a?(0,s.jsxs)(v.$,{type:"button",variant:"ghost",size:"sm",onClick:$,disabled:"running"===Y.runState,className:"light"===t?"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,s.jsx)(eH.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Back"]}):null}),(0,s.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:G?(0,s.jsx)(s.Fragment,{children:U?(0,s.jsxs)(v.$,{type:"button",onClick:O,className:(0,k.cn)("h-8 min-w-[156px] rounded-full px-3 text-[11px]","light"===t?"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,s.jsx)(eZ.A,{className:"ml-1.5 h-3 w-3"})]}):W?(0,s.jsxs)("span",{className:(0,k.cn)("inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-[9px] uppercase tracking-[0.16em]","light"===t?"border-[#d8c0b0] bg-white/85 text-[#8d725f]":"border-white/10 bg-white/[0.06] text-slate-300"),children:[(0,s.jsx)(c.A,{className:"h-3 w-3 animate-spin"}),"Building workspace"]}):(0,s.jsxs)(v.$,{type:"button",onClick:T,className:(0,k.cn)("h-8 min-w-[156px] rounded-full px-3 text-[11px]","light"===t?"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"===E?"Retry setup":"Create Workspace",(0,s.jsx)(eZ.A,{className:"ml-1.5 h-3 w-3"})]})}):(0,s.jsxs)(s.Fragment,{children:["models"!==a||F?null:(0,s.jsx)(v.$,{type:"button",variant:"secondary",size:"sm",onClick:()=>A(),className:e3(t),children:"Open full Add Models"}),(0,s.jsx)(v.$,{type:"button",onClick:()=>{"system"===a?"dismiss"===es.kind?O():D?R():C():"dismiss"===es.kind?O():"set-default"===es.kind&&S(b||void 0)},disabled:"running"===Y.runState||"select-model"===es.kind,className:(0,k.cn)("h-8 min-w-[156px] rounded-full px-3 text-[11px]","light"===t?"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"===Y.runState?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Working..."]}):(0,s.jsxs)(s.Fragment,{children:[es.label,(0,s.jsx)(eZ.A,{className:"ml-1.5 h-3 w-3"})]})})]})})]})]})})})}var tS=a(62820),tA=a(77262),tI=a(75084),tT=a(95506);function tO({open:e,target:t,surfaceTheme:a,previewState:r,preview:n,previewError:i,runState:l,statusMessage:o,resultMessage:d,backgroundLogPath:u,log:p,confirmText:m,onConfirmTextChange:x,onRefreshPreview:h,onExecute:g,onBackToSetup:b,onOpenChange:f}){let w="full-uninstall"===t?"FULL UNINSTALL":"RESET MISSION CONTROL",y="running"===l,j="success"===l||"error"===l,N=null!==t&&"ready"===r&&!y&&!j&&m.trim()===w,C="full-uninstall"===t?"Full Uninstall":"Reset AgentOS",S="light"===a?"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,s.jsx)(eV.lG,{open:e,onOpenChange:e=>{(e||!y)&&f(e)},children:(0,s.jsxs)(eV.Cf,{className:(0,k.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"===a?"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,s.jsxs)(eV.c7,{children:[(0,s.jsxs)(eV.L3,{className:(0,k.cn)("flex items-center gap-2","light"===a?"text-[#3f2f24]":"text-white"),children:["full-uninstall"===t?(0,s.jsx)(tS.A,{className:"h-4 w-4"}):(0,s.jsx)(tA.A,{className:"h-4 w-4"}),C]}),(0,s.jsx)(eV.rr,{className:"light"===a?"text-[#7e6555]":"text-slate-400",children:"full-uninstall"===t?"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"===r?(0,s.jsxs)("div",{className:(0,k.cn)("flex items-center gap-2 rounded-[16px] border px-4 py-4 text-sm","light"===a?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,s.jsx)(c.A,{className:"h-4 w-4 animate-spin"}),"Loading the reset preview..."]}):null,"error"===r?(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[16px] border px-4 py-4","light"===a?"border-rose-200 bg-rose-50 text-rose-900":"border-rose-400/25 bg-rose-500/10 text-rose-100"),children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:"Preview could not be prepared."}),(0,s.jsx)("p",{className:"mt-1 text-sm",children:i||"Unknown reset preview error."})]}):null,n?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"grid gap-3 md:grid-cols-4",children:[(0,s.jsx)(tR,{label:"Delete folders",value:String(n.summary.deleteFolderCount),surfaceTheme:a}),(0,s.jsx)(tR,{label:"Keep folders",value:String(n.summary.metadataOnlyCount),surfaceTheme:a}),(0,s.jsx)(tR,{label:"Agents",value:String(n.summary.agentCount),surfaceTheme:a}),(0,s.jsx)(tR,{label:"Live agents",value:String(n.summary.liveAgentCount),surfaceTheme:a,danger:n.summary.liveAgentCount>0})]}),n.warnings.length>0?(0,s.jsx)("div",{className:(0,k.cn)("mt-3 rounded-[16px] border px-4 py-4","light"===a?"border-amber-300/90 bg-amber-50 text-amber-950":"border-amber-300/25 bg-amber-300/10 text-amber-50"),children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(W.A,{className:"mt-0.5 h-4 w-4 shrink-0"}),(0,s.jsx)("div",{className:"space-y-1 text-sm",children:n.warnings.map(e=>(0,s.jsx)("p",{children:e},e))})]})}):null,(0,s.jsxs)("div",{className:(0,k.cn)("mt-3 rounded-[16px] border px-4 py-4","light"===a?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:(0,k.cn)("text-xs uppercase tracking-[0.18em]","light"===a?"text-[#9a7f6c]":"text-slate-500"),children:"Workspace impact"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-sm","light"===a?"text-[#6d5647]":"text-slate-400"),children:"`Delete folder` removes the workspace directory. `Keep folder` only removes OpenClaw and AgentOS integration from that location."})]}),(0,s.jsx)(v.$,{type:"button",size:"sm",variant:"secondary",onClick:h,className:"light"===a?"border-[#dcc6b6] bg-white text-[#5d4739] hover:bg-[#f7eee7] hover:text-[#5d4739]":void 0,children:"Refresh preview"})]}),(0,s.jsx)("div",{className:"mt-3 space-y-2",children:n.workspaces.map(e=>(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[14px] border px-3 py-3","light"===a?"border-[#ece0d6] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:(0,k.cn)("text-sm font-medium","light"===a?"text-[#3f2f24]":"text-white"),children:e.name}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 break-all font-mono text-[11px]","light"===a?"text-[#7e6555]":"text-slate-400"),children:e.path})]}),(0,s.jsx)("span",{className:(0,k.cn)("rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]","delete-folder"===e.action?"light"===a?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-400/25 bg-rose-500/10 text-rose-200":"light"===a?"border-amber-300 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-200"),children:"delete-folder"===e.action?"Delete folder":"Keep folder"})]}),(0,s.jsxs)("p",{className:(0,k.cn)("mt-2 text-xs","light"===a?"text-[#6d5647]":"text-slate-400"),children:[e.agentCount," agents, ",e.runtimeCount," tracked runs, ",e.liveAgentCount," live agents."]}),(0,s.jsx)("div",{className:"mt-2 space-y-1",children:e.reasons.map(e=>(0,s.jsx)("p",{className:(0,k.cn)("text-xs","light"===a?"text-[#7e6555]":"text-slate-500"),children:e},e))})]},e.workspaceId))})]}),(0,s.jsxs)("div",{className:"mt-3 grid gap-3 md:grid-cols-2",children:[(0,s.jsx)(t$,{title:"AgentOS state",items:n.missionControlPaths,surfaceTheme:a}),(0,s.jsx)(t$,{title:"Browser state",items:n.browserStorageKeys,surfaceTheme:a})]}),"full-uninstall"===t?(0,s.jsxs)("div",{className:"mt-3 grid gap-3 md:grid-cols-2",children:[(0,s.jsx)(t$,{title:"OpenClaw state",items:n.openClawPaths,surfaceTheme:a}),(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[16px] border px-4 py-4","light"===a?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-xs uppercase tracking-[0.18em]","light"===a?"text-[#9a7f6c]":"text-slate-500"),children:"CLI cleanup"}),(0,s.jsx)("div",{className:"mt-3 space-y-2",children:n.packageActions.map(e=>(0,s.jsxs)("div",{className:(0,k.cn)("min-w-0 overflow-hidden rounded-[14px] border px-3 py-3","light"===a?"border-[#ece0d6] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,s.jsx)("p",{className:(0,k.cn)("min-w-0 break-all text-sm font-medium","light"===a?"text-[#3f2f24]":"text-white"),children:e.packageName}),(0,s.jsx)("span",{className:(0,k.cn)("shrink-0 rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",e.detected?"light"===a?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-400/25 bg-rose-500/10 text-rose-200":"light"===a?"border-[#dcc6b6] bg-[#f4e8dd] text-[#876c5a]":"border-white/10 bg-white/[0.05] text-slate-300"),children:e.detected?"Scheduled":"Manual"})]}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 break-words text-xs","light"===a?"text-[#6d5647]":"text-slate-400"),children:e.reason||"No extra detail."}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 whitespace-pre-wrap break-all font-mono text-[11px]","light"===a?"text-[#7e6555]":"text-slate-500"),children:e.command||"Automatic cleanup is not available."})]},e.packageName))})]})]}):null,(0,s.jsxs)("div",{className:(0,k.cn)("mt-3 rounded-[16px] border px-4 py-4","light"===a?"border-rose-200 bg-rose-50/70 text-rose-950":"border-rose-400/25 bg-rose-500/10 text-rose-50"),children:[(0,s.jsxs)(tT.J,{htmlFor:"reset-confirm",className:"text-sm font-medium text-inherit",children:["Type ",w," to continue"]}),(0,s.jsx)(ti.p,{id:"reset-confirm",value:m,onChange:e=>x(e.target.value),placeholder:w,disabled:y,className:(0,k.cn)("mt-2 h-10","light"===a?"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"!==l||d||p?(0,s.jsxs)("div",{className:(0,k.cn)("min-w-0 overflow-hidden rounded-[16px] border px-4 py-4","error"===l?"light"===a?"border-rose-200 bg-rose-50 text-rose-950":"border-rose-400/25 bg-rose-500/10 text-rose-50":"success"===l?"light"===a?"border-emerald-200 bg-emerald-50 text-emerald-950":"border-emerald-400/25 bg-emerald-500/10 text-emerald-50":"light"===a?"border-[#e6d6ca] bg-white text-[#3f2f24]":"border-white/10 bg-white/[0.03] text-slate-100"),children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:o||d||"Reset status"}),d?(0,s.jsx)("p",{className:"mt-1 text-sm",children:d}):null,u?(0,s.jsxs)("p",{className:"mt-2 break-all font-mono text-[11px]",children:["Background cleanup log: ",u]}):null,(0,s.jsx)("pre",{className:(0,k.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"===a?"border-[#e6d6ca] bg-[#fffaf6] text-[#5f4a3d]":"border-white/10 bg-slate-950/45 text-slate-300"),children:p||"Waiting for command output..."})]}):null,(0,s.jsxs)(eV.Es,{children:[(0,s.jsx)(v.$,{type:"button",variant:j?"default":"secondary",onClick:()=>{"full-uninstall"===t&&"success"===l?b():f(!1)},disabled:y,className:j&&"light"===a?"bg-[#5c4437] text-white hover:bg-[#4d382d]":j?"bg-cyan-400 text-slate-950 hover:bg-cyan-300":void 0,children:"full-uninstall"===t&&"success"===l?"Back to setup":j?"Done":"Close"}),j?null:(0,s.jsx)(v.$,{type:"button",onClick:g,disabled:!N,className:S,children:y?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Running..."]}):(0,s.jsxs)(s.Fragment,{children:["full-uninstall"===t?(0,s.jsx)(tS.A,{className:"mr-1.5 h-3.5 w-3.5"}):(0,s.jsx)(tI.A,{className:"mr-1.5 h-3.5 w-3.5"}),C]})})]})]})})}function tR({label:e,value:t,surfaceTheme:a,danger:r=!1}){return(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[16px] border px-4 py-3",r?"light"===a?"border-rose-200 bg-rose-50":"border-rose-400/20 bg-rose-500/10":"light"===a?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[11px] uppercase tracking-[0.16em]","light"===a?"text-[#9a7f6c]":"text-slate-500"),children:e}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 font-display text-lg","light"===a?"text-[#3f2f24]":"text-white"),children:t})]})}function t$({title:e,items:t,surfaceTheme:a}){return(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[16px] border px-4 py-4","light"===a?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-xs uppercase tracking-[0.18em]","light"===a?"text-[#9a7f6c]":"text-slate-500"),children:e}),(0,s.jsx)("div",{className:"mt-3 space-y-2",children:t.map(e=>(0,s.jsx)("p",{className:(0,k.cn)("break-all rounded-[12px] border px-3 py-2 font-mono text-[11px]","light"===a?"border-[#ece0d6] bg-[#fffaf6] text-[#6d5647]":"border-white/8 bg-white/[0.03] text-slate-400"),children:e},e))})]})}var tM=a(24809),t_=a.n(tM),tE=a(48758),tP=a(96551),tL=a(9152),tD=a(41363),tU=a(3324),tF=a(47377),tG=a(20872),tW=a(4974),tz=a(12482),tV=a(16055);function tq(e,t,a){var s,r,n,i,l,o,d,c;let u,p,m=tJ(e?.fallbackCounts),x=!function(e,t){if(0===e.length)return!1;if(!t)return!0;let a=Date.parse(t);return!Number.isFinite(a)||e.some(e=>{let t=Date.parse(e.at);return!Number.isFinite(t)||t>=a})}(e?.recentFallbackDiagnostics??[],e?.lastConnectedAt??null)?0:m,h=function(e){switch(e){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"}}(e?.connectionState),g=function(e){switch(e){case"live":return"Live";case"retrying":return"Retrying";default:return"Connecting"}}(t),b=(s=a,{label:function(e){switch(e){case"live":return"Gateway events: Live";case"reconnecting":return"Gateway events: Reconnecting";case"polling":return"Gateway events: Polling";default:return"Gateway events: Unknown"}}(u=s?.mode),lastEventLabel:tB(s?.lastEventAt),lastError:s?.lastError?.trim()||null,recovery:s?.recovery?.trim()||null,tone:"live"===(r=u)?"success":"reconnecting"===r||"polling"===r?"warning":"neutral"});return{modeLabel:"native-ws"===(n=e?.mode)?"Native WS":"cli"===n?"CLI forced":"Unknown",gatewayModeLabel:function(e){switch(e){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"}}(e?.gatewayMode),statusLabel:(i=e,i?.statusLabel?i.statusLabel:i?"cli"===i.mode||"cli-forced"===i.connectionState?"CLI fallback forced":tJ(i.fallbackCounts)>0?"CLI fallback used":"connected"===i.connectionState?"Native Gateway: OK":"error"===i.connectionState?"Native Gateway: Unreachable":"Native Gateway: Degraded":"Native Gateway: Unknown"),connectionLabel:h,protocolLabel:"number"==typeof(l=e?.protocolVersion)&&Number.isFinite(l)?`v${l}`:"Unknown",protocolRangeLabel:(o=e?.protocolRange)&&"number"==typeof o.min&&"number"==typeof o.max?`v${o.min}-v${o.max} supported`:"Unknown",streamLabel:g,eventBridgeLabel:b.label,eventBridgeLastEventLabel:b.lastEventLabel,eventBridgeLastError:b.lastError,eventBridgeRecovery:b.recovery,eventBridgeTone:b.tone,fallbackTotal:m,fallbackOperationCount:tK(e?.fallbackCounts),fallbackSummaryLabel:(d=e?.fallbackTotal??m,p=tK(e?.fallbackCounts),d<=0||p<=0?"CLI fallback used: 0 operations":`CLI fallback used: ${d} ${1===d?"operation":"operations"} across ${p} ${1===p?"method":"methods"}`),lastConnectedLabel:tB(e?.lastConnectedAt),lastDisconnectedLabel:tB(e?.lastDisconnectedAt),lastNativeError:e?.lastNativeError?.trim()||null,recovery:e?.recovery?.trim()||null,recentFallbackDiagnostics:e?.recentFallbackDiagnostics??[],statusTone:"retrying"===(c={gatewayMode:e?.gatewayMode,connectionState:e?.connectionState,mode:e?.mode,streamState:t,fallbackTotal:x}).streamState||"error"===c.connectionState||"unreachable"===c.gatewayMode?"danger":"cli"===c.mode||"cli-forced"===c.connectionState||"closed"===c.connectionState||"connecting"===c.connectionState||"fallback-active"===c.gatewayMode||"degraded"===c.gatewayMode||c.fallbackTotal>0?"warning":"connected"===c.connectionState&&"live"===c.streamState?"success":"neutral"}}function tJ(e){return Object.values(e??{}).reduce((e,t)=>Number.isFinite(t)&&t>0?e+t:e,0)}function tK(e){return Object.values(e??{}).filter(e=>Number.isFinite(e)&&e>0).length}function tB(e){if(!e)return"Not yet";let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}let tH=[{value:"auto",label:"Auto"},{value:"local-prefix",label:"Local prefix"},{value:"global-path",label:"Global PATH"},{value:"custom",label:"Custom"}],tZ=[{id:"openclaw",label:"OpenClaw",icon:tE.A},{id:"gateway",label:"Gateway",icon:tP.A},{id:"models",label:"Models",icon:tL.A},{id:"workspace",label:"Workspace",icon:tD.A},{id:"agents",label:"Agents",icon:tU.A},{id:"diagnostics",label:"Diagnostics",icon:E.A},{id:"advanced",label:"Advanced",icon:tF.A},{id:"danger-zone",label:"Danger Zone",icon:W.A,destructive:!0}];function tY(e){var t,a,r,l,o,d,u,p,m,x;let h,{snapshot:b,surfaceTheme:f,connectionState:w,gatewayDraft:y,workspaceRootDraft:j,openClawBinarySelection:N,isSavingGateway:C,isSavingWorkspaceRoot:S,isSavingOpenClawBinary:A,isCheckingForUpdates:I,updateRunState:T,selectedModelId:O,modelOnboardingRunState:R,gatewayControlAction:$,lastCheckedAt:M,onGatewayDraftChange:_,onWorkspaceRootDraftChange:P,onSelectedModelIdChange:L,onSaveGatewaySettings:D,onSaveWorkspaceRootSettings:U,onCheckForUpdates:F,onControlGateway:G,onOpenSetupWizard:z,onRunModelRefresh:V,onRunModelSetDefault:q,onOpenAddModels:J,onOpenUpdateDialog:K,onOpenResetDialog:B,onOpenClawBinarySelectionModeChange:H,onOpenClawBinarySelectionPathChange:Z,onSaveOpenClawBinarySettings:Y,installSummary:X,sidebarOpen:Q=!1}=e,[ee,et]=(0,i.useState)(null),[ea,es]=(0,i.useState)(null),[er,en]=(0,i.useState)("token"),[ei,el]=(0,i.useState)(""),[eo,ed]=(0,i.useState)(null),[ec,eu]=(0,i.useState)(!1),[ep,em]=(0,i.useState)(!1),[ex,eh]=(0,i.useState)(!1),[eg,eb]=(0,i.useState)(!1),[ef,ew]=(0,i.useState)(()=>b.diagnostics.compatibilitySmokeTest??null),[ev,ey]=(0,i.useState)(null),[ej,eN]=(0,i.useState)(!1),[ek,eC]=(0,i.useState)(()=>b.diagnostics.configUpdatePacing),[eS,eA]=(0,i.useState)(()=>b.diagnostics.configUpdatePacing.settings.mode),[eI,eT]=(0,i.useState)(()=>String(Math.ceil((b.diagnostics.configUpdatePacing.settings.minimumIntervalMs??1e4)/1e3))),[eO,eR]=(0,i.useState)(null),[e$,eM]=(0,i.useState)(!1),[e_,eE]=(0,i.useState)(0),[eP,eL]=(0,i.useState)(()=>al()),[eD,eU]=(0,i.useState)(!1),eF=eD?eP:al(),eG=!!(b.diagnostics.updateAvailable&&b.diagnostics.latestVersion),eW=!!(b.diagnostics.version&&!b.diagnostics.latestVersion&&!b.diagnostics.updateError),eV=b.diagnostics.version||"unknown",eq=b.diagnostics.latestVersion||null,eJ=b.diagnostics.updateInfo?.trim()||null,eK=b.diagnostics.updateError?.trim()||null,eH=b.diagnostics.modelReadiness.resolvedDefaultModel||b.diagnostics.modelReadiness.defaultModel||"",eZ=O||eH||"",eY=b.models.find(e=>e.id===eZ),eX=eY?.provider||b.diagnostics.modelReadiness.preferredLoginProvider||function(e){if(!e)return null;let[t]=e.split("/");return t||null}(eH)||"Not connected",eQ=(0,i.useMemo)(()=>b.diagnostics.commandHistory??[],[b.diagnostics.commandHistory]).slice(0,6),e0=(0,i.useMemo)(()=>({ok:eQ.filter(e=>"ok"===e.status).length,failed:eQ.filter(e=>"ok"!==e.status).length}),[eQ]),e1=(0,i.useMemo)(()=>tq(b.diagnostics.transport,w,b.diagnostics.eventBridge),[w,b.diagnostics.eventBridge,b.diagnostics.transport]),e2=b.diagnostics.capabilityMatrix,e5=b.diagnostics.compatibilityReport,e3=e2?.compatibility,e8=(b.diagnostics.gatewayFallbackDiagnostics?.length?b.diagnostics.gatewayFallbackDiagnostics:e2?.fallbackDiagnostics??[]).slice(0,4),e4=ee?ee.native.ok?"Authenticated":function(e){switch(e){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"}}(ee.native.kind):"Unknown";(0,i.useEffect)(()=>{let e=b.diagnostics.compatibilitySmokeTest;e&&ew(t=>{if(!t)return e;let a=Date.parse(t.checkedAt),s=Date.parse(e.checkedAt);return Number.isFinite(s)&&(!Number.isFinite(a)||s>a)?e:t})},[b.diagnostics.compatibilitySmokeTest]),(0,i.useEffect)(()=>{eC(b.diagnostics.configUpdatePacing),eA(b.diagnostics.configUpdatePacing.settings.mode),eT(String(Math.ceil((b.diagnostics.configUpdatePacing.settings.minimumIntervalMs??1e4)/1e3)))},[b.diagnostics.configUpdatePacing]),(0,i.useEffect)(()=>{if(!ek.cooldownUntil)return;let e=window.setInterval(()=>{eE(e=>e+1)},1e3);return()=>window.clearInterval(e)},[ek.cooldownUntil]);let e6=(0,i.useCallback)(async()=>{eu(!0),es(null);try{et(await t6())}catch(e){es(e instanceof Error?e.message:"Unable to check Gateway auth status.")}finally{eu(!1)}},[]);(0,i.useEffect)(()=>{e6()},[e6]),(0,i.useEffect)(()=>{let e=()=>{eL(function(){switch(window.location.hash.replace(/^#/,"")){case"gateway":return"gateway";case"models":return"models";case"workspace":return"workspace";case"agents":return"agents";case"diagnostics":return"diagnostics";case"advanced":return"advanced";case"danger-zone":return"danger-zone";default:return"openclaw"}}()),eU(!0),ai()};return window.addEventListener("hashchange",e),e(),()=>{window.removeEventListener("hashchange",e)}},[]),(0,i.useEffect)(()=>{ai()},[eP]);let e9=async()=>{let e=ei.trim();if(!e)return void es("Gateway token/password is required.");em(!0),es(null),ed(null);try{let t=await fetch("/api/settings/gateway",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"saveCredential",kind:er,value:e})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"Gateway credential could not be saved.")}let a=await t.json();et(a.authStatus),el(""),ed("Saved to .env.local and applied to the current AgentOS server session.")}catch(e){es(e instanceof Error?e.message:"Unable to save Gateway credential.")}finally{em(!1)}},e7=async()=>{eh(!0),es(null),ed(null);try{let e=await fetch("/api/settings/gateway",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"generateLocalToken"})});if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||"Gateway token could not be generated.")}let t=await e.json();et(t.authStatus),ed("Generated a local Gateway token and applied it to AgentOS.")}catch(e){es(e instanceof Error?e.message:"Unable to generate Gateway token.")}finally{eh(!1)}},te=async()=>{eb(!0),es(null),ed(null);try{let e=await fetch("/api/settings/gateway",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"repairDeviceAccess"})});if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||"Gateway device access could not be repaired.")}let t=await e.json();et(t.authStatus),ed("Local Gateway device access repaired for AgentOS.")}catch(e){es(e instanceof Error?e.message:"Unable to repair Gateway access.")}finally{eb(!1)}},tt=async()=>{eN(!0),ey(null);try{let e=await fetch("/api/openclaw/compatibility-smoke",{method:"POST",cache:"no-store"});if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||"OpenClaw compatibility smoke test failed.")}let t=await e.json();ew(t.report)}catch(e){ey(e instanceof Error?e.message:"Unable to run OpenClaw compatibility smoke test.")}finally{eN(!1)}},ta=async()=>{eM(!0),eR(null);try{let e="custom"===eS?1e3*Math.max(1,Math.round(Number(eI)||10)):null,t=await fetch("/api/settings/config-pacing",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:eS,minimumIntervalMs:e})}),a=await t.json();if(!t.ok)throw Error(a.error||"Unable to update config update pacing.");eC(a.configUpdatePacing),eA(a.configUpdatePacing.settings.mode),eT(String(Math.ceil((a.configUpdatePacing.settings.minimumIntervalMs??1e4)/1e3)))}catch(e){eR(e instanceof Error?e.message:"Unable to update config update pacing.")}finally{eM(!1)}},ts=ek.cooldownUntil?Math.max(0,Date.parse(ek.cooldownUntil)-Date.now()+0*e_):null;return(0,s.jsx)("main",{className:(0,k.cn)("relative z-10 min-h-screen","light"===f?"text-foreground":"text-slate-100"),children:(0,s.jsx)("section",{className:(0,k.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",Q?"lg:ml-[316px]":"lg:ml-[80px]"),children:(0,s.jsxs)("div",{className:"mx-auto max-w-[1160px] 2xl:max-w-[1240px]",children:[(0,s.jsx)("div",{className:"flex flex-col",children:(0,s.jsx)("nav",{"aria-label":"Settings sections",className:(0,k.cn)("flex flex-wrap gap-2 rounded-[22px] border p-2 backdrop-blur-xl","light"===f?"border-border bg-card/88 shadow-card":"border-border bg-card/88 shadow-[0_18px_44px_rgba(0,0,0,0.16)]"),children:tZ.map(e=>{let t=eF===e.id,a=e.icon;return(0,s.jsxs)(t_(),{href:`/settings#${e.id}`,scroll:!1,"aria-current":t?"page":void 0,onClick:()=>{eL(e.id),ai()},className:(0,k.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",t&&!e.destructive?"light"===f?"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)]":t&&e.destructive?"light"===f?"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"===f?"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,s.jsx)(a,{className:"h-3.5 w-3.5 shrink-0"}),(0,s.jsx)("span",{children:e.label})]},e.id)})})}),(0,s.jsxs)("div",{className:"mt-5 flex flex-col gap-4",children:["openclaw"===eF?(0,s.jsx)("section",{id:"openclaw",className:"scroll-mt-24",children:(0,s.jsxs)("div",{className:(0,k.cn)("panel-surface panel-glow min-h-full overflow-hidden rounded-[22px] p-4","light"===f?"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,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("span",{className:(0,k.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,s.jsx)(tE.A,{className:"h-4 w-4"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("h2",{className:"font-display text-lg",children:"OpenClaw"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-0.5 text-xs leading-5","light"===f?"text-muted-foreground":"text-slate-400"),children:"Source of truth for runtime and control state."})]})]}),(0,s.jsxs)("div",{className:"mt-5 grid grid-cols-2 gap-3",children:[(0,s.jsx)(tQ,{label:"Current version",value:`v${b.diagnostics.version||"unknown"}`,surfaceTheme:f,dark:"dark"===f}),(0,s.jsx)(tQ,{label:"Latest available",value:b.diagnostics.latestVersion?`v${b.diagnostics.latestVersion}`:"Unknown",badge:eG?"Update":"Stable",surfaceTheme:f,dark:"dark"===f})]}),(0,s.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,s.jsxs)(v.$,{type:"button",onClick:K,disabled:!eG||"running"===T,className:"h-9 rounded-full bg-emerald-600 px-4 text-xs text-white hover:bg-emerald-500",children:["running"===T?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(tG.A,{className:"h-3.5 w-3.5"}),"Update now"]}),(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:()=>void F(),disabled:I||"running"===T,className:ac(f,"px-4"),children:[(0,s.jsx)(n.A,{className:"h-3.5 w-3.5"}),"Check"]}),(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:()=>z(),className:ac(f,"px-4"),children:[(0,s.jsx)(tW.A,{className:"h-3.5 w-3.5"}),"Open wizard"]})]}),(0,s.jsx)(t4,{surfaceTheme:f,isCheckingForUpdates:I,isUpdateRegistryLoading:eW,hasUpdateAvailable:eG,currentVersion:eV,latestVersion:eq,updateInfo:eJ,updateError:eK,lastCheckedAt:M,isUpdateRunning:"running"===T}),(0,s.jsxs)("div",{className:(0,k.cn)("mt-5 grid gap-3 border-t pt-4 sm:grid-cols-2","light"===f?"border-border":"border-white/10"),children:[(0,s.jsx)(tQ,{label:"Detected install",value:X.label||"Unknown",surfaceTheme:f,dark:"dark"===f,compact:!0}),(0,s.jsx)(tQ,{label:"Resolved path",value:as(N.resolvedPath||"openclaw",26),surfaceTheme:f,dark:"dark"===f,compact:!0})]}),(0,s.jsxs)("div",{className:(0,k.cn)("mt-4 rounded-[18px] border p-3.5","light"===f?"border-border bg-muted/45":"border-white/10 bg-white/[0.035]"),children:[(0,s.jsx)(tT.J,{className:ao(f),children:"OpenClaw binary mode"}),(0,s.jsx)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:tH.map(e=>(0,s.jsx)("button",{type:"button",onClick:()=>H(e.value),className:(0,k.cn)("h-9 rounded-full border px-3 text-xs transition-colors",N.mode===e.value?"light"===f?"border-primary/35 bg-primary/10 text-primary":"border-primary/30 bg-primary/12 text-primary":"light"===f?"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:e.label},e.value))}),"custom"===N.mode?(0,s.jsx)(ti.p,{value:N.path??"",onChange:e=>Z(e.target.value),placeholder:"/path/to/openclaw",className:ad(f,"mt-3")}):null,(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:()=>void Y(N),disabled:A,className:ac(f,"mt-3 w-full"),children:[A?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(tz.A,{className:"h-3.5 w-3.5"}),"Save selection"]})]})]})}):null,"gateway"===eF?(0,s.jsx)("section",{id:"gateway",className:"scroll-mt-24",children:(0,s.jsxs)(tX,{title:"Gateway",icon:tP.A,surfaceTheme:f,children:[(0,s.jsx)(t0,{surfaceTheme:f,rows:[["Status",`${"remote"===(t=b).diagnostics.bindMode||t.diagnostics.configuredGatewayUrl?"Remote":"Local"} / ${b.diagnostics.loaded||b.diagnostics.rpcOk?"Online":"Offline"}`],["Native Gateway",e1.statusLabel],["Gateway mode",e1.gatewayModeLabel],["CLI fallback used",`${e1.fallbackTotal} operations`],["Endpoint",b.diagnostics.gatewayUrl||"Not configured"],["Auth status",e4],["Protocol",`${e1.protocolRangeLabel}, connected: ${e1.protocolLabel}`],["OpenClaw Compatibility",e5?t7(e5.status):"Unknown"],["Native Gateway coverage",e5?`${e5.summary.nativeGatewayCoveragePercent}% (${e5.summary.nativeGatewayCoverageLabel})`:"Unknown"],["CLI fallback operation count",e5?String(e5.summary.cliFallbackOperationCount):"Unknown"],["Unsupported/degraded surfaces",e5?(h=[...(a=e5).summary.failedSurfaces,...a.summary.unsupportedSurfaces,...a.summary.degradedSurfaces]).length>0?at(h,3):"None":"Unknown"],["Compatibility",function(e){switch(e?.protocol.status){case"compatible":return"Compatible";case"unsupported":return"Unsupported";default:return"Unknown"}}(e3)],["Contract audit",function(e){if(!e)return"Unknown";let t=function(e){switch(e){case"gateway-handshake":return"handshake";case"disabled":return"disabled";case"unavailable":return"unavailable";default:return e}}(e.source);switch(e.status){case"advertised":return`Advertised via ${t}`;case"verified":return`Verified via ${t}`;case"drift":return`Drift via ${t}`;default:return`Unknown via ${t}`}}(e3?.methodContract)],["Contract gaps",(r=e3?.methodContract,l=e2?.operations,r?"advertised"===r.status||"verified"===r.status?"None":"unknown"===r.status?r.reason:r.missingOperations.length>0?aa(r.missingOperations,l):`${r.missingMethodCount} methods`:"Unknown")],["Native ops",(o=e3)?`${o.nativeOperationCount} native / ${o.degradedOperationCount} limited`:"Unknown"],["Alias ops",(d=e3?.aliasOperations,u=e2?.operations,d?d.length>0?aa(d,u):"None":"Unknown")],["Limited ops",(p=e3?.degradedOperations,m=e2?.operations,p?p.length>0?aa(p,m):"None":"Unknown")],["Native chat",t9(e2?.nativeMissionDispatch)],["Config patch",t9(e2?.configPatch)],["Events",t9(e2?.eventBridge)]],successIndex:1}),(0,s.jsx)(t2,{compatibilityReport:e5,report:ef,snapshot:b,capabilityMatrix:e2,transportSummary:e1,nativeAuthLabel:e4,error:ev,isRunning:ej,onRun:()=>void tt(),surfaceTheme:f}),e1.recovery||e1.lastNativeError?(0,s.jsxs)("div",{className:(0,k.cn)("mt-4 rounded-[18px] border p-3.5",ap(f)),children:[(0,s.jsx)("p",{className:ao(f),children:"Native Gateway diagnostic"}),e1.lastNativeError?(0,s.jsxs)("p",{className:(0,k.cn)("mt-2 text-xs leading-5","light"===f?"text-muted-foreground":"text-slate-300"),children:["Last native error: ",e1.lastNativeError]}):null,e1.recovery?(0,s.jsxs)("p",{className:(0,k.cn)("mt-1 text-xs leading-5","light"===f?"text-muted-foreground":"text-slate-400"),children:["Recovery: ",e1.recovery]}):null]}):null,(0,s.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(tT.J,{className:ao(f),children:"Gateway endpoint"}),(0,s.jsx)(ti.p,{value:y,onChange:e=>_(e.target.value),placeholder:"ws://127.0.0.1:18789",className:ad(f,"mt-2")})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,s.jsxs)(v.$,{type:"button",onClick:()=>void D(y.trim()||null),disabled:C,className:"h-9 rounded-full bg-emerald-600 text-xs text-white hover:bg-emerald-500",children:[C?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(tz.A,{className:"h-3.5 w-3.5"}),"Save endpoint"]}),(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:()=>void D(null),disabled:C,className:ac(f),children:[(0,s.jsx)(tA.A,{className:"h-3.5 w-3.5"}),"Clear"]})]})]}),(0,s.jsx)("div",{className:"mt-4 grid grid-cols-3 gap-2",children:["start","stop","restart"].map(e=>(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:()=>void G(e),disabled:null!==$,className:(0,k.cn)(ac(f),"capitalize"),children:[$===e?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):null,e]},e))}),(0,s.jsxs)("div",{className:(0,k.cn)("mt-4 rounded-[18px] p-3.5","light"===f?"border border-emerald-200 bg-emerald-50/55":"border border-cyan-300/12 bg-cyan-300/[0.06]"),children:[(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)(tV.A,{className:(0,k.cn)("mt-0.5 h-4 w-4","light"===f?"text-emerald-700":"text-cyan-200")}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:(0,k.cn)("text-sm font-medium","light"===f?"text-[#2f624b]":"text-slate-100"),children:"Native Gateway auth"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-xs leading-5","light"===f?"text-[#6f836f]":"text-slate-400"),children:"Use local repair when AgentOS reports missing operator scopes."})]})]}),(0,s.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:()=>void te(),disabled:eg,className:ac(f,"px-3","gateway-contrast"),children:[eg?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(tW.A,{className:"h-3.5 w-3.5"}),"Repair local access"]}),(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:()=>void e7(),disabled:ex,className:ac(f,"px-3","gateway-contrast"),children:[ex?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(tV.A,{className:"h-3.5 w-3.5"}),"Generate token"]})]}),(0,s.jsxs)("div",{className:"mt-3 grid gap-2 sm:grid-cols-[112px_1fr]",children:[(0,s.jsxs)("select",{value:er,onChange:e=>en(e.target.value),className:ad(f),children:[(0,s.jsx)("option",{value:"token",children:"Token"}),(0,s.jsx)("option",{value:"password",children:"Password"})]}),(0,s.jsx)(ti.p,{type:"password",value:ei,onChange:e=>el(e.target.value),placeholder:"Paste known credential",className:ad(f)})]}),(0,s.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[(0,s.jsxs)(v.$,{type:"button",onClick:()=>void e9(),disabled:ep,className:"h-9 rounded-full bg-emerald-600 text-xs text-white hover:bg-emerald-500",children:[ep?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(tz.A,{className:"h-3.5 w-3.5"}),"Save credential"]}),(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:()=>void e6(),disabled:ec,className:ac(f,void 0,"gateway-contrast"),children:[ec?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(n.A,{className:"h-3.5 w-3.5"}),"Test auth"]})]}),ea||eo||ee?.native.issue?(0,s.jsx)("p",{className:(0,k.cn)("mt-3 text-xs leading-5",ea?"light"===f?"text-red-700":"text-rose-300":"light"===f?"text-muted-foreground":"text-slate-400"),children:ea||eo||ee?.native.issue}):null]})]})}):null,"models"===eF?(0,s.jsx)("section",{id:"models",className:"scroll-mt-24",children:(0,s.jsxs)(tX,{title:"Models",icon:tL.A,surfaceTheme:f,children:[(0,s.jsx)(t0,{surfaceTheme:f,rows:[["Default model",eH||"Not selected"],["Provider",eX],["Available",`${b.diagnostics.modelReadiness.availableModelCount} of ${b.diagnostics.modelReadiness.totalModelCount}`]]}),(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsx)(tT.J,{className:ao(f),children:"Model"}),(0,s.jsxs)("select",{value:eZ,onChange:e=>L(e.target.value),className:ad(f,"mt-2"),children:[(0,s.jsx)("option",{value:"",children:"Choose model"}),b.models.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))]})]}),(0,s.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-2",children:[(0,s.jsxs)(v.$,{type:"button",onClick:()=>void q(eZ),disabled:!eZ||"running"===R,className:"h-9 rounded-full bg-emerald-600 text-xs text-white hover:bg-emerald-500",children:["running"===R?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(eB.A,{className:"h-3.5 w-3.5"}),"Use selected"]}),(0,s.jsx)(v.$,{type:"button",variant:"secondary",onClick:()=>J(null),className:ac(f),children:"Add models"})]}),(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:()=>void V(),disabled:"running"===R,className:(0,k.cn)(ac(f),"mt-3 w-full"),children:[(0,s.jsx)(n.A,{className:"h-3.5 w-3.5"}),"Refresh models"]})]})}):null,"workspace"===eF?(0,s.jsx)("section",{id:"workspace",className:"scroll-mt-24",children:(0,s.jsxs)(tX,{title:"Workspace",icon:tD.A,surfaceTheme:f,children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(tT.J,{className:ao(f),children:"Workspace root"}),(0,s.jsxs)("div",{className:"mt-2 flex gap-2",children:[(0,s.jsx)(ti.p,{value:j,onChange:e=>P(e.target.value),placeholder:"~/Documents/AgentOS",className:ad(f)}),(0,s.jsx)("button",{type:"button","aria-label":"Copy workspace root",onClick:()=>{var e;return e=j||b.diagnostics.workspaceRoot,void("u">typeof navigator&&navigator.clipboard&&navigator.clipboard.writeText(e))},className:(x=f,(0,k.cn)("flex h-10 w-10 shrink-0 items-center justify-center rounded-[16px] border","light"===x?"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,s.jsx)(ez.A,{className:"h-3.5 w-3.5"})})]})]}),(0,s.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-2",children:[(0,s.jsxs)(v.$,{type:"button",onClick:()=>void U(j.trim()||null),disabled:S,className:"h-9 rounded-full bg-emerald-600 text-xs text-white hover:bg-emerald-500",children:[S?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(tz.A,{className:"h-3.5 w-3.5"}),"Save"]}),(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:()=>void U(null),disabled:S,className:ac(f),children:[(0,s.jsx)(tA.A,{className:"h-3.5 w-3.5"}),"Reset"]})]}),(0,s.jsxs)("div",{className:(0,k.cn)("mt-4 rounded-[18px] p-3.5","light"===f?"border border-border bg-muted/45":"border border-white/[0.08] bg-[#101a2a]/92"),children:[(0,s.jsx)("p",{className:ao(f),children:"Current root"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-2 break-all text-sm","light"===f?"text-foreground":"text-slate-200"),children:as(b.diagnostics.workspaceRoot,56)})]})]})}):null,"diagnostics"===eF?(0,s.jsx)("section",{id:"diagnostics",className:"scroll-mt-24",children:(0,s.jsx)(tX,{title:"Diagnostics",icon:E.A,surfaceTheme:f,action:(0,s.jsxs)("span",{className:(0,k.cn)("inline-flex items-center gap-2 rounded-full border px-3 py-1.5 text-xs","light"===f?"border-border bg-card text-muted-foreground":"border-white/[0.08] bg-[#101a2a]/92 text-slate-300"),children:[(0,s.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),e0.ok," OK",e0.failed?(0,s.jsxs)("span",{className:"text-red-600",children:[e0.failed," failed"]}):null]}),children:(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(t5,{summary:e1,surfaceTheme:f}),e8.length?(0,s.jsxs)("div",{className:(0,k.cn)("border-l-2 py-1 pl-3","light"===f?"border-amber-300":"border-amber-300/45"),children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,s.jsx)("p",{className:ao(f),children:"Gateway fallback diagnostics"}),(0,s.jsxs)("span",{className:(0,k.cn)("text-[11px]","light"===f?"text-muted-foreground":"text-slate-400"),children:[e8.length," recent"]})]}),(0,s.jsx)("div",{className:"mt-2 space-y-2",children:e8.map(e=>(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:(0,k.cn)("text-sm font-medium","light"===f?"text-foreground":"text-slate-100"),children:e.operationLabel}),(0,s.jsx)("code",{className:(0,k.cn)("rounded-full px-2 py-0.5 text-[10px]","light"===f?"bg-muted text-muted-foreground":"bg-white/[0.06] text-slate-300"),children:e.operation}),(0,s.jsx)("span",{className:(0,k.cn)("text-[11px]","light"===f?"text-amber-700":"text-amber-200"),children:function(e){switch(e){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"}}(e.kind)}),(0,s.jsx)("span",{className:(0,k.cn)("text-[11px]","light"===f?"text-muted-foreground":"text-slate-500"),children:ar(e.at)})]}),(0,s.jsxs)("p",{className:(0,k.cn)("mt-1 text-xs","light"===f?"text-muted-foreground":"text-slate-400"),children:["Reason: ",e.issue]}),(0,s.jsxs)("p",{className:(0,k.cn)("mt-0.5 text-xs","light"===f?"text-muted-foreground":"text-slate-500"),children:["Recovery: ",e.recovery||function(e){switch(e){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."}}(e.kind)]})]},`${e.at}-${e.operation}`))})]}):null,eQ.length?eQ.map(e=>(0,s.jsxs)("details",{className:(0,k.cn)("group rounded-[16px] border","light"===f?"border-border bg-card":"border-white/[0.08] bg-[#101a2a]/92"),children:[(0,s.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-3 px-3.5 py-2.5",children:[(0,s.jsxs)("code",{className:(0,k.cn)("min-w-0 flex-1 truncate font-mono text-[11px]","light"===f?"text-foreground":"text-slate-200"),children:[e.command," ",e.args.join(" ")]}),(0,s.jsx)("span",{className:(0,k.cn)("inline-flex shrink-0 items-center gap-1.5 rounded-full border px-2 py-1 text-[9px] uppercase tracking-[0.12em]","ok"===e.status?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-red-200 bg-red-50 text-red-700"),children:e.status}),(0,s.jsxs)("span",{className:(0,k.cn)("hidden text-xs sm:inline","light"===f?"text-muted-foreground":"text-slate-400"),children:[e.durationMs," ms"]}),(0,s.jsx)(g.A,{className:(0,k.cn)("h-4 w-4 transition-transform group-open:rotate-180","light"===f?"text-muted-foreground":"text-slate-400")})]}),(0,s.jsxs)("div",{className:(0,k.cn)("border-t p-3.5","light"===f?"border-border":"border-white/[0.08]"),children:[(0,s.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,s.jsx)(t1,{title:"stdout",value:e.stdoutPreview,surfaceTheme:f}),(0,s.jsx)(t1,{title:"stderr",value:e.stderrPreview,surfaceTheme:f})]}),(0,s.jsxs)("p",{className:(0,k.cn)("mt-3 text-xs","light"===f?"text-muted-foreground":"text-slate-400"),children:["Exit code: ",e.exitCode??"n/a"," | Started: ",ar(e.startedAt)]})]})]},e.id)):(0,s.jsx)(t8,{title:"No recent CLI calls",detail:"Diagnostics will appear after AgentOS uses fallback commands.",surfaceTheme:f})]})})}):null,"agents"===eF?(0,s.jsx)("section",{id:"agents",className:"scroll-mt-24",children:(0,s.jsxs)(tX,{title:"Agents",icon:tU.A,surfaceTheme:f,children:[(0,s.jsx)(t0,{surfaceTheme:f,rows:[["Agents",String(b.agents.length)],["Workspaces",String(b.workspaces.length)],["Active runtimes",String(b.runtimes.filter(e=>"running"===e.status).length)]]}),(0,s.jsx)(v.$,{asChild:!0,variant:"secondary",className:(0,k.cn)(ac(f),"mt-4 w-full"),children:(0,s.jsx)(t_(),{href:"/",children:"Open mission control"})})]})}):null,"advanced"===eF?(0,s.jsx)("section",{id:"advanced",className:"scroll-mt-24",children:(0,s.jsxs)(tX,{title:"Advanced",icon:tF.A,surfaceTheme:f,children:[(0,s.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,s.jsx)(tQ,{label:"Install method",value:b.diagnostics.updateInstallKind||X.label||"Unknown",surfaceTheme:f}),(0,s.jsx)(tQ,{label:"Updater",value:b.diagnostics.updatePackageManager||"Unknown",surfaceTheme:f}),(0,s.jsx)(tQ,{label:"Last checked",value:M?new Date(M).toLocaleTimeString():"Not checked",surfaceTheme:f})]}),(0,s.jsxs)("div",{className:(0,k.cn)("mt-4 rounded-[18px] p-3.5","light"===f?"border border-border bg-muted/45":"border border-white/[0.08] bg-[#101a2a]/92"),children:[(0,s.jsx)("p",{className:ao(f),children:"Install root"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-2 break-all text-sm","light"===f?"text-foreground":"text-slate-200"),children:as(b.diagnostics.updateRoot||X.root||"Not detected",80)})]}),(0,s.jsxs)("div",{className:(0,k.cn)("mt-4 rounded-[18px] p-3.5","light"===f?"border border-border bg-muted/45":"border border-white/[0.08] bg-[#101a2a]/92"),children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:ao(f),children:"Config update pacing"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-xs leading-5","light"===f?"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,s.jsx)("span",{className:(0,k.cn)("inline-flex items-center rounded-full border px-2.5 py-1 text-[10px] uppercase tracking-[0.12em]",ek.pending?"light"===f?"border-amber-200 bg-amber-50 text-amber-700":"border-amber-300/24 bg-amber-300/[0.08] text-amber-200":"light"===f?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/[0.08] text-emerald-200"),children:ek.pending?"Pending config update":"Idle"})]}),(0,s.jsxs)("div",{className:"mt-3 grid gap-2 sm:grid-cols-3",children:[(0,s.jsx)("button",{type:"button",onClick:()=>eA("respect-gateway"),className:au(f,"respect-gateway"===eS),children:"Respect Gateway"}),(0,s.jsx)("button",{type:"button",onClick:()=>eA("fast-local-testing"),className:au(f,"fast-local-testing"===eS),children:"Fast testing"}),(0,s.jsx)("button",{type:"button",onClick:()=>eA("custom"),className:au(f,"custom"===eS),children:"Custom"})]}),"custom"===eS?(0,s.jsxs)("div",{className:"mt-3",children:[(0,s.jsx)(tT.J,{className:ao(f),children:"Minimum local interval, seconds"}),(0,s.jsx)(ti.p,{type:"number",min:1,max:600,value:eI,onChange:e=>eT(e.target.value),className:ad(f,"mt-2")})]}):null,(0,s.jsx)(t0,{surfaceTheme:f,rows:[["Current mode",function(e){switch(e){case"fast-local-testing":return"Fast local testing";case"custom":return"Custom";default:return"Respect Gateway cooldown"}}(ek.settings.mode)],["Minimum local interval",an(ek.settings.minimumIntervalMs)],["Pending paths",ek.pendingPaths.length?ek.pendingPaths.join(", "):"None"],["Retry countdown",null!==ts?an(ts):"None"],["CLI fallback","Disabled for Gateway config cooldown recovery"]]}),ek.lastIssue?(0,s.jsxs)("p",{className:(0,k.cn)("mt-3 text-xs leading-5","light"===f?"text-amber-700":"text-amber-200"),children:["Last Gateway issue: ",ek.lastIssue]}):null,eO?(0,s.jsx)("p",{className:(0,k.cn)("mt-3 text-xs leading-5","light"===f?"text-red-700":"text-rose-300"),children:eO}):null,(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:()=>void ta(),disabled:e$,className:(0,k.cn)(ac(f),"mt-3 w-full"),children:[e$?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(tz.A,{className:"h-3.5 w-3.5"}),"Save pacing"]})]})]})}):null,"danger-zone"===eF?(0,s.jsx)("section",{id:"danger-zone",className:"scroll-mt-24",children:(0,s.jsx)("div",{className:(0,k.cn)("rounded-[22px] p-4 shadow-[0_18px_44px_rgba(185,28,28,0.06)]","light"===f?"border border-red-200 bg-red-50/58":"border border-rose-400/20 bg-rose-500/[0.08]"),children:(0,s.jsxs)("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("span",{className:(0,k.cn)("flex h-10 w-10 shrink-0 items-center justify-center rounded-full border","light"===f?"border-red-200 bg-white text-red-600":"border-rose-300/20 bg-rose-400/10 text-rose-200"),children:(0,s.jsx)(W.A,{className:"h-4 w-4"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:(0,k.cn)("font-display text-lg","light"===f?"text-red-700":"text-rose-100"),children:"Danger Zone"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1.5 max-w-2xl text-sm leading-6","light"===f?"text-red-700/72":"text-rose-100/80"),children:"These actions are destructive and cannot be undone. Confirmation is required before anything runs."})]})]}),(0,s.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2 md:min-w-[340px]",children:[(0,s.jsxs)(v.$,{type:"button",variant:"destructive",onClick:()=>B("mission-control"),className:"h-9 rounded-full bg-red-600 text-xs text-white hover:bg-red-500",children:[(0,s.jsx)(tI.A,{className:"h-3.5 w-3.5"}),"Reset AgentOS"]}),(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:()=>B("full-uninstall"),className:(0,k.cn)("h-9 rounded-full text-xs","light"===f?"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,s.jsx)(tI.A,{className:"h-3.5 w-3.5"}),"Full uninstall"]})]})]})})}):null]})]})})})}function tX({title:e,icon:t,children:a,action:r,surfaceTheme:n}){return(0,s.jsxs)("div",{className:(0,k.cn)("min-h-full rounded-[22px] p-4 shadow-[0_20px_54px_rgba(101,74,54,0.07)] backdrop-blur-xl","light"===n?"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,s.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.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,s.jsx)(t,{className:"h-4 w-4"})}),(0,s.jsx)("h2",{className:(0,k.cn)("font-display text-lg","light"===n?"text-[#2d211b]":"text-slate-100"),children:e})]}),r]}),(0,s.jsx)("div",{className:"mt-4",children:a})]})}function tQ({label:e,value:t,badge:a,surfaceTheme:r,dark:n=!1,compact:i=!1}){let l=n||"dark"===r;return(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[11px]",l?"text-slate-400":"text-muted-foreground"),children:e}),(0,s.jsxs)("div",{className:"mt-1.5 flex items-center gap-2",children:[(0,s.jsx)("p",{className:(0,k.cn)("min-w-0 truncate font-medium",i?"text-sm":"text-[1.05rem]",l?"text-white":"text-foreground"),title:t,children:t}),a?(0,s.jsx)("span",{className:(0,k.cn)("shrink-0 rounded-full border px-2 py-0.5 text-[9px] uppercase tracking-[0.12em]",l?"border-emerald-300/20 bg-emerald-300/10 text-emerald-100":"border-emerald-200 bg-emerald-50 text-emerald-700"),children:a}):null]})]})}function t0({rows:e,successIndex:t,surfaceTheme:a}){let r="dark"===a;return(0,s.jsx)("div",{className:(0,k.cn)("overflow-hidden rounded-[18px] border","light"===a?"border-border bg-card":"border-border bg-[#0f1826]"),children:e.map(([e,a],n)=>(0,s.jsxs)("div",{className:(0,k.cn)("flex items-center justify-between gap-3 px-3.5 py-2.5 last:border-b-0","border-b border-border"),children:[(0,s.jsx)("span",{className:(0,k.cn)("text-sm",r?"text-slate-400":"text-muted-foreground"),children:e}),(0,s.jsx)("span",{className:(0,k.cn)("min-w-0 truncate text-right text-sm",r?"text-slate-100":"text-foreground",t===n?r?"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:a,children:a})]},e))})}function t1({title:e,value:t,surfaceTheme:a}){let r="dark"===a;return(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:ao(a),children:e}),(0,s.jsx)("pre",{className:(0,k.cn)("mt-2 max-h-40 overflow-auto rounded-[14px] border p-3 text-xs",r?"border-white/[0.08] bg-[#0d1624]/92 text-slate-200":"border-border bg-muted/55 text-foreground"),children:t||"No output"})]})}function t2({compatibilityReport:e,report:t,snapshot:a,capabilityMatrix:r,transportSummary:n,nativeAuthLabel:i,error:l,isRunning:o,onRun:d,surfaceTheme:u}){var p;let m,x=t?.compatibility,h=e?.status,b=x?`v${x.agentOsSupportedProtocolRange.min}-v${x.agentOsSupportedProtocolRange.max}`:e?`v${e.gateway.protocolRange.min}-v${e.gateway.protocolRange.max}`:n.protocolRangeLabel,f=x?.lastFallbackReason||e?.fallback.diagnostics[0]?.issue||a.diagnostics.gatewayFallbackDiagnostics?.[0]?.issue||"None",w=x?.lastNativeError||n.lastNativeError||"None",y=e?.recovery||t?.recovery||n.recovery||a.diagnostics.issues[0]||"OpenClaw compatibility is not available yet.",j=h?t7(h):t?function(e){switch(e){case"compatible":return"Compatible";case"degraded":return"Degraded";case"incompatible":return"Incompatible";default:return"Unknown"}}(t.status):"Unknown",N=h?function(e){switch(e){case"compatible":return"success";case"degraded":return"warning";case"incompatible":return"danger";default:return"neutral"}}(h):t?function(e){switch(e){case"compatible":return"success";case"degraded":return"warning";case"incompatible":return"danger";default:return"neutral"}}(t.status):"neutral",C=t?t.safeToDispatchMissions?"Safe to dispatch":"Do not dispatch":e?"compatible"===e.status?"Compatible":"degraded"===e.status?"Degraded":"Incompatible":"Not tested",S=e?[...e.summary.failedSurfaces,...e.summary.unsupportedSurfaces,...e.summary.degradedSurfaces]:[],A=e?.contracts.filter(e=>"ok"!==e.status).slice(0,5)??[];return(0,s.jsxs)("div",{className:(0,k.cn)("mt-4 rounded-[18px] border p-3.5",ap(u)),children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:ao(u),children:"Compatibility"}),(0,s.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-2",children:[(0,s.jsx)("p",{className:(0,k.cn)("font-medium","light"===u?"text-foreground":"text-slate-100"),children:j}),(0,s.jsx)("span",{className:t3(N,u),children:C})]}),(0,s.jsxs)("p",{className:(0,k.cn)("mt-1 text-xs","light"===u?"text-muted-foreground":"text-slate-400"),children:["Report: ",e?ar(e.generatedAt):"Not available",t?` / Smoke: ${ar(t.checkedAt)}`:""]})]}),(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:d,disabled:o,className:ac(u,"px-4"),children:[o?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(tE.A,{className:"h-3.5 w-3.5"}),o?"Running...":"Run OpenClaw Smoke Test"]})]}),(0,s.jsx)("div",{className:"mt-3",children:(0,s.jsx)(t0,{surfaceTheme:u,rows:[["Installed OpenClaw",ae(e?.openClaw.installedVersion??x?.installedVersion??a.diagnostics.version??null)],["Required OpenClaw",ae(x?.requiredOpenClawVersion??e?.openClaw.supportedBaselineVersion??null)],["Recommended OpenClaw",ae(e?.openClaw.recommendedVersion??x?.recommendedOpenClawVersion??a.diagnostics.latestVersion??null)],["Gateway protocol status",e?(m=(p=e).gateway.protocolVersion?`v${p.gateway.protocolVersion}`:"unknown",`${m} / ${p.gateway.protocolStatus}`):x?.gatewayProtocolVersion?`v${x.gatewayProtocolVersion}`:r?.gatewayProtocolVersion?`v${r.gatewayProtocolVersion}`:n.protocolLabel],["AgentOS protocol range",b],["Native Gateway coverage",e?`${e.summary.nativeGatewayCoveragePercent}% (${e.summary.nativeGatewayCoverageLabel})`:"Unknown"],["CLI fallback operation count",e?String(e.summary.cliFallbackOperationCount):"Unknown"],["Unsupported/degraded surfaces",e?S.length>0?at(S,3):"None":"Unknown"],["Node.js",x?.nodeVersion?`${x.nodeVersion} / ${function(e){switch(e){case"supported":return"Supported";case"unsupported":return"Unsupported";default:return"Unknown"}}(x.nodeStatus)}`:"Run smoke test"],["Gateway auth",x?.gatewayAuthStatus||i],["Native Gateway",e?`${e.gateway.health} / ${e.gateway.capabilitySource}`:x?.nativeGatewayStatus||n.statusLabel],["CLI fallback count",String(x?.cliFallbackUsageCount??n.fallbackTotal)],["Last native error",w],["Last fallback reason",f]]})}),(0,s.jsxs)("div",{className:(0,k.cn)("mt-3 rounded-[16px] border p-3 text-xs leading-5","light"===u?"border-border bg-muted/45 text-foreground":"border-white/[0.08] bg-[#0d1624] text-slate-300"),children:[(0,s.jsx)("p",{className:ao(u),children:"Recovery suggestion"}),(0,s.jsx)("p",{className:"mt-1.5",children:y}),l?(0,s.jsx)("p",{className:(0,k.cn)("mt-1.5","light"===u?"text-rose-700":"text-rose-200"),children:l}):null]}),A.length>0?(0,s.jsx)("div",{className:"mt-3 space-y-2",children:A.map(e=>(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[16px] border p-3","light"===u?"border-border bg-card":"border-white/[0.08] bg-[#101a2a]/92"),children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:t3(function(e){switch(e){case"ok":return"success";case"degraded":return"warning";case"unsupported":case"failed":return"danger"}}(e.status),u),children:function(e){switch(e){case"ok":return"OK";case"degraded":return"Degraded";case"unsupported":return"Unsupported";case"failed":return"Failed"}}(e.status)}),(0,s.jsx)("p",{className:(0,k.cn)("text-sm font-medium","light"===u?"text-foreground":"text-slate-100"),children:e.label})]}),(0,s.jsx)("p",{className:(0,k.cn)("mt-2 text-xs leading-5","light"===u?"text-muted-foreground":"text-slate-300"),children:e.reason}),(0,s.jsxs)("p",{className:(0,k.cn)("mt-1 text-xs leading-5","light"===u?"text-muted-foreground":"text-slate-400"),children:["Recovery: ",e.suggestedRecovery]})]},e.operation))}):null,t?.checks.length?(0,s.jsx)("div",{className:"mt-3 space-y-2",children:t.checks.map(e=>(0,s.jsxs)("details",{className:(0,k.cn)("group rounded-[16px] border","light"===u?"border-border bg-card":"border-white/[0.08] bg-[#101a2a]/92"),children:[(0,s.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-3 px-3.5 py-2.5",children:[(0,s.jsx)("span",{className:t3(function(e){switch(e){case"pass":return"success";case"warning":return"warning";case"fail":return"danger";default:return"neutral"}}(e.status),u),children:function(e){switch(e){case"pass":return"Pass";case"warning":return"Warning";case"fail":return"Fail";default:return"Unknown"}}(e.status)}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:(0,k.cn)("truncate text-sm font-medium","light"===u?"text-foreground":"text-slate-100"),children:e.label}),(0,s.jsx)("p",{className:(0,k.cn)("mt-0.5 truncate text-xs","light"===u?"text-muted-foreground":"text-slate-400"),children:e.summary})]}),(0,s.jsxs)("span",{className:(0,k.cn)("hidden text-xs sm:inline","light"===u?"text-muted-foreground":"text-slate-400"),children:[e.durationMs," ms"]}),(0,s.jsx)(g.A,{className:(0,k.cn)("h-4 w-4 transition-transform group-open:rotate-180","light"===u?"text-muted-foreground":"text-slate-400")})]}),(0,s.jsxs)("div",{className:(0,k.cn)("border-t p-3.5","light"===u?"border-border":"border-white/[0.08]"),children:[e.recovery?(0,s.jsxs)("p",{className:(0,k.cn)("mb-3 text-xs leading-5","light"===u?"text-muted-foreground":"text-slate-300"),children:["Recovery: ",e.recovery]}):null,(0,s.jsx)(t1,{title:"raw details",value:function(e){if(null==e)return"No raw details";if("string"==typeof e)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}(e.rawDetails),surfaceTheme:u})]})]},e.id))}):(0,s.jsx)(t8,{title:"No compatibility smoke report",detail:"Run the smoke test to verify OpenClaw binary, Gateway, models, sessions, tasks, config, events, and fallback behavior.",surfaceTheme:u})]})}function t5({summary:e,surfaceTheme:t}){return(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[18px] border p-3.5",ap(t)),children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:ao(t),children:"Gateway Transport"}),(0,s.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-2",children:[(0,s.jsx)("p",{className:(0,k.cn)("font-medium","light"===t?"text-foreground":"text-slate-100"),children:e.statusLabel}),(0,s.jsx)("span",{className:t3(e.statusTone,t),children:e.gatewayModeLabel})]}),(0,s.jsxs)("p",{className:(0,k.cn)("mt-1 text-xs","light"===t?"text-muted-foreground":"text-slate-400"),children:[e.connectionLabel," / ",e.modeLabel]})]}),(0,s.jsxs)("div",{className:"text-left sm:text-right",children:[(0,s.jsx)("p",{className:ao(t),children:"Snapshot stream"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1.5 text-sm","light"===t?"text-foreground":"text-slate-200"),children:e.streamLabel})]})]}),(0,s.jsxs)("div",{className:"mt-3 grid gap-3 sm:grid-cols-4",children:[(0,s.jsx)(tQ,{label:"Protocol support",value:e.protocolRangeLabel,surfaceTheme:t,dark:"dark"===t,compact:!0}),(0,s.jsx)(tQ,{label:"Connected protocol",value:e.protocolLabel,surfaceTheme:t,dark:"dark"===t,compact:!0}),(0,s.jsx)(tQ,{label:"CLI fallback used",value:String(e.fallbackTotal),badge:e.fallbackTotal>0?"Used":"Clean",surfaceTheme:t,dark:"dark"===t,compact:!0}),(0,s.jsx)(tQ,{label:"Last connected",value:e.lastConnectedLabel,surfaceTheme:t,dark:"dark"===t,compact:!0})]}),(0,s.jsxs)("div",{className:"mt-3 grid gap-3 sm:grid-cols-2",children:[(0,s.jsx)(tQ,{label:"Last disconnected",value:e.lastDisconnectedLabel,surfaceTheme:t,dark:"dark"===t,compact:!0}),(0,s.jsx)(tQ,{label:"Fallback summary",value:e.fallbackSummaryLabel,surfaceTheme:t,dark:"dark"===t,compact:!0})]}),(0,s.jsxs)("div",{className:"mt-3 grid gap-3 sm:grid-cols-2",children:[(0,s.jsx)(tQ,{label:"Gateway event stream",value:e.eventBridgeLabel,badge:"success"===e.eventBridgeTone?"Live":"warning"===e.eventBridgeTone?"Degraded":"Unknown",surfaceTheme:t,dark:"dark"===t,compact:!0}),(0,s.jsx)(tQ,{label:"Last Gateway event",value:e.eventBridgeLastEventLabel,surfaceTheme:t,dark:"dark"===t,compact:!0})]}),e.lastNativeError?(0,s.jsx)("div",{className:"mt-3",children:(0,s.jsx)(t1,{title:"Last native error",value:e.lastNativeError,surfaceTheme:t})}):null,e.eventBridgeLastError?(0,s.jsx)("div",{className:"mt-3",children:(0,s.jsx)(t1,{title:"Last event stream error",value:e.eventBridgeLastError,surfaceTheme:t})}):null,e.recovery?(0,s.jsxs)("p",{className:(0,k.cn)("mt-3 text-xs leading-5","light"===t?"text-muted-foreground":"text-slate-400"),children:["Recovery: ",e.recovery]}):null,e.eventBridgeRecovery?(0,s.jsxs)("p",{className:(0,k.cn)("mt-2 text-xs leading-5","light"===t?"text-muted-foreground":"text-slate-400"),children:["Event stream recovery: ",e.eventBridgeRecovery]}):null]})}function t3(e,t){let a="inline-flex shrink-0 items-center rounded-full border px-2 py-1 text-[9px] uppercase tracking-[0.12em]";return"success"===e?(0,k.cn)(a,"light"===t?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/10 text-emerald-100"):"danger"===e?(0,k.cn)(a,"light"===t?"border-red-200 bg-red-50 text-red-700":"border-rose-300/20 bg-rose-300/10 text-rose-100"):"warning"===e?(0,k.cn)(a,"light"===t?"border-amber-200 bg-amber-50 text-amber-700":"border-amber-300/20 bg-amber-300/10 text-amber-100"):(0,k.cn)(a,"light"===t?"border-border bg-card text-muted-foreground":"border-white/[0.08] bg-[#101a2a]/92 text-slate-300")}function t8({title:e,detail:t,surfaceTheme:a}){return(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[18px] border border-dashed p-4 text-center","light"===a?"border-border bg-muted/45":"border-white/[0.08] bg-[#0d1624]/60"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-sm font-medium","light"===a?"text-foreground":"text-slate-100"),children:e}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-xs","light"===a?"text-muted-foreground":"text-slate-400"),children:t})]})}function t4({surfaceTheme:e,isCheckingForUpdates:t,isUpdateRegistryLoading:a,hasUpdateAvailable:r,currentVersion:n,latestVersion:i,updateInfo:l,updateError:o,lastCheckedAt:d,isUpdateRunning:u}){let p=t||u,m=t?"Checking registry":u?"Updating":r?"Update available":o?"Check failed":a?"Registry loading":"Up to date",x=r?"light"===e?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/10 text-emerald-100":o?"light"===e?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-300/20 bg-rose-300/10 text-rose-100":p||a?"light"===e?"border-amber-300 bg-amber-50 text-amber-700":"border-amber-300/20 bg-amber-300/10 text-amber-100":"light"===e?"border-slate-300 bg-white text-slate-600":"border-white/10 bg-[#0f1826] text-slate-300",h=t?"Refreshing OpenClaw update registry...":u?"Installing the selected OpenClaw update.":r?"A newer release is available and ready to install.":o?"OpenClaw returned an error while checking updates.":a?"OpenClaw has not reported a latest release yet.":"No newer release is currently available.";return(0,s.jsxs)("div",{className:(0,k.cn)("mt-3 rounded-[20px] border p-3.5",ap(e)),children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[10px] uppercase tracking-[0.18em]",am(e)),children:"Update status"}),(0,s.jsxs)("div",{className:"mt-1 flex items-center gap-2",children:[p?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin text-emerald-400"}):null,(0,s.jsx)("p",{className:(0,k.cn)("font-medium","light"===e?"text-foreground":"text-slate-100"),children:m}),(0,s.jsx)("span",{className:(0,k.cn)("rounded-full border px-2 py-0.5 text-[9px] uppercase tracking-[0.12em]",x),children:r?"Ready":p?"Working":o?"Attention":"Stable"})]})]}),(0,s.jsxs)("div",{className:"text-right",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[10px] uppercase tracking-[0.18em]",am(e)),children:"Last checked"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-[11px]","light"===e?"text-muted-foreground":"text-slate-300"),children:d?new Date(d).toLocaleTimeString():"Not yet"})]})]}),(0,s.jsx)("div",{className:"mt-3 h-2 overflow-hidden rounded-full bg-black/10 dark:bg-white/10",children:(0,s.jsx)("div",{className:(0,k.cn)("h-full rounded-full transition-all",p?"w-1/2 animate-pulse bg-emerald-400/80":r?"w-full bg-emerald-500":o?"w-2/3 bg-rose-400":"w-5/6 bg-slate-400/70")})}),(0,s.jsxs)("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:[(0,s.jsx)(tQ,{label:"Current version",value:`v${n}`,surfaceTheme:e,dark:"dark"===e,compact:!0}),(0,s.jsx)(tQ,{label:"Latest available",value:i?`v${i}`:"Unknown",badge:r?"Ready":o?"Error":p||a?"Loading":"Stable",surfaceTheme:e,dark:"dark"===e,compact:!0})]}),(0,s.jsxs)("div",{className:(0,k.cn)("mt-3 rounded-[18px] border p-3 text-[11px] leading-5","light"===e?"border-border bg-card text-foreground":"border-white/[0.08] bg-[#0d1624] text-slate-300"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[10px] uppercase tracking-[0.18em]",am(e)),children:"Details"}),(0,s.jsx)("p",{className:"mt-1.5",children:h}),l?(0,s.jsx)("p",{className:"mt-1.5 opacity-90",children:l}):null,o?(0,s.jsx)("p",{className:(0,k.cn)("mt-1.5","light"===e?"text-rose-700":"text-rose-200"),children:o}):null,r?(0,s.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2 text-[10px] uppercase tracking-[0.16em]",children:[(0,s.jsx)("span",{className:(0,k.cn)("rounded-full border px-2 py-1",x),children:"Update ready"}),(0,s.jsx)("span",{className:(0,k.cn)("rounded-full border px-2 py-1",am(e)),children:"Review before install"})]}):null]})]})}async function t6(){let e=await fetch("/api/settings/gateway",{method:"GET",cache:"no-store"});if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||"Unable to check Gateway auth status.")}return(await e.json()).authStatus}function t9(e){return"supported"===e?"Supported":"unsupported"===e?"Fallback":"Unknown"}function t7(e){switch(e){case"compatible":return"Compatible";case"degraded":return"Degraded";case"incompatible":return"Incompatible";default:return"Unknown"}}function ae(e){return e?`v${e.replace(/^v/i,"")}`:"Unknown"}function at(e,t){let a=Array.from(new Set(e)),s=a.slice(0,t),r=a.length>s.length?` +${a.length-s.length}`:"";return`${s.join(", ")}${r}`}function aa(e,t){let a=e.slice(0,3).map(e=>(function(e,t){let[a,s]=e.split(/:\s*/,2),r=t?.[a],n=r?.label??((a||e).replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[._-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,e=>e.toUpperCase())||"Gateway operation");return!s&&r?.recovery&&"gateway-native"!==r.mode?`${n}: ${r.recovery}`:s?`${n} via ${s}`:n})(e,t)),s=e.length>a.length?` +${e.length-a.length}`:"";return`${e.length}: ${a.join(", ")}${s}`}function as(e,t){let a=(0,N.$7)(e);return a.length<=t?a:`${a.slice(0,Math.max(0,t-3))}...`}function ar(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function an(e){if(!e||e<=0)return"Gateway cooldown only";let t=Math.ceil(e/1e3);if(t<60)return`${t}s`;let a=Math.floor(t/60),s=t%60;return s?`${a}m ${s}s`:`${a}m`}function ai(){window.requestAnimationFrame(()=>{window.scrollTo({top:0,left:0,behavior:"auto"})})}function al(){return"openclaw"}function ao(e){return(0,k.cn)("text-[10px] uppercase tracking-[0.18em]","light"===e?"text-muted-foreground":"text-slate-400")}function ad(e,t){return(0,k.cn)("h-10 rounded-[16px] px-3 text-sm outline-none",t,"light"===e?"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 ac(e,t,a){return(0,k.cn)("h-9 rounded-full px-3 text-xs",t,"light"===e?"border-border bg-card text-secondary-foreground hover:bg-muted hover:text-foreground":"gateway-contrast"===a?"border-primary/15 bg-[#0f1826] text-foreground hover:bg-[#182538]":"border-border bg-[#121d2d] text-slate-200 hover:bg-[#182538]")}function au(e,t){return(0,k.cn)("h-9 rounded-full border px-3 text-xs transition-colors",t?"light"===e?"border-primary/35 bg-primary/10 text-primary":"border-primary/30 bg-primary/12 text-primary":"light"===e?"border-border bg-card text-muted-foreground hover:bg-muted hover:text-foreground":"border-border bg-[#121d2d] text-slate-200 hover:bg-[#182538]")}function ap(e){return"light"===e?"border-border bg-muted/45":"border-border bg-[#101a2a]/92"}function am(e){return"light"===e?"text-muted-foreground":"text-slate-400"}var ax=a(73294),ah=a(93479),ag=a(4606),ab=a(6246),af=a(55058),aw=a(96595),av=a(18027);function ay({open:e,task:t,snapshot:a,surfaceTheme:r,onOpenChange:l,onAccept:o,onContinue:d,onRetry:u,onDismiss:p,onOpenEvidence:m}){var x,h,g;let b,f,w,y,[j,C]=(0,i.useState)(null),S=(0,i.useMemo)(()=>{var e;return Array.isArray(e=t?.metadata.optimisticEvents)?e.filter(aC):[]},[t?.metadata.optimisticEvents]),{detail:A,loading:I,error:T}=(0,av.j)(t?.id??"task-review:none",e&&!!t,{dispatchId:t?.dispatchId,optimisticFeed:S}),O=function(e,t){if(!e||!t)return e??t;let a=Object.fromEntries(["reviewStatus","reviewAction","reviewedAt","reviewEvents"].map(e=>[e,t.metadata[e]]).filter(([,e])=>void 0!==e));return 0===Object.keys(a).length?e:{...e,metadata:{...e.metadata,...a}}}(A?.task,t),R=A?.integrity??null,$=O?a.workspaces.find(e=>e.id===O.workspaceId)??null:null,_=O?a.agents.find(e=>e.id===O.primaryAgentId)??null:null,E=[...A?.liveFeed??[]].reverse().find(e=>"assistant"===e.kind||"tool"===e.kind||"artifact"===e.kind)??null,P=O?(0,K.VL)(O,{hasLiveActivity:"running"===O.status||"queued"===O.status||O.liveRunCount>0,latestEvidenceAt:E?.timestamp??null}):null,L=O?(0,K.UF)(O):null,D=O?(0,K.kg)(O):null,U=O?(x=O,b="string"==typeof(h=R?.finalResponseText)?h.trim():"",f="string"==typeof x.metadata.finalResponseText?x.metadata.finalResponseText.trim():"",w="string"==typeof x.metadata.resultPreview?x.metadata.resultPreview.trim():"",y=x.subtitle.trim(),b||f||w||y):"",F=O?(g=O,g.mission?.trim()||g.title.trim()||"Untitled task"):"",G=R?.issues.find(e=>"partial-final-response"===e.id)??R?.issues[0]??null,z=R?.status==="verified"&&!G,V=P?(0,K.B4)(P):z?"verified":"needs review",J=P?(0,K.E2)(P):G?.detail||(z?"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."),H="light"===r,Z=null!==j,Y=async(e,t)=>{if(!j){C(e);try{await t()}finally{C(null)}}};return(0,s.jsx)(eV.lG,{open:e,onOpenChange:l,children:(0,s.jsxs)(eV.Cf,{className:(0,k.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",H?"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:H?"text-slate-500 hover:bg-slate-950/5 hover:text-slate-900":void 0,children:[(0,s.jsx)("div",{className:(0,k.cn)("border-b px-5 py-4",H?"border-slate-200/80 bg-slate-50/85":"border-white/[0.08] bg-white/[0.03]"),children:(0,s.jsxs)("div",{className:"flex items-start gap-3 pr-9",children:[(0,s.jsx)("div",{className:(0,k.cn)("mt-0.5 flex h-10 w-10 shrink-0 items-center justify-center rounded-[14px] border","accepted"===P||z?"border-emerald-300/30 bg-emerald-400/12 text-emerald-200":"border-amber-300/30 bg-amber-400/12 text-amber-100"),children:"accepted"===P||z?(0,s.jsx)(eW.A,{className:"h-4 w-4"}):(0,s.jsx)(W.A,{className:"h-4 w-4"})}),(0,s.jsxs)(eV.c7,{className:"min-w-0 flex-1 space-y-1",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)(B.E,{variant:"accepted"===P||z?"success":P?"muted":"warning",children:V}),O?.dispatchId?(0,s.jsxs)(B.E,{variant:"muted",children:["dispatch ",(0,N.m_)(O.dispatchId,8)]}):null]}),(0,s.jsx)(eV.L3,{className:(0,k.cn)("truncate text-lg",H&&"text-slate-950"),children:O?.title.trim()||"Task review"}),(0,s.jsxs)(eV.rr,{className:H?"text-slate-600":void 0,children:[$?.name||"Workspace",_?` \xb7 ${(0,N.CK)(_)}`:""]})]})]})}),(0,s.jsx)(aw.F,{className:"min-h-0 flex-1",children:(0,s.jsxs)("div",{className:"grid gap-4 p-5 lg:grid-cols-[minmax(0,1fr)_290px]",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)(aj,{icon:ah.A,title:"Captured output",tone:"accepted"===P||z?"success":"warning",isLight:H,children:U?(0,s.jsx)(q.G,{text:U,className:(0,k.cn)("text-[12.5px] leading-6",H?"text-slate-800":"text-slate-100")}):(0,s.jsx)("p",{className:(0,k.cn)("text-[12.5px] leading-6",H?"text-slate-500":"text-slate-400"),children:"No captured assistant output is available yet."})}),(0,s.jsxs)(aj,{icon:W.A,title:"Review reason",tone:"warning",isLight:H,children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[12.5px] leading-6",H?"text-slate-700":"text-slate-200"),children:J}),D?(0,s.jsxs)("p",{className:(0,k.cn)("mt-2 text-[11px]","text-slate-500"),children:["Last operator action: ",D]}):null]}),(0,s.jsx)(aj,{icon:ag.A,title:"Original prompt",isLight:H,children:(0,s.jsx)(q.G,{text:F||"No original prompt was captured.",className:(0,k.cn)("text-[12.5px] leading-6",H?"text-slate-700":"text-slate-200")})})]}),(0,s.jsxs)("aside",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[18px] border p-3",H?"border-slate-200 bg-white":"border-white/[0.08] bg-white/[0.035]"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[10px] uppercase tracking-[0.2em]","text-slate-500"),children:"Evidence"}),(0,s.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[(0,s.jsx)(aN,{label:"Runs",value:String(O?.runtimeCount??0),isLight:H}),(0,s.jsx)(aN,{label:"Turns",value:String(function(e){if(!e)return 0;let t=e.metadata.turnCount;return"number"==typeof t&&Number.isFinite(t)?t:e.runtimeCount}(O)),isLight:H}),(0,s.jsx)(aN,{label:"Files",value:String(O?.artifactCount??0),isLight:H}),(0,s.jsx)(aN,{label:"Issues",value:String(R?.issues.length??O?.warningCount??0),isLight:H})]}),I?(0,s.jsxs)("div",{className:(0,k.cn)("mt-3 flex items-center gap-2 text-[11px]",H?"text-slate-500":"text-slate-400"),children:[(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}),"Loading live evidence..."]}):null,T?(0,s.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:T}):null]}),(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[18px] border p-3",H?"border-slate-200 bg-white":"border-white/[0.08] bg-white/[0.035]"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[10px] uppercase tracking-[0.2em]","text-slate-500"),children:"Task state"}),(0,s.jsxs)("div",{className:"mt-3 space-y-2 text-[12px]",children:[(0,s.jsx)(ak,{label:"Status",value:O?.status??"unknown",isLight:H}),(0,s.jsx)(ak,{label:"Updated",value:O?.updatedAt?(0,N.fw)(O.updatedAt):"unknown",isLight:H}),(0,s.jsx)(ak,{label:"Reviewed",value:L?(0,N.fw)(Date.parse(L)):"not yet",isLight:H})]})]}),(0,s.jsxs)(v.$,{type:"button",variant:"secondary",className:(0,k.cn)("w-full justify-start gap-2",H&&"border-slate-200 bg-slate-50 text-slate-800 hover:bg-slate-100"),disabled:!O||Z,onClick:()=>{O&&m(O,"output")},children:[(0,s.jsx)(M.A,{className:"h-4 w-4"}),"Open evidence"]})]})]})}),(0,s.jsxs)("div",{className:(0,k.cn)("flex flex-col gap-2 border-t px-5 py-4 sm:flex-row sm:items-center sm:justify-end",H?"border-slate-200 bg-slate-50/85":"border-white/[0.08] bg-white/[0.03]"),children:[(0,s.jsxs)(v.$,{type:"button",variant:"ghost",className:(0,k.cn)("gap-2",H&&"text-slate-700 hover:bg-slate-950/5 hover:text-slate-950"),disabled:!O||Z,onClick:()=>void Y("dismiss",()=>{if(O)return p(O)}),children:["dismiss"===j?(0,s.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(ab.A,{className:"h-4 w-4"}),"dismiss"===j?"Dismissing...":"Dismiss"]}),(0,s.jsxs)(v.$,{type:"button",variant:"secondary",className:(0,k.cn)("gap-2",H&&"border-slate-200 bg-white text-slate-800 hover:bg-slate-100"),disabled:!O||Z,onClick:()=>void Y("retry",()=>{if(O)return u(O)}),children:["retry"===j?(0,s.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(n.A,{className:"h-4 w-4"}),"retry"===j?"Preparing...":"Retry"]}),(0,s.jsxs)(v.$,{type:"button",variant:"secondary",className:(0,k.cn)("gap-2",H&&"border-slate-200 bg-white text-slate-800 hover:bg-slate-100"),disabled:!O||Z,onClick:()=>void Y("continue",()=>{if(O)return d(O,U)}),children:["continue"===j?(0,s.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(af.A,{className:"h-4 w-4"}),"continue"===j?"Continuing...":"Continue task"]}),(0,s.jsxs)(v.$,{type:"button",className:"gap-2 bg-emerald-400 text-slate-950 shadow-emerald-400/20 hover:bg-emerald-300",disabled:!O||Z,onClick:()=>void Y("accept",()=>{if(O)return o(O)}),children:["accept"===j?(0,s.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(eW.A,{className:"h-4 w-4"}),"accept"===j?"Accepting...":"Accept result"]})]})]})})}function aj({icon:e,title:t,tone:a="neutral",isLight:r,children:n}){return(0,s.jsxs)("section",{className:(0,k.cn)("rounded-[18px] border p-3.5",r?"border-slate-200 bg-white":"border-white/[0.08] bg-white/[0.035]"),children:[(0,s.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,s.jsx)("div",{className:(0,k.cn)("flex h-7 w-7 items-center justify-center rounded-[10px] border","success"===a?"border-emerald-300/30 bg-emerald-400/12 text-emerald-200":"warning"===a?"border-amber-300/30 bg-amber-400/12 text-amber-100":r?"border-slate-200 bg-slate-50 text-slate-600":"border-white/[0.08] bg-white/[0.05] text-slate-300"),children:(0,s.jsx)(e,{className:"h-3.5 w-3.5"})}),(0,s.jsx)("p",{className:(0,k.cn)("text-[10px] uppercase tracking-[0.2em]","text-slate-500"),children:t})]}),n]})}function aN({label:e,value:t,isLight:a}){return(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[12px] border px-3 py-2",a?"border-slate-200 bg-slate-50":"border-white/[0.08] bg-white/[0.04]"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[9px] uppercase tracking-[0.16em]","text-slate-500"),children:e}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 font-mono text-[13px]",a?"text-slate-900":"text-white"),children:t})]})}function ak({label:e,value:t,isLight:a}){return(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("span",{className:"text-slate-500",children:e}),(0,s.jsx)("span",{className:(0,k.cn)("min-w-0 truncate text-right",a?"text-slate-900":"text-slate-100"),children:t})]})}function aC(e){return"object"==typeof e&&null!==e&&"string"==typeof e.id&&"string"==typeof e.kind&&"string"==typeof e.timestamp&&"string"==typeof e.title&&"string"==typeof e.detail}var aS=a(68903);function aA(e,t){let a=e.trim();return a.length<=t?a:`${a.slice(0,t).trimEnd()}
3
+ ${i}`:n:i)}),requestAnimationFrame(()=>{eu.current?.focus();let e=eu.current?.value??"";eu.current?.setSelectionRange(e.length,e.length)})};return(0,s.jsx)("div",{className:(0,k.cn)("mx-auto w-full transition-[width,max-width] duration-300",eO&&"max-w-[360px]",eT&&"lg:w-[360px]"),onMouseEnter:()=>{et&&!H&&er(!0)},onMouseLeave:()=>{et&&!H&&er(!1)},children:(0,s.jsx)(b.N,{initial:!1,mode:"wait",children:eO?(0,s.jsx)(f.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:H,onFocus:()=>{H||er(!0)},onClick:()=>{H||(ei(!1),er(!0),requestAnimationFrame(()=>{eu.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,s.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,s.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:ev||"No agent"}),(0,s.jsx)("p",{className:"min-w-0 flex-1 truncate text-[13px] text-[#f6eee5]/58",children:H?"Creating task...":eC}),(0,s.jsxs)("span",{className:"inline-flex h-8 items-center rounded-full bg-white px-3 text-[12px] font-medium text-slate-950",children:[H?(0,s.jsx)(c.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(u.A,{className:"mr-1.5 h-3.5 w-3.5"}),H?"Creating":"Create task"]})]})},"collapsed"):(0,s.jsxs)(f.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,s.jsx)(b.N,{initial:!1,children:ed?(0,s.jsxs)(f.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,s.jsxs)("span",{className:"truncate",children:["From ",ed.sourceLabel]}),(0,s.jsx)("button",{type:"button",className:"text-slate-200 transition-colors hover:text-white",onClick:()=>eR(ed.mission,{mode:"replace"}),children:"Replace"}),(0,s.jsx)("button",{type:"button",className:"text-slate-200 transition-colors hover:text-white",onClick:()=>eR(ed.mission),children:"Append"}),(0,s.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:()=>ec(null),"aria-label":"Dismiss runtime suggestion",children:(0,s.jsx)(p.A,{className:"h-3.5 w-3.5"})})]}):null}),(0,s.jsxs)("div",{className:(0,k.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",l&&"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:()=>{ei(!1),g?.(!0)},onBlurCapture:e=>{let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||(g?.(!1),et||0!==z.trim().length||Q||null!==ed||er(!1))},children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-2.5 pb-1 pt-2.5",children:[ew?(0,s.jsx)(A,{value:q,options:ej,onChange:e=>{ei(!1),J(e),d?.(e)}}):(0,s.jsx)(_,{children:"No agent"}),(0,s.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,s.jsx)(T,{label:"Refresh AgentOS",onClick:async()=>{X(!0),await $(),X(!1)},children:Y?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(m.A,{className:"h-3.5 w-3.5"})}),(0,s.jsx)(T,{label:"Create workspace",onClick:M,children:(0,s.jsx)(x.A,{className:"h-3.5 w-3.5"})}),(0,s.jsx)(T,{label:"Composer settings",onClick:()=>ee(e=>!e),active:Q||"medium"!==K,children:(0,s.jsxs)("span",{className:"relative inline-flex",children:[(0,s.jsx)(h.A,{className:"h-3.5 w-3.5"}),"medium"!==K?(0,s.jsx)("span",{className:"absolute -right-1 -top-1 h-1.5 w-1.5 rounded-full bg-white/80"}):null]})})]})]}),(0,s.jsx)("div",{className:"px-2.5 pt-0.5",children:(0,s.jsx)(y.T,{ref:eu,value:z,onChange:e=>{ei(!1),V(e.target.value)},onKeyDown:async e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),ek&&ey&&await e_({mission:z,agentId:ey,workspaceId:a??void 0,thinking:K}))},placeholder:eC,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,s.jsxs)("div",{className:"flex items-end justify-between gap-2.5 px-2.5 pb-2.5 pt-1.5",children:[(0,s.jsx)(b.N,{initial:!1,children:eA?(0,s.jsxs)(f.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:[eS.map(e=>(0,s.jsx)(O,{label:e.label,onClick:()=>{"open-workspace-create"===e.action?M():e.mission&&eR(e.mission,{thinking:e.thinking})}},e.id)),eb?(0,s.jsx)(w.O,{snapshot:e,defaultWorkspaceId:eb.id,onRefresh:$,onAgentCreationPending:U,onAgentCreated:e=>{em.current=e,J(e)},onAgentCreatedVisible:F,surfaceTheme:t,trigger:(0,s.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,el&&eb?(0,s.jsx)("button",{type:"button",onClick:()=>E(),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,s.jsx)("div",{})}),(0,s.jsxs)(v.$,{className:"h-9 rounded-full bg-white px-3.5 text-slate-950 shadow-none hover:bg-white/92",disabled:!ek,onClick:async()=>{ey&&await e_({mission:z,agentId:ey,workspaceId:a??void 0,thinking:K})},children:[H?(0,s.jsx)(c.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(u.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Create task"]})]})]}),(0,s.jsx)(b.N,{initial:!1,children:Q?(0,s.jsx)(f.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,s.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,s.jsx)("p",{className:"text-[11px] text-slate-300",children:"Thinking"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(I,{ariaLabel:"Select thinking level",value:K,options:[{label:"off",value:"off"},{label:"minimal",value:"minimal"},{label:"low",value:"low"},{label:"medium",value:"medium"},{label:"high",value:"high"}],onChange:e=>B(e)})}),(0,s.jsx)("button",{type:"button",className:"mt-3 text-[12px] text-slate-400 transition-colors hover:text-white",onClick:()=>{ei(!1),V(""),B("medium"),ec(null),eh.current=!0,eN&&void 0!==globalThis.localStorage&&globalThis.localStorage.removeItem(eN)},children:"Clear draft"})]})}):null})]},"expanded")})})}function A({value:e,options:t,onChange:a}){let r=t.find(t=>t.value===e)??t[0],n=t.length>1;return(0,s.jsxs)("div",{className:"relative inline-flex items-center rounded-full border border-white/[0.08] bg-white/[0.04] text-slate-100",children:[n?(0,s.jsx)("select",{"aria-label":"Select mission agent",value:r?.value??"",onChange:e=>a(e.target.value),className:"h-8 appearance-none bg-transparent pl-3 pr-8 text-[12px] outline-none",children:t.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))}):(0,s.jsx)("span",{className:"px-3 text-[12px]",children:r?.label||"No agent"}),n?(0,s.jsx)(g.A,{className:"pointer-events-none absolute right-3 h-3.5 w-3.5 text-slate-400"}):null]})}function I({ariaLabel:e,value:t,options:a,onChange:r}){let n=a.find(e=>e.value===t)??a[0];return(0,s.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,s.jsx)("select",{"aria-label":e,value:n?.value??"",onChange:e=>r(e.target.value),className:"h-9 w-full appearance-none bg-transparent pl-3 pr-9 text-[12px] outline-none",children:a.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,s.jsx)(g.A,{className:"pointer-events-none absolute right-3 h-3.5 w-3.5 text-slate-400"})]})}function T({label:e,active:t=!1,onClick:a,children:r}){return(0,s.jsx)("button",{type:"button","aria-label":e,title:e,onClick:a,className:(0,k.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",t&&"border-white/[0.08] bg-white/[0.06] text-white"),children:r})}function O({label:e,onClick:t}){return(0,s.jsx)("button",{type:"button",onClick:t,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:e})}function _({children:e}){return(0,s.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:e})}function R(e,t){return e||t?`mission-control-composer-draft:${e??"global"}:${t??"unassigned"}`:null}var $=a(49568),M=a(94766),E=a(37227),P=a(86161),L=a(10910),D=a(46765),U=a(60159),F=a(39582),G=a(90656),W=a(2452),z=a(48583),V=a(91980),q=a(88790),J=a(38436),K=a(93028),B=a(66761),H=a(12842);let Z=["Focus on tests","Prioritize UI polish","Avoid changing public API","Continue from the latest failure"];function Y({className:e,...t}){return(0,s.jsx)(B.E,{...t,className:(0,k.cn)("!h-4 !px-1.5 !py-0 !text-[8px] !leading-none !tracking-[0.1em] !whitespace-nowrap",e)})}function X(e){return(0,s.jsx)(Q,{...e},e.selectedNodeId??"overview")}function Q({snapshot:e,surfaceTheme:t,selectedNodeId:a,activeTaskCard:r,agentDetailFocus:n,lastMission:l,onRefresh:o,onSnapshotChange:d,onConfigureAgentCapabilities:c,onConnectModelProvider:u,onAbortTask:m,collapsed:x,onToggleCollapsed:h,activeTab:g,onActiveTabChange:w}){let v=(0,N.hv)(e.generatedAt),y=e.workspaces.find(e=>e.id===a),j=e.agents.find(e=>e.id===a),C=e.tasks.find(e=>e.id===a),S=C&&r?.taskId===C.id?r:null,A=e.runtimes.find(e=>e.id===a),I=e.models.find(e=>e.id===a),T=!!C?.metadata.optimistic,O=y||j||C||A||I||null,_=A?.id??null,R=C?.id??null,U=C&&"string"==typeof C.dispatchId?C.dispatchId:null,{runtimeOutput:F,runtimeOutputError:G}=function(e){let[t,a]=(0,i.useState)(null),[s,r]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!e)return;let t=new AbortController;return fetch(`/api/runtimes/${encodeURIComponent(e)}`,{signal:t.signal}).then(async e=>{let t=await e.json();if(!e.ok)throw Error(t.error||"Unable to load runtime output.");a(t),r(null)}).catch(s=>{t.signal.aborted||(a(null),r({runtimeId:e,message:s instanceof Error?s.message:"Unable to load runtime output."}))}),()=>t.abort()},[e]),{runtimeOutput:t,runtimeOutputError:s}}(_),W=(0,i.useMemo)(()=>{var e;return T&&C?{task:e=C,runs:[],outputs:[],liveFeed:function(e){let t=new Map;for(let a of[...ex(e.metadata.optimisticEvents),...ex(e.metadata.reviewEvents)])t.set(a.id,a);return[...t.values()].sort((e,t)=>Date.parse(e.timestamp)-Date.parse(t.timestamp))}(e),createdFiles:[],warnings:ej(e)||"stalled"===e.status&&!ey(e.subtitle)?[e.subtitle]:[],integrity:em(e)}:null},[T,C]),z=!!R&&(!T||!!U),{taskDetail:q,taskDetailError:K,taskDetailNotice:B}=function({selectedTaskId:e,canStreamTaskDetail:t,selectedTaskDispatchId:a}){let[s,r]=(0,i.useState)(null),[n,l]=(0,i.useState)(null),[o,d]=(0,i.useState)(null);return(0,i.useEffect)(()=>{if(!e||!t)return;let s=new URLSearchParams;a&&s.set("dispatchId",a);let n=new EventSource(`/api/tasks/${encodeURIComponent(e)}/stream${s.size>0?`?${s.toString()}`:""}`),i=t=>{try{let e=JSON.parse(t.data);if("task"!==e.type)return;r(e.detail),l(null)}catch(t){l({taskId:e,message:t instanceof Error?t.message:"Unable to parse task feed."})}},o=t=>{try{let a=JSON.parse(t.data);"error"===a.type&&l({taskId:e,message:a.error})}catch{l({taskId:e,message:"Unable to load task detail."})}},c=t=>{try{let a=JSON.parse(t.data);if("ready"!==a.type)return;let s=a.eventBridge,r=s&&"live"!==s.mode?[s.message,s.recovery].filter(Boolean).join(" "):null;d({taskId:e,message:r})}catch{d({taskId:e,message:null})}};return n.addEventListener("task",i),n.addEventListener("task-error",o),n.addEventListener("ready",c),n.onerror=()=>{l(t=>t?.taskId===e?t:{taskId:e,message:"Task feed disconnected. Reconnecting…"})},()=>{n.removeEventListener("task",i),n.removeEventListener("task-error",o),n.removeEventListener("ready",c),n.close()}},[e,t,a]),{taskDetail:s,taskDetailError:n,taskDetailNotice:o}}({selectedTaskId:R,canStreamTaskDetail:z,selectedTaskDispatchId:U}),H=F&&F.runtimeId===_?F:null,Z=G?.runtimeId===_?G.message:null,X=q&&(q.task.id===R||U&&"string"==typeof q.task.dispatchId&&q.task.dispatchId===U)?q:null,el=K?.taskId===R?K.message:null,eo=B?.taskId===R?B.message:null,ep=function(e,t){var a,s,r;if(!e||!t||null===t.followUpIndex)return e;let n=function(e,t){let a=e.runId?.trim();if(a){let e=t.filter(e=>{let t;return e.runId===a||e.id===a||("string"==typeof(t=e.metadata.runId)&&t.trim().length>0?t.trim():null)===a});if(e.length>0)return e.sort((e,t)=>ee(t.updatedAt)-ee(e.updatedAt))}let s=e.createdAt?Date.parse(e.createdAt):NaN,r=e.sessionId?.trim();return t.filter(e=>{let t=ee(e.updatedAt),a=Number.isNaN(s)||0===t||t>=s-5e3,n=!r||e.sessionId===r||e.key.includes(r);return a&&n}).sort((e,t)=>ee(t.updatedAt)-ee(e.updatedAt))}(t,e.runs),i=(a=n).find(e=>et(e))??a.find(e=>"completed"===e.status)??a[0]??null,l=e.outputs.filter(e=>n.some(t=>t.id===e.runtimeId)),o=(s=l).find(e=>e.finalText?.trim())??s.find(e=>e.errorMessage?.trim())??s[0]??null,d=function(e,t,a){if(t.length>0){let e=new Set(t.map(e=>e.id));return a.filter(t=>!!(t.runtimeId&&e.has(t.runtimeId)))}let s=e.createdAt?Date.parse(e.createdAt):NaN;return Number.isNaN(s)?[]:a.filter(e=>{let t=Date.parse(e.timestamp);return!Number.isNaN(t)&&t>=s-5e3})}(t,n,e.liveFeed),c=d.length>0?d:[(r=t,{id:`follow-up-${r.cardNumber}-accepted`,kind:"user",timestamp:r.createdAt??new Date().toISOString(),title:"Follow-up accepted",detail:r.message||"OpenClaw accepted the follow-up for the existing session.",runtimeId:r.runId??void 0})],u=l.length>0?eU(l.flatMap(e=>e.createdFiles)):eU(n.flatMap(e=>eL(e))),p=l.length>0?ea(l.flatMap(e=>e.warnings)):ea(n.flatMap(e=>eD(e))),m=function(e,t,a){switch(e){case"queued":case"running":case"idle":case"completed":case"stalled":case"cancelled":return e;default:return t?.finalText||a.summary?"completed":"running"}}(i?.status??t.status,o,t),x=o?.finalText?.trim()||t.summary?.trim()||null,h=ea([...n.flatMap(e=>e.toolNames??[]),...l.flatMap(e=>e.items.map(e=>e.toolName).filter(e=>!!e))]);return{...e,task:{...e.task,title:t.message||`Follow-up ${t.cardNumber-1}`,mission:t.message??e.task.mission,subtitle:x||(i&&et(i)?i.subtitle:null)||("running"===m||"queued"===m?"Follow-up is running in the existing OpenClaw session.":e.task.subtitle),status:m,updatedAt:i?.updatedAt??e.task.updatedAt,primaryRuntimeId:i?.id??e.task.primaryRuntimeId,runtimeIds:n.map(e=>e.id),sessionIds:ea([t.sessionId??"",...n.map(e=>e.sessionId??"")]),runIds:ea([t.runId??"",...n.map(e=>e.runId??"")]),runtimeCount:Math.max(n.length,+!!t.runId),updateCount:c.length,liveRunCount:+("running"===m||"queued"===m),artifactCount:u.length,warningCount:p.length,tokenUsage:function(e){let t=e.map(e=>e.tokenUsage).filter(e=>!!e);if(0!==t.length)return t.reduce((e,t)=>({input:e.input+(t?.input??0),output:e.output+(t?.output??0),total:e.total+(t?.total??0),cacheRead:(e.cacheRead??0)+(t?.cacheRead??0)}),{input:0,output:0,total:0,cacheRead:0})}(n),metadata:{...e.task.metadata,resultPreview:x??(i&&et(i)?i.subtitle:null)??"Waiting for follow-up output.",finalResponseText:x,finalResponseRuntimeId:i?.id??null,turnCount:Math.max(new Set(n.map(e=>e.runId??e.id)).size,+!!t.runId),sessionCount:ea([t.sessionId??"",...n.map(e=>e.sessionId??"")]).length,followUpCardNumber:t.cardNumber,followUpMessage:t.message??null}},runs:n,outputs:l,liveFeed:c,createdFiles:u,warnings:p,integrity:{...e.integrity,finalResponseText:x,finalResponseSource:x?"runtime":"none",outputFileCount:u.length,transcriptTurnCount:l.reduce((e,t)=>e+t.items.length,0)||n.length,matchingTranscriptTurnCount:l.reduce((e,t)=>e+t.items.length,0),toolNames:h,issues:x?[]:e.integrity.issues,status:x?"verified":e.integrity.status}}}(X??W,S),eh=z&&!X&&!el,eg=!!_&&!H&&!Z,eb=!!j,ef=!!(A||C),ew=!!(A||C),ev=("chat"!==g||eb)&&("output"!==g||ef)&&("files"!==g||ew)?g:"overview",eN="chat"===ev&&!!j,eO=C?"Activity":"Output",e_=y?.name||(j?(0,N.CK)(j):null)||(S?(0,N.$m)(S.message||`Follow-up ${S.cardNumber-1}`,48)||"Follow-up":C?(0,N.$m)(C.title||C.mission||"Task",48)||"Task":null)||(A?(0,N.$m)(A.title||"Run",48)||"Run":null)||I?.name||"Gateway overview",eR=y?"workspace":j?"agent":C?S?`follow-up ${S.cardNumber}`:"task":A?"run":I?"model":"selection",e$=(0,i.useMemo)(()=>[{id:"overview",label:"Inspect",icon:$.A,enabled:!0},{id:"chat",label:"Chat",icon:M.A,enabled:eb},{id:"output",label:eO,icon:E.A,enabled:ef},{id:"files",label:"Files",icon:P.A,enabled:ew},{id:"raw",label:"Raw",icon:L.A,enabled:!0}],[eO,eb,ew,ef]);return(0,s.jsxs)("div",{className:"panel-surface panel-glow flex h-full flex-row-reverse overflow-hidden rounded-l-[28px] border border-r-0 border-sky-100/[0.09] bg-[radial-gradient(circle_at_22%_0%,rgba(125,211,252,0.07),transparent_34%),radial-gradient(circle_at_100%_18%,rgba(250,0,63,0.07),transparent_30%),linear-gradient(180deg,rgba(5,11,22,0.96),rgba(2,7,16,0.99))] shadow-[0_30px_90px_rgba(0,0,0,0.52)] backdrop-blur-2xl",children:[(0,s.jsxs)("div",{className:(0,k.cn)("flex h-full shrink-0 flex-col items-center bg-[linear-gradient(180deg,rgba(4,10,20,0.92),rgba(2,6,13,0.98))] px-1.5 py-4",x?"w-full rounded-l-[28px]":"w-[60px] border-l border-sky-100/[0.09]"),children:[(0,s.jsx)(J.A,{label:"Inspector",side:"left",surfaceTheme:t,panelCollapsed:x,children:(0,s.jsx)("button",{type:"button","aria-label":x?"Expand inspector":"Collapse inspector",onClick:h,className:"flex h-10 w-10 items-center justify-center rounded-[13px] border border-sky-100/[0.11] bg-white/[0.035] shadow-[0_10px_24px_rgba(0,0,0,0.18)] transition-all hover:border-sky-100/[0.18] hover:bg-sky-200/[0.06]",children:(0,s.jsx)(E.A,{className:"h-4 w-4 text-sky-200/80"})})}),(0,s.jsx)("div",{className:"mt-4 flex flex-1 flex-col items-center gap-2",children:e$.map(e=>(0,s.jsx)(eI,{icon:e.icon,label:e.label,active:ev===e.id,surfaceTheme:t,panelCollapsed:x,tooltipSide:"left",disabled:!e.enabled,onClick:()=>{e.enabled&&(w(e.id),x&&h())}},e.id))}),(0,s.jsxs)("div",{className:"mt-3 flex flex-col items-center gap-1",children:[(0,s.jsx)(Y,{variant:"muted",className:"h-5 min-w-[34px] rounded-full px-1.5 py-0 text-[8px] leading-none tracking-[0.14em]",children:O?"live":"idle"}),x?(0,s.jsx)("p",{className:"max-w-[44px] truncate text-center text-[8px] uppercase tracking-[0.14em] text-slate-500",children:eR}):null]})]}),x?null:(0,s.jsx)("div",{className:"min-w-0 flex-1 bg-[linear-gradient(180deg,rgba(5,12,24,0.86),rgba(3,8,17,0.96))]",children:(0,s.jsxs)("div",{className:(0,k.cn)("mission-scroll flex h-full min-h-0 flex-col overscroll-contain",eN?"overflow-hidden":"overflow-y-auto"),children:[(0,s.jsxs)("div",{className:"shrink-0 px-5 pb-4 pt-5",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-[0.34em] text-sky-200/65",children:"Inspect"}),(0,s.jsxs)("div",{className:"mt-2 flex min-w-0 flex-wrap items-center gap-2",children:[(0,s.jsx)("h2",{className:"min-w-0 max-w-full truncate font-display text-[1.65rem] leading-[1.1] text-white",children:e_}),(0,s.jsx)(Y,{variant:"muted",className:"shrink-0 h-6 rounded-full border-sky-100/[0.1] bg-white/[0.045] px-2.5 py-0 text-[9px] leading-none tracking-[0.16em] text-slate-100",children:eR})]}),(0,s.jsx)("p",{className:"mt-2 line-clamp-2 text-[13px] leading-5 text-slate-300/90",children:C?`${C.runtimeCount} runs \xb7 ${C.liveRunCount} live \xb7 ${(0,N.fw)(C.updatedAt,v)}`:A?`Run ${(0,N.m_)(A.runId||A.id,10)} \xb7 ${A.status} \xb7 ${(0,N.fw)(A.updatedAt,v)}`:j?`${j.activeRuntimeIds.length} active runs`:y?`${y.agentIds.length} agents attached`:I?`${I.provider} model`:"Live gateway context"})]}),(0,s.jsx)("button",{type:"button","aria-label":"Close inspector",onClick:h,className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[13px] border border-white/[0.09] bg-white/[0.045] text-slate-300 shadow-[inset_0_1px_0_rgba(255,255,255,0.05)] transition-all hover:border-sky-100/[0.16] hover:bg-white/[0.07] hover:text-white",children:(0,s.jsx)(p.A,{className:"h-4 w-4"})})]}),(0,s.jsx)("div",{className:"mt-5 flex flex-nowrap gap-1 overflow-x-auto rounded-[18px] border border-sky-100/[0.08] bg-[linear-gradient(180deg,rgba(10,20,37,0.82),rgba(7,15,29,0.74))] p-1 shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]",children:e$.filter(e=>e.enabled).map(e=>(0,s.jsx)(eT,{label:e.label,active:ev===e.id,onClick:()=>w(e.id)},e.id))})]}),(0,s.jsx)("div",{className:(0,k.cn)("flex-1 px-5 pb-5 pt-0",eN&&"min-h-0 overflow-hidden"),children:(0,s.jsx)(b.N,{mode:"wait",children:(0,s.jsxs)(f.P.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},className:(0,k.cn)("space-y-3.5",eN&&"flex h-full min-h-0 flex-col space-y-0"),children:["overview"===ev?(0,s.jsxs)(s.Fragment,{children:[y?(0,s.jsx)(er,{snapshot:e,workspaceId:y.id}):null,j?(0,s.jsx)(en,{snapshot:e,agentId:j.id,focusSection:n,onConfigureAgentCapabilities:c}):null,C?(0,s.jsx)(ei,{snapshot:e,task:C,taskId:C.id,taskDetail:ep,taskDetailLoading:eh,taskDetailError:el,taskDetailNotice:eo,onAbortTask:m,onControlComplete:o}):null,A?(0,s.jsx)(ek,{snapshot:e,runtimeId:A.id,runtimeOutput:H,runtimeOutputLoading:eg,runtimeOutputError:Z}):null,I?(0,s.jsx)(eA,{snapshot:e,modelId:I.id}):null,O?null:(0,s.jsx)(es,{snapshot:e,lastMission:l})]}):null,j?(0,s.jsx)("div",{className:(0,k.cn)("min-h-0 flex-1",eN?"block":"hidden"),"aria-hidden":!eN,children:(0,s.jsx)(V.d,{agent:j,snapshot:e,surfaceTheme:t,isVisible:eN,onRefresh:o,onSnapshotChange:d,onConnectModelProvider:u})}):null,"output"===ev&&C?(0,s.jsx)(ed,{task:C,basePath:eu(e,C,ep?.runs),taskDetail:ep,taskDetailLoading:eh,taskDetailError:el,taskDetailNotice:eo,onAbortTask:m,onControlComplete:o}):null,"output"===ev&&A?(0,s.jsx)(eS,{runtime:A,basePath:e.workspaces.find(e=>e.id===A.workspaceId)?.path,runtimeOutput:H,runtimeOutputLoading:eg,runtimeOutputError:Z}):null,"files"===ev&&C?(0,s.jsx)(ec,{snapshot:e,task:C,taskDetail:ep}):null,"files"===ev&&A?(0,s.jsx)(eC,{runtime:A,runtimeOutput:H}):null,"raw"===ev?(0,s.jsx)("pre",{className:"overflow-x-auto rounded-[22px] border border-sky-100/[0.08] bg-slate-950/[0.62] p-4 text-[11px] leading-5 text-slate-300 shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]",children:JSON.stringify(C&&ep?ep:A&&H?{runtime:A,output:H}:O||e,null,2)}):null]},a||"overview")})}),eN?null:(0,s.jsx)("div",{className:"shrink-0 px-5 pb-5 pt-0",children:(0,s.jsx)("div",{className:"rounded-[22px] border border-sky-100/[0.08] bg-[linear-gradient(180deg,rgba(8,20,34,0.78),rgba(5,13,24,0.78))] p-4 shadow-[0_16px_42px_rgba(0,0,0,0.25),inset_0_1px_0_rgba(255,255,255,0.04)]",children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-[14px] border border-sky-100/[0.1] bg-white/[0.045] text-sky-200/75",children:(0,s.jsx)(D.A,{className:"h-4 w-4"})}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"truncate font-display text-[15px] text-white",children:C?`${C.runtimeCount} runs`:A?`Run ${(0,N.m_)(A.runId||A.id,10)}`:j?`${j.activeRuntimeIds.length} active runs`:y?`${y.agentIds.length} agents`:I?I.provider:"Gateway overview"}),(0,s.jsxs)("p",{className:"mt-1 text-[12px] text-slate-400",children:[eR," \xb7"," ",C?`${ep?.liveFeed.length??0} live feed events`:A?`${H?.items.length??0} transcript entries`:j?`${j.activeRuntimeIds.length} tracked runs`:y?`${y.agentIds.length} attached`:`${e.presence.length} live beacons`]})]})]})})})]})})]})}function ee(e){return"number"!=typeof e||!Number.isFinite(e)||e<=0?0:e>1e12?e:1e3*e}function et(e){let t=e.subtitle.trim().toLowerCase();return!!(t&&!["chat","agent","sessions.changed","session.message","openclaw runtime event","gateway runtime event"].includes(t))}function ea(e){return Array.from(new Set(e.map(e=>e.trim()).filter(Boolean)))}function es({snapshot:e,lastMission:t}){let a=(0,N.hv)(e.generatedAt),r=e.diagnostics.runtime.stateWritable&&e.diagnostics.runtime.sessionStoreWritable?"passed"===e.diagnostics.runtime.smokeTest.status?"verified":"pending smoke test":"attention";return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(eO,{icon:D.A,title:"Gateway health",value:e.diagnostics.health,children:[(0,s.jsx)("p",{children:e.diagnostics.gatewayUrl}),(0,s.jsx)("p",{children:e.diagnostics.dashboardUrl})]}),(0,s.jsxs)(eO,{icon:P.A,title:"Runtime preflight",value:r,children:[(0,s.jsx)("p",{className:"font-mono text-xs text-slate-400",children:e.diagnostics.runtime.stateRoot}),(0,s.jsx)("p",{children:e.diagnostics.runtime.sessionStores.length>0?`${e.diagnostics.runtime.sessionStores.filter(e=>e.writable).length}/${e.diagnostics.runtime.sessionStores.length} session stores writable`:"No agent session stores have been probed yet."}),e.diagnostics.runtime.smokeTest.checkedAt?(0,s.jsxs)("p",{children:["Smoke test ",e.diagnostics.runtime.smokeTest.status," \xb7"," ",e.diagnostics.runtime.smokeTest.agentId||"unknown agent"," \xb7"," ",(0,N.fw)(Date.parse(e.diagnostics.runtime.smokeTest.checkedAt),a)]}):(0,s.jsx)("p",{children:"No runtime smoke test has been recorded yet."}),e.diagnostics.runtime.issues[0]?(0,s.jsx)("div",{className:"rounded-[14px] border border-amber-400/15 bg-amber-400/8 px-3 py-2 text-[13px] text-amber-50",children:e.diagnostics.runtime.issues[0]}):null]}),(0,s.jsxs)(eO,{icon:E.A,title:"Presence beacons",value:String(e.presence.length),children:[0===e.presence.length?(0,s.jsx)("p",{children:"No live presence payloads."}):null,e.presence.map(e=>(0,s.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,s.jsx)("div",{className:"text-[13px] text-white",children:e.host}),(0,s.jsxs)("div",{className:"mt-1 text-xs text-slate-400",children:[e.ip," \xb7 ",e.platform," \xb7 ",e.version]})]},e.ts))]}),t?(0,s.jsxs)(eO,{icon:U.A,title:"Last mission",value:t.status,children:[(0,s.jsx)("p",{className:"text-sm text-white",children:t.summary}),(0,s.jsx)("p",{className:"font-mono text-xs text-slate-500",children:t.runId?`Run ${t.runId}`:`Dispatch ${t.dispatchId??"pending"}`}),"string"==typeof t.meta?.outputDirRelative?(0,s.jsx)("p",{className:"font-mono text-xs text-slate-400",children:t.meta.outputDirRelative}):null,t.payloads[0]?.text?(0,s.jsx)("div",{className:"rounded-[14px] border border-cyan-400/15 bg-cyan-400/8 px-3 py-2 text-[13px] text-cyan-50",children:t.payloads[0].text}):null]}):null]})}function er({snapshot:e,workspaceId:t}){let a=(0,N.hv)(e.generatedAt),r=e.workspaces.find(e=>e.id===t),n=e.agents.filter(e=>e.workspaceId===t),i=r?r.modelIds.map(t=>e.models.find(e=>e.id===t)?.name||t):[],l=e.runtimes.filter(e=>e.workspaceId===t||r?.activeRuntimeIds.includes(e.id)).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0));if(!r)return null;let o=l.filter(e=>"running"===e.status||"queued"===e.status||"idle"===e.status),d=l[0]??null,c=eU(l.flatMap(eL)).slice(0,8),u=r.bootstrap.coreFiles.every(e=>e.present)&&r.bootstrap.projectShell.every(e=>e.present)?"ready":r.bootstrap.coreFiles.some(e=>e.present)||r.bootstrap.projectShell.some(e=>e.present)?"partial":"thin",p=Array.from(new Set(n.flatMap(e=>e.observedTools??[]))),m=0===n.length?"no agents":r.capabilities.workspaceOnlyAgentCount===n.length?"workspace-only":0===r.capabilities.workspaceOnlyAgentCount?"open":"mixed";return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(eO,{icon:P.A,title:"Overview",value:r.health,children:[(0,s.jsx)("p",{className:"font-mono text-xs text-slate-400",children:(0,N.$7)(r.path)}),(0,s.jsx)(e$,{items:[{label:"Agents",value:String(n.length)},{label:"Models",value:String(r.modelIds.length)},{label:"Runs",value:String(l.length)},{label:"Sessions",value:String(r.totalSessions)}]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Models"}),(0,s.jsx)(eE,{emptyLabel:"No models attached",items:i,emptyVariant:"muted",itemVariant:"muted"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Team"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:n.map(e=>(0,s.jsx)(Y,{variant:e.isDefault?"default":"muted",children:(0,N.CK)(e)},e.id))})]})]}),(0,s.jsxs)(eO,{icon:U.A,title:"Bootstrap",value:u,children:[(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(Y,{variant:r.bootstrap.template?"default":"muted",children:r.bootstrap.template||"template unknown"}),(0,s.jsx)(Y,{variant:r.bootstrap.sourceMode?"muted":"warning",children:r.bootstrap.sourceMode||"source unknown"}),r.bootstrap.agentTemplate?(0,s.jsx)(Y,{variant:"muted",children:r.bootstrap.agentTemplate}):null]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Core files"}),(0,s.jsx)(eM,{items:r.bootstrap.coreFiles,missingVariant:"warning"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Optional scaffold"}),(0,s.jsx)(eM,{items:[...r.bootstrap.optionalFiles,...r.bootstrap.folders]})]}),r.bootstrap.contextFiles?.length?(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Context docs"}),(0,s.jsx)(eM,{items:r.bootstrap.contextFiles})]}):null,(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Project shell"}),(0,s.jsx)(eM,{items:r.bootstrap.projectShell})]})]}),(0,s.jsxs)(eO,{icon:U.A,title:"Capabilities",value:m,children:[(0,s.jsxs)("p",{children:[r.capabilities.workspaceOnlyAgentCount,"/",n.length," agents are configured with"," ",(0,s.jsx)("span",{className:"font-mono text-xs text-slate-300",children:"fs.workspaceOnly"}),"."]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Skills"}),(0,s.jsx)(eE,{emptyLabel:"No explicit skills",items:r.capabilities.skills,emptyVariant:"muted",itemVariant:"muted"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Local workspace skills"}),(0,s.jsx)(eE,{emptyLabel:"No local SKILL.md scaffolds",items:r.bootstrap.localSkillIds,emptyVariant:"muted",itemVariant:"success"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Declared tools"}),(0,s.jsx)(eE,{emptyLabel:"No explicit tools configured",items:r.capabilities.tools,emptyVariant:"muted",itemVariant:"warning"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Observed tools"}),(0,s.jsx)(eE,{emptyLabel:"No runtime tool calls recovered yet",items:p,emptyVariant:"muted",itemVariant:"default"})]})]}),(0,s.jsxs)(eO,{icon:E.A,title:"Activity",value:`${o.length} live`,children:[(0,s.jsxs)("p",{children:[l.length," tracked runs across ",r.totalSessions," recorded sessions."]}),(0,s.jsx)("p",{children:d?`Latest update ${(0,N.fw)(d.updatedAt,a)}`:"No runtime activity has been recorded yet."}),l.length>0?(0,s.jsx)("div",{className:"space-y-2 pt-1",children:l.slice(0,3).map(e=>(0,s.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,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"truncate text-[13px] text-white",children:e.title}),(0,s.jsxs)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:[e.subtitle," \xb7 ",(0,N.m_)(e.runId||e.id,10)]})]}),(0,s.jsx)(Y,{variant:(0,N.Uu)(e.status),children:e.status})]},e.id))}):null,(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Agent posture"}),(0,s.jsx)("div",{className:"space-y-2",children:n.map(e=>(0,s.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,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"truncate text-[13px] text-white",children:(0,N.CK)(e)}),(0,s.jsx)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:e.currentAction})]}),(0,s.jsx)(Y,{variant:"engaged"===e.status?"default":"offline"===e.status?"danger":"muted",children:e.status})]},e.id))})]})]}),(0,s.jsx)(eO,{icon:L.A,title:"Created files",value:String(c.length),children:(0,s.jsx)(eR,{files:c,basePath:r.path,emptyLabel:"No file artifacts have been detected in recent workspace runs."})})]})}function en({snapshot:e,agentId:t,focusSection:a,onConfigureAgentCapabilities:r}){let n=(0,N.hv)(e.generatedAt),l=e.agents.find(e=>e.id===t),o=e.workspaces.find(e=>e.id===l?.workspaceId),d=e.models.find(e=>e.id===l?.modelId),c=(0,i.useRef)(null),u=(0,i.useRef)(null),p=(0,i.useRef)(null),m=l?.observedTools??[],x=l?.skills??[],h=(l?.tools??[]).filter(e=>"fs.workspaceOnly"!==e),g=l?.tools.includes("fs.workspaceOnly")?["fs.workspaceOnly"]:[],w=l?(0,H.Cf)(l.policy.preset):null,y=x.length>0?x:w?.skillIds??[],j=h.length>0?h:w?.tools??[],C=l?[{label:"Preset",value:(0,H._P)(l.policy.preset)},{label:"Missing tools",value:(0,H.zR)(l.policy.missingToolBehavior)},{label:"Install scope",value:(0,H.UJ)(l.policy.installScope)},{label:"File access",value:(0,H.bQ)(l.policy.fileAccess)},{label:"Network",value:(0,H.Bw)(l.policy.networkAccess)}]:[],S=e.runtimes.filter(e=>l?.activeRuntimeIds.includes(e.id)).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0)),[A,I]=(0,i.useState)(null),T=eU(S.flatMap(eL)).slice(0,8);return((0,i.useEffect)(()=>{if(!a)return;let e="skills"===a?c.current:"tools"===a?u.current:p.current;e?.scrollIntoView({behavior:"smooth",block:"start"})},[a]),l)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(eO,{icon:U.A,title:"Agent identity",value:l.id,children:[(0,s.jsx)("p",{children:(0,N.CK)(l)}),(0,s.jsx)("p",{children:l.identity.emoji?`${l.identity.emoji} \xb7 ${l.identity.theme??"theme unset"}`:"No identity emoji"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[l.isDefault?(0,s.jsx)(Y,{variant:"default",children:"default agent"}):null,(0,s.jsx)(Y,{variant:(0,H.Cf)(l.policy.preset).badgeVariant,children:(0,H._P)(l.policy.preset)}),l.identity.source?(0,s.jsx)(Y,{variant:"muted",children:l.identity.source}):null]})]}),(0,s.jsxs)(eO,{icon:P.A,title:"Workspace",value:o?.name||"n/a",children:[(0,s.jsx)("p",{className:"font-mono text-xs text-slate-400",children:(0,N.$7)(l.workspacePath)}),(0,s.jsxs)("p",{children:[l.sessionCount," recorded sessions"]})]}),(0,s.jsxs)(eO,{icon:U.A,title:"Model assignment",value:d?.name||l.modelId,children:[(0,s.jsx)("p",{children:d?`${d.provider} \xb7 ${(0,N.FO)(d.contextWindow)} ctx`:"Model metadata unavailable"}),(0,s.jsx)("p",{children:d?.available===!1?"Currently unavailable":d?.local?"Local model route":"Remote model route"})]}),(0,s.jsx)(eO,{icon:U.A,title:"Agent summary",value:(0,H._P)(l.policy.preset),actions:(0,s.jsxs)(v.$,{type:"button",variant:"secondary",size:"sm",onClick:()=>{r?.(l.id,"tools"===a?"tools":"skills")},className:"h-7 rounded-full px-2.5 text-[11px]",children:[(0,s.jsx)(F.A,{className:"mr-1 h-3 w-3"}),"Edit"]}),children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Purpose"}),(0,s.jsx)("div",{className:"w-full rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:(0,s.jsx)("p",{className:"text-[13px] leading-5 text-slate-200",children:l.profile.purpose||"No explicit purpose was found in the workspace bootstrap files."})})]}),(0,s.jsxs)("div",{ref:c,className:(0,k.cn)("scroll-mt-4 rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5 transition-all","skills"===a&&"border-sky-100/[0.18] bg-sky-200/[0.035] shadow-[0_0_0_1px_rgba(125,211,252,0.05)]"),children:[(0,s.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-2",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Skills"}),(0,s.jsxs)(Y,{variant:"muted",children:[y.length," active"]})]}),(0,s.jsx)(eE,{emptyLabel:"No skills available",items:y,emptyVariant:"muted",itemVariant:"muted"})]}),(0,s.jsxs)("div",{ref:u,className:(0,k.cn)("scroll-mt-4 rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5 transition-all","tools"===a&&"border-sky-100/[0.18] bg-sky-200/[0.035] shadow-[0_0_0_1px_rgba(125,211,252,0.05)]"),children:[(0,s.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-2",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Tools"}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[g.length>0?(0,s.jsxs)(Y,{variant:"success",children:[(0,s.jsx)(G.A,{className:"mr-1 h-3 w-3"}),"policy locked"]}):null,(0,s.jsxs)(Y,{variant:"muted",children:[j.length," active"]})]})]}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)(eE,{emptyLabel:"No tools available",items:j,emptyVariant:"muted",itemVariant:"warning"}),g.length>0?(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Policy locked"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:g.map(e=>(0,s.jsxs)(Y,{variant:"success",children:[(0,s.jsx)(G.A,{className:"mr-1 h-3 w-3"}),e]},e))}),(0,s.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,m.length>0?(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Observed"}),(0,s.jsx)(eE,{emptyLabel:"No runtime tool calls recovered yet",items:m,emptyVariant:"muted",itemVariant:"default"})]}):null]})]}),(0,s.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-3",children:[(0,s.jsx)("p",{className:"text-[12px] leading-5 text-slate-400",children:w?.description??"No policy description available."}),(0,s.jsxs)("div",{className:"mt-3 grid gap-1.5 text-[13px] text-slate-300",children:[C.map(e=>(0,s.jsxs)("p",{children:[e.label,": ",(0,s.jsx)("span",{className:"text-white",children:e.value})]},e.label)),l.profile.outputPreference?(0,s.jsxs)("p",{children:["Output preference: ",(0,s.jsx)("span",{className:"text-white",children:l.profile.outputPreference})]}):null]})]})]})}),(0,s.jsxs)(eO,{icon:D.A,title:"Runtime posture",value:l.status,children:[(0,s.jsx)("p",{children:l.currentAction}),(0,s.jsxs)("p",{children:["Last active ",(0,N.fw)(l.lastActiveAt,n)]}),(0,s.jsx)("p",{children:l.heartbeat.enabled?`Heartbeat ${l.heartbeat.every}`:"Heartbeat disabled"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(Y,{variant:l.heartbeat.enabled?"success":"muted",children:l.heartbeat.enabled?"heartbeat on":"heartbeat off"}),"number"==typeof l.heartbeat.everyMs?(0,s.jsxs)(Y,{variant:"muted",children:[Math.round(l.heartbeat.everyMs/1e3),"s interval"]}):null]})]}),(0,s.jsx)("div",{ref:p,className:"scroll-mt-4",children:(0,s.jsxs)(eO,{icon:E.A,title:"Activity history",value:String(S.length),className:(0,k.cn)("sessions"===a&&"border-sky-100/[0.18] bg-[linear-gradient(180deg,rgba(12,25,37,0.9),rgba(8,13,24,0.86))] shadow-[0_0_0_1px_rgba(125,211,252,0.05)]"),children:[(0,s.jsxs)("p",{children:[l.sessionCount," recorded sessions overall."]}),(0,s.jsx)("p",{children:S.length>0?`${S.length} history item${1===S.length?"":"s"} recovered from the latest agent activity.`:"No linked runtime records were recovered for this agent in the current snapshot."}),l.sessionCount>S.length?(0,s.jsxs)("p",{className:"text-[12px] text-slate-500",children:[l.sessionCount-S.length," session",l.sessionCount-S.length==1?"":"s"," do not have recovered runtime data yet."]}):null,S.length>0?(0,s.jsx)("div",{className:"space-y-2.5 pt-1",children:S.map(e=>{var t,a;let r=A===e.id,i=function(e){switch(e){case"session":return"Direct chat";case"turn":return"Conversation";case"cron":return"Scheduled";default:return"Unknown source"}}(e.source),l=function(e){if(e.taskId)return"Task";switch(e.source){case"session":return"Chat";case"turn":return"Run";case"cron":return"Scheduled";default:return"Activity"}}(e),o=e.sessionId?`session ${(0,N.m_)(e.sessionId,10)}`:e.runId?`run ${(0,N.m_)(e.runId,10)}`:"session n/a",d="number"!=typeof(t=e.tokenUsage?.total)||Number.isNaN(t)?"0 Tokens":t>=1e3?`${Math.round(t/1e3)}K Tokens`:`${t} Tokens`,c="number"!=typeof(a=e.updatedAt)||Number.isNaN(a)?"No time":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(a));return(0,s.jsxs)("div",{className:(0,k.cn)("overflow-hidden rounded-[14px] border bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] transition-all",r?"border-sky-100/[0.16] shadow-[0_0_0_1px_rgba(125,211,252,0.05)]":"border-white/[0.08]"),children:[(0,s.jsxs)("button",{type:"button","aria-expanded":r,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:()=>{I(t=>t===e.id?null:e.id)},onPointerDown:e=>e.stopPropagation(),children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,s.jsx)(Y,{variant:(0,N.Uu)(e.status),children:e.status}),(0,s.jsx)(Y,{variant:e.tokenUsage?.total?"default":"muted",children:d})]}),(0,s.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,s.jsx)("p",{className:"line-clamp-2 text-[13px] leading-5 text-white",children:e.title}),(0,s.jsx)("p",{className:"line-clamp-2 text-[12px] leading-5 text-slate-300",children:e.subtitle})]}),(0,s.jsxs)("div",{className:"flex items-end justify-between gap-3",children:[(0,s.jsx)("div",{className:"min-w-0",children:(0,s.jsxs)("p",{className:"truncate text-[9px] uppercase tracking-[0.18em] text-slate-500",children:[l," \xb7 ",o]})}),(0,s.jsx)("p",{className:"shrink-0 text-right text-[9px] uppercase tracking-[0.18em] text-slate-500",children:c})]})]}),(0,s.jsx)(b.N,{initial:!1,children:r?(0,s.jsx)(f.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,s.jsxs)("div",{className:"space-y-3 px-3 py-3",children:[(0,s.jsx)(e$,{items:[{label:"Source",value:i},{label:"Status",value:e.status},{label:"Updated",value:(0,N.fw)(e.updatedAt,n)},{label:"Key",value:(0,N.m_)(e.key,12)}]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[e.sessionId?(0,s.jsxs)(Y,{variant:"muted",children:["session ",(0,N.m_)(e.sessionId,12)]}):null,e.runId?(0,s.jsxs)(Y,{variant:"muted",children:["run ",(0,N.m_)(e.runId,12)]}):null,e.taskId?(0,s.jsxs)(Y,{variant:"muted",children:["task ",(0,N.m_)(e.taskId,12)]}):null,e.modelId?(0,s.jsxs)(Y,{variant:"muted",children:["model ",(0,N.m_)(e.modelId,12)]}):null]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Preview"}),(0,s.jsx)("div",{className:"rounded-[12px] border border-white/[0.08] bg-white/[0.03] px-3 py-2",children:(0,s.jsx)("p",{className:"text-[12px] leading-5 text-slate-200",children:e.subtitle})})]}),e.toolNames?.length?(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Tools"}),(0,s.jsx)(eE,{emptyLabel:"No tool names recorded",items:e.toolNames,emptyVariant:"muted",itemVariant:"warning"})]}):null]})}):null})]},e.id)})}):null]})}),(0,s.jsx)(eO,{icon:L.A,title:"Created files",value:String(T.length),children:(0,s.jsx)(eR,{files:T,basePath:l.workspacePath,emptyLabel:"No file artifacts have been detected for this agent yet."})}),(0,s.jsxs)(eO,{icon:U.A,title:"Capabilities",value:`${l.skills.length} skills`,children:[(0,s.jsx)(eE,{emptyLabel:"No explicit skills",items:l.skills,emptyVariant:"muted",itemVariant:"muted"}),(0,s.jsxs)("div",{className:"pt-1",children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Declared tools"}),(0,s.jsx)(eE,{emptyLabel:"No explicit tools configured",items:l.tools,emptyVariant:"muted",itemVariant:"warning"})]}),(0,s.jsxs)("div",{className:"pt-1",children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Observed tools"}),(0,s.jsx)(eE,{emptyLabel:"No runtime tool calls recovered yet",items:m,emptyVariant:"muted",itemVariant:"default"})]})]})]}):null}function ei({snapshot:e,task:t,taskId:a,taskDetail:r,taskDetailLoading:n,taskDetailError:i,taskDetailNotice:l,onAbortTask:o,onControlComplete:d}){var c,u,p,m,x;let h,g=e.tasks.find(e=>e.id===a)??t,b=r?.task?(c=r.task,u=g,0===Object.keys(h=Object.fromEntries(["reviewStatus","reviewAction","reviewedAt","reviewEvents"].map(e=>[e,u.metadata[e]]).filter(([,e])=>void 0!==e))).length?c:{...c,metadata:{...c.metadata,...h}}):g,f=ej(b),w=r?.runs??e.runtimes.filter(e=>t?.runtimeIds.includes(e.id)).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0)),v=eu(e,b,w),y=ep(e,b,w),j=e.agents.find(e=>e.id===b?.primaryAgentId),k=eU(r?.createdFiles??w.flatMap(e=>eL(e))),C=r?.warnings??[];if(!t)return null;let S=r?.integrity??em(t),A=eh(b),I=("string"==typeof(p=b).metadata.routedMission?p.metadata.routedMission.trim():"")||eh(p),T=(m=A,x=I,ef(m)!==ef(x)),O=eg(b),_=eb(b.metadata.sessionCount,b.sessionIds.length),R=eb(b.metadata.turnCount,w.length),$=(r?.liveFeed??[]).filter(e=>ev(e)).sort((e,t)=>Date.parse(e.timestamp)-Date.parse(t.timestamp)),M=function(e){for(let t of e)if("string"==typeof t.filePath&&"string"==typeof t.displayPath)return{path:t.filePath,displayPath:t.displayPath};return null}($);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(eO,{icon:P.A,title:"Mission",value:f?"aborted":b.status,children:[(0,s.jsx)(e_,{label:"Original prompt",text:A,basePath:v}),(0,s.jsx)(e_,{label:"Sent to OpenClaw",text:T?I:"Same as original prompt.",basePath:v,subtle:!T}),(0,s.jsx)(e_,{label:"Latest task output",text:O||"Waiting for the first OpenClaw update.",basePath:v,subtle:!O}),(0,s.jsx)(e$,{items:[{label:"Sessions",value:String(_)},{label:"Turns",value:String(R)},{label:"Runs",value:String(b.runtimeCount)},{label:"Files",value:String(b.artifactCount)},{label:"Live",value:String(b.liveRunCount)},{label:"Tools",value:String(S.toolNames.length)}]}),(0,s.jsx)(eo,{task:b,onAbortTask:o,onControlComplete:d}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[y?(0,s.jsx)(Y,{variant:"muted",children:y.name}):null,j?(0,s.jsx)(Y,{variant:"default",children:(0,N.CK)(j)}):null,b.dispatchId?(0,s.jsxs)(Y,{variant:"muted",children:["dispatch ",(0,N.m_)(b.dispatchId,8)]}):null,f?(0,s.jsx)(Y,{variant:"danger",children:"aborted"}):null]}),n&&!r?(0,s.jsx)("p",{children:"Connecting live task feed…"}):null,i?(0,s.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:i}):null,l?(0,s.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:l}):null]}),(0,s.jsx)(el,{task:b,integrity:S,basePath:v,latestEvidenceAt:([...r?.liveFeed??[]].reverse().find(e=>"assistant"===e.kind||"tool"===e.kind||"artifact"===e.kind)??null)?.timestamp??null}),(0,s.jsxs)(eO,{icon:E.A,title:"Runner logs",value:String($.length),children:[M?(0,s.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Log file"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(q.G,{text:M.displayPath,className:"text-[12.5px] leading-5 text-slate-100",filePath:M.path,displayPath:M.displayPath,basePath:v})}),(0,s.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===$.length?(0,s.jsx)("p",{children:"No meaningful dispatch runner diagnostics have been captured for this task yet."}):(0,s.jsx)("div",{className:"max-h-[300px] space-y-2 overflow-y-auto pr-1",children:$.map(e=>(0,s.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,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("div",{className:"flex min-w-0 items-center gap-2",children:(0,s.jsx)(Y,{variant:eF(e.kind,e.isError),children:e.title})}),(0,s.jsx)("span",{className:"shrink-0 text-[10px] uppercase tracking-[0.18em] text-slate-500",children:(0,N.fw)(new Date(e.timestamp).getTime())})]}),(0,s.jsx)("pre",{className:"mt-2 whitespace-pre-wrap break-words font-mono text-[11px] leading-5 text-slate-100",children:e.detail})]},e.id))})]}),(0,s.jsxs)(eO,{icon:E.A,title:"Runs",value:String(w.length),children:[0===w.length?(0,s.jsx)("p",{children:"No OpenClaw runs have been grouped into this task yet."}):null,(0,s.jsx)("div",{className:"space-y-2",children:w.map(e=>(0,s.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,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"truncate text-[13px] text-white",children:e.title}),(0,s.jsx)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:e.subtitle})]}),(0,s.jsx)(Y,{variant:(0,N.Uu)(e.status),children:e.status})]},e.id))})]}),(0,s.jsx)(eO,{icon:L.A,title:"Artifacts",value:String(k.length),children:(0,s.jsx)(eR,{files:k,basePath:v,emptyLabel:"This task has not produced a detectable file artifact yet."})}),C.length>0?(0,s.jsx)(eO,{icon:D.A,title:"Warnings",value:String(C.length),children:(0,s.jsx)(eP,{items:C,emptyLabel:"No warnings detected."})}):null]})}function el({task:e,integrity:t,basePath:a,latestEvidenceAt:r}){let n=ej(e),i=!!e.metadata.optimistic&&!n&&"stalled"!==e.status,l=t.issues.find(e=>"missing-final-response"===e.id),o=t.issues.find(e=>"partial-final-response"===e.id),d=!!(t.finalResponseText||t.outputFileCount>0||t.transcriptTurnCount>0||t.matchingTranscriptTurnCount>0||t.toolNames.length>0),c=(0,K.VL)(e,{hasLiveActivity:"running"===e.status||"queued"===e.status||e.liveRunCount>0,latestEvidenceAt:r}),u=(0,K.kg)(e),p=(0,K.UF)(e),m=c?(0,K.E2)(c):n?"This task was aborted by an operator. Captured evidence may be incomplete.":i?"OpenClaw accepted this task. Session, tool, and file evidence will appear here as soon as the first runtime reports in.":l?l.detail:o?o.detail:"verified"===t.status?"AgentOS found a matching transcript and the captured result looks internally consistent.":t.sessionMismatch?"The linked transcript belongs to a different mission or stale session, so this completion cannot be trusted yet.":t.issues.some(e=>"empty-output-dir"===e.id)?"The task is marked completed, but the expected deliverables are missing from the output folder.":"error"===t.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,s.jsxs)(eO,{icon:D.A,title:"Result integrity",value:c?(0,K.B4)(c):n?"aborted":o?"needs review":"stalled"!==e.status||t.finalResponseText?i?"pending":t.status:d?"needs review":"waiting output",children:[(0,s.jsx)("p",{children:m}),c?(0,s.jsxs)("div",{className:"rounded-[14px] border border-emerald-400/16 bg-emerald-400/[0.06] px-3 py-2.5",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-emerald-100/80",children:"Operator review"}),(0,s.jsxs)("p",{className:"mt-2 text-[12px] leading-5 text-emerald-50",children:[u||(0,K.B4)(c),p?` \xb7 ${(0,N.fw)(Date.parse(p))}`:""]})]}):null,(0,s.jsx)(e$,{items:[{label:"Output files",value:String(t.outputFileCount)},{label:"Transcript turns",value:String(t.transcriptTurnCount)},{label:"Matched turns",value:String(t.matchingTranscriptTurnCount)},{label:"Tools",value:String(t.toolNames.length)},{label:"Emails",value:String(t.emails.length)}]}),t.outputDir||t.outputDirRelative?(0,s.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Output folder"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(q.G,{text:t.outputDirRelative||t.outputDir||"Output folder",className:"text-[12.5px] leading-5 text-slate-100",filePath:t.outputDir,displayPath:t.outputDirRelative||t.outputDir,basePath:a})}),(0,s.jsx)("p",{className:"mt-2 text-[11px] text-slate-400",children:t.outputDirExists?`${t.outputFileCount} file${1===t.outputFileCount?"":"s"} detected in the folder.`:"The output folder is not currently accessible."})]}):null,(0,s.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,s.jsxs)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:["Final response ","none"!==t.finalResponseSource?`(${t.finalResponseSource})`:""]}),o?(0,s.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:o.detail}):null,(0,s.jsx)("div",{className:"mt-2",children:t.finalResponseText?(0,s.jsx)(q.G,{text:t.finalResponseText,className:"text-[12.5px] leading-5 text-slate-100",basePath:a}):(0,s.jsx)("p",{className:"text-[12.5px] leading-5 text-slate-400",children:"No final response was captured."})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Recovered tools"}),t.toolNames.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:t.toolNames.map(e=>(0,s.jsx)(Y,{variant:"muted",children:e},e))}):(0,s.jsx)("p",{children:"No tool calls were recovered from a matching transcript turn."})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Detected emails"}),t.emails.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:t.emails.map(e=>(0,s.jsx)(Y,{variant:"muted",children:e},e))}):(0,s.jsx)("p",{children:"No email addresses were detected in the captured result."})]}),t.dispatchSessionId?(0,s.jsxs)("p",{className:"font-mono text-xs text-slate-400",children:["session ",(0,N.m_)(t.dispatchSessionId,12),t.sessionMismatch?" \xb7 mismatch detected":""]}):null,t.issues.length>0?(0,s.jsxs)("div",{className:"rounded-[14px] border border-amber-400/16 bg-amber-400/[0.06] px-3 py-2.5",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-amber-100/80",children:"Review issues"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(eP,{items:t.issues.map(e=>`${e.title}: ${e.detail}`),emptyLabel:"No integrity issues detected."})})]}):null]})}function eo({task:e,onAbortTask:t,onControlComplete:a}){var r;let[n,l]=(0,i.useState)(null),[o,d]=(0,i.useState)(""),[c,u]=(0,i.useState)(null),p=eN(r=e)||r.liveRunCount>0,m=!!t&&eN(e),x=o.trim();if(!p)return null;let h=e=>{l(t=>t===e?null:e),d("")},g=async()=>{if(n&&x&&!c){u(n);try{let s=await fetch(`/api/tasks/${encodeURIComponent(e.id)}/control`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:n,message:x,dispatchId:e.dispatchId??null})}),r=await s.json().catch(()=>null);if(!s.ok){var t;throw Error(((t=r)&&"object"==typeof t?"string"==typeof t.error?t.error:"string"==typeof t.message?t.message:null:null)||"Unable to update the running task.")}z.oR.success("steer"===n?"Steer request sent.":"Context added to session."),l(null),d(""),a?.()}catch(e){z.oR.error("steer"===n?"Steer request failed.":"Context injection failed.",{description:e instanceof Error?e.message:"Unknown control error."})}finally{u(null)}}};return(0,s.jsxs)("div",{className:"rounded-[20px] border border-sky-100/[0.08] bg-[linear-gradient(180deg,rgba(8,20,34,0.72),rgba(5,13,25,0.7))] p-3 shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]",children:[(0,s.jsx)("p",{className:"mb-2.5 text-[10px] font-semibold uppercase tracking-[0.24em] text-sky-200/60",children:"Quick actions"}),(0,s.jsxs)("div",{className:"grid gap-2 sm:grid-cols-3",children:[(0,s.jsxs)(v.$,{type:"button",variant:"destructive",size:"sm",disabled:!m,className:"h-11 justify-start gap-2 rounded-[14px] border border-rose-400/25 bg-rose-500/10 px-3 text-[12px] text-rose-100 hover:bg-rose-500/16 disabled:opacity-50",onClick:()=>{m&&t?.(e)},children:[(0,s.jsx)(W.A,{className:"h-3.5 w-3.5"}),"Stop"]}),(0,s.jsxs)(v.$,{type:"button",variant:"steer"===n?"default":"secondary",size:"sm",className:(0,k.cn)("h-11 justify-start gap-2 rounded-[14px] border px-3 text-[12px]","steer"===n?"border-sky-100/[0.18] bg-sky-200/[0.12] text-sky-50 shadow-[0_0_18px_rgba(125,211,252,0.1)]":"border-sky-100/[0.08] bg-white/[0.045] text-slate-100 hover:bg-white/[0.08]"),onClick:()=>h("steer"),children:[(0,s.jsx)(F.A,{className:"h-3.5 w-3.5"}),"Steer"]}),(0,s.jsxs)(v.$,{type:"button",variant:"inject"===n?"default":"secondary",size:"sm",className:(0,k.cn)("h-11 justify-start gap-2 rounded-[14px] border px-3 text-[12px]","inject"===n?"border-sky-100/[0.18] bg-sky-200/[0.12] text-sky-50 shadow-[0_0_18px_rgba(125,211,252,0.1)]":"border-sky-100/[0.08] bg-white/[0.045] text-slate-100 hover:bg-white/[0.08]"),onClick:()=>h("inject"),children:[(0,s.jsx)(M.A,{className:"h-3.5 w-3.5"}),"Add context"]})]}),n?(0,s.jsxs)("div",{className:"mt-3 space-y-2.5",children:[(0,s.jsx)(y.T,{value:o,disabled:!!c,rows:3,maxLength:4e3,placeholder:"steer"===n?"Focus on tests":"Inject this note/reference into the running session",className:"min-h-[86px] rounded-[14px] border-sky-100/[0.08] bg-slate-950/40 px-3 py-2.5 text-[12px] leading-5 text-slate-100 placeholder:text-slate-500",onChange:e=>d(e.target.value)}),"steer"===n?(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:Z.map(e=>(0,s.jsx)("button",{type:"button",disabled:!!c,className:"rounded-full border border-sky-100/[0.08] bg-white/[0.04] px-2.5 py-1 text-[10px] text-slate-300 transition-colors hover:border-sky-100/[0.16] hover:text-slate-100 disabled:cursor-not-allowed disabled:opacity-60",onClick:()=>d(e),children:e},e))}):null,(0,s.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[(0,s.jsx)(v.$,{type:"button",variant:"ghost",size:"sm",disabled:!!c,className:"h-8 rounded-[10px] px-2.5 text-[11px]",onClick:()=>{l(null),d("")},children:"Cancel"}),(0,s.jsx)(v.$,{type:"button",variant:"default",size:"sm",disabled:!x||!!c,className:"h-8 rounded-[10px] px-2.5 text-[11px]",onClick:()=>void g(),children:c?"Sending...":"steer"===n?"Send steer":"Add context"})]})]}):null]})}function ed({task:e,basePath:t,taskDetail:a,taskDetailLoading:r,taskDetailError:n,taskDetailNotice:i,onAbortTask:l,onControlComplete:o}){if(r&&!a)return(0,s.jsxs)(eO,{icon:E.A,title:"Live feed",value:"connecting",children:[(0,s.jsx)(eo,{task:e,onAbortTask:l,onControlComplete:o}),(0,s.jsx)("p",{children:"Connecting to the task feed…"})]});if(n&&!a)return(0,s.jsxs)(eO,{icon:E.A,title:"Live feed",value:"error",children:[(0,s.jsx)(eo,{task:e,onAbortTask:l,onControlComplete:o}),(0,s.jsx)("p",{children:n})]});let d=(function(...e){let t=new Map;for(let a of e.flat())t.set(a.id,a);return[...t.values()].sort((e,t)=>Date.parse(e.timestamp)-Date.parse(t.timestamp))})(a?.liveFeed??[],ex(e.metadata.reviewEvents)).filter(e=>!ev(e)),c=a?.integrity??em(e);return(0,s.jsxs)(eO,{icon:E.A,title:"Live feed",value:String(d.length),children:[(0,s.jsx)(eo,{task:a?.task??e,onAbortTask:l,onControlComplete:o}),n?(0,s.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:n}):null,i?(0,s.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:i}):null,c.issues.length>0?(0,s.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:c.issues[0]?.detail}):null,0===d.length?(0,s.jsx)("p",{children:"No streamed task events have arrived yet."}):null,(0,s.jsx)("div",{className:"space-y-2",children:d.map(e=>(0,s.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,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,s.jsx)(Y,{variant:eF(e.kind,e.isError),children:e.kind}),(0,s.jsx)("p",{className:"truncate text-[12px] text-white",children:e.title})]}),(0,s.jsx)("span",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:(0,N.fw)(new Date(e.timestamp).getTime())})]}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(q.G,{text:e.detail,className:"text-[12.5px] leading-5 text-slate-100",url:e.url,filePath:e.filePath,displayPath:e.displayPath,basePath:t})})]},e.id))})]})}function ec({snapshot:e,task:t,taskDetail:a}){let r=a?.runs??e.runtimes.filter(e=>t.runtimeIds.includes(e.id)).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0)),n=eU(a?.createdFiles??r.flatMap(e=>eL(e))),i=a?.integrity??em(t),l=eu(e,t,r);return(0,s.jsxs)(eO,{icon:L.A,title:"Files",value:String(n.length),children:[(0,s.jsxs)("p",{children:[r.length," run",1===r.length?"":"s"," contributed to this task."]}),i.outputDir||i.outputDirRelative?(0,s.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Output folder"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(q.G,{text:i.outputDirRelative||i.outputDir||"Output folder",className:"text-[12.5px] leading-5 text-slate-100",filePath:i.outputDir,displayPath:i.outputDirRelative||i.outputDir,basePath:l})}),(0,s.jsx)("p",{className:"mt-2 text-[11px] text-slate-400",children:i.outputDirExists?`${i.outputFileCount} file${1===i.outputFileCount?"":"s"} detected in the folder.`:"The output folder is not currently accessible."})]}):null,(0,s.jsx)(eR,{files:n,basePath:l,emptyLabel:"This task has not produced a detectable file artifact yet."})]})}function eu(e,t,a=[]){return ep(e,t,a)?.path??function(e,t,a=[]){for(let s of[t.primaryAgentId,...a.map(e=>e.agentId)].filter(e=>"string"==typeof e&&e.trim().length>0)){let t=e.agents.find(e=>e.id===s)?.workspacePath;if(t)return t}}(e,t,a)}function ep(e,t,a=[]){for(let s of[t.workspaceId,...a.map(e=>e.workspaceId),t.primaryAgentId?e.agents.find(e=>e.id===t.primaryAgentId)?.workspaceId:void 0,...a.map(t=>t.agentId?e.agents.find(e=>e.id===t.agentId)?.workspaceId:void 0)].filter(e=>"string"==typeof e&&e.trim().length>0)){let t=e.workspaces.find(e=>e.id===s);if(t)return t}return null}function em(e){var t,a;let s,r,n,i=!!e.metadata.optimistic&&!ej(e)&&"stalled"!==e.status,l=(s="string"==typeof(t=e).metadata.finalResponseText?t.metadata.finalResponseText.trim():"",r="string"==typeof t.metadata.resultPreview?t.metadata.resultPreview.trim():"",!!((n=s||r)&&!(ey(a=n)||/waiting for (the first )?(transcript|output)/i.test(a)||/working silently/i.test(a)))),o=ej(e)?[{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"===e.status?[{id:l?"partial-final-response":"stalled-dispatch",severity:"warning",title:l?"Final response came from an incomplete runtime":"Waiting for output evidence",detail:l?"The assistant produced output, but the runtime stalled before the task completed. Treat this as the last captured response, not a verified completion.":ey(e.subtitle)?"AgentOS is still waiting for the first transcript entry from this runtime.":e.subtitle}]:[];return{status:o.some(e=>"error"===e.severity)?"error":i||o.length>0?"warning":"verified",outputDir:"string"==typeof e.metadata.outputDir&&e.metadata.outputDir.trim().length>0?e.metadata.outputDir:null,outputDirRelative:"string"==typeof e.metadata.outputDirRelative&&e.metadata.outputDirRelative.trim().length>0?e.metadata.outputDirRelative:null,outputDirExists:!1,outputFileCount:0,transcriptTurnCount:0,matchingTranscriptTurnCount:0,finalResponseText:l?eg(e):null,finalResponseSource:"none",dispatchSessionId:null,sessionMismatch:!1,toolNames:[],emails:[],issues:o}}function ex(e){return Array.isArray(e)?e.filter(ew):[]}function eh(e){return e.mission?.trim()||e.title.trim()||"Untitled task"}function eg(e){return("string"==typeof e.metadata.resultPreview?e.metadata.resultPreview.trim():"")||e.subtitle.trim()||""}function eb(e,t){return"number"==typeof e&&Number.isFinite(e)?e:t}function ef(e){return e.replace(/\s+/g," ").trim()}function ew(e){return"object"==typeof e&&null!==e&&"string"==typeof e.id&&"string"==typeof e.kind&&"string"==typeof e.timestamp&&"string"==typeof e.title&&"string"==typeof e.detail}function ev(e){return e.id.startsWith("runner-log:")}function ey(e){return"string"==typeof e&&(/No transcript file was found for this runtime session/i.test(e)||/No transcript entries were found for this runtime/i.test(e))}function ej(e){let t="string"==typeof e.metadata.dispatchStatus?e.metadata.dispatchStatus:null,a=e.status;return"cancelled"===t||"aborted"===t||"cancelled"===a||"aborted"===a}function eN(e){if(ej(e))return!1;let t=e.status;return"running"===t||"queued"===t}function ek({snapshot:e,runtimeId:t,runtimeOutput:a,runtimeOutputLoading:r,runtimeOutputError:n}){let i=(0,N.hv)(e.generatedAt),l=e.runtimes.find(e=>e.id===t),o=eU(a?.createdFiles??(l?eL(l):[])),d=a?.warnings??(l?eD(l):[]),c=a?.warningSummary??d[0]??null,u=l?e.workspaces.find(e=>e.id===l.workspaceId)?.path:void 0;return l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(eO,{icon:E.A,title:"Runtime key",value:l.status,children:[(0,s.jsx)("p",{className:"font-mono text-xs text-slate-400",children:l.key}),(0,s.jsxs)("p",{children:["Session ",(0,N.m_)(l.sessionId,12)]}),l.taskId?(0,s.jsxs)("p",{children:["Task ",(0,N.m_)(l.taskId,12)]}):null,l.runId?(0,s.jsxs)("p",{children:["Run ",(0,N.m_)(l.runId,12)]}):null]}),(0,s.jsxs)(eO,{icon:D.A,title:"Activity",value:(0,N.fw)(l.updatedAt,i),children:[(0,s.jsx)("p",{children:l.subtitle}),(0,s.jsxs)("p",{children:[(0,N._y)(l.tokenUsage?.total)," tokens"]})]}),(0,s.jsxs)(eO,{icon:U.A,title:"Latest output",value:a?.stopReason||(r?"loading":"no transcript"),children:[r?(0,s.jsx)("p",{children:"Loading transcript output…"}):null,n?(0,s.jsx)("p",{children:n}):null,r||n?null:(0,s.jsx)(q.G,{text:a?.finalText||a?.errorMessage||"No assistant output has been recorded for this runtime yet.",className:"text-[13px] leading-5 text-slate-100",basePath:u}),c?(0,s.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: ",c]}):null,a?.finalTimestamp?(0,s.jsxs)("p",{className:"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:["Updated ",(0,N.fw)(new Date(a.finalTimestamp).getTime())]}):null]}),(0,s.jsx)(eO,{icon:L.A,title:"Created files",value:String(o.length),children:(0,s.jsx)(eR,{files:o,basePath:e.workspaces.find(e=>e.id===l.workspaceId)?.path,emptyLabel:"This runtime has not produced a detectable file artifact."})})]}):null}function eC({runtime:e,runtimeOutput:t}){let a=eU(t?.createdFiles??eL(e));return(0,s.jsxs)(eO,{icon:L.A,title:"Files",value:String(a.length),children:[(0,s.jsx)("p",{children:e.title}),(0,s.jsx)(eR,{files:a,emptyLabel:"This runtime has not produced a detectable file artifact."})]})}function eS({runtime:e,basePath:t,runtimeOutput:a,runtimeOutputLoading:r,runtimeOutputError:n}){if(r)return(0,s.jsx)(eO,{icon:E.A,title:"Runtime output",value:"loading",children:(0,s.jsxs)("p",{children:["Loading transcript output for ",e.title,"…"]})});if(n)return(0,s.jsx)(eO,{icon:E.A,title:"Runtime output",value:"error",children:(0,s.jsx)("p",{children:n})});if(!a)return(0,s.jsx)(eO,{icon:E.A,title:"Runtime output",value:"missing",children:(0,s.jsx)("p",{children:"No transcript data is available for this runtime."})});let i=eU(a.createdFiles);return(0,s.jsxs)("div",{className:"space-y-3.5",children:[a.warningSummary?(0,s.jsx)(eO,{icon:D.A,title:"Warnings",value:String(a.warnings.length),children:(0,s.jsx)("p",{children:a.warningSummary})}):null,(0,s.jsx)(eO,{icon:L.A,title:"Created files",value:String(i.length),children:(0,s.jsx)(eR,{files:i,basePath:t,emptyLabel:"This runtime transcript does not include a successful file creation."})}),(0,s.jsxs)(eO,{icon:E.A,title:"Final response",value:"stalled"===e.status||"cancelled"===e.status?"stalled"===e.status?"stalled":e.status:a.stopReason||a.status,children:["stalled"===e.status||"cancelled"===e.status?(0,s.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"===e.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,a.errorMessage&&!ey(a.errorMessage)?(0,s.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:a.errorMessage}):null,(0,s.jsx)(q.G,{text:a.finalText||(a.errorMessage&&!ey(a.errorMessage)?a.errorMessage:"Waiting for the first assistant output from this runtime."),className:"text-[13px] leading-5 text-slate-100",basePath:t}),a.finalTimestamp?(0,s.jsx)("p",{className:"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:new Date(a.finalTimestamp).toLocaleString()}):null]}),(0,s.jsxs)(eO,{icon:D.A,title:"Transcript trail",value:String(a.items.length),children:[0===a.items.length?(0,s.jsx)("p",{children:"Waiting for the first transcript entry."}):null,(0,s.jsx)("div",{className:"space-y-2",children:a.items.map(e=>(0,s.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,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(Y,{variant:"assistant"===e.role?e.isError?"danger":"default":"toolResult"===e.role?"warning":"muted",children:e.role}),e.toolName?(0,s.jsx)(Y,{variant:"muted",children:e.toolName}):null]}),(0,s.jsx)("span",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:(0,N.fw)(new Date(e.timestamp).getTime())})]}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(q.G,{text:e.text,className:"text-[12.5px] leading-5 text-slate-100",basePath:t})})]},e.id))})]})]})}function eA({snapshot:e,modelId:t}){let a=e.models.find(e=>e.id===t);return a?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(eO,{icon:U.A,title:"Model routing",value:a.provider,children:[(0,s.jsx)("p",{children:a.name}),(0,s.jsx)("p",{children:a.local?"Local model":"Remote model"})]}),(0,s.jsxs)(eO,{icon:D.A,title:"Capacity",value:`${(0,N.FO)(a.contextWindow)} ctx`,children:[(0,s.jsx)("p",{children:a.input}),(0,s.jsx)("p",{children:!1===a.available?"Unavailable":"Available"}),(0,s.jsxs)("p",{children:[a.usageCount," attached agents"]})]})]}):null}function eI({icon:e,label:t,active:a,surfaceTheme:r,panelCollapsed:n,tooltipSide:i,disabled:l=!1,onClick:o}){return(0,s.jsx)(J.A,{label:t,side:i,surfaceTheme:r,panelCollapsed:n,children:(0,s.jsx)("button",{type:"button","aria-label":t,"aria-disabled":l,tabIndex:l?-1:0,onClick:o,className:(0,k.cn)("inline-flex h-10 w-10 items-center justify-center rounded-[13px] border shadow-[inset_0_1px_0_rgba(255,255,255,0.04)] transition-all",l?"border-white/[0.05] bg-white/[0.02] text-slate-600":a?"border-sky-100/[0.2] bg-sky-200/[0.1] text-sky-100 shadow-[0_0_18px_rgba(125,211,252,0.12),inset_0_1px_0_rgba(255,255,255,0.08)]":"border-white/[0.09] bg-white/[0.03] text-slate-500 hover:border-sky-100/[0.14] hover:bg-white/[0.055] hover:text-slate-100"),children:(0,s.jsx)(e,{className:"h-3.5 w-3.5"})})})}function eT({label:e,active:t,onClick:a}){return(0,s.jsx)("button",{type:"button",onClick:a,className:(0,k.cn)("inline-flex min-w-[86px] flex-1 items-center justify-center rounded-[14px] border px-3 py-2.5 text-[11px] whitespace-nowrap transition-all",t?"border-transparent bg-transparent text-sky-100 shadow-[inset_0_-2px_0_rgba(125,211,252,0.62)]":"border-transparent bg-transparent text-slate-400 hover:bg-white/[0.035] hover:text-slate-100"),children:e})}function eO({icon:e,title:t,value:a,actions:r,children:n,className:i}){return(0,s.jsxs)("section",{className:(0,k.cn)("rounded-[22px] border border-sky-100/[0.08] bg-[linear-gradient(180deg,rgba(8,17,32,0.82),rgba(5,12,25,0.78))] p-4 shadow-[0_16px_44px_rgba(0,0,0,0.22),inset_0_1px_0_rgba(255,255,255,0.04)] transition-all",i),children:[(0,s.jsx)("div",{className:"flex items-start justify-between gap-3",children:(0,s.jsxs)("div",{className:"min-w-0 space-y-1.5",children:[(0,s.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,s.jsx)(e,{className:"h-3.5 w-3.5 shrink-0 text-sky-200/65"}),(0,s.jsx)("p",{className:"truncate text-[10px] font-semibold uppercase tracking-[0.28em] text-slate-300/75",children:t})]}),(0,s.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,s.jsx)(Y,{variant:"muted",className:"max-w-full truncate rounded-full bg-white/[0.055] px-2.5 py-1 text-[10px] tracking-[0.16em] text-slate-100",children:a}),r?(0,s.jsx)("div",{className:"shrink-0",children:r}):null]})]})}),(0,s.jsx)("div",{className:"mt-4 space-y-3 text-[13px] leading-5 text-slate-300",children:n})]})}function e_({label:e,text:t,basePath:a,subtle:r=!1}){return(0,s.jsxs)("div",{className:"rounded-[18px] border border-sky-100/[0.08] bg-slate-950/[0.25] px-3.5 py-3 shadow-[inset_0_1px_0_rgba(255,255,255,0.035)]",children:[(0,s.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-[0.2em] text-slate-400",children:e}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(q.G,{text:t,className:(0,k.cn)("text-[12.5px] leading-5",r?"text-slate-400":"text-slate-100"),basePath:a})})]})}function eR({files:e,basePath:t,emptyLabel:a}){let r=eU(e??[]);return 0===r.length?(0,s.jsx)("p",{className:"text-[12px] text-slate-400",children:a}):(0,s.jsx)("div",{className:"space-y-2",children:r.map(e=>{var a;let r="string"==typeof(a=e.path)&&(a.startsWith("/")||/^[A-Za-z]:[\\/]/.test(a))||!!t;return(0,s.jsx)("button",{type:"button",disabled:!r,onClick:()=>void eG(e.path,t),className:(0,k.cn)("w-full rounded-[16px] border border-sky-100/[0.08] bg-[linear-gradient(180deg,rgba(9,18,34,0.74),rgba(7,14,27,0.66))] px-3 py-2.5 text-left shadow-[inset_0_1px_0_rgba(255,255,255,0.035)] transition-all",r?"hover:border-sky-100/[0.16] hover:bg-white/[0.055]":"cursor-not-allowed opacity-60"),children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"truncate font-mono text-[12px] text-sky-100/85",children:e.displayPath}),(0,s.jsx)("p",{className:"truncate text-[11px] text-slate-400",children:(0,N.$7)(e.path)})]}),(0,s.jsx)(Y,{variant:"muted",children:r?"reveal":"relative"})]})},e.path)})})}function e$({items:e}){return(0,s.jsx)("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:e.map(e=>(0,s.jsxs)("div",{className:"rounded-[18px] border border-sky-100/[0.08] bg-[linear-gradient(180deg,rgba(9,18,34,0.7),rgba(6,13,26,0.68))] px-3 py-3 shadow-[inset_0_1px_0_rgba(255,255,255,0.035)]",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:e.label}),(0,s.jsx)("p",{className:"mt-1.5 truncate font-display text-[1.05rem] leading-none text-white",children:e.value})]},e.label))})}function eM({items:e,missingVariant:t="muted"}){return(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map(e=>(0,s.jsx)(Y,{variant:e.present?"success":t,children:e.label},e.id))})}function eE({items:e,emptyLabel:t,itemVariant:a,emptyVariant:r}){return 0===e.length?(0,s.jsx)(Y,{variant:r,children:t}):(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map(e=>(0,s.jsx)(Y,{variant:a,children:e},e))})}function eP({items:e,emptyLabel:t}){return 0===e.length?(0,s.jsx)("p",{className:"text-[12px] text-slate-400",children:t}):(0,s.jsx)("div",{className:"space-y-2",children:e.map(e=>(0,s.jsx)("div",{className:"rounded-[16px] border border-sky-100/[0.08] bg-[linear-gradient(180deg,rgba(9,18,34,0.72),rgba(6,13,26,0.68))] px-3 py-2.5 shadow-[inset_0_1px_0_rgba(255,255,255,0.035)]",children:(0,s.jsx)("p",{className:"text-[12px] leading-5 text-slate-200",children:e})},e))})}function eL(e){let t=e.metadata.createdFiles;return Array.isArray(t)?t.flatMap(e=>{if(!e||"object"!=typeof e)return[];let t="path"in e&&"string"==typeof e.path?e.path:null,a="displayPath"in e&&"string"==typeof e.displayPath?e.displayPath:t;return t&&a?[{path:t,displayPath:a}]:[]}):[]}function eD(e){let t=e.metadata.warnings;return Array.isArray(t)?t.filter(e=>"string"==typeof e&&e.trim().length>0):[]}function eU(e){let t=new Set,a=[];for(let s of Array.isArray(e)?e:[]){let e="string"==typeof s?.path?s.path.trim():"",r="string"==typeof s?.displayPath&&s.displayPath.trim().length>0?s.displayPath.trim():e;!e||t.has(e)||(t.add(e),a.push({path:e,displayPath:r}))}return a}function eF(e,t){if(t)return"danger";switch(e){case"assistant":return"default";case"tool":case"warning":return"warning";case"artifact":return"success";default:return"muted"}}async function eG(e,t){try{let a=await fetch("/api/files/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,basePath:t??null})}),s=await a.json();if(!a.ok)throw Error(s.error||"Unable to reveal file.");z.oR.success("Revealed file.",{description:(0,N.$7)(e)})}catch(e){z.oR.error("Could not reveal file.",{description:e instanceof Error?e.message:"Unknown file reveal error."})}}var eW=a(33494),ez=a(15054),eV=a(64248),eq=a(3342),eJ=a(58386);function eK({snapshot:e,surfaceTheme:t,isInspectorOpen:a,taskAbortRequest:r,taskAbortRunState:n,taskAbortMessage:l,onTaskAbortOpenChange:o,onTaskAbortConfirm:d,updateDialogOpen:u,updateRunState:p,updateStatusMessage:m,updateResultMessage:x,updateLog:h,updateManualCommand:g,activeRuntimeCount:b,updateInstallSummary:f,onUpdateDialogOpenChange:w,onRunOpenClawUpdate:y}){let j="running"===p,N="success"===p||"error"===p,C=(0,eq.Ku)(p),S=(0,eq.SG)(p),[A,I]=(0,i.useState)(!1),T=(0,eJ.T)(g),O=async()=>{if(g)try{await navigator.clipboard.writeText(g),z.oR.success("Command copied.",{description:"Open Terminal and paste it."})}catch(e){z.oR.error("Could not copy command.",{description:e instanceof Error?e.message:"Clipboard access is unavailable."})}},_=async()=>{if(g&&T){I(!0);try{let e=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:g})}),t=await e.json().catch(()=>null);if(!e.ok||t?.error)throw Error(t?.error||"Unable to open Terminal.");z.oR.success("Terminal opened.",{description:"Confirm the update there, then return to AgentOS."})}catch(e){z.oR.error("Could not open Terminal.",{description:e instanceof Error?e.message:"Open Terminal manually and run the command."})}finally{I(!1)}}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eV.lG,{open:null!==r,onOpenChange:e=>{"running"!==n&&o(e)},children:(0,s.jsxs)(eV.Cf,{className:(0,k.cn)("max-w-[480px] gap-5 p-5 sm:p-6","light"===t?"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,s.jsxs)(eV.c7,{children:[(0,s.jsx)(eV.L3,{className:"light"===t?"text-[#3f2f24]":"text-white",children:"Abort task?"}),(0,s.jsx)(eV.rr,{className:"light"===t?"text-[#7e6555]":"text-slate-400",children:"This stops the current OpenClaw dispatch for the selected task. It does not delete captured evidence or files."})]}),r?(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[20px] border px-4 py-4","light"===t?"border-[#e3d4c8] bg-[#fffaf6] text-[#4f3d31]":"border-rose-400/20 bg-rose-400/10 text-rose-50"),children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.24em] text-slate-500",children:"Selected task"}),(0,s.jsx)("p",{className:"mt-2 font-display text-[1.02rem] leading-6 text-inherit",children:r.title}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-sm leading-6","light"===t?"text-[#8b7262]":"text-rose-100/80"),children:r.subtitle}),l?(0,s.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:l}):null]}):null,(0,s.jsxs)(eV.Es,{children:[(0,s.jsx)(v.$,{type:"button",variant:"secondary",disabled:"running"===n,className:"light"===t?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",onClick:()=>{"running"!==n&&o(!1)},children:"Cancel"}),(0,s.jsx)(v.$,{type:"button",variant:"destructive",disabled:!r||"running"===n,onClick:()=>{d()},children:"running"===n?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Aborting..."]}):"Abort task"})]})]})}),a?null:(0,s.jsxs)("div",{className:(0,k.cn)("pointer-events-auto absolute bottom-3 right-[74px] z-30 text-[11px] tracking-[0.04em] lg:bottom-4","light"===t?"text-[#8f7664]":"text-slate-500"),children:["Built on"," ",(0,s.jsx)("a",{href:"https://openclaw.ai/",target:"_blank",rel:"noreferrer",className:(0,k.cn)("transition-colors","light"===t?"text-[#6f5a4b] hover:text-[#4f3d31]":"text-slate-300 hover:text-slate-100"),children:"OpenClaw"})," ","by"," ",(0,s.jsx)("a",{href:"https://sapienx.app/",target:"_blank",rel:"noreferrer",className:(0,k.cn)("transition-colors","light"===t?"text-[#6f5a4b] hover:text-[#4f3d31]":"text-slate-300 hover:text-slate-100"),children:"SapienX"})]}),(0,s.jsx)(eV.lG,{open:u,onOpenChange:e=>{j||w(e)},children:(0,s.jsxs)(eV.Cf,{className:(0,k.cn)("max-h-[calc(100vh-48px)] max-w-[468px] gap-5 overflow-y-auto p-5 sm:p-6","light"===t?"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,s.jsxs)(eV.c7,{children:[(0,s.jsx)(eV.L3,{className:"light"===t?"text-[#3f2f24]":"text-white",children:C}),(0,s.jsx)(eV.rr,{className:"light"===t?"text-[#7e6555]":"text-slate-400",children:S})]}),N?(0,s.jsxs)("div",{className:(0,k.cn)("space-y-4","light"===t?"text-[#4f3d31]":"text-slate-200"),children:[(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[24px] border px-4 py-5",(0,eq.CP)(p,t)),children:[(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("div",{className:(0,k.cn)("flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl border",(0,eq.to)(p,t)),children:"success"===p?(0,s.jsx)(eW.A,{className:"h-5 w-5"}):(0,s.jsx)(W.A,{className:"h-5 w-5"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"font-display text-[1.05rem] leading-6",children:"success"===p?"OpenClaw is up to date":"Update needs attention"}),(0,s.jsx)("p",{className:"mt-1 text-sm leading-6",children:x||("success"===p?"The update finished successfully.":"The update did not finish cleanly.")})]})]}),(0,s.jsxs)("div",{className:"mt-4 grid gap-3 sm:grid-cols-3",children:[(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[18px] border px-3 py-3","light"===t?"border-white/70 bg-white/70":"border-white/10 bg-slate-950/30"),children:[(0,s.jsx)("p",{className:"light"===t?"text-[10px] uppercase tracking-[0.22em] text-[#8d725f]":"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Installed version"}),(0,s.jsxs)("p",{className:"mt-2 font-display text-lg text-inherit",children:["v",e.diagnostics.version||e.diagnostics.latestVersion||"unknown"]})]}),(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[18px] border px-3 py-3","light"===t?"border-white/70 bg-white/70":"border-white/10 bg-slate-950/30"),children:[(0,s.jsx)("p",{className:"light"===t?"text-[10px] uppercase tracking-[0.22em] text-[#8d725f]":"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Latest reported"}),(0,s.jsxs)("p",{className:"mt-2 font-display text-lg text-inherit",children:["v",e.diagnostics.latestVersion||e.diagnostics.version||"unknown"]})]}),(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[18px] border px-3 py-3","light"===t?"border-white/70 bg-white/70":"border-white/10 bg-slate-950/30"),children:[(0,s.jsx)("p",{className:"light"===t?"text-[10px] uppercase tracking-[0.22em] text-[#8d725f]":"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Detected install"}),(0,s.jsx)("p",{className:"mt-2 text-sm font-medium text-inherit",children:f.label}),(0,s.jsx)("p",{className:"light"===t?"mt-1 text-xs text-[#8b7262]":"mt-1 text-xs text-slate-400",children:f.detail})]})]})]}),(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[20px] border","light"===t?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,s.jsxs)("div",{className:(0,k.cn)("flex items-center justify-between border-b px-4 py-3","light"===t?"border-[#eadccf]":"border-white/8"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[10px] uppercase tracking-[0.24em]","light"===t?"text-[#9a7f6c]":"text-slate-500"),children:"Update log"}),(0,s.jsx)("span",{className:"light"===t?"text-xs text-[#8b7262]":"text-xs text-slate-400",children:"success"===p?"Completed":"Failed"})]}),(0,s.jsx)("pre",{className:(0,k.cn)("max-h-[180px] overflow-auto whitespace-pre-wrap break-words px-4 py-3 font-mono text-[11px] leading-5","light"===t?"text-[#4f3d31]":"text-slate-200"),children:h||"No command output was captured."})]}),g?(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[20px] border px-4 py-3","light"===t?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[10px] uppercase tracking-[0.24em]","light"===t?"text-[#9a7f6c]":"text-slate-500"),children:T?"Terminal":"Manual"}),T?(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-sm leading-6","light"===t?"text-[#705b4d]":"text-slate-400"),children:"Open Terminal and run this command to confirm the update."}):null,(0,s.jsx)("p",{className:(0,k.cn)("mt-2 break-all font-mono text-[11px] leading-5","light"===t?"text-[#4f3d31]":"text-slate-200"),children:g}),(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,s.jsxs)(v.$,{type:"button",variant:"secondary",size:"sm",onClick:()=>{O()},className:"light"===t?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",children:[(0,s.jsx)(ez.A,{className:"mr-1.5 h-3 w-3"}),"Copy command"]}),T?(0,s.jsx)(v.$,{type:"button",variant:"secondary",size:"sm",onClick:()=>{_()},disabled:A,className:"light"===t?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",children:A?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(E.A,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}):null]})]}):null]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:(0,k.cn)("grid gap-3 sm:grid-cols-2","light"===t?"text-[#4f3d31]":"text-slate-200"),children:[(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[20px] border px-4 py-4","light"===t?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[10px] uppercase tracking-[0.24em]","light"===t?"text-[#9a7f6c]":"text-slate-500"),children:"Version target"}),(0,s.jsxs)("p",{className:"mt-2 font-display text-[1.1rem] leading-6 text-inherit",children:["v",e.diagnostics.latestVersion||e.diagnostics.version||"unknown"]}),(0,s.jsxs)("p",{className:"light"===t?"mt-1 text-xs text-[#8b7262]":"mt-1 text-xs text-slate-400",children:["Current: v",e.diagnostics.version||"unknown"]})]}),(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[20px] border px-4 py-4","light"===t?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[10px] uppercase tracking-[0.24em]","light"===t?"text-[#9a7f6c]":"text-slate-500"),children:"Detected install"}),(0,s.jsx)("p",{className:"mt-2 text-sm font-medium leading-6 text-inherit",children:f.label}),(0,s.jsx)("p",{className:"light"===t?"mt-1 text-xs text-[#8b7262]":"mt-1 text-xs text-slate-400",children:f.detail})]})]}),(0,s.jsx)("div",{className:(0,k.cn)("rounded-[20px] border px-4 py-3 text-sm",b>0?"light"===t?"border-rose-300/80 bg-rose-50 text-rose-800":"border-rose-300/25 bg-rose-300/10 text-rose-100":"light"===t?"border-[#e3d4c8] bg-[#fffaf6] text-[#745e4f]":"border-white/8 bg-white/[0.03] text-slate-300"),children:b>0?`${b} running or queued runtime${1===b?"":"s"} may be interrupted during the update.`:"No running runtimes are currently tracked, so the update risk is lower."}),j?(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[20px] border","light"===t?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,s.jsxs)("div",{className:(0,k.cn)("flex items-center gap-3 border-b px-4 py-3","light"===t?"border-[#eadccf]":"border-white/8"),children:[(0,s.jsx)("div",{className:(0,k.cn)("flex h-9 w-9 items-center justify-center rounded-2xl border","light"===t?"border-[#dcc6b6] bg-[#f4e8dd] text-[#7b6453]":"border-white/10 bg-white/[0.05] text-slate-200"),children:(0,s.jsx)(c.A,{className:"h-4 w-4 animate-spin"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"light"===t?"text-sm font-medium text-[#4a382c]":"text-sm font-medium text-white",children:"Update in progress"}),(0,s.jsx)("p",{className:"light"===t?"text-xs text-[#8b7262]":"text-xs text-slate-400",children:m||"Streaming OpenClaw output..."})]})]}),(0,s.jsx)("pre",{className:(0,k.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"===t?"text-[#4f3d31]":"text-slate-200"),children:h||"Waiting for command output..."})]}):null]}),(0,s.jsxs)(eV.Es,{children:[(0,s.jsx)(v.$,{type:"button",variant:"secondary",onClick:()=>{w(!1)},className:"light"===t?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",children:j?"Run in background":N?"Done":"Cancel"}),N?null:(0,s.jsx)(v.$,{type:"button",onClick:y,disabled:j,className:(0,k.cn)(e.diagnostics.updateAvailable?"bg-amber-400 text-slate-950 shadow-lg shadow-amber-400/20 hover:bg-amber-300":"","light"!==t||e.diagnostics.updateAvailable?"":"bg-[#c8946f] text-white shadow-[0_12px_28px_rgba(200,148,111,0.24)] hover:bg-[#b88461]"),children:j?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Updating..."]}):"Update now"})]})]})})]})}var eB=a(82625),eH=a(22662),eZ=a(34927),eY=a(38111),eX=a(37176),eQ=a(23169);function e0(e,t){return t?e:"system"}function e1(e,t,a,s,r,n,i,l){return"cli"===e?!l&&t.diagnostics.installed?`Installed${t.diagnostics.version?` \xb7 v${t.diagnostics.version}`:""}`:"installing-cli"===a?"Installing the CLI and local wrapper.":"detecting"===a||l||!t.diagnostics.installed?"Checking whether the CLI is already installed.":"Install the OpenClaw CLI.":"gateway"===e?!l&&t.diagnostics.loaded?"Gateway is already registered.":"installing-gateway"===a?"Registering the gateway service.":"starting-gateway"===a?"Starting the gateway service.":"detecting"===a&&s?"Checking gateway registration.":n||"verifying"===a?"Gateway is up and waiting on RPC.":!l&&t.diagnostics.rpcOk?"Gateway is running directly.":"Register the gateway service once.":i?"RPC, state, and session store are ready.":"verifying"===a?"Verifying RPC, state writes, and session store access.":"starting-gateway"===a?"Starting the gateway and waiting for RPC.":r?"Gateway is up; verify RPC and runtime state.":n?"RPC is online; final runtime checks continue.":"Start the gateway and verify RPC."}function e2(e,t){if(!e.trim())return null;let a=t.find(t=>t.id===e);return a?.name||(0,N.JZ)(e)}function e5(e,t){return e?"complete":t?"current":"pending"}function e3(e){return"light"===e?"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 e4(e){let t=e.trim().toLowerCase();return"openrouter"===t?"OpenRouter":"openai-codex"===t?"ChatGPT":"openai"===t?"OpenAI":"anthropic"===t?"Anthropic":"ollama"===t?"Ollama":"xai"===t?"xAI":"google"===t||"gemini"===t?"Gemini":"deepseek"===t?"DeepSeek":"mistral"===t?"Mistral":e.split("-").map(e=>e?e[0].toUpperCase()+e.slice(1):e).join(" ")}function e8(e){let t=e?.trim();if(!t)return null;let[a]=t.split("/",1);return a||null}function e6(e,t){let a=t?.trim()??"",s=e8(t);return s?"openai"===s&&e9(e,a)?"openai-codex":(0,eQ.a3)(s)?s:null:null}function e9(e,t){if(!(0,eX.jw)(t))return!1;let a=e.diagnostics.modelReadiness.authProviders,s=a.find(e=>"openai-codex"===e.provider),r=a.find(e=>"openai"===e.provider);return!!s?.connected||"openai-codex"===e.diagnostics.modelReadiness.preferredLoginProvider||!!(s?.canLogin&&!r?.connected)}function e7(e){let t=e.diagnostics.modelReadiness.resolvedDefaultModel||e.diagnostics.modelReadiness.defaultModel||null;if(t&&e.diagnostics.modelReadiness.defaultModelReady)return t;let a=e.diagnostics.modelReadiness.recommendedModelId||null;return a&&e.workspaces.length>0?a:null}function te(e,t){return"complete"===e?"light"===t?"border-emerald-200 bg-emerald-50/60":"border-emerald-400/20 bg-emerald-400/8":"current"===e?"light"===t?"border-[#d9c2b3] bg-white/70":"border-white/12 bg-white/[0.05]":"light"===t?"border-[#eadcd0] bg-[#fffaf6]/80":"border-white/6 bg-white/[0.02]"}function tt(e,t){return"complete"===e?"light"===t?"border-emerald-300 bg-emerald-100 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"current"===e?"light"===t?"border-[#d5b9a5] bg-[#f5ebe3] text-[#8b6d5a]":"border-white/12 bg-white/[0.06] text-white":"light"===t?"border-[#e1ccc0] bg-white text-[#9a7f6c]":"border-white/8 bg-white/[0.03] text-slate-400"}function ta(e,t){return"complete"===e?"light"===t?"bg-emerald-100 text-emerald-700":"bg-emerald-300/10 text-emerald-200":"current"===e?"light"===t?"bg-[#efe1d4] text-[#876c5a]":"bg-white/[0.06] text-slate-300":"light"===t?"bg-[#f6ece4] text-[#a08471]":"bg-white/[0.04] text-slate-500"}var ts=a(95372),tr=a(86247),tn=a(66342),ti=a(85844),tl=a(14766),to=a(17327);function td({snapshot:e,selectedModelId:t,onSelectedModelIdChange:a,onOpenAddModels:r,onSnapshotChange:l,autoDiscover:o=!0}){let[d,u]=(0,i.useState)(()=>(function(e,t){let a=e6(e,t);if(a)return a;let s=e.diagnostics.modelReadiness.authProviders.find(e=>e.connected&&(0,eQ.a3)(e.provider))?.provider;if(s)return s;let r=e.diagnostics.modelReadiness.preferredLoginProvider;if((0,eQ.a3)(r))return r;let n=e8(e.diagnostics.modelReadiness.recommendedModelId);return(0,eQ.a3)(n)?n:"openrouter"})(e,t)),[p,m]=(0,i.useState)({}),[x,h]=(0,i.useState)(!1),g=(0,i.useMemo)(()=>Object.values(p).flatMap(e=>e?.models??[]),[p]),b=(0,i.useMemo)(()=>(function(e,t,a=[]){let s=t?.trim();if(!s)return null;let r=a.find(e=>e.id===s&&(0,eQ.a3)(e.provider))?.provider;if((0,eQ.a3)(r))return r;let n=e.models.find(e=>e.id===s&&(0,eQ.a3)(e.provider))?.provider;return(0,eQ.a3)(n)?"openai"===n&&e9(e,s)?"openai-codex":n:e6(e,s)})(e,t,g),[g,t,e]);(0,i.useEffect)(()=>{b&&u(e=>e===b?e:b)},[b]),(0,i.useEffect)(()=>{R(d)},[d]);let f=(0,eQ.W2)(d),w=tu(p[d]),y=w.connection??tp(e,d),N=(0,i.useMemo)(()=>e.models.filter(e=>tm(d,e.id,e.provider)&&!1!==e.available&&!e.missing).map(t=>({id:t.id,name:t.name,provider:t.provider,input:t.input,contextWindow:t.contextWindow,local:!!t.local,available:!1!==t.available,missing:t.missing,alreadyAdded:!0,recommended:t.id===e.diagnostics.modelReadiness.recommendedModelId||t.id===e.diagnostics.modelReadiness.resolvedDefaultModel||t.id===e.diagnostics.modelReadiness.defaultModel,supportsTools:t.tags.includes("tools"),isFree:t.tags.includes("free"),tags:t.tags})),[d,e.diagnostics.modelReadiness.defaultModel,e.diagnostics.modelReadiness.recommendedModelId,e.diagnostics.modelReadiness.resolvedDefaultModel,e.models]),C=w.models.length>0?w.models:N,S=(0,i.useMemo)(()=>{let e=w.search.trim().toLowerCase();return C.slice().sort((e,t)=>{let a=Number(t.recommended)+Number(t.isFree)+Number(t.supportsTools),s=Number(e.recommended)+Number(e.isFree)+Number(e.supportsTools);return a!==s?a-s:e.name.localeCompare(t.name)}).filter(t=>!e||`${t.name} ${t.id} ${t.tags.join(" ")}`.toLowerCase().includes(e))},[C,w.search]),A=e.models.find(e=>e.id===t)?.name||S.find(e=>e.id===t)?.name||t.trim()||null,I="connecting"===w.flowState||"discovering"===w.flowState||w.statusMessage?.startsWith("Checking ")===!0&&!y.connected,T="discovering"===w.flowState?`Discovering ${f.shortLabel} models...`:"connecting"===w.flowState?w.statusMessage||`Connecting ${f.shortLabel}...`:w.statusMessage||`Checking ${f.shortLabel}...`,O=S.length>6||!!f.searchPlaceholder,_=y.connected||S.length>0||!!w.emptyState;async function R(e){let t=tu(p[e]);t.loaded&&t.connection||await P(e)}function $(e,t){m(a=>({...a,[e]:{...tu(a[e]),...t}}))}function M(e,t,a,s){$(e,{flowState:a,connection:t.connection,statusMessage:t.message,errorMessage:null,emptyState:t.emptyState??null,manualCommand:t.manualCommand??null,docsUrl:t.docsUrl??null,models:t.models,loaded:!0,...s})}async function P(e){let t=(0,tl.oZ)(e);$(e,{flowState:"idle",errorMessage:null,statusMessage:`Checking ${e4(e)}...`});try{let a=await t.getConnectionStatus(),s=a.connection.connected&&o&&!F(e);M(e,a,s?"discovering":"idle"),U(a),s&&await D(e,!0)}catch(t){$(e,{flowState:"error",errorMessage:t instanceof Error?t.message:"Provider status could not be loaded.",loaded:!0})}}async function L(e,t){let a=(0,tl.oZ)(e),s=tu(p[e]);$(e,{flowState:"connecting",errorMessage:null,statusMessage:"openai-codex"===e?t?.force?"Refreshing Codex app-server setup...":"Checking Codex app-server setup...":`Connecting ${(0,eQ.W2)(e).shortLabel}...`});try{let r=await a.connect({apiKey:s.apiKey,force:t?.force}),n=r.connection.connected&&!r.manualCommand&&!F(e);M(e,r,n?"discovering":"idle",{apiKey:""}),U(r),n&&await D(e,!0)}catch(t){$(e,{flowState:"error",errorMessage:t instanceof Error?t.message:"Provider connection failed."})}}async function D(e,t=!1){let a=(0,tl.oZ)(e),s=tu(p[e]);if(t||"discovering"!==s.flowState){$(e,{flowState:"discovering",errorMessage:null,statusMessage:"ollama"===e?"Checking the local Ollama runtime...":`Discovering ${(0,eQ.W2)(e).shortLabel} models...`});try{let t=await a.discoverModels();M(e,t,t.models.length>0?"ready":"idle",{search:s.search}),U(t)}catch(t){$(e,{flowState:"error",errorMessage:t instanceof Error?t.message:"Provider discovery failed."})}}}function U(e){e.snapshot&&l?.(e.snapshot)}function F(t){return e.models.some(e=>tm(t,e.id,e.provider)&&!1!==e.available&&!e.missing)}async function G(e){try{await navigator.clipboard.writeText(e),j.o.success("Copied.",{description:"Command copied to your clipboard."})}catch(e){j.o.error("Copy failed.",{description:e instanceof Error?e.message:"Clipboard access is not available."})}}async function W(e){if(!(0,eJ.T)(e))return void await G(e);h(!0);try{let t=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e})}),a=await t.json().catch(()=>null);if(!t.ok||a?.error)throw Error(a?.error||"Unable to open Terminal.");j.o.success("Terminal opened.",{description:"Finish auth there, then refresh this provider."})}catch(e){j.o.error("Could not open Terminal.",{description:e instanceof Error?e.message:"Open Terminal manually and run the command."})}finally{h(!1)}}return(0,s.jsxs)("div",{className:(0,k.cn)("mt-3 rounded-[16px] border px-3 py-3","border-white/8 bg-[rgba(255,255,255,0.03)]"),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("div",{className:"min-w-0",children:(0,s.jsxs)("p",{className:"whitespace-nowrap text-[8px] font-medium text-slate-500",children:["Provider first : ",eQ.y8.length," providers"]})}),(0,s.jsx)("div",{className:"flex shrink-0 flex-wrap gap-1.5",children:A?(0,s.jsx)(B.E,{variant:"default",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Selected"}):null})]}),(0,s.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:eQ.y8.map(t=>{let r=tu(p[t.id]).connection??tp(e,t.id);return(0,s.jsx)("div",{className:"w-[128px] shrink-0 snap-start sm:w-[136px]",children:(0,s.jsx)(tn.I,{descriptor:t,active:d===t.id,compact:!0,micro:!0,connected:r.connected,detail:r.detail,onClick:()=>{u(t.id),b&&b!==t.id&&a("")}})},t.id)})}),(0,s.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,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("div",{children:(0,s.jsx)("p",{className:"font-display text-[0.88rem] text-white",children:f.label})}),(0,s.jsx)(B.E,{variant:y.connected?"success":"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:y.connected?"Connected":"Not connected"})]}),w.statusMessage&&!I?(0,s.jsx)("div",{className:"mt-3 rounded-[16px] border border-white/10 bg-white/[0.04] px-3 py-2",children:(0,s.jsx)("p",{className:"text-[11px] text-slate-200",children:w.statusMessage})}):null,w.errorMessage?(0,s.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:w.errorMessage}):null,"apiKey"!==f.connectKind||y.connected||0!==S.length||I?null:(0,s.jsxs)("div",{className:"mt-4 flex flex-wrap items-end gap-3",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("label",{className:"block text-[9px] uppercase tracking-[0.16em] text-slate-500",children:"API key"}),(0,s.jsx)(ti.p,{type:"password",value:w.apiKey,onChange:e=>$(d,{apiKey:e.target.value}),placeholder:"openrouter"===d?"sk-or-v1-...":"Paste API key",className:"mt-1.5 h-8 text-[11px]"})]}),(0,s.jsx)(v.$,{type:"button",className:"h-8 rounded-full px-3 text-[10px]",disabled:"connecting"===w.flowState||!w.apiKey.trim(),onClick:()=>{L(d)},children:"connecting"===w.flowState?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Connecting..."]}):`Connect ${f.shortLabel}`})]}),"apiKey"===f.connectKind&&w.manualCommand&&!I?(0,s.jsxs)("div",{className:"mt-3 rounded-[16px] border border-cyan-300/15 bg-cyan-300/[0.07] p-3",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-[11px] font-medium text-cyan-50",children:"Finish setup in Terminal"}),(0,s.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,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(v.$,{type:"button",variant:"secondary",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",disabled:x,onClick:()=>{W(w.manualCommand||"")},children:x?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(E.A,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}),(0,s.jsxs)(v.$,{type:"button",variant:"ghost",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:()=>{G(w.manualCommand||"")},children:[(0,s.jsx)(ez.A,{className:"mr-1.5 h-3 w-3"}),"Copy command"]}),(0,s.jsxs)(v.$,{type:"button",variant:"ghost",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:()=>{P(d)},children:[(0,s.jsx)(n.A,{className:"mr-1.5 h-3 w-3"}),"I've connected it"]})]})]}),(0,s.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,s.jsx)("code",{className:"text-[10px] text-slate-200",children:w.manualCommand})})]}):null,I?(0,s.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,s.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,s.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,s.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,s.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,s.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,s.jsxs)("div",{className:"relative flex max-w-[340px] flex-col items-center",children:[(0,s.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,s.jsx)(c.A,{className:"h-8 w-8 animate-spin text-cyan-200"})}),(0,s.jsx)("p",{className:"font-display text-[1.1rem] leading-[1.2rem] tracking-[0.01em] text-white",children:T}),(0,s.jsx)("p",{className:"mt-2 max-w-[280px] text-[11px] leading-[1rem] text-slate-400",children:"discovering"===w.flowState?"Pulling the provider catalog into AgentOS.":"connecting"===w.flowState?"Preparing the provider connection.":"Checking provider status before discovery."}),(0,s.jsxs)("div",{className:"mt-4 flex gap-1.5",children:[(0,s.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-cyan-300/90"}),(0,s.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-cyan-300/60 [animation-delay:120ms]"}),(0,s.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-cyan-300/30 [animation-delay:240ms]"})]})]})]}):null,"oauth"!==f.connectKind||y.connected||0!==S.length||I?null:(0,s.jsxs)("div",{className:"mt-4 rounded-[20px] border border-white/10 bg-white/[0.03] p-3",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-display text-[0.88rem] text-white",children:"Use Codex app-server"}),(0,s.jsxs)("p",{className:"mt-1 max-w-[500px] text-[10px] leading-[0.98rem] text-slate-400",children:["OpenClaw ",to.L," uses the Codex app-server plugin for ChatGPT-backed models."]})]}),(0,s.jsx)(v.$,{type:"button",className:"h-8 rounded-full px-3 text-[10px]",disabled:"connecting"===w.flowState&&!w.manualCommand,onClick:()=>{L(d)},children:"connecting"!==w.flowState||w.manualCommand?"Connect ChatGPT":(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Connecting..."]})}),(0,s.jsx)(v.$,{type:"button",variant:"ghost",className:"h-8 rounded-full px-3 text-[10px]",disabled:"connecting"===w.flowState&&!w.manualCommand,onClick:()=>{L(d,{force:!0})},children:"Refresh app-server"})]}),w.manualCommand?(0,s.jsxs)("div",{className:"mt-3 rounded-[16px] border border-cyan-300/15 bg-cyan-300/[0.07] p-3",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-[11px] font-medium text-cyan-50",children:"Finish setup in Terminal"}),(0,s.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,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(v.$,{type:"button",variant:"secondary",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",disabled:x,onClick:()=>{W(w.manualCommand||"")},children:x?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(E.A,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}),(0,s.jsxs)(v.$,{type:"button",variant:"ghost",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:()=>{G(w.manualCommand||"")},children:[(0,s.jsx)(ez.A,{className:"mr-1.5 h-3 w-3"}),"Copy command"]}),(0,s.jsxs)(v.$,{type:"button",variant:"ghost",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:()=>{P(d)},children:[(0,s.jsx)(n.A,{className:"mr-1.5 h-3 w-3"}),"I've connected it"]})]})]}),(0,s.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,s.jsx)("code",{className:"text-[10px] text-slate-200",children:w.manualCommand})})]}):null]}),_&&!I?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"mt-4 flex flex-nowrap items-center justify-between gap-2 overflow-x-auto pb-1",children:[(0,s.jsx)("p",{className:"shrink-0 whitespace-nowrap text-[9px] uppercase tracking-[0.16em] text-slate-500",children:S.length>0?`Found ${S.length} model${1===S.length?"":"s"}`:"No models found"}),(0,s.jsxs)("div",{className:"flex shrink-0 flex-nowrap gap-1.5",children:[(0,s.jsxs)(v.$,{type:"button",variant:"secondary",size:"sm",onClick:()=>{P(d)},className:"h-6 rounded-full px-2 text-[9px]",children:[(0,s.jsx)(n.A,{className:"mr-1 h-2.5 w-2.5"}),"Refresh"]}),(0,s.jsx)(v.$,{type:"button",variant:"ghost",size:"sm",onClick:()=>r(d),className:"h-6 rounded-full px-2 text-[9px]",children:"Add Models"})]})]}),O?(0,s.jsxs)("div",{className:"relative mt-3",children:[(0,s.jsx)(tr.A,{className:"pointer-events-none absolute left-3 top-1/2 h-3 w-3 -translate-y-1/2 text-slate-500"}),(0,s.jsx)(ti.p,{value:w.search,onChange:e=>$(d,{search:e.target.value}),placeholder:f.searchPlaceholder??"Search models",className:"h-8 pl-8 text-[11px]"})]}):null,w.emptyState?(0,s.jsx)(tc,{emptyState:w.emptyState,onRefresh:()=>{P(d)}}):null,S.length>0?(0,s.jsx)("div",{className:"mt-3 max-h-[min(34vh,260px)] space-y-1 overflow-y-auto pr-1",children:S.map(e=>{let r=t===e.id;return(0,s.jsxs)("button",{type:"button",onClick:()=>{(0,eQ.a3)(e.provider)&&u(e.provider),a(e.id)},className:(0,k.cn)("flex w-full items-start justify-between gap-2 rounded-[14px] border px-2.5 py-2 text-left transition-all",r?"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,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"truncate text-[11px] font-medium text-white",children:e.name}),(0,s.jsx)("p",{className:"mt-0.5 truncate text-[9px] uppercase tracking-[0.16em] text-slate-500",children:e.id}),(0,s.jsxs)("div",{className:"mt-1 flex flex-wrap gap-1.5 text-[9px] text-slate-400",children:[(0,s.jsx)("span",{children:e.input}),e.contextWindow?(0,s.jsxs)("span",{children:[Intl.NumberFormat().format(e.contextWindow)," ctx"]}):null,e.isFree?(0,s.jsx)("span",{children:"free"}):null]})]}),(0,s.jsx)("div",{className:"shrink-0",children:r?(0,s.jsx)(B.E,{variant:"default",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Selected"}):e.recommended?(0,s.jsx)(B.E,{variant:"default",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Recommended"}):e.local?(0,s.jsx)(B.E,{variant:"success",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Local"}):(0,s.jsx)(B.E,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Remote"})})]},e.id)})}):(0,s.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,A&&!I?(0,s.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,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"text-[8px] uppercase tracking-[0.16em] text-emerald-200/75",children:"Selected model"}),(0,s.jsx)("p",{className:"truncate text-[11px] text-emerald-50",children:A})]}),(0,s.jsx)(B.E,{variant:"default",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Selected"})]}):null]})]})}function tc({emptyState:e,onRefresh:t}){return(0,s.jsxs)("div",{className:"mt-3 rounded-[18px] border border-white/10 bg-white/[0.03] p-3",children:[(0,s.jsx)("p",{className:"font-display text-[0.88rem] text-white",children:e.title}),(0,s.jsx)("p",{className:"mt-1 max-w-[520px] text-[11px] leading-[0.98rem] text-slate-400",children:e.description}),(0,s.jsx)("div",{className:"mt-3 flex flex-wrap gap-1.5",children:(0,s.jsxs)(v.$,{type:"button",variant:"secondary",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:t,children:[(0,s.jsx)(n.A,{className:"mr-1.5 h-3 w-3"}),"Refresh provider"]})})]})}function tu(e){return e||{loaded:!1,connection:null,statusMessage:null,errorMessage:null,emptyState:null,manualCommand:null,docsUrl:null,models:[],apiKey:"",search:"",flowState:"idle"}}function tp(e,t){let a=e.diagnostics.modelReadiness.authProviders.find(e=>e.provider===t),s=e.models.filter(e=>tm(t,e.id,e.provider)).length;if("ollama"===t)return{connected:s>0,detail:s>0?`${s} model${1===s?"":"s"} already visible in AgentOS.`:"Detect local models from this machine."};let r=!!a?.connected;return{connected:r,detail:r?a?.detail||(0,eQ.W2)(t).helperText:s>0?`${s} model${1===s?"":"s"} are already saved in AgentOS. Connect ${e4(t)} to use them.`:(0,eQ.W2)(t).helperText}}function tm(e,t,a){return(0,eX.Pr)(e,t,a)}function tx({steps:e,surfaceTheme:t,statusCopy:a,showDetails:r,phaseLabel:n,run:l,gatewayAuthNeedsSetup:o,onOpenGatewayAuthSettings:d}){let[u,p]=(0,i.useState)(!1);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"mt-3",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[7px] uppercase tracking-[0.18em]","light"===t?"text-[#977b69]":"text-slate-500"),children:"Step 1"}),(0,s.jsx)("h2",{className:(0,k.cn)("mt-1 text-[13px] font-medium","light"===t?"text-[#33251c]":"text-white"),children:"System setup"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-[10px] leading-[0.95rem]","light"===t?"text-[#705b4d]":"text-slate-400"),children:"Install the CLI, start the gateway, and verify RPC."})]}),(0,s.jsx)("div",{className:"mt-2.5 space-y-1.5",children:e.map((e,a)=>{let r="runtime"===e.id,n="current"===e.state&&"running"===l.runState,i="complete"===e.state?"Ready":"current"===e.state?n?"Checking":r?"Needs verification":"Pending":"Pending";return(0,s.jsxs)("div",{className:(0,k.cn)("relative flex items-center gap-1.5 overflow-hidden rounded-[12px] border px-2 py-1.5",n?"light"===t?"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)]":"",te(e.state,t)),children:[n?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(f.P.div,{"aria-hidden":"true",className:(0,k.cn)("pointer-events-none absolute inset-y-0 left-0 w-1/3 blur-[1px]","light"===t?"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%",r?"250%":"230%"]},transition:{duration:r?1.45:2.05,repeat:1/0,ease:"linear"}}),(0,s.jsx)(f.P.div,{"aria-hidden":"true",className:(0,k.cn)("pointer-events-none absolute inset-x-2 bottom-0 h-px rounded-full","light"===t?"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:r?1.2:1.65,repeat:1/0,ease:"easeInOut"}})]}):null,(0,s.jsxs)("span",{className:(0,k.cn)("relative mt-0.5 inline-flex h-5 w-5 items-center justify-center overflow-hidden rounded-full border text-[9px] font-medium",tt(e.state,t)),children:[n?(0,s.jsx)(f.P.span,{"aria-hidden":"true",className:(0,k.cn)("absolute inset-0 rounded-full border","light"===t?"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:r?1.5:1.9,repeat:1/0,ease:"easeInOut"}}):null,(0,s.jsx)("span",{className:"relative z-[1]",children:"complete"===e.state?(0,s.jsx)(eB.A,{className:"h-2.5 w-2.5"}):n?(0,s.jsx)(c.A,{className:"h-2.5 w-2.5 animate-spin"}):a+1})]}),(0,s.jsxs)("div",{className:"relative z-[1] min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[11px]","light"===t?"text-[#3e2f24]":"text-white"),children:e.label}),(0,s.jsx)("span",{className:(0,k.cn)("rounded-full px-1.5 py-0.5 text-[6px] uppercase tracking-[0.14em]",ta(e.state,t)),children:i})]}),(0,s.jsx)("p",{className:(0,k.cn)("mt-0.5 text-[8px] leading-[0.82rem]","light"===t?"text-[#8f7664]":"text-slate-500"),children:e.description})]})]},e.id)})}),(0,s.jsx)(tN,{surfaceTheme:t,statusCopy:a,showDetails:r,phaseLabel:n,detailsOpen:u,onDetailsOpenChange:p,run:l}),o?(0,s.jsx)("div",{className:(0,k.cn)("mt-2.5 rounded-[14px] border px-2.5 py-2","light"===t?"border-amber-300 bg-amber-50 text-amber-950":"border-amber-300/22 bg-amber-300/10 text-amber-100"),children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(W.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"text-[10px] font-medium",children:"Native Gateway auth needs an env credential"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-[9px] leading-[0.95rem]","light"===t?"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,s.jsx)(v.$,{type:"button",size:"sm",variant:"secondary",onClick:d,className:(0,k.cn)("mt-2",e3(t)),children:"Configure Gateway auth"})]})]})}):null]})}function th({snapshot:e,surfaceTheme:t,statusCopy:a,showDetails:r,phaseLabel:n,run:l,modelPhase:o,selectedModelId:d,modelSwitchFeedback:c,onSelectedModelIdChange:u,onClearModelSwitchFeedback:p,onOpenAddModels:m,onSnapshotChange:x}){let[h,g]=(0,i.useState)(!0),b=(0,i.useMemo)(()=>e.models.filter(e=>!1!==e.available&&!e.missing),[e.models]),f=(0,i.useMemo)(()=>e2(d,b),[b,d]),w=e.diagnostics.modelReadiness.resolvedDefaultModel||e.diagnostics.modelReadiness.defaultModel||null,v=(0,eY.X2)(e),y=tw(w,b),j=tw(d,b),N=!!(d.trim()&&d.trim()!==(w?.trim()??"")),C=(0,i.useMemo)(()=>(function({statusCopy:e,run:t,selectedModelLabel:a,phase:s}){var r;let n=`${e}
4
+ ${t.log}`.toLowerCase(),i=!!t.manualCommand||/terminal|sign-in|login|oauth|api key|provider auth/.test(n),l="verifying"===s&&(/creating a demo workspace/.test(n)||/resolving workspace settings and reserving the target directory/.test(n)||/preparing workspace folder/.test(n)||/checking input and target path/.test(n)||/reserved target directory/.test(n)||/creating a fresh workspace folder/.test(n)||/fresh workspace folder created at/.test(n)||/preparing an empty workspace scaffold/.test(n)||/generating workspace docs/.test(n)||/scaffolding workspace files/.test(n)||/workspace files and starter docs are in place/.test(n)||/workspace bootstrap is wrapping up without a kickoff mission/.test(n)||/creating the first workspace agent/.test(n)||/provisioning the first workspace agent/.test(n)||/creating agent \d+ of \d+/.test(n)||/linked to the workspace/.test(n)||/finalizing workspace bootstrap/.test(n)||/workspace bootstrap finished/.test(n)||/demo workspace is ready/.test(n));if("running"!==t.runState||i||!l)return null;let o=(r=n,/resolving workspace settings/.test(r)||/checking input and target path/.test(r)||/reserved target directory/.test(r)||/creating a demo workspace/.test(r)?1:/preparing workspace folder/.test(r)||/creating a fresh workspace folder/.test(r)||/preparing an empty workspace scaffold/.test(r)||/scaffolding workspace files/.test(r)||/fresh workspace folder created at/.test(r)||/generating workspace docs/.test(r)||/workspace files and starter docs are in place/.test(r)?2:/creating the first workspace agent/.test(r)||/provisioning the first workspace agent/.test(r)||/creating agent \d+ of \d+/.test(r)||/linked to the workspace/.test(r)?3:/finalizing workspace bootstrap/.test(r)||/workspace bootstrap is wrapping up without a kickoff mission/.test(r)||/workspace bootstrap finished/.test(r)||/demo workspace is ready/.test(r)?4:1),d=[{id:"model",label:"Default model",detail:a?`${a} 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((e,t)=>({...e,state:t<o?"done":t===o?"current":"pending"}));return{stepIndex:o,steps:d,logLines:t.log.split(/\r?\n/).map(e=>e.trim().replace(/^>\s*/,"")).filter(e=>!!e).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:a}})({statusCopy:a,run:l,selectedModelLabel:f,phase:o}),[o,l,f,a]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"mt-3",children:(0,s.jsx)("p",{className:(0,k.cn)("text-[11px] font-medium","light"===t?"text-[#33251c]":"text-white"),children:"Step 2: Model setup"})}),C?(0,s.jsx)(tk,{surfaceTheme:t,statusCopy:a,phaseLabel:n,buildScene:C}):"idle"!==c.phase?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(tb,{surfaceTheme:t,feedback:c,defaultModelLabel:tw(c.previousModelId,b),nextModelLabel:tw(c.nextModelId,b),onChangeAgain:p}),(0,s.jsx)(tN,{surfaceTheme:t,statusCopy:a,showDetails:r,phaseLabel:n,detailsOpen:h,onDetailsOpenChange:g,run:l})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(tg,{surfaceTheme:t,defaultModelLabel:y,switchTargetLabel:j,hasPendingModelSwitch:N}),(0,s.jsx)(td,{snapshot:e,selectedModelId:d,onSelectedModelIdChange:u,onOpenAddModels:m,onSnapshotChange:x,autoDiscover:!v}),(0,s.jsx)(tN,{surfaceTheme:t,statusCopy:a,showDetails:r,phaseLabel:n,detailsOpen:h,onDetailsOpenChange:g,run:l})]})]})}function tg({surfaceTheme:e,defaultModelLabel:t,switchTargetLabel:a,hasPendingModelSwitch:r}){return(0,s.jsx)("div",{className:(0,k.cn)("mt-2 rounded-[14px] border px-2.5 py-2","light"===e?"border-[#e8d8ca] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[7px] uppercase tracking-[0.16em]","light"===e?"text-[#9a7a65]":"text-slate-500"),children:"Detected default"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 truncate text-[10px]","light"===e?"text-[#3e2f24]":"text-white"),children:t??"Not set"})]}),r?(0,s.jsxs)("div",{className:"min-w-0 text-right",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[7px] uppercase tracking-[0.16em]","light"===e?"text-[#9a7a65]":"text-slate-500"),children:"Switch to"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 truncate text-[10px]","light"===e?"text-[#7a4d2d]":"text-cyan-100"),children:a})]}):null]})})}function tb({surfaceTheme:e,feedback:t,defaultModelLabel:a,nextModelLabel:r,onChangeAgain:n}){var i;let l,o="light"===e,d="saving"===t.phase,u="success"===t.phase,p="error"===t.phase,m=t.message||(u?"AgentOS will use this route for new actions.":p?"Review the log below, then try again.":"Saving the route, refreshing OpenClaw config, and updating AgentOS."),x=(l=(i=t).message??"","saving"!==i.phase?0:/updating agentos snapshot|snapshot/i.test(l)?3:/verifying selected provider|provider/i.test(l)?2:+!!/refreshing openclaw config|config/i.test(l));return(0,s.jsx)("div",{className:(0,k.cn)("mt-3 overflow-hidden rounded-[22px] border",o?"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,s.jsxs)("div",{className:"relative isolate min-h-[300px] overflow-hidden px-4 py-4 text-center",children:[(0,s.jsx)("div",{"aria-hidden":"true",className:(0,k.cn)("pointer-events-none absolute inset-0",o?"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,s.jsxs)("div",{className:"relative z-[1] flex flex-col items-center",children:[(0,s.jsxs)("div",{className:"relative flex h-20 w-20 items-center justify-center",children:[d?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(f.P.div,{"aria-hidden":"true",className:(0,k.cn)("absolute h-20 w-20 rounded-full border",o?"border-[#d1a98b]":"border-cyan-200/24"),animate:{rotate:360},transition:{duration:8,repeat:1/0,ease:"linear"}}),(0,s.jsx)(f.P.div,{"aria-hidden":"true",className:(0,k.cn)("absolute h-14 w-14 rounded-full border border-dashed",o?"border-[#c8946f]":"border-cyan-200/40"),animate:{rotate:-360},transition:{duration:6,repeat:1/0,ease:"linear"}})]}):null,(0,s.jsx)("span",{className:(0,k.cn)("relative z-[1] inline-flex h-12 w-12 items-center justify-center rounded-full border",u?o?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":p?o?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200":o?"border-[#d7b59a] bg-white text-[#9a6a48]":"border-cyan-300/20 bg-cyan-300/10 text-cyan-100"),children:u?(0,s.jsx)(eB.A,{className:"h-5 w-5"}):d?(0,s.jsx)(c.A,{className:"h-5 w-5 animate-spin"}):(0,s.jsx)(ts.A,{className:"h-5 w-5"})})]}),(0,s.jsx)("p",{className:(0,k.cn)("mt-3 text-[8px] uppercase tracking-[0.22em]",o?"text-[#94735e]":"text-cyan-200/70"),children:"Model route"}),(0,s.jsx)("h3",{className:(0,k.cn)("mt-1 text-[17px] font-medium tracking-[-0.03em]",o?"text-[#2d2118]":"text-white"),children:u?"Default model updated":p?"Default model could not be changed":"Switching default model"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 max-w-[320px] text-[10px] leading-[1rem]",o?"text-[#6d5647]":"text-slate-300"),children:m}),(0,s.jsxs)("div",{className:(0,k.cn)("mt-4 grid w-full gap-2 rounded-[16px] border px-3 py-3 text-left",o?"border-[#ead8c8] bg-white/70":"border-white/8 bg-white/[0.04]"),children:[(0,s.jsx)(tf,{label:"Previous",value:a??"Not set",surfaceTheme:e,muted:!0}),(0,s.jsx)(tf,{label:"New default",value:r??"Not selected",surfaceTheme:e})]}),d?(0,s.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((e,t)=>(0,s.jsxs)("div",{className:(0,k.cn)("flex items-center gap-2 rounded-[12px] border px-2.5 py-2",t===x?o?"border-[#c8946f] bg-[#fff5ed]":"border-cyan-300/24 bg-cyan-300/[0.07]":t<x?o?"border-emerald-200 bg-emerald-50/60":"border-emerald-300/16 bg-emerald-300/[0.05]":o?"border-[#ead8c8] bg-white/55":"border-white/8 bg-white/[0.03]"),children:[(0,s.jsx)("span",{className:(0,k.cn)("inline-flex h-4 w-4 items-center justify-center rounded-full border text-[8px]",t<x?o?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":t===x?o?"border-[#c8946f] bg-[#f8eadf] text-[#8c5d3d]":"border-cyan-300/30 bg-cyan-300/10 text-cyan-100":o?"border-[#e0cec0] bg-white text-[#9a7f6c]":"border-white/10 bg-white/[0.03] text-slate-500"),children:t<x?(0,s.jsx)(eB.A,{className:"h-2.5 w-2.5"}):t+1}),(0,s.jsx)("p",{className:(0,k.cn)("text-[10px]",o?"text-[#5f4b3e]":"text-slate-300"),children:e})]},e))}):null,d?null:(0,s.jsx)(v.$,{type:"button",variant:"secondary",size:"sm",onClick:n,className:(0,k.cn)("mt-4 h-8 rounded-full px-3 text-[10px]",e3(e)),children:"Change again"})]})]})})}function tf({label:e,value:t,surfaceTheme:a,muted:r=!1}){return(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("span",{className:(0,k.cn)("text-[7px] uppercase tracking-[0.16em]","light"===a?"text-[#9a7f6c]":"text-slate-500"),children:e}),(0,s.jsx)("span",{className:(0,k.cn)("min-w-0 truncate text-right text-[10px]",r?"light"===a?"text-[#8a7261]":"text-slate-400":"light"===a?"text-[#3e2f24]":"text-white"),children:t})]})}function tw(e,t){return e?.trim()?e2(e,t)??(0,N.JZ)(e):null}function tv({surfaceTheme:e,workspaceCount:t,agentCount:a,workspaceSetupReady:r,defaultModelLabel:n,createProgress:i,createRunState:l}){let o=t>0,d="running"===l&&!!i,c="error"===l&&!!i,u=!!i&&(d||c),p=o?r?`You already have ${t} workspace${1===t?"":"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.":d?"AgentOS Workspace is being provisioned now. The scaffold and starter agent are being built in the background.":c?"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,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:(0,k.cn)("mt-3 rounded-[16px] border px-3 py-3","light"===e?"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,s.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,s.jsx)("span",{className:(0,k.cn)("mt-0.5 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full border","light"===e?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/10 text-emerald-200"),children:(0,s.jsx)(eB.A,{className:"h-3.5 w-3.5"})}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[7px] uppercase tracking-[0.18em]","light"===e?"text-emerald-700/75":"text-emerald-200/75"),children:"Launchpad"}),(0,s.jsx)("h2",{className:(0,k.cn)("mt-1 text-[13px] font-medium","light"===e?"text-[#2d2118]":"text-white"),children:"OpenClaw is ready."}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-[10px] leading-[0.95rem]","light"===e?"text-[#5f4b3e]":"text-slate-300"),children:p})]})]}),u?null:(0,s.jsxs)("div",{className:"mt-3 grid gap-1.5 sm:grid-cols-2",children:[(0,s.jsx)(tj,{surfaceTheme:e,label:"System",value:"Online",detail:"CLI, gateway, and runtime access verified"}),(0,s.jsx)(tj,{surfaceTheme:e,label:r?"Default model":"Detected default",value:n,detail:r?"Usable model route selected":"Detected on this machine, not yet confirmed by a workspace."}),(0,s.jsx)(tj,{surfaceTheme:e,label:"Runtime",value:"Smoke test passed",detail:"A live agent turn was verified"}),(0,s.jsx)(tj,{surfaceTheme:e,label:o?"Starter agent":"Workspaces",value:o?a>0?"Visible":"Pending":String(t),detail:o?"Required before canvas handoff":"Create one to begin"})]})]}),u?(0,s.jsx)(ty,{surfaceTheme:e,progress:i,runState:l}):(0,s.jsxs)("div",{className:(0,k.cn)("mt-2.5 rounded-[12px] border px-2.5 py-2","light"===e?"border-[#e5d5c9] bg-[#fffaf6]":"border-white/8 bg-[rgba(255,255,255,0.02)]"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[7px] uppercase tracking-[0.16em]","light"===e?"text-[#977b69]":"text-slate-500"),children:"Next step"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-[11px] leading-[1rem]","light"===e?"text-[#5f4b3e]":"text-slate-300"),children:o?"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 ty({surfaceTheme:e,progress:t,runState:a}){let r="light"===e,n=t.steps.find(e=>"active"===e.status)??t.steps[0]??null,i="error"===a;return(0,s.jsxs)("div",{className:(0,k.cn)("relative mt-2.5 overflow-hidden rounded-[18px] border px-2.5 py-2.5",r?i?"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))]":i?"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,s.jsx)("div",{"aria-hidden":"true",className:(0,k.cn)("pointer-events-none absolute inset-0",r?"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%)]":i?"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,s.jsx)(f.P.div,{"aria-hidden":"true",className:(0,k.cn)("pointer-events-none absolute -left-8 top-5 h-24 w-24 rounded-full blur-3xl",r?"bg-[#efc6a8]/20":i?"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,s.jsx)(f.P.div,{"aria-hidden":"true",className:(0,k.cn)("pointer-events-none absolute -right-4 top-8 h-28 w-28 rounded-full blur-3xl",r?"bg-[#f6d9c2]/18":i?"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,s.jsxs)("div",{className:"relative z-[1] flex items-start justify-between gap-2",children:[(0,s.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[(0,s.jsx)(f.P.div,{className:(0,k.cn)("mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full border",r?i?"border-rose-300 bg-white text-rose-700":"border-[#d9b59a] bg-white text-[#8b6d5a]":i?"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:i?(0,s.jsx)(W.A,{className:"h-3.5 w-3.5"}):(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"})}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[7px] uppercase tracking-[0.18em]",r?i?"text-rose-600/75":"text-[#977b69]":i?"text-rose-200/75":"text-cyan-200/70"),children:i?"Needs attention":"Building"}),(0,s.jsx)("h3",{className:(0,k.cn)("mt-1 text-[13px] font-medium",r?i?"text-rose-950":"text-[#281d17]":i?"text-rose-50":"text-white"),children:i?"Workspace creation needs attention":t.title}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-[10px] leading-[0.95rem]",r?i?"text-rose-700":"text-[#6f5a4c]":i?"text-rose-100/80":"text-slate-300"),children:i?"Review the captured output and retry when the workspace state is clean.":t.description})]})]}),(0,s.jsxs)("div",{className:"flex shrink-0 flex-col items-end gap-1",children:[(0,s.jsx)("span",{className:(0,k.cn)("rounded-full border px-2 py-0.5 text-[8px] uppercase tracking-[0.16em]",r?i?"border-rose-200 bg-white text-rose-700":"border-[#dcc7b8] bg-white/75 text-[#8b6f5c]":i?"border-rose-300/20 bg-rose-300/8 text-rose-100":"border-cyan-300/16 bg-cyan-300/10 text-cyan-100"),children:i?"Error":`${t.percent}%`}),n?(0,s.jsx)("span",{className:(0,k.cn)("max-w-[140px] truncate rounded-full border px-2 py-0.5 text-[7px] uppercase tracking-[0.14em]",r?i?"border-rose-200 bg-white text-rose-700":"border-[#e9d7ca] bg-white text-[#8b6f5c]":i?"border-rose-300/18 bg-rose-300/8 text-rose-100":"border-white/10 bg-white/[0.04] text-slate-300"),children:n.label}):null]})]}),(0,s.jsx)("div",{className:"relative z-[1] mt-2.5 h-1.5 overflow-hidden rounded-full bg-white/8",children:(0,s.jsx)(f.P.div,{className:(0,k.cn)("h-full rounded-full transition-[width] duration-500 ease-out",r?i?"bg-rose-300/85":"bg-amber-300/85":i?"bg-rose-300/85":"bg-cyan-300/85"),style:{width:`${t.percent}%`}})}),(0,s.jsxs)("div",{className:(0,k.cn)("relative z-[1] mt-2.5 overflow-hidden rounded-[14px] border px-2.5 py-2",r?"border-[#ead8c8] bg-white/70":"border-white/8 bg-white/[0.04]"),children:[(0,s.jsx)("div",{"aria-hidden":"true",className:(0,k.cn)("absolute inset-0 opacity-60",r?"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,s.jsx)("div",{className:"relative z-[1] flex items-center gap-2",children:["Workspace","Starter agent","Canvas"].map((e,a)=>{let n=0===a?t.percent>=28:1===a?t.percent>=62:t.percent>=88,l=!i&&!n&&(0===a||1===a&&t.percent>=28||2===a&&t.percent>=62);return(0,s.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[(0,s.jsxs)("div",{className:(0,k.cn)("relative flex min-h-[52px] min-w-0 flex-1 flex-col justify-between rounded-[12px] border px-2 py-1.5",n?r?"border-emerald-200 bg-emerald-50/80":"border-emerald-300/20 bg-emerald-300/10":l?r?"border-[#d8b69b] bg-[#fff8f1]":"border-cyan-300/18 bg-cyan-300/[0.06]":r?"border-[#ead8c8] bg-white/65":"border-white/8 bg-white/[0.03]"),children:[l?(0,s.jsx)(f.P.div,{"aria-hidden":"true",className:(0,k.cn)("absolute inset-y-0 left-0 w-1/2",r?"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,s.jsx)("span",{className:(0,k.cn)("relative z-[1] inline-flex h-5 w-5 items-center justify-center rounded-full border text-[8px]",n?r?"border-emerald-300 bg-white text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":r?"border-[#dcc7b8] bg-white text-[#8b6f5c]":"border-white/10 bg-white/[0.05] text-slate-300"),children:n?(0,s.jsx)(eB.A,{className:"h-2.5 w-2.5"}):l?(0,s.jsx)(c.A,{className:"h-2.5 w-2.5 animate-spin"}):a+1}),(0,s.jsx)("span",{className:(0,k.cn)("relative z-[1] truncate text-[8px] leading-[0.9rem]",r?"text-[#5f4b3e]":"text-slate-300"),children:e})]}),a<2?(0,s.jsx)("span",{className:(0,k.cn)("hidden h-px w-4 shrink-0 sm:block",n?r?"bg-emerald-300/70":"bg-emerald-300/45":r?"bg-[#dfcabb]":"bg-white/12")}):null]},e)})})]}),(0,s.jsx)("div",{className:"relative z-[1] mt-2.5 space-y-1.5",children:t.steps.map((e,t)=>{let a="active"===e.status,n="done"===e.status?r?"border-emerald-200 bg-emerald-50/75":"border-emerald-400/20 bg-emerald-400/10":a?r?"border-[#d9bca5] bg-white":"border-cyan-300/18 bg-cyan-300/[0.05]":r?"border-[#eadccc] bg-white/70":"border-white/6 bg-white/[0.03]",l="done"===e.status?r?"border-emerald-300 bg-emerald-100 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":a?r?"border-[#d5b9a5] bg-[#f5ebe3] text-[#8b6d5a]":"border-cyan-200/20 bg-cyan-300/10 text-cyan-100":r?"border-[#e1ccc0] bg-white text-[#9a7f6c]":"border-white/8 bg-white/[0.03] text-slate-400";return(0,s.jsxs)("div",{className:(0,k.cn)("relative overflow-hidden rounded-[12px] border px-2.5 py-1.5",n),children:[a?(0,s.jsx)(f.P.div,{"aria-hidden":"true",className:(0,k.cn)("pointer-events-none absolute inset-y-0 left-0 w-1/3 blur-[1px]",r?"bg-gradient-to-r from-transparent via-[#d9b08d]/24 to-transparent":i?"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,s.jsxs)("div",{className:"relative z-[1] flex items-start gap-1.5",children:[(0,s.jsx)("span",{className:(0,k.cn)("mt-0.5 inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full border text-[9px] font-medium",l),children:"done"===e.status?(0,s.jsx)(eB.A,{className:"h-2.5 w-2.5"}):a?(0,s.jsx)(c.A,{className:"h-2.5 w-2.5 animate-spin"}):t+1}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-1",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[10px]",r?"text-[#3e2f24]":"text-white"),children:e.label}),(0,s.jsxs)("span",{className:(0,k.cn)("text-[7px] tabular-nums",r?"text-[#8f7664]":"text-slate-400"),children:[e.percent,"%"]})]}),(0,s.jsx)("p",{className:(0,k.cn)("mt-0.5 text-[8px] leading-[0.82rem]",r?"text-[#8f7664]":"text-slate-500"),children:e.detail||e.description}),(0,s.jsx)("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-white/8",children:(0,s.jsx)(f.P.div,{className:(0,k.cn)("h-full rounded-full transition-[width] duration-500 ease-out","done"===e.status?"bg-emerald-300/85":a?r?i?"bg-rose-300/85":"bg-amber-300/85":i?"bg-rose-300/85":"bg-cyan-300/85":"bg-transparent"),style:{width:`${Math.max(e.percent,10*!!a)}%`}})}),a&&e.activities.length>0?(0,s.jsx)("div",{className:"mt-1 space-y-0.5",children:e.activities.slice(-2).map(e=>(0,s.jsxs)("div",{className:(0,k.cn)("flex items-start gap-1.5 text-[8px] leading-[0.9rem]",r?"text-[#705b4d]":"text-slate-300"),children:[(0,s.jsx)("span",{className:(0,k.cn)("mt-[5px] h-1.5 w-1.5 shrink-0 rounded-full","done"===e.status&&"bg-emerald-300","active"===e.status&&"bg-cyan-300","error"===e.status&&"bg-rose-300","pending"===e.status&&(r?"bg-[#c9b4a2]":"bg-slate-500"))}),(0,s.jsx)("span",{className:"min-w-0",children:e.message})]},e.id))}):null]})]})]},e.id)})})]})}function tj({surfaceTheme:e,label:t,value:a,detail:r}){return(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[12px] border px-2.5 py-2","light"===e?"border-[#e6d7cb] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[7px] uppercase tracking-[0.16em]","light"===e?"text-[#977b69]":"text-slate-500"),children:t}),(0,s.jsx)("p",{title:a,className:(0,k.cn)("mt-1 truncate text-[10px]","light"===e?"text-[#33251c]":"text-white"),children:a}),(0,s.jsx)("p",{className:(0,k.cn)("mt-0.5 text-[8px] leading-[0.85rem]","light"===e?"text-[#8f7664]":"text-slate-500"),children:r})]})}function tN({surfaceTheme:e,statusCopy:t,showDetails:a,phaseLabel:r,detailsOpen:n,onDetailsOpenChange:l,run:o}){let[d,u]=(0,i.useState)(!1),p=(0,eJ.T)(o.manualCommand),m=async()=>{if(o.manualCommand)try{await navigator.clipboard.writeText(o.manualCommand),j.o.success("Command copied.",{description:"Open Terminal and paste it."})}catch(e){j.o.error("Could not copy command.",{description:e instanceof Error?e.message:"Clipboard access is unavailable."})}},x=async()=>{if(o.manualCommand&&p){u(!0);try{let e=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:o.manualCommand})}),t=await e.json().catch(()=>null);if(!e.ok||t?.error)throw Error(t?.error||"Unable to open Terminal.");j.o.success("Terminal opened.",{description:"Finish auth there, then refresh."})}catch(e){j.o.error("Could not open Terminal.",{description:e instanceof Error?e.message:"Open Terminal manually and run the command."})}finally{u(!1)}}};return(0,s.jsxs)("div",{className:(0,k.cn)("mt-2.5 rounded-[12px] border","light"===e?"border-[#e5d5c9] bg-[#fffaf6]":"border-white/8 bg-[rgba(255,255,255,0.02)]"),children:[(0,s.jsxs)("div",{className:"px-2.5 py-2",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[7px] uppercase tracking-[0.16em]","light"===e?"text-[#977b69]":"text-slate-500"),children:"Status"}),a?(0,s.jsx)("button",{type:"button",onClick:()=>l(!n),className:(0,k.cn)("text-[8px] uppercase tracking-[0.16em] transition-colors","light"===e?"text-[#8f7664] hover:text-[#6f5949]":"text-slate-500 hover:text-slate-300"),children:n?"Hide details":"Show details"}):null]}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-[11px] leading-[1rem]","light"===e?"text-[#5f4b3e]":"text-slate-300"),children:t})]}),a&&n?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:(0,k.cn)("flex items-center justify-between border-y px-2.5 py-1.5","light"===e?"border-[#ebddd2]":"border-white/8"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[8px] uppercase tracking-[0.16em]","light"===e?"text-[#977b69]":"text-slate-500"),children:"Log"}),(0,s.jsx)("span",{className:"light"===e?"text-[10px] text-[#8c7362]":"text-[10px] text-slate-400",children:r})]}),(0,s.jsx)("pre",{className:(0,k.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"===e?"text-[#4f3d31]":"text-slate-200"),children:o.log||"No output yet.\n\nStart the step to stream logs."}),o.manualCommand?(0,s.jsxs)("div",{className:(0,k.cn)("border-t px-2.5 py-2","light"===e?"border-[#ebddd2]":"border-white/8"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[8px] uppercase tracking-[0.16em]","light"===e?"text-[#977b69]":"text-slate-500"),children:p?"Terminal":"Manual"}),p?(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-[9px] leading-[0.95rem]","light"===e?"text-[#705b4d]":"text-slate-400"),children:"Open Terminal and run this command."}):null,(0,s.jsx)("p",{className:(0,k.cn)("mt-1 break-all font-mono text-[9px] leading-[0.92rem]","light"===e?"text-[#4f3d31]":"text-slate-200"),children:o.manualCommand}),(0,s.jsxs)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[(0,s.jsxs)(v.$,{type:"button",variant:"secondary",size:"sm",onClick:m,className:e3(e),children:[(0,s.jsx)(ez.A,{className:"mr-1.5 h-3 w-3"}),"Copy command"]}),p?(0,s.jsx)(v.$,{type:"button",variant:"secondary",size:"sm",onClick:x,disabled:d,className:e3(e),children:d?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(E.A,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}):null]}),o.docsUrl?(0,s.jsxs)("a",{href:o.docsUrl,target:"_blank",rel:"noreferrer",className:(0,k.cn)("mt-2 inline-flex items-center gap-1 text-[9px] underline underline-offset-4","light"===e?"text-[#7f6554]":"text-slate-300"),children:["Setup docs",(0,s.jsx)(eZ.A,{className:"h-2.5 w-2.5"})]}):null]}):null]}):null]})}function tk({surfaceTheme:e,statusCopy:t,phaseLabel:a,buildScene:r}){let n="light"===e;return(0,s.jsx)("div",{className:(0,k.cn)("mt-3 overflow-hidden rounded-[24px] border",n?"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,s.jsxs)("div",{className:"relative isolate min-h-[440px] overflow-hidden px-4 py-4 sm:px-5 sm:py-5",children:[(0,s.jsx)("div",{className:(0,k.cn)("pointer-events-none absolute inset-0",n?"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,s.jsx)(f.P.div,{"aria-hidden":"true",className:(0,k.cn)("pointer-events-none absolute -left-12 top-8 h-36 w-36 rounded-full blur-3xl",n?"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,s.jsx)(f.P.div,{"aria-hidden":"true",className:(0,k.cn)("pointer-events-none absolute right-0 top-24 h-44 w-44 rounded-full blur-3xl",n?"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,s.jsxs)("div",{className:"relative z-[1] flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[9px] uppercase tracking-[0.24em]",n?"text-[#8f6f5d]":"text-cyan-200/70"),children:"Building"}),(0,s.jsx)("h3",{className:(0,k.cn)("mt-1 text-[18px] font-medium tracking-[-0.03em] sm:text-[22px]",n?"text-[#231a15]":"text-white"),children:"Creating your demo workspace"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 max-w-[42rem] text-[11px] leading-[1rem] sm:text-[12px] sm:leading-[1.05rem]",n?"text-[#6f5a4c]":"text-slate-300"),children:t})]}),(0,s.jsxs)("div",{className:"flex shrink-0 flex-col items-end gap-1.5",children:[(0,s.jsx)("span",{className:(0,k.cn)("inline-flex items-center rounded-full border px-2.5 py-1 text-[8px] uppercase tracking-[0.16em]",n?"border-[#d9c3b1] bg-white/70 text-[#8b6f5c]":"border-cyan-300/18 bg-cyan-300/10 text-cyan-100"),children:a}),r.selectedModelLabel?(0,s.jsxs)("span",{className:(0,k.cn)("inline-flex max-w-[220px] truncate rounded-full border px-2.5 py-1 text-[9px]",n?"border-[#ead8c8] bg-white text-[#5a4638]":"border-white/10 bg-white/[0.04] text-slate-200"),children:["Default model: ",r.selectedModelLabel]}):null]})]}),(0,s.jsxs)("div",{className:"relative z-[1] mt-5 grid gap-4 xl:grid-cols-[minmax(0,1.2fr)_minmax(280px,0.8fr)]",children:[(0,s.jsxs)("div",{className:(0,k.cn)("relative min-h-[290px] overflow-hidden rounded-[28px] border",n?"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,s.jsx)("div",{className:(0,k.cn)("absolute inset-0 opacity-80",n?"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,s.jsx)(f.P.div,{"aria-hidden":"true",className:(0,k.cn)("absolute inset-x-0 top-0 h-px",n?"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,s.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,s.jsxs)("div",{className:"relative flex flex-col items-center text-center",children:[(0,s.jsx)(f.P.div,{className:(0,k.cn)("absolute h-56 w-56 rounded-full border",n?"border-[#d8bda5]/45":"border-cyan-200/14"),animate:{rotate:360},transition:{duration:28,repeat:1/0,ease:"linear"}}),(0,s.jsx)(f.P.div,{className:(0,k.cn)("absolute h-40 w-40 rounded-full border",n?"border-[#e2c4ad]/65":"border-cyan-200/16"),animate:{rotate:-360},transition:{duration:18,repeat:1/0,ease:"linear"}}),(0,s.jsx)(f.P.div,{className:(0,k.cn)("absolute h-24 w-24 rounded-full border",n?"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,s.jsx)("div",{className:(0,k.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)]",n?"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,s.jsx)(c.A,{className:"h-10 w-10 animate-spin"})}),(0,s.jsx)("p",{className:(0,k.cn)("mt-5 text-[9px] uppercase tracking-[0.22em]",n?"text-[#9a7d69]":"text-cyan-200/70"),children:"Workspace fabric"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-[18px] font-medium tracking-[-0.03em]",n?"text-[#281d17]":"text-white"),children:r.headline}),(0,s.jsx)("p",{className:(0,k.cn)("mt-2 max-w-[28rem] text-[11px] leading-[1rem]",n?"text-[#6a5547]":"text-slate-300"),children:r.summary}),(0,s.jsxs)("div",{className:"mt-5 flex flex-wrap items-center justify-center gap-2",children:[(0,s.jsxs)("span",{className:(0,k.cn)("inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-[9px]",n?"border-[#dec8b8] bg-white text-[#634d3d]":"border-white/10 bg-white/[0.04] text-slate-200"),children:[(0,s.jsx)("span",{className:(0,k.cn)("h-1.5 w-1.5 rounded-full",n?"bg-[#c98a5f]":"bg-cyan-300")}),"Building workspace"]}),(0,s.jsxs)("span",{className:(0,k.cn)("inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-[9px]",n?"border-[#dec8b8] bg-white text-[#634d3d]":"border-white/10 bg-white/[0.04] text-slate-200"),children:[(0,s.jsx)("span",{className:(0,k.cn)("h-1.5 w-1.5 rounded-full",n?"bg-emerald-500":"bg-emerald-300")}),"Default model locked"]})]})]})}),(0,s.jsx)("div",{className:"absolute inset-x-5 bottom-5",children:(0,s.jsx)("div",{className:(0,k.cn)("relative h-2 overflow-hidden rounded-full border",n?"border-[#dec8b8] bg-white/90":"border-white/10 bg-white/[0.04]"),children:(0,s.jsx)(f.P.div,{className:(0,k.cn)("absolute inset-y-0 left-0 w-1/3 rounded-full",n?"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,s.jsxs)("div",{className:"flex min-h-0 flex-col gap-3",children:[r.steps.map((e,t)=>(0,s.jsx)(f.P.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.35,delay:.05*t},className:(0,k.cn)("rounded-[18px] border px-3 py-2.5","current"===e.state?n?"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"===e.state?n?"border-[#e7d5c6] bg-[rgba(255,255,255,0.76)]":"border-white/10 bg-white/[0.03]":n?"border-[#eadccf] bg-[rgba(255,250,246,0.8)]":"border-white/8 bg-white/[0.02]"),children:(0,s.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,s.jsx)("div",{className:(0,k.cn)("mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full border text-[10px] font-medium","current"===e.state?n?"border-[#c78e61] bg-[#f7e6d7] text-[#6b4d39]":"border-cyan-300/28 bg-cyan-300/12 text-cyan-50":"done"===e.state?n?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/12 text-emerald-200":n?"border-[#e2d4c7] bg-white text-[#9a7f6c]":"border-white/10 bg-white/[0.03] text-slate-400"),children:"done"===e.state?(0,s.jsx)(eB.A,{className:"h-3.5 w-3.5"}):t+1}),(0,s.jsx)("div",{className:"min-w-0 flex-1",children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[11px] font-medium",n?"text-[#2b1f18]":"text-white"),children:e.label}),(0,s.jsx)("p",{className:(0,k.cn)("mt-0.5 text-[9px] leading-[0.95rem]",n?"text-[#7c6554]":"text-slate-400"),children:e.detail})]}),(0,s.jsx)("span",{className:(0,k.cn)("rounded-full px-1.5 py-0.5 text-[7px] uppercase tracking-[0.14em]","current"===e.state?n?"bg-[#f1dfd0] text-[#835f48]":"bg-cyan-300/12 text-cyan-100":"done"===e.state?n?"bg-emerald-100 text-emerald-700":"bg-emerald-300/12 text-emerald-200":n?"bg-[#f6ece3] text-[#a0826e]":"bg-white/[0.04] text-slate-500"),children:"done"===e.state?"Ready":"current"===e.state?"Building":"Queued"})]})})]})},e.id)),(0,s.jsxs)("div",{className:(0,k.cn)("mt-auto rounded-[20px] border p-3",n?"border-[#ead8c8] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[8px] uppercase tracking-[0.18em]",n?"text-[#8f6f5d]":"text-cyan-200/60"),children:"Live build feed"}),(0,s.jsx)("span",{className:(0,k.cn)("text-[9px]",n?"text-[#8a6f5e]":"text-slate-400"),children:a})]}),(0,s.jsx)("div",{className:"mt-2 space-y-1.5",children:r.logLines.length>0?r.logLines.slice(-4).map((e,t)=>(0,s.jsxs)(f.P.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.25,delay:.04*t},className:(0,k.cn)("flex items-start gap-2 rounded-[14px] border px-2.5 py-2 text-[10px] leading-[0.98rem]",t===r.logLines.length-1?n?"border-[#d8b79e] bg-[#fff7f0] text-[#5a4638]":"border-cyan-300/18 bg-cyan-300/[0.06] text-slate-100":n?"border-[#eee0d3] bg-[#fffdfb] text-[#735d4e]":"border-white/8 bg-white/[0.02] text-slate-300"),children:[(0,s.jsx)("span",{className:(0,k.cn)("mt-1 h-1.5 w-1.5 shrink-0 rounded-full",t===r.logLines.length-1?n?"bg-[#c98758]":"bg-cyan-300":n?"bg-[#e3c8b2]":"bg-slate-500")}),(0,s.jsx)("span",{className:"min-w-0",children:e})]},`${e}-${t}`)):(0,s.jsx)("div",{className:(0,k.cn)("rounded-[14px] border border-dashed px-2.5 py-3 text-[10px]",n?"border-[#e8d7c8] text-[#7e6453]":"border-white/10 text-slate-400"),children:"Waiting for the first build signal..."})})]})]})]})]})})}function tC({snapshot:e,surfaceTheme:t,stage:a,systemReady:r,modelReady:n,systemSetupRequired:i,showReadyState:l,systemActionLabel:o,systemActionDescription:d,systemPhase:u,modelPhase:p,systemRun:m,modelRun:h,modelSwitchFeedback:g,selectedModelId:b,discoveredModels:w,onSelectedModelIdChange:y,onClearModelSwitchFeedback:j,onSnapshotChange:N,onRunSystemSetup:C,onRunModelSetDefault:S,onOpenAddModels:A,onOpenGatewayAuthSettings:I,onCreateWorkspace:T,onEnterAgentOS:O,onContinueToModels:_,onBackToSystem:R,onSelectStage:$,launchpadCreateProgress:M,launchpadCreateRunState:E}){var P,L;let D=r??("success"===m.runState||(0,eY.h6)(e)),U=(0,eq.Id)(e),F=n??("success"===g.phase||l||(0,eY.X2)(e)),G=F&&(l||!U||"running"===E||"success"===E||"error"===E),W="running"===E,z=e.workspaces.length,V=e.agents.length,q=z>0,J=e.diagnostics.modelReadiness.resolvedDefaultModel||e.diagnostics.modelReadiness.defaultModel||"Ready",K=e.diagnostics.modelReadiness.resolvedDefaultModel||e.diagnostics.modelReadiness.defaultModel||null,B=[{id:"system",order:1,label:"System setup",description:"CLI, gateway, RPC",state:e5(D,"system"===a&&!D)},{id:"models",order:2,label:"Model setup",description:"Default model, auth",state:e5(F,"models"===a&&!F)}],H=function(e,t,a={}){let s=!0===a.forcePending,r=!s&&e.diagnostics.rpcOk&&!e.diagnostics.loaded,n=!s&&e.diagnostics.installed||"installing-gateway"===t||"starting-gateway"===t||"verifying"===t||"ready"===t,i=!s&&e.diagnostics.loaded||r||"starting-gateway"===t||"verifying"===t||"ready"===t,l=!s&&e.diagnostics.rpcOk||"ready"===t,o=!s&&e.diagnostics.runtime.stateWritable&&e.diagnostics.runtime.sessionStoreWritable||"ready"===t,d=l&&o;return[{id:"cli",label:"OpenClaw CLI",description:e1("cli",e,t,n,i,l,d,s),state:e5(n,!n&&("detecting"===t||"installing-cli"===t))},{id:"gateway",label:"Gateway service",description:e1("gateway",e,t,n,i,l,d,s),state:e5(i,!i&&("installing-gateway"===t||n&&"detecting"===t))},{id:"runtime",label:"Runtime ready",description:e1("runtime",e,t,n,i,l,d,s),state:e5(d,!d&&("starting-gateway"===t||"verifying"===t||i&&"detecting"===t||i||l))}]}(e,D?"ready":u,{forcePending:i}),Z=e2(b,e.models.filter(e=>!1!==e.available&&!e.missing)),Y="system"===a?m:h,X=Y.statusMessage||Y.resultMessage||("system"===a?d:Z?`Selected model: ${Z}.`:"Choose a provider, connect it, and then pick a model."),Q="system"===a?D?"ready":i?"waiting":(0,eY.iN)(e)?"ready":e.diagnostics.rpcOk?"verifying access":e.diagnostics.loaded&&!e.diagnostics.rpcOk?"verifying"===u?"connecting":"starting gateway":u?u.replace("-"," "):"waiting":(0,eY.X2)(e)?"ready":e.diagnostics.modelReadiness.ready&&"passed"!==e.diagnostics.runtime.smokeTest.status?"smoke test":p?p.replace("-"," "):"waiting",ee="idle"!==Y.runState||!!Y.manualCommand||Y.log.trim().length>0||"models"===a&&w.length>0,et=(P=Y.runState,"running"===P?"Running":F?"Ready":"success"===P?"models"===a?"Updated":"Step complete":"error"===P?"Needs attention":"system"===a?"Step 1":"Step 2"),ea=e.diagnostics.issues.some(e=>/gateway\..*auth|redacted secret|AGENTOS_OPENCLAW_GATEWAY_TOKEN|OPENCLAW_GATEWAY_TOKEN/i.test(e)),es=function(e){if("system"===e.stage)return e.systemReady&&e.modelReady?{kind:"dismiss",label:"Enter AgentOS"}:e.systemReady?{kind:"continue",label:"Continue to model setup"}:{kind:"system",label:e.systemActionLabel};let t=e.selectedModelId.trim(),a=e.defaultModelId?.trim()??"";return t?t===a?{kind:"dismiss",label:"Enter AgentOS"}:{kind:"set-default",label:"Set as default"}:e.modelReady?{kind:"dismiss",label:"Enter AgentOS"}:{kind:"select-model",label:"Select a model"}}({stage:a,systemReady:D,modelReady:F,systemActionLabel:o,selectedModelId:b,defaultModelId:K});return(0,s.jsx)(f.P.div,{initial:{opacity:0,backdropFilter:"blur(0px)"},animate:{opacity:1,backdropFilter:"blur(12px)"},exit:{opacity:0,backdropFilter:"blur(0px)"},className:(0,k.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"===t?"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,s.jsx)(f.P.div,{initial:{opacity:0,y:18,scale:.985},animate:{opacity:1,y:0,scale:1},className:(0,k.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",G&&(W||"error"===E)?"max-w-[640px]":"max-w-[420px]","light"===t?"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,s.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,s.jsxs)("div",{className:"px-2.5 py-2.5 sm:px-3 sm:py-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsxs)("span",{className:(0,k.cn)("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[8px] uppercase tracking-[0.18em]","light"===t?"border-[#d8c0b0] bg-[#f3e7dc] text-[#8d725f]":"border-white/10 bg-white/[0.06] text-slate-300"),children:[(0,s.jsx)(x.A,{className:"h-2 w-2"}),G?W?"Opening":"error"===E?"Needs attention":"Launchpad":"Welcome"]}),(0,s.jsx)("span",{className:(0,k.cn)("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.16em]",(L=Y.runState,"error"===L?"light"===t?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200":"success"===L||F?"light"===t?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"running"===L?"light"===t?"border-[#d8c0b0] bg-white/80 text-[#8d725f]":"border-white/10 bg-white/[0.04] text-slate-300":"light"===t?"border-[#d8c0b0] bg-white/80 text-[#8d725f]":"border-white/10 bg-white/[0.04] text-slate-400")),children:et})]}),(0,s.jsx)("div",{className:"mt-3",children:(0,s.jsx)("p",{className:(0,k.cn)("whitespace-nowrap text-[9px] leading-[1rem] tracking-[0.08em]","light"===t?"text-[#33251c]":"text-slate-100"),children:G?W?"AGENTOS : Opening your first workspace.":"error"===E?"AGENTOS : Workspace setup needs attention.":U?"AGENTOS : OpenClaw is ready. Choose your first action below.":q?"AGENTOS : Syncing the first workspace agent.":"AGENTOS : OpenClaw is ready. Create the first workspace below.":"AGENTOS : Bring your local OpenClaw online."})}),(0,s.jsx)("div",{className:"mt-3 grid gap-1.5 sm:grid-cols-2",children:B.map(e=>(0,s.jsx)("button",{type:"button",onClick:()=>$(e.id),className:(0,k.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"===t?"focus-visible:ring-[#c8946f] focus-visible:ring-offset-[#fff7f1]":"focus-visible:ring-white/70 focus-visible:ring-offset-[#060a12]",te(e.state,t)),"aria-pressed":a===e.id,children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:(0,k.cn)("inline-flex h-5 w-5 items-center justify-center rounded-full border text-[9px] font-medium",tt(e.state,t)),children:"complete"===e.state?(0,s.jsx)(eB.A,{className:"h-2.5 w-2.5"}):e.order}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[11px]","light"===t?"text-[#3e2f24]":"text-white"),children:e.label}),(0,s.jsx)("p",{className:(0,k.cn)("mt-0.5 text-[8px] leading-[0.85rem]","light"===t?"text-[#8f7664]":"text-slate-500"),children:e.description})]})]}),(0,s.jsx)("span",{className:(0,k.cn)("rounded-full px-1.5 py-0.5 text-[6px] uppercase tracking-[0.14em]",ta(e.state,t)),children:"complete"===e.state?"Ready":"current"===e.state?"Active":"Pending"})]})},e.id))})]}),(0,s.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:G?(0,s.jsx)(tv,{surfaceTheme:t,workspaceCount:z,agentCount:V,workspaceSetupReady:U,defaultModelLabel:J,createProgress:M,createRunState:E}):"system"===a?(0,s.jsx)(tx,{steps:H,surfaceTheme:t,statusCopy:X,showDetails:ee,phaseLabel:Q,run:Y,gatewayAuthNeedsSetup:ea,onOpenGatewayAuthSettings:I}):(0,s.jsx)(th,{snapshot:e,surfaceTheme:t,statusCopy:X,showDetails:ee,phaseLabel:Q,run:Y,modelPhase:p,selectedModelId:b,modelSwitchFeedback:g,onSelectedModelIdChange:y,onClearModelSwitchFeedback:j,onOpenAddModels:A,onSnapshotChange:N})}),(0,s.jsxs)("div",{className:(0,k.cn)("mt-auto flex flex-wrap items-center justify-between gap-1.5 border-t px-2.5 py-2 sm:px-3","light"===t?"border-[#ebddd2]":"border-white/8"),children:[(0,s.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:G?(0,s.jsx)("span",{className:(0,k.cn)("rounded-full border px-2 py-0.5 text-[8px] uppercase tracking-[0.16em]","light"===t?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/10 text-emerald-200"),children:q?U?"Setup complete":"error"===E?"Needs attention":"Syncing agent":"running"===E?"Building workspace":"error"===E?"Needs attention":"Ready"}):"models"===a?(0,s.jsxs)(v.$,{type:"button",variant:"ghost",size:"sm",onClick:R,disabled:"running"===Y.runState,className:"light"===t?"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,s.jsx)(eH.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Back"]}):null}),(0,s.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:G?(0,s.jsx)(s.Fragment,{children:U?(0,s.jsxs)(v.$,{type:"button",onClick:O,className:(0,k.cn)("h-8 min-w-[156px] rounded-full px-3 text-[11px]","light"===t?"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,s.jsx)(eZ.A,{className:"ml-1.5 h-3 w-3"})]}):W?(0,s.jsxs)("span",{className:(0,k.cn)("inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-[9px] uppercase tracking-[0.16em]","light"===t?"border-[#d8c0b0] bg-white/85 text-[#8d725f]":"border-white/10 bg-white/[0.06] text-slate-300"),children:[(0,s.jsx)(c.A,{className:"h-3 w-3 animate-spin"}),"Building workspace"]}):(0,s.jsxs)(v.$,{type:"button",onClick:T,className:(0,k.cn)("h-8 min-w-[156px] rounded-full px-3 text-[11px]","light"===t?"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"===E?"Retry setup":"Create Workspace",(0,s.jsx)(eZ.A,{className:"ml-1.5 h-3 w-3"})]})}):(0,s.jsxs)(s.Fragment,{children:["models"!==a||F?null:(0,s.jsx)(v.$,{type:"button",variant:"secondary",size:"sm",onClick:()=>A(),className:e3(t),children:"Open full Add Models"}),(0,s.jsx)(v.$,{type:"button",onClick:()=>{"system"===a?"dismiss"===es.kind?O():D?_():C():"dismiss"===es.kind?O():"set-default"===es.kind&&S(b||void 0)},disabled:"running"===Y.runState||"select-model"===es.kind,className:(0,k.cn)("h-8 min-w-[156px] rounded-full px-3 text-[11px]","light"===t?"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"===Y.runState?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Working..."]}):(0,s.jsxs)(s.Fragment,{children:[es.label,(0,s.jsx)(eZ.A,{className:"ml-1.5 h-3 w-3"})]})})]})})]})]})})})}var tS=a(62820),tA=a(77262),tI=a(75084),tT=a(95506);function tO({open:e,target:t,surfaceTheme:a,previewState:r,preview:n,previewError:i,runState:l,statusMessage:o,resultMessage:d,backgroundLogPath:u,log:p,confirmText:m,onConfirmTextChange:x,onRefreshPreview:h,onExecute:g,onBackToSetup:b,onOpenChange:f}){let w="full-uninstall"===t?"FULL UNINSTALL":"RESET MISSION CONTROL",y="running"===l,j="success"===l||"error"===l,N=null!==t&&"ready"===r&&!y&&!j&&m.trim()===w,C="full-uninstall"===t?"Full Uninstall":"Reset AgentOS",S="light"===a?"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,s.jsx)(eV.lG,{open:e,onOpenChange:e=>{(e||!y)&&f(e)},children:(0,s.jsxs)(eV.Cf,{className:(0,k.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"===a?"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,s.jsxs)(eV.c7,{children:[(0,s.jsxs)(eV.L3,{className:(0,k.cn)("flex items-center gap-2","light"===a?"text-[#3f2f24]":"text-white"),children:["full-uninstall"===t?(0,s.jsx)(tS.A,{className:"h-4 w-4"}):(0,s.jsx)(tA.A,{className:"h-4 w-4"}),C]}),(0,s.jsx)(eV.rr,{className:"light"===a?"text-[#7e6555]":"text-slate-400",children:"full-uninstall"===t?"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"===r?(0,s.jsxs)("div",{className:(0,k.cn)("flex items-center gap-2 rounded-[16px] border px-4 py-4 text-sm","light"===a?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,s.jsx)(c.A,{className:"h-4 w-4 animate-spin"}),"Loading the reset preview..."]}):null,"error"===r?(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[16px] border px-4 py-4","light"===a?"border-rose-200 bg-rose-50 text-rose-900":"border-rose-400/25 bg-rose-500/10 text-rose-100"),children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:"Preview could not be prepared."}),(0,s.jsx)("p",{className:"mt-1 text-sm",children:i||"Unknown reset preview error."})]}):null,n?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"grid gap-3 md:grid-cols-4",children:[(0,s.jsx)(t_,{label:"Delete folders",value:String(n.summary.deleteFolderCount),surfaceTheme:a}),(0,s.jsx)(t_,{label:"Keep folders",value:String(n.summary.metadataOnlyCount),surfaceTheme:a}),(0,s.jsx)(t_,{label:"Agents",value:String(n.summary.agentCount),surfaceTheme:a}),(0,s.jsx)(t_,{label:"Live agents",value:String(n.summary.liveAgentCount),surfaceTheme:a,danger:n.summary.liveAgentCount>0})]}),n.warnings.length>0?(0,s.jsx)("div",{className:(0,k.cn)("mt-3 rounded-[16px] border px-4 py-4","light"===a?"border-amber-300/90 bg-amber-50 text-amber-950":"border-amber-300/25 bg-amber-300/10 text-amber-50"),children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(W.A,{className:"mt-0.5 h-4 w-4 shrink-0"}),(0,s.jsx)("div",{className:"space-y-1 text-sm",children:n.warnings.map(e=>(0,s.jsx)("p",{children:e},e))})]})}):null,(0,s.jsxs)("div",{className:(0,k.cn)("mt-3 rounded-[16px] border px-4 py-4","light"===a?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:(0,k.cn)("text-xs uppercase tracking-[0.18em]","light"===a?"text-[#9a7f6c]":"text-slate-500"),children:"Workspace impact"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-sm","light"===a?"text-[#6d5647]":"text-slate-400"),children:"`Delete folder` removes the workspace directory. `Keep folder` only removes OpenClaw and AgentOS integration from that location."})]}),(0,s.jsx)(v.$,{type:"button",size:"sm",variant:"secondary",onClick:h,className:"light"===a?"border-[#dcc6b6] bg-white text-[#5d4739] hover:bg-[#f7eee7] hover:text-[#5d4739]":void 0,children:"Refresh preview"})]}),(0,s.jsx)("div",{className:"mt-3 space-y-2",children:n.workspaces.map(e=>(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[14px] border px-3 py-3","light"===a?"border-[#ece0d6] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:(0,k.cn)("text-sm font-medium","light"===a?"text-[#3f2f24]":"text-white"),children:e.name}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 break-all font-mono text-[11px]","light"===a?"text-[#7e6555]":"text-slate-400"),children:e.path})]}),(0,s.jsx)("span",{className:(0,k.cn)("rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]","delete-folder"===e.action?"light"===a?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-400/25 bg-rose-500/10 text-rose-200":"light"===a?"border-amber-300 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-200"),children:"delete-folder"===e.action?"Delete folder":"Keep folder"})]}),(0,s.jsxs)("p",{className:(0,k.cn)("mt-2 text-xs","light"===a?"text-[#6d5647]":"text-slate-400"),children:[e.agentCount," agents, ",e.runtimeCount," tracked runs, ",e.liveAgentCount," live agents."]}),(0,s.jsx)("div",{className:"mt-2 space-y-1",children:e.reasons.map(e=>(0,s.jsx)("p",{className:(0,k.cn)("text-xs","light"===a?"text-[#7e6555]":"text-slate-500"),children:e},e))})]},e.workspaceId))})]}),(0,s.jsxs)("div",{className:"mt-3 grid gap-3 md:grid-cols-2",children:[(0,s.jsx)(tR,{title:"AgentOS state",items:n.missionControlPaths,surfaceTheme:a}),(0,s.jsx)(tR,{title:"Browser state",items:n.browserStorageKeys,surfaceTheme:a})]}),"full-uninstall"===t?(0,s.jsxs)("div",{className:"mt-3 grid gap-3 md:grid-cols-2",children:[(0,s.jsx)(tR,{title:"OpenClaw state",items:n.openClawPaths,surfaceTheme:a}),(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[16px] border px-4 py-4","light"===a?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-xs uppercase tracking-[0.18em]","light"===a?"text-[#9a7f6c]":"text-slate-500"),children:"CLI cleanup"}),(0,s.jsx)("div",{className:"mt-3 space-y-2",children:n.packageActions.map(e=>(0,s.jsxs)("div",{className:(0,k.cn)("min-w-0 overflow-hidden rounded-[14px] border px-3 py-3","light"===a?"border-[#ece0d6] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,s.jsx)("p",{className:(0,k.cn)("min-w-0 break-all text-sm font-medium","light"===a?"text-[#3f2f24]":"text-white"),children:e.packageName}),(0,s.jsx)("span",{className:(0,k.cn)("shrink-0 rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",e.detected?"light"===a?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-400/25 bg-rose-500/10 text-rose-200":"light"===a?"border-[#dcc6b6] bg-[#f4e8dd] text-[#876c5a]":"border-white/10 bg-white/[0.05] text-slate-300"),children:e.detected?"Scheduled":"Manual"})]}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 break-words text-xs","light"===a?"text-[#6d5647]":"text-slate-400"),children:e.reason||"No extra detail."}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 whitespace-pre-wrap break-all font-mono text-[11px]","light"===a?"text-[#7e6555]":"text-slate-500"),children:e.command||"Automatic cleanup is not available."})]},e.packageName))})]})]}):null,(0,s.jsxs)("div",{className:(0,k.cn)("mt-3 rounded-[16px] border px-4 py-4","light"===a?"border-rose-200 bg-rose-50/70 text-rose-950":"border-rose-400/25 bg-rose-500/10 text-rose-50"),children:[(0,s.jsxs)(tT.J,{htmlFor:"reset-confirm",className:"text-sm font-medium text-inherit",children:["Type ",w," to continue"]}),(0,s.jsx)(ti.p,{id:"reset-confirm",value:m,onChange:e=>x(e.target.value),placeholder:w,disabled:y,className:(0,k.cn)("mt-2 h-10","light"===a?"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"!==l||d||p?(0,s.jsxs)("div",{className:(0,k.cn)("min-w-0 overflow-hidden rounded-[16px] border px-4 py-4","error"===l?"light"===a?"border-rose-200 bg-rose-50 text-rose-950":"border-rose-400/25 bg-rose-500/10 text-rose-50":"success"===l?"light"===a?"border-emerald-200 bg-emerald-50 text-emerald-950":"border-emerald-400/25 bg-emerald-500/10 text-emerald-50":"light"===a?"border-[#e6d6ca] bg-white text-[#3f2f24]":"border-white/10 bg-white/[0.03] text-slate-100"),children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:o||d||"Reset status"}),d?(0,s.jsx)("p",{className:"mt-1 text-sm",children:d}):null,u?(0,s.jsxs)("p",{className:"mt-2 break-all font-mono text-[11px]",children:["Background cleanup log: ",u]}):null,(0,s.jsx)("pre",{className:(0,k.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"===a?"border-[#e6d6ca] bg-[#fffaf6] text-[#5f4a3d]":"border-white/10 bg-slate-950/45 text-slate-300"),children:p||"Waiting for command output..."})]}):null,(0,s.jsxs)(eV.Es,{children:[(0,s.jsx)(v.$,{type:"button",variant:j?"default":"secondary",onClick:()=>{"full-uninstall"===t&&"success"===l?b():f(!1)},disabled:y,className:j&&"light"===a?"bg-[#5c4437] text-white hover:bg-[#4d382d]":j?"bg-cyan-400 text-slate-950 hover:bg-cyan-300":void 0,children:"full-uninstall"===t&&"success"===l?"Back to setup":j?"Done":"Close"}),j?null:(0,s.jsx)(v.$,{type:"button",onClick:g,disabled:!N,className:S,children:y?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(c.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Running..."]}):(0,s.jsxs)(s.Fragment,{children:["full-uninstall"===t?(0,s.jsx)(tS.A,{className:"mr-1.5 h-3.5 w-3.5"}):(0,s.jsx)(tI.A,{className:"mr-1.5 h-3.5 w-3.5"}),C]})})]})]})})}function t_({label:e,value:t,surfaceTheme:a,danger:r=!1}){return(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[16px] border px-4 py-3",r?"light"===a?"border-rose-200 bg-rose-50":"border-rose-400/20 bg-rose-500/10":"light"===a?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[11px] uppercase tracking-[0.16em]","light"===a?"text-[#9a7f6c]":"text-slate-500"),children:e}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 font-display text-lg","light"===a?"text-[#3f2f24]":"text-white"),children:t})]})}function tR({title:e,items:t,surfaceTheme:a}){return(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[16px] border px-4 py-4","light"===a?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-xs uppercase tracking-[0.18em]","light"===a?"text-[#9a7f6c]":"text-slate-500"),children:e}),(0,s.jsx)("div",{className:"mt-3 space-y-2",children:t.map(e=>(0,s.jsx)("p",{className:(0,k.cn)("break-all rounded-[12px] border px-3 py-2 font-mono text-[11px]","light"===a?"border-[#ece0d6] bg-[#fffaf6] text-[#6d5647]":"border-white/8 bg-white/[0.03] text-slate-400"),children:e},e))})]})}var t$=a(24809),tM=a.n(t$),tE=a(48758),tP=a(96551),tL=a(9152),tD=a(41363),tU=a(3324),tF=a(47377),tG=a(20872),tW=a(4974),tz=a(12482),tV=a(16055);function tq(e,t,a){var s,r,n,i,l,o,d,c;let u,p,m=tJ(e?.fallbackCounts),x=!function(e,t){if(0===e.length)return!1;if(!t)return!0;let a=Date.parse(t);return!Number.isFinite(a)||e.some(e=>{let t=Date.parse(e.at);return!Number.isFinite(t)||t>=a})}(e?.recentFallbackDiagnostics??[],e?.lastConnectedAt??null)?0:m,h=function(e){switch(e){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"}}(e?.connectionState),g=function(e){switch(e){case"live":return"Live";case"retrying":return"Retrying";default:return"Connecting"}}(t),b=(s=a,{label:function(e){switch(e){case"live":return"Gateway events: Live";case"reconnecting":return"Gateway events: Reconnecting";case"polling":return"Gateway events: Polling";default:return"Gateway events: Unknown"}}(u=s?.mode),lastEventLabel:tB(s?.lastEventAt),lastError:s?.lastError?.trim()||null,recovery:s?.recovery?.trim()||null,tone:"live"===(r=u)?"success":"reconnecting"===r||"polling"===r?"warning":"neutral"});return{modeLabel:"native-ws"===(n=e?.mode)?"Native WS":"cli"===n?"CLI forced":"Unknown",gatewayModeLabel:function(e){switch(e){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"}}(e?.gatewayMode),statusLabel:(i=e,i?.statusLabel?i.statusLabel:i?"cli"===i.mode||"cli-forced"===i.connectionState?"CLI fallback forced":tJ(i.fallbackCounts)>0?"CLI fallback used":"connected"===i.connectionState?"Native Gateway: OK":"error"===i.connectionState?"Native Gateway: Unreachable":"Native Gateway: Degraded":"Native Gateway: Unknown"),connectionLabel:h,protocolLabel:"number"==typeof(l=e?.protocolVersion)&&Number.isFinite(l)?`v${l}`:"Unknown",protocolRangeLabel:(o=e?.protocolRange)&&"number"==typeof o.min&&"number"==typeof o.max?`v${o.min}-v${o.max} supported`:"Unknown",streamLabel:g,eventBridgeLabel:b.label,eventBridgeLastEventLabel:b.lastEventLabel,eventBridgeLastError:b.lastError,eventBridgeRecovery:b.recovery,eventBridgeTone:b.tone,fallbackTotal:m,fallbackOperationCount:tK(e?.fallbackCounts),fallbackSummaryLabel:(d=e?.fallbackTotal??m,p=tK(e?.fallbackCounts),d<=0||p<=0?"CLI fallback used: 0 operations":`CLI fallback used: ${d} ${1===d?"operation":"operations"} across ${p} ${1===p?"method":"methods"}`),lastConnectedLabel:tB(e?.lastConnectedAt),lastDisconnectedLabel:tB(e?.lastDisconnectedAt),lastNativeError:e?.lastNativeError?.trim()||null,recovery:e?.recovery?.trim()||null,recentFallbackDiagnostics:e?.recentFallbackDiagnostics??[],statusTone:"retrying"===(c={gatewayMode:e?.gatewayMode,connectionState:e?.connectionState,mode:e?.mode,streamState:t,fallbackTotal:x}).streamState||"error"===c.connectionState||"unreachable"===c.gatewayMode?"danger":"cli"===c.mode||"cli-forced"===c.connectionState||"closed"===c.connectionState||"connecting"===c.connectionState||"fallback-active"===c.gatewayMode||"degraded"===c.gatewayMode||c.fallbackTotal>0?"warning":"connected"===c.connectionState&&"live"===c.streamState?"success":"neutral"}}function tJ(e){return Object.values(e??{}).reduce((e,t)=>Number.isFinite(t)&&t>0?e+t:e,0)}function tK(e){return Object.values(e??{}).filter(e=>Number.isFinite(e)&&e>0).length}function tB(e){if(!e)return"Not yet";let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}let tH=[{value:"auto",label:"Auto"},{value:"local-prefix",label:"Local prefix"},{value:"global-path",label:"Global PATH"},{value:"custom",label:"Custom"}],tZ=[{id:"openclaw",label:"OpenClaw",icon:tE.A},{id:"gateway",label:"Gateway",icon:tP.A},{id:"models",label:"Models",icon:tL.A},{id:"workspace",label:"Workspace",icon:tD.A},{id:"agents",label:"Agents",icon:tU.A},{id:"diagnostics",label:"Diagnostics",icon:E.A},{id:"advanced",label:"Advanced",icon:tF.A},{id:"danger-zone",label:"Danger Zone",icon:W.A,destructive:!0}];function tY(e){var t,a,r,l,o,d,u,p,m,x;let h,{snapshot:b,surfaceTheme:f,connectionState:w,gatewayDraft:y,workspaceRootDraft:j,openClawBinarySelection:N,isSavingGateway:C,isSavingWorkspaceRoot:S,isSavingOpenClawBinary:A,isCheckingForUpdates:I,updateRunState:T,selectedModelId:O,modelOnboardingRunState:_,gatewayControlAction:R,lastCheckedAt:$,onGatewayDraftChange:M,onWorkspaceRootDraftChange:P,onSelectedModelIdChange:L,onSaveGatewaySettings:D,onSaveWorkspaceRootSettings:U,onCheckForUpdates:F,onControlGateway:G,onOpenSetupWizard:z,onRunModelRefresh:V,onRunModelSetDefault:q,onOpenAddModels:J,onOpenUpdateDialog:K,onOpenResetDialog:B,onOpenClawBinarySelectionModeChange:H,onOpenClawBinarySelectionPathChange:Z,onSaveOpenClawBinarySettings:Y,installSummary:X,sidebarOpen:Q=!1}=e,[ee,et]=(0,i.useState)(null),[ea,es]=(0,i.useState)(null),[er,en]=(0,i.useState)("token"),[ei,el]=(0,i.useState)(""),[eo,ed]=(0,i.useState)(null),[ec,eu]=(0,i.useState)(!1),[ep,em]=(0,i.useState)(!1),[ex,eh]=(0,i.useState)(!1),[eg,eb]=(0,i.useState)(!1),[ef,ew]=(0,i.useState)(()=>b.diagnostics.compatibilitySmokeTest??null),[ev,ey]=(0,i.useState)(null),[ej,eN]=(0,i.useState)(!1),[ek,eC]=(0,i.useState)(()=>b.diagnostics.configUpdatePacing),[eS,eA]=(0,i.useState)(()=>b.diagnostics.configUpdatePacing.settings.mode),[eI,eT]=(0,i.useState)(()=>String(Math.ceil((b.diagnostics.configUpdatePacing.settings.minimumIntervalMs??1e4)/1e3))),[eO,e_]=(0,i.useState)(null),[eR,e$]=(0,i.useState)(!1),[eM,eE]=(0,i.useState)(0),[eP,eL]=(0,i.useState)(()=>al()),[eD,eU]=(0,i.useState)(!1),eF=eD?eP:al(),eG=!!(b.diagnostics.updateAvailable&&b.diagnostics.latestVersion),eW=!!(b.diagnostics.version&&!b.diagnostics.latestVersion&&!b.diagnostics.updateError),eV=b.diagnostics.version||"unknown",eq=b.diagnostics.latestVersion||null,eJ=b.diagnostics.updateInfo?.trim()||null,eK=b.diagnostics.updateError?.trim()||null,eH=b.diagnostics.modelReadiness.resolvedDefaultModel||b.diagnostics.modelReadiness.defaultModel||"",eZ=O||eH||"",eY=b.models.find(e=>e.id===eZ),eX=eY?.provider||b.diagnostics.modelReadiness.preferredLoginProvider||function(e){if(!e)return null;let[t]=e.split("/");return t||null}(eH)||"Not connected",eQ=(0,i.useMemo)(()=>b.diagnostics.commandHistory??[],[b.diagnostics.commandHistory]).slice(0,6),e0=(0,i.useMemo)(()=>({ok:eQ.filter(e=>"ok"===e.status).length,failed:eQ.filter(e=>"ok"!==e.status).length}),[eQ]),e1=(0,i.useMemo)(()=>tq(b.diagnostics.transport,w,b.diagnostics.eventBridge),[w,b.diagnostics.eventBridge,b.diagnostics.transport]),e2=b.diagnostics.capabilityMatrix,e5=b.diagnostics.compatibilityReport,e3=e2?.compatibility,e4=(b.diagnostics.gatewayFallbackDiagnostics?.length?b.diagnostics.gatewayFallbackDiagnostics:e2?.fallbackDiagnostics??[]).slice(0,4),e8=ee?ee.native.ok?"Authenticated":function(e){switch(e){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"}}(ee.native.kind):"Unknown";(0,i.useEffect)(()=>{let e=b.diagnostics.compatibilitySmokeTest;e&&ew(t=>{if(!t)return e;let a=Date.parse(t.checkedAt),s=Date.parse(e.checkedAt);return Number.isFinite(s)&&(!Number.isFinite(a)||s>a)?e:t})},[b.diagnostics.compatibilitySmokeTest]),(0,i.useEffect)(()=>{eC(b.diagnostics.configUpdatePacing),eA(b.diagnostics.configUpdatePacing.settings.mode),eT(String(Math.ceil((b.diagnostics.configUpdatePacing.settings.minimumIntervalMs??1e4)/1e3)))},[b.diagnostics.configUpdatePacing]),(0,i.useEffect)(()=>{if(!ek.cooldownUntil)return;let e=window.setInterval(()=>{eE(e=>e+1)},1e3);return()=>window.clearInterval(e)},[ek.cooldownUntil]);let e6=(0,i.useCallback)(async()=>{eu(!0),es(null);try{et(await t6())}catch(e){es(e instanceof Error?e.message:"Unable to check Gateway auth status.")}finally{eu(!1)}},[]);(0,i.useEffect)(()=>{e6()},[e6]),(0,i.useEffect)(()=>{let e=()=>{eL(function(){switch(window.location.hash.replace(/^#/,"")){case"gateway":return"gateway";case"models":return"models";case"workspace":return"workspace";case"agents":return"agents";case"diagnostics":return"diagnostics";case"advanced":return"advanced";case"danger-zone":return"danger-zone";default:return"openclaw"}}()),eU(!0),ai()};return window.addEventListener("hashchange",e),e(),()=>{window.removeEventListener("hashchange",e)}},[]),(0,i.useEffect)(()=>{ai()},[eP]);let e9=async()=>{let e=ei.trim();if(!e)return void es("Gateway token/password is required.");em(!0),es(null),ed(null);try{let t=await fetch("/api/settings/gateway",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"saveCredential",kind:er,value:e})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"Gateway credential could not be saved.")}let a=await t.json();et(a.authStatus),el(""),ed("Saved to .env.local and applied to the current AgentOS server session.")}catch(e){es(e instanceof Error?e.message:"Unable to save Gateway credential.")}finally{em(!1)}},e7=async()=>{eh(!0),es(null),ed(null);try{let e=await fetch("/api/settings/gateway",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"generateLocalToken"})});if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||"Gateway token could not be generated.")}let t=await e.json();et(t.authStatus),ed("Generated a local Gateway token and applied it to AgentOS.")}catch(e){es(e instanceof Error?e.message:"Unable to generate Gateway token.")}finally{eh(!1)}},te=async()=>{eb(!0),es(null),ed(null);try{let e=await fetch("/api/settings/gateway",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"repairDeviceAccess"})});if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||"Gateway device access could not be repaired.")}let t=await e.json();et(t.authStatus),ed("Local Gateway device access repaired for AgentOS.")}catch(e){es(e instanceof Error?e.message:"Unable to repair Gateway access.")}finally{eb(!1)}},tt=async()=>{eN(!0),ey(null);try{let e=await fetch("/api/openclaw/compatibility-smoke",{method:"POST",cache:"no-store"});if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||"OpenClaw compatibility smoke test failed.")}let t=await e.json();ew(t.report)}catch(e){ey(e instanceof Error?e.message:"Unable to run OpenClaw compatibility smoke test.")}finally{eN(!1)}},ta=async()=>{e$(!0),e_(null);try{let e="custom"===eS?1e3*Math.max(1,Math.round(Number(eI)||10)):null,t=await fetch("/api/settings/config-pacing",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:eS,minimumIntervalMs:e})}),a=await t.json();if(!t.ok)throw Error(a.error||"Unable to update config update pacing.");eC(a.configUpdatePacing),eA(a.configUpdatePacing.settings.mode),eT(String(Math.ceil((a.configUpdatePacing.settings.minimumIntervalMs??1e4)/1e3)))}catch(e){e_(e instanceof Error?e.message:"Unable to update config update pacing.")}finally{e$(!1)}},ts=ek.cooldownUntil?Math.max(0,Date.parse(ek.cooldownUntil)-Date.now()+0*eM):null;return(0,s.jsx)("main",{className:(0,k.cn)("relative z-10 min-h-screen","light"===f?"text-foreground":"text-slate-100"),children:(0,s.jsx)("section",{className:(0,k.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",Q?"lg:ml-[316px]":"lg:ml-[80px]"),children:(0,s.jsxs)("div",{className:"mx-auto max-w-[1160px] 2xl:max-w-[1240px]",children:[(0,s.jsx)("div",{className:"flex flex-col",children:(0,s.jsx)("nav",{"aria-label":"Settings sections",className:(0,k.cn)("flex flex-wrap gap-2 rounded-[22px] border p-2 backdrop-blur-xl","light"===f?"border-border bg-card/88 shadow-card":"border-border bg-card/88 shadow-[0_18px_44px_rgba(0,0,0,0.16)]"),children:tZ.map(e=>{let t=eF===e.id,a=e.icon;return(0,s.jsxs)(tM(),{href:`/settings#${e.id}`,scroll:!1,"aria-current":t?"page":void 0,onClick:()=>{eL(e.id),ai()},className:(0,k.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",t&&!e.destructive?"light"===f?"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)]":t&&e.destructive?"light"===f?"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"===f?"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,s.jsx)(a,{className:"h-3.5 w-3.5 shrink-0"}),(0,s.jsx)("span",{children:e.label})]},e.id)})})}),(0,s.jsxs)("div",{className:"mt-5 flex flex-col gap-4",children:["openclaw"===eF?(0,s.jsx)("section",{id:"openclaw",className:"scroll-mt-24",children:(0,s.jsxs)("div",{className:(0,k.cn)("panel-surface panel-glow min-h-full overflow-hidden rounded-[22px] p-4","light"===f?"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,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("span",{className:(0,k.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,s.jsx)(tE.A,{className:"h-4 w-4"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("h2",{className:"font-display text-lg",children:"OpenClaw"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-0.5 text-xs leading-5","light"===f?"text-muted-foreground":"text-slate-400"),children:"Source of truth for runtime and control state."})]})]}),(0,s.jsxs)("div",{className:"mt-5 grid grid-cols-2 gap-3",children:[(0,s.jsx)(tQ,{label:"Current version",value:`v${b.diagnostics.version||"unknown"}`,surfaceTheme:f,dark:"dark"===f}),(0,s.jsx)(tQ,{label:"Latest available",value:b.diagnostics.latestVersion?`v${b.diagnostics.latestVersion}`:"Unknown",badge:eG?"Update":"Stable",surfaceTheme:f,dark:"dark"===f})]}),(0,s.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,s.jsxs)(v.$,{type:"button",onClick:K,disabled:!eG||"running"===T,className:"h-9 rounded-full bg-emerald-600 px-4 text-xs text-white hover:bg-emerald-500",children:["running"===T?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(tG.A,{className:"h-3.5 w-3.5"}),"Update now"]}),(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:()=>void F(),disabled:I||"running"===T,className:ac(f,"px-4"),children:[(0,s.jsx)(n.A,{className:"h-3.5 w-3.5"}),"Check"]}),(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:()=>z(),className:ac(f,"px-4"),children:[(0,s.jsx)(tW.A,{className:"h-3.5 w-3.5"}),"Open wizard"]})]}),(0,s.jsx)(t8,{surfaceTheme:f,isCheckingForUpdates:I,isUpdateRegistryLoading:eW,hasUpdateAvailable:eG,currentVersion:eV,latestVersion:eq,updateInfo:eJ,updateError:eK,lastCheckedAt:$,isUpdateRunning:"running"===T}),(0,s.jsxs)("div",{className:(0,k.cn)("mt-5 grid gap-3 border-t pt-4 sm:grid-cols-2","light"===f?"border-border":"border-white/10"),children:[(0,s.jsx)(tQ,{label:"Detected install",value:X.label||"Unknown",surfaceTheme:f,dark:"dark"===f,compact:!0}),(0,s.jsx)(tQ,{label:"Resolved path",value:as(N.resolvedPath||"openclaw",26),surfaceTheme:f,dark:"dark"===f,compact:!0})]}),(0,s.jsxs)("div",{className:(0,k.cn)("mt-4 rounded-[18px] border p-3.5","light"===f?"border-border bg-muted/45":"border-white/10 bg-white/[0.035]"),children:[(0,s.jsx)(tT.J,{className:ao(f),children:"OpenClaw binary mode"}),(0,s.jsx)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:tH.map(e=>(0,s.jsx)("button",{type:"button",onClick:()=>H(e.value),className:(0,k.cn)("h-9 rounded-full border px-3 text-xs transition-colors",N.mode===e.value?"light"===f?"border-primary/35 bg-primary/10 text-primary":"border-primary/30 bg-primary/12 text-primary":"light"===f?"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:e.label},e.value))}),"custom"===N.mode?(0,s.jsx)(ti.p,{value:N.path??"",onChange:e=>Z(e.target.value),placeholder:"/path/to/openclaw",className:ad(f,"mt-3")}):null,(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:()=>void Y(N),disabled:A,className:ac(f,"mt-3 w-full"),children:[A?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(tz.A,{className:"h-3.5 w-3.5"}),"Save selection"]})]})]})}):null,"gateway"===eF?(0,s.jsx)("section",{id:"gateway",className:"scroll-mt-24",children:(0,s.jsxs)(tX,{title:"Gateway",icon:tP.A,surfaceTheme:f,children:[(0,s.jsx)(t0,{surfaceTheme:f,rows:[["Status",`${"remote"===(t=b).diagnostics.bindMode||t.diagnostics.configuredGatewayUrl?"Remote":"Local"} / ${b.diagnostics.loaded||b.diagnostics.rpcOk?"Online":"Offline"}`],["Native Gateway",e1.statusLabel],["Gateway mode",e1.gatewayModeLabel],["CLI fallback used",`${e1.fallbackTotal} operations`],["Endpoint",b.diagnostics.gatewayUrl||"Not configured"],["Auth status",e8],["Protocol",`${e1.protocolRangeLabel}, connected: ${e1.protocolLabel}`],["OpenClaw Compatibility",e5?t7(e5.status):"Unknown"],["Native Gateway coverage",e5?`${e5.summary.nativeGatewayCoveragePercent}% (${e5.summary.nativeGatewayCoverageLabel})`:"Unknown"],["CLI fallback operation count",e5?String(e5.summary.cliFallbackOperationCount):"Unknown"],["Unsupported/degraded surfaces",e5?(h=[...(a=e5).summary.failedSurfaces,...a.summary.unsupportedSurfaces,...a.summary.degradedSurfaces]).length>0?at(h,3):"None":"Unknown"],["Compatibility",function(e){switch(e?.protocol.status){case"compatible":return"Compatible";case"unsupported":return"Unsupported";default:return"Unknown"}}(e3)],["Contract audit",function(e){if(!e)return"Unknown";let t=function(e){switch(e){case"gateway-handshake":return"handshake";case"disabled":return"disabled";case"unavailable":return"unavailable";default:return e}}(e.source);switch(e.status){case"advertised":return`Advertised via ${t}`;case"verified":return`Verified via ${t}`;case"drift":return`Drift via ${t}`;default:return`Unknown via ${t}`}}(e3?.methodContract)],["Contract gaps",(r=e3?.methodContract,l=e2?.operations,r?"advertised"===r.status||"verified"===r.status?"None":"unknown"===r.status?r.reason:r.missingOperations.length>0?aa(r.missingOperations,l):`${r.missingMethodCount} methods`:"Unknown")],["Native ops",(o=e3)?`${o.nativeOperationCount} native / ${o.degradedOperationCount} limited`:"Unknown"],["Alias ops",(d=e3?.aliasOperations,u=e2?.operations,d?d.length>0?aa(d,u):"None":"Unknown")],["Limited ops",(p=e3?.degradedOperations,m=e2?.operations,p?p.length>0?aa(p,m):"None":"Unknown")],["Native chat",t9(e2?.nativeMissionDispatch)],["Config patch",t9(e2?.configPatch)],["Events",t9(e2?.eventBridge)]],successIndex:1}),(0,s.jsx)(t2,{compatibilityReport:e5,report:ef,snapshot:b,capabilityMatrix:e2,transportSummary:e1,nativeAuthLabel:e8,error:ev,isRunning:ej,onRun:()=>void tt(),surfaceTheme:f}),e1.recovery||e1.lastNativeError?(0,s.jsxs)("div",{className:(0,k.cn)("mt-4 rounded-[18px] border p-3.5",ap(f)),children:[(0,s.jsx)("p",{className:ao(f),children:"Native Gateway diagnostic"}),e1.lastNativeError?(0,s.jsxs)("p",{className:(0,k.cn)("mt-2 text-xs leading-5","light"===f?"text-muted-foreground":"text-slate-300"),children:["Last native error: ",e1.lastNativeError]}):null,e1.recovery?(0,s.jsxs)("p",{className:(0,k.cn)("mt-1 text-xs leading-5","light"===f?"text-muted-foreground":"text-slate-400"),children:["Recovery: ",e1.recovery]}):null]}):null,(0,s.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(tT.J,{className:ao(f),children:"Gateway endpoint"}),(0,s.jsx)(ti.p,{value:y,onChange:e=>M(e.target.value),placeholder:"ws://127.0.0.1:18789",className:ad(f,"mt-2")})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,s.jsxs)(v.$,{type:"button",onClick:()=>void D(y.trim()||null),disabled:C,className:"h-9 rounded-full bg-emerald-600 text-xs text-white hover:bg-emerald-500",children:[C?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(tz.A,{className:"h-3.5 w-3.5"}),"Save endpoint"]}),(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:()=>void D(null),disabled:C,className:ac(f),children:[(0,s.jsx)(tA.A,{className:"h-3.5 w-3.5"}),"Clear"]})]})]}),(0,s.jsx)("div",{className:"mt-4 grid grid-cols-3 gap-2",children:["start","stop","restart"].map(e=>(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:()=>void G(e),disabled:null!==R,className:(0,k.cn)(ac(f),"capitalize"),children:[R===e?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):null,e]},e))}),(0,s.jsxs)("div",{className:(0,k.cn)("mt-4 rounded-[18px] p-3.5","light"===f?"border border-emerald-200 bg-emerald-50/55":"border border-cyan-300/12 bg-cyan-300/[0.06]"),children:[(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)(tV.A,{className:(0,k.cn)("mt-0.5 h-4 w-4","light"===f?"text-emerald-700":"text-cyan-200")}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:(0,k.cn)("text-sm font-medium","light"===f?"text-[#2f624b]":"text-slate-100"),children:"Native Gateway auth"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-xs leading-5","light"===f?"text-[#6f836f]":"text-slate-400"),children:"Use local repair when AgentOS reports missing operator scopes."})]})]}),(0,s.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:()=>void te(),disabled:eg,className:ac(f,"px-3","gateway-contrast"),children:[eg?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(tW.A,{className:"h-3.5 w-3.5"}),"Repair local access"]}),(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:()=>void e7(),disabled:ex,className:ac(f,"px-3","gateway-contrast"),children:[ex?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(tV.A,{className:"h-3.5 w-3.5"}),"Generate token"]})]}),(0,s.jsxs)("div",{className:"mt-3 grid gap-2 sm:grid-cols-[112px_1fr]",children:[(0,s.jsxs)("select",{value:er,onChange:e=>en(e.target.value),className:ad(f),children:[(0,s.jsx)("option",{value:"token",children:"Token"}),(0,s.jsx)("option",{value:"password",children:"Password"})]}),(0,s.jsx)(ti.p,{type:"password",value:ei,onChange:e=>el(e.target.value),placeholder:"Paste known credential",className:ad(f)})]}),(0,s.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[(0,s.jsxs)(v.$,{type:"button",onClick:()=>void e9(),disabled:ep,className:"h-9 rounded-full bg-emerald-600 text-xs text-white hover:bg-emerald-500",children:[ep?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(tz.A,{className:"h-3.5 w-3.5"}),"Save credential"]}),(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:()=>void e6(),disabled:ec,className:ac(f,void 0,"gateway-contrast"),children:[ec?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(n.A,{className:"h-3.5 w-3.5"}),"Test auth"]})]}),ea||eo||ee?.native.issue?(0,s.jsx)("p",{className:(0,k.cn)("mt-3 text-xs leading-5",ea?"light"===f?"text-red-700":"text-rose-300":"light"===f?"text-muted-foreground":"text-slate-400"),children:ea||eo||ee?.native.issue}):null]})]})}):null,"models"===eF?(0,s.jsx)("section",{id:"models",className:"scroll-mt-24",children:(0,s.jsxs)(tX,{title:"Models",icon:tL.A,surfaceTheme:f,children:[(0,s.jsx)(t0,{surfaceTheme:f,rows:[["Default model",eH||"Not selected"],["Provider",eX],["Available",`${b.diagnostics.modelReadiness.availableModelCount} of ${b.diagnostics.modelReadiness.totalModelCount}`]]}),(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsx)(tT.J,{className:ao(f),children:"Model"}),(0,s.jsxs)("select",{value:eZ,onChange:e=>L(e.target.value),className:ad(f,"mt-2"),children:[(0,s.jsx)("option",{value:"",children:"Choose model"}),b.models.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name||e.id},e.id))]})]}),(0,s.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-2",children:[(0,s.jsxs)(v.$,{type:"button",onClick:()=>void q(eZ),disabled:!eZ||"running"===_,className:"h-9 rounded-full bg-emerald-600 text-xs text-white hover:bg-emerald-500",children:["running"===_?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(eB.A,{className:"h-3.5 w-3.5"}),"Use selected"]}),(0,s.jsx)(v.$,{type:"button",variant:"secondary",onClick:()=>J(null),className:ac(f),children:"Add models"})]}),(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:()=>void V(),disabled:"running"===_,className:(0,k.cn)(ac(f),"mt-3 w-full"),children:[(0,s.jsx)(n.A,{className:"h-3.5 w-3.5"}),"Refresh models"]})]})}):null,"workspace"===eF?(0,s.jsx)("section",{id:"workspace",className:"scroll-mt-24",children:(0,s.jsxs)(tX,{title:"Workspace",icon:tD.A,surfaceTheme:f,children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(tT.J,{className:ao(f),children:"Workspace root"}),(0,s.jsxs)("div",{className:"mt-2 flex gap-2",children:[(0,s.jsx)(ti.p,{value:j,onChange:e=>P(e.target.value),placeholder:"~/Documents/AgentOS",className:ad(f)}),(0,s.jsx)("button",{type:"button","aria-label":"Copy workspace root",onClick:()=>{var e;return e=j||b.diagnostics.workspaceRoot,void("u">typeof navigator&&navigator.clipboard&&navigator.clipboard.writeText(e))},className:(x=f,(0,k.cn)("flex h-10 w-10 shrink-0 items-center justify-center rounded-[16px] border","light"===x?"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,s.jsx)(ez.A,{className:"h-3.5 w-3.5"})})]})]}),(0,s.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-2",children:[(0,s.jsxs)(v.$,{type:"button",onClick:()=>void U(j.trim()||null),disabled:S,className:"h-9 rounded-full bg-emerald-600 text-xs text-white hover:bg-emerald-500",children:[S?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(tz.A,{className:"h-3.5 w-3.5"}),"Save"]}),(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:()=>void U(null),disabled:S,className:ac(f),children:[(0,s.jsx)(tA.A,{className:"h-3.5 w-3.5"}),"Reset"]})]}),(0,s.jsxs)("div",{className:(0,k.cn)("mt-4 rounded-[18px] p-3.5","light"===f?"border border-border bg-muted/45":"border border-white/[0.08] bg-[#101a2a]/92"),children:[(0,s.jsx)("p",{className:ao(f),children:"Current root"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-2 break-all text-sm","light"===f?"text-foreground":"text-slate-200"),children:as(b.diagnostics.workspaceRoot,56)})]})]})}):null,"diagnostics"===eF?(0,s.jsx)("section",{id:"diagnostics",className:"scroll-mt-24",children:(0,s.jsx)(tX,{title:"Diagnostics",icon:E.A,surfaceTheme:f,action:(0,s.jsxs)("span",{className:(0,k.cn)("inline-flex items-center gap-2 rounded-full border px-3 py-1.5 text-xs","light"===f?"border-border bg-card text-muted-foreground":"border-white/[0.08] bg-[#101a2a]/92 text-slate-300"),children:[(0,s.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),e0.ok," OK",e0.failed?(0,s.jsxs)("span",{className:"text-red-600",children:[e0.failed," failed"]}):null]}),children:(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(t5,{summary:e1,surfaceTheme:f}),e4.length?(0,s.jsxs)("div",{className:(0,k.cn)("border-l-2 py-1 pl-3","light"===f?"border-amber-300":"border-amber-300/45"),children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,s.jsx)("p",{className:ao(f),children:"Gateway fallback diagnostics"}),(0,s.jsxs)("span",{className:(0,k.cn)("text-[11px]","light"===f?"text-muted-foreground":"text-slate-400"),children:[e4.length," recent"]})]}),(0,s.jsx)("div",{className:"mt-2 space-y-2",children:e4.map(e=>(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:(0,k.cn)("text-sm font-medium","light"===f?"text-foreground":"text-slate-100"),children:e.operationLabel}),(0,s.jsx)("code",{className:(0,k.cn)("rounded-full px-2 py-0.5 text-[10px]","light"===f?"bg-muted text-muted-foreground":"bg-white/[0.06] text-slate-300"),children:e.operation}),(0,s.jsx)("span",{className:(0,k.cn)("text-[11px]","light"===f?"text-amber-700":"text-amber-200"),children:function(e){switch(e){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"}}(e.kind)}),(0,s.jsx)("span",{className:(0,k.cn)("text-[11px]","light"===f?"text-muted-foreground":"text-slate-500"),children:ar(e.at)})]}),(0,s.jsxs)("p",{className:(0,k.cn)("mt-1 text-xs","light"===f?"text-muted-foreground":"text-slate-400"),children:["Reason: ",e.issue]}),(0,s.jsxs)("p",{className:(0,k.cn)("mt-0.5 text-xs","light"===f?"text-muted-foreground":"text-slate-500"),children:["Recovery: ",e.recovery||function(e){switch(e){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."}}(e.kind)]})]},`${e.at}-${e.operation}`))})]}):null,eQ.length?eQ.map(e=>(0,s.jsxs)("details",{className:(0,k.cn)("group rounded-[16px] border","light"===f?"border-border bg-card":"border-white/[0.08] bg-[#101a2a]/92"),children:[(0,s.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-3 px-3.5 py-2.5",children:[(0,s.jsxs)("code",{className:(0,k.cn)("min-w-0 flex-1 truncate font-mono text-[11px]","light"===f?"text-foreground":"text-slate-200"),children:[e.command," ",e.args.join(" ")]}),(0,s.jsx)("span",{className:(0,k.cn)("inline-flex shrink-0 items-center gap-1.5 rounded-full border px-2 py-1 text-[9px] uppercase tracking-[0.12em]","ok"===e.status?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-red-200 bg-red-50 text-red-700"),children:e.status}),(0,s.jsxs)("span",{className:(0,k.cn)("hidden text-xs sm:inline","light"===f?"text-muted-foreground":"text-slate-400"),children:[e.durationMs," ms"]}),(0,s.jsx)(g.A,{className:(0,k.cn)("h-4 w-4 transition-transform group-open:rotate-180","light"===f?"text-muted-foreground":"text-slate-400")})]}),(0,s.jsxs)("div",{className:(0,k.cn)("border-t p-3.5","light"===f?"border-border":"border-white/[0.08]"),children:[(0,s.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,s.jsx)(t1,{title:"stdout",value:e.stdoutPreview,surfaceTheme:f}),(0,s.jsx)(t1,{title:"stderr",value:e.stderrPreview,surfaceTheme:f})]}),(0,s.jsxs)("p",{className:(0,k.cn)("mt-3 text-xs","light"===f?"text-muted-foreground":"text-slate-400"),children:["Exit code: ",e.exitCode??"n/a"," | Started: ",ar(e.startedAt)]})]})]},e.id)):(0,s.jsx)(t4,{title:"No recent CLI calls",detail:"Diagnostics will appear after AgentOS uses fallback commands.",surfaceTheme:f})]})})}):null,"agents"===eF?(0,s.jsx)("section",{id:"agents",className:"scroll-mt-24",children:(0,s.jsxs)(tX,{title:"Agents",icon:tU.A,surfaceTheme:f,children:[(0,s.jsx)(t0,{surfaceTheme:f,rows:[["Agents",String(b.agents.length)],["Workspaces",String(b.workspaces.length)],["Active runtimes",String(b.runtimes.filter(e=>"running"===e.status).length)]]}),(0,s.jsx)(v.$,{asChild:!0,variant:"secondary",className:(0,k.cn)(ac(f),"mt-4 w-full"),children:(0,s.jsx)(tM(),{href:"/",children:"Open mission control"})})]})}):null,"advanced"===eF?(0,s.jsx)("section",{id:"advanced",className:"scroll-mt-24",children:(0,s.jsxs)(tX,{title:"Advanced",icon:tF.A,surfaceTheme:f,children:[(0,s.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,s.jsx)(tQ,{label:"Install method",value:b.diagnostics.updateInstallKind||X.label||"Unknown",surfaceTheme:f}),(0,s.jsx)(tQ,{label:"Updater",value:b.diagnostics.updatePackageManager||"Unknown",surfaceTheme:f}),(0,s.jsx)(tQ,{label:"Last checked",value:$?new Date($).toLocaleTimeString():"Not checked",surfaceTheme:f})]}),(0,s.jsxs)("div",{className:(0,k.cn)("mt-4 rounded-[18px] p-3.5","light"===f?"border border-border bg-muted/45":"border border-white/[0.08] bg-[#101a2a]/92"),children:[(0,s.jsx)("p",{className:ao(f),children:"Install root"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-2 break-all text-sm","light"===f?"text-foreground":"text-slate-200"),children:as(b.diagnostics.updateRoot||X.root||"Not detected",80)})]}),(0,s.jsxs)("div",{className:(0,k.cn)("mt-4 rounded-[18px] p-3.5","light"===f?"border border-border bg-muted/45":"border border-white/[0.08] bg-[#101a2a]/92"),children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:ao(f),children:"Config update pacing"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-xs leading-5","light"===f?"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,s.jsx)("span",{className:(0,k.cn)("inline-flex items-center rounded-full border px-2.5 py-1 text-[10px] uppercase tracking-[0.12em]",ek.pending?"light"===f?"border-amber-200 bg-amber-50 text-amber-700":"border-amber-300/24 bg-amber-300/[0.08] text-amber-200":"light"===f?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/[0.08] text-emerald-200"),children:ek.pending?"Pending config update":"Idle"})]}),(0,s.jsxs)("div",{className:"mt-3 grid gap-2 sm:grid-cols-3",children:[(0,s.jsx)("button",{type:"button",onClick:()=>eA("respect-gateway"),className:au(f,"respect-gateway"===eS),children:"Respect Gateway"}),(0,s.jsx)("button",{type:"button",onClick:()=>eA("fast-local-testing"),className:au(f,"fast-local-testing"===eS),children:"Fast testing"}),(0,s.jsx)("button",{type:"button",onClick:()=>eA("custom"),className:au(f,"custom"===eS),children:"Custom"})]}),"custom"===eS?(0,s.jsxs)("div",{className:"mt-3",children:[(0,s.jsx)(tT.J,{className:ao(f),children:"Minimum local interval, seconds"}),(0,s.jsx)(ti.p,{type:"number",min:1,max:600,value:eI,onChange:e=>eT(e.target.value),className:ad(f,"mt-2")})]}):null,(0,s.jsx)(t0,{surfaceTheme:f,rows:[["Current mode",function(e){switch(e){case"fast-local-testing":return"Fast local testing";case"custom":return"Custom";default:return"Respect Gateway cooldown"}}(ek.settings.mode)],["Minimum local interval",an(ek.settings.minimumIntervalMs)],["Pending paths",ek.pendingPaths.length?ek.pendingPaths.join(", "):"None"],["Retry countdown",null!==ts?an(ts):"None"],["CLI fallback","Disabled for Gateway config cooldown recovery"]]}),ek.lastIssue?(0,s.jsxs)("p",{className:(0,k.cn)("mt-3 text-xs leading-5","light"===f?"text-amber-700":"text-amber-200"),children:["Last Gateway issue: ",ek.lastIssue]}):null,eO?(0,s.jsx)("p",{className:(0,k.cn)("mt-3 text-xs leading-5","light"===f?"text-red-700":"text-rose-300"),children:eO}):null,(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:()=>void ta(),disabled:eR,className:(0,k.cn)(ac(f),"mt-3 w-full"),children:[eR?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(tz.A,{className:"h-3.5 w-3.5"}),"Save pacing"]})]})]})}):null,"danger-zone"===eF?(0,s.jsx)("section",{id:"danger-zone",className:"scroll-mt-24",children:(0,s.jsx)("div",{className:(0,k.cn)("rounded-[22px] p-4 shadow-[0_18px_44px_rgba(185,28,28,0.06)]","light"===f?"border border-red-200 bg-red-50/58":"border border-rose-400/20 bg-rose-500/[0.08]"),children:(0,s.jsxs)("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("span",{className:(0,k.cn)("flex h-10 w-10 shrink-0 items-center justify-center rounded-full border","light"===f?"border-red-200 bg-white text-red-600":"border-rose-300/20 bg-rose-400/10 text-rose-200"),children:(0,s.jsx)(W.A,{className:"h-4 w-4"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:(0,k.cn)("font-display text-lg","light"===f?"text-red-700":"text-rose-100"),children:"Danger Zone"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1.5 max-w-2xl text-sm leading-6","light"===f?"text-red-700/72":"text-rose-100/80"),children:"These actions are destructive and cannot be undone. Confirmation is required before anything runs."})]})]}),(0,s.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2 md:min-w-[340px]",children:[(0,s.jsxs)(v.$,{type:"button",variant:"destructive",onClick:()=>B("mission-control"),className:"h-9 rounded-full bg-red-600 text-xs text-white hover:bg-red-500",children:[(0,s.jsx)(tI.A,{className:"h-3.5 w-3.5"}),"Reset AgentOS"]}),(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:()=>B("full-uninstall"),className:(0,k.cn)("h-9 rounded-full text-xs","light"===f?"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,s.jsx)(tI.A,{className:"h-3.5 w-3.5"}),"Full uninstall"]})]})]})})}):null]})]})})})}function tX({title:e,icon:t,children:a,action:r,surfaceTheme:n}){return(0,s.jsxs)("div",{className:(0,k.cn)("min-h-full rounded-[22px] p-4 shadow-[0_20px_54px_rgba(101,74,54,0.07)] backdrop-blur-xl","light"===n?"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,s.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.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,s.jsx)(t,{className:"h-4 w-4"})}),(0,s.jsx)("h2",{className:(0,k.cn)("font-display text-lg","light"===n?"text-[#2d211b]":"text-slate-100"),children:e})]}),r]}),(0,s.jsx)("div",{className:"mt-4",children:a})]})}function tQ({label:e,value:t,badge:a,surfaceTheme:r,dark:n=!1,compact:i=!1}){let l=n||"dark"===r;return(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[11px]",l?"text-slate-400":"text-muted-foreground"),children:e}),(0,s.jsxs)("div",{className:"mt-1.5 flex items-center gap-2",children:[(0,s.jsx)("p",{className:(0,k.cn)("min-w-0 truncate font-medium",i?"text-sm":"text-[1.05rem]",l?"text-white":"text-foreground"),title:t,children:t}),a?(0,s.jsx)("span",{className:(0,k.cn)("shrink-0 rounded-full border px-2 py-0.5 text-[9px] uppercase tracking-[0.12em]",l?"border-emerald-300/20 bg-emerald-300/10 text-emerald-100":"border-emerald-200 bg-emerald-50 text-emerald-700"),children:a}):null]})]})}function t0({rows:e,successIndex:t,surfaceTheme:a}){let r="dark"===a;return(0,s.jsx)("div",{className:(0,k.cn)("overflow-hidden rounded-[18px] border","light"===a?"border-border bg-card":"border-border bg-[#0f1826]"),children:e.map(([e,a],n)=>(0,s.jsxs)("div",{className:(0,k.cn)("flex items-center justify-between gap-3 px-3.5 py-2.5 last:border-b-0","border-b border-border"),children:[(0,s.jsx)("span",{className:(0,k.cn)("text-sm",r?"text-slate-400":"text-muted-foreground"),children:e}),(0,s.jsx)("span",{className:(0,k.cn)("min-w-0 truncate text-right text-sm",r?"text-slate-100":"text-foreground",t===n?r?"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:a,children:a})]},e))})}function t1({title:e,value:t,surfaceTheme:a}){let r="dark"===a;return(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:ao(a),children:e}),(0,s.jsx)("pre",{className:(0,k.cn)("mt-2 max-h-40 overflow-auto rounded-[14px] border p-3 text-xs",r?"border-white/[0.08] bg-[#0d1624]/92 text-slate-200":"border-border bg-muted/55 text-foreground"),children:t||"No output"})]})}function t2({compatibilityReport:e,report:t,snapshot:a,capabilityMatrix:r,transportSummary:n,nativeAuthLabel:i,error:l,isRunning:o,onRun:d,surfaceTheme:u}){var p;let m,x=t?.compatibility,h=e?.status,b=x?`v${x.agentOsSupportedProtocolRange.min}-v${x.agentOsSupportedProtocolRange.max}`:e?`v${e.gateway.protocolRange.min}-v${e.gateway.protocolRange.max}`:n.protocolRangeLabel,f=x?.lastFallbackReason||e?.fallback.diagnostics[0]?.issue||a.diagnostics.gatewayFallbackDiagnostics?.[0]?.issue||"None",w=x?.lastNativeError||n.lastNativeError||"None",y=e?.recovery||t?.recovery||n.recovery||a.diagnostics.issues[0]||"OpenClaw compatibility is not available yet.",j=h?t7(h):t?function(e){switch(e){case"compatible":return"Compatible";case"degraded":return"Degraded";case"incompatible":return"Incompatible";default:return"Unknown"}}(t.status):"Unknown",N=h?function(e){switch(e){case"compatible":return"success";case"degraded":return"warning";case"incompatible":return"danger";default:return"neutral"}}(h):t?function(e){switch(e){case"compatible":return"success";case"degraded":return"warning";case"incompatible":return"danger";default:return"neutral"}}(t.status):"neutral",C=t?t.safeToDispatchMissions?"Safe to dispatch":"Do not dispatch":e?"compatible"===e.status?"Compatible":"degraded"===e.status?"Degraded":"Incompatible":"Not tested",S=e?[...e.summary.failedSurfaces,...e.summary.unsupportedSurfaces,...e.summary.degradedSurfaces]:[],A=e?.contracts.filter(e=>"ok"!==e.status).slice(0,5)??[];return(0,s.jsxs)("div",{className:(0,k.cn)("mt-4 rounded-[18px] border p-3.5",ap(u)),children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:ao(u),children:"Compatibility"}),(0,s.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-2",children:[(0,s.jsx)("p",{className:(0,k.cn)("font-medium","light"===u?"text-foreground":"text-slate-100"),children:j}),(0,s.jsx)("span",{className:t3(N,u),children:C})]}),(0,s.jsxs)("p",{className:(0,k.cn)("mt-1 text-xs","light"===u?"text-muted-foreground":"text-slate-400"),children:["Report: ",e?ar(e.generatedAt):"Not available",t?` / Smoke: ${ar(t.checkedAt)}`:""]})]}),(0,s.jsxs)(v.$,{type:"button",variant:"secondary",onClick:d,disabled:o,className:ac(u,"px-4"),children:[o?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(tE.A,{className:"h-3.5 w-3.5"}),o?"Running...":"Run OpenClaw Smoke Test"]})]}),(0,s.jsx)("div",{className:"mt-3",children:(0,s.jsx)(t0,{surfaceTheme:u,rows:[["Installed OpenClaw",ae(e?.openClaw.installedVersion??x?.installedVersion??a.diagnostics.version??null)],["Required OpenClaw",ae(x?.requiredOpenClawVersion??e?.openClaw.supportedBaselineVersion??null)],["Recommended OpenClaw",ae(e?.openClaw.recommendedVersion??x?.recommendedOpenClawVersion??a.diagnostics.latestVersion??null)],["Gateway protocol status",e?(m=(p=e).gateway.protocolVersion?`v${p.gateway.protocolVersion}`:"unknown",`${m} / ${p.gateway.protocolStatus}`):x?.gatewayProtocolVersion?`v${x.gatewayProtocolVersion}`:r?.gatewayProtocolVersion?`v${r.gatewayProtocolVersion}`:n.protocolLabel],["AgentOS protocol range",b],["Native Gateway coverage",e?`${e.summary.nativeGatewayCoveragePercent}% (${e.summary.nativeGatewayCoverageLabel})`:"Unknown"],["CLI fallback operation count",e?String(e.summary.cliFallbackOperationCount):"Unknown"],["Unsupported/degraded surfaces",e?S.length>0?at(S,3):"None":"Unknown"],["Node.js",x?.nodeVersion?`${x.nodeVersion} / ${function(e){switch(e){case"supported":return"Supported";case"unsupported":return"Unsupported";default:return"Unknown"}}(x.nodeStatus)}`:"Run smoke test"],["Gateway auth",x?.gatewayAuthStatus||i],["Native Gateway",e?`${e.gateway.health} / ${e.gateway.capabilitySource}`:x?.nativeGatewayStatus||n.statusLabel],["CLI fallback count",String(x?.cliFallbackUsageCount??n.fallbackTotal)],["Last native error",w],["Last fallback reason",f]]})}),(0,s.jsxs)("div",{className:(0,k.cn)("mt-3 rounded-[16px] border p-3 text-xs leading-5","light"===u?"border-border bg-muted/45 text-foreground":"border-white/[0.08] bg-[#0d1624] text-slate-300"),children:[(0,s.jsx)("p",{className:ao(u),children:"Recovery suggestion"}),(0,s.jsx)("p",{className:"mt-1.5",children:y}),l?(0,s.jsx)("p",{className:(0,k.cn)("mt-1.5","light"===u?"text-rose-700":"text-rose-200"),children:l}):null]}),A.length>0?(0,s.jsx)("div",{className:"mt-3 space-y-2",children:A.map(e=>(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[16px] border p-3","light"===u?"border-border bg-card":"border-white/[0.08] bg-[#101a2a]/92"),children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:t3(function(e){switch(e){case"ok":return"success";case"degraded":return"warning";case"unsupported":case"failed":return"danger"}}(e.status),u),children:function(e){switch(e){case"ok":return"OK";case"degraded":return"Degraded";case"unsupported":return"Unsupported";case"failed":return"Failed"}}(e.status)}),(0,s.jsx)("p",{className:(0,k.cn)("text-sm font-medium","light"===u?"text-foreground":"text-slate-100"),children:e.label})]}),(0,s.jsx)("p",{className:(0,k.cn)("mt-2 text-xs leading-5","light"===u?"text-muted-foreground":"text-slate-300"),children:e.reason}),(0,s.jsxs)("p",{className:(0,k.cn)("mt-1 text-xs leading-5","light"===u?"text-muted-foreground":"text-slate-400"),children:["Recovery: ",e.suggestedRecovery]})]},e.operation))}):null,t?.checks.length?(0,s.jsx)("div",{className:"mt-3 space-y-2",children:t.checks.map(e=>(0,s.jsxs)("details",{className:(0,k.cn)("group rounded-[16px] border","light"===u?"border-border bg-card":"border-white/[0.08] bg-[#101a2a]/92"),children:[(0,s.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-3 px-3.5 py-2.5",children:[(0,s.jsx)("span",{className:t3(function(e){switch(e){case"pass":return"success";case"warning":return"warning";case"fail":return"danger";default:return"neutral"}}(e.status),u),children:function(e){switch(e){case"pass":return"Pass";case"warning":return"Warning";case"fail":return"Fail";default:return"Unknown"}}(e.status)}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:(0,k.cn)("truncate text-sm font-medium","light"===u?"text-foreground":"text-slate-100"),children:e.label}),(0,s.jsx)("p",{className:(0,k.cn)("mt-0.5 truncate text-xs","light"===u?"text-muted-foreground":"text-slate-400"),children:e.summary})]}),(0,s.jsxs)("span",{className:(0,k.cn)("hidden text-xs sm:inline","light"===u?"text-muted-foreground":"text-slate-400"),children:[e.durationMs," ms"]}),(0,s.jsx)(g.A,{className:(0,k.cn)("h-4 w-4 transition-transform group-open:rotate-180","light"===u?"text-muted-foreground":"text-slate-400")})]}),(0,s.jsxs)("div",{className:(0,k.cn)("border-t p-3.5","light"===u?"border-border":"border-white/[0.08]"),children:[e.recovery?(0,s.jsxs)("p",{className:(0,k.cn)("mb-3 text-xs leading-5","light"===u?"text-muted-foreground":"text-slate-300"),children:["Recovery: ",e.recovery]}):null,(0,s.jsx)(t1,{title:"raw details",value:function(e){if(null==e)return"No raw details";if("string"==typeof e)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}(e.rawDetails),surfaceTheme:u})]})]},e.id))}):(0,s.jsx)(t4,{title:"No compatibility smoke report",detail:"Run the smoke test to verify OpenClaw binary, Gateway, models, sessions, tasks, config, events, and fallback behavior.",surfaceTheme:u})]})}function t5({summary:e,surfaceTheme:t}){return(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[18px] border p-3.5",ap(t)),children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:ao(t),children:"Gateway Transport"}),(0,s.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-2",children:[(0,s.jsx)("p",{className:(0,k.cn)("font-medium","light"===t?"text-foreground":"text-slate-100"),children:e.statusLabel}),(0,s.jsx)("span",{className:t3(e.statusTone,t),children:e.gatewayModeLabel})]}),(0,s.jsxs)("p",{className:(0,k.cn)("mt-1 text-xs","light"===t?"text-muted-foreground":"text-slate-400"),children:[e.connectionLabel," / ",e.modeLabel]})]}),(0,s.jsxs)("div",{className:"text-left sm:text-right",children:[(0,s.jsx)("p",{className:ao(t),children:"Snapshot stream"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1.5 text-sm","light"===t?"text-foreground":"text-slate-200"),children:e.streamLabel})]})]}),(0,s.jsxs)("div",{className:"mt-3 grid gap-3 sm:grid-cols-4",children:[(0,s.jsx)(tQ,{label:"Protocol support",value:e.protocolRangeLabel,surfaceTheme:t,dark:"dark"===t,compact:!0}),(0,s.jsx)(tQ,{label:"Connected protocol",value:e.protocolLabel,surfaceTheme:t,dark:"dark"===t,compact:!0}),(0,s.jsx)(tQ,{label:"CLI fallback used",value:String(e.fallbackTotal),badge:e.fallbackTotal>0?"Used":"Clean",surfaceTheme:t,dark:"dark"===t,compact:!0}),(0,s.jsx)(tQ,{label:"Last connected",value:e.lastConnectedLabel,surfaceTheme:t,dark:"dark"===t,compact:!0})]}),(0,s.jsxs)("div",{className:"mt-3 grid gap-3 sm:grid-cols-2",children:[(0,s.jsx)(tQ,{label:"Last disconnected",value:e.lastDisconnectedLabel,surfaceTheme:t,dark:"dark"===t,compact:!0}),(0,s.jsx)(tQ,{label:"Fallback summary",value:e.fallbackSummaryLabel,surfaceTheme:t,dark:"dark"===t,compact:!0})]}),(0,s.jsxs)("div",{className:"mt-3 grid gap-3 sm:grid-cols-2",children:[(0,s.jsx)(tQ,{label:"Gateway event stream",value:e.eventBridgeLabel,badge:"success"===e.eventBridgeTone?"Live":"warning"===e.eventBridgeTone?"Degraded":"Unknown",surfaceTheme:t,dark:"dark"===t,compact:!0}),(0,s.jsx)(tQ,{label:"Last Gateway event",value:e.eventBridgeLastEventLabel,surfaceTheme:t,dark:"dark"===t,compact:!0})]}),e.lastNativeError?(0,s.jsx)("div",{className:"mt-3",children:(0,s.jsx)(t1,{title:"Last native error",value:e.lastNativeError,surfaceTheme:t})}):null,e.eventBridgeLastError?(0,s.jsx)("div",{className:"mt-3",children:(0,s.jsx)(t1,{title:"Last event stream error",value:e.eventBridgeLastError,surfaceTheme:t})}):null,e.recovery?(0,s.jsxs)("p",{className:(0,k.cn)("mt-3 text-xs leading-5","light"===t?"text-muted-foreground":"text-slate-400"),children:["Recovery: ",e.recovery]}):null,e.eventBridgeRecovery?(0,s.jsxs)("p",{className:(0,k.cn)("mt-2 text-xs leading-5","light"===t?"text-muted-foreground":"text-slate-400"),children:["Event stream recovery: ",e.eventBridgeRecovery]}):null]})}function t3(e,t){let a="inline-flex shrink-0 items-center rounded-full border px-2 py-1 text-[9px] uppercase tracking-[0.12em]";return"success"===e?(0,k.cn)(a,"light"===t?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/10 text-emerald-100"):"danger"===e?(0,k.cn)(a,"light"===t?"border-red-200 bg-red-50 text-red-700":"border-rose-300/20 bg-rose-300/10 text-rose-100"):"warning"===e?(0,k.cn)(a,"light"===t?"border-amber-200 bg-amber-50 text-amber-700":"border-amber-300/20 bg-amber-300/10 text-amber-100"):(0,k.cn)(a,"light"===t?"border-border bg-card text-muted-foreground":"border-white/[0.08] bg-[#101a2a]/92 text-slate-300")}function t4({title:e,detail:t,surfaceTheme:a}){return(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[18px] border border-dashed p-4 text-center","light"===a?"border-border bg-muted/45":"border-white/[0.08] bg-[#0d1624]/60"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-sm font-medium","light"===a?"text-foreground":"text-slate-100"),children:e}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-xs","light"===a?"text-muted-foreground":"text-slate-400"),children:t})]})}function t8({surfaceTheme:e,isCheckingForUpdates:t,isUpdateRegistryLoading:a,hasUpdateAvailable:r,currentVersion:n,latestVersion:i,updateInfo:l,updateError:o,lastCheckedAt:d,isUpdateRunning:u}){let p=t||u,m=t?"Checking registry":u?"Updating":r?"Update available":o?"Check failed":a?"Registry loading":"Up to date",x=r?"light"===e?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/10 text-emerald-100":o?"light"===e?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-300/20 bg-rose-300/10 text-rose-100":p||a?"light"===e?"border-amber-300 bg-amber-50 text-amber-700":"border-amber-300/20 bg-amber-300/10 text-amber-100":"light"===e?"border-slate-300 bg-white text-slate-600":"border-white/10 bg-[#0f1826] text-slate-300",h=t?"Refreshing OpenClaw update registry...":u?"Installing the selected OpenClaw update.":r?"A newer release is available and ready to install.":o?"OpenClaw returned an error while checking updates.":a?"OpenClaw has not reported a latest release yet.":"No newer release is currently available.";return(0,s.jsxs)("div",{className:(0,k.cn)("mt-3 rounded-[20px] border p-3.5",ap(e)),children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[10px] uppercase tracking-[0.18em]",am(e)),children:"Update status"}),(0,s.jsxs)("div",{className:"mt-1 flex items-center gap-2",children:[p?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin text-emerald-400"}):null,(0,s.jsx)("p",{className:(0,k.cn)("font-medium","light"===e?"text-foreground":"text-slate-100"),children:m}),(0,s.jsx)("span",{className:(0,k.cn)("rounded-full border px-2 py-0.5 text-[9px] uppercase tracking-[0.12em]",x),children:r?"Ready":p?"Working":o?"Attention":"Stable"})]})]}),(0,s.jsxs)("div",{className:"text-right",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[10px] uppercase tracking-[0.18em]",am(e)),children:"Last checked"}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-[11px]","light"===e?"text-muted-foreground":"text-slate-300"),children:d?new Date(d).toLocaleTimeString():"Not yet"})]})]}),(0,s.jsx)("div",{className:"mt-3 h-2 overflow-hidden rounded-full bg-black/10 dark:bg-white/10",children:(0,s.jsx)("div",{className:(0,k.cn)("h-full rounded-full transition-all",p?"w-1/2 animate-pulse bg-emerald-400/80":r?"w-full bg-emerald-500":o?"w-2/3 bg-rose-400":"w-5/6 bg-slate-400/70")})}),(0,s.jsxs)("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:[(0,s.jsx)(tQ,{label:"Current version",value:`v${n}`,surfaceTheme:e,dark:"dark"===e,compact:!0}),(0,s.jsx)(tQ,{label:"Latest available",value:i?`v${i}`:"Unknown",badge:r?"Ready":o?"Error":p||a?"Loading":"Stable",surfaceTheme:e,dark:"dark"===e,compact:!0})]}),(0,s.jsxs)("div",{className:(0,k.cn)("mt-3 rounded-[18px] border p-3 text-[11px] leading-5","light"===e?"border-border bg-card text-foreground":"border-white/[0.08] bg-[#0d1624] text-slate-300"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[10px] uppercase tracking-[0.18em]",am(e)),children:"Details"}),(0,s.jsx)("p",{className:"mt-1.5",children:h}),l?(0,s.jsx)("p",{className:"mt-1.5 opacity-90",children:l}):null,o?(0,s.jsx)("p",{className:(0,k.cn)("mt-1.5","light"===e?"text-rose-700":"text-rose-200"),children:o}):null,r?(0,s.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2 text-[10px] uppercase tracking-[0.16em]",children:[(0,s.jsx)("span",{className:(0,k.cn)("rounded-full border px-2 py-1",x),children:"Update ready"}),(0,s.jsx)("span",{className:(0,k.cn)("rounded-full border px-2 py-1",am(e)),children:"Review before install"})]}):null]})]})}async function t6(){let e=await fetch("/api/settings/gateway",{method:"GET",cache:"no-store"});if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||"Unable to check Gateway auth status.")}return(await e.json()).authStatus}function t9(e){return"supported"===e?"Supported":"unsupported"===e?"Fallback":"Unknown"}function t7(e){switch(e){case"compatible":return"Compatible";case"degraded":return"Degraded";case"incompatible":return"Incompatible";default:return"Unknown"}}function ae(e){return e?`v${e.replace(/^v/i,"")}`:"Unknown"}function at(e,t){let a=Array.from(new Set(e)),s=a.slice(0,t),r=a.length>s.length?` +${a.length-s.length}`:"";return`${s.join(", ")}${r}`}function aa(e,t){let a=e.slice(0,3).map(e=>(function(e,t){let[a,s]=e.split(/:\s*/,2),r=t?.[a],n=r?.label??((a||e).replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[._-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,e=>e.toUpperCase())||"Gateway operation");return!s&&r?.recovery&&"gateway-native"!==r.mode?`${n}: ${r.recovery}`:s?`${n} via ${s}`:n})(e,t)),s=e.length>a.length?` +${e.length-a.length}`:"";return`${e.length}: ${a.join(", ")}${s}`}function as(e,t){let a=(0,N.$7)(e);return a.length<=t?a:`${a.slice(0,Math.max(0,t-3))}...`}function ar(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function an(e){if(!e||e<=0)return"Gateway cooldown only";let t=Math.ceil(e/1e3);if(t<60)return`${t}s`;let a=Math.floor(t/60),s=t%60;return s?`${a}m ${s}s`:`${a}m`}function ai(){window.requestAnimationFrame(()=>{window.scrollTo({top:0,left:0,behavior:"auto"})})}function al(){return"openclaw"}function ao(e){return(0,k.cn)("text-[10px] uppercase tracking-[0.18em]","light"===e?"text-muted-foreground":"text-slate-400")}function ad(e,t){return(0,k.cn)("h-10 rounded-[16px] px-3 text-sm outline-none",t,"light"===e?"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 ac(e,t,a){return(0,k.cn)("h-9 rounded-full px-3 text-xs",t,"light"===e?"border-border bg-card text-secondary-foreground hover:bg-muted hover:text-foreground":"gateway-contrast"===a?"border-primary/15 bg-[#0f1826] text-foreground hover:bg-[#182538]":"border-border bg-[#121d2d] text-slate-200 hover:bg-[#182538]")}function au(e,t){return(0,k.cn)("h-9 rounded-full border px-3 text-xs transition-colors",t?"light"===e?"border-primary/35 bg-primary/10 text-primary":"border-primary/30 bg-primary/12 text-primary":"light"===e?"border-border bg-card text-muted-foreground hover:bg-muted hover:text-foreground":"border-border bg-[#121d2d] text-slate-200 hover:bg-[#182538]")}function ap(e){return"light"===e?"border-border bg-muted/45":"border-border bg-[#101a2a]/92"}function am(e){return"light"===e?"text-muted-foreground":"text-slate-400"}var ax=a(73294),ah=a(93479),ag=a(4606),ab=a(6246),af=a(55058),aw=a(96595),av=a(18027);function ay({open:e,task:t,snapshot:a,surfaceTheme:r,onOpenChange:l,onAccept:o,onContinue:d,onRetry:u,onDismiss:p,onOpenEvidence:m}){var x,h,g;let b,f,w,y,[j,C]=(0,i.useState)(null),S=(0,i.useMemo)(()=>{var e;return Array.isArray(e=t?.metadata.optimisticEvents)?e.filter(aC):[]},[t?.metadata.optimisticEvents]),{detail:A,loading:I,error:T}=(0,av.j)(t?.id??"task-review:none",e&&!!t,{dispatchId:t?.dispatchId,optimisticFeed:S}),O=function(e,t){if(!e||!t)return e??t;let a=Object.fromEntries(["reviewStatus","reviewAction","reviewedAt","reviewEvents"].map(e=>[e,t.metadata[e]]).filter(([,e])=>void 0!==e));return 0===Object.keys(a).length?e:{...e,metadata:{...e.metadata,...a}}}(A?.task,t),_=A?.integrity??null,R=O?a.workspaces.find(e=>e.id===O.workspaceId)??null:null,M=O?a.agents.find(e=>e.id===O.primaryAgentId)??null:null,E=[...A?.liveFeed??[]].reverse().find(e=>"assistant"===e.kind||"tool"===e.kind||"artifact"===e.kind)??null,P=O?(0,K.VL)(O,{hasLiveActivity:"running"===O.status||"queued"===O.status||O.liveRunCount>0,latestEvidenceAt:E?.timestamp??null}):null,L=O?(0,K.UF)(O):null,D=O?(0,K.kg)(O):null,U=O?(x=O,b="string"==typeof(h=_?.finalResponseText)?h.trim():"",f="string"==typeof x.metadata.finalResponseText?x.metadata.finalResponseText.trim():"",w="string"==typeof x.metadata.resultPreview?x.metadata.resultPreview.trim():"",y=x.subtitle.trim(),b||f||w||y):"",F=O?(g=O,g.mission?.trim()||g.title.trim()||"Untitled task"):"",G=_?.issues.find(e=>"partial-final-response"===e.id)??_?.issues[0]??null,z=_?.status==="verified"&&!G,V=P?(0,K.B4)(P):z?"verified":"needs review",J=P?(0,K.E2)(P):G?.detail||(z?"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."),H="light"===r,Z=null!==j,Y=async(e,t)=>{if(!j){C(e);try{await t()}finally{C(null)}}};return(0,s.jsx)(eV.lG,{open:e,onOpenChange:l,children:(0,s.jsxs)(eV.Cf,{className:(0,k.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",H?"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:H?"text-slate-500 hover:bg-slate-950/5 hover:text-slate-900":void 0,children:[(0,s.jsx)("div",{className:(0,k.cn)("border-b px-5 py-4",H?"border-slate-200/80 bg-slate-50/85":"border-white/[0.08] bg-white/[0.03]"),children:(0,s.jsxs)("div",{className:"flex items-start gap-3 pr-9",children:[(0,s.jsx)("div",{className:(0,k.cn)("mt-0.5 flex h-10 w-10 shrink-0 items-center justify-center rounded-[14px] border","accepted"===P||z?"border-emerald-300/30 bg-emerald-400/12 text-emerald-200":"border-amber-300/30 bg-amber-400/12 text-amber-100"),children:"accepted"===P||z?(0,s.jsx)(eW.A,{className:"h-4 w-4"}):(0,s.jsx)(W.A,{className:"h-4 w-4"})}),(0,s.jsxs)(eV.c7,{className:"min-w-0 flex-1 space-y-1",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)(B.E,{variant:"accepted"===P||z?"success":P?"muted":"warning",children:V}),O?.dispatchId?(0,s.jsxs)(B.E,{variant:"muted",children:["dispatch ",(0,N.m_)(O.dispatchId,8)]}):null]}),(0,s.jsx)(eV.L3,{className:(0,k.cn)("truncate text-lg",H&&"text-slate-950"),children:O?.title.trim()||"Task review"}),(0,s.jsxs)(eV.rr,{className:H?"text-slate-600":void 0,children:[R?.name||"Workspace",M?` \xb7 ${(0,N.CK)(M)}`:""]})]})]})}),(0,s.jsx)(aw.F,{className:"min-h-0 flex-1",children:(0,s.jsxs)("div",{className:"grid gap-4 p-5 lg:grid-cols-[minmax(0,1fr)_290px]",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)(aj,{icon:ah.A,title:"Captured output",tone:"accepted"===P||z?"success":"warning",isLight:H,children:U?(0,s.jsx)(q.G,{text:U,className:(0,k.cn)("text-[12.5px] leading-6",H?"text-slate-800":"text-slate-100")}):(0,s.jsx)("p",{className:(0,k.cn)("text-[12.5px] leading-6",H?"text-slate-500":"text-slate-400"),children:"No captured assistant output is available yet."})}),(0,s.jsxs)(aj,{icon:W.A,title:"Review reason",tone:"warning",isLight:H,children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[12.5px] leading-6",H?"text-slate-700":"text-slate-200"),children:J}),D?(0,s.jsxs)("p",{className:(0,k.cn)("mt-2 text-[11px]","text-slate-500"),children:["Last operator action: ",D]}):null]}),(0,s.jsx)(aj,{icon:ag.A,title:"Original prompt",isLight:H,children:(0,s.jsx)(q.G,{text:F||"No original prompt was captured.",className:(0,k.cn)("text-[12.5px] leading-6",H?"text-slate-700":"text-slate-200")})})]}),(0,s.jsxs)("aside",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[18px] border p-3",H?"border-slate-200 bg-white":"border-white/[0.08] bg-white/[0.035]"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[10px] uppercase tracking-[0.2em]","text-slate-500"),children:"Evidence"}),(0,s.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[(0,s.jsx)(aN,{label:"Runs",value:String(O?.runtimeCount??0),isLight:H}),(0,s.jsx)(aN,{label:"Turns",value:String(function(e){if(!e)return 0;let t=e.metadata.turnCount;return"number"==typeof t&&Number.isFinite(t)?t:e.runtimeCount}(O)),isLight:H}),(0,s.jsx)(aN,{label:"Files",value:String(O?.artifactCount??0),isLight:H}),(0,s.jsx)(aN,{label:"Issues",value:String(_?.issues.length??O?.warningCount??0),isLight:H})]}),I?(0,s.jsxs)("div",{className:(0,k.cn)("mt-3 flex items-center gap-2 text-[11px]",H?"text-slate-500":"text-slate-400"),children:[(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}),"Loading live evidence..."]}):null,T?(0,s.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:T}):null]}),(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[18px] border p-3",H?"border-slate-200 bg-white":"border-white/[0.08] bg-white/[0.035]"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[10px] uppercase tracking-[0.2em]","text-slate-500"),children:"Task state"}),(0,s.jsxs)("div",{className:"mt-3 space-y-2 text-[12px]",children:[(0,s.jsx)(ak,{label:"Status",value:O?.status??"unknown",isLight:H}),(0,s.jsx)(ak,{label:"Updated",value:O?.updatedAt?(0,N.fw)(O.updatedAt):"unknown",isLight:H}),(0,s.jsx)(ak,{label:"Reviewed",value:L?(0,N.fw)(Date.parse(L)):"not yet",isLight:H})]})]}),(0,s.jsxs)(v.$,{type:"button",variant:"secondary",className:(0,k.cn)("w-full justify-start gap-2",H&&"border-slate-200 bg-slate-50 text-slate-800 hover:bg-slate-100"),disabled:!O||Z,onClick:()=>{O&&m(O,"output")},children:[(0,s.jsx)($.A,{className:"h-4 w-4"}),"Open evidence"]})]})]})}),(0,s.jsxs)("div",{className:(0,k.cn)("flex flex-col gap-2 border-t px-5 py-4 sm:flex-row sm:items-center sm:justify-end",H?"border-slate-200 bg-slate-50/85":"border-white/[0.08] bg-white/[0.03]"),children:[(0,s.jsxs)(v.$,{type:"button",variant:"ghost",className:(0,k.cn)("gap-2",H&&"text-slate-700 hover:bg-slate-950/5 hover:text-slate-950"),disabled:!O||Z,onClick:()=>void Y("dismiss",()=>{if(O)return p(O)}),children:["dismiss"===j?(0,s.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(ab.A,{className:"h-4 w-4"}),"dismiss"===j?"Dismissing...":"Dismiss"]}),(0,s.jsxs)(v.$,{type:"button",variant:"secondary",className:(0,k.cn)("gap-2",H&&"border-slate-200 bg-white text-slate-800 hover:bg-slate-100"),disabled:!O||Z,onClick:()=>void Y("retry",()=>{if(O)return u(O)}),children:["retry"===j?(0,s.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(n.A,{className:"h-4 w-4"}),"retry"===j?"Preparing...":"Retry"]}),(0,s.jsxs)(v.$,{type:"button",variant:"secondary",className:(0,k.cn)("gap-2",H&&"border-slate-200 bg-white text-slate-800 hover:bg-slate-100"),disabled:!O||Z,onClick:()=>void Y("continue",()=>{if(O)return d(O,U)}),children:["continue"===j?(0,s.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(af.A,{className:"h-4 w-4"}),"continue"===j?"Continuing...":"Continue task"]}),(0,s.jsxs)(v.$,{type:"button",className:"gap-2 bg-emerald-400 text-slate-950 shadow-emerald-400/20 hover:bg-emerald-300",disabled:!O||Z,onClick:()=>void Y("accept",()=>{if(O)return o(O)}),children:["accept"===j?(0,s.jsx)(c.A,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(eW.A,{className:"h-4 w-4"}),"accept"===j?"Accepting...":"Accept result"]})]})]})})}function aj({icon:e,title:t,tone:a="neutral",isLight:r,children:n}){return(0,s.jsxs)("section",{className:(0,k.cn)("rounded-[18px] border p-3.5",r?"border-slate-200 bg-white":"border-white/[0.08] bg-white/[0.035]"),children:[(0,s.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,s.jsx)("div",{className:(0,k.cn)("flex h-7 w-7 items-center justify-center rounded-[10px] border","success"===a?"border-emerald-300/30 bg-emerald-400/12 text-emerald-200":"warning"===a?"border-amber-300/30 bg-amber-400/12 text-amber-100":r?"border-slate-200 bg-slate-50 text-slate-600":"border-white/[0.08] bg-white/[0.05] text-slate-300"),children:(0,s.jsx)(e,{className:"h-3.5 w-3.5"})}),(0,s.jsx)("p",{className:(0,k.cn)("text-[10px] uppercase tracking-[0.2em]","text-slate-500"),children:t})]}),n]})}function aN({label:e,value:t,isLight:a}){return(0,s.jsxs)("div",{className:(0,k.cn)("rounded-[12px] border px-3 py-2",a?"border-slate-200 bg-slate-50":"border-white/[0.08] bg-white/[0.04]"),children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[9px] uppercase tracking-[0.16em]","text-slate-500"),children:e}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 font-mono text-[13px]",a?"text-slate-900":"text-white"),children:t})]})}function ak({label:e,value:t,isLight:a}){return(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("span",{className:"text-slate-500",children:e}),(0,s.jsx)("span",{className:(0,k.cn)("min-w-0 truncate text-right",a?"text-slate-900":"text-slate-100"),children:t})]})}function aC(e){return"object"==typeof e&&null!==e&&"string"==typeof e.id&&"string"==typeof e.kind&&"string"==typeof e.timestamp&&"string"==typeof e.title&&"string"==typeof e.detail}var aS=a(68903);function aA(e,t){let a=e.trim();return a.length<=t?a:`${a.slice(0,t).trimEnd()}
5
5
 
6
- [truncated for task continuation]`}var aI=a(38958),aT=a(47322),aO=a(93004),aR=a(58434),a$=a(16611),aM=a(47936),a_=a(10597),aE=a(33899),aP=a(99261),aL=a(94837),aD=a(38641),aU=a(73875);function aF({snapshot:e,surfaceTheme:t,connectionState:a,isCheckingForUpdates:r,updateRunState:l,lastCheckedAt:o,onCheckForUpdates:d,onOpenSetupWizard:u,onOpenUpdateDialog:p}){let[m,x]=(0,i.useState)(null),[g,b]=(0,i.useState)(null),[f,w]=(0,i.useState)(!1),[y,j]=(0,i.useState)(!1),N="running"===l,C=(0,eY.X2)(e),S=!!(e.diagnostics.updateAvailable&&e.diagnostics.latestVersion),A=!!(e.diagnostics.version&&!e.diagnostics.latestVersion&&!e.diagnostics.updateError),I=r?"Checking update registry...":S?`Latest v${e.diagnostics.latestVersion}`:e.diagnostics.updateError?"Check failed":A?e.diagnostics.updateInfo?.trim()||"Registry status is still loading.":"Up to date",T=e.diagnostics.modelReadiness.resolvedDefaultModel||e.diagnostics.modelReadiness.defaultModel||"Not selected",O=function(e){let{diagnostics:t}=e,a="remote"===t.bindMode||t.configuredGatewayUrl?"Remote":"Local",s=t.rpcOk||t.loaded?"Online":"Offline";return`${a} / ${s}`}(e),R=tq(e.diagnostics.transport,a),$=!!(m&&!m.native.ok&&("auth"===m.native.kind||"scope-limited"===m.native.kind)),M=(0,i.useCallback)(async()=>{w(!0),b(null);try{x(await az())}catch(e){b(e instanceof Error?e.message:"Unable to check Gateway auth status.")}finally{w(!1)}},[]);(0,i.useEffect)(()=>{M()},[M]);let _=async()=>{j(!0),b(null);try{let e=await fetch("/api/settings/gateway",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"repairDeviceAccess"})});if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||"Gateway access could not be repaired.")}let t=await e.json();x(t.authStatus)}catch(e){b(e instanceof Error?e.message:"Unable to repair Gateway access.")}finally{j(!1)}};return(0,s.jsxs)("div",{role:"menu","aria-label":"System menu",className:(0,k.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"===t?"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,s.jsxs)("div",{className:(0,k.cn)("rounded-[20px] border p-3.5",aq(t)),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2.5",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[9px] uppercase tracking-[0.22em]",aJ(t)),children:"OpenClaw"}),(0,s.jsxs)("div",{className:"mt-0.5 flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:"font-display text-[1rem]",children:aV(e.diagnostics.health)}),(0,s.jsx)(aG,{health:e.diagnostics.health,surfaceTheme:t})]})]}),(0,s.jsxs)("div",{className:"text-right",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[9px] uppercase tracking-[0.2em]",aJ(t)),children:"Version"}),(0,s.jsxs)("p",{className:"mt-0.5 font-mono text-[11px]",children:["v",e.diagnostics.version||"unknown"]})]})]}),(0,s.jsx)("div",{className:(0,k.cn)("mt-3 rounded-[18px] border p-3","light"===t?"border-[#eadbcf] bg-[#f9f1e8]/80":"border-white/[0.08] bg-[#101a2a]/92"),children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2.5",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[9px] uppercase tracking-[0.18em]",aJ(t)),children:"Updates"}),(0,s.jsx)("p",{className:"mt-0.5 text-[13px]",children:I})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)(v.$,{type:"button",size:"sm",variant:"secondary",onClick:()=>void d(),disabled:r||N,className:aK(t),children:[r?(0,s.jsx)(c.A,{className:"h-3 w-3 animate-spin"}):(0,s.jsx)(n.A,{className:"h-3 w-3"}),r?"Checking...":"Check"]}),S?(0,s.jsxs)(v.$,{type:"button",size:"sm",onClick:p,disabled:N,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,s.jsx)(aD.A,{className:"h-3 w-3"}),"Update"]}):null]})]})})]}),(0,s.jsxs)("div",{className:(0,k.cn)("mt-2 rounded-[16px] border px-3 py-2","light"===t?"border-[#e6d7c9] bg-white text-[#6b5546]":"border-white/[0.08] bg-[#0f1826] text-slate-300"),children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em]",children:r?"Checking":"Registry"}),(0,s.jsx)("p",{className:"mt-1 text-[11px] leading-4",children:r?"Refreshing OpenClaw update registry...":e.diagnostics.updateInfo?.trim()||(o?`Last checked ${new Date(o).toLocaleTimeString()}.`:"No registry check run yet.")})]}),(0,s.jsxs)("div",{className:"mt-2.5 grid gap-1.5",children:[(0,s.jsx)(aW,{surfaceTheme:t,icon:(0,s.jsx)(tW.A,{className:"h-3.5 w-3.5"}),label:"Gateway",value:R.statusLabel,detail:`${O} / ${R.gatewayModeLabel}`}),(0,s.jsx)(aW,{surfaceTheme:t,icon:(0,s.jsx)(h.A,{className:"h-3.5 w-3.5"}),label:"Default model",value:T,wrapValue:!0,action:(0,s.jsx)(v.$,{asChild:!0,size:"sm",variant:"secondary",className:aK(t),children:(0,s.jsxs)(t_(),{href:"/settings#models",children:[(0,s.jsx)(aU.A,{className:"h-3 w-3"}),"Models"]})})}),(0,s.jsx)(aW,{surfaceTheme:t,icon:C?(0,s.jsx)(eW.A,{className:"h-3.5 w-3.5"}):(0,s.jsx)(W.A,{className:"h-3.5 w-3.5"}),label:"Setup",value:C?"Ready":"Needs setup",action:(0,s.jsx)(v.$,{type:"button",size:"sm",variant:"secondary",onClick:()=>u(C?"system":void 0),className:aK(t),children:"Open"})})]}),$||g?(0,s.jsxs)("div",{className:(0,k.cn)("mt-2.5 rounded-[18px] border p-2.5","light"===t?"border-amber-300/70 bg-amber-50/80 text-amber-950":"border-amber-300/20 bg-amber-300/10 text-amber-100"),children:[(0,s.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,s.jsx)(tV.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"text-[13px] font-medium",children:"Gateway auth needs attention"}),(0,s.jsx)("p",{className:"mt-0.5 line-clamp-2 text-[11px] leading-4 opacity-80",children:g||m?.native.issue||"Native Gateway auth is not ready. Open Settings to repair access."})]})]}),(0,s.jsxs)("div",{className:"mt-2.5 flex items-center gap-1.5",children:[(0,s.jsxs)(v.$,{type:"button",size:"sm",variant:"secondary",onClick:()=>void M(),disabled:f||y,className:aK(t),children:[f?(0,s.jsx)(c.A,{className:"h-3 w-3 animate-spin"}):null,"Test"]}),m?.native.kind==="scope-limited"?(0,s.jsxs)(v.$,{type:"button",size:"sm",onClick:()=>void _(),disabled:f||y,className:"rounded-full bg-emerald-600 px-2.5 text-[11px] text-white hover:bg-emerald-500",children:[y?(0,s.jsx)(c.A,{className:"h-3 w-3 animate-spin"}):null,"Repair"]}):null,(0,s.jsx)(v.$,{asChild:!0,size:"sm",variant:"secondary",className:aK(t),children:(0,s.jsx)(t_(),{href:"/settings#gateway",children:"Open settings"})})]})]}):null,(0,s.jsxs)("div",{className:(0,k.cn)("mt-2.5 grid grid-cols-2 gap-1.5 border-t pt-2.5","light"===t?"border-[#e6d7c9]":"border-white/[0.08]"),children:[(0,s.jsx)(v.$,{asChild:!0,variant:"secondary",className:aB(t),children:(0,s.jsxs)(t_(),{href:"/settings",children:[(0,s.jsx)(tF.A,{className:"h-3.5 w-3.5"}),"Control Center"]})}),(0,s.jsx)(v.$,{asChild:!0,variant:"secondary",className:aB(t),children:(0,s.jsxs)(t_(),{href:"/settings#diagnostics",children:[(0,s.jsx)(W.A,{className:"h-3.5 w-3.5"}),"Diagnostics"]})})]})]})}function aG({health:e,surfaceTheme:t}){return(0,s.jsxs)("span",{className:(0,k.cn)("inline-flex items-center gap-1.5 rounded-full border px-2 py-1 text-[10px] uppercase tracking-[0.18em]","healthy"===e?"light"===t?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-400/30 bg-emerald-400/10 text-emerald-200":"degraded"===e?"light"===t?"border-amber-300 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-100":"light"===t?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-100"),children:[(0,s.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}),aV(e)]})}function aW({surfaceTheme:e,icon:t,label:a,value:r,detail:n,action:i,wrapValue:l=!1}){return(0,s.jsxs)("div",{className:(0,k.cn)("flex items-center gap-3 rounded-[20px] border p-3",aq(e)),children:[(0,s.jsx)("span",{className:(0,k.cn)("flex h-9 w-9 shrink-0 items-center justify-center rounded-full border","light"===e?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-cyan-300/15 bg-cyan-300/10 text-cyan-200"),children:t}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[10px] uppercase tracking-[0.18em]",aJ(e)),children:a}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-sm font-medium",l?"break-words leading-4":"truncate"),title:r,children:r}),n?(0,s.jsx)("p",{className:(0,k.cn)("mt-0.5",l?"break-words text-[11px] leading-4":"truncate text-xs",aJ(e)),children:n}):null]}),i?(0,s.jsx)("div",{className:"shrink-0",children:i}):null]})}async function az(){let e=await fetch("/api/settings/gateway",{method:"GET",cache:"no-store"});if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||"Unable to check Gateway auth status.")}return(await e.json()).authStatus}function aV(e){switch(e){case"healthy":return"Online";case"degraded":return"Degraded";default:return"Offline"}}function aq(e){return"light"===e?"border-[#e5d7c9] bg-[#fffaf4]/86 shadow-[0_18px_48px_rgba(119,91,70,0.08)]":"border-white/[0.08] bg-[#0d1624]/96"}function aJ(e){return"light"===e?"text-[#8c7564]":"text-slate-400"}function aK(e){return(0,k.cn)("h-8 rounded-full px-3 text-xs","light"===e?"border-[#dcc9bb] bg-[#fffaf3] text-[#5d493b] hover:bg-[#f3e7dc]":"border-white/10 bg-[#121d2d] text-slate-200 hover:bg-[#182538]")}function aB(e){return(0,k.cn)("h-10 rounded-full text-xs","light"===e?"border-[#dcc9bb] bg-[#fffaf3] text-[#4d3c32] hover:bg-[#f3e7dc]":"border-white/10 bg-[#121d2d] text-slate-200 hover:bg-[#182538]")}function aH(e,t){switch(e){case"healthy":return"light"===t?"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"===t?"border-amber-300/90 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-200";default:return"light"===t?"border-rose-300/80 bg-rose-50 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200"}}function aZ(e){switch(e){case"healthy":return"bg-emerald-400";case"degraded":return"bg-amber-300";default:return"bg-rose-300"}}function aY({surfaceTheme:e}){return(0,s.jsxs)("div",{className:(0,k.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"===e?"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,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:(0,k.cn)("inline-flex h-7 w-7 items-center justify-center overflow-hidden rounded-[8px] border","light"===e?"border-[#d1bcad] bg-[#f5ece4]":"border-white/[0.08] bg-white/[0.03]"),children:(0,s.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,s.jsx)("source",{src:"/assets/logo.webm",type:"video/webm"})})}),(0,s.jsx)("p",{className:(0,k.cn)("text-[10px] tracking-[0.18em]","light"===e?"text-[#8a7261]":"text-slate-500"),children:"AgentOS"})]}),(0,s.jsx)("span",{"aria-hidden":"true",className:(0,k.cn)("h-4 w-px","light"===e?"bg-[#cdb7a8]/80":"bg-white/[0.08]")}),(0,s.jsx)("h2",{className:(0,k.cn)("font-display text-[0.88rem]","light"===e?"text-[#816958]/80":"text-slate-400/75"),children:"Control Plane"})]})}function aX({settingsRef:e,isSettingsOpen:t,onToggleTheme:a,onToggleSettings:r,...n}){var i,l,o;let{snapshot:d,surfaceTheme:c}=n,{onOpenSetupWizard:u}=n,p=d.diagnostics.health,m="offline"===p,x=function(e){switch(e){case"healthy":return"Online";case"degraded":return"Degraded";default:return"Offline"}}(p),h=(i=c,(0,k.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"===i?"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]")),g=(l=c,(0,k.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"===l?"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]")),b=(o=c,(0,k.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"===o?"translate-x-7 bg-[#c8946f] text-white":"translate-x-0 bg-cyan-300 text-slate-950"));return(0,s.jsx)("div",{className:"flex w-full items-center px-0 pt-6",children:(0,s.jsxs)("div",{ref:e,className:"pointer-events-auto relative ml-auto",children:[(0,s.jsxs)("div",{className:(0,k.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"===c?"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,s.jsxs)("div",{className:"flex items-baseline gap-[3px]",children:[(0,s.jsx)("span",{className:(0,k.cn)("text-[10px] uppercase tracking-[0.3em]","light"===c?"text-[#8a7261]":"text-slate-500"),children:"OPENCLAW"}),(0,s.jsxs)("span",{className:(0,k.cn)("font-mono text-[8px] tracking-[0.04em]","light"===c?"text-[#6f5a4b]/85":"text-slate-300/80"),children:["v",d.diagnostics.version||"unknown"]})]}),m?(0,s.jsxs)(f.P.button,{type:"button",onClick:()=>u(),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,k.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",aH(p,c),"light"===c?"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,s.jsx)(f.P.span,{"aria-hidden":"true",className:(0,k.cn)("pointer-events-none absolute inset-0 rounded-full","light"===c?"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,s.jsx)("span",{"aria-hidden":"true",className:(0,k.cn)("relative z-10 h-2 w-2 rounded-full shadow-[0_0_12px_currentColor]",aZ(p))}),(0,s.jsxs)("span",{className:"relative z-10 inline-flex items-center gap-1.5",children:[(0,s.jsx)("span",{children:x}),(0,s.jsx)("span",{className:(0,k.cn)("rounded-full border px-1.5 py-0.5 text-[7px] uppercase tracking-[0.18em]","light"===c?"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,s.jsx)(aE.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,s.jsxs)("span",{className:(0,k.cn)("inline-flex items-center gap-2 rounded-full border px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.22em]",aH(p,c)),children:[(0,s.jsx)("span",{"aria-hidden":"true",className:(0,k.cn)("h-2 w-2 rounded-full shadow-[0_0_12px_currentColor]",aZ(p))}),x]}),(0,s.jsx)("button",{type:"button",role:"switch","aria-label":"light"===c?"Switch to dark theme":"Switch to light theme","aria-checked":"light"===c,onClick:a,className:g,children:(0,s.jsx)("span",{className:b,children:"light"===c?(0,s.jsx)(aP.A,{className:"h-3 w-3"}):(0,s.jsx)(aL.A,{className:"h-3 w-3"})})}),(0,s.jsx)("button",{type:"button","aria-label":"Open settings","aria-expanded":t,"aria-haspopup":"menu",onClick:r,className:h,children:(0,s.jsx)(tF.A,{className:"h-3.5 w-3.5"})})]}),t?(0,s.jsx)(aF,{...n}):null]})})}var aQ=a(77402),a0=a(833);let a1=(0,a$.default)(()=>Promise.all([a.e(5751),a.e(9708),a.e(213),a.e(2125),a.e(7197)]).then(a.bind(a,67197)).then(e=>e.MissionCanvas),{loadableGenerated:{webpack:()=>[67197]},ssr:!1,loading:()=>(0,s.jsx)("div",{className:"h-full w-full"})}),a2=[4e3,8e3,15e3,3e4,45e3,6e4],a5=[0,800,1200,1800,2600,3600,5e3,6500],a3=void 0===globalThis.window?i.useEffect:i.useLayoutEffect,a8={phase:"idle",previousModelId:null,nextModelId:null,message:null};function a4(e){return new Promise(t=>{setTimeout(t,e)})}function a6({initialSnapshot:e,mode:t="mission"}){let{snapshot:a,connectionState:c,refresh:u,refreshSnapshot:p,setSnapshot:m}=(0,aM.v)(e),[x,h]=(0,i.useState)(e.workspaces[0]?.id??null),[g,b]=(0,i.useState)(e.workspaces[0]?.id??null),[f,w]=(0,i.useState)(null),[v,y]=(0,i.useState)(null),[C,A]=(0,i.useState)(null),[I,T]=(0,i.useState)(!1),[O,R]=(0,i.useState)(!1),[$,M]=(0,i.useState)(0),[_,E]=(0,i.useState)("overview"),[P,L]=(0,i.useState)(null),[D,U]=(0,i.useState)(null),[F,G]=(0,i.useState)(null),[W,z]=(0,i.useState)([]),[V,q]=(0,i.useState)(null),{surfaceTheme:J,setSurfaceTheme:B,hiddenRuntimeIds:H,setHiddenRuntimeIds:Z,hiddenTaskKeys:Y,setHiddenTaskKeys:Q,lockedTaskKeys:ee,setLockedTaskKeys:et,safeHiddenRuntimeIds:ea,safeHiddenTaskKeys:es,safeLockedTaskKeys:er,clearPreferenceState:en}=(0,aS.$)();(0,i.useEffect)(()=>{let e=document.documentElement,t=e.classList.contains("dark"),a=e.style.colorScheme;return e.classList.toggle("dark","light"!==J),e.style.colorScheme="light"===J?"light":"dark",()=>{e.classList.toggle("dark",t),e.style.colorScheme=a}},[J]);let[ei,el]=(0,i.useState)(null),[eo,ed]=(0,i.useState)(null),[ec,eu]=(0,i.useState)(null),[ep,em]=(0,i.useState)("idle"),[ex,eh]=(0,i.useState)(null),eg=(0,i.useRef)(new Map),[eb,ef]=(0,i.useState)(null),[ew,ev]=(0,i.useState)([]),[ey,ej]=(0,i.useState)({}),[eN,ek]=(0,i.useState)(!1),[eC,eS]=(0,i.useState)(!1),[eA,eI]=(0,i.useState)(!1),[eT,eO]=(0,i.useState)(!1),[eR,e$]=(0,i.useState)(null),[eM,e_]=(0,i.useState)("idle"),[eE,eP]=(0,i.useState)(null),[eL,eD]=(0,i.useState)(null),[eU,eF]=(0,i.useState)("idle"),[eG,eW]=(0,i.useState)(null),[ez,eV]=(0,i.useState)(null),[eJ,eB]=(0,i.useState)(null),[eH,eZ]=(0,i.useState)(""),[eX,e1]=(0,i.useState)(""),[e2,e5]=(0,i.useState)("idle"),[e3,e8]=(0,i.useState)(null),[e4,e6]=(0,i.useState)(null),e9=(0,i.useRef)(null),te=(0,i.useRef)(new Map),[tt,ta]=(0,i.useState)(()=>(0,eq.QO)(e)),[ts,tr]=(0,i.useState)(()=>(0,eq.hZ)(e)),[tn,ti]=(0,i.useState)(()=>e.diagnostics.openClawBinarySelection),[tl,to]=(0,i.useState)(!1),[td,tc]=(0,i.useState)(!1),[tu,tp]=(0,i.useState)(!1),[tm,tx]=(0,i.useState)(!1),[th,tg]=(0,i.useState)("idle"),[tb,tf]=(0,i.useState)(null),[tw,tv]=(0,i.useState)(null),[ty,tj]=(0,i.useState)(""),[tN,tk]=(0,i.useState)(null),[tS,tA]=(0,i.useState)("idle"),[tI,tT]=(0,i.useState)(null),[tR,t$]=(0,i.useState)(null),[tM,t_]=(0,i.useState)(null),[tE,tP]=(0,i.useState)(""),[tL,tD]=(0,i.useState)(null),[tU,tF]=(0,i.useState)(null),[tG,tW]=(0,i.useState)("system"),[tz,tV]=(0,i.useState)(""),[tq,tJ]=(0,i.useState)([]),[tK,tB]=(0,i.useState)("idle"),[tH,tZ]=(0,i.useState)(null),[tX,tQ]=(0,i.useState)(null),[t0,t1]=(0,i.useState)(null),[t2,t5]=(0,i.useState)(""),[t3,t8]=(0,i.useState)(null),[t4,t6]=(0,i.useState)(null),[t9,t7]=(0,i.useState)(a8),[ae,at]=(0,i.useState)(!1),[aa,as]=(0,i.useState)(!1),[ar,an]=(0,i.useState)(!1),[ai,al]=(0,i.useState)(!1),[ao,ad]=(0,i.useState)(!1),[ac,au]=(0,i.useState)(null),[ap,am]=(0,i.useState)(null),[ah,ag]=(0,i.useState)(!1),[ab,af]=(0,i.useState)("basic"),[aw,av]=(0,i.useState)(null),[aj,aN]=(0,i.useState)(!1),[ak,aC]=(0,i.useState)(null),[a$,aE]=(0,i.useState)([]),[aP,aL]=(0,i.useState)([]),[aD,aU]=(0,i.useState)(null),[aF,aG]=(0,i.useState)(!1),[aW,az]=(0,i.useState)(null),[aV,aq]=(0,i.useState)(null),[aJ,aK]=(0,i.useState)(null),[aB,aH]=(0,i.useState)(null),aZ=(0,i.useRef)(null),a9=(0,i.useRef)(null),a7=(0,i.useRef)(null),se=(0,i.useRef)(null),st=(0,i.useRef)(0),sa=(0,i.useRef)(null),ss=(0,i.useCallback)((e,t="overview",a=null)=>{b(e),E(t),w(a),L(t=>t?.taskId===e?t:null)},[]),{taskReviewRequest:sr,taskReviewState:sn,clearTaskReviewState:si,openTaskReview:sl,closeTaskReview:so,acceptTaskReview:sd,dismissTaskReview:sc,continueTaskReview:su,retryTaskReview:sp,openTaskReviewEvidence:sm}=function({selectNode:e,setIsInspectorOpen:t,setComposeIntent:a,setComposerTargetAgentId:s,setIsComposerActive:r,refreshSnapshot:n}){let[l,o]=(0,i.useState)(null),[d,c]=(0,i.useState)({}),[u,p]=(0,i.useState)(!1);(0,i.useEffect)(()=>{let e=globalThis.localStorage?.getItem(K.hy);c((0,K.Kf)(e??null)),p(!0)},[]),(0,i.useEffect)(()=>{u&&globalThis.localStorage?.setItem(K.hy,JSON.stringify(d))},[u,d]);let m=(0,i.useCallback)(t=>{e(t.id,"output"),o({requestId:`task-review:${t.id}:${Date.now()}`,taskId:t.id,taskKey:(0,K.HR)(t),fallbackTask:t})},[e]),x=(0,i.useCallback)((e,t,a)=>{let s=(0,K.ss)(e,t,a);return c(e=>({...e,[s.taskKey]:s})),s},[]),h=(0,i.useCallback)(()=>{o(null)},[]),g=(0,i.useCallback)(e=>{x(e,"accepted","Accepted result"),h(),j.o.success("Task result accepted.",{description:"The review warning is marked as handled for this workspace."})},[h,x]),b=(0,i.useCallback)(e=>{x(e,"dismissed","Dismissed review"),h(),j.o.message("Task review dismissed.",{description:"The warning remains available in the task evidence."})},[h,x]),f=(0,i.useCallback)(async(a,s)=>{let r,i,l=(r=aA((0,eq.sL)(a),3200),["Continue this task from the last captured output. Finish the remaining work and verify the result.","","Original mission:",r,(i=aA(s,7600))?"":null,i?"Last captured output:":null,i||null].filter(e=>"string"==typeof e).join("\n"));try{let s=await fetch(`/api/tasks/${encodeURIComponent(a.id)}/control`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"continue",message:l,dispatchId:a.dispatchId??null})}),r=await s.json().catch(()=>null);if(!s.ok)throw Error(r?.error||"Unable to continue this task.");x(a,"continued","Accepted continuation"),e(a.id,"output"),t(!0),h(),n({force:!0}),j.o.success("Task continuation accepted.",{description:"OpenClaw accepted the continuation. AgentOS will track the follow-up until live output arrives."})}catch(e){j.o.error("Task continuation failed.",{description:e instanceof Error?e.message:"Unable to continue this task."})}},[h,x,n,e,t]),w=(0,i.useCallback)(e=>{x(e,"retried","Drafted retry"),a({id:`review-retry:${e.id}:${Date.now()}`,mission:["Retry this task from the original mission. Do not assume the previous stalled runtime completed.\n\nOriginal mission:",(0,eq.sL)(e)].join("\n"),agentId:e.primaryAgentId,sourceKind:"reply",sourceLabel:e.title.trim()||"Task review"}),s(e.primaryAgentId??null),r(!0),h(),j.o.success("Retry draft prepared.",{description:"Review the mission input, then send it when ready."})},[h,x,a,s,r]),v=(0,i.useCallback)((a,s)=>{e(a.id,s),t(!0),h()},[h,e,t]);return{taskReviewRequest:l,taskReviewState:d,clearTaskReviewState:()=>{c({})},openTaskReview:m,closeTaskReview:h,acceptTaskReview:g,dismissTaskReview:b,continueTaskReview:f,retryTaskReview:w,openTaskReviewEvidence:v}}({selectNode:ss,setIsInspectorOpen:eS,setComposeIntent:e=>{R(!0),q(e)},setComposerTargetAgentId:A,setIsComposerActive:T,refreshSnapshot:p}),sx=eC&&"chat"===_?g:null,sh=(0,i.useMemo)(()=>{let e=(0,eq.Uh)(a,W);return(0,K.wg)(e,sn)},[a,W,sn]),sg=(0,i.useMemo)(()=>sr?sh.tasks.find(e=>e.id===sr.taskId||(0,K.HR)(e)===sr.taskKey)??sr.fallbackTask:null,[sr,sh.tasks]),sb=(0,i.useCallback)((e,t={})=>{t.markPending&&e&&aK(e),y(null),A(null),h(e),ss(e)},[ss]),sf=(0,i.useRef)(null),sw=(0,i.useRef)(!1),sv=(0,i.useRef)(!1),sy=a.runtimes.filter(e=>("running"===e.status||"queued"===e.status)&&!(0,eq.MG)(e)).length,sj=!ai&&(0,eY.h6)(a),sN=!ai&&(0,eY.X2)(a),sk=e0(tG,sj||"success"===tS),sC=(0,eq.Id)(a),sS=(0,eq.R)(a),sA=(0,eq.iy)(a),sI=sy>0||W.length>0,sT=(0,eq.EE)(a,{hasSeenMissionReady:ao,modelSwitchSucceeded:"success"===t9.phase}),sO=sj&&sN&&!sC,sR=!sI&&(!ae||sO)&&(!sN||sO)&&!sT||ar||aa,s$=sh.tasks.filter(e=>!x||(0,a_.kO)(e,sh.agents)===x).filter(e=>(0,eq.Zc)(e,ea,es,er)).length,sM=(0,i.useCallback)(e=>{let t=sh.tasks.filter(t=>(0,a_.kO)(t,sh.agents)===e).filter(e=>!er.includes(e.key));if(0===t.length)return;let a=t.every(e=>(0,eq.Zc)(e,ea,es,er)),s=new Set(t.map(e=>e.key)),r=new Set(t.flatMap(e=>e.runtimeIds));if(a){Q(e=>e.filter(e=>!s.has(e))),Z(e=>e.filter(e=>!r.has(e)));return}Q(e=>Array.from(new Set([...e,...s]))),Z(e=>Array.from(new Set([...e,...r])))},[sh.agents,sh.tasks,ea,es,er,Z,Q]),s_=(0,i.useCallback)(e=>{let t=sh.agents.find(t=>t.id===e);t&&(y(t=>t===e?null:e),h(t.workspaceId),ss(e))},[ss,sh.agents]),sE=(0,i.useCallback)((e,t)=>{let a=sh.agents.find(t=>t.id===e);a&&(h(a.workspaceId),eS(!0),ss(a.id,"overview",t))},[ss,sh.agents]),sP=(0,i.useCallback)((e,t)=>{let a=sh.agents.find(t=>t.id===e);a&&(h(a.workspaceId),ss(a.id),ed({requestId:`capabilities:${e}:${t}:${Date.now()}`,agentId:e,focus:t}))},[ss,sh.agents]),sL=(0,i.useCallback)(e=>{let t=sh.agents.find(t=>t.id===e);t&&(h(t.workspaceId),ss(t.id),aq({requestId:`model:${e}:${Date.now()}`,agentId:e}))},[ss,sh.agents]),sD=(0,i.useCallback)(e=>{ev(t=>t.filter(t=>t.id!==e)),ef(e),e9.current&&clearTimeout(e9.current),e9.current=setTimeout(()=>{e9.current=null,ef(null)},2400)},[]),sU=(0,i.useCallback)(e=>{if(h(e.workspaceId),ss(e.id),ev(t=>[...t.filter(t=>t.id!==e.id),e]),e.warning){ej(t=>({...t,[e.id]:e.warning??""}));let t=te.current.get(e.id);t&&clearTimeout(t);let a=setTimeout(()=>{te.current.delete(e.id),ej(t=>{let a={...t};return delete a[e.id],a})},12e3);te.current.set(e.id,a)}},[ss]);(0,i.useEffect)(()=>{if(0===ew.length)return;let e=new Set(sh.agents.map(e=>e.id));ew.some(t=>e.has(t.id))&&ev(t=>t.filter(t=>!e.has(t.id)))},[ew,sh.agents]),(0,i.useEffect)(()=>{let e=te.current;return()=>{e.forEach(e=>clearTimeout(e)),e.clear()}},[]);let sF=(0,i.useCallback)(e=>{e||aq(null)},[]),sG=(0,i.useCallback)(e=>{e||ed(null)},[]),sW=(0,i.useCallback)(e=>{if(!v)return;let t=sh.agents.find(t=>t.id===e);t&&(v!==e||x!==t.workspaceId||g!==e)&&(y(e),h(t.workspaceId),ss(e))},[x,v,ss,g,sh.agents]),sz=(0,i.useCallback)(e=>{let t=sh.agents.find(t=>t.id===e);t&&(h(t.workspaceId),A(t.id),R(!0),T(!0),ss(t.id))},[ss,sh.agents]),sV=(0,i.useCallback)(()=>{sw.current=!0},[]),sq=(0,i.useCallback)(e=>{if(e){sv.current=!1,R(!0),T(!0);return}if(sw.current){sv.current=!0;return}sv.current=!1,R(!1),T(!1)},[]),sJ=(0,i.useCallback)(()=>{y(null),ss(x??sh.workspaces[0]?.id??null)},[x,ss,sh.workspaces]);(0,i.useEffect)(()=>{let e=()=>{!sw.current||(sw.current=!1,sv.current&&(sv.current=!1,R(!1),T(!1),M(e=>e+1)))};return window.addEventListener("pointerup",e),window.addEventListener("pointercancel",e),()=>{window.removeEventListener("pointerup",e),window.removeEventListener("pointercancel",e)}},[]),(0,i.useEffect)(()=>()=>{st.current+=1,e9.current&&(clearTimeout(e9.current),e9.current=null)},[]);let sK=(0,i.useCallback)((e="basic")=>{av(null),af(e),ag(!0)},[]),sB=(0,i.useCallback)(e=>{av(e),af("advanced"),ag(!0)},[]),sH=(0,i.useCallback)(e=>{ag(e),e||(av(null),af("basic"))},[]),sZ=(0,i.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch("/api/accounts/login-targets",{cache:"no-store"}),fetch("/api/accounts/access-rules",{cache:"no-store"})]),a=await e.json().catch(()=>null),s=await t.json().catch(()=>null);e.ok&&a?.ok&&aE(a.targets),t.ok&&s?.ok&&aL(s.rules)}catch{aE([]),aL([])}},[]);(0,i.useEffect)(()=>{sZ()},[sZ]);let sY=(0,i.useCallback)((e,t)=>{e&&sb(e),aC(t??null),aN(!0),sZ()},[sZ,sb]),sX=(0,i.useCallback)(e=>{sb(e),aU(e)},[sb]),sQ=(0,i.useCallback)(e=>{e||aU(null)},[]);(0,i.useEffect)(()=>{if(x){if(a.workspaces.some(e=>e.id===x)){aJ===x&&aK(null);return}aJ===x||(0,eq.DK)(a)||h(a.workspaces[0]?.id??null)}},[x,aJ,a]),(0,i.useEffect)(()=>{if(0===W.length)return;let e=W.map(e=>({entry:e,replacement:(0,eq.oc)(a.tasks,e)})).filter(e=>!!e.replacement);if(0===e.length)return;let t=new Map(e.map(({entry:e,replacement:t})=>[e.requestId,t]));z(e=>e.filter(e=>!t.has(e.requestId)));let s=W.find(e=>e.task.id===g),r=s?t.get(s.requestId)??null:null;r&&(b(r.id),r.workspaceId&&h(r.workspaceId))},[W,g,a.tasks]),(0,i.useEffect)(()=>{if(g){if(sh.workspaces.some(e=>e.id===g)||sh.agents.some(e=>e.id===g)||sh.tasks.some(e=>e.id===g)||sh.runtimes.some(e=>e.id===g)||sh.models.some(e=>e.id===g)){aJ===g&&aK(null);return}aJ!==g&&ss(x||sh.workspaces[0]?.id||null)}},[sh,g,x,aJ,ss]),a3(()=>{let e=a.diagnostics.workspaceRoot;if(aB===e||(0,eq.DK)(a))return;let t=(0,eq.cY)(e),s=globalThis.localStorage?.getItem(t)??null,r=(0,eq.mr)(a.workspaces.map(e=>e.id),s,x);r!==x&&(h(r),b(r??null)),aH(e)},[x,aB,a.diagnostics.loaded,a.diagnostics.rpcOk,a.diagnostics.workspaceRoot,a.mode,a.workspaces]),(0,i.useEffect)(()=>{let e=a.diagnostics.workspaceRoot;if(aB!==e)return;let t=(0,eq.cY)(e),s=globalThis.localStorage;void 0!==s&&s.setItem(t,(0,eq.SW)(x))},[x,aB,a.diagnostics.workspaceRoot]),(0,i.useEffect)(()=>{let e=sh.tasks.find(e=>e.id===g),t=e&&(0,eq.Zc)(e,ea,es,er);if(g){if(v&&!I){g!==v&&e?.primaryAgentId!==v&&ss(v);return}(ea.includes(g)||t)&&ss(x||sh.workspaces[0]?.id||null)}},[g,v,I,ea,es,er,x,sh.workspaces,sh.tasks,ss]),(0,i.useEffect)(()=>{!v||sh.agents.some(e=>e.id===v)||y(null)},[v,sh.agents]),(0,i.useEffect)(()=>{if(!F)return;let e=a.tasks.find(e=>e.dispatchId===F);e&&(ss(e.id,"overview"),eS(!0),G(null))},[F,a.tasks,ss]),(0,i.useEffect)(()=>{z(e=>e.filter(e=>{let t="string"==typeof e.task.metadata.dispatchSubmittedAt?Date.parse(e.task.metadata.dispatchSubmittedAt):e.task.updatedAt??NaN,s=!Number.isNaN(t)&&Date.now()-t>18e5;if(!e.dispatchId)return!s;let r=a.tasks.find(t=>t.dispatchId===e.dispatchId);return r?"running"===r.status||"queued"===r.status:!s}))},[a.tasks]),(0,i.useEffect)(()=>{eA||tl||td||(ta((0,eq.QO)(a)),tr((0,eq.hZ)(a)))},[a,eA,tl,td]),(0,i.useEffect)(()=>{eA||tu||ti(e=>{var t;return(t=a.diagnostics.openClawBinarySelection,e.mode===t.mode&&e.path===t.path&&e.resolvedPath===t.resolvedPath&&e.label===t.label&&e.detail===t.detail)?e:a.diagnostics.openClawBinarySelection})},[eA,tu,a.diagnostics.openClawBinarySelection]),(0,i.useEffect)(()=>{let e=e7(a)||"";if(!e)return;let t=a9.current;a9.current=e,tV(a=>{let s=a.trim();return s&&s!==t?a:e})},[a]),(0,i.useEffect)(()=>{if("fallback"!==a.mode||a.diagnostics.installed)return;let e=`${a.mode}:${a.diagnostics.installed?"installed":"missing"}:${a.diagnostics.issues.join("|")}`;aZ.current!==e&&(aZ.current=e,p({force:!0}).catch(()=>{}))},[p,a.diagnostics.installed,a.diagnostics.issues,a.mode]),(0,i.useEffect)(()=>{"models"!==tG||sj||"success"===tS?("success"===tS||sj)&&tW("models"):tW("system")},[sj,tK,tS,tG]),(0,i.useEffect)(()=>{if(ae)return void an(!1);if("success"===t9.phase){ad(!0),tW(sj?"models":"system"),an(sj);return}an(!1)},[ae,sj,t9.phase]);let s0=()=>{"running"!==th&&(tg("idle"),tf(null),tv(null),tj(""),tk(null))},s1=()=>{tA("idle"),tT(null),t$(null),t_(null),tP(""),tD(null),tF(null),tB("idle"),tZ(null),tQ(null),t1(null),t8(null),t6(null),t5(""),tJ([]),tV(""),t7(a8),an(!1),ad(!1),e5("idle"),e8(null),a9.current=null},s2=()=>{s1(),al(!0),tW("system"),at(!1),as(!0)},s5=e=>{tj(t=>{let a=`${t}${e}`;return a.length>4e4?a.slice(a.length-4e4):a})},s3=e=>{tP(t=>{let a=`${t}${e}`;return a.length>4e4?a.slice(a.length-4e4):a})},s8=e=>{t5(t=>{let a=`${t}${e}`;return a.length>4e4?a.slice(a.length-4e4):a})},s4=e=>{eZ(t=>{let a=`${t}${e}`;return a.length>4e4?a.slice(a.length-4e4):a})},s6=(0,i.useCallback)((e,t={})=>{let a=e7(e);if(!a)return;let s=a9.current;a9.current=a,tV(e=>{let r=e.trim();return t.force||!r||r===s?a:e})},[]),s9=(0,i.useCallback)(async e=>{let t=e??null;try{t=await p({force:!0})}catch{}return t&&(m(t),s6(t)),t},[s6,p,m]),s7=(0,i.useCallback)(async()=>{if(!ec||"running"===ep)return;let e="string"==typeof ec.metadata.optimisticRequestId?ec.metadata.optimisticRequestId:null,t=e?W.find(t=>t.requestId===e):W.find(e=>e.task.id===ec.id),a="string"==typeof ec.dispatchId?ec.dispatchId:t?.dispatchId??null;if(e&&!a){eg.current.get(e)?.abort(),eg.current.delete(e),z(t=>t.map(t=>t.requestId===e?{...t,task:(0,eq.GU)(t.task,{status:"cancelled",subtitle:"Mission submission cancelled before dispatch.",bootstrapStage:"cancelled",feedEvent:{id:`${t.task.id}:cancelled:${Date.now()}`,kind:"warning",timestamp:new Date().toISOString(),title:"Dispatch cancelled",detail:"Mission submission cancelled before dispatch.",isError:!1}})}:t)),j.o.success("Mission submission cancelled.",{description:ec.title}),eu(null),em("idle"),eh(null);return}em("running"),eh(null);try{let e=await fetch(`/api/tasks/${encodeURIComponent(ec.id)}/abort`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Aborted from AgentOS.",dispatchId:a})}),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||t?.message||t?.summary||"Unable to abort task.");j.o.success("Task abort requested.",{description:ec.title}),eu(null),em("idle"),await u()}catch(t){let e=t instanceof Error?t.message:"Unknown abort error.";em("error"),eh(e),j.o.error("Task abort failed.",{description:e})}},[W,u,ec,ep]),re=e=>{e&&tJ(e)};(0,i.useEffect)(()=>{if(!eA)return;let e=e=>{sf.current?.contains(e.target)||eI(!1)},t=e=>{"Escape"===e.key&&eI(!1)};return window.addEventListener("pointerdown",e),window.addEventListener("keydown",t),()=>{window.removeEventListener("pointerdown",e),window.removeEventListener("keydown",t)}},[eA]);let rt=async()=>{if("running"===th)return void tx(!0);let e=e=>{sa.current=j.o.loading("Updating OpenClaw...",{id:sa.current??void 0,description:e,duration:1/0,action:{label:"View",onClick:()=>tx(!0)}})},t=(e,t)=>{let a={id:sa.current??void 0,description:t,duration:e?6e3:1e4,action:{label:"View details",onClick:()=>tx(!0)}};e?j.o.success("OpenClaw updated.",a):j.o.error("OpenClaw update failed.",a),sa.current=null},a=!1,s=e=>{if(s5(`
6
+ [truncated for task continuation]`}var aI=a(38958),aT=a(47322),aO=a(93004),a_=a(58434),aR=a(16611),a$=a(47936),aM=a(10597),aE=a(33899),aP=a(99261),aL=a(94837),aD=a(38641),aU=a(73875);function aF({snapshot:e,surfaceTheme:t,connectionState:a,isCheckingForUpdates:r,updateRunState:l,lastCheckedAt:o,onCheckForUpdates:d,onOpenSetupWizard:u,onOpenUpdateDialog:p}){let[m,x]=(0,i.useState)(null),[g,b]=(0,i.useState)(null),[f,w]=(0,i.useState)(!1),[y,j]=(0,i.useState)(!1),N="running"===l,C=(0,eY.X2)(e),S=!!(e.diagnostics.updateAvailable&&e.diagnostics.latestVersion),A=!!(e.diagnostics.version&&!e.diagnostics.latestVersion&&!e.diagnostics.updateError),I=r?"Checking update registry...":S?`Latest v${e.diagnostics.latestVersion}`:e.diagnostics.updateError?"Check failed":A?e.diagnostics.updateInfo?.trim()||"Registry status is still loading.":"Up to date",T=e.diagnostics.modelReadiness.resolvedDefaultModel||e.diagnostics.modelReadiness.defaultModel||"Not selected",O=function(e){let{diagnostics:t}=e,a="remote"===t.bindMode||t.configuredGatewayUrl?"Remote":"Local",s=t.rpcOk||t.loaded?"Online":"Offline";return`${a} / ${s}`}(e),_=tq(e.diagnostics.transport,a),R=!!(m&&!m.native.ok&&("auth"===m.native.kind||"scope-limited"===m.native.kind)),$=(0,i.useCallback)(async()=>{w(!0),b(null);try{x(await az())}catch(e){b(e instanceof Error?e.message:"Unable to check Gateway auth status.")}finally{w(!1)}},[]);(0,i.useEffect)(()=>{$()},[$]);let M=async()=>{j(!0),b(null);try{let e=await fetch("/api/settings/gateway",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"repairDeviceAccess"})});if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||"Gateway access could not be repaired.")}let t=await e.json();x(t.authStatus)}catch(e){b(e instanceof Error?e.message:"Unable to repair Gateway access.")}finally{j(!1)}};return(0,s.jsxs)("div",{role:"menu","aria-label":"System menu",className:(0,k.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"===t?"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,s.jsxs)("div",{className:(0,k.cn)("rounded-[20px] border p-3.5",aq(t)),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2.5",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[9px] uppercase tracking-[0.22em]",aJ(t)),children:"OpenClaw"}),(0,s.jsxs)("div",{className:"mt-0.5 flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:"font-display text-[1rem]",children:aV(e.diagnostics.health)}),(0,s.jsx)(aG,{health:e.diagnostics.health,surfaceTheme:t})]})]}),(0,s.jsxs)("div",{className:"text-right",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[9px] uppercase tracking-[0.2em]",aJ(t)),children:"Version"}),(0,s.jsxs)("p",{className:"mt-0.5 font-mono text-[11px]",children:["v",e.diagnostics.version||"unknown"]})]})]}),(0,s.jsx)("div",{className:(0,k.cn)("mt-3 rounded-[18px] border p-3","light"===t?"border-[#eadbcf] bg-[#f9f1e8]/80":"border-white/[0.08] bg-[#101a2a]/92"),children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2.5",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[9px] uppercase tracking-[0.18em]",aJ(t)),children:"Updates"}),(0,s.jsx)("p",{className:"mt-0.5 text-[13px]",children:I})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)(v.$,{type:"button",size:"sm",variant:"secondary",onClick:()=>void d(),disabled:r||N,className:aK(t),children:[r?(0,s.jsx)(c.A,{className:"h-3 w-3 animate-spin"}):(0,s.jsx)(n.A,{className:"h-3 w-3"}),r?"Checking...":"Check"]}),S?(0,s.jsxs)(v.$,{type:"button",size:"sm",onClick:p,disabled:N,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,s.jsx)(aD.A,{className:"h-3 w-3"}),"Update"]}):null]})]})})]}),(0,s.jsxs)("div",{className:(0,k.cn)("mt-2 rounded-[16px] border px-3 py-2","light"===t?"border-[#e6d7c9] bg-white text-[#6b5546]":"border-white/[0.08] bg-[#0f1826] text-slate-300"),children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em]",children:r?"Checking":"Registry"}),(0,s.jsx)("p",{className:"mt-1 text-[11px] leading-4",children:r?"Refreshing OpenClaw update registry...":e.diagnostics.updateInfo?.trim()||(o?`Last checked ${new Date(o).toLocaleTimeString()}.`:"No registry check run yet.")})]}),(0,s.jsxs)("div",{className:"mt-2.5 grid gap-1.5",children:[(0,s.jsx)(aW,{surfaceTheme:t,icon:(0,s.jsx)(tW.A,{className:"h-3.5 w-3.5"}),label:"Gateway",value:_.statusLabel,detail:`${O} / ${_.gatewayModeLabel}`}),(0,s.jsx)(aW,{surfaceTheme:t,icon:(0,s.jsx)(h.A,{className:"h-3.5 w-3.5"}),label:"Default model",value:T,wrapValue:!0,action:(0,s.jsx)(v.$,{asChild:!0,size:"sm",variant:"secondary",className:aK(t),children:(0,s.jsxs)(tM(),{href:"/settings#models",children:[(0,s.jsx)(aU.A,{className:"h-3 w-3"}),"Models"]})})}),(0,s.jsx)(aW,{surfaceTheme:t,icon:C?(0,s.jsx)(eW.A,{className:"h-3.5 w-3.5"}):(0,s.jsx)(W.A,{className:"h-3.5 w-3.5"}),label:"Setup",value:C?"Ready":"Needs setup",action:(0,s.jsx)(v.$,{type:"button",size:"sm",variant:"secondary",onClick:()=>u(C?"system":void 0),className:aK(t),children:"Open"})})]}),R||g?(0,s.jsxs)("div",{className:(0,k.cn)("mt-2.5 rounded-[18px] border p-2.5","light"===t?"border-amber-300/70 bg-amber-50/80 text-amber-950":"border-amber-300/20 bg-amber-300/10 text-amber-100"),children:[(0,s.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,s.jsx)(tV.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"text-[13px] font-medium",children:"Gateway auth needs attention"}),(0,s.jsx)("p",{className:"mt-0.5 line-clamp-2 text-[11px] leading-4 opacity-80",children:g||m?.native.issue||"Native Gateway auth is not ready. Open Settings to repair access."})]})]}),(0,s.jsxs)("div",{className:"mt-2.5 flex items-center gap-1.5",children:[(0,s.jsxs)(v.$,{type:"button",size:"sm",variant:"secondary",onClick:()=>void $(),disabled:f||y,className:aK(t),children:[f?(0,s.jsx)(c.A,{className:"h-3 w-3 animate-spin"}):null,"Test"]}),m?.native.kind==="scope-limited"?(0,s.jsxs)(v.$,{type:"button",size:"sm",onClick:()=>void M(),disabled:f||y,className:"rounded-full bg-emerald-600 px-2.5 text-[11px] text-white hover:bg-emerald-500",children:[y?(0,s.jsx)(c.A,{className:"h-3 w-3 animate-spin"}):null,"Repair"]}):null,(0,s.jsx)(v.$,{asChild:!0,size:"sm",variant:"secondary",className:aK(t),children:(0,s.jsx)(tM(),{href:"/settings#gateway",children:"Open settings"})})]})]}):null,(0,s.jsxs)("div",{className:(0,k.cn)("mt-2.5 grid grid-cols-2 gap-1.5 border-t pt-2.5","light"===t?"border-[#e6d7c9]":"border-white/[0.08]"),children:[(0,s.jsx)(v.$,{asChild:!0,variant:"secondary",className:aB(t),children:(0,s.jsxs)(tM(),{href:"/settings",children:[(0,s.jsx)(tF.A,{className:"h-3.5 w-3.5"}),"Control Center"]})}),(0,s.jsx)(v.$,{asChild:!0,variant:"secondary",className:aB(t),children:(0,s.jsxs)(tM(),{href:"/settings#diagnostics",children:[(0,s.jsx)(W.A,{className:"h-3.5 w-3.5"}),"Diagnostics"]})})]})]})}function aG({health:e,surfaceTheme:t}){return(0,s.jsxs)("span",{className:(0,k.cn)("inline-flex items-center gap-1.5 rounded-full border px-2 py-1 text-[10px] uppercase tracking-[0.18em]","healthy"===e?"light"===t?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-400/30 bg-emerald-400/10 text-emerald-200":"degraded"===e?"light"===t?"border-amber-300 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-100":"light"===t?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-100"),children:[(0,s.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}),aV(e)]})}function aW({surfaceTheme:e,icon:t,label:a,value:r,detail:n,action:i,wrapValue:l=!1}){return(0,s.jsxs)("div",{className:(0,k.cn)("flex items-center gap-3 rounded-[20px] border p-3",aq(e)),children:[(0,s.jsx)("span",{className:(0,k.cn)("flex h-9 w-9 shrink-0 items-center justify-center rounded-full border","light"===e?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-cyan-300/15 bg-cyan-300/10 text-cyan-200"),children:t}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:(0,k.cn)("text-[10px] uppercase tracking-[0.18em]",aJ(e)),children:a}),(0,s.jsx)("p",{className:(0,k.cn)("mt-1 text-sm font-medium",l?"break-words leading-4":"truncate"),title:r,children:r}),n?(0,s.jsx)("p",{className:(0,k.cn)("mt-0.5",l?"break-words text-[11px] leading-4":"truncate text-xs",aJ(e)),children:n}):null]}),i?(0,s.jsx)("div",{className:"shrink-0",children:i}):null]})}async function az(){let e=await fetch("/api/settings/gateway",{method:"GET",cache:"no-store"});if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||"Unable to check Gateway auth status.")}return(await e.json()).authStatus}function aV(e){switch(e){case"healthy":return"Online";case"degraded":return"Degraded";default:return"Offline"}}function aq(e){return"light"===e?"border-[#e5d7c9] bg-[#fffaf4]/86 shadow-[0_18px_48px_rgba(119,91,70,0.08)]":"border-white/[0.08] bg-[#0d1624]/96"}function aJ(e){return"light"===e?"text-[#8c7564]":"text-slate-400"}function aK(e){return(0,k.cn)("h-8 rounded-full px-3 text-xs","light"===e?"border-[#dcc9bb] bg-[#fffaf3] text-[#5d493b] hover:bg-[#f3e7dc]":"border-white/10 bg-[#121d2d] text-slate-200 hover:bg-[#182538]")}function aB(e){return(0,k.cn)("h-10 rounded-full text-xs","light"===e?"border-[#dcc9bb] bg-[#fffaf3] text-[#4d3c32] hover:bg-[#f3e7dc]":"border-white/10 bg-[#121d2d] text-slate-200 hover:bg-[#182538]")}function aH(e,t){switch(e){case"healthy":return"light"===t?"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"===t?"border-amber-300/90 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-200";default:return"light"===t?"border-rose-300/80 bg-rose-50 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200"}}function aZ(e){switch(e){case"healthy":return"bg-emerald-400";case"degraded":return"bg-amber-300";default:return"bg-rose-300"}}function aY({surfaceTheme:e}){return(0,s.jsxs)("div",{className:(0,k.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"===e?"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,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:(0,k.cn)("inline-flex h-7 w-7 items-center justify-center overflow-hidden rounded-[8px] border","light"===e?"border-[#d1bcad] bg-[#f5ece4]":"border-white/[0.08] bg-white/[0.03]"),children:(0,s.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,s.jsx)("source",{src:"/assets/logo.webm",type:"video/webm"})})}),(0,s.jsx)("p",{className:(0,k.cn)("text-[10px] tracking-[0.18em]","light"===e?"text-[#8a7261]":"text-slate-500"),children:"AgentOS"})]}),(0,s.jsx)("span",{"aria-hidden":"true",className:(0,k.cn)("h-4 w-px","light"===e?"bg-[#cdb7a8]/80":"bg-white/[0.08]")}),(0,s.jsx)("h2",{className:(0,k.cn)("font-display text-[0.88rem]","light"===e?"text-[#816958]/80":"text-slate-400/75"),children:"Control Plane"})]})}function aX({settingsRef:e,isSettingsOpen:t,onToggleTheme:a,onToggleSettings:r,...n}){var i,l,o;let{snapshot:d,surfaceTheme:c}=n,{onOpenSetupWizard:u}=n,p=d.diagnostics.health,m="offline"===p,x=function(e){switch(e){case"healthy":return"Online";case"degraded":return"Degraded";default:return"Offline"}}(p),h=(i=c,(0,k.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"===i?"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]")),g=(l=c,(0,k.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"===l?"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]")),b=(o=c,(0,k.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"===o?"translate-x-7 bg-[#c8946f] text-white":"translate-x-0 bg-cyan-300 text-slate-950"));return(0,s.jsx)("div",{className:"flex w-full items-center px-0 pt-6",children:(0,s.jsxs)("div",{ref:e,className:"pointer-events-auto relative ml-auto",children:[(0,s.jsxs)("div",{className:(0,k.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"===c?"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,s.jsxs)("div",{className:"flex items-baseline gap-[3px]",children:[(0,s.jsx)("span",{className:(0,k.cn)("text-[10px] uppercase tracking-[0.3em]","light"===c?"text-[#8a7261]":"text-slate-500"),children:"OPENCLAW"}),(0,s.jsxs)("span",{className:(0,k.cn)("font-mono text-[8px] tracking-[0.04em]","light"===c?"text-[#6f5a4b]/85":"text-slate-300/80"),children:["v",d.diagnostics.version||"unknown"]})]}),m?(0,s.jsxs)(f.P.button,{type:"button",onClick:()=>u(),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,k.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",aH(p,c),"light"===c?"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,s.jsx)(f.P.span,{"aria-hidden":"true",className:(0,k.cn)("pointer-events-none absolute inset-0 rounded-full","light"===c?"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,s.jsx)("span",{"aria-hidden":"true",className:(0,k.cn)("relative z-10 h-2 w-2 rounded-full shadow-[0_0_12px_currentColor]",aZ(p))}),(0,s.jsxs)("span",{className:"relative z-10 inline-flex items-center gap-1.5",children:[(0,s.jsx)("span",{children:x}),(0,s.jsx)("span",{className:(0,k.cn)("rounded-full border px-1.5 py-0.5 text-[7px] uppercase tracking-[0.18em]","light"===c?"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,s.jsx)(aE.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,s.jsxs)("span",{className:(0,k.cn)("inline-flex items-center gap-2 rounded-full border px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.22em]",aH(p,c)),children:[(0,s.jsx)("span",{"aria-hidden":"true",className:(0,k.cn)("h-2 w-2 rounded-full shadow-[0_0_12px_currentColor]",aZ(p))}),x]}),(0,s.jsx)("button",{type:"button",role:"switch","aria-label":"light"===c?"Switch to dark theme":"Switch to light theme","aria-checked":"light"===c,onClick:a,className:g,children:(0,s.jsx)("span",{className:b,children:"light"===c?(0,s.jsx)(aP.A,{className:"h-3 w-3"}):(0,s.jsx)(aL.A,{className:"h-3 w-3"})})}),(0,s.jsx)("button",{type:"button","aria-label":"Open settings","aria-expanded":t,"aria-haspopup":"menu",onClick:r,className:h,children:(0,s.jsx)(tF.A,{className:"h-3.5 w-3.5"})})]}),t?(0,s.jsx)(aF,{...n}):null]})})}var aQ=a(77402),a0=a(833);let a1=(0,aR.default)(()=>Promise.all([a.e(5751),a.e(9708),a.e(213),a.e(2125),a.e(7197)]).then(a.bind(a,67197)).then(e=>e.MissionCanvas),{loadableGenerated:{webpack:()=>[67197]},ssr:!1,loading:()=>(0,s.jsx)("div",{className:"h-full w-full"})}),a2=[4e3,8e3,15e3,3e4,45e3,6e4],a5=[0,800,1200,1800,2600,3600,5e3,6500],a3=void 0===globalThis.window?i.useEffect:i.useLayoutEffect,a4={phase:"idle",previousModelId:null,nextModelId:null,message:null};function a8(e){return new Promise(t=>{setTimeout(t,e)})}function a6({initialSnapshot:e,mode:t="mission"}){let{snapshot:a,connectionState:c,refresh:u,refreshSnapshot:p,setSnapshot:m}=(0,a$.v)(e),[x,h]=(0,i.useState)(e.workspaces[0]?.id??null),[g,b]=(0,i.useState)(e.workspaces[0]?.id??null),[f,w]=(0,i.useState)(null),[v,y]=(0,i.useState)(null),[C,A]=(0,i.useState)(null),[I,T]=(0,i.useState)(!1),[O,_]=(0,i.useState)(!1),[R,$]=(0,i.useState)(0),[M,E]=(0,i.useState)("overview"),[P,L]=(0,i.useState)(null),[D,U]=(0,i.useState)(null),[F,G]=(0,i.useState)(null),[W,z]=(0,i.useState)([]),[V,q]=(0,i.useState)(null),{surfaceTheme:J,setSurfaceTheme:B,hiddenRuntimeIds:H,setHiddenRuntimeIds:Z,hiddenTaskKeys:Y,setHiddenTaskKeys:Q,lockedTaskKeys:ee,setLockedTaskKeys:et,safeHiddenRuntimeIds:ea,safeHiddenTaskKeys:es,safeLockedTaskKeys:er,clearPreferenceState:en}=(0,aS.$)();(0,i.useEffect)(()=>{let e=document.documentElement,t=e.classList.contains("dark"),a=e.style.colorScheme;return e.classList.toggle("dark","light"!==J),e.style.colorScheme="light"===J?"light":"dark",()=>{e.classList.toggle("dark",t),e.style.colorScheme=a}},[J]);let[ei,el]=(0,i.useState)(null),[eo,ed]=(0,i.useState)(null),[ec,eu]=(0,i.useState)(null),[ep,em]=(0,i.useState)("idle"),[ex,eh]=(0,i.useState)(null),eg=(0,i.useRef)(new Map),[eb,ef]=(0,i.useState)(null),[ew,ev]=(0,i.useState)([]),[ey,ej]=(0,i.useState)({}),[eN,ek]=(0,i.useState)(!1),[eC,eS]=(0,i.useState)(!1),[eA,eI]=(0,i.useState)(!1),[eT,eO]=(0,i.useState)(!1),[e_,eR]=(0,i.useState)(null),[e$,eM]=(0,i.useState)("idle"),[eE,eP]=(0,i.useState)(null),[eL,eD]=(0,i.useState)(null),[eU,eF]=(0,i.useState)("idle"),[eG,eW]=(0,i.useState)(null),[ez,eV]=(0,i.useState)(null),[eJ,eB]=(0,i.useState)(null),[eH,eZ]=(0,i.useState)(""),[eX,e1]=(0,i.useState)(""),[e2,e5]=(0,i.useState)("idle"),[e3,e4]=(0,i.useState)(null),[e8,e6]=(0,i.useState)(null),e9=(0,i.useRef)(null),te=(0,i.useRef)(new Map),[tt,ta]=(0,i.useState)(()=>(0,eq.QO)(e)),[ts,tr]=(0,i.useState)(()=>(0,eq.hZ)(e)),[tn,ti]=(0,i.useState)(()=>e.diagnostics.openClawBinarySelection),[tl,to]=(0,i.useState)(!1),[td,tc]=(0,i.useState)(!1),[tu,tp]=(0,i.useState)(!1),[tm,tx]=(0,i.useState)(!1),[th,tg]=(0,i.useState)("idle"),[tb,tf]=(0,i.useState)(null),[tw,tv]=(0,i.useState)(null),[ty,tj]=(0,i.useState)(""),[tN,tk]=(0,i.useState)(null),[tS,tA]=(0,i.useState)("idle"),[tI,tT]=(0,i.useState)(null),[t_,tR]=(0,i.useState)(null),[t$,tM]=(0,i.useState)(null),[tE,tP]=(0,i.useState)(""),[tL,tD]=(0,i.useState)(null),[tU,tF]=(0,i.useState)(null),[tG,tW]=(0,i.useState)("system"),[tz,tV]=(0,i.useState)(""),[tq,tJ]=(0,i.useState)([]),[tK,tB]=(0,i.useState)("idle"),[tH,tZ]=(0,i.useState)(null),[tX,tQ]=(0,i.useState)(null),[t0,t1]=(0,i.useState)(null),[t2,t5]=(0,i.useState)(""),[t3,t4]=(0,i.useState)(null),[t8,t6]=(0,i.useState)(null),[t9,t7]=(0,i.useState)(a4),[ae,at]=(0,i.useState)(!1),[aa,as]=(0,i.useState)(!1),[ar,an]=(0,i.useState)(!1),[ai,al]=(0,i.useState)(!1),[ao,ad]=(0,i.useState)(!1),[ac,au]=(0,i.useState)(null),[ap,am]=(0,i.useState)(null),[ah,ag]=(0,i.useState)(!1),[ab,af]=(0,i.useState)("basic"),[aw,av]=(0,i.useState)(null),[aj,aN]=(0,i.useState)(!1),[ak,aC]=(0,i.useState)(null),[aR,aE]=(0,i.useState)([]),[aP,aL]=(0,i.useState)([]),[aD,aU]=(0,i.useState)(null),[aF,aG]=(0,i.useState)(!1),[aW,az]=(0,i.useState)(null),[aV,aq]=(0,i.useState)(null),[aJ,aK]=(0,i.useState)(null),[aB,aH]=(0,i.useState)(null),aZ=(0,i.useRef)(null),a9=(0,i.useRef)(null),a7=(0,i.useRef)(null),se=(0,i.useRef)(null),st=(0,i.useRef)(0),sa=(0,i.useRef)(null),ss=(0,i.useCallback)((e,t="overview",a=null)=>{b(e),E(t),w(a),L(t=>t?.taskId===e?t:null)},[]),{taskReviewRequest:sr,taskReviewState:sn,clearTaskReviewState:si,openTaskReview:sl,closeTaskReview:so,acceptTaskReview:sd,dismissTaskReview:sc,continueTaskReview:su,retryTaskReview:sp,openTaskReviewEvidence:sm}=function({selectNode:e,setIsInspectorOpen:t,setComposeIntent:a,setComposerTargetAgentId:s,setIsComposerActive:r,refreshSnapshot:n}){let[l,o]=(0,i.useState)(null),[d,c]=(0,i.useState)({}),[u,p]=(0,i.useState)(!1);(0,i.useEffect)(()=>{let e=globalThis.localStorage?.getItem(K.hy);c((0,K.Kf)(e??null)),p(!0)},[]),(0,i.useEffect)(()=>{u&&globalThis.localStorage?.setItem(K.hy,JSON.stringify(d))},[u,d]);let m=(0,i.useCallback)(t=>{e(t.id,"output"),o({requestId:`task-review:${t.id}:${Date.now()}`,taskId:t.id,taskKey:(0,K.HR)(t),fallbackTask:t})},[e]),x=(0,i.useCallback)((e,t,a)=>{let s=(0,K.ss)(e,t,a);return c(e=>({...e,[s.taskKey]:s})),s},[]),h=(0,i.useCallback)(()=>{o(null)},[]),g=(0,i.useCallback)(e=>{x(e,"accepted","Accepted result"),h(),j.o.success("Task result accepted.",{description:"The review warning is marked as handled for this workspace."})},[h,x]),b=(0,i.useCallback)(e=>{x(e,"dismissed","Dismissed review"),h(),j.o.message("Task review dismissed.",{description:"The warning remains available in the task evidence."})},[h,x]),f=(0,i.useCallback)(async(a,s)=>{let r,i,l=(r=aA((0,eq.sL)(a),3200),["Continue this task from the last captured output. Finish the remaining work and verify the result.","","Original mission:",r,(i=aA(s,7600))?"":null,i?"Last captured output:":null,i||null].filter(e=>"string"==typeof e).join("\n"));try{let s=await fetch(`/api/tasks/${encodeURIComponent(a.id)}/control`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"continue",message:l,dispatchId:a.dispatchId??null})}),r=await s.json().catch(()=>null);if(!s.ok)throw Error(r?.error||"Unable to continue this task.");x(a,"continued","Accepted continuation"),e(a.id,"output"),t(!0),h(),n({force:!0}),j.o.success("Task continuation accepted.",{description:"OpenClaw accepted the continuation. AgentOS will track the follow-up until live output arrives."})}catch(e){j.o.error("Task continuation failed.",{description:e instanceof Error?e.message:"Unable to continue this task."})}},[h,x,n,e,t]),w=(0,i.useCallback)(e=>{x(e,"retried","Drafted retry"),a({id:`review-retry:${e.id}:${Date.now()}`,mission:["Retry this task from the original mission. Do not assume the previous stalled runtime completed.\n\nOriginal mission:",(0,eq.sL)(e)].join("\n"),agentId:e.primaryAgentId,sourceKind:"reply",sourceLabel:e.title.trim()||"Task review"}),s(e.primaryAgentId??null),r(!0),h(),j.o.success("Retry draft prepared.",{description:"Review the mission input, then send it when ready."})},[h,x,a,s,r]),v=(0,i.useCallback)((a,s)=>{e(a.id,s),t(!0),h()},[h,e,t]);return{taskReviewRequest:l,taskReviewState:d,clearTaskReviewState:()=>{c({})},openTaskReview:m,closeTaskReview:h,acceptTaskReview:g,dismissTaskReview:b,continueTaskReview:f,retryTaskReview:w,openTaskReviewEvidence:v}}({selectNode:ss,setIsInspectorOpen:eS,setComposeIntent:e=>{_(!0),q(e)},setComposerTargetAgentId:A,setIsComposerActive:T,refreshSnapshot:p}),sx=eC&&"chat"===M?g:null,sh=(0,i.useMemo)(()=>{let e=(0,eq.Uh)(a,W);return(0,K.wg)(e,sn)},[a,W,sn]),sg=(0,i.useMemo)(()=>sr?sh.tasks.find(e=>e.id===sr.taskId||(0,K.HR)(e)===sr.taskKey)??sr.fallbackTask:null,[sr,sh.tasks]),sb=(0,i.useCallback)((e,t={})=>{t.markPending&&e&&aK(e),y(null),A(null),h(e),ss(e)},[ss]),sf=(0,i.useRef)(null),sw=(0,i.useRef)(!1),sv=(0,i.useRef)(!1),sy=a.runtimes.filter(e=>("running"===e.status||"queued"===e.status)&&!(0,eq.MG)(e)).length,sj=!ai&&(0,eY.h6)(a),sN=!ai&&(0,eY.X2)(a),sk=e0(tG,sj||"success"===tS),sC=(0,eq.Id)(a),sS=(0,eq.R)(a),sA=(0,eq.iy)(a),sI=sy>0||W.length>0,sT=(0,eq.EE)(a,{hasSeenMissionReady:ao,modelSwitchSucceeded:"success"===t9.phase}),sO=sj&&sN&&!sC,s_=!sI&&(!ae||sO)&&(!sN||sO)&&!sT||ar||aa,sR=sh.tasks.filter(e=>!x||(0,aM.kO)(e,sh.agents)===x).filter(e=>(0,eq.Zc)(e,ea,es,er)).length,s$=(0,i.useCallback)(e=>{let t=sh.tasks.filter(t=>(0,aM.kO)(t,sh.agents)===e).filter(e=>!er.includes(e.key));if(0===t.length)return;let a=t.every(e=>(0,eq.Zc)(e,ea,es,er)),s=new Set(t.map(e=>e.key)),r=new Set(t.flatMap(e=>e.runtimeIds));if(a){Q(e=>e.filter(e=>!s.has(e))),Z(e=>e.filter(e=>!r.has(e)));return}Q(e=>Array.from(new Set([...e,...s]))),Z(e=>Array.from(new Set([...e,...r])))},[sh.agents,sh.tasks,ea,es,er,Z,Q]),sM=(0,i.useCallback)(e=>{let t=sh.agents.find(t=>t.id===e);t&&(y(t=>t===e?null:e),h(t.workspaceId),ss(e))},[ss,sh.agents]),sE=(0,i.useCallback)((e,t)=>{let a=sh.agents.find(t=>t.id===e);a&&(h(a.workspaceId),eS(!0),ss(a.id,"overview",t))},[ss,sh.agents]),sP=(0,i.useCallback)((e,t)=>{let a=sh.agents.find(t=>t.id===e);a&&(h(a.workspaceId),ss(a.id),ed({requestId:`capabilities:${e}:${t}:${Date.now()}`,agentId:e,focus:t}))},[ss,sh.agents]),sL=(0,i.useCallback)(e=>{let t=sh.agents.find(t=>t.id===e);t&&(h(t.workspaceId),ss(t.id),aq({requestId:`model:${e}:${Date.now()}`,agentId:e}))},[ss,sh.agents]),sD=(0,i.useCallback)(e=>{ev(t=>t.filter(t=>t.id!==e)),ef(e),e9.current&&clearTimeout(e9.current),e9.current=setTimeout(()=>{e9.current=null,ef(null)},2400)},[]),sU=(0,i.useCallback)(e=>{if(h(e.workspaceId),ss(e.id),ev(t=>[...t.filter(t=>t.id!==e.id),e]),e.warning){ej(t=>({...t,[e.id]:e.warning??""}));let t=te.current.get(e.id);t&&clearTimeout(t);let a=setTimeout(()=>{te.current.delete(e.id),ej(t=>{let a={...t};return delete a[e.id],a})},12e3);te.current.set(e.id,a)}},[ss]);(0,i.useEffect)(()=>{if(0===ew.length)return;let e=new Set(sh.agents.map(e=>e.id));ew.some(t=>e.has(t.id))&&ev(t=>t.filter(t=>!e.has(t.id)))},[ew,sh.agents]),(0,i.useEffect)(()=>{let e=te.current;return()=>{e.forEach(e=>clearTimeout(e)),e.clear()}},[]);let sF=(0,i.useCallback)(e=>{e||aq(null)},[]),sG=(0,i.useCallback)(e=>{e||ed(null)},[]),sW=(0,i.useCallback)(e=>{if(!v)return;let t=sh.agents.find(t=>t.id===e);t&&(v!==e||x!==t.workspaceId||g!==e)&&(y(e),h(t.workspaceId),ss(e))},[x,v,ss,g,sh.agents]),sz=(0,i.useCallback)(e=>{let t=sh.agents.find(t=>t.id===e);t&&(h(t.workspaceId),A(t.id),_(!0),T(!0),ss(t.id))},[ss,sh.agents]),sV=(0,i.useCallback)(()=>{sw.current=!0},[]),sq=(0,i.useCallback)(e=>{if(e){sv.current=!1,_(!0),T(!0);return}if(sw.current){sv.current=!0;return}sv.current=!1,_(!1),T(!1)},[]),sJ=(0,i.useCallback)(()=>{y(null),ss(x??sh.workspaces[0]?.id??null)},[x,ss,sh.workspaces]);(0,i.useEffect)(()=>{let e=()=>{!sw.current||(sw.current=!1,sv.current&&(sv.current=!1,_(!1),T(!1),$(e=>e+1)))};return window.addEventListener("pointerup",e),window.addEventListener("pointercancel",e),()=>{window.removeEventListener("pointerup",e),window.removeEventListener("pointercancel",e)}},[]),(0,i.useEffect)(()=>()=>{st.current+=1,e9.current&&(clearTimeout(e9.current),e9.current=null)},[]);let sK=(0,i.useCallback)((e="basic")=>{av(null),af(e),ag(!0)},[]),sB=(0,i.useCallback)(e=>{av(e),af("advanced"),ag(!0)},[]),sH=(0,i.useCallback)(e=>{ag(e),e||(av(null),af("basic"))},[]),sZ=(0,i.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch("/api/accounts/login-targets",{cache:"no-store"}),fetch("/api/accounts/access-rules",{cache:"no-store"})]),a=await e.json().catch(()=>null),s=await t.json().catch(()=>null);e.ok&&a?.ok&&aE(a.targets),t.ok&&s?.ok&&aL(s.rules)}catch{aE([]),aL([])}},[]);(0,i.useEffect)(()=>{sZ()},[sZ]);let sY=(0,i.useCallback)((e,t)=>{e&&sb(e),aC(t??null),aN(!0),sZ()},[sZ,sb]),sX=(0,i.useCallback)(e=>{sb(e),aU(e)},[sb]),sQ=(0,i.useCallback)(e=>{e||aU(null)},[]);(0,i.useEffect)(()=>{if(x){if(a.workspaces.some(e=>e.id===x)){aJ===x&&aK(null);return}aJ===x||(0,eq.DK)(a)||h(a.workspaces[0]?.id??null)}},[x,aJ,a]),(0,i.useEffect)(()=>{if(0===W.length)return;let e=W.map(e=>({entry:e,replacement:(0,eq.oc)(a.tasks,e)})).filter(e=>!!e.replacement);if(0===e.length)return;let t=new Map(e.map(({entry:e,replacement:t})=>[e.requestId,t]));z(e=>e.filter(e=>!t.has(e.requestId)));let s=W.find(e=>e.task.id===g),r=s?t.get(s.requestId)??null:null;r&&(b(r.id),r.workspaceId&&h(r.workspaceId))},[W,g,a.tasks]),(0,i.useEffect)(()=>{if(g){if(sh.workspaces.some(e=>e.id===g)||sh.agents.some(e=>e.id===g)||sh.tasks.some(e=>e.id===g)||sh.runtimes.some(e=>e.id===g)||sh.models.some(e=>e.id===g)){aJ===g&&aK(null);return}aJ!==g&&ss(x||sh.workspaces[0]?.id||null)}},[sh,g,x,aJ,ss]),a3(()=>{let e=a.diagnostics.workspaceRoot;if(aB===e||(0,eq.DK)(a))return;let t=(0,eq.cY)(e),s=globalThis.localStorage?.getItem(t)??null,r=(0,eq.mr)(a.workspaces.map(e=>e.id),s,x);r!==x&&(h(r),b(r??null)),aH(e)},[x,aB,a.diagnostics.loaded,a.diagnostics.rpcOk,a.diagnostics.workspaceRoot,a.mode,a.workspaces]),(0,i.useEffect)(()=>{let e=a.diagnostics.workspaceRoot;if(aB!==e)return;let t=(0,eq.cY)(e),s=globalThis.localStorage;void 0!==s&&s.setItem(t,(0,eq.SW)(x))},[x,aB,a.diagnostics.workspaceRoot]),(0,i.useEffect)(()=>{let e=sh.tasks.find(e=>e.id===g),t=e&&(0,eq.Zc)(e,ea,es,er);if(g){if(v&&!I){g!==v&&e?.primaryAgentId!==v&&ss(v);return}(ea.includes(g)||t)&&ss(x||sh.workspaces[0]?.id||null)}},[g,v,I,ea,es,er,x,sh.workspaces,sh.tasks,ss]),(0,i.useEffect)(()=>{!v||sh.agents.some(e=>e.id===v)||y(null)},[v,sh.agents]),(0,i.useEffect)(()=>{if(!F)return;let e=a.tasks.find(e=>e.dispatchId===F);e&&(ss(e.id,"overview"),eS(!0),G(null))},[F,a.tasks,ss]),(0,i.useEffect)(()=>{z(e=>e.filter(e=>{let t="string"==typeof e.task.metadata.dispatchSubmittedAt?Date.parse(e.task.metadata.dispatchSubmittedAt):e.task.updatedAt??NaN,s=!Number.isNaN(t)&&Date.now()-t>18e5;if(!e.dispatchId)return!s;let r=a.tasks.find(t=>t.dispatchId===e.dispatchId);return r?"running"===r.status||"queued"===r.status:!s}))},[a.tasks]),(0,i.useEffect)(()=>{eA||tl||td||(ta((0,eq.QO)(a)),tr((0,eq.hZ)(a)))},[a,eA,tl,td]),(0,i.useEffect)(()=>{eA||tu||ti(e=>{var t;return(t=a.diagnostics.openClawBinarySelection,e.mode===t.mode&&e.path===t.path&&e.resolvedPath===t.resolvedPath&&e.label===t.label&&e.detail===t.detail)?e:a.diagnostics.openClawBinarySelection})},[eA,tu,a.diagnostics.openClawBinarySelection]),(0,i.useEffect)(()=>{let e=e7(a)||"";if(!e)return;let t=a9.current;a9.current=e,tV(a=>{let s=a.trim();return s&&s!==t?a:e})},[a]),(0,i.useEffect)(()=>{if("fallback"!==a.mode||a.diagnostics.installed)return;let e=`${a.mode}:${a.diagnostics.installed?"installed":"missing"}:${a.diagnostics.issues.join("|")}`;aZ.current!==e&&(aZ.current=e,p({force:!0}).catch(()=>{}))},[p,a.diagnostics.installed,a.diagnostics.issues,a.mode]),(0,i.useEffect)(()=>{"models"!==tG||sj||"success"===tS?("success"===tS||sj)&&tW("models"):tW("system")},[sj,tK,tS,tG]),(0,i.useEffect)(()=>{if(ae)return void an(!1);if("success"===t9.phase){ad(!0),tW(sj?"models":"system"),an(sj);return}an(!1)},[ae,sj,t9.phase]);let s0=()=>{"running"!==th&&(tg("idle"),tf(null),tv(null),tj(""),tk(null))},s1=()=>{tA("idle"),tT(null),tR(null),tM(null),tP(""),tD(null),tF(null),tB("idle"),tZ(null),tQ(null),t1(null),t4(null),t6(null),t5(""),tJ([]),tV(""),t7(a4),an(!1),ad(!1),e5("idle"),e4(null),a9.current=null},s2=()=>{s1(),al(!0),tW("system"),at(!1),as(!0)},s5=e=>{tj(t=>{let a=`${t}${e}`;return a.length>4e4?a.slice(a.length-4e4):a})},s3=e=>{tP(t=>{let a=`${t}${e}`;return a.length>4e4?a.slice(a.length-4e4):a})},s4=e=>{t5(t=>{let a=`${t}${e}`;return a.length>4e4?a.slice(a.length-4e4):a})},s8=e=>{eZ(t=>{let a=`${t}${e}`;return a.length>4e4?a.slice(a.length-4e4):a})},s6=(0,i.useCallback)((e,t={})=>{let a=e7(e);if(!a)return;let s=a9.current;a9.current=a,tV(e=>{let r=e.trim();return t.force||!r||r===s?a:e})},[]),s9=(0,i.useCallback)(async e=>{let t=e??null;try{t=await p({force:!0})}catch{}return t&&(m(t),s6(t)),t},[s6,p,m]),s7=(0,i.useCallback)(async()=>{if(!ec||"running"===ep)return;let e="string"==typeof ec.metadata.optimisticRequestId?ec.metadata.optimisticRequestId:null,t=e?W.find(t=>t.requestId===e):W.find(e=>e.task.id===ec.id),a="string"==typeof ec.dispatchId?ec.dispatchId:t?.dispatchId??null;if(e&&!a){eg.current.get(e)?.abort(),eg.current.delete(e),z(t=>t.map(t=>t.requestId===e?{...t,task:(0,eq.GU)(t.task,{status:"cancelled",subtitle:"Mission submission cancelled before dispatch.",bootstrapStage:"cancelled",feedEvent:{id:`${t.task.id}:cancelled:${Date.now()}`,kind:"warning",timestamp:new Date().toISOString(),title:"Dispatch cancelled",detail:"Mission submission cancelled before dispatch.",isError:!1}})}:t)),j.o.success("Mission submission cancelled.",{description:ec.title}),eu(null),em("idle"),eh(null);return}em("running"),eh(null);try{let e=await fetch(`/api/tasks/${encodeURIComponent(ec.id)}/abort`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Aborted from AgentOS.",dispatchId:a})}),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||t?.message||t?.summary||"Unable to abort task.");j.o.success("Task abort requested.",{description:ec.title}),eu(null),em("idle"),await u()}catch(t){let e=t instanceof Error?t.message:"Unknown abort error.";em("error"),eh(e),j.o.error("Task abort failed.",{description:e})}},[W,u,ec,ep]),re=e=>{e&&tJ(e)};(0,i.useEffect)(()=>{if(!eA)return;let e=e=>{sf.current?.contains(e.target)||eI(!1)},t=e=>{"Escape"===e.key&&eI(!1)};return window.addEventListener("pointerdown",e),window.addEventListener("keydown",t),()=>{window.removeEventListener("pointerdown",e),window.removeEventListener("keydown",t)}},[eA]);let rt=async()=>{if("running"===th)return void tx(!0);let e=e=>{sa.current=j.o.loading("Updating OpenClaw...",{id:sa.current??void 0,description:e,duration:1/0,action:{label:"View",onClick:()=>tx(!0)}})},t=(e,t)=>{let a={id:sa.current??void 0,description:t,duration:e?6e3:1e4,action:{label:"View details",onClick:()=>tx(!0)}};e?j.o.success("OpenClaw updated.",a):j.o.error("OpenClaw update failed.",a),sa.current=null},a=!1,s=e=>{if(s5(`
7
7
  > ${e.message}
8
8
  `),a)return;let t=e.stdout.trimEnd(),s=e.stderr.trimEnd();t&&s5(`
9
9
  [stdout]
@@ -13,13 +13,13 @@ ${t}
13
13
  ${s}
14
14
  `)};tx(!0),tg("running"),tf("Starting OpenClaw update..."),tv(null),tj(""),tk(null),e("Starting OpenClaw update...");try{let r=await fetch("/api/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirmed:!0})});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(e?.error||"OpenClaw update request failed.")}if(!r.body)throw Error("OpenClaw update did not return a readable stream.");let n=r.body.getReader(),i=new TextDecoder,l="",o=!1;for(;;){let{value:r,done:d}=await n.read();if(d)break;let c=(l+=i.decode(r,{stream:!0})).indexOf("\n");for(;c>=0;){let r=l.slice(0,c).trim();if(l=l.slice(c+1),r){let n=JSON.parse(r);"status"===n.type?(tf(n.message),s5(`
15
15
  > ${n.message}
16
- `),e(n.message)):"log"===n.type?(a=!0,s5(n.text)):(o=!0,s(n),tf(null),tv(n.message),tg(n.ok?"success":"error"),tk(n.manualCommand??null),n.snapshot&&m(n.snapshot),n.ok?t(!0,n.message):t(!1,n.message))}c=l.indexOf("\n")}}let d=l.trim();if(d){let e=JSON.parse(d);"done"===e.type&&(o=!0,s(e),tf(null),tv(e.message),tg(e.ok?"success":"error"),tk(e.manualCommand??null),e.snapshot&&m(e.snapshot),t(e.ok,e.message))}if(!o)throw Error("OpenClaw update stream ended unexpectedly.")}catch(e){tg("error"),tf(null),tv(e instanceof Error?e.message:"OpenClaw update failed."),t(!1,e instanceof Error?e.message:"Unknown update error.")}},ra=async()=>{at(!1),s1(),tW("system"),tA("running"),tT("detecting"),t$("Checking local OpenClaw status..."),t_(null),tD(null),tF(null),tP("");try{let e=await fetch("/api/onboarding",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intent:"auto"})});if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||"OpenClaw onboarding request failed.")}if(!e.body)throw Error("OpenClaw onboarding did not return a readable stream.");let t=e.body.getReader(),a=new TextDecoder,s="",r=!1;for(;;){let{value:e,done:n}=await t.read();if(n)break;let i=(s+=a.decode(e,{stream:!0})).indexOf("\n");for(;i>=0;){let e=s.slice(0,i).trim();if(s=s.slice(i+1),e){let t=JSON.parse(e);"status"===t.type?(tT(t.phase),t$(t.message),s3(`
16
+ `),e(n.message)):"log"===n.type?(a=!0,s5(n.text)):(o=!0,s(n),tf(null),tv(n.message),tg(n.ok?"success":"error"),tk(n.manualCommand??null),n.snapshot&&m(n.snapshot),n.ok?t(!0,n.message):t(!1,n.message))}c=l.indexOf("\n")}}let d=l.trim();if(d){let e=JSON.parse(d);"done"===e.type&&(o=!0,s(e),tf(null),tv(e.message),tg(e.ok?"success":"error"),tk(e.manualCommand??null),e.snapshot&&m(e.snapshot),t(e.ok,e.message))}if(!o)throw Error("OpenClaw update stream ended unexpectedly.")}catch(e){tg("error"),tf(null),tv(e instanceof Error?e.message:"OpenClaw update failed."),t(!1,e instanceof Error?e.message:"Unknown update error.")}},ra=async()=>{at(!1),s1(),tW("system"),tA("running"),tT("detecting"),tR("Checking local OpenClaw status..."),tM(null),tD(null),tF(null),tP("");try{let e=await fetch("/api/onboarding",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intent:"auto"})});if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||"OpenClaw onboarding request failed.")}if(!e.body)throw Error("OpenClaw onboarding did not return a readable stream.");let t=e.body.getReader(),a=new TextDecoder,s="",r=!1;for(;;){let{value:e,done:n}=await t.read();if(n)break;let i=(s+=a.decode(e,{stream:!0})).indexOf("\n");for(;i>=0;){let e=s.slice(0,i).trim();if(s=s.slice(i+1),e){let t=JSON.parse(e);"status"===t.type?(tT(t.phase),tR(t.message),s3(`
17
17
  > ${t.message}
18
- `)):"log"===t.type?s3(t.text):(r=!0,tT(t.phase),t_(t.message),tD(t.manualCommand??null),tF(t.docsUrl??null),t.ok?(t$("Refreshing model status..."),await s9(t.snapshot??null),al(!1)):(t$(null),t.snapshot&&m(t.snapshot)),t$(null),tA(t.ok?"success":"error"),t.ok?j.o.success("System setup ready.",{description:t.message}):j.o.error("OpenClaw onboarding failed.",{description:t.message}))}i=s.indexOf("\n")}}let n=s.trim();if(n){let e=JSON.parse(n);"done"===e.type&&(r=!0,tT(e.phase),t_(e.message),tD(e.manualCommand??null),tF(e.docsUrl??null),e.ok?(t$("Refreshing model status..."),await s9(e.snapshot??null),al(!1)):(t$(null),e.snapshot&&m(e.snapshot)),t$(null),tA(e.ok?"success":"error"))}if(!r)throw Error("OpenClaw onboarding stream ended unexpectedly.")}catch(e){tA("error"),t$(null),t_(e instanceof Error?e.message:"OpenClaw onboarding failed."),j.o.error("OpenClaw onboarding failed.",{description:e instanceof Error?e.message:"Unknown onboarding error."})}},rs=async(e,t={})=>{let a=t.timeoutMs?new AbortController:null,s=t.timeoutMs?globalThis.setTimeout(()=>a?.abort(),t.timeoutMs):null;try{let s=await fetch("/api/models/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"status",provider:e,includeSnapshot:t.includeSnapshot}),signal:a?.signal}),r=await s.json().catch(()=>null);if(!s.ok||!r)throw Error(r?.error||r?.message||"Provider status could not be loaded.");return r}finally{s&&globalThis.clearTimeout(s)}},rr=(e,t,a)=>{let s=(0,eQ.W2)(e);st.current+=1,tW("models"),as(!0),at(!1),tZ("ready"),tQ("Refreshing OpenClaw model status..."),t8(null),t6(null),a?(m(a),s6(a)):s9(null),tQ(null),tB("success"),t1(`${s.shortLabel} is connected. You can discover or add models now.`),s8(`
18
+ `)):"log"===t.type?s3(t.text):(r=!0,tT(t.phase),tM(t.message),tD(t.manualCommand??null),tF(t.docsUrl??null),t.ok?(tR("Refreshing model status..."),await s9(t.snapshot??null),al(!1)):(tR(null),t.snapshot&&m(t.snapshot)),tR(null),tA(t.ok?"success":"error"),t.ok?j.o.success("System setup ready.",{description:t.message}):j.o.error("OpenClaw onboarding failed.",{description:t.message}))}i=s.indexOf("\n")}}let n=s.trim();if(n){let e=JSON.parse(n);"done"===e.type&&(r=!0,tT(e.phase),tM(e.message),tD(e.manualCommand??null),tF(e.docsUrl??null),e.ok?(tR("Refreshing model status..."),await s9(e.snapshot??null),al(!1)):(tR(null),e.snapshot&&m(e.snapshot)),tR(null),tA(e.ok?"success":"error"))}if(!r)throw Error("OpenClaw onboarding stream ended unexpectedly.")}catch(e){tA("error"),tR(null),tM(e instanceof Error?e.message:"OpenClaw onboarding failed."),j.o.error("OpenClaw onboarding failed.",{description:e instanceof Error?e.message:"Unknown onboarding error."})}},rs=async(e,t={})=>{let a=t.timeoutMs?new AbortController:null,s=t.timeoutMs?globalThis.setTimeout(()=>a?.abort(),t.timeoutMs):null;try{let s=await fetch("/api/models/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"status",provider:e,includeSnapshot:t.includeSnapshot}),signal:a?.signal}),r=await s.json().catch(()=>null);if(!s.ok||!r)throw Error(r?.error||r?.message||"Provider status could not be loaded.");return r}finally{s&&globalThis.clearTimeout(s)}},rr=(e,t,a)=>{let s=(0,eQ.W2)(e);st.current+=1,tW("models"),as(!0),at(!1),tZ("ready"),tQ("Refreshing OpenClaw model status..."),t4(null),t6(null),a?(m(a),s6(a)):s9(null),tQ(null),tB("success"),t1(`${s.shortLabel} is connected. You can discover or add models now.`),s4(`
19
19
  > ${s.shortLabel} connected. AgentOS refreshed OpenClaw model status.
20
- `),j.o.success(`${s.shortLabel} connected.`,{description:t||"AgentOS refreshed OpenClaw model status."})},rn=async e=>{let t=e.trim();if(!t)return!1;let a=se.current;if(a?.command===t&&Date.now()-a.openedAt<12e4)return!1;try{let e=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:t})}),a=await e.json().catch(()=>null);if(!e.ok||a?.error)throw Error(a?.error||"Unable to open Terminal.");return se.current={command:t,openedAt:Date.now()},j.o.success("Terminal opened.",{description:"Finish provider auth there, then refresh models."}),!0}catch(e){return j.o.error("Could not open Terminal.",{description:e instanceof Error?e.message:"Open Terminal manually and run the command."}),!1}},ri=async(e,t={})=>{let s=(0,eq.YI)(e.intent),r=a.diagnostics.modelReadiness.resolvedDefaultModel||a.diagnostics.modelReadiness.defaultModel||null,n=t=>{"set-default"===e.intent&&(a7.current=j.o.loading("Setting default model...",{id:a7.current??void 0,description:t,duration:1/0}))},i=(t,a,s)=>{if("set-default"!==e.intent)return!1;let r={id:a7.current??void 0,description:s,duration:"message"===t?1/0:6e3};return"success"===t?j.o.success(a,r):"message"===t?j.o.message(a,r):j.o.error(a,r),a7.current=null,!0},l=!1,o=a=>{let s=t.verifyProvider??("login-provider"===e.intent?(0,eQ.d4)(e.provider):null);t.autoOpenTerminal&&!l&&"done"===a.type&&"authenticating"===a.phase&&a.manualCommand&&(l=!0,rn(a.manualCommand).finally(()=>{s&&(e=>{let t=(0,eQ.W2)(e),a=st.current+1;for(let[s,r]of(st.current=a,a2.entries()))globalThis.setTimeout(()=>{st.current===a&&(async()=>{try{let r=await rs(e);if(st.current!==a)return;if(r.connection.connected){st.current+=1,rr(e,r.connection.detail,r.snapshot);return}s===a2.length-1&&(tQ(null),t1(`Still waiting for ${t.shortLabel} auth. Finish the browser sign-in, then refresh models.`))}catch{s===a2.length-1&&tQ(null)}})()},r)})(s)}))};t.forceOpen&&as(!0),at(!1),tW("models"),tB("running"),tZ((0,eq.oA)(e.intent)),tQ(s.statusMessage),t1(null),t8(null),t6(null),t5(""),t7("set-default"===e.intent?{phase:"saving",previousModelId:r,nextModelId:e.modelId,message:s.statusMessage}:a8),n(s.statusMessage);try{let t=await fetch("/api/onboarding/models",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"Model onboarding request failed.")}if(!t.body)throw Error("Model onboarding did not return a readable stream.");let a=t.body.getReader(),l=new TextDecoder,d="",c=!1;for(;;){let{value:t,done:u}=await a.read();if(u)break;let p=(d+=l.decode(t,{stream:!0})).indexOf("\n");for(;p>=0;){let t=d.slice(0,p).trim();if(d=d.slice(p+1),t){let a=JSON.parse(t);"status"===a.type?(tZ(a.phase),tQ(a.message),s8(`
20
+ `),j.o.success(`${s.shortLabel} connected.`,{description:t||"AgentOS refreshed OpenClaw model status."})},rn=async e=>{let t=e.trim();if(!t)return!1;let a=se.current;if(a?.command===t&&Date.now()-a.openedAt<12e4)return!1;try{let e=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:t})}),a=await e.json().catch(()=>null);if(!e.ok||a?.error)throw Error(a?.error||"Unable to open Terminal.");return se.current={command:t,openedAt:Date.now()},j.o.success("Terminal opened.",{description:"Finish provider auth there, then refresh models."}),!0}catch(e){return j.o.error("Could not open Terminal.",{description:e instanceof Error?e.message:"Open Terminal manually and run the command."}),!1}},ri=async(e,t={})=>{let s=(0,eq.YI)(e.intent),r=a.diagnostics.modelReadiness.resolvedDefaultModel||a.diagnostics.modelReadiness.defaultModel||null,n=t=>{"set-default"===e.intent&&(a7.current=j.o.loading("Setting default model...",{id:a7.current??void 0,description:t,duration:1/0}))},i=(t,a,s)=>{if("set-default"!==e.intent)return!1;let r={id:a7.current??void 0,description:s,duration:"message"===t?1/0:6e3};return"success"===t?j.o.success(a,r):"message"===t?j.o.message(a,r):j.o.error(a,r),a7.current=null,!0},l=!1,o=a=>{let s=t.verifyProvider??("login-provider"===e.intent?(0,eQ.d4)(e.provider):null);t.autoOpenTerminal&&!l&&"done"===a.type&&"authenticating"===a.phase&&a.manualCommand&&(l=!0,rn(a.manualCommand).finally(()=>{s&&(e=>{let t=(0,eQ.W2)(e),a=st.current+1;for(let[s,r]of(st.current=a,a2.entries()))globalThis.setTimeout(()=>{st.current===a&&(async()=>{try{let r=await rs(e);if(st.current!==a)return;if(r.connection.connected){st.current+=1,rr(e,r.connection.detail,r.snapshot);return}s===a2.length-1&&(tQ(null),t1(`Still waiting for ${t.shortLabel} auth. Finish the browser sign-in, then refresh models.`))}catch{s===a2.length-1&&tQ(null)}})()},r)})(s)}))};t.forceOpen&&as(!0),at(!1),tW("models"),tB("running"),tZ((0,eq.oA)(e.intent)),tQ(s.statusMessage),t1(null),t4(null),t6(null),t5(""),t7("set-default"===e.intent?{phase:"saving",previousModelId:r,nextModelId:e.modelId,message:s.statusMessage}:a4),n(s.statusMessage);try{let t=await fetch("/api/onboarding/models",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"Model onboarding request failed.")}if(!t.body)throw Error("Model onboarding did not return a readable stream.");let a=t.body.getReader(),l=new TextDecoder,d="",c=!1;for(;;){let{value:t,done:u}=await a.read();if(u)break;let p=(d+=l.decode(t,{stream:!0})).indexOf("\n");for(;p>=0;){let t=d.slice(0,p).trim();if(d=d.slice(p+1),t){let a=JSON.parse(t);"status"===a.type?(tZ(a.phase),tQ(a.message),s4(`
21
21
  > ${a.message}
22
- `),"set-default"===e.intent&&(n(a.message),t7({phase:"saving",previousModelId:r,nextModelId:e.modelId,message:a.message}))):"log"===a.type?s8(a.text):(c=!0,tZ(a.phase),tQ(null),t1(a.message),t8(a.manualCommand??null),t6(a.docsUrl??null),tB(a.ok?"success":"error"),o(a),re(a.discoveredModels),"set-default"===e.intent&&t7({phase:a.ok?"success":"error",previousModelId:r,nextModelId:e.modelId,message:a.message}),a.snapshot&&(m(a.snapshot),a.ok&&"set-default"===e.intent&&s6(a.snapshot,{force:!0})),a.ok?(i("success",s.successTitle,a.message)||j.o.success(s.successTitle,{description:a.message}),"set-default"===e.intent&&an(!0)):"authenticating"===a.phase&&a.manualCommand?i("message","Continue in terminal.",a.message)||j.o.message("Continue in terminal.",{description:a.message}):i("error",s.errorTitle,a.message)||j.o.error(s.errorTitle,{description:a.message}))}p=d.indexOf("\n")}}let u=d.trim();if(u){let t=JSON.parse(u);"done"===t.type&&(c=!0,tZ(t.phase),tQ(null),t1(t.message),t8(t.manualCommand??null),t6(t.docsUrl??null),tB(t.ok?"success":"error"),o(t),re(t.discoveredModels),"set-default"===e.intent&&t7({phase:t.ok?"success":"error",previousModelId:r,nextModelId:e.modelId,message:t.message}),t.snapshot&&(m(t.snapshot),t.ok&&"set-default"===e.intent&&s6(t.snapshot,{force:!0})),t.ok?i("success",s.successTitle,t.message):"authenticating"===t.phase&&t.manualCommand?i("message","Continue in terminal.",t.message):i("error",s.errorTitle,t.message),t.ok&&"set-default"===e.intent&&an(!0))}if(!c)throw Error("Model onboarding stream ended unexpectedly.")}catch(a){"set-default"===e.intent&&t7({phase:"error",previousModelId:r,nextModelId:e.modelId,message:a instanceof Error?a.message:"Default model save failed."});let t=a instanceof Error?a.message:"Unknown model onboarding error.";tB("error"),tQ(null),t1(a instanceof Error?a.message:"Model onboarding failed."),i("error",s.errorTitle,t)||j.o.error(s.errorTitle,{description:t})}},rl=async()=>{await ri({intent:"refresh"})},ro=async()=>{await ri({intent:"discover"})},rd=async(e,t={})=>{let s=(0,eQ.d4)(e);if(!s)return void j.o.error("Unknown model provider.",{description:"AgentOS could not match this auth request to a supported provider."});as(!0);let r=a.diagnostics.modelReadiness.authProviders.find(e=>e.provider===s);if(r?.connected)return void rr(s,r.detail,a);try{let e=await rs(s,{timeoutMs:2500});if(e.connection.connected)return void rr(s,e.connection.detail,e.snapshot)}catch{}await ri({intent:"login-provider",provider:s},{forceOpen:!0,verifyProvider:s,...t})},rc=async e=>{let t=e||tz,s=a.diagnostics.modelReadiness.resolvedDefaultModel||a.diagnostics.modelReadiness.defaultModel||null;!t||s&&t.trim()===s.trim()||await ri({intent:"set-default",modelId:t})},ru=(0,i.useCallback)(()=>{as(!1),an(!1),at(!0),e5("idle"),e8(null),e6(null)},[]),rp=(0,i.useCallback)(async(e,t)=>{let s=a,r=(0,eq.zr)(s,e);for(let a of(e8((0,eq.n)({progress:t,readiness:r,state:r.ready?"ready":"syncing"})),a5)){a>0&&await a4(a);let n=await p({force:!0}).catch(()=>null);if(n&&(s=n),r=(0,eq.zr)(s,e),e8((0,eq.n)({progress:t,readiness:r,state:r.ready?"ready":"syncing"})),r.ready)return{snapshot:s,readiness:r}}let n=(0,eq._9)(r);throw e8((0,eq.n)({progress:t,readiness:r,state:"error",errorDetail:n})),Error(n)},[p,a]),rm=(0,i.useCallback)(async(e,t)=>{let a=t.workspaces.some(t=>t.id===e.workspaceId)?e.workspaceId:t.workspaces[0]?.id??e.workspaceId;e5("success"),sb(a,{markPending:!0}),m(t),await a4(450),ru(),j.o.success("Workspace ready.",{description:`${e.agentIds.length} agent${1===e.agentIds.length?"":"s"} visible at ${e.workspacePath}`}),e.warnings?.length&&j.o.message("Workspace created with a sync warning.",{description:e.warnings[0]}),e.kickoffError&&j.o.message("Workspace created, but kickoff needs attention.",{description:e.kickoffError})},[ru,sb,m]),rx=(0,i.useCallback)(async()=>{if("running"===e2)return null;if("error"===e2&&e4){at(!1),as(!0),e5("running");try{let e=await rp(e4,e3);return await rm(e4,e.snapshot),e4}catch(e){return e5("error"),j.o.error("Workspace setup needs attention.",{description:e instanceof Error?e.message:"AgentOS could not confirm the canvas handoff."}),null}}let e=tz.trim()||(0,aR.nd)(a,x)||null;if(!e)return j.o.error("Choose a model first.",{description:"OpenClaw needs a usable default model before it can create the first workspace."}),null;let t=(0,a0.sg)((0,a0.fV)({sourceMode:"empty",agentCount:1,kickoffMission:!0})),s=null;at(!1),as(!0),e5("running"),e6(null),e8(t);try{let a=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"AgentOS Workspace",brief:"First workspace created from the AgentOS launchpad.",modelId:e,sourceMode:"empty",template:"software",teamPreset:"solo",modelProfile:"balanced",rules:{workspaceOnly:!0,generateStarterDocs:!0,generateMemory:!0,kickoffMission:!0},stream:!0})});if(!a.ok){let e=await a.json().catch(()=>null);throw Error(e?.error||"OpenClaw could not create the workspace.")}let r=null,n=null;if(await (0,aQ.z)(a,async e=>{if("progress"===e.type){t=e.progress,e8(e.progress);return}e.progress&&(t=e.progress,e8(e.progress)),e.ok?r=e.result:n=e.error}),n||!r)throw Error(n||"OpenClaw could not create the workspace.");let i=r;s=i,e6(i);let l=await rp(i,t);return await rm(i,l.snapshot),i}catch(t){e5("error");let e=t instanceof Error?t.message:"Unknown workspace error.";return j.o.error(s?"Workspace setup needs attention.":"Workspace creation failed.",{description:e}),null}},[rm,e3,e2,e4,x,tz,a,rp]),rh=e=>{let t=e0(e??(sj?"models":"system"),sj);eI(!1),tW(t),at(!1),an(void 0===e&&sT),as(!0),"models"===t&&s6(a,{force:!0})},rg=()=>{if(as(!1),an(!1),at(!0),"settings"===t){window.location.hash="gateway";return}eI(!0)},rb=(0,i.useCallback)(()=>{if(!(0,eq.Id)(a))return void rx();let e=(x&&a.workspaces.some(e=>e.id===x)?x:a.workspaces[0]?.id)??null;e&&(aK(null),sb(e)),ru()},[x,ru,sb,rx,a]),rf=async e=>{au(e);try{let t=await fetch("/api/gateway/control",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e})}),a=await t.json();if(!t.ok||a.error||!a.snapshot)throw Error(a.error||"Gateway control request failed.");m(a.snapshot),j.o.success("Gateway updated.",{description:a.message||"Gateway state changed."})}catch(e){j.o.error("Gateway action failed.",{description:e instanceof Error?e.message:"Unknown gateway control error."})}finally{au(null)}},rw=e=>{az((0,eQ.d4)(e)),aG(!0)},rv=async()=>{eO(!0);try{let e=await p({force:!0}),t=Date.now(),a=e.diagnostics.updateInfo?.trim(),s=!!e.diagnostics.version&&!e.diagnostics.latestVersion&&!e.diagnostics.updateError;if(am(t),!e.diagnostics.installed)return void j.o.message("OpenClaw is unavailable.",{description:e.diagnostics.issues[0]||"AgentOS is running in fallback mode."});if(e.diagnostics.updateAvailable)return void j.o.message("Update available.",{description:a||`v${e.diagnostics.latestVersion} is available. Current version: v${e.diagnostics.version||"unknown"}.`});if(s)return void j.o.message("Update registry is still loading.",{description:a||`Running v${e.diagnostics.version||"unknown"}. OpenClaw has not reported a latest release yet.`});if(e.diagnostics.latestVersion&&!e.diagnostics.version)return void j.o.message("Update status refreshed.",{description:a||`Latest available version: v${e.diagnostics.latestVersion}.`});if(e.diagnostics.updateError)return void j.o.error("Update check could not reach the registry.",{description:a||e.diagnostics.updateError});j.o.success("OpenClaw is up to date.",{description:a||`Current version: v${e.diagnostics.version||"unknown"}. No newer release was reported.`})}catch(e){j.o.error("Update check failed.",{description:e instanceof Error?e.message:"Unable to refresh OpenClaw status."})}finally{eO(!1)}},ry=async e=>{to(!0);try{let t=await fetch("/api/settings/gateway",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({gatewayUrl:e})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"Gateway settings could not be updated.")}let a=await t.json();m(a.snapshot),ta((0,eq.QO)(a.snapshot)),j.o.success("Gateway updated.",{description:e?.trim()?`AgentOS now targets ${a.snapshot.diagnostics.configuredGatewayUrl||a.snapshot.diagnostics.gatewayUrl}.`:"AgentOS reverted to the local default gateway."})}catch(e){j.o.error("Gateway update failed.",{description:e instanceof Error?e.message:"Unable to update the OpenClaw gateway."})}finally{to(!1)}},rj=async e=>{tc(!0);try{let t=await fetch("/api/settings/workspace-root",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceRoot:e})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"Workspace root could not be updated.")}let a=await t.json();m(a.snapshot),tr((0,eq.hZ)(a.snapshot)),j.o.success("Workspace root updated.",{description:e?.trim()?`New workspaces will default to ${(0,N.$7)(a.snapshot.diagnostics.workspaceRoot)}. Existing workspaces stay where they are.`:"AgentOS reverted to the default workspace root. Existing workspaces were not moved."})}catch(e){j.o.error("Workspace root update failed.",{description:e instanceof Error?e.message:"Unable to update the default workspace root."})}finally{tc(!1)}},rN=(0,i.useCallback)((e,t)=>{switch(e){case"auto":return{mode:"auto",path:null,resolvedPath:null,label:"Auto",detail:"Use the managed resolution order."};case"local-prefix":return{mode:"local-prefix",path:null,resolvedPath:null,label:"Local prefix",detail:"Use the managed local prefix install."};case"global-path":return{mode:"global-path",path:null,resolvedPath:null,label:"Global PATH",detail:"Resolve the first executable named openclaw on PATH when saved."};default:{let e="string"==typeof t?t.trim():"";return{mode:"custom",path:e||null,resolvedPath:e||null,label:"Custom path",detail:e||"Enter an absolute path to an executable OpenClaw binary."}}}},[]),rk=(0,i.useCallback)(e=>{ti(t=>e===t.mode?"custom"===e?rN(e,t.path):t:"custom"===e?rN(e,t.path):rN(e))},[rN]),rC=(0,i.useCallback)(e=>{ti(rN("custom",e))},[rN]),rS=()=>{if(void 0===globalThis.localStorage)return;let e=[aS.M.surfaceTheme,aS.M.hiddenRuntimeIds,aS.M.hiddenTaskKeys,aS.M.lockedTaskKeys,"mission-control-workspace-plan-id","mission-control-recent-prompts","mission-control-node-positions",K.hy],t=["mission-control-active-workspace-id:","mission-control-node-positions:v2:","mission-control-composer-draft:","mission-control-agent-chat:v1:","mission-control-agent-chat-seen:v1:"];for(let t of e)globalThis.localStorage.removeItem(t);for(let e=globalThis.localStorage.length-1;e>=0;e-=1){let a=globalThis.localStorage.key(e);a&&t.some(e=>a.startsWith(e))&&globalThis.localStorage.removeItem(a)}en(),si()},rA=()=>{e_("idle"),eP(null),eD(null),eF("idle"),eW(null),eV(null),eB(null),eZ(""),e1("")},rI=async e=>{e_("loading"),eP(null),eD(null);try{let t=await fetch("/api/reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intent:"preview",target:e})}),a=await t.json().catch(()=>null);if(!t.ok||!a?.preview)throw Error(a?.error||"Reset preview could not be loaded.");eP(a.preview),e_("ready")}catch(e){e_("error"),eD(e instanceof Error?e.message:"Reset preview failed.")}},rT=async e=>{eI(!1),e$(e),rA(),await rI(e)},rO=async()=>{if(eR){eF("running"),eW("full-uninstall"===eR?"Starting full uninstall...":"Starting AgentOS reset..."),eV(null),eB(null),eZ("");try{let e=await fetch("/api/reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intent:"execute",target:eR,confirmed:!0})});if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||"Reset request failed.")}if(!e.body)throw Error("Reset request did not return a readable stream.");let t=e.body.getReader(),a=new TextDecoder,s="",r=!1;for(;;){let{value:e,done:n}=await t.read();if(n)break;let i=(s+=a.decode(e,{stream:!0})).indexOf("\n");for(;i>=0;){let e=s.slice(0,i).trim();if(s=s.slice(i+1),e){let t=JSON.parse(e);"status"===t.type?(eW(t.message),s4(`
22
+ `),"set-default"===e.intent&&(n(a.message),t7({phase:"saving",previousModelId:r,nextModelId:e.modelId,message:a.message}))):"log"===a.type?s4(a.text):(c=!0,tZ(a.phase),tQ(null),t1(a.message),t4(a.manualCommand??null),t6(a.docsUrl??null),tB(a.ok?"success":"error"),o(a),re(a.discoveredModels),"set-default"===e.intent&&t7({phase:a.ok?"success":"error",previousModelId:r,nextModelId:e.modelId,message:a.message}),a.snapshot&&(m(a.snapshot),a.ok&&"set-default"===e.intent&&s6(a.snapshot,{force:!0})),a.ok?(i("success",s.successTitle,a.message)||j.o.success(s.successTitle,{description:a.message}),"set-default"===e.intent&&an(!0)):"authenticating"===a.phase&&a.manualCommand?i("message","Continue in terminal.",a.message)||j.o.message("Continue in terminal.",{description:a.message}):i("error",s.errorTitle,a.message)||j.o.error(s.errorTitle,{description:a.message}))}p=d.indexOf("\n")}}let u=d.trim();if(u){let t=JSON.parse(u);"done"===t.type&&(c=!0,tZ(t.phase),tQ(null),t1(t.message),t4(t.manualCommand??null),t6(t.docsUrl??null),tB(t.ok?"success":"error"),o(t),re(t.discoveredModels),"set-default"===e.intent&&t7({phase:t.ok?"success":"error",previousModelId:r,nextModelId:e.modelId,message:t.message}),t.snapshot&&(m(t.snapshot),t.ok&&"set-default"===e.intent&&s6(t.snapshot,{force:!0})),t.ok?i("success",s.successTitle,t.message):"authenticating"===t.phase&&t.manualCommand?i("message","Continue in terminal.",t.message):i("error",s.errorTitle,t.message),t.ok&&"set-default"===e.intent&&an(!0))}if(!c)throw Error("Model onboarding stream ended unexpectedly.")}catch(a){"set-default"===e.intent&&t7({phase:"error",previousModelId:r,nextModelId:e.modelId,message:a instanceof Error?a.message:"Default model save failed."});let t=a instanceof Error?a.message:"Unknown model onboarding error.";tB("error"),tQ(null),t1(a instanceof Error?a.message:"Model onboarding failed."),i("error",s.errorTitle,t)||j.o.error(s.errorTitle,{description:t})}},rl=async()=>{await ri({intent:"refresh"})},ro=async()=>{await ri({intent:"discover"})},rd=async(e,t={})=>{let s=(0,eQ.d4)(e);if(!s)return void j.o.error("Unknown model provider.",{description:"AgentOS could not match this auth request to a supported provider."});as(!0);let r=a.diagnostics.modelReadiness.authProviders.find(e=>e.provider===s);if(r?.connected)return void rr(s,r.detail,a);try{let e=await rs(s,{timeoutMs:2500});if(e.connection.connected)return void rr(s,e.connection.detail,e.snapshot)}catch{}await ri({intent:"login-provider",provider:s},{forceOpen:!0,verifyProvider:s,...t})},rc=async e=>{let t=e||tz,s=a.diagnostics.modelReadiness.resolvedDefaultModel||a.diagnostics.modelReadiness.defaultModel||null;!t||s&&t.trim()===s.trim()||await ri({intent:"set-default",modelId:t})},ru=(0,i.useCallback)(()=>{as(!1),an(!1),at(!0),e5("idle"),e4(null),e6(null)},[]),rp=(0,i.useCallback)(async(e,t)=>{let s=a,r=(0,eq.zr)(s,e);for(let a of(e4((0,eq.n)({progress:t,readiness:r,state:r.ready?"ready":"syncing"})),a5)){a>0&&await a8(a);let n=await p({force:!0}).catch(()=>null);if(n&&(s=n),r=(0,eq.zr)(s,e),e4((0,eq.n)({progress:t,readiness:r,state:r.ready?"ready":"syncing"})),r.ready)return{snapshot:s,readiness:r}}let n=(0,eq._9)(r);throw e4((0,eq.n)({progress:t,readiness:r,state:"error",errorDetail:n})),Error(n)},[p,a]),rm=(0,i.useCallback)(async(e,t)=>{let a=t.workspaces.some(t=>t.id===e.workspaceId)?e.workspaceId:t.workspaces[0]?.id??e.workspaceId;e5("success"),sb(a,{markPending:!0}),m(t),await a8(450),ru(),j.o.success("Workspace ready.",{description:`${e.agentIds.length} agent${1===e.agentIds.length?"":"s"} visible at ${e.workspacePath}`}),e.warnings?.length&&j.o.message("Workspace created with a sync warning.",{description:e.warnings[0]}),e.kickoffError&&j.o.message("Workspace created, but kickoff needs attention.",{description:e.kickoffError})},[ru,sb,m]),rx=(0,i.useCallback)(async()=>{if("running"===e2)return null;if("error"===e2&&e8){at(!1),as(!0),e5("running");try{let e=await rp(e8,e3);return await rm(e8,e.snapshot),e8}catch(e){return e5("error"),j.o.error("Workspace setup needs attention.",{description:e instanceof Error?e.message:"AgentOS could not confirm the canvas handoff."}),null}}let e=tz.trim()||(0,a_.nd)(a,x)||null;if(!e)return j.o.error("Choose a model first.",{description:"OpenClaw needs a usable default model before it can create the first workspace."}),null;let t=(0,a0.sg)((0,a0.fV)({sourceMode:"empty",agentCount:1,kickoffMission:!0})),s=null;at(!1),as(!0),e5("running"),e6(null),e4(t);try{let a=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"AgentOS Workspace",brief:"First workspace created from the AgentOS launchpad.",modelId:e,sourceMode:"empty",template:"software",teamPreset:"solo",modelProfile:"balanced",rules:{workspaceOnly:!0,generateStarterDocs:!0,generateMemory:!0,kickoffMission:!0},stream:!0})});if(!a.ok){let e=await a.json().catch(()=>null);throw Error(e?.error||"OpenClaw could not create the workspace.")}let r=null,n=null;if(await (0,aQ.z)(a,async e=>{if("progress"===e.type){t=e.progress,e4(e.progress);return}e.progress&&(t=e.progress,e4(e.progress)),e.ok?r=e.result:n=e.error}),n||!r)throw Error(n||"OpenClaw could not create the workspace.");let i=r;s=i,e6(i);let l=await rp(i,t);return await rm(i,l.snapshot),i}catch(t){e5("error");let e=t instanceof Error?t.message:"Unknown workspace error.";return j.o.error(s?"Workspace setup needs attention.":"Workspace creation failed.",{description:e}),null}},[rm,e3,e2,e8,x,tz,a,rp]),rh=e=>{let t=e0(e??(sj?"models":"system"),sj);eI(!1),tW(t),at(!1),an(void 0===e&&sT),as(!0),"models"===t&&s6(a,{force:!0})},rg=()=>{if(as(!1),an(!1),at(!0),"settings"===t){window.location.hash="gateway";return}eI(!0)},rb=(0,i.useCallback)(()=>{if(!(0,eq.Id)(a))return void rx();let e=(x&&a.workspaces.some(e=>e.id===x)?x:a.workspaces[0]?.id)??null;e&&(aK(null),sb(e)),ru()},[x,ru,sb,rx,a]),rf=async e=>{au(e);try{let t=await fetch("/api/gateway/control",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e})}),a=await t.json();if(!t.ok||a.error||!a.snapshot)throw Error(a.error||"Gateway control request failed.");m(a.snapshot),j.o.success("Gateway updated.",{description:a.message||"Gateway state changed."})}catch(e){j.o.error("Gateway action failed.",{description:e instanceof Error?e.message:"Unknown gateway control error."})}finally{au(null)}},rw=e=>{az((0,eQ.d4)(e)),aG(!0)},rv=async()=>{eO(!0);try{let e=await p({force:!0}),t=Date.now(),a=e.diagnostics.updateInfo?.trim(),s=!!e.diagnostics.version&&!e.diagnostics.latestVersion&&!e.diagnostics.updateError;if(am(t),!e.diagnostics.installed)return void j.o.message("OpenClaw is unavailable.",{description:e.diagnostics.issues[0]||"AgentOS is running in fallback mode."});if(e.diagnostics.updateAvailable)return void j.o.message("Update available.",{description:a||`v${e.diagnostics.latestVersion} is available. Current version: v${e.diagnostics.version||"unknown"}.`});if(s)return void j.o.message("Update registry is still loading.",{description:a||`Running v${e.diagnostics.version||"unknown"}. OpenClaw has not reported a latest release yet.`});if(e.diagnostics.latestVersion&&!e.diagnostics.version)return void j.o.message("Update status refreshed.",{description:a||`Latest available version: v${e.diagnostics.latestVersion}.`});if(e.diagnostics.updateError)return void j.o.error("Update check could not reach the registry.",{description:a||e.diagnostics.updateError});j.o.success("OpenClaw is up to date.",{description:a||`Current version: v${e.diagnostics.version||"unknown"}. No newer release was reported.`})}catch(e){j.o.error("Update check failed.",{description:e instanceof Error?e.message:"Unable to refresh OpenClaw status."})}finally{eO(!1)}},ry=async e=>{to(!0);try{let t=await fetch("/api/settings/gateway",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({gatewayUrl:e})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"Gateway settings could not be updated.")}let a=await t.json();m(a.snapshot),ta((0,eq.QO)(a.snapshot)),j.o.success("Gateway updated.",{description:e?.trim()?`AgentOS now targets ${a.snapshot.diagnostics.configuredGatewayUrl||a.snapshot.diagnostics.gatewayUrl}.`:"AgentOS reverted to the local default gateway."})}catch(e){j.o.error("Gateway update failed.",{description:e instanceof Error?e.message:"Unable to update the OpenClaw gateway."})}finally{to(!1)}},rj=async e=>{tc(!0);try{let t=await fetch("/api/settings/workspace-root",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceRoot:e})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"Workspace root could not be updated.")}let a=await t.json();m(a.snapshot),tr((0,eq.hZ)(a.snapshot)),j.o.success("Workspace root updated.",{description:e?.trim()?`New workspaces will default to ${(0,N.$7)(a.snapshot.diagnostics.workspaceRoot)}. Existing workspaces stay where they are.`:"AgentOS reverted to the default workspace root. Existing workspaces were not moved."})}catch(e){j.o.error("Workspace root update failed.",{description:e instanceof Error?e.message:"Unable to update the default workspace root."})}finally{tc(!1)}},rN=(0,i.useCallback)((e,t)=>{switch(e){case"auto":return{mode:"auto",path:null,resolvedPath:null,label:"Auto",detail:"Use the managed resolution order."};case"local-prefix":return{mode:"local-prefix",path:null,resolvedPath:null,label:"Local prefix",detail:"Use the managed local prefix install."};case"global-path":return{mode:"global-path",path:null,resolvedPath:null,label:"Global PATH",detail:"Resolve the first executable named openclaw on PATH when saved."};default:{let e="string"==typeof t?t.trim():"";return{mode:"custom",path:e||null,resolvedPath:e||null,label:"Custom path",detail:e||"Enter an absolute path to an executable OpenClaw binary."}}}},[]),rk=(0,i.useCallback)(e=>{ti(t=>e===t.mode?"custom"===e?rN(e,t.path):t:"custom"===e?rN(e,t.path):rN(e))},[rN]),rC=(0,i.useCallback)(e=>{ti(rN("custom",e))},[rN]),rS=()=>{if(void 0===globalThis.localStorage)return;let e=[aS.M.surfaceTheme,aS.M.hiddenRuntimeIds,aS.M.hiddenTaskKeys,aS.M.lockedTaskKeys,"mission-control-workspace-plan-id","mission-control-recent-prompts","mission-control-node-positions",K.hy],t=["mission-control-active-workspace-id:","mission-control-node-positions:v2:","mission-control-composer-draft:","mission-control-agent-chat:v1:","mission-control-agent-chat-seen:v1:"];for(let t of e)globalThis.localStorage.removeItem(t);for(let e=globalThis.localStorage.length-1;e>=0;e-=1){let a=globalThis.localStorage.key(e);a&&t.some(e=>a.startsWith(e))&&globalThis.localStorage.removeItem(a)}en(),si()},rA=()=>{eM("idle"),eP(null),eD(null),eF("idle"),eW(null),eV(null),eB(null),eZ(""),e1("")},rI=async e=>{eM("loading"),eP(null),eD(null);try{let t=await fetch("/api/reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intent:"preview",target:e})}),a=await t.json().catch(()=>null);if(!t.ok||!a?.preview)throw Error(a?.error||"Reset preview could not be loaded.");eP(a.preview),eM("ready")}catch(e){eM("error"),eD(e instanceof Error?e.message:"Reset preview failed.")}},rT=async e=>{eI(!1),eR(e),rA(),await rI(e)},rO=async()=>{if(e_){eF("running"),eW("full-uninstall"===e_?"Starting full uninstall...":"Starting AgentOS reset..."),eV(null),eB(null),eZ("");try{let e=await fetch("/api/reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intent:"execute",target:e_,confirmed:!0})});if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||"Reset request failed.")}if(!e.body)throw Error("Reset request did not return a readable stream.");let t=e.body.getReader(),a=new TextDecoder,s="",r=!1;for(;;){let{value:e,done:n}=await t.read();if(n)break;let i=(s+=a.decode(e,{stream:!0})).indexOf("\n");for(;i>=0;){let e=s.slice(0,i).trim();if(s=s.slice(i+1),e){let t=JSON.parse(e);"status"===t.type?(eW(t.message),s8(`
23
23
  > ${t.message}
24
- `)):"log"===t.type?s4(`${t.text}
25
- `):(r=!0,eW(null),eV(t.message),eB(t.backgroundLogPath??null),eF(t.ok?"success":"error"),t.snapshot&&m(t.snapshot),t.ok?("full-uninstall"===eR&&s2(),rS(),j.o.success("full-uninstall"===eR?"Full uninstall started.":"AgentOS reset completed.",{description:t.message})):j.o.error("full-uninstall"===eR?"Full uninstall failed.":"AgentOS reset failed.",{description:t.message}))}i=s.indexOf("\n")}}let n=s.trim();if(n){let e=JSON.parse(n);"done"===e.type&&(r=!0,eW(null),eV(e.message),eB(e.backgroundLogPath??null),eF(e.ok?"success":"error"),e.snapshot&&m(e.snapshot),e.ok&&("full-uninstall"===eR&&s2(),rS()))}if(!r)throw Error("Reset stream ended unexpectedly.")}catch(e){eF("error"),eW(null),eV(e instanceof Error?e.message:"Reset failed."),j.o.error("full-uninstall"===eR?"Full uninstall failed.":"AgentOS reset failed.",{description:e instanceof Error?e.message:"Unknown reset error."})}}},rR=e=>{e||"running"!==eU&&(e$(null),rA())},r$=()=>{e$(null),rA(),rh("system")},rM=()=>{let e=sj;t$("Refreshing model status..."),s9(a).then(t=>{t&&(0,eY.h6)(t)&&(e=!0,al(!1))}).catch(()=>{}).finally(()=>{t$(null),tW(e0("models",e))})},r_={snapshot:a,surfaceTheme:J,connectionState:c,gatewayDraft:tt,workspaceRootDraft:ts,isSavingGateway:tl,isSavingWorkspaceRoot:td,isCheckingForUpdates:eT,updateRunState:th,selectedModelId:tz,modelOnboardingRunState:tK,gatewayControlAction:ac,lastCheckedAt:ap,onGatewayDraftChange:ta,onWorkspaceRootDraftChange:tr,onSelectedModelIdChange:tV,onSaveGatewaySettings:ry,onSaveWorkspaceRootSettings:rj,onCheckForUpdates:rv,onControlGateway:rf,onOpenSetupWizard:rh,onRunModelRefresh:rl,onRunModelSetDefault:rc,onOpenAddModels:rw,onOpenUpdateDialog:()=>{"idle"===th&&s0(),tx(!0)},onOpenResetDialog:e=>{rT(e)},openClawBinarySelection:tn,isSavingOpenClawBinary:tu,onOpenClawBinarySelectionModeChange:rk,onOpenClawBinarySelectionPathChange:rC,onSaveOpenClawBinarySettings:async e=>{tp(!0);try{let t=await fetch("/api/settings/openclaw-binary",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"OpenClaw binary selection could not be updated.")}let a=await t.json();m(a.snapshot),ti(a.selection);let s=a.selection.label||"OpenClaw binary";j.o.success("OpenClaw binary updated.",{description:"auto"===a.selection.mode?"AgentOS will use the managed resolution order.":`${s} is now the active choice.`})}catch(e){j.o.error("OpenClaw binary update failed.",{description:e instanceof Error?e.message:"Unable to update the OpenClaw binary."})}finally{tp(!1)}},installSummary:sS},rE=(0,s.jsxs)(s.Fragment,{children:[sR?(0,s.jsx)(tC,{snapshot:a,surfaceTheme:J,stage:sk,systemReady:"success"===tS||sj,modelReady:"success"===t9.phase||ar||sN,systemSetupRequired:ai,showReadyState:ar,systemActionLabel:sA.label,systemActionDescription:sA.description,systemPhase:tI,modelPhase:tH,systemRun:{runState:tS,statusMessage:tR,resultMessage:tM,log:tE,manualCommand:tL,docsUrl:tU},modelRun:{runState:tK,statusMessage:tX,resultMessage:t0,log:t2,manualCommand:t3,docsUrl:t4},modelSwitchFeedback:t9,selectedModelId:tz,discoveredModels:tq,onSelectedModelIdChange:tV,onClearModelSwitchFeedback:()=>t7(a8),onSnapshotChange:m,onRunSystemSetup:ra,onRunModelSetDefault:rc,onOpenAddModels:rw,onOpenGatewayAuthSettings:rg,onEnterAgentOS:rb,onCreateWorkspace:rx,onContinueToModels:rM,onBackToSystem:()=>tW("system"),onSelectStage:e=>{an(!1),tW(e0(e,sj))},launchpadCreateProgress:e3,launchpadCreateRunState:e2}):null,(0,s.jsx)(aO.L,{open:ah,onOpenChange:sH,initialMode:ab,workspaceEditId:aw,surfaceTheme:J,snapshot:a,onRefresh:u,onWorkspaceCreated:e=>{sb(e,{markPending:!0})},onWorkspaceUpdated:e=>{sb(e,{markPending:!0})}},aw?`workspace-edit:${aw}`:"workspace-create"),(0,s.jsx)(l.o,{open:aF,onOpenChange:aG,snapshot:a,initialProvider:aW,onSnapshotChange:m}),(0,s.jsx)(tO,{open:null!==eR,target:eR,surfaceTheme:J,previewState:eM,preview:eE,previewError:eL,runState:eU,statusMessage:eG,resultMessage:ez,backgroundLogPath:eJ,log:eH,confirmText:eX,onConfirmTextChange:e1,onRefreshPreview:()=>{eR&&rI(eR)},onExecute:()=>{rO()},onBackToSetup:r$,onOpenChange:rR}),(0,s.jsx)(eK,{snapshot:a,surfaceTheme:J,isInspectorOpen:!1,taskAbortRequest:ec,taskAbortRunState:ep,taskAbortMessage:ex,onTaskAbortOpenChange:e=>{"running"!==ep&&(e||(eu(null),em("idle"),eh(null)))},onTaskAbortConfirm:()=>{s7()},updateDialogOpen:tm,updateRunState:th,updateStatusMessage:tb,updateResultMessage:tw,updateLog:ty,updateManualCommand:tN,activeRuntimeCount:sy,updateInstallSummary:sS,onUpdateDialogOpenChange:e=>{"running"===th?tx(e):(tx(e),e||s0())},onRunOpenClawUpdate:()=>{rt()}})]});return"settings"===t?(0,s.jsxs)("div",{className:(0,k.cn)("mission-shell relative min-h-screen overflow-hidden","light"===J&&"mission-shell--light"),children:[(0,s.jsx)("div",{className:"mission-canvas-backdrop fixed inset-0 z-0",children:(0,s.jsx)("div",{"aria-hidden":"true",className:"mission-canvas-pattern absolute inset-0 z-0"})}),(0,s.jsx)("div",{className:(0,k.cn)("pointer-events-auto fixed left-0 top-0 z-30 hidden h-[100dvh] overflow-visible mission-ease-smooth transition-[width] duration-500 lg:block",eN?"w-[calc(100vw-96px)] max-w-[292px] lg:w-[292px] lg:max-w-none":"w-[56px]"),onMouseEnter:()=>ek(!0),onMouseLeave:()=>ek(!1),onFocusCapture:()=>ek(!0),onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||ek(!1)},children:(0,s.jsx)(ax.z,{snapshot:sh,surfaceTheme:J,activeWorkspaceId:x,requestedAgentAction:ei,connectionState:c,collapsed:!eN,settingsMode:!0,modelManager:{runState:tK,statusMessage:tX,resultMessage:t0,log:t2,manualCommand:t3,docsUrl:t4,discoveredModels:tq,systemReady:sj},onExpandCollapsed:()=>ek(!0),onToggleCollapsed:()=>ek(e=>!e),onSelectWorkspace:e=>{sb(e)},onRefresh:u,onRunModelRefresh:rl,onRunModelDiscover:ro,onRunModelSetDefault:rc,onConnectModelProvider:rd,onOpenModelSetup:()=>rh(),onOpenAddModels:rw,onOpenWorkspaceCreate:()=>sK("basic"),onEditWorkspace:sB,onSnapshotChange:m,onAgentCreationPending:sU,onAgentCreatedVisible:sD})}),eN?(0,s.jsx)("button",{type:"button","aria-label":"Close navigation",className:"fixed inset-0 z-40 bg-black/62 backdrop-blur-[2px] lg:hidden",onClick:()=>ek(!1)}):null,(0,s.jsx)("div",{className:(0,k.cn)("pointer-events-auto fixed left-0 top-0 z-50 h-[100dvh] overflow-hidden mission-ease-smooth bg-[#050a12] shadow-[18px_0_60px_rgba(0,0,0,0.42)] transition-[width] duration-300 lg:hidden",eN?"w-[min(86vw,292px)]":"w-[56px]"),onClickCapture:e=>{eN&&e.target instanceof Element&&e.target.closest("a")&&ek(!1)},children:(0,s.jsx)(ax.z,{snapshot:sh,surfaceTheme:J,activeWorkspaceId:x,requestedAgentAction:ei,connectionState:c,collapsed:!eN,settingsMode:!0,modelManager:{runState:tK,statusMessage:tX,resultMessage:t0,log:t2,manualCommand:t3,docsUrl:t4,discoveredModels:tq,systemReady:sj},onExpandCollapsed:()=>ek(!0),onToggleCollapsed:()=>ek(e=>!e),onSelectWorkspace:e=>{sb(e)},onRefresh:u,onRunModelRefresh:rl,onRunModelDiscover:ro,onRunModelSetDefault:rc,onConnectModelProvider:rd,onOpenModelSetup:()=>rh(),onOpenAddModels:rw,onOpenWorkspaceCreate:()=>sK("basic"),onEditWorkspace:sB,onSnapshotChange:m,onAgentCreationPending:sU,onAgentCreatedVisible:sD})}),(0,s.jsx)(tY,{...r_,sidebarOpen:eN}),(0,s.jsx)("div",{className:(0,k.cn)("pointer-events-none fixed top-0 z-40 hidden lg:block",eN?"lg:left-[316px]":"lg:left-[80px]","lg:right-[84px]"),children:(0,s.jsx)(aX,{settingsRef:sf,isSettingsOpen:eA,onToggleTheme:()=>B(e=>"light"===e?"dark":"light"),onToggleSettings:()=>eI(e=>!e),...r_})}),rE]}):(0,s.jsxs)("div",{className:(0,k.cn)("mission-shell relative min-h-screen overflow-hidden","light"===J&&"mission-shell--light"),children:[(0,s.jsxs)("div",{className:"mission-canvas-backdrop absolute inset-0 z-0",children:[(0,s.jsx)("div",{"aria-hidden":"true",className:"mission-canvas-pattern absolute inset-0 z-0"}),(0,s.jsx)("div",{className:"absolute inset-0 z-10",children:(0,s.jsx)(a1,{snapshot:sh,pendingCreatedAgents:ew,agentCreationWarnings:ey,accountTargets:a$,accountAccessRules:aP,activeWorkspaceId:x,selectedNodeId:g,focusedAgentId:v,recentCreatedAgentId:eb,composerTargetAgentId:C,activeChatAgentId:sx,isComposerActive:I,composerViewportResetNonce:$,recentDispatchId:F,hiddenRuntimeIds:H,hiddenTaskKeys:Y,lockedTaskKeys:ee,onToggleWorkspaceTaskCards:sM,className:"rounded-none",onEditAgent:e=>{ss(e),el({requestId:`edit:${e}:${Date.now()}`,kind:"edit",agentId:e})},onDeleteAgent:e=>{ss(e),el({requestId:`delete:${e}:${Date.now()}`,kind:"delete",agentId:e})},onFocusAgent:s_,onCreateTaskAgent:sz,onConfigureAgentModel:sL,onConfigureAgentCapabilities:sP,onInspectAgentDetail:sE,onOpenWorkspaceChannels:sY,onOpenWorkspaceFiles:sX,onMessageAgent:e=>{let t=sh.agents.find(t=>t.id===e);t&&(el(null),h(t.workspaceId),ss(e,"chat"),eS(!0))},onReplyTask:e=>{let t=(0,eq.sL)(e);R(!0),q({id:`reply:${e.id}:${Date.now()}`,mission:t,agentId:e.primaryAgentId,sourceKind:"reply",sourceLabel:e.title.trim()||e.subtitle.trim()||e.id})},onCopyTaskPrompt:async e=>{let t=(0,eq.sL)(e);R(!0),q({id:`copy:${e.id}:${Date.now()}`,mission:t,agentId:e.primaryAgentId,sourceKind:"copy",sourceLabel:e.title.trim()||e.subtitle.trim()||e.id});try{await navigator.clipboard.writeText(t),j.o.success("Prompt copied to clipboard.",{description:"The mission input was also populated."})}catch{j.o.message("Prompt moved into mission input.",{description:"Clipboard access was not available."})}},onHideTask:e=>{er.includes(e.key)||(Q(t=>t.includes(e.key)?t:[...t,e.key]),Z(t=>{let a=new Set(t);return e.runtimeIds.forEach(e=>a.add(e)),Array.from(a)}))},onToggleTaskLock:e=>{et(t=>{let a=Array.isArray(t)?t:[];return a.includes(e.key)?a.filter(t=>t!==e.key):[...a,e.key]})},onAbortTask:e=>{(0,eq.ss)(e)&&(eu(e),em("idle"),eh(null))},onInspectTask:(e,t,a)=>{L(a??null),ss(e.id,t),eS(!0)},onActiveTaskCardChange:(e,t)=>{g===e.id&&L(t)},onReviewTask:sl,onSelectNode:e=>{ss(e)},onCanvasNodePointerDownCapture:sV})})]}),(0,s.jsx)("div",{className:(0,k.cn)("pointer-events-none absolute top-0 z-40 hidden lg:block",eN?"lg:left-[316px]":"lg:left-[80px]",eC?"lg:right-[426px]":"lg:right-[84px]"),children:(0,s.jsx)(aX,{settingsRef:sf,isSettingsOpen:eA,onToggleTheme:()=>B(e=>"light"===e?"dark":"light"),onToggleSettings:()=>eI(e=>!e),...r_})}),(0,s.jsxs)("div",{className:"relative z-20 min-h-screen pointer-events-none lg:h-screen",children:[(0,s.jsx)("div",{className:"pointer-events-none absolute left-1/2 top-4 z-30 -translate-x-1/2 lg:hidden",children:(0,s.jsx)(aY,{surfaceTheme:J})}),(0,s.jsx)("div",{className:"pointer-events-none absolute left-[80px] top-6 z-10 hidden lg:block",children:(0,s.jsx)(aY,{surfaceTheme:J})}),(0,s.jsx)("div",{className:(0,k.cn)("pointer-events-auto absolute left-0 top-0 z-30 h-[100dvh] overflow-visible mission-ease-smooth transition-[width] duration-500",eN?"w-[calc(100vw-96px)] max-w-[292px] lg:w-[292px] lg:max-w-none":"w-[56px]"),onMouseEnter:()=>ek(!0),onMouseLeave:()=>ek(!1),onFocusCapture:()=>ek(!0),onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||ek(!1)},children:(0,s.jsx)(ax.z,{snapshot:sh,surfaceTheme:J,activeWorkspaceId:x,requestedAgentAction:ei,connectionState:c,collapsed:!eN,modelManager:{runState:tK,statusMessage:tX,resultMessage:t0,log:t2,manualCommand:t3,docsUrl:t4,discoveredModels:tq,systemReady:sj},onExpandCollapsed:()=>ek(!0),onToggleCollapsed:()=>ek(e=>!e),onSelectWorkspace:e=>{sb(e)},onRefresh:u,onRunModelRefresh:rl,onRunModelDiscover:ro,onRunModelSetDefault:rc,onConnectModelProvider:rd,onOpenModelSetup:()=>rh(),onOpenAddModels:rw,onOpenWorkspaceCreate:()=>sK("basic"),onEditWorkspace:sB,onSnapshotChange:m,onAgentCreationPending:sU,onAgentCreatedVisible:sD})}),(0,s.jsx)("div",{className:(0,k.cn)("pointer-events-auto absolute right-0 top-0 z-30 h-[100dvh] overflow-visible mission-ease-smooth transition-[width] duration-500",eC?"w-[calc(100vw-112px)] max-w-[300px] lg:w-[394px] lg:max-w-none":"w-[60px]"),children:(0,s.jsx)(X,{snapshot:sh,surfaceTheme:J,selectedNodeId:g,activeTaskCard:P,agentDetailFocus:f,lastMission:D,onRefresh:u,onSnapshotChange:m,onConfigureAgentCapabilities:sP,onConnectModelProvider:e=>{rd(e,{autoOpenTerminal:!0})},collapsed:!eC,onToggleCollapsed:()=>eS(e=>!e),activeTab:_,onActiveTabChange:E,onAbortTask:e=>{(0,eq.ss)(e)&&(eu(e),em("idle"),eh(null))}})}),(0,s.jsx)(d.z,{open:!!eo,agentId:eo?.agentId??null,initialFocus:eo?.focus??"skills",snapshot:sh,onOpenChange:sG,onSnapshotChange:e=>m(e),onRefresh:async()=>{await p({force:!0})}}),(0,s.jsx)(o.r,{open:!!aV,agentId:aV?.agentId??null,snapshot:sh,onOpenChange:sF,onSnapshotChange:e=>m(e),onRefresh:u,onOpenAddModels:()=>{aq(null),rw(null)}}),(0,s.jsxs)("div",{className:"pointer-events-auto absolute bottom-[calc(env(safe-area-inset-bottom)+12px)] left-4 right-4 z-40 lg:bottom-6 lg:left-1/2 lg:right-auto lg:w-[min(800px,calc(100vw-320px))] lg:-translate-x-1/2",children:[(0,s.jsxs)("div",{className:"mx-auto mb-1 flex w-fit flex-col items-start gap-1",children:[s$>0?(0,s.jsxs)("div",{className:"inline-flex items-center gap-1.5 rounded-full border border-white/[0.08] bg-[linear-gradient(180deg,rgba(10,16,26,0.96),rgba(6,10,18,0.94))] px-3 py-1 text-[8px] text-slate-200 shadow-[0_10px_24px_rgba(0,0,0,0.14)]",children:[(0,s.jsx)(r.A,{className:"h-3 w-3 text-slate-400"}),(0,s.jsxs)("span",{className:"leading-3 text-slate-300",children:[s$," hidden"]})]}):null,v?(0,s.jsxs)("button",{type:"button",onClick:sJ,className:"inline-flex items-center gap-1.5 rounded-full border border-cyan-300/18 bg-[linear-gradient(180deg,rgba(16,25,38,0.98),rgba(8,12,20,0.96))] px-3 py-1 text-[8px] text-cyan-100 shadow-[0_10px_24px_rgba(0,0,0,0.14)] transition-colors hover:border-cyan-200/30 hover:bg-[linear-gradient(180deg,rgba(20,33,49,0.98),rgba(10,15,25,0.96))]","aria-label":"Reset focus and show the full workspace",title:"Reset Focus",children:[(0,s.jsx)(n.A,{className:"h-3 w-3 text-cyan-300"}),(0,s.jsx)("span",{className:"leading-3 text-cyan-50",children:"Reset Focus"})]}):null]}),O?(0,s.jsx)(S,{snapshot:sh,surfaceTheme:J,activeWorkspaceId:x,selectedNodeId:g,composeIntent:V,isComposerActive:I,onTargetAgentChange:A,onTargetAgentSelect:sW,onComposerActiveChange:sq,onRefresh:u,onOpenWorkspaceCreate:()=>{sK("basic")},onOpenWorkspaceChannels:sY,onAgentCreationPending:sU,onAgentCreatedVisible:sD,onMissionDispatchStart:e=>{eg.current.set(e.requestId,e.abortController);let t=(0,eq.Ig)(e,a);z(a=>[t,...a.filter(t=>t.requestId!==e.requestId)]),e.workspaceId&&h(e.workspaceId),ss(t.task.id),eS(!0)},onMissionDispatchFailure:(e,t)=>{eg.current.delete(e),z(a=>a.map(a=>a.requestId===e?{...a,task:(0,eq.GU)(a.task,{status:"stalled",subtitle:t,bootstrapStage:"stalled",feedEvent:{id:`${a.task.id}:failed:${Date.now()}`,kind:"warning",timestamp:new Date().toISOString(),title:"Dispatch failed",detail:t,isError:!0}})}:a))},onMissionResponse:(e,t)=>{var a;eg.current.delete(t.requestId),U(e);let s="stalled"===e.status&&"string"==typeof(a=e.summary)&&(/No transcript file was found for this runtime session/i.test(a)||/No transcript entries were found for this runtime/i.test(a));z(a=>a.map(a=>a.requestId===t.requestId?{...a,dispatchId:e.dispatchId??a.dispatchId,task:(0,eq.GU)(a.task,{dispatchId:e.dispatchId,status:s?"running":"stalled"===e.status?"stalled":"cancelled"===e.status?"cancelled":"completed"===e.status?"completed":"queued",subtitle:e.summary,bootstrapStage:s?"runtime-observed":"stalled"===e.status?"stalled":"cancelled"===e.status?"cancelled":"completed"===e.status?"completed":"accepted",feedEvent:{id:`${a.task.id}:response:${Date.now()}`,kind:"cancelled"!==e.status&&("stalled"!==e.status||s)?"status":"warning",timestamp:new Date().toISOString(),title:s?"Waiting for output":"stalled"===e.status?"Dispatch blocked":"cancelled"===e.status?"Dispatch cancelled":"completed"===e.status?"Mission finished":"Mission accepted",detail:s?"The runtime is live, but AgentOS has not captured transcript output yet.":e.summary||"Mission accepted and queued for OpenClaw execution.",isError:"cancelled"===e.status||"stalled"===e.status&&!s}})}:a)),e.dispatchId&&G(e.dispatchId)}}):null]}),(0,s.jsx)(aI._,{snapshot:sh,workspaceId:x??sh.workspaces[0]?.id??null,accountTargets:a$,accountAccessRules:aP,initialAgentId:ak,open:aj,onOpenChange:e=>{aN(e),e||aC(null)},onRefresh:u,onSnapshotChange:m,onAccountAccessRulesChange:aL,onAccountTargetsChange:aE}),(0,s.jsx)(aT.W,{snapshot:sh,workspaceId:aD,open:null!==aD,onOpenChange:sQ}),(0,s.jsx)(ay,{open:!!sr,task:sg,snapshot:sh,surfaceTheme:J,onOpenChange:e=>{e||so()},onAccept:sd,onContinue:su,onRetry:sp,onDismiss:sc,onOpenEvidence:sm}),sR?(0,s.jsx)(tC,{snapshot:a,surfaceTheme:J,stage:sk,systemReady:"success"===tS||sj,modelReady:"success"===t9.phase||ar||sN,systemSetupRequired:ai,showReadyState:ar,systemActionLabel:sA.label,systemActionDescription:sA.description,systemPhase:tI,modelPhase:tH,systemRun:{runState:tS,statusMessage:tR,resultMessage:tM,log:tE,manualCommand:tL,docsUrl:tU},modelRun:{runState:tK,statusMessage:tX,resultMessage:t0,log:t2,manualCommand:t3,docsUrl:t4},modelSwitchFeedback:t9,selectedModelId:tz,discoveredModels:tq,onSelectedModelIdChange:tV,onClearModelSwitchFeedback:()=>t7(a8),onSnapshotChange:m,onRunSystemSetup:ra,onRunModelSetDefault:rc,onOpenAddModels:rw,onOpenGatewayAuthSettings:rg,onEnterAgentOS:rb,onCreateWorkspace:rx,onContinueToModels:rM,onBackToSystem:()=>tW("system"),onSelectStage:e=>{an(!1),tW(e0(e,sj))},launchpadCreateProgress:e3,launchpadCreateRunState:e2}):null,(0,s.jsx)(aO.L,{open:ah,onOpenChange:sH,initialMode:ab,workspaceEditId:aw,surfaceTheme:J,snapshot:a,onRefresh:u,onWorkspaceCreated:e=>{sb(e,{markPending:!0})},onWorkspaceUpdated:e=>{sb(e,{markPending:!0})}},aw?`workspace-edit:${aw}`:"workspace-create"),(0,s.jsx)(l.o,{open:aF,onOpenChange:aG,snapshot:a,initialProvider:aW,onSnapshotChange:m}),(0,s.jsx)(tO,{open:null!==eR,target:eR,surfaceTheme:J,previewState:eM,preview:eE,previewError:eL,runState:eU,statusMessage:eG,resultMessage:ez,backgroundLogPath:eJ,log:eH,confirmText:eX,onConfirmTextChange:e1,onRefreshPreview:()=>{eR&&rI(eR)},onExecute:()=>{rO()},onBackToSetup:r$,onOpenChange:rR}),(0,s.jsx)(eK,{snapshot:a,surfaceTheme:J,isInspectorOpen:eC,taskAbortRequest:ec,taskAbortRunState:ep,taskAbortMessage:ex,onTaskAbortOpenChange:e=>{"running"!==ep&&(e||(eu(null),em("idle"),eh(null)))},onTaskAbortConfirm:()=>{s7()},updateDialogOpen:tm,updateRunState:th,updateStatusMessage:tb,updateResultMessage:tw,updateLog:ty,updateManualCommand:tN,activeRuntimeCount:sy,updateInstallSummary:sS,onUpdateDialogOpenChange:e=>{"running"===th?tx(e):(tx(e),e||s0())},onRunOpenClawUpdate:()=>{rt()}})]})]})}},57442:(e,t,a)=>{Promise.resolve().then(a.bind(a,26580))},81076:(e,t,a)=>{"use strict";function s(e,t){return`surface-module-v1:${e.workspaceId}:${e.id}:${t}`}function r(e,t){return`account-module-v1:${e.workspaceId}:${e.id}:${t}`}function n(e,t,a,s=212,r=220){let i=Math.round(Math.max(88,.42*s)),l=Math.round(Math.max(34,.18*r));return{x:e.x-i,y:Math.round(e.y-l-(a>1?(a-1)*76/2:0)+76*t)}}function i(e,t,a,s){let r=(t.x-e.x)*220-20*a.x,n=(t.y-e.y)*220-20*a.y;a.x+=r*s,a.y+=n*s;let i={x:e.x+a.x*s,y:e.y+a.y*s};return .35>Math.abs(t.x-i.x)&&.35>Math.abs(t.y-i.y)&&.35>Math.abs(a.x)&&.35>Math.abs(a.y)?(a.x=0,a.y=0,{position:t,settled:!0}):{position:i,settled:!1}}a.d(t,{Gh:()=>r,Jz:()=>i,Wn:()=>s,mI:()=>n})},88790:(e,t,a)=>{"use strict";a.d(t,{G:()=>m});var s=a(36366),r=a(58359),n=a(23688),i=a(48583),l=a(82711),o=a(23351);let d=/https?:\/\/[^\s<>"'`)\]]+/g,c=/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi,u=/(?:^|[\s(])((?:\.{1,2}\/)?(?:deliverables|memory|docs|app|components|lib|public|scripts|packages|hooks|output)\/[^\s`),;]+)/g,p=/`((?:\/|\.{1,2}\/|deliverables\/|memory\/|docs\/|app\/|components\/|lib\/|public\/|scripts\/|packages\/|hooks\/|output\/)[^`\n]+)`/g;function m({text:e,className:t,url:a,filePath:i,displayPath:g,basePath:b,compact:f=!1}){let w=function(e,t){let a=new Set;for(let s of(t&&a.add(t),e.matchAll(d)))s[0]&&a.add(s[0]);return[...a]}(e,a),v=function(e){let t=new Set;for(let a of e.matchAll(c))a[0]&&t.add(a[0]);return[...t]}(e),y=function(e,t,a){var s,r;let n,i,l=[],o=(s=t,r=a,n=x(s),i=x(r),n&&i&&n.startsWith("/")?{path:n.replace(/\/+$/,""),label:i.replace(/\/+$/,"")}:null),d=(e,t)=>{let a=function(e,t){let a=x(e);if(!a)return null;if(a.startsWith("/")||!t)return a;if(a===t.label)return t.path;let s=`${t.label}/`;if(!a.startsWith(s))return a;let r=a.slice(s.length).replace(/^\/+/,"");return r?`${t.path}/${r}`:t.path}(e,o),s=x(t||e);a&&s&&(l.some(e=>x(e.path)===a||x(e.label)===s)||l.push({path:a,label:s}))};for(let s of(t&&d(t,a||t),e.matchAll(p))){let e=x(s[1]);e&&d(e,e)}for(let t of e.matchAll(u)){let e=x(t[1]);e&&d(e,e)}return l}(e,i,g);return(0,s.jsxs)("div",{className:(0,o.cn)("space-y-2",f&&"space-y-1.5"),children:[(0,s.jsx)("p",{className:(0,o.cn)("whitespace-pre-wrap break-words",t),children:function(e){let t=Array.from(e.matchAll(d));if(0===t.length)return e;let a=[],r=0;for(let[n]of t){let t=e.indexOf(n,r);t>r&&a.push(e.slice(r,t)),a.push((0,s.jsx)("a",{href:n,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:e=>e.stopPropagation(),children:n},`${n}:${t}`)),r=t+n.length}return r<e.length&&a.push(e.slice(r)),a}(e)}),w.length>0||v.length>0||y.length>0?(0,s.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[w.map(e=>(0,s.jsxs)("a",{href:e,target:"_blank",rel:"noreferrer",className:(0,o.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]",f&&"px-1.5 py-[3px] text-[9px]"),onClick:e=>e.stopPropagation(),children:[(0,s.jsx)(r.A,{className:(0,o.cn)("h-3 w-3 shrink-0",f&&"h-2.5 w-2.5")}),(0,s.jsx)("span",{className:"truncate",children:function(e){try{let t=new URL(e);return`${t.hostname}${"/"===t.pathname?"":t.pathname}`}catch{return e}}(e)})]},e)),v.map(e=>(0,s.jsxs)("a",{href:`mailto:${e}`,className:(0,o.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]",f&&"px-1.5 py-[3px] text-[9px]"),onClick:e=>e.stopPropagation(),children:[(0,s.jsx)(r.A,{className:(0,o.cn)("h-3 w-3 shrink-0",f&&"h-2.5 w-2.5")}),(0,s.jsx)("span",{className:"truncate",children:e})]},e)),y.map(e=>(0,s.jsxs)("button",{type:"button",className:(0,o.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]",f&&"px-1.5 py-[3px] text-[9px]"),onClick:t=>{t.stopPropagation(),h(e.path,b)},children:[(0,s.jsx)(n.A,{className:(0,o.cn)("h-3 w-3 shrink-0",f&&"h-2.5 w-2.5")}),(0,s.jsx)("span",{className:"truncate",children:(0,l.$7)(e.label)})]},`${e.path}:${e.label}`))]}):null]})}function x(e){let t=e?.trim();return t?t.replace(/[.,:;]+$/g,""):null}async function h(e,t){try{let a=await fetch("/api/files/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,basePath:t??null})}),s=await a.json();if(!a.ok)throw Error(s.error||"Unable to reveal file.");i.oR.success("Revealed file.",{description:(0,l.$7)(e)})}catch(e){i.oR.error("Could not reveal file.",{description:e instanceof Error?e.message:"Unknown file reveal error."})}}},93028:(e,t,a)=>{"use strict";a.d(t,{B4:()=>u,E2:()=>m,HR:()=>r,Kf:()=>i,UF:()=>o,VL:()=>c,hy:()=>s,kg:()=>d,l_:()=>p,ss:()=>n,wg:()=>l});let s="mission-control-task-review-state-v1";function r(e){let t="string"==typeof e.key?e.key.trim():"",a="string"==typeof e.dispatchId?e.dispatchId.trim():"";return t||a||e.id}function n(e,t,a,s=new Date().toISOString()){return{taskId:e.id,taskKey:r(e),status:t,action:a,reviewedAt:s}}function i(e){if(!e)return{};try{let a=JSON.parse(e);if(!a||"object"!=typeof a||Array.isArray(a))return{};let s={};for(let[e,r]of Object.entries(a)){var t;(t=r)&&"object"==typeof t&&"string"==typeof t.taskId&&"string"==typeof t.taskKey&&x(t.status)&&"string"==typeof t.action&&"string"==typeof t.reviewedAt&&(s[e]={...r,taskKey:r.taskKey||e})}return s}catch{return{}}}function l(e,t){if(0===Object.keys(t).length)return e;let a=!1,s=e.tasks.map(e=>{var s,n,i,l;let o=t[r(e)];return o?(a=!0,s=e,n=o,{...s,metadata:{...s.metadata,reviewStatus:n.status,reviewAction:n.action,reviewedAt:n.reviewedAt,reviewEvents:[(i=s,l=n,{id:`task-review:${l.taskKey}:${l.status}`,kind:"accepted"===l.status||"continued"===l.status?"status":"warning",timestamp:l.reviewedAt,title:function(e){switch(e){case"accepted":return"Review accepted";case"continued":return"Continuation accepted";case"retried":return"Retry drafted";case"dismissed":return"Review dismissed"}}(l.status),detail:`${m(l.status)} Task: ${i.title.trim()||i.id}.`})]}}):e});return a?{...e,tasks:s}:e}function o(e){let t=e.metadata.reviewedAt;return"string"==typeof t&&t.trim().length>0?t:null}function d(e){let t=e.metadata.reviewAction;return"string"==typeof t&&t.trim().length>0?t:null}function c(e,t={}){let a,s=x(a=e.metadata.reviewStatus)?a:null;return"continued"!==s?s:!function(e,t={}){let a=o(e),s=a?Date.parse(a):NaN;return!(!Number.isNaN(s)&&function(e,t){if(!e)return!1;let a=Date.parse(e);return!Number.isNaN(a)&&a>t}(t.latestEvidenceAt,s))&&(!!t.hasLiveActivity||!Number.isNaN(s)&&(t.nowMs??Date.now())-s<12e4)}(e,t)?null:s}function u(e){switch(e){case"accepted":return"accepted";case"continued":return"continuing";case"retried":return"retry drafted";case"dismissed":return"dismissed"}}function p(e){switch(e){case"accepted":return"review accepted";case"continued":return"continuation accepted";case"retried":return"retry drafted";case"dismissed":return"review dismissed"}}function m(e){switch(e){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."}}function x(e){return"accepted"===e||"continued"===e||"retried"===e||"dismissed"===e}}}]);
24
+ `)):"log"===t.type?s8(`${t.text}
25
+ `):(r=!0,eW(null),eV(t.message),eB(t.backgroundLogPath??null),eF(t.ok?"success":"error"),t.snapshot&&m(t.snapshot),t.ok?("full-uninstall"===e_&&s2(),rS(),j.o.success("full-uninstall"===e_?"Full uninstall started.":"AgentOS reset completed.",{description:t.message})):j.o.error("full-uninstall"===e_?"Full uninstall failed.":"AgentOS reset failed.",{description:t.message}))}i=s.indexOf("\n")}}let n=s.trim();if(n){let e=JSON.parse(n);"done"===e.type&&(r=!0,eW(null),eV(e.message),eB(e.backgroundLogPath??null),eF(e.ok?"success":"error"),e.snapshot&&m(e.snapshot),e.ok&&("full-uninstall"===e_&&s2(),rS()))}if(!r)throw Error("Reset stream ended unexpectedly.")}catch(e){eF("error"),eW(null),eV(e instanceof Error?e.message:"Reset failed."),j.o.error("full-uninstall"===e_?"Full uninstall failed.":"AgentOS reset failed.",{description:e instanceof Error?e.message:"Unknown reset error."})}}},r_=e=>{e||"running"!==eU&&(eR(null),rA())},rR=()=>{eR(null),rA(),rh("system")},r$=()=>{let e=sj;tR("Refreshing model status..."),s9(a).then(t=>{t&&(0,eY.h6)(t)&&(e=!0,al(!1))}).catch(()=>{}).finally(()=>{tR(null),tW(e0("models",e))})},rM={snapshot:a,surfaceTheme:J,connectionState:c,gatewayDraft:tt,workspaceRootDraft:ts,isSavingGateway:tl,isSavingWorkspaceRoot:td,isCheckingForUpdates:eT,updateRunState:th,selectedModelId:tz,modelOnboardingRunState:tK,gatewayControlAction:ac,lastCheckedAt:ap,onGatewayDraftChange:ta,onWorkspaceRootDraftChange:tr,onSelectedModelIdChange:tV,onSaveGatewaySettings:ry,onSaveWorkspaceRootSettings:rj,onCheckForUpdates:rv,onControlGateway:rf,onOpenSetupWizard:rh,onRunModelRefresh:rl,onRunModelSetDefault:rc,onOpenAddModels:rw,onOpenUpdateDialog:()=>{"idle"===th&&s0(),tx(!0)},onOpenResetDialog:e=>{rT(e)},openClawBinarySelection:tn,isSavingOpenClawBinary:tu,onOpenClawBinarySelectionModeChange:rk,onOpenClawBinarySelectionPathChange:rC,onSaveOpenClawBinarySettings:async e=>{tp(!0);try{let t=await fetch("/api/settings/openclaw-binary",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"OpenClaw binary selection could not be updated.")}let a=await t.json();m(a.snapshot),ti(a.selection);let s=a.selection.label||"OpenClaw binary";j.o.success("OpenClaw binary updated.",{description:"auto"===a.selection.mode?"AgentOS will use the managed resolution order.":`${s} is now the active choice.`})}catch(e){j.o.error("OpenClaw binary update failed.",{description:e instanceof Error?e.message:"Unable to update the OpenClaw binary."})}finally{tp(!1)}},installSummary:sS},rE=(0,s.jsxs)(s.Fragment,{children:[s_?(0,s.jsx)(tC,{snapshot:a,surfaceTheme:J,stage:sk,systemReady:"success"===tS||sj,modelReady:"success"===t9.phase||ar||sN,systemSetupRequired:ai,showReadyState:ar,systemActionLabel:sA.label,systemActionDescription:sA.description,systemPhase:tI,modelPhase:tH,systemRun:{runState:tS,statusMessage:t_,resultMessage:t$,log:tE,manualCommand:tL,docsUrl:tU},modelRun:{runState:tK,statusMessage:tX,resultMessage:t0,log:t2,manualCommand:t3,docsUrl:t8},modelSwitchFeedback:t9,selectedModelId:tz,discoveredModels:tq,onSelectedModelIdChange:tV,onClearModelSwitchFeedback:()=>t7(a4),onSnapshotChange:m,onRunSystemSetup:ra,onRunModelSetDefault:rc,onOpenAddModels:rw,onOpenGatewayAuthSettings:rg,onEnterAgentOS:rb,onCreateWorkspace:rx,onContinueToModels:r$,onBackToSystem:()=>tW("system"),onSelectStage:e=>{an(!1),tW(e0(e,sj))},launchpadCreateProgress:e3,launchpadCreateRunState:e2}):null,(0,s.jsx)(aO.L,{open:ah,onOpenChange:sH,initialMode:ab,workspaceEditId:aw,surfaceTheme:J,snapshot:a,onRefresh:u,onWorkspaceCreated:e=>{sb(e,{markPending:!0})},onWorkspaceUpdated:e=>{sb(e,{markPending:!0})}},aw?`workspace-edit:${aw}`:"workspace-create"),(0,s.jsx)(l.o,{open:aF,onOpenChange:aG,snapshot:a,initialProvider:aW,onSnapshotChange:m}),(0,s.jsx)(tO,{open:null!==e_,target:e_,surfaceTheme:J,previewState:e$,preview:eE,previewError:eL,runState:eU,statusMessage:eG,resultMessage:ez,backgroundLogPath:eJ,log:eH,confirmText:eX,onConfirmTextChange:e1,onRefreshPreview:()=>{e_&&rI(e_)},onExecute:()=>{rO()},onBackToSetup:rR,onOpenChange:r_}),(0,s.jsx)(eK,{snapshot:a,surfaceTheme:J,isInspectorOpen:!1,taskAbortRequest:ec,taskAbortRunState:ep,taskAbortMessage:ex,onTaskAbortOpenChange:e=>{"running"!==ep&&(e||(eu(null),em("idle"),eh(null)))},onTaskAbortConfirm:()=>{s7()},updateDialogOpen:tm,updateRunState:th,updateStatusMessage:tb,updateResultMessage:tw,updateLog:ty,updateManualCommand:tN,activeRuntimeCount:sy,updateInstallSummary:sS,onUpdateDialogOpenChange:e=>{"running"===th?tx(e):(tx(e),e||s0())},onRunOpenClawUpdate:()=>{rt()}})]});return"settings"===t?(0,s.jsxs)("div",{className:(0,k.cn)("mission-shell relative min-h-screen overflow-hidden","light"===J&&"mission-shell--light"),children:[(0,s.jsx)("div",{className:"mission-canvas-backdrop fixed inset-0 z-0",children:(0,s.jsx)("div",{"aria-hidden":"true",className:"mission-canvas-pattern absolute inset-0 z-0"})}),(0,s.jsx)("div",{className:(0,k.cn)("pointer-events-auto fixed left-0 top-0 z-30 hidden h-[100dvh] overflow-visible mission-ease-smooth transition-[width] duration-500 lg:block",eN?"w-[calc(100vw-96px)] max-w-[292px] lg:w-[292px] lg:max-w-none":"w-[56px]"),onMouseEnter:()=>ek(!0),onMouseLeave:()=>ek(!1),onFocusCapture:()=>ek(!0),onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||ek(!1)},children:(0,s.jsx)(ax.z,{snapshot:sh,surfaceTheme:J,activeWorkspaceId:x,requestedAgentAction:ei,connectionState:c,collapsed:!eN,settingsMode:!0,modelManager:{runState:tK,statusMessage:tX,resultMessage:t0,log:t2,manualCommand:t3,docsUrl:t8,discoveredModels:tq,systemReady:sj},onExpandCollapsed:()=>ek(!0),onToggleCollapsed:()=>ek(e=>!e),onSelectWorkspace:e=>{sb(e)},onRefresh:u,onRunModelRefresh:rl,onRunModelDiscover:ro,onRunModelSetDefault:rc,onConnectModelProvider:rd,onOpenModelSetup:()=>rh(),onOpenAddModels:rw,onOpenWorkspaceCreate:()=>sK("basic"),onEditWorkspace:sB,onSnapshotChange:m,onAgentCreationPending:sU,onAgentCreatedVisible:sD})}),eN?(0,s.jsx)("button",{type:"button","aria-label":"Close navigation",className:"fixed inset-0 z-40 bg-black/62 backdrop-blur-[2px] lg:hidden",onClick:()=>ek(!1)}):null,(0,s.jsx)("div",{className:(0,k.cn)("pointer-events-auto fixed left-0 top-0 z-50 h-[100dvh] overflow-hidden mission-ease-smooth bg-[#050a12] shadow-[18px_0_60px_rgba(0,0,0,0.42)] transition-[width] duration-300 lg:hidden",eN?"w-[min(86vw,292px)]":"w-[56px]"),onClickCapture:e=>{eN&&e.target instanceof Element&&e.target.closest("a")&&ek(!1)},children:(0,s.jsx)(ax.z,{snapshot:sh,surfaceTheme:J,activeWorkspaceId:x,requestedAgentAction:ei,connectionState:c,collapsed:!eN,settingsMode:!0,modelManager:{runState:tK,statusMessage:tX,resultMessage:t0,log:t2,manualCommand:t3,docsUrl:t8,discoveredModels:tq,systemReady:sj},onExpandCollapsed:()=>ek(!0),onToggleCollapsed:()=>ek(e=>!e),onSelectWorkspace:e=>{sb(e)},onRefresh:u,onRunModelRefresh:rl,onRunModelDiscover:ro,onRunModelSetDefault:rc,onConnectModelProvider:rd,onOpenModelSetup:()=>rh(),onOpenAddModels:rw,onOpenWorkspaceCreate:()=>sK("basic"),onEditWorkspace:sB,onSnapshotChange:m,onAgentCreationPending:sU,onAgentCreatedVisible:sD})}),(0,s.jsx)(tY,{...rM,sidebarOpen:eN}),(0,s.jsx)("div",{className:(0,k.cn)("pointer-events-none fixed top-0 z-40 hidden lg:block",eN?"lg:left-[316px]":"lg:left-[80px]","lg:right-[84px]"),children:(0,s.jsx)(aX,{settingsRef:sf,isSettingsOpen:eA,onToggleTheme:()=>B(e=>"light"===e?"dark":"light"),onToggleSettings:()=>eI(e=>!e),...rM})}),rE]}):(0,s.jsxs)("div",{className:(0,k.cn)("mission-shell relative min-h-screen overflow-hidden","light"===J&&"mission-shell--light"),children:[(0,s.jsxs)("div",{className:"mission-canvas-backdrop absolute inset-0 z-0",children:[(0,s.jsx)("div",{"aria-hidden":"true",className:"mission-canvas-pattern absolute inset-0 z-0"}),(0,s.jsx)("div",{className:"absolute inset-0 z-10",children:(0,s.jsx)(a1,{snapshot:sh,pendingCreatedAgents:ew,agentCreationWarnings:ey,accountTargets:aR,accountAccessRules:aP,activeWorkspaceId:x,selectedNodeId:g,focusedAgentId:v,recentCreatedAgentId:eb,composerTargetAgentId:C,activeChatAgentId:sx,isComposerActive:I,composerViewportResetNonce:R,recentDispatchId:F,hiddenRuntimeIds:H,hiddenTaskKeys:Y,lockedTaskKeys:ee,onToggleWorkspaceTaskCards:s$,className:"rounded-none",onEditAgent:e=>{ss(e),el({requestId:`edit:${e}:${Date.now()}`,kind:"edit",agentId:e})},onDeleteAgent:e=>{ss(e),el({requestId:`delete:${e}:${Date.now()}`,kind:"delete",agentId:e})},onFocusAgent:sM,onCreateTaskAgent:sz,onConfigureAgentModel:sL,onConfigureAgentCapabilities:sP,onInspectAgentDetail:sE,onOpenWorkspaceChannels:sY,onOpenWorkspaceFiles:sX,onMessageAgent:e=>{let t=sh.agents.find(t=>t.id===e);t&&(el(null),h(t.workspaceId),ss(e,"chat"),eS(!0))},onReplyTask:e=>{let t=(0,eq.sL)(e);_(!0),q({id:`reply:${e.id}:${Date.now()}`,mission:t,agentId:e.primaryAgentId,sourceKind:"reply",sourceLabel:e.title.trim()||e.subtitle.trim()||e.id})},onCopyTaskPrompt:async e=>{let t=(0,eq.sL)(e);_(!0),q({id:`copy:${e.id}:${Date.now()}`,mission:t,agentId:e.primaryAgentId,sourceKind:"copy",sourceLabel:e.title.trim()||e.subtitle.trim()||e.id});try{await navigator.clipboard.writeText(t),j.o.success("Prompt copied to clipboard.",{description:"The mission input was also populated."})}catch{j.o.message("Prompt moved into mission input.",{description:"Clipboard access was not available."})}},onHideTask:e=>{er.includes(e.key)||(Q(t=>t.includes(e.key)?t:[...t,e.key]),Z(t=>{let a=new Set(t);return e.runtimeIds.forEach(e=>a.add(e)),Array.from(a)}))},onToggleTaskLock:e=>{et(t=>{let a=Array.isArray(t)?t:[];return a.includes(e.key)?a.filter(t=>t!==e.key):[...a,e.key]})},onAbortTask:e=>{(0,eq.ss)(e)&&(eu(e),em("idle"),eh(null))},onInspectTask:(e,t,a)=>{L(a??null),ss(e.id,t),eS(!0)},onActiveTaskCardChange:(e,t)=>{g===e.id&&L(t)},onReviewTask:sl,onSelectNode:e=>{ss(e)},onCanvasNodePointerDownCapture:sV})})]}),(0,s.jsx)("div",{className:(0,k.cn)("pointer-events-none absolute top-0 z-40 hidden lg:block",eN?"lg:left-[316px]":"lg:left-[80px]",eC?"lg:right-[572px]":"lg:right-[76px]"),children:(0,s.jsx)(aX,{settingsRef:sf,isSettingsOpen:eA,onToggleTheme:()=>B(e=>"light"===e?"dark":"light"),onToggleSettings:()=>eI(e=>!e),...rM})}),(0,s.jsxs)("div",{className:"relative z-20 min-h-screen pointer-events-none lg:h-screen",children:[(0,s.jsx)("div",{className:"pointer-events-none absolute left-1/2 top-4 z-30 -translate-x-1/2 lg:hidden",children:(0,s.jsx)(aY,{surfaceTheme:J})}),(0,s.jsx)("div",{className:"pointer-events-none absolute left-[80px] top-6 z-10 hidden lg:block",children:(0,s.jsx)(aY,{surfaceTheme:J})}),(0,s.jsx)("div",{className:(0,k.cn)("pointer-events-auto absolute left-0 top-0 z-30 h-[100dvh] overflow-visible mission-ease-smooth transition-[width] duration-500",eN?"w-[calc(100vw-96px)] max-w-[292px] lg:w-[292px] lg:max-w-none":"w-[56px]"),onMouseEnter:()=>ek(!0),onMouseLeave:()=>ek(!1),onFocusCapture:()=>ek(!0),onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||ek(!1)},children:(0,s.jsx)(ax.z,{snapshot:sh,surfaceTheme:J,activeWorkspaceId:x,requestedAgentAction:ei,connectionState:c,collapsed:!eN,modelManager:{runState:tK,statusMessage:tX,resultMessage:t0,log:t2,manualCommand:t3,docsUrl:t8,discoveredModels:tq,systemReady:sj},onExpandCollapsed:()=>ek(!0),onToggleCollapsed:()=>ek(e=>!e),onSelectWorkspace:e=>{sb(e)},onRefresh:u,onRunModelRefresh:rl,onRunModelDiscover:ro,onRunModelSetDefault:rc,onConnectModelProvider:rd,onOpenModelSetup:()=>rh(),onOpenAddModels:rw,onOpenWorkspaceCreate:()=>sK("basic"),onEditWorkspace:sB,onSnapshotChange:m,onAgentCreationPending:sU,onAgentCreatedVisible:sD})}),(0,s.jsx)("div",{className:(0,k.cn)("pointer-events-auto absolute right-0 top-0 z-30 h-[100dvh] overflow-visible mission-ease-smooth transition-[width] duration-500",eC?"w-[calc(100vw-80px)] max-w-[540px] lg:w-[540px] lg:max-w-none":"w-[52px]"),children:(0,s.jsx)(X,{snapshot:sh,surfaceTheme:J,selectedNodeId:g,activeTaskCard:P,agentDetailFocus:f,lastMission:D,onRefresh:u,onSnapshotChange:m,onConfigureAgentCapabilities:sP,onConnectModelProvider:e=>{rd(e,{autoOpenTerminal:!0})},collapsed:!eC,onToggleCollapsed:()=>eS(e=>!e),activeTab:M,onActiveTabChange:E,onAbortTask:e=>{(0,eq.ss)(e)&&(eu(e),em("idle"),eh(null))}})}),(0,s.jsx)(d.z,{open:!!eo,agentId:eo?.agentId??null,initialFocus:eo?.focus??"skills",snapshot:sh,onOpenChange:sG,onSnapshotChange:e=>m(e),onRefresh:async()=>{await p({force:!0})}}),(0,s.jsx)(o.r,{open:!!aV,agentId:aV?.agentId??null,snapshot:sh,onOpenChange:sF,onSnapshotChange:e=>m(e),onRefresh:u,onOpenAddModels:()=>{aq(null),rw(null)}}),(0,s.jsxs)("div",{className:"pointer-events-auto absolute bottom-[calc(env(safe-area-inset-bottom)+12px)] left-4 right-4 z-40 lg:bottom-6 lg:left-1/2 lg:right-auto lg:w-[min(800px,calc(100vw-320px))] lg:-translate-x-1/2",children:[(0,s.jsxs)("div",{className:"mx-auto mb-1 flex w-fit flex-col items-start gap-1",children:[sR>0?(0,s.jsxs)("div",{className:"inline-flex items-center gap-1.5 rounded-full border border-white/[0.08] bg-[linear-gradient(180deg,rgba(10,16,26,0.96),rgba(6,10,18,0.94))] px-3 py-1 text-[8px] text-slate-200 shadow-[0_10px_24px_rgba(0,0,0,0.14)]",children:[(0,s.jsx)(r.A,{className:"h-3 w-3 text-slate-400"}),(0,s.jsxs)("span",{className:"leading-3 text-slate-300",children:[sR," hidden"]})]}):null,v?(0,s.jsxs)("button",{type:"button",onClick:sJ,className:"inline-flex items-center gap-1.5 rounded-full border border-cyan-300/18 bg-[linear-gradient(180deg,rgba(16,25,38,0.98),rgba(8,12,20,0.96))] px-3 py-1 text-[8px] text-cyan-100 shadow-[0_10px_24px_rgba(0,0,0,0.14)] transition-colors hover:border-cyan-200/30 hover:bg-[linear-gradient(180deg,rgba(20,33,49,0.98),rgba(10,15,25,0.96))]","aria-label":"Reset focus and show the full workspace",title:"Reset Focus",children:[(0,s.jsx)(n.A,{className:"h-3 w-3 text-cyan-300"}),(0,s.jsx)("span",{className:"leading-3 text-cyan-50",children:"Reset Focus"})]}):null]}),O?(0,s.jsx)(S,{snapshot:sh,surfaceTheme:J,activeWorkspaceId:x,selectedNodeId:g,composeIntent:V,isComposerActive:I,onTargetAgentChange:A,onTargetAgentSelect:sW,onComposerActiveChange:sq,onRefresh:u,onOpenWorkspaceCreate:()=>{sK("basic")},onOpenWorkspaceChannels:sY,onAgentCreationPending:sU,onAgentCreatedVisible:sD,onMissionDispatchStart:e=>{eg.current.set(e.requestId,e.abortController);let t=(0,eq.Ig)(e,a);z(a=>[t,...a.filter(t=>t.requestId!==e.requestId)]),e.workspaceId&&h(e.workspaceId),ss(t.task.id),eS(!0)},onMissionDispatchFailure:(e,t)=>{eg.current.delete(e),z(a=>a.map(a=>a.requestId===e?{...a,task:(0,eq.GU)(a.task,{status:"stalled",subtitle:t,bootstrapStage:"stalled",feedEvent:{id:`${a.task.id}:failed:${Date.now()}`,kind:"warning",timestamp:new Date().toISOString(),title:"Dispatch failed",detail:t,isError:!0}})}:a))},onMissionResponse:(e,t)=>{var a;eg.current.delete(t.requestId),U(e);let s="stalled"===e.status&&"string"==typeof(a=e.summary)&&(/No transcript file was found for this runtime session/i.test(a)||/No transcript entries were found for this runtime/i.test(a));z(a=>a.map(a=>a.requestId===t.requestId?{...a,dispatchId:e.dispatchId??a.dispatchId,task:(0,eq.GU)(a.task,{dispatchId:e.dispatchId,status:s?"running":"stalled"===e.status?"stalled":"cancelled"===e.status?"cancelled":"completed"===e.status?"completed":"queued",subtitle:e.summary,bootstrapStage:s?"runtime-observed":"stalled"===e.status?"stalled":"cancelled"===e.status?"cancelled":"completed"===e.status?"completed":"accepted",feedEvent:{id:`${a.task.id}:response:${Date.now()}`,kind:"cancelled"!==e.status&&("stalled"!==e.status||s)?"status":"warning",timestamp:new Date().toISOString(),title:s?"Waiting for output":"stalled"===e.status?"Dispatch blocked":"cancelled"===e.status?"Dispatch cancelled":"completed"===e.status?"Mission finished":"Mission accepted",detail:s?"The runtime is live, but AgentOS has not captured transcript output yet.":e.summary||"Mission accepted and queued for OpenClaw execution.",isError:"cancelled"===e.status||"stalled"===e.status&&!s}})}:a)),e.dispatchId&&G(e.dispatchId)}}):null]}),(0,s.jsx)(aI._,{snapshot:sh,workspaceId:x??sh.workspaces[0]?.id??null,accountTargets:aR,accountAccessRules:aP,initialAgentId:ak,open:aj,onOpenChange:e=>{aN(e),e||aC(null)},onRefresh:u,onSnapshotChange:m,onAccountAccessRulesChange:aL,onAccountTargetsChange:aE}),(0,s.jsx)(aT.W,{snapshot:sh,workspaceId:aD,open:null!==aD,onOpenChange:sQ}),(0,s.jsx)(ay,{open:!!sr,task:sg,snapshot:sh,surfaceTheme:J,onOpenChange:e=>{e||so()},onAccept:sd,onContinue:su,onRetry:sp,onDismiss:sc,onOpenEvidence:sm}),s_?(0,s.jsx)(tC,{snapshot:a,surfaceTheme:J,stage:sk,systemReady:"success"===tS||sj,modelReady:"success"===t9.phase||ar||sN,systemSetupRequired:ai,showReadyState:ar,systemActionLabel:sA.label,systemActionDescription:sA.description,systemPhase:tI,modelPhase:tH,systemRun:{runState:tS,statusMessage:t_,resultMessage:t$,log:tE,manualCommand:tL,docsUrl:tU},modelRun:{runState:tK,statusMessage:tX,resultMessage:t0,log:t2,manualCommand:t3,docsUrl:t8},modelSwitchFeedback:t9,selectedModelId:tz,discoveredModels:tq,onSelectedModelIdChange:tV,onClearModelSwitchFeedback:()=>t7(a4),onSnapshotChange:m,onRunSystemSetup:ra,onRunModelSetDefault:rc,onOpenAddModels:rw,onOpenGatewayAuthSettings:rg,onEnterAgentOS:rb,onCreateWorkspace:rx,onContinueToModels:r$,onBackToSystem:()=>tW("system"),onSelectStage:e=>{an(!1),tW(e0(e,sj))},launchpadCreateProgress:e3,launchpadCreateRunState:e2}):null,(0,s.jsx)(aO.L,{open:ah,onOpenChange:sH,initialMode:ab,workspaceEditId:aw,surfaceTheme:J,snapshot:a,onRefresh:u,onWorkspaceCreated:e=>{sb(e,{markPending:!0})},onWorkspaceUpdated:e=>{sb(e,{markPending:!0})}},aw?`workspace-edit:${aw}`:"workspace-create"),(0,s.jsx)(l.o,{open:aF,onOpenChange:aG,snapshot:a,initialProvider:aW,onSnapshotChange:m}),(0,s.jsx)(tO,{open:null!==e_,target:e_,surfaceTheme:J,previewState:e$,preview:eE,previewError:eL,runState:eU,statusMessage:eG,resultMessage:ez,backgroundLogPath:eJ,log:eH,confirmText:eX,onConfirmTextChange:e1,onRefreshPreview:()=>{e_&&rI(e_)},onExecute:()=>{rO()},onBackToSetup:rR,onOpenChange:r_}),(0,s.jsx)(eK,{snapshot:a,surfaceTheme:J,isInspectorOpen:eC,taskAbortRequest:ec,taskAbortRunState:ep,taskAbortMessage:ex,onTaskAbortOpenChange:e=>{"running"!==ep&&(e||(eu(null),em("idle"),eh(null)))},onTaskAbortConfirm:()=>{s7()},updateDialogOpen:tm,updateRunState:th,updateStatusMessage:tb,updateResultMessage:tw,updateLog:ty,updateManualCommand:tN,activeRuntimeCount:sy,updateInstallSummary:sS,onUpdateDialogOpenChange:e=>{"running"===th?tx(e):(tx(e),e||s0())},onRunOpenClawUpdate:()=>{rt()}})]})]})}},57442:(e,t,a)=>{Promise.resolve().then(a.bind(a,26580))},81076:(e,t,a)=>{"use strict";function s(e,t){return`surface-module-v1:${e.workspaceId}:${e.id}:${t}`}function r(e,t){return`account-module-v1:${e.workspaceId}:${e.id}:${t}`}function n(e,t,a,s=212,r=220){let i=Math.round(Math.max(88,.42*s)),l=Math.round(Math.max(34,.18*r));return{x:e.x-i,y:Math.round(e.y-l-(a>1?(a-1)*76/2:0)+76*t)}}function i(e,t,a,s){let r=(t.x-e.x)*220-20*a.x,n=(t.y-e.y)*220-20*a.y;a.x+=r*s,a.y+=n*s;let i={x:e.x+a.x*s,y:e.y+a.y*s};return .35>Math.abs(t.x-i.x)&&.35>Math.abs(t.y-i.y)&&.35>Math.abs(a.x)&&.35>Math.abs(a.y)?(a.x=0,a.y=0,{position:t,settled:!0}):{position:i,settled:!1}}a.d(t,{Gh:()=>r,Jz:()=>i,Wn:()=>s,mI:()=>n})},88790:(e,t,a)=>{"use strict";a.d(t,{G:()=>m});var s=a(36366),r=a(58359),n=a(23688),i=a(48583),l=a(82711),o=a(23351);let d=/https?:\/\/[^\s<>"'`)\]]+/g,c=/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi,u=/(?:^|[\s(])((?:\.{1,2}\/)?(?:deliverables|memory|docs|app|components|lib|public|scripts|packages|hooks|output)\/[^\s`),;]+)/g,p=/`((?:\/|\.{1,2}\/|deliverables\/|memory\/|docs\/|app\/|components\/|lib\/|public\/|scripts\/|packages\/|hooks\/|output\/)[^`\n]+)`/g;function m({text:e,className:t,url:a,filePath:i,displayPath:g,basePath:b,compact:f=!1}){let w=function(e,t){let a=new Set;for(let s of(t&&a.add(t),e.matchAll(d)))s[0]&&a.add(s[0]);return[...a]}(e,a),v=function(e){let t=new Set;for(let a of e.matchAll(c))a[0]&&t.add(a[0]);return[...t]}(e),y=function(e,t,a){var s,r;let n,i,l=[],o=(s=t,r=a,n=x(s),i=x(r),n&&i&&n.startsWith("/")?{path:n.replace(/\/+$/,""),label:i.replace(/\/+$/,"")}:null),d=(e,t)=>{let a=function(e,t){let a=x(e);if(!a)return null;if(a.startsWith("/")||!t)return a;if(a===t.label)return t.path;let s=`${t.label}/`;if(!a.startsWith(s))return a;let r=a.slice(s.length).replace(/^\/+/,"");return r?`${t.path}/${r}`:t.path}(e,o),s=x(t||e);a&&s&&(l.some(e=>x(e.path)===a||x(e.label)===s)||l.push({path:a,label:s}))};for(let s of(t&&d(t,a||t),e.matchAll(p))){let e=x(s[1]);e&&d(e,e)}for(let t of e.matchAll(u)){let e=x(t[1]);e&&d(e,e)}return l}(e,i,g);return(0,s.jsxs)("div",{className:(0,o.cn)("space-y-2",f&&"space-y-1.5"),children:[(0,s.jsx)("p",{className:(0,o.cn)("whitespace-pre-wrap break-words",t),children:function(e){let t=Array.from(e.matchAll(d));if(0===t.length)return e;let a=[],r=0;for(let[n]of t){let t=e.indexOf(n,r);t>r&&a.push(e.slice(r,t)),a.push((0,s.jsx)("a",{href:n,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:e=>e.stopPropagation(),children:n},`${n}:${t}`)),r=t+n.length}return r<e.length&&a.push(e.slice(r)),a}(e)}),w.length>0||v.length>0||y.length>0?(0,s.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[w.map(e=>(0,s.jsxs)("a",{href:e,target:"_blank",rel:"noreferrer",className:(0,o.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]",f&&"px-1.5 py-[3px] text-[9px]"),onClick:e=>e.stopPropagation(),children:[(0,s.jsx)(r.A,{className:(0,o.cn)("h-3 w-3 shrink-0",f&&"h-2.5 w-2.5")}),(0,s.jsx)("span",{className:"truncate",children:function(e){try{let t=new URL(e);return`${t.hostname}${"/"===t.pathname?"":t.pathname}`}catch{return e}}(e)})]},e)),v.map(e=>(0,s.jsxs)("a",{href:`mailto:${e}`,className:(0,o.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]",f&&"px-1.5 py-[3px] text-[9px]"),onClick:e=>e.stopPropagation(),children:[(0,s.jsx)(r.A,{className:(0,o.cn)("h-3 w-3 shrink-0",f&&"h-2.5 w-2.5")}),(0,s.jsx)("span",{className:"truncate",children:e})]},e)),y.map(e=>(0,s.jsxs)("button",{type:"button",className:(0,o.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]",f&&"px-1.5 py-[3px] text-[9px]"),onClick:t=>{t.stopPropagation(),h(e.path,b)},children:[(0,s.jsx)(n.A,{className:(0,o.cn)("h-3 w-3 shrink-0",f&&"h-2.5 w-2.5")}),(0,s.jsx)("span",{className:"truncate",children:(0,l.$7)(e.label)})]},`${e.path}:${e.label}`))]}):null]})}function x(e){let t=e?.trim();return t?t.replace(/[.,:;]+$/g,""):null}async function h(e,t){try{let a=await fetch("/api/files/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,basePath:t??null})}),s=await a.json();if(!a.ok)throw Error(s.error||"Unable to reveal file.");i.oR.success("Revealed file.",{description:(0,l.$7)(e)})}catch(e){i.oR.error("Could not reveal file.",{description:e instanceof Error?e.message:"Unknown file reveal error."})}}},93028:(e,t,a)=>{"use strict";a.d(t,{B4:()=>u,E2:()=>m,HR:()=>r,Kf:()=>i,UF:()=>o,VL:()=>c,hy:()=>s,kg:()=>d,l_:()=>p,ss:()=>n,wg:()=>l});let s="mission-control-task-review-state-v1";function r(e){let t="string"==typeof e.key?e.key.trim():"",a="string"==typeof e.dispatchId?e.dispatchId.trim():"";return t||a||e.id}function n(e,t,a,s=new Date().toISOString()){return{taskId:e.id,taskKey:r(e),status:t,action:a,reviewedAt:s}}function i(e){if(!e)return{};try{let a=JSON.parse(e);if(!a||"object"!=typeof a||Array.isArray(a))return{};let s={};for(let[e,r]of Object.entries(a)){var t;(t=r)&&"object"==typeof t&&"string"==typeof t.taskId&&"string"==typeof t.taskKey&&x(t.status)&&"string"==typeof t.action&&"string"==typeof t.reviewedAt&&(s[e]={...r,taskKey:r.taskKey||e})}return s}catch{return{}}}function l(e,t){if(0===Object.keys(t).length)return e;let a=!1,s=e.tasks.map(e=>{var s,n,i,l;let o=t[r(e)];return o?(a=!0,s=e,n=o,{...s,metadata:{...s.metadata,reviewStatus:n.status,reviewAction:n.action,reviewedAt:n.reviewedAt,reviewEvents:[(i=s,l=n,{id:`task-review:${l.taskKey}:${l.status}`,kind:"accepted"===l.status||"continued"===l.status?"status":"warning",timestamp:l.reviewedAt,title:function(e){switch(e){case"accepted":return"Review accepted";case"continued":return"Continuation accepted";case"retried":return"Retry drafted";case"dismissed":return"Review dismissed"}}(l.status),detail:`${m(l.status)} Task: ${i.title.trim()||i.id}.`})]}}):e});return a?{...e,tasks:s}:e}function o(e){let t=e.metadata.reviewedAt;return"string"==typeof t&&t.trim().length>0?t:null}function d(e){let t=e.metadata.reviewAction;return"string"==typeof t&&t.trim().length>0?t:null}function c(e,t={}){let a,s=x(a=e.metadata.reviewStatus)?a:null;return"continued"!==s?s:!function(e,t={}){let a=o(e),s=a?Date.parse(a):NaN;return!(!Number.isNaN(s)&&function(e,t){if(!e)return!1;let a=Date.parse(e);return!Number.isNaN(a)&&a>t}(t.latestEvidenceAt,s))&&(!!t.hasLiveActivity||!Number.isNaN(s)&&(t.nowMs??Date.now())-s<12e4)}(e,t)?null:s}function u(e){switch(e){case"accepted":return"accepted";case"continued":return"continuing";case"retried":return"retry drafted";case"dismissed":return"dismissed"}}function p(e){switch(e){case"accepted":return"review accepted";case"continued":return"continuation accepted";case"retried":return"retry drafted";case"dismissed":return"review dismissed"}}function m(e){switch(e){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."}}function x(e){return"accepted"===e||"continued"===e||"retried"===e||"dismissed"===e}}}]);