@sapienx/agentos 0.1.7 → 0.1.8

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 (149) hide show
  1. package/bundle/.next/BUILD_ID +1 -1
  2. package/bundle/.next/app-path-routes-manifest.json +14 -11
  3. package/bundle/.next/build-manifest.json +2 -2
  4. package/bundle/.next/routes-manifest.json +22 -0
  5. package/bundle/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  6. package/bundle/.next/server/app/_global-error.html +2 -2
  7. package/bundle/.next/server/app/_global-error.rsc +1 -1
  8. package/bundle/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/bundle/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  10. package/bundle/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  11. package/bundle/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  12. package/bundle/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  13. package/bundle/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  14. package/bundle/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/bundle/.next/server/app/_not-found.html +1 -1
  16. package/bundle/.next/server/app/_not-found.rsc +2 -2
  17. package/bundle/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  18. package/bundle/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  19. package/bundle/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  20. package/bundle/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  21. package/bundle/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  22. package/bundle/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  23. package/bundle/.next/server/app/api/agents/route.js.nft.json +1 -1
  24. package/bundle/.next/server/app/api/agents/route_client-reference-manifest.js +1 -1
  25. package/bundle/.next/server/app/api/diagnostics/route.js.nft.json +1 -1
  26. package/bundle/.next/server/app/api/diagnostics/route_client-reference-manifest.js +1 -1
  27. package/bundle/.next/server/app/api/files/reveal/route_client-reference-manifest.js +1 -1
  28. package/bundle/.next/server/app/api/gateway/control/route.js.nft.json +1 -1
  29. package/bundle/.next/server/app/api/gateway/control/route_client-reference-manifest.js +1 -1
  30. package/bundle/.next/server/app/api/mission/route.js.nft.json +1 -1
  31. package/bundle/.next/server/app/api/mission/route_client-reference-manifest.js +1 -1
  32. package/bundle/.next/server/app/api/models/providers/route.js +2 -0
  33. package/bundle/.next/server/app/api/models/providers/route.js.nft.json +1 -0
  34. package/bundle/.next/server/app/api/models/providers/route_client-reference-manifest.js +1 -0
  35. package/bundle/.next/server/app/api/onboarding/models/route.js.nft.json +1 -1
  36. package/bundle/.next/server/app/api/onboarding/models/route_client-reference-manifest.js +1 -1
  37. package/bundle/.next/server/app/api/onboarding/route.js.nft.json +1 -1
  38. package/bundle/.next/server/app/api/onboarding/route_client-reference-manifest.js +1 -1
  39. package/bundle/.next/server/app/api/planner/[planId]/deploy/route.js.nft.json +1 -1
  40. package/bundle/.next/server/app/api/planner/[planId]/deploy/route_client-reference-manifest.js +1 -1
  41. package/bundle/.next/server/app/api/planner/[planId]/route.js.nft.json +1 -1
  42. package/bundle/.next/server/app/api/planner/[planId]/route_client-reference-manifest.js +1 -1
  43. package/bundle/.next/server/app/api/planner/[planId]/simulate/route.js.nft.json +1 -1
  44. package/bundle/.next/server/app/api/planner/[planId]/simulate/route_client-reference-manifest.js +1 -1
  45. package/bundle/.next/server/app/api/planner/[planId]/turn/route.js.nft.json +1 -1
  46. package/bundle/.next/server/app/api/planner/[planId]/turn/route_client-reference-manifest.js +1 -1
  47. package/bundle/.next/server/app/api/planner/route.js.nft.json +1 -1
  48. package/bundle/.next/server/app/api/planner/route_client-reference-manifest.js +1 -1
  49. package/bundle/.next/server/app/api/reset/route.js.nft.json +1 -1
  50. package/bundle/.next/server/app/api/reset/route_client-reference-manifest.js +1 -1
  51. package/bundle/.next/server/app/api/runtimes/[runtimeId]/route.js.nft.json +1 -1
  52. package/bundle/.next/server/app/api/runtimes/[runtimeId]/route_client-reference-manifest.js +1 -1
  53. package/bundle/.next/server/app/api/settings/gateway/route.js.nft.json +1 -1
  54. package/bundle/.next/server/app/api/settings/gateway/route_client-reference-manifest.js +1 -1
  55. package/bundle/.next/server/app/api/settings/workspace-root/route.js.nft.json +1 -1
  56. package/bundle/.next/server/app/api/settings/workspace-root/route_client-reference-manifest.js +1 -1
  57. package/bundle/.next/server/app/api/snapshot/route.js.nft.json +1 -1
  58. package/bundle/.next/server/app/api/snapshot/route_client-reference-manifest.js +1 -1
  59. package/bundle/.next/server/app/api/stream/route.js +1 -1
  60. package/bundle/.next/server/app/api/stream/route.js.nft.json +1 -1
  61. package/bundle/.next/server/app/api/stream/route_client-reference-manifest.js +1 -1
  62. package/bundle/.next/server/app/api/system/open-terminal/route_client-reference-manifest.js +1 -1
  63. package/bundle/.next/server/app/api/tasks/[taskId]/abort/route.js +1 -0
  64. package/bundle/.next/server/app/api/tasks/[taskId]/abort/route.js.nft.json +1 -0
  65. package/bundle/.next/server/app/api/tasks/[taskId]/abort/route_client-reference-manifest.js +1 -0
  66. package/bundle/.next/server/app/api/tasks/[taskId]/stream/route.js +4 -0
  67. package/bundle/.next/server/app/api/tasks/[taskId]/stream/route.js.nft.json +1 -0
  68. package/bundle/.next/server/app/api/tasks/[taskId]/stream/route_client-reference-manifest.js +1 -0
  69. package/bundle/.next/server/app/api/update/route.js.nft.json +1 -1
  70. package/bundle/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  71. package/bundle/.next/server/app/api/workspaces/route.js.nft.json +1 -1
  72. package/bundle/.next/server/app/api/workspaces/route_client-reference-manifest.js +1 -1
  73. package/bundle/.next/server/app/page.js +14 -14
  74. package/bundle/.next/server/app/page.js.nft.json +1 -1
  75. package/bundle/.next/server/app/page_client-reference-manifest.js +1 -1
  76. package/bundle/.next/server/app-paths-manifest.json +14 -11
  77. package/bundle/.next/server/chunks/350.js +1 -1
  78. package/bundle/.next/server/chunks/419.js +29 -29
  79. package/bundle/.next/server/functions-config-manifest.json +3 -0
  80. package/bundle/.next/server/pages/404.html +1 -1
  81. package/bundle/.next/server/pages/500.html +2 -2
  82. package/bundle/.next/static/chunks/878-919c758aa9e87b6d.js +13 -0
  83. package/bundle/.next/static/chunks/app/_global-error/page-75723f28c245a30d.js +1 -0
  84. package/bundle/.next/static/chunks/app/_not-found/page-75723f28c245a30d.js +1 -0
  85. package/bundle/.next/static/chunks/app/api/agents/route-75723f28c245a30d.js +1 -0
  86. package/bundle/.next/static/chunks/app/api/diagnostics/route-75723f28c245a30d.js +1 -0
  87. package/bundle/.next/static/chunks/app/api/files/reveal/route-75723f28c245a30d.js +1 -0
  88. package/bundle/.next/static/chunks/app/api/gateway/control/route-75723f28c245a30d.js +1 -0
  89. package/bundle/.next/static/chunks/app/api/mission/route-75723f28c245a30d.js +1 -0
  90. package/bundle/.next/static/chunks/app/api/models/providers/route-75723f28c245a30d.js +1 -0
  91. package/bundle/.next/static/chunks/app/api/onboarding/models/route-75723f28c245a30d.js +1 -0
  92. package/bundle/.next/static/chunks/app/api/onboarding/route-75723f28c245a30d.js +1 -0
  93. package/bundle/.next/static/chunks/app/api/planner/[planId]/deploy/route-75723f28c245a30d.js +1 -0
  94. package/bundle/.next/static/chunks/app/api/planner/[planId]/route-75723f28c245a30d.js +1 -0
  95. package/bundle/.next/static/chunks/app/api/planner/[planId]/simulate/route-75723f28c245a30d.js +1 -0
  96. package/bundle/.next/static/chunks/app/api/planner/[planId]/turn/route-75723f28c245a30d.js +1 -0
  97. package/bundle/.next/static/chunks/app/api/planner/route-75723f28c245a30d.js +1 -0
  98. package/bundle/.next/static/chunks/app/api/reset/route-75723f28c245a30d.js +1 -0
  99. package/bundle/.next/static/chunks/app/api/runtimes/[runtimeId]/route-75723f28c245a30d.js +1 -0
  100. package/bundle/.next/static/chunks/app/api/settings/gateway/route-75723f28c245a30d.js +1 -0
  101. package/bundle/.next/static/chunks/app/api/settings/workspace-root/route-75723f28c245a30d.js +1 -0
  102. package/bundle/.next/static/chunks/app/api/snapshot/route-75723f28c245a30d.js +1 -0
  103. package/bundle/.next/static/chunks/app/api/stream/route-75723f28c245a30d.js +1 -0
  104. package/bundle/.next/static/chunks/app/api/system/open-terminal/route-75723f28c245a30d.js +1 -0
  105. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/abort/route-75723f28c245a30d.js +1 -0
  106. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/stream/route-75723f28c245a30d.js +1 -0
  107. package/bundle/.next/static/chunks/app/api/update/route-75723f28c245a30d.js +1 -0
  108. package/bundle/.next/static/chunks/app/api/workspaces/route-75723f28c245a30d.js +1 -0
  109. package/bundle/.next/static/chunks/app/not-found-75723f28c245a30d.js +1 -0
  110. package/bundle/.next/static/chunks/app/page-dee040e8fa0bfe5c.js +14 -0
  111. package/bundle/.next/static/chunks/next/dist/client/components/builtin/app-error-75723f28c245a30d.js +1 -0
  112. package/bundle/.next/static/chunks/next/dist/client/components/builtin/forbidden-75723f28c245a30d.js +1 -0
  113. package/bundle/.next/static/chunks/next/dist/client/components/builtin/unauthorized-75723f28c245a30d.js +1 -0
  114. package/bundle/.next/static/css/665b6d1d1e231c6e.css +3 -0
  115. package/bundle/.next/static/dMZieB6mihw477BgExG8r/_buildManifest.js +1 -0
  116. package/bundle/scripts/openclaw-mission-dispatch-runner.mjs +84 -24
  117. package/package.json +1 -1
  118. package/bundle/.next/static/chunks/768-10d6bd3c2342134e.js +0 -13
  119. package/bundle/.next/static/chunks/app/_global-error/page-b01b0a6fdf60f7fe.js +0 -1
  120. package/bundle/.next/static/chunks/app/_not-found/page-b01b0a6fdf60f7fe.js +0 -1
  121. package/bundle/.next/static/chunks/app/api/agents/route-b01b0a6fdf60f7fe.js +0 -1
  122. package/bundle/.next/static/chunks/app/api/diagnostics/route-b01b0a6fdf60f7fe.js +0 -1
  123. package/bundle/.next/static/chunks/app/api/files/reveal/route-b01b0a6fdf60f7fe.js +0 -1
  124. package/bundle/.next/static/chunks/app/api/gateway/control/route-b01b0a6fdf60f7fe.js +0 -1
  125. package/bundle/.next/static/chunks/app/api/mission/route-b01b0a6fdf60f7fe.js +0 -1
  126. package/bundle/.next/static/chunks/app/api/onboarding/models/route-b01b0a6fdf60f7fe.js +0 -1
  127. package/bundle/.next/static/chunks/app/api/onboarding/route-b01b0a6fdf60f7fe.js +0 -1
  128. package/bundle/.next/static/chunks/app/api/planner/[planId]/deploy/route-b01b0a6fdf60f7fe.js +0 -1
  129. package/bundle/.next/static/chunks/app/api/planner/[planId]/route-b01b0a6fdf60f7fe.js +0 -1
  130. package/bundle/.next/static/chunks/app/api/planner/[planId]/simulate/route-b01b0a6fdf60f7fe.js +0 -1
  131. package/bundle/.next/static/chunks/app/api/planner/[planId]/turn/route-b01b0a6fdf60f7fe.js +0 -1
  132. package/bundle/.next/static/chunks/app/api/planner/route-b01b0a6fdf60f7fe.js +0 -1
  133. package/bundle/.next/static/chunks/app/api/reset/route-b01b0a6fdf60f7fe.js +0 -1
  134. package/bundle/.next/static/chunks/app/api/runtimes/[runtimeId]/route-b01b0a6fdf60f7fe.js +0 -1
  135. package/bundle/.next/static/chunks/app/api/settings/gateway/route-b01b0a6fdf60f7fe.js +0 -1
  136. package/bundle/.next/static/chunks/app/api/settings/workspace-root/route-b01b0a6fdf60f7fe.js +0 -1
  137. package/bundle/.next/static/chunks/app/api/snapshot/route-b01b0a6fdf60f7fe.js +0 -1
  138. package/bundle/.next/static/chunks/app/api/stream/route-b01b0a6fdf60f7fe.js +0 -1
  139. package/bundle/.next/static/chunks/app/api/system/open-terminal/route-b01b0a6fdf60f7fe.js +0 -1
  140. package/bundle/.next/static/chunks/app/api/update/route-b01b0a6fdf60f7fe.js +0 -1
  141. package/bundle/.next/static/chunks/app/api/workspaces/route-b01b0a6fdf60f7fe.js +0 -1
  142. package/bundle/.next/static/chunks/app/not-found-b01b0a6fdf60f7fe.js +0 -1
  143. package/bundle/.next/static/chunks/app/page-863784e11f2deb8d.js +0 -14
  144. package/bundle/.next/static/chunks/next/dist/client/components/builtin/app-error-b01b0a6fdf60f7fe.js +0 -1
  145. package/bundle/.next/static/chunks/next/dist/client/components/builtin/forbidden-b01b0a6fdf60f7fe.js +0 -1
  146. package/bundle/.next/static/chunks/next/dist/client/components/builtin/unauthorized-b01b0a6fdf60f7fe.js +0 -1
  147. package/bundle/.next/static/css/a321f34e664c439e.css +0 -3
  148. package/bundle/.next/static/sgPf3JHUUWvk8YndSq2L9/_buildManifest.js +0 -1
  149. /package/bundle/.next/static/{sgPf3JHUUWvk8YndSq2L9 → dMZieB6mihw477BgExG8r}/_ssgManifest.js +0 -0
@@ -0,0 +1,14 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{2629:(e,t,a)=>{"use strict";a.d(t,{Toaster:()=>s.l$,o:()=>s.oR});var s=a(2273)},4430:(e,t,a)=>{"use strict";a.d(t,{MissionControlShell:()=>rA});var s=a(9227),r=a(909),n=a(6036),i=a(5642),l=a(5923),o=a(8219),d=a(1627),c=a(8433),p=a(6281),m=a(3035),u=a(7763),h=a(6605),x=a(764),g=a(9099),b=a(5425),f=a(2402),w=a(7111),v=a(1094),y=a(9540),j=a(3587);function k(...e){return(0,j.QP)((0,y.$)(e))}let N=(0,v.F)("inline-flex items-center rounded-full border px-2.5 py-0.5 text-[11px] font-medium tracking-[0.14em] uppercase transition-colors",{variants:{variant:{default:"border-cyan-400/30 bg-cyan-400/10 text-cyan-200",muted:"border-white/10 bg-white/5 text-slate-300",success:"border-emerald-400/25 bg-emerald-400/10 text-emerald-200",warning:"border-amber-400/25 bg-amber-400/10 text-amber-100",danger:"border-rose-400/30 bg-rose-400/10 text-rose-100"}},defaultVariants:{variant:"default"}});function C({className:e,variant:t,...a}){return(0,s.jsx)("div",{className:k(N({variant:t}),e),...a})}var S=a(8186);let A=(0,v.F)("inline-flex items-center justify-center whitespace-nowrap rounded-2xl text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-cyan-400 text-slate-950 shadow-lg shadow-cyan-400/20 hover:bg-cyan-300",secondary:"border border-white/10 bg-white/5 text-slate-100 hover:bg-white/10 hover:text-white",ghost:"text-slate-200 hover:bg-white/[0.08] hover:text-white",destructive:"bg-rose-500 text-white shadow-lg shadow-rose-500/20 hover:bg-rose-400"},size:{default:"h-11 px-4 py-2",sm:"h-9 rounded-xl px-3",lg:"h-12 rounded-2xl px-5",icon:"h-11 w-11"}},defaultVariants:{variant:"default",size:"default"}}),I=m.forwardRef(({className:e,variant:t,size:a,asChild:r=!1,...n},i)=>{let l=r?S.DX:"button";return(0,s.jsx)(l,{className:k(A({variant:t,size:a,className:e})),ref:i,...n})});I.displayName="Button";let T=m.forwardRef(({className:e,type:t,...a},r)=>(0,s.jsx)("input",{type:t,className:k("flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white placeholder:text-slate-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-400/60 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...a}));T.displayName="Input";var O=a(4372);let R=O.bL,M=m.forwardRef(({className:e,...t},a)=>(0,s.jsx)(O.B8,{ref:a,className:k("inline-flex h-11 items-center rounded-2xl border border-white/10 bg-white/5 p-1 text-slate-400",e),...t}));M.displayName=O.B8.displayName;let $=m.forwardRef(({className:e,...t},a)=>(0,s.jsx)(O.l9,{ref:a,className:k("inline-flex items-center justify-center whitespace-nowrap rounded-xl px-3 py-2 text-sm transition-all data-[state=active]:bg-white/10 data-[state=active]:text-white",e),...t}));$.displayName=O.l9.displayName;let P=m.forwardRef(({className:e,...t},a)=>(0,s.jsx)(O.UC,{ref:a,className:k("mt-4 outline-none focus-visible:ring-0",e),...t}));function _(e,t){let a=t.trim().toLowerCase();return a?e.filter(e=>`${e.name} ${e.id} ${e.tags.join(" ")}`.toLowerCase().includes(a)):e}function E({provider:e,models:t,selectedModelIds:a,search:r,onSearchChange:n,onToggleModel:i,onAddSelected:l,isAdding:o}){let d=t.filter(e=>e.recommended),c=t.length>8||"openrouter"===e,p=a.filter(e=>!t.find(t=>t.id===e)?.alreadyAdded).length,m=_(d,r),u=_(t,r);return(0,s.jsxs)("div",{className:"rounded-[24px] border border-white/10 bg-[linear-gradient(180deg,rgba(10,15,26,0.94),rgba(7,11,20,0.96))] p-4",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-display text-[0.96rem] text-white",children:"Select models to add"}),(0,s.jsxs)("p",{className:"mt-1 text-[12px] leading-5 text-slate-400",children:["Found ",t.length," model",1===t.length?"":"s"," for this provider."]})]}),(0,s.jsxs)(C,{variant:"muted",children:[t.filter(e=>e.alreadyAdded).length," already added"]})]}),c?(0,s.jsxs)("div",{className:"relative mt-4",children:[(0,s.jsx)(b.A,{className:"pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-500"}),(0,s.jsx)(T,{value:r,onChange:e=>n(e.target.value),placeholder:"openrouter"===e?"Search OpenRouter models":"Search models",className:"pl-11"})]}):null,"openrouter"===e?(0,s.jsxs)(R,{defaultValue:"recommended",className:"mt-4",children:[(0,s.jsxs)(M,{children:[(0,s.jsx)($,{value:"recommended",children:"Recommended"}),(0,s.jsx)($,{value:"all",children:"All models"})]}),(0,s.jsx)(P,{value:"recommended",children:(0,s.jsx)(D,{models:m,selectedModelIds:a,onToggleModel:i,emptyMessage:"No recommended matches. Switch to All models to browse the full catalog."})}),(0,s.jsx)(P,{value:"all",children:(0,s.jsx)(D,{models:u,selectedModelIds:a,onToggleModel:i,emptyMessage:"No models matched this search."})})]}):(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(D,{models:u,selectedModelIds:a,onToggleModel:i,emptyMessage:"No models matched this search."})}),(0,s.jsxs)("div",{className:"mt-4 flex items-center justify-between gap-3 border-t border-white/10 pt-4",children:[(0,s.jsx)("p",{className:"text-[11px] text-slate-400",children:p>0?`${p} model${1===p?"":"s"} selected`:"Choose at least one model to add"}),(0,s.jsx)(I,{type:"button",onClick:l,disabled:0===p||o,className:"h-9 rounded-full px-4",children:o?"Adding...":"Add selected models"})]})]})}function D({models:e,selectedModelIds:t,onToggleModel:a,emptyMessage:r}){return 0===e.length?(0,s.jsx)("div",{className:"rounded-[22px] border border-dashed border-white/10 bg-white/[0.03] px-4 py-8 text-center text-[13px] text-slate-400",children:r}):(0,s.jsx)("div",{className:"max-h-[min(36vh,320px)] space-y-2 overflow-y-auto pr-1",children:e.map(e=>{let r=t.includes(e.id);return(0,s.jsxs)("button",{type:"button",disabled:e.alreadyAdded,onClick:()=>a(e.id),className:k("flex w-full items-start justify-between gap-3 rounded-[18px] border px-3.5 py-3 text-left transition-all",e.alreadyAdded?"cursor-not-allowed border-white/8 bg-white/[0.02] opacity-70":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:"flex min-w-0 items-start gap-3",children:[(0,s.jsx)("div",{className:k("mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-md border",e.alreadyAdded?"border-white/10 bg-white/[0.03] text-slate-500":r?"border-cyan-300/50 bg-cyan-300/15 text-cyan-100":"border-white/12 bg-white/[0.03] text-transparent"),children:e.alreadyAdded?(0,s.jsx)(f.A,{className:"h-3 w-3"}):(0,s.jsx)(w.A,{className:"h-3 w-3"})}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"truncate text-[13px] font-medium text-white",children:e.name}),(0,s.jsx)("p",{className:"mt-1 truncate text-[11px] uppercase tracking-[0.18em] text-slate-500",children:e.id}),(0,s.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2 text-[11px] 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:e.alreadyAdded?(0,s.jsx)(C,{variant:"muted",children:"Already added"}):e.recommended?(0,s.jsx)(C,{variant:"default",children:"Recommended"}):e.local?(0,s.jsx)(C,{variant:"success",children:"Local"}):(0,s.jsx)(C,{variant:"muted",children:"Remote"})})]},e.id)})})}P.displayName=O.UC.displayName;var L=a(9718),U=a(1263),F=a(2589),z=a(8574),W=a(5766),B=a(890);let q={"openai-codex":L.A,openrouter:U.A,ollama:F.A,anthropic:z.A,openai:W.A,xai:B.A};function V({descriptor:e,active:t,compact:a=!1,connected:r=!1,detail:n,onClick:i}){let l=q[e.id];return(0,s.jsxs)("button",{type:"button",onClick:i,className:k("group w-full rounded-[24px] border text-left transition-all",a?"p-3.5":"p-4",t?"border-cyan-300/40 bg-[linear-gradient(180deg,rgba(23,32,52,0.98),rgba(11,18,31,0.98))] shadow-[0_18px_45px_rgba(10,16,28,0.26)]":"border-white/10 bg-[linear-gradient(180deg,rgba(15,23,42,0.92),rgba(10,15,28,0.92))] hover:border-white/18 hover:bg-[linear-gradient(180deg,rgba(20,29,49,0.96),rgba(12,18,31,0.96))]"),children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsx)("div",{className:k("flex items-center justify-center rounded-[18px] border",a?"h-9 w-9":"h-10 w-10",t?"border-cyan-300/25 bg-cyan-300/10 text-cyan-100":"border-white/10 bg-white/[0.04] text-slate-200"),children:(0,s.jsx)(l,{className:"h-4 w-4"})}),(0,s.jsx)(C,{variant:r?"success":t?"default":"muted",children:r?"Connected":t?"Selected":"Provider"})]}),(0,s.jsxs)("div",{className:a?"mt-3":"mt-4",children:[(0,s.jsx)("p",{className:k("font-display text-white",a?"text-[0.92rem]":"text-[0.98rem]"),children:e.label}),(0,s.jsx)("p",{className:k("mt-1.5 text-slate-300",a?"text-[11px] leading-5":"text-[12px] leading-5"),children:e.description}),(0,s.jsx)("p",{className:"mt-3 text-[10px] uppercase tracking-[0.18em] text-slate-500",children:n||e.helperText})]})]})}var K=a(2512),J=a(1835);let G=K.bL,H=K.l9,Z=K.ZL;K.bm;let Y=m.forwardRef(({className:e,...t},a)=>(0,s.jsx)(K.hJ,{ref:a,className:k("fixed inset-0 z-50 bg-slate-950/75 backdrop-blur-md",e),...t}));Y.displayName=K.hJ.displayName;let Q=m.forwardRef(({className:e,children:t,...a},r)=>(0,s.jsxs)(Z,{children:[(0,s.jsx)(Y,{}),(0,s.jsxs)(K.UC,{ref:r,className:k("fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 rounded-[28px] border border-white/10 bg-slate-950/90 p-6 shadow-panel backdrop-blur-xl duration-200",e),...a,children:[t,(0,s.jsxs)(K.bm,{className:"absolute right-4 top-4 rounded-full p-2 text-slate-400 transition-colors hover:bg-white/5 hover:text-white",children:[(0,s.jsx)(J.A,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));Q.displayName=K.UC.displayName;let X=({className:e,...t})=>(0,s.jsx)("div",{className:k("flex flex-col space-y-2 text-left",e),...t}),ee=({className:e,...t})=>(0,s.jsx)("div",{className:k("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t}),et=m.forwardRef(({className:e,...t},a)=>(0,s.jsx)(K.hE,{ref:a,className:k("font-display text-xl text-white",e),...t}));et.displayName=K.hE.displayName;let ea=m.forwardRef(({className:e,...t},a)=>(0,s.jsx)(K.VY,{ref:a,className:k("text-sm text-slate-400",e),...t}));ea.displayName=K.VY.displayName;let es=[{id:"openai-codex",label:"ChatGPT",shortLabel:"ChatGPT",description:"Connect your ChatGPT account and pull in Codex-ready models.",category:"primary",connectKind:"oauth",accent:"from-[#d8f5eb] via-[#ebfbf5] to-white",helperText:"Account-based login with the OpenClaw provider flow."},{id:"openrouter",label:"OpenRouter",shortLabel:"OpenRouter",description:"Add an API key, discover the full catalog, and curate the models you want.",category:"primary",connectKind:"apiKey",accent:"from-[#fff2d7] via-[#fff7ea] to-white",helperText:"Best for broad model access and curated remote routes.",searchPlaceholder:"Search OpenRouter models"},{id:"ollama",label:"Ollama Local",shortLabel:"Ollama",description:"Discover models already available on this machine and add them instantly.",category:"primary",connectKind:"local",accent:"from-[#deefff] via-[#f2f8ff] to-white",helperText:"Local-first discovery with helpful pull commands when empty."},{id:"anthropic",label:"Anthropic",shortLabel:"Anthropic",description:"Paste an API key and add Claude models through the same flow.",category:"other",connectKind:"apiKey",accent:"from-[#efe9ff] via-[#f7f3ff] to-white",helperText:"Simple API key connection."},{id:"openai",label:"OpenAI API",shortLabel:"OpenAI",description:"Connect a standard OpenAI API key for direct GPT model access.",category:"other",connectKind:"apiKey",accent:"from-[#e8f8e8] via-[#f4fbf4] to-white",helperText:"Use this for API-key-based OpenAI routing."},{id:"xai",label:"xAI",shortLabel:"xAI",description:"Use an xAI API key to bring Grok models into AgentOS.",category:"other",connectKind:"apiKey",accent:"from-[#ffe6ea] via-[#fff3f5] to-white",helperText:"Simple API key connection."}],er=es.filter(e=>"primary"===e.category),en=es.filter(e=>"other"===e.category);function ei(e){let t=es.find(t=>t.id===e);if(!t)throw Error(`Unknown model provider: ${e}`);return t}async function el(e){let t=await fetch("/api/models/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),a=await t.json().catch(()=>null);if(!t.ok||!a)throw Error(a?.error||a?.message||"Model provider request failed.");if(!a.ok&&a.message)throw Error(a.message);return a}let eo=Object.fromEntries(es.map(e=>{var t;return[e.id,{id:t=e.id,descriptor:ei(t),getConnectionStatus:()=>el({action:"status",provider:t}),connect:e=>el({action:"connect",provider:t,apiKey:e?.apiKey?.trim()?e.apiKey.trim():void 0,endpoint:e?.endpoint?.trim()?e.endpoint.trim():void 0}),discoverModels:()=>el({action:"discover",provider:t}),addModels:e=>el({action:"add-models",provider:t,modelIds:e})}]}));var ed=a(2629);let ec=()=>({flowState:"idle",connection:null,statusMessage:null,errorMessage:null,emptyState:null,manualCommand:null,docsUrl:null,models:[],selectedModelIds:[],apiKey:"",search:"",loaded:!1});function ep({open:e,onOpenChange:t,snapshot:a,initialProvider:n=null,onSnapshotChange:i}){var l,o;let d,c,b,f,[w,v]=(0,m.useState)(n),[y,j]=(0,m.useState)(!1),[N,S]=(0,m.useState)({}),[A,O]=(0,m.useState)(!1),R=(0,m.useEffectEvent)(e=>{P(e)});(0,m.useEffect)(()=>{if(e){if(n)return void R(n);v(e=>e??null)}},[e,n]);let M=w&&N[w]||ec(),$=w?ei(w):null;async function P(e){if(v(e),"ollama"!==e){(N[e]||ec()).loaded||await _(e);return}await L(e,!0)}async function _(e){let t=eo[e];W(e,{flowState:"idle",errorMessage:null});try{let a=await t.getConnectionStatus();B(e,a,a.emptyState?"discovery-empty":"idle")}catch(t){W(e,{flowState:"auth-error",errorMessage:t instanceof Error?t.message:"Provider status could not be loaded.",loaded:!0})}}async function D(e){let t=eo[e],a=N[e]||ec();W(e,{flowState:"connecting",errorMessage:null,statusMessage:"openai-codex"===e?"Opening the ChatGPT connection flow...":`Connecting ${ei(e).shortLabel}...`});try{let s=await t.connect({apiKey:a.apiKey});B(e,s,"openai-codex"===e?"connecting":s.models.length?"discovery-success":"idle"),s.snapshot&&i(s.snapshot),"openai-codex"!==e&&"ollama"!==e&&await L(e)}catch(t){W(e,{flowState:"auth-error",errorMessage:t instanceof Error?t.message:"Provider connection failed."})}}async function L(e,t=!1){let a=eo[e],s=N[e]||ec();if(t||"discovery-loading"!==s.flowState){W(e,{flowState:"discovery-loading",errorMessage:null,statusMessage:"ollama"===e?"Checking the local Ollama runtime...":"Discovering available models..."});try{let t=await a.discoverModels();B(e,t,t.models.length>0?"discovery-success":t.emptyState?"discovery-empty":"idle"),t.snapshot&&i(t.snapshot)}catch(t){W(e,{flowState:"auth-error",errorMessage:t instanceof Error?t.message:"Model discovery failed."})}}}async function U(e){let t=eo[e],a=N[e]||ec(),s=a.selectedModelIds.filter(e=>!a.models.find(t=>t.id===e)?.alreadyAdded);if(0!==s.length){W(e,{flowState:"connecting",errorMessage:null,statusMessage:"Adding selected models..."});try{let a=await t.addModels(s);B(e,a,"add-success",{selectedModelIds:[]}),a.snapshot&&i(a.snapshot),ed.o.success("Models added.",{description:a.message})}catch(t){W(e,{flowState:"add-error",errorMessage:t instanceof Error?t.message:"Models could not be added."})}}}async function F(e){try{O(!0);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)throw Error(a?.error||"Terminal could not be opened.");ed.o.success("Terminal opened.",{description:"Finish the provider login there, then return here to discover models."})}catch(e){ed.o.error("Unable to open Terminal.",{description:e instanceof Error?e.message:"Unknown terminal error."})}finally{O(!1)}}async function z(e){try{await navigator.clipboard.writeText(e),ed.o.success("Copied.",{description:"Command copied to your clipboard."})}catch{ed.o.error("Copy failed.",{description:"Clipboard access is not available."})}}function W(e,t){S(a=>({...a,[e]:{...a[e]||ec(),...t}}))}function B(e,t,a,s){W(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})}return(0,s.jsx)(G,{open:e,onOpenChange:t,children:(0,s.jsxs)(Q,{className:"flex h-[88dvh] max-h-[88dvh] w-[calc(100vw-20px)] max-w-[940px] flex-col gap-0 overflow-hidden p-0 sm:h-[min(88dvh,860px)] sm:max-h-[min(88dvh,860px)] sm:w-[min(940px,calc(100vw-40px))]",children:[(0,s.jsxs)(X,{className:"shrink-0 border-b border-white/10 bg-[linear-gradient(180deg,rgba(12,18,31,0.96),rgba(9,13,24,0.98))] px-6 py-5 pr-14",children:[(0,s.jsx)(et,{className:"text-[1.35rem]",children:"Add Models"}),(0,s.jsx)(ea,{className:"max-w-[560px] text-[13px] leading-6 text-slate-400",children:"Connect a provider, discover available models, and add them in seconds."})]}),(0,s.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain",children:(0,s.jsxs)("div",{className:"space-y-6 px-5 py-5 sm:px-6 sm:py-6",children:[(0,s.jsx)("div",{className:"grid gap-4 lg:grid-cols-3",children:er.map(e=>(0,s.jsx)(V,{descriptor:e,active:w===e.id,connected:eu(a,N,e.id).connected,detail:eu(a,N,e.id).detail,onClick:()=>{P(e.id)}},e.id))}),(0,s.jsxs)("div",{className:"rounded-[28px] border border-white/10 bg-[linear-gradient(180deg,rgba(13,20,34,0.94),rgba(9,13,24,0.96))]",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>j(e=>!e),className:"flex w-full items-center justify-between gap-3 px-4 py-3.5 text-left",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-display text-[0.95rem] text-white",children:"Other providers"}),(0,s.jsx)("p",{className:"mt-1 text-[11px] leading-5 text-slate-400",children:"Simpler API-key setup for additional provider routes."})]}),(0,s.jsx)(u.A,{className:k("h-4 w-4 text-slate-400 transition-transform",y?"rotate-180":"rotate-0")})]}),y?(0,s.jsx)("div",{className:"grid gap-3 border-t border-white/10 px-4 py-4 md:grid-cols-2 xl:grid-cols-3",children:en.map(e=>(0,s.jsx)(V,{descriptor:e,active:w===e.id,compact:!0,connected:eu(a,N,e.id).connected,detail:eu(a,N,e.id).detail,onClick:()=>{P(e.id)}},e.id))}):null]}),(0,s.jsx)("div",{className:"rounded-[28px] border border-white/10 bg-[linear-gradient(180deg,rgba(11,18,32,0.96),rgba(6,10,18,0.98))] p-4 sm:p-5",children:w&&$?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-display text-[1rem] text-white",children:$.label}),(0,s.jsx)("p",{className:"mt-1 max-w-[620px] text-[12px] leading-6 text-slate-400",children:"oauth"===$.connectKind?"Use your account login, then discover the models that are ready to add.":"local"===$.connectKind?"Check the local runtime first, then add the models already available on this machine.":"Connect the provider, review the discovered catalog, and add only the models you want."})]}),(0,s.jsx)(C,{variant:M.connection?.connected?"success":"muted",children:M.connection?.connected?"Connected":"Not connected"})]}),(0,s.jsx)("div",{className:"mt-5 flex flex-wrap gap-2",children:(l=w,o=M,d="ollama"===l?!!(o.connection?.connected||o.emptyState):!!(o.connection?.connected||o.manualCommand),c=o.models.length>0||!!o.emptyState,b=o.selectedModelIds.length>0,f="add-success"===o.flowState,[{label:"Choose provider",status:"done"},{label:"ollama"===l?"Local check":"Connect",status:"connecting"!==o.flowState||d?d?"done":"pending":"active"},{label:"Discover",status:"discovery-loading"===o.flowState?"active":c?"done":"pending"},{label:"Select",status:f?"done":b?"active":"pending"},{label:"Add",status:f?"done":"add-error"===o.flowState?"active":"pending"}]).map(e=>(0,s.jsxs)("div",{className:k("inline-flex items-center gap-2 rounded-full border px-3 py-1.5 text-[11px] uppercase tracking-[0.18em]","done"===e.status?"border-emerald-300/20 bg-emerald-300/10 text-emerald-100":"active"===e.status?"border-cyan-300/20 bg-cyan-300/10 text-cyan-100":"border-white/10 bg-white/[0.03] text-slate-500"),children:[(0,s.jsx)("span",{className:k("h-2 w-2 rounded-full","done"===e.status?"bg-emerald-300":"active"===e.status?"bg-cyan-300":"bg-slate-600")}),e.label]},e.label))}),M.statusMessage?(0,s.jsx)("div",{className:"mt-5 rounded-[22px] border border-white/10 bg-white/[0.04] px-4 py-3",children:(0,s.jsx)("p",{className:"text-[13px] text-slate-200",children:M.statusMessage})}):null,M.errorMessage?(0,s.jsx)("div",{className:"mt-4 rounded-[22px] border border-rose-400/20 bg-rose-400/[0.08] px-4 py-3 text-[13px] text-rose-100",children:M.errorMessage}):null,"openai-codex"===w?(0,s.jsxs)("div",{className:"mt-6 rounded-[28px] border border-white/10 bg-white/[0.03] p-5",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-display text-[1rem] text-white",children:"Connect your ChatGPT account"}),(0,s.jsx)("p",{className:"mt-1 max-w-[560px] text-[13px] leading-6 text-slate-400",children:"This uses OpenClaw's account-based login flow. No API key is required."})]}),(0,s.jsx)(I,{type:"button",className:"h-10 rounded-full px-5",disabled:"connecting"===M.flowState&&!M.manualCommand,onClick:()=>{D(w)},children:"connecting"!==M.flowState||M.manualCommand?"Connect ChatGPT":(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Connecting..."]})})]}),M.manualCommand?(0,s.jsxs)("div",{className:"mt-5 rounded-[22px] border border-cyan-300/15 bg-cyan-300/[0.07] p-4",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-[13px] font-medium text-cyan-50",children:"Finish sign-in in Terminal"}),(0,s.jsx)("p",{className:"mt-1 max-w-[560px] text-[12px] leading-6 text-cyan-100/80",children:"Open Terminal, complete the provider login, then return here and check discovery."})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(I,{type:"button",variant:"secondary",size:"sm",className:"h-9 rounded-full px-3",disabled:A,onClick:()=>{F(M.manualCommand||"")},children:A?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Opening..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Open Terminal"]})}),(0,s.jsxs)(I,{type:"button",variant:"ghost",size:"sm",className:"h-9 rounded-full px-3",onClick:()=>{z(M.manualCommand||"")},children:[(0,s.jsx)(x.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy command"]}),(0,s.jsxs)(I,{type:"button",variant:"ghost",size:"sm",className:"h-9 rounded-full px-3",onClick:()=>{L(w)},children:[(0,s.jsx)(p.A,{className:"mr-1.5 h-3.5 w-3.5"}),"I've connected it"]})]})]}),(0,s.jsx)("div",{className:"mt-4 overflow-x-auto rounded-[18px] border border-white/10 bg-slate-950/60 px-4 py-3",children:(0,s.jsx)("code",{className:"text-[12px] text-slate-200",children:M.manualCommand})})]}):null]}):null,"apiKey"===$.connectKind?(0,s.jsx)("div",{className:"mt-6 rounded-[28px] border border-white/10 bg-white/[0.03] p-5",children:(0,s.jsxs)("div",{className:"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-[11px] uppercase tracking-[0.18em] text-slate-500",children:"API key"}),(0,s.jsx)(T,{type:"password",value:M.apiKey,onChange:e=>W(w,{apiKey:e.target.value}),placeholder:"openrouter"===w?"sk-or-v1-...":"Paste API key",className:"mt-2"})]}),(0,s.jsx)(I,{type:"button",className:"h-11 rounded-full px-5",disabled:"connecting"===M.flowState||!M.apiKey.trim(),onClick:()=>{D(w)},children:"connecting"===M.flowState?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Connecting..."]}):`Connect ${$.shortLabel}`})]})}):null,"oauth"!==$.connectKind?(0,s.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,s.jsx)(I,{type:"button",variant:"secondary",size:"sm",className:"h-9 rounded-full px-4",disabled:"discovery-loading"===M.flowState,onClick:()=>{L(w)},children:"discovery-loading"===M.flowState?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Discovering..."]}):"Discover models"}),(0,s.jsx)(I,{type:"button",variant:"ghost",size:"sm",className:"h-9 rounded-full px-4",onClick:()=>{_(w)},children:"Refresh status"})]}):null,M.emptyState?(0,s.jsx)(em,{emptyState:M.emptyState,onCopyCommand:e=>{z(e)}}):null,M.models.length>0?(0,s.jsx)("div",{className:"mt-6",children:(0,s.jsx)(E,{provider:w,models:M.models,selectedModelIds:M.selectedModelIds,search:M.search,onSearchChange:e=>W(w,{search:e}),onToggleModel:e=>{W(w,{selectedModelIds:M.selectedModelIds.includes(e)?M.selectedModelIds.filter(t=>t!==e):[...M.selectedModelIds,e]})},onAddSelected:()=>{U(w)},isAdding:"connecting"===M.flowState&&"Adding selected models..."===M.statusMessage})}):null,"add-success"===M.flowState?(0,s.jsxs)("div",{className:"mt-5 flex items-center gap-3 rounded-[22px] border border-emerald-300/20 bg-emerald-300/[0.08] px-4 py-3",children:[(0,s.jsx)(g.A,{className:"h-4 w-4 text-emerald-200"}),(0,s.jsx)("p",{className:"text-[13px] text-emerald-50",children:M.statusMessage||"Models were added successfully."})]}):null,M.docsUrl?(0,s.jsx)("a",{href:M.docsUrl,target:"_blank",rel:"noreferrer",className:"mt-5 inline-flex text-[12px] text-slate-300 underline underline-offset-4",children:"OpenClaw model docs"}):null]}):(0,s.jsx)("div",{className:"flex min-h-[240px] items-center justify-center rounded-[24px] border border-dashed border-white/10 bg-white/[0.02] px-6 py-8 text-center",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-display text-[1.05rem] text-white",children:"Choose a provider to begin"}),(0,s.jsx)("p",{className:"mt-2 max-w-[420px] text-[13px] leading-6 text-slate-400",children:"Start with ChatGPT, OpenRouter, or Ollama Local. The flow will guide you through connect, discovery, selection, and add."})]})})})]})})]})})}function em({emptyState:e,onCopyCommand:t}){return(0,s.jsxs)("div",{className:"mt-5 rounded-[28px] border border-white/10 bg-white/[0.03] p-5",children:[(0,s.jsx)("p",{className:"font-display text-[1rem] text-white",children:e.title}),(0,s.jsx)("p",{className:"mt-1 max-w-[620px] text-[13px] leading-6 text-slate-400",children:e.description}),e.commands?.length?(0,s.jsx)("div",{className:"mt-4 space-y-2",children:e.commands.map(e=>(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-[18px] border border-white/10 bg-slate-950/60 px-4 py-3",children:[(0,s.jsx)("code",{className:"text-[12px] text-slate-200",children:e}),(0,s.jsxs)(I,{type:"button",size:"sm",variant:"ghost",className:"h-8 rounded-full px-3",onClick:()=>t(e),children:[(0,s.jsx)(x.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy"]})]},e))}):null]})}function eu(e,t,a){let s=t[a]?.connection;if(s)return s;let r=e.diagnostics.modelReadiness.authProviders.find(e=>e.provider===a),n=e.models.filter(e=>e.id.startsWith(`${a}/`)).length;return"ollama"===a?{provider:a,connected:n>0,canConnect:!0,needsTerminal:!1,detail:n>0?`${n} model${1===n?"":"s"} already visible in AgentOS.`:"Detect local models from this machine."}:{provider:a,connected:!!(r?.connected||n>0),canConnect:!0,needsTerminal:"openai-codex"===a,detail:r?.detail||ei(a).helperText}}var eh=a(2998);a(8646);var ex=a(3564),eg=a(7446),eb=a(978),ef=a(1052);function ew({tone:e,pulse:t=!1,className:a}){return(0,s.jsxs)("span",{className:k("relative inline-flex h-2.5 w-2.5 items-center justify-center",a),children:[t?(0,s.jsx)(ef.P.span,{className:k("absolute inset-0 rounded-full",e),animate:{opacity:[.4,0],scale:[1,2.2]},transition:{duration:1.8,repeat:1/0,ease:"easeOut"}}):null,(0,s.jsx)("span",{className:k("relative inline-flex h-2.5 w-2.5 rounded-full",e)})]})}var ev=a(1679);let ey=m.forwardRef(({className:e,children:t,...a},r)=>(0,s.jsxs)(ev.bL,{ref:r,className:k("relative overflow-hidden",e),...a,children:[(0,s.jsx)(ev.LM,{className:"mission-scroll h-full w-full rounded-[inherit] [&>div]:!block [&>div]:!w-full [&>div]:!min-w-0",children:t}),(0,s.jsx)(ej,{}),(0,s.jsx)(ev.OK,{})]}));ey.displayName=ev.bL.displayName;let ej=m.forwardRef(({className:e,orientation:t="vertical",...a},r)=>(0,s.jsx)(ev.VM,{ref:r,orientation:t,className:k("flex touch-none select-none transition-colors","vertical"===t&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===t&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...a,children:(0,s.jsx)(ev.lr,{className:"relative flex-1 rounded-full bg-white/[0.12]"})}));ej.displayName=ev.VM.displayName;let ek={worker:{label:"Worker",description:"Delivers code, docs, research, review, or analysis without mutating the system.",defaultName:"Worker",defaultEmoji:"\uD83D\uDEE0️",defaultTheme:"slate",badgeVariant:"default"},setup:{label:"Setup / Operator",description:"Prepares the environment, installs dependencies, and unblocks other agents.",defaultName:"Setup Operator",defaultEmoji:"\uD83E\uDDF0",defaultTheme:"amber",badgeVariant:"warning"},browser:{label:"Browser",description:"Captures browser evidence, screenshots, and user-path validation inside the workspace.",defaultName:"Browser Agent",defaultEmoji:"\uD83C\uDF10",defaultTheme:"blue",badgeVariant:"success"},monitoring:{label:"Monitoring",description:"Periodically checks workspace health, drift, and blockers, then leaves triage handoffs.",defaultName:"Monitoring Agent",defaultEmoji:"\uD83D\uDEF0️",defaultTheme:"teal",badgeVariant:"warning"},custom:{label:"Custom",description:"Starts from a safe default policy but leaves room for manual overrides.",defaultName:"Custom Agent",defaultEmoji:"\uD83E\uDDE9",defaultTheme:"violet",badgeVariant:"muted"}},eN={worker:{missingToolBehavior:"fallback",installScope:"none",fileAccess:"workspace-only",networkAccess:"enabled"},setup:{missingToolBehavior:"allow-install",installScope:"workspace",fileAccess:"workspace-only",networkAccess:"enabled"},browser:{missingToolBehavior:"ask-setup",installScope:"none",fileAccess:"workspace-only",networkAccess:"enabled"},monitoring:{missingToolBehavior:"fallback",installScope:"none",fileAccess:"workspace-only",networkAccess:"enabled"},custom:{missingToolBehavior:"fallback",installScope:"none",fileAccess:"workspace-only",networkAccess:"enabled"}},eC=Object.entries(ek).map(([e,t])=>({value:e,label:t.label,description:t.description})),eS=[{value:"fallback",label:"Fallback",description:"Produce the nearest viable output format instead of failing the task."},{value:"ask-setup",label:"Ask for setup",description:"Stop before environment changes and report the missing capability clearly."},{value:"route-setup",label:"Route to setup agent",description:"Leave an explicit setup handoff instead of attempting installs directly."},{value:"allow-install",label:"Allow install",description:"Install missing tooling when policy allows it and the task truly depends on it."}],eA=[{value:"none",label:"None",description:"Do not install workspace or system dependencies."},{value:"workspace",label:"Workspace only",description:"Only install dependencies inside the project or workspace environment."},{value:"system",label:"System",description:"Permit system-wide installs when they are necessary and intentional."}],eI=[{value:"workspace-only",label:"Workspace only",description:"Keep file work grounded inside the attached workspace."},{value:"extended",label:"Extended",description:"Allow broader file access when the task explicitly needs it."}],eT=[{value:"restricted",label:"Off",description:"Avoid network access unless the task explicitly depends on it."},{value:"enabled",label:"On",description:"Use network access when the task needs external information or downloads."}];function eO(e="worker",t){return{...eN[e],...t??{},preset:e}}function eR(e){return ek[e].label}function eM(e){return eS.find(t=>t.value===e)?.label??e}function e$(e){return eA.find(t=>t.value===e)?.label??e}function eP(e){return eI.find(t=>t.value===e)?.label??e}function e_(e){return eT.find(t=>t.value===e)?.label??e}var eE=a(6966);function eD(e){return e?`${(0,eE.B)(e,{addSuffix:!0})}`:"No activity"}function eL(e){return e?e>=1e3?`${Math.round(e/1e3)}k`:String(e):"n/a"}function eU(e){return"number"!=typeof e?"0":e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}k`:String(e)}function eF(e){return e.split("/").at(1)||e}function ez(e){switch(e){case"running":return"default";case"completed":return"success";case"cancelled":return"danger";case"stalled":return"warning";default:return"muted"}}function eW(e,t=8){return e?e.length<=t?e:e.slice(0,t):"n/a"}function eB(e){return e.replace(/^\/Users\/[^/]+/,"~")}function eq({label:e,onClick:t,danger:a=!1}){return(0,s.jsx)("button",{type:"button",className:k("flex w-full items-center rounded-[10px] px-2.5 py-2 text-left text-[11px] transition-colors",a?"text-rose-200 hover:bg-rose-400/10 hover:text-rose-100":"text-slate-200 hover:bg-white/[0.06] hover:text-white"),onClick:t,children:(0,s.jsx)("span",{children:e})})}function eV({label:e,value:t}){return(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3 rounded-[10px] bg-white/[0.02] px-2.5 py-1.5",children:[(0,s.jsx)("span",{className:"shrink-0 text-[9px] uppercase tracking-[0.18em] text-slate-500",children:e}),(0,s.jsx)("span",{className:"min-w-0 text-right text-[10px] leading-4 text-slate-100",children:t})]})}var eK=a(4331),eJ=a(6238),eG=a(3302),eH=a(2829),eZ=a(5720),eY=a(5805),eQ=a(7409),eX=a(2273);let e0=/https?:\/\/[^\s<>"'`)\]]+/g,e1=/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi,e2=/(?:^|[\s(])((?:\.{1,2}\/)?(?:deliverables|memory|docs|app|components|lib|public|scripts|packages|hooks|output)\/[^\s`),;]+)/g,e5=/`((?:\/|\.{1,2}\/|deliverables\/|memory\/|docs\/|app\/|components\/|lib\/|public\/|scripts\/|packages\/|hooks\/|output\/)[^`\n]+)`/g;function e3({text:e,className:t,url:a,filePath:r,displayPath:n,compact:i=!1}){let l=function(e,t){let a=new Set;for(let s of(t&&a.add(t),e.matchAll(e0)))s[0]&&a.add(s[0]);return[...a]}(e,a),o=function(e){let t=new Set;for(let a of e.matchAll(e1))a[0]&&t.add(a[0]);return[...t]}(e),d=function(e,t,a){let s=new Map;for(let r of(t&&s.set(t,{path:t,label:a||t}),e.matchAll(e5))){let e=r[1]?.trim();!e||s.has(e)||s.set(e,{path:e,label:e})}for(let t of e.matchAll(e2)){let e=t[1]?.trim();!e||s.has(e)||s.set(e,{path:e,label:e})}return[...s.values()]}(e,r,n);return(0,s.jsxs)("div",{className:k("space-y-2",i&&"space-y-1.5"),children:[(0,s.jsx)("p",{className:k("whitespace-pre-wrap break-words",t),children:function(e){let t=Array.from(e.matchAll(e0));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:"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)}),l.length>0||o.length>0||d.length>0?(0,s.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[l.map(e=>(0,s.jsxs)("a",{href:e,target:"_blank",rel:"noreferrer",className:k("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]",i&&"px-1.5 py-[3px] text-[9px]"),onClick:e=>e.stopPropagation(),children:[(0,s.jsx)(eQ.A,{className:k("h-3 w-3 shrink-0",i&&"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)),o.map(e=>(0,s.jsxs)("a",{href:`mailto:${e}`,className:k("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]",i&&"px-1.5 py-[3px] text-[9px]"),onClick:e=>e.stopPropagation(),children:[(0,s.jsx)(eQ.A,{className:k("h-3 w-3 shrink-0",i&&"h-2.5 w-2.5")}),(0,s.jsx)("span",{className:"truncate",children:e})]},e)),d.map(e=>(0,s.jsxs)("button",{type:"button",className:k("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]",i&&"px-1.5 py-[3px] text-[9px]"),onClick:t=>{t.stopPropagation(),e4(e.path)},children:[(0,s.jsx)(eY.A,{className:k("h-3 w-3 shrink-0",i&&"h-2.5 w-2.5")}),(0,s.jsx)("span",{className:"truncate",children:eB(e.label)})]},`${e.path}:${e.label}`))]}):null]})}async function e4(e){try{let t=await fetch("/api/files/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),a=await t.json();if(!t.ok)throw Error(a.error||"Unable to reveal file.");eX.oR.success("Revealed file.",{description:eB(e)})}catch(e){eX.oR.error("Could not reveal file.",{description:e instanceof Error?e.message:"Unknown file reveal error."})}}function e8({icon:e,label:t,value:a,active:r=!1,onClick:n}){return(0,s.jsxs)("button",{type:"button",className:k("flex min-h-[38px] w-full items-center justify-between rounded-[12px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-2.5 py-1.5 text-left transition-colors hover:border-cyan-300/20 hover:bg-cyan-400/[0.06]",r&&"border-cyan-300/30 bg-cyan-400/[0.08]"),onClick:e=>{e.stopPropagation(),n?.()},onPointerDown:e=>e.stopPropagation(),children:[(0,s.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 text-[9px] uppercase tracking-[0.16em] text-slate-400",children:[(0,s.jsx)(e,{className:"h-3 w-3 shrink-0"}),(0,s.jsx)("span",{className:"truncate",children:t})]}),a?(0,s.jsx)("span",{className:"ml-2 shrink-0 font-mono text-[10px] text-slate-200",children:a}):null]})}function e6({icon:e,label:t,destructive:a=!1,disabled:r=!1,onClick:n}){return(0,s.jsxs)("button",{type:"button",disabled:r,className:k("flex w-full items-center gap-2 rounded-[10px] px-2.5 py-2 text-left text-[11px] transition-colors",r?"cursor-not-allowed text-slate-500":a?"text-rose-100 hover:bg-rose-400/10 hover:text-rose-50":"text-slate-200 hover:bg-white/[0.06] hover:text-white"),onClick:n,children:[(0,s.jsx)(e,{className:k("h-3.5 w-3.5",a?"text-rose-300":"text-cyan-300")}),(0,s.jsx)("span",{children:t})]})}function e9(e){let t="string"==typeof e.metadata.dispatchStatus?e.metadata.dispatchStatus:null,a=e.status;return"cancelled"===t||"aborted"===t||"cancelled"===a||"aborted"===a}var e7=a(1455),te=a(1807),tt=a(2271);function ta({icon:e,label:t,value:a}){return(0,s.jsxs)("div",{className:"inline-flex items-center gap-1.5 rounded-full border border-white/[0.06] bg-slate-950/65 px-2.5 py-1 text-slate-300",children:[(0,s.jsx)(e,{className:"h-3 w-3 text-slate-400"}),(0,s.jsx)("span",{className:"workspace-node__metric-label text-[9px] uppercase tracking-[0.16em] text-slate-500",children:t}),(0,s.jsx)("span",{className:"font-display text-[12px] text-white",children:a})]})}let ts={},tr={workspace:function({data:e,selected:t}){return(0,s.jsx)(ef.P.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},className:k("workspace-node h-full rounded-[26px] border border-white/[0.04] bg-[linear-gradient(180deg,rgba(4,11,22,0.18),rgba(4,9,18,0.06))] p-3 text-white backdrop-blur-[2px]",e.emphasis?"opacity-100":"opacity-75",t&&"border-cyan-300/[0.16]"),children:(0,s.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,s.jsxs)("div",{className:"min-w-0 space-y-1.5",children:[(0,s.jsxs)("div",{className:"inline-flex items-center gap-2 rounded-full border border-white/[0.08] bg-slate-950/75 px-2.5 py-1.5 shadow-[0_14px_28px_rgba(0,0,0,0.2)]",children:[(0,s.jsx)("div",{className:"rounded-full border border-white/10 bg-white/[0.06] p-1.5",children:(0,s.jsx)(e7.A,{className:"h-3 w-3 text-cyan-200"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-display text-[12px] tracking-[0.04em] text-white",children:e.workspace.name}),(0,s.jsx)("p",{className:"workspace-node__slug text-[9px] uppercase tracking-[0.22em] text-slate-500",children:e.workspace.slug})]})]}),(0,s.jsx)("p",{className:"workspace-node__path max-w-[300px] truncate pl-1 text-[9px] uppercase tracking-[0.16em] text-slate-600",children:eB(e.workspace.path)})]}),(0,s.jsxs)("div",{className:"flex shrink-0 max-w-[48%] flex-wrap items-center justify-end gap-1.5",children:[(0,s.jsx)(C,{variant:"muted","data-health":e.workspace.health,className:k("workspace-node__health",function(e){switch(e){case"engaged":return"border-cyan-300/30 bg-cyan-300/14 text-cyan-50";case"monitoring":return"border-emerald-300/30 bg-emerald-300/14 text-emerald-50";case"ready":return"border-amber-300/30 bg-amber-300/14 text-amber-50";case"offline":return"border-rose-300/30 bg-rose-300/14 text-rose-50";default:return"border-white/12 bg-white/[0.07] text-slate-100"}}(e.workspace.health)),children:e.workspace.health}),(0,s.jsxs)("div",{className:"flex flex-wrap justify-end gap-1.5",children:[(0,s.jsx)(ta,{icon:te.A,label:"Agents",value:String(e.workspace.agentIds.length)}),(0,s.jsx)(ta,{icon:tt.A,label:"Models",value:String(e.workspace.modelIds.length)}),(0,s.jsx)(ta,{icon:L.A,label:"Runs",value:String(e.workspace.activeRuntimeIds.length)})]})]})]})})},agent:function({data:e,selected:t}){let[a,r]=(0,m.useState)(!1),[n,i]=(0,m.useState)(!1),l=(0,m.useRef)(null),o=`agent-details-${e.agent.id}`,d=function(e){switch(e){case"engaged":return"text-cyan-300";case"monitoring":return"text-emerald-300";case"ready":return"text-amber-200";case"offline":return"text-rose-200";default:return"text-slate-400"}}(e.agent.status),c="engaged"===e.agent.status?"bg-cyan-300":"monitoring"===e.agent.status?"bg-emerald-300":"ready"===e.agent.status?"bg-amber-200":"offline"===e.agent.status?"bg-rose-300":"bg-slate-500",p=e.agent.skills.length,h=e.agent.tools,x=e.agent.observedTools??[],g=h.length,b=x.length,f=`${p} skill${1===p?"":"s"}`,w=b>0?`${b} observed tool${1===b?"":"s"}`:g>0?`${g} configured tool${1===g?"":"s"}`:"No tools observed",v=e.agent.heartbeat.enabled?e.agent.heartbeat.every??("number"==typeof e.agent.heartbeat.everyMs?`${Math.round(e.agent.heartbeat.everyMs/1e3)}s`:null):null,y=e.agent.lastActiveAt?eD(e.agent.lastActiveAt):"No recent activity",j=`${eR(e.agent.policy.preset)} \xb7 ${f} \xb7 ${w}`,N=e.agent.lastActiveAt?`${eP(e.agent.policy.fileAccess)} \xb7 Heartbeat ${e.agent.heartbeat.enabled?v??"on":"off"} \xb7 Last active ${y}`:`${eP(e.agent.policy.fileAccess)} \xb7 Heartbeat ${e.agent.heartbeat.enabled?v??"on":"off"} \xb7 ${y}`;return(0,m.useEffect)(()=>{if(!a)return;let e=e=>{l.current?.contains(e.target)||r(!1)};return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e)},[a]),(0,s.jsxs)(ef.P.div,{initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},className:k("w-[212px] rounded-[16px] border border-white/[0.1] bg-[linear-gradient(180deg,rgba(15,24,40,0.94),rgba(8,13,24,0.94))] px-3 py-2.5 shadow-[0_16px_28px_rgba(0,0,0,0.26)] backdrop-blur-xl",e.emphasis?"opacity-100":"opacity-72",t&&"border-cyan-300/[0.45] shadow-[0_18px_42px_rgba(34,211,238,0.16)]"),children:[(0,s.jsx)(eh.h7,{type:"source",id:"source-right",position:ex.yX.Right,className:"!h-2.5 !w-2.5 !border-0 !bg-cyan-300/90 shadow-[0_0_14px_rgba(103,232,249,0.42)]"}),(0,s.jsxs)("div",{className:"flex items-start justify-between gap-2.5",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 text-[9px] uppercase tracking-[0.22em] text-slate-500",children:[(0,s.jsx)(ew,{tone:c,pulse:"engaged"===e.agent.status||"monitoring"===e.agent.status}),"Agent"]}),(0,s.jsx)("p",{className:"mt-1.5 truncate font-display text-[0.96rem] text-white",children:e.agent.name}),(0,s.jsx)("p",{className:"mt-0.5 truncate text-[10px] uppercase tracking-[0.16em] text-slate-500",children:e.agent.identity.theme??"OpenClaw operator"})]}),(0,s.jsxs)("div",{className:"relative",ref:l,children:[(0,s.jsx)("button",{type:"button","aria-label":`${e.agent.name} actions`,onClick:e=>{e.stopPropagation(),r(e=>!e)},onPointerDown:e=>e.stopPropagation(),className:"inline-flex rounded-full border border-white/[0.08] bg-white/[0.05] p-1.5 text-slate-300 transition-colors hover:bg-white/[0.1] hover:text-white",children:(0,s.jsx)(eg.A,{className:"h-3.5 w-3.5"})}),a?(0,s.jsxs)("div",{className:"absolute right-0 top-[calc(100%+8px)] z-30 min-w-[136px] rounded-[14px] border border-white/[0.1] bg-slate-950/96 p-1.5 shadow-[0_20px_44px_rgba(0,0,0,0.42)] backdrop-blur-xl",onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:[(0,s.jsx)(eq,{label:"Edit",onClick:()=>{e.onEdit?.(e.agent.id),r(!1)}}),(0,s.jsx)(eq,{label:"Delete",danger:!0,onClick:()=>{e.onDelete?.(e.agent.id),r(!1)}})]}):null]})]}),(0,s.jsxs)("div",{className:"mt-2.5 flex flex-wrap items-center gap-1.5",children:[(0,s.jsx)(C,{variant:"engaged"===e.agent.status?"default":"monitoring"===e.agent.status?"success":"warning",children:e.agent.status}),(0,s.jsx)(C,{variant:"muted",className:"max-w-[132px] truncate",children:eF(e.agent.modelId)})]}),(0,s.jsxs)("div",{className:"mt-2.5 border-t border-white/[0.08] pt-2.5",children:[(0,s.jsx)("p",{className:"text-[12px] leading-4 text-slate-100",children:e.agent.currentAction}),(0,s.jsx)("p",{className:k("mt-1.5 text-[9px] uppercase tracking-[0.2em]",d),children:e.agent.id})]}),(0,s.jsxs)("div",{className:k("mt-2.5 border-t border-white/[0.08] pt-2.5",n&&"pb-1"),children:[(0,s.jsxs)("button",{type:"button","aria-expanded":n,"aria-controls":o,className:"group flex w-full items-start justify-between gap-3 rounded-[14px] border border-transparent px-1 py-1.5 text-left transition-colors hover:border-white/[0.06] hover:bg-white/[0.02]",onClick:e=>{e.stopPropagation(),i(e=>!e)},onPointerDown:e=>e.stopPropagation(),children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"text-[9px] uppercase tracking-[0.2em] text-slate-500 transition-colors group-hover:text-slate-400",children:"Agent details"}),(0,s.jsx)("p",{className:"mt-1 truncate text-[10px] text-slate-300",children:j}),(0,s.jsx)("p",{className:"mt-1 truncate text-[10px] text-slate-500",children:N})]}),(0,s.jsx)("div",{className:"mt-0.5 shrink-0 rounded-full border border-white/[0.08] bg-white/[0.04] p-1 text-slate-400 transition-colors group-hover:border-white/[0.12] group-hover:text-slate-200",children:n?(0,s.jsx)(eb.A,{className:"h-3 w-3"}):(0,s.jsx)(u.A,{className:"h-3 w-3"})})]}),n?(0,s.jsx)(ef.P.div,{id:o,initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden nowheel",onClick:e=>e.stopPropagation(),children:(0,s.jsx)("div",{className:"pt-2.5",children:(0,s.jsx)(ey,{className:"h-[160px] w-full pr-3",children:(0,s.jsxs)("div",{className:"space-y-2.5",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[9px] uppercase tracking-[0.2em] text-slate-500",children:"Capabilities"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.agent.skills.length>0?e.agent.skills.map(e=>(0,s.jsx)(C,{variant:"muted",className:"max-w-full truncate",children:e},e)):(0,s.jsx)(C,{variant:"muted",children:"No explicit skills"})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[9px] uppercase tracking-[0.2em] text-slate-500",children:"Declared tools"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:h.length>0?h.map(e=>(0,s.jsx)(C,{variant:"warning",className:"max-w-full truncate",children:e},e)):(0,s.jsx)(C,{variant:"muted",children:"No explicit tools configured"})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[9px] uppercase tracking-[0.2em] text-slate-500",children:"Observed tools"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:x.length>0?x.map(e=>(0,s.jsx)(C,{variant:"default",className:"max-w-full truncate",children:e},e)):(0,s.jsx)(C,{variant:"muted",children:"No runtime tool calls recovered yet"})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[9px] uppercase tracking-[0.2em] text-slate-500",children:"Permissions"}),(0,s.jsxs)("div",{className:"grid gap-1.5",children:[(0,s.jsx)(eV,{label:"File access",value:eP(e.agent.policy.fileAccess)}),(0,s.jsx)(eV,{label:"Network",value:e_(e.agent.policy.networkAccess)}),(0,s.jsx)(eV,{label:"Install scope",value:e$(e.agent.policy.installScope)}),(0,s.jsx)(eV,{label:"Missing tools",value:eM(e.agent.policy.missingToolBehavior)})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[9px] uppercase tracking-[0.2em] text-slate-500",children:"Runtime posture"}),(0,s.jsxs)("div",{className:"grid gap-1.5",children:[(0,s.jsx)(eV,{label:"Last active",value:y}),(0,s.jsx)(eV,{label:"Heartbeat",value:e.agent.heartbeat.enabled?v?`On \xb7 ${v}`:"On":"Off"}),(0,s.jsx)(eV,{label:"Sessions",value:String(e.agent.sessionCount)}),(0,s.jsx)(eV,{label:"Active runs",value:String(e.agent.activeRuntimeIds.length)})]})]})]})})})}):null]})]})},task:function({data:e,selected:t}){var a;let r="string"==typeof e.task.metadata.bootstrapStage?e.task.metadata.bootstrapStage:null,n="string"==typeof e.task.metadata.dispatchSubmittedAt?e.task.metadata.dispatchSubmittedAt:null,i=!!e.pendingCreation,l=!!e.justCreated,o=e9(e.task),d=function(e){if(e9(e))return!1;let t=e.status;return"running"===t||"queued"===t}(e.task),c=o?"text-rose-200":function(e){switch(e){case"running":return"text-cyan-300";case"completed":return"text-emerald-300";case"cancelled":return"text-rose-300";case"stalled":case"queued":return"text-amber-200";default:return"text-slate-400"}}(e.task.status),[p,h]=(0,m.useState)(!1),g=(0,m.useRef)(null),b=i?"warning":o?"danger":ez(e.task.status),w=function(e,t,a,s){if(s)return"aborted";if(!a||!e)return t;switch(e){case"submitting":return"submitting";case"accepted":return"accepted";case"waiting-for-heartbeat":return"starting runner";case"waiting-for-runtime":return"awaiting runtime";case"runtime-observed":return"going live";case"stalled":return"stalled";case"completed":return"completed";default:return t}}(r,e.task.status,i,o),v=function(e,t,a){if(a)return"dispatch aborted";switch(e){case"submitting":return"contacting dispatcher";case"accepted":return"dispatch accepted";case"waiting-for-heartbeat":return"waiting for first heartbeat";case"waiting-for-runtime":return"waiting for first OpenClaw runtime";case"runtime-observed":return"runtime observed";case"stalled":return"dispatch stalled";default:return t>0?`${t} live run${1===t?"":"s"}`:"no live runs right now"}}(r,e.task.liveRunCount,o),y=Array.isArray(e.task.metadata.optimisticEvents)?e.task.metadata.optimisticEvents:[],j=y.length>0&&"object"==typeof(a=y[y.length-1])&&null!==a&&"string"==typeof a.id&&"string"==typeof a.title&&"string"==typeof a.detail?y[y.length-1]:null,N=i?function(e){if(!e)return null;let t=Date.parse(e);if(Number.isNaN(t))return null;let a=Math.floor(Math.max(Date.now()-t,0)/1e3);if(a<60)return`${a}s`;let s=Math.floor(a/60),r=a%60;return 0===r?`${s}m`:`${s}m ${r}s`}(n):null,[S,A]=(0,m.useState)(!1),{feed:I,loading:T,error:O}=function(e,t){let[a,s]=(0,m.useState)({taskId:null,feed:[]}),[r,n]=(0,m.useState)(null),[i,l]=(0,m.useState)({taskId:null,message:null});(0,m.useEffect)(()=>{if(!t)return;let a=new EventSource(`/api/tasks/${e}/stream`),r=t=>{try{let a=JSON.parse(t.data);"task"===a.type&&(s({taskId:e,feed:a.detail.liveFeed||[]}),n(e),l({taskId:e,message:null}))}catch(t){console.error("Failed to parse task stream event",t),l({taskId:e,message:"Unable to parse task feed."})}},i=t=>{try{let a=JSON.parse(t.data);l({taskId:e,message:a.error||"Unknown error"})}catch{l({taskId:e,message:"Stream error"})}};return a.addEventListener("task",r),a.addEventListener("task-error",i),a.onerror=()=>{l(t=>t.taskId===e&&t.message?t:{taskId:e,message:"Task feed disconnected. Reconnecting…"})},()=>{a.close(),a.removeEventListener("task",r),a.removeEventListener("task-error",i)}},[e,t]);let o=a.taskId===e?a.feed:[],d=i.taskId===e?i.message:null;return{feed:o,loading:t&&r!==e&&null===d,error:d}}(e.task.id,S),R=I[I.length-1]??j??null,M=R?.title||v,$=R?.detail||(i?[v,N?`${N} elapsed`:null].filter(Boolean).join(" \xb7 "):e.task.subtitle||v),P=I.length>0?String(I.length):void 0,_=`task-feed-${e.task.id}`;return(0,m.useEffect)(()=>{if(!p)return;let e=e=>{g.current?.contains(e.target)||h(!1)};return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e)},[p]),(0,s.jsxs)(ef.P.div,{initial:i?{opacity:0,scale:.92,y:-10}:l?{opacity:0,scale:.96,y:10}:{opacity:0,x:10},animate:i?{opacity:1,scale:1,y:0}:l?{opacity:1,scale:[1,1.015,1],y:0}:{opacity:1,x:0},transition:l?{duration:.7,times:[0,.45,1]}:void 0,className:k("relative w-[272px] overflow-hidden rounded-[20px] border border-white/[0.1] bg-[linear-gradient(180deg,rgba(15,24,40,0.96),rgba(8,13,24,0.96))] p-3.5 shadow-[0_18px_36px_rgba(0,0,0,0.28)] backdrop-blur-xl",e.emphasis?"opacity-100":"opacity-72",t&&"border-cyan-300/[0.45] shadow-[0_20px_46px_rgba(34,211,238,0.16)]",i&&"border-cyan-300/30 shadow-[0_24px_54px_rgba(34,211,238,0.2)]",l&&"border-cyan-200/40 shadow-[0_24px_56px_rgba(125,211,252,0.18)]",o&&"border-rose-300/30 shadow-[0_24px_54px_rgba(244,63,94,0.14)]","completed"===e.task.status&&!o&&!i&&!l&&"border-white/[0.06] bg-[linear-gradient(180deg,rgba(13,18,30,0.9),rgba(8,12,22,0.9))]"),children:[i?(0,s.jsx)(ef.P.div,{className:"pointer-events-none absolute inset-[-16px] rounded-[24px] border border-cyan-200/16",animate:{opacity:[.18,.42,.18],scale:[.985,1.02,.985]},transition:{duration:1.8,repeat:1/0,ease:"easeInOut"}}):null,(0,s.jsx)(eh.h7,{type:"target",id:"target-left",position:ex.yX.Left,className:"!h-2.5 !w-2.5 !border-0 !bg-white/35"}),(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 text-[9px] uppercase tracking-[0.22em] text-slate-500",children:[(0,s.jsx)(ew,{tone:i?"bg-cyan-300":o?"bg-rose-200":"stalled"===e.task.status?"bg-amber-200":"completed"===e.task.status?"bg-emerald-300":"running"===e.task.status?"bg-cyan-300":"bg-amber-200"}),i?"Task bootstrap":"Task"]}),(0,s.jsx)("p",{className:"mt-1.5 line-clamp-2 font-display text-[1rem] leading-5 text-white",children:e.task.title}),(0,s.jsx)("p",{className:"mt-1 truncate text-[10px] uppercase tracking-[0.16em] text-slate-500",children:e.task.primaryAgentName||"OpenClaw"})]}),(0,s.jsxs)("div",{className:"relative",ref:g,children:[(0,s.jsx)("button",{type:"button","aria-label":"Task actions",onClick:e=>{e.stopPropagation(),h(e=>!e)},onPointerDown:e=>e.stopPropagation(),className:"inline-flex rounded-full border border-white/[0.08] bg-white/[0.05] p-1.5 text-slate-300 transition-colors hover:bg-white/[0.1] hover:text-white",children:(0,s.jsx)(eg.A,{className:"h-3 w-3"})}),p?(0,s.jsxs)("div",{className:"absolute right-0 top-[calc(100%+8px)] z-30 min-w-[148px] rounded-[14px] border border-white/[0.1] bg-slate-950/96 p-1.5 shadow-[0_20px_44px_rgba(0,0,0,0.42)] backdrop-blur-xl",onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:[(0,s.jsx)(e6,{icon:eK.A,label:"Use prompt",onClick:()=>{e.onReply?.(e.task),h(!1)}}),(0,s.jsx)(e6,{icon:x.A,label:"Copy mission",onClick:()=>{e.onCopyPrompt?.(e.task),h(!1)}}),(0,s.jsx)(e6,{icon:eJ.A,label:"Hide",onClick:()=>{e.onHide?.(e.task),h(!1)}}),e.onAbortTask&&(d||o)?(0,s.jsx)(e6,{icon:eG.A,label:o?"Aborted":"Abort task",destructive:!0,disabled:!d,onClick:()=>{d&&(e.onAbortTask?.(e.task),h(!1))}}):null,(0,s.jsx)(e6,{icon:e.locked?eH.A:f.A,label:e.locked?"Unlock":"Lock",onClick:()=>{e.onToggleLock?.(e.task),h(!1)}})]}):null]})]}),(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-1.5",children:[(0,s.jsx)(C,{variant:b,children:w}),e.task.warningCount>0?(0,s.jsxs)(C,{variant:"warning",children:[e.task.warningCount," review",1===e.task.warningCount?"":"s"]}):null,l?(0,s.jsxs)(C,{variant:"default",className:"gap-1 border-cyan-100/20 bg-cyan-100/12 text-cyan-50",children:[(0,s.jsx)(L.A,{className:"h-3 w-3"}),"new"]}):null,(0,s.jsxs)("span",{className:k("text-[9px] uppercase tracking-[0.18em]",c),children:[eU(e.task.tokenUsage?.total)," tokens"]})]}),(0,s.jsx)("div",{className:"mt-3 rounded-[16px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:(0,s.jsx)("p",{className:"line-clamp-2 text-[12.5px] leading-5 text-slate-100",children:e.task.subtitle})}),(0,s.jsxs)("div",{className:"mt-3 grid grid-cols-3 gap-1.5",children:[(0,s.jsx)(e8,{icon:eZ.A,label:"Feed",value:P,active:S,onClick:()=>{e.onInspect?e.onInspect(e.task,"output"):A(e=>!e)}}),(0,s.jsx)(e8,{icon:eY.A,label:"Runs",value:String(e.task.runtimeCount),onClick:()=>e.onInspect?.(e.task,"overview")}),(0,s.jsx)(e8,{icon:L.A,label:"Files",value:String(e.task.artifactCount),onClick:()=>e.onInspect?.(e.task,"files")})]}),(0,s.jsxs)("div",{className:k("mt-3 border-t border-white/[0.08] pt-2.5",S&&"pb-1"),children:[(0,s.jsxs)("button",{type:"button","aria-expanded":S,"aria-controls":_,className:"group flex w-full items-start justify-between gap-3 rounded-[14px] border border-transparent px-1 py-1.5 text-left transition-colors hover:border-white/[0.06] hover:bg-white/[0.02]",onClick:e=>{e.stopPropagation(),A(e=>!e)},onPointerDown:e=>e.stopPropagation(),children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"text-[9px] uppercase tracking-[0.2em] text-slate-500 transition-colors group-hover:text-slate-400",children:"Live feed"}),(0,s.jsx)("p",{className:"mt-1 truncate text-[10px] text-slate-300",children:M}),(0,s.jsx)("p",{className:"mt-1 truncate text-[10px] text-slate-500",children:$})]}),(0,s.jsx)("div",{className:"mt-0.5 shrink-0 rounded-full border border-white/[0.08] bg-white/[0.04] p-1 text-slate-400 transition-colors group-hover:border-white/[0.12] group-hover:text-slate-200",children:S?(0,s.jsx)(eb.A,{className:"h-3 w-3"}):(0,s.jsx)(u.A,{className:"h-3 w-3"})})]}),S&&(0,s.jsx)(ef.P.div,{id:_,initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden nowheel",onClick:e=>e.stopPropagation(),children:(0,s.jsx)("div",{className:"pt-2.5",children:(0,s.jsx)(ey,{className:"h-[164px] w-full pr-3",children:T&&0===I.length?(0,s.jsx)("div",{className:"py-4 text-center text-[10px] text-slate-500",children:"Connecting to feed..."}):O&&0===I.length?(0,s.jsx)("div",{className:"rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[10px] leading-5 text-amber-100",children:O}):0===I.length?(0,s.jsx)("div",{className:"py-4 text-center text-[10px] text-slate-500",children:"No events yet."}):(0,s.jsx)("div",{className:"flex flex-col gap-2.5",children:I.map(e=>(0,s.jsxs)("div",{className:"group/item relative pl-3",children:[(0,s.jsx)("div",{className:k("absolute left-0 top-1.5 h-1.5 w-1.5 rounded-full",function(e,t){if(t)return"bg-red-400";switch(e){case"status":return"bg-slate-400";case"assistant":return"bg-cyan-400";case"tool":return"bg-indigo-400";case"artifact":return"bg-emerald-400";case"warning":return"bg-amber-400";case"user":return"bg-pink-400";default:return"bg-slate-500"}}(e.kind,e.isError))}),(0,s.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,s.jsx)("span",{className:"text-[10px] font-medium text-slate-300",children:e.title}),(0,s.jsx)("span",{className:"shrink-0 text-[9px] text-slate-600",children:function(e){try{return new Date(e).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{return""}}(e.timestamp)})]}),(0,s.jsx)("div",{className:"mt-0.5",children:(0,s.jsx)(e3,{text:e.detail,className:"text-[10px] leading-relaxed text-slate-400 group-hover/item:text-slate-300",url:"url"in e?e.url:null,filePath:"filePath"in e?e.filePath:null,displayPath:"displayPath"in e?e.displayPath:null,compact:!0})})]},e.id))})})})})]})]})}},tn="mission-control-node-positions";function ti({snapshot:e,activeWorkspaceId:t,selectedNodeId:a,recentDispatchId:r,hiddenRuntimeIds:n,hiddenTaskKeys:i,lockedTaskKeys:l,onEditAgent:o,onDeleteAgent:d,onReplyTask:c,onCopyTaskPrompt:p,onHideTask:u,onToggleTaskLock:h,onAbortTask:x,onInspectTask:g,onSelectNode:b,className:f}){let w=(0,m.useRef)(null),v=(0,m.useRef)(null),y=(0,m.useRef)(new Set),j=(0,m.useRef)(new Map),N=(0,m.useRef)({}),C=(0,m.useRef)(!1),S=(0,m.useRef)(!1),A=(0,m.useRef)(!1),[I,T]=(0,m.useState)([]),[O,R]=(0,m.useState)(null),M=tl(e,t,I,n,i,l,o,d,c,p,u,h,x,g,ts),[$,P,_]=(0,eh.ck)(M.nodes),[E,D,L]=(0,eh.fM)(M.edges);return(0,m.useEffect)(()=>{let e=function(){var e;let t,a=(e=tn,(t=globalThis.localStorage)&&"function"==typeof t.getItem?t.getItem(e):null);if(!a)return{};try{let e=JSON.parse(a);if(!e||"object"!=typeof e)return{};let t=Object.entries(e).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(t)}catch{return{}}}();N.current=e,C.current=!0,S.current=!0,0!==Object.keys(e).length&&P(t=>t.map(t=>{var a;if("workspace"===t.type)return t;let s="agent"===t.type?tc(t.data.agent):tm(t.data.task),r="agent"===t.type?tp(t.data.agent.id):(a=t.data.task.id,`task:${a}`),n=e[s]||e[r];return n&&(t.position.x!==n.x||t.position.y!==n.y)?{...t,position:{x:n.x,y:n.y}}:t}))},[P]),(0,m.useEffect)(()=>{let a=tl(e,t,I,n,i,l,o,d,c,p,u,h,x,g,N.current);P(e=>{var t,s;let r;return!A.current&&C.current?(A.current=!0,a.nodes):(t=e,s=a.nodes,r=new Map(t.map(e=>[e.id,e])),s.map(e=>{let t=r.get(e.id);return t&&t.type===e.type&&"workspace"!==e.type?{...e,position:t.position,width:t.width,height:t.height}:e}))}),D(a.edges)},[e,t,I,n,i,l,o,d,c,p,u,h,x,g,D,P]),(0,m.useEffect)(()=>{P(e=>e.map(e=>{var t,s;return{...e,selected:e.id===a,zIndex:(t=e,s=a,"workspace"===t.type?0:"agent"===t.type?10:t.id===s?60:t.data.pendingCreation?40:t.data.justCreated?28:10)}}))},[a,P]),(0,m.useEffect)(()=>{var t,a,s,o;let d,c;if(!r||y.current.has(r))return;let p=e.tasks.filter(e=>!to(e,n,i,l)&&e.dispatchId===r&&!0!==e.metadata.optimistic).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0))[0];p&&(y.current.add(r),t=p.id,a=T,s=j,o=R,a(e=>e.includes(t)?e:[...e,t]),o(t),(d=s.current.get(t))&&clearTimeout(d),c=setTimeout(()=>{a(e=>e.filter(e=>e!==t)),s.current.delete(t)},12e3),s.current.set(t,c),b(p.id))},[e.tasks,r,n,i,l,b]),(0,m.useEffect)(()=>{let e=j.current;return()=>{e.forEach(e=>{clearTimeout(e)}),e.clear()}},[]),(0,m.useEffect)(()=>{if(!O||!v.current)return;let e=$.find(e=>e.id===O);if(!e)return;v.current.setCenter(e.position.x+(e.width??272)/2,e.position.y+(e.height??204)/2,{zoom:Math.max(v.current.getZoom(),.88),duration:650});let t=setTimeout(()=>{R(e=>e===O?null:e)},900);return()=>clearTimeout(t)},[O,$]),(0,m.useEffect)(()=>{let e=w.current;if(!e||"u"<typeof ResizeObserver)return;let t=null,a=new ResizeObserver(()=>{v.current&&0!==$.length&&(t&&clearTimeout(t),t=setTimeout(()=>{v.current?.fitView({padding:.14,duration:260,maxZoom:.9})},90))});return a.observe(e),()=>{a.disconnect(),t&&clearTimeout(t)}},[$.length]),(0,m.useEffect)(()=>{var e,t,a,s;let r,n,i;if(!C.current)return;if(S.current){S.current=!1;return}let l=Object.fromEntries($.filter(e=>"agent"===e.type||"task"===e.type).map(e=>{var t;return["agent"===(t=e).type?tc(t.data.agent):tm(t.data.task),{x:e.position.x,y:e.position.y}]})),o={...N.current,...l};e=N.current,t=o,r=Object.entries(e),n=Object.entries(t),!(r.length===n.length&&r.every(([e,a])=>{let s=t[e];return s&&s.x===a.x&&s.y===a.y}))&&(N.current=o,a=tn,s=JSON.stringify(o),(i=globalThis.localStorage)&&"function"==typeof i.setItem&&i.setItem(a,s))},[$]),(0,s.jsx)("div",{ref:w,className:k("h-full w-full",f),children:(0,s.jsx)(eh.Gc,{nodes:$,edges:E,nodeTypes:tr,onInit:e=>{v.current=e},elevateNodesOnSelect:!1,onNodesChange:_,onEdgesChange:L,onNodeClick:(e,t)=>b(t.id),fitView:!0,fitViewOptions:{padding:.14,duration:700,maxZoom:.9},minZoom:.42,maxZoom:1.2,defaultEdgeOptions:{type:"simplebezier",style:{stroke:"rgba(148, 163, 184, 0.34)",strokeWidth:1.15}},proOptions:{hideAttribution:!0},className:"h-full w-full rounded-[inherit]"})})}function tl(e,t,a,s,r,n,i,l,o,d,c,p,m,u,h){let x=t?e.workspaces.filter(e=>e.id===t):[...e.workspaces].sort((e,t)=>t.activeRuntimeIds.length-e.activeRuntimeIds.length),g=[],b=[],f=[];x.forEach((x,w)=>{let v=e.agents.filter(e=>e.workspaceId===x.id),y=e.tasks.filter(e=>e.workspaceId===x.id&&!to(e,s,r,n)),j=w%2*1160+44,k=920*Math.floor(w/2)+42,N=j+52,C=j+390,S=k+118;v.forEach((e,s)=>{let r=y.filter(t=>{var a;return((a=t).primaryAgentId||a.agentIds[0]||null)===e.id}).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0)),g=S+4*s;b.push({id:e.id,type:"agent",draggable:!0,position:td(tc(e),{x:N,y:g},h,tp(e.id)),zIndex:10,selected:!1,data:{agent:e,emphasis:!t||t===x.id,onEdit:i,onDelete:l}}),f.push(...r),r.forEach((e,s)=>{var r;let i="string"==typeof e.metadata.bootstrapStage?e.metadata.bootstrapStage:null,l="submitting"===i||"accepted"===i||"waiting-for-heartbeat"===i||"waiting-for-runtime"===i||"runtime-observed"===i,f=a.includes(e.id);b.push({id:e.id,type:"task",draggable:!0,selectable:!0,position:td(tm(e),{x:C,y:g+152*s+10},h,(r=e.id,`task:${r}`)),zIndex:l?40:f?28:10,selected:!1,data:{task:e,emphasis:!t||t===x.id,pendingCreation:l,justCreated:f,locked:n.includes(e.key),onReply:o,onCopyPrompt:d,onHide:c,onToggleLock:p,onAbortTask:m,onInspect:u}})}),S+=Math.max(152,152*r.length+44)}),g.push({id:x.id,type:"workspace",draggable:!1,position:{x:j,y:k},zIndex:0,style:{width:1060,height:Math.max(S-k+112,700)},selectable:!0,selected:!1,data:{workspace:x,emphasis:!t||t===x.id}})});let w=[...g,...b];return{nodes:w,edges:function(e,t){let a=[],s=new Map(t.map(e=>[e.id,e]));for(let t of e){if(!t.primaryAgentId)continue;let e=s.get(t.primaryAgentId),r=s.get(t.id);e&&r&&a.push({id:`edge:${t.primaryAgentId}:${t.id}`,source:t.primaryAgentId,target:t.id,sourceHandle:"source-right",targetHandle:"target-left",type:"simplebezier",zIndex:4,animated:"running"===t.status,style:{stroke:"running"===t.status?"rgba(107, 190, 255, 0.85)":"rgba(148, 163, 184, 0.28)",strokeWidth:"running"===t.status?1.45:1.05}})}return a}(f,w)}}function to(e,t,a,s){return!s.includes(e.key)&&(!!a.includes(e.key)||0!==e.runtimeIds.length&&e.runtimeIds.every(e=>t.includes(e)))}function td(e,t,a,s){let r=a[e]||(s?a[s]:void 0);return r?{x:r.x,y:r.y}:t}function tc(e){return`agent:${e.workspaceId}:${e.id}`}function tp(e){return`agent:${e}`}function tm(e){return`task:${e.workspaceId||"global"}:${e.key}`}var tu=a(3638),th=a(2070),tx=a(3440),tg=a(9311),tb=a(9389);let tf=(0,v.F)("text-xs font-medium uppercase tracking-[0.18em] text-slate-400"),tw=m.forwardRef(({className:e,...t},a)=>(0,s.jsx)(tb.b,{ref:a,className:k(tf(),e),...t}));tw.displayName=tb.b.displayName;let tv=[{value:"15m",label:"15 min"},{value:"30m",label:"30 min"},{value:"60m",label:"1 hour"},{value:"240m",label:"4 hours"}];function ty(e){return"monitoring"===e?{enabled:!0,every:"30m"}:{enabled:!1,every:"30m"}}function tj(e,t){let a=ty(e),s="string"==typeof t?.every&&t.every.trim()&&"disabled"!==t.every?t.every.trim():a.every;return"boolean"==typeof t?.enabled?{enabled:t.enabled,every:s}:t?.every==="disabled"?{enabled:!1,every:s}:a}function tk(e,t,a){let s=ty(t);return e.enabled!==s.enabled||e.every!==s.every?e:ty(a)}function tN({snapshot:e,defaultWorkspaceId:t,onRefresh:a,onAgentCreated:r,trigger:n}){var i,l;let o,d,[c,p]=(0,m.useState)(!1),[u,h]=(0,m.useState)(!1),[x,g]=(0,m.useState)(!1),[b,f]=(0,m.useState)(!1),[w,v]=(0,m.useState)(!1),[y,j]=(0,m.useState)(()=>tT(t??e.workspaces[0]?.id??"")),N=e.workspaces.find(e=>e.id===y.workspaceId)??e.workspaces[0]??null,C=(i=N?.slug,l=y.name||ek[y.policy.preset].defaultName,o=tO(i??""),d=tO(l)||"agent",o?`${o}-${d}`:d),S=tO(y.id),A=S.length>0?e.agents.find(e=>e.id===S)??null:null,O=A?e.workspaces.find(e=>e.id===A.workspaceId)?.name??A.workspacePath:null,R=!!(S&&y.workspaceId)&&!b&&null===A,M=x||"monitoring"===y.policy.preset;(0,m.useEffect)(()=>{p(!0)},[]),(0,m.useEffect)(()=>{u||(j(tT(t??e.workspaces[0]?.id??"")),g(!1),v(!1))},[u,t,e.workspaces]),(0,m.useEffect)(()=>{u&&!w&&C&&j(e=>e.id===C?e:{...e,id:C})},[u,w,C]);let $=async()=>{if(S&&!A){f(!0);try{let e=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...y,id:S})}),t=await e.json();if(!e.ok||t.error||!t.agentId)throw Error(t.error||"OpenClaw could not create the agent.");ed.o.success("Agent created in OpenClaw.",{description:t.agentId}),h(!1),await a(),r?.(t.agentId)}catch(e){ed.o.error("Agent creation failed.",{description:e instanceof Error?e.message:"Unknown agent error."})}finally{f(!1)}}};return c?(0,s.jsxs)(G,{open:u,onOpenChange:h,children:[(0,s.jsx)(H,{asChild:!0,children:n}),(0,s.jsxs)(Q,{className:"max-h-[90vh] overflow-y-auto sm:max-w-3xl",children:[(0,s.jsxs)(X,{children:[(0,s.jsx)(et,{children:"Create a new OpenClaw agent"}),(0,s.jsx)(ea,{children:"This creates a real isolated agent bound to an existing workspace with a preset policy."})]}),(0,s.jsxs)("div",{className:"space-y-5",children:[(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("p",{className:"text-[11px] uppercase tracking-[0.18em] text-slate-400",children:"Agent preset"}),(0,s.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:eC.map(e=>(0,s.jsx)(tS,{label:e.label,description:e.description,active:y.policy.preset===e.value,badgeVariant:ek[e.value].badgeVariant,onClick:()=>j(t=>{var a,s;let r,n,i;return a=t,s=e.value,r=ek[a.policy.preset],n=ek[s],i=eO(s),{...a,name:a.name&&a.name!==r.defaultName?a.name:n.defaultName,emoji:a.emoji&&a.emoji!==r.defaultEmoji?a.emoji:n.defaultEmoji,theme:a.theme&&a.theme!==r.defaultTheme?a.theme:n.defaultTheme,policy:i,heartbeat:tk(a.heartbeat,a.policy.preset,s)}})},e.value))})]}),(0,s.jsx)(tA,{policy:y.policy}),(0,s.jsxs)(tC,{label:"Agent id",htmlFor:"create-agent-id",children:[(0,s.jsx)(T,{id:"create-agent-id",value:y.id,onChange:e=>{let t=e.target.value,a=tO(t);v(!!a&&a!==C),j(e=>({...e,id:t}))},placeholder:C||"workspace-agent"}),(0,s.jsx)("p",{className:k("text-[12px]",A?"text-rose-300":"text-slate-500"),children:A?`ID "${S}" is already used by ${A.name} in ${O}.`:S&&S!==y.id.trim()?`Saved as ${S}. Suggested workspace-scoped id: ${C}.`:`Workspace-scoped id: ${C}.`})]}),(0,s.jsx)(tC,{label:"Display name",htmlFor:"create-agent-name",children:(0,s.jsx)(T,{id:"create-agent-name",value:y.name,onChange:e=>j(t=>({...t,name:e.target.value})),placeholder:ek[y.policy.preset].defaultName})}),(0,s.jsx)(tC,{label:"Workspace",htmlFor:"create-agent-workspace",children:(0,s.jsx)("select",{id:"create-agent-workspace",value:y.workspaceId,onChange:e=>j(t=>({...t,workspaceId:e.target.value})),className:"flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white outline-none",children:e.workspaces.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name},e.id))})}),(0,s.jsx)(tC,{label:"Model",htmlFor:"create-agent-model",children:(0,s.jsxs)("select",{id:"create-agent-model",value:y.modelId,onChange:e=>j(t=>({...t,modelId:e.target.value})),className:"flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white outline-none",children:[(0,s.jsx)("option",{value:"",children:"Use OpenClaw default"}),e.models.map(e=>(0,s.jsx)("option",{value:e.id,children:e.id},e.id))]})}),(0,s.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,s.jsx)(tC,{label:"Emoji",htmlFor:"create-agent-emoji",children:(0,s.jsx)(T,{id:"create-agent-emoji",value:y.emoji,onChange:e=>j(t=>({...t,emoji:e.target.value})),placeholder:ek[y.policy.preset].defaultEmoji})}),(0,s.jsx)(tC,{label:"Theme",htmlFor:"create-agent-theme",children:(0,s.jsx)(T,{id:"create-agent-theme",value:y.theme,onChange:e=>j(t=>({...t,theme:e.target.value})),placeholder:ek[y.policy.preset].defaultTheme})})]}),(0,s.jsx)(tC,{label:"Avatar URL",htmlFor:"create-agent-avatar",children:(0,s.jsx)(T,{id:"create-agent-avatar",value:y.avatar,onChange:e=>j(t=>({...t,avatar:e.target.value})),placeholder:"https://example.com/avatar.png"})}),(0,s.jsxs)("div",{className:"rounded-[20px] border border-white/10 bg-white/[0.03] p-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium text-white",children:"Advanced policy"}),(0,s.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:"Override missing-tool behavior, install scope, file access, and network posture."})]}),(0,s.jsx)(I,{type:"button",variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>g(e=>!e),children:x?"Hide":"Show"})]}),M?(0,s.jsxs)("div",{className:"mt-4 rounded-[18px] border border-white/10 bg-slate-950/40 p-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium text-white",children:"Heartbeat"}),(0,s.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:"Use this only for periodic watch or triage agents. Leave it off for normal task execution."})]}),(0,s.jsx)(I,{type:"button",variant:y.heartbeat.enabled?"default":"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>j(e=>({...e,heartbeat:e.heartbeat.enabled?{...e.heartbeat,enabled:!1}:{...e.heartbeat,enabled:!0,every:e.heartbeat.every||ty(e.policy.preset).every}})),children:y.heartbeat.enabled?"On":"Off"})]}),y.heartbeat.enabled?(0,s.jsx)("div",{className:"mt-3",children:(0,s.jsx)(tC,{label:"Interval",htmlFor:"create-agent-heartbeat-every",children:(0,s.jsx)("select",{id:"create-agent-heartbeat-every",value:y.heartbeat.every,onChange:e=>j(t=>({...t,heartbeat:{...t.heartbeat,every:e.target.value}})),className:"flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white outline-none",children:tv.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))})})}):null]}):null,x?(0,s.jsxs)("div",{className:"mt-4 grid gap-4 sm:grid-cols-2",children:[(0,s.jsx)(tI,{label:"Missing tool behavior",htmlFor:"create-agent-missing-tools",value:y.policy.missingToolBehavior,options:eS,onChange:e=>j(t=>({...t,policy:{...t.policy,missingToolBehavior:e}}))}),(0,s.jsx)(tI,{label:"Install scope",htmlFor:"create-agent-install-scope",value:y.policy.installScope,options:eA,onChange:e=>j(t=>({...t,policy:{...t.policy,installScope:e}}))}),(0,s.jsx)(tI,{label:"File access",htmlFor:"create-agent-file-access",value:y.policy.fileAccess,options:eI,onChange:e=>j(t=>({...t,policy:{...t.policy,fileAccess:e}}))}),(0,s.jsx)(tI,{label:"Network access",htmlFor:"create-agent-network-access",value:y.policy.networkAccess,options:eT,onChange:e=>j(t=>({...t,policy:{...t.policy,networkAccess:e}}))})]}):null]})]}),(0,s.jsxs)(ee,{children:[(0,s.jsx)(I,{variant:"secondary",onClick:()=>h(!1),children:"Cancel"}),(0,s.jsx)(I,{onClick:$,disabled:!R,children:b?"Creating...":"Create agent"})]})]})]}):(0,s.jsx)(s.Fragment,{children:n})}function tC({label:e,htmlFor:t,children:a}){return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(tw,{htmlFor:t,className:"text-[11px] uppercase tracking-[0.18em] text-slate-400",children:e}),a]})}function tS({label:e,description:t,active:a,badgeVariant:r,onClick:n}){return(0,s.jsx)("button",{type:"button",onClick:n,className:k("rounded-[20px] border p-4 text-left transition-colors",a?"border-cyan-300/30 bg-cyan-400/10":"border-white/10 bg-white/[0.03]"),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-sm font-medium text-white",children:e}),(0,s.jsx)("p",{className:"text-xs leading-5 text-slate-400",children:t})]}),(0,s.jsx)(C,{variant:r,children:a?"selected":"preset"})]})})}function tA({policy:e}){let t=ek[e.preset];return(0,s.jsxs)("div",{className:"rounded-[20px] border border-white/10 bg-slate-950/50 p-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium text-white",children:t.label}),(0,s.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:t.description})]}),(0,s.jsx)(C,{variant:t.badgeVariant,children:t.label})]}),(0,s.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,s.jsx)(C,{variant:"muted",children:eM(e.missingToolBehavior)}),(0,s.jsx)(C,{variant:"muted",children:e$(e.installScope)}),(0,s.jsx)(C,{variant:"muted",children:eP(e.fileAccess)}),(0,s.jsxs)(C,{variant:"muted",children:["Network ",e_(e.networkAccess)]})]})]})}function tI({label:e,htmlFor:t,value:a,options:r,onChange:n}){return(0,s.jsx)(tC,{label:e,htmlFor:t,children:(0,s.jsx)("select",{id:t,value:a,onChange:e=>n(e.target.value),className:"flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white outline-none",children:r.map(e=>(0,s.jsxs)("option",{value:e.value,children:[e.label," - ",e.description]},e.value))})})}function tT(e,t={}){let a=eO(t.policy?.preset??"worker",t.policy),s=ek[a.preset],r=tj(a.preset,t.heartbeat);return{id:t.id??"",workspaceId:e,modelId:t.modelId??"",name:t.name??s.defaultName,emoji:t.emoji??s.defaultEmoji,theme:t.theme??s.defaultTheme,avatar:t.avatar??"",policy:a,heartbeat:r}}function tO(e){return e.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}let tR=m.forwardRef(({className:e,...t},a)=>(0,s.jsx)("textarea",{className:k("flex min-h-[96px] w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-3 text-sm text-white placeholder:text-slate-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-400/60 disabled:cursor-not-allowed disabled:opacity-50",e),ref:a,...t}));tR.displayName="Textarea";let tM="mission-control-recent-prompts";function t$({snapshot:e,activeWorkspaceId:t,selectedNodeId:a,composeIntent:n,onRefresh:i,onOpenWorkspaceCreate:l,onMissionDispatchStart:o,onMissionDispatchFailure:d,onMissionResponse:c}){let p,u,[h,x]=(0,m.useState)(""),[g,b]=(0,m.useState)(""),[f,w]=(0,m.useState)("medium"),[v,y]=(0,m.useState)(!1),[j,N]=(0,m.useState)(!1),[C,S]=(0,m.useState)(!1),[A,T]=(0,m.useState)(!1),[O,R]=(0,m.useState)(!1),[M,$]=(0,m.useState)(!1),[P,_]=(0,m.useState)(null),E=(0,m.useRef)(null),D=(0,m.useRef)(null),U=(0,m.useRef)(null),F=(0,m.useRef)(null),z=(0,m.useRef)(!1),W=(0,m.useRef)(null),B=e.workspaces.find(e=>e.id===t)??e.workspaces[0],q=e.agents.filter(e=>!B||e.workspaceId===B.id),V=q.find(e=>e.id===g)??q[0]??null,K=V?.id??null,G=q.map(e=>({label:e.name,value:e.id})),H=tU(B?.id??t??null,K),Z=!!(h.trim()&&K&&!v),Y=V?`Compose for ${V.name}...`:"Compose a mission...",Q=((p=[]).push({id:"workspace-create",label:"Create workspace",action:"open-workspace-create"}),u=new Set,p.filter(e=>{let t=`${e.action||"mission"}:${e.mission?.trim().toLowerCase()||e.label.toLowerCase()}`;return!u.has(t)&&(u.add(t),!0)}).slice(0,3)),X=Q.length>0,ee=O&&!M&&!A&&!C&&!v&&0===h.trim().length&&null===P;(0,m.useEffect)(()=>{let s=`${t??"all"}:${a??"none"}:${q.map(e=>e.id).join(",")}`,r=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,t,a),n=U.current;if(n&&q.some(e=>e.id===n)){g!==n&&b(n),U.current=null;return}D.current!==s&&(D.current=s,r&&q.some(e=>e.id===r))?b(r):q.some(e=>e.id===g)||b(r&&q.some(e=>e.id===r)?r:q[0]?.id??"")},[e,t,a,g,q]),(0,m.useEffect)(()=>{let e=globalThis.matchMedia("(min-width: 1024px)"),t=()=>{R(e.matches),e.matches||$(!1)};return t(),e.addEventListener("change",t),()=>{e.removeEventListener("change",t)}},[]),(0,m.useEffect)(()=>{var e;(e=E.current)&&(e.style.height="0px",e.style.height=`${Math.min(e.scrollHeight,150)}px`)},[h]),(0,m.useEffect)(()=>{if(!H||void 0===globalThis.localStorage)return;if(W.current===H){W.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}}(H);z.current=!0,x(e?.mission??""),w(e?.thinking??"medium"),_(null)},[H]),(0,m.useEffect)(()=>{if(H&&void 0!==globalThis.localStorage){if(z.current){z.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{}}(H,{mission:h,thinking:f})}},[H,h,f]),(0,m.useEffect)(()=>{if(!n||F.current===n.id)return;F.current=n.id;let e=n.mission.trim();if(!e)return;let a=tU(B?.id??t??null,n.agentId??K);a&&(W.current=a);let s=0===h.trim().length||h.trim()===e;_({id:n.id,mission:e,sourceKind:n.sourceKind??"copy",sourceLabel:n.sourceLabel??"selected runtime"}),s&&x(e),n.agentId&&b(n.agentId),requestAnimationFrame(()=>{E.current?.focus(),s&&E.current?.setSelectionRange(e.length,e.length)})},[n,h,t,K,B?.id]);let et=async e=>{y(!0);let a=e.agentId||K,s=Date.now(),r=globalThis.crypto?.randomUUID?.()||`dispatch:${s}`,n=new AbortController;a&&o({requestId:r,mission:e.mission.trim(),agentId:a,workspaceId:B?.id??t??null,submittedAt:s,abortController:n});try{let l=e.mission.trim(),o=await fetch("/api/mission",{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:JSON.stringify(e)}),d=await o.json();if(!o.ok||d.error)throw Error(d.error||"OpenClaw rejected the mission.");c(d,{requestId:r}),x(""),_(null),S(!1),z.current=!0,H&&void 0!==globalThis.localStorage&&globalThis.localStorage.removeItem(H),a&&function(e){let t=[e,...(function(){try{let e=globalThis.localStorage.getItem(tM);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(tM,JSON.stringify(t))}catch{}}({id:globalThis.crypto?.randomUUID?.()||`${s}`,mission:l,agentId:a,agentName:V?.name??"Agent",workspaceId:B?.id??t,workspaceName:B?.name??null,submittedAt:s});let p="string"==typeof d.meta?.outputDirRelative?`${d.status} via ${d.agentId} \xb7 ${d.meta.outputDirRelative}`:`${d.status} via ${d.agentId}`;"stalled"===d.status?ed.o.error("Mission could not start.",{description:d.summary||p}):ed.o.success("Mission queued in OpenClaw.",{description:p}),i().catch(()=>null)}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;d(r,e instanceof Error?e.message:"Unknown mission error."),ed.o.error("Mission dispatch failed.",{description:e instanceof Error?e.message:"Unknown mission error."})}finally{y(!1)}},ea=(e,t={})=>{t.thinking&&w(t.thinking),x(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
+
3
+ ${i}`:n:i)}),requestAnimationFrame(()=>{E.current?.focus();let e=E.current?.value??"";E.current?.setSelectionRange(e.length,e.length)})};return(0,s.jsx)("div",{className:k("mx-auto w-full transition-[width] duration-300",ee&&"lg:w-[360px]"),onMouseEnter:()=>{O&&$(!0)},onMouseLeave:()=>{O&&$(!1)},children:(0,s.jsx)(tg.N,{initial:!1,mode:"wait",children:ee?(0,s.jsx)(ef.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},onFocus:()=>$(!0),onClick:()=>{$(!0),requestAnimationFrame(()=>{E.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:V?.name||"No agent"}),(0,s.jsx)("p",{className:"min-w-0 flex-1 truncate text-[13px] text-[#f6eee5]/58",children:Y}),(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:[(0,s.jsx)(tu.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Create task"]})]})},"collapsed"):(0,s.jsxs)(ef.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)(tg.N,{initial:!1,children:P?(0,s.jsxs)(ef.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 ",P.sourceLabel]}),(0,s.jsx)("button",{type:"button",className:"text-slate-200 transition-colors hover:text-white",onClick:()=>ea(P.mission,{mode:"replace"}),children:"Replace"}),(0,s.jsx)("button",{type:"button",className:"text-slate-200 transition-colors hover:text-white",onClick:()=>ea(P.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:()=>_(null),"aria-label":"Dismiss runtime suggestion",children:(0,s.jsx)(J.A,{className:"h-3.5 w-3.5"})})]}):null}),(0,s.jsxs)("div",{className:k("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",A&&"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:()=>T(!0),onBlurCapture:e=>{let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||T(!1)},children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-2.5 pb-1 pt-2.5",children:[V?(0,s.jsx)(tP,{value:g,options:G,onChange:e=>{b(e)}}):(0,s.jsx)(tL,{children:"No agent"}),(0,s.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,s.jsx)(tE,{label:"Refresh mission control",onClick:async()=>{N(!0),await i(),N(!1)},children:j?(0,s.jsx)(r.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(th.A,{className:"h-3.5 w-3.5"})}),(0,s.jsx)(tE,{label:"Create workspace",onClick:l,children:(0,s.jsx)(L.A,{className:"h-3.5 w-3.5"})}),(0,s.jsx)(tE,{label:"Composer settings",onClick:()=>S(e=>!e),active:C||"medium"!==f,children:(0,s.jsxs)("span",{className:"relative inline-flex",children:[(0,s.jsx)(tx.A,{className:"h-3.5 w-3.5"}),"medium"!==f?(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)(tR,{ref:E,value:h,onChange:e=>x(e.target.value),onKeyDown:async e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key&&(e.preventDefault(),Z&&K&&await et({mission:h,agentId:K,workspaceId:t??void 0,thinking:f}))},placeholder:Y,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)(tg.N,{initial:!1,children:X?(0,s.jsxs)(ef.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:[Q.map(e=>(0,s.jsx)(tD,{label:e.label,onClick:()=>{"open-workspace-create"===e.action?l():e.mission&&ea(e.mission,{thinking:e.thinking})}},e.id)),B?(0,s.jsx)(tN,{snapshot:e,defaultWorkspaceId:B.id,onRefresh:i,onAgentCreated:e=>{U.current=e,b(e)},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]}):(0,s.jsx)("div",{})}),(0,s.jsxs)(I,{className:"h-9 rounded-full bg-white px-3.5 text-slate-950 shadow-none hover:bg-white/92",disabled:!Z,onClick:async()=>{K&&await et({mission:h,agentId:K,workspaceId:t??void 0,thinking:f})},children:[v?(0,s.jsx)(r.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(tu.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Create task"]})]})]}),(0,s.jsx)(tg.N,{initial:!1,children:C?(0,s.jsx)(ef.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)(t_,{ariaLabel:"Select thinking level",value:f,options:[{label:"off",value:"off"},{label:"minimal",value:"minimal"},{label:"low",value:"low"},{label:"medium",value:"medium"},{label:"high",value:"high"}],onChange:e=>w(e)})}),(0,s.jsx)("button",{type:"button",className:"mt-3 text-[12px] text-slate-400 transition-colors hover:text-white",onClick:()=>{x(""),w("medium"),_(null),z.current=!0,H&&void 0!==globalThis.localStorage&&globalThis.localStorage.removeItem(H)},children:"Clear draft"})]})}):null})]},"expanded")})})}function tP({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)(u.A,{className:"pointer-events-none absolute right-3 h-3.5 w-3.5 text-slate-400"}):null]})}function t_({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)(u.A,{className:"pointer-events-none absolute right-3 h-3.5 w-3.5 text-slate-400"})]})}function tE({label:e,active:t=!1,onClick:a,children:r}){return(0,s.jsx)("button",{type:"button","aria-label":e,title:e,onClick:a,className:k("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 tD({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 tL({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 tU(e,t){return e||t?`mission-control-composer-draft:${e??"global"}:${t??"unassigned"}`:null}var tF=a(9682),tz=a(9379),tW=a(4708),tB=a(9114),tq=a(8443),tV=a(4935);function tK(e){return(0,s.jsx)(tJ,{...e},e.selectedNodeId??"overview")}function tJ({snapshot:e,selectedNodeId:t,lastMission:a,onAbortTask:r,collapsed:n,onToggleCollapsed:i,activeTab:l,onActiveTabChange:o}){let d=e.workspaces.find(e=>e.id===t),c=e.agents.find(e=>e.id===t),p=e.tasks.find(e=>e.id===t),u=e.runtimes.find(e=>e.id===t),x=e.models.find(e=>e.id===t),g=!!p?.metadata.optimistic,b=d||c||p||u||x||null,f=u?.id??null,w=p?.id??null,[v,y]=(0,m.useState)(null),[j,N]=(0,m.useState)(null),[S,A]=(0,m.useState)(null),[I,T]=(0,m.useState)(null),O=(0,m.useMemo)(()=>{var e;let t;return g&&p?{task:e=p,runs:[],outputs:[],liveFeed:Array.isArray(t=e.metadata.optimisticEvents)?t.filter(t2).sort((e,t)=>Date.parse(e.timestamp)-Date.parse(t.timestamp)):[],createdFiles:[],warnings:"stalled"===e.status||t5(e)?[e.subtitle]:[],integrity:t1(e)}:null},[g,p]),R=v&&v.runtimeId===f?v:null,M=j?.runtimeId===f?j.message:null,$=S&&S.task.id===w?S:null,P=I?.taskId===w?I.message:null,_=O??$,E=!!w&&!g&&!_&&!P,D=!!f&&!R&&!M,L=!!(u||p),U=!!(u||p),F=("output"!==l||L)&&("files"!==l||U)?l:"overview",z=p?"Feed":"Output",W=d?.name||c?.name||p?.title||u?.title||x?.name||"Gateway overview",B=d?"workspace focus":c?"agent focus":p?"task focus":u?"run focus":x?"model focus":"live selection",q=(0,m.useMemo)(()=>[{id:"overview",label:"Overview",icon:tF.A,enabled:!0},{id:"output",label:z,icon:h.A,enabled:L},{id:"files",label:"Files",icon:tz.A,enabled:U},{id:"raw",label:"Raw",icon:tW.A,enabled:!0}],[z,U,L]);return(0,m.useEffect)(()=>{if(!f)return;let e=new AbortController;return fetch(`/api/runtimes/${encodeURIComponent(f)}`,{signal:e.signal}).then(async e=>{let t=await e.json();if(!e.ok)throw Error(t.error||"Unable to load runtime output.");y(t),N(null)}).catch(t=>{e.signal.aborted||(y(null),N({runtimeId:f,message:t instanceof Error?t.message:"Unable to load runtime output."}))}),()=>e.abort()},[f]),(0,m.useEffect)(()=>{if(!w||g)return;let e=new EventSource(`/api/tasks/${encodeURIComponent(w)}/stream`),t=e=>{try{let t=JSON.parse(e.data);if("task"!==t.type)return;A(t.detail),T(null)}catch(e){T({taskId:w,message:e instanceof Error?e.message:"Unable to parse task feed."})}},a=e=>{try{let t=JSON.parse(e.data);"error"===t.type&&T({taskId:w,message:t.error})}catch{T({taskId:w,message:"Unable to load task detail."})}};return e.addEventListener("task",t),e.addEventListener("task-error",a),e.onerror=()=>{T(e=>e?.taskId===w?e:{taskId:w,message:"Task feed disconnected. Reconnecting…"})},()=>{e.removeEventListener("task",t),e.removeEventListener("task-error",a),e.close()}},[w,g]),(0,s.jsxs)("div",{className:"panel-surface panel-glow flex h-full flex-row-reverse overflow-hidden rounded-[30px] border 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:k("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-3 py-4",n?"w-full":"w-[78px] border-l border-white/[0.08]"),children:[(0,s.jsx)("button",{type:"button","aria-label":n?"Expand inspector":"Collapse inspector",onClick:i,className:"flex h-12 w-12 items-center justify-center rounded-[18px] border border-cyan-300/20 bg-cyan-400/[0.12] shadow-[0_10px_24px_rgba(34,211,238,0.18)] transition-all hover:border-cyan-200/30 hover:bg-cyan-400/[0.16]",children:(0,s.jsx)(h.A,{className:"h-5 w-5 text-cyan-200"})}),(0,s.jsx)("button",{type:"button","aria-label":n?"Expand inspector":"Collapse inspector",onClick:i,className:"mt-4 inline-flex h-11 w-11 items-center justify-center rounded-[16px] border border-white/10 bg-white/[0.04] text-slate-300 transition-all hover:border-cyan-300/18 hover:bg-white/[0.08] hover:text-white",children:n?(0,s.jsx)(tB.A,{className:"h-4 w-4"}):(0,s.jsx)(tq.A,{className:"h-4 w-4"})}),(0,s.jsx)("div",{className:"mt-6 flex flex-1 flex-col items-center gap-2",children:q.map(e=>(0,s.jsx)(t9,{icon:e.icon,label:e.label,active:F===e.id,disabled:!e.enabled,onClick:()=>{e.enabled&&(o(e.id),n&&i())}},e.id))}),(0,s.jsxs)("div",{className:"mt-4 flex flex-col items-center gap-2",children:[(0,s.jsx)(C,{variant:"muted",children:b?"live":"idle"}),n?(0,s.jsx)("p",{className:"max-w-[56px] truncate text-center text-[9px] uppercase tracking-[0.16em] text-slate-500",children:B}):null]})]}),n?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:"mission-scroll flex h-full min-h-0 flex-col overflow-y-auto overscroll-contain",children:[(0,s.jsxs)("div",{className:"shrink-0 border-b border-white/[0.08] 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",children:[(0,s.jsx)("p",{className:"text-[11px] uppercase tracking-[0.28em] text-slate-500",children:"Inspector"}),(0,s.jsx)("h2",{className:"mt-2 font-display text-[1.38rem] leading-tight text-white",children:W}),(0,s.jsx)("p",{className:"mt-2 text-[12px] leading-5 text-slate-400",children:b?"Live OpenClaw-backed details for the selected entity.":"Local gateway health, recent presence, and last mission response."})]}),(0,s.jsx)("div",{className:"rounded-[18px] border border-white/10 bg-white/[0.04] p-2.5 shadow-[inset_0_1px_0_rgba(255,255,255,0.05)]",children:(0,s.jsx)(h.A,{className:"h-4 w-4 text-cyan-200"})})]}),(0,s.jsxs)("div",{className:"mt-4 rounded-[22px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(13,20,34,0.98),rgba(6,10,18,0.96))] p-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:"Selected entity"}),(0,s.jsx)("p",{className:"mt-1.5 text-[14px] text-white",children:W})]}),(0,s.jsx)(C,{variant:"muted",children:B})]}),p?(0,s.jsxs)("p",{className:"mt-3 text-[12px] leading-5 text-slate-400",children:[p.runtimeCount," runs \xb7 ",p.liveRunCount," live \xb7 ",eD(p.updatedAt)]}):null,u?(0,s.jsxs)("p",{className:"mt-3 text-[12px] leading-5 text-slate-400",children:["Run ",eW(u.runId||u.id,10)," \xb7 ",u.status," \xb7 ",eD(u.updatedAt)]}):null]}),(0,s.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:q.filter(e=>e.enabled).map(e=>(0,s.jsx)(t7,{label:e.label,active:F===e.id,onClick:()=>o(e.id)},e.id))})]}),(0,s.jsx)("div",{className:"flex-1 p-4",children:(0,s.jsx)(tg.N,{mode:"wait",children:(0,s.jsxs)(ef.P.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},className:"space-y-3.5",children:["overview"===F?(0,s.jsxs)(s.Fragment,{children:[d?(0,s.jsx)(tH,{snapshot:e,workspaceId:d.id}):null,c?(0,s.jsx)(tZ,{snapshot:e,agentId:c.id}):null,p?(0,s.jsx)(tY,{snapshot:e,task:p,taskId:p.id,taskDetail:_,taskDetailLoading:E,taskDetailError:P,onAbortTask:r}):null,u?(0,s.jsx)(t3,{snapshot:e,runtimeId:u.id,runtimeOutput:R,runtimeOutputLoading:D,runtimeOutputError:M}):null,x?(0,s.jsx)(t6,{snapshot:e,modelId:x.id}):null,b?null:(0,s.jsx)(tG,{snapshot:e,lastMission:a})]}):null,"output"===F&&p?(0,s.jsx)(tX,{task:p,taskDetail:_,taskDetailLoading:E,taskDetailError:P}):null,"output"===F&&u?(0,s.jsx)(t8,{runtime:u,runtimeOutput:R,runtimeOutputLoading:D,runtimeOutputError:M}):null,"files"===F&&p?(0,s.jsx)(t0,{snapshot:e,task:p,taskDetail:_}):null,"files"===F&&u?(0,s.jsx)(t4,{runtime:u,runtimeOutput:R}):null,"raw"===F?(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(p&&_?_:u&&R?{runtime:u,output:R}:b||e,null,2)}):null]},`${t||"overview"}:${F}`)})}),(0,s.jsx)("div",{className:"shrink-0 border-t border-white/[0.08] p-4",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-4 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)(tV.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:W}),(0,s.jsx)("p",{className:"mt-1 text-[12px] text-slate-400",children:p?`${_?.liveFeed.length??0} live feed events`:u?`${R?.items.length??0} transcript entries`:c?`${c.activeRuntimeIds.length} tracked runs`:d?`${d.agentIds.length} agents attached`:`${e.presence.length} live beacons`})]})]})})})]})})]})}function tG({snapshot:e,lastMission:t}){let a=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)(ae,{icon:tV.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)(ae,{icon:tz.A,title:"Runtime preflight",value:a,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"," ",eD(Date.parse(e.diagnostics.runtime.smokeTest.checkedAt))]}):(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)(ae,{icon:h.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)(ae,{icon:F.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 tH({snapshot:e,workspaceId:t}){let a=e.workspaces.find(e=>e.id===t),r=e.agents.filter(e=>e.workspaceId===t),n=a?a.modelIds.map(t=>e.models.find(e=>e.id===t)?.name||t):[],i=e.runtimes.filter(e=>e.workspaceId===t||a?.activeRuntimeIds.includes(e.id)).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0));if(!a)return null;let l=i.filter(e=>"running"===e.status||"queued"===e.status||"idle"===e.status),o=i[0]??null,d=al(i.flatMap(ai)).slice(0,8),c=a.bootstrap.coreFiles.every(e=>e.present)&&a.bootstrap.projectShell.every(e=>e.present)?"ready":a.bootstrap.coreFiles.some(e=>e.present)||a.bootstrap.projectShell.some(e=>e.present)?"partial":"thin",p=Array.from(new Set(r.flatMap(e=>e.observedTools??[]))),m=0===r.length?"no agents":a.capabilities.workspaceOnlyAgentCount===r.length?"workspace-only":0===a.capabilities.workspaceOnlyAgentCount?"open":"mixed";return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(ae,{icon:tz.A,title:"Overview",value:a.health,children:[(0,s.jsx)("p",{className:"font-mono text-xs text-slate-400",children:eB(a.path)}),(0,s.jsx)(aa,{items:[{label:"Agents",value:String(r.length)},{label:"Models",value:String(a.modelIds.length)},{label:"Runs",value:String(i.length)},{label:"Sessions",value:String(a.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)(ar,{emptyLabel:"No models attached",items:n,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:r.map(e=>(0,s.jsx)(C,{variant:e.isDefault?"default":"muted",children:e.name},e.id))})]})]}),(0,s.jsxs)(ae,{icon:F.A,title:"Bootstrap",value:c,children:[(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(C,{variant:a.bootstrap.template?"default":"muted",children:a.bootstrap.template||"template unknown"}),(0,s.jsx)(C,{variant:a.bootstrap.sourceMode?"muted":"warning",children:a.bootstrap.sourceMode||"source unknown"}),a.bootstrap.agentTemplate?(0,s.jsx)(C,{variant:"muted",children:a.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)(as,{items:a.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)(as,{items:[...a.bootstrap.optionalFiles,...a.bootstrap.folders]})]}),(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)(as,{items:a.bootstrap.projectShell})]})]}),(0,s.jsxs)(ae,{icon:F.A,title:"Capabilities",value:m,children:[(0,s.jsxs)("p",{children:[a.capabilities.workspaceOnlyAgentCount,"/",r.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)(ar,{emptyLabel:"No explicit skills",items:a.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)(ar,{emptyLabel:"No local SKILL.md scaffolds",items:a.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)(ar,{emptyLabel:"No explicit tools configured",items:a.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)(ar,{emptyLabel:"No runtime tool calls recovered yet",items:p,emptyVariant:"muted",itemVariant:"default"})]})]}),(0,s.jsxs)(ae,{icon:h.A,title:"Activity",value:`${l.length} live`,children:[(0,s.jsxs)("p",{children:[i.length," tracked runs across ",a.totalSessions," recorded sessions."]}),(0,s.jsx)("p",{children:o?`Latest update ${eD(o.updatedAt)}`:"No runtime activity has been recorded yet."}),i.length>0?(0,s.jsx)("div",{className:"space-y-2 pt-1",children:i.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 ",eW(e.runId||e.id,10)]})]}),(0,s.jsx)(C,{variant:ez(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:r.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.name}),(0,s.jsx)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:e.currentAction})]}),(0,s.jsx)(C,{variant:"engaged"===e.status?"default":"offline"===e.status?"danger":"muted",children:e.status})]},e.id))})]})]}),(0,s.jsx)(ae,{icon:tW.A,title:"Created files",value:String(d.length),children:(0,s.jsx)(at,{files:d,emptyLabel:"No file artifacts have been detected in recent workspace runs."})})]})}function tZ({snapshot:e,agentId:t}){let a=e.agents.find(e=>e.id===t),r=e.workspaces.find(e=>e.id===a?.workspaceId),n=e.models.find(e=>e.id===a?.modelId),i=a?.observedTools??[],l=e.runtimes.filter(e=>a?.activeRuntimeIds.includes(e.id)).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0)),o=al(l.flatMap(ai)).slice(0,8);return a?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(ae,{icon:F.A,title:"Agent identity",value:a.id,children:[(0,s.jsx)("p",{children:a.name}),(0,s.jsx)("p",{children:a.identity.emoji?`${a.identity.emoji} \xb7 ${a.identity.theme??"theme unset"}`:"No identity emoji"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[a.isDefault?(0,s.jsx)(C,{variant:"default",children:"default agent"}):null,(0,s.jsx)(C,{variant:ek[a.policy.preset].badgeVariant,children:eR(a.policy.preset)}),a.identity.source?(0,s.jsx)(C,{variant:"muted",children:a.identity.source}):null]})]}),(0,s.jsxs)(ae,{icon:tz.A,title:"Workspace",value:r?.name||"n/a",children:[(0,s.jsx)("p",{className:"font-mono text-xs text-slate-400",children:eB(a.workspacePath)}),(0,s.jsxs)("p",{children:[a.sessionCount," recorded sessions"]})]}),(0,s.jsxs)(ae,{icon:F.A,title:"Model assignment",value:n?.name||a.modelId,children:[(0,s.jsx)("p",{children:n?`${n.provider} \xb7 ${eL(n.contextWindow)} ctx`:"Model metadata unavailable"}),(0,s.jsx)("p",{children:n?.available===!1?"Currently unavailable":n?.local?"Local model route":"Remote model route"})]}),(0,s.jsxs)(ae,{icon:F.A,title:"Agent profile",value:a.profile.purpose||"Profile not declared",children:[(0,s.jsx)("p",{children:a.profile.purpose||"No explicit purpose was found in the workspace bootstrap files."}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:a.profile.sourceFiles.length>0?a.profile.sourceFiles.map(e=>(0,s.jsx)(C,{variant:"muted",children:e},e)):(0,s.jsx)(C,{variant:"warning",children:"derived from config"})})]}),(0,s.jsx)(ae,{icon:h.A,title:"Operating style",value:`${a.profile.operatingInstructions.length} rules`,children:(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Operating instructions"}),(0,s.jsx)(an,{emptyLabel:"No workspace bootstrap instructions were found.",items:a.profile.operatingInstructions})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Response style"}),(0,s.jsx)(ar,{emptyLabel:"No explicit response style",items:a.profile.responseStyle,emptyVariant:"muted",itemVariant:"muted"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-1 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Output preference"}),(0,s.jsx)("p",{children:a.profile.outputPreference||"No explicit output preference was found."})]})]})}),(0,s.jsxs)(ae,{icon:tV.A,title:"Runtime posture",value:a.status,children:[(0,s.jsx)("p",{children:a.currentAction}),(0,s.jsxs)("p",{children:["Last active ",eD(a.lastActiveAt)]}),(0,s.jsx)("p",{children:a.heartbeat.enabled?`Heartbeat ${a.heartbeat.every}`:"Heartbeat disabled"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(C,{variant:a.heartbeat.enabled?"success":"muted",children:a.heartbeat.enabled?"heartbeat on":"heartbeat off"}),"number"==typeof a.heartbeat.everyMs?(0,s.jsxs)(C,{variant:"muted",children:[Math.round(a.heartbeat.everyMs/1e3),"s interval"]}):null]})]}),(0,s.jsxs)(ae,{icon:h.A,title:"Operating policy",value:eR(a.policy.preset),children:[(0,s.jsx)("p",{children:ek[a.policy.preset].description}),(0,s.jsxs)("div",{className:"mt-3 grid gap-2 text-[13px] text-slate-300",children:[(0,s.jsxs)("p",{children:["Missing tools: ",(0,s.jsx)("span",{className:"text-white",children:eM(a.policy.missingToolBehavior)})]}),(0,s.jsxs)("p",{children:["Install scope: ",(0,s.jsx)("span",{className:"text-white",children:e$(a.policy.installScope)})]}),(0,s.jsxs)("p",{children:["File access: ",(0,s.jsx)("span",{className:"text-white",children:eP(a.policy.fileAccess)})]}),(0,s.jsxs)("p",{children:["Network: ",(0,s.jsx)("span",{className:"text-white",children:e_(a.policy.networkAccess)})]})]})]}),(0,s.jsxs)(ae,{icon:h.A,title:"Run history",value:String(l.length),children:[0===l.length?(0,s.jsx)("p",{children:"No runtime history has been recorded for this agent yet."}):null,l.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)(C,{variant:ez(e.status),children:e.status})]},e.id))]}),(0,s.jsx)(ae,{icon:tW.A,title:"Created files",value:String(o.length),children:(0,s.jsx)(at,{files:o,emptyLabel:"No file artifacts have been detected for this agent yet."})}),(0,s.jsxs)(ae,{icon:F.A,title:"Capabilities",value:`${a.skills.length} skills`,children:[(0,s.jsx)(ar,{emptyLabel:"No explicit skills",items:a.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)(ar,{emptyLabel:"No explicit tools configured",items:a.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)(ar,{emptyLabel:"No runtime tool calls recovered yet",items:i,emptyVariant:"muted",itemVariant:"default"})]})]})]}):null}function tY({snapshot:e,task:t,taskId:a,taskDetail:r,taskDetailLoading:n,taskDetailError:l,onAbortTask:o}){let d=e.tasks.find(e=>e.id===a)??t,c=t5(d),p=!!o&&function(e){if(t5(e))return!1;let t=e.status;return"running"===t||"queued"===t}(d),m=e.workspaces.find(e=>e.id===t?.workspaceId),u=e.agents.find(e=>e.id===t?.primaryAgentId),x=r?.runs??e.runtimes.filter(e=>t?.runtimeIds.includes(e.id)).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0)),g=r?.createdFiles??al(x.flatMap(e=>ai(e))),b=r?.warnings??[];if(!t)return null;let f=r?.integrity??t1(t);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(ae,{icon:tz.A,title:"Task overview",value:c?"aborted":d.status,children:[(0,s.jsx)("p",{className:"text-sm text-white",children:d.mission||d.title}),(0,s.jsx)("p",{children:d.subtitle}),(0,s.jsx)(aa,{items:[{label:"Runs",value:String(d.runtimeCount)},{label:"Feed",value:String(d.updateCount)},{label:"Files",value:String(d.artifactCount)},{label:"Live",value:String(d.liveRunCount)}]}),o&&(p||c)?(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:(0,s.jsxs)(I,{type:"button",variant:c?"secondary":"destructive",size:"sm",disabled:!p,className:"gap-2",onClick:()=>{p&&o(d)},children:[(0,s.jsx)(i.A,{className:"h-3.5 w-3.5"}),c?"Aborted":"Abort task"]})}):null,(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[m?(0,s.jsx)(C,{variant:"muted",children:m.name}):null,u?(0,s.jsx)(C,{variant:"default",children:u.name}):null,d.dispatchId?(0,s.jsxs)(C,{variant:"muted",children:["dispatch ",eW(d.dispatchId,8)]}):null,c?(0,s.jsx)(C,{variant:"danger",children:"aborted"}):null]}),n&&!r?(0,s.jsx)("p",{children:"Connecting live task feed…"}):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)(tQ,{task:d,integrity:f}),(0,s.jsxs)(ae,{icon:h.A,title:"Runs",value:String(x.length),children:[0===x.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:x.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)(C,{variant:ez(e.status),children:e.status})]},e.id))})]}),(0,s.jsx)(ae,{icon:tW.A,title:"Artifacts",value:String(g.length),children:(0,s.jsx)(at,{files:g,emptyLabel:"This task has not produced a detectable file artifact yet."})}),b.length>0?(0,s.jsx)(ae,{icon:tV.A,title:"Warnings",value:String(b.length),children:(0,s.jsx)(an,{items:b,emptyLabel:"No warnings detected."})}):null]})}function tQ({task:e,integrity:t}){let a=t5(e),r=t.issues.find(e=>"partial-final-response"===e.id),n=a?"This task was aborted by an operator. Captured evidence may be incomplete.":"verified"===t.status?"Mission Control 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.":"Mission Control recovered partial evidence, but this result still needs operator review.";return(0,s.jsxs)(ae,{icon:tV.A,title:"Result integrity",value:a?"aborted":"stalled"===e.status?"stalled":t.status,children:[(0,s.jsx)("p",{children:n}),(0,s.jsx)(aa,{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)(e3,{text:t.outputDirRelative||t.outputDir||"Output folder",className:"text-[12.5px] leading-5 text-slate-100",filePath:t.outputDir,displayPath:t.outputDirRelative||t.outputDir})}),(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})`:""]}),r?(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:r.detail}):null,(0,s.jsx)("div",{className:"mt-2",children:t.finalResponseText?(0,s.jsx)(e3,{text:t.finalResponseText,className:"text-[12.5px] leading-5 text-slate-100"}):(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)(C,{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)(C,{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 ",eW(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)(an,{items:t.issues.map(e=>`${e.title}: ${e.detail}`),emptyLabel:"No integrity issues detected."})})]}):null]})}function tX({task:e,taskDetail:t,taskDetailLoading:a,taskDetailError:r}){if(a&&!t)return(0,s.jsx)(ae,{icon:h.A,title:"Live feed",value:"connecting",children:(0,s.jsxs)("p",{children:["Connecting to the task feed for ",e.title,"…"]})});if(r&&!t)return(0,s.jsx)(ae,{icon:h.A,title:"Live feed",value:"error",children:(0,s.jsx)("p",{children:r})});let n=t?.liveFeed??[],i=t?.integrity??t1(e);return(0,s.jsxs)(ae,{icon:h.A,title:"Live feed",value:String(n.length),children:[r?(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:r}):null,i.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:i.issues[0]?.detail}):null,0===n.length?(0,s.jsx)("p",{children:"No streamed task events have arrived yet."}):null,(0,s.jsx)("div",{className:"space-y-2",children:n.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)(C,{variant:function(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"}}(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:eD(new Date(e.timestamp).getTime())})]}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(e3,{text:e.detail,className:"text-[12.5px] leading-5 text-slate-100",url:e.url,filePath:e.filePath,displayPath:e.displayPath})})]},e.id))})]})}function t0({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=a?.createdFiles??al(r.flatMap(e=>ai(e))),i=a?.integrity??t1(t);return(0,s.jsxs)(ae,{icon:tW.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)(e3,{text:i.outputDirRelative||i.outputDir||"Output folder",className:"text-[12.5px] leading-5 text-slate-100",filePath:i.outputDir,displayPath:i.outputDirRelative||i.outputDir})}),(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)(at,{files:n,emptyLabel:"This task has not produced a detectable file artifact yet."})]})}function t1(e){let t=t5(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:"stalled-dispatch",severity:"warning",title:"Dispatch stalled before evidence was captured",detail:e.subtitle}]:e.metadata.optimistic?[{id:"pending-evidence",severity:"warning",title:"Waiting for runtime evidence",detail:"Mission Control will attach transcript, tool, and file evidence after the first runtime is observed."}]:[];return{status:t.some(e=>"error"===e.severity)?"error":t.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:null,finalResponseSource:"none",dispatchSessionId:null,sessionMismatch:!1,toolNames:[],emails:[],issues:t}}function t2(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 t5(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 t3({snapshot:e,runtimeId:t,runtimeOutput:a,runtimeOutputLoading:r,runtimeOutputError:n}){let i,l=e.runtimes.find(e=>e.id===t),o=al(a?.createdFiles??(l?ai(l):[])),d=a?.warnings??(l&&Array.isArray(i=l.metadata.warnings)?i.filter(e=>"string"==typeof e&&e.trim().length>0):[]),c=a?.warningSummary??d[0]??null;return l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(ae,{icon:h.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 ",eW(l.sessionId,12)]}),l.taskId?(0,s.jsxs)("p",{children:["Task ",eW(l.taskId,12)]}):null,l.runId?(0,s.jsxs)("p",{children:["Run ",eW(l.runId,12)]}):null]}),(0,s.jsxs)(ae,{icon:tV.A,title:"Activity",value:eD(l.updatedAt),children:[(0,s.jsx)("p",{children:l.subtitle}),(0,s.jsxs)("p",{children:[eU(l.tokenUsage?.total)," tokens"]})]}),(0,s.jsxs)(ae,{icon:F.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)(e3,{text:a?.finalText||a?.errorMessage||"No assistant output has been recorded for this runtime yet.",className:"text-[13px] leading-5 text-slate-100"}),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 ",eD(new Date(a.finalTimestamp).getTime())]}):null]}),(0,s.jsx)(ae,{icon:tW.A,title:"Created files",value:String(o.length),children:(0,s.jsx)(at,{files:o,emptyLabel:"This runtime has not produced a detectable file artifact."})})]}):null}function t4({runtime:e,runtimeOutput:t}){let a=al(t?.createdFiles??ai(e));return(0,s.jsxs)(ae,{icon:tW.A,title:"Files",value:String(a.length),children:[(0,s.jsx)("p",{children:e.title}),(0,s.jsx)(at,{files:a,emptyLabel:"This runtime has not produced a detectable file artifact."})]})}function t8({runtime:e,runtimeOutput:t,runtimeOutputLoading:a,runtimeOutputError:r}){return a?(0,s.jsx)(ae,{icon:h.A,title:"Runtime output",value:"loading",children:(0,s.jsxs)("p",{children:["Loading transcript output for ",e.title,"…"]})}):r?(0,s.jsx)(ae,{icon:h.A,title:"Runtime output",value:"error",children:(0,s.jsx)("p",{children:r})}):t?(0,s.jsxs)("div",{className:"space-y-3.5",children:[t.warningSummary?(0,s.jsx)(ae,{icon:tV.A,title:"Warnings",value:String(t.warnings.length),children:(0,s.jsx)("p",{children:t.warningSummary})}):null,(0,s.jsx)(ae,{icon:tW.A,title:"Created files",value:String(t.createdFiles.length),children:(0,s.jsx)(at,{files:t.createdFiles,emptyLabel:"This runtime transcript does not include a successful file creation."})}),(0,s.jsxs)(ae,{icon:h.A,title:"Final response",value:"stalled"===e.status||"cancelled"===e.status?e.status:t.stopReason||t.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:"This runtime did not complete cleanly. The text below is the last captured assistant output, not a verified completion."}):null,t.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:t.errorMessage}):null,(0,s.jsx)(e3,{text:t.finalText||t.errorMessage||"No assistant output has been recorded for this runtime yet.",className:"text-[13px] leading-5 text-slate-100"}),t.finalTimestamp?(0,s.jsx)("p",{className:"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:new Date(t.finalTimestamp).toLocaleString()}):null]}),(0,s.jsxs)(ae,{icon:tV.A,title:"Transcript trail",value:String(t.items.length),children:[0===t.items.length?(0,s.jsx)("p",{children:"No transcript entries were found."}):null,(0,s.jsx)("div",{className:"space-y-2",children:t.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)(C,{variant:"assistant"===e.role?e.isError?"danger":"default":"toolResult"===e.role?"warning":"muted",children:e.role}),e.toolName?(0,s.jsx)(C,{variant:"muted",children:e.toolName}):null]}),(0,s.jsx)("span",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:eD(new Date(e.timestamp).getTime())})]}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(e3,{text:e.text,className:"text-[12.5px] leading-5 text-slate-100"})})]},e.id))})]})]}):(0,s.jsx)(ae,{icon:h.A,title:"Runtime output",value:"missing",children:(0,s.jsx)("p",{children:"No transcript data is available for this runtime."})})}function t6({snapshot:e,modelId:t}){let a=e.models.find(e=>e.id===t);return a?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(ae,{icon:F.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)(ae,{icon:tV.A,title:"Capacity",value:`${eL(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 t9({icon:e,label:t,active:a,disabled:r=!1,onClick:n}){return(0,s.jsx)("button",{type:"button",title:t,disabled:r,onClick:n,className:k("inline-flex h-11 w-11 items-center justify-center rounded-[16px] border transition-all",r?"border-white/5 bg-white/[0.02] text-slate-600":a?"border-cyan-300/20 bg-cyan-400 text-slate-950 shadow-[0_12px_28px_rgba(96,165,250,0.35)]":"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-4 w-4"})})}function t7({label:e,active:t,onClick:a}){return(0,s.jsx)("button",{type:"button",onClick:a,className:k("inline-flex items-center rounded-full border px-3 py-2 text-[11px] uppercase tracking-[0.18em] 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 ae({icon:e,title:t,value:a,children:r}){return(0,s.jsxs)("section",{className:"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.5",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.jsx)("p",{className:"font-display text-[1rem] text-white",children:a})]}),(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:r})]})}function at({files: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)("button",{type:"button",onClick:()=>void ao(e.path),className:"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 hover:border-cyan-300/28 hover:bg-cyan-400/[0.08]",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:eB(e.path)})]}),(0,s.jsx)(C,{variant:"muted",children:"reveal"})]})},e.path))})}function aa({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 as({items:e,missingVariant:t="muted"}){return(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map(e=>(0,s.jsx)(C,{variant:e.present?"success":t,children:e.label},e.id))})}function ar({items:e,emptyLabel:t,itemVariant:a,emptyVariant:r}){return 0===e.length?(0,s.jsx)(C,{variant:r,children:t}):(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map(e=>(0,s.jsx)(C,{variant:a,children:e},e))})}function an({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 ai(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 al(e){let t=new Set,a=[];for(let s of e)!s.path||t.has(s.path)||(t.add(s.path),a.push(s));return a}async function ao(e){try{let t=await fetch("/api/files/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),a=await t.json();if(!t.ok)throw Error(a.error||"Unable to reveal file.");eX.oR.success("Revealed file.",{description:eB(e)})}catch(e){eX.oR.error("Could not reveal file.",{description:e instanceof Error?e.message:"Unknown file reveal error."})}}var ad=a(144),ac=a(4545);function ap(e){var t;return e.diagnostics.installed&&e.diagnostics.rpcOk&&(t=e).diagnostics.runtime.stateWritable&&t.diagnostics.runtime.sessionStoreWritable}function am(e){return ap(e)&&e.diagnostics.modelReadiness.ready&&"passed"===e.diagnostics.runtime.smokeTest.status}function au({snapshot:e,surfaceTheme:t,stage:a,systemActionLabel:n,systemActionDescription:i,systemPhase:l,modelPhase:o,systemRun:d,modelRun:c,selectedModelId:p,discoveredModels:m,onSelectedModelIdChange:u,onRunSystemSetup:h,onRunModelAutoSetup:x,onRunModelDiscover:g,onRunModelRefresh:b,onRunModelSetDefault:f,onContinueToModels:v,onBackToSystem:y,onDismiss:j,canDismiss:N}){var C,S,A,T,O,R,M,$,P,_,E,D,U,F,z,W,B,q;let V,K,J,G,H,Z=ap(e),Y=am(e),Q=(C=a,S=Z,A=Y,[{id:"system",order:1,label:"System setup",description:"CLI, gateway service, live RPC, runtime state",state:af(S,"system"===C&&!S)},{id:"models",order:2,label:"Model setup",description:"Default model, provider auth, live smoke test",state:af(A,"models"===C&&!A)}]),X=(T=e,O=l,V=T.diagnostics.rpcOk&&!T.diagnostics.loaded,K=T.diagnostics.installed||"installing-gateway"===O||"starting-gateway"===O||"verifying"===O||"ready"===O,J=T.diagnostics.loaded||V||"starting-gateway"===O||"verifying"===O||"ready"===O,G=T.diagnostics.rpcOk||"ready"===O,H=T.diagnostics.runtime.stateWritable&&T.diagnostics.runtime.sessionStoreWritable||"ready"===O,[{id:"cli",label:"OpenClaw CLI",description:T.diagnostics.installed?`Installed${T.diagnostics.version?` \xb7 v${T.diagnostics.version}`:""}`:"Install the OpenClaw CLI on this machine.",state:af(K,!K&&("detecting"===O||"installing-cli"===O))},{id:"gateway",label:"Gateway service",description:T.diagnostics.loaded?"The local gateway service is already registered on this machine.":V?"Gateway is live via direct run.":"Register the gateway service once so Mission Control can start it reliably.",state:af(J,!J&&("installing-gateway"===O||K&&"detecting"===O))},{id:"runtime",label:"Live connection",description:T.diagnostics.rpcOk?"Mission Control is connected to a live OpenClaw gateway.":"Start the gateway and wait for RPC health to turn online.",state:af(G,!G&&("starting-gateway"===O||"verifying"===O||J&&"detecting"===O))},{id:"state",label:"Runtime state",description:T.diagnostics.runtime.stateWritable&&T.diagnostics.runtime.sessionStoreWritable?"Mission Control can write to the OpenClaw state root and agent session stores.":"Verify write access to the OpenClaw runtime state before live work begins.",state:af(H,!H&&("verifying"===O||G))}]),ee=e.models.filter(e=>!1!==e.available&&!e.missing),et=m.filter(e=>!ee.some(t=>t.id===e.modelId)),ea="system"===a?d:c,es=ea.statusMessage||ea.resultMessage||(R=a,M=i,"system"===R?M:"Choose or connect a usable model route so the product is actually ready."),er="system"===a?($=l,ap(P=e)?"ready":P.diagnostics.rpcOk?"verifying access":P.diagnostics.loaded&&!P.diagnostics.rpcOk?"verifying"===$?"connecting":"starting gateway":$?$.replace("-"," "):"waiting"):(_=o,am(E=e)?"ready":E.diagnostics.modelReadiness.ready&&"passed"!==E.diagnostics.runtime.smokeTest.status?"smoke test":_?_.replace("-"," "):"waiting"),en="idle"!==ea.runState||!!ea.manualCommand||ea.log.trim().length>0,ei=(D=ea.runState,U=a,F=Y,"running"===D?"Running":F?"Ready":"success"===D?"models"===U?"Updated":"Step complete":"error"===D?"Needs attention":"system"===U?"Step 1":"Step 2"),el="system"===(z={stage:a,systemReady:Z,modelReady:Y,systemActionLabel:n,selectedModelId:p,availableModelIds:ee.map(e=>e.id)}).stage?z.systemReady&&z.modelReady?{kind:"dismiss",label:"Enter Mission Control"}:z.systemReady?{kind:"continue",label:"Continue to model setup"}:{kind:"system",label:z.systemActionLabel}:z.modelReady?{kind:"dismiss",label:"Enter Mission Control"}:z.selectedModelId&&z.availableModelIds.includes(z.selectedModelId)||z.selectedModelId?{kind:"set-default",label:"Use selected model"}:{kind:"auto",label:"Auto configure models"};return(0,s.jsx)(ef.P.div,{initial:{opacity:0,backdropFilter:"blur(0px)"},animate:{opacity:1,backdropFilter:"blur(12px)"},exit:{opacity:0,backdropFilter:"blur(0px)"},className:k("absolute inset-0 z-[80] pointer-events-auto flex items-center justify-center overflow-y-auto px-3 py-4 sm:px-4 sm:py-6","light"===t?"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))]":"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.jsxs)(ef.P.div,{initial:{opacity:0,y:18,scale:.985},animate:{opacity:1,y:0,scale:1},className:k("my-auto flex w-full max-w-[420px] flex-col overflow-hidden rounded-[16px] border shadow-[0_18px_46px_rgba(0,0,0,0.18)] backdrop-blur-2xl max-h-[min(80vh,560px)]","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:"overflow-y-auto 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:k("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)(L.A,{className:"h-2 w-2"}),"Welcome"]}),(0,s.jsx)("span",{className:k("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.16em]",(W=ea.runState,B=Y,q=t,"error"===W?"light"===q?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200":"success"===W||B?"light"===q?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"running"===W?"light"===q?"border-[#d8c0b0] bg-white/80 text-[#8d725f]":"border-white/10 bg-white/[0.04] text-slate-300":"light"===q?"border-[#d8c0b0] bg-white/80 text-[#8d725f]":"border-white/10 bg-white/[0.04] text-slate-400")),children:ei})]}),(0,s.jsxs)("div",{className:"mt-3",children:[(0,s.jsx)("p",{className:k("text-[7px] uppercase tracking-[0.18em]","light"===t?"text-[#977b69]":"text-slate-500"),children:"OpenClaw Mission Control"}),(0,s.jsx)("h1",{className:k("mt-1 font-display text-[1.12rem] leading-[1.25rem]","light"===t?"text-[#33251c]":"text-white"),children:"Bring your local OpenClaw online."}),(0,s.jsx)("p",{className:k("mt-1.5 text-[11px] leading-[1.05rem]","light"===t?"text-[#705b4d]":"text-slate-300"),children:"Finish the system layer first, then lock a usable default model so the product is ready for real work."})]}),(0,s.jsx)("div",{className:"mt-3 grid gap-1.5 sm:grid-cols-2",children:Q.map(e=>(0,s.jsx)("div",{className:k("rounded-[14px] border px-2.5 py-2",ay(e.state,t)),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:k("inline-flex h-5 w-5 items-center justify-center rounded-full border text-[9px] font-medium",aj(e.state,t)),children:"complete"===e.state?(0,s.jsx)(w.A,{className:"h-2.5 w-2.5"}):e.order}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:k("text-[11px]","light"===t?"text-[#3e2f24]":"text-white"),children:e.label}),(0,s.jsx)("p",{className:k("mt-0.5 text-[8px] leading-[0.85rem]","light"===t?"text-[#8f7664]":"text-slate-500"),children:e.description})]})]}),(0,s.jsx)("span",{className:k("rounded-full px-1.5 py-0.5 text-[6px] uppercase tracking-[0.14em]",ak(e.state,t)),children:"complete"===e.state?"Ready":"current"===e.state?"Active":"Pending"})]})},e.id))}),"system"===a?(0,s.jsx)(ah,{steps:X,surfaceTheme:t,statusCopy:es,showDetails:en,phaseLabel:er,run:ea}):(0,s.jsx)(ax,{snapshot:e,surfaceTheme:t,statusCopy:es,showDetails:en,phaseLabel:er,run:ea,selectedModelId:p,availableModels:ee.map(e=>({id:e.id,name:e.name,provider:e.provider})),discoveredModels:et,onSelectedModelIdChange:u,onRunModelDiscover:g,onRunModelRefresh:b,onRunModelSetDefault:f})]}),(0,s.jsxs)("div",{className:k("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.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:["models"===a?(0,s.jsxs)(I,{type:"button",variant:"ghost",size:"sm",onClick:y,disabled:"running"===ea.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)(ad.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Back"]}):null,N?(0,s.jsx)("button",{type:"button",onClick:j,className:k("text-[9px] uppercase tracking-[0.16em] transition-colors","light"===t?"text-[#8f7664] hover:text-[#6f5949]":"text-slate-500 hover:text-slate-300"),children:"Open demo surface"}):null]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:["models"!==a||Y?null:(0,s.jsx)(I,{type:"button",variant:"secondary",size:"sm",onClick:x,disabled:"running"===c.runState,className:aw(t),children:"running"===c.runState?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Working..."]}):"Auto configure"}),(0,s.jsx)(I,{type:"button",onClick:()=>{"system"===a?Z&&Y?j():Z?v():h():Y?j():"set-default"===el.kind?f():x()},disabled:"running"===ea.runState,className:k("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"===ea.runState?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Working..."]}):(0,s.jsxs)(s.Fragment,{children:[el.label,(0,s.jsx)(ac.A,{className:"ml-1.5 h-3 w-3"})]})})]})]})]})})}function ah({steps:e,surfaceTheme:t,statusCopy:a,showDetails:r,phaseLabel:n,run:i}){return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"mt-3",children:[(0,s.jsx)("p",{className:k("text-[7px] uppercase tracking-[0.18em]","light"===t?"text-[#977b69]":"text-slate-500"),children:"Step 1"}),(0,s.jsx)("h2",{className:k("mt-1 text-[13px] font-medium","light"===t?"text-[#33251c]":"text-white"),children:"System setup"}),(0,s.jsx)("p",{className:k("mt-1 text-[10px] leading-[0.95rem]","light"===t?"text-[#705b4d]":"text-slate-400"),children:"Install the CLI if needed, make sure the gateway service exists, and verify a live RPC connection."})]}),(0,s.jsx)("div",{className:"mt-2.5 space-y-1.5",children:e.map((e,a)=>(0,s.jsxs)("div",{className:k("flex items-center gap-1.5 rounded-[12px] border px-2 py-1.5",ay(e.state,t)),children:[(0,s.jsx)("span",{className:k("mt-0.5 inline-flex h-5 w-5 items-center justify-center rounded-full border text-[9px] font-medium",aj(e.state,t)),children:"complete"===e.state?(0,s.jsx)(w.A,{className:"h-2.5 w-2.5"}):a+1}),(0,s.jsxs)("div",{className:"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:k("text-[11px]","light"===t?"text-[#3e2f24]":"text-white"),children:e.label}),(0,s.jsx)("span",{className:k("rounded-full px-1.5 py-0.5 text-[6px] uppercase tracking-[0.14em]",ak(e.state,t)),children:"complete"===e.state?"Ready":"current"===e.state?"Active":"Pending"})]}),(0,s.jsx)("p",{className:k("mt-0.5 text-[8px] leading-[0.82rem]","light"===t?"text-[#8f7664]":"text-slate-500"),children:e.description})]})]},e.id))}),(0,s.jsx)(ag,{surfaceTheme:t,statusCopy:a,showDetails:r,phaseLabel:n,run:i})]})}function ax({snapshot:e,surfaceTheme:t,statusCopy:a,showDetails:r,phaseLabel:n,run:i,selectedModelId:l,availableModels:o,discoveredModels:d,onSelectedModelIdChange:c,onRunModelDiscover:m,onRunModelRefresh:u,onRunModelSetDefault:h}){let x=e.diagnostics.modelReadiness;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"mt-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:k("text-[7px] uppercase tracking-[0.18em]","light"===t?"text-[#977b69]":"text-slate-500"),children:"Step 2"}),(0,s.jsx)("h2",{className:k("mt-1 text-[13px] font-medium","light"===t?"text-[#33251c]":"text-white"),children:"Model setup"})]}),(0,s.jsxs)(I,{type:"button",variant:"secondary",size:"sm",onClick:u,disabled:"running"===i.runState,className:aw(t),children:[(0,s.jsx)(p.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Refresh"]})]}),(0,s.jsx)("p",{className:k("mt-1 text-[10px] leading-[0.95rem]","light"===t?"text-[#705b4d]":"text-slate-400"),children:"Lock a usable default model before handing the user into the live product."})]}),(0,s.jsxs)("div",{className:"mt-2.5 grid gap-1.5 sm:grid-cols-3",children:[(0,s.jsx)(ab,{surfaceTheme:t,label:"Default model",value:x.resolvedDefaultModel||x.defaultModel||"Not set"}),(0,s.jsx)(ab,{surfaceTheme:t,label:"Available routes",value:`${x.availableModelCount}/${x.totalModelCount}`}),(0,s.jsx)(ab,{surfaceTheme:t,label:"Connected providers",value:String(x.authProviders.filter(e=>e.connected).length)})]}),(0,s.jsxs)("div",{className:k("mt-2.5 rounded-[12px] border px-2.5 py-2.5","light"===t?"border-[#e5d5c9] bg-[#fffaf6]":"border-white/8 bg-[rgba(255,255,255,0.02)]"),children:[(0,s.jsxs)("div",{className:"grid gap-2.5 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-end",children:[(0,s.jsxs)("label",{className:"block",children:[(0,s.jsx)("span",{className:k("text-[7px] uppercase tracking-[0.16em]","light"===t?"text-[#977b69]":"text-slate-500"),children:"Default model"}),(0,s.jsxs)("select",{value:l,onChange:e=>c(e.target.value),className:k("mt-1.5 h-9 w-full rounded-[12px] border px-2.5 text-[11px] outline-none","light"===t?"border-[#dccabd] bg-white text-[#33251c]":"border-white/10 bg-white/[0.04] text-slate-100"),children:[(0,s.jsx)("option",{value:"",children:"Auto choose"}),o.map(e=>(0,s.jsxs)("option",{value:e.id,children:[e.name," \xb7 ",e.provider]},e.id))]})]}),(0,s.jsxs)("div",{className:k("rounded-[12px] border px-2.5 py-1.5 text-[10px]","light"===t?"border-[#eadcd0] bg-[#fff7f2] text-[#705b4d]":"border-white/10 bg-white/[0.03] text-slate-400"),children:[x.localModelCount," local \xb7 ",x.remoteModelCount," remote"]})]}),(0,s.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:(0,s.jsx)(I,{type:"button",variant:"secondary",size:"sm",onClick:m,disabled:"running"===i.runState,className:aw(t),children:d.length>0?"Scan again":"Discover models"})}),x.issues.length>0?(0,s.jsx)("div",{className:"mt-2.5 space-y-1",children:x.issues.map(e=>(0,s.jsx)("p",{className:k("rounded-[10px] border px-2 py-1.5 text-[9px] leading-[0.85rem]","light"===t?"border-amber-200 bg-amber-50 text-amber-800":"border-amber-300/20 bg-amber-300/10 text-amber-100"),children:e},e))}):null,e.diagnostics.modelReadiness.authProviders.length>0?(0,s.jsx)("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:e.diagnostics.modelReadiness.authProviders.map(e=>(0,s.jsxs)("span",{className:k("rounded-full border px-2 py-0.5 text-[9px]",e.connected?"light"===t?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/10 text-emerald-200":"light"===t?"border-[#dccabd] bg-white text-[#705b4d]":"border-white/10 bg-white/[0.04] text-slate-300"),children:[av(e.provider),e.detail?` \xb7 ${e.detail}`:""]},e.provider))}):null,d.length>0?(0,s.jsxs)("div",{className:"mt-2.5 space-y-1.5",children:[(0,s.jsx)("p",{className:k("text-[7px] uppercase tracking-[0.16em]","light"===t?"text-[#977b69]":"text-slate-500"),children:"Discovered routes"}),(0,s.jsx)("div",{className:"space-y-1.5",children:d.slice(0,3).map(e=>(0,s.jsxs)("div",{className:k("flex items-center justify-between gap-2 rounded-[12px] border px-2 py-1.5","light"===t?"border-[#eadcd0] bg-[#fff7f2]":"border-white/10 bg-white/[0.03]"),children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:k("truncate text-[10px]","light"===t?"text-[#3e2f24]":"text-white"),children:e.name}),(0,s.jsxs)("p",{className:k("mt-0.5 text-[8px] leading-[0.85rem]","light"===t?"text-[#8f7664]":"text-slate-500"),children:[av(e.provider),e.isFree?" \xb7 free":"",e.supportsTools?" \xb7 tools":""]})]}),(0,s.jsx)(I,{type:"button",variant:"secondary",size:"sm",onClick:()=>h(e.modelId),disabled:"running"===i.runState,className:aw(t),children:"Use"})]},e.modelId))}),(0,s.jsx)("p",{className:k("text-[9px] leading-[0.95rem]","light"===t?"text-[#705b4d]":"text-slate-500"),children:"The dropdown only shows routes that are already configured. Use a discovered route here to add it first; if credentials are missing, Mission Control will hand you off to OpenClaw."})]}):null]}),(0,s.jsx)(ag,{surfaceTheme:t,statusCopy:a,showDetails:r,phaseLabel:n,run:i})]})}function ag({surfaceTheme:e,statusCopy:t,showDetails:a,phaseLabel:n,run:i}){let[l,o]=(0,m.useState)(!1),d=!!i.manualCommand?.trim().startsWith("openclaw "),c=async()=>{if(i.manualCommand)try{await navigator.clipboard.writeText(i.manualCommand),ed.o.success("Command copied.",{description:"Open Terminal and paste the command to continue setup."})}catch(e){ed.o.error("Could not copy command.",{description:e instanceof Error?e.message:"Clipboard access is unavailable."})}},p=async()=>{if(i.manualCommand&&d){o(!0);try{let e=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:i.manualCommand})}),t=await e.json().catch(()=>null);if(!e.ok||t?.error)throw Error(t?.error||"Unable to open Terminal.");ed.o.success("Terminal opened.",{description:"Finish the OpenClaw auth flow there, then return and refresh setup."})}catch(e){ed.o.error("Could not open Terminal.",{description:e instanceof Error?e.message:"Open Terminal manually and run the command below."})}finally{o(!1)}}};return(0,s.jsxs)("div",{className:k("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.jsx)("p",{className:k("text-[7px] uppercase tracking-[0.16em]","light"===e?"text-[#977b69]":"text-slate-500"),children:"Current status"}),(0,s.jsx)("p",{className:k("mt-1 text-[11px] leading-[1rem]","light"===e?"text-[#5f4b3e]":"text-slate-300"),children:t})]}),a?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:k("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:k("text-[8px] uppercase tracking-[0.16em]","light"===e?"text-[#977b69]":"text-slate-500"),children:"Setup log"}),(0,s.jsx)("span",{className:"light"===e?"text-[10px] text-[#8c7362]":"text-[10px] text-slate-400",children:n})]}),(0,s.jsx)("pre",{className:k("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:i.log||"No command output yet.\n\nStart this step and Mission Control will stream each action here."}),i.manualCommand?(0,s.jsxs)("div",{className:k("border-t px-2.5 py-2","light"===e?"border-[#ebddd2]":"border-white/8"),children:[(0,s.jsx)("p",{className:k("text-[8px] uppercase tracking-[0.16em]","light"===e?"text-[#977b69]":"text-slate-500"),children:d?"Run in terminal":"Manual fallback"}),d?(0,s.jsx)("p",{className:k("mt-1 text-[9px] leading-[0.95rem]","light"===e?"text-[#705b4d]":"text-slate-400"),children:"Open Terminal and run this command to continue setup."}):null,(0,s.jsx)("p",{className:k("mt-1 break-all font-mono text-[9px] leading-[0.92rem]","light"===e?"text-[#4f3d31]":"text-slate-200"),children:i.manualCommand}),(0,s.jsxs)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[(0,s.jsxs)(I,{type:"button",variant:"secondary",size:"sm",onClick:c,className:aw(e),children:[(0,s.jsx)(x.A,{className:"mr-1.5 h-3 w-3"}),"Copy command"]}),d?(0,s.jsx)(I,{type:"button",variant:"secondary",size:"sm",onClick:p,disabled:l,className:aw(e),children:l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h.A,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}):null]}),i.docsUrl?(0,s.jsxs)("a",{href:i.docsUrl,target:"_blank",rel:"noreferrer",className:k("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)(ac.A,{className:"h-2.5 w-2.5"})]}):null]}):null]}):null]})}function ab({surfaceTheme:e,label:t,value:a}){return(0,s.jsxs)("div",{className:k("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:k("text-[7px] uppercase tracking-[0.16em]","light"===e?"text-[#977b69]":"text-slate-500"),children:t}),(0,s.jsx)("p",{className:k("mt-1 text-[11px] leading-[0.92rem]","light"===e?"text-[#3e2f24]":"text-white"),children:a})]})}function af(e,t){return e?"complete":t?"current":"pending"}function aw(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 av(e){let t=e.trim().toLowerCase();return"openrouter"===t?"OpenRouter":"openai-codex"===t?"OpenAI Codex":"openai"===t?"OpenAI":"anthropic"===t?"Anthropic":"ollama"===t?"Ollama":e.split("-").map(e=>e?e[0].toUpperCase()+e.slice(1):e).join(" ")}function ay(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 aj(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 ak(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 aN=a(4954),aC=a(5160),aS=a(50);function aA({open:e,target:t,surfaceTheme:a,previewState:n,preview:l,previewError:o,runState:d,statusMessage:c,resultMessage:p,backgroundLogPath:m,log:u,confirmText:h,onConfirmTextChange:x,onRefreshPreview:g,onExecute:b,onOpenChange:f}){let w="full-uninstall"===t?"FULL UNINSTALL":"RESET MISSION CONTROL",v="running"===d,y="success"===d||"error"===d,j=null!==t&&"ready"===n&&!v&&!y&&h.trim()===w,N="full-uninstall"===t?"Full Uninstall":"Reset Mission Control",C="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)(G,{open:e,onOpenChange:e=>{(e||!v)&&f(e)},children:(0,s.jsxs)(Q,{className:k("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)(X,{children:[(0,s.jsxs)(et,{className:k("flex items-center gap-2","light"===a?"text-[#3f2f24]":"text-white"),children:["full-uninstall"===t?(0,s.jsx)(aN.A,{className:"h-4 w-4"}):(0,s.jsx)(aC.A,{className:"h-4 w-4"}),N]}),(0,s.jsx)(ea,{className:"light"===a?"text-[#7e6555]":"text-slate-400",children:"full-uninstall"===t?"Remove Mission Control state, OpenClaw service and local state, then attempt to remove detected OpenClaw and AgentOS packages.":"Remove Mission Control-managed workspaces, attached agents, planner state, and browser state."})]}),"loading"===n?(0,s.jsxs)("div",{className:k("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)(r.A,{className:"h-4 w-4 animate-spin"}),"Loading the reset preview..."]}):null,"error"===n?(0,s.jsxs)("div",{className:k("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:o||"Unknown reset preview error."})]}):null,l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"grid gap-3 md:grid-cols-4",children:[(0,s.jsx)(aI,{label:"Delete folders",value:String(l.summary.deleteFolderCount),surfaceTheme:a}),(0,s.jsx)(aI,{label:"Keep folders",value:String(l.summary.metadataOnlyCount),surfaceTheme:a}),(0,s.jsx)(aI,{label:"Agents",value:String(l.summary.agentCount),surfaceTheme:a}),(0,s.jsx)(aI,{label:"Live agents",value:String(l.summary.liveAgentCount),surfaceTheme:a,danger:l.summary.liveAgentCount>0})]}),l.warnings.length>0?(0,s.jsx)("div",{className:k("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)(i.A,{className:"mt-0.5 h-4 w-4 shrink-0"}),(0,s.jsx)("div",{className:"space-y-1 text-sm",children:l.warnings.map(e=>(0,s.jsx)("p",{children:e},e))})]})}):null,(0,s.jsxs)("div",{className:k("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:k("text-xs uppercase tracking-[0.18em]","light"===a?"text-[#9a7f6c]":"text-slate-500"),children:"Workspace impact"}),(0,s.jsx)("p",{className:k("mt-1 text-sm","light"===a?"text-[#6d5647]":"text-slate-400"),children:"`Delete folder` removes the workspace directory. `Keep folder` only removes OpenClaw and Mission Control integration from that location."})]}),(0,s.jsx)(I,{type:"button",size:"sm",variant:"secondary",onClick:g,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:l.workspaces.map(e=>(0,s.jsxs)("div",{className:k("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:k("text-sm font-medium","light"===a?"text-[#3f2f24]":"text-white"),children:e.name}),(0,s.jsx)("p",{className:k("mt-1 break-all font-mono text-[11px]","light"===a?"text-[#7e6555]":"text-slate-400"),children:e.path})]}),(0,s.jsx)("span",{className:k("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:k("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:k("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)(aT,{title:"Mission Control state",items:l.missionControlPaths,surfaceTheme:a}),(0,s.jsx)(aT,{title:"Browser state",items:l.browserStorageKeys,surfaceTheme:a})]}),"full-uninstall"===t?(0,s.jsxs)("div",{className:"mt-3 grid gap-3 md:grid-cols-2",children:[(0,s.jsx)(aT,{title:"OpenClaw state",items:l.openClawPaths,surfaceTheme:a}),(0,s.jsxs)("div",{className:k("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:k("text-xs uppercase tracking-[0.18em]","light"===a?"text-[#9a7f6c]":"text-slate-500"),children:"Package cleanup"}),(0,s.jsx)("div",{className:"mt-3 space-y-2",children:l.packageActions.map(e=>(0,s.jsxs)("div",{className:k("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:k("min-w-0 break-all text-sm font-medium","light"===a?"text-[#3f2f24]":"text-white"),children:e.packageName}),(0,s.jsx)("span",{className:k("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:k("mt-1 break-words text-xs","light"===a?"text-[#6d5647]":"text-slate-400"),children:e.reason||"No extra detail."}),(0,s.jsx)("p",{className:k("mt-1 whitespace-pre-wrap break-all font-mono text-[11px]","light"===a?"text-[#7e6555]":"text-slate-500"),children:e.command||"Automatic package removal is not available."})]},e.packageName))})]})]}):null,(0,s.jsxs)("div",{className:k("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)(tw,{htmlFor:"reset-confirm",className:"text-sm font-medium text-inherit",children:["Type ",w," to continue"]}),(0,s.jsx)(T,{id:"reset-confirm",value:h,onChange:e=>x(e.target.value),placeholder:w,disabled:v,className:k("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"!==d||p||u?(0,s.jsxs)("div",{className:k("min-w-0 overflow-hidden rounded-[16px] border px-4 py-4","error"===d?"light"===a?"border-rose-200 bg-rose-50 text-rose-950":"border-rose-400/25 bg-rose-500/10 text-rose-50":"success"===d?"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:c||p||"Reset status"}),p?(0,s.jsx)("p",{className:"mt-1 text-sm",children:p}):null,m?(0,s.jsxs)("p",{className:"mt-2 break-all font-mono text-[11px]",children:["Background cleanup log: ",m]}):null,(0,s.jsx)("pre",{className:k("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:u||"Waiting for command output..."})]}):null,(0,s.jsxs)(ee,{children:[(0,s.jsx)(I,{type:"button",variant:y?"default":"secondary",onClick:()=>f(!1),disabled:v,className:y&&"light"===a?"bg-[#5c4437] text-white hover:bg-[#4d382d]":y?"bg-cyan-400 text-slate-950 hover:bg-cyan-300":void 0,children:y?"Done":"Close"}),y?null:(0,s.jsx)(I,{type:"button",onClick:b,disabled:!j,className:C,children:v?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.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)(aN.A,{className:"mr-1.5 h-3.5 w-3.5"}):(0,s.jsx)(aS.A,{className:"mr-1.5 h-3.5 w-3.5"}),N]})})]})]})})}function aI({label:e,value:t,surfaceTheme:a,danger:r=!1}){return(0,s.jsxs)("div",{className:k("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:k("text-[11px] uppercase tracking-[0.16em]","light"===a?"text-[#9a7f6c]":"text-slate-500"),children:e}),(0,s.jsx)("p",{className:k("mt-1 font-display text-lg","light"===a?"text-[#3f2f24]":"text-white"),children:t})]})}function aT({title:e,items:t,surfaceTheme:a}){return(0,s.jsxs)("div",{className:k("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:k("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:k("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 aO=a(6607),aR=a(6780);function aM({snapshot:e,activeWorkspaceId:t,requestedAgentAction:a,connectionState:n,collapsed:l,modelManager:o,onToggleCollapsed:d,onSelectWorkspace:c,onRefresh:u,onRunModelRefresh:h,onRunModelDiscover:x,onRunModelSetDefault:g,onConnectModelProvider:b,onOpenModelSetup:f,onOpenAddModels:w}){var v;let y=function(e){switch(e){case"healthy":return"text-emerald-300";case"degraded":return"text-amber-200";default:return"text-rose-200"}}(e.diagnostics.health),j="healthy"===e.diagnostics.health?"bg-emerald-300":"degraded"===e.diagnostics.health?"bg-amber-200":"bg-rose-300",N=e.diagnostics.gatewayUrl.replace(/^wss?:\/\//,"").replace(/\/$/,""),[S,A]=(0,m.useState)(!1),[O,R]=(0,m.useState)(!1),[M,$]=(0,m.useState)(!1),[P,_]=(0,m.useState)(!1),[E,D]=(0,m.useState)(!1),[L,U]=(0,m.useState)(!1),[W,B]=(0,m.useState)(!1),[q,V]=(0,m.useState)(!1),[K,J]=(0,m.useState)(null),[H,Z]=(0,m.useState)(null),[Y,es]=(0,m.useState)(null),[er,en]=(0,m.useState)(""),[ei,el]=(0,m.useState)(null),[eo,ec]=(0,m.useState)(""),[ep,em]=(0,m.useState)("workspaces"),[eu,eh]=(0,m.useState)(""),ex=(0,m.useRef)(null),eg=(0,m.useMemo)(()=>e.agents.filter(e=>!t||e.workspaceId===t).sort((e,t)=>e.workspaceId!==t.workspaceId?e.workspaceId.localeCompare(t.workspaceId):e.name.localeCompare(t.name)),[e.agents,t]),eb=e.workspaces.find(e=>e.id===t)??e.workspaces[0]??null,ef=(0,m.useMemo)(()=>e.models.filter(e=>!1!==e.available&&!e.missing),[e.models]),ev=(0,m.useMemo)(()=>o.discoveredModels.filter(t=>!e.models.some(e=>e.id===t.modelId)),[o.discoveredModels,e.models]),ey=eu&&(ef.some(e=>e.id===eu)||ev.some(e=>e.modelId===eu))?eu:(v=e).diagnostics.modelReadiness.resolvedDefaultModel||v.diagnostics.modelReadiness.defaultModel||v.models.find(e=>!1!==e.available&&!e.missing)?.id||"",ej=!!K&&(O||"monitoring"===K.policy.preset),eN=[{id:"overview",label:"Overview",icon:aO.A},{id:"workspaces",label:"Workspaces",icon:e7.A,badge:String(e.workspaces.length)},{id:"agents",label:"Agents",icon:z.A,badge:String(eg.length)},{id:"models",label:"Models",icon:F.A,badge:String(e.models.length)}],eM=(0,m.useMemo)(()=>Y?e.agents.filter(e=>e.workspaceId===Y.id):[],[Y,e.agents]),e$=(0,m.useMemo)(()=>eM.filter(e=>"engaged"===e.status||"monitoring"===e.status||"ready"===e.status),[eM]),eP=(0,m.useMemo)(()=>Y?e.runtimes.filter(e=>e.workspaceId===Y.id):[],[Y,e.runtimes]),e_=(0,m.useMemo)(()=>ei?e.runtimes.filter(e=>e.agentId===ei.id):[],[ei,e.runtimes]),eE=ei?e.workspaces.find(e=>e.id===ei.workspaceId)??null:null,eD=!!ei&&("engaged"===ei.status||"monitoring"===ei.status||"ready"===ei.status),eU=e=>{el(e),ec(""),B(!0)};(0,m.useEffect)(()=>{if(!a||ex.current===a.requestId)return;let t=e.agents.find(e=>e.id===a.agentId);if(t){if(ex.current=a.requestId,"edit"===a.kind)return void ez(t);eU(t)}},[a,e.agents]);let ez=e=>{J({...function(e,t={}){let a=eO(t.policy?.preset??"worker",t.policy),s=ek[a.preset],r=tj(a.preset,t.heartbeat);return{id:t.id??"",workspaceId:e,modelId:t.modelId??"",name:t.name??s.defaultName,emoji:t.emoji??s.defaultEmoji,theme:t.theme??s.defaultTheme,avatar:t.avatar??"",policy:a,heartbeat:r}}(e.workspaceId,{id:e.id,modelId:"unassigned"===e.modelId?"":e.modelId,name:e.name,emoji:e.identity.emoji??"",theme:e.identity.theme??"",avatar:e.identity.avatar??"",policy:e.policy,heartbeat:tj(e.policy.preset,{enabled:e.heartbeat.enabled,every:e.heartbeat.every??void 0})})}),R(!1),A(!0)},eW=async()=>{if(K){$(!0);try{let e=await fetch("/api/agents",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(K)}),t=await e.json();if(!e.ok||t.error)throw Error(t.error||"OpenClaw could not update the agent.");ed.o.success("Agent updated in OpenClaw.",{description:K.id}),A(!1),await u()}catch(e){ed.o.error("Agent update failed.",{description:e instanceof Error?e.message:"Unknown agent error."})}finally{$(!1)}}},eq=async()=>{if(H){U(!0);try{let e=await fetch("/api/workspaces",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceId:H.workspaceId,name:H.name.trim()||void 0,directory:H.directory.trim()||void 0})}),t=await e.json();if(!e.ok||t.error)throw Error(t.error||"OpenClaw could not update the workspace.");ed.o.success("Workspace updated in OpenClaw.",{description:t.workspacePath||H.currentPath}),_(!1),await u(),c(t.workspaceId??H.workspaceId)}catch(e){ed.o.error("Workspace update failed.",{description:e instanceof Error?e.message:"Unknown workspace error."})}finally{U(!1)}}},eV=async()=>{if(Y){U(!0);try{let e=await fetch("/api/workspaces",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceId:Y.id})}),a=await e.json();if(!e.ok||a.error)throw Error(a.error||"OpenClaw could not delete the workspace.");ed.o.success("Workspace deleted from OpenClaw.",{description:a.workspacePath||Y.path}),D(!1),es(null),en(""),c(t===Y.id?null:t),await u()}catch(e){ed.o.error("Workspace deletion failed.",{description:e instanceof Error?e.message:"Unknown workspace error."})}finally{U(!1)}}},eK=async()=>{if(ei){V(!0);try{let e=await fetch("/api/agents",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentId:ei.id})}),t=await e.json();if(!e.ok||t.error)throw Error(t.error||"OpenClaw could not delete the agent.");ed.o.success("Agent deleted from OpenClaw.",{description:t.agentId||ei.id}),K?.id===ei.id&&(A(!1),J(null)),B(!1),el(null),ec(""),await u()}catch(e){ed.o.error("Agent deletion failed.",{description:e instanceof Error?e.message:"Unknown agent error."})}finally{V(!1)}}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"panel-surface panel-glow flex h-full overflow-hidden rounded-[30px] border 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:k("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-3 py-4",l?"w-full":"w-[78px] border-r border-white/[0.08]"),children:[(0,s.jsx)("button",{type:"button","aria-label":l?"Expand mission control":"Collapse mission control",onClick:d,className:"flex h-12 w-12 items-center justify-center rounded-[18px] border border-cyan-300/20 bg-cyan-400/[0.12] shadow-[0_10px_24px_rgba(34,211,238,0.18)] transition-all hover:border-cyan-200/30 hover:bg-cyan-400/[0.16]",children:(0,s.jsx)(aR.A,{className:"h-5 w-5 text-cyan-200"})}),(0,s.jsx)("button",{type:"button","aria-label":l?"Expand mission control":"Collapse mission control",onClick:d,className:"mt-4 inline-flex h-11 w-11 items-center justify-center rounded-[16px] border border-white/10 bg-white/[0.04] text-slate-300 transition-all hover:border-cyan-300/18 hover:bg-white/[0.08] hover:text-white",children:l?(0,s.jsx)(tq.A,{className:"h-4 w-4"}):(0,s.jsx)(tB.A,{className:"h-4 w-4"})}),(0,s.jsx)("div",{className:"mt-6 flex flex-1 flex-col items-center gap-2",children:eN.map(e=>(0,s.jsx)(a$,{icon:e.icon,label:e.label,active:ep===e.id,onClick:()=>{em(e.id),l&&d()}},e.id))}),(0,s.jsxs)("div",{className:"mt-4 flex flex-col items-center gap-2",children:[(0,s.jsx)(ew,{tone:j,pulse:"healthy"===e.diagnostics.health}),l?(0,s.jsx)("p",{className:"text-[9px] uppercase tracking-[0.18em] text-slate-500",children:e.mode}):null]})]}),l?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:"mission-scroll flex h-full min-h-0 flex-col overflow-y-auto overscroll-contain",children:[(0,s.jsxs)("div",{className:"shrink-0 border-b border-white/[0.08] 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",children:[(0,s.jsx)("p",{className:"text-[11px] uppercase tracking-[0.28em] text-slate-500",children:"OpenClaw"}),(0,s.jsx)("h1",{className:"mt-2 font-display text-[1.38rem] text-white",children:"Mission Control"}),(0,s.jsx)("p",{className:"mt-2 text-[12px] leading-5 text-slate-400",children:"Classic operations rail for live workspaces, agents, and model routing."})]}),(0,s.jsx)("div",{className:"rounded-[18px] border border-white/10 bg-white/[0.04] p-2.5 shadow-[inset_0_1px_0_rgba(255,255,255,0.05)]",children:(0,s.jsx)(aR.A,{className:"h-4 w-4 text-cyan-200"})})]}),(0,s.jsxs)("div",{className:"mt-4 rounded-[22px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(13,20,34,0.98),rgba(6,10,18,0.96))] p-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)(ew,{tone:j,pulse:"healthy"===e.diagnostics.health}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:k("text-[13px] font-medium capitalize",y),children:e.diagnostics.health}),(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:"live"===n?"stream online":n})]})]}),(0,s.jsx)(C,{variant:"muted",children:e.mode})]}),(0,s.jsxs)("div",{className:"mt-3 rounded-[16px] border border-white/[0.06] 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:"Gateway"}),(0,s.jsx)("p",{className:"mt-1.5 text-[13px] text-white",children:N})]}),e.diagnostics.issues.length>0?(0,s.jsx)("div",{className:"mt-3 rounded-[16px] border border-amber-400/15 bg-amber-400/[0.08] px-3 py-2 text-xs text-amber-100",children:e.diagnostics.issues[0]}):null]}),(0,s.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:eN.map(e=>(0,s.jsx)(aP,{label:e.label,badge:e.badge,active:ep===e.id,onClick:()=>em(e.id)},e.id))})]}),(0,s.jsxs)("div",{className:"flex-1 space-y-6 p-4",children:["overview"===ep?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a_,{eyebrow:"Overview",title:"System summary",detail:"Current health, active focus, and runtime inventory."}),(0,s.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,s.jsx)(aE,{label:"Workspaces",value:String(e.workspaces.length)}),(0,s.jsx)(aE,{label:"Agents",value:String(e.agents.length)}),(0,s.jsx)(aE,{label:"Models",value:String(e.models.length)}),(0,s.jsx)(aE,{label:"Runs",value:String(e.runtimes.length)})]}),eb?(0,s.jsxs)("div",{className:"rounded-[22px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.9),rgba(6,10,18,0.88))] p-4",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:"truncate font-display text-[15px] text-white",children:eb.name}),(0,s.jsx)("p",{className:"mt-1 truncate text-[10px] uppercase tracking-[0.22em] text-slate-500",children:eb.slug})]}),(0,s.jsx)(C,{variant:"muted",children:eb.health})]}),(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2 text-[10px] uppercase tracking-[0.16em] text-slate-400",children:[(0,s.jsxs)("span",{children:[eb.agentIds.length," agents"]}),(0,s.jsxs)("span",{children:[eb.modelIds.length," models"]}),(0,s.jsxs)("span",{children:[eb.activeRuntimeIds.length," runs"]})]}),(0,s.jsx)("p",{className:"mt-3 text-[12px] text-slate-400",children:function(e){let t=eB(e),a=t.split("/").filter(Boolean).filter(e=>{var t;return t=e,!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t)});if(a.length<=3)return t;let s="~"===a[0]?"~/":"/";return`${s}…/${a.slice(-2).join("/")}`}(eb.path)})]}):null]}):null,"workspaces"===ep?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a_,{eyebrow:"Home",title:"Workspaces",detail:"Select, rename, or remove real OpenClaw workspaces.",action:(0,s.jsx)(I,{variant:"ghost",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>c(null),children:"All"})}),(0,s.jsx)("div",{className:"space-y-3",children:e.workspaces.map(e=>{let a=e.id===t;return(0,s.jsxs)("div",{className:k("rounded-[20px] border p-3.5 transition-all",a?"border-cyan-300/[0.35] bg-cyan-400/[0.08] shadow-[0_14px_40px_rgba(34,211,238,0.12)]":"border-white/[0.08] bg-white/[0.03] hover:bg-white/[0.05]"),children:[(0,s.jsx)("button",{type:"button",onClick:()=>c(a?null:e.id),className:"w-full text-left",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:"truncate font-display text-[15px] text-white",children:e.name}),(0,s.jsx)("p",{className:"mt-1 truncate text-[10px] uppercase tracking-[0.22em] text-slate-500",children:e.slug})]}),(0,s.jsx)(C,{variant:a?"default":"muted",children:e.health})]})}),(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2 text-[10px] uppercase tracking-[0.16em] text-slate-400",children:[(0,s.jsxs)("span",{children:[e.agentIds.length," agents"]}),(0,s.jsxs)("span",{children:[e.modelIds.length," models"]}),(0,s.jsxs)("span",{children:[e.activeRuntimeIds.length," runs"]})]}),(0,s.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,s.jsx)(I,{variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>{Z({workspaceId:e.id,name:e.name,directory:"",currentPath:e.path}),_(!0)},children:"Edit"}),(0,s.jsx)(I,{variant:"ghost",size:"sm",className:"h-8 rounded-full px-3 text-[11px] text-rose-200 hover:bg-rose-400/10 hover:text-rose-100",onClick:()=>{es(e),en(""),D(!0)},children:"Delete"})]})]},e.id)})})]}):null,"agents"===ep?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a_,{eyebrow:"Apps",title:"Agents",detail:"Create and tune live isolated OpenClaw operators.",action:(0,s.jsx)(tN,{snapshot:e,defaultWorkspaceId:t??e.workspaces[0]?.id??null,onRefresh:u,trigger:(0,s.jsx)(I,{variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",disabled:0===e.workspaces.length,children:"Add"})})}),(0,s.jsxs)("div",{className:"space-y-3",children:[0===eg.length?(0,s.jsx)("div",{className:"rounded-[18px] border border-white/[0.08] bg-white/[0.03] px-3.5 py-3 text-[12px] text-slate-400",children:"No agents are attached to this workspace yet."}):null,eg.map(a=>(0,s.jsxs)("div",{className:"rounded-[18px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.9),rgba(8,13,24,0.84))] p-3.5",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.jsxs)("p",{className:"truncate text-[13px] font-medium text-white",children:[a.identity.emoji?`${a.identity.emoji} `:"",a.name]}),(0,s.jsx)("p",{className:"mt-1 truncate text-[10px] uppercase tracking-[0.22em] text-slate-500",children:a.id}),(0,s.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2",children:[(0,s.jsx)(C,{variant:ek[a.policy.preset].badgeVariant,children:eR(a.policy.preset)}),(0,s.jsx)(C,{variant:"engaged"===a.status?"default":"muted",children:a.status})]})]}),(0,s.jsx)(aq,{agentName:a.name,onEdit:()=>ez(a),onDelete:()=>eU(a)})]}),(0,s.jsx)("div",{className:"mt-3 flex items-center gap-2",children:(0,s.jsx)("div",{className:"min-w-0 flex-1 rounded-full border border-white/[0.08] bg-white/[0.03] px-3 py-2 text-[10px] uppercase tracking-[0.16em] text-slate-400",children:(0,s.jsx)("span",{className:"truncate",children:"unassigned"===a.modelId?"default model":eF(a.modelId)})})}),t?null:(0,s.jsx)("p",{className:"mt-2 truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:e.workspaces.find(e=>e.id===a.workspaceId)?.name||"Workspace"})]},a.id))]})]}):null,"models"===ep?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a_,{eyebrow:"Models",title:"Models & providers",detail:"Connect providers, choose a default route, and manage live model readiness.",action:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(I,{variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:w,children:"Add models"}),(0,s.jsxs)(I,{variant:"ghost",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",disabled:"running"===o.runState,onClick:h,children:["running"===o.runState?(0,s.jsx)(r.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(p.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Refresh"]})]})}),(0,s.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,s.jsx)(aE,{label:"Default",value:e.diagnostics.modelReadiness.resolvedDefaultModel||e.diagnostics.modelReadiness.defaultModel||"Not set"}),(0,s.jsx)(aE,{label:"Providers",value:String(e.diagnostics.modelReadiness.authProviders.filter(e=>e.connected).length)}),(0,s.jsx)(aE,{label:"Routes",value:`${e.diagnostics.modelReadiness.availableModelCount}/${e.diagnostics.modelReadiness.totalModelCount}`})]}),o.systemReady?null:(0,s.jsxs)("div",{className:"rounded-[20px] border border-amber-400/15 bg-amber-400/[0.08] p-4",children:[(0,s.jsx)("p",{className:"text-[13px] font-medium text-amber-50",children:"Finish system setup first"}),(0,s.jsx)("p",{className:"mt-1.5 text-[12px] leading-5 text-amber-100/80",children:"Provider auth and model verification need a live OpenClaw gateway and writable runtime state."}),(0,s.jsx)("div",{className:"mt-3",children:(0,s.jsx)(I,{variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:f,children:"Open setup"})})]}),(0,s.jsx)("div",{className:"space-y-3",children:e.diagnostics.modelReadiness.authProviders.map(e=>(0,s.jsx)(aD,{provider:e,disabled:!o.systemReady||"running"===o.runState,onConnect:()=>b(e.provider)},e.provider))}),(0,s.jsxs)("div",{className:"rounded-[20px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.9),rgba(8,13,24,0.84))] p-4",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:"font-display text-[15px] text-white",children:"Default route"}),(0,s.jsx)("p",{className:"mt-1 text-[12px] leading-5 text-slate-400",children:"Pick the model AgentOS should prefer for live work, or discover new routes first."})]}),(0,s.jsxs)(C,{variant:"muted",children:[e.diagnostics.modelReadiness.localModelCount," local \xb7 ",e.diagnostics.modelReadiness.remoteModelCount," remote"]})]}),(0,s.jsxs)("label",{className:"mt-3 block",children:[(0,s.jsx)("span",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Default model"}),(0,s.jsxs)("select",{value:ey,onChange:e=>eh(e.target.value),className:"mt-1.5 h-10 w-full rounded-[14px] border border-white/[0.08] bg-white/[0.04] px-3 text-[12px] text-slate-100 outline-none",children:[(0,s.jsx)("option",{value:"",children:"Auto choose"}),ef.map(e=>(0,s.jsxs)("option",{value:e.id,children:[e.name," \xb7 ",e.provider]},e.id))]})]}),(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,s.jsx)(I,{variant:"default",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:w,children:"Add models"}),(0,s.jsx)(I,{variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",disabled:!o.systemReady||"running"===o.runState,onClick:()=>g(ey||void 0),children:"running"===o.runState?"Working...":"Use selected model"}),(0,s.jsx)(I,{variant:"ghost",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",disabled:!o.systemReady||"running"===o.runState,onClick:x,children:"Discover routes"})]}),e.diagnostics.modelReadiness.issues.length>0?(0,s.jsx)("div",{className:"mt-3 space-y-2",children:e.diagnostics.modelReadiness.issues.map(e=>(0,s.jsx)("div",{className:"rounded-[14px] border border-amber-400/15 bg-amber-400/[0.08] px-3 py-2 text-[12px] leading-5 text-amber-100",children:e},e))}):null]}),ev.length>0?(0,s.jsxs)("div",{className:"rounded-[20px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.9),rgba(8,13,24,0.84))] p-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-display text-[15px] text-white",children:"Discovered routes"}),(0,s.jsx)("p",{className:"mt-1 text-[12px] leading-5 text-slate-400",children:"Newly detected remote routes that are not configured in the current model deck yet."})]}),(0,s.jsx)(C,{variant:"muted",children:ev.length})]}),(0,s.jsx)("div",{className:"mt-3 space-y-2",children:ev.slice(0,6).map(e=>(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"truncate text-[13px] font-medium text-white",children:e.name}),(0,s.jsxs)("p",{className:"mt-1 text-[10px] uppercase tracking-[0.18em] text-slate-500",children:[aU(e.provider),e.isFree?" \xb7 free":"",e.supportsTools?" \xb7 tools":""]})]}),(0,s.jsx)(I,{variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",disabled:!o.systemReady||"running"===o.runState,onClick:()=>g(e.modelId),children:"Use"})]},e.modelId))})]}):null,(0,s.jsx)("div",{className:"space-y-3",children:e.models.slice(0,8).map(e=>(0,s.jsxs)("div",{className:"rounded-[18px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.9),rgba(8,13,24,0.84))] px-3.5 py-3",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 text-[13px] font-medium text-white",children:eF(e.id)}),(0,s.jsx)("p",{className:"mt-1 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:e.provider})]}),(0,s.jsx)(C,{variant:e.local?"success":e.missing?"danger":"muted",children:e.local?"local":e.missing?"missing":"remote"})]}),(0,s.jsxs)("div",{className:"mt-3 flex items-center justify-between text-[11px] text-slate-400",children:[(0,s.jsxs)("span",{children:[eL(e.contextWindow)," ctx"]}),(0,s.jsxs)("span",{children:[e.usageCount," agents"]})]})]},e.id))}),(0,s.jsx)(aL,{manager:o})]}):null]}),(0,s.jsx)("div",{className:"shrink-0 border-t border-white/[0.08] p-4",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-4 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)(aR.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:eb?.name||"No active workspace"}),(0,s.jsx)("p",{className:"mt-1 text-[12px] text-slate-400",children:eb?`${eb.agentIds.length} agents \xb7 ${eb.activeRuntimeIds.length} runs`:`${e.agents.length} agents \xb7 ${e.runtimes.length} runs`})]})]})})})]})})]}),(0,s.jsx)(G,{open:P,onOpenChange:_,children:(0,s.jsxs)(Q,{children:[(0,s.jsxs)(X,{children:[(0,s.jsx)(et,{children:"Edit OpenClaw workspace"}),(0,s.jsx)(ea,{children:"Renaming a workspace moves the real directory and updates every attached agent binding."})]}),H?(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)(aF,{label:"Workspace name",htmlFor:"edit-workspace-name",children:(0,s.jsx)(T,{id:"edit-workspace-name",value:H.name,onChange:e=>Z(t=>t?{...t,name:e.target.value}:t),placeholder:"Workspace name"})}),(0,s.jsxs)("div",{className:"rounded-[18px] border border-white/10 bg-white/[0.03] px-3.5 py-3",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:"Current path"}),(0,s.jsx)("p",{className:"mt-1.5 break-all font-mono text-xs text-slate-300",children:H.currentPath})]}),(0,s.jsx)(aF,{label:"Directory override",htmlFor:"edit-workspace-directory",children:(0,s.jsx)(T,{id:"edit-workspace-directory",value:H.directory,onChange:e=>Z(t=>t?{...t,directory:e.target.value}:t),placeholder:"Leave blank to rename in the same parent folder"})})]}):null,(0,s.jsxs)(ee,{children:[(0,s.jsx)(I,{variant:"secondary",onClick:()=>_(!1),children:"Cancel"}),(0,s.jsx)(I,{onClick:eq,disabled:L||!H?.name.trim(),children:L?"Saving…":"Save workspace"})]})]})}),(0,s.jsx)(G,{open:E,onOpenChange:D,children:(0,s.jsxs)(Q,{children:[(0,s.jsxs)(X,{children:[(0,s.jsx)(et,{children:"Delete OpenClaw workspace"}),(0,s.jsx)(ea,{children:"This permanently removes the workspace directory and all OpenClaw agents bound to it."})]}),Y?(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)("div",{className:"rounded-[20px] border border-rose-400/20 bg-rose-500/[0.08] px-4 py-3.5",children:(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("div",{className:"mt-0.5 rounded-full border border-rose-300/20 bg-rose-400/10 p-2 text-rose-200",children:(0,s.jsx)(i.A,{className:"h-4 w-4"})}),(0,s.jsxs)("div",{className:"space-y-1.5 text-sm text-rose-50",children:[(0,s.jsx)("p",{className:"font-medium",children:"This action cannot be undone."}),(0,s.jsx)("p",{className:"text-rose-100/80",children:"OpenClaw will remove the workspace folder from disk and prune the attached agents/state."})]})]})}),(0,s.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,s.jsx)(aK,{label:"Agents",value:String(eM.length)}),(0,s.jsx)(aK,{label:"Runs",value:String(eP.length)}),(0,s.jsx)(aK,{label:"Live agents",value:String(e$.length),danger:e$.length>0})]}),(0,s.jsxs)("div",{className:"rounded-[18px] border border-white/10 bg-white/[0.03] px-3.5 py-3",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:"Workspace path"}),(0,s.jsx)("p",{className:"mt-1.5 break-all font-mono text-xs text-slate-300",children:Y.path})]}),e$.length>0||eP.length>0?(0,s.jsx)("div",{className:"rounded-[18px] border border-amber-400/15 bg-amber-400/[0.08] px-3.5 py-3 text-sm text-amber-100",children:e$.length>0?`${e$.length} active or recently engaged agents are still attached to this workspace.`:`${eP.length} runtime records are still associated with this workspace.`}):null,(0,s.jsx)(aF,{label:`Type ${Y.slug} to confirm`,htmlFor:"delete-workspace-confirm",children:(0,s.jsx)(T,{id:"delete-workspace-confirm",value:er,onChange:e=>en(e.target.value),placeholder:Y.slug})})]}):null,(0,s.jsxs)(ee,{children:[(0,s.jsx)(I,{variant:"secondary",onClick:()=>{D(!1),es(null),en("")},children:"Cancel"}),(0,s.jsx)(I,{variant:"destructive",onClick:eV,disabled:L||!Y||er.trim()!==Y.slug,children:L?"Deleting…":"Delete workspace"})]})]})}),(0,s.jsx)(G,{open:W,onOpenChange:B,children:(0,s.jsxs)(Q,{children:[(0,s.jsxs)(X,{children:[(0,s.jsx)(et,{children:"Delete OpenClaw agent"}),(0,s.jsx)(ea,{children:"This removes the selected agent from OpenClaw and detaches its workspace binding."})]}),ei?(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)("div",{className:"rounded-[20px] border border-rose-400/20 bg-rose-500/[0.08] px-4 py-3.5",children:(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("div",{className:"mt-0.5 rounded-full border border-rose-300/20 bg-rose-400/10 p-2 text-rose-200",children:(0,s.jsx)(i.A,{className:"h-4 w-4"})}),(0,s.jsxs)("div",{className:"space-y-1.5 text-sm text-rose-50",children:[(0,s.jsx)("p",{className:"font-medium",children:"This action cannot be undone."}),(0,s.jsx)("p",{className:"text-rose-100/80",children:"OpenClaw will delete this agent, remove its config entry, remove its manifest record, and clean up agent-specific policy/state files. Shared workspace docs and files will remain."})]})]})}),(0,s.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,s.jsx)(aK,{label:"Status",value:ei.status,danger:eD}),(0,s.jsx)(aK,{label:"Runs",value:String(e_.length)}),(0,s.jsx)(aK,{label:"Workspace",value:eE?.name??"Unknown"})]}),(0,s.jsxs)("div",{className:"rounded-[18px] border border-white/10 bg-white/[0.03] px-3.5 py-3",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:"Agent id"}),(0,s.jsx)("p",{className:"mt-1.5 break-all font-mono text-xs text-slate-300",children:ei.id})]}),eD||e_.length>0?(0,s.jsx)("div",{className:"rounded-[18px] border border-amber-400/15 bg-amber-400/[0.08] px-3.5 py-3 text-sm text-amber-100",children:eD?"This agent is still active or recently engaged. Delete it only if you want to stop using it entirely.":`${e_.length} runtime records are still associated with this agent.`}):null,(0,s.jsx)(aF,{label:`Type ${ei.id} to confirm`,htmlFor:"delete-agent-confirm",children:(0,s.jsx)(T,{id:"delete-agent-confirm",value:eo,onChange:e=>ec(e.target.value),placeholder:ei.id})})]}):null,(0,s.jsxs)(ee,{children:[(0,s.jsx)(I,{variant:"secondary",onClick:()=>{B(!1),el(null),ec("")},children:"Cancel"}),(0,s.jsx)(I,{variant:"destructive",onClick:eK,disabled:q||!ei||eo.trim()!==ei.id,children:q?"Deleting…":"Delete agent"})]})]})}),(0,s.jsx)(G,{open:S,onOpenChange:A,children:(0,s.jsxs)(Q,{className:"max-h-[90vh] overflow-y-auto sm:max-w-3xl",children:[(0,s.jsxs)(X,{children:[(0,s.jsx)(et,{children:"Edit OpenClaw agent"}),(0,s.jsx)(ea,{children:"Update the selected agent identity, preset, and operating policy."})]}),K?(0,s.jsxs)("div",{className:"space-y-5",children:[(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("p",{className:"text-[11px] uppercase tracking-[0.18em] text-slate-400",children:"Agent preset"}),(0,s.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:eC.map(e=>(0,s.jsx)(az,{label:e.label,description:e.description,active:K.policy.preset===e.value,badgeVariant:ek[e.value].badgeVariant,onClick:()=>J(t=>{var a,s;let r,n,i;return t?(a=t,s=e.value,r=ek[a.policy.preset],n=ek[s],i=eO(s),{...a,name:a.name&&a.name!==r.defaultName?a.name:n.defaultName,emoji:a.emoji&&a.emoji!==r.defaultEmoji?a.emoji:n.defaultEmoji,theme:a.theme&&a.theme!==r.defaultTheme?a.theme:n.defaultTheme,policy:i,heartbeat:tk(a.heartbeat,a.policy.preset,s)}):t})},e.value))})]}),(0,s.jsx)(aW,{policy:K.policy}),(0,s.jsx)(aF,{label:"Agent id",htmlFor:"edit-agent-id",children:(0,s.jsx)(T,{id:"edit-agent-id",value:K.id,disabled:!0})}),(0,s.jsx)(aF,{label:"Display name",htmlFor:"edit-agent-name",children:(0,s.jsx)(T,{id:"edit-agent-name",value:K.name,onChange:e=>J(t=>t?{...t,name:e.target.value}:t),placeholder:ek[K.policy.preset].defaultName})}),(0,s.jsx)(aF,{label:"Workspace",htmlFor:"edit-agent-workspace",children:(0,s.jsx)(T,{id:"edit-agent-workspace",value:e.workspaces.find(e=>e.id===K.workspaceId)?.name||K.workspaceId,disabled:!0})}),(0,s.jsx)(aF,{label:"Model",htmlFor:"edit-agent-model",children:(0,s.jsxs)("select",{id:"edit-agent-model",value:K.modelId,onChange:e=>J(t=>t?{...t,modelId:e.target.value}:t),className:"flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white outline-none",children:[(0,s.jsx)("option",{value:"",children:"Use OpenClaw default"}),e.models.map(e=>(0,s.jsx)("option",{value:e.id,children:e.id},e.id))]})}),(0,s.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,s.jsx)(aF,{label:"Emoji",htmlFor:"edit-agent-emoji",children:(0,s.jsx)(T,{id:"edit-agent-emoji",value:K.emoji,onChange:e=>J(t=>t?{...t,emoji:e.target.value}:t),placeholder:ek[K.policy.preset].defaultEmoji})}),(0,s.jsx)(aF,{label:"Theme",htmlFor:"edit-agent-theme",children:(0,s.jsx)(T,{id:"edit-agent-theme",value:K.theme,onChange:e=>J(t=>t?{...t,theme:e.target.value}:t),placeholder:ek[K.policy.preset].defaultTheme})})]}),(0,s.jsx)(aF,{label:"Avatar URL",htmlFor:"edit-agent-avatar",children:(0,s.jsx)(T,{id:"edit-agent-avatar",value:K.avatar,onChange:e=>J(t=>t?{...t,avatar:e.target.value}:t),placeholder:"https://example.com/avatar.png"})}),(0,s.jsxs)("div",{className:"rounded-[20px] border border-white/10 bg-white/[0.03] p-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium text-white",children:"Advanced policy"}),(0,s.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:"Override how this agent handles missing tools, installs, file scope, and network usage."})]}),(0,s.jsx)(I,{type:"button",variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>R(e=>!e),children:O?"Hide":"Show"})]}),ej?(0,s.jsxs)("div",{className:"mt-4 rounded-[18px] border border-white/10 bg-slate-950/40 p-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium text-white",children:"Heartbeat"}),(0,s.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:"Use this only for periodic watch or triage agents. Leave it off for normal task execution."})]}),(0,s.jsx)(I,{type:"button",variant:K.heartbeat.enabled?"default":"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>J(e=>e?{...e,heartbeat:e.heartbeat.enabled?{...e.heartbeat,enabled:!1}:{...e.heartbeat,enabled:!0,every:e.heartbeat.every||ty(e.policy.preset).every}}:e),children:K.heartbeat.enabled?"On":"Off"})]}),K.heartbeat.enabled?(0,s.jsx)("div",{className:"mt-3",children:(0,s.jsx)(aF,{label:"Interval",htmlFor:"edit-agent-heartbeat-every",children:(0,s.jsx)("select",{id:"edit-agent-heartbeat-every",value:K.heartbeat.every,onChange:e=>J(t=>t?{...t,heartbeat:{...t.heartbeat,every:e.target.value}}:t),className:"flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white outline-none",children:tv.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))})})}):null]}):null,O?(0,s.jsxs)("div",{className:"mt-4 grid gap-4 sm:grid-cols-2",children:[(0,s.jsx)(aB,{label:"Missing tool behavior",htmlFor:"edit-agent-missing-tools",value:K.policy.missingToolBehavior,options:eS,onChange:e=>J(t=>t?{...t,policy:{...t.policy,missingToolBehavior:e}}:t)}),(0,s.jsx)(aB,{label:"Install scope",htmlFor:"edit-agent-install-scope",value:K.policy.installScope,options:eA,onChange:e=>J(t=>t?{...t,policy:{...t.policy,installScope:e}}:t)}),(0,s.jsx)(aB,{label:"File access",htmlFor:"edit-agent-file-access",value:K.policy.fileAccess,options:eI,onChange:e=>J(t=>t?{...t,policy:{...t.policy,fileAccess:e}}:t)}),(0,s.jsx)(aB,{label:"Network access",htmlFor:"edit-agent-network-access",value:K.policy.networkAccess,options:eT,onChange:e=>J(t=>t?{...t,policy:{...t.policy,networkAccess:e}}:t)})]}):null]})]}):null,(0,s.jsxs)(ee,{children:[(0,s.jsx)(I,{variant:"secondary",onClick:()=>A(!1),children:"Cancel"}),(0,s.jsx)(I,{onClick:eW,disabled:M||!K,children:M?"Saving…":"Save changes"})]})]})})]})}function a$({icon:e,label:t,active:a,onClick:r}){return(0,s.jsx)("button",{type:"button",onClick:r,title:t,className:k("inline-flex h-11 w-11 items-center justify-center rounded-[16px] border transition-all",a?"border-cyan-300/20 bg-cyan-400 text-slate-950 shadow-[0_12px_28px_rgba(96,165,250,0.35)]":"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-4 w-4"})})}function aP({label:e,badge:t,active:a,onClick:r}){return(0,s.jsxs)("button",{type:"button",onClick:r,className:k("inline-flex items-center gap-2 rounded-full border px-3 py-2 text-[11px] uppercase tracking-[0.18em] transition-all",a?"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:[(0,s.jsx)("span",{children:e}),t?(0,s.jsx)("span",{className:k("rounded-full px-1.5 py-0.5 text-[10px] tracking-normal",a?"bg-slate-950/14 text-slate-950":"bg-white/[0.08] text-slate-400"),children:t}):null]})}function a_({eyebrow:e,title:t,detail:a,action:r}){return(0,s.jsxs)("div",{className:"flex items-end justify-between gap-4",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:e}),(0,s.jsx)("h2",{className:"mt-1.5 font-display text-[1.02rem] text-white",children:t}),(0,s.jsx)("p",{className:"mt-1.5 text-[12px] leading-5 text-slate-400",children:a})]}),r?(0,s.jsx)("div",{className:"shrink-0",children:r}):null]})}function aE({label:e,value:t}){return(0,s.jsxs)("div",{className:"rounded-[18px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.88),rgba(7,12,22,0.82))] px-3.5 py-3",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:e}),(0,s.jsx)("p",{className:"mt-1.5 font-display text-[1.2rem] text-white",children:t})]})}function aD({provider:e,disabled:t,onConnect:a}){var r;let n="openai-codex"===e.provider?"Connect ChatGPT":"openrouter"===e.provider?"Add API key":"Connect";return(0,s.jsxs)("div",{className:"rounded-[20px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.9),rgba(8,13,24,0.84))] p-4",children:[(0,s.jsx)("div",{className:"flex items-start justify-between gap-3",children:(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("p",{className:"truncate font-display text-[15px] text-white",children:aU(e.provider)}),(0,s.jsx)(C,{variant:e.connected?"success":e.canLogin?"warning":"muted",children:e.connected?"connected":e.canLogin?"needs auth":"local"})]}),(0,s.jsx)("p",{className:"mt-1 text-[12px] leading-5 text-slate-400",children:e.detail||("openai-codex"===(r=e.provider)?"Use the OpenClaw OpenAI Codex route. If your ChatGPT plan includes Codex access, connect that account here.":"openrouter"===r?"Paste an API key to unlock OpenRouter-hosted routes.":"ollama"===r?"Local model provider. Pull models locally to make new routes available.":"Connect this provider to make its remote routes available inside AgentOS.")})]})}),(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.canLogin?(0,s.jsx)(I,{variant:e.connected?"ghost":"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",disabled:t,onClick:a,children:n}):null,"openai-codex"===e.provider?(0,s.jsx)(C,{variant:"muted",children:"ChatGPT/Codex route"}):null]})]})}function aL({manager:e}){var t;let[a,n]=(0,m.useState)(!1),i=!!e.manualCommand?.trim().startsWith("openclaw "),l=e.statusMessage||e.resultMessage||"Refresh provider status, connect a route, or choose a default model to keep AgentOS ready.",o=async()=>{if(e.manualCommand)try{await navigator.clipboard.writeText(e.manualCommand),ed.o.success("Command copied.",{description:"Open Terminal and paste the command to continue model setup."})}catch(e){ed.o.error("Could not copy command.",{description:e instanceof Error?e.message:"Clipboard access is unavailable."})}},d=async()=>{if(e.manualCommand&&i){n(!0);try{let t=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e.manualCommand})}),a=await t.json().catch(()=>null);if(!t.ok||a?.error)throw Error(a?.error||"Unable to open Terminal.");ed.o.success("Terminal opened.",{description:"Finish the OpenClaw provider flow there, then return and refresh this panel."})}catch(e){ed.o.error("Could not open Terminal.",{description:e instanceof Error?e.message:"Open Terminal manually and run the command below."})}finally{n(!1)}}};return(0,s.jsxs)("div",{className:"rounded-[20px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.9),rgba(8,13,24,0.84))] p-4",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.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("p",{className:"font-display text-[15px] text-white",children:"Model setup console"}),(0,s.jsx)(C,{variant:"success"===(t=e.runState)?"success":"error"===t?"warning":"running"===t?"default":"muted",children:"idle"===e.runState?"idle":e.runState})]}),(0,s.jsx)("p",{className:"mt-1 text-[12px] leading-5 text-slate-400",children:l})]}),"running"===e.runState?(0,s.jsx)(r.A,{className:"mt-0.5 h-4 w-4 animate-spin text-cyan-200"}):(0,s.jsx)(L.A,{className:"mt-0.5 h-4 w-4 text-cyan-200"})]}),(0,s.jsx)("pre",{className:"mt-3 max-h-[180px] overflow-auto rounded-[16px] border border-white/[0.08] bg-slate-950/[0.72] px-3 py-2.5 font-mono text-[10px] leading-5 text-slate-300",children:e.log||"No model-management output yet.\n\nProvider auth and model actions will stream here."}),e.manualCommand?(0,s.jsxs)("div",{className:"mt-3 rounded-[16px] 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:"Manual command"}),(0,s.jsx)("p",{className:"mt-1.5 break-all font-mono text-[11px] leading-5 text-slate-200",children:e.manualCommand}),(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,s.jsxs)(I,{variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:o,children:[(0,s.jsx)(x.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy command"]}),i?(0,s.jsx)(I,{variant:"ghost",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:d,disabled:a,children:a?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Opening..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Open Terminal"]})}):null]}),e.docsUrl?(0,s.jsx)("a",{href:e.docsUrl,target:"_blank",rel:"noreferrer",className:"mt-3 inline-flex items-center gap-1 text-[11px] text-slate-300 underline underline-offset-4",children:"Setup docs"}):null]}):null]})}function aU(e){let t=e.trim().toLowerCase();return"openrouter"===t?"OpenRouter":"openai-codex"===t?"OpenAI Codex":"openai"===t?"OpenAI":"anthropic"===t?"Anthropic":"ollama"===t?"Ollama":e.split("-").map(e=>e?e[0].toUpperCase()+e.slice(1):e).join(" ")}function aF({label:e,htmlFor:t,children:a}){return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(tw,{htmlFor:t,className:"text-[11px] uppercase tracking-[0.18em] text-slate-400",children:e}),a]})}function az({label:e,description:t,active:a,badgeVariant:r,onClick:n}){return(0,s.jsx)("button",{type:"button",onClick:n,className:k("rounded-[20px] border p-4 text-left transition-colors",a?"border-cyan-300/30 bg-cyan-400/10":"border-white/10 bg-white/[0.03]"),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-sm font-medium text-white",children:e}),(0,s.jsx)("p",{className:"text-xs leading-5 text-slate-400",children:t})]}),(0,s.jsx)(C,{variant:r,children:a?"selected":"preset"})]})})}function aW({policy:e}){let t=ek[e.preset];return(0,s.jsxs)("div",{className:"rounded-[20px] border border-white/10 bg-slate-950/50 p-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-medium text-white",children:t.label}),(0,s.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:t.description})]}),(0,s.jsx)(C,{variant:t.badgeVariant,children:t.label})]}),(0,s.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,s.jsx)(C,{variant:"muted",children:eM(e.missingToolBehavior)}),(0,s.jsx)(C,{variant:"muted",children:e$(e.installScope)}),(0,s.jsx)(C,{variant:"muted",children:eP(e.fileAccess)}),(0,s.jsxs)(C,{variant:"muted",children:["Network ",e_(e.networkAccess)]})]})]})}function aB({label:e,htmlFor:t,value:a,options:r,onChange:n}){return(0,s.jsx)(aF,{label:e,htmlFor:t,children:(0,s.jsx)("select",{id:t,value:a,onChange:e=>n(e.target.value),className:"flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white outline-none",children:r.map(e=>(0,s.jsxs)("option",{value:e.value,children:[e.label," - ",e.description]},e.value))})})}function aq({agentName:e,onEdit:t,onDelete:a}){let[r,n]=(0,m.useState)(!1),i=(0,m.useRef)(null);return(0,m.useEffect)(()=>{if(!r)return;let e=e=>{i.current?.contains(e.target)||n(!1)};return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e)},[r]),(0,s.jsxs)("div",{className:"relative",ref:i,children:[(0,s.jsx)("button",{type:"button","aria-label":`${e} actions`,onClick:()=>n(e=>!e),className:"inline-flex rounded-full border border-white/[0.08] bg-white/[0.05] p-1.5 text-slate-300 transition-colors hover:bg-white/[0.1] hover:text-white",children:(0,s.jsx)(eg.A,{className:"h-3.5 w-3.5"})}),r?(0,s.jsxs)("div",{className:"absolute right-0 top-[calc(100%+8px)] z-30 min-w-[136px] rounded-[14px] border border-white/[0.1] bg-slate-950/96 p-1.5 shadow-[0_20px_44px_rgba(0,0,0,0.42)] backdrop-blur-xl",children:[(0,s.jsx)(aV,{label:"Edit",onClick:()=>{n(!1),t()}}),(0,s.jsx)(aV,{label:"Delete",danger:!0,onClick:()=>{n(!1),a()}})]}):null]})}function aV({label:e,onClick:t,danger:a=!1}){return(0,s.jsx)("button",{type:"button",className:k("flex w-full items-center rounded-[10px] px-2.5 py-2 text-left text-[11px] transition-colors",a?"text-rose-200 hover:bg-rose-400/10 hover:text-rose-100":"text-slate-200 hover:bg-white/[0.06] hover:text-white"),onClick:t,children:(0,s.jsx)("span",{children:e})})}function aK({label:e,value:t,danger:a=!1}){return(0,s.jsxs)("div",{className:k("rounded-[18px] border px-3.5 py-3",a?"border-amber-300/20 bg-amber-400/[0.08]":"border-white/10 bg-white/[0.03]"),children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:e}),(0,s.jsx)("p",{className:k("mt-1.5 font-display text-lg",a?"text-amber-100":"text-white"),children:t})]})}var aJ=a(2235);function aG({progress:e,className:t}){return(0,s.jsxs)("div",{className:k("rounded-[18px] border border-white/10 bg-slate-950/50 p-4",t),children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"max-w-2xl",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:e.title}),(0,s.jsx)("p",{className:"mt-2 text-sm text-slate-200",children:e.description})]}),(0,s.jsxs)("div",{className:"shrink-0 text-right",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Progress"}),(0,s.jsxs)("p",{className:"mt-1 text-lg font-semibold text-white",children:[e.percent,"%"]})]})]}),(0,s.jsx)("div",{className:"mt-4 h-2 overflow-hidden rounded-full bg-white/8",children:(0,s.jsx)("div",{className:"h-full rounded-full bg-cyan-300/85 transition-[width] duration-500 ease-out",style:{width:`${e.percent}%`}})}),(0,s.jsx)("div",{className:"mt-4 space-y-2.5",children:e.steps.map((e,t)=>{let a="done"===e.status?"border-emerald-400/20 bg-emerald-400/10":"active"===e.status?"border-cyan-400/25 bg-cyan-400/10":"error"===e.status?"border-amber-400/25 bg-amber-400/10":"border-white/10 bg-white/[0.03]",n="done"===e.status?"border-emerald-300/30 bg-emerald-300/15 text-emerald-100":"active"===e.status?"border-cyan-300/30 bg-cyan-300/15 text-cyan-100":"error"===e.status?"border-amber-300/30 bg-amber-300/15 text-amber-100":"border-white/10 bg-slate-950/65 text-slate-400",l="done"===e.status?"bg-emerald-300/85":"active"===e.status?"bg-cyan-300/85":"error"===e.status?"bg-amber-300/85":"bg-transparent";return(0,s.jsx)("div",{className:k("rounded-[14px] border px-3 py-2.5 transition-colors",a),children:(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("span",{className:k("mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full border text-[10px] font-medium",n),children:"done"===e.status?(0,s.jsx)(w.A,{className:"h-3.5 w-3.5"}):"active"===e.status?(0,s.jsx)(r.A,{className:"h-3.5 w-3.5 animate-spin"}):"error"===e.status?(0,s.jsx)(i.A,{className:"h-3.5 w-3.5"}):t+1}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[(0,s.jsx)("p",{className:"text-sm text-white",children:e.label}),(0,s.jsxs)("span",{className:"text-xs tabular-nums text-slate-400",children:[e.percent,"%"]})]}),(0,s.jsx)("p",{className:"mt-0.5 text-xs leading-5 text-slate-400",children:e.detail||e.description}),(0,s.jsx)("div",{className:"mt-2 h-1.5 overflow-hidden rounded-full bg-white/8",children:(0,s.jsx)("div",{className:k("h-full rounded-full transition-[width] duration-500 ease-out",l),style:{width:`${e.percent}%`}})}),e.activities.length>0?(0,s.jsx)("div",{className:"mt-2.5 space-y-1.5",children:e.activities.map(e=>(0,s.jsxs)("div",{className:"flex items-start gap-2 text-[11px] leading-5 text-slate-300",children:[(0,s.jsx)("span",{className:k("mt-[7px] 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-amber-300","pending"===e.status&&"bg-slate-500")}),(0,s.jsx)("span",{className:"min-w-0",children:e.message})]},e.id))}):null]})]})},e.id)})})]})}var aH=a(3201),aZ=a(6492),aY=a(1266),aQ=a(4294),aX=a(9560),a0=a(7646),a1=a(3813),a2=a(8074),a5=a(4448),a3=a(9182);let a4=[{id:"company",label:"Company",icon:a2.A},{id:"product",label:"Product",icon:a5.A},{id:"workspace",label:"Workspace",icon:a3.A},{id:"team",label:"Team",icon:z.A},{id:"operations",label:"Operations",icon:aR.A},{id:"deploy",label:"Deploy",icon:aH.A}],a8=[{id:"intake",label:"Intake",section:"company"},{id:"context-harvest",label:"Context",section:"workspace"},{id:"team-synthesis",label:"Team",section:"team"},{id:"pressure-test",label:"Review",section:"operations"},{id:"decision-lock",label:"Lock",section:"deploy"},{id:"ready",label:"Ready",section:"deploy"},{id:"deploying",label:"Deploying",section:"deploy"},{id:"deployed",label:"Live",section:"deploy"}];function a6(e){return a8.find(t=>t.id===e)?.section??"company"}function a9(e){return a8.find(t=>t.id===e)?.label??"Draft"}function a7(e,t){switch(t){case"company":{let t=[e.company.name,e.company.mission,e.company.targetCustomer].filter(e=>!e.trim()).length;return 0===t?{label:"Ready to review",variant:"success"}:{label:`${t} core field${1===t?"":"s"} missing`,variant:"warning"}}case"product":{let t=[+!e.product.offer.trim(),e.product.scopeV1.length>0?0:1,e.product.launchPriority.length>0?0:1].reduce((e,t)=>e+t,0);return 0===t?{label:"Scope is defined",variant:"success"}:{label:`${t} product decision${1===t?"":"s"} pending`,variant:"warning"}}case"workspace":{let t=+!e.workspace.name.trim();return"clone"!==e.workspace.sourceMode||e.workspace.repoUrl?.trim()||(t+=1),"existing"!==e.workspace.sourceMode||e.workspace.existingPath?.trim()||(t+=1),0===t?{label:"Provisioning path set",variant:"success"}:{label:`${t} workspace input${1===t?"":"s"} missing`,variant:"warning"}}case"team":{let t=e.team.persistentAgents.filter(e=>e.enabled).length,a=e.team.persistentAgents.some(e=>e.enabled&&e.isPrimary);if(0===t)return{label:"Add at least one agent",variant:"danger"};if(!a)return{label:"Primary agent missing",variant:"warning"};return{label:`${t} active agent${1===t?"":"s"}`,variant:"success"}}case"operations":{let t=e.operations.workflows.filter(e=>e.enabled).length,a=e.operations.automations.filter(e=>e.enabled).length;if(0===t&&0===a)return{label:"No runtime loops yet",variant:"warning"};return{label:`${t} workflows, ${a} automations`,variant:"success"}}default:if(!e.intake.reviewRequested&&"deploying"!==e.status&&"deployed"!==e.status)return{label:"Review not opened yet",variant:"muted"};if(e.deploy.blockers.length>0)return{label:`${e.deploy.blockers.length} blocker${1===e.deploy.blockers.length?"":"s"}`,variant:"danger"};if(e.deploy.warnings.length>0)return{label:`${e.deploy.warnings.length} warning${1===e.deploy.warnings.length?"":"s"}`,variant:"warning"};return{label:"Ready to deploy",variant:"success"}}}function se(e,t){switch(t){case"company":return e.company.name?`${e.company.name}${e.company.mission?` \xb7 ${e.company.mission}`:""}`:"Mission and audience are still being shaped.";case"product":return e.product.offer||"Offer and V1 scope are still being drafted.";case"workspace":return`${st(e.workspace.template)} \xb7 ${st(e.workspace.sourceMode)}`;case"team":return`${e.team.persistentAgents.filter(e=>e.enabled).length} agents drafted`;case"operations":return`${e.operations.workflows.filter(e=>e.enabled).length} workflows \xb7 ${e.operations.automations.filter(e=>e.enabled).length} automations`;default:return e.intake.reviewRequested?"Deploy review is open.":"Review not started."}}function st(e){return e.split(/[-_]/g).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}let sa={workspaceOnly:!0,generateStarterDocs:!0,generateMemory:!0,kickoffMission:!0},ss={software:[{id:"builder",role:"Builder",name:"Builder",emoji:"\uD83D\uDEE0️",theme:"amber",skillId:"project-builder",isPrimary:!0,description:"Implements requested changes and drives delivery forward."},{id:"reviewer",role:"Reviewer",name:"Reviewer",emoji:"\uD83D\uDD0D",theme:"rose",skillId:"project-reviewer",description:"Reviews work for correctness, regressions, and product risk."},{id:"tester",role:"Tester",name:"Tester",emoji:"\uD83E\uDDEA",theme:"emerald",skillId:"project-tester",description:"Validates behavior, tests, and environment assumptions."},{id:"learner",role:"Learner",name:"Learner",emoji:"\uD83E\uDDE0",theme:"cyan",skillId:"project-learner",description:"Consolidates durable project knowledge and memory."}],frontend:[{id:"builder",role:"Builder",name:"Builder",emoji:"\uD83D\uDEE0️",theme:"amber",skillId:"project-builder",isPrimary:!0,description:"Implements UI and frontend product work."},{id:"reviewer",role:"Reviewer",name:"Reviewer",emoji:"\uD83D\uDD0D",theme:"rose",skillId:"project-reviewer",description:"Reviews interaction, correctness, and regression risk."},{id:"tester",role:"Tester",name:"Tester",emoji:"\uD83E\uDDEA",theme:"emerald",skillId:"project-tester",description:"Checks behavior, responsive states, and verification gaps."},{id:"learner",role:"Learner",name:"Learner",emoji:"\uD83E\uDDE0",theme:"cyan",skillId:"project-learner",description:"Maintains stable product and implementation knowledge."},{id:"browser",role:"Browser Agent",name:"Browser Agent",emoji:"\uD83C\uDF10",theme:"blue",skillId:"project-browser",description:"Exercises browser flows, captures UI evidence, and validates user paths."}],backend:[{id:"builder",role:"Builder",name:"Builder",emoji:"\uD83D\uDEE0️",theme:"amber",skillId:"project-builder",isPrimary:!0,description:"Implements service, API, and infrastructure changes."},{id:"reviewer",role:"Reviewer",name:"Reviewer",emoji:"\uD83D\uDD0D",theme:"rose",skillId:"project-reviewer",description:"Catches correctness, data handling, and operational risks."},{id:"tester",role:"Tester",name:"Tester",emoji:"\uD83E\uDDEA",theme:"emerald",skillId:"project-tester",description:"Validates APIs, background jobs, migrations, and failure paths."},{id:"learner",role:"Learner",name:"Learner",emoji:"\uD83E\uDDE0",theme:"cyan",skillId:"project-learner",description:"Maintains architecture notes and durable operational memory."}],research:[{id:"researcher",role:"Research Lead",name:"Research Lead",emoji:"\uD83D\uDD2C",theme:"violet",skillId:"project-researcher",isPrimary:!0,description:"Runs investigations, frames questions, and synthesizes findings."},{id:"reviewer",role:"Reviewer",name:"Reviewer",emoji:"\uD83D\uDD0D",theme:"rose",skillId:"project-reviewer",description:"Pressure-tests claims, assumptions, and interpretation quality."},{id:"learner",role:"Archivist",name:"Archivist",emoji:"\uD83E\uDDE0",theme:"cyan",skillId:"project-learner",description:"Distills durable research notes, memory, and takeaways."}],content:[{id:"strategist",role:"Strategist",name:"Strategist",emoji:"\uD83D\uDCE3",theme:"orange",skillId:"project-strategist",isPrimary:!0,description:"Frames audience, goals, positioning, and campaign direction."},{id:"writer",role:"Writer",name:"Writer",emoji:"✍️",theme:"sky",skillId:"project-writer",description:"Drafts content, messaging, and campaign assets."},{id:"reviewer",role:"Reviewer",name:"Reviewer",emoji:"\uD83D\uDD0D",theme:"rose",skillId:"project-reviewer",description:"Edits for clarity, quality, and consistency."},{id:"analyst",role:"Analyst",name:"Analyst",emoji:"\uD83D\uDCC8",theme:"emerald",skillId:"project-analyst",description:"Tracks results, experiments, and performance insights."}]};function sr(e,t){let a=["AGENTS.md","SOUL.md","IDENTITY.md","TOOLS.md","HEARTBEAT.md"];return t.generateMemory&&a.push("MEMORY.md","memory/blueprint.md","memory/decisions.md"),t.generateStarterDocs&&a.push("docs/brief.md","docs/architecture.md","deliverables/README.md"),"frontend"===e&&a.push("docs/ux-notes.md"),"backend"===e&&a.push("docs/service-map.md"),"research"===e&&a.push("docs/research-plan.md"),"content"===e&&a.push("docs/content-brief.md"),a}let sn=Object.fromEntries([{value:"software",label:"Software project",description:"Balanced software delivery setup for product and engineering work."},{value:"frontend",label:"Frontend app",description:"UI-focused team with browser coverage and product-facing documentation."},{value:"backend",label:"Backend/API",description:"Service and API template with strong testing and delivery defaults."},{value:"research",label:"Research",description:"Exploration-first workspace for investigation, synthesis, and durable notes."},{value:"content",label:"Content/Growth",description:"Campaign and content setup for strategy, writing, review, and analytics."}].map(e=>[e.value,e.label]));function si({className:e,surfaceTheme:t,mode:a,snapshot:r,plan:n,resolvedName:i,resolvedTemplate:l,sourceAnalysis:o,workspacePath:d,notice:c,basicRules:p,basicPreset:u,onBasicPresetChange:h,onBasicRuleToggle:x,progress:g}){let b="light"===t,f=(0,m.useRef)({}),w=(0,m.useRef)(null),[v,y]=(0,m.useState)(null),j=(0,m.useMemo)(()=>(function({mode:e,plan:t,notice:a,progress:s,resolvedName:r,resolvedTemplate:n,basicRules:i,basicPreset:l,sourceAnalysis:o,workspacePath:d}){return{mode:e,noticeSignature:a?`${a.tone}:${a.title}:${a.description}`:"",progressSignature:s?JSON.stringify(s):"",basic:{architectSignature:t?`${t.architectSummary}:${t.intake.confirmations.join("|")}`:"",summarySignature:[r,n,o.kind,o.label,o.hint,o.repoUrl??"",o.existingPath??"",o.websiteUrl??"",d].join(":"),defaultsSignature:`${l}:${i.generateStarterDocs}:${i.generateMemory}:${i.kickoffMission}`},advanced:{stage:t?.stage??null,readinessSignature:t?`${t.readinessScore}:${t.architectSummary}`:"",deploySignature:t?`${t.intake.reviewRequested}:${t.deploy.blockers.join("|")}:${t.deploy.warnings.join("|")}`:"",sectionSignatures:Object.fromEntries(a4.map(e=>[e.id,t?`${a7(t,e.id).label}:${a7(t,e.id).variant}:${se(t,e.id)}`:""]))}}})({mode:a,plan:n,notice:c,progress:g,resolvedName:i,resolvedTemplate:l,basicRules:p,basicPreset:u,sourceAnalysis:o,workspacePath:d}),[u,p,a,c,n,g,i,l,o,d]);return(0,m.useEffect)(()=>{let e=w.current;if(w.current=j,!e)return;let t=function(e,t){if(e.mode!==t.mode)return"basic"===t.mode?t.basic.architectSignature?"architect-readout":"summary":t.advanced.stage?`section-${a6(t.advanced.stage)}`:"readiness";if(e.noticeSignature!==t.noticeSignature&&t.noticeSignature)return"notice";if(e.progressSignature!==t.progressSignature&&t.progressSignature)return"progress";if("basic"===t.mode)return e.basic.architectSignature!==t.basic.architectSignature&&t.basic.architectSignature?"architect-readout":e.basic.summarySignature!==t.basic.summarySignature?"summary":e.basic.defaultsSignature!==t.basic.defaultsSignature?"defaults":null;if(e.advanced.deploySignature!==t.advanced.deploySignature&&t.advanced.deploySignature)return"deploy-review";if(e.advanced.stage!==t.advanced.stage&&t.advanced.stage)return`section-${a6(t.advanced.stage)}`;if(e.advanced.readinessSignature!==t.advanced.readinessSignature&&t.advanced.readinessSignature)return"readiness";for(let a of a4)if(e.advanced.sectionSignatures[a.id]!==t.advanced.sectionSignatures[a.id])return`section-${a.id}`;return null}(e,j);t&&y(t)},[j]),(0,m.useEffect)(()=>{if(!v)return;let e=f.current[v];e&&globalThis.requestAnimationFrame(()=>{e.scrollIntoView({behavior:"smooth",block:"center"})});let t=globalThis.setTimeout(()=>{y(e=>e===v?null:e)},2200);return()=>{globalThis.clearTimeout(t)}},[v]),(0,s.jsx)("aside",{className:k("min-h-0 border-t lg:border-l lg:border-t-0",b?"border-[#ebe5dd] bg-[#f7f2eb]":"border-white/10 bg-[rgba(5,9,18,0.92)]",e),children:(0,s.jsx)(ey,{className:"h-full",children:(0,s.jsxs)("div",{className:"space-y-4 p-4 md:p-5",children:[(0,s.jsx)(so,{surfaceTheme:t,title:"basic"===a?"Workspace draft":"Workspace blueprint",subtitle:"basic"===a?"Architect is filling this live while the fast create path stays available.":"Live structured view of what Architect is shaping through conversation."}),(0,s.jsx)(sl,{sectionKey:"setup-speed",activeSection:v,surfaceTheme:t,register:e=>{f.current["setup-speed"]=e},children:(0,s.jsx)(su,{surfaceTheme:t,mode:a,preset:u,onPresetChange:h})}),c?(0,s.jsx)(sl,{sectionKey:"notice",activeSection:v,surfaceTheme:t,register:e=>{f.current.notice=e},children:(0,s.jsxs)("div",{className:k("rounded-[18px] border px-4 py-3","warning"===c.tone?b?"border-amber-200 bg-amber-50 text-amber-900":"border-amber-400/25 bg-amber-400/10 text-amber-100":b?"border-[#e3ddd4] bg-white text-[#3f3933]":"border-white/10 bg-white/[0.04] text-slate-200"),children:[(0,s.jsx)("p",{className:k("text-[11px] uppercase tracking-[0.18em]",b?"text-[#9c9389]":"text-slate-500"),children:c.title}),(0,s.jsx)("p",{className:"mt-1 text-[13px] leading-6",children:c.description})]})}):null,g?(0,s.jsx)(sl,{sectionKey:"progress",activeSection:v,surfaceTheme:t,register:e=>{f.current.progress=e},children:(0,s.jsx)(aG,{progress:g,className:k(b?"border-[#e5ded3] bg-white text-slate-900 [&_p]:text-inherit":"border-white/10 bg-slate-950/50")})}):null,"basic"===a?(0,s.jsxs)("div",{className:"space-y-3",children:[n?(0,s.jsx)(sl,{sectionKey:"architect-readout",activeSection:v,surfaceTheme:t,register:e=>{f.current["architect-readout"]=e},children:(0,s.jsx)("div",{className:k("rounded-[22px] border p-4",b?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("span",{className:k("inline-flex size-9 shrink-0 items-center justify-center rounded-full border",b?"border-[#e7e0d6] bg-[#faf6f1] text-[#5e5750]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,s.jsx)(z.A,{className:"h-4 w-4"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:k("text-[11px] uppercase tracking-[0.18em]",b?"text-[#a0978b]":"text-slate-500"),children:"Architect readout"}),(0,s.jsx)("p",{className:k("mt-1 text-[13px] leading-6",b?"text-[#171410]":"text-white"),children:n.architectSummary}),n.intake.confirmations.length>0?(0,s.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,s.jsx)("p",{className:k("text-[11px] uppercase tracking-[0.16em]",b?"text-[#8d8276]":"text-slate-500"),children:"Next decisions"}),n.intake.confirmations.slice(0,2).map(e=>(0,s.jsx)("div",{className:k("rounded-[16px] border px-3 py-2 text-[12px] leading-5",b?"border-[#e8e0d6] bg-[#faf6f1] text-[#5d554d]":"border-white/10 bg-white/[0.05] text-slate-300"),children:e},e))]}):null]})]})})}):null,(0,s.jsx)(sl,{sectionKey:"summary",activeSection:v,surfaceTheme:t,register:e=>{f.current.summary=e},children:(0,s.jsx)(sd,{surfaceTheme:t,resolvedName:i,resolvedTemplate:l,sourceAnalysis:o,workspacePath:d,workspaceRoot:r.diagnostics.workspaceRoot,summaryLabel:n?"Updated from Architect's latest read of the conversation.":"Resolved from your quick setup."})}),(0,s.jsx)(sl,{sectionKey:"defaults",activeSection:v,surfaceTheme:t,register:e=>{f.current.defaults=e},children:(0,s.jsxs)("div",{className:k("rounded-[22px] border p-4",b?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:[(0,s.jsx)("p",{className:k("text-[11px] uppercase tracking-[0.18em]",b?"text-[#a0978b]":"text-slate-500"),children:"Fast-path defaults"}),(0,s.jsx)(sm,{surfaceTheme:t,template:l,rules:p,preset:u,onRuleToggle:x})]})})]}):n?(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)(sl,{sectionKey:"readiness",activeSection:v,surfaceTheme:t,register:e=>{f.current.readiness=e},children:(0,s.jsx)("div",{className:k("rounded-[22px] border p-4",b?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:k("text-[11px] uppercase tracking-[0.18em]",b?"text-[#a0978b]":"text-slate-500"),children:"Readiness"}),(0,s.jsxs)("p",{className:k("mt-1 text-[28px] font-semibold tracking-[-0.03em]",b?"text-[#181612]":"text-white"),children:[n.readinessScore,"%"]}),(0,s.jsx)("p",{className:k("text-[13px] leading-6",b?"text-[#6e665d]":"text-slate-300"),children:n.architectSummary})]}),(0,s.jsx)("span",{className:k("inline-flex size-10 items-center justify-center rounded-full border",b?"border-[#e5ddd2] bg-[#f5f0e8] text-[#6a635b]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,s.jsx)(z.A,{className:"h-4 w-4"})})]})})}),a4.map(e=>{let a=a7(n,e.id),r=e.icon,i=`section-${e.id}`;return(0,s.jsx)(sl,{sectionKey:i,activeSection:v,surfaceTheme:t,register:e=>{f.current[i]=e},children:(0,s.jsx)("div",{className:k("rounded-[22px] border p-4",b?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("span",{className:k("inline-flex size-9 shrink-0 items-center justify-center rounded-full border",b?"border-[#e7e0d6] bg-[#faf6f1] text-[#5e5750]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,s.jsx)(r,{className:"h-4 w-4"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,s.jsx)("p",{className:k("text-[14px] font-semibold",b?"text-[#171410]":"text-white"),children:e.label}),(0,s.jsx)(sp,{surfaceTheme:t,tone:a.variant,label:a.label})]}),(0,s.jsx)("p",{className:k("mt-1 text-[13px] leading-6",b?"text-[#70685f]":"text-slate-300"),children:se(n,e.id)})]})]})})},e.id)}),(0,s.jsx)(sl,{sectionKey:"deploy-review",activeSection:v,surfaceTheme:t,register:e=>{f.current["deploy-review"]=e},children:(0,s.jsxs)("div",{className:k("rounded-[22px] border p-4",b?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(aH.A,{className:k("h-4 w-4",b?"text-[#5f5952]":"text-slate-300")}),(0,s.jsx)("p",{className:k("text-[14px] font-semibold",b?"text-[#171410]":"text-white"),children:"Deploy review"})]}),n.deploy.blockers.length>0?(0,s.jsx)(sg,{surfaceTheme:t,title:"Blockers",tone:"danger",items:n.deploy.blockers}):null,n.deploy.warnings.length>0?(0,s.jsx)(sg,{surfaceTheme:t,title:"Warnings",tone:"warning",items:n.deploy.warnings}):null,0===n.deploy.blockers.length&&0===n.deploy.warnings.length?(0,s.jsx)("p",{className:k("mt-3 text-[13px] leading-6",b?"text-[#70685f]":"text-slate-300"),children:"Architect has not surfaced blockers or warnings yet. Request review when the blueprint feels directionally right."}):null]})})]}):(0,s.jsxs)("div",{className:k("rounded-[22px] border border-dashed p-5",b?"border-[#ddd5ca] bg-white/80":"border-white/10 bg-white/[0.04]"),children:[(0,s.jsx)("p",{className:k("text-[14px] font-medium",b?"text-[#211d19]":"text-white"),children:"Architect is preparing the blueprint."}),(0,s.jsx)("p",{className:k("mt-1 text-[13px] leading-6",b?"text-[#776f65]":"text-slate-300"),children:"Once the first plan is ready, this pane will start reflecting the structured workspace draft."})]})]})})})}function sl({sectionKey:e,activeSection:t,surfaceTheme:a,register:r,children:n}){return(0,s.jsx)("div",{ref:r,className:k("scroll-mt-6 rounded-[26px] transition-all duration-500",t===e&&("light"===a?"ring-2 ring-[#d8b184]/70 shadow-[0_0_0_1px_rgba(216,177,132,0.18),0_18px_36px_rgba(102,78,47,0.16)]":"ring-2 ring-cyan-300/45 shadow-[0_0_0_1px_rgba(103,232,249,0.14),0_18px_36px_rgba(6,182,212,0.16)]")),children:n})}function so({surfaceTheme:e,title:t,subtitle:a}){let r="light"===e;return(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:k("text-[11px] uppercase tracking-[0.18em]",r?"text-[#8b7262]":"text-slate-500"),children:t}),(0,s.jsx)("p",{className:k("mt-1 text-[13px] leading-6",r?"text-[#705b4d]":"text-slate-300"),children:a})]})}function sd({surfaceTheme:e,resolvedName:t,resolvedTemplate:a,sourceAnalysis:r,workspacePath:n,workspaceRoot:i,summaryLabel:l}){let o="light"===e;return(0,s.jsx)("div",{className:k("rounded-[22px] border p-4",o?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("span",{className:k("inline-flex size-9 shrink-0 items-center justify-center rounded-full border",o?"border-[#e7e0d6] bg-[#faf6f1] text-[#5e5750]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,s.jsx)(L.A,{className:"h-4 w-4"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:k("text-[11px] uppercase tracking-[0.18em]",o?"text-[#a0978b]":"text-slate-500"),children:"Fast-path snapshot"}),(0,s.jsx)("p",{className:k("mt-1 text-[12px] leading-5",o?"text-[#776f65]":"text-slate-400"),children:l}),(0,s.jsxs)("div",{className:"mt-4 grid gap-3 md:grid-cols-2",children:[(0,s.jsx)(sc,{surfaceTheme:e,label:"Name",value:t,icon:L.A}),(0,s.jsx)(sc,{surfaceTheme:e,label:"Template",value:sn[a],icon:aZ.A}),(0,s.jsx)(sc,{surfaceTheme:e,label:"Source",value:r.label,icon:"clone"===r.kind?aY.A:"website"===r.kind?aQ.A:aX.A}),(0,s.jsx)(sc,{surfaceTheme:e,label:"Path",value:n,detail:`Root: ${i}`,icon:aX.A,mono:!0})]})]})]})})}function sc({surfaceTheme:e,label:t,value:a,icon:r,detail:n,mono:i=!1}){let l="light"===e;return(0,s.jsx)("div",{className:k("rounded-[18px] border px-3 py-3",l?"border-[#e8e0d6] bg-[#faf6f1]":"border-white/10 bg-white/[0.03]"),children:(0,s.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,s.jsx)("span",{className:k("mt-0.5 inline-flex size-7 shrink-0 items-center justify-center rounded-full border",l?"border-[#e0d7cc] bg-white text-[#615a52]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,s.jsx)(r,{className:"h-3.5 w-3.5"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:k("text-[11px] uppercase tracking-[0.16em]",l?"text-[#8d8276]":"text-slate-500"),children:t}),(0,s.jsx)("p",{className:k("mt-1 break-words text-[13px] font-medium leading-5",l?"text-[#171410]":"text-white",i&&"font-mono text-[12px]"),children:a}),n?(0,s.jsx)("p",{className:k("mt-1 text-[11px] leading-5",l?"text-[#776f65]":"text-slate-400"),children:n}):null]})]})})}function sp({surfaceTheme:e,tone:t,label:a}){return(0,s.jsx)("span",{className:k("inline-flex items-center rounded-full border px-2.5 py-1 text-[10px] uppercase tracking-[0.16em]","muted"===t&&("light"===e?"border-[#e4ddd3] bg-[#f7f2eb] text-[#746b61]":"border-white/10 bg-white/[0.05] text-slate-300"),"success"===t&&"border-emerald-200 bg-emerald-50 text-emerald-700","warning"===t&&"border-amber-200 bg-amber-50 text-amber-700","danger"===t&&"border-rose-200 bg-rose-50 text-rose-700"),children:a})}function sm({surfaceTheme:e,template:t,rules:a,preset:r,onRuleToggle:n}){var i,l,o;let d,c="light"===e,p=(i=t,l=a,d="frontend"===(o=i)?["docs/ux-notes.md"]:"backend"===o?["docs/service-map.md"]:"research"===o?["docs/research-plan.md"]:"content"===o?["docs/content-brief.md"]:[],[{id:"core",title:"Core agent files",description:"Required bootstrap files that define the workspace identity and operating instructions.",checked:!0,locked:!0,files:["AGENTS.md","SOUL.md","IDENTITY.md","TOOLS.md","HEARTBEAT.md"],rule:void 0},{id:"docs",title:"Starter docs",description:"Brief, architecture notes, and the initial deliverables handoff scaffold.",checked:l.generateStarterDocs,locked:!1,files:["docs/brief.md","docs/architecture.md","deliverables/README.md",...d],rule:"generateStarterDocs"},{id:"memory",title:"Memory files",description:"Durable project memory for blueprint decisions and accumulated context.",checked:l.generateMemory,locked:!1,files:["MEMORY.md","memory/blueprint.md","memory/decisions.md"],rule:"generateMemory"},{id:"kickoff",title:"Kickoff mission",description:"Runs the first mission immediately after bootstrap so the agent starts with momentum.",checked:l.kickoffMission,locked:!1,files:[],rule:"kickoffMission"}]),m=sr(t,a);return(0,s.jsxs)("div",{className:"mt-3 space-y-4",children:["custom"===r?(0,s.jsx)(sp,{surfaceTheme:e,tone:"muted",label:"Custom mix"}):null,(0,s.jsx)("div",{className:"space-y-2",children:p.map(t=>(0,s.jsx)("button",{type:"button",onClick:t.rule?()=>n(t.rule):void 0,disabled:!t.rule,className:k("w-full rounded-[18px] border px-3 py-3 text-left transition-colors",c?"border-[#e8e0d6] bg-[#faf6f1]":"border-white/10 bg-white/[0.03]",t.rule?c?"hover:border-[#d8c9ba] hover:bg-[#f6efe6]":"hover:border-white/15 hover:bg-white/[0.05]":"cursor-default"),children:(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("span",{className:k("mt-0.5 inline-flex size-5 shrink-0 items-center justify-center rounded-md border",t.checked?c?"border-[#1f1b17] bg-[#1f1b17] text-white":"border-cyan-300 bg-cyan-300 text-slate-950":c?"border-[#d9d0c6] bg-white text-transparent":"border-white/15 bg-transparent text-transparent"),children:(0,s.jsx)(w.A,{className:"h-3 w-3"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("p",{className:k("text-[13px] font-medium",c?"text-[#171410]":"text-white"),children:t.title}),t.locked?(0,s.jsxs)("span",{className:k("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",c?"border-[#e0d7cc] bg-white text-[#7a7168]":"border-white/10 bg-white/[0.05] text-slate-400"),children:[(0,s.jsx)(a0.A,{className:"h-3 w-3"}),"Required"]}):null]}),(0,s.jsx)("p",{className:k("mt-1 text-[12px] leading-5",c?"text-[#776f65]":"text-slate-400"),children:t.description}),t.files.length>0?(0,s.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:t.files.map(t=>(0,s.jsx)(sx,{surfaceTheme:e,label:t},t))}):null]})]})},t.id))}),(0,s.jsxs)("div",{className:k("rounded-[18px] border px-3 py-3",c?"border-[#e8e0d6] bg-[#faf6f1]":"border-white/10 bg-white/[0.03]"),children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(a1.A,{className:k("h-4 w-4",c?"text-[#5f5952]":"text-slate-300")}),(0,s.jsx)("p",{className:k("text-[12px] uppercase tracking-[0.16em]",c?"text-[#8d8276]":"text-slate-500"),children:"Will create"})]}),(0,s.jsxs)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[m.map(t=>(0,s.jsx)(sx,{surfaceTheme:e,label:t},t)),a.kickoffMission?(0,s.jsx)(sx,{surfaceTheme:e,label:"Kickoff mission",accent:!0}):null]})]}),(0,s.jsxs)("p",{className:k("text-[13px] leading-6",c?"text-[#70685f]":"text-slate-300"),children:["fastest"===r?"Fastest setup keeps only the core agent files and skips kickoff.":"custom"===r?"Custom setup keeps only the extras you left enabled.":"Standard setup creates starter docs, memory, and a kickoff mission."," Need more control later? Switch to Advanced and keep the same draft."]})]})}function su({surfaceTheme:e,mode:t,preset:a,onPresetChange:r}){let n="light"===e;return(0,s.jsxs)("div",{className:k("rounded-[22px] border p-4",n?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:k("text-[11px] uppercase tracking-[0.18em]",n?"text-[#a0978b]":"text-slate-500"),children:"Setup speed"}),(0,s.jsx)("p",{className:k("mt-1 text-[13px] leading-6",n?"text-[#70685f]":"text-slate-300"),children:"basic"===t?"Choose how much scaffold the fast create path should write before the workspace opens.":"These presets also work in Advanced and update the workspace bootstrap rules."})]}),"custom"===a?(0,s.jsx)(sp,{surfaceTheme:e,tone:"muted",label:"Custom mix"}):null]}),(0,s.jsxs)("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:[(0,s.jsx)(sh,{surfaceTheme:e,active:"standard"===a,title:"Standard",description:"Docs, memory, and kickoff mission",onClick:()=>r("standard")}),(0,s.jsx)(sh,{surfaceTheme:e,active:"fastest"===a,title:"Fastest setup",description:"Core files only, no kickoff",onClick:()=>r("fastest")})]})]})}function sh({surfaceTheme:e,active:t,title:a,description:r,onClick:n}){let i="light"===e;return(0,s.jsxs)("button",{type:"button",onClick:n,className:k("rounded-[18px] border px-3 py-3 text-left transition-colors",t?i?"border-[#1f1b17] bg-[#1f1b17] text-white":"border-cyan-300 bg-cyan-300/15 text-cyan-50":i?"border-[#e8e0d6] bg-[#faf6f1] text-[#171410] hover:border-[#d8c9ba] hover:bg-[#f6efe6]":"border-white/10 bg-white/[0.03] text-white hover:border-white/15 hover:bg-white/[0.05]"),children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(aZ.A,{className:"h-4 w-4"}),(0,s.jsx)("p",{className:"text-[13px] font-medium",children:a})]}),(0,s.jsx)("p",{className:k("mt-1 text-[12px] leading-5",t?"opacity-80":i?"text-[#776f65]":"text-slate-400"),children:r})]})}function sx({surfaceTheme:e,label:t,accent:a=!1}){return(0,s.jsxs)("span",{className:k("inline-flex items-center rounded-full border px-2.5 py-1 font-mono text-[10px]",a?"light"===e?"border-[#d8b184] bg-[#f8efe3] text-[#7c5a34]":"border-cyan-300/30 bg-cyan-300/10 text-cyan-100":"light"===e?"border-[#e4ddd3] bg-white text-[#6c645b]":"border-white/10 bg-white/[0.05] text-slate-300"),children:[(0,s.jsx)(w.A,{className:"mr-1 h-3 w-3"}),t]})}function sg({surfaceTheme:e,title:t,tone:a,items:r}){let n="light"===e;return(0,s.jsxs)("div",{className:k("mt-3 rounded-[18px] border px-4 py-3","danger"===a?n?"border-rose-200 bg-rose-50":"border-rose-400/25 bg-rose-400/10":n?"border-amber-200 bg-amber-50":"border-amber-400/25 bg-amber-400/10"),children:[(0,s.jsx)("p",{className:k("text-[11px] uppercase tracking-[0.18em]",n?"text-[#9f958a]":"text-slate-500"),children:t}),(0,s.jsx)("div",{className:"mt-2 space-y-2",children:r.map(e=>(0,s.jsxs)("div",{className:k("flex items-start gap-2 text-[13px] leading-6",n?"text-[#403934]":"text-slate-200"),children:[(0,s.jsx)(i.A,{className:"mt-1 h-3.5 w-3.5 shrink-0"}),(0,s.jsx)("span",{children:e})]},e))})]})}var sb=a(6613);function sf({surfaceTheme:e,mode:t,onModeChange:a,onNewDraft:r,badges:n}){let i="light"===e;return(0,s.jsxs)("div",{className:k("relative z-[1] border-b px-4 py-3 md:px-5",i?"border-[#e7e1d8] bg-[linear-gradient(180deg,rgba(255,255,255,0.96),rgba(248,244,237,0.94))]":"border-white/10 bg-[linear-gradient(180deg,rgba(10,16,29,0.96),rgba(6,11,21,0.94))]"),children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,s.jsx)("div",{className:"min-w-0",children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("span",{className:k("inline-flex size-10 shrink-0 items-center justify-center rounded-full border shadow-[0_8px_24px_rgba(56,47,38,0.08)]",i?"border-[#e3ddd4] bg-white text-[#4c4640]":"border-white/10 bg-white/[0.05] text-slate-200 shadow-[0_16px_36px_rgba(0,0,0,0.28)]"),children:(0,s.jsx)(z.A,{className:"h-4 w-4"})}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:k("text-[11px] uppercase tracking-[0.22em]",i?"text-[#7f6554]":"text-slate-500"),children:"Architect"}),(0,s.jsx)("h2",{className:k("truncate text-[18px] font-semibold tracking-[-0.02em]",i?"text-[#2d2118]":"text-white"),children:"Create workspace"}),(0,s.jsx)("p",{className:k("text-[13px]",i?"text-[#604c3f]":"text-slate-300"),children:"Talk to Architect once. Stay on the fast path or open the full blueprint without losing the draft."})]})]})}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsxs)("div",{className:k("inline-flex rounded-full border p-1",i?"border-[#e4ddd3] bg-[#f4efe7]":"border-white/10 bg-white/[0.04]"),children:[(0,s.jsx)(sw,{surfaceTheme:e,active:"basic"===t,label:"Basic",onClick:()=>a("basic")}),(0,s.jsx)(sw,{surfaceTheme:e,active:"advanced"===t,label:"Advanced",onClick:()=>a("advanced")})]}),(0,s.jsxs)("button",{type:"button",onClick:r,className:k("inline-flex h-9 items-center gap-2 rounded-full border px-3 text-[13px] transition-colors",i?"border-[#dfd8ce] bg-white text-[#38322d] hover:bg-[#f5f1ea]":"border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]"),children:[(0,s.jsx)(sb.A,{className:"h-3.5 w-3.5"}),"New draft"]})]})]}),n.length>0?(0,s.jsx)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:n.map(e=>(0,s.jsx)("span",{className:k("inline-flex items-center rounded-full border px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.16em]","success"===e.tone&&"border-emerald-200 bg-emerald-50 text-emerald-700","warning"===e.tone&&"border-amber-200 bg-amber-50 text-amber-700","danger"===e.tone&&"border-rose-200 bg-rose-50 text-rose-700",(!e.tone||"muted"===e.tone)&&(i?"border-[#e4ddd3] bg-white text-[#5f5348]":"border-white/10 bg-white/[0.05] text-slate-300")),children:e.label},e.id))}):null]})}function sw({surfaceTheme:e,active:t,label:a,onClick:r}){let n="light"===e;return(0,s.jsx)("button",{type:"button",onClick:r,className:k("inline-flex min-w-[92px] items-center justify-center rounded-full px-3 py-1.5 text-[13px] transition-colors",t?n?"bg-white text-[#151310] shadow-sm":"bg-[#0f1726] text-white shadow-[0_8px_18px_rgba(0,0,0,0.28)]":n?"text-[#6d584a] hover:text-[#2d2824]":"text-slate-400 hover:text-slate-100"),children:a})}var sv=a(9436);function sy({surfaceTheme:e,value:t,placeholder:a,onChange:n,onSubmit:i,disabled:l=!1,isBusy:o=!1,helperText:d,toolbar:c,className:p}){let u=(0,m.useRef)(null),h=!!t.trim()&&!l;(0,m.useEffect)(()=>{let e=u.current;e&&(e.style.height="0px",e.style.height=`${Math.min(e.scrollHeight,200)}px`)},[t]);let x=async e=>{e.preventDefault(),h&&await i()},g=async e=>{"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),h&&await i())},b="light"===e;return(0,s.jsxs)("form",{onSubmit:x,className:k("rounded-[24px] border p-3",b?"border-[#dfd9d1] bg-white shadow-[0_24px_80px_rgba(56,47,38,0.08)]":"border-white/10 bg-[rgba(7,12,22,0.92)] shadow-[0_24px_80px_rgba(0,0,0,0.38)]",p),children:[(0,s.jsx)("textarea",{ref:u,value:t,onChange:e=>n(e.target.value),onKeyDown:g,placeholder:a,className:k("min-h-[44px] max-h-[200px] w-full resize-none overflow-y-auto border-0 bg-transparent px-2 py-1 text-[15px] leading-6 outline-none",b?"text-[#191714] placeholder:text-[#9b948c]":"text-slate-100 placeholder:text-slate-500")}),(0,s.jsxs)("div",{className:"mt-2 flex flex-wrap items-center justify-between gap-3",children:[(0,s.jsxs)("div",{className:"flex min-h-8 items-center gap-2",children:[c,d?(0,s.jsx)("p",{className:k("text-[11px]",b?"text-[#8b837a]":"text-slate-400"),children:d}):null]}),(0,s.jsx)("button",{type:"submit",disabled:!h,className:k("inline-flex size-8 items-center justify-center rounded-full transition-colors disabled:cursor-not-allowed",b?"bg-[#161514] text-white hover:bg-[#26231f] disabled:bg-[#d5cec5] disabled:text-[#8d857c]":"bg-cyan-300 text-slate-950 hover:bg-cyan-200 disabled:bg-white/[0.08] disabled:text-slate-500"),children:o?(0,s.jsx)(r.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(sv.A,{className:"h-3.5 w-3.5"})})]})]})}function sj({surfaceTheme:e,messages:t,isTyping:a=!1,typingLabel:r="Typing…",emptyState:n,auxiliary:i,className:l}){let o=(0,m.useRef)(null);return(0,m.useEffect)(()=>{o.current?.scrollIntoView({block:"end"})},[a,t]),(0,s.jsx)(ey,{className:k("h-full",l),children:(0,s.jsxs)("div",{className:"mx-auto flex min-h-full w-full max-w-4xl flex-col gap-5 px-2 py-4 md:gap-6 md:px-4",children:[n,i,t.map(t=>(0,s.jsx)(sk,{message:t,surfaceTheme:e},t.id)),a?(0,s.jsx)(sN,{surfaceTheme:e,label:r}):null,(0,s.jsx)("div",{ref:o,className:"h-6 w-full shrink-0"})]})})}function sk({message:e,surfaceTheme:t}){let a="light"===t;if("system"===e.role)return(0,s.jsxs)("div",{className:k("mx-auto w-full max-w-3xl rounded-[18px] border px-4 py-3 text-[13px] leading-6",a?"border-[#e3ddd4] bg-[#f5f0e8] text-[#5b544d]":"border-white/10 bg-white/[0.05] text-slate-300"),children:[(0,s.jsx)("p",{className:k("text-[11px] uppercase tracking-[0.18em]",a?"text-[#8b8074]":"text-slate-500"),children:e.author||"Workspace Wizard"}),(0,s.jsx)("p",{className:"mt-1",children:e.text})]});let r="user"===e.role,n="pending"===e.status;return(0,s.jsxs)("div",{className:k("flex w-full items-start gap-3",r?"justify-end":"justify-start"),children:[r?null:(0,s.jsx)("div",{className:k("mt-0.5 inline-flex size-8 shrink-0 items-center justify-center rounded-full border",a?"border-[#e6dfd4] bg-white text-[#5f5a53]":"border-white/10 bg-white/[0.05] text-slate-300"),children:"Architect"===e.author?(0,s.jsx)(z.A,{className:"h-3.5 w-3.5"}):(0,s.jsx)(L.A,{className:"h-3.5 w-3.5"})}),(0,s.jsxs)("div",{className:k("max-w-[min(100%,720px)]",r?a?"rounded-[22px] bg-[#191714] px-4 py-2.5 text-white":"rounded-[22px] bg-cyan-300 px-4 py-2.5 text-slate-950":a?"px-0 py-0 text-[#1b1815]":"px-0 py-0 text-slate-100",n&&"opacity-75"),children:[!r&&e.author?(0,s.jsx)("p",{className:k("mb-1 text-[11px] uppercase tracking-[0.18em]",a?"text-[#8f857a]":"text-slate-500"),children:e.author}):null,(0,s.jsx)("p",{className:k("whitespace-pre-wrap text-[15px] leading-7",r&&"leading-6"),children:e.text})]})]})}function sN({surfaceTheme:e,label:t}){let a="light"===e;return(0,s.jsxs)("div",{className:"flex w-full items-start gap-3",children:[(0,s.jsx)("div",{className:k("mt-0.5 inline-flex size-8 shrink-0 items-center justify-center rounded-full border",a?"border-[#e6dfd4] bg-white text-[#5f5a53]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,s.jsx)(z.A,{className:"h-3.5 w-3.5"})}),(0,s.jsxs)("div",{className:"max-w-[min(100%,720px)]",children:[(0,s.jsx)("p",{className:k("mb-1 text-[11px] uppercase tracking-[0.18em]",a?"text-[#8f857a]":"text-slate-500"),children:"Architect"}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsxs)("div",{className:k("inline-flex items-center gap-1.5 rounded-full border px-3 py-2",a?"border-[#e6dfd5] bg-white text-[#5a534c]":"border-white/10 bg-white/[0.05] text-slate-300"),children:[(0,s.jsx)("span",{className:k("inline-flex size-1.5 animate-pulse rounded-full",a?"bg-[#5a534c]":"bg-slate-300")}),(0,s.jsx)("span",{className:k("inline-flex size-1.5 animate-pulse rounded-full [animation-delay:120ms]",a?"bg-[#5a534c]":"bg-slate-300")}),(0,s.jsx)("span",{className:k("inline-flex size-1.5 animate-pulse rounded-full [animation-delay:240ms]",a?"bg-[#5a534c]":"bg-slate-300")})]}),(0,s.jsx)("p",{className:k("text-[13px] leading-6",a?"text-[#6f685f]":"text-slate-400"),children:t})]})]})]})}function sC({surfaceTheme:e,chips:t,onSelect:a,disabled:r=!1,className:n}){if(0===t.length)return null;let i="light"===e;return(0,s.jsx)("div",{className:k("flex flex-wrap items-center gap-2",n),children:t.map(e=>(0,s.jsx)("button",{type:"button",onClick:()=>a(e),disabled:r,className:k("inline-flex min-h-8 items-center rounded-full border px-4 py-1.5 text-left text-[12px] transition-colors disabled:cursor-not-allowed disabled:opacity-50",i?"border-[#ddd7cf] bg-white text-[#4a443f] hover:border-[#cfc7bc] hover:bg-[#f3efe8]":"border-white/10 bg-white/[0.05] text-slate-200 hover:bg-white/[0.08] hover:text-white"),children:e.label},e.id))})}async function sS(e,t){if(!e.body)throw Error("The server did not return a readable stream.");let a=e.body.getReader(),s=new TextDecoder,r="";for(;;){let{value:e,done:n}=await a.read();if(n)break;let i=(r+=s.decode(e,{stream:!0})).indexOf("\n");for(;i>=0;){let e=r.slice(0,i).trim();r=r.slice(i+1),e&&await t(JSON.parse(e)),i=r.indexOf("\n")}}let n=r.trim();n&&await t(JSON.parse(n))}let sA={founder:"Founder",product:"Product Lead",architect:"System Architect",ops:"Operations",growth:"Growth",reviewer:"Reviewer"},sI={small:{label:"Small",agentCount:1,workflowCount:1,automationCount:0,externalChannelCount:0,confirmationLimit:1,suggestedReplyLimit:2},medium:{label:"Medium",agentCount:3,workflowCount:3,automationCount:1,externalChannelCount:0,confirmationLimit:2,suggestedReplyLimit:3},large:{label:"Large",agentCount:5,workflowCount:4,automationCount:2,externalChannelCount:1,confirmationLimit:3,suggestedReplyLimit:4}};function sT(e){return sI[e]??sI.medium}let sO={internal:{label:"Internal",requiresCredentials:!1,credentials:[]},slack:{label:"Slack",requiresCredentials:!0,credentials:[{key:"botToken",label:"Bot token",placeholder:"xoxb-...",secret:!0}]},telegram:{label:"Telegram",requiresCredentials:!0,credentials:[{key:"token",label:"Bot token",placeholder:"123456:ABC...",secret:!0}]},discord:{label:"Discord",requiresCredentials:!0,credentials:[{key:"token",label:"Bot token",placeholder:"Discord bot token",secret:!0}]},googlechat:{label:"Google Chat",requiresCredentials:!0,credentials:[{key:"webhookUrl",label:"Webhook URL",placeholder:"https://chat.googleapis.com/...",secret:!0}]}};function sR(){return globalThis.crypto?.randomUUID?.()??`plan-${Date.now()}`}function sM(e,t,a){return{id:sR(),role:e,author:t,text:a,createdAt:new Date().toISOString()}}function s$(e){return{id:e.id?.trim()||sR(),kind:e.kind,label:e.label.trim(),summary:e.summary.trim(),details:s0(e.details),status:e.status??"ready",createdAt:e.createdAt??new Date().toISOString(),url:sX(e.url),error:sX(e.error)}}function sP(e){return{id:e.id?.trim()||sR(),section:e.section,label:e.label.trim(),value:e.value.trim(),confidence:Math.max(0,Math.min(100,Math.round(e.confidence??72))),status:e.status??"inferred",rationale:sQ(e.rationale??""),sourceLabels:s0(e.sourceLabels)}}function s_(e){let t=s5(e?.id||e?.name||"operator")||"operator",a=e?.role?.trim()||"Operator",s=e?.name?.trim()||s3(t);return{id:t,role:a,name:s,purpose:e?.purpose?.trim()||`${s} owns ${a.toLowerCase()} execution and handoffs.`,enabled:e?.enabled!==!1,isPrimary:!!e?.isPrimary,emoji:e?.emoji?.trim(),theme:e?.theme?.trim(),skillId:e?.skillId?.trim(),modelId:e?.modelId?.trim(),policy:e?.policy??eO("worker"),heartbeat:e?.heartbeat??{enabled:!1},responsibilities:s0(e?.responsibilities),outputs:s0(e?.outputs)}}function sE(e){return{id:s5(e?.id||e?.name||`workflow-${Date.now()}`)||`workflow-${Date.now()}`,name:e?.name?.trim()||"New workflow",goal:e?.goal?.trim()||"",trigger:e?.trigger??"manual",ownerAgentId:e?.ownerAgentId?.trim(),collaboratorAgentIds:s0(e?.collaboratorAgentIds),successDefinition:e?.successDefinition?.trim()||"",outputs:s0(e?.outputs),channelIds:s0(e?.channelIds),enabled:e?.enabled!==!1}}function sD(e="internal",t){let a=sO[e];return{id:s5(t?.id||t?.name||`${e}-${Date.now()}`)||`${e}-${Date.now()}`,type:e,name:t?.name?.trim()||a.label,purpose:t?.purpose?.trim()||"",target:t?.target?.trim(),enabled:t?.enabled!==!1,announce:!!t?.announce,requiresCredentials:a.requiresCredentials,credentials:t?.credentials?.map(e=>({...e,value:e.value??""}))??a.credentials.map(e=>({...e,value:""}))}}function sL(e){return{id:s5(e?.id||e?.name||`automation-${Date.now()}`)||`automation-${Date.now()}`,name:e?.name?.trim()||"New automation",description:e?.description?.trim()||"",enabled:e?.enabled!==!1,scheduleKind:e?.scheduleKind??"every",scheduleValue:e?.scheduleValue?.trim()||"24h",agentId:e?.agentId?.trim(),mission:e?.mission?.trim()||"",thinking:e?.thinking??"medium",announce:!!e?.announce,channelId:e?.channelId?.trim()}}function sU(e){return(function(e,t){let a=ss[e];if("solo"===t){let e=a.find(e=>e.isPrimary)??a[0];return[{...e,name:"Builder"===e.role?"Default Agent":e.name,policy:eO("browser"===e.id?"browser":"worker"),enabled:!0}]}return a.map(e=>({id:e.id,role:e.role,name:e.name,emoji:e.emoji,theme:e.theme,skillId:e.skillId,modelId:e.modelId,isPrimary:!!e.isPrimary,policy:eO("browser"===e.id?"browser":"worker"),enabled:!0}))})(e,"core").map(t=>{var a,s,r,n,i,l,o;return s_({id:t.id,role:t.role,name:t.name,purpose:(a=t.id,s=t.role,r=e,/review/i.test(a)||/review/i.test(s)?`Pressure-test ${r} work for correctness, regression risk, and missing validation.`:/test/i.test(a)||/test/i.test(s)?`Validate behavior, environment assumptions, and release confidence for this ${r} workspace.`:/learn/i.test(a)||/learn/i.test(s)?"Keep the workspace memory, conventions, and durable decisions coherent over time.":/browser/i.test(a)||/browser/i.test(s)?"Exercise real UI flows and collect evidence for browser-facing work.":`Own hands-on delivery and keep the ${r} workspace moving.`),enabled:t.enabled,isPrimary:t.isPrimary,emoji:t.emoji,theme:t.theme,skillId:t.skillId,modelId:t.modelId,policy:t.policy??eO("worker"),heartbeat:t.heartbeat??{enabled:!1},responsibilities:(n=t.id,i=e,/review/i.test(n)?["Review active work","Call out regressions","Protect launch quality"]:/test/i.test(n)?["Run verification loops","Capture evidence","Surface failing assumptions"]:/learn/i.test(n)?["Update durable memory","Track decisions","Reduce restart friction"]:/browser/i.test(n)?["Exercise flows","Capture screenshots","Validate responsive states"]:"content"===i?["Drive content production","Coordinate handoffs","Prepare launch artifacts"]:["Implement the next increment","Coordinate specialists","Keep execution momentum"]),outputs:(l=t.id,o=e,/review/i.test(l)?["review notes","risk checklist"]:/test/i.test(l)?["verification report","repro steps"]:/learn/i.test(l)?["memory updates","decision log entries"]:/browser/i.test(l)?["screenshots","browser validation notes"]:"research"===o?["research summary","evidence log"]:["implementation artifacts","handoff summary"])})})}function sF(e,t){let a=t.find(e=>e.enabled&&e.isPrimary)?.id,s=sZ(t,"review"),r=sZ(t,"test"),n=sZ(t,"learn"),i=sZ(t,"browser");if("research"===e)return[sE({id:"research-loop",name:"Research loop",goal:"Turn the main question into evidence-backed findings and explicit unknowns.",trigger:"manual",ownerAgentId:a,collaboratorAgentIds:[n,s].filter(Boolean),successDefinition:"Question, evidence, synthesis, and next-step recommendations are documented.",outputs:["docs/research-plan.md","deliverables/<run>/research-summary.md"]}),sE({id:"finding-review",name:"Finding review",goal:"Pressure-test claims before publishing or acting on them.",trigger:"manual",ownerAgentId:s??a,collaboratorAgentIds:[a].filter(Boolean),successDefinition:"Assumptions, risks, and evidence gaps are explicit.",outputs:["deliverables/<run>/review-notes.md"]})];if("content"===e)return[sE({id:"strategy",name:"Strategy and briefing",goal:"Clarify audience, offer, channels, and campaign bets before production.",trigger:"manual",ownerAgentId:a,collaboratorAgentIds:[s,n].filter(Boolean),successDefinition:"The team agrees on brief, priorities, and success signals.",outputs:["docs/content-brief.md","deliverables/<run>/campaign-brief.md"]}),sE({id:"production",name:"Production and QA",goal:"Create assets, review them, and prepare a launch package.",trigger:"manual",ownerAgentId:a,collaboratorAgentIds:[s].filter(Boolean),successDefinition:"Assets are approved and delivery-ready.",outputs:["deliverables/<run>/drafts/","deliverables/<run>/launch-package.md"]}),sE({id:"performance-loop",name:"Performance loop",goal:"Review outcomes, learn from results, and feed the next iteration.",trigger:"cron",ownerAgentId:n??s??a,collaboratorAgentIds:[a].filter(Boolean),successDefinition:"Measured results and next changes are documented.",outputs:["deliverables/<run>/performance-review.md"]})];let l=i&&"frontend"===e?i:a;return[sE({id:"scope-v1",name:"V1 shaping",goal:"Turn the product goal into a constrained first delivery batch.",trigger:"manual",ownerAgentId:a,collaboratorAgentIds:[n,s].filter(Boolean),successDefinition:"Scope, non-goals, and critical path are documented.",outputs:["docs/brief.md","memory/blueprint.md"]}),sE({id:"delivery",name:"Delivery loop",goal:"Implement, validate, and hand off the next meaningful increment.",trigger:"manual",ownerAgentId:l,collaboratorAgentIds:[r,s].filter(Boolean),successDefinition:"A tested increment ships with review notes and clear handoff.",outputs:["deliverables/<run>/release-notes.md","deliverables/<run>/verification.md"]}),sE({id:"launch-readiness",name:"Launch readiness",goal:"Check blockers, rollback posture, and communication before launch.",trigger:"launch",ownerAgentId:s??a,collaboratorAgentIds:[r,n].filter(Boolean),successDefinition:"Launch risks, open blockers, and go/no-go signal are explicit.",outputs:["deliverables/<run>/launch-checklist.md"]})]}function sz(){return[sD("internal",{id:"internal-ops",name:"Internal ops",purpose:"Default internal coordination surface for planner outputs and deploy notes.",announce:!1})]}function sW(e){var t,a,s,r,n,i,l,o,d,c,p,m,u,h,x,g,b,f,w,v,y,j,k,N,C;let S,A,I,T,O,R,M,$,P,_,E,D,L,U,F,z,W,B,q,V=s2(e);if(V.runtime=(t=V.id,a=V.runtime,U=a?.architectSessionId?.trim()||`planner-${t}-architect`,F=Object.fromEntries(Object.entries(a?.advisorAgentIds??{}).filter(([,e])=>"string"==typeof e&&e.trim())),z=Object.fromEntries(Object.entries(sA).map(([e])=>[e,a?.advisorSessionIds?.[e]?.trim()||`planner-${t}-${e}`])),{mode:a?.mode==="fallback"?"fallback":"agent",status:a?.status==="error"?"error":a?.status==="ready"?"ready":"pending",workspaceId:sX(a?.workspaceId),workspacePath:sX(a?.workspacePath),architectAgentId:sX(a?.architectAgentId),architectSessionId:U,advisorAgentIds:F,advisorSessionIds:z,lastArchitectRunId:sX(a?.lastArchitectRunId),lastAdvisorRunIds:s0(a?.lastAdvisorRunIds),lastError:sX(a?.lastError)}),V.intake=(s={...V.intake,started:!!V.intake?.started||V.conversation.some(e=>"user"===e.role)},{started:!!s?.started,initialPrompt:sQ(s?.initialPrompt??""),latestPrompt:sQ(s?.latestPrompt??""),sources:(s?.sources??[]).map(e=>s$(e)),confirmations:s0(s?.confirmations).map(e=>e.trim()).filter(Boolean).slice(0,3),mode:s?.mode==="advanced"?"advanced":"guided",size:s?.size==="small"||s?.size==="large"?s.size:"medium",reviewRequested:!!s?.reviewRequested,turnCount:Math.max(0,Math.floor(s?.turnCount??0)),inferences:(s?.inferences??[]).map(e=>sP(e)),suggestedReplies:s0(s?.suggestedReplies).slice(0,4)}),V.company.name=sQ(V.company.name),V.company.mission=sQ(V.company.mission),V.company.targetCustomer=sQ(V.company.targetCustomer),V.company.constraints=s0(V.company.constraints),V.company.successSignals=s0(V.company.successSignals),V.product.offer=sQ(V.product.offer),V.product.scopeV1=s0(V.product.scopeV1),V.product.nonGoals=s0(V.product.nonGoals),V.product.revenueModel=sQ(V.product.revenueModel),V.product.launchPriority=s0(V.product.launchPriority),V.workspace.name=sQ(V.workspace.name),V.workspace.directory=sX(V.workspace.directory),V.workspace.repoUrl=sX(V.workspace.repoUrl),V.workspace.existingPath=sX(V.workspace.existingPath),V.workspace.stackDecisions=s0(V.workspace.stackDecisions),V.workspace.docs=s1(s0(V.workspace.docs).concat(sr(V.workspace.template,V.workspace.rules))),V.team.persistentAgents=V.team.persistentAgents.map(e=>s_({...e,id:e.id,role:e.role,name:e.name,purpose:e.purpose,enabled:e.enabled,isPrimary:e.isPrimary,emoji:e.emoji,theme:e.theme,skillId:e.skillId,modelId:e.modelId,policy:e.policy,heartbeat:e.heartbeat,responsibilities:e.responsibilities,outputs:e.outputs})).filter((e,t,a)=>a.findIndex(t=>t.id===e.id)===t),0===V.team.persistentAgents.length&&(V.team.persistentAgents=sU(V.workspace.template)),!V.team.persistentAgents.some(e=>e.enabled&&e.isPrimary)){let e=V.team.persistentAgents.find(e=>e.enabled);e&&(e.isPrimary=!0)}if(V.operations.channels=V.operations.channels.map(e=>sD(e.type,e)).filter((e,t,a)=>a.findIndex(t=>t.id===e.id)===t),0===V.operations.channels.length&&(V.operations.channels=sz()),V.operations.workflows=V.operations.workflows.map(e=>sE(e)).filter((e,t,a)=>a.findIndex(t=>t.id===e.id)===t),0===V.operations.workflows.length&&(V.operations.workflows=sF(V.workspace.template,V.team.persistentAgents)),V.operations.automations=V.operations.automations.map(e=>sL(e)).filter((e,t,a)=>a.findIndex(t=>t.id===e.id)===t),B=sT((W=s2(V)).intake.size),W.team.persistentAgents=function(e,t,a){var s;let r,n;if(a<=0)return[];return sY((n=(s=[...t,...sU(e),...(r=s_({id:"ops-lead",role:"Operations Lead",name:"Operations Lead",purpose:"Own automations, reporting cadence, and cross-agent handoffs for the workspace.",responsibilities:["Maintain the operating cadence","Wire recurring automations","Keep handoffs durable"],outputs:["ops brief","automation notes"]}),"research"===e?[s_({id:"analyst",role:"Analyst",name:"Analyst",purpose:"Turn gathered evidence into patterns, themes, and decision-ready summaries.",responsibilities:["Cluster findings","Spot repeated signals","Prepare concise summaries"],outputs:["insight summary","theme map"]}),r]:[r])]).find(e=>e.isPrimary)??s[0])?[n,...s.filter(e=>e.id!==n.id)]:s).slice(0,a).map((e,t)=>s_({...e,enabled:!0,isPrimary:e.isPrimary||0===t}))}(W.workspace.template,W.team.persistentAgents,B.agentCount),W.operations.channels=function(e,t,a){let s=t.find(e=>"internal"===e.type)??sz()[0],r=[...t.filter(e=>"internal"!==e.type),...("content"===e?["telegram","discord","slack"]:["slack","discord","telegram"]).map(t=>sD(t,{id:`${t}-ops`,purpose:"content"===e?"Optional distribution or community surface for a larger operating setup.":"Optional external operating surface for a larger workspace.",enabled:!1,announce:!0}))].filter((e,t,a)=>a.findIndex(t=>t.type===e.type)===t);return[sD("internal",{...s,enabled:!0}),...r.slice(0,a)]}(W.workspace.template,W.operations.channels,B.externalChannelCount),W.operations.workflows=function(e,t,a,s){let r,n,i,l;return s<=0?[]:sY([...t,...sF(e,a),...(r=a.find(e=>e.enabled&&e.isPrimary)?.id,n=sZ(a,"review"),i=sZ(a,"learn"),l=sZ(a,"ops"),[sE({id:"context-sync",name:"research"===e?"Evidence sync":"Context sync",goal:"Pull new context from linked sources and keep the blueprint aligned with reality.",trigger:"manual",ownerAgentId:i??r,collaboratorAgentIds:[r,n].filter(Boolean),successDefinition:"New context is reflected in durable docs, scope, and decision notes.",outputs:["memory/blueprint.md","deliverables/<run>/context-sync.md"]}),sE({id:"ops-rhythm",name:"Operating rhythm",goal:"Review handoffs, automations, and next-step ownership on a repeatable cadence.",trigger:"cron",ownerAgentId:l??n??i??r,collaboratorAgentIds:[r].filter(Boolean),successDefinition:"The workspace has a fresh operator brief and an explicit next batch of work.",outputs:["deliverables/<run>/ops-rhythm.md"]})])]).slice(0,s).map(e=>{var t,s;let r,n,i,l,o;return t=e,r=new Set((s=a).filter(e=>e.enabled).map(e=>e.id)),n=s.find(e=>e.enabled&&e.isPrimary)?.id,i=sZ(s,"review"),l=sZ(s,"learn"),o=t.ownerAgentId&&r.has(t.ownerAgentId)?t.ownerAgentId:i??l??n,sE({...t,ownerAgentId:o,collaboratorAgentIds:t.collaboratorAgentIds.filter(e=>r.has(e)&&e!==o),enabled:!0})})}(W.workspace.template,W.operations.workflows,W.team.persistentAgents,B.workflowCount),W.operations.automations=function(e,t,a,s,r){let n,i,l;return r<=0?[]:sY([...t,...(n=sZ(a,"review")??a.find(e=>e.enabled)?.id,i=sZ(a,"learn")??n,[sL({id:"daily-triage",name:"Daily triage",description:"Review drift, blockers, and next handoffs every day.",scheduleKind:"every",scheduleValue:"24h",agentId:n,mission:"content"===e?"Review active campaigns, blockers, and next content handoffs. Leave a concise operator brief.":"Inspect the workspace, surface blockers, and leave a concise next-step handoff for the team.",thinking:"medium",channelId:l=s[0]?.id}),sL({id:"weekly-review",name:"Weekly review",description:"Capture progress, decisions, and next bets once per week.",scheduleKind:"every",scheduleValue:"168h",agentId:i,mission:"research"===e?"Summarize evidence gathered this week, open questions, and the next investigation batch.":"Summarize progress, major decisions, and the next delivery batch for this workspace.",thinking:"high",channelId:l})].filter(e=>e.agentId))]).slice(0,r).map(e=>{var t,r,n;let i,l,o,d,c;return t=e,r=a,n=s,i=new Set(r.filter(e=>e.enabled).map(e=>e.id)),l=new Set(n.map(e=>e.id)),o=r.find(e=>e.enabled&&e.isPrimary)?.id,d=sZ(r,"review"),c=sZ(r,"learn"),sL({...t,agentId:t.agentId&&i.has(t.agentId)?t.agentId:d??c??o,channelId:t.channelId&&l.has(t.channelId)?t.channelId:n[0]?.id,enabled:!0})})}(W.workspace.template,W.operations.automations,W.team.persistentAgents,W.operations.channels,B.automationCount),(V=W).operations.hooks=V.operations.hooks.map(e=>({id:s5(e?.id||e?.name||`hook-${Date.now()}`)||`hook-${Date.now()}`,name:e?.name?.trim()||"New hook",source:e?.source?.trim()||"",enabled:e?.enabled!==!1,notes:e?.notes?.trim()||""})).filter((e,t,a)=>a.findIndex(t=>t.id===e.id)===t),V.operations.sandbox=(r=V.operations.sandbox,{workspaceOnly:r?.workspaceOnly??!0,mode:r?.mode??"default",notes:s0(r?.notes)}),V.deploy.firstMissions=(q=(n=V).team.persistentAgents.find(e=>e.enabled&&e.isPrimary),s1([q?"Inspect the new workspace, refine docs to match the blueprint, and break the first delivery batch into concrete tasks.":"",n.team.persistentAgents.find(e=>/review/i.test(e.role)&&e.enabled)?"Review the blueprint against the created workspace, call out execution risks, and leave a launch-readiness checklist.":"",n.team.persistentAgents.find(e=>/learn/i.test(e.role)&&e.enabled)?"Capture durable facts, decisions, and conventions in memory files so the team can continue without drift.":""].filter(Boolean))),!V.company.name&&V.workspace.name&&(V.company.name=V.workspace.name),!V.workspace.name&&V.company.name&&(V.workspace.name=V.company.name),!V.intake.started)return V.deploy.blockers=[],V.deploy.warnings=[],V.intake.confirmations=[],V.intake.inferences=[],V.intake.suggestedReplies=[],V.readinessScore=0,V.architectSummary="Start with one prompt. Paste the project goal, website URL, repo, or existing folder and the architect will draft the workspace for you.",V.stage="intake",V.status="draft",V.updatedAt=new Date().toISOString(),V;let K=function(e){var t;let a,s,r=sB(e),n=[],i=sT(e.intake.size),l=e.intake.sources.some(e=>"website"===e.kind&&"ready"===e.status),o=sq(e),d=!!(e.company.mission&&e.company.targetCustomer&&(e.product.offer||e.product.scopeV1.length>0));for(let i of(e.company.name||n.push("tr"===r?"Şirkete ya da workspace'e ne ad verelim?":"What should I call the company or workspace?"),e.company.mission||n.push("tr"===r?"Bu workspace \xf6nce tam olarak hangi \xe7ıktıyı optimize etmeli?":"What exact outcome should this workspace optimize for first?"),e.company.targetCustomer||n.push((a=sB(t=e),(s=sV(t))?"tr"===a?`İlk hedef kitleyi ${s} olarak okuyorum. Bunu koruyalım mı, yoksa daha doğru segmenti sen mi g\xf6stereceksin?`:`I can read the first audience as ${s}. Keep that, or point me to the better segment?`:"content"===t.workspace.template?t.operations.channels.some(e=>"telegram"===e.type&&e.enabled)?"tr"===a?"İlk kullanıcı topluluk y\xf6neticileri, moderat\xf6rler ya da Telegram \xfcyeleri mi olmalı?":"Should the first user be community managers, moderators, or Telegram members?":"tr"===a?"Bu i\xe7erik ya da topluluk workspace'i \xf6nce kime hizmet etmeli?":"Who should this content or community workspace serve first?":"research"===t.workspace.template?"tr"===a?"Bu araştırma workspace'i i\xe7in ilk karar verici ya da hedef kitle kim?":"Who is the first decision-maker or audience for this research workspace?":"tr"===a?"İlk kullanıcı ya da m\xfcşteri segmenti kim?":"Who is the first user or customer segment?")),e.workspace.repoUrl||e.workspace.existingPath||!(e.intake.turnCount<=1)||sK(e.intake.latestPrompt||e.intake.initialPrompt)||n.push("tr"===r?"Buna sıfırdan mı başlayalım, bir repo mu klonlayalım, yoksa mevcut bir klas\xf6r\xfc m\xfc bağlayalım?":"Should this start from scratch, clone a repo, or attach an existing folder?"),e.company.mission&&e.company.targetCustomer&&0===e.product.scopeV1.length?n.push("tr"===r?"İlk \xe7ıkaracağımız en k\xfc\xe7\xfck V1 sonucu ne olmalı?":"What is the smallest V1 outcome we should launch first?"):0===e.product.nonGoals.length&&d&&e.product.scopeV1.length>0&&("advanced"===e.intake.mode||e.intake.reviewRequested||e.intake.turnCount>=4)&&n.push("tr"===r?"V1 i\xe7in neleri \xf6zellikle kapsam dışında bırakalım?":"What should stay explicitly out of scope for V1?"),e.company.mission&&(e.product.scopeV1.length>0||l||o.length>0)&&0===e.company.successSignals.length&&("advanced"===e.intake.mode||e.intake.reviewRequested||e.intake.turnCount>=3)&&n.push("tr"===r?"Bu workspace'in işe yaradığını bize hangi sinyal g\xf6stermeli?":"What signal should tell us this workspace is working?"),e.intake.sources.filter(e=>"error"===e.status)))n.push("tr"===r?`${i.label} kaynağını inceleyemedim. Bu kaynak \xf6nemliyse şirket bağlamını manuel olarak doğrula.`:`I could not inspect ${i.label}. Confirm the company context manually if this source matters.`);return s1(n).slice(0,Math.min(l?2:3,i.confirmationLimit))}(V),J=function(e){let t=[];for(let a of(e.company.name||t.push("Company or workspace name is missing."),e.company.mission||t.push("Mission is missing."),e.company.targetCustomer||t.push("Target customer is missing."),e.workspace.name||t.push("Workspace name is missing."),"clone"!==e.workspace.sourceMode||e.workspace.repoUrl||t.push("Clone mode needs a repository URL."),"existing"!==e.workspace.sourceMode||e.workspace.existingPath||t.push("Existing-folder mode needs a folder path."),e.team.persistentAgents.some(e=>e.enabled)||t.push("At least one persistent agent must be enabled."),e.team.persistentAgents.some(e=>e.enabled&&e.isPrimary)||t.push("One enabled agent must be marked as primary."),e.operations.workflows.some(e=>e.enabled)||t.push("At least one enabled workflow is required."),e.operations.workflows.filter(e=>e.enabled)))a.name&&a.goal&&a.successDefinition||t.push(`Workflow "${a.name||a.id}" is incomplete.`),a.ownerAgentId&&!e.team.persistentAgents.some(e=>e.id===a.ownerAgentId&&e.enabled)&&t.push(`Workflow "${a.name}" points to a missing or disabled owner agent.`);for(let a of e.operations.automations.filter(e=>e.enabled))a.mission&&a.scheduleValue||t.push(`Automation "${a.name}" is incomplete.`),a.agentId&&!e.team.persistentAgents.some(e=>e.id===a.agentId&&e.enabled)&&t.push(`Automation "${a.name}" points to a missing or disabled agent.`);for(let a of e.operations.channels.filter(e=>e.enabled&&e.requiresCredentials))a.credentials.filter(e=>!e.value.trim()).length>0&&t.push(`Channel "${a.name}" is missing required credentials.`);return s1(t)}(V),G=(S=[],A=sT((i=V).intake.size),0===i.product.nonGoals.length&&S.push("No non-goals are defined for V1."),0===i.product.launchPriority.length&&S.push("Launch priorities are not ordered yet."),0===i.company.successSignals.length&&S.push("Success signals are still empty."),0===i.workspace.stackDecisions.length&&"content"!==i.workspace.template&&S.push("Critical stack decisions are not captured yet."),A.automationCount>0&&!i.operations.automations.some(e=>e.enabled)&&S.push("No automation loops are enabled."),A.externalChannelCount>0&&!i.operations.channels.some(e=>"internal"!==e.type)&&S.push("Only internal channels are configured."),A.agentCount>=3&&i.team.maxParallelRuns<2&&S.push("Parallel run limit is conservative for a multi-agent workspace."),s1(S)),H=(l=V).intake.reviewRequested||"deploying"===l.status||"deployed"===l.status;return V.intake.confirmations=K,V.intake.inferences=(I=[],T=(o=V).intake.sources.filter(e=>"ready"===e.status).map(e=>e.label),O=o.intake.confirmations.join(" ").toLowerCase(),o.company.name&&I.push(sP({section:"company",label:"Company",value:o.company.name,confidence:sJ(o,"company-name"),status:sG(O,"company"),rationale:T.length>0?"Derived from linked context and the current brief.":"Derived from the current brief.",sourceLabels:T})),o.company.mission&&I.push(sP({section:"company",label:"Mission",value:o.company.mission,confidence:sJ(o,"mission"),status:sG(O,"outcome"),rationale:"Architect condensed the first business outcome from the request.",sourceLabels:T})),o.company.targetCustomer&&I.push(sP({section:"company",label:"First audience",value:o.company.targetCustomer,confidence:sJ(o,"target-customer"),status:sG(O,"audience"),rationale:"This is the current best guess for the first user or buyer segment.",sourceLabels:T})),I.push(sP({section:"workspace",label:"Workspace type",value:s3(o.workspace.template),confidence:sJ(o,"template"),status:"inferred",rationale:"Template is inferred from the requested operating model and linked context.",sourceLabels:T})),I.push(sP({section:"workspace",label:"Starting point",value:"clone"===o.workspace.sourceMode?o.workspace.repoUrl||"Clone an existing repository":"existing"===o.workspace.sourceMode?o.workspace.existingPath||"Attach an existing folder":"Start from scratch",confidence:sJ(o,"source-mode"),status:sG(O,"start"),rationale:"This is how the workspace will be materialized when you deploy.",sourceLabels:T})),o.product.offer&&I.push(sP({section:"product",label:"Offer",value:o.product.offer,confidence:sJ(o,"offer"),status:"inferred",rationale:"Architect turned the brief into a concrete operator-facing offer.",sourceLabels:T})),(R=o.operations.channels.filter(e=>e.enabled&&"internal"!==e.type)).length>0&&I.push(sP({section:"operations",label:"External channels",value:R.map(e=>e.name).join(", "),confidence:sJ(o,"channels"),status:"inferred",rationale:"The request implies these operating channels should exist after deploy.",sourceLabels:T})),(M=o.team.persistentAgents.find(e=>e.enabled&&e.isPrimary))&&I.push(sP({section:"team",label:"Primary operator",value:`${M.name} (${M.role})`,confidence:sJ(o,"team"),status:"inferred",rationale:"Architect drafted a primary agent to own the first delivery loop.",sourceLabels:T})),($=o.operations.workflows.find(e=>e.enabled))&&I.push(sP({section:"operations",label:"First workflow",value:$.name,confidence:sJ(o,"workflow"),status:"inferred",rationale:"This is the first operational loop the company would run after deploy.",sourceLabels:T})),I.slice(0,8)),V.intake.suggestedReplies=(d=V,c=K,P=sB(d),_=[],E=sT(d.intake.size),D=sV(d),d.company.targetCustomer||(D&&_.push("tr"===P?`İlk hedef kitle ${sH(D)} gibi g\xf6r\xfcn\xfcyor.`:`The first audience looks like ${sH(D)}.`),"content"===d.workspace.template?(_.push("tr"===P?"İlk kullanıcılar topluluk y\xf6neticileri ve moderat\xf6rler.":"The first users are community managers and moderators."),_.push("tr"===P?"İlk kullanıcılar daha hızlı moderasyon ve onboarding isteyen Telegram \xfcyeleri.":"The first users are Telegram members who need faster moderation and onboarding.")):_.push("tr"===P?"İlk kullanıcılar bu iş akışını her g\xfcn y\xfcr\xfcten operat\xf6rler.":"The first users are the operators running this workflow every day.")),d.company.mission||_.push("tr"===P?"İlk hedef, hacmi en y\xfcksek manuel iş akışını otomatikleştirmek.":"The first outcome is automating the highest-volume manual workflow."),!d.product.scopeV1.length&&d.company.mission&&d.company.targetCustomer&&_.push("tr"===P?"V1, genişlemeden \xf6nce en dar ama faydalı d\xf6ng\xfcy\xfc u\xe7tan uca \xe7\xf6zmeli.":"V1 should handle the narrowest useful loop end to end before we expand."),d.workspace.repoUrl||d.workspace.existingPath||sK(d.intake.latestPrompt||d.intake.initialPrompt)||(_.push("tr"===P?"Şimdilik sıfırdan başlayalım.":"Start from scratch for now."),_.push("tr"===P?"İyi bir temel bulursak mevcut bir repository klonlayabiliriz.":"Clone an existing repository if you find a good base.")),0===d.company.successSignals.length&&d.intake.turnCount>=2&&_.push("tr"===P?"Başarı; daha az manuel iş, daha hızlı yanıt s\xfcreleri ve daha net bir operasyon ritmi demek.":"Success means less manual work, faster response times, and a clearer operating cadence."),0===c.length&&(_.push("tr"===P?"Gelişmiş edit\xf6r\xfc a\xe7.":"Open the advanced editor."),_.push("tr"===P?"Deploy review aşamasına ge\xe7.":"Move into deploy review.")),s1(_).slice(0,E.suggestedReplyLimit)),V.deploy.blockers=H?J:[],V.deploy.warnings=H?G:[],V.readinessScore=(p=V,m=J,u=G,h=H,L=14,p.company.name&&(L+=10),p.company.mission&&(L+=15),p.company.targetCustomer&&(L+=15),p.product.offer&&(L+=10),p.product.scopeV1.length>0&&(L+=10),p.workspace.name&&(L+=10),p.intake.sources.length>0&&(L+=6),p.team.persistentAgents.some(e=>e.enabled&&e.isPrimary)&&(L+=10),p.operations.workflows.some(e=>e.enabled)&&(L+=10),p.operations.automations.some(e=>e.enabled)&&(L+=5),h?(L-=12*m.length,L-=3*u.length):L-=4*Math.max(0,p.intake.confirmations.length-1),Math.max(0,Math.min(100,L))),V.architectSummary=function(e,t,a,s){let r=sB(e),n=sT(e.intake.size);if(!e.intake.started)return"tr"===r?`Tek bir mesajla başla. ${n.label} modunda sohbet yalın kalır; Architect ise arka planda proje bağlamını toplar, ekibi taslaklar ve workspace blueprint'ini hazırlar.`:`Start with one prompt. ${n.label} mode keeps the chat lean while the architect still harvests full project context, drafts the team, and prepares the workspace blueprint.`;let i=e.team.persistentAgents.filter(e=>e.enabled).length,l=e.operations.workflows.filter(e=>e.enabled).length,o=e.operations.automations.filter(e=>e.enabled).length,d=e.intake.confirmations.length;return s?"tr"===r?[e.company.mission?`${e.company.name||e.workspace.name||"Bu şirket"} ${e.company.mission} hedefi etrafında konumlandı.`:"Şirket misyonu i\xe7in h\xe2l\xe2 kısa ve net bir c\xfcmle gerekiyor.",e.company.targetCustomer?`Birincil hedef kitle: ${e.company.targetCustomer}.`:"Hedef m\xfcşteri h\xe2l\xe2 eksik.",`${i} agent, ${l} g\xf6rev ve ${o} automation yapılandırıldı.`,d>0?`Senden ${d} doğrulama daha gerekiyor.`:t.length>0?`Deploy \xf6ncesi ${t.length} blocker kaldı.`:a.length>0?`G\xf6zden ge\xe7irilmesi gereken ${a.length} warning var.`:"Kritik blocker kalmadı."].join(" "):[e.company.mission?`${e.company.name||e.workspace.name||"This company"} is pointed at ${e.company.mission}.`:"The company mission still needs a concise sentence.",e.company.targetCustomer?`Primary audience: ${e.company.targetCustomer}.`:"Target customer is still missing.",`${i} agents, ${l} tasks, and ${o} automations are configured.`,d>0?`${d} confirmation item${1===d?"":"s"} still need your input.`:t.length>0?`${t.length} blocker${1===t.length?"":"s"} remain before deploy.`:a.length>0?`${a.length} warning${1===a.length?"":"s"} remain to review.`:"No hard blockers remain."].join(" "):"tr"===r?[e.company.mission?`${e.company.name||e.workspace.name||"Bu workspace"} i\xe7in odak alanı ${e.company.mission}.`:e.company.name||e.workspace.name?`${e.company.name||e.workspace.name} i\xe7in ilk operasyonel \xe7ıktıyı şekillendiriyorum.`:"Bu workspace i\xe7in ilk somut \xe7ıktıyı h\xe2l\xe2 netleştiriyorum.",e.company.targetCustomer?`İlk hedef kitle: ${e.company.targetCustomer}.`:"İlk kullanıcı ya da hedef segmenti h\xe2l\xe2 netleştirmem gerekiyor.",e.intake.sources.length>0?`${e.intake.sources.length} bağlam kaynağını zaten topladım.`:"Bir website, repo ya da kısa bir brief ver; ilk taslağı \xe7ıkarayım.",`${n.label.toLowerCase()} mod i\xe7in ${i} agent, ${l} g\xf6rev ve ${o} automation taslağı hazır.`,d>0?`Senden sadece ${d} kritik karar daha gerekiyor.`:"Taslak tutarlı g\xf6r\xfcn\xfcyor. İstersen full blueprint'i a\xe7abilir ya da deploy review'a ge\xe7ebilirim."].join(" "):[e.company.mission?`${e.company.name||e.workspace.name||"This workspace"} looks like a ${s3(e.workspace.template).toLowerCase()} company focused on ${e.company.mission}.`:e.company.name||e.workspace.name?`I am shaping the first operating outcome for ${e.company.name||e.workspace.name}.`:"I am still shaping the first concrete outcome for this workspace.",e.company.targetCustomer?`First audience: ${e.company.targetCustomer}.`:"I still need the first audience or user segment.",e.intake.sources.length>0?`I already harvested ${e.intake.sources.length} context source${1===e.intake.sources.length?"":"s"}.`:"Give me a website, repo, or short brief and I will infer the first draft.",`${i} agents, ${l} tasks, and ${o} automations are drafted for ${n.label.toLowerCase()} mode.`,d>0?`Only ${d} high-value decision${1===d?"":"s"} still need your input.`:"The draft is coherent. I can open the full blueprint or move into deploy review."].join(" ")}(V,J,G,H),V.stage=(x=V,g=J,b=G,f=K,w=H,x.intake.started?"deploying"===x.status?"deploying":"deployed"===x.status?"deployed":(v=x).company.mission||v.product.offer||v.workspace.name||v.intake.sources.length>0?((y=x).company.name||y.workspace.name)&&y.company.mission&&y.team.persistentAgents.some(e=>e.enabled)&&y.operations.workflows.some(e=>e.enabled)?w?g.length>0?"pressure-test":b.length>0||x.readinessScore<90?"decision-lock":"ready":f.length>0?"team-synthesis":"decision-lock":"team-synthesis":x.intake.turnCount>1?"context-harvest":"intake":"intake"),V.status=(j=V,k=J,N=K,C=H,j.intake.started?"deploying"===j.status||"deployed"===j.status?j.status:C?"blocked"===j.status&&k.length>0||k.length>0?"blocked":j.readinessScore>=90?"ready":"review":N.length>0?"draft":"review":"draft"),V.updatedAt=new Date().toISOString(),V}function sB(e,t){for(let s of[t,...e.conversation.slice().reverse().filter(e=>"user"===e.role).map(e=>e.text),e.intake.latestPrompt,e.intake.initialPrompt]){var a;let e=!function(e){let t=e?.trim();if(!t)return!1;if(/[çğıöşüÇĞİÖŞÜ]/.test(t))return!0;let a=t.toLowerCase().match(/\b(ve|bir|bu|şu|için|ile|olarak|olan|mı|mi|mu|mü|ne|nasıl|hangi|neden|hedef|ilk|müşteri|kullanıcı|oluştur|gerekli|alanları|yardımcı)\b/g);return!!(a&&a.length>=2)}(a=s)?!function(e){let t=e?.trim();if(!t||/[çğıöşüÇĞİÖŞÜ]/.test(t))return!1;let a=t.toLowerCase().match(/\b(let'?s|the|and|for|with|from|this|that|what|how|why|when|where|who|should|could|would|need|want|start|build|create|launch|project|workspace|customer|user|team|goal|mission|review|deploy|product|website|repo|folder)\b/g);return!!(a&&a.length>=2)}(a)?null:"en":"tr";if(e)return e}return"en"}function sq(e){return e.intake.sources.filter(e=>"ready"===e.status).flatMap(e=>[e.label,e.summary,...e.details]).join(" ").toLowerCase()}function sV(e){let t=sq(e);if(!t)return;let a=/\bweb3|onchain|crypto|blockchain|token\b/.test(t),s=/\bstartup|startups|founder|founders|business(?:es)?\b/.test(t),r=/\bcommunity|communities|member|members|holder|holders|nft|dao|governance\b/.test(t),n=/\bdeveloper|developers|builder|builders|engineer|engineers\b/.test(t),i=/\boperator|operators|moderator|moderators|admin|admins|ops\b/.test(t);return s&&r?a?"Web3 startups and token-led communities":"startups and their communities":s?a?"Web3 startups and founders":"startups and founders":r?a?"DAO, NFT, and Web3 communities":"community leads and members":n&&i?"developers and internal operators":n?"developers and technical teams":i?"internal operators and moderators":void 0}function sK(e){return/\b(from scratch|greenfield|empty workspace|clone|repo|existing folder|existing workspace|s[ıi]f[ıi]rdan|mevcut klas[oö]r|mevcut repo|bo[sş])\b/i.test(e)}function sJ(e,t){let a=`${e.intake.initialPrompt} ${e.intake.latestPrompt}`.toLowerCase(),s=e.intake.sources.filter(e=>"ready"===e.status),r=66;return s.length>0&&(r+=8),e.intake.turnCount>1&&(r+=6),("template"===t&&/\b(telegram|discord|community|topluluk|grup|content|marketing|research|frontend|backend)\b/.test(a)||"source-mode"===t&&sK(a)||"channels"===t&&/\b(slack|telegram|discord|google chat)\b/.test(a))&&(r+=10),"company-name"===t&&s.some(e=>"website"===e.kind)&&(r+=6),"target-customer"!==t||e.company.targetCustomer||(r-=18),("workflow"===t||"team"===t)&&(r-=4),Math.max(52,Math.min(96,r))}function sG(e,t){return e.includes(t)?"needs-confirmation":"inferred"}function sH(e){return e?e.charAt(0).toLowerCase()+e.slice(1):e}function sZ(e,t){return e.find(e=>RegExp(t,"i").test(`${e.id} ${e.role} ${e.name}`))?.id}function sY(e){return e.filter((e,t,a)=>a.findIndex(t=>t.id===e.id)===t)}function sQ(e){return e.trim()}function sX(e){return e?.trim()||void 0}function s0(e){return s1((e??[]).flatMap(e=>e.split(/\r?\n|,/g).map(e=>e.trim()).filter(Boolean)).map(e=>e.trim()).filter(Boolean))}function s1(e){return Array.from(new Set(e.filter(Boolean)))}function s2(e){return structuredClone(e)}function s5(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function s3(e){return e.split(/[-_]/g).filter(Boolean).map(e=>e[0].toUpperCase()+e.slice(1)).join(" ")}function s4(e){let t="clone"===e.sourceMode?{label:"Cloning repository",description:"The repository is being cloned before workspace files are added."}:"existing"===e.sourceMode?{label:"Attaching existing folder",description:"Mission Control is validating the existing directory and preparing it for bootstrap."}:{label:"Preparing workspace folder",description:"A fresh workspace directory is being created inside the configured workspace root."};return{title:"Provisioning workspace",description:"Mission Control is creating the workspace and reporting each real bootstrap step as it finishes.",steps:[{id:"validate",label:"Checking input and target path",description:"Workspace input, agent ids, and the destination directory are being validated."},{id:"source",label:t.label,description:t.description},{id:"scaffold",label:"Scaffolding workspace files",description:"Core docs, local state, starter memory, and shared workspace metadata are being written."},{id:"agents",label:1===e.agentCount?"Creating the first agent":"Creating workspace agents",description:1===e.agentCount?"The primary agent is being provisioned and linked to the workspace.":"Each enabled agent is being provisioned and linked to the workspace."},{id:"kickoff",label:e.kickoffMission?"Running kickoff mission":"Finalizing workspace",description:e.kickoffMission?"The primary agent is inspecting the new workspace and refining the initial setup.":"Workspace bootstrap is wrapping up without a kickoff mission."}]}}function s8(e){return{title:e.title,description:e.description,percent:0,steps:e.steps.map(e=>({...e,status:"pending",percent:0,activities:[]}))}}let s6=new Set(["a","an","and","autonomous","automate","automated","automation","build","create","for","from","in","launch","new","of","on","project","run","runs","set","setup","start","that","the","to","up","workspace","adı","agent","ajan","asistan","benim","bide","bir","birde","de","diye","ekleyelim","gibi","i\xe7in","olarak","olsun","proje","şahsi","verelim","yeni"]);function s9(){return{name:"",goal:"",source:""}}function s7(e){let t=e.trim();if(!t)return{kind:"empty",createSourceMode:"empty",label:"Fresh workspace",hint:"Mission Control will scaffold a new project folder."};if(rs(t))return{kind:"existing",createSourceMode:"existing",label:"Existing folder",hint:t,existingPath:t};if(rr(t))return{kind:"clone",createSourceMode:"clone",label:"Clone repository",hint:t,repoUrl:t};let a=rn(t);return a?ri(a)?{kind:"clone",createSourceMode:"clone",label:"Clone repository",hint:a,repoUrl:a}:{kind:"website",createSourceMode:"empty",label:"Fresh workspace + website",hint:a,websiteUrl:a}:{kind:"context",createSourceMode:"empty",label:"Fresh workspace + context",hint:"The pasted source will be attached to the brief.",contextText:t}}function re(e){let t=e.toLowerCase();return/\b(telegram|discord|community|channel automation|campaign|content|marketing|growth|seo|newsletter)\b/.test(t)?"content":/\b(frontend|ui|website|landing page|design system|dashboard)\b/.test(t)?"frontend":/\b(backend|api|service|microservice|worker|cron|queue|sdk)\b/.test(t)?"backend":/\b(research|investigation|analysis|benchmark|thesis)\b/.test(t)?"research":"software"}function rt(e){return e.name.trim()||function(e,t){let a=function(e){let t=e.trim();if(!t)return;if(rr(t))return rl(t.split(":").at(-1)??"");let a=rn(t);return a?ri(a)?rl(new URL(a).pathname):function(e){try{let[t]=new URL(e).hostname.replace(/^www\./,"").split(".");if(!t)return;return t.split(/[-_]+/g).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}catch{return}}(a):rs(t)?rl(t):void 0}(e);if(a)return a;let s=function(e){let t=e.match(/["“]([^"”]+)["”]/)?.[1]?.trim();if(t)return t;for(let t of[/\b(?:adı|ismi|name)\s*(?:olarak|:|=)?\s*([\p{L}\p{N}][\p{L}\p{N}._-]{1,40}(?:\s+[\p{L}\p{N}][\p{L}\p{N}._-]{1,40}){0,2})(?=\s+(?:olsun|olacak|diyelim|verelim|koyalım|olarak|için)\b|[.!?,]|$)/iu,/\b([\p{L}\p{N}][\p{L}\p{N}._-]{1,40}(?:\s+[\p{L}\p{N}][\p{L}\p{N}._-]{1,40}){0,2})\s+diye\b/iu]){let a=(e.match(t)?.[1]??"").replace(/\b(yeni|bir|workspace|project|proje|ekleyelim|kuralım|başlatalım|oluşturalım)\b/giu," ").replace(/\b(diye|olarak|benim|bide|bir de)\b.*$/iu,"").replace(/\s+/g," ").trim();if(a)return a}}(t);if(s)return s;let r=t.toLowerCase().replace(/[^a-z0-9\s-]+/g," ").split(/\s+/).map(e=>e.trim()).filter(e=>e&&!s6.has(e)).slice(0,4);return 0===r.length?"":r.map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}(e.source,e.goal)||"New Workspace"}function ra(e){let t=e.workspace.repoUrl?.trim()||e.workspace.existingPath?.trim()||e.intake.sources.find(e=>"website"===e.kind)?.url||e.intake.sources.find(e=>"prompt"===e.kind)?.summary||"";return{name:e.workspace.name||"",goal:e.company.mission||e.product.offer||e.intake.latestPrompt||"",source:t}}function rs(e){return e.startsWith("/")||e.startsWith("./")||e.startsWith("../")}function rr(e){return/^git@[^:]+:[^/].+/.test(e)}function rn(e){if(e.includes("@"))return null;let t=e.replace(/[),.;!?]+$/g,""),a=/^https?:\/\//i.test(t)?t:`https://${t}`;try{let e=new URL(a);return e.hostname.includes(".")?e.toString():null}catch{return null}}function ri(e){try{let t=new URL(e),a=t.hostname.toLowerCase(),s=t.pathname.toLowerCase();return"github.com"===a||"gitlab.com"===a||"bitbucket.org"===a||s.endsWith(".git")}catch{return!1}}function rl(e){let t=e.replace(/\\/g,"/").replace(/\/+$/g,"").split("/").filter(Boolean).at(-1)?.replace(/\.git$/i,"");if(t)return t.split(/[-_]+/g).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}let ro="workspace-wizard-basic-source",rd="Imported quick setup assumptions:";function rc(e="standard"){return{...sa,workspaceOnly:!0,generateStarterDocs:"fastest"!==e,generateMemory:"fastest"!==e,kickoffMission:"fastest"!==e}}function rp(e){return{...rc(),...e,workspaceOnly:!0}}function rm(e,t,a){let s=structuredClone(e),r=s7(t.source),n=rt(t),i=t.goal.trim();return s.intake.mode=s.intake.mode||"guided",s.intake.started=!!(i||t.source.trim()),i&&(s.intake.initialPrompt||(s.intake.initialPrompt=i),s.intake.latestPrompt=i,s.company.mission=i,s.product.offer.trim()||(s.product.offer=i)),s.workspace.name=n,s.workspace.sourceMode=r.createSourceMode,s.workspace.repoUrl=r.repoUrl,s.workspace.existingPath=r.existingPath,s.workspace.template=re(`${i}
4
+ ${t.source}`),s.workspace.modelProfile=s.workspace.modelProfile||"balanced",s.workspace.rules=rp(a??s.workspace.rules),s.intake.sources=s.intake.sources.filter(e=>e.id!==ro),"empty"!==r.kind&&s.intake.sources.unshift(s$({id:ro,kind:"clone"===r.kind?"repo":"existing"===r.kind?"folder":"website"===r.kind?"website":"prompt",label:r.label,summary:r.hint,details:[r.hint],url:r.repoUrl??r.websiteUrl})),sW(s)}function ru(e){return rp(e.workspace.rules)}let rh="mission-control-workspace-plan-id",rx=[{id:"software",label:"Ship a software workspace",prompt:"Create a software workspace to ship product work, review changes, and keep durable project context."},{id:"frontend",label:"Spin up a frontend squad",prompt:"Create a frontend workspace for rapid UI delivery, QA, and release-ready product handoffs."},{id:"content",label:"Run a content engine",prompt:"Create a content workspace to plan campaigns, produce copy, and keep publishing operations organized."},{id:"research",label:"Start a research pod",prompt:"Create a research workspace for investigation, synthesis, benchmarking, and note capture."}];function rg({open:e,onOpenChange:t,initialMode:a="basic",surfaceTheme:n,snapshot:i,onRefresh:l,onWorkspaceCreated:o}){let d=function({open:e,initialMode:t,onRefresh:a,onWorkspaceCreated:s}){let[r,n]=(0,m.useState)(t),[i,l]=(0,m.useState)(null),[o,d]=(0,m.useState)(null),[c,p]=(0,m.useState)(!1),[u,h]=(0,m.useState)(s9),[x,g]=(0,m.useState)(rc),[b,f]=(0,m.useState)(null),[w,v]=(0,m.useState)(!1),[y,j]=(0,m.useState)(!1),[k,N]=(0,m.useState)(!1),[C,S]=(0,m.useState)(!1),[A,I]=(0,m.useState)(!1),[T,O]=(0,m.useState)(!1),[R,M]=(0,m.useState)(null),[$,P]=(0,m.useState)(null),[_,E]=(0,m.useState)(0),[D,L]=(0,m.useState)(null),U=(0,m.useRef)(null),F=(0,m.useMemo)(()=>s7(u.source),[u.source]),z=(0,m.useMemo)(()=>{let e;return(e=rp(x)).generateStarterDocs||e.generateMemory||e.kickoffMission?e.generateStarterDocs&&e.generateMemory&&e.kickoffMission?"standard":"custom":"fastest"},[x]),W=(0,m.useMemo)(()=>(function({initialTurn:e,step:t,active:a}){return a?e?t>=2?{title:"Still working",description:"The first turn is the slowest. The planner is usually inspecting links and provisioning the hidden architect runtime."}:t>=1?{title:"Collecting context",description:"The architect is reading the prompt, inspecting websites or repos, and drafting the first workspace blueprint."}:{title:"Starting planner",description:"The architect is opening the planning session and preparing the first draft."}:t>=2?{title:"Still working",description:"The architect is waiting on the planner runtime. This can happen when linked context or advisor runs take longer."}:t>=1?{title:"Updating draft",description:"Refreshing context, specialist notes, and the current workspace plan."}:{title:"Architect thinking",description:"Applying your latest direction to the workspace draft."}:null})({initialTurn:!i?.intake.started,step:_,active:y}),[y,i?.intake.started,_]);(0,m.useEffect)(()=>{if(!y)return void E(0);E(0);let e=globalThis.setTimeout(()=>E(1),1800),t=globalThis.setTimeout(()=>E(2),6200);return()=>{globalThis.clearTimeout(e),globalThis.clearTimeout(t)}},[y]);let B=(0,m.useCallback)(e=>{l(t=>t?sW(e(structuredClone(t))):t)},[]),q=(0,m.useCallback)(()=>globalThis.localStorage?.getItem(rh)??null,[]),V=(0,m.useCallback)(()=>{globalThis.localStorage?.removeItem(rh),p(!1)},[]),K=(0,m.useCallback)(e=>(l(e),p(!!e),e)?(d(e.id),h(ra(e)),g(ru(e)),globalThis.localStorage?.setItem(rh,e.id),e):(d(null),null),[]),J=(0,m.useCallback)(async({resumeStored:e})=>{let t=e?globalThis.localStorage?.getItem(rh):null;if(t){let e=await fetch(`/api/planner/${t}`,{cache:"no-store"});if(e.ok)return(await e.json()).plan}let a=await fetch("/api/planner",{method:"POST"}),s=await a.json();if(!a.ok||!s.plan)throw Error(s.error||"Unable to create planner workspace.");return s.plan},[]),G=(0,m.useCallback)(async({resumeStored:e,draftOverride:t})=>{if(i)return i;if(U.current)return U.current;let a=(async()=>{v(!0);try{let a=await J({resumeStored:e}),s=t??u,r=s.goal.trim()||s.source.trim()||s.name.trim()?rm(a,s,x):a;return K(r)}catch(e){return ed.o.error("Workspace architect could not start.",{description:e instanceof Error?e.message:"Unknown planner error."}),null}finally{v(!1),U.current=null}})();return U.current=a,a},[u,x,K,i,J]),H=(0,m.useCallback)(async()=>{if(f(null),M(null),P(null),j(!1),N(!1),S(!1),I(!1),O(!1),L(null),U.current=null,"basic"===r){V(),l(null),d(null),h(s9()),g(rc());return}V(),l(null),d(null);let e=s9();h(e),g(rc()),await G({resumeStored:!1,draftOverride:e})&&n("advanced")},[V,G,r]),Z=(0,m.useCallback)(()=>{V(),f(null)},[V]),Y=(0,m.useCallback)(async()=>{if(!i||!o)return!1;N(!0);try{let e=await fetch(`/api/planner/${o}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:i})}),t=await e.json();if(!e.ok||!t.plan)throw Error(t.error||"Unable to save planner workspace.");return K(t.plan),ed.o.success("Planner draft saved."),!0}catch(e){return ed.o.error("Planner draft could not be saved.",{description:e instanceof Error?e.message:"Unknown planner save error."}),!1}finally{N(!1)}},[K,i,o]),Q=(0,m.useCallback)(async()=>{if(!i||!o)return!1;S(!0);try{let e=await fetch(`/api/planner/${o}/simulate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:i})}),t=await e.json();if(!e.ok||!t.plan)throw Error(t.error||"Unable to simulate planner team.");return K(t.plan),ed.o.success("Planner team simulated."),!0}catch(e){return ed.o.error("Planner simulation failed.",{description:e instanceof Error?e.message:"Unknown planner simulation error."}),!1}finally{S(!1)}},[K,i,o]),X=(0,m.useCallback)(()=>{B(e=>(e.intake.mode="advanced",e.intake.reviewRequested=!0,e.advisorNotes=[],e.conversation.push(sM("assistant","Workspace Architect","Deploy review is open now. I am surfacing the real blockers and warnings that matter before launch.")),e))},[B]),ee=(0,m.useCallback)(async()=>{let e=await G({resumeStored:!1,draftOverride:u})??i;if(!e)return null;let t=rm(e,u,x);K(t),O(!0),P(s8(s4({sourceMode:t.workspace.sourceMode,agentCount:1,kickoffMission:t.workspace.rules.kickoffMission??!0})));try{var r;let e=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...{name:t.workspace.name,brief:[(r=t).company.mission.trim()||r.product.offer.trim(),r.company.name.trim()?`Company: ${r.company.name.trim()}`:null,r.product.scopeV1.length>0?`Scope: ${r.product.scopeV1.join(", ")}`:null,...r.intake.sources.flatMap(e=>e.id!==ro?[]:"repo"===e.kind&&e.url?[`Bootstrap source: clone ${e.url}`]:"folder"===e.kind?[`Bootstrap source: existing folder ${e.summary}`]:"website"===e.kind&&e.url?[`Reference website: ${e.url}`]:"prompt"===e.kind?[`Additional context: ${e.summary}`]:[])].filter(e=>!!e?.trim()).join("\n"),directory:t.workspace.directory,modelId:t.workspace.modelId,sourceMode:t.workspace.sourceMode,repoUrl:t.workspace.repoUrl,existingPath:t.workspace.existingPath,template:t.workspace.template,teamPreset:"solo",modelProfile:t.workspace.modelProfile||"balanced",rules:rp(t.workspace.rules)},stream:!0})});if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||"OpenClaw could not create the workspace.")}let n=null,i=null;if(await sS(e,async e=>{"progress"===e.type?P(e.progress):(e.progress&&P(e.progress),e.ok?n=e.result:i=e.error)}),i||!n)throw Error(i||"OpenClaw could not create the workspace.");let l=n;return V(),await a(),s(l.workspaceId),ed.o.success("Workspace created.",{description:`${l.agentIds.length} agent${1===l.agentIds.length?"":"s"} created at ${l.workspacePath}`}),l.kickoffError&&ed.o.message("Workspace created, but kickoff needs attention.",{description:l.kickoffError}),l}catch(e){return ed.o.error("Workspace creation failed.",{description:e instanceof Error?e.message:"Unknown workspace error."}),null}finally{O(!1)}},[u,x,V,K,G,a,s,i]),et=(0,m.useCallback)(async()=>{var e;if(!i||!o)return null;I(!0),M(s8({title:"Deploying workspace",description:"The planner is turning the blueprint into a live workspace and streaming each deploy stage.",steps:[{id:"plan",label:"Locking deploy plan",description:"Deploy blockers are being checked and the planner state is being locked for launch."},...s4({sourceMode:(e={sourceMode:i.workspace.sourceMode??"empty",agentCount:i.team.persistentAgents.filter(e=>e.enabled).length,kickoffMission:i.workspace.rules.kickoffMission??!0,hasChannels:!!i.operations.channels.some(e=>e.enabled&&"internal"!==e.type),hasAutomations:!!i.operations.automations.some(e=>e.enabled),hasPlannerKickoffs:!!i.deploy.firstMissions.some(e=>e.trim().length>0)}).sourceMode,agentCount:e.agentCount,kickoffMission:e.kickoffMission}).steps,{id:"blueprint",label:"Writing planner files",description:"Planner blueprint, company notes, and workflow docs are being written into the workspace."},{id:"channels",label:e.hasChannels?"Provisioning channels":"Checking channels",description:e.hasChannels?"Enabled external channels are being provisioned and connected.":"No external channels are enabled, so this stage will pass quickly."},{id:"automations",label:e.hasAutomations?"Provisioning automations":"Checking automation loops",description:e.hasAutomations?"Enabled recurring loops are being attached to their target agents.":"No recurring automations are enabled, so this stage is mostly validation."},{id:"planner-kickoff",label:e.hasPlannerKickoffs?"Running planner kickoff missions":"Finalizing deploy",description:e.hasPlannerKickoffs?"The first missions are being dispatched so the new workspace starts with clear momentum.":"The workspace is being finalized and the deploy request is wrapping up."}]}));try{let e=await fetch(`/api/planner/${o}/deploy`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:i,stream:!0})});if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||"Unable to deploy planner workspace.")}let t=null,r=null;if(await sS(e,async e=>{"progress"===e.type?M(e.progress):(e.progress&&M(e.progress),e.ok?t=e.result:r=e.error)}),r||!t)throw Error(r||"Unable to deploy planner workspace.");let n=t;return K(n.plan),V(),await a(),s(n.workspaceId),ed.o.success("Workspace deployed.",{description:n.workspacePath}),n}catch(e){return ed.o.error("Planner deploy failed.",{description:e instanceof Error?e.message:"Unknown deploy error."}),null}finally{I(!1)}},[V,K,a,s,i,o]),ea=(0,m.useCallback)(async e=>{if(!e.trim())return!1;j(!0),L(e.trim());try{let a="advanced"===t&&!i&&!u.goal.trim()&&!u.source.trim()&&!u.name.trim(),s=await G({resumeStored:a,draftOverride:u})??i;if(!s)return!1;let r=await fetch(`/api/planner/${s.id}/turn`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:e,plan:s})}),n=await r.json();if(!r.ok||!n.plan)throw Error(n.error||"Unable to process planner turn.");return K(n.plan),f(null),!0}catch(e){return ed.o.error("Planner turn failed.",{description:e instanceof Error?e.message:"Unknown planner turn error."}),!1}finally{L(null),j(!1)}},[u,K,G,t,i]),es=(0,m.useCallback)(async()=>{let e=q();if(!e)return p(!1),!1;v(!0);try{let t=await fetch(`/api/planner/${e}`,{cache:"no-store"}),a=await t.json();if(!t.ok||!a.plan)throw Error(a.error||"Unable to load the stored planner draft.");return K(a.plan),n("advanced"),f({tone:"muted",title:"Resumed previous draft",description:"Architect restored your earlier blueprint so you can keep shaping the same workspace."}),!0}catch(e){return ed.o.error("Stored draft could not be resumed.",{description:e instanceof Error?e.message:"Unknown planner error."}),!1}finally{v(!1),U.current=null}},[K,q]),er=(0,m.useCallback)(async e=>{if(e!==r){if("advanced"===e){let e=await G({resumeStored:!1,draftOverride:u});if(!e)return;let t=rm(e,u,x),a=!t.intake.started&&t.conversation.filter(e=>"system"!==e.role).length<=1?function(e,t){let a=structuredClone(e),s=t.goal.trim(),r=t.source.trim();if(a.conversation=a.conversation.filter(e=>!("system"===e.role&&"Workspace Wizard"===e.author&&e.text.startsWith(rd))),!s&&!r)return sW(a);let n=[s?`goal: ${s}`:null,r?`source: ${r}`:null,`fast-path name: ${rt(t)}`].filter(Boolean);return a.conversation.push(sM("system","Workspace Wizard",`${rd} ${n.join(" \xb7 ")}`)),sW(a)}(t,u):t;K(a),f(a.intake.started||u.goal.trim()||u.source.trim()?{tone:"muted",title:"Same draft, deeper controls",description:"Architect will keep extending the exact same conversation and blueprint as you move into Advanced."}:null),n("advanced");return}if(i)h(ra(i)),g(ru(i)),f(i&&(i.team.persistentAgents.filter(e=>e.enabled).length>1||i.operations.workflows.some(e=>e.enabled)||i.operations.automations.some(e=>e.enabled)||i.operations.channels.some(e=>e.enabled&&"internal"!==e.type)||i.operations.hooks.some(e=>e.enabled))?{tone:"warning",title:"Advanced details preserved",description:"Basic mode will keep showing the fast path, but the richer blueprint remains in memory if you switch back."}:null);else f(null);n("basic")}},[u,x,K,G,r,i]),en=(0,m.useCallback)(e=>{h(t=>{let a={...t,goal:e};return"basic"===r&&l(e=>e?rm(e,a,x):e),a})},[x,r]),ei=(0,m.useCallback)(e=>{h(t=>{let a={...t,source:e};return"basic"===r&&l(e=>e?rm(e,a,x):e),a})},[x,r]),el=(0,m.useCallback)(e=>{h(t=>{let a={...t,name:e};return"basic"===r&&l(e=>e?rm(e,a,x):e),a})},[x,r]),eo=(0,m.useCallback)(e=>{let t=rc(e);g(t),l(e=>e?rm(e,u,t):e)},[u]),ec=(0,m.useCallback)(e=>{g(t=>{let a={...t,[e]:!t[e],workspaceOnly:!0};return l(e=>e?rm(e,u,a):e),a})},[u]);return(0,m.useEffect)(()=>{if(!e){n(t),l(null),d(null),p(!1),h(s9()),g(rc()),f(null),P(null),M(null),L(null),U.current=null;return}let a=q();if(n(t),p(!!a),h(s9()),g(rc()),f(null),P(null),M(null),L(null),U.current=null,"advanced"===t){let e=(async()=>{v(!0);try{let e=await J({resumeStored:!0}),t=K(e);return a&&t&&f({tone:"muted",title:"Resumed previous draft",description:"Architect restored the last saved blueprint. Start a new draft if you want a clean slate."}),t}catch(e){return ed.o.error("Workspace architect could not start.",{description:e instanceof Error?e.message:"Unknown planner error."}),null}finally{v(!1),U.current=null}})();U.current=e}else l(null),d(null)},[K,q,t,e,J]),{mode:r,plan:i,planId:o,hasStoredDraft:c,notice:b,sourceAnalysis:F,basicDraft:u,basicRules:x,basicPreset:z,isPlanLoading:w,isSending:y,isSaving:k,isSimulating:C,isDeploying:A,isCreating:T,createProgress:$,deployProgress:R,architectBusyStatus:W,pendingUserMessage:D,setBasicGoal:en,setBasicSource:ei,setBasicName:el,setBasicPreset:eo,toggleBasicRule:ec,setNotice:f,updatePlan:B,switchMode:er,startFreshDraft:H,discardStoredDraft:Z,resumeStoredDraft:es,savePlan:Y,simulatePlan:Q,requestReview:X,createWorkspace:ee,deployPlan:et,submitArchitectTurn:ea}}({open:e,initialMode:a,onRefresh:l,onWorkspaceCreated:o}),[c,p]=(0,m.useState)(""),[u,h]=(0,m.useState)(!1),x="light"===n,g=e=>{e||(p(""),h(!1)),t(e)},b=rt(d.basicDraft),f=re(`${d.basicDraft.goal}
5
+ ${d.basicDraft.source}`),w=function(e,t,a=s7(t.source)){if("existing"===a.kind&&a.existingPath)return a.existingPath;let s=rt(t).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return`${eB(e)}/${s||"workspace"}`}(i.diagnostics.workspaceRoot,d.basicDraft,d.sourceAnalysis),v=(0,m.useMemo)(()=>{var e,t;let a;return e=d.mode,t=d.plan,a=[{id:"surface",label:"basic"===e?"Architect-assisted fast path":"Architect co-design",tone:"muted"}],t&&("basic"===e?t.intake.confirmations.length>0?a.push({id:"confirmations",label:`${t.intake.confirmations.length} decision${1===t.intake.confirmations.length?"":"s"} needed`,tone:t.intake.confirmations.length>1?"warning":"muted"}):t.intake.started&&a.push({id:"draft",label:"Draft synced live",tone:"muted"}):(t.intake.confirmations.length>0&&a.push({id:"confirmations",label:`${t.intake.confirmations.length} decision${1===t.intake.confirmations.length?"":"s"} needed`,tone:t.intake.confirmations.length>1?"warning":"muted"}),a.push({id:"stage",label:`Stage \xb7 ${a9(t.stage)}`,tone:"muted"}),a.push({id:"readiness",label:`${t.readinessScore}% drafted`,tone:t.readinessScore>=85?"success":t.readinessScore>=45?"warning":"muted"}),a.push({id:"status",label:`Status \xb7 ${t.status}`,tone:"blocked"===t.status?"danger":"ready"===t.status||"deployed"===t.status?"success":"review"===t.status?"warning":"muted"}))),a},[d.mode,d.plan]),y=(0,m.useMemo)(()=>{var e,t;let a;return e=d.plan,t=d.pendingUserMessage,a=e?.conversation.map(e=>({id:e.id,role:e.role,author:"assistant"===e.role?"Architect":"system"===e.role?"Workspace Wizard":e.author,text:e.text}))??[],t?.trim()&&a.push({id:"pending-user-message",role:"user",text:t.trim(),status:"pending"}),a},[d.pendingUserMessage,d.plan]),j=(0,m.useMemo)(()=>{let e=(d.plan?.intake.suggestedReplies??[]).filter(e=>e.trim().length>0).map((e,t)=>({id:`reply-${t}`,label:e,prompt:e})).slice(0,"basic"===d.mode?3:4);return e.length>0?e:d.plan?.intake.started?[]:rx.slice(0,"basic"===d.mode?3:4)},[d.mode,d.plan?.intake.started,d.plan?.intake.suggestedReplies]),k=d.isCreating?d.createProgress:d.isDeploying?d.deployProgress:null,N=d.isSending||d.isPlanLoading||d.isDeploying||d.isCreating,C="basic"===d.mode&&d.hasStoredDraft&&!d.plan&&!d.isPlanLoading,S=!!(d.plan?.intake.started||d.basicDraft.goal.trim()||c.trim()),A=async e=>{let t=(e??c).trim();if(!t)return!1;let a=void 0===e;a&&p("");let s=await d.submitArchitectTurn(t);return!s&&a&&p(c),s},T=async()=>{(!c.trim()||await A())&&await d.createWorkspace()&&g(!1)},O=async()=>{await d.deployPlan()&&g(!1)};return(0,s.jsx)(G,{open:e,onOpenChange:g,children:(0,s.jsxs)(Q,{className:x?"h-[92vh] max-w-[min(1380px,96vw)] gap-0 overflow-hidden border-[#e7dfd4] bg-[#fcfaf6] p-0 text-[#161411] shadow-[0_40px_140px_rgba(16,12,8,0.45)]":"h-[92vh] max-w-[min(1380px,96vw)] gap-0 overflow-hidden border-white/10 bg-[rgba(4,8,15,0.96)] p-0 text-white shadow-[0_40px_140px_rgba(0,0,0,0.58)]",children:[(0,s.jsx)(et,{className:"sr-only",children:"Create workspace"}),(0,s.jsx)(ea,{className:"sr-only",children:"Create a workspace in Basic or Advanced mode using the Architect wizard."}),(0,s.jsxs)("div",{className:"relative flex h-full min-h-0 flex-col overflow-hidden",children:[(0,s.jsx)("div",{className:x?"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_top,rgba(255,255,255,0.86),transparent_34%),linear-gradient(180deg,rgba(248,244,237,0.92),rgba(252,250,246,0.86)_24%,rgba(244,238,230,0.82)_100%)]":"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_top,rgba(59,130,246,0.14),transparent_28%),radial-gradient(circle_at_80%_18%,rgba(56,189,248,0.12),transparent_24%),linear-gradient(180deg,rgba(9,15,27,0.98),rgba(4,8,15,0.96)_28%,rgba(2,6,13,0.98)_100%)]"}),(0,s.jsx)(sf,{surfaceTheme:n,mode:d.mode,onModeChange:e=>{d.switchMode(e)},onNewDraft:()=>{p(""),h(!1),d.startFreshDraft()},badges:v}),(0,s.jsxs)("div",{className:"relative z-[1] grid min-h-0 flex-1 lg:grid-cols-[minmax(0,1fr),390px] xl:grid-cols-[minmax(0,1fr),420px]",children:[(0,s.jsxs)("div",{className:x?"flex min-h-0 flex-col bg-[linear-gradient(180deg,rgba(252,250,246,0.7),rgba(247,242,235,0.92))]":"flex min-h-0 flex-col bg-[linear-gradient(180deg,rgba(8,13,24,0.2),rgba(6,10,18,0.42))]",children:[(0,s.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[d.architectBusyStatus?(0,s.jsx)("div",{className:x?"border-b border-[#ece5db] px-4 py-3 md:px-5":"border-b border-white/10 px-4 py-3 md:px-5",children:(0,s.jsxs)("div",{className:x?"rounded-[18px] border border-[#e6dfd5] bg-white px-4 py-3":"rounded-[18px] border border-white/10 bg-white/[0.04] px-4 py-3",children:[(0,s.jsx)("p",{className:x?"text-[11px] uppercase tracking-[0.18em] text-[#8b7262]":"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:d.architectBusyStatus.title}),(0,s.jsx)("p",{className:x?"mt-1 text-[13px] leading-6 text-[#6d665e]":"mt-1 text-[13px] leading-6 text-slate-300",children:d.architectBusyStatus.description})]})}):null,(0,s.jsx)("div",{className:"min-h-0 flex-1",children:(0,s.jsx)(sj,{surfaceTheme:n,messages:y,isTyping:d.isSending,typingLabel:"Architect is shaping the next pass...",emptyState:d.isPlanLoading&&0===y.length?(0,s.jsx)(rw,{surfaceTheme:n}):0===y.length&&"basic"===d.mode?(0,s.jsx)(rb,{surfaceTheme:n}):0===y.length?(0,s.jsx)(rf,{surfaceTheme:n}):null,auxiliary:(0,s.jsxs)(s.Fragment,{children:[C?(0,s.jsx)(ry,{surfaceTheme:n,isBusy:N,onResume:()=>{d.resumeStoredDraft()},onStartFresh:d.discardStoredDraft}):null,k?(0,s.jsx)("div",{className:"mx-auto w-full max-w-3xl",children:(0,s.jsx)(aG,{progress:k,className:x?"border-[#e6dfd5] bg-white":"border-white/10 bg-slate-950/50"})}):"basic"!==d.mode||d.plan?.intake.started||d.pendingUserMessage?null:(0,s.jsx)(rv,{surfaceTheme:n,name:d.basicDraft.name,source:d.basicDraft.source,onNameChange:d.setBasicName,onSourceChange:d.setBasicSource})]})})})]}),(0,s.jsx)("div",{className:x?"border-t border-[#ece5db] bg-[linear-gradient(180deg,rgba(252,250,246,0.7),rgba(247,242,235,0.92))] px-4 py-4 md:px-5":"border-t border-white/10 bg-[linear-gradient(180deg,rgba(5,9,18,0.68),rgba(4,8,15,0.94))] px-4 py-4 md:px-5",children:(0,s.jsxs)("div",{className:"mx-auto w-full max-w-4xl",children:[(0,s.jsx)(sC,{surfaceTheme:n,chips:j.map(e=>({id:e.id,label:e.label})),disabled:N,onSelect:e=>{let t=j.find(t=>t.id===e.id);t&&A(t.prompt)},className:"mb-3"}),(0,s.jsx)(sy,{surfaceTheme:n,value:c,onChange:p,onSubmit:async()=>{await A()},placeholder:"basic"===d.mode?"Tell Architect what this workspace should do first...":"Keep shaping the workspace with Architect...",disabled:N,isBusy:d.isSending,helperText:"basic"===d.mode?"Architect keeps the fast-path draft synced while you stay in one lightweight flow.":"Architect updates the same structured draft with every turn.",toolbar:"basic"!==d.mode||d.plan?d.plan?(0,s.jsxs)("span",{className:x?"inline-flex items-center rounded-full border border-[#e3ddd4] bg-[#f6f1ea] px-3 py-1 text-[11px] uppercase tracking-[0.16em] text-[#6c645b]":"inline-flex items-center rounded-full border border-white/10 bg-white/[0.05] px-3 py-1 text-[11px] uppercase tracking-[0.16em] text-slate-300",children:["Stage \xb7 ",a9(d.plan.stage)]}):null:(0,s.jsx)("span",{className:x?"inline-flex items-center rounded-full border border-[#e3ddd4] bg-[#f6f1ea] px-3 py-1 text-[11px] uppercase tracking-[0.16em] text-[#6c645b]":"inline-flex items-center rounded-full border border-white/10 bg-white/[0.05] px-3 py-1 text-[11px] uppercase tracking-[0.16em] text-slate-300",children:"Architect live"})})]})})]}),(0,s.jsx)(si,{className:"hidden lg:block",surfaceTheme:n,mode:d.mode,snapshot:i,plan:d.plan,resolvedName:b,resolvedTemplate:f,sourceAnalysis:d.sourceAnalysis,workspacePath:w,notice:d.notice,basicRules:d.basicRules,basicPreset:d.basicPreset,onBasicPresetChange:d.setBasicPreset,onBasicRuleToggle:d.toggleBasicRule,progress:"basic"===d.mode?d.createProgress:d.isDeploying?d.deployProgress:null})]}),u?(0,s.jsxs)("div",{className:x?"absolute inset-0 z-20 flex flex-col bg-[rgba(22,18,14,0.18)] backdrop-blur-sm lg:hidden":"absolute inset-0 z-20 flex flex-col bg-[rgba(2,6,13,0.56)] backdrop-blur-sm lg:hidden",children:[(0,s.jsxs)("div",{className:x?"flex items-center justify-between border-b border-[#e7dfd4] bg-[#fcfaf6] px-4 py-3":"flex items-center justify-between border-b border-white/10 bg-[rgba(4,8,15,0.96)] px-4 py-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:x?"text-[11px] uppercase tracking-[0.18em] text-[#9f958a]":"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:"basic"===d.mode?"Workspace draft":"Workspace blueprint"}),(0,s.jsx)("p",{className:x?"text-[13px] text-[#6f675e]":"text-[13px] text-slate-300",children:"Review the structured side of the same wizard."})]}),(0,s.jsx)("button",{type:"button",onClick:()=>h(!1),className:x?"inline-flex size-9 items-center justify-center rounded-full border border-[#e4ddd3] bg-white text-[#4f4943] transition-colors hover:bg-[#f4efe7]":"inline-flex size-9 items-center justify-center rounded-full border border-white/10 bg-white/[0.05] text-slate-200 transition-colors hover:bg-white/[0.08]",children:(0,s.jsx)(J.A,{className:"h-4 w-4"})})]}),(0,s.jsx)(si,{className:"min-h-0 flex-1 border-t-0 lg:hidden",surfaceTheme:n,mode:d.mode,snapshot:i,plan:d.plan,resolvedName:b,resolvedTemplate:f,sourceAnalysis:d.sourceAnalysis,workspacePath:w,notice:d.notice,basicRules:d.basicRules,basicPreset:d.basicPreset,onBasicPresetChange:d.setBasicPreset,onBasicRuleToggle:d.toggleBasicRule,progress:"basic"===d.mode?d.createProgress:d.isDeploying?d.deployProgress:null})]}):null,(0,s.jsx)("div",{className:x?"relative z-[1] border-t border-[#e7dfd4] bg-white/90 px-4 py-3 backdrop-blur-sm md:px-5":"relative z-[1] border-t border-white/10 bg-[rgba(4,8,15,0.88)] px-4 py-3 backdrop-blur-sm md:px-5",children:(0,s.jsxs)("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[(0,s.jsx)("p",{className:x?"text-[13px] text-[#776f65]":"text-[13px] text-slate-300",children:"basic"===d.mode?"One prompt is enough to start. Create now or open the richer blueprint.":"Advanced keeps the conversation and blueprint aligned through launch review."}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsxs)(I,{variant:"secondary",size:"sm",className:x?"rounded-full border-[#dfd8ce] bg-[#f7f2eb] text-[#403934] hover:bg-[#f1ebe3] lg:hidden":"rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08] lg:hidden",onClick:()=>h(!0),children:[(0,s.jsx)(aJ.A,{className:"mr-2 h-4 w-4"}),"View blueprint"]}),"basic"===d.mode?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(I,{variant:"secondary",size:"sm",className:x?"rounded-full border-[#dfd8ce] bg-[#f7f2eb] text-[#403934] hover:bg-[#f1ebe3]":"rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]",onClick:()=>{d.switchMode("advanced")},disabled:d.isCreating||d.isSending||d.isPlanLoading,children:"Advanced details"}),(0,s.jsxs)(I,{size:"sm",className:x?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",onClick:()=>void T(),disabled:d.isCreating||d.isSending||d.isPlanLoading||!S,children:[d.isCreating?(0,s.jsx)(r.A,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(L.A,{className:"mr-2 h-4 w-4"}),"Create workspace"]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(I,{variant:"secondary",size:"sm",className:x?"rounded-full border-[#dfd8ce] bg-[#f7f2eb] text-[#403934] hover:bg-[#f1ebe3]":"rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]",onClick:()=>void d.savePlan(),disabled:!d.plan||d.isSaving||d.isPlanLoading,children:[d.isSaving?(0,s.jsx)(r.A,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save draft"]}),d.plan?.intake.reviewRequested?(0,s.jsxs)(I,{size:"sm",className:x?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",onClick:()=>void O(),disabled:!d.plan||d.plan.deploy.blockers.length>0||d.isDeploying||d.isPlanLoading,children:[d.isDeploying?(0,s.jsx)(r.A,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(z.A,{className:"mr-2 h-4 w-4"}),"Deploy workspace"]}):(0,s.jsx)(I,{size:"sm",className:x?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",onClick:()=>d.requestReview(),disabled:!d.plan||d.isSending||d.isDeploying,children:"Review blueprint"})]})]})]})})]})]})})}function rb({surfaceTheme:e}){let t="light"===e;return(0,s.jsxs)("div",{className:"mx-auto mt-4 flex w-full max-w-3xl flex-col justify-center px-4 md:mt-16 md:px-8",children:[(0,s.jsx)("p",{className:t?"text-[28px] font-semibold tracking-[-0.03em] text-[#181612]":"text-[28px] font-semibold tracking-[-0.03em] text-white",children:"One message is enough to start."}),(0,s.jsx)("p",{className:t?"mt-2 text-[28px] tracking-[-0.03em] text-[#7f756b]":"mt-2 text-[28px] tracking-[-0.03em] text-slate-400",children:"Describe the outcome, paste a source, and let Architect shape the workspace without pushing you into full planning too early."})]})}function rf({surfaceTheme:e}){let t="light"===e;return(0,s.jsxs)("div",{className:"mx-auto mt-4 flex w-full max-w-3xl flex-col justify-center px-4 md:mt-16 md:px-8",children:[(0,s.jsx)("p",{className:t?"text-[28px] font-semibold tracking-[-0.03em] text-[#181612]":"text-[28px] font-semibold tracking-[-0.03em] text-white",children:"Design the workspace with Architect."}),(0,s.jsx)("p",{className:t?"mt-2 text-[28px] tracking-[-0.03em] text-[#7f756b]":"mt-2 text-[28px] tracking-[-0.03em] text-slate-400",children:"Describe the operating model, and the blueprint will update alongside the conversation."})]})}function rw({surfaceTheme:e}){return(0,s.jsxs)("div",{className:"light"===e?"mx-auto mt-10 flex w-full max-w-3xl items-center gap-3 rounded-[22px] border border-[#e6dfd5] bg-white px-5 py-4 text-[14px] text-[#6d665e]":"mx-auto mt-10 flex w-full max-w-3xl items-center gap-3 rounded-[22px] border border-white/10 bg-white/[0.04] px-5 py-4 text-[14px] text-slate-300",children:[(0,s.jsx)(r.A,{className:"h-4 w-4 animate-spin"}),"Architect is opening the planning session and loading the latest blueprint."]})}function rv({surfaceTheme:e,name:t,source:a,onNameChange:r,onSourceChange:n}){let i="light"===e;return(0,s.jsx)("div",{className:i?"mx-auto w-full max-w-3xl rounded-[24px] border border-[#e4ddd3] bg-white p-4 shadow-[0_24px_80px_rgba(56,47,38,0.06)]":"mx-auto w-full max-w-3xl rounded-[24px] border border-white/10 bg-white/[0.04] p-4 shadow-[0_24px_80px_rgba(0,0,0,0.28)]",children:(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("span",{className:i?"inline-flex size-9 shrink-0 items-center justify-center rounded-full border border-[#e4ddd3] bg-[#faf6f1] text-[#5e5750]":"inline-flex size-9 shrink-0 items-center justify-center rounded-full border border-white/10 bg-white/[0.05] text-slate-300",children:(0,s.jsx)(L.A,{className:"h-4 w-4"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:i?"text-[11px] uppercase tracking-[0.18em] text-[#8b7262]":"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:"Quick setup"}),(0,s.jsx)("p",{className:i?"mt-1 text-[13px] leading-6 text-[#70685f]":"mt-1 text-[13px] leading-6 text-slate-300",children:"Keep the fast path lightweight. Optional name and source live here; the main goal still comes through the composer."}),(0,s.jsxs)("div",{className:"mt-4 grid gap-3 md:grid-cols-2",children:[(0,s.jsx)(rj,{surfaceTheme:e,label:"Workspace name",children:(0,s.jsx)(T,{value:t,onChange:e=>r(e.target.value),placeholder:"Optional. Architect can infer it.",className:i?"border-[#e4ddd3] bg-[#fcfaf6] text-[#1c1916] placeholder:text-[#9b948c] focus-visible:ring-[#b8ada1]":"border-white/10 bg-[rgba(4,8,15,0.64)] text-slate-100 placeholder:text-slate-500 focus-visible:ring-cyan-300/60"})}),(0,s.jsx)(rj,{surfaceTheme:e,label:"Source",children:(0,s.jsx)(T,{value:a,onChange:e=>n(e.target.value),placeholder:"Repo URL, website URL, or existing folder path",className:i?"border-[#e4ddd3] bg-[#fcfaf6] text-[#1c1916] placeholder:text-[#9b948c] focus-visible:ring-[#b8ada1]":"border-white/10 bg-[rgba(4,8,15,0.64)] text-slate-100 placeholder:text-slate-500 focus-visible:ring-cyan-300/60"})})]})]})]})})}function ry({surfaceTheme:e,isBusy:t,onResume:a,onStartFresh:r}){let n="light"===e;return(0,s.jsx)("div",{className:n?"mx-auto w-full max-w-3xl rounded-[22px] border border-[#e4ddd3] bg-[#fffaf3] px-4 py-4 shadow-[0_18px_48px_rgba(56,47,38,0.05)]":"mx-auto w-full max-w-3xl rounded-[22px] border border-white/10 bg-white/[0.05] px-4 py-4",children:(0,s.jsxs)("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:n?"text-[11px] uppercase tracking-[0.18em] text-[#8b7262]":"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:"Previous draft found"}),(0,s.jsx)("p",{className:n?"mt-1 text-[14px] leading-6 text-[#30261d]":"mt-1 text-[14px] leading-6 text-white",children:"Architect still has an earlier workspace blueprint. Resume it or start fresh before creating a new one."})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)(I,{variant:"secondary",size:"sm",className:n?"rounded-full border-[#dfd8ce] bg-white text-[#403934] hover:bg-[#f7f2eb]":"rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]",onClick:r,disabled:t,children:"Start fresh"}),(0,s.jsx)(I,{size:"sm",className:n?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",onClick:a,disabled:t,children:"Resume blueprint"})]})]})})}function rj({surfaceTheme:e,label:t,children:a}){return(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)("p",{className:"light"===e?"text-[11px] uppercase tracking-[0.16em] text-[#8d8276]":"text-[11px] uppercase tracking-[0.16em] text-slate-500",children:t}),a]})}let rk="mission-control-surface-theme",rN="mission-control-hidden-runtime-ids",rC="mission-control-hidden-task-keys",rS="mission-control-locked-task-keys";function rA({initialSnapshot:e}){var t,a,l,o,d,c,p;let{snapshot:u,connectionState:h,refresh:x,refreshSnapshot:g,setSnapshot:b}=function(e){let[t,a]=(0,m.useState)(e),[s,r]=(0,m.useState)("connecting");(0,m.useEffect)(()=>{let e=new EventSource("/api/stream");return e.addEventListener("snapshot",e=>{let t=JSON.parse(e.data);(0,m.startTransition)(()=>{a(t),r("live")})}),e.addEventListener("error",()=>{r("retrying")}),e.addEventListener("ready",()=>{r("live")}),e.onerror=()=>{r("retrying")},()=>{e.close()}},[]);let n=async()=>{let e=await fetch("/api/snapshot",{cache:"no-store"}),t=await e.json();return(0,m.startTransition)(()=>{a(t),r("live")}),t};return{snapshot:t,connectionState:s,refresh:async()=>{await n()},refreshSnapshot:n,setSnapshot:a}}(e),[f,w]=(0,m.useState)(e.workspaces[0]?.id??null),[v,y]=(0,m.useState)(e.workspaces[0]?.id??null),[j,N]=(0,m.useState)("overview"),[C,S]=(0,m.useState)(null),[A,T]=(0,m.useState)(null),[O,R]=(0,m.useState)([]),[M,$]=(0,m.useState)(null),[P,_]=(0,m.useState)([]),[E,D]=(0,m.useState)([]),[L,U]=(0,m.useState)([]),[F,z]=(0,m.useState)(null),[W,B]=(0,m.useState)(null),[q,V]=(0,m.useState)("idle"),[K,J]=(0,m.useState)(null),H=(0,m.useRef)(new Map),[Z,Y]=(0,m.useState)(!1),[es,er]=(0,m.useState)(!1),[en,ei]=(0,m.useState)(!1),[el,eo]=(0,m.useState)(!1),[ec,em]=(0,m.useState)(null),[eu,eh]=(0,m.useState)("idle"),[ex,eg]=(0,m.useState)(null),[eb,ef]=(0,m.useState)(null),[ew,ev]=(0,m.useState)("idle"),[ey,ej]=(0,m.useState)(null),[ek,eN]=(0,m.useState)(null),[eC,eS]=(0,m.useState)(null),[eA,eI]=(0,m.useState)(""),[eT,eO]=(0,m.useState)(""),[eR,eM]=(0,m.useState)(()=>rD(e)),[e$,eP]=(0,m.useState)(()=>rL(e)),[e_,eE]=(0,m.useState)(!1),[eD,eL]=(0,m.useState)(!1),[eU,eF]=(0,m.useState)(!1),[ez,eW]=(0,m.useState)("idle"),[eq,eV]=(0,m.useState)(null),[eK,eJ]=(0,m.useState)(null),[eG,eH]=(0,m.useState)(""),[eZ,eY]=(0,m.useState)("idle"),[eQ,eX]=(0,m.useState)(null),[e0,e1]=(0,m.useState)(null),[e2,e5]=(0,m.useState)(null),[e3,e4]=(0,m.useState)(""),[e8,e6]=(0,m.useState)(null),[e9,e7]=(0,m.useState)(null),[te,tt]=(0,m.useState)("system"),[ta,ts]=(0,m.useState)(""),[tr,tn]=(0,m.useState)([]),[tl,to]=(0,m.useState)("idle"),[td,tc]=(0,m.useState)(null),[tp,tm]=(0,m.useState)(null),[tu,th]=(0,m.useState)(null),[tx,tg]=(0,m.useState)(""),[tb,tf]=(0,m.useState)(null),[tw,tv]=(0,m.useState)(null),[ty,tj]=(0,m.useState)(!1),[tk,tN]=(0,m.useState)(!1),[tC,tS]=(0,m.useState)(!1),[tA,tI]=(0,m.useState)(()=>am(e)),[tT,tO]=(0,m.useState)(null),[tR,tM]=(0,m.useState)(null),[tP,t_]=(0,m.useState)("dark"),[tE,tD]=(0,m.useState)(!1),[tL,tU]=(0,m.useState)("basic"),[tF,tz]=(0,m.useState)(!1),[tW,tB]=(0,m.useState)(null),tq=(0,m.useMemo)(()=>(function(e,t){if(0===t.length)return e;let a=t.filter(t=>!t.dispatchId||!e.tasks.some(e=>e.dispatchId===t.dispatchId)).map(e=>e.task);return 0===a.length?e:{...e,tasks:[...a,...e.tasks]}})(u,O),[u,O]),tV=(0,m.useCallback)((e,t="overview")=>{y(e),N(t)},[]),tJ=(0,m.useRef)(null),tG=(0,m.useRef)(null),tH=u.runtimes.filter(e=>"running"===e.status||"queued"===e.status).length,tZ=ap(u),tY=am(u),tQ=[u.diagnostics.updatePackageManager,u.diagnostics.updateInstallKind].filter(Boolean).join(" \xb7 "),tX="running"===ez,t0="success"===ez||"error"===ez,t1="running"===(t=ez)?"Updating OpenClaw":"success"===t?"Update complete":"error"===t?"Update failed":"Update OpenClaw",t2="running"===(a=ez)?"OpenClaw is being updated now. Local gateway activity may pause briefly while the CLI is replaced.":"success"===a?"The CLI update finished. Review the result below, then close this panel when you are done.":"error"===a?"The update did not complete cleanly. Review the result and captured output before trying again.":"This runs openclaw update against the installed CLI and may briefly interrupt local gateway activity.",t5=(l=u).diagnostics.installed?ap(l)?{label:"Enter Mission Control",description:"OpenClaw is online and the runtime state is writable."}:l.diagnostics.rpcOk?{label:"Repair runtime access",description:"OpenClaw is online, but Mission Control still needs verified write access to the runtime state."}:l.diagnostics.loaded?(!l.diagnostics.rpcOk,{label:"Start OpenClaw",description:"Start the local gateway service and wait for a live RPC connection."}):{label:"Prepare local gateway",description:"OpenClaw CLI is already ready. Mission Control will register the local gateway service once, then start it."}:{label:"Install OpenClaw",description:"Download the OpenClaw CLI and prepare this machine for Mission Control."},t3=tH>0||O.length>0,t4=!ty&&!tY&&!t3&&(!tA||"offline"===u.diagnostics.health),t8=u.tasks.filter(e=>!f||e.workspaceId===f),t6=t8.filter(e=>rP(e,P,E,L)).length,t9=t8.filter(e=>"completed"===e.status||"stalled"===e.status||"cancelled"===e.status||"idle"===e.status||rR(e)).length;(0,m.useEffect)(()=>{!f||u.workspaces.some(e=>e.id===f)||w(u.workspaces[0]?.id??null)},[u.workspaces,f]),(0,m.useEffect)(()=>{!v||tq.workspaces.some(e=>e.id===v)||tq.agents.some(e=>e.id===v)||tq.tasks.some(e=>e.id===v)||tq.runtimes.some(e=>e.id===v)||tq.models.some(e=>e.id===v)||tV(f||tq.workspaces[0]?.id||null)},[tq,v,f,tV]),(0,m.useEffect)(()=>{let e=tq.tasks.find(e=>e.id===v),t=e&&rP(e,P,E,L);v&&(P.includes(v)||t)&&tV(f||tq.workspaces[0]?.id||null)},[v,P,E,L,f,tq.workspaces,tq.tasks,tV]),(0,m.useEffect)(()=>{let e=globalThis.localStorage?.getItem(rk),t=globalThis.localStorage?.getItem(rN),a=globalThis.localStorage?.getItem(rC),s=globalThis.localStorage?.getItem(rS);if(("dark"===e||"light"===e)&&t_(e),t)try{let e=JSON.parse(t);Array.isArray(e)&&_(e.filter(e=>"string"==typeof e))}catch{}if(a)try{let e=JSON.parse(a);Array.isArray(e)&&D(e.filter(e=>"string"==typeof e))}catch{}if(s)try{let e=JSON.parse(s);Array.isArray(e)&&U(e.filter(e=>"string"==typeof e))}catch{}},[]),(0,m.useEffect)(()=>{globalThis.localStorage?.setItem(rk,tP)},[tP]),(0,m.useEffect)(()=>{globalThis.localStorage?.setItem(rN,JSON.stringify(P))},[P]),(0,m.useEffect)(()=>{globalThis.localStorage?.setItem(rC,JSON.stringify(E))},[E]),(0,m.useEffect)(()=>{globalThis.localStorage?.setItem(rS,JSON.stringify(L))},[L]),(0,m.useEffect)(()=>{if(!A)return;let e=u.tasks.find(e=>e.dispatchId===A);e&&(y(t=>t===e.id?t:(N("overview"),e.id)),er(!0),T(null))},[A,u.tasks]),(0,m.useEffect)(()=>{R(e=>e.filter(e=>{let t="string"==typeof e.task.metadata.dispatchSubmittedAt?Date.parse(e.task.metadata.dispatchSubmittedAt):e.task.updatedAt??NaN,a=!Number.isNaN(t)&&Date.now()-t>18e5;if(!e.dispatchId)return!a;let s=u.tasks.find(t=>t.dispatchId===e.dispatchId);return s?"running"===s.status||"queued"===s.status:!a}))},[u.tasks]),(0,m.useEffect)(()=>{en||e_||eD||(eM(rD(u)),eP(rL(u)))},[u,en,e_,eD]),(0,m.useEffect)(()=>{tY&&tj(!1)},[tY]),(0,m.useEffect)(()=>{tY&&tI(!0)},[tY]),(0,m.useEffect)(()=>{ts(e=>{let t=u.models.filter(e=>!1!==e.available&&!e.missing).map(e=>e.id),a=u.diagnostics.modelReadiness.recommendedModelId;return e&&t.includes(e)?e:a&&t.includes(a)?a:t[0]||""})},[u.models,u.diagnostics.modelReadiness.recommendedModelId]),(0,m.useEffect)(()=>{tZ?tt("models"):tt("system")},[tZ]),(0,m.useEffect)(()=>{(tG.current&&(globalThis.clearTimeout(tG.current),tG.current=null),tY)?"idle"!==eZ||"idle"!==tl?(eY("success"),eX("ready"),e1(null),e5("OpenClaw and a usable default model are ready. Entering Mission Control..."),to("success"),tc("ready"),tm(null),th("A usable default model is ready."),tt("models"),tS(!0),tG.current=globalThis.setTimeout(()=>{tS(!1)},1100)):tS(!1):tS(!1)},[tY,eZ,tl]),(0,m.useEffect)(()=>()=>{tG.current&&globalThis.clearTimeout(tG.current)},[]);let t7=()=>{"running"!==ez&&(eW("idle"),eV(null),eJ(null),eH(""))},ae=e=>{eH(t=>{let a=`${t}${e}`;return a.length>4e4?a.slice(a.length-4e4):a})},at=e=>{e4(t=>{let a=`${t}${e}`;return a.length>4e4?a.slice(a.length-4e4):a})},aa=e=>{tg(t=>{let a=`${t}${e}`;return a.length>4e4?a.slice(a.length-4e4):a})},as=e=>{eI(t=>{let a=`${t}${e}`;return a.length>4e4?a.slice(a.length-4e4):a})},ar=(0,m.useCallback)(async()=>{if(!W||"running"===q)return;let e="string"==typeof W.metadata.optimisticRequestId?W.metadata.optimisticRequestId:null,t=e?O.find(t=>t.requestId===e):O.find(e=>e.task.id===W.id),a="string"==typeof W.dispatchId?W.dispatchId:t?.dispatchId??null;if(e&&!a){H.current.get(e)?.abort(),H.current.delete(e),R(t=>t.map(t=>t.requestId===e?{...t,task:r$(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)),ed.o.success("Mission submission cancelled.",{description:W.title}),B(null),V("idle"),J(null);return}V("running"),J(null);try{let e=await fetch(`/api/tasks/${encodeURIComponent(W.id)}/abort`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Aborted from Mission Control.",dispatchId:a})}),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||t?.message||t?.summary||"Unable to abort task.");ed.o.success("Task abort requested.",{description:W.title}),B(null),V("idle"),await x()}catch(t){let e=t instanceof Error?t.message:"Unknown abort error.";V("error"),J(e),ed.o.error("Task abort failed.",{description:e})}},[O,x,W,q]),an=e=>{e&&tn(e)};(0,m.useEffect)(()=>{if(!en)return;let e=e=>{tJ.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)}},[en]);let ai=async()=>{eF(!0),eW("running"),eV("Starting OpenClaw update..."),eJ(null),eH("");try{let e=await fetch("/api/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirmed:!0})});if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||"OpenClaw update request failed.")}if(!e.body)throw Error("OpenClaw update 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?(eV(t.message),ae(`
6
+ > ${t.message}
7
+ `)):"log"===t.type?ae(t.text):(r=!0,eV(null),eJ(t.message),eW(t.ok?"success":"error"),t.snapshot&&b(t.snapshot),t.ok?ed.o.success("OpenClaw updated.",{description:t.message}):ed.o.error("OpenClaw update failed.",{description:t.message}))}i=s.indexOf("\n")}}let n=s.trim();if(n){let e=JSON.parse(n);"done"===e.type&&(r=!0,eV(null),eJ(e.message),eW(e.ok?"success":"error"),e.snapshot&&b(e.snapshot))}if(!r)throw Error("OpenClaw update stream ended unexpectedly.")}catch(e){eW("error"),eV(null),eJ(e instanceof Error?e.message:"OpenClaw update failed."),ed.o.error("OpenClaw update failed.",{description:e instanceof Error?e.message:"Unknown update error."})}},al=async()=>{tj(!1),tt("system"),eY("running"),eX("detecting"),e1("Checking local OpenClaw status..."),e5(null),e6(null),e7(null),e4("");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?(eX(t.phase),e1(t.message),at(`
8
+ > ${t.message}
9
+ `)):"log"===t.type?at(t.text):(r=!0,eX(t.phase),e1(null),e5(t.message),e6(t.manualCommand??null),e7(t.docsUrl??null),eY(t.ok?"success":"error"),t.snapshot&&b(t.snapshot),t.ok?ed.o.success("System setup ready.",{description:t.message}):ed.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,eX(e.phase),e1(null),e5(e.message),e6(e.manualCommand??null),e7(e.docsUrl??null),eY(e.ok?"success":"error"),e.snapshot&&b(e.snapshot))}if(!r)throw Error("OpenClaw onboarding stream ended unexpectedly.")}catch(e){eY("error"),e1(null),e5(e instanceof Error?e.message:"OpenClaw onboarding failed."),ed.o.error("OpenClaw onboarding failed.",{description:e instanceof Error?e.message:"Unknown onboarding error."})}},ao=async e=>{var t,a;let s="discover"===(t=e.intent)?{statusMessage:"Scanning remote model routes...",successTitle:"Models discovered.",errorTitle:"Model discovery failed."}:"login-provider"===t?{statusMessage:"Preparing provider auth...",successTitle:"Provider connected.",errorTitle:"Provider auth needs attention."}:"refresh"===t?{statusMessage:"Refreshing model status...",successTitle:"Model setup refreshed.",errorTitle:"Model refresh failed."}:{statusMessage:"Checking available models and provider auth...",successTitle:"Model setup ready.",errorTitle:"Model setup failed."};tj(!1),tt("models"),to("running"),tc("refresh"===(a=e.intent)?"refreshing":"discover"===a?"discovering":"detecting"),tm(s.statusMessage),th(null),tf(null),tv(null),tg("");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(),r=new TextDecoder,n="",i=!1;for(;;){let{value:e,done:t}=await a.read();if(t)break;let l=(n+=r.decode(e,{stream:!0})).indexOf("\n");for(;l>=0;){let e=n.slice(0,l).trim();if(n=n.slice(l+1),e){let t=JSON.parse(e);"status"===t.type?(tc(t.phase),tm(t.message),aa(`
10
+ > ${t.message}
11
+ `)):"log"===t.type?aa(t.text):(i=!0,tc(t.phase),tm(null),th(t.message),tf(t.manualCommand??null),tv(t.docsUrl??null),to(t.ok?"success":"error"),an(t.discoveredModels),t.snapshot&&b(t.snapshot),t.ok?ed.o.success(s.successTitle,{description:t.message}):"authenticating"===t.phase&&t.manualCommand?ed.o.message("Continue in terminal.",{description:t.message}):ed.o.error(s.errorTitle,{description:t.message}))}l=n.indexOf("\n")}}let l=n.trim();if(l){let e=JSON.parse(l);"done"===e.type&&(i=!0,tc(e.phase),tm(null),th(e.message),tf(e.manualCommand??null),tv(e.docsUrl??null),to(e.ok?"success":"error"),an(e.discoveredModels),e.snapshot&&b(e.snapshot))}if(!i)throw Error("Model onboarding stream ended unexpectedly.")}catch(e){to("error"),tm(null),th(e instanceof Error?e.message:"Model onboarding failed."),ed.o.error(s.errorTitle,{description:e instanceof Error?e.message:"Unknown model onboarding error."})}},ad=async()=>{await ao({intent:"auto",modelId:ta||void 0})},ac=async()=>{await ao({intent:"refresh"})},ah=async()=>{await ao({intent:"discover"})},ax=async e=>{await ao({intent:"login-provider",provider:e})},ag=async e=>{let t=e||ta;t?await ao({intent:"set-default",modelId:t}):await ad()},ab=(e=tZ?"models":"system")=>{ei(!1),tt(e),tj(!1),tS(!1),tN(!0)},af=async e=>{tO(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.");b(a.snapshot),ed.o.success("Gateway updated.",{description:a.message||"Gateway state changed."})}catch(e){ed.o.error("Gateway action failed.",{description:e instanceof Error?e.message:"Unknown gateway control error."})}finally{tO(null)}},aw=e=>{tB(e??null),tz(!0)},av=async()=>{eo(!0);try{let e=await g(),t=Date.now(),a=e.diagnostics.updateInfo?.trim();if(tM(t),!e.diagnostics.installed)return void ed.o.message("OpenClaw is unavailable.",{description:e.diagnostics.issues[0]||"Mission Control is running in fallback mode."});if(e.diagnostics.updateAvailable)return void ed.o.message("Update available.",{description:a||`v${e.diagnostics.latestVersion} is available. Current version: v${e.diagnostics.version||"unknown"}.`});if(e.diagnostics.latestVersion&&!e.diagnostics.version)return void ed.o.message("Update status refreshed.",{description:a||`Latest available version: v${e.diagnostics.latestVersion}.`});if(e.diagnostics.updateError)return void ed.o.error("Update check could not reach the registry.",{description:a||e.diagnostics.updateError});ed.o.success("OpenClaw is up to date.",{description:a||`Current version: v${e.diagnostics.version||"unknown"}. No newer release was reported.`})}catch(e){ed.o.error("Update check failed.",{description:e instanceof Error?e.message:"Unable to refresh OpenClaw status."})}finally{eo(!1)}},ay=async e=>{eE(!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();b(a.snapshot),eM(rD(a.snapshot)),ed.o.success("Gateway updated.",{description:e?.trim()?`Mission Control now targets ${a.snapshot.diagnostics.configuredGatewayUrl||a.snapshot.diagnostics.gatewayUrl}.`:"Mission Control reverted to the local default gateway."})}catch(e){ed.o.error("Gateway update failed.",{description:e instanceof Error?e.message:"Unable to update the OpenClaw gateway."})}finally{eE(!1)}},aj=async e=>{eL(!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();b(a.snapshot),eP(rL(a.snapshot)),ed.o.success("Workspace root updated.",{description:e?.trim()?`New workspaces will default to ${eB(a.snapshot.diagnostics.workspaceRoot)}. Existing workspaces stay where they are.`:"Mission Control reverted to the default workspace root. Existing workspaces were not moved."})}catch(e){ed.o.error("Workspace root update failed.",{description:e instanceof Error?e.message:"Unable to update the default workspace root."})}finally{eL(!1)}},ak=()=>{if(void 0===globalThis.localStorage)return;let e=["mission-control-composer-draft:"];for(let e of["mission-control-surface-theme","mission-control-workspace-plan-id","mission-control-recent-prompts"])globalThis.localStorage.removeItem(e);for(let t=globalThis.localStorage.length-1;t>=0;t-=1){let a=globalThis.localStorage.key(t);a&&e.some(e=>a.startsWith(e))&&globalThis.localStorage.removeItem(a)}},aN=()=>{eh("idle"),eg(null),ef(null),ev("idle"),ej(null),eN(null),eS(null),eI(""),eO("")},aC=async e=>{eh("loading"),eg(null),ef(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.");eg(a.preview),eh("ready")}catch(e){eh("error"),ef(e instanceof Error?e.message:"Reset preview failed.")}},aS=async e=>{ei(!1),em(e),aN(),await aC(e)},aI=async()=>{if(ec){ev("running"),ej("full-uninstall"===ec?"Starting full uninstall...":"Starting Mission Control reset..."),eN(null),eS(null),eI("");try{let e=await fetch("/api/reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intent:"execute",target:ec,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?(ej(t.message),as(`
12
+ > ${t.message}
13
+ `)):"log"===t.type?as(`${t.text}
14
+ `):(r=!0,ej(null),eN(t.message),eS(t.backgroundLogPath??null),ev(t.ok?"success":"error"),t.snapshot&&b(t.snapshot),t.ok?(ak(),ed.o.success("full-uninstall"===ec?"Full uninstall started.":"Mission Control reset completed.",{description:t.message})):ed.o.error("full-uninstall"===ec?"Full uninstall failed.":"Mission Control 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,ej(null),eN(e.message),eS(e.backgroundLogPath??null),ev(e.ok?"success":"error"),e.snapshot&&b(e.snapshot),e.ok&&ak())}if(!r)throw Error("Reset stream ended unexpectedly.")}catch(e){ev("error"),ej(null),eN(e instanceof Error?e.message:"Reset failed."),ed.o.error("full-uninstall"===ec?"Full uninstall failed.":"Mission Control reset failed.",{description:e instanceof Error?e.message:"Unknown reset error."})}}};return(0,s.jsxs)("div",{className:k("mission-shell relative min-h-screen overflow-hidden","light"===tP&&"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)(ti,{snapshot:tq,activeWorkspaceId:f,selectedNodeId:v,recentDispatchId:A,hiddenRuntimeIds:P,hiddenTaskKeys:E,lockedTaskKeys:L,className:"rounded-none",onEditAgent:e=>{tV(e),z({requestId:`edit:${e}:${Date.now()}`,kind:"edit",agentId:e})},onDeleteAgent:e=>{tV(e),z({requestId:`delete:${e}:${Date.now()}`,kind:"delete",agentId:e})},onReplyTask:e=>{let t=rO(e);$({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=rO(e);$({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),ed.o.success("Prompt copied to clipboard.",{description:"The mission input was also populated."})}catch{ed.o.message("Prompt moved into mission input.",{description:"Clipboard access was not available."})}},onHideTask:e=>{L.includes(e.key)||(D(t=>t.includes(e.key)?t:[...t,e.key]),_(t=>{let a=new Set(t);return e.runtimeIds.forEach(e=>a.add(e)),Array.from(a)}))},onToggleTaskLock:e=>{U(t=>t.includes(e.key)?t.filter(t=>t!==e.key):[...t,e.key])},onAbortTask:e=>{rM(e)&&(B(e),V("idle"),J(null))},onInspectTask:(e,t)=>{tV(e.id,t),er(!0)},onSelectNode:e=>{tV(e)}})})]}),(0,s.jsx)("div",{className:k("pointer-events-none absolute top-0 z-40 hidden lg:block",Z?"lg:left-[442px]":"lg:left-[118px]",es?"lg:right-[442px]":"lg:right-[118px]"),children:(0,s.jsx)(rT,{snapshot:u,surfaceTheme:tP,settingsRef:tJ,isSettingsOpen:en,gatewayDraft:eR,workspaceRootDraft:e$,isSavingGateway:e_,isSavingWorkspaceRoot:eD,isCheckingForUpdates:el,selectedModelId:ta,modelOnboardingRunState:tl,gatewayControlAction:tT,lastCheckedAt:tR,onToggleTheme:()=>t_(e=>"light"===e?"dark":"light"),onToggleSettings:()=>ei(e=>!e),onGatewayDraftChange:eM,onWorkspaceRootDraftChange:eP,onSelectedModelIdChange:ts,onSaveGatewaySettings:ay,onSaveWorkspaceRootSettings:aj,onCheckForUpdates:av,onControlGateway:af,onOpenSetupWizard:ab,onRunModelRefresh:ac,onRunModelSetDefault:ag,onOpenAddModels:aw,onOpenUpdateDialog:()=>{t7(),eF(!0)},onOpenResetDialog:e=>{aS(e)}})}),(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)(rI,{surfaceTheme:tP})}),(0,s.jsx)("div",{className:k("pointer-events-auto absolute left-4 top-4 z-30",Z?"bottom-[calc(env(safe-area-inset-bottom)+124px)] w-[calc(100vw-112px)] max-w-[300px] lg:bottom-[244px] lg:top-6 lg:w-[394px] lg:max-w-none":"w-[78px] lg:bottom-[244px] lg:top-6"),children:(0,s.jsx)(aM,{snapshot:tq,activeWorkspaceId:f,requestedAgentAction:F,connectionState:h,collapsed:!Z,modelManager:{runState:tl,statusMessage:tp,resultMessage:tu,log:tx,manualCommand:tb,docsUrl:tw,discoveredModels:tr,systemReady:tZ},onToggleCollapsed:()=>Y(e=>!e),onSelectWorkspace:e=>{w(e),tV(e)},onRefresh:x,onRunModelRefresh:ac,onRunModelDiscover:ah,onRunModelSetDefault:ag,onConnectModelProvider:ax,onOpenModelSetup:()=>ab(tZ?"models":"system"),onOpenAddModels:aw})}),(0,s.jsx)("div",{className:k("pointer-events-auto absolute right-4 top-4 z-30",es?"bottom-[calc(env(safe-area-inset-bottom)+124px)] w-[calc(100vw-112px)] max-w-[300px] lg:bottom-[244px] lg:top-6 lg:w-[394px] lg:max-w-none":"w-[78px] lg:bottom-[244px] lg:top-6"),children:(0,s.jsx)(tK,{snapshot:tq,selectedNodeId:v,lastMission:C,collapsed:!es,onToggleCollapsed:()=>er(e=>!e),activeTab:j,onActiveTabChange:N,onAbortTask:e=>{rM(e)&&(B(e),V("idle"),J(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-full max-w-[260px] items-center justify-between rounded-full border border-white/[0.08] bg-[linear-gradient(180deg,rgba(10,16,26,0.96),rgba(6,10,18,0.94))] p-0.5 text-[8px] text-slate-200 shadow-[0_10px_24px_rgba(0,0,0,0.14)]",children:[(0,s.jsxs)("span",{className:"truncate pl-1.5 pr-1 leading-3 text-slate-300",children:[t6," hidden"]}),(0,s.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[(0,s.jsx)(I,{type:"button",variant:"secondary",size:"sm",disabled:0===t9,className:"h-5 rounded-full border-white/[0.1] bg-white/[0.06] px-1.5 text-[8px] text-slate-200 hover:bg-white/[0.1]",onClick:()=>{let e=t8.filter(e=>("completed"===e.status||"stalled"===e.status||"idle"===e.status||rR(e))&&!L.includes(e.key)).map(e=>e.key);0!==e.length&&D(t=>Array.from(new Set([...t,...e])))},children:"Hide"}),(0,s.jsx)(I,{type:"button",variant:"secondary",size:"sm",disabled:0===t6,className:"h-5 rounded-full border-white/[0.1] bg-white/[0.06] px-1.5 text-[8px] text-slate-200 hover:bg-white/[0.1]",onClick:()=>{let e=new Set(t8.map(e=>e.key)),t=new Set(t8.flatMap(e=>e.runtimeIds));D(t=>t.filter(t=>!e.has(t))),_(e=>e.filter(e=>!t.has(e)))},children:"Show"})]})]}),(0,s.jsx)(t$,{snapshot:tq,activeWorkspaceId:f,selectedNodeId:v,composeIntent:M,onRefresh:x,onOpenWorkspaceCreate:()=>{tU("basic"),tD(!0)},onMissionDispatchStart:e=>{var t,a;let s,r,n;H.current.set(e.requestId,e.abortController);let i=(t=e,a=u,s=new Date(t.submittedAt).toISOString(),r=a.agents.find(e=>e.id===t.agentId),n={id:`optimistic:${t.requestId}:submitted`,kind:"user",timestamp:s,title:"Mission submitted",detail:rE(t.mission,220),agentId:t.agentId},{requestId:t.requestId,dispatchId:null,task:{id:`optimistic-task:${t.requestId}`,key:`optimistic:${t.requestId}`,title:rE(t.mission,86),mission:t.mission,subtitle:"Sending mission to AgentOS. Waiting for a dispatch id.",status:"queued",updatedAt:t.submittedAt,ageMs:0,workspaceId:t.workspaceId??void 0,primaryAgentId:t.agentId,primaryAgentName:r?.name??"OpenClaw",runtimeIds:[],agentIds:[t.agentId],sessionIds:[],runIds:[],runtimeCount:0,updateCount:0,liveRunCount:0,artifactCount:0,warningCount:0,metadata:{optimistic:!0,optimisticRequestId:t.requestId,bootstrapStage:"submitting",dispatchSubmittedAt:s,optimisticEvents:[n]}}});R(t=>[i,...t.filter(t=>t.requestId!==e.requestId)]),e.workspaceId&&w(e.workspaceId),tV(i.task.id),er(!0)},onMissionDispatchFailure:(e,t)=>{H.current.delete(e),R(a=>a.map(a=>a.requestId===e?{...a,task:r$(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)=>{H.current.delete(t.requestId),S(e),R(a=>a.map(a=>a.requestId===t.requestId?{...a,dispatchId:e.dispatchId??a.dispatchId,task:r$(a.task,{dispatchId:e.dispatchId,status:"stalled"===e.status?"stalled":"cancelled"===e.status?"cancelled":"queued",subtitle:e.summary,bootstrapStage:"stalled"===e.status?"stalled":"cancelled"===e.status?"cancelled":"accepted",feedEvent:{id:`${a.task.id}:response:${Date.now()}`,kind:"stalled"===e.status||"cancelled"===e.status?"warning":"status",timestamp:new Date().toISOString(),title:"stalled"===e.status?"Dispatch blocked":"cancelled"===e.status?"Dispatch cancelled":"Mission accepted",detail:e.summary||"Mission accepted and queued for OpenClaw execution.",isError:"stalled"===e.status||"cancelled"===e.status}})}:a)),e.dispatchId&&T(e.dispatchId)}})]}),t4||tC||tk?(0,s.jsx)(au,{snapshot:u,surfaceTheme:tP,stage:te,systemActionLabel:t5.label,systemActionDescription:t5.description,systemPhase:eQ,modelPhase:td,systemRun:{runState:eZ,statusMessage:e0,resultMessage:e2,log:e3,manualCommand:e8,docsUrl:e9},modelRun:{runState:tl,statusMessage:tp,resultMessage:tu,log:tx,manualCommand:tb,docsUrl:tw},selectedModelId:ta,discoveredModels:tr,onSelectedModelIdChange:ts,onRunSystemSetup:al,onRunModelAutoSetup:ad,onRunModelDiscover:ah,onRunModelRefresh:ac,onRunModelSetDefault:ag,onContinueToModels:()=>tt("models"),onBackToSystem:()=>tt("system"),onDismiss:()=>{tN(!1),tS(!1),tY||tj(!0)},canDismiss:!tC&&"running"!==eZ&&"running"!==tl}):null,(0,s.jsx)(rg,{open:tE,onOpenChange:tD,initialMode:tL,surfaceTheme:tP,snapshot:u,onRefresh:x,onWorkspaceCreated:e=>{w(e),tV(e)}}),(0,s.jsx)(ep,{open:tF,onOpenChange:tz,snapshot:u,initialProvider:tW,onSnapshotChange:b}),(0,s.jsx)(aA,{open:null!==ec,target:ec,surfaceTheme:tP,previewState:eu,preview:ex,previewError:eb,runState:ew,statusMessage:ey,resultMessage:ek,backgroundLogPath:eC,log:eA,confirmText:eT,onConfirmTextChange:eO,onRefreshPreview:()=>{ec&&aC(ec)},onExecute:()=>{aI()},onOpenChange:e=>{e||"running"!==ew&&(em(null),aN())}}),(0,s.jsx)(G,{open:null!==W,onOpenChange:e=>{"running"!==q&&(e||(B(null),V("idle"),J(null)))},children:(0,s.jsxs)(Q,{className:k("max-w-[480px] gap-5 p-5 sm:p-6","light"===tP?"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)(X,{children:[(0,s.jsx)(et,{className:"light"===tP?"text-[#3f2f24]":"text-white",children:"Abort task?"}),(0,s.jsx)(ea,{className:"light"===tP?"text-[#7e6555]":"text-slate-400",children:"This stops the current OpenClaw dispatch for the selected task. It does not delete captured evidence or files."})]}),W?(0,s.jsxs)("div",{className:k("rounded-[20px] border px-4 py-4","light"===tP?"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:W.title}),(0,s.jsx)("p",{className:k("mt-1 text-sm leading-6","light"===tP?"text-[#8b7262]":"text-rose-100/80"),children:W.subtitle}),K?(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:K}):null]}):null,(0,s.jsxs)(ee,{children:[(0,s.jsx)(I,{type:"button",variant:"secondary",disabled:"running"===q,className:"light"===tP?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",onClick:()=>{"running"!==q&&(B(null),V("idle"),J(null))},children:"Cancel"}),(0,s.jsx)(I,{type:"button",variant:"destructive",disabled:!W||"running"===q,onClick:()=>{ar()},children:"running"===q?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Aborting..."]}):"Abort task"})]})]})}),(0,s.jsxs)("div",{className:k("pointer-events-auto absolute bottom-3 right-4 z-30 text-[11px] tracking-[0.04em] lg:bottom-4 lg:right-6","light"===tP?"text-[#8f7664]":"text-slate-500"),children:["Built on"," ",(0,s.jsx)("a",{href:"https://openclaw.ai/",target:"_blank",rel:"noreferrer",className:k("transition-colors","light"===tP?"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:k("transition-colors","light"===tP?"text-[#6f5a4b] hover:text-[#4f3d31]":"text-slate-300 hover:text-slate-100"),children:"SapienX"})]}),(0,s.jsx)(G,{open:eU,onOpenChange:e=>{"running"!==ez&&(eF(e),e||t7())},children:(0,s.jsxs)(Q,{className:k("max-w-[468px] gap-5 p-5 sm:p-6","light"===tP?"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)(X,{children:[(0,s.jsx)(et,{className:"light"===tP?"text-[#3f2f24]":"text-white",children:t1}),(0,s.jsx)(ea,{className:"light"===tP?"text-[#7e6555]":"text-slate-400",children:t2})]}),t0?(0,s.jsxs)("div",{className:k("space-y-4","light"===tP?"text-[#4f3d31]":"text-slate-200"),children:[(0,s.jsxs)("div",{className:k("rounded-[24px] border px-4 py-5",(o=ez,d=tP,"success"===o?"light"===d?"border-emerald-300 bg-emerald-50/80 text-emerald-950":"border-emerald-300/25 bg-emerald-300/10 text-emerald-50":"light"===d?"border-rose-300 bg-rose-50/90 text-rose-950":"border-rose-300/25 bg-rose-300/10 text-rose-50")),children:[(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("div",{className:k("flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl border",(c=ez,p=tP,"success"===c?"light"===p?"border-emerald-300 bg-white/80 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"light"===p?"border-rose-300 bg-white/80 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200")),children:"success"===ez?(0,s.jsx)(n.A,{className:"h-5 w-5"}):(0,s.jsx)(i.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"===ez?"OpenClaw is up to date":"Update needs attention"}),(0,s.jsx)("p",{className:"mt-1 text-sm leading-6",children:eK||("success"===ez?"The update finished successfully.":"The update did not finish cleanly.")})]})]}),(0,s.jsxs)("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[(0,s.jsxs)("div",{className:k("rounded-[18px] border px-3 py-3","light"===tP?"border-white/70 bg-white/70":"border-white/10 bg-slate-950/30"),children:[(0,s.jsx)("p",{className:"light"===tP?"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",u.diagnostics.version||u.diagnostics.latestVersion||"unknown"]})]}),(0,s.jsxs)("div",{className:k("rounded-[18px] border px-3 py-3","light"===tP?"border-white/70 bg-white/70":"border-white/10 bg-slate-950/30"),children:[(0,s.jsx)("p",{className:"light"===tP?"text-[10px] uppercase tracking-[0.22em] text-[#8d725f]":"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Install mode"}),(0,s.jsx)("p",{className:"mt-2 text-sm font-medium text-inherit",children:tQ||"unknown"})]})]})]}),(0,s.jsxs)("div",{className:k("rounded-[20px] border","light"===tP?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,s.jsxs)("div",{className:k("flex items-center justify-between border-b px-4 py-3","light"===tP?"border-[#eadccf]":"border-white/8"),children:[(0,s.jsx)("p",{className:k("text-[10px] uppercase tracking-[0.24em]","light"===tP?"text-[#9a7f6c]":"text-slate-500"),children:"Update log"}),(0,s.jsx)("span",{className:"light"===tP?"text-xs text-[#8b7262]":"text-xs text-slate-400",children:"success"===ez?"Completed":"Failed"})]}),(0,s.jsx)("pre",{className:k("max-h-[180px] overflow-auto whitespace-pre-wrap break-words px-4 py-3 font-mono text-[11px] leading-5","light"===tP?"text-[#4f3d31]":"text-slate-200"),children:eG||"No command output was captured."})]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:k("grid gap-3 sm:grid-cols-2","light"===tP?"text-[#4f3d31]":"text-slate-200"),children:[(0,s.jsxs)("div",{className:k("rounded-[20px] border px-4 py-4","light"===tP?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,s.jsx)("p",{className:k("text-[10px] uppercase tracking-[0.24em]","light"===tP?"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",u.diagnostics.latestVersion||u.diagnostics.version||"unknown"]}),(0,s.jsxs)("p",{className:"light"===tP?"mt-1 text-xs text-[#8b7262]":"mt-1 text-xs text-slate-400",children:["Current: v",u.diagnostics.version||"unknown"]})]}),(0,s.jsxs)("div",{className:k("rounded-[20px] border px-4 py-4","light"===tP?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,s.jsx)("p",{className:k("text-[10px] uppercase tracking-[0.24em]","light"===tP?"text-[#9a7f6c]":"text-slate-500"),children:"Install mode"}),(0,s.jsx)("p",{className:"mt-2 text-sm font-medium leading-6 text-inherit",children:tQ||"unknown"}),(0,s.jsx)("p",{className:"light"===tP?"mt-1 text-xs text-[#8b7262]":"mt-1 text-xs text-slate-400",children:eB(u.diagnostics.updateRoot||"")||"Install root unavailable"})]})]}),(0,s.jsx)("div",{className:k("rounded-[20px] border px-4 py-3 text-sm",tH>0?"light"===tP?"border-rose-300/80 bg-rose-50 text-rose-800":"border-rose-300/25 bg-rose-300/10 text-rose-100":"light"===tP?"border-[#e3d4c8] bg-[#fffaf6] text-[#745e4f]":"border-white/8 bg-white/[0.03] text-slate-300"),children:tH>0?`${tH} running or queued runtime${1===tH?"":"s"} may be interrupted during the update.`:"No running runtimes are currently tracked, so the update risk is lower."}),tX?(0,s.jsxs)("div",{className:k("rounded-[20px] border","light"===tP?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,s.jsxs)("div",{className:k("flex items-center gap-3 border-b px-4 py-3","light"===tP?"border-[#eadccf]":"border-white/8"),children:[(0,s.jsx)("div",{className:k("flex h-9 w-9 items-center justify-center rounded-2xl border","light"===tP?"border-[#dcc6b6] bg-[#f4e8dd] text-[#7b6453]":"border-white/10 bg-white/[0.05] text-slate-200"),children:(0,s.jsx)(r.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"===tP?"text-sm font-medium text-[#4a382c]":"text-sm font-medium text-white",children:"Update in progress"}),(0,s.jsx)("p",{className:"light"===tP?"text-xs text-[#8b7262]":"text-xs text-slate-400",children:eq||"Streaming OpenClaw output..."})]})]}),(0,s.jsx)("pre",{className:k("max-h-[180px] min-h-[120px] overflow-auto whitespace-pre-wrap break-words px-4 py-3 font-mono text-[11px] leading-5","light"===tP?"text-[#4f3d31]":"text-slate-200"),children:eG||"Waiting for command output..."})]}):null]}),(0,s.jsxs)(ee,{children:[(0,s.jsx)(I,{type:"button",variant:"secondary",onClick:()=>{eF(!1),t7()},disabled:tX,className:"light"===tP?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",children:t0?"Done":"Cancel"}),t0?null:(0,s.jsx)(I,{type:"button",onClick:ai,disabled:tX,className:k(u.diagnostics.updateAvailable?"bg-amber-400 text-slate-950 shadow-lg shadow-amber-400/20 hover:bg-amber-300":"","light"!==tP||u.diagnostics.updateAvailable?"":"bg-[#c8946f] text-white shadow-[0_12px_28px_rgba(200,148,111,0.24)] hover:bg-[#b88461]"),children:tX?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Updating..."]}):"Update now"})]})]})})]})]})}function rI({surfaceTheme:e}){return(0,s.jsxs)("div",{className:k("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:k("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:k("text-[10px] tracking-[0.18em]","light"===e?"text-[#8a7261]":"text-slate-500"),children:"AgentOS"})]}),(0,s.jsx)("span",{"aria-hidden":"true",className:k("h-4 w-px","light"===e?"bg-[#cdb7a8]/80":"bg-white/[0.08]")}),(0,s.jsx)("h2",{className:k("font-display text-[0.88rem]","light"===e?"text-[#816958]/80":"text-slate-400/75"),children:"Mission Control"})]})}function rT({snapshot:e,surfaceTheme:t,settingsRef:a,isSettingsOpen:n,gatewayDraft:m,workspaceRootDraft:u,isSavingGateway:h,isSavingWorkspaceRoot:x,isCheckingForUpdates:g,selectedModelId:b,modelOnboardingRunState:f,gatewayControlAction:w,lastCheckedAt:v,onToggleTheme:y,onToggleSettings:j,onGatewayDraftChange:N,onWorkspaceRootDraftChange:C,onSelectedModelIdChange:S,onSaveGatewaySettings:A,onSaveWorkspaceRootSettings:O,onCheckForUpdates:R,onControlGateway:M,onOpenSetupWizard:$,onRunModelRefresh:P,onRunModelSetDefault:_,onOpenAddModels:E,onOpenUpdateDialog:D,onOpenResetDialog:L}){let U=am(e),F=null!==w,z="running"===f,W=rU(t,"secondary"),B=rU(t,"primary"),q=rU(t,"warning"),V=rU(t,"warningSolid"),K=k("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"===t?"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]"),J=k("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"===t?"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]"),G=k("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"===t?"translate-x-7 bg-[#c8946f] text-white":"translate-x-0 bg-cyan-300 text-slate-950");return(0,s.jsxs)("div",{className:"flex w-full items-center justify-between px-0 pt-6",children:[(0,s.jsx)(rI,{surfaceTheme:t}),(0,s.jsxs)("div",{ref:a,className:"pointer-events-auto relative",children:[(0,s.jsxs)("div",{className:k("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"===t?"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:k("text-[10px] uppercase tracking-[0.3em]","light"===t?"text-[#8a7261]":"text-slate-500"),children:"OPENCLAW"}),(0,s.jsxs)("span",{className:k("font-mono text-[8px] tracking-[0.04em]","light"===t?"text-[#6f5a4b]/85":"text-slate-300/80"),children:["v",e.diagnostics.version||"unknown"]})]}),(0,s.jsxs)("span",{className:k("inline-flex items-center gap-2 rounded-full border px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.22em]",function(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"}}(e.diagnostics.health,t)),children:[(0,s.jsx)("span",{"aria-hidden":"true",className:k("h-2 w-2 rounded-full shadow-[0_0_12px_currentColor]",function(e){switch(e){case"healthy":return"bg-emerald-400";case"degraded":return"bg-amber-300";default:return"bg-rose-300"}}(e.diagnostics.health))}),function(e){switch(e){case"healthy":return"Online";case"degraded":return"Degraded";default:return"Offline"}}(e.diagnostics.health)]}),(0,s.jsx)("button",{type:"button",role:"switch","aria-label":"light"===t?"Switch to dark theme":"Switch to light theme","aria-checked":"light"===t,onClick:y,className:J,children:(0,s.jsx)("span",{className:G,children:"light"===t?(0,s.jsx)(l.A,{className:"h-3 w-3"}):(0,s.jsx)(o.A,{className:"h-3 w-3"})})}),(0,s.jsx)("button",{type:"button","aria-label":"Open settings","aria-expanded":n,"aria-haspopup":"menu",onClick:j,className:K,children:(0,s.jsx)(d.A,{className:"h-3.5 w-3.5"})})]}),n?(0,s.jsxs)("div",{role:"menu","aria-label":"OpenClaw settings",className:k("absolute right-0 top-[calc(100%+12px)] z-[70] max-h-[min(82vh,calc(100svh-96px))] w-[300px] overflow-y-auto overscroll-contain rounded-[20px] border p-3 shadow-[0_22px_64px_rgba(0,0,0,0.24)] backdrop-blur-2xl","light"===t?"border-[#dbc9bc]/90 bg-[rgba(252,247,241,0.95)] text-[#4a382c] shadow-[0_24px_60px_rgba(161,125,101,0.18)]":"border-cyan-300/12 bg-[rgba(10,16,28,0.9)] text-slate-100"),children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:k("text-[8px] uppercase tracking-[0.24em]","light"===t?"text-[#9a7f6c]":"text-slate-500"),children:"Settings"}),(0,s.jsx)("h3",{className:k("mt-0.5 font-display text-[14px]","light"===t?"text-[#3f2f24]":"text-white"),children:"OpenClaw surface"})]}),(0,s.jsx)("span",{className:k("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.18em]","light"===t?"border-[#d6c0b0] bg-[#f3e7dc] text-[#8a7261]":"border-white/10 bg-white/[0.06] text-slate-400"),children:e.mode})]}),e.diagnostics.updateAvailable&&e.diagnostics.latestVersion?(0,s.jsxs)("div",{className:k("mt-2.5 rounded-[18px] border px-3 py-3","light"===t?"border-amber-300/90 bg-[linear-gradient(135deg,rgba(255,247,237,0.98),rgba(252,231,214,0.94))] shadow-[0_16px_36px_rgba(194,120,55,0.16)]":"border-amber-300/30 bg-[linear-gradient(135deg,rgba(71,35,8,0.62),rgba(33,20,8,0.82))] shadow-[0_18px_42px_rgba(245,158,11,0.14)]"),children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-2.5",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:k("text-[8px] uppercase tracking-[0.18em]","light"===t?"text-amber-800/70":"text-amber-200/80"),children:"Update available"}),(0,s.jsxs)("div",{className:"mt-1.5 flex items-baseline gap-1.5",children:[(0,s.jsxs)("p",{className:k("font-display text-[0.98rem]","light"===t?"text-amber-950":"text-amber-50"),children:["v",e.diagnostics.latestVersion]}),(0,s.jsxs)("p",{className:k("text-[9px]","light"===t?"text-amber-900/70":"text-amber-100/70"),children:["from v",e.diagnostics.version||"unknown"]})]})]}),(0,s.jsx)(c.A,{className:k("mt-0.5 h-4 w-4","light"===t?"text-amber-700":"text-amber-300")})]}),(0,s.jsx)("p",{className:k("mt-1.5 text-[10px] leading-[1.05rem]","light"===t?"text-amber-950/80":"text-amber-50/85"),children:"A newer OpenClaw release was detected. You can update directly from Mission Control."}),(0,s.jsx)("button",{type:"button",onClick:D,className:k("mt-2.5 inline-flex items-center justify-center py-1",V),children:"Update now"})]}):null,(0,s.jsxs)("div",{className:k("mt-2.5 rounded-[16px] border px-2.5 py-2","light"===t?"border-[#e6d7cb] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,s.jsx)("p",{className:k("text-[8px] uppercase tracking-[0.18em]","light"===t?"text-[#9a7f6c]":"text-slate-500"),children:"OpenClaw version"}),(0,s.jsxs)("div",{className:"mt-1.5 flex items-center justify-between gap-2",children:[(0,s.jsx)("p",{className:k("font-display text-[0.88rem]","light"===t?"text-[#3f2f24]":"text-white"),children:e.diagnostics.version||"Unavailable"}),e.diagnostics.updateChannel?(0,s.jsx)("span",{className:k("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.18em]","light"===t?"border-[#dcc6b6] bg-[#f4e8dd] text-[#876c5a]":"border-cyan-400/14 bg-cyan-400/8 text-cyan-100"),children:e.diagnostics.updateChannel}):null]}),(0,s.jsx)("p",{className:k("mt-1.5 text-[10px] leading-[1.05rem]","light"===t?"text-[#816958]":"text-slate-400"),children:e.diagnostics.updateInfo?.trim()||"No additional update message was returned in the latest OpenClaw status snapshot."}),(0,s.jsxs)("div",{className:"mt-3",children:[(0,s.jsx)(I,{type:"button",size:"sm",variant:"secondary",onClick:()=>{R()},disabled:g,className:k("w-full disabled:cursor-wait",e.diagnostics.updateAvailable?q:W),children:g?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Checking..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(p.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Check for updates"]})}),v?(0,s.jsxs)("p",{className:k("mt-2 text-center text-[9px]","light"===t?"text-[#8f7664]":"text-slate-500"),children:["Last checked at"," ",new Date(v).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]}):null]})]}),(0,s.jsxs)("div",{className:k("mt-2 rounded-[16px] border px-2.5 py-2.5","light"===t?"border-[#e6d7cb] 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:k("text-[8px] uppercase tracking-[0.18em]","light"===t?"text-[#9a7f6c]":"text-slate-500"),children:"Setup center"}),(0,s.jsx)("p",{className:k("mt-1 text-[10px] leading-[1.05rem]","light"===t?"text-[#816958]":"text-slate-400"),children:"Reopen the wizard, control the gateway, and manage the minimum model setup from one place."})]}),(0,s.jsx)("span",{className:k("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.18em]",U?"light"===t?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"light"===t?"border-amber-300 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-200"),children:U?"Ready":"Needs attention"})]}),(0,s.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,s.jsx)(I,{type:"button",size:"sm",variant:"secondary",onClick:()=>$(e.diagnostics.rpcOk?"models":"system"),className:W,children:"Open wizard"}),(0,s.jsx)(I,{type:"button",size:"sm",variant:"secondary",disabled:z,onClick:()=>{P()},className:W,children:"Refresh setup"})]}),(0,s.jsxs)("div",{className:k("mt-3 rounded-[14px] border px-2.5 py-2.5","light"===t?"border-[#eadcd0] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:k("text-[11px]","light"===t?"text-[#9a7f6c]":"text-slate-400"),children:"Gateway control"}),(0,s.jsx)("p",{className:k("mt-0.5 text-[10px] leading-[1.05rem]","light"===t?"text-[#816958]":"text-slate-500"),children:e.diagnostics.rpcOk?"Live RPC connection is online.":e.diagnostics.loaded?"Service is loaded but Mission Control cannot verify RPC yet.":"Service is not loaded on this machine yet."})]}),(0,s.jsx)("span",{className:k("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.18em]",e.diagnostics.rpcOk?"light"===t?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"light"===t?"border-amber-300 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-200"),children:e.diagnostics.rpcOk?"Online":e.diagnostics.loaded?"Service only":"Offline"})]}),(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,s.jsx)(I,{type:"button",size:"sm",variant:"secondary",disabled:F||e.diagnostics.rpcOk,onClick:()=>{M("start")},className:W,children:"start"===w?"Starting...":"Start"}),(0,s.jsx)(I,{type:"button",size:"sm",variant:"secondary",disabled:F||!e.diagnostics.loaded,onClick:()=>{M("restart")},className:W,children:"restart"===w?"Restarting...":"Restart"}),(0,s.jsx)(I,{type:"button",size:"sm",variant:"secondary",disabled:F||!e.diagnostics.loaded,onClick:()=>{M("stop")},className:W,children:"stop"===w?"Stopping...":"Stop"})]})]}),(0,s.jsxs)("div",{className:k("mt-2 rounded-[14px] border px-2.5 py-2.5","light"===t?"border-[#eadcd0] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:k("text-[11px]","light"===t?"text-[#9a7f6c]":"text-slate-400"),children:"Model setup"}),(0,s.jsxs)("p",{className:k("mt-0.5 text-[10px] leading-[1.05rem]","light"===t?"text-[#816958]":"text-slate-500"),children:["Default model: ",e.diagnostics.modelReadiness.resolvedDefaultModel||e.diagnostics.modelReadiness.defaultModel||"Not set"]})]}),(0,s.jsxs)("span",{className:k("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.18em]",e.diagnostics.modelReadiness.ready?"light"===t?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"light"===t?"border-amber-300 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-200"),children:[e.diagnostics.modelReadiness.availableModelCount,"/",e.diagnostics.modelReadiness.totalModelCount]})]}),(0,s.jsxs)("select",{value:b,onChange:e=>S(e.target.value),disabled:z,className:k("mt-2.5 h-9 w-full rounded-[14px] border px-2.5 text-[11px]","light"===t?"border-[#d9c9bc] bg-[#fffdfb] text-[#4f3d31]":"border-white/10 bg-white/[0.04] text-slate-100"),children:[(0,s.jsx)("option",{value:"",children:"Auto choose"}),e.models.filter(e=>!1!==e.available&&!e.missing).map(e=>(0,s.jsxs)("option",{value:e.id,children:[e.name," \xb7 ",e.provider]},e.id))]}),(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,s.jsx)(I,{type:"button",size:"sm",variant:"secondary",disabled:z,onClick:()=>{_()},className:W,children:z?"Working...":"Use selected"}),(0,s.jsx)(I,{type:"button",size:"sm",variant:"secondary",disabled:z,onClick:()=>{E()},className:W,children:"Add models"})]})]})]}),(0,s.jsxs)("div",{className:k("mt-2 rounded-[16px] border px-2.5 py-2.5","light"===t?"border-[#e6d7cb] 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)(tw,{htmlFor:"workspace-root",className:k("text-[11px]","light"===t?"text-[#9a7f6c]":"text-slate-500"),children:"Workspace root"}),(0,s.jsx)("p",{className:k("mt-0.5 text-[10px] leading-[1.05rem]","light"===t?"text-[#816958]":"text-slate-400"),children:"Default parent path for newly created workspaces. Existing workspaces stay at their current paths."})]}),(0,s.jsx)("span",{className:k("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.18em]","light"===t?"border-[#dcc6b6] bg-[#f4e8dd] text-[#876c5a]":"border-white/10 bg-white/[0.05] text-slate-300"),children:"New only"})]}),(0,s.jsx)(T,{id:"workspace-root",value:u,onChange:e=>C(e.target.value),placeholder:"~/Documents/Shared/projects",disabled:x,style:"light"===t?{colorScheme:"light"}:void 0,className:k("mt-2.5 h-9 rounded-[14px] px-2.5 text-[11px]","light"===t?"border-[#d9c9bc] bg-[#fffdfb] text-[#4f3d31] caret-[#7c5a46] placeholder:text-[#b29b8b] shadow-[inset_0_0_0_1000px_#fffdfb] [-webkit-text-fill-color:#4f3d31] focus-visible:ring-[#c8946f]/45":"border-white/10 bg-white/[0.04] text-slate-100 placeholder:text-slate-500")}),(0,s.jsxs)("p",{className:k("mt-1.5 break-all font-mono text-[9px] leading-[1rem]","light"===t?"text-[#6f5a4b]":"text-slate-300"),children:["Configured root: ",e.diagnostics.configuredWorkspaceRoot?eB(e.diagnostics.configuredWorkspaceRoot):"default"]}),(0,s.jsxs)("p",{className:k("mt-1 break-all font-mono text-[9px] leading-[1rem]","light"===t?"text-[#6f5a4b]":"text-slate-300"),children:["Effective root: ",eB(e.diagnostics.workspaceRoot)]}),(0,s.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,s.jsx)(I,{type:"button",size:"sm",variant:"secondary",disabled:x,onClick:()=>{O(null)},className:W,children:"Use default"}),(0,s.jsx)(I,{type:"button",size:"sm",disabled:x,onClick:()=>{O(u)},className:B,children:x?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Saving..."]}):"Save root"})]})]}),(0,s.jsxs)("div",{className:k("mt-2 rounded-[16px] border px-2.5 py-2.5","light"===t?"border-[#e6d7cb] 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)(tw,{htmlFor:"gateway-url",className:k("text-[11px]","light"===t?"text-[#9a7f6c]":"text-slate-500"),children:"OpenClaw gateway"}),(0,s.jsx)("p",{className:k("mt-0.5 text-[10px] leading-[1.05rem]","light"===t?"text-[#816958]":"text-slate-400"),children:"Enter a `ws://` or `wss://` endpoint. Leave it empty to use the local default gateway."})]}),(0,s.jsx)("span",{className:k("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.18em]","light"===t?"border-[#dcc6b6] bg-[#f4e8dd] text-[#876c5a]":"border-white/10 bg-white/[0.05] text-slate-300"),children:e.diagnostics.bindMode||"default"})]}),(0,s.jsx)(T,{id:"gateway-url",value:m,onChange:e=>N(e.target.value),placeholder:"ws://127.0.0.1:18789",disabled:h,style:"light"===t?{colorScheme:"light"}:void 0,className:k("mt-2.5 h-9 rounded-[14px] px-2.5 text-[11px]","light"===t?"border-[#d9c9bc] bg-[#fffdfb] text-[#4f3d31] caret-[#7c5a46] placeholder:text-[#b29b8b] shadow-[inset_0_0_0_1000px_#fffdfb] [-webkit-text-fill-color:#4f3d31] focus-visible:ring-[#c8946f]/45":"border-white/10 bg-white/[0.04] text-slate-100 placeholder:text-slate-500")}),(0,s.jsxs)("p",{className:k("mt-1.5 break-all font-mono text-[9px] leading-[1rem]","light"===t?"text-[#6f5a4b]":"text-slate-300"),children:["Configured endpoint: ",e.diagnostics.configuredGatewayUrl||"local default"]}),(0,s.jsxs)("p",{className:k("mt-1 break-all font-mono text-[9px] leading-[1rem]","light"===t?"text-[#6f5a4b]":"text-slate-300"),children:["Effective endpoint: ",e.diagnostics.gatewayUrl]}),(0,s.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,s.jsx)(I,{type:"button",size:"sm",variant:"secondary",disabled:h,onClick:()=>{A(null)},className:W,children:"Use local"}),(0,s.jsx)(I,{type:"button",size:"sm",disabled:h,onClick:()=>{A(m)},className:B,children:h?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Saving..."]}):"Save gateway"})]})]}),(0,s.jsxs)("div",{className:k("mt-2 rounded-[16px] border px-2.5 py-2.5","light"===t?"border-rose-200 bg-[linear-gradient(135deg,rgba(255,245,245,0.96),rgba(255,236,236,0.92))]":"border-rose-400/18 bg-[linear-gradient(135deg,rgba(62,16,24,0.46),rgba(24,10,15,0.82))]"),children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:k("text-[8px] uppercase tracking-[0.18em]","light"===t?"text-rose-700/80":"text-rose-200/75"),children:"Danger zone"}),(0,s.jsx)("p",{className:k("mt-1 text-[10px] leading-[1.05rem]","light"===t?"text-rose-900/80":"text-rose-100/80"),children:"Review exactly which workspaces, agents, integration files, and packages would be removed before taking irreversible actions."})]}),(0,s.jsx)(i.A,{className:k("mt-0.5 h-4 w-4","light"===t?"text-rose-700":"text-rose-200")})]}),(0,s.jsxs)("div",{className:"mt-3 grid gap-2",children:[(0,s.jsx)(I,{type:"button",size:"sm",variant:"secondary",onClick:()=>L("mission-control"),className:k("justify-start","light"===t?"border-rose-200 bg-white text-rose-900 hover:bg-rose-50 hover:text-rose-900":"border-rose-400/20 bg-white/[0.04] text-rose-100 hover:bg-rose-500/10"),children:"Reset Mission Control"}),(0,s.jsx)(I,{type:"button",size:"sm",variant:"secondary",onClick:()=>L("full-uninstall"),className:k("justify-start","light"===t?"border-rose-300 bg-rose-600 text-white hover:bg-rose-700":"border-rose-400/24 bg-rose-500/90 text-white hover:bg-rose-500"),children:"Full Uninstall"})]})]})]}):null]})]})}function rO(e){return e.mission?.trim()?e.mission.trim():e.title.trim()?e.title.trim():e.subtitle.trim()||"Continue this task."}function rR(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 rM(e){if(rR(e))return!1;let t=e.status;return"running"===t||"queued"===t}function r$(e,t){let a,s=(Array.isArray(a=e.metadata.optimisticEvents)?a.filter(r_):[]).concat(t.feedEvent);return{...e,dispatchId:t.dispatchId??e.dispatchId,status:t.status,subtitle:t.subtitle,updatedAt:Date.now(),liveRunCount:+("stalled"!==t.status&&"cancelled"!==t.status),warningCount:"stalled"===t.status||"cancelled"===t.status?1:e.warningCount,metadata:{...e.metadata,bootstrapStage:t.bootstrapStage,optimisticEvents:function(e){let t=new Map;for(let a of e)t.set(a.id,a);return[...t.values()].sort((e,t)=>Date.parse(e.timestamp)-Date.parse(t.timestamp))}(s)}}}function rP(e,t,a,s){return!s.includes(e.key)&&(!!a.includes(e.key)||0!==e.runtimeIds.length&&e.runtimeIds.every(e=>t.includes(e)))}function r_(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 rE(e,t){let a=e.replace(/\s+/g," ").trim();return a.length<=t?a:`${a.slice(0,Math.max(t-1,1)).trimEnd()}…`}function rD(e){return(e.diagnostics.configuredGatewayUrl||e.diagnostics.gatewayUrl).replace(/\/$/,"")}function rL(e){return eB(e.diagnostics.configuredWorkspaceRoot||e.diagnostics.workspaceRoot)}function rU(e,t){let a="h-8 rounded-[12px] border px-2.5 text-[9px] uppercase tracking-[0.18em] transition-[background-color,border-color,color,box-shadow,transform] duration-150 active:scale-[0.985]";return"primary"===t?k(a,"light"===e?"border-[#c8946f] bg-[#c8946f] text-white shadow-[0_12px_28px_rgba(200,148,111,0.24)] hover:bg-[#b88461] hover:border-[#b88461] hover:text-white active:bg-[#a97553] active:border-[#a97553]":"border-cyan-300/30 bg-cyan-300 text-slate-950 shadow-[0_12px_28px_rgba(34,211,238,0.2)] hover:bg-cyan-200 hover:border-cyan-200 hover:text-slate-950 active:bg-cyan-100 active:border-cyan-100"):"warning"===t?k(a,"light"===e?"border-amber-400/90 bg-amber-100 text-amber-900 shadow-[inset_0_1px_0_rgba(255,255,255,0.55)] hover:bg-amber-200 hover:border-amber-400 hover:text-amber-900 active:bg-amber-300":"border-amber-300/35 bg-amber-300/16 text-amber-100 shadow-[inset_0_1px_0_rgba(255,255,255,0.05)] hover:bg-amber-300/24 hover:border-amber-300/45 hover:text-amber-50 active:bg-amber-300/30"):"warningSolid"===t?k(a,"light"===e?"border-amber-900 bg-amber-900 text-amber-50 shadow-[0_12px_28px_rgba(146,64,14,0.18)] hover:bg-amber-800 hover:border-amber-800 hover:text-amber-50 active:bg-amber-700 active:border-amber-700":"border-amber-300 bg-amber-300 text-slate-950 shadow-[0_12px_28px_rgba(245,158,11,0.18)] hover:bg-amber-200 hover:border-amber-200 hover:text-slate-950 active:bg-amber-100 active:border-amber-100"):k(a,"light"===e?"border-[#d3bba9] bg-[#f1e3d7] text-[#6f5949] shadow-[inset_0_1px_0_rgba(255,255,255,0.55)] hover:bg-[#ead8ca] hover:border-[#caa98f] hover:text-[#5f4a3d] active:bg-[#dfc9b7] active:border-[#bf9c82]":"border-white/12 bg-white/[0.05] text-slate-200 shadow-[inset_0_1px_0_rgba(255,255,255,0.04)] hover:bg-white/[0.1] hover:border-white/16 hover:text-slate-100 active:bg-white/[0.14] active:border-white/20")}},8377:(e,t,a)=>{Promise.resolve().then(a.bind(a,4430))}},e=>{e.O(0,[119,708,273,878,881,26,358],()=>e(e.s=8377)),_N_E=e.O()}]);