@sapienx/agentos 0.1.9 → 0.3.13
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.
- package/README.md +11 -1
- package/bin/agentos.js +780 -10
- package/bundle/.next/BUILD_ID +1 -1
- package/bundle/.next/app-path-routes-manifest.json +9 -5
- package/bundle/.next/build-manifest.json +6 -6
- package/bundle/.next/prerender-manifest.json +3 -3
- package/bundle/.next/react-loadable-manifest.json +11 -1
- package/bundle/.next/routes-manifest.json +30 -0
- package/bundle/.next/server/app/_global-error/page.js +3 -3
- package/bundle/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/bundle/.next/server/app/_global-error.html +1 -1
- package/bundle/.next/server/app/_global-error.rsc +1 -1
- package/bundle/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/bundle/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/bundle/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/bundle/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/bundle/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/bundle/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/bundle/.next/server/app/_not-found/page.js +2 -2
- package/bundle/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/bundle/.next/server/app/_not-found.html +1 -1
- package/bundle/.next/server/app/_not-found.rsc +3 -3
- package/bundle/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/bundle/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/bundle/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
- package/bundle/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/bundle/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/bundle/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/bundle/.next/server/app/api/agents/[agentId]/chat/route.js +1 -0
- package/bundle/.next/server/app/api/agents/[agentId]/chat/route.js.nft.json +1 -0
- package/bundle/.next/server/app/api/agents/[agentId]/chat/route_client-reference-manifest.js +1 -0
- package/bundle/.next/server/app/api/agents/route.js +1 -1
- package/bundle/.next/server/app/api/agents/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/diagnostics/route.js +1 -1
- package/bundle/.next/server/app/api/diagnostics/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/files/reveal/route.js +1 -1
- package/bundle/.next/server/app/api/gateway/control/route.js +1 -1
- package/bundle/.next/server/app/api/gateway/control/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/mission/route.js +1 -1
- package/bundle/.next/server/app/api/mission/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/models/providers/route.js +2 -2
- package/bundle/.next/server/app/api/models/providers/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/onboarding/models/route.js +7 -7
- package/bundle/.next/server/app/api/onboarding/models/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/onboarding/route.js +6 -6
- package/bundle/.next/server/app/api/onboarding/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/openclaw/capabilities/route.js +3 -0
- package/bundle/.next/server/app/api/openclaw/capabilities/route.js.nft.json +1 -0
- package/bundle/.next/server/app/api/openclaw/capabilities/route_client-reference-manifest.js +1 -0
- package/bundle/.next/server/app/api/planner/[planId]/deploy/route.js +2 -2
- package/bundle/.next/server/app/api/planner/[planId]/deploy/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/document-rewrite/route.js +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/document-rewrite/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/route.js +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/simulate/route.js +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/simulate/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/turn/route.js +1 -1
- package/bundle/.next/server/app/api/planner/[planId]/turn/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/planner/route.js +1 -1
- package/bundle/.next/server/app/api/planner/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/reset/route.js +2 -2
- package/bundle/.next/server/app/api/reset/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/runtimes/[runtimeId]/route.js +1 -1
- package/bundle/.next/server/app/api/runtimes/[runtimeId]/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/settings/gateway/route.js +1 -1
- package/bundle/.next/server/app/api/settings/gateway/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/settings/workspace-root/route.js +1 -1
- package/bundle/.next/server/app/api/settings/workspace-root/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/snapshot/route.js +1 -1
- package/bundle/.next/server/app/api/snapshot/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/stream/route.js +2 -2
- package/bundle/.next/server/app/api/stream/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/system/open-terminal/route.js +1 -1
- package/bundle/.next/server/app/api/tasks/[taskId]/abort/route.js +1 -1
- package/bundle/.next/server/app/api/tasks/[taskId]/abort/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/tasks/[taskId]/stream/route.js +2 -2
- package/bundle/.next/server/app/api/tasks/[taskId]/stream/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/update/route.js +2 -2
- package/bundle/.next/server/app/api/update/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/discovered-groups/route.js +1 -0
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/discovered-groups/route.js.nft.json +1 -0
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/discovered-groups/route_client-reference-manifest.js +1 -0
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/route.js +1 -0
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/route.js.nft.json +1 -0
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/route_client-reference-manifest.js +1 -0
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/edit-draft/route.js +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/edit-draft/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/workspaces/route.js +2 -2
- package/bundle/.next/server/app/api/workspaces/route.js.nft.json +1 -1
- package/bundle/.next/server/app/page.js +52 -39
- package/bundle/.next/server/app/page.js.nft.json +1 -1
- package/bundle/.next/server/app/page_client-reference-manifest.js +1 -1
- package/bundle/.next/server/app-paths-manifest.json +9 -5
- package/bundle/.next/server/chunks/212.js +3 -3
- package/bundle/.next/server/chunks/49.js +212 -42
- package/bundle/.next/server/functions-config-manifest.json +3 -0
- package/bundle/.next/server/middleware-build-manifest.js +1 -1
- package/bundle/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/bundle/.next/server/pages/404.html +1 -1
- package/bundle/.next/server/pages/500.html +1 -1
- package/bundle/.next/server/server-reference-manifest.json +1 -1
- package/bundle/.next/static/E1q9ZtkD74uwvDRq3uoCz/_buildManifest.js +1 -0
- package/bundle/.next/static/chunks/1364.5bd755c8584fcbc8.js +1 -0
- package/bundle/.next/static/chunks/1506.ec91294c1cbc454f.js +1 -0
- package/bundle/.next/static/chunks/{424-90a1df1753670aa3.js → 4424-08671f25c8f9ae84.js} +1 -1
- package/bundle/.next/static/chunks/4a846800.17bbc9efb621dbb7.js +1 -0
- package/bundle/.next/static/chunks/5954-fd2a9c905dcede3c.js +15 -0
- package/bundle/.next/static/chunks/8583-0efb0aa0937b762c.js +1 -0
- package/bundle/.next/static/chunks/app/_global-error/page-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/_not-found/page-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/agents/[agentId]/chat/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/agents/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/diagnostics/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/files/reveal/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/gateway/control/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/mission/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/models/providers/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/onboarding/models/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/onboarding/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/openclaw/capabilities/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/planner/[planId]/deploy/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/planner/[planId]/document-rewrite/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/planner/[planId]/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/planner/[planId]/simulate/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/planner/[planId]/turn/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/planner/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/reset/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/runtimes/[runtimeId]/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/settings/gateway/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/settings/workspace-root/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/snapshot/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/stream/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/system/open-terminal/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/tasks/[taskId]/abort/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/tasks/[taskId]/stream/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/update/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/discovered-groups/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/edit-draft/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/api/workspaces/route-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/layout-7c2d7e515f68248b.js +1 -0
- package/bundle/.next/static/chunks/app/not-found-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/app/page-e7ca3c6ffb09198b.js +176 -0
- package/bundle/.next/static/chunks/d08e407b-a7a2691dd8d9de6b.js +1 -0
- package/bundle/.next/static/chunks/f6503f1c-7df4e7c4564148dc.js +1 -0
- package/bundle/.next/static/chunks/framework-c8a5f18418cd0e86.js +1 -0
- package/bundle/.next/static/chunks/main-app-9a4481b0ab7b57f6.js +1 -0
- package/bundle/.next/static/chunks/{main-28f7be32434a5aa2.js → main-eb49e7f5b314b5dc.js} +2 -2
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/app-error-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/forbidden-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/global-error-38aa72b47d0b8f99.js +1 -0
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/unauthorized-1a770949224cd2a0.js +1 -0
- package/bundle/.next/static/chunks/webpack-4fdc6767ef8ff7b1.js +1 -0
- package/bundle/.next/static/css/e20ab76ee4e77d93.css +3 -0
- package/bundle/package.json +2 -1
- package/bundle/public/assets/agent.mp4 +0 -0
- package/bundle/public/assets/provider-logos/deepseek.svg +1 -0
- package/bundle/public/assets/provider-logos/openai.svg +5 -0
- package/bundle/public/assets/provider-logos/xai.svg +7 -0
- package/bundle/public/readme/banner.jpeg +0 -0
- package/bundle/public/readme/banner2.jpeg +0 -0
- package/package.json +2 -2
- package/bundle/.next/static/GiI1KbaEnOWQ2uB6c5S7l/_buildManifest.js +0 -1
- package/bundle/.next/static/chunks/4a846800-6992bfdb6d680e8c.js +0 -1
- package/bundle/.next/static/chunks/583-20f3363124499c5d.js +0 -1
- package/bundle/.next/static/chunks/805-27fb5cc3e5bbb716.js +0 -15
- package/bundle/.next/static/chunks/app/_global-error/page-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/_not-found/page-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/agents/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/diagnostics/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/files/reveal/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/gateway/control/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/mission/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/models/providers/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/onboarding/models/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/onboarding/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/planner/[planId]/deploy/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/planner/[planId]/document-rewrite/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/planner/[planId]/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/planner/[planId]/simulate/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/planner/[planId]/turn/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/planner/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/reset/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/runtimes/[runtimeId]/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/settings/gateway/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/settings/workspace-root/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/snapshot/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/stream/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/system/open-terminal/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/tasks/[taskId]/abort/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/tasks/[taskId]/stream/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/update/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/edit-draft/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/api/workspaces/route-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/layout-f64f74d82381e703.js +0 -1
- package/bundle/.next/static/chunks/app/not-found-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/app/page-f4845e91032a411f.js +0 -163
- package/bundle/.next/static/chunks/f6503f1c-76bd524eece75922.js +0 -1
- package/bundle/.next/static/chunks/framework-3804ea39af33aa2e.js +0 -1
- package/bundle/.next/static/chunks/main-app-5eca1027f109d5af.js +0 -1
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/app-error-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/forbidden-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/global-error-e382d739d625239d.js +0 -1
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/unauthorized-e372189c79e963a1.js +0 -1
- package/bundle/.next/static/chunks/webpack-5bdc2ea2996939e4.js +0 -1
- package/bundle/.next/static/css/de551c93149758e0.css +0 -3
- /package/bundle/.next/static/{GiI1KbaEnOWQ2uB6c5S7l → E1q9ZtkD74uwvDRq3uoCz}/_ssgManifest.js +0 -0
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{243:(e,t,a)=>{"use strict";a.d(t,{Toaster:()=>s.l$,o:()=>s.oR});var s=a(8583)},6817:(e,t,a)=>{"use strict";a.d(t,{MissionControlShell:()=>r6});var s=a(6366),r=a(576),n=a(5411),i=a(2071),l=a(1113),o=a(2452),d=a(9261),c=a(4837),p=a(9758),u=a(3899),m=a(430),h=a(9613),x=a(7227),g=a(5054),b=a(7794),f=a(6247),w=a(656),v=a(2625),y=a(5880),j=a(5286),k=a(493);function N(...e){return(0,k.QP)((0,j.$)(e))}let C=(0,y.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 S({className:e,variant:t,...a}){return(0,s.jsx)("div",{className:N(C({variant:t}),e),...a})}var A=a(7932);let I=(0,y.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"}}),T=m.forwardRef(({className:e,variant:t,size:a,asChild:r=!1,...n},i)=>{let l=r?A.DX:"button";return(0,s.jsx)(l,{className:N(I({variant:t,size:a,className:e})),ref:i,...n})});T.displayName="Button";let R=m.forwardRef(({className:e,type:t,...a},r)=>(0,s.jsx)("input",{type:t,className:N("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}));R.displayName="Input";var M=a(6563);let O=M.bL,$=m.forwardRef(({className:e,...t},a)=>(0,s.jsx)(M.B8,{ref:a,className:N("inline-flex h-11 items-center rounded-2xl border border-white/10 bg-white/5 p-1 text-slate-400",e),...t}));$.displayName=M.B8.displayName;let _=m.forwardRef(({className:e,...t},a)=>(0,s.jsx)(M.l9,{ref:a,className:N("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=M.l9.displayName;let P=m.forwardRef(({className:e,...t},a)=>(0,s.jsx)(M.UC,{ref:a,className:N("mt-4 outline-none focus-visible:ring-0",e),...t}));function E(e,t){let a=t.trim().toLowerCase();return a?e.filter(e=>`${e.name} ${e.id} ${e.tags.join(" ")}`.toLowerCase().includes(a)):e}function D({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,u=E(d,r),m=E(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)(S,{variant:"muted",children:[t.filter(e=>e.alreadyAdded).length," already added"]})]}),c?(0,s.jsxs)("div",{className:"relative mt-4",children:[(0,s.jsx)(f.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)(R,{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)(O,{defaultValue:"recommended",className:"mt-4",children:[(0,s.jsxs)($,{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)(L,{models:u,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)(L,{models:m,selectedModelIds:a,onToggleModel:i,emptyMessage:"No models matched this search."})})]}):(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(L,{models:m,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)(T,{type:"button",onClick:l,disabled:0===p||o,className:"h-9 rounded-full px-4",children:o?"Adding...":"Add selected models"})]})]})}function L({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:N("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:N("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)(w.A,{className:"h-3 w-3"}):(0,s.jsx)(v.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)(S,{variant:"muted",children:"Already added"}):e.recommended?(0,s.jsx)(S,{variant:"default",children:"Recommended"}):e.local?(0,s.jsx)(S,{variant:"success",children:"Local"}):(0,s.jsx)(S,{variant:"muted",children:"Remote"})})]},e.id)})})}P.displayName=M.UC.displayName;var U=a(7408),F=a(1909),z=a(159),W=a(3324),q=a(8732),B=a(3776);let V={"openai-codex":U.A,openrouter:F.A,ollama:z.A,anthropic:W.A,openai:q.A,xai:B.A};function K({descriptor:e,active:t,compact:a=!1,connected:r=!1,detail:n,onClick:i}){let l=V[e.id];return(0,s.jsxs)("button",{type:"button",onClick:i,className:N("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:N("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)(S,{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:N("font-display text-white",a?"text-[0.92rem]":"text-[0.98rem]"),children:e.label}),(0,s.jsx)("p",{className:N("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 G=a(8957),J=a(5433);let H=G.bL,Z=G.l9,Q=G.ZL;G.bm;let Y=m.forwardRef(({className:e,...t},a)=>(0,s.jsx)(G.hJ,{ref:a,className:N("fixed inset-0 z-50 bg-slate-950/75 backdrop-blur-md",e),...t}));Y.displayName=G.hJ.displayName;let X=m.forwardRef(({className:e,children:t,...a},r)=>(0,s.jsxs)(Q,{children:[(0,s.jsx)(Y,{}),(0,s.jsxs)(G.UC,{ref:r,className:N("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)(G.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"})]})]})]}));X.displayName=G.UC.displayName;let ee=({className:e,...t})=>(0,s.jsx)("div",{className:N("flex flex-col space-y-2 text-left",e),...t}),et=({className:e,...t})=>(0,s.jsx)("div",{className:N("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t}),ea=m.forwardRef(({className:e,...t},a)=>(0,s.jsx)(G.hE,{ref:a,className:N("font-display text-xl text-white",e),...t}));ea.displayName=G.hE.displayName;let es=m.forwardRef(({className:e,...t},a)=>(0,s.jsx)(G.VY,{ref:a,className:N("text-sm text-slate-400",e),...t}));es.displayName=G.VY.displayName;let er=[{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."}],en=er.filter(e=>"primary"===e.category),ei=er.filter(e=>"other"===e.category);function el(e){let t=er.find(t=>t.id===e);if(!t)throw Error(`Unknown model provider: ${e}`);return t}function eo(e){return"string"==typeof e&&er.some(t=>t.id===e)}function ed(e){if(eo(e))return e;if(e&&"object"==typeof e&&"id"in e){let t=e.id;if(eo(t))return t}return null}async function ec(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 ep=Object.fromEntries(er.map(e=>{var t;return[e.id,{id:t=e.id,descriptor:el(t),getConnectionStatus:()=>ec({action:"status",provider:t}),connect:e=>ec({action:"connect",provider:t,apiKey:e?.apiKey?.trim()?e.apiKey.trim():void 0,endpoint:e?.endpoint?.trim()?e.endpoint.trim():void 0}),discoverModels:()=>ec({action:"discover",provider:t}),addModels:e=>ec({action:"add-models",provider:t,modelIds:e})}]}));var eu=a(243);let em=()=>({flowState:"idle",connection:null,statusMessage:null,errorMessage:null,emptyState:null,manualCommand:null,docsUrl:null,models:[],selectedModelIds:[],apiKey:"",search:"",loaded:!1});function eh({open:e,onOpenChange:t,snapshot:a,initialProvider:r=null,onSnapshotChange:l}){var o,d;let c,p,u,f,w=ed(r),[v,y]=(0,m.useState)(w),[j,k]=(0,m.useState)(!1),[C,A]=(0,m.useState)({}),[I,M]=(0,m.useState)(!1),O=(0,m.useEffectEvent)(e=>{E(e)});(0,m.useEffect)(()=>{if(e){if(w)return void O(w);y(e=>eo(e)?e:null)}},[e,w]);let $=eo(v)?v:null,_=$&&C[$]||em(),P=$?el($):null;async function E(e){if(y(e),"ollama"!==e){(C[e]||em()).loaded||await L(e);return}await F(e,!0)}async function L(e){let t=ep[e];B(e,{flowState:"idle",errorMessage:null});try{let a=await t.getConnectionStatus();V(e,a,a.emptyState?"discovery-empty":"idle")}catch(t){B(e,{flowState:"auth-error",errorMessage:t instanceof Error?t.message:"Provider status could not be loaded.",loaded:!0})}}async function U(e){let t=ep[e],a=C[e]||em();B(e,{flowState:"connecting",errorMessage:null,statusMessage:"openai-codex"===e?"Opening the ChatGPT connection flow...":`Connecting ${el(e).shortLabel}...`});try{let s=await t.connect({apiKey:a.apiKey});V(e,s,"openai-codex"===e?"connecting":s.models.length?"discovery-success":"idle"),s.snapshot&&l(s.snapshot),"openai-codex"!==e&&"ollama"!==e&&await F(e)}catch(t){B(e,{flowState:"auth-error",errorMessage:t instanceof Error?t.message:"Provider connection failed."})}}async function F(e,t=!1){let a=ep[e],s=C[e]||em();if(t||"discovery-loading"!==s.flowState){B(e,{flowState:"discovery-loading",errorMessage:null,statusMessage:"ollama"===e?"Checking the local Ollama runtime...":"Discovering available models..."});try{let t=await a.discoverModels();V(e,t,t.models.length>0?"discovery-success":t.emptyState?"discovery-empty":"idle"),t.snapshot&&l(t.snapshot)}catch(t){B(e,{flowState:"auth-error",errorMessage:t instanceof Error?t.message:"Model discovery failed."})}}}async function z(e){let t=ep[e],a=C[e]||em(),s=a.selectedModelIds.filter(e=>!a.models.find(t=>t.id===e)?.alreadyAdded);if(0!==s.length){B(e,{flowState:"connecting",errorMessage:null,statusMessage:"Adding selected models..."});try{let a=await t.addModels(s);V(e,a,"add-success",{selectedModelIds:[]}),a.snapshot&&l(a.snapshot),eu.o.success("Models added.",{description:a.message})}catch(t){B(e,{flowState:"add-error",errorMessage:t instanceof Error?t.message:"Models could not be added."})}}}async function W(e){try{M(!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.");eu.o.success("Terminal opened.",{description:"Finish the provider login there, then return here to discover models."})}catch(e){eu.o.error("Unable to open Terminal.",{description:e instanceof Error?e.message:"Unknown terminal error."})}finally{M(!1)}}async function q(e){try{await navigator.clipboard.writeText(e),eu.o.success("Copied.",{description:"Command copied to your clipboard."})}catch{eu.o.error("Copy failed.",{description:"Clipboard access is not available."})}}function B(e,t){A(a=>({...a,[e]:{...a[e]||em(),...t}}))}function V(e,t,a,s){B(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)(H,{open:e,onOpenChange:t,children:(0,s.jsxs)(X,{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)(ee,{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)(ea,{className:"text-[1.35rem]",children:"Add Models"}),(0,s.jsx)(es,{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:en.map(e=>(0,s.jsx)(K,{descriptor:e,active:$===e.id,connected:eg(a,C,e.id).connected,detail:eg(a,C,e.id).detail,onClick:()=>{E(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:()=>k(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)(h.A,{className:N("h-4 w-4 text-slate-400 transition-transform",j?"rotate-180":"rotate-0")})]}),j?(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:ei.map(e=>(0,s.jsx)(K,{descriptor:e,active:$===e.id,compact:!0,connected:eg(a,C,e.id).connected,detail:eg(a,C,e.id).detail,onClick:()=>{E(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:$&&P?(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:P.label}),(0,s.jsx)("p",{className:"mt-1 max-w-[620px] text-[12px] leading-6 text-slate-400",children:"oauth"===P.connectKind?"Use your account login, then discover the models that are ready to add.":"local"===P.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)(S,{variant:_.connection?.connected?"success":"muted",children:_.connection?.connected?"Connected":"Not connected"})]}),(0,s.jsx)("div",{className:"mt-5 flex flex-wrap gap-2",children:(o=$,d=_,c="ollama"===o?!!(d.connection?.connected||d.emptyState):!!(d.connection?.connected||d.manualCommand),p=d.models.length>0||!!d.emptyState,u=d.selectedModelIds.length>0,f="add-success"===d.flowState,[{label:"Choose provider",status:"done"},{label:"ollama"===o?"Local check":"Connect",status:"connecting"!==d.flowState||c?c?"done":"pending":"active"},{label:"Discover",status:"discovery-loading"===d.flowState?"active":p?"done":"pending"},{label:"Select",status:f?"done":u?"active":"pending"},{label:"Add",status:f?"done":"add-error"===d.flowState?"active":"pending"}]).map(e=>(0,s.jsxs)("div",{className:N("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:N("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))}),_.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:_.statusMessage})}):null,_.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:_.errorMessage}):null,"openai-codex"===$?(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)(T,{type:"button",className:"h-10 rounded-full px-5",disabled:"connecting"===_.flowState&&!_.manualCommand,onClick:()=>{U($)},children:"connecting"!==_.flowState||_.manualCommand?"Connect ChatGPT":(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Connecting..."]})})]}),_.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)(T,{type:"button",variant:"secondary",size:"sm",className:"h-9 rounded-full px-3",disabled:I,onClick:()=>{W(_.manualCommand||"")},children:I?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Opening..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(x.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Open Terminal"]})}),(0,s.jsxs)(T,{type:"button",variant:"ghost",size:"sm",className:"h-9 rounded-full px-3",onClick:()=>{q(_.manualCommand||"")},children:[(0,s.jsx)(g.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy command"]}),(0,s.jsxs)(T,{type:"button",variant:"ghost",size:"sm",className:"h-9 rounded-full px-3",onClick:()=>{F($)},children:[(0,s.jsx)(n.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:_.manualCommand})})]}):null]}):null,"apiKey"===P.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)(R,{type:"password",value:_.apiKey,onChange:e=>B($,{apiKey:e.target.value}),placeholder:"openrouter"===$?"sk-or-v1-...":"Paste API key",className:"mt-2"})]}),(0,s.jsx)(T,{type:"button",className:"h-11 rounded-full px-5",disabled:"connecting"===_.flowState||!_.apiKey.trim(),onClick:()=>{U($)},children:"connecting"===_.flowState?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Connecting..."]}):`Connect ${P.shortLabel}`})]})}):null,"oauth"!==P.connectKind?(0,s.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,s.jsx)(T,{type:"button",variant:"secondary",size:"sm",className:"h-9 rounded-full px-4",disabled:"discovery-loading"===_.flowState,onClick:()=>{F($)},children:"discovery-loading"===_.flowState?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Discovering..."]}):"Discover models"}),(0,s.jsx)(T,{type:"button",variant:"ghost",size:"sm",className:"h-9 rounded-full px-4",onClick:()=>{L($)},children:"Refresh status"})]}):null,_.emptyState?(0,s.jsx)(ex,{emptyState:_.emptyState,onCopyCommand:e=>{q(e)}}):null,_.models.length>0?(0,s.jsx)("div",{className:"mt-6",children:(0,s.jsx)(D,{provider:$,models:_.models,selectedModelIds:_.selectedModelIds,search:_.search,onSearchChange:e=>B($,{search:e}),onToggleModel:e=>{B($,{selectedModelIds:_.selectedModelIds.includes(e)?_.selectedModelIds.filter(t=>t!==e):[..._.selectedModelIds,e]})},onAddSelected:()=>{z($)},isAdding:"connecting"===_.flowState&&"Adding selected models..."===_.statusMessage})}):null,"add-success"===_.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)(b.A,{className:"h-4 w-4 text-emerald-200"}),(0,s.jsx)("p",{className:"text-[13px] text-emerald-50",children:_.statusMessage||"Models were added successfully."})]}):null,_.docsUrl?(0,s.jsx)("a",{href:_.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 ex({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)(T,{type:"button",size:"sm",variant:"ghost",className:"h-8 rounded-full px-3",onClick:()=>t(e),children:[(0,s.jsx)(g.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy"]})]},e))}):null]})}function eg(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||el(a).helperText}}var eb=a(1179),ef=a(7489);a(8954);var ew=a(8072),ev=a(736),ey=a(6658);function ej({tone:e,pulse:t=!1,className:a}){return(0,s.jsxs)("span",{className:N("relative inline-flex h-2.5 w-2.5 items-center justify-center",a),children:[t?(0,s.jsx)(ey.P.span,{className:N("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:N("relative inline-flex h-2.5 w-2.5 rounded-full",e)})]})}var ek=a(6337);let eN=m.forwardRef(({className:e,children:t,...a},r)=>(0,s.jsxs)(ek.bL,{ref:r,className:N("relative overflow-hidden",e),...a,children:[(0,s.jsx)(ek.LM,{className:"mission-scroll h-full w-full rounded-[inherit] [&>div]:!block [&>div]:!w-full [&>div]:!min-w-0",children:t}),(0,s.jsx)(eC,{}),(0,s.jsx)(ek.OK,{})]}));eN.displayName=ek.bL.displayName;let eC=m.forwardRef(({className:e,orientation:t="vertical",...a},r)=>(0,s.jsx)(ek.VM,{ref:r,orientation:t,className:N("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)(ek.lr,{className:"relative flex-1 rounded-full bg-white/[0.12]"})}));eC.displayName=ek.VM.displayName;let eS={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"}},eA={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"}},eI=Object.entries(eS).map(([e,t])=>({value:e,label:t.label,description:t.description})),eT=[{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."}],eR=[{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."}],eM=[{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."}],eO=[{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 e$(e="worker",t){return{...eA[e],...t??{},preset:e}}function e_(e){return eS[e].label}function eP(e){return eT.find(t=>t.value===e)?.label??e}function eE(e){return eR.find(t=>t.value===e)?.label??e}function eD(e){return eM.find(t=>t.value===e)?.label??e}function eL(e){return eO.find(t=>t.value===e)?.label??e}var eU=a(3962);function eF(e,t=Date.now()){return null==e||Number.isNaN(e)?"No activity":`${(0,eU.k)(e,t,{addSuffix:!0})}`}function ez(e){if(!e)return Date.now();let t=Date.parse(e);return Number.isNaN(t)?Date.now():t}function eW(e){return e?e>=1e3?`${Math.round(e/1e3)}k`:String(e):"n/a"}function eq(e){return"number"!=typeof e?"0":e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}k`:String(e)}function eB(e){return e.split("/").at(1)||e}function eV(e){switch(e){case"running":return"default";case"completed":return"success";case"cancelled":return"danger";case"stalled":return"warning";default:return"muted"}}function eK(e,t=8){return e?e.length<=t?e:e.slice(0,t):"n/a"}function eG(e){return e.replace(/^\/Users\/[^/]+/,"~")}let eJ=[/^Task output routing:/i,/^Agent operating policy:/i];function eH(e,t=64){if(!e)return"";let a=function(e){let t=e.replace(/\r\n/g,"\n").trim();if(!t)return"";let a=[];for(let e of t.split("\n")){let t=e.trim();if(eJ.some(e=>e.test(t)))break;a.push(e)}return a.join(" ").replace(/\s+/g," ").trim()}(e);return a?a.length<=t?a:`${a.slice(0,Math.max(t-1,1)).trimEnd()}…`:""}function eZ({label:e,onClick:t,danger:a=!1}){return(0,s.jsx)("button",{type:"button",className:N("nodrag nopan 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 eQ({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 eY=a(345),eX=a(3932),e0=a(6287),e1=a(4606),e2=a(4318),e5=a(3688),e3=a(8359),e4=a(8583);let e8=/https?:\/\/[^\s<>"'`)\]]+/g,e6=/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi,e9=/(?:^|[\s(])((?:\.{1,2}\/)?(?:deliverables|memory|docs|app|components|lib|public|scripts|packages|hooks|output)\/[^\s`),;]+)/g,e7=/`((?:\/|\.{1,2}\/|deliverables\/|memory\/|docs\/|app\/|components\/|lib\/|public\/|scripts\/|packages\/|hooks\/|output\/)[^`\n]+)`/g;function te({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(e8)))s[0]&&a.add(s[0]);return[...a]}(e,a),o=function(e){let t=new Set;for(let a of e.matchAll(e6))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(e7))){let e=r[1]?.trim();!e||s.has(e)||s.set(e,{path:e,label:e})}for(let t of e.matchAll(e9)){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:N("space-y-2",i&&"space-y-1.5"),children:[(0,s.jsx)("p",{className:N("whitespace-pre-wrap break-words",t),children:function(e){let t=Array.from(e.matchAll(e8));if(0===t.length)return e;let a=[],r=0;for(let[n]of t){let t=e.indexOf(n,r);t>r&&a.push(e.slice(r,t)),a.push((0,s.jsx)("a",{href:n,target:"_blank",rel:"noreferrer",className:"nodrag nopan text-cyan-100 underline decoration-cyan-200/45 underline-offset-2 transition-colors hover:text-cyan-50 hover:decoration-cyan-100",onClick:e=>e.stopPropagation(),children:n},`${n}:${t}`)),r=t+n.length}return r<e.length&&a.push(e.slice(r)),a}(e)}),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:N("nodrag nopan inline-flex max-w-full items-center gap-1 rounded-full border border-cyan-300/16 bg-cyan-400/[0.08] px-2 py-1 text-[10px] text-cyan-100 transition-colors hover:border-cyan-200/30 hover:bg-cyan-400/[0.14]",i&&"px-1.5 py-[3px] text-[9px]"),onClick:e=>e.stopPropagation(),children:[(0,s.jsx)(e3.A,{className:N("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:N("nodrag nopan inline-flex max-w-full items-center gap-1 rounded-full border border-sky-300/16 bg-sky-400/[0.08] px-2 py-1 text-[10px] text-sky-50 transition-colors hover:border-sky-200/30 hover:bg-sky-400/[0.14]",i&&"px-1.5 py-[3px] text-[9px]"),onClick:e=>e.stopPropagation(),children:[(0,s.jsx)(e3.A,{className:N("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:N("nodrag nopan inline-flex max-w-full items-center gap-1 rounded-full border border-emerald-300/16 bg-emerald-400/[0.08] px-2 py-1 text-[10px] text-emerald-50 transition-colors hover:border-emerald-200/30 hover:bg-emerald-400/[0.14]",i&&"px-1.5 py-[3px] text-[9px]"),onClick:t=>{t.stopPropagation(),tt(e.path)},children:[(0,s.jsx)(e5.A,{className:N("h-3 w-3 shrink-0",i&&"h-2.5 w-2.5")}),(0,s.jsx)("span",{className:"truncate",children:eG(e.label)})]},`${e.path}:${e.label}`))]}):null]})}async function tt(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.");e4.oR.success("Revealed file.",{description:eG(e)})}catch(e){e4.oR.error("Could not reveal file.",{description:e instanceof Error?e.message:"Unknown file reveal error."})}}function ta({icon:e,label:t,value:a,active:r=!1,onClick:n}){return(0,s.jsxs)("button",{type:"button",className:N("nodrag nopan 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-amber-300/20 hover:bg-amber-400/[0.06]",r&&"border-amber-300/30 bg-amber-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 ts({icon:e,label:t,destructive:a=!1,disabled:r=!1,onClick:n}){return(0,s.jsxs)("button",{type:"button",disabled:r,className:N("nodrag nopan 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:N("h-3.5 w-3.5",a?"text-rose-300":"text-cyan-300")}),(0,s.jsx)("span",{children:t})]})}function tr(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 tn=a(3633),ti=a(8049),tl=a(2937),to=a(9568);function td({icon:e,label:t,value:a}){return(0,s.jsxs)("div",{className:"workspace-node__chip inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1",children:[(0,s.jsx)(e,{className:"workspace-node__chip-icon h-3 w-3 text-inherit"}),(0,s.jsx)("span",{className:"workspace-node__chip-label text-[9px] uppercase tracking-[0.16em] text-inherit",children:t}),(0,s.jsx)("span",{className:"workspace-node__chip-value font-display text-[12px] text-inherit",children:a})]})}function tc({value:e,taskCardsHidden:t,disabled:a,onToggle:n}){return(0,s.jsxs)("button",{type:"button","aria-pressed":t,"aria-label":t?"Show task cards in this workspace":"Hide task cards in this workspace",title:t?"Show task cards in this workspace":"Hide task cards in this workspace",disabled:a,onClick:e=>{e.stopPropagation(),n()},onPointerDown:e=>e.stopPropagation(),className:N("workspace-node__chip workspace-node__task-toggle nodrag nopan inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 focus-visible:outline-none disabled:cursor-default disabled:opacity-50",a&&"pointer-events-none"),children:[t?(0,s.jsx)(r.A,{className:"workspace-node__chip-icon h-3 w-3 text-inherit"}):(0,s.jsx)(to.A,{className:"workspace-node__chip-icon h-3 w-3 text-inherit"}),(0,s.jsx)("span",{className:N("workspace-node__chip-label text-[9px] uppercase tracking-[0.16em] text-inherit"),children:"Runs"}),(0,s.jsx)("span",{className:"workspace-node__chip-value font-display text-[12px] text-inherit",children:e})]})}let tp={},tu={workspace:function({data:e,selected:t}){return(0,s.jsx)(ey.P.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},className:N("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)(tn.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:eG(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)(S,{variant:"muted","data-health":e.workspace.health,className:N("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)(td,{icon:ti.A,label:"Agents",value:String(e.workspace.agentIds.length)}),(0,s.jsx)(td,{icon:tl.A,label:"Models",value:String(e.workspace.modelIds.length)}),(0,s.jsx)(tc,{value:String(e.workspace.activeRuntimeIds.length),taskCardsHidden:e.taskCardsHidden,disabled:0===e.taskCardCount||!e.onToggleTaskCards,onToggle:()=>e.onToggleTaskCards?.()})]})]})]})})},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,u=e.agent.tools,x=e.agent.observedTools??[],g=u.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?eF(e.agent.lastActiveAt,e.relativeTimeReferenceMs):"No recent activity",j=`${e_(e.agent.policy.preset)} \xb7 ${f} \xb7 ${w}`,k=e.agent.lastActiveAt?`${eD(e.agent.policy.fileAccess)} \xb7 Heartbeat ${e.agent.heartbeat.enabled?v??"on":"off"} \xb7 Last active ${y}`:`${eD(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)(ey.P.div,{initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},className:N("relative w-[212px] overflow-hidden rounded-[16px] border border-cyan-300/12 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)("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_18%_10%,rgba(34,211,238,0.18),transparent_36%),radial-gradient(circle_at_84%_18%,rgba(16,185,129,0.08),transparent_28%)]"}),(0,s.jsx)("div",{className:"pointer-events-none absolute inset-y-4 left-0 w-[3px] rounded-r-full bg-[linear-gradient(180deg,rgba(125,211,252,0.9),rgba(34,211,238,0.14))]"}),(0,s.jsx)("div",{className:"pointer-events-none absolute inset-x-3 top-0 h-px bg-cyan-200/10"}),(0,s.jsx)("div",{className:"pointer-events-none absolute right-2 top-2 h-10 w-10 rounded-full bg-cyan-300/10 blur-xl"}),(0,s.jsxs)("div",{className:"relative z-10",children:[(0,s.jsx)(eb.h7,{type:"source",id:"source-right",position:ef.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 flex-1",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)(ej,{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:"nodrag nopan 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:"nodrag nopan 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)(ew.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)(eZ,{label:e.focused?"Clear focus":"Focus",onClick:()=>{e.onFocus?.(e.agent.id),r(!1)}}),(0,s.jsx)(eZ,{label:"Edit",onClick:()=>{e.onEdit?.(e.agent.id),r(!1)}}),(0,s.jsx)(eZ,{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)(S,{variant:"engaged"===e.agent.status?"default":"monitoring"===e.agent.status?"success":"warning",children:e.agent.status}),(0,s.jsx)(S,{variant:"muted",className:"max-w-[132px] truncate",children:eB(e.agent.modelId)})]}),(0,s.jsxs)("div",{className:"mt-2.5 rounded-[14px] border border-cyan-300/10 bg-cyan-400/[0.05] px-2.5 py-2",children:[(0,s.jsx)("p",{className:"text-[9px] uppercase tracking-[0.22em] text-cyan-100/70",children:"Active command"}),(0,s.jsx)("p",{className:"mt-1 text-[12px] leading-4 text-slate-100",children:e.agent.currentAction}),(0,s.jsx)("p",{className:N("mt-1.5 text-[9px] uppercase tracking-[0.2em]",d),children:e.agent.id})]}),(0,s.jsxs)("div",{className:N("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:"nodrag nopan 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:k})]}),(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)(ev.A,{className:"h-3 w-3"}):(0,s.jsx)(h.A,{className:"h-3 w-3"})})]}),n?(0,s.jsx)(ey.P.div,{id:o,initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"nodrag nopan overflow-hidden nowheel",onClick:e=>e.stopPropagation(),children:(0,s.jsx)("div",{className:"pt-2.5",children:(0,s.jsx)(eN,{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)(S,{variant:"muted",className:"max-w-full truncate",children:e},e)):(0,s.jsx)(S,{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:u.length>0?u.map(e=>(0,s.jsx)(S,{variant:"warning",className:"max-w-full truncate",children:e},e)):(0,s.jsx)(S,{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)(S,{variant:"default",className:"max-w-full truncate",children:e},e)):(0,s.jsx)(S,{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)(eQ,{label:"File access",value:eD(e.agent.policy.fileAccess)}),(0,s.jsx)(eQ,{label:"Network",value:eL(e.agent.policy.networkAccess)}),(0,s.jsx)(eQ,{label:"Install scope",value:eE(e.agent.policy.installScope)}),(0,s.jsx)(eQ,{label:"Missing tools",value:eP(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)(eQ,{label:"Last active",value:y}),(0,s.jsx)(eQ,{label:"Heartbeat",value:e.agent.heartbeat.enabled?v?`On \xb7 ${v}`:"On":"Off"}),(0,s.jsx)(eQ,{label:"Sessions",value:String(e.agent.sessionCount)}),(0,s.jsx)(eQ,{label:"Active runs",value:String(e.agent.activeRuntimeIds.length)})]})]})]})})})}):null]})]})]})},task:function({data:e,selected:t}){var a;let n="string"==typeof e.task.metadata.bootstrapStage?e.task.metadata.bootstrapStage:null,i="string"==typeof e.task.metadata.dispatchSubmittedAt?e.task.metadata.dispatchSubmittedAt:null,l=!!e.pendingCreation,o=!!e.justCreated,d=tr(e.task),c=function(e){if(tr(e))return!1;let t=e.status;return"running"===t||"queued"===t}(e.task),p=d?"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),[u,x]=(0,m.useState)(!1),b=(0,m.useRef)(null),f=l?"warning":d?"danger":eV(e.task.status),v=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}}(n,e.task.status,l,d),y=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"}}(n,e.task.liveRunCount,d),j=Array.isArray(e.task.metadata.optimisticEvents)?e.task.metadata.optimisticEvents:[],k=j.length>0&&"object"==typeof(a=j[j.length-1])&&null!==a&&"string"==typeof a.id&&"string"==typeof a.title&&"string"==typeof a.detail?j[j.length-1]:null,C=l?function(e,t){if(!e)return null;let a=Date.parse(e);if(Number.isNaN(a))return null;let s=Math.floor(Math.max(t-a,0)/1e3);if(s<60)return`${s}s`;let r=Math.floor(s/60),n=s%60;return 0===n?`${r}m`:`${r}m ${n}s`}(i,e.relativeTimeReferenceMs):null,[A,I]=(0,m.useState)(!1),{feed:T,loading:R,error:M}=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,A),O=T[T.length-1]??k??null,$=O?.title||y,_=eH(O?.detail,88)||(l?[y,C?`${C} elapsed`:null].filter(Boolean).join(" \xb7 "):eH(e.task.subtitle,72)||y),P=T.length>0?String(T.length):void 0,E=`task-feed-${e.task.id}`;return(0,m.useEffect)(()=>{if(!u)return;let e=e=>{b.current?.contains(e.target)||x(!1)};return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e)},[u]),(0,s.jsxs)(ey.P.div,{initial:l?{opacity:0,scale:.92,y:-10}:o?{opacity:0,scale:.96,y:10}:{opacity:0,x:10},animate:l?{opacity:1,scale:1,y:0}:o?{opacity:1,scale:[1,1.015,1],y:0}:{opacity:1,x:0},transition:o?{duration:.7,times:[0,.45,1]}:void 0,className:N("relative w-[272px] overflow-visible rounded-[22px] border border-amber-200/10 bg-[linear-gradient(180deg,rgba(20,18,14,0.98),rgba(9,8,6,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)]",l&&"border-cyan-300/30 shadow-[0_24px_54px_rgba(34,211,238,0.2)]",o&&"border-cyan-200/40 shadow-[0_24px_56px_rgba(125,211,252,0.18)]",d&&"border-rose-300/30 shadow-[0_24px_54px_rgba(244,63,94,0.14)]","completed"===e.task.status&&!d&&!l&&!o&&"border-white/[0.06] bg-[linear-gradient(180deg,rgba(13,18,30,0.9),rgba(8,12,22,0.9))]"),children:[(0,s.jsxs)("div",{className:"pointer-events-none absolute inset-0 overflow-hidden rounded-[22px]",children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_82%_0%,rgba(251,191,36,0.22),transparent_30%),radial-gradient(circle_at_12%_100%,rgba(217,119,6,0.08),transparent_26%)]"}),(0,s.jsx)("div",{className:"absolute inset-x-0 top-0 h-[4px] bg-[linear-gradient(90deg,rgba(251,191,36,0.78),rgba(217,119,6,0.18),rgba(255,255,255,0.04))]"}),(0,s.jsx)("div",{className:"absolute right-3 top-3 h-12 w-12 rounded-full bg-amber-300/10 blur-xl"})]}),(0,s.jsxs)("div",{className:"relative z-10",children:[l?(0,s.jsx)(ey.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)(eb.h7,{type:"target",id:"target-left",position:ef.yX.Left,className:"!h-2.5 !w-2.5 !border-0 !bg-white/35"}),(0,s.jsxs)("div",{className:"relative z-20 overflow-visible rounded-[18px] border border-amber-200/12 bg-amber-400/[0.05] px-3 py-3 shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("div",{className:"text-[9px] uppercase tracking-[0.24em] text-amber-100/75",children:"Task"}),(0,s.jsxs)("div",{className:"nodrag nopan relative flex items-center gap-1.5",ref:b,children:[(0,s.jsx)(S,{variant:f,className:"max-w-[112px] truncate",children:v}),(0,s.jsx)("button",{type:"button","aria-label":"Task actions",onClick:e=>{e.stopPropagation(),x(e=>!e)},onPointerDown:e=>e.stopPropagation(),className:"nodrag nopan 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)(ew.A,{className:"h-3 w-3"})}),u?(0,s.jsxs)("div",{className:"nodrag nopan absolute right-0 top-[calc(100%+8px)] z-[70] 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)(ts,{icon:eY.A,label:"Use prompt",onClick:()=>{e.onReply?.(e.task),x(!1)}}),(0,s.jsx)(ts,{icon:g.A,label:"Copy mission",onClick:()=>{e.onCopyPrompt?.(e.task),x(!1)}}),(0,s.jsx)(ts,{icon:r.A,label:"Hide",onClick:()=>{e.onHide?.(e.task),x(!1)}}),e.onAbortTask&&(c||d)?(0,s.jsx)(ts,{icon:eX.A,label:d?"Aborted":"Abort task",destructive:!0,disabled:!c,onClick:()=>{c&&(e.onAbortTask?.(e.task),x(!1))}}):null,(0,s.jsx)(ts,{icon:e.locked?e0.A:w.A,label:e.locked?"Unlock":"Lock",onClick:()=>{e.onToggleLock?.(e.task),x(!1)}})]}):null]})]}),(0,s.jsxs)("div",{className:"mt-3 flex items-start gap-3",children:[(0,s.jsx)("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[14px] border border-amber-300/20 bg-amber-400/[0.1] text-amber-100 shadow-[0_0_20px_rgba(251,191,36,0.12)]",children:(0,s.jsx)(e1.A,{className:"h-4 w-4"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"line-clamp-1 font-display text-[1rem] leading-5 text-white",children:eH(e.task.title||e.task.mission,44)||e.task.title}),(0,s.jsx)("p",{className:"mt-0.5 truncate text-[10px] uppercase tracking-[0.16em] text-slate-500",children:e.task.primaryAgentName||"OpenClaw"})]})]})]}),(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-1.5",children:[e.task.warningCount>0?(0,s.jsxs)(S,{variant:"warning",children:[e.task.warningCount," review",1===e.task.warningCount?"":"s"]}):null,o?(0,s.jsxs)(S,{variant:"default",className:"gap-1 border-cyan-100/20 bg-cyan-100/12 text-cyan-50",children:[(0,s.jsx)(U.A,{className:"h-3 w-3"}),"new"]}):null,(0,s.jsxs)("span",{className:N("text-[9px] uppercase tracking-[0.18em]",p),children:[eq(e.task.tokenUsage?.total)," tokens"]})]}),(0,s.jsx)("div",{className:"mt-3 rounded-[16px] border border-amber-300/12 bg-amber-400/[0.04] px-3 py-2.5",children:(0,s.jsx)("p",{className:"line-clamp-1 text-[12.5px] leading-5 text-slate-100",children:eH(e.task.subtitle,72)||e.task.subtitle})}),(0,s.jsxs)("div",{className:"mt-3 grid grid-cols-3 gap-1.5",children:[(0,s.jsx)(ta,{icon:e2.A,label:"Feed",value:P,active:A,onClick:()=>{e.onInspect?e.onInspect(e.task,"output"):I(e=>!e)}}),(0,s.jsx)(ta,{icon:e5.A,label:"Runs",value:String(e.task.runtimeCount),onClick:()=>e.onInspect?.(e.task,"overview")}),(0,s.jsx)(ta,{icon:U.A,label:"Files",value:String(e.task.artifactCount),onClick:()=>e.onInspect?.(e.task,"files")})]}),(0,s.jsxs)("div",{className:N("mt-3 border-t border-white/[0.08] pt-2.5",A&&"pb-1"),children:[(0,s.jsxs)("button",{type:"button","aria-expanded":A,"aria-controls":E,className:"nodrag nopan 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:"Live feed"}),(0,s.jsx)("p",{className:"mt-1 truncate text-[10px] text-slate-300",children:$}),(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:A?(0,s.jsx)(ev.A,{className:"h-3 w-3"}):(0,s.jsx)(h.A,{className:"h-3 w-3"})})]}),A&&(0,s.jsx)(ey.P.div,{id:E,initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"nodrag nopan overflow-hidden nowheel",onClick:e=>e.stopPropagation(),children:(0,s.jsx)("div",{className:"pt-2.5",children:(0,s.jsx)(eN,{className:"h-[164px] w-full pr-3",children:R&&0===T.length?(0,s.jsx)("div",{className:"py-4 text-center text-[10px] text-slate-500",children:"Connecting to feed..."}):M&&0===T.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:M}):0===T.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:T.map(e=>(0,s.jsxs)("div",{className:"group/item relative pl-3",children:[(0,s.jsx)("div",{className:N("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)(te,{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))})})})})]})]})]})}},tm={simplebezier:function({id:e,sourceX:t,sourceY:a,sourcePosition:r,targetX:n,targetY:i,targetPosition:l,style:o,selected:d,animated:c,markerEnd:p,interactionWidth:u=28}){let[m]=(0,eb.LN)({sourceX:t,sourceY:a,sourcePosition:r,targetX:n,targetY:i,targetPosition:l}),h=function(e,t){if("number"==typeof e&&Number.isFinite(e))return e;if("string"==typeof e){let t=Number.parseFloat(e);if(Number.isFinite(t))return t}return t?2.95:2.25}(o?.strokeWidth,!!c),x=`mission-edge-motion-${e.replace(/[^a-zA-Z0-9_-]/g,"-")}`,g=c?[{size:4.6,halo:8.4,duration:2.4,delay:0,alpha:.96},{size:3.2,halo:6.4,duration:2.95,delay:.78,alpha:.86},{size:2.2,halo:5.2,duration:2.65,delay:1.42,alpha:.8}]:[],b={...o,animation:"none",pointerEvents:"none",strokeDasharray:"none",strokeWidth:h+4},f={...o,animation:"none",pointerEvents:"none",strokeDasharray:"none",strokeWidth:h};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eb.tE,{path:m,className:N("mission-edge__path mission-edge__path--glow",c&&"mission-edge__path--animated",d&&"mission-edge__path--selected"),interactionWidth:0,style:b}),(0,s.jsx)(eb.tE,{path:m,className:N("mission-edge__path mission-edge__path--core",c&&"mission-edge__path--animated",d&&"mission-edge__path--selected"),interactionWidth:u,markerEnd:p,style:f}),c?(0,s.jsx)("path",{id:x,d:m,fill:"none",stroke:"none",opacity:0,style:{pointerEvents:"none"}}):null,g.map((e,t)=>(0,s.jsxs)("g",{className:"mission-edge__packet",style:{color:"var(--mission-edge-packet)",opacity:e.alpha,filter:"drop-shadow(0 0 10px var(--mission-edge-glow-active))"},"aria-hidden":"true",children:[(0,s.jsx)("circle",{r:e.halo,fill:"currentColor",opacity:.16}),(0,s.jsx)("circle",{r:e.size,fill:"currentColor",opacity:.95}),(0,s.jsx)("animateMotion",{dur:`${e.duration}s`,begin:`${e.delay}s`,repeatCount:"indefinite",rotate:"auto",children:(0,s.jsx)("mpath",{href:`#${x}`})})]},`${x}-packet-${t}`))]})}},th="mission-control-node-positions";function tx({snapshot:e,activeWorkspaceId:t,selectedNodeId:a,focusedAgentId:r,recentDispatchId:n,hiddenRuntimeIds:i,hiddenTaskKeys:l,lockedTaskKeys:o,onToggleWorkspaceTaskCards:d,onEditAgent:c,onDeleteAgent:p,onFocusAgent:u,onReplyTask:h,onCopyTaskPrompt:x,onHideTask:g,onToggleTaskLock:b,onAbortTask:f,onInspectTask:w,onSelectNode:v,className:y}){let j=(0,m.useRef)(null),k=(0,m.useRef)(null),C=(0,m.useRef)(new Set),S=(0,m.useRef)(new Map),A=(0,m.useRef)({}),I=(0,m.useRef)(!1),T=(0,m.useRef)(!1),R=(0,m.useRef)(!1),M=ez(e.generatedAt),[O,$]=(0,m.useState)([]),[_,P]=(0,m.useState)(null),E=tg(e,M,t,r,O,i,l,o,d,c,p,u,h,x,g,b,f,w,tp),[D,L,U]=(0,eb.ck)(E.nodes),[F,z,W]=(0,eb.fM)(E.edges);return(0,m.useEffect)(()=>{let e=function(){var e;let t,a=(e=th,(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{}}}();A.current=e,I.current=!0,T.current=!0,0!==Object.keys(e).length&&L(t=>t.map(t=>{var a;if("workspace"===t.type)return t;let s="agent"===t.type?tw(t.data.agent):ty(t.data.task),r="agent"===t.type?tv(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}))},[L]),(0,m.useEffect)(()=>{let a=tg(e,M,t,r,O,i,l,o,d,c,p,u,h,x,g,b,f,w,A.current);L(e=>{var t,s;let r;return!R.current&&I.current?(R.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);if(!t||t.type!==e.type||"workspace"===e.type)return e;let a=t.selected??e.selected,s=t.selected?t.zIndex:e.zIndex;return{...e,position:t.position,width:t.width??e.width,height:t.height??e.height,measured:t.measured??e.measured,dragging:t.dragging??e.dragging,selected:a,zIndex:s}}))}),z(a.edges)},[e,t,r,O,i,l,o,d,c,p,u,h,x,g,b,f,w,M,z,L]),(0,m.useEffect)(()=>{L(e=>e.map(e=>{var t,s;let r=e.id===a,n=(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);return!!e.selected===r&&e.zIndex===n?e:{...e,selected:r,zIndex:n}}))},[a,L]),(0,m.useEffect)(()=>{if(!k.current)return;let e=setTimeout(()=>{k.current?.fitView({padding:r?.2:.14,duration:500,maxZoom:r?1.05:.9})},0);return()=>clearTimeout(e)},[r]),(0,m.useEffect)(()=>{var t,a,s,r;let d,c;if(!n||C.current.has(n))return;let p=e.tasks.filter(e=>!tb(e,i,l,o)&&e.dispatchId===n&&!0!==e.metadata.optimistic).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0))[0];p&&(C.current.add(n),t=p.id,a=$,s=S,r=P,a(e=>e.includes(t)?e:[...e,t]),r(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),v(p.id))},[e.tasks,n,i,l,o,v]),(0,m.useEffect)(()=>{let e=S.current;return()=>{e.forEach(e=>{clearTimeout(e)}),e.clear()}},[]),(0,m.useEffect)(()=>{if(!_||!k.current)return;let e=D.find(e=>e.id===_);if(!e)return;k.current.setCenter(e.position.x+(e.width??272)/2,e.position.y+(e.height??204)/2,{zoom:Math.max(k.current.getZoom(),.88),duration:650});let t=setTimeout(()=>{P(e=>e===_?null:e)},900);return()=>clearTimeout(t)},[_,D]),(0,m.useEffect)(()=>{let e=j.current;if(!e||"u"<typeof ResizeObserver)return;let t=null,a=new ResizeObserver(()=>{k.current&&0!==D.length&&(t&&clearTimeout(t),t=setTimeout(()=>{k.current?.fitView({padding:.14,duration:260,maxZoom:.9})},90))});return a.observe(e),()=>{a.disconnect(),t&&clearTimeout(t)}},[D.length]),(0,m.useEffect)(()=>{var e,t,a,s;let r,n,i;if(!I.current)return;if(T.current){T.current=!1;return}let l=Object.fromEntries(D.filter(e=>"agent"===e.type||"task"===e.type).map(e=>{var t;return["agent"===(t=e).type?tw(t.data.agent):ty(t.data.task),{x:e.position.x,y:e.position.y}]})),o={...A.current,...l};e=A.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}))&&(A.current=o,a=th,s=JSON.stringify(o),(i=globalThis.localStorage)&&"function"==typeof i.setItem&&i.setItem(a,s))},[D]),(0,s.jsx)("div",{ref:j,className:N("h-full w-full",y),children:(0,s.jsx)(eb.Gc,{nodes:D,edges:F,nodeTypes:tu,onInit:e=>{k.current=e},elevateNodesOnSelect:!1,onNodesChange:U,onEdgesChange:W,onNodeClick:(e,t)=>v(t.id),fitView:!0,fitViewOptions:{padding:.14,duration:700,maxZoom:.9},minZoom:.42,maxZoom:1.2,defaultEdgeOptions:{type:"simplebezier",markerEnd:{type:ef.TG.ArrowClosed,width:16,height:16,color:"var(--mission-edge-arrow)"},style:{strokeWidth:2.25}},edgeTypes:tm,defaultMarkerColor:"var(--mission-edge-arrow)",proOptions:{hideAttribution:!0},className:"h-full w-full rounded-[inherit]"})})}function tg(e,t,a,s,r,n,i,l,o,d,c,p,u,m,h,x,g,b,f){let w=s?e.agents.find(e=>e.id===s):null,v=w?.workspaceId??null,y=null!==w,j=y?e.workspaces.filter(e=>e.id===v):a?e.workspaces.filter(e=>e.id===a):[...e.workspaces].sort((e,t)=>t.activeRuntimeIds.length-e.activeRuntimeIds.length),k=[],N=[],C=[];j.forEach((w,v)=>{let j=y?e.agents.filter(e=>e.workspaceId===w.id&&e.id===s):e.agents.filter(e=>e.workspaceId===w.id),S=y?e.tasks.filter(e=>e.workspaceId===w.id&&e.primaryAgentId===s):e.tasks.filter(e=>e.workspaceId===w.id),A=y?[]:S.filter(e=>!l.includes(e.key)),I=y?S:S.filter(e=>!tb(e,n,i,l)),T=!y&&A.length>0&&A.every(e=>tb(e,n,i,l)),R=v%2*1160+44,M=920*Math.floor(v/2)+42,O=R+52,$=R+390,_=M+118;j.forEach((e,n)=>{let i=I.filter(t=>{var a;return((a=t).primaryAgentId||a.agentIds[0]||null)===e.id}).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0)),o=_+4*n;N.push({id:e.id,type:"agent",draggable:!0,position:tf(tw(e),{x:O,y:o},f,tv(e.id)),zIndex:10,selected:!1,data:{agent:e,emphasis:!!y||!a||a===w.id,focused:s===e.id,relativeTimeReferenceMs:t,onEdit:d,onDelete:c,onFocus:p}}),C.push(...i),i.forEach((e,s)=>{var n;let i="string"==typeof e.metadata.bootstrapStage?e.metadata.bootstrapStage:null,d="submitting"===i||"accepted"===i||"waiting-for-heartbeat"===i||"waiting-for-runtime"===i||"runtime-observed"===i,c=r.includes(e.id);N.push({id:e.id,type:"task",draggable:!0,selectable:!0,position:tf(ty(e),{x:$,y:o+152*s+10},f,(n=e.id,`task:${n}`)),zIndex:d?40:c?28:10,selected:!1,data:{task:e,emphasis:!!y||!a||a===w.id,relativeTimeReferenceMs:t,pendingCreation:d,justCreated:c,locked:l.includes(e.key),onReply:u,onCopyPrompt:m,onHide:h,onToggleLock:x,onAbortTask:g,onInspect:b}})}),_+=Math.max(152,152*i.length+44)}),y||k.push({id:w.id,type:"workspace",draggable:!1,position:{x:R,y:M},zIndex:0,style:{width:1060,height:Math.max(_-M+112,700)},selectable:!0,selected:!1,data:{workspace:w,emphasis:!a||a===w.id,taskCardCount:A.length,taskCardsHidden:T,onToggleTaskCards:A.length>0?()=>o(w.id):void 0}})});let S=[...k,...N];return{nodes:S,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:{strokeWidth:"running"===t.status?2.95:2.25}})}return a}(C,S)}}function tb(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 tf(e,t,a,s){let r=a[e]||(s?a[s]:void 0);return r?{x:r.x,y:r.y}:t}function tw(e){return`agent:${e.workspaceId}:${e.id}`}function tv(e){return`agent:${e}`}function ty(e){return`task:${e.workspaceId||"global"}:${e.key}`}var tj=a(1880),tk=a(4816),tN=a(7618),tC=a(7882),tS=a(8755);let tA=(0,y.F)("text-xs font-medium uppercase tracking-[0.18em] text-slate-400"),tI=m.forwardRef(({className:e,...t},a)=>(0,s.jsx)(tS.b,{ref:a,className:N(tA(),e),...t}));tI.displayName=tS.b.displayName;let tT=[{value:"15m",label:"15 min"},{value:"30m",label:"30 min"},{value:"60m",label:"1 hour"},{value:"240m",label:"4 hours"}];function tR(e){return"monitoring"===e?{enabled:!0,every:"30m"}:{enabled:!1,every:"30m"}}function tM(e,t){let a=tR(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 tO(e,t,a){let s=tR(t);return e.enabled!==s.enabled||e.every!==s.every?e:tR(a)}function t$({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)(()=>tL(t??e.workspaces[0]?.id??"")),k=e.workspaces.find(e=>e.id===y.workspaceId)??e.workspaces[0]??null,C=(i=k?.slug,l=y.name||eS[y.policy.preset].defaultName,o=tU(i??""),d=tU(l)||"agent",o?`${o}-${d}`:d),S=tU(y.id),A=S.length>0?e.agents.find(e=>e.id===S)??null:null,I=A?e.workspaces.find(e=>e.id===A.workspaceId)?.name??A.workspacePath:null,M=!!(S&&y.workspaceId)&&!b&&null===A,O=x||"monitoring"===y.policy.preset;(0,m.useEffect)(()=>{p(!0)},[]),(0,m.useEffect)(()=>{u||(j(tL(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.");eu.o.success("Agent created in OpenClaw.",{description:t.agentId}),h(!1),await a(),r?.(t.agentId)}catch(e){eu.o.error("Agent creation failed.",{description:e instanceof Error?e.message:"Unknown agent error."})}finally{f(!1)}}};return c?(0,s.jsxs)(H,{open:u,onOpenChange:h,children:[(0,s.jsx)(Z,{asChild:!0,children:n}),(0,s.jsxs)(X,{className:"max-h-[90vh] overflow-y-auto sm:max-w-3xl",children:[(0,s.jsxs)(ee,{children:[(0,s.jsx)(ea,{children:"Create a new OpenClaw agent"}),(0,s.jsx)(es,{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:eI.map(e=>(0,s.jsx)(tP,{label:e.label,description:e.description,active:y.policy.preset===e.value,badgeVariant:eS[e.value].badgeVariant,onClick:()=>j(t=>{var a,s;let r,n,i;return a=t,s=e.value,r=eS[a.policy.preset],n=eS[s],i=e$(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:tO(a.heartbeat,a.policy.preset,s)}})},e.value))})]}),(0,s.jsx)(tE,{policy:y.policy}),(0,s.jsxs)(t_,{label:"Agent id",htmlFor:"create-agent-id",children:[(0,s.jsx)(R,{id:"create-agent-id",value:y.id,onChange:e=>{let t=e.target.value,a=tU(t);v(!!a&&a!==C),j(e=>({...e,id:t}))},placeholder:C||"workspace-agent"}),(0,s.jsx)("p",{className:N("text-[12px]",A?"text-rose-300":"text-slate-500"),children:A?`ID "${S}" is already used by ${A.name} in ${I}.`:S&&S!==y.id.trim()?`Saved as ${S}. Suggested workspace-scoped id: ${C}.`:`Workspace-scoped id: ${C}.`})]}),(0,s.jsx)(t_,{label:"Display name",htmlFor:"create-agent-name",children:(0,s.jsx)(R,{id:"create-agent-name",value:y.name,onChange:e=>j(t=>({...t,name:e.target.value})),placeholder:eS[y.policy.preset].defaultName})}),(0,s.jsx)(t_,{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)(t_,{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)(t_,{label:"Emoji",htmlFor:"create-agent-emoji",children:(0,s.jsx)(R,{id:"create-agent-emoji",value:y.emoji,onChange:e=>j(t=>({...t,emoji:e.target.value})),placeholder:eS[y.policy.preset].defaultEmoji})}),(0,s.jsx)(t_,{label:"Theme",htmlFor:"create-agent-theme",children:(0,s.jsx)(R,{id:"create-agent-theme",value:y.theme,onChange:e=>j(t=>({...t,theme:e.target.value})),placeholder:eS[y.policy.preset].defaultTheme})})]}),(0,s.jsx)(t_,{label:"Avatar URL",htmlFor:"create-agent-avatar",children:(0,s.jsx)(R,{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)(T,{type:"button",variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>g(e=>!e),children:x?"Hide":"Show"})]}),O?(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)(T,{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||tR(e.policy.preset).every}})),children:y.heartbeat.enabled?"On":"Off"})]}),y.heartbeat.enabled?(0,s.jsx)("div",{className:"mt-3",children:(0,s.jsx)(t_,{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:tT.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)(tD,{label:"Missing tool behavior",htmlFor:"create-agent-missing-tools",value:y.policy.missingToolBehavior,options:eT,onChange:e=>j(t=>({...t,policy:{...t.policy,missingToolBehavior:e}}))}),(0,s.jsx)(tD,{label:"Install scope",htmlFor:"create-agent-install-scope",value:y.policy.installScope,options:eR,onChange:e=>j(t=>({...t,policy:{...t.policy,installScope:e}}))}),(0,s.jsx)(tD,{label:"File access",htmlFor:"create-agent-file-access",value:y.policy.fileAccess,options:eM,onChange:e=>j(t=>({...t,policy:{...t.policy,fileAccess:e}}))}),(0,s.jsx)(tD,{label:"Network access",htmlFor:"create-agent-network-access",value:y.policy.networkAccess,options:eO,onChange:e=>j(t=>({...t,policy:{...t.policy,networkAccess:e}}))})]}):null]})]}),(0,s.jsxs)(et,{children:[(0,s.jsx)(T,{variant:"secondary",onClick:()=>h(!1),children:"Cancel"}),(0,s.jsx)(T,{onClick:$,disabled:!M,children:b?"Creating...":"Create agent"})]})]})]}):(0,s.jsx)(s.Fragment,{children:n})}function t_({label:e,htmlFor:t,children:a}){return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(tI,{htmlFor:t,className:"text-[11px] uppercase tracking-[0.18em] text-slate-400",children:e}),a]})}function tP({label:e,description:t,active:a,badgeVariant:r,onClick:n}){return(0,s.jsx)("button",{type:"button",onClick:n,className:N("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)(S,{variant:r,children:a?"selected":"preset"})]})})}function tE({policy:e}){let t=eS[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)(S,{variant:t.badgeVariant,children:t.label})]}),(0,s.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,s.jsx)(S,{variant:"muted",children:eP(e.missingToolBehavior)}),(0,s.jsx)(S,{variant:"muted",children:eE(e.installScope)}),(0,s.jsx)(S,{variant:"muted",children:eD(e.fileAccess)}),(0,s.jsxs)(S,{variant:"muted",children:["Network ",eL(e.networkAccess)]})]})]})}function tD({label:e,htmlFor:t,value:a,options:r,onChange:n}){return(0,s.jsx)(t_,{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 tL(e,t={}){let a=e$(t.policy?.preset??"worker",t.policy),s=eS[a.preset],r=tM(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 tU(e){return e.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}let tF=m.forwardRef(({className:e,...t},a)=>(0,s.jsx)("textarea",{className:N("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}));tF.displayName="Textarea";let tz="mission-control-recent-prompts";function tW({snapshot:e,activeWorkspaceId:t,selectedNodeId:a,composeIntent:r,onRefresh:n,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,k]=(0,m.useState)(!1),[C,S]=(0,m.useState)(!1),[A,I]=(0,m.useState)(!1),[R,M]=(0,m.useState)(!1),[O,$]=(0,m.useState)(!1),[_,P]=(0,m.useState)(null),E=(0,m.useRef)(null),D=(0,m.useRef)(null),L=(0,m.useRef)(null),F=(0,m.useRef)(null),z=(0,m.useRef)(!1),W=(0,m.useRef)(null),q=e.workspaces.find(e=>e.id===t)??e.workspaces[0],B=e.agents.filter(e=>!q||e.workspaceId===q.id),V=B.find(e=>e.id===g)??B[0]??null,K=V?.id??null,G=B.map(e=>({label:e.name,value:e.id})),H=tJ(q?.id??t??null,K),Z=!!(h.trim()&&K&&!v),Q=V?`Compose for ${V.name}...`:"Compose a mission...",Y=((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=Y.length>0,ee=R&&!O&&!A&&!C&&!v&&0===h.trim().length&&null===_;(0,m.useEffect)(()=>{let s=`${t??"all"}:${a??"none"}:${B.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=L.current;if(n&&B.some(e=>e.id===n)){g!==n&&b(n),L.current=null;return}D.current!==s&&(D.current=s,r&&B.some(e=>e.id===r))?b(r):B.some(e=>e.id===g)||b(r&&B.some(e=>e.id===r)?r:B[0]?.id??"")},[e,t,a,g,B]),(0,m.useEffect)(()=>{let e=globalThis.matchMedia("(min-width: 1024px)"),t=()=>{M(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"),P(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(!r||F.current===r.id)return;F.current=r.id;let e=r.mission.trim();if(!e)return;let a=tJ(q?.id??t??null,r.agentId??K);a&&(W.current=a);let s=0===h.trim().length||h.trim()===e;P({id:r.id,mission:e,sourceKind:r.sourceKind??"copy",sourceLabel:r.sourceLabel??"selected runtime"}),s&&x(e),r.agentId&&b(r.agentId),requestAnimationFrame(()=>{E.current?.focus(),s&&E.current?.setSelectionRange(e.length,e.length)})},[r,h,t,K,q?.id]);let et=async e=>{y(!0);let a=e.agentId||K,s=Date.now(),r=globalThis.crypto?.randomUUID?.()||`dispatch:${s}`,i=new AbortController;a&&o({requestId:r,mission:e.mission.trim(),agentId:a,workspaceId:q?.id??t??null,submittedAt:s,abortController:i});try{let l=e.mission.trim(),o=await fetch("/api/mission",{method:"POST",headers:{"Content-Type":"application/json"},signal:i.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(""),P(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(tz);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(tz,JSON.stringify(t))}catch{}}({id:globalThis.crypto?.randomUUID?.()||`${s}`,mission:l,agentId:a,agentName:V?.name??"Agent",workspaceId:q?.id??t,workspaceName:q?.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?eu.o.error("Mission could not start.",{description:d.summary||p}):eu.o.success("Mission queued in OpenClaw.",{description:p}),n().catch(()=>null)}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;d(r,e instanceof Error?e.message:"Unknown mission error."),eu.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:N("mx-auto w-full transition-[width] duration-300",ee&&"lg:w-[360px]"),onMouseEnter:()=>{R&&$(!0)},onMouseLeave:()=>{R&&$(!1)},children:(0,s.jsx)(tC.N,{initial:!1,mode:"wait",children:ee?(0,s.jsx)(ey.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:Q}),(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)(tj.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Create task"]})]})},"collapsed"):(0,s.jsxs)(ey.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)(tC.N,{initial:!1,children:_?(0,s.jsxs)(ey.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 ",_.sourceLabel]}),(0,s.jsx)("button",{type:"button",className:"text-slate-200 transition-colors hover:text-white",onClick:()=>ea(_.mission,{mode:"replace"}),children:"Replace"}),(0,s.jsx)("button",{type:"button",className:"text-slate-200 transition-colors hover:text-white",onClick:()=>ea(_.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:()=>P(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:N("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:()=>I(!0),onBlurCapture:e=>{let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||I(!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)(tq,{value:g,options:G,onChange:e=>{b(e)}}):(0,s.jsx)(tG,{children:"No agent"}),(0,s.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,s.jsx)(tV,{label:"Refresh mission control",onClick:async()=>{k(!0),await n(),k(!1)},children:j?(0,s.jsx)(i.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(tk.A,{className:"h-3.5 w-3.5"})}),(0,s.jsx)(tV,{label:"Create workspace",onClick:l,children:(0,s.jsx)(U.A,{className:"h-3.5 w-3.5"})}),(0,s.jsx)(tV,{label:"Composer settings",onClick:()=>S(e=>!e),active:C||"medium"!==f,children:(0,s.jsxs)("span",{className:"relative inline-flex",children:[(0,s.jsx)(tN.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)(tF,{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:Q,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)(tC.N,{initial:!1,children:X?(0,s.jsxs)(ey.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:[Y.map(e=>(0,s.jsx)(tK,{label:e.label,onClick:()=>{"open-workspace-create"===e.action?l():e.mission&&ea(e.mission,{thinking:e.thinking})}},e.id)),q?(0,s.jsx)(t$,{snapshot:e,defaultWorkspaceId:q.id,onRefresh:n,onAgentCreated:e=>{L.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)(T,{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)(i.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(tj.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Create task"]})]})]}),(0,s.jsx)(tC.N,{initial:!1,children:C?(0,s.jsx)(ey.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)(tB,{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"),P(null),z.current=!0,H&&void 0!==globalThis.localStorage&&globalThis.localStorage.removeItem(H)},children:"Clear draft"})]})}):null})]},"expanded")})})}function tq({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)(h.A,{className:"pointer-events-none absolute right-3 h-3.5 w-3.5 text-slate-400"}):null]})}function tB({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)(h.A,{className:"pointer-events-none absolute right-3 h-3.5 w-3.5 text-slate-400"})]})}function tV({label:e,active:t=!1,onClick:a,children:r}){return(0,s.jsx)("button",{type:"button","aria-label":e,title:e,onClick:a,className:N("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 tK({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 tG({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 tJ(e,t){return e||t?`mission-control-composer-draft:${e??"global"}:${t??"unassigned"}`:null}var tH=a(6161),tZ=a(910),tQ=a(8988),tY=a(1333),tX=a(6765);function t0(e){return(0,s.jsx)(t1,{...e},e.selectedNodeId??"overview")}function t1({snapshot:e,selectedNodeId:t,lastMission:a,onAbortTask:r,collapsed:n,onToggleCollapsed:i,activeTab:l,onActiveTabChange:o}){let d=ez(e.generatedAt),c=e.workspaces.find(e=>e.id===t),p=e.agents.find(e=>e.id===t),u=e.tasks.find(e=>e.id===t),h=e.runtimes.find(e=>e.id===t),g=e.models.find(e=>e.id===t),b=!!u?.metadata.optimistic,f=c||p||u||h||g||null,w=h?.id??null,v=u?.id??null,[y,j]=(0,m.useState)(null),[k,C]=(0,m.useState)(null),[A,I]=(0,m.useState)(null),[T,R]=(0,m.useState)(null),M=(0,m.useMemo)(()=>{var e;let t;return b&&u?{task:e=u,runs:[],outputs:[],liveFeed:Array.isArray(t=e.metadata.optimisticEvents)?t.filter(ae).sort((e,t)=>Date.parse(e.timestamp)-Date.parse(t.timestamp)):[],createdFiles:[],warnings:"stalled"===e.status||at(e)?[e.subtitle]:[],integrity:t7(e)}:null},[b,u]),O=y&&y.runtimeId===w?y:null,$=k?.runtimeId===w?k.message:null,_=A&&A.task.id===v?A:null,P=T?.taskId===v?T.message:null,E=M??_,D=!!v&&!b&&!E&&!P,L=!!w&&!O&&!$,U=!!(h||u),F=!!(h||u),z=("output"!==l||U)&&("files"!==l||F)?l:"overview",W=u?"Feed":"Output",q=c?.name||p?.name||(u?eH(u.title||u.mission||"Task",48)||"Task":null)||(h?eH(h.title||"Run",48)||"Run":null)||g?.name||"Gateway overview",B=c?"workspace":p?"agent":u?"task":h?"run":g?"model":"selection",V=(0,m.useMemo)(()=>[{id:"overview",label:"Overview",icon:to.A,enabled:!0},{id:"output",label:W,icon:x.A,enabled:U},{id:"files",label:"Files",icon:tH.A,enabled:F},{id:"raw",label:"Raw",icon:tZ.A,enabled:!0}],[W,F,U]);return(0,m.useEffect)(()=>{if(!w)return;let e=new AbortController;return fetch(`/api/runtimes/${encodeURIComponent(w)}`,{signal:e.signal}).then(async e=>{let t=await e.json();if(!e.ok)throw Error(t.error||"Unable to load runtime output.");j(t),C(null)}).catch(t=>{e.signal.aborted||(j(null),C({runtimeId:w,message:t instanceof Error?t.message:"Unable to load runtime output."}))}),()=>e.abort()},[w]),(0,m.useEffect)(()=>{if(!v||b)return;let e=new EventSource(`/api/tasks/${encodeURIComponent(v)}/stream`),t=e=>{try{let t=JSON.parse(e.data);if("task"!==t.type)return;I(t.detail),R(null)}catch(e){R({taskId:v,message:e instanceof Error?e.message:"Unable to parse task feed."})}},a=e=>{try{let t=JSON.parse(e.data);"error"===t.type&&R({taskId:v,message:t.error})}catch{R({taskId:v,message:"Unable to load task detail."})}};return e.addEventListener("task",t),e.addEventListener("task-error",a),e.onerror=()=>{R(e=>e?.taskId===v?e:{taskId:v,message:"Task feed disconnected. Reconnecting…"})},()=>{e.removeEventListener("task",t),e.removeEventListener("task-error",a),e.close()}},[v,b]),(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:N("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)(x.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)(tQ.A,{className:"h-4 w-4"}):(0,s.jsx)(tY.A,{className:"h-4 w-4"})}),(0,s.jsx)("div",{className:"mt-6 flex flex-1 flex-col items-center gap-2",children:V.map(e=>(0,s.jsx)(ai,{icon:e.icon,label:e.label,active:z===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)(S,{variant:"muted",children:f?"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 line-clamp-1 font-display text-[1.24rem] leading-tight text-white",children:q}),(0,s.jsx)("p",{className:"mt-2 text-[12px] leading-5 text-slate-400",children:f?"Live selection details.":"Gateway status and activity."})]}),(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)(x.A,{className:"h-4 w-4 text-cyan-200"})})]}),(0,s.jsxs)("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[(0,s.jsx)(S,{variant:"muted",children:B}),(0,s.jsx)("p",{className:"text-[12px] leading-5 text-slate-400",children:u?`${u.runtimeCount} runs \xb7 ${u.liveRunCount} live \xb7 ${eF(u.updatedAt,d)}`:h?`Run ${eK(h.runId||h.id,10)} \xb7 ${h.status} \xb7 ${eF(h.updatedAt,d)}`:p?`${p.activeRuntimeIds.length} active runs`:c?`${c.agentIds.length} agents attached`:g?`${g.provider} model`:"Live gateway context"})]}),(0,s.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:V.filter(e=>e.enabled).map(e=>(0,s.jsx)(al,{label:e.label,active:z===e.id,onClick:()=>o(e.id)},e.id))})]}),(0,s.jsx)("div",{className:"flex-1 p-4",children:(0,s.jsx)(tC.N,{mode:"wait",children:(0,s.jsxs)(ey.P.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},className:"space-y-3.5",children:["overview"===z?(0,s.jsxs)(s.Fragment,{children:[c?(0,s.jsx)(t5,{snapshot:e,workspaceId:c.id}):null,p?(0,s.jsx)(t3,{snapshot:e,agentId:p.id}):null,u?(0,s.jsx)(t4,{snapshot:e,task:u,taskId:u.id,taskDetail:E,taskDetailLoading:D,taskDetailError:P,onAbortTask:r}):null,h?(0,s.jsx)(aa,{snapshot:e,runtimeId:h.id,runtimeOutput:O,runtimeOutputLoading:L,runtimeOutputError:$}):null,g?(0,s.jsx)(an,{snapshot:e,modelId:g.id}):null,f?null:(0,s.jsx)(t2,{snapshot:e,lastMission:a})]}):null,"output"===z&&u?(0,s.jsx)(t6,{task:u,taskDetail:E,taskDetailLoading:D,taskDetailError:P}):null,"output"===z&&h?(0,s.jsx)(ar,{runtime:h,runtimeOutput:O,runtimeOutputLoading:L,runtimeOutputError:$}):null,"files"===z&&u?(0,s.jsx)(t9,{snapshot:e,task:u,taskDetail:E}):null,"files"===z&&h?(0,s.jsx)(as,{runtime:h,runtimeOutput:O}):null,"raw"===z?(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(u&&E?E:h&&O?{runtime:h,output:O}:f||e,null,2)}):null]},`${t||"overview"}:${z}`)})}),(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)(tX.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:u?`${u.runtimeCount} runs`:h?`Run ${eK(h.runId||h.id,10)}`:p?`${p.activeRuntimeIds.length} active runs`:c?`${c.agentIds.length} agents`:g?g.provider:"Gateway overview"}),(0,s.jsxs)("p",{className:"mt-1 text-[12px] text-slate-400",children:[B," \xb7"," ",u?`${E?.liveFeed.length??0} live feed events`:h?`${O?.items.length??0} transcript entries`:p?`${p.activeRuntimeIds.length} tracked runs`:c?`${c.agentIds.length} attached`:`${e.presence.length} live beacons`]})]})]})})})]})})]})}function t2({snapshot:e,lastMission:t}){let a=ez(e.generatedAt),r=e.diagnostics.runtime.stateWritable&&e.diagnostics.runtime.sessionStoreWritable?"passed"===e.diagnostics.runtime.smokeTest.status?"verified":"pending smoke test":"attention";return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(ao,{icon:tX.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)(ao,{icon:tH.A,title:"Runtime preflight",value:r,children:[(0,s.jsx)("p",{className:"font-mono text-xs text-slate-400",children:e.diagnostics.runtime.stateRoot}),(0,s.jsx)("p",{children:e.diagnostics.runtime.sessionStores.length>0?`${e.diagnostics.runtime.sessionStores.filter(e=>e.writable).length}/${e.diagnostics.runtime.sessionStores.length} session stores writable`:"No agent session stores have been probed yet."}),e.diagnostics.runtime.smokeTest.checkedAt?(0,s.jsxs)("p",{children:["Smoke test ",e.diagnostics.runtime.smokeTest.status," \xb7"," ",e.diagnostics.runtime.smokeTest.agentId||"unknown agent"," \xb7"," ",eF(Date.parse(e.diagnostics.runtime.smokeTest.checkedAt),a)]}):(0,s.jsx)("p",{children:"No runtime smoke test has been recorded yet."}),e.diagnostics.runtime.issues[0]?(0,s.jsx)("div",{className:"rounded-[14px] border border-amber-400/15 bg-amber-400/8 px-3 py-2 text-[13px] text-amber-50",children:e.diagnostics.runtime.issues[0]}):null]}),(0,s.jsxs)(ao,{icon:x.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)(ao,{icon:z.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 t5({snapshot:e,workspaceId:t}){let a=ez(e.generatedAt),r=e.workspaces.find(e=>e.id===t),n=e.agents.filter(e=>e.workspaceId===t),i=r?r.modelIds.map(t=>e.models.find(e=>e.id===t)?.name||t):[],l=e.runtimes.filter(e=>e.workspaceId===t||r?.activeRuntimeIds.includes(e.id)).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0));if(!r)return null;let o=l.filter(e=>"running"===e.status||"queued"===e.status||"idle"===e.status),d=l[0]??null,c=ax(l.flatMap(ah)).slice(0,8),p=r.bootstrap.coreFiles.every(e=>e.present)&&r.bootstrap.projectShell.every(e=>e.present)?"ready":r.bootstrap.coreFiles.some(e=>e.present)||r.bootstrap.projectShell.some(e=>e.present)?"partial":"thin",u=Array.from(new Set(n.flatMap(e=>e.observedTools??[]))),m=0===n.length?"no agents":r.capabilities.workspaceOnlyAgentCount===n.length?"workspace-only":0===r.capabilities.workspaceOnlyAgentCount?"open":"mixed";return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(ao,{icon:tH.A,title:"Overview",value:r.health,children:[(0,s.jsx)("p",{className:"font-mono text-xs text-slate-400",children:eG(r.path)}),(0,s.jsx)(ac,{items:[{label:"Agents",value:String(n.length)},{label:"Models",value:String(r.modelIds.length)},{label:"Runs",value:String(l.length)},{label:"Sessions",value:String(r.totalSessions)}]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Models"}),(0,s.jsx)(au,{emptyLabel:"No models attached",items:i,emptyVariant:"muted",itemVariant:"muted"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Team"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:n.map(e=>(0,s.jsx)(S,{variant:e.isDefault?"default":"muted",children:e.name},e.id))})]})]}),(0,s.jsxs)(ao,{icon:z.A,title:"Bootstrap",value:p,children:[(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(S,{variant:r.bootstrap.template?"default":"muted",children:r.bootstrap.template||"template unknown"}),(0,s.jsx)(S,{variant:r.bootstrap.sourceMode?"muted":"warning",children:r.bootstrap.sourceMode||"source unknown"}),r.bootstrap.agentTemplate?(0,s.jsx)(S,{variant:"muted",children:r.bootstrap.agentTemplate}):null]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Core files"}),(0,s.jsx)(ap,{items:r.bootstrap.coreFiles,missingVariant:"warning"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Optional scaffold"}),(0,s.jsx)(ap,{items:[...r.bootstrap.optionalFiles,...r.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)(ap,{items:r.bootstrap.projectShell})]})]}),(0,s.jsxs)(ao,{icon:z.A,title:"Capabilities",value:m,children:[(0,s.jsxs)("p",{children:[r.capabilities.workspaceOnlyAgentCount,"/",n.length," agents are configured with"," ",(0,s.jsx)("span",{className:"font-mono text-xs text-slate-300",children:"fs.workspaceOnly"}),"."]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Skills"}),(0,s.jsx)(au,{emptyLabel:"No explicit skills",items:r.capabilities.skills,emptyVariant:"muted",itemVariant:"muted"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Local workspace skills"}),(0,s.jsx)(au,{emptyLabel:"No local SKILL.md scaffolds",items:r.bootstrap.localSkillIds,emptyVariant:"muted",itemVariant:"success"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Declared tools"}),(0,s.jsx)(au,{emptyLabel:"No explicit tools configured",items:r.capabilities.tools,emptyVariant:"muted",itemVariant:"warning"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Observed tools"}),(0,s.jsx)(au,{emptyLabel:"No runtime tool calls recovered yet",items:u,emptyVariant:"muted",itemVariant:"default"})]})]}),(0,s.jsxs)(ao,{icon:x.A,title:"Activity",value:`${o.length} live`,children:[(0,s.jsxs)("p",{children:[l.length," tracked runs across ",r.totalSessions," recorded sessions."]}),(0,s.jsx)("p",{children:d?`Latest update ${eF(d.updatedAt,a)}`:"No runtime activity has been recorded yet."}),l.length>0?(0,s.jsx)("div",{className:"space-y-2 pt-1",children:l.slice(0,3).map(e=>(0,s.jsxs)("div",{className:"flex items-center justify-between rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"truncate text-[13px] text-white",children:e.title}),(0,s.jsxs)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:[e.subtitle," \xb7 ",eK(e.runId||e.id,10)]})]}),(0,s.jsx)(S,{variant:eV(e.status),children:e.status})]},e.id))}):null,(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Agent posture"}),(0,s.jsx)("div",{className:"space-y-2",children:n.map(e=>(0,s.jsxs)("div",{className:"flex items-center justify-between rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"truncate text-[13px] text-white",children:e.name}),(0,s.jsx)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:e.currentAction})]}),(0,s.jsx)(S,{variant:"engaged"===e.status?"default":"offline"===e.status?"danger":"muted",children:e.status})]},e.id))})]})]}),(0,s.jsx)(ao,{icon:tZ.A,title:"Created files",value:String(c.length),children:(0,s.jsx)(ad,{files:c,emptyLabel:"No file artifacts have been detected in recent workspace runs."})})]})}function t3({snapshot:e,agentId:t}){let a=ez(e.generatedAt),r=e.agents.find(e=>e.id===t),n=e.workspaces.find(e=>e.id===r?.workspaceId),i=e.models.find(e=>e.id===r?.modelId),l=r?.observedTools??[],o=e.runtimes.filter(e=>r?.activeRuntimeIds.includes(e.id)).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0)),d=ax(o.flatMap(ah)).slice(0,8);return r?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(ao,{icon:z.A,title:"Agent identity",value:r.id,children:[(0,s.jsx)("p",{children:r.name}),(0,s.jsx)("p",{children:r.identity.emoji?`${r.identity.emoji} \xb7 ${r.identity.theme??"theme unset"}`:"No identity emoji"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[r.isDefault?(0,s.jsx)(S,{variant:"default",children:"default agent"}):null,(0,s.jsx)(S,{variant:eS[r.policy.preset].badgeVariant,children:e_(r.policy.preset)}),r.identity.source?(0,s.jsx)(S,{variant:"muted",children:r.identity.source}):null]})]}),(0,s.jsxs)(ao,{icon:tH.A,title:"Workspace",value:n?.name||"n/a",children:[(0,s.jsx)("p",{className:"font-mono text-xs text-slate-400",children:eG(r.workspacePath)}),(0,s.jsxs)("p",{children:[r.sessionCount," recorded sessions"]})]}),(0,s.jsxs)(ao,{icon:z.A,title:"Model assignment",value:i?.name||r.modelId,children:[(0,s.jsx)("p",{children:i?`${i.provider} \xb7 ${eW(i.contextWindow)} ctx`:"Model metadata unavailable"}),(0,s.jsx)("p",{children:i?.available===!1?"Currently unavailable":i?.local?"Local model route":"Remote model route"})]}),(0,s.jsxs)(ao,{icon:z.A,title:"Agent profile",value:r.profile.purpose||"Profile not declared",children:[(0,s.jsx)("p",{children:r.profile.purpose||"No explicit purpose was found in the workspace bootstrap files."}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:r.profile.sourceFiles.length>0?r.profile.sourceFiles.map(e=>(0,s.jsx)(S,{variant:"muted",children:e},e)):(0,s.jsx)(S,{variant:"warning",children:"derived from config"})})]}),(0,s.jsx)(ao,{icon:x.A,title:"Operating style",value:`${r.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)(am,{emptyLabel:"No workspace bootstrap instructions were found.",items:r.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)(au,{emptyLabel:"No explicit response style",items:r.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:r.profile.outputPreference||"No explicit output preference was found."})]})]})}),(0,s.jsxs)(ao,{icon:tX.A,title:"Runtime posture",value:r.status,children:[(0,s.jsx)("p",{children:r.currentAction}),(0,s.jsxs)("p",{children:["Last active ",eF(r.lastActiveAt,a)]}),(0,s.jsx)("p",{children:r.heartbeat.enabled?`Heartbeat ${r.heartbeat.every}`:"Heartbeat disabled"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(S,{variant:r.heartbeat.enabled?"success":"muted",children:r.heartbeat.enabled?"heartbeat on":"heartbeat off"}),"number"==typeof r.heartbeat.everyMs?(0,s.jsxs)(S,{variant:"muted",children:[Math.round(r.heartbeat.everyMs/1e3),"s interval"]}):null]})]}),(0,s.jsxs)(ao,{icon:x.A,title:"Operating policy",value:e_(r.policy.preset),children:[(0,s.jsx)("p",{children:eS[r.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:eP(r.policy.missingToolBehavior)})]}),(0,s.jsxs)("p",{children:["Install scope: ",(0,s.jsx)("span",{className:"text-white",children:eE(r.policy.installScope)})]}),(0,s.jsxs)("p",{children:["File access: ",(0,s.jsx)("span",{className:"text-white",children:eD(r.policy.fileAccess)})]}),(0,s.jsxs)("p",{children:["Network: ",(0,s.jsx)("span",{className:"text-white",children:eL(r.policy.networkAccess)})]})]})]}),(0,s.jsxs)(ao,{icon:x.A,title:"Run history",value:String(o.length),children:[0===o.length?(0,s.jsx)("p",{children:"No runtime history has been recorded for this agent yet."}):null,o.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)(S,{variant:eV(e.status),children:e.status})]},e.id))]}),(0,s.jsx)(ao,{icon:tZ.A,title:"Created files",value:String(d.length),children:(0,s.jsx)(ad,{files:d,emptyLabel:"No file artifacts have been detected for this agent yet."})}),(0,s.jsxs)(ao,{icon:z.A,title:"Capabilities",value:`${r.skills.length} skills`,children:[(0,s.jsx)(au,{emptyLabel:"No explicit skills",items:r.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)(au,{emptyLabel:"No explicit tools configured",items:r.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)(au,{emptyLabel:"No runtime tool calls recovered yet",items:l,emptyVariant:"muted",itemVariant:"default"})]})]})]}):null}function t4({snapshot:e,task:t,taskId:a,taskDetail:r,taskDetailLoading:n,taskDetailError:i,onAbortTask:l}){let d=e.tasks.find(e=>e.id===a)??t,c=at(d),p=!!l&&function(e){if(at(e))return!1;let t=e.status;return"running"===t||"queued"===t}(d),u=e.workspaces.find(e=>e.id===t?.workspaceId),m=e.agents.find(e=>e.id===t?.primaryAgentId),h=r?.runs??e.runtimes.filter(e=>t?.runtimeIds.includes(e.id)).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0)),g=r?.createdFiles??ax(h.flatMap(e=>ah(e))),b=r?.warnings??[];if(!t)return null;let f=r?.integrity??t7(t);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(ao,{icon:tH.A,title:"Mission",value:c?"aborted":d.status,children:[(0,s.jsx)("p",{className:"line-clamp-1 text-sm text-white",children:eH(d.mission||d.title,80)||d.title}),(0,s.jsx)("p",{className:"line-clamp-1 text-[12.5px] leading-5 text-slate-400",children:eH(d.subtitle,110)||d.subtitle}),(0,s.jsx)(ac,{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)}]}),l&&(p||c)?(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:(0,s.jsxs)(T,{type:"button",variant:c?"secondary":"destructive",size:"sm",disabled:!p,className:"gap-2",onClick:()=>{p&&l(d)},children:[(0,s.jsx)(o.A,{className:"h-3.5 w-3.5"}),c?"Aborted":"Abort task"]})}):null,(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[u?(0,s.jsx)(S,{variant:"muted",children:u.name}):null,m?(0,s.jsx)(S,{variant:"default",children:m.name}):null,d.dispatchId?(0,s.jsxs)(S,{variant:"muted",children:["dispatch ",eK(d.dispatchId,8)]}):null,c?(0,s.jsx)(S,{variant:"danger",children:"aborted"}):null]}),n&&!r?(0,s.jsx)("p",{children:"Connecting live task feed…"}):null,i?(0,s.jsx)("p",{className:"rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:i}):null]}),(0,s.jsx)(t8,{task:d,integrity:f}),(0,s.jsxs)(ao,{icon:x.A,title:"Runs",value:String(h.length),children:[0===h.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:h.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)(S,{variant:eV(e.status),children:e.status})]},e.id))})]}),(0,s.jsx)(ao,{icon:tZ.A,title:"Artifacts",value:String(g.length),children:(0,s.jsx)(ad,{files:g,emptyLabel:"This task has not produced a detectable file artifact yet."})}),b.length>0?(0,s.jsx)(ao,{icon:tX.A,title:"Warnings",value:String(b.length),children:(0,s.jsx)(am,{items:b,emptyLabel:"No warnings detected."})}):null]})}function t8({task:e,integrity:t}){let a=at(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)(ao,{icon:tX.A,title:"Result integrity",value:a?"aborted":"stalled"===e.status?"stalled":t.status,children:[(0,s.jsx)("p",{children:n}),(0,s.jsx)(ac,{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)(te,{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)(te,{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)(S,{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)(S,{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 ",eK(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)(am,{items:t.issues.map(e=>`${e.title}: ${e.detail}`),emptyLabel:"No integrity issues detected."})})]}):null]})}function t6({task:e,taskDetail:t,taskDetailLoading:a,taskDetailError:r}){if(a&&!t)return(0,s.jsx)(ao,{icon:x.A,title:"Live feed",value:"connecting",children:(0,s.jsx)("p",{children:"Connecting to the task feed…"})});if(r&&!t)return(0,s.jsx)(ao,{icon:x.A,title:"Live feed",value:"error",children:(0,s.jsx)("p",{children:r})});let n=t?.liveFeed??[],i=t?.integrity??t7(e);return(0,s.jsxs)(ao,{icon:x.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)(S,{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:eF(new Date(e.timestamp).getTime())})]}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(te,{text:e.detail,className:"text-[12.5px] leading-5 text-slate-100",url:e.url,filePath:e.filePath,displayPath:e.displayPath})})]},e.id))})]})}function t9({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??ax(r.flatMap(e=>ah(e))),i=a?.integrity??t7(t);return(0,s.jsxs)(ao,{icon:tZ.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)(te,{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)(ad,{files:n,emptyLabel:"This task has not produced a detectable file artifact yet."})]})}function t7(e){let t=at(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 ae(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 at(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 aa({snapshot:e,runtimeId:t,runtimeOutput:a,runtimeOutputLoading:r,runtimeOutputError:n}){let i,l=ez(e.generatedAt),o=e.runtimes.find(e=>e.id===t),d=ax(a?.createdFiles??(o?ah(o):[])),c=a?.warnings??(o&&Array.isArray(i=o.metadata.warnings)?i.filter(e=>"string"==typeof e&&e.trim().length>0):[]),p=a?.warningSummary??c[0]??null;return o?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(ao,{icon:x.A,title:"Runtime key",value:o.status,children:[(0,s.jsx)("p",{className:"font-mono text-xs text-slate-400",children:o.key}),(0,s.jsxs)("p",{children:["Session ",eK(o.sessionId,12)]}),o.taskId?(0,s.jsxs)("p",{children:["Task ",eK(o.taskId,12)]}):null,o.runId?(0,s.jsxs)("p",{children:["Run ",eK(o.runId,12)]}):null]}),(0,s.jsxs)(ao,{icon:tX.A,title:"Activity",value:eF(o.updatedAt,l),children:[(0,s.jsx)("p",{children:o.subtitle}),(0,s.jsxs)("p",{children:[eq(o.tokenUsage?.total)," tokens"]})]}),(0,s.jsxs)(ao,{icon:z.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)(te,{text:a?.finalText||a?.errorMessage||"No assistant output has been recorded for this runtime yet.",className:"text-[13px] leading-5 text-slate-100"}),p?(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: ",p]}):null,a?.finalTimestamp?(0,s.jsxs)("p",{className:"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:["Updated ",eF(new Date(a.finalTimestamp).getTime())]}):null]}),(0,s.jsx)(ao,{icon:tZ.A,title:"Created files",value:String(d.length),children:(0,s.jsx)(ad,{files:d,emptyLabel:"This runtime has not produced a detectable file artifact."})})]}):null}function as({runtime:e,runtimeOutput:t}){let a=ax(t?.createdFiles??ah(e));return(0,s.jsxs)(ao,{icon:tZ.A,title:"Files",value:String(a.length),children:[(0,s.jsx)("p",{children:e.title}),(0,s.jsx)(ad,{files:a,emptyLabel:"This runtime has not produced a detectable file artifact."})]})}function ar({runtime:e,runtimeOutput:t,runtimeOutputLoading:a,runtimeOutputError:r}){return a?(0,s.jsx)(ao,{icon:x.A,title:"Runtime output",value:"loading",children:(0,s.jsxs)("p",{children:["Loading transcript output for ",e.title,"…"]})}):r?(0,s.jsx)(ao,{icon:x.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)(ao,{icon:tX.A,title:"Warnings",value:String(t.warnings.length),children:(0,s.jsx)("p",{children:t.warningSummary})}):null,(0,s.jsx)(ao,{icon:tZ.A,title:"Created files",value:String(t.createdFiles.length),children:(0,s.jsx)(ad,{files:t.createdFiles,emptyLabel:"This runtime transcript does not include a successful file creation."})}),(0,s.jsxs)(ao,{icon:x.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)(te,{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)(ao,{icon:tX.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)(S,{variant:"assistant"===e.role?e.isError?"danger":"default":"toolResult"===e.role?"warning":"muted",children:e.role}),e.toolName?(0,s.jsx)(S,{variant:"muted",children:e.toolName}):null]}),(0,s.jsx)("span",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:eF(new Date(e.timestamp).getTime())})]}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(te,{text:e.text,className:"text-[12.5px] leading-5 text-slate-100"})})]},e.id))})]})]}):(0,s.jsx)(ao,{icon:x.A,title:"Runtime output",value:"missing",children:(0,s.jsx)("p",{children:"No transcript data is available for this runtime."})})}function an({snapshot:e,modelId:t}){let a=e.models.find(e=>e.id===t);return a?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(ao,{icon:z.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)(ao,{icon:tX.A,title:"Capacity",value:`${eW(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 ai({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:N("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 al({label:e,active:t,onClick:a}){return(0,s.jsx)("button",{type:"button",onClick:a,className:N("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 ao({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 ad({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 ag(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:eG(e.path)})]}),(0,s.jsx)(S,{variant:"muted",children:"reveal"})]})},e.path))})}function ac({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 ap({items:e,missingVariant:t="muted"}){return(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map(e=>(0,s.jsx)(S,{variant:e.present?"success":t,children:e.label},e.id))})}function au({items:e,emptyLabel:t,itemVariant:a,emptyVariant:r}){return 0===e.length?(0,s.jsx)(S,{variant:r,children:t}):(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map(e=>(0,s.jsx)(S,{variant:a,children:e},e))})}function am({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 ah(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 ax(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 ag(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.");e4.oR.success("Revealed file.",{description:eG(e)})}catch(e){e4.oR.error("Could not reveal file.",{description:e instanceof Error?e.message:"Unknown file reveal error."})}}var ab=a(2662),af=a(4927);function aw(e){var t;return e.diagnostics.installed&&e.diagnostics.rpcOk&&(t=e).diagnostics.runtime.stateWritable&&t.diagnostics.runtime.sessionStoreWritable}function av(e){return aw(e)&&e.diagnostics.modelReadiness.ready&&"passed"===e.diagnostics.runtime.smokeTest.status}function ay({snapshot:e,surfaceTheme:t,stage:a,systemActionLabel:r,systemActionDescription:n,systemPhase:l,modelPhase:o,systemRun:d,modelRun:c,selectedModelId:p,discoveredModels:u,onSelectedModelIdChange:m,onRunSystemSetup:h,onRunModelAutoSetup:x,onRunModelDiscover:g,onRunModelRefresh:b,onRunModelSetDefault:f,onContinueToModels:w,onBackToSystem:y,onDismiss:j,canDismiss:k}){var C,S,A,I,R,M,O,$,_,P,E,D,L,F,z,W,q,B;let V,K,G,J,H,Z=aw(e),Q=av(e),Y=(C=a,S=Z,A=Q,[{id:"system",order:1,label:"System setup",description:"CLI, gateway service, live RPC, runtime state",state:aS(S,"system"===C&&!S)},{id:"models",order:2,label:"Model setup",description:"Default model, provider auth, live smoke test",state:aS(A,"models"===C&&!A)}]),X=(I=e,R=l,V=I.diagnostics.rpcOk&&!I.diagnostics.loaded,K=I.diagnostics.installed||"installing-gateway"===R||"starting-gateway"===R||"verifying"===R||"ready"===R,G=I.diagnostics.loaded||V||"starting-gateway"===R||"verifying"===R||"ready"===R,J=I.diagnostics.rpcOk||"ready"===R,H=I.diagnostics.runtime.stateWritable&&I.diagnostics.runtime.sessionStoreWritable||"ready"===R,[{id:"cli",label:"OpenClaw CLI",description:I.diagnostics.installed?`Installed${I.diagnostics.version?` \xb7 v${I.diagnostics.version}`:""}`:"Install the OpenClaw CLI on this machine.",state:aS(K,!K&&("detecting"===R||"installing-cli"===R))},{id:"gateway",label:"Gateway service",description:I.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:aS(G,!G&&("installing-gateway"===R||K&&"detecting"===R))},{id:"runtime",label:"Live connection",description:I.diagnostics.rpcOk?"Mission Control is connected to a live OpenClaw gateway.":"Start the gateway and wait for RPC health to turn online.",state:aS(J,!J&&("starting-gateway"===R||"verifying"===R||G&&"detecting"===R))},{id:"state",label:"Runtime state",description:I.diagnostics.runtime.stateWritable&&I.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:aS(H,!H&&("verifying"===R||J))}]),ee=e.models.filter(e=>!1!==e.available&&!e.missing),et=u.filter(e=>!ee.some(t=>t.id===e.modelId)),ea="system"===a?d:c,es=ea.statusMessage||ea.resultMessage||(M=a,O=n,"system"===M?O:"Choose or connect a usable model route so the product is actually ready."),er="system"===a?($=l,aw(_=e)?"ready":_.diagnostics.rpcOk?"verifying access":_.diagnostics.loaded&&!_.diagnostics.rpcOk?"verifying"===$?"connecting":"starting gateway":$?$.replace("-"," "):"waiting"):(P=o,av(E=e)?"ready":E.diagnostics.modelReadiness.ready&&"passed"!==E.diagnostics.runtime.smokeTest.status?"smoke test":P?P.replace("-"," "):"waiting"),en="idle"!==ea.runState||!!ea.manualCommand||ea.log.trim().length>0,ei=(D=ea.runState,L=a,F=Q,"running"===D?"Running":F?"Ready":"success"===D?"models"===L?"Updated":"Step complete":"error"===D?"Needs attention":"system"===L?"Step 1":"Step 2"),el="system"===(z={stage:a,systemReady:Z,modelReady:Q,systemActionLabel:r,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)(ey.P.div,{initial:{opacity:0,backdropFilter:"blur(0px)"},animate:{opacity:1,backdropFilter:"blur(12px)"},exit:{opacity:0,backdropFilter:"blur(0px)"},className:N("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)(ey.P.div,{initial:{opacity:0,y:18,scale:.985},animate:{opacity:1,y:0,scale:1},className:N("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:N("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)(U.A,{className:"h-2 w-2"}),"Welcome"]}),(0,s.jsx)("span",{className:N("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.16em]",(W=ea.runState,q=Q,B=t,"error"===W?"light"===B?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200":"success"===W||q?"light"===B?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"running"===W?"light"===B?"border-[#d8c0b0] bg-white/80 text-[#8d725f]":"border-white/10 bg-white/[0.04] text-slate-300":"light"===B?"border-[#d8c0b0] bg-white/80 text-[#8d725f]":"border-white/10 bg-white/[0.04] text-slate-400")),children:ei})]}),(0,s.jsxs)("div",{className:"mt-3",children:[(0,s.jsx)("p",{className:N("text-[7px] uppercase tracking-[0.18em]","light"===t?"text-[#977b69]":"text-slate-500"),children:"OpenClaw Mission Control"}),(0,s.jsx)("h1",{className:N("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:N("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:Y.map(e=>(0,s.jsx)("div",{className:N("rounded-[14px] border px-2.5 py-2",aT(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:N("inline-flex h-5 w-5 items-center justify-center rounded-full border text-[9px] font-medium",aR(e.state,t)),children:"complete"===e.state?(0,s.jsx)(v.A,{className:"h-2.5 w-2.5"}):e.order}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:N("text-[11px]","light"===t?"text-[#3e2f24]":"text-white"),children:e.label}),(0,s.jsx)("p",{className:N("mt-0.5 text-[8px] leading-[0.85rem]","light"===t?"text-[#8f7664]":"text-slate-500"),children:e.description})]})]}),(0,s.jsx)("span",{className:N("rounded-full px-1.5 py-0.5 text-[6px] uppercase tracking-[0.14em]",aM(e.state,t)),children:"complete"===e.state?"Ready":"current"===e.state?"Active":"Pending"})]})},e.id))}),"system"===a?(0,s.jsx)(aj,{steps:X,surfaceTheme:t,statusCopy:es,showDetails:en,phaseLabel:er,run:ea}):(0,s.jsx)(ak,{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:m,onRunModelDiscover:g,onRunModelRefresh:b,onRunModelSetDefault:f})]}),(0,s.jsxs)("div",{className:N("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)(T,{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)(ab.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Back"]}):null,k?(0,s.jsx)("button",{type:"button",onClick:j,className:N("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||Q?null:(0,s.jsx)(T,{type:"button",variant:"secondary",size:"sm",onClick:x,disabled:"running"===c.runState,className:aA(t),children:"running"===c.runState?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Working..."]}):"Auto configure"}),(0,s.jsx)(T,{type:"button",onClick:()=>{"system"===a?Z&&Q?j():Z?w():h():Q?j():"set-default"===el.kind?f():x()},disabled:"running"===ea.runState,className:N("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)(i.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Working..."]}):(0,s.jsxs)(s.Fragment,{children:[el.label,(0,s.jsx)(af.A,{className:"ml-1.5 h-3 w-3"})]})})]})]})]})})}function aj({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:N("text-[7px] uppercase tracking-[0.18em]","light"===t?"text-[#977b69]":"text-slate-500"),children:"Step 1"}),(0,s.jsx)("h2",{className:N("mt-1 text-[13px] font-medium","light"===t?"text-[#33251c]":"text-white"),children:"System setup"}),(0,s.jsx)("p",{className:N("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:N("flex items-center gap-1.5 rounded-[12px] border px-2 py-1.5",aT(e.state,t)),children:[(0,s.jsx)("span",{className:N("mt-0.5 inline-flex h-5 w-5 items-center justify-center rounded-full border text-[9px] font-medium",aR(e.state,t)),children:"complete"===e.state?(0,s.jsx)(v.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:N("text-[11px]","light"===t?"text-[#3e2f24]":"text-white"),children:e.label}),(0,s.jsx)("span",{className:N("rounded-full px-1.5 py-0.5 text-[6px] uppercase tracking-[0.14em]",aM(e.state,t)),children:"complete"===e.state?"Ready":"current"===e.state?"Active":"Pending"})]}),(0,s.jsx)("p",{className:N("mt-0.5 text-[8px] leading-[0.82rem]","light"===t?"text-[#8f7664]":"text-slate-500"),children:e.description})]})]},e.id))}),(0,s.jsx)(aN,{surfaceTheme:t,statusCopy:a,showDetails:r,phaseLabel:n,run:i})]})}function ak({snapshot:e,surfaceTheme:t,statusCopy:a,showDetails:r,phaseLabel:i,run:l,selectedModelId:o,availableModels:d,discoveredModels:c,onSelectedModelIdChange:p,onRunModelDiscover:u,onRunModelRefresh:m,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:N("text-[7px] uppercase tracking-[0.18em]","light"===t?"text-[#977b69]":"text-slate-500"),children:"Step 2"}),(0,s.jsx)("h2",{className:N("mt-1 text-[13px] font-medium","light"===t?"text-[#33251c]":"text-white"),children:"Model setup"})]}),(0,s.jsxs)(T,{type:"button",variant:"secondary",size:"sm",onClick:m,disabled:"running"===l.runState,className:aA(t),children:[(0,s.jsx)(n.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Refresh"]})]}),(0,s.jsx)("p",{className:N("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)(aC,{surfaceTheme:t,label:"Default model",value:x.resolvedDefaultModel||x.defaultModel||"Not set"}),(0,s.jsx)(aC,{surfaceTheme:t,label:"Available routes",value:`${x.availableModelCount}/${x.totalModelCount}`}),(0,s.jsx)(aC,{surfaceTheme:t,label:"Connected providers",value:String(x.authProviders.filter(e=>e.connected).length)})]}),(0,s.jsxs)("div",{className:N("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:N("text-[7px] uppercase tracking-[0.16em]","light"===t?"text-[#977b69]":"text-slate-500"),children:"Default model"}),(0,s.jsxs)("select",{value:o,onChange:e=>p(e.target.value),className:N("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"}),d.map(e=>(0,s.jsxs)("option",{value:e.id,children:[e.name," \xb7 ",e.provider]},e.id))]})]}),(0,s.jsxs)("div",{className:N("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)(T,{type:"button",variant:"secondary",size:"sm",onClick:u,disabled:"running"===l.runState,className:aA(t),children:c.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:N("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:N("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:[aI(e.provider),e.detail?` \xb7 ${e.detail}`:""]},e.provider))}):null,c.length>0?(0,s.jsxs)("div",{className:"mt-2.5 space-y-1.5",children:[(0,s.jsx)("p",{className:N("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:c.slice(0,3).map(e=>(0,s.jsxs)("div",{className:N("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:N("truncate text-[10px]","light"===t?"text-[#3e2f24]":"text-white"),children:e.name}),(0,s.jsxs)("p",{className:N("mt-0.5 text-[8px] leading-[0.85rem]","light"===t?"text-[#8f7664]":"text-slate-500"),children:[aI(e.provider),e.isFree?" \xb7 free":"",e.supportsTools?" \xb7 tools":""]})]}),(0,s.jsx)(T,{type:"button",variant:"secondary",size:"sm",onClick:()=>h(e.modelId),disabled:"running"===l.runState,className:aA(t),children:"Use"})]},e.modelId))}),(0,s.jsx)("p",{className:N("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)(aN,{surfaceTheme:t,statusCopy:a,showDetails:r,phaseLabel:i,run:l})]})}function aN({surfaceTheme:e,statusCopy:t,showDetails:a,phaseLabel:r,run:n}){let[l,o]=(0,m.useState)(!1),d=!!n.manualCommand?.trim().startsWith("openclaw "),c=async()=>{if(n.manualCommand)try{await navigator.clipboard.writeText(n.manualCommand),eu.o.success("Command copied.",{description:"Open Terminal and paste the command to continue setup."})}catch(e){eu.o.error("Could not copy command.",{description:e instanceof Error?e.message:"Clipboard access is unavailable."})}},p=async()=>{if(n.manualCommand&&d){o(!0);try{let e=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:n.manualCommand})}),t=await e.json().catch(()=>null);if(!e.ok||t?.error)throw Error(t?.error||"Unable to open Terminal.");eu.o.success("Terminal opened.",{description:"Finish the OpenClaw auth flow there, then return and refresh setup."})}catch(e){eu.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:N("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:N("text-[7px] uppercase tracking-[0.16em]","light"===e?"text-[#977b69]":"text-slate-500"),children:"Current status"}),(0,s.jsx)("p",{className:N("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:N("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:N("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:r})]}),(0,s.jsx)("pre",{className:N("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:n.log||"No command output yet.\n\nStart this step and Mission Control will stream each action here."}),n.manualCommand?(0,s.jsxs)("div",{className:N("border-t px-2.5 py-2","light"===e?"border-[#ebddd2]":"border-white/8"),children:[(0,s.jsx)("p",{className:N("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:N("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:N("mt-1 break-all font-mono text-[9px] leading-[0.92rem]","light"===e?"text-[#4f3d31]":"text-slate-200"),children:n.manualCommand}),(0,s.jsxs)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[(0,s.jsxs)(T,{type:"button",variant:"secondary",size:"sm",onClick:c,className:aA(e),children:[(0,s.jsx)(g.A,{className:"mr-1.5 h-3 w-3"}),"Copy command"]}),d?(0,s.jsx)(T,{type:"button",variant:"secondary",size:"sm",onClick:p,disabled:l,className:aA(e),children:l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(x.A,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}):null]}),n.docsUrl?(0,s.jsxs)("a",{href:n.docsUrl,target:"_blank",rel:"noreferrer",className:N("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)(af.A,{className:"h-2.5 w-2.5"})]}):null]}):null]}):null]})}function aC({surfaceTheme:e,label:t,value:a}){return(0,s.jsxs)("div",{className:N("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:N("text-[7px] uppercase tracking-[0.16em]","light"===e?"text-[#977b69]":"text-slate-500"),children:t}),(0,s.jsx)("p",{className:N("mt-1 text-[11px] leading-[0.92rem]","light"===e?"text-[#3e2f24]":"text-white"),children:a})]})}function aS(e,t){return e?"complete":t?"current":"pending"}function aA(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 aI(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 aT(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 aR(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 aM(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 aO=a(2820),a$=a(7262),a_=a(5084);function aP({open:e,target:t,surfaceTheme:a,previewState:r,preview:n,previewError:l,runState:d,statusMessage:c,resultMessage:p,backgroundLogPath:u,log:m,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"===r&&!v&&!y&&h.trim()===w,k="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)(H,{open:e,onOpenChange:e=>{(e||!v)&&f(e)},children:(0,s.jsxs)(X,{className:N("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)(ee,{children:[(0,s.jsxs)(ea,{className:N("flex items-center gap-2","light"===a?"text-[#3f2f24]":"text-white"),children:["full-uninstall"===t?(0,s.jsx)(aO.A,{className:"h-4 w-4"}):(0,s.jsx)(a$.A,{className:"h-4 w-4"}),k]}),(0,s.jsx)(es,{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"===r?(0,s.jsxs)("div",{className:N("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)(i.A,{className:"h-4 w-4 animate-spin"}),"Loading the reset preview..."]}):null,"error"===r?(0,s.jsxs)("div",{className:N("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:l||"Unknown reset preview error."})]}):null,n?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"grid gap-3 md:grid-cols-4",children:[(0,s.jsx)(aE,{label:"Delete folders",value:String(n.summary.deleteFolderCount),surfaceTheme:a}),(0,s.jsx)(aE,{label:"Keep folders",value:String(n.summary.metadataOnlyCount),surfaceTheme:a}),(0,s.jsx)(aE,{label:"Agents",value:String(n.summary.agentCount),surfaceTheme:a}),(0,s.jsx)(aE,{label:"Live agents",value:String(n.summary.liveAgentCount),surfaceTheme:a,danger:n.summary.liveAgentCount>0})]}),n.warnings.length>0?(0,s.jsx)("div",{className:N("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)(o.A,{className:"mt-0.5 h-4 w-4 shrink-0"}),(0,s.jsx)("div",{className:"space-y-1 text-sm",children:n.warnings.map(e=>(0,s.jsx)("p",{children:e},e))})]})}):null,(0,s.jsxs)("div",{className:N("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:N("text-xs uppercase tracking-[0.18em]","light"===a?"text-[#9a7f6c]":"text-slate-500"),children:"Workspace impact"}),(0,s.jsx)("p",{className:N("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)(T,{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:n.workspaces.map(e=>(0,s.jsxs)("div",{className:N("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:N("text-sm font-medium","light"===a?"text-[#3f2f24]":"text-white"),children:e.name}),(0,s.jsx)("p",{className:N("mt-1 break-all font-mono text-[11px]","light"===a?"text-[#7e6555]":"text-slate-400"),children:e.path})]}),(0,s.jsx)("span",{className:N("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:N("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:N("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)(aD,{title:"Mission Control state",items:n.missionControlPaths,surfaceTheme:a}),(0,s.jsx)(aD,{title:"Browser state",items:n.browserStorageKeys,surfaceTheme:a})]}),"full-uninstall"===t?(0,s.jsxs)("div",{className:"mt-3 grid gap-3 md:grid-cols-2",children:[(0,s.jsx)(aD,{title:"OpenClaw state",items:n.openClawPaths,surfaceTheme:a}),(0,s.jsxs)("div",{className:N("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:N("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:n.packageActions.map(e=>(0,s.jsxs)("div",{className:N("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:N("min-w-0 break-all text-sm font-medium","light"===a?"text-[#3f2f24]":"text-white"),children:e.packageName}),(0,s.jsx)("span",{className:N("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:N("mt-1 break-words text-xs","light"===a?"text-[#6d5647]":"text-slate-400"),children:e.reason||"No extra detail."}),(0,s.jsx)("p",{className:N("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:N("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)(tI,{htmlFor:"reset-confirm",className:"text-sm font-medium text-inherit",children:["Type ",w," to continue"]}),(0,s.jsx)(R,{id:"reset-confirm",value:h,onChange:e=>x(e.target.value),placeholder:w,disabled:v,className:N("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||m?(0,s.jsxs)("div",{className:N("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,u?(0,s.jsxs)("p",{className:"mt-2 break-all font-mono text-[11px]",children:["Background cleanup log: ",u]}):null,(0,s.jsx)("pre",{className:N("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:m||"Waiting for command output..."})]}):null,(0,s.jsxs)(et,{children:[(0,s.jsx)(T,{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)(T,{type:"button",onClick:b,disabled:!j,className:C,children:v?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.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)(aO.A,{className:"mr-1.5 h-3.5 w-3.5"}):(0,s.jsx)(a_.A,{className:"mr-1.5 h-3.5 w-3.5"}),k]})})]})]})})}function aE({label:e,value:t,surfaceTheme:a,danger:r=!1}){return(0,s.jsxs)("div",{className:N("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:N("text-[11px] uppercase tracking-[0.16em]","light"===a?"text-[#9a7f6c]":"text-slate-500"),children:e}),(0,s.jsx)("p",{className:N("mt-1 font-display text-lg","light"===a?"text-[#3f2f24]":"text-white"),children:t})]})}function aD({title:e,items:t,surfaceTheme:a}){return(0,s.jsxs)("div",{className:N("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:N("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:N("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 aL=a(25),aU=a(7101),aF=a(8482);function az({snapshot:e,activeWorkspaceId:t,requestedAgentAction:a,connectionState:r,collapsed:l,modelManager:d,onToggleCollapsed:c,onSelectWorkspace:p,onRefresh:u,onRunModelRefresh:x,onRunModelDiscover:g,onRunModelSetDefault:b,onConnectModelProvider:f,onOpenModelSetup:w,onOpenAddModels:v,onEditWorkspace:y}){var j;let[k,C]=(0,m.useState)(!1),A=function(e){switch(e){case"healthy":return"text-emerald-300";case"degraded":return"text-amber-200";default:return"text-rose-200"}}(e.diagnostics.health),I="healthy"===e.diagnostics.health?"bg-emerald-300":"degraded"===e.diagnostics.health?"bg-amber-200":"bg-rose-300",M=e.diagnostics.gatewayUrl.replace(/^wss?:\/\//,"").replace(/\/$/,""),[O,$]=(0,m.useState)(!1),[_,P]=(0,m.useState)(!1),[E,D]=(0,m.useState)(!1),[L,U]=(0,m.useState)(!1),[F,q]=(0,m.useState)(!1),[B,V]=(0,m.useState)(!1),[K,G]=(0,m.useState)(!1),[J,Z]=(0,m.useState)(null),[Q,Y]=(0,m.useState)(null),[er,en]=(0,m.useState)(""),[ei,el]=(0,m.useState)(null),[eo,ed]=(0,m.useState)(""),[ec,ep]=(0,m.useState)("workspaces"),[em,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]),ew=(0,m.useMemo)(()=>d.discoveredModels.filter(t=>!e.models.some(e=>e.id===t.modelId)),[d.discoveredModels,e.models]),ey=em&&(ef.some(e=>e.id===em)||ew.some(e=>e.modelId===em))?em:(j=e).diagnostics.modelReadiness.resolvedDefaultModel||j.diagnostics.modelReadiness.defaultModel||j.models.find(e=>!1!==e.available&&!e.missing)?.id||"",ek=!!J&&(_||"monitoring"===J.policy.preset),eN=()=>{k&&C(!1),l&&c()},eC=[{id:"overview",label:"Overview",icon:aU.A},{id:"workspaces",label:"Workspaces",icon:tn.A,badge:String(e.workspaces.length)},{id:"agents",label:"Agents",icon:W.A,badge:String(eg.length)},{id:"models",label:"Models",icon:z.A,badge:String(e.models.length)}],eA=(0,m.useMemo)(()=>Q?e.agents.filter(e=>e.workspaceId===Q.id):[],[Q,e.agents]),eP=(0,m.useMemo)(()=>eA.filter(e=>"engaged"===e.status||"monitoring"===e.status||"ready"===e.status),[eA]),eE=(0,m.useMemo)(()=>Q?e.runtimes.filter(e=>e.workspaceId===Q.id):[],[Q,e.runtimes]),eD=(0,m.useMemo)(()=>ei?e.runtimes.filter(e=>e.agentId===ei.id):[],[ei,e.runtimes]),eL=ei?e.workspaces.find(e=>e.id===ei.workspaceId)??null:null,eU=!!ei&&("engaged"===ei.status||"monitoring"===ei.status||"ready"===ei.status),eF=e=>{el(e),ed(""),V(!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);eF(t)}},[a,e.agents]);let ez=e=>{Z({...function(e,t={}){let a=e$(t.policy?.preset??"worker",t.policy),s=eS[a.preset],r=tM(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:tM(e.policy.preset,{enabled:e.heartbeat.enabled,every:e.heartbeat.every??void 0})})}),P(!1),$(!0)},eq=async()=>{if(J){D(!0);try{let e=await fetch("/api/agents",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(J)}),t=await e.json();if(!e.ok||t.error)throw Error(t.error||"OpenClaw could not update the agent.");eu.o.success("Agent updated in OpenClaw.",{description:J.id}),$(!1),await u()}catch(e){eu.o.error("Agent update failed.",{description:e instanceof Error?e.message:"Unknown agent error."})}finally{D(!1)}}},eV=async()=>{if(Q){q(!0);try{let e=await fetch("/api/workspaces",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceId:Q.id})}),a=await e.json();if(!e.ok||a.error)throw Error(a.error||"OpenClaw could not delete the workspace.");eu.o.success("Workspace deleted from OpenClaw.",{description:a.workspacePath||Q.path}),U(!1),Y(null),en(""),p(t===Q.id?null:t),await u()}catch(e){eu.o.error("Workspace deletion failed.",{description:e instanceof Error?e.message:"Unknown workspace error."})}finally{q(!1)}}},eK=async()=>{if(ei){G(!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.");eu.o.success("Agent deleted from OpenClaw.",{description:t.agentId||ei.id}),J?.id===ei.id&&($(!1),Z(null)),V(!1),el(null),ed(""),await u()}catch(e){eu.o.error("Agent deletion failed.",{description:e instanceof Error?e.message:"Unknown agent error."})}finally{G(!1)}}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"relative flex h-full items-start overflow-visible",children:[(0,s.jsxs)("div",{className:N("panel-surface panel-glow relative flex h-full shrink-0 self-stretch flex-col items-center overflow-hidden px-3 py-4 transition-[max-height] duration-500 ease-[cubic-bezier(0.22,1,0.36,1)]",l?"w-full rounded-[30px]":"w-[78px] rounded-l-[30px] rounded-r-none border-r-0",k?"max-h-[176px]":"max-h-full"),children:[(0,s.jsx)("button",{type:"button","aria-label":l?"Open mission control":"Collapse mission control",onClick:()=>{l?eN():c()},className:"flex h-12 w-12 shrink-0 aspect-square items-center justify-center overflow-hidden rounded-[18px] border border-cyan-300/20 bg-cyan-400/[0.12] shadow-[0_10px_24px_rgba(34,211,238,0.18)]",children:(0,s.jsx)(aL.default,{src:"/assets/logo.webp",alt:"",width:32,height:32,"aria-hidden":"true",className:"pointer-events-none h-8 w-8 select-none object-contain",priority:!0})}),(0,s.jsx)("div",{className:N("mt-6 flex w-full flex-1 flex-col items-center gap-2 overflow-hidden transition-[max-height,opacity,transform] duration-500 ease-[cubic-bezier(0.22,1,0.36,1)]",k?"max-h-0 -translate-y-3 opacity-0 pointer-events-none":"max-h-[420px] translate-y-0 opacity-100"),children:eC.map(e=>(0,s.jsx)(aW,{icon:e.icon,label:e.label,active:ec===e.id,onClick:()=>{(ep(e.id),l)?eN():ec===e.id&&c()}},e.id))}),(0,s.jsxs)("div",{className:"mt-auto flex w-full flex-col items-center gap-2 pb-1",children:[(0,s.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,s.jsx)(ej,{tone:I,pulse:"healthy"===e.diagnostics.health}),l?(0,s.jsx)("p",{className:"text-[9px] uppercase tracking-[0.18em] text-slate-500",children:e.mode}):null]}),(0,s.jsx)("button",{type:"button","aria-label":k?"Expand rail":"Collapse rail",onClick:()=>{l||c(),C(e=>!e)},className:"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:k?(0,s.jsx)(h.A,{className:"h-4 w-4"}):(0,s.jsx)(ev.A,{className:"h-4 w-4"})})]})]}),(0,s.jsx)("div",{className:N("panel-surface panel-glow h-full min-w-0 flex-1 overflow-hidden rounded-r-[30px] border border-white/[0.08] bg-[#04070e]/88 shadow-[0_28px_90px_rgba(0,0,0,0.42)] backdrop-blur-2xl transition-[opacity,transform] duration-500 ease-[cubic-bezier(0.22,1,0.36,1)]",l?"-translate-x-4 opacity-0 pointer-events-none":"translate-x-0 opacity-100",!l&&"rounded-l-none border-l-0"),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 px-5 pb-4 pt-5",children:[(0,s.jsxs)("div",{className:"flex w-full items-baseline justify-center gap-2 whitespace-nowrap text-center",children:[(0,s.jsx)("span",{className:"font-display text-[15px] font-semibold tracking-[0.2em] text-slate-100",children:"AgentOS"}),(0,s.jsx)("span",{className:"text-[11px] font-medium text-slate-600",children:"|"}),(0,s.jsx)("span",{className:"font-display text-[11px] font-normal tracking-[0.2em] text-slate-500",children:"Mission Control"})]}),(0,s.jsx)("div",{className:"mt-4 h-px w-full bg-white/[0.08]"}),(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 gap-3",children:[(0,s.jsx)(ej,{tone:I,pulse:"healthy"===e.diagnostics.health}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:N("text-[13px] font-medium capitalize",A),children:e.diagnostics.health}),(0,s.jsxs)("p",{className:"truncate text-[10px] uppercase tracking-[0.2em] text-slate-500",children:["live"===r?"online":r,(0,s.jsx)("span",{className:"mx-2 text-slate-600",children:"\xb7"}),M]})]})]}),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:eC.map(e=>(0,s.jsx)(aq,{label:e.label,badge:e.badge,active:ec===e.id,onClick:()=>ep(e.id)},e.id))})]}),(0,s.jsxs)("div",{className:"flex-1 space-y-6 p-4",children:["overview"===ec?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(aB,{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)(aV,{label:"Workspaces",value:String(e.workspaces.length)}),(0,s.jsx)(aV,{label:"Agents",value:String(e.agents.length)}),(0,s.jsx)(aV,{label:"Models",value:String(e.models.length)}),(0,s.jsx)(aV,{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)(S,{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=eG(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"===ec?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(aB,{eyebrow:"Home",title:"Workspaces",detail:"Select, rename, or remove real OpenClaw workspaces.",action:(0,s.jsx)(T,{variant:"ghost",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>p(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:N("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:()=>p(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)(S,{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)(T,{variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>y(e.id),children:"Edit"}),(0,s.jsx)(T,{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:()=>{Y(e),en(""),U(!0)},children:"Delete"})]})]},e.id)})})]}):null,"agents"===ec?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(aB,{eyebrow:"Apps",title:"Agents",detail:"Create and tune live isolated OpenClaw operators.",action:(0,s.jsx)(t$,{snapshot:e,defaultWorkspaceId:t??e.workspaces[0]?.id??null,onRefresh:u,trigger:(0,s.jsx)(T,{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)(S,{variant:eS[a.policy.preset].badgeVariant,children:e_(a.policy.preset)}),(0,s.jsx)(S,{variant:"engaged"===a.status?"default":"muted",children:a.status})]})]}),(0,s.jsx)(aY,{agentName:a.name,onEdit:()=>ez(a),onDelete:()=>eF(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":eB(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"===ec?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(aB,{eyebrow:"Models",title:"Models & providers",detail:"Connect providers, choose a default route, and manage live model readiness."}),(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:"space-y-1.5",children:[(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Default"}),(0,s.jsx)("p",{className:"font-display text-[15px] text-white",children:e.diagnostics.modelReadiness.resolvedDefaultModel||e.diagnostics.modelReadiness.defaultModel||"Not set"}),(0,s.jsx)("p",{className:"text-[12px] leading-5 text-slate-400",children:"Connect providers, choose a default route, and keep live model readiness visible."})]}),(0,s.jsxs)("div",{className:"mt-4 grid gap-3 border-t border-white/[0.06] pt-4 sm:grid-cols-2",children:[(0,s.jsxs)("div",{className:"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:"Providers"}),(0,s.jsxs)("p",{className:"mt-1.5 text-[13px] leading-5 text-white",children:[e.diagnostics.modelReadiness.authProviders.filter(e=>e.connected).length," ","connected"]})]}),(0,s.jsxs)("div",{className:"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:"Routes"}),(0,s.jsxs)("p",{className:"mt-1.5 text-[13px] leading-5 text-white",children:[e.diagnostics.modelReadiness.availableModelCount,"/",e.diagnostics.modelReadiness.totalModelCount," available"]})]})]}),d.systemReady?null:(0,s.jsxs)("div",{className:"mt-4 rounded-[16px] border border-amber-400/15 bg-amber-400/[0.08] px-3 py-2.5",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)(T,{variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:w,children:"Open setup"})})]}),(0,s.jsxs)("label",{className:"mt-4 block space-y-1 border-t border-white/[0.06] pt-4",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:"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-4 grid gap-2",children:[(0,s.jsx)(T,{variant:"secondary",size:"sm",className:"h-8 w-full justify-center rounded-full px-3 text-[11px]",disabled:!d.systemReady||"running"===d.runState,onClick:()=>b(ey||void 0),children:"running"===d.runState?"Working...":"Use selected model"}),(0,s.jsx)(T,{variant:"ghost",size:"sm",className:"h-8 w-full justify-center rounded-full px-3 text-[11px]",disabled:!d.systemReady||"running"===d.runState,onClick:g,children:"Discover routes"})]})]}),(0,s.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[(0,s.jsx)(T,{variant:"secondary",size:"sm",className:"h-8 w-full justify-center rounded-full px-3 text-[11px]",onClick:v,children:"Add models"}),(0,s.jsxs)(T,{variant:"ghost",size:"sm",className:"h-8 w-full justify-center rounded-full px-3 text-[11px]",disabled:"running"===d.runState,onClick:x,children:["running"===d.runState?(0,s.jsx)(i.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(n.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Refresh"]})]}),(0,s.jsx)("div",{className:"space-y-3",children:e.diagnostics.modelReadiness.authProviders.map(e=>(0,s.jsx)(aK,{provider:e,disabled:!d.systemReady||"running"===d.runState,onConnect:()=>f(e.provider)},e.provider))}),ew.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)(S,{variant:"muted",children:ew.length})]}),(0,s.jsx)("div",{className:"mt-3 space-y-2",children:ew.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:[aG(e.provider),e.isFree?" \xb7 free":"",e.supportsTools?" \xb7 tools":""]})]}),(0,s.jsx)(T,{variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",disabled:!d.systemReady||"running"===d.runState,onClick:()=>b(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:eB(e.id)}),(0,s.jsx)("p",{className:"mt-1 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:e.provider})]}),(0,s.jsx)(S,{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:[eW(e.contextWindow)," ctx"]}),(0,s.jsxs)("span",{children:[e.usageCount," agents"]})]})]},e.id))})]}):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)(aF.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)(H,{open:L,onOpenChange:U,children:(0,s.jsxs)(X,{children:[(0,s.jsxs)(ee,{children:[(0,s.jsx)(ea,{children:"Delete OpenClaw workspace"}),(0,s.jsx)(es,{children:"This permanently removes the workspace directory and all OpenClaw agents bound to it."})]}),Q?(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)(o.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)(a0,{label:"Agents",value:String(eA.length)}),(0,s.jsx)(a0,{label:"Runs",value:String(eE.length)}),(0,s.jsx)(a0,{label:"Live agents",value:String(eP.length),danger:eP.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:Q.path})]}),eP.length>0||eE.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:eP.length>0?`${eP.length} active or recently engaged agents are still attached to this workspace.`:`${eE.length} runtime records are still associated with this workspace.`}):null,(0,s.jsx)(aJ,{label:`Type ${Q.slug} to confirm`,htmlFor:"delete-workspace-confirm",children:(0,s.jsx)(R,{id:"delete-workspace-confirm",value:er,onChange:e=>en(e.target.value),placeholder:Q.slug})})]}):null,(0,s.jsxs)(et,{children:[(0,s.jsx)(T,{variant:"secondary",onClick:()=>{U(!1),Y(null),en("")},children:"Cancel"}),(0,s.jsx)(T,{variant:"destructive",onClick:eV,disabled:F||!Q||er.trim()!==Q.slug,children:F?"Deleting…":"Delete workspace"})]})]})}),(0,s.jsx)(H,{open:B,onOpenChange:V,children:(0,s.jsxs)(X,{children:[(0,s.jsxs)(ee,{children:[(0,s.jsx)(ea,{children:"Delete OpenClaw agent"}),(0,s.jsx)(es,{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)(o.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)(a0,{label:"Status",value:ei.status,danger:eU}),(0,s.jsx)(a0,{label:"Runs",value:String(eD.length)}),(0,s.jsx)(a0,{label:"Workspace",value:eL?.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})]}),eU||eD.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:eU?"This agent is still active or recently engaged. Delete it only if you want to stop using it entirely.":`${eD.length} runtime records are still associated with this agent.`}):null,(0,s.jsx)(aJ,{label:`Type ${ei.id} to confirm`,htmlFor:"delete-agent-confirm",children:(0,s.jsx)(R,{id:"delete-agent-confirm",value:eo,onChange:e=>ed(e.target.value),placeholder:ei.id})})]}):null,(0,s.jsxs)(et,{children:[(0,s.jsx)(T,{variant:"secondary",onClick:()=>{V(!1),el(null),ed("")},children:"Cancel"}),(0,s.jsx)(T,{variant:"destructive",onClick:eK,disabled:K||!ei||eo.trim()!==ei.id,children:K?"Deleting…":"Delete agent"})]})]})}),(0,s.jsx)(H,{open:O,onOpenChange:$,children:(0,s.jsxs)(X,{className:"max-h-[90vh] overflow-y-auto sm:max-w-3xl",children:[(0,s.jsxs)(ee,{children:[(0,s.jsx)(ea,{children:"Edit OpenClaw agent"}),(0,s.jsx)(es,{children:"Update the selected agent identity, preset, and operating policy."})]}),J?(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:eI.map(e=>(0,s.jsx)(aH,{label:e.label,description:e.description,active:J.policy.preset===e.value,badgeVariant:eS[e.value].badgeVariant,onClick:()=>Z(t=>{var a,s;let r,n,i;return t?(a=t,s=e.value,r=eS[a.policy.preset],n=eS[s],i=e$(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:tO(a.heartbeat,a.policy.preset,s)}):t})},e.value))})]}),(0,s.jsx)(aZ,{policy:J.policy}),(0,s.jsx)(aJ,{label:"Agent id",htmlFor:"edit-agent-id",children:(0,s.jsx)(R,{id:"edit-agent-id",value:J.id,disabled:!0})}),(0,s.jsx)(aJ,{label:"Display name",htmlFor:"edit-agent-name",children:(0,s.jsx)(R,{id:"edit-agent-name",value:J.name,onChange:e=>Z(t=>t?{...t,name:e.target.value}:t),placeholder:eS[J.policy.preset].defaultName})}),(0,s.jsx)(aJ,{label:"Workspace",htmlFor:"edit-agent-workspace",children:(0,s.jsx)(R,{id:"edit-agent-workspace",value:e.workspaces.find(e=>e.id===J.workspaceId)?.name||J.workspaceId,disabled:!0})}),(0,s.jsx)(aJ,{label:"Model",htmlFor:"edit-agent-model",children:(0,s.jsxs)("select",{id:"edit-agent-model",value:J.modelId,onChange:e=>Z(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)(aJ,{label:"Emoji",htmlFor:"edit-agent-emoji",children:(0,s.jsx)(R,{id:"edit-agent-emoji",value:J.emoji,onChange:e=>Z(t=>t?{...t,emoji:e.target.value}:t),placeholder:eS[J.policy.preset].defaultEmoji})}),(0,s.jsx)(aJ,{label:"Theme",htmlFor:"edit-agent-theme",children:(0,s.jsx)(R,{id:"edit-agent-theme",value:J.theme,onChange:e=>Z(t=>t?{...t,theme:e.target.value}:t),placeholder:eS[J.policy.preset].defaultTheme})})]}),(0,s.jsx)(aJ,{label:"Avatar URL",htmlFor:"edit-agent-avatar",children:(0,s.jsx)(R,{id:"edit-agent-avatar",value:J.avatar,onChange:e=>Z(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)(T,{type:"button",variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>P(e=>!e),children:_?"Hide":"Show"})]}),ek?(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)(T,{type:"button",variant:J.heartbeat.enabled?"default":"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>Z(e=>e?{...e,heartbeat:e.heartbeat.enabled?{...e.heartbeat,enabled:!1}:{...e.heartbeat,enabled:!0,every:e.heartbeat.every||tR(e.policy.preset).every}}:e),children:J.heartbeat.enabled?"On":"Off"})]}),J.heartbeat.enabled?(0,s.jsx)("div",{className:"mt-3",children:(0,s.jsx)(aJ,{label:"Interval",htmlFor:"edit-agent-heartbeat-every",children:(0,s.jsx)("select",{id:"edit-agent-heartbeat-every",value:J.heartbeat.every,onChange:e=>Z(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:tT.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))})})}):null]}):null,_?(0,s.jsxs)("div",{className:"mt-4 grid gap-4 sm:grid-cols-2",children:[(0,s.jsx)(aQ,{label:"Missing tool behavior",htmlFor:"edit-agent-missing-tools",value:J.policy.missingToolBehavior,options:eT,onChange:e=>Z(t=>t?{...t,policy:{...t.policy,missingToolBehavior:e}}:t)}),(0,s.jsx)(aQ,{label:"Install scope",htmlFor:"edit-agent-install-scope",value:J.policy.installScope,options:eR,onChange:e=>Z(t=>t?{...t,policy:{...t.policy,installScope:e}}:t)}),(0,s.jsx)(aQ,{label:"File access",htmlFor:"edit-agent-file-access",value:J.policy.fileAccess,options:eM,onChange:e=>Z(t=>t?{...t,policy:{...t.policy,fileAccess:e}}:t)}),(0,s.jsx)(aQ,{label:"Network access",htmlFor:"edit-agent-network-access",value:J.policy.networkAccess,options:eO,onChange:e=>Z(t=>t?{...t,policy:{...t.policy,networkAccess:e}}:t)})]}):null]})]}):null,(0,s.jsxs)(et,{children:[(0,s.jsx)(T,{variant:"secondary",onClick:()=>$(!1),children:"Cancel"}),(0,s.jsx)(T,{onClick:eq,disabled:E||!J,children:E?"Saving…":"Save changes"})]})]})})]})}function aW({icon:e,label:t,active:a,onClick:r}){return(0,s.jsx)("button",{type:"button",onClick:r,title:t,className:N("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 aq({label:e,badge:t,active:a,onClick:r}){return(0,s.jsxs)("button",{type:"button",onClick:r,className:N("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:N("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 aB({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 aV({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 aK({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:aG(e.provider)}),(0,s.jsx)(S,{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)(T,{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)(S,{variant:"muted",children:"ChatGPT/Codex route"}):null]})]})}function aG(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 aJ({label:e,htmlFor:t,children:a}){return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(tI,{htmlFor:t,className:"text-[11px] uppercase tracking-[0.18em] text-slate-400",children:e}),a]})}function aH({label:e,description:t,active:a,badgeVariant:r,onClick:n}){return(0,s.jsx)("button",{type:"button",onClick:n,className:N("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)(S,{variant:r,children:a?"selected":"preset"})]})})}function aZ({policy:e}){let t=eS[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)(S,{variant:t.badgeVariant,children:t.label})]}),(0,s.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,s.jsx)(S,{variant:"muted",children:eP(e.missingToolBehavior)}),(0,s.jsx)(S,{variant:"muted",children:eE(e.installScope)}),(0,s.jsx)(S,{variant:"muted",children:eD(e.fileAccess)}),(0,s.jsxs)(S,{variant:"muted",children:["Network ",eL(e.networkAccess)]})]})]})}function aQ({label:e,htmlFor:t,value:a,options:r,onChange:n}){return(0,s.jsx)(aJ,{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 aY({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)(ew.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)(aX,{label:"Edit",onClick:()=>{n(!1),t()}}),(0,s.jsx)(aX,{label:"Delete",danger:!0,onClick:()=>{n(!1),a()}})]}):null]})}function aX({label:e,onClick:t,danger:a=!1}){return(0,s.jsx)("button",{type:"button",className:N("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 a0({label:e,value:t,danger:a=!1}){return(0,s.jsxs)("div",{className:N("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:N("mt-1.5 font-display text-lg",a?"text-amber-100":"text-white"),children:t})]})}var a1=a(93);function a2({progress:e,className:t}){return(0,s.jsxs)("div",{className:N("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]",r="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",n="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:N("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:N("mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full border text-[10px] font-medium",r),children:"done"===e.status?(0,s.jsx)(v.A,{className:"h-3.5 w-3.5"}):"active"===e.status?(0,s.jsx)(i.A,{className:"h-3.5 w-3.5 animate-spin"}):"error"===e.status?(0,s.jsx)(o.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:N("h-full rounded-full transition-[width] duration-500 ease-out",n),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:N("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 a5=a(9582);let a3={software:"Software project",frontend:"Frontend app",backend:"Backend/API",research:"Research",content:"Content/Growth"},a4=["Use repository-local scripts or documented commands for repeatable workflows.","Update this file when the project exposes a cleaner build, test, or release path."];function a8(e){let t=a7(e.template,e.rules),a=new Map(a9(e.docOverrides).map(e=>[e.path,e.content]));return t.map(t=>{let s=t.render(e),r=a.has(t.path);return{path:t.path,title:t.title,description:t.description,category:t.category,baseContent:s,content:r?a.get(t.path)??"":s,overridden:r}})}function a6(e){let t=a8(e).map(e=>({...e,generated:!0})),a=new Set(t.map(e=>e.path));return[...t,...a9(e.docOverrides).filter(e=>!a.has(e.path)).map(e=>{var t;return{path:e.path,title:e.path,description:"Existing workspace file.",category:(t=e.path).startsWith("memory/")?"memory":t.startsWith("docs/")?"docs":t.startsWith("deliverables/")?"deliverables":"core",baseContent:e.content,content:e.content,overridden:!1,generated:!1}})]}function a9(e){let t=new Map;for(let a of e??[]){let e=a.path.trim();e&&t.set(e,a.content)}return Array.from(t.entries()).map(([e,t])=>({path:e,content:t}))}function a7(e,t){let a=[{path:"AGENTS.md",title:"AGENTS.md",description:"Shared operating instructions for all agents.",category:"core",render:se},{path:"SOUL.md",title:"SOUL.md",description:"Purpose, operating style, and active focus.",category:"core",render:({template:e,brief:t})=>{var a,s;return a=e,s=t,`# SOUL
|
|
4
|
-
|
|
5
|
-
## My Purpose
|
|
6
|
-
Help this ${a3[a].toLowerCase()} workspace turn intent into real outcomes with pragmatic execution, verification, and durable memory.
|
|
7
|
-
|
|
8
|
-
## How I Operate
|
|
9
|
-
- Start from the current workspace reality before proposing large moves.
|
|
10
|
-
- Prefer concrete action, visible artifacts, and clear handoffs.
|
|
11
|
-
- Keep docs, memory, and deliverables aligned with the actual state of the work.
|
|
12
|
-
|
|
13
|
-
## My Quirks
|
|
14
|
-
- Pragmatic
|
|
15
|
-
- Direct
|
|
16
|
-
- Product-aware
|
|
17
|
-
- Quality-minded
|
|
18
|
-
|
|
19
|
-
${s?`## Active Focus
|
|
20
|
-
${s}
|
|
21
|
-
`:""}`}},{path:"IDENTITY.md",title:"IDENTITY.md",description:"Workspace identity and vibe.",category:"core",render:({template:e})=>{var t;return t=e,`# IDENTITY
|
|
22
|
-
|
|
23
|
-
## Role
|
|
24
|
-
This workspace hosts a ${a3[t].toLowerCase()} team coordinated through OpenClaw.
|
|
25
|
-
|
|
26
|
-
**Vibe:** pragmatic, concise, quality-minded, workspace-grounded
|
|
27
|
-
`}},{path:"TOOLS.md",title:"TOOLS.md",description:"Repository commands and workflow notes.",category:"core",render:({template:e,toolExamples:t})=>{var a,s;return a=e,s=t??a4,`# TOOLS
|
|
28
|
-
|
|
29
|
-
Repository commands and workflow notes for this ${a3[a].toLowerCase()} workspace.
|
|
30
|
-
|
|
31
|
-
## Examples
|
|
32
|
-
${s.map(e=>`- ${e}`).join("\n")}
|
|
33
|
-
|
|
34
|
-
## Notes
|
|
35
|
-
- Replace these examples with sharper project-specific commands when the repo exposes them.
|
|
36
|
-
- Prefer repeatable commands that other agents can run without interpretation drift.
|
|
37
|
-
`}},{path:"HEARTBEAT.md",title:"HEARTBEAT.md",description:"Refresh ritual and coherence checks.",category:"core",render:({template:e})=>{var t;return t=e,`# HEARTBEAT
|
|
38
|
-
|
|
39
|
-
- Start each substantial task by refreshing the brief, docs, and current files.
|
|
40
|
-
- Keep the ${a3[t].toLowerCase()} workspace coherent across code, docs, and memory.
|
|
41
|
-
- Prefer explicit handoffs between implementation, review, testing, and knowledge capture.
|
|
42
|
-
`}}];return t.generateMemory&&a.push({path:"MEMORY.md",title:"MEMORY.md",description:"Durable project memory.",category:"memory",render:({name:e,template:t,brief:a})=>{var s,r,n;return s=e,r=t,n=a,`# ${s} Memory
|
|
43
|
-
|
|
44
|
-
Durable project facts for this ${a3[r].toLowerCase()} workspace.
|
|
45
|
-
|
|
46
|
-
## Current brief
|
|
47
|
-
${n||"No brief captured yet. Fill this in as soon as the project goal is clarified."}
|
|
48
|
-
|
|
49
|
-
## Stable facts
|
|
50
|
-
- Add durable architecture, product, or workflow facts here.
|
|
51
|
-
- Move longer notes into memory/*.md when they outgrow this file.
|
|
52
|
-
`}},{path:"memory/blueprint.md",title:"memory/blueprint.md",description:"Project blueprint and current outcome.",category:"memory",render:({name:e,template:t,brief:a})=>{var s,r,n;return s=e,r=t,n=a,`# ${s} Blueprint
|
|
53
|
-
|
|
54
|
-
## Workspace type
|
|
55
|
-
${a3[r]}
|
|
56
|
-
|
|
57
|
-
## Outcome
|
|
58
|
-
${n||"Define the target outcome, user impact, and quality bar for this workspace."}
|
|
59
|
-
|
|
60
|
-
## Constraints
|
|
61
|
-
- Add technical, product, legal, or operational constraints here.
|
|
62
|
-
|
|
63
|
-
## Unknowns
|
|
64
|
-
- Capture unresolved questions that block confident execution.
|
|
65
|
-
`}},{path:"memory/decisions.md",title:"memory/decisions.md",description:"Decision log.",category:"memory",render:()=>`# Decisions
|
|
66
|
-
|
|
67
|
-
Use this file for durable decisions that should survive across sessions.
|
|
68
|
-
|
|
69
|
-
## Template
|
|
70
|
-
- Date:
|
|
71
|
-
- Decision:
|
|
72
|
-
- Context:
|
|
73
|
-
- Consequence:
|
|
74
|
-
`}),t.generateStarterDocs&&a.push({path:"docs/brief.md",title:"docs/brief.md",description:"Objective, source mode, and success signals.",category:"docs",render:({name:e,template:t,brief:a,sourceMode:s})=>{var r,n,i,l;return r=e,n=t,i=a,l=s,`# ${r} Brief
|
|
75
|
-
|
|
76
|
-
## Template
|
|
77
|
-
${a3[n]}
|
|
78
|
-
|
|
79
|
-
## Source mode
|
|
80
|
-
${l}
|
|
81
|
-
|
|
82
|
-
## Objective
|
|
83
|
-
${i||"Clarify the main goal, target user, and success definition for this workspace."}
|
|
84
|
-
|
|
85
|
-
## Success signals
|
|
86
|
-
- Define what success looks like in observable terms.
|
|
87
|
-
|
|
88
|
-
## Open questions
|
|
89
|
-
- List the unknowns worth resolving first.
|
|
90
|
-
`}},{path:"docs/architecture.md",title:"docs/architecture.md",description:"Current system shape and dependencies.",category:"docs",render:({template:e})=>{var t;return t=e,`# Architecture
|
|
91
|
-
|
|
92
|
-
## Current shape
|
|
93
|
-
- Describe the main components, systems, or content lanes in this ${a3[t].toLowerCase()} workspace.
|
|
94
|
-
|
|
95
|
-
## Dependencies
|
|
96
|
-
- List critical external services, repos, data sources, or channels.
|
|
97
|
-
|
|
98
|
-
## Risks
|
|
99
|
-
- Capture structural, operational, or delivery risks here.
|
|
100
|
-
`}},{path:"deliverables/README.md",title:"deliverables/README.md",description:"Guidance for handoff artifacts.",category:"deliverables",render:()=>`# Deliverables
|
|
101
|
-
|
|
102
|
-
Use this folder for substantial output artifacts that should be easy to hand off or review.
|
|
103
|
-
|
|
104
|
-
- Create one subfolder per task or run, for example \`deliverables/2026-03-07-15-30-00-launch-brief/\`.
|
|
105
|
-
- Put drafts, reports, docs, and publishable assets for that task inside its run folder.
|
|
106
|
-
- Keep filenames descriptive and tied to the task or audience.
|
|
107
|
-
`}),"frontend"===e&&a.push({path:"docs/ux-notes.md",title:"docs/ux-notes.md",description:"Interaction patterns and UI risks.",category:"docs",render:()=>st("ux")}),"backend"===e&&a.push({path:"docs/service-map.md",title:"docs/service-map.md",description:"Service, queue, and dependency map.",category:"docs",render:()=>st("backend")}),"research"===e&&a.push({path:"docs/research-plan.md",title:"docs/research-plan.md",description:"Question framing and evidence plan.",category:"docs",render:()=>st("research")}),"content"===e&&a.push({path:"docs/content-brief.md",title:"docs/content-brief.md",description:"Audience, channel, and campaign brief.",category:"docs",render:()=>st("content")}),a}function se({name:e,brief:t,template:a,sourceMode:s,rules:r,agents:n=[]}){let i=n.map(e=>`- ${e.role}: ${e.name}${e.skillId?` \xb7 skill ${e.skillId}`:""}${e.policy?` \xb7 ${e_(e.policy.preset)}`:""}`);return`# ${e}
|
|
108
|
-
|
|
109
|
-
Shared project context for all agents working in this workspace.
|
|
110
|
-
|
|
111
|
-
## Workspace
|
|
112
|
-
- Template: ${a3[a]}
|
|
113
|
-
- Source mode: ${s}
|
|
114
|
-
- Workspace-only access: ${r.workspaceOnly?"enabled":"disabled"}
|
|
115
|
-
|
|
116
|
-
## Team
|
|
117
|
-
${i.length>0?i.join("\n"):"- No agents configured yet."}
|
|
118
|
-
|
|
119
|
-
## Customize
|
|
120
|
-
${t||"Clarify the project goal, definition of done, constraints, and success signals before large changes."}
|
|
121
|
-
|
|
122
|
-
## Safety defaults
|
|
123
|
-
- Stay inside the attached workspace unless the task explicitly requires another location.
|
|
124
|
-
- Prefer direct, reviewable changes over speculative rewrites.
|
|
125
|
-
- Preserve user work and avoid destructive actions without clear approval.
|
|
126
|
-
- Update durable docs when stable architecture, workflow, or product decisions change.
|
|
127
|
-
- Worker and browser agents should not install tooling unless their explicit policy allows it.
|
|
128
|
-
- Route environment preparation to setup-oriented agents when the work depends on new tooling.
|
|
129
|
-
|
|
130
|
-
## Daily memory
|
|
131
|
-
- Capture durable facts in MEMORY.md and memory/*.md.
|
|
132
|
-
- Record stable decisions in memory/decisions.md.
|
|
133
|
-
- Keep temporary chatter and scratch notes in memory/.
|
|
134
|
-
|
|
135
|
-
## Output
|
|
136
|
-
- Be concise in chat and write longer output to files when the artifact matters.
|
|
137
|
-
- Put task-specific deliverables, drafts, reports, and docs inside per-run folders under deliverables/.
|
|
138
|
-
- Avoid writing final artifacts to the workspace root unless explicitly requested.
|
|
139
|
-
`}function st(e){return"ux"===e?`# UX Notes
|
|
140
|
-
|
|
141
|
-
- Track interaction patterns, responsive edge cases, and visual risk areas here.
|
|
142
|
-
`:"backend"===e?`# Service Map
|
|
143
|
-
|
|
144
|
-
- Document services, jobs, queues, external dependencies, and critical flows here.
|
|
145
|
-
`:"research"===e?`# Research Plan
|
|
146
|
-
|
|
147
|
-
- State the question, method, evidence sources, and expected output before large investigation work.
|
|
148
|
-
`:`# Content Brief
|
|
149
|
-
|
|
150
|
-
- Capture audience, channel, tone, CTA, and distribution assumptions for this content workspace.
|
|
151
|
-
`}let sa=[{value:"empty",label:"Empty workspace",description:"Create a fresh project folder and scaffold the shared OpenClaw context."},{value:"clone",label:"Clone repo",description:"Clone a repository first, then layer workspace docs, memory, and agents on top."},{value:"existing",label:"Use existing folder",description:"Attach OpenClaw to a folder that already exists and preserve any current files."}],ss=[{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."}],sr=[{value:"balanced",label:"Balanced",description:"General-purpose default for daily execution, review, and coordination."},{value:"fast",label:"Fast",description:"Favor speed and iteration for high-throughput tasking and first passes."},{value:"quality",label:"Quality",description:"Favor deeper reasoning and more careful outputs for critical work."}],sn={workspaceOnly:!0,generateStarterDocs:!0,generateMemory:!0,kickoffMission:!0},si={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 sl(e,t,a){let s=function(e){let t=e?.trim();if(!t)return"";let a=(!/\s/.test(t)&&t.includes(".")?t.split(".")[0]:t).replace(/[^A-Za-z0-9\u00C0-\u024F]+/g," ").trim();return a?a.split(/\s+/).filter(Boolean).map(e=>e[0].toUpperCase()+e.slice(1)).join(" "):""}(e);if(!s)return a;let r=t.trim();return r?`${s} ${r}`:s}function so(e,t){return a7(e,t).map(e=>e.path)}function sd(e){if("raw"===e)return"workspace";let[t]=e.split(".");return t}function sc({open:e,surfaceTheme:t,plan:a,focus:r,busy:n=!1,onClose:l,onSave:o}){var d;let[c,p]=(0,m.useState)(()=>"raw"===r?"raw":"fields"),[u,h]=(0,m.useState)(()=>{var e;return a?{companyName:(e=a).company.name,companyMission:e.company.mission,companyTargetCustomer:e.company.targetCustomer,companyConstraints:su(e.company.constraints),companySuccessSignals:su(e.company.successSignals),productOffer:e.product.offer,productRevenueModel:e.product.revenueModel,productScopeV1:su(e.product.scopeV1),productNonGoals:su(e.product.nonGoals),productLaunchPriority:su(e.product.launchPriority),workspaceName:e.workspace.name,workspaceDirectory:e.workspace.directory??"",workspaceSourceMode:e.workspace.sourceMode,workspaceRepoUrl:e.workspace.repoUrl??"",workspaceExistingPath:e.workspace.existingPath??"",workspaceTemplate:e.workspace.template,workspaceModelProfile:e.workspace.modelProfile,workspaceModelId:e.workspace.modelId??"",workspaceStackDecisions:su(e.workspace.stackDecisions),workspaceDocs:su(e.workspace.docs),workspaceRuleGenerateStarterDocs:e.workspace.rules.generateStarterDocs,workspaceRuleGenerateMemory:e.workspace.rules.generateMemory,workspaceRuleKickoffMission:e.workspace.rules.kickoffMission,intakeReviewRequested:e.intake.reviewRequested,intakeAutopilot:e.autopilot,teamAllowEphemeralSubagents:e.team.allowEphemeralSubagents,teamMaxParallelRuns:String(e.team.maxParallelRuns),teamEscalationRules:su(e.team.escalationRules),deployBlockers:su(e.deploy.blockers),deployWarnings:su(e.deploy.warnings),deployFirstMissions:su(e.deploy.firstMissions)}:null}),[x,g]=(0,m.useState)(()=>a?JSON.stringify(a,null,2):""),[b,f]=(0,m.useState)(null),w=(0,m.useRef)({}),v=(0,m.useRef)({}),y="light"===t,j=r&&"raw"!==r?sd(r):null,k=r&&"raw"!==r&&(d=r).includes(".")?d:null;(0,m.useEffect)(()=>{if(!e||!a||!r||"raw"===r||"fields"!==c)return;let t=sd(r),s=k?v.current[k]??w.current[t]:w.current[t];s&&globalThis.requestAnimationFrame(()=>{s.scrollIntoView({behavior:"smooth",block:k?"center":"start"}),k&&s===v.current[k]&&"function"==typeof s.focus&&s.focus({preventScroll:!0})})},[r,k,e,a,c]);let C=!!(a&&u);if(!e||!a||!u)return null;let S=(e,t)=>{h(a=>a?{...a,[e]:t}:a)},A=e=>t=>{v.current[e]=t},I=async()=>{var e,t,s,r;let n,i,d,c,p,m,h,x,g=(e=a,t=u,n=structuredClone(e),i=e.company.name.trim(),d=e.workspace.name.trim(),c=t.companyName.trim(),p=t.workspaceName.trim(),m=c!==i,h=p!==d,n.company.name=c,n.company.mission=t.companyMission.trim(),n.company.targetCustomer=t.companyTargetCustomer.trim(),n.company.constraints=sm(t.companyConstraints),n.company.successSignals=sm(t.companySuccessSignals),n.product.offer=t.productOffer.trim(),n.product.revenueModel=t.productRevenueModel.trim(),n.product.scopeV1=sm(t.productScopeV1),n.product.nonGoals=sm(t.productNonGoals),n.product.launchPriority=sm(t.productLaunchPriority),n.workspace.name=p,n.workspace.directory=sh(t.workspaceDirectory),n.workspace.sourceMode=t.workspaceSourceMode,n.workspace.repoUrl=sh(t.workspaceRepoUrl),n.workspace.existingPath=sh(t.workspaceExistingPath),n.workspace.template=t.workspaceTemplate,n.workspace.modelProfile=t.workspaceModelProfile,n.workspace.modelId=sh(t.workspaceModelId),n.workspace.stackDecisions=sm(t.workspaceStackDecisions),n.workspace.docs=sm(t.workspaceDocs),n.workspace.rules={...n.workspace.rules,workspaceOnly:!0,generateStarterDocs:t.workspaceRuleGenerateStarterDocs,generateMemory:t.workspaceRuleGenerateMemory,kickoffMission:t.workspaceRuleKickoffMission},h&&!m?n.company.name=p:m&&!h&&(n.workspace.name=c),n.team.allowEphemeralSubagents=t.teamAllowEphemeralSubagents,n.team.maxParallelRuns=Number.isFinite(Number(t.teamMaxParallelRuns))?Math.max(1,Number(t.teamMaxParallelRuns)):n.team.maxParallelRuns,n.team.escalationRules=sm(t.teamEscalationRules),n.intake.reviewRequested=t.intakeReviewRequested,n.autopilot=t.intakeAutopilot,n.deploy.blockers=sm(t.deployBlockers),n.deploy.warnings=sm(t.deployWarnings),n.deploy.firstMissions=sm(t.deployFirstMissions),n),b=(s=a,r=g,x=[],(sp(s.company,r.company)&&x.push("company"),sp(s.product,r.product)&&x.push("product"),sp(s.workspace,r.workspace)&&x.push("workspace"),sp(s.team,r.team)&&x.push("team"),sp({reviewRequested:s.intake.reviewRequested,autopilot:s.autopilot},{reviewRequested:r.intake.reviewRequested,autopilot:r.autopilot})&&x.push("intake"),sp(s.deploy,r.deploy)&&x.push("deploy"),0===x.length)?"Manual blueprint edit applied.":`Manual blueprint edit applied to ${x.join(", ")}.`);await o(g,b)&&l()},M=async()=>{try{let e=JSON.parse(x);await o(e,"Manual raw blueprint edit applied.")&&l()}catch(e){f(e instanceof Error?e.message:"Raw JSON could not be parsed.")}};return(0,s.jsxs)("div",{className:"absolute inset-0 z-30",children:[(0,s.jsx)("button",{type:"button","aria-label":"Close blueprint editor",onClick:l,className:N("absolute inset-0 h-full w-full cursor-default",y?"bg-[rgba(17,14,10,0.26)]":"bg-[rgba(2,6,13,0.56)]")}),(0,s.jsxs)("div",{className:N("absolute inset-y-0 right-0 flex h-full w-full flex-col border-l shadow-[0_34px_120px_rgba(0,0,0,0.35)] lg:max-w-[760px]",y?"border-[#e6ded4] bg-[linear-gradient(180deg,rgba(255,253,249,0.98),rgba(247,241,233,0.98))] text-[#151311]":"border-white/10 bg-[linear-gradient(180deg,rgba(5,9,18,0.98),rgba(3,7,15,0.98))] text-white"),onClick:e=>e.stopPropagation(),children:[(0,s.jsxs)("div",{className:N("flex items-start justify-between gap-4 border-b px-4 py-4 md:px-5",y?"border-[#e7dfd4]":"border-white/10"),children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:N("text-[11px] uppercase tracking-[0.18em]",y?"text-[#9a9085]":"text-slate-500"),children:"Blueprint editor"}),(0,s.jsx)("h2",{className:N("mt-1 text-[18px] font-semibold tracking-[-0.03em]",y?"text-[#171410]":"text-white"),children:"Edit any detail, then keep chatting with Architect"}),(0,s.jsx)("p",{className:N("mt-1 text-[13px] leading-6",y?"text-[#6f675e]":"text-slate-300"),children:"Structured fields cover the common edits. Raw JSON lets you change anything else in the same plan."})]}),(0,s.jsx)("button",{type:"button",onClick:l,className:N("inline-flex size-9 shrink-0 items-center justify-center rounded-full border transition-colors",y?"border-[#e3dbd0] bg-white text-[#5d564d] hover:bg-[#f5efe6]":"border-white/10 bg-white/[0.05] text-slate-300 hover:bg-white/[0.08]"),children:(0,s.jsx)(J.A,{className:"h-4 w-4"})})]}),(0,s.jsxs)("div",{className:N("flex items-center gap-2 border-b px-4 py-3 md:px-5",y?"border-[#e7dfd4]":"border-white/10"),children:[(0,s.jsx)(sx,{surfaceTheme:t,label:`Stage \xb7 ${a.stage}`}),(0,s.jsx)(sx,{surfaceTheme:t,label:`Status \xb7 ${a.status}`}),(0,s.jsx)(sx,{surfaceTheme:t,label:`Readiness \xb7 ${a.readinessScore}%`})]}),(0,s.jsxs)(O,{value:c,onValueChange:e=>p(e),className:"flex min-h-0 flex-1 flex-col px-4 py-4 md:px-5",children:[(0,s.jsxs)($,{className:N("w-fit",y?"bg-[#f2ece4] text-[#645b52]":"bg-white/5"),children:[(0,s.jsx)(_,{value:"fields",children:"Fields"}),(0,s.jsx)(_,{value:"raw",children:"Raw JSON"})]}),(0,s.jsx)(P,{value:"fields",className:"min-h-0 flex-1",children:(0,s.jsx)(eN,{className:"h-full pr-1",children:(0,s.jsxs)("div",{className:"space-y-4 pb-4",children:[(0,s.jsxs)("div",{className:"grid gap-4 xl:grid-cols-2",children:[(0,s.jsxs)(sg,{surfaceTheme:t,sectionId:"company",highlighted:"company"===j,title:"Company",description:"Mission and audience details.",register:e=>{w.current.company=e},children:[(0,s.jsx)(sb,{label:"Name",children:(0,s.jsx)(R,{ref:A("company.name"),value:u.companyName,onChange:e=>S("companyName",e.target.value)})}),(0,s.jsx)(sb,{label:"Mission",children:(0,s.jsx)(tF,{ref:A("company.mission"),value:u.companyMission,onChange:e=>S("companyMission",e.target.value),className:"min-h-[96px]"})}),(0,s.jsx)(sb,{label:"Target customer",children:(0,s.jsx)(R,{ref:A("company.targetCustomer"),value:u.companyTargetCustomer,onChange:e=>S("companyTargetCustomer",e.target.value)})}),(0,s.jsx)(sb,{label:"Constraints",children:(0,s.jsx)(tF,{ref:A("company.constraints"),value:u.companyConstraints,onChange:e=>S("companyConstraints",e.target.value),placeholder:"One constraint per line",className:"min-h-[84px]"})}),(0,s.jsx)(sb,{label:"Success signals",children:(0,s.jsx)(tF,{ref:A("company.successSignals"),value:u.companySuccessSignals,onChange:e=>S("companySuccessSignals",e.target.value),placeholder:"One signal per line",className:"min-h-[84px]"})})]}),(0,s.jsxs)(sg,{surfaceTheme:t,sectionId:"product",highlighted:"product"===j,title:"Product",description:"Offer and V1 shape.",register:e=>{w.current.product=e},children:[(0,s.jsx)(sb,{label:"Offer",children:(0,s.jsx)(tF,{ref:A("product.offer"),value:u.productOffer,onChange:e=>S("productOffer",e.target.value),className:"min-h-[96px]"})}),(0,s.jsx)(sb,{label:"Revenue model",children:(0,s.jsx)(R,{ref:A("product.revenueModel"),value:u.productRevenueModel,onChange:e=>S("productRevenueModel",e.target.value)})}),(0,s.jsx)(sb,{label:"Scope V1",children:(0,s.jsx)(tF,{ref:A("product.scopeV1"),value:u.productScopeV1,onChange:e=>S("productScopeV1",e.target.value),placeholder:"One item per line",className:"min-h-[84px]"})}),(0,s.jsx)(sb,{label:"Non-goals",children:(0,s.jsx)(tF,{ref:A("product.nonGoals"),value:u.productNonGoals,onChange:e=>S("productNonGoals",e.target.value),placeholder:"One item per line",className:"min-h-[84px]"})}),(0,s.jsx)(sb,{label:"Launch priority",children:(0,s.jsx)(tF,{ref:A("product.launchPriority"),value:u.productLaunchPriority,onChange:e=>S("productLaunchPriority",e.target.value),placeholder:"One item per line",className:"min-h-[84px]"})})]})]}),(0,s.jsxs)(sg,{surfaceTheme:t,sectionId:"workspace",highlighted:"workspace"===j,title:"Workspace",description:"Provisioning path and bootstrap rules.",register:e=>{w.current.workspace=e},children:[(0,s.jsxs)("div",{className:"grid gap-4 xl:grid-cols-2",children:[(0,s.jsx)(sb,{label:"Workspace name",children:(0,s.jsx)(R,{ref:A("workspace.name"),value:u.workspaceName,onChange:e=>S("workspaceName",e.target.value)})}),(0,s.jsx)(sb,{label:"Workspace directory",children:(0,s.jsx)(R,{ref:A("workspace.directory"),value:u.workspaceDirectory,onChange:e=>S("workspaceDirectory",e.target.value)})}),(0,s.jsx)(sb,{label:"Repository URL",children:(0,s.jsx)(R,{ref:A("workspace.repoUrl"),value:u.workspaceRepoUrl,onChange:e=>S("workspaceRepoUrl",e.target.value)})}),(0,s.jsx)(sb,{label:"Existing folder path",children:(0,s.jsx)(R,{ref:A("workspace.existingPath"),value:u.workspaceExistingPath,onChange:e=>S("workspaceExistingPath",e.target.value)})}),(0,s.jsx)(sb,{label:"Model id",children:(0,s.jsx)(R,{ref:A("workspace.modelId"),value:u.workspaceModelId,onChange:e=>S("workspaceModelId",e.target.value)})})]}),(0,s.jsx)(sf,{surfaceTheme:t,label:"Source mode",value:u.workspaceSourceMode,options:sa,onChange:e=>S("workspaceSourceMode",e),fieldRef:A("workspace.sourceMode"),highlighted:"workspace.sourceMode"===k}),(0,s.jsx)(sf,{surfaceTheme:t,label:"Template",value:u.workspaceTemplate,options:ss,onChange:e=>S("workspaceTemplate",e),fieldRef:A("workspace.template"),highlighted:"workspace.template"===k}),(0,s.jsx)(sf,{surfaceTheme:t,label:"Model profile",value:u.workspaceModelProfile,options:sr,onChange:e=>S("workspaceModelProfile",e),fieldRef:A("workspace.modelProfile"),highlighted:"workspace.modelProfile"===k}),(0,s.jsxs)("div",{className:"grid gap-4 xl:grid-cols-2",children:[(0,s.jsx)(sb,{label:"Stack decisions",children:(0,s.jsx)(tF,{ref:A("workspace.stackDecisions"),value:u.workspaceStackDecisions,onChange:e=>S("workspaceStackDecisions",e.target.value),placeholder:"One item per line",className:"min-h-[84px]"})}),(0,s.jsx)(sb,{label:"Docs",children:(0,s.jsx)(tF,{ref:A("workspace.docs"),value:u.workspaceDocs,onChange:e=>S("workspaceDocs",e.target.value),placeholder:"One item per line",className:"min-h-[84px]"})})]}),(0,s.jsx)(sw,{surfaceTheme:t,label:"Starter docs",description:"Generate the first brief, architecture, and deliverables scaffold.",checked:u.workspaceRuleGenerateStarterDocs,onToggle:()=>S("workspaceRuleGenerateStarterDocs",!u.workspaceRuleGenerateStarterDocs),fieldRef:A("workspace.ruleGenerateStarterDocs"),highlighted:"workspace.ruleGenerateStarterDocs"===k}),(0,s.jsx)(sw,{surfaceTheme:t,label:"Memory",description:"Generate the persistent memory files for blueprint decisions.",checked:u.workspaceRuleGenerateMemory,onToggle:()=>S("workspaceRuleGenerateMemory",!u.workspaceRuleGenerateMemory),fieldRef:A("workspace.ruleGenerateMemory"),highlighted:"workspace.ruleGenerateMemory"===k}),(0,s.jsx)(sw,{surfaceTheme:t,label:"Kickoff mission",description:"Run the first mission immediately after bootstrap.",checked:u.workspaceRuleKickoffMission,onToggle:()=>S("workspaceRuleKickoffMission",!u.workspaceRuleKickoffMission),fieldRef:A("workspace.ruleKickoffMission"),highlighted:"workspace.ruleKickoffMission"===k})]}),(0,s.jsxs)("div",{className:"grid gap-4 xl:grid-cols-2",children:[(0,s.jsxs)(sg,{surfaceTheme:t,sectionId:"team",highlighted:"team"===j,title:"Team",description:"Planner behavior and coordination rules.",register:e=>{w.current.team=e},children:[(0,s.jsx)(sw,{surfaceTheme:t,label:"Allow ephemeral subagents",description:"Let the planner spin up temporary helpers when useful.",checked:u.teamAllowEphemeralSubagents,onToggle:()=>S("teamAllowEphemeralSubagents",!u.teamAllowEphemeralSubagents),fieldRef:A("team.allowEphemeralSubagents"),highlighted:"team.allowEphemeralSubagents"===k}),(0,s.jsx)(sw,{surfaceTheme:t,label:"Autopilot",description:"Let the planner take a stronger lead when the shape is clear.",checked:u.intakeAutopilot,onToggle:()=>S("intakeAutopilot",!u.intakeAutopilot),fieldRef:A("team.autopilot"),highlighted:"team.autopilot"===k}),(0,s.jsx)(sw,{surfaceTheme:t,label:"Review requested",description:"Keep the planner in a review-heavy shaping mode.",checked:u.intakeReviewRequested,onToggle:()=>S("intakeReviewRequested",!u.intakeReviewRequested),fieldRef:A("team.reviewRequested"),highlighted:"team.reviewRequested"===k}),(0,s.jsx)(sb,{label:"Max parallel runs",children:(0,s.jsx)(R,{ref:A("team.maxParallelRuns"),type:"number",min:1,value:u.teamMaxParallelRuns,onChange:e=>S("teamMaxParallelRuns",e.target.value)})}),(0,s.jsx)(sb,{label:"Escalation rules",children:(0,s.jsx)(tF,{ref:A("team.escalationRules"),value:u.teamEscalationRules,onChange:e=>S("teamEscalationRules",e.target.value),placeholder:"One rule per line",className:"min-h-[84px]"})})]}),(0,s.jsxs)(sg,{surfaceTheme:t,sectionId:"deploy",highlighted:"deploy"===j,title:"Deploy",description:"Review blockers, warnings, and first missions.",register:e=>{w.current.deploy=e},children:[(0,s.jsx)(sb,{label:"Blockers",children:(0,s.jsx)(tF,{ref:A("deploy.blockers"),value:u.deployBlockers,onChange:e=>S("deployBlockers",e.target.value),placeholder:"One blocker per line",className:"min-h-[84px]"})}),(0,s.jsx)(sb,{label:"Warnings",children:(0,s.jsx)(tF,{ref:A("deploy.warnings"),value:u.deployWarnings,onChange:e=>S("deployWarnings",e.target.value),placeholder:"One warning per line",className:"min-h-[84px]"})}),(0,s.jsx)(sb,{label:"First missions",children:(0,s.jsx)(tF,{ref:A("deploy.firstMissions"),value:u.deployFirstMissions,onChange:e=>S("deployFirstMissions",e.target.value),placeholder:"One mission per line",className:"min-h-[84px]"})})]}),(0,s.jsxs)(sg,{surfaceTheme:t,title:"Note",description:"What happens on save?",children:[(0,s.jsx)("p",{className:N("text-[13px] leading-6",y?"text-[#6f675e]":"text-slate-300"),children:"Derived plan fields like readiness score, stage, and recommended missions are recalculated after you save."}),(0,s.jsx)("p",{className:N("mt-3 text-[13px] leading-6",y?"text-[#6f675e]":"text-slate-300"),children:"If you want to edit something that is not shown here, switch to Raw JSON and change the exact nested field."})]})]})]})})}),(0,s.jsx)(P,{value:"raw",className:"min-h-0 flex-1",children:(0,s.jsxs)("div",{className:"flex h-full min-h-0 flex-col gap-3",children:[(0,s.jsx)("div",{className:N("rounded-[18px] border px-4 py-3",y?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:(0,s.jsx)("p",{className:N("text-[13px] leading-6",y?"text-[#6f675e]":"text-slate-300"),children:"This view edits the full blueprint JSON. It is the fastest way to change nested fields, agents, workflows, and any other detail."})}),(0,s.jsx)(tF,{value:x,onChange:e=>{g(e.target.value),f(null)},className:N("min-h-0 flex-1 font-mono text-[12px] leading-5",y?"border-[#dcd4c9] bg-white text-[#1a1714]":"border-white/10 bg-[#03060d] text-slate-100")}),b?(0,s.jsx)("p",{className:"rounded-xl border border-rose-300/30 bg-rose-500/10 px-3 py-2 text-[13px] leading-5 text-rose-200",children:b}):null,(0,s.jsx)("p",{className:N("text-[12px] leading-5",y?"text-[#7b7268]":"text-slate-400"),children:"Current draft JSON snapshot loaded on open. Changes are saved through the same planner draft path as the structured editor."})]})})]}),(0,s.jsxs)("div",{className:N("flex items-center justify-between gap-3 border-t px-4 py-4 md:px-5",y?"border-[#e7dfd4]":"border-white/10"),children:[(0,s.jsx)(T,{type:"button",variant:"secondary",onClick:l,className:y?"rounded-full border-[#ddd6cb] bg-[#f7f2eb] text-[#403934] hover:bg-[#f1ebe3]":"rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]",children:"Cancel"}),(0,s.jsxs)(T,{type:"button",onClick:"raw"===c?M:I,disabled:!C||n,className:y?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",children:[n?(0,s.jsx)(i.A,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(a5.A,{className:"mr-2 h-4 w-4"}),"Apply changes"]})]})]})]})}function sp(e,t){return JSON.stringify(e)!==JSON.stringify(t)}function su(e){return e.join("\n")}function sm(e){return e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean)}function sh(e){let t=e.trim();return t.length>0?t:void 0}function sx({surfaceTheme:e,label:t}){return(0,s.jsx)("span",{className:N("inline-flex items-center rounded-full border px-2.5 py-1 text-[10px] uppercase tracking-[0.16em]","light"===e?"border-[#e4ddd3] bg-[#f7f2eb] text-[#746b61]":"border-white/10 bg-white/[0.05] text-slate-300"),children:t})}function sg({surfaceTheme:e,sectionId:t,highlighted:a=!1,title:r,description:n,register:i,children:l}){let o="light"===e;return(0,s.jsxs)("section",{ref:i,"data-blueprint-section":t,className:N("rounded-[22px] border p-4 transition-all duration-300",o?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]",a&&(o?"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:[(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsx)("p",{className:N("text-[11px] uppercase tracking-[0.18em]",o?"text-[#a0978b]":"text-slate-500"),children:r}),(0,s.jsx)("p",{className:N("mt-1 text-[13px] leading-6",o?"text-[#6f675e]":"text-slate-300"),children:n})]}),(0,s.jsx)("div",{className:"space-y-4",children:l})]})}function sb({label:e,children:t}){return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(tI,{children:e}),t]})}function sf({surfaceTheme:e,label:t,value:a,options:r,onChange:n,fieldRef:i,highlighted:l=!1}){let o="light"===e;return(0,s.jsxs)("div",{ref:i,tabIndex:-1,className:N("space-y-2 rounded-[18px] border p-3 transition-all",o?"border-[#e8e0d6] bg-[#faf6f1]":"border-white/10 bg-white/[0.03]",l&&(o?"ring-2 ring-[#d8b184]/60 shadow-[0_0_0_1px_rgba(216,177,132,0.12)]":"ring-2 ring-cyan-300/30 shadow-[0_0_0_1px_rgba(103,232,249,0.12)]")),children:[(0,s.jsx)(tI,{children:t}),(0,s.jsx)("div",{className:"grid gap-2 md:grid-cols-2",children:r.map(e=>{let t=e.value===a;return(0,s.jsx)("button",{type:"button",onClick:()=>n(e.value),className:N("rounded-[16px] border px-3 py-3 text-left transition-colors",t?o?"border-[#161514] bg-[#161514] text-white":"border-cyan-300 bg-cyan-300/15 text-cyan-50":o?"border-[#e7dfd4] bg-[#faf6f1] text-[#171410] hover:border-[#d6cab9] hover:bg-[#f6efe6]":"border-white/10 bg-white/[0.03] text-slate-100 hover:border-white/15 hover:bg-white/[0.05]"),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:"text-[13px] font-medium",children:e.label}),(0,s.jsx)("p",{className:N("mt-1 text-[12px] leading-5",t?"opacity-80":o?"text-[#70685e]":"text-slate-400"),children:e.description})]}),t?(0,s.jsx)(v.A,{className:"mt-0.5 h-4 w-4 shrink-0"}):null]})},e.value)})})]})}function sw({surfaceTheme:e,label:t,description:a,checked:r,onToggle:n,fieldRef:i,highlighted:l=!1}){let o="light"===e;return(0,s.jsx)("button",{type:"button",onClick:n,ref:i,className:N("w-full rounded-[16px] border px-3 py-3 text-left transition-colors",r?o?"border-[#1f1b17] bg-[#1f1b17] text-white":"border-cyan-300 bg-cyan-300/15 text-cyan-50":o?"border-[#e7dfd4] bg-[#faf6f1] text-[#171410] hover:border-[#d6cab9] hover:bg-[#f6efe6]":"border-white/10 bg-white/[0.03] text-slate-100 hover:border-white/15 hover:bg-white/[0.05]",l&&(o?"ring-2 ring-[#d8b184]/60 shadow-[0_0_0_1px_rgba(216,177,132,0.12)]":"ring-2 ring-cyan-300/30 shadow-[0_0_0_1px_rgba(103,232,249,0.12)]")),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:"text-[13px] font-medium",children:t}),(0,s.jsx)("p",{className:N("mt-1 text-[12px] leading-5",r?"opacity-80":o?"text-[#70685e]":"text-slate-400"),children:a})]}),(0,s.jsx)("span",{className:N("mt-0.5 inline-flex size-5 shrink-0 items-center justify-center rounded-full border",r?o?"border-white/25 bg-white text-[#171410]":"border-white/20 bg-white text-slate-950":o?"border-[#cfc6ba] bg-transparent text-transparent":"border-white/15 bg-transparent text-transparent"),children:(0,s.jsx)(v.A,{className:"h-3 w-3"})})]})})}function sv({open:e,surfaceTheme:t,plan:a,path:r,busy:n=!1,rewriteBusy:l=!1,onClose:o,onSave:d,onRewriteWithArchitect:c}){let p="light"===t,u=(0,m.useMemo)(()=>e&&a?a6({name:a.workspace.name||"Workspace",brief:a.company.mission||a.product.offer||void 0,template:a.workspace.template,sourceMode:a.workspace.sourceMode,rules:a.workspace.rules,agents:a.team.persistentAgents.filter(e=>e.enabled),docOverrides:a.workspace.docOverrides,toolExamples:[]}).find(e=>e.path===r)??null:null,[e,r,a]),[h,x]=(0,m.useState)(()=>u?.content??""),[g,b]=(0,m.useState)(""),[f,w]=(0,m.useState)(null),v=n||l||!!f;if((0,m.useEffect)(()=>{if(!f)return;if(f.revealedCharCount>=f.changedToCharCount){let e=globalThis.setTimeout(()=>{x(f.nextContent),w(null)},120);return()=>{globalThis.clearTimeout(e)}}let e=globalThis.setTimeout(()=>{w(e=>e?{...e,revealedCharCount:Math.min(e.revealedCharCount+1,e.changedToCharCount)}:e)},Math.max(12,Math.min(24,Math.round(1800/Math.max(f.changedToCharCount,1)))));return()=>{globalThis.clearTimeout(e)}},[f]),!e||!a||!u)return null;let y=async()=>{let e=await c({path:u.path,currentContent:h,instruction:g.trim()||void 0});if(!e)return;let t=function(e,t){if(e===t)return null;let a=e.split(/\r?\n/),s=t.split(/\r?\n/),r=0;for(;r<a.length&&r<s.length&&a[r]===s[r];)r+=1;let n=0;for(;n<a.length-r&&n<s.length-r&&a[a.length-1-n]===s[s.length-1-n];)n+=1;let i=s.slice(0,r),l=a.slice(r,a.length-n),o=s.slice(r,s.length-n),d=s.slice(s.length-n),c=o.join("\n"),p=Array.from(c).length;return{prefixLines:i,changedFromLines:l,changedToLines:o,suffixLines:d,changedToText:c,changedToCharCount:p,revealedCharCount:0,nextContent:t}}(h,e);if(!t){x(e),b("");return}w(t),b("")},j=async()=>{let e=structuredClone(a),t=a9([...e.workspace.docOverrides.filter(e=>e.path!==u.path),...h===u.baseContent?[]:[{path:u.path,content:h}]]);e.workspace.docOverrides=t;let s=h===u.baseContent?u.generated?`Reset ${u.path} to the generated default scaffold.`:`Kept ${u.path} at the loaded workspace content.`:u.generated?`Updated ${u.path} scaffold content.`:`Updated ${u.path} existing file content.`;await d(e,s)&&o()};return(0,s.jsxs)("div",{className:"absolute inset-0 z-30",children:[(0,s.jsx)("button",{type:"button","aria-label":"Close document editor",onClick:o,className:N("absolute inset-0 h-full w-full cursor-default",p?"bg-[rgba(17,14,10,0.26)]":"bg-[rgba(2,6,13,0.56)]")}),(0,s.jsxs)("div",{className:N("absolute inset-y-0 right-0 flex h-full w-full flex-col border-l shadow-[0_34px_120px_rgba(0,0,0,0.35)] lg:max-w-[860px]",p?"border-[#e6ded4] bg-[linear-gradient(180deg,rgba(255,253,249,0.98),rgba(247,241,233,0.98))] text-[#151311]":"border-white/10 bg-[linear-gradient(180deg,rgba(5,9,18,0.98),rgba(3,7,15,0.98))] text-white"),onClick:e=>e.stopPropagation(),children:[(0,s.jsxs)("div",{className:N("flex items-center justify-between gap-4 border-b px-4 py-3 md:px-5",p?"border-[#e7dfd4]":"border-white/10"),children:[(0,s.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,s.jsx)("p",{className:N("text-[11px] uppercase tracking-[0.18em]",p?"text-[#9a9085]":"text-slate-500"),children:"Document editor"}),(0,s.jsx)("span",{className:N("text-[11px] uppercase tracking-[0.18em]",p?"text-[#c2b6a5]":"text-slate-600"),children:"/"}),(0,s.jsx)("p",{className:N("truncate font-mono text-[12px]",p?"text-[#4a433b]":"text-slate-300"),children:u.path}),(0,s.jsx)("span",{className:N("inline-flex shrink-0 items-center rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",u.generated?u.overridden?p?"border-emerald-200 bg-emerald-50 text-emerald-900":"border-emerald-300/30 bg-emerald-300/12 text-emerald-100":p?"border-[#e0d7cc] bg-white text-[#7a7168]":"border-white/10 bg-white/[0.05] text-slate-400":p?"border-cyan-200 bg-cyan-50 text-cyan-900":"border-cyan-300/25 bg-cyan-300/12 text-cyan-100"),children:u.generated?u.overridden?"Customized":"Generated":"Existing"})]}),(0,s.jsx)("button",{type:"button",onClick:o,className:N("inline-flex size-9 shrink-0 items-center justify-center rounded-full border transition-colors",p?"border-[#e3dbd0] bg-white text-[#5d564d] hover:bg-[#f5efe6]":"border-white/10 bg-white/[0.05] text-slate-300 hover:bg-white/[0.08]"),children:(0,s.jsx)(J.A,{className:"h-4 w-4"})})]}),(0,s.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-3 px-4 py-3 md:px-5",children:[(0,s.jsx)(eN,{className:"min-h-0 flex-1",children:f?(0,s.jsx)(sy,{surfaceTheme:t,animation:f}):(0,s.jsx)(tF,{value:h,onChange:e=>x(e.target.value),className:N("min-h-[60vh] font-mono text-[12px] leading-5",p?"border-[#dcd4c9] bg-white text-[#1a1714]":"border-white/10 bg-[#03060d] text-slate-100"),disabled:v})}),(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3 border-t pt-2",style:{borderColor:p?"#e7dfd4":"rgba(255,255,255,0.1)"},children:[(0,s.jsx)(T,{type:"button",variant:"secondary",onClick:()=>{x(u.baseContent)},disabled:v,className:p?"rounded-full border-[#ddd6cb] bg-[#f7f2eb] text-[#403934] hover:bg-[#f1ebe3]":"rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]",children:u.generated?"Reset to default":"Reset to loaded content"}),(0,s.jsxs)(T,{type:"button",onClick:j,disabled:v,className:p?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",children:[n?(0,s.jsx)(i.A,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(a5.A,{className:"mr-2 h-4 w-4"}),"Apply changes"]})]}),(0,s.jsx)("div",{className:N("rounded-[18px] border px-4 py-3",p?"border-[#e5ded3] bg-white":"border-white/10 bg-white/[0.04]"),children:(0,s.jsxs)("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr),auto] md:items-end",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("label",{htmlFor:"architect-rewrite-prompt",className:N("text-[11px] uppercase tracking-[0.18em]",p?"text-[#8b8278]":"text-slate-400"),children:"Architect instructions"}),(0,s.jsx)(tF,{id:"architect-rewrite-prompt",value:g,onChange:e=>b(e.target.value),placeholder:"Tell Architect what to rewrite in this document.",className:N("mt-2 min-h-[88px] font-sans text-[13px] leading-6",p?"border-[#dcd4c9] bg-white text-[#1a1714]":"border-white/10 bg-[#03060d] text-slate-100"),disabled:v}),(0,s.jsx)("p",{className:N("mt-2 text-[12px] leading-5",p?"text-[#7b7268]":"text-slate-400"),children:"Leave it blank for a general pass. Architect will rewrite only the changed block and keep the rest intact."})]}),(0,s.jsxs)(T,{type:"button",variant:"secondary",onClick:y,disabled:v,className:p?"rounded-full border-[#d8d0c4] bg-[#f8f3eb] text-[#3f3831] hover:bg-[#f1ebe4]":"rounded-full border-cyan-300/20 bg-cyan-300/10 text-cyan-100 hover:bg-cyan-300/16",children:[l?(0,s.jsx)(i.A,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(U.A,{className:"mr-2 h-4 w-4"}),"Rewrite with Architect"]})]})})]})]})]})}function sy({surfaceTheme:e,animation:t}){var a,r;let n="light"===e,i=N("whitespace-pre-wrap break-words rounded-lg border px-3 py-2",n?"border-[#e4ddd2] bg-white text-[#1a1714]":"border-white/10 bg-[#040810] text-slate-100"),l=(a=t.changedToText,(r=t.revealedCharCount)<=0?"":Array.from(a).slice(0,r).join(""));return(0,s.jsxs)("div",{className:N("rounded-[18px] border px-4 py-3",n?"border-[#e5ded3] bg-white":"border-white/10 bg-white/[0.04]"),children:[(0,s.jsxs)("div",{className:N("flex items-center justify-between gap-2 whitespace-nowrap text-[9px] uppercase tracking-[0.18em] leading-none",n?"text-[#8b8278]":"text-slate-400"),children:[(0,s.jsx)("span",{className:"min-w-0 truncate",children:"Rewriting"}),(0,s.jsxs)("span",{className:N("shrink-0 rounded-full border px-2 py-0.5",n?"border-[#dfd7cc] bg-[#faf6f1] text-[#6e6458]":"border-white/10 bg-white/[0.04] text-slate-300"),children:[t.revealedCharCount,"/",t.changedToCharCount||1]})]}),(0,s.jsxs)("div",{className:"mt-2 space-y-2 font-mono text-[12px] leading-5",children:[t.prefixLines.length?(0,s.jsx)("div",{className:N("space-y-1.5",n?"text-[#27231e]":"text-slate-100"),children:t.prefixLines.map((e,t)=>(0,s.jsx)("div",{className:"whitespace-pre-wrap break-words",children:e||"\xa0"},`prefix-${t}`))}):null,(0,s.jsx)("div",{className:N("rounded-2xl border px-3 py-2.5",n?"border-[#d8cdbc] bg-[#f9f5ef]":"border-cyan-300/20 bg-cyan-300/6"),children:(0,s.jsxs)("div",{className:"grid gap-2 md:grid-cols-2",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:N("mb-1 text-[9px] uppercase tracking-[0.18em]",n?"text-[#968a7c]":"text-slate-400"),children:"Old"}),(0,s.jsx)("div",{className:i,children:t.changedFromLines.length?t.changedFromLines.map((e,t)=>(0,s.jsx)("div",{className:"whitespace-pre-wrap break-words opacity-55 line-through",children:e||"\xa0"},`before-${t}`)):(0,s.jsx)("div",{className:"opacity-45",children:"[empty]"})})]}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:N("mb-1 text-[9px] uppercase tracking-[0.18em]",n?"text-[#968a7c]":"text-slate-400"),children:"New"}),(0,s.jsx)("div",{className:N(i,"min-h-[96px]"),children:t.changedToCharCount>0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"whitespace-pre-wrap break-words",children:l}),t.revealedCharCount<t.changedToCharCount?(0,s.jsx)(ey.P.span,{"aria-hidden":"true",className:N("ml-0.5 inline-block align-[-0.15em] text-[1.1em] leading-none",n?"text-[#161514]":"text-cyan-100"),animate:{opacity:[0,1,0]},transition:{duration:.8,repeat:1/0,ease:"easeInOut"},children:"|"}):null]}):(0,s.jsx)("span",{className:N("opacity-45",n?"text-[#7d7266]":"text-slate-400"),children:"[removed]"})})]})]})}),t.suffixLines.length?(0,s.jsx)("div",{className:N("space-y-1.5",n?"text-[#27231e]":"text-slate-100"),children:t.suffixLines.map((e,t)=>(0,s.jsx)("div",{className:"whitespace-pre-wrap break-words",children:e||"\xa0"},`suffix-${t}`))}):null]})]})}var sj=a(3479),sk=a(4779),sN=a(9350),sC=a(5800),sS=a(6968),sA=a(9266),sI=a(7876),sT=a(7828),sR=a(421),sM=a(3960);let sO=[{id:"company",label:"Company",icon:sT.A},{id:"product",label:"Product",icon:sR.A},{id:"workspace",label:"Workspace",icon:sM.A},{id:"team",label:"Team",icon:W.A},{id:"operations",label:"Operations",icon:aF.A},{id:"deploy",label:"Deploy",icon:sk.A}],s$=[{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 s_(e){return s$.find(t=>t.id===e)?.section??"company"}function sP(e){return s$.find(t=>t.id===e)?.label??"Draft"}function sE(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 sD(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`${sL(e.workspace.template)} \xb7 ${sL(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 sL(e){return e.split(/[-_]/g).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}let sU=Object.fromEntries(ss.map(e=>[e.value,e.label]));function sF({className:e,surfaceTheme:t,workspaceMode:a="create",mode:r,snapshot:n,basicQuickSetup:i,plan:l,resolvedName:o,resolvedTemplate:d,sourceAnalysis:c,workspacePath:p,notice:u,basicRules:h,basicPreset:x,onOpenBlueprintEditor:g,onOpenDocumentEditor:b,onBasicPresetChange:f,onBasicRuleToggle:w,progress:v}){let y="light"===t,j=(0,m.useRef)({}),k=(0,m.useRef)(null),[C,S]=(0,m.useState)(null),A=(e="workspace.name")=>{g?.(e)},I=(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(sO.map(e=>[e.id,t?`${sE(t,e.id).label}:${sE(t,e.id).variant}:${sD(t,e.id)}`:""]))}}})({mode:r,plan:l,notice:u,progress:v,resolvedName:o,resolvedTemplate:d,basicRules:h,basicPreset:x,sourceAnalysis:c,workspacePath:p}),[x,h,r,u,l,v,o,d,c,p]),R=(0,m.useMemo)(()=>l?a6({name:l.workspace.name||"Workspace",brief:l.company.mission||l.product.offer||void 0,template:l.workspace.template,sourceMode:l.workspace.sourceMode,rules:l.workspace.rules,agents:l.team.persistentAgents.filter(e=>e.enabled),docOverrides:l.workspace.docOverrides,toolExamples:[]}):[],[l]);return(0,m.useEffect)(()=>{let e=k.current;if(k.current=I,!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-${s_(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-${s_(t.advanced.stage)}`;if(e.advanced.readinessSignature!==t.advanced.readinessSignature&&t.advanced.readinessSignature)return"readiness";for(let a of sO)if(e.advanced.sectionSignatures[a.id]!==t.advanced.sectionSignatures[a.id])return`section-${a.id}`;return null}(e,I);t&&S(t)},[I]),(0,m.useEffect)(()=>{if(!C)return;let e=j.current[C];e&&globalThis.requestAnimationFrame(()=>{e.scrollIntoView({behavior:"smooth",block:"center"})});let t=globalThis.setTimeout(()=>{S(e=>e===C?null:e)},2200);return()=>{globalThis.clearTimeout(t)}},[C]),(0,s.jsx)("aside",{className:N("min-h-0 border-t lg:border-l lg:border-t-0",y?"border-[#ebe5dd] bg-[#f7f2eb]":"border-white/10 bg-[rgba(5,9,18,0.92)]",e),children:(0,s.jsx)(eN,{className:"h-full",children:(0,s.jsxs)("div",{className:"space-y-4 p-4 md:p-5",children:[(0,s.jsx)(sW,{surfaceTheme:t,title:"basic"===r?"Workspace draft":"Workspace blueprint",subtitle:"basic"===r?"Live draft view. The fast path stays available while Architect fills in the details.":"Structured blueprint synced with the conversation.",action:l&&g?(0,s.jsxs)(T,{type:"button",variant:"secondary",size:"sm",onClick:()=>A("workspace.name"),className:y?"rounded-full border-[#ddd6cb] bg-[#f7f2eb] text-[#403934] hover:bg-[#f1ebe3]":"rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]",children:[(0,s.jsx)(a5.A,{className:"mr-2 h-3.5 w-3.5"}),"Edit details"]}):null}),"create"===a?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(sz,{sectionKey:"setup-speed",activeSection:C,surfaceTheme:t,register:e=>{j.current["setup-speed"]=e},children:(0,s.jsx)(sG,{surfaceTheme:t,mode:r,preset:x,onPresetChange:f,onOpenBlueprintEditor:A})}),i?(0,s.jsx)("div",{className:"space-y-3",children:i}):null]}):null,u?(0,s.jsx)(sz,{sectionKey:"notice",activeSection:C,surfaceTheme:t,register:e=>{j.current.notice=e},children:(0,s.jsxs)("div",{className:N("rounded-[18px] border px-4 py-3","warning"===u.tone?y?"border-amber-200 bg-amber-50 text-amber-900":"border-amber-400/25 bg-amber-400/10 text-amber-100":y?"border-[#e3ddd4] bg-white text-[#3f3933]":"border-white/10 bg-white/[0.04] text-slate-200"),children:[(0,s.jsx)("p",{className:N("text-[11px] uppercase tracking-[0.18em]",y?"text-[#9c9389]":"text-slate-500"),children:u.title}),(0,s.jsx)("p",{className:"mt-1 text-[13px] leading-6",children:u.description})]})}):null,v?(0,s.jsx)(sz,{sectionKey:"progress",activeSection:C,surfaceTheme:t,register:e=>{j.current.progress=e},children:(0,s.jsx)(a2,{progress:v,className:N(y?"border-[#e5ded3] bg-white text-slate-900 [&_p]:text-inherit":"border-white/10 bg-slate-950/50")})}):null,"basic"===r?(0,s.jsxs)("div",{className:"space-y-3",children:[l?(0,s.jsx)(sz,{sectionKey:"architect-readout",activeSection:C,surfaceTheme:t,register:e=>{j.current["architect-readout"]=e},children:(0,s.jsx)("button",{type:"button",onClick:()=>A("company.mission"),className:N("w-full rounded-[22px] border p-4 text-left transition-colors",y?"border-[#e5ddd2] bg-white hover:border-[#d9ccbf] hover:bg-[#fdfbf7]":"border-white/10 bg-white/[0.04] hover:border-white/15 hover:bg-white/[0.06]"),children:(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("span",{className:N("inline-flex size-9 shrink-0 items-center justify-center rounded-full border",y?"border-[#e7e0d6] bg-[#faf6f1] text-[#5e5750]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,s.jsx)(W.A,{className:"h-4 w-4"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:N("text-[11px] uppercase tracking-[0.18em]",y?"text-[#a0978b]":"text-slate-500"),children:"Architect readout"}),(0,s.jsx)("p",{className:N("mt-1 text-[13px] leading-6",y?"text-[#171410]":"text-white"),children:l.architectSummary}),l.intake.confirmations.length>0?(0,s.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,s.jsx)("p",{className:N("text-[11px] uppercase tracking-[0.16em]",y?"text-[#8d8276]":"text-slate-500"),children:"Next decisions"}),l.intake.confirmations.slice(0,2).map(e=>(0,s.jsx)("div",{className:N("rounded-[16px] border px-3 py-2 text-[12px] leading-5",y?"border-[#e8e0d6] bg-[#faf6f1] text-[#5d554d]":"border-white/10 bg-white/[0.05] text-slate-300"),children:e},e))]}):null]})]})})}):null,(0,s.jsx)(sz,{sectionKey:"summary",activeSection:C,surfaceTheme:t,register:e=>{j.current.summary=e},children:(0,s.jsx)(sq,{surfaceTheme:t,resolvedName:o,resolvedTemplate:d,sourceAnalysis:c,workspacePath:p,workspaceRoot:n.diagnostics.workspaceRoot,summaryLabel:l?"Updated from Architect's latest read of the conversation.":"Resolved from your quick setup.",onOpenBlueprintEditor:A})}),(0,s.jsx)(sz,{sectionKey:"defaults",activeSection:C,surfaceTheme:t,register:e=>{j.current.defaults=e},children:(0,s.jsxs)("div",{className:N("rounded-[22px] border p-4",y?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:[(0,s.jsx)("p",{className:N("text-[11px] uppercase tracking-[0.18em]",y?"text-[#a0978b]":"text-slate-500"),children:"Fast-path defaults"}),(0,s.jsx)(sK,{surfaceTheme:t,plan:l,template:d,rules:h,preset:x,onRuleToggle:w,onOpenBlueprintEditor:A,onOpenDocumentEditor:b})]})})]}):l?(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)(sz,{sectionKey:"readiness",activeSection:C,surfaceTheme:t,register:e=>{j.current.readiness=e},children:(0,s.jsx)("button",{type:"button",onClick:()=>A("deploy.blockers"),className:N("w-full rounded-[22px] border p-4 text-left transition-colors",y?"border-[#e5ddd2] bg-white hover:border-[#d9ccbf] hover:bg-[#fdfbf7]":"border-white/10 bg-white/[0.04] hover:border-white/15 hover:bg-white/[0.06]"),children:(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:N("text-[11px] uppercase tracking-[0.18em]",y?"text-[#a0978b]":"text-slate-500"),children:"Readiness"}),(0,s.jsxs)("p",{className:N("mt-1 text-[28px] font-semibold tracking-[-0.03em]",y?"text-[#181612]":"text-white"),children:[l.readinessScore,"%"]}),(0,s.jsx)("p",{className:N("text-[13px] leading-6",y?"text-[#6e665d]":"text-slate-300"),children:l.architectSummary})]}),(0,s.jsx)("span",{className:N("inline-flex size-10 items-center justify-center rounded-full border",y?"border-[#e5ddd2] bg-[#f5f0e8] text-[#6a635b]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,s.jsx)(W.A,{className:"h-4 w-4"})})]})})}),sO.map(e=>{let a=sE(l,e.id),r=e.icon,n=`section-${e.id}`;return(0,s.jsx)(sz,{sectionKey:n,activeSection:C,surfaceTheme:t,register:e=>{j.current[n]=e},children:(0,s.jsx)("button",{type:"button",onClick:()=>A("company"===e.id?"company.mission":"product"===e.id?"product.offer":"workspace"===e.id?"workspace.name":"team"===e.id?"team.maxParallelRuns":"deploy.blockers"),className:N("w-full rounded-[22px] border p-4 text-left transition-colors",y?"border-[#e5ddd2] bg-white hover:border-[#d9ccbf] hover:bg-[#fdfbf7]":"border-white/10 bg-white/[0.04] hover:border-white/15 hover:bg-white/[0.06]"),children:(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("span",{className:N("inline-flex size-9 shrink-0 items-center justify-center rounded-full border",y?"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:N("text-[14px] font-semibold",y?"text-[#171410]":"text-white"),children:e.label}),(0,s.jsx)(sV,{surfaceTheme:t,tone:a.variant,label:a.label})]}),(0,s.jsx)("p",{className:N("mt-1 text-[13px] leading-6",y?"text-[#70685f]":"text-slate-300"),children:sD(l,e.id)})]})]})})},e.id)}),(0,s.jsx)(sz,{sectionKey:"documents",activeSection:C,surfaceTheme:t,register:e=>{j.current.documents=e},children:(0,s.jsxs)("div",{className:N("rounded-[22px] border p-4",y?"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)(sj.A,{className:N("h-4 w-4",y?"text-[#5f5952]":"text-slate-300")}),(0,s.jsx)("p",{className:N("text-[14px] font-semibold",y?"text-[#171410]":"text-white"),children:"Documents"})]}),(0,s.jsx)("div",{className:"mt-3 flex flex-wrap gap-1.5",children:R.map(e=>(0,s.jsx)(sH,{surfaceTheme:t,label:e.path,tone:e.generated?e.overridden?"success":"default":"accent",interactive:!!b,onClick:b?()=>b(e.path):void 0},e.path))}),b?(0,s.jsx)("p",{className:N("mt-2 text-[11px] leading-5",y?"text-[#7a7168]":"text-slate-400"),children:"edit"===a?"These are the current workspace files. Click a chip to edit one.":"These are the scaffold documents that will be written for this workspace."}):null]})}),(0,s.jsx)(sz,{sectionKey:"deploy-review",activeSection:C,surfaceTheme:t,register:e=>{j.current["deploy-review"]=e},children:(0,s.jsxs)("button",{type:"button",onClick:()=>A("deploy.blockers"),className:N("w-full rounded-[22px] border p-4 text-left transition-colors",y?"border-[#e5ddd2] bg-white hover:border-[#d9ccbf] hover:bg-[#fdfbf7]":"border-white/10 bg-white/[0.04] hover:border-white/15 hover:bg-white/[0.06]"),children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(sk.A,{className:N("h-4 w-4",y?"text-[#5f5952]":"text-slate-300")}),(0,s.jsx)("p",{className:N("text-[14px] font-semibold",y?"text-[#171410]":"text-white"),children:"Deploy review"})]}),l.deploy.blockers.length>0?(0,s.jsx)(sZ,{surfaceTheme:t,title:"Blockers",tone:"danger",items:l.deploy.blockers}):null,l.deploy.warnings.length>0?(0,s.jsx)(sZ,{surfaceTheme:t,title:"Warnings",tone:"warning",items:l.deploy.warnings}):null,0===l.deploy.blockers.length&&0===l.deploy.warnings.length?(0,s.jsx)("p",{className:N("mt-3 text-[13px] leading-6",y?"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:N("rounded-[22px] border border-dashed p-5",y?"border-[#ddd5ca] bg-white/80":"border-white/10 bg-white/[0.04]"),children:[(0,s.jsx)("p",{className:N("text-[14px] font-medium",y?"text-[#211d19]":"text-white"),children:"Architect is preparing the blueprint."}),(0,s.jsx)("p",{className:N("mt-1 text-[13px] leading-6",y?"text-[#776f65]":"text-slate-300"),children:"Once the first plan is ready, this pane will start reflecting the structured workspace draft."})]})]})})})}function sz({sectionKey:e,activeSection:t,surfaceTheme:a,register:r,children:n}){return(0,s.jsx)("div",{ref:r,className:N("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 sW({surfaceTheme:e,title:t,subtitle:a,action:r}){let n="light"===e;return(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:N("text-[11px] uppercase tracking-[0.18em]",n?"text-[#8b7262]":"text-slate-500"),children:t}),(0,s.jsx)("p",{className:N("mt-1 text-[13px] leading-6",n?"text-[#705b4d]":"text-slate-300"),children:a})]}),r?(0,s.jsx)("div",{className:"shrink-0",children:r}):null]})}function sq({surfaceTheme:e,resolvedName:t,resolvedTemplate:a,sourceAnalysis:r,workspacePath:n,workspaceRoot:i,summaryLabel:l,onOpenBlueprintEditor:o}){let d="light"===e;return(0,s.jsx)("div",{className:N("rounded-[22px] border p-4",d?"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:N("inline-flex size-9 shrink-0 items-center justify-center rounded-full border",d?"border-[#e7e0d6] bg-[#faf6f1] text-[#5e5750]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,s.jsx)(U.A,{className:"h-4 w-4"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:N("text-[11px] uppercase tracking-[0.18em]",d?"text-[#a0978b]":"text-slate-500"),children:"Fast-path snapshot"}),(0,s.jsx)("p",{className:N("mt-1 text-[12px] leading-5",d?"text-[#776f65]":"text-slate-400"),children:l}),(0,s.jsxs)("div",{className:"mt-4 space-y-2",children:[(0,s.jsx)(sB,{surfaceTheme:e,label:"Name",value:t,icon:U.A,onClick:()=>o?.("workspace.name")}),(0,s.jsx)(sB,{surfaceTheme:e,label:"Template",value:sU[a],icon:sN.A,onClick:()=>o?.("workspace.template")}),(0,s.jsx)(sB,{surfaceTheme:e,label:"Source",value:r.label,icon:"clone"===r.kind?sC.A:"website"===r.kind?sS.A:sA.A,onClick:()=>o?.("workspace.sourceMode")}),(0,s.jsx)(sB,{surfaceTheme:e,label:"Path",value:n,icon:sA.A,mono:!0,title:`Root: ${i}`,onClick:()=>o?.("workspace.directory")})]})]})]})})}function sB({surfaceTheme:e,label:t,value:a,icon:r,detail:n,mono:i=!1,title:l,onClick:o}){let d="light"===e,c=!!o;return(0,s.jsx)("button",{type:"button",onClick:o,className:N("w-full rounded-[14px] border px-3 py-2.5 text-left transition-colors",d?"border-[#e8e0d6] bg-[#faf6f1]":"border-white/10 bg-white/[0.03]",c&&(d?"cursor-pointer hover:border-[#d9b78b] hover:bg-[#f7efe3] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#d9b78b]/60":"cursor-pointer hover:border-cyan-300/30 hover:bg-white/[0.06] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/30")),title:l,children:(0,s.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,s.jsx)("span",{className:N("inline-flex size-6 shrink-0 items-center justify-center rounded-full border",d?"border-[#e0d7cc] bg-white text-[#615a52]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,s.jsx)(r,{className:"h-3 w-3"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:N("text-[10px] uppercase tracking-[0.16em]",d?"text-[#8d8276]":"text-slate-500"),children:t}),(0,s.jsx)("p",{className:N("truncate text-[12px] font-medium leading-4",d?"text-[#171410]":"text-white",i&&"font-mono text-[12px]"),title:a,children:a})]}),c?(0,s.jsx)(a5.A,{className:N("h-3.5 w-3.5 shrink-0",d?"text-[#8f8377]":"text-slate-400")}):null,n?(0,s.jsx)("span",{className:N("shrink-0 text-[10px] leading-4",d?"text-[#776f65]":"text-slate-400"),children:n}):null]})})}function sV({surfaceTheme:e,tone:t,label:a}){return(0,s.jsx)("span",{className:N("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 sK({surfaceTheme:e,plan:t,template:a,rules:r,preset:n,onRuleToggle:i,onOpenBlueprintEditor:l,onOpenDocumentEditor:o}){var d,c,p;let u,h="light"===e,x=(d=a,c=r,u="frontend"===(p=d)?["docs/ux-notes.md"]:"backend"===p?["docs/service-map.md"]:"research"===p?["docs/research-plan.md"]:"content"===p?["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:c.generateStarterDocs,locked:!1,files:["docs/brief.md","docs/architecture.md","deliverables/README.md",...u],rule:"generateStarterDocs"},{id:"memory",title:"Memory files",description:"Durable project memory for blueprint decisions and accumulated context.",checked:c.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:c.kickoffMission,locked:!1,files:[],rule:"kickoffMission"}]),g=so(a,r),b=(0,m.useMemo)(()=>new Set(a9(t?.workspace.docOverrides).map(e=>e.path)),[t?.workspace.docOverrides]),f=!!t;return(0,s.jsxs)("div",{className:"mt-3 space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:["custom"===n?(0,s.jsx)(sV,{surfaceTheme:e,tone:"muted",label:"Custom mix"}):(0,s.jsx)("span",{}),l?(0,s.jsxs)(T,{type:"button",variant:"secondary",size:"sm",onClick:()=>l("workspace.ruleGenerateStarterDocs"),className:h?"rounded-full border-[#ddd6cb] bg-[#f7f2eb] text-[#403934] hover:bg-[#f1ebe3]":"rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]",children:[(0,s.jsx)(a5.A,{className:"mr-2 h-3.5 w-3.5"}),"Edit section"]}):null]}),(0,s.jsx)("div",{className:"space-y-2",children:x.map(t=>(0,s.jsx)("button",{type:"button",onClick:t.rule?()=>i(t.rule):void 0,disabled:!t.rule,className:N("w-full rounded-[18px] border px-3 py-3 text-left transition-colors",h?"border-[#e8e0d6] bg-[#faf6f1]":"border-white/10 bg-white/[0.03]",t.rule?h?"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:N("mt-0.5 inline-flex size-5 shrink-0 items-center justify-center rounded-md border",t.checked?h?"border-[#1f1b17] bg-[#1f1b17] text-white":"border-cyan-300 bg-cyan-300 text-slate-950":h?"border-[#d9d0c6] bg-white text-transparent":"border-white/15 bg-transparent text-transparent"),children:(0,s.jsx)(v.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:N("text-[13px] font-medium",h?"text-[#171410]":"text-white"),children:t.title}),t.locked?(0,s.jsxs)("span",{className:N("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",h?"border-[#e0d7cc] bg-white text-[#7a7168]":"border-white/10 bg-white/[0.05] text-slate-400"),children:[(0,s.jsx)(sI.A,{className:"h-3 w-3"}),"Required"]}):null]}),(0,s.jsx)("p",{className:N("mt-1 text-[12px] leading-5",h?"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)(sH,{surfaceTheme:e,label:t},t))}):null]})]})},t.id))}),(0,s.jsxs)("div",{className:N("rounded-[18px] border px-3 py-3",h?"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)(sj.A,{className:N("h-4 w-4",h?"text-[#5f5952]":"text-slate-300")}),(0,s.jsx)("p",{className:N("text-[12px] uppercase tracking-[0.16em]",h?"text-[#8d8276]":"text-slate-500"),children:"Will create"})]}),(0,s.jsxs)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[g.map(t=>(0,s.jsx)(sH,{surfaceTheme:e,label:t,tone:b.has(t)?"success":"default",interactive:!!(f&&o),onClick:f&&o?()=>o(t):void 0},t)),r.kickoffMission?(0,s.jsx)(sH,{surfaceTheme:e,label:"Kickoff mission",tone:"accent"}):null]}),f&&o?(0,s.jsx)("p",{className:N("mt-2 text-[11px] leading-5",h?"text-[#7a7168]":"text-slate-400"),children:"Click a document chip to edit its scaffold."}):null]}),(0,s.jsxs)("p",{className:N("text-[13px] leading-6",h?"text-[#70685f]":"text-slate-300"),children:["fastest"===n?"Fastest setup keeps only the core agent files and skips kickoff.":"custom"===n?"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 sG({surfaceTheme:e,mode:t,preset:a,onPresetChange:r,onOpenBlueprintEditor:n}){let i="light"===e;return(0,s.jsxs)("div",{className:N("rounded-xl border p-3",i?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:N("text-[10px] uppercase tracking-[0.18em]",i?"text-[#a0978b]":"text-slate-500"),children:"Setup speed"}),(0,s.jsx)("p",{className:N("mt-1 text-[11px] leading-5",i?"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."})]}),(0,s.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:["custom"===a?(0,s.jsx)(sV,{surfaceTheme:e,tone:"muted",label:"Custom"}):null,n?(0,s.jsxs)(T,{type:"button",variant:"secondary",size:"sm",onClick:()=>n("workspace.ruleGenerateStarterDocs"),className:i?"rounded-full border-[#ddd6cb] bg-[#f7f2eb] text-[#403934] hover:bg-[#f1ebe3]":"rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]",children:[(0,s.jsx)(a5.A,{className:"mr-2 h-3.5 w-3.5"}),"Edit"]}):null]})]}),(0,s.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,s.jsx)(sJ,{surfaceTheme:e,active:"standard"===a,title:"Standard",description:"Docs, memory, and kickoff mission",onClick:()=>r("standard")}),(0,s.jsx)(sJ,{surfaceTheme:e,active:"fastest"===a,title:"Fastest setup",description:"Core files only, no kickoff",onClick:()=>r("fastest")})]})]})}function sJ({surfaceTheme:e,active:t,title:a,description:r,onClick:n}){let i="light"===e;return(0,s.jsx)("button",{type:"button",onClick:n,className:N("w-full rounded-[14px] border px-3 py-2 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 justify-between gap-3",children:[(0,s.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,s.jsx)(sN.A,{className:"h-3.5 w-3.5 shrink-0"}),(0,s.jsx)("p",{className:"truncate text-[12px] font-medium",children:a})]}),(0,s.jsx)("p",{className:N("truncate text-right text-[11px] leading-4",t?"opacity-80":i?"text-[#776f65]":"text-slate-400"),children:r})]})})}function sH({surfaceTheme:e,label:t,tone:a="default",interactive:r=!1,onClick:n}){let i=N("inline-flex items-center rounded-full border px-2.5 py-1 font-mono text-[10px] transition-colors","accent"===a?"light"===e?"border-[#d8b184] bg-[#f8efe3] text-[#7c5a34]":"border-cyan-300/30 bg-cyan-300/10 text-cyan-100":"success"===a?"light"===e?"border-emerald-300 bg-emerald-50 text-emerald-900":"border-emerald-300/30 bg-emerald-300/12 text-emerald-100":"light"===e?"border-[#e4ddd3] bg-white text-[#6c645b]":"border-white/10 bg-white/[0.05] text-slate-300",r?"success"===a?"light"===e?"cursor-pointer hover:border-emerald-400 hover:bg-emerald-100":"cursor-pointer hover:border-emerald-300/45 hover:bg-emerald-300/16":"light"===e?"cursor-pointer hover:border-[#d8c8ba] hover:bg-[#f6efe6]":"cursor-pointer hover:border-white/15 hover:bg-white/[0.08]":"");return r?(0,s.jsxs)("button",{type:"button",onClick:n,"aria-label":`Edit ${t}`,className:i,children:[(0,s.jsx)(a5.A,{className:"mr-1 h-3 w-3"}),t]}):(0,s.jsxs)("span",{className:i,children:[(0,s.jsx)(v.A,{className:"mr-1 h-3 w-3"}),t]})}function sZ({surfaceTheme:e,title:t,tone:a,items:r}){let n="light"===e;return(0,s.jsxs)("div",{className:N("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:N("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:N("flex items-start gap-2 text-[13px] leading-6",n?"text-[#403934]":"text-slate-200"),children:[(0,s.jsx)(o.A,{className:"mt-1 h-3.5 w-3.5 shrink-0"}),(0,s.jsx)("span",{children:e})]},e))})]})}var sQ=a(3875);function sY({surfaceTheme:e,mode:t,onModeChange:a,onNewDraft:r,badges:n,title:i="Create workspace",showModeToggle:l=!0,showNewDraft:o=!0}){let d="light"===e;return(0,s.jsx)("div",{className:N("relative z-[1] border-b px-4 py-2 md:px-5",d?"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-col gap-2 md:flex-nowrap md:flex-row md:items-center md:justify-between md:gap-3",children:[(0,s.jsx)("div",{className:"min-w-0",children:(0,s.jsxs)("div",{className:"flex min-w-0 items-center gap-2.5",children:[(0,s.jsx)("span",{className:N("inline-flex size-8 shrink-0 items-center justify-center rounded-full border shadow-[0_8px_20px_rgba(56,47,38,0.08)]",d?"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)(W.A,{className:"h-3.5 w-3.5"})}),(0,s.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,s.jsx)("p",{className:N("text-[10px] uppercase tracking-[0.22em]",d?"text-[#7f6554]":"text-slate-500"),children:"Architect"}),(0,s.jsx)("span",{className:N("text-[10px] uppercase tracking-[0.18em]",d?"text-[#a59a8e]":"text-slate-600"),children:"/"}),(0,s.jsx)("h2",{className:N("truncate text-[16px] font-semibold tracking-[-0.02em]",d?"text-[#2d2118]":"text-white"),children:i})]})]})}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 md:flex-nowrap md:justify-end",children:[n.length>0?(0,s.jsx)("div",{className:"flex flex-wrap items-center gap-1.5 md:flex-nowrap",children:n.map(e=>(0,s.jsx)("span",{className:N("inline-flex items-center rounded-full border px-2.5 py-0.5 text-[9px] 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)&&(d?"border-[#e4ddd3] bg-white text-[#5f5348]":"border-white/10 bg-white/[0.05] text-slate-300")),children:e.label},e.id))}):null,l?(0,s.jsxs)("div",{className:N("inline-flex rounded-full border p-0.5",d?"border-[#e4ddd3] bg-[#f4efe7]":"border-white/10 bg-white/[0.04]"),children:[(0,s.jsx)(sX,{surfaceTheme:e,active:"basic"===t,label:"Basic",onClick:()=>a("basic")}),(0,s.jsx)(sX,{surfaceTheme:e,active:"advanced"===t,label:"Advanced",onClick:()=>a("advanced")})]}):null,o&&r?(0,s.jsxs)("button",{type:"button",onClick:r,className:N("inline-flex h-8 items-center gap-2 rounded-full border px-2.5 text-[11px] transition-colors",d?"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)(sQ.A,{className:"h-3.5 w-3.5"}),"New draft"]}):null]})]})})}function sX({surfaceTheme:e,active:t,label:a,onClick:r}){let n="light"===e;return(0,s.jsx)("button",{type:"button",onClick:r,className:N("inline-flex min-w-[78px] items-center justify-center rounded-full px-2.5 py-1 text-[11px] 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 s0=a(3942);function s1({surfaceTheme:e,value:t,placeholder:a,onChange:r,onSubmit:n,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 n()},g=async e=>{"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),h&&await n())},b="light"===e;return(0,s.jsxs)("form",{onSubmit:x,className:N("rounded-[20px] border p-2.5 transition-all duration-200 focus-within:shadow-[0_0_0_1px_rgba(0,0,0,0.02)]",b?"border-[#ddd6cb] bg-white shadow-[0_18px_56px_rgba(56,47,38,0.08)] focus-within:border-[#cfc6ba]":"border-white/10 bg-[rgba(7,12,22,0.92)] shadow-[0_18px_56px_rgba(0,0,0,0.34)] focus-within:border-cyan-300/30",p),children:[(0,s.jsx)("textarea",{ref:u,value:t,onChange:e=>r(e.target.value),onKeyDown:g,placeholder:a,className:N("min-h-[44px] max-h-[200px] w-full resize-none overflow-y-auto border-0 bg-transparent px-1.5 py-1.5 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-2",children:[(0,s.jsxs)("div",{className:"flex min-h-8 items-center gap-2",children:[c,d?(0,s.jsx)("p",{className:N("text-[11px]",b?"text-[#8b837a]":"text-slate-400"),children:d}):null]}),(0,s.jsx)("button",{type:"submit",disabled:!h,className:N("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)(i.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(s0.A,{className:"h-3.5 w-3.5"})})]})]})}function s2({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)(eN,{className:N("h-full",l),children:(0,s.jsxs)("div",{className:"mx-auto flex min-h-full w-full max-w-3xl flex-col gap-4 px-2 py-4 md:gap-5 md:px-4",children:[n,i,t.map(t=>(0,s.jsx)(s5,{message:t,surfaceTheme:e},t.id)),a?(0,s.jsx)(s3,{surfaceTheme:e,label:r}):null,(0,s.jsx)("div",{ref:o,className:"h-6 w-full shrink-0"})]})})}function s5({message:e,surfaceTheme:t}){let a="light"===t;if("system"===e.role)return(0,s.jsxs)("div",{className:N("mx-auto w-full max-w-2xl rounded-2xl 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:N("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:N("flex w-full items-start gap-2.5",r?"justify-end":"justify-start"),children:[r?null:(0,s.jsx)("div",{className:N("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)(W.A,{className:"h-3.5 w-3.5"}):(0,s.jsx)(U.A,{className:"h-3.5 w-3.5"})}),(0,s.jsxs)("div",{className:N("max-w-[min(100%,680px)]",r?a?"rounded-2xl border border-[#ddd6cb] bg-[#1a1715] px-3 py-2 text-white":"rounded-2xl border border-cyan-200/40 bg-cyan-300 px-3 py-2 text-slate-950":"space-y-1 px-0 py-0",n&&"opacity-75"),children:[!r&&e.author?(0,s.jsx)("p",{className:N("text-[10px] uppercase tracking-[0.2em]",a?"text-[#8f857a]":"text-slate-500"),children:e.author}):null,(0,s.jsx)("p",{className:N("whitespace-pre-wrap text-[14px] leading-7",r&&"leading-6"),children:e.text})]})]})}function s3({surfaceTheme:e,label:t}){let a="light"===e;return(0,s.jsxs)("div",{className:"flex w-full items-start gap-2.5",children:[(0,s.jsx)("div",{className:N("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)(W.A,{className:"h-3.5 w-3.5"})}),(0,s.jsxs)("div",{className:"max-w-[min(100%,680px)]",children:[(0,s.jsx)("p",{className:N("text-[10px] uppercase tracking-[0.2em]",a?"text-[#8f857a]":"text-slate-500"),children:"Architect"}),(0,s.jsxs)("div",{className:"mt-1 flex items-center gap-2.5",children:[(0,s.jsxs)("div",{className:N("inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5",a?"border-[#e6dfd5] bg-white text-[#5a534c]":"border-white/10 bg-white/[0.05] text-slate-300"),children:[(0,s.jsx)("span",{className:N("inline-flex size-1.5 animate-pulse rounded-full",a?"bg-[#5a534c]":"bg-slate-300")}),(0,s.jsx)("span",{className:N("inline-flex size-1.5 animate-pulse rounded-full [animation-delay:120ms]",a?"bg-[#5a534c]":"bg-slate-300")}),(0,s.jsx)("span",{className:N("inline-flex size-1.5 animate-pulse rounded-full [animation-delay:240ms]",a?"bg-[#5a534c]":"bg-slate-300")})]}),(0,s.jsx)("p",{className:N("text-[12px] leading-5",a?"text-[#6f685f]":"text-slate-400"),children:t})]})]})]})}function s4({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:N("flex flex-wrap items-center gap-1.5",n),children:t.map(e=>(0,s.jsx)("button",{type:"button",onClick:()=>a(e),disabled:r,className:N("inline-flex min-h-8 items-center rounded-full border px-3.5 py-1.5 text-left text-[11px] 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 s8(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 s6={founder:"Founder",product:"Product Lead",architect:"System Architect",ops:"Operations",growth:"Growth",reviewer:"Reviewer"},s9={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 s7(e){return s9[e]??s9.medium}let re={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 rt(){return globalThis.crypto?.randomUUID?.()??`plan-${Date.now()}`}function ra(e,t,a){return{id:rt(),role:e,author:t,text:a,createdAt:new Date().toISOString()}}function rs(e){return{id:e.id?.trim()||rt(),kind:e.kind,label:e.label.trim(),summary:e.summary.trim(),details:rN(e.details),status:e.status??"ready",createdAt:e.createdAt??new Date().toISOString(),confidence:"number"==typeof e.confidence?Math.max(0,Math.min(100,Math.round(e.confidence))):void 0,url:rk(e.url),error:rk(e.error)}}function rr(e){return{id:e.id?.trim()||rt(),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:rj(e.rationale??""),sourceLabels:rN(e.sourceLabels)}}function rn(e){let t=rA(e?.id||e?.name||"operator")||"operator",a=e?.role?.trim()||"Operator",s=e?.name?.trim()||rI(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??e$("worker"),heartbeat:e?.heartbeat??{enabled:!1},responsibilities:rN(e?.responsibilities),outputs:rN(e?.outputs)}}function ri(e){return{id:rA(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:rN(e?.collaboratorAgentIds),successDefinition:e?.successDefinition?.trim()||"",outputs:rN(e?.outputs),channelIds:rN(e?.channelIds),enabled:e?.enabled!==!1}}function rl(e="internal",t){let a=re[e];return{id:rA(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 ro(e){return{id:rA(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 rd(e,t){return(function(e,t,a){let s=si[e];if("solo"===t){let e=s.find(e=>e.isPrimary)??s[0];return[{...e,name:sl(a,e.role,"Builder"===e.role?"Default Agent":e.name),policy:e$("browser"===e.id?"browser":"worker"),enabled:!0}]}return s.map(e=>({id:e.id,role:e.role,name:e.isPrimary?sl(a,e.role,e.name):e.name,emoji:e.emoji,theme:e.theme,skillId:e.skillId,modelId:e.modelId,isPrimary:!!e.isPrimary,policy:e$("browser"===e.id?"browser":"worker"),enabled:!0}))})(e,"core",t).map(t=>{var a,s,r,n,i,l,o;return rn({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??e$("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 rc(e,t){let a=t.find(e=>e.enabled&&e.isPrimary)?.id,s=rv(t,"review"),r=rv(t,"test"),n=rv(t,"learn"),i=rv(t,"browser");if("research"===e)return[ri({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"]}),ri({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[ri({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"]}),ri({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"]}),ri({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[ri({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"]}),ri({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"]}),ri({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 rp(){return[rl("internal",{id:"internal-ops",name:"Internal ops",purpose:"Default internal coordination surface for planner outputs and deploy notes.",announce:!1})]}function ru(e){var t,a,s,r,n,i,l,o,d,c,p,u,m,h,x,g,b,f,w,v,y,j,k,N,C,S,A;let I,T,R,M,O,$,_,P,E,D,L,U,F,z,W,q,B,V,K,G,J=rS(e),H=J.intake.sources.some(e=>"workspace-edit-source"===e.id);if(J.runtime=(t=J.id,a=J.runtime,W=a?.architectSessionId?.trim()||`planner-${t}-architect`,q=Object.fromEntries(Object.entries(a?.advisorAgentIds??{}).filter(([,e])=>"string"==typeof e&&e.trim())),B=Object.fromEntries(Object.entries(s6).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:rk(a?.workspaceId),workspacePath:rk(a?.workspacePath),architectAgentId:rk(a?.architectAgentId),architectSessionId:W,advisorAgentIds:q,advisorSessionIds:B,lastArchitectRunId:rk(a?.lastArchitectRunId),lastAdvisorRunIds:rN(a?.lastAdvisorRunIds),lastError:rk(a?.lastError)}),J.intake=(s={...J.intake,started:!!J.intake?.started||J.conversation.some(e=>"user"===e.role)},{started:!!s?.started,initialPrompt:rj(s?.initialPrompt??""),latestPrompt:rj(s?.latestPrompt??""),sources:(s?.sources??[]).map(e=>rs(e)),confirmations:rN(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=>rr(e)),suggestedReplies:rN(s?.suggestedReplies).slice(0,4)}),J.company.name=rj(J.company.name),J.company.mission=rj(J.company.mission),J.company.targetCustomer=rj(J.company.targetCustomer),J.company.constraints=rN(J.company.constraints),J.company.successSignals=rN(J.company.successSignals),J.product.offer=rj(J.product.offer),J.product.scopeV1=rN(J.product.scopeV1),J.product.nonGoals=rN(J.product.nonGoals),J.product.revenueModel=rj(J.product.revenueModel),J.product.launchPriority=rN(J.product.launchPriority),J.workspace.name=rj(J.workspace.name),J.workspace.directory=rk(J.workspace.directory),J.workspace.repoUrl=rk(J.workspace.repoUrl),J.workspace.existingPath=rk(J.workspace.existingPath),J.workspace.stackDecisions=rN(J.workspace.stackDecisions),J.workspace.docs=rC(rN(J.workspace.docs).concat(so(J.workspace.template,J.workspace.rules))),J.workspace.docOverrides=a9(J.workspace.docOverrides),J.team.persistentAgents=J.team.persistentAgents.map(e=>rn({...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),H){if(!J.team.persistentAgents.some(e=>e.enabled&&e.isPrimary)){let e=J.team.persistentAgents.find(e=>e.enabled);e&&(e.isPrimary=!0)}}else{let e,t;if(0===J.team.persistentAgents.length&&(J.team.persistentAgents=rd(J.workspace.template,J.workspace.name)),!J.team.persistentAgents.some(e=>e.enabled&&e.isPrimary)){let e=J.team.persistentAgents.find(e=>e.enabled);e&&(e.isPrimary=!0)}let a=J.team.persistentAgents.find(e=>e.enabled&&e.isPrimary);a&&J.workspace.name&&(i=a.name,l=a.role,e=i.trim().toLowerCase(),t=l.trim().toLowerCase(),!e||"default agent"===e||e===t||"primary agent"===e||"workspace agent"===e)&&(a.name=sl(J.workspace.name,a.role,a.name))}J.operations.channels=J.operations.channels.map(e=>rl(e.type,e)).filter((e,t,a)=>a.findIndex(t=>t.id===e.id)===t),H||0!==J.operations.channels.length||(J.operations.channels=rp()),J.operations.workflows=J.operations.workflows.map(e=>ri(e)).filter((e,t,a)=>a.findIndex(t=>t.id===e.id)===t),H||0!==J.operations.workflows.length||(J.operations.workflows=rc(J.workspace.template,J.team.persistentAgents)),J.operations.automations=J.operations.automations.map(e=>ro(e)).filter((e,t,a)=>a.findIndex(t=>t.id===e.id)===t),H||(K=s7((V=rS(J)).intake.size),V.team.persistentAgents=function(e,t,a){var s;let r,n;if(a<=0)return[];return ry((n=(s=[...t,...rd(e),...(r=rn({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?[rn({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)=>rn({...e,enabled:!0,isPrimary:e.isPrimary||0===t}))}(V.workspace.template,V.team.persistentAgents,K.agentCount),V.operations.channels=function(e,t,a){let s=t.find(e=>"internal"===e.type)??rp()[0],r=[...t.filter(e=>"internal"!==e.type),...("content"===e?["telegram","discord","slack"]:["slack","discord","telegram"]).map(t=>rl(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[rl("internal",{...s,enabled:!0}),...r.slice(0,a)]}(V.workspace.template,V.operations.channels,K.externalChannelCount),V.operations.workflows=function(e,t,a,s){let r,n,i,l;return s<=0?[]:ry([...t,...rc(e,a),...(r=a.find(e=>e.enabled&&e.isPrimary)?.id,n=rv(a,"review"),i=rv(a,"learn"),l=rv(a,"ops"),[ri({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"]}),ri({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=rv(s,"review"),l=rv(s,"learn"),o=t.ownerAgentId&&r.has(t.ownerAgentId)?t.ownerAgentId:i??l??n,ri({...t,ownerAgentId:o,collaboratorAgentIds:t.collaboratorAgentIds.filter(e=>r.has(e)&&e!==o),enabled:!0})})}(V.workspace.template,V.operations.workflows,V.team.persistentAgents,K.workflowCount),V.operations.automations=function(e,t,a,s,r){let n,i,l;return r<=0?[]:ry([...t,...(n=rv(a,"review")??a.find(e=>e.enabled)?.id,i=rv(a,"learn")??n,[ro({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}),ro({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=rv(r,"review"),c=rv(r,"learn"),ro({...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})})}(V.workspace.template,V.operations.automations,V.team.persistentAgents,V.operations.channels,K.automationCount),J=V),J.operations.hooks=J.operations.hooks.map(e=>({id:rA(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),J.operations.sandbox=(r=J.operations.sandbox,{workspaceOnly:r?.workspaceOnly??!0,mode:r?.mode??"default",notes:rN(r?.notes)}),H||(J.deploy.firstMissions=(G=(n=J).team.persistentAgents.find(e=>e.enabled&&e.isPrimary),rC([G?"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))));let Z=rf(J.company.name),Q=rf(J.workspace.name);if((!J.company.name||Z)&&J.workspace.name&&!Q&&(J.company.name=J.workspace.name),(!J.workspace.name||Q)&&J.company.name&&!Z&&(J.workspace.name=J.company.name),!J.intake.started)return J.deploy.blockers=[],J.deploy.warnings=[],J.intake.confirmations=[],J.intake.inferences=[],J.intake.suggestedReplies=[],J.readinessScore=0,J.architectSummary="Start with one prompt. Paste the project goal, website URL, repo, or existing folder and the architect will draft the workspace for you.",J.stage="intake",J.status="draft",J.updatedAt=new Date().toISOString(),J;let Y=function(e){let t=[],a=s7(e.intake.size);for(let a of e.intake.sources.filter(e=>"error"===e.status))t.push("tr"===rh(e)?`${a.label} kaynağını inceleyemedim. Bu kaynak \xf6nemliyse şirket bağlamını manuel olarak doğrula.`:`I could not inspect ${a.label}. Confirm the company context manually if this source matters.`);return rC(t).slice(0,a.confirmationLimit)}(J),X=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 rC(t)}(J),ee=(I=[],T=s7((o=J).intake.size),0===o.product.nonGoals.length&&I.push("No non-goals are defined for V1."),0===o.product.launchPriority.length&&I.push("Launch priorities are not ordered yet."),0===o.company.successSignals.length&&I.push("Success signals are still empty."),0===o.workspace.stackDecisions.length&&"content"!==o.workspace.template&&I.push("Critical stack decisions are not captured yet."),T.automationCount>0&&!o.operations.automations.some(e=>e.enabled)&&I.push("No automation loops are enabled."),T.externalChannelCount>0&&!o.operations.channels.some(e=>"internal"!==e.type)&&I.push("Only internal channels are configured."),T.agentCount>=3&&o.team.maxParallelRuns<2&&I.push("Parallel run limit is conservative for a multi-agent workspace."),rC(I)),et=(d=J).intake.reviewRequested||"deploying"===d.status||"deployed"===d.status;return J.intake.confirmations=Y,J.intake.inferences=(R=[],M=(c=J).intake.sources.filter(e=>"ready"===e.status).map(e=>e.label),O=c.intake.confirmations.join(" ").toLowerCase(),c.company.name&&R.push(rr({section:"company",label:"Company",value:c.company.name,confidence:rg(c,"company-name"),status:rb(O,"company"),rationale:M.length>0?"Derived from linked context and the current brief.":"Derived from the current brief.",sourceLabels:M})),c.company.mission&&R.push(rr({section:"company",label:"Mission",value:c.company.mission,confidence:rg(c,"mission"),status:rb(O,"outcome"),rationale:"Architect condensed the first business outcome from the request.",sourceLabels:M})),c.company.targetCustomer&&R.push(rr({section:"company",label:"First audience",value:c.company.targetCustomer,confidence:rg(c,"target-customer"),status:rb(O,"audience"),rationale:"This is the current best guess for the first user or buyer segment.",sourceLabels:M})),R.push(rr({section:"workspace",label:"Workspace type",value:rI(c.workspace.template),confidence:rg(c,"template"),status:"inferred",rationale:"Template is inferred from the requested operating model and linked context.",sourceLabels:M})),R.push(rr({section:"workspace",label:"Starting point",value:"clone"===c.workspace.sourceMode?c.workspace.repoUrl||"Clone an existing repository":"existing"===c.workspace.sourceMode?c.workspace.existingPath||"Attach an existing folder":"Start from scratch",confidence:rg(c,"source-mode"),status:rb(O,"start"),rationale:"This is how the workspace will be materialized when you deploy.",sourceLabels:M})),c.product.offer&&R.push(rr({section:"product",label:"Offer",value:c.product.offer,confidence:rg(c,"offer"),status:"inferred",rationale:"Architect turned the brief into a concrete operator-facing offer.",sourceLabels:M})),($=c.operations.channels.filter(e=>e.enabled&&"internal"!==e.type)).length>0&&R.push(rr({section:"operations",label:"External channels",value:$.map(e=>e.name).join(", "),confidence:rg(c,"channels"),status:"inferred",rationale:"The request implies these operating channels should exist after deploy.",sourceLabels:M})),(_=c.team.persistentAgents.find(e=>e.enabled&&e.isPrimary))&&R.push(rr({section:"team",label:"Primary operator",value:`${_.name} (${_.role})`,confidence:rg(c,"team"),status:"inferred",rationale:"Architect drafted a primary agent to own the first delivery loop.",sourceLabels:M})),(P=c.operations.workflows.find(e=>e.enabled))&&R.push(rr({section:"operations",label:"First workflow",value:P.name,confidence:rg(c,"workflow"),status:"inferred",rationale:"This is the first operational loop the company would run after deploy.",sourceLabels:M})),R.slice(0,8)),J.intake.suggestedReplies=(p=J,u=Y,E=rh(p),D=[],L=s7(p.intake.size),U=function(e){let t=e.intake.sources.filter(e=>"ready"===e.status).flatMap(e=>[e.label,e.summary,...e.details]).join(" ").toLowerCase();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}(p),F=rm(p),p.company.targetCustomer||(U&&D.push("tr"===E?`İlk hedef kitle ${rw(U)} gibi g\xf6r\xfcn\xfcyor.`:`The first audience looks like ${rw(U)}.`),"content"===p.workspace.template?(D.push("tr"===E?"İlk kullanıcılar topluluk y\xf6neticileri ve moderat\xf6rler.":"The first users are community managers and moderators."),D.push("tr"===E?"İ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.")):D.push("tr"===E?"İ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.")),p.company.mission||D.push("tr"===E?"İlk hedef, hacmi en y\xfcksek manuel iş akışını otomatikleştirmek.":"The first outcome is automating the highest-volume manual workflow."),!p.product.scopeV1.length&&p.company.mission&&p.company.targetCustomer&&D.push("tr"===E?"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."),p.workspace.repoUrl||p.workspace.existingPath||rx(p.intake.latestPrompt||p.intake.initialPrompt)||(D.push("tr"===E?"Şimdilik varsayılan bir başlangı\xe7la ilerleyelim; kaynak t\xfcr\xfcn\xfc daha sonra istediğin gibi revize edebiliriz.":"We can proceed with a default starting point and revise the source later if you want."),D.push("tr"===E?"Eğer bir repo ya da mevcut klas\xf6r istiyorsan sonraki mesajda sadece onu s\xf6ylemen yeterli.":"If you want a repo or existing folder, just say so in the next edit.")),0===p.company.successSignals.length&&p.intake.turnCount>=2&&D.push("tr"===E?"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!==u.length||F||(D.push("tr"===E?"İstersen bu taslağı şimdi daha keskin hale getirebiliriz.":"If you want, we can tighten this draft right now."),D.push("tr"===E?"Gelişmiş edit\xf6r\xfc a\xe7.":"Open the advanced editor.")),rC(D).slice(0,L.suggestedReplyLimit)),J.deploy.blockers=et?X:[],J.deploy.warnings=et?ee:[],J.readinessScore=(m=J,h=X,x=ee,g=et,z=14,m.company.name&&(z+=10),m.company.mission&&(z+=15),m.company.targetCustomer&&(z+=15),m.product.offer&&(z+=10),m.product.scopeV1.length>0&&(z+=10),m.workspace.name&&(z+=10),m.intake.sources.length>0&&(z+=6),m.team.persistentAgents.some(e=>e.enabled&&e.isPrimary)&&(z+=10),m.operations.workflows.some(e=>e.enabled)&&(z+=10),m.operations.automations.some(e=>e.enabled)&&(z+=5),g?(z-=12*h.length,z-=3*x.length):z-=4*Math.max(0,m.intake.confirmations.length-1),Math.max(0,Math.min(100,z))),J.architectSummary=function(e,t,a,s){let r=rh(e),n=rm(e),i=e.intake.sources.find(e=>"website"===e.kind&&"ready"===e.status&&"number"==typeof e.confidence&&e.confidence<80&&!!e.label),l=e.team.persistentAgents.filter(e=>e.enabled).length,o=e.operations.workflows.filter(e=>e.enabled).length,d=e.operations.automations.filter(e=>e.enabled).length,c=e.intake.confirmations.length;if(!e.intake.started)return"tr"===r?"Tek mesajla başla.":"Start with one prompt.";if(!s&&n){let t=e.company.mission||e.product.offer||e.company.name||e.workspace.name,a="clone"===e.workspace.sourceMode?"tr"===r?"klon repo":"a cloned repo":"existing"===e.workspace.sourceMode?"tr"===r?"mevcut klas\xf6r":"an existing folder":"tr"===r?"sıfırdan":"scratch",s=!i||e.company.name||e.workspace.name?"":"tr"===r?`Site adı i\xe7in ${i.label} varsayımını kullandım.`:`I used ${i.label} as the site name.`;return"tr"===r?[s,t?`İlk taslak ${t} etrafında hazır.`:`İlk taslak ${a} başlangıcıyla hazır.`].filter(Boolean).join(" "):[s,t?`First pass ready around ${t}.`:`First pass ready from ${a}.`].filter(Boolean).join(" ")}return s?"tr"===r?[e.company.mission?`Odak: ${e.company.mission}.`:"Misyon kısa bir c\xfcmle istiyor.",e.company.targetCustomer?`Kitle: ${e.company.targetCustomer}.`:"Kitle a\xe7ık.",`${l} agent, ${o} g\xf6rev, ${d} automation.`,c>0?`${c} revizyon kaldı.`:t.length>0?`${t.length} blocker kaldı.`:a.length>0?`${a.length} warning var.`:"Deploy'a hazır."].join(" "):[e.company.mission?`Focus: ${e.company.mission}.`:"Mission still needs a short sentence.",e.company.targetCustomer?`Audience: ${e.company.targetCustomer}.`:"Audience open.",`${l} agents, ${o} workflows, ${d} automations.`,c>0?`${c} revision${1===c?"":"s"} left.`:t.length>0?`${t.length} blocker${1===t.length?"":"s"} remain.`:a.length>0?`${a.length} warning${1===a.length?"":"s"} remain.`:"Ready to deploy."].join(" "):"tr"===r?[e.company.mission?`Odak: ${e.company.mission}.`:e.company.name||e.workspace.name?`İlk \xe7ıktı: ${e.company.name||e.workspace.name}.`:"İlk \xe7ıktı netleşiyor.",e.company.targetCustomer?`Kitle: ${e.company.targetCustomer}.`:"Kitle a\xe7ık.",e.intake.sources.length>0?`${e.intake.sources.length} kaynak topladım.`:"URL, repo ya da kısa brief yeterli.",`${l} agent, ${o} g\xf6rev, ${d} automation.`,c>0?`${c} revizyon kaldı.`:"Revizyona hazır."].join(" "):[e.company.mission?`Focus: ${e.company.mission}.`:`First outcome: ${e.company.name||e.workspace.name||"this workspace"}.`,e.company.targetCustomer?`Audience: ${e.company.targetCustomer}.`:"Audience open.",e.intake.sources.length>0?`I have ${e.intake.sources.length} source${1===e.intake.sources.length?"":"s"}.`:"Add a URL, repo, or short brief.",`${l} agents, ${o} workflows, ${d} automations.`,c>0?`${c} revision${1===c?"":"s"} left.`:"Ready to revise."].join(" ")}(J,X,ee,et),J.stage=(b=J,f=X,w=ee,v=Y,y=et,b.intake.started?!y&&rm(b)?b.intake.sources.length>0?"context-harvest":"intake":"deploying"===b.status?"deploying":"deployed"===b.status?"deployed":(j=b).company.mission||j.product.offer||j.workspace.name||j.intake.sources.length>0?((k=b).company.name||k.workspace.name)&&k.company.mission&&k.team.persistentAgents.some(e=>e.enabled)&&k.operations.workflows.some(e=>e.enabled)?y?f.length>0?"pressure-test":w.length>0||b.readinessScore<90?"decision-lock":"ready":v.length>0?"team-synthesis":"decision-lock":"team-synthesis":b.intake.turnCount>1?"context-harvest":"intake":"intake"),J.status=(N=J,C=X,S=Y,A=et,N.intake.started?"deploying"===N.status||"deployed"===N.status?N.status:A?"blocked"===N.status&&C.length>0||C.length>0?"blocked":N.readinessScore>=90?"ready":"review":rm(N)||S.length>0?"draft":"review":"draft"),J.updatedAt=new Date().toISOString(),J}function rm(e){return e.intake.turnCount<=1&&!e.intake.reviewRequested}function rh(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 rx(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 rg(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&&rx(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 rb(e,t){return e.includes(t)?"needs-confirmation":"inferred"}function rf(e){let t=e.toLowerCase();return/\b(yapal[ıi]m|ekleyelim|başlatal[ıi]m|kural[ıi]m|olsun|diyelim|verelim|koyal[ıi]m|kurmak|kurulum|oluşturmak|oluşturma|başlatmak|başlama|yapmak|yapma|istiyorum|istiyoruz|istemek|want|build|create|make|start|launch|setup|set up)\b/.test(t)}function rw(e){return e?e.charAt(0).toLowerCase()+e.slice(1):e}function rv(e,t){return e.find(e=>RegExp(t,"i").test(`${e.id} ${e.role} ${e.name}`))?.id}function ry(e){return e.filter((e,t,a)=>a.findIndex(t=>t.id===e.id)===t)}function rj(e){return e.trim()}function rk(e){return e?.trim()||void 0}function rN(e){return rC((e??[]).flatMap(e=>e.split(/\r?\n|,/g).map(e=>e.trim()).filter(Boolean)).map(e=>e.trim()).filter(Boolean))}function rC(e){return Array.from(new Set(e.filter(Boolean)))}function rS(e){return structuredClone(e)}function rA(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function rI(e){return e.split(/[-_]/g).filter(Boolean).map(e=>e[0].toUpperCase()+e.slice(1)).join(" ")}function rT(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 rR(e){return{title:e.title,description:e.description,percent:0,steps:e.steps.map(e=>({...e,status:"pending",percent:0,activities:[]}))}}let rM=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 rO(){return{name:"",goal:"",source:""}}function r$(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(rD(t))return{kind:"existing",createSourceMode:"existing",label:"Existing folder",hint:t,existingPath:t};if(rL(t))return{kind:"clone",createSourceMode:"clone",label:"Clone repository",hint:t,repoUrl:t};let a=rU(t);return a?rF(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 r_(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 rP(e){return e.name.trim()||function(e,t){let a=function(e){let t=e.trim();if(!t)return;if(rL(t))return rz(t.split(":").at(-1)??"");let a=rU(t);return a?rF(a)?rz(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):rD(t)?rz(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&&!rM.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 rE(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 rD(e){return e.startsWith("/")||e.startsWith("./")||e.startsWith("../")}function rL(e){return/^git@[^:]+:[^/].+/.test(e)}function rU(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 rF(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 rz(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 rW="workspace-wizard-basic-source",rq="Imported quick setup assumptions:";function rB(e="standard"){return{...sn,workspaceOnly:!0,generateStarterDocs:"fastest"!==e,generateMemory:"fastest"!==e,kickoffMission:"fastest"!==e}}function rV(e){return{...rB(),...e,workspaceOnly:!0}}function rK(e,t,a){let s=structuredClone(e),r=r$(t.source),n=rP(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=r_(`${i}
|
|
152
|
-
${t.source}`),s.workspace.modelProfile=s.workspace.modelProfile||"balanced",s.workspace.rules=rV(a??s.workspace.rules),s.intake.sources=s.intake.sources.filter(e=>e.id!==rW),"empty"!==r.kind&&s.intake.sources.unshift(rs({id:rW,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})),ru(s)}function rG(e){return rV(e.workspace.rules)}let rJ="mission-control-workspace-plan-id",rH=[{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 rZ({open:e,onOpenChange:t,initialMode:a="basic",workspaceEditId:r=null,surfaceTheme:n,snapshot:l,onRefresh:o,onWorkspaceCreated:d,onWorkspaceUpdated:c}){let p=!!r,u=function({open:e,initialMode:t,workspaceEditId:a,onRefresh:s,onWorkspaceCreated:r,onWorkspaceUpdated:n}){let[i,l]=(0,m.useState)(t),[o,d]=(0,m.useState)(null),[c,p]=(0,m.useState)(null),[u,h]=(0,m.useState)(!1),[x,g]=(0,m.useState)(rO),[b,f]=(0,m.useState)(()=>rB("fastest")),[w,v]=(0,m.useState)(null),[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,R]=(0,m.useState)(!1),[M,O]=(0,m.useState)(!1),[$,_]=(0,m.useState)(!1),[P,E]=(0,m.useState)(!1),[,D]=(0,m.useState)(null),[L,U]=(0,m.useState)(null),[F,z]=(0,m.useState)(null),[W,q]=(0,m.useState)(0),[B,V]=(0,m.useState)(null),K=(0,m.useRef)(null),G=(0,m.useRef)(null),J=(0,m.useRef)(null),H=(0,m.useMemo)(()=>a?`${rJ}:${a}`:rJ,[a]),Z=(0,m.useMemo)(()=>r$(x.source),[x.source]),Q=(0,m.useMemo)(()=>{let e;return(e=rV(b)).generateStarterDocs||e.generateMemory||e.kickoffMission?e.generateStarterDocs&&e.generateMemory&&e.kickoffMission?"standard":"custom":"fastest"},[b]),Y=(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, extracting intent, and narrowing the plan."}:t>=1?{title:"Collecting context",description:"The architect is reading the prompt, extracting intent, and drafting the next clarifying question."}:{title:"Starting planner",description:"The architect is opening the planning session and preparing the first intent pass."}: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:!o?.intake.started,step:k?W:0,active:k||$||P}),[P,$,k,o?.intake.started,W]),X=(0,m.useCallback)(e=>(G.current=e,d(e),h(!!e),e)?(p(e.id),g(rE(e)),f(rG(e)),globalThis.localStorage?.setItem(H,e.id),e):(p(null),null),[H]);(0,m.useEffect)(()=>{if(!k)return void q(0);q(0);let e=globalThis.setTimeout(()=>q(1),1800),t=globalThis.setTimeout(()=>q(2),6200);return()=>{globalThis.clearTimeout(e),globalThis.clearTimeout(t)}},[k]);let ee=(0,m.useCallback)(e=>{if(!o)return null;let t=ru(e(structuredClone(o)));return X(t),t},[X,o]),et=(0,m.useCallback)(()=>globalThis.localStorage?.getItem(H)??null,[H]),ea=(0,m.useCallback)(()=>{globalThis.localStorage?.removeItem(H),h(!1)},[H]),es=(0,m.useCallback)(async({resumeStored:e})=>{if(a){let t=e?globalThis.localStorage?.getItem(H):null;if(t){let e=await fetch(`/api/planner/${t}`,{cache:"no-store"});if(e.ok)return(await e.json()).plan}let s=await fetch(`/api/workspaces/${a}/edit-draft`,{method:"POST"}),r=await s.json();if(!s.ok||!r.plan)throw Error(r.error||"Unable to create workspace edit draft.");return r.seed&&(J.current=r.seed,D(r.seed)),r.plan}let t=e?globalThis.localStorage?.getItem(H):null;if(t){let e=await fetch(`/api/planner/${t}`,{cache:"no-store"});if(e.ok)return(await e.json()).plan}let s=await fetch("/api/planner",{method:"POST"}),r=await s.json();if(!s.ok||!r.plan)throw Error(r.error||"Unable to create planner workspace.");return r.plan},[H,a]),er=(0,m.useCallback)(async({resumeStored:e,draftOverride:t})=>{if(o)return o;if(K.current)return K.current;let a=(async()=>{j(!0);try{let a=await es({resumeStored:e}),s=t??x,r=s.goal.trim()||s.source.trim()||s.name.trim()?rK(a,s,b):a;return X(r)}catch(e){return eu.o.error("Workspace architect could not start.",{description:e instanceof Error?e.message:"Unknown planner error."}),null}finally{j(!1),K.current=null}})();return K.current=a,a},[x,b,X,o,es]),en=(0,m.useCallback)(async()=>{if(v(null),U(null),z(null),N(!1),S(!1),I(!1),R(!1),O(!1),_(!1),V(null),K.current=null,a){ea(),d(null),G.current=null,p(null),await er({resumeStored:!1,draftOverride:void 0})&&l("advanced");return}if("basic"===i){ea(),d(null),G.current=null,p(null),g(rO()),f(rB("fastest"));return}ea(),d(null),G.current=null,p(null);let e=rO();g(e),f(rB("fastest")),await er({resumeStored:!1,draftOverride:e})&&l("advanced")},[ea,er,i,a]),ei=(0,m.useCallback)(()=>{ea(),v(null)},[ea]),el=(0,m.useCallback)(async e=>{let t=e??G.current;if(!t||!c)return!1;S(!0);try{let e=await fetch(`/api/planner/${c}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:t})}),a=await e.json();if(!e.ok||!a.plan)throw Error(a.error||"Unable to save planner workspace.");return X(a.plan),eu.o.success("Planner draft saved."),!0}catch(e){return eu.o.error("Planner draft could not be saved.",{description:e instanceof Error?e.message:"Unknown planner save error."}),!1}finally{S(!1)}},[X,c]),eo=(0,m.useCallback)(async e=>{let t=e??G.current;if(!t||!c)return!1;I(!0);try{let e=await fetch(`/api/planner/${c}/simulate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:t})}),a=await e.json();if(!e.ok||!a.plan)throw Error(a.error||"Unable to simulate planner team.");return X(a.plan),eu.o.success("Planner team simulated."),!0}catch(e){return eu.o.error("Planner simulation failed.",{description:e instanceof Error?e.message:"Unknown planner simulation error."}),!1}finally{I(!1)}},[X,c]),ed=(0,m.useCallback)(()=>{ee(e=>(e.intake.mode="advanced",e.intake.reviewRequested=!0,e.advisorNotes=[],e.conversation.push(ra("assistant","Workspace Architect","Deploy review is open now. I am surfacing the real blockers and warnings that matter before launch.")),e))},[ee]),ec=(0,m.useCallback)(async()=>{if(a)return null;let e=await er({resumeStored:!1,draftOverride:x})??G.current;if(!e)return null;let t=rK(e,x,b);X(t),O(!0),z(rR(rT({sourceMode:t.workspace.sourceMode,agentCount:1,kickoffMission:t.workspace.rules.kickoffMission??!0})));try{var n;let e=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...{name:t.workspace.name,brief:[(n=t).company.mission.trim()||n.product.offer.trim(),n.company.name.trim()?`Company: ${n.company.name.trim()}`:null,n.product.scopeV1.length>0?`Scope: ${n.product.scopeV1.join(", ")}`:null,...n.intake.sources.flatMap(e=>e.id!==rW?[]:"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",docOverrides:t.workspace.docOverrides,rules:rV(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 a=null,i=null;if(await s8(e,async e=>{"progress"===e.type?z(e.progress):(e.progress&&z(e.progress),e.ok?a=e.result:i=e.error)}),i||!a)throw Error(i||"OpenClaw could not create the workspace.");let l=a;return ea(),await s(),r(l.workspaceId),eu.o.success("Workspace created.",{description:`${l.agentIds.length} agent${1===l.agentIds.length?"":"s"} created at ${l.workspacePath}`}),l.kickoffError&&eu.o.message("Workspace created, but kickoff needs attention.",{description:l.kickoffError}),l}catch(e){return eu.o.error("Workspace creation failed.",{description:e instanceof Error?e.message:"Unknown workspace error."}),null}finally{O(!1)}},[x,b,ea,X,er,s,r,a]),ep=(0,m.useCallback)(async()=>{let e=G.current,t=J.current;if(!e||!a)return null;E(!0);try{let r=await fetch("/api/workspaces",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceId:a,name:e.workspace.name,directory:e.workspace.directory,plan:e,baseline:t})}),i=await r.json();if(!r.ok||i.error)throw Error(i.error||"OpenClaw could not update the workspace.");return ea(),await s(),n?.(i.workspaceId??a),eu.o.success("Workspace updated.",{description:i.workspacePath||e.workspace.directory||e.workspace.name}),i}catch(e){return eu.o.error("Workspace update failed.",{description:e instanceof Error?e.message:"Unknown workspace error."}),null}finally{E(!1)}},[ea,s,n,a]),em=(0,m.useCallback)(async()=>{var e;let t=G.current;if(!t||!c)return null;R(!0),U(rR({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."},...rT({sourceMode:(e={sourceMode:t.workspace.sourceMode??"empty",agentCount:t.team.persistentAgents.filter(e=>e.enabled).length,kickoffMission:t.workspace.rules.kickoffMission??!0,hasChannels:!!t.operations.channels.some(e=>e.enabled&&"internal"!==e.type),hasAutomations:!!t.operations.automations.some(e=>e.enabled),hasPlannerKickoffs:!!t.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/${c}/deploy`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:t,stream:!0})});if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||"Unable to deploy planner workspace.")}let a=null,n=null;if(await s8(e,async e=>{"progress"===e.type?U(e.progress):(e.progress&&U(e.progress),e.ok?a=e.result:n=e.error)}),n||!a)throw Error(n||"Unable to deploy planner workspace.");let i=a;return X(i.plan),ea(),await s(),r(i.workspaceId),eu.o.success("Workspace deployed.",{description:i.workspacePath}),i}catch(e){return eu.o.error("Planner deploy failed.",{description:e instanceof Error?e.message:"Unknown deploy error."}),null}finally{R(!1)}},[ea,X,s,r,c]),eh=(0,m.useCallback)(async e=>{if(!e.trim())return!1;N(!0),V(e.trim());try{let a="advanced"===t&&!o&&!x.goal.trim()&&!x.source.trim()&&!x.name.trim(),s=await er({resumeStored:a,draftOverride:x})??o;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 X(n.plan),v(null),!0}catch(e){return eu.o.error("Planner turn failed.",{description:e instanceof Error?e.message:"Unknown planner turn error."}),!1}finally{V(null),N(!1)}},[x,X,er,t,o]),ex=(0,m.useCallback)(async({path:e,currentContent:t,instruction:a})=>{if(!o||!c)return null;let s=e.trim();if(!s)return null;_(!0);try{let e=await fetch(`/api/planner/${c}/document-rewrite`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:o,path:s,currentContent:t,instruction:a?.trim()||"Rewrite this document to improve clarity, usefulness, and consistency with the workspace context."})}),r=await e.json();if(!e.ok||!r.plan)throw Error(r.error||"Unable to rewrite the document.");X(r.plan),v(null);let n=a8({name:r.plan.workspace.name||"Workspace",brief:r.plan.company.mission||r.plan.product.offer||void 0,template:r.plan.workspace.template,sourceMode:r.plan.workspace.sourceMode,rules:r.plan.workspace.rules,agents:r.plan.team.persistentAgents.filter(e=>e.enabled),docOverrides:r.plan.workspace.docOverrides,toolExamples:[]}).find(e=>e.path===s);return eu.o.success(`Architect rewrote ${s}.`,{description:r.reply||"The document override has been updated."}),n?.content??null}catch(e){return eu.o.error("Document rewrite failed.",{description:e instanceof Error?e.message:"Unknown document rewrite error."}),null}finally{_(!1)}},[X,o,c]),eg=(0,m.useCallback)(async()=>{let e=et();if(!e)return h(!1),!1;j(!0);try{let t=await fetch(`/api/planner/${e}`,{cache:"no-store"}),s=await t.json();if(!t.ok||!s.plan)throw Error(s.error||"Unable to load the stored planner draft.");return X(s.plan),l("advanced"),v({tone:"muted",title:a?"Resumed workspace edit":"Resumed previous draft",description:a?"Architect restored your earlier edit session so you can keep shaping the same workspace.":"Architect restored your earlier blueprint so you can keep shaping the same workspace."}),!0}catch(e){return eu.o.error("Stored draft could not be resumed.",{description:e instanceof Error?e.message:"Unknown planner error."}),!1}finally{j(!1),K.current=null}},[X,et,a]),eb=(0,m.useCallback)(async e=>{if(e!==i){if(a){if("basic"===e)return;l("advanced");return}if("advanced"===e){let e=await er({resumeStored:!1,draftOverride:x});if(!e)return;let t=rK(e,x,b),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(rq))),!s&&!r)return ru(a);let n=[s?`goal: ${s}`:null,r?`source: ${r}`:null,`fast-path name: ${rP(t)}`].filter(Boolean);return a.conversation.push(ra("system","Workspace Wizard",`${rq} ${n.join(" \xb7 ")}`)),ru(a)}(t,x):t;X(a),v(a.intake.started||x.goal.trim()||x.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),l("advanced");return}if(o)g(rE(o)),f(rG(o)),v(o&&(o.team.persistentAgents.filter(e=>e.enabled).length>1||o.operations.workflows.some(e=>e.enabled)||o.operations.automations.some(e=>e.enabled)||o.operations.channels.some(e=>e.enabled&&"internal"!==e.type)||o.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 v(null);l("basic")}},[x,b,X,er,i,o,a]),ef=(0,m.useCallback)(e=>{g(t=>{let a={...t,goal:e};return"basic"===i&&d(e=>{let t=e?rK(e,a,b):e;return G.current=t,t}),a})},[b,i]),ew=(0,m.useCallback)(e=>{g(t=>{let a={...t,source:e};return"basic"===i&&d(e=>{let t=e?rK(e,a,b):e;return G.current=t,t}),a})},[b,i]),ev=(0,m.useCallback)(e=>{g(t=>{let a={...t,name:e};return"basic"===i&&d(e=>{let t=e?rK(e,a,b):e;return G.current=t,t}),a})},[b,i]),ey=(0,m.useCallback)(e=>{let t=rB(e);f(t),d(e=>{let a=e?rK(e,x,t):e;return G.current=a,a})},[x]),ej=(0,m.useCallback)(e=>{f(t=>{let a={...t,[e]:!t[e],workspaceOnly:!0};return d(e=>{let t=e?rK(e,x,a):e;return G.current=t,t}),a})},[x]);return(0,m.useEffect)(()=>{if(!e){l(t),d(null),G.current=null,p(null),h(!1),g(rO()),f(rB("fastest")),v(null),z(null),U(null),_(!1),E(!1),V(null),D(null),J.current=null,K.current=null;return}let s=et();if(l(a?"advanced":t),h(!a&&!!s),g(rO()),f(rB("fastest")),v(null),z(null),U(null),_(!1),E(!1),V(null),D(null),J.current=null,K.current=null,!a&&"advanced"!==t){d(null),G.current=null,p(null);return}if(a||"advanced"===t){let e=(async()=>{j(!0);try{let e=await es({resumeStored:!a}),t=X(e);return!a&&s&&t&&v({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 eu.o.error("Workspace architect could not start.",{description:e instanceof Error?e.message:"Unknown planner error."}),null}finally{j(!1),K.current=null}})();K.current=e}else d(null),G.current=null,p(null)},[X,et,t,e,es,a]),{mode:i,plan:o,planId:c,hasStoredDraft:u,notice:w,sourceAnalysis:Z,basicDraft:x,basicRules:b,basicPreset:Q,isPlanLoading:y,isSending:k,isSaving:C,isSimulating:A,isDeploying:T,isCreating:M,isApplyingWorkspaceChanges:P,isDocumentRewriting:$,createProgress:F,deployProgress:L,architectBusyStatus:Y,pendingUserMessage:B,setBasicGoal:ef,setBasicSource:ew,setBasicName:ev,setBasicPreset:ey,toggleBasicRule:ej,setNotice:v,updatePlan:ee,switchMode:eb,startFreshDraft:en,discardStoredDraft:ei,resumeStoredDraft:eg,savePlan:el,simulatePlan:eo,requestReview:ed,createWorkspace:ec,deployPlan:em,applyWorkspaceChanges:ep,submitArchitectTurn:eh,rewriteDocumentWithArchitect:ex}}({open:e,initialMode:a,workspaceEditId:r,onRefresh:o,onWorkspaceCreated:d,onWorkspaceUpdated:c}),[h,x]=(0,m.useState)(""),[g,b]=(0,m.useState)(!1),[f,w]=(0,m.useState)(!1),[v,y]=(0,m.useState)(!1),[j,k]=(0,m.useState)("workspace.name"),[N,C]=(0,m.useState)("AGENTS.md"),S="light"===n,A=p?l.workspaces.find(e=>e.id===r)??null:null,I=e=>{e||(x(""),b(!1),w(!1),y(!1),k("workspace.name"),C("AGENTS.md")),t(e)},R=p?u.plan?.workspace.name??A?.name??rP(u.basicDraft):rP(u.basicDraft),M=p?u.plan?.workspace.template??A?.bootstrap.template??r_(`${u.basicDraft.goal}
|
|
153
|
-
${u.basicDraft.source}`):r_(`${u.basicDraft.goal}
|
|
154
|
-
${u.basicDraft.source}`),O=p?u.plan?.workspace.directory??A?.path??l.diagnostics.workspaceRoot:function(e,t,a=r$(t.source)){if("existing"===a.kind&&a.existingPath)return a.existingPath;let s=rP(t).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return`${eG(e)}/${s||"workspace"}`}(l.diagnostics.workspaceRoot,u.basicDraft,u.sourceAnalysis),$=(0,m.useMemo)(()=>{var e,t;let a;return e=u.mode,t=u.plan,a=[{id:"surface",label:p?"Editing workspace":"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 ${sP(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},[p,u.mode,u.plan]),_=(0,m.useMemo)(()=>{var e,t;let a;return e=u.plan,t=u.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},[u.pendingUserMessage,u.plan]),P=(0,m.useMemo)(()=>{let e=(u.plan?.intake.suggestedReplies??[]).filter(e=>e.trim().length>0).map((e,t)=>({id:`reply-${t}`,label:e,prompt:e})).slice(0,"basic"===u.mode?3:4);return e.length>0?e:u.plan?.intake.started?[]:rH.slice(0,"basic"===u.mode?3:4)},[u.mode,u.plan?.intake.started,u.plan?.intake.suggestedReplies]),E=u.isCreating?u.createProgress:u.isDeploying?u.deployProgress:null,D=u.isSending||u.isPlanLoading||u.isDeploying||u.isCreating||u.isDocumentRewriting||u.isApplyingWorkspaceChanges,L="basic"===u.mode&&u.hasStoredDraft&&!u.plan&&!u.isPlanLoading,F=p?!!(u.plan||h.trim()):!!(u.plan?.intake.started||u.basicDraft.goal.trim()||h.trim()),z=!!(u.plan?.intake.started||u.basicDraft.name.trim()||u.basicDraft.goal.trim()||u.basicDraft.source.trim()||h.trim()),q=p||"basic"!==u.mode?null:(0,s.jsx)(r0,{surfaceTheme:n,name:u.basicDraft.name,source:u.basicDraft.source,onNameChange:u.setBasicName,onSourceChange:u.setBasicSource}),B=async e=>{let t=(e??h).trim();if(!t)return!1;let a=void 0===e;a&&x("");let s=await u.submitArchitectTurn(t);return!s&&a&&x(h),s},V=async()=>{if(p){if(!(!h.trim()||await B()))return;await u.applyWorkspaceChanges()&&I(!1);return}(!h.trim()||await B())&&await u.createWorkspace()&&I(!1)},K=async()=>{p||await u.deployPlan()&&I(!1)},G=async(e,t)=>{let a=t.trim()?{...e,conversation:[...e.conversation,ra("system","Workspace Wizard",t)]}:e;return u.savePlan(a)},Z=async(e,t)=>{let a=t.trim()?{...e,conversation:[...e.conversation,ra("system","Workspace Wizard",t)]}:e;return u.savePlan(a)},Q=(e="workspace.name")=>{k(e),b(!1),w(!0),y(!1)},Y=e=>{C(e),b(!1),w(!1),y(!0)};return(0,s.jsx)(H,{open:e,onOpenChange:I,children:(0,s.jsxs)(X,{className:S?"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)(ea,{className:"sr-only",children:p?"Edit workspace":"Create workspace"}),(0,s.jsx)(es,{className:"sr-only",children:p?"Edit the existing workspace blueprint, documents, and agents using Architect.":"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:S?"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)(sY,{surfaceTheme:n,mode:u.mode,onModeChange:e=>{u.switchMode(e)},onNewDraft:p?void 0:()=>{x(""),b(!1),w(!1),y(!1),u.startFreshDraft()},title:p?"Edit workspace":"Create workspace",showModeToggle:!p,showNewDraft:!p,badges:$}),(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:S?"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:[u.architectBusyStatus?(0,s.jsx)("div",{className:S?"border-b border-[#ece5db] px-4 py-2.5 md:px-5":"border-b border-white/10 px-4 py-2.5 md:px-5",children:(0,s.jsxs)("div",{className:S?"rounded-2xl border border-[#e6dfd5] bg-white px-3 py-2":"rounded-2xl border border-white/10 bg-white/[0.04] px-3 py-2",children:[(0,s.jsx)("p",{className:S?"text-[10px] uppercase tracking-[0.2em] text-[#8b7262]":"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:u.architectBusyStatus.title}),(0,s.jsx)("p",{className:S?"mt-1 text-[12px] leading-5 text-[#6d665e]":"mt-1 text-[12px] leading-5 text-slate-300",children:u.architectBusyStatus.description})]})}):null,(0,s.jsx)("div",{className:"min-h-0 flex-1",children:(0,s.jsx)(s2,{surfaceTheme:n,messages:_,isTyping:u.isSending,typingLabel:"Architect is shaping the next pass...",emptyState:u.isPlanLoading&&0===_.length?(0,s.jsx)(rX,{surfaceTheme:n}):0===_.length&&"basic"===u.mode?(0,s.jsx)(rQ,{surfaceTheme:n}):0===_.length?(0,s.jsx)(rY,{surfaceTheme:n}):null,auxiliary:(0,s.jsxs)(s.Fragment,{children:[L?(0,s.jsx)(r1,{surfaceTheme:n,isBusy:D,onResume:()=>{u.resumeStoredDraft()},onStartFresh:u.discardStoredDraft}):null,E?(0,s.jsx)("div",{className:"mx-auto w-full max-w-3xl",children:(0,s.jsx)(a2,{progress:E,className:S?"border-[#e6dfd5] bg-white":"border-white/10 bg-slate-950/50"})}):null]})})})]}),(0,s.jsx)("div",{className:S?"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-3xl",children:[(0,s.jsx)(s4,{surfaceTheme:n,chips:P.map(e=>({id:e.id,label:e.label})),disabled:D,onSelect:e=>{let t=P.find(t=>t.id===e.id);t&&B(t.prompt)},className:"mb-2.5"}),(0,s.jsx)(s1,{surfaceTheme:n,value:h,onChange:x,onSubmit:async()=>{await B()},placeholder:p?"Tell Architect what to change in this workspace...":"basic"===u.mode?"Describe what this workspace should do...":"Refine the blueprint with Architect...",disabled:D,isBusy:u.isSending,helperText:p?"Architect updates the existing workspace draft as you chat.":"basic"===u.mode?"Architect keeps the fast-path draft synced as you chat.":"Architect updates the shared blueprint on every turn.",toolbar:p?(0,s.jsx)("span",{className:S?"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:"Editing draft"}):"basic"!==u.mode||u.plan?u.plan?(0,s.jsxs)("span",{className:S?"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 ",sP(u.plan.stage)]}):null:(0,s.jsx)("span",{className:S?"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:"Live draft"})})]})})]}),(0,s.jsx)(sF,{className:"hidden lg:block",surfaceTheme:n,workspaceMode:p?"edit":"create",mode:u.mode,snapshot:l,basicQuickSetup:q,plan:u.plan,resolvedName:R,resolvedTemplate:M,sourceAnalysis:u.sourceAnalysis,workspacePath:O,notice:u.notice,basicRules:u.basicRules,basicPreset:u.basicPreset,onOpenBlueprintEditor:Q,onOpenDocumentEditor:Y,onBasicPresetChange:u.setBasicPreset,onBasicRuleToggle:u.toggleBasicRule,progress:p?null:"basic"===u.mode?u.createProgress:u.isDeploying?u.deployProgress:null})]}),g?(0,s.jsxs)("div",{className:S?"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:S?"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:S?"text-[11px] uppercase tracking-[0.18em] text-[#9f958a]":"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:"basic"===u.mode?"Workspace draft":"Workspace blueprint"}),(0,s.jsx)("p",{className:S?"text-[13px] text-[#6f675e]":"text-[13px] text-slate-300",children:"Review the structured side of the same wizard."})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[u.plan?(0,s.jsx)(T,{type:"button",variant:"secondary",size:"sm",onClick:()=>Q(),className:S?"rounded-full border-[#ddd6cb] bg-[#f7f2eb] text-[#403934] hover:bg-[#f1ebe3]":"rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]",children:"Edit details"}):null,(0,s.jsx)("button",{type:"button",onClick:()=>b(!1),className:S?"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)(sF,{className:"min-h-0 flex-1 border-t-0 lg:hidden",surfaceTheme:n,workspaceMode:p?"edit":"create",mode:u.mode,snapshot:l,basicQuickSetup:q,plan:u.plan,resolvedName:R,resolvedTemplate:M,sourceAnalysis:u.sourceAnalysis,workspacePath:O,notice:u.notice,basicRules:u.basicRules,basicPreset:u.basicPreset,onOpenBlueprintEditor:Q,onOpenDocumentEditor:Y,onBasicPresetChange:u.setBasicPreset,onBasicRuleToggle:u.toggleBasicRule,progress:p?null:"basic"===u.mode?u.createProgress:u.isDeploying?u.deployProgress:null})]}):null,f&&u.plan?(0,s.jsx)(sc,{open:f,surfaceTheme:n,plan:u.plan,busy:u.isSaving,focus:j,onClose:()=>w(!1),onSave:G},`${u.plan.id}:${j}`):null,v&&u.plan?(0,s.jsx)(sv,{open:v,surfaceTheme:n,plan:u.plan,path:N,busy:u.isSaving,rewriteBusy:u.isDocumentRewriting,onClose:()=>y(!1),onSave:Z,onRewriteWithArchitect:u.rewriteDocumentWithArchitect},`${u.plan.id}:${N}`):null,(0,s.jsx)("div",{className:S?"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:S?"text-[13px] text-[#776f65]":"text-[13px] text-slate-300",children:"basic"===u.mode?"Chat stays fast. Open the blueprint for details.":"Chat and blueprint stay synced as you refine the plan."}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsxs)(T,{variant:"secondary",size:"sm",className:S?"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:()=>b(!0),children:[(0,s.jsx)(a1.A,{className:"mr-2 h-4 w-4"}),"View blueprint"]}),p?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(T,{variant:"secondary",size:"sm",className:S?"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 u.savePlan(),disabled:!u.plan||u.isSaving||u.isPlanLoading,children:[u.isSaving?(0,s.jsx)(i.A,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save draft"]}),(0,s.jsxs)(T,{size:"sm",className:S?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",onClick:()=>void V(),disabled:!F||u.isPlanLoading||u.isSending||u.isSaving||u.isApplyingWorkspaceChanges,children:[u.isApplyingWorkspaceChanges?(0,s.jsx)(i.A,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(U.A,{className:"mr-2 h-4 w-4"}),"Apply changes"]})]}):"basic"===u.mode?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(T,{variant:"secondary",size:"sm",className:S?"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:()=>{u.switchMode("advanced")},disabled:u.isCreating||u.isSending||u.isPlanLoading,children:"Advanced details"}),(0,s.jsxs)(T,{size:"sm",className:S?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",onClick:()=>void V(),disabled:u.isCreating||u.isSending||u.isPlanLoading||!z,children:[u.isCreating?(0,s.jsx)(i.A,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(U.A,{className:"mr-2 h-4 w-4"}),"Create workspace"]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(T,{variant:"secondary",size:"sm",className:S?"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 u.savePlan(),disabled:!u.plan||u.isSaving||u.isPlanLoading,children:[u.isSaving?(0,s.jsx)(i.A,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save draft"]}),u.plan?.intake.reviewRequested?(0,s.jsxs)(T,{size:"sm",className:S?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",onClick:()=>void K(),disabled:!u.plan||u.plan.deploy.blockers.length>0||u.isDeploying||u.isPlanLoading,children:[u.isDeploying?(0,s.jsx)(i.A,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(W.A,{className:"mr-2 h-4 w-4"}),"Deploy workspace"]}):(0,s.jsx)(T,{size:"sm",className:S?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",onClick:()=>u.requestReview(),disabled:!u.plan||u.isSending||u.isDeploying,children:"Review blueprint"})]})]})]})})]})]})})}function rQ({surfaceTheme:e}){let t="light"===e;return(0,s.jsxs)("div",{className:"mx-auto mt-4 flex w-full max-w-2xl flex-col gap-3 px-4 md:mt-12 md:px-6",children:[(0,s.jsx)("p",{className:N("text-[10px] uppercase tracking-[0.22em]",t?"text-[#8b7262]":"text-slate-500"),children:"Fast path"}),(0,s.jsx)("p",{className:t?"text-[24px] font-semibold tracking-[-0.03em] text-[#181612]":"text-[24px] font-semibold tracking-[-0.03em] text-white",children:"Start with one prompt."}),(0,s.jsx)("p",{className:t?"text-[15px] leading-7 text-[#7f756b]":"text-[15px] leading-7 text-slate-400",children:"Tell Architect what this workspace should do. It will reflect the intent back and ask the next critical question."})]})}function rY({surfaceTheme:e}){let t="light"===e;return(0,s.jsxs)("div",{className:"mx-auto mt-4 flex w-full max-w-2xl flex-col gap-3 px-4 md:mt-12 md:px-6",children:[(0,s.jsx)("p",{className:N("text-[10px] uppercase tracking-[0.22em]",t?"text-[#8b7262]":"text-slate-500"),children:"Blueprint mode"}),(0,s.jsx)("p",{className:t?"text-[24px] font-semibold tracking-[-0.03em] text-[#181612]":"text-[24px] font-semibold tracking-[-0.03em] text-white",children:"Shape the workspace with Architect."}),(0,s.jsx)("p",{className:t?"text-[15px] leading-7 text-[#7f756b]":"text-[15px] leading-7 text-slate-400",children:"Describe the operating model, and the structured draft updates as you chat."})]})}function rX({surfaceTheme:e}){return(0,s.jsxs)("div",{className:"light"===e?"mx-auto mt-10 flex w-full max-w-2xl items-center gap-3 rounded-2xl border border-[#e6dfd5] bg-white px-4 py-3 text-[13px] text-[#6d665e]":"mx-auto mt-10 flex w-full max-w-2xl items-center gap-3 rounded-2xl border border-white/10 bg-white/[0.04] px-4 py-3 text-[13px] text-slate-300",children:[(0,s.jsx)(i.A,{className:"h-4 w-4 animate-spin"}),"Architect is opening the planning session and extracting intent from the latest brief."]})}function r0({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-2xl border border-[#e4ddd3] bg-white p-3.5 shadow-[0_18px_56px_rgba(56,47,38,0.06)]":"mx-auto w-full max-w-3xl rounded-2xl border border-white/10 bg-white/[0.04] p-3.5 shadow-[0_18px_56px_rgba(0,0,0,0.24)]",children:(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("span",{className:i?"inline-flex size-8 shrink-0 items-center justify-center rounded-full border border-[#e4ddd3] bg-[#faf6f1] text-[#5e5750]":"inline-flex size-8 shrink-0 items-center justify-center rounded-full border border-white/10 bg-white/[0.05] text-slate-300",children:(0,s.jsx)(U.A,{className:"h-3.5 w-3.5"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:i?"text-[10px] uppercase tracking-[0.2em] text-[#8b7262]":"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:"Quick details"}),(0,s.jsx)("p",{className:i?"mt-1 text-[12px] leading-5 text-[#70685f]":"mt-1 text-[12px] leading-5 text-slate-300",children:"Optional name and source live here. Architect can still infer both from the prompt."}),(0,s.jsxs)("div",{className:"mt-3 grid gap-2.5 md:grid-cols-2",children:[(0,s.jsx)(r2,{surfaceTheme:e,label:"Workspace name",children:(0,s.jsx)(R,{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)(r2,{surfaceTheme:e,label:"Source",children:(0,s.jsx)(R,{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 r1({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)(T,{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)(T,{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 r2({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 r5="mission-control-surface-theme",r3="mission-control-hidden-runtime-ids",r4="mission-control-hidden-task-keys",r8="mission-control-locked-task-keys";function r6({initialSnapshot:e}){var t,a,d,c,p,u,h;let{snapshot:x,connectionState:g,refresh:b,refreshSnapshot:f,setSnapshot:w}=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),[v,y]=(0,m.useState)(e.workspaces[0]?.id??null),[j,k]=(0,m.useState)(e.workspaces[0]?.id??null),[C,S]=(0,m.useState)(null),[A,I]=(0,m.useState)("overview"),[R,M]=(0,m.useState)(null),[O,$]=(0,m.useState)(null),[_,P]=(0,m.useState)([]),[E,D]=(0,m.useState)(null),[L,U]=(0,m.useState)([]),[F,z]=(0,m.useState)([]),[W,q]=(0,m.useState)([]),[B,V]=(0,m.useState)(null),[K,G]=(0,m.useState)(null),[J,Z]=(0,m.useState)("idle"),[Q,Y]=(0,m.useState)(null),er=(0,m.useRef)(new Map),[en,ei]=(0,m.useState)(!1),[el,eo]=(0,m.useState)(!1),[ec,ep]=(0,m.useState)(!1),[em,ex]=(0,m.useState)(!1),[eg,eb]=(0,m.useState)(null),[ef,ew]=(0,m.useState)("idle"),[ev,ey]=(0,m.useState)(null),[ej,ek]=(0,m.useState)(null),[eN,eC]=(0,m.useState)("idle"),[eS,eA]=(0,m.useState)(null),[eI,eT]=(0,m.useState)(null),[eR,eM]=(0,m.useState)(null),[eO,e$]=(0,m.useState)(""),[e_,eP]=(0,m.useState)(""),[eE,eD]=(0,m.useState)(()=>ni(e)),[eL,eU]=(0,m.useState)(()=>nl(e)),[eF,ez]=(0,m.useState)(!1),[eW,eq]=(0,m.useState)(!1),[eB,eV]=(0,m.useState)(!1),[eK,eJ]=(0,m.useState)("idle"),[eH,eZ]=(0,m.useState)(null),[eQ,eY]=(0,m.useState)(null),[eX,e0]=(0,m.useState)(""),[e1,e2]=(0,m.useState)("idle"),[e5,e3]=(0,m.useState)(null),[e4,e8]=(0,m.useState)(null),[e6,e9]=(0,m.useState)(null),[e7,te]=(0,m.useState)(""),[tt,ta]=(0,m.useState)(null),[ts,tr]=(0,m.useState)(null),[tn,ti]=(0,m.useState)("system"),[tl,to]=(0,m.useState)(""),[td,tc]=(0,m.useState)([]),[tp,tu]=(0,m.useState)("idle"),[tm,th]=(0,m.useState)(null),[tg,tb]=(0,m.useState)(null),[tf,tw]=(0,m.useState)(null),[tv,ty]=(0,m.useState)(""),[tj,tk]=(0,m.useState)(null),[tN,tC]=(0,m.useState)(null),[tS,tA]=(0,m.useState)(!1),[tI,tT]=(0,m.useState)(!1),[tR,tM]=(0,m.useState)(!1),[tO,t$]=(0,m.useState)(()=>av(e)),[t_,tP]=(0,m.useState)(null),[tE,tD]=(0,m.useState)(null),[tL,tU]=(0,m.useState)("dark"),[tF,tz]=(0,m.useState)(!1),[tq,tB]=(0,m.useState)("basic"),[tV,tK]=(0,m.useState)(null),[tG,tJ]=(0,m.useState)(!1),[tH,tZ]=(0,m.useState)(null),[tQ,tY]=(0,m.useState)(null),tX=(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]}})(x,_),[x,_]),t1=(0,m.useCallback)((e,t="overview")=>{k(e),I(t)},[]),t2=(0,m.useRef)(null),t5=(0,m.useRef)(null),t3=x.runtimes.filter(e=>"running"===e.status||"queued"===e.status).length,t4=aw(x),t8=av(x),t6=[x.diagnostics.updatePackageManager,x.diagnostics.updateInstallKind].filter(Boolean).join(" \xb7 "),t9="running"===eK,t7="success"===eK||"error"===eK,ae="running"===(t=eK)?"Updating OpenClaw":"success"===t?"Update complete":"error"===t?"Update failed":"Update OpenClaw",at="running"===(a=eK)?"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.",aa=(d=x).diagnostics.installed?aw(d)?{label:"Enter Mission Control",description:"OpenClaw is online and the runtime state is writable."}:d.diagnostics.rpcOk?{label:"Repair runtime access",description:"OpenClaw is online, but Mission Control still needs verified write access to the runtime state."}:d.diagnostics.loaded?(!d.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."},as=t3>0||_.length>0,ar=!tS&&!t8&&!as&&(!tO||"offline"===x.diagnostics.health),an=tX.tasks.filter(e=>!v||e.workspaceId===v).filter(e=>ns(e,L,F,W)).length,ai=(0,m.useCallback)(e=>{let t=tX.tasks.filter(t=>t.workspaceId===e).filter(e=>!W.includes(e.key));if(0===t.length)return;let a=t.every(e=>ns(e,L,F,W)),s=new Set(t.map(e=>e.key)),r=new Set(t.flatMap(e=>e.runtimeIds));if(a){z(e=>e.filter(e=>!s.has(e))),U(e=>e.filter(e=>!r.has(e)));return}z(e=>Array.from(new Set([...e,...s]))),U(e=>Array.from(new Set([...e,...r])))},[tX.tasks,L,F,W]),al=(0,m.useCallback)(e=>{let t=tX.agents.find(t=>t.id===e);t&&(S(t=>t===e?null:e),y(t.workspaceId),t1(e))},[t1,tX.agents]),ao=(0,m.useCallback)(()=>{S(null),t1(v??tX.workspaces[0]?.id??null)},[v,t1,tX.workspaces]),ad=(0,m.useCallback)((e="basic")=>{tK(null),tB(e),tz(!0)},[]),ac=(0,m.useCallback)(e=>{tK(e),tB("advanced"),tz(!0)},[]),ap=(0,m.useCallback)(e=>{tz(e),e||(tK(null),tB("basic"))},[]);(0,m.useEffect)(()=>{if(v){if(x.workspaces.some(e=>e.id===v)){tQ===v&&tY(null);return}tQ!==v&&y(x.workspaces[0]?.id??null)}},[x.workspaces,v,tQ]),(0,m.useEffect)(()=>{if(j){if(tX.workspaces.some(e=>e.id===j)||tX.agents.some(e=>e.id===j)||tX.tasks.some(e=>e.id===j)||tX.runtimes.some(e=>e.id===j)||tX.models.some(e=>e.id===j)){tQ===j&&tY(null);return}tQ!==j&&t1(v||tX.workspaces[0]?.id||null)}},[tX,j,v,tQ,t1]),(0,m.useEffect)(()=>{let e=tX.tasks.find(e=>e.id===j),t=e&&ns(e,L,F,W);if(j){if(C){j!==C&&e?.primaryAgentId!==C&&t1(C);return}(L.includes(j)||t)&&t1(v||tX.workspaces[0]?.id||null)}},[j,C,L,F,W,v,tX.workspaces,tX.tasks,t1]),(0,m.useEffect)(()=>{!C||tX.agents.some(e=>e.id===C)||S(null)},[C,tX.agents]),(0,m.useEffect)(()=>{let e=globalThis.localStorage?.getItem(r5),t=globalThis.localStorage?.getItem(r3),a=globalThis.localStorage?.getItem(r4),s=globalThis.localStorage?.getItem(r8);if(("dark"===e||"light"===e)&&tU(e),t)try{let e=JSON.parse(t);Array.isArray(e)&&U(e.filter(e=>"string"==typeof e))}catch{}if(a)try{let e=JSON.parse(a);Array.isArray(e)&&z(e.filter(e=>"string"==typeof e))}catch{}if(s)try{let e=JSON.parse(s);Array.isArray(e)&&q(e.filter(e=>"string"==typeof e))}catch{}},[]),(0,m.useEffect)(()=>{globalThis.localStorage?.setItem(r5,tL)},[tL]),(0,m.useEffect)(()=>{globalThis.localStorage?.setItem(r3,JSON.stringify(L))},[L]),(0,m.useEffect)(()=>{globalThis.localStorage?.setItem(r4,JSON.stringify(F))},[F]),(0,m.useEffect)(()=>{globalThis.localStorage?.setItem(r8,JSON.stringify(W))},[W]),(0,m.useEffect)(()=>{if(!O)return;let e=x.tasks.find(e=>e.dispatchId===O);e&&(k(t=>t===e.id?t:(I("overview"),e.id)),eo(!0),$(null))},[O,x.tasks]),(0,m.useEffect)(()=>{P(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=x.tasks.find(t=>t.dispatchId===e.dispatchId);return s?"running"===s.status||"queued"===s.status:!a}))},[x.tasks]),(0,m.useEffect)(()=>{ec||eF||eW||(eD(ni(x)),eU(nl(x)))},[x,ec,eF,eW]),(0,m.useEffect)(()=>{t8&&tA(!1)},[t8]),(0,m.useEffect)(()=>{t8&&t$(!0)},[t8]),(0,m.useEffect)(()=>{to(e=>{let t=x.models.filter(e=>!1!==e.available&&!e.missing).map(e=>e.id),a=x.diagnostics.modelReadiness.recommendedModelId;return e&&t.includes(e)?e:a&&t.includes(a)?a:t[0]||""})},[x.models,x.diagnostics.modelReadiness.recommendedModelId]),(0,m.useEffect)(()=>{t4?ti("models"):ti("system")},[t4]),(0,m.useEffect)(()=>{(t5.current&&(globalThis.clearTimeout(t5.current),t5.current=null),t8)?"idle"!==e1||"idle"!==tp?(e2("success"),e3("ready"),e8(null),e9("OpenClaw and a usable default model are ready. Entering Mission Control..."),tu("success"),th("ready"),tb(null),tw("A usable default model is ready."),ti("models"),tM(!0),t5.current=globalThis.setTimeout(()=>{tM(!1)},1100)):tM(!1):tM(!1)},[t8,e1,tp]),(0,m.useEffect)(()=>()=>{t5.current&&globalThis.clearTimeout(t5.current)},[]);let au=()=>{"running"!==eK&&(eJ("idle"),eZ(null),eY(null),e0(""))},am=e=>{e0(t=>{let a=`${t}${e}`;return a.length>4e4?a.slice(a.length-4e4):a})},ah=e=>{te(t=>{let a=`${t}${e}`;return a.length>4e4?a.slice(a.length-4e4):a})},ax=e=>{ty(t=>{let a=`${t}${e}`;return a.length>4e4?a.slice(a.length-4e4):a})},ag=e=>{e$(t=>{let a=`${t}${e}`;return a.length>4e4?a.slice(a.length-4e4):a})},ab=(0,m.useCallback)(async()=>{if(!K||"running"===J)return;let e="string"==typeof K.metadata.optimisticRequestId?K.metadata.optimisticRequestId:null,t=e?_.find(t=>t.requestId===e):_.find(e=>e.task.id===K.id),a="string"==typeof K.dispatchId?K.dispatchId:t?.dispatchId??null;if(e&&!a){er.current.get(e)?.abort(),er.current.delete(e),P(t=>t.map(t=>t.requestId===e?{...t,task:na(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)),eu.o.success("Mission submission cancelled.",{description:K.title}),G(null),Z("idle"),Y(null);return}Z("running"),Y(null);try{let e=await fetch(`/api/tasks/${encodeURIComponent(K.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.");eu.o.success("Task abort requested.",{description:K.title}),G(null),Z("idle"),await b()}catch(t){let e=t instanceof Error?t.message:"Unknown abort error.";Z("error"),Y(e),eu.o.error("Task abort failed.",{description:e})}},[_,b,K,J]),af=e=>{e&&tc(e)};(0,m.useEffect)(()=>{if(!ec)return;let e=e=>{t2.current?.contains(e.target)||ep(!1)},t=e=>{"Escape"===e.key&&ep(!1)};return window.addEventListener("pointerdown",e),window.addEventListener("keydown",t),()=>{window.removeEventListener("pointerdown",e),window.removeEventListener("keydown",t)}},[ec]);let aj=async()=>{eV(!0),eJ("running"),eZ("Starting OpenClaw update..."),eY(null),e0("");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?(eZ(t.message),am(`
|
|
155
|
-
> ${t.message}
|
|
156
|
-
`)):"log"===t.type?am(t.text):(r=!0,eZ(null),eY(t.message),eJ(t.ok?"success":"error"),t.snapshot&&w(t.snapshot),t.ok?eu.o.success("OpenClaw updated.",{description:t.message}):eu.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,eZ(null),eY(e.message),eJ(e.ok?"success":"error"),e.snapshot&&w(e.snapshot))}if(!r)throw Error("OpenClaw update stream ended unexpectedly.")}catch(e){eJ("error"),eZ(null),eY(e instanceof Error?e.message:"OpenClaw update failed."),eu.o.error("OpenClaw update failed.",{description:e instanceof Error?e.message:"Unknown update error."})}},ak=async()=>{tA(!1),ti("system"),e2("running"),e3("detecting"),e8("Checking local OpenClaw status..."),e9(null),ta(null),tr(null),te("");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?(e3(t.phase),e8(t.message),ah(`
|
|
157
|
-
> ${t.message}
|
|
158
|
-
`)):"log"===t.type?ah(t.text):(r=!0,e3(t.phase),e8(null),e9(t.message),ta(t.manualCommand??null),tr(t.docsUrl??null),e2(t.ok?"success":"error"),t.snapshot&&w(t.snapshot),t.ok?eu.o.success("System setup ready.",{description:t.message}):eu.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,e3(e.phase),e8(null),e9(e.message),ta(e.manualCommand??null),tr(e.docsUrl??null),e2(e.ok?"success":"error"),e.snapshot&&w(e.snapshot))}if(!r)throw Error("OpenClaw onboarding stream ended unexpectedly.")}catch(e){e2("error"),e8(null),e9(e instanceof Error?e.message:"OpenClaw onboarding failed."),eu.o.error("OpenClaw onboarding failed.",{description:e instanceof Error?e.message:"Unknown onboarding error."})}},aN=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."};tA(!1),ti("models"),tu("running"),th("refresh"===(a=e.intent)?"refreshing":"discover"===a?"discovering":"detecting"),tb(s.statusMessage),tw(null),tk(null),tC(null),ty("");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?(th(t.phase),tb(t.message),ax(`
|
|
159
|
-
> ${t.message}
|
|
160
|
-
`)):"log"===t.type?ax(t.text):(i=!0,th(t.phase),tb(null),tw(t.message),tk(t.manualCommand??null),tC(t.docsUrl??null),tu(t.ok?"success":"error"),af(t.discoveredModels),t.snapshot&&w(t.snapshot),t.ok?eu.o.success(s.successTitle,{description:t.message}):"authenticating"===t.phase&&t.manualCommand?eu.o.message("Continue in terminal.",{description:t.message}):eu.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,th(e.phase),tb(null),tw(e.message),tk(e.manualCommand??null),tC(e.docsUrl??null),tu(e.ok?"success":"error"),af(e.discoveredModels),e.snapshot&&w(e.snapshot))}if(!i)throw Error("Model onboarding stream ended unexpectedly.")}catch(e){tu("error"),tb(null),tw(e instanceof Error?e.message:"Model onboarding failed."),eu.o.error(s.errorTitle,{description:e instanceof Error?e.message:"Unknown model onboarding error."})}},aC=async()=>{await aN({intent:"auto",modelId:tl||void 0})},aS=async()=>{await aN({intent:"refresh"})},aA=async()=>{await aN({intent:"discover"})},aI=async e=>{await aN({intent:"login-provider",provider:e})},aT=async e=>{let t=e||tl;t?await aN({intent:"set-default",modelId:t}):await aC()},aR=(e=t4?"models":"system")=>{ep(!1),ti(e),tA(!1),tM(!1),tT(!0)},aM=async e=>{tP(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.");w(a.snapshot),eu.o.success("Gateway updated.",{description:a.message||"Gateway state changed."})}catch(e){eu.o.error("Gateway action failed.",{description:e instanceof Error?e.message:"Unknown gateway control error."})}finally{tP(null)}},aO=e=>{tZ(ed(e)),tJ(!0)},a$=async()=>{ex(!0);try{let e=await f(),t=Date.now(),a=e.diagnostics.updateInfo?.trim();if(tD(t),!e.diagnostics.installed)return void eu.o.message("OpenClaw is unavailable.",{description:e.diagnostics.issues[0]||"Mission Control is running in fallback mode."});if(e.diagnostics.updateAvailable)return void eu.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 eu.o.message("Update status refreshed.",{description:a||`Latest available version: v${e.diagnostics.latestVersion}.`});if(e.diagnostics.updateError)return void eu.o.error("Update check could not reach the registry.",{description:a||e.diagnostics.updateError});eu.o.success("OpenClaw is up to date.",{description:a||`Current version: v${e.diagnostics.version||"unknown"}. No newer release was reported.`})}catch(e){eu.o.error("Update check failed.",{description:e instanceof Error?e.message:"Unable to refresh OpenClaw status."})}finally{ex(!1)}},a_=async e=>{ez(!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();w(a.snapshot),eD(ni(a.snapshot)),eu.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){eu.o.error("Gateway update failed.",{description:e instanceof Error?e.message:"Unable to update the OpenClaw gateway."})}finally{ez(!1)}},aE=async e=>{eq(!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();w(a.snapshot),eU(nl(a.snapshot)),eu.o.success("Workspace root updated.",{description:e?.trim()?`New workspaces will default to ${eG(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){eu.o.error("Workspace root update failed.",{description:e instanceof Error?e.message:"Unable to update the default workspace root."})}finally{eq(!1)}},aD=()=>{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)}},aL=()=>{ew("idle"),ey(null),ek(null),eC("idle"),eA(null),eT(null),eM(null),e$(""),eP("")},aU=async e=>{ew("loading"),ey(null),ek(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.");ey(a.preview),ew("ready")}catch(e){ew("error"),ek(e instanceof Error?e.message:"Reset preview failed.")}},aF=async e=>{ep(!1),eb(e),aL(),await aU(e)},aW=async()=>{if(eg){eC("running"),eA("full-uninstall"===eg?"Starting full uninstall...":"Starting Mission Control reset..."),eT(null),eM(null),e$("");try{let e=await fetch("/api/reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intent:"execute",target:eg,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?(eA(t.message),ag(`
|
|
161
|
-
> ${t.message}
|
|
162
|
-
`)):"log"===t.type?ag(`${t.text}
|
|
163
|
-
`):(r=!0,eA(null),eT(t.message),eM(t.backgroundLogPath??null),eC(t.ok?"success":"error"),t.snapshot&&w(t.snapshot),t.ok?(aD(),eu.o.success("full-uninstall"===eg?"Full uninstall started.":"Mission Control reset completed.",{description:t.message})):eu.o.error("full-uninstall"===eg?"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,eA(null),eT(e.message),eM(e.backgroundLogPath??null),eC(e.ok?"success":"error"),e.snapshot&&w(e.snapshot),e.ok&&aD())}if(!r)throw Error("Reset stream ended unexpectedly.")}catch(e){eC("error"),eA(null),eT(e instanceof Error?e.message:"Reset failed."),eu.o.error("full-uninstall"===eg?"Full uninstall failed.":"Mission Control reset failed.",{description:e instanceof Error?e.message:"Unknown reset error."})}}};return(0,s.jsxs)("div",{className:N("mission-shell relative min-h-screen overflow-hidden","light"===tL&&"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)(tx,{snapshot:tX,activeWorkspaceId:v,selectedNodeId:j,focusedAgentId:C,recentDispatchId:O,hiddenRuntimeIds:L,hiddenTaskKeys:F,lockedTaskKeys:W,onToggleWorkspaceTaskCards:ai,className:"rounded-none",onEditAgent:e=>{t1(e),V({requestId:`edit:${e}:${Date.now()}`,kind:"edit",agentId:e})},onDeleteAgent:e=>{t1(e),V({requestId:`delete:${e}:${Date.now()}`,kind:"delete",agentId:e})},onFocusAgent:al,onReplyTask:e=>{let t=ne(e);D({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=ne(e);D({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),eu.o.success("Prompt copied to clipboard.",{description:"The mission input was also populated."})}catch{eu.o.message("Prompt moved into mission input.",{description:"Clipboard access was not available."})}},onHideTask:e=>{W.includes(e.key)||(z(t=>t.includes(e.key)?t:[...t,e.key]),U(t=>{let a=new Set(t);return e.runtimeIds.forEach(e=>a.add(e)),Array.from(a)}))},onToggleTaskLock:e=>{q(t=>t.includes(e.key)?t.filter(t=>t!==e.key):[...t,e.key])},onAbortTask:e=>{nt(e)&&(G(e),Z("idle"),Y(null))},onInspectTask:(e,t)=>{t1(e.id,t),eo(!0)},onSelectNode:e=>{t1(e)}})})]}),(0,s.jsx)("div",{className:N("pointer-events-none absolute top-0 z-40 hidden lg:block",en?"lg:left-[442px]":"lg:left-[118px]",el?"lg:right-[442px]":"lg:right-[118px]"),children:(0,s.jsx)(r7,{snapshot:x,surfaceTheme:tL,settingsRef:t2,isSettingsOpen:ec,gatewayDraft:eE,workspaceRootDraft:eL,isSavingGateway:eF,isSavingWorkspaceRoot:eW,isCheckingForUpdates:em,selectedModelId:tl,modelOnboardingRunState:tp,gatewayControlAction:t_,lastCheckedAt:tE,onToggleTheme:()=>tU(e=>"light"===e?"dark":"light"),onToggleSettings:()=>ep(e=>!e),onGatewayDraftChange:eD,onWorkspaceRootDraftChange:eU,onSelectedModelIdChange:to,onSaveGatewaySettings:a_,onSaveWorkspaceRootSettings:aE,onCheckForUpdates:a$,onControlGateway:aM,onOpenSetupWizard:aR,onRunModelRefresh:aS,onRunModelSetDefault:aT,onOpenAddModels:aO,onOpenUpdateDialog:()=>{au(),eV(!0)},onOpenResetDialog:e=>{aF(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)(r9,{surfaceTheme:tL})}),(0,s.jsx)("div",{className:N("pointer-events-auto absolute left-4 top-4 z-30",en?"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)(az,{snapshot:tX,activeWorkspaceId:v,requestedAgentAction:B,connectionState:g,collapsed:!en,modelManager:{runState:tp,statusMessage:tg,resultMessage:tf,log:tv,manualCommand:tj,docsUrl:tN,discoveredModels:td,systemReady:t4},onToggleCollapsed:()=>ei(e=>!e),onSelectWorkspace:e=>{y(e),t1(e)},onRefresh:b,onRunModelRefresh:aS,onRunModelDiscover:aA,onRunModelSetDefault:aT,onConnectModelProvider:aI,onOpenModelSetup:()=>aR(t4?"models":"system"),onOpenAddModels:aO,onEditWorkspace:ac})}),(0,s.jsx)("div",{className:N("pointer-events-auto absolute right-4 top-4 z-30",el?"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)(t0,{snapshot:tX,selectedNodeId:j,lastMission:R,collapsed:!el,onToggleCollapsed:()=>eo(e=>!e),activeTab:A,onActiveTabChange:I,onAbortTask:e=>{nt(e)&&(G(e),Z("idle"),Y(null))}})}),(0,s.jsxs)("div",{className:"pointer-events-auto absolute bottom-[calc(env(safe-area-inset-bottom)+12px)] left-4 right-4 z-40 lg:bottom-6 lg:left-1/2 lg:right-auto lg:w-[min(800px,calc(100vw-320px))] lg:-translate-x-1/2",children:[(0,s.jsxs)("div",{className:"mx-auto mb-1 flex w-fit flex-col items-start gap-1",children:[an>0?(0,s.jsxs)("div",{className:"inline-flex items-center gap-1.5 rounded-full border border-white/[0.08] bg-[linear-gradient(180deg,rgba(10,16,26,0.96),rgba(6,10,18,0.94))] px-3 py-1 text-[8px] text-slate-200 shadow-[0_10px_24px_rgba(0,0,0,0.14)]",children:[(0,s.jsx)(r.A,{className:"h-3 w-3 text-slate-400"}),(0,s.jsxs)("span",{className:"leading-3 text-slate-300",children:[an," hidden"]})]}):null,C?(0,s.jsxs)("button",{type:"button",onClick:ao,className:"inline-flex items-center gap-1.5 rounded-full border border-cyan-300/18 bg-[linear-gradient(180deg,rgba(16,25,38,0.98),rgba(8,12,20,0.96))] px-3 py-1 text-[8px] text-cyan-100 shadow-[0_10px_24px_rgba(0,0,0,0.14)] transition-colors hover:border-cyan-200/30 hover:bg-[linear-gradient(180deg,rgba(20,33,49,0.98),rgba(10,15,25,0.96))]","aria-label":"Reset focus and show the full workspace",title:"Reset Focus",children:[(0,s.jsx)(n.A,{className:"h-3 w-3 text-cyan-300"}),(0,s.jsx)("span",{className:"leading-3 text-cyan-50",children:"Reset Focus"})]}):null]}),(0,s.jsx)(tW,{snapshot:tX,activeWorkspaceId:v,selectedNodeId:j,composeIntent:E,onRefresh:b,onOpenWorkspaceCreate:()=>{ad("basic")},onMissionDispatchStart:e=>{var t,a;let s,r,n;er.current.set(e.requestId,e.abortController);let i=(t=e,a=x,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:nn(t.mission,220),agentId:t.agentId},{requestId:t.requestId,dispatchId:null,task:{id:`optimistic-task:${t.requestId}`,key:`optimistic:${t.requestId}`,title:nn(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]}}});P(t=>[i,...t.filter(t=>t.requestId!==e.requestId)]),e.workspaceId&&y(e.workspaceId),t1(i.task.id),eo(!0)},onMissionDispatchFailure:(e,t)=>{er.current.delete(e),P(a=>a.map(a=>a.requestId===e?{...a,task:na(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)=>{er.current.delete(t.requestId),M(e),P(a=>a.map(a=>a.requestId===t.requestId?{...a,dispatchId:e.dispatchId??a.dispatchId,task:na(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&&$(e.dispatchId)}})]}),ar||tR||tI?(0,s.jsx)(ay,{snapshot:x,surfaceTheme:tL,stage:tn,systemActionLabel:aa.label,systemActionDescription:aa.description,systemPhase:e5,modelPhase:tm,systemRun:{runState:e1,statusMessage:e4,resultMessage:e6,log:e7,manualCommand:tt,docsUrl:ts},modelRun:{runState:tp,statusMessage:tg,resultMessage:tf,log:tv,manualCommand:tj,docsUrl:tN},selectedModelId:tl,discoveredModels:td,onSelectedModelIdChange:to,onRunSystemSetup:ak,onRunModelAutoSetup:aC,onRunModelDiscover:aA,onRunModelRefresh:aS,onRunModelSetDefault:aT,onContinueToModels:()=>ti("models"),onBackToSystem:()=>ti("system"),onDismiss:()=>{tT(!1),tM(!1),t8||tA(!0)},canDismiss:!tR&&"running"!==e1&&"running"!==tp}):null,(0,s.jsx)(rZ,{open:tF,onOpenChange:ap,initialMode:tq,workspaceEditId:tV,surfaceTheme:tL,snapshot:x,onRefresh:b,onWorkspaceCreated:e=>{tY(e),y(e),t1(e)},onWorkspaceUpdated:e=>{tY(e),y(e),t1(e)}},tV?`workspace-edit:${tV}`:"workspace-create"),(0,s.jsx)(eh,{open:tG,onOpenChange:tJ,snapshot:x,initialProvider:tH,onSnapshotChange:w}),(0,s.jsx)(aP,{open:null!==eg,target:eg,surfaceTheme:tL,previewState:ef,preview:ev,previewError:ej,runState:eN,statusMessage:eS,resultMessage:eI,backgroundLogPath:eR,log:eO,confirmText:e_,onConfirmTextChange:eP,onRefreshPreview:()=>{eg&&aU(eg)},onExecute:()=>{aW()},onOpenChange:e=>{e||"running"!==eN&&(eb(null),aL())}}),(0,s.jsx)(H,{open:null!==K,onOpenChange:e=>{"running"!==J&&(e||(G(null),Z("idle"),Y(null)))},children:(0,s.jsxs)(X,{className:N("max-w-[480px] gap-5 p-5 sm:p-6","light"===tL?"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)(ee,{children:[(0,s.jsx)(ea,{className:"light"===tL?"text-[#3f2f24]":"text-white",children:"Abort task?"}),(0,s.jsx)(es,{className:"light"===tL?"text-[#7e6555]":"text-slate-400",children:"This stops the current OpenClaw dispatch for the selected task. It does not delete captured evidence or files."})]}),K?(0,s.jsxs)("div",{className:N("rounded-[20px] border px-4 py-4","light"===tL?"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:K.title}),(0,s.jsx)("p",{className:N("mt-1 text-sm leading-6","light"===tL?"text-[#8b7262]":"text-rose-100/80"),children:K.subtitle}),Q?(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:Q}):null]}):null,(0,s.jsxs)(et,{children:[(0,s.jsx)(T,{type:"button",variant:"secondary",disabled:"running"===J,className:"light"===tL?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",onClick:()=>{"running"!==J&&(G(null),Z("idle"),Y(null))},children:"Cancel"}),(0,s.jsx)(T,{type:"button",variant:"destructive",disabled:!K||"running"===J,onClick:()=>{ab()},children:"running"===J?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Aborting..."]}):"Abort task"})]})]})}),(0,s.jsxs)("div",{className:N("pointer-events-auto absolute bottom-3 right-4 z-30 text-[11px] tracking-[0.04em] lg:bottom-4 lg:right-6","light"===tL?"text-[#8f7664]":"text-slate-500"),children:["Built on"," ",(0,s.jsx)("a",{href:"https://openclaw.ai/",target:"_blank",rel:"noreferrer",className:N("transition-colors","light"===tL?"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:N("transition-colors","light"===tL?"text-[#6f5a4b] hover:text-[#4f3d31]":"text-slate-300 hover:text-slate-100"),children:"SapienX"})]}),(0,s.jsx)(H,{open:eB,onOpenChange:e=>{"running"!==eK&&(eV(e),e||au())},children:(0,s.jsxs)(X,{className:N("max-w-[468px] gap-5 p-5 sm:p-6","light"===tL?"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)(ee,{children:[(0,s.jsx)(ea,{className:"light"===tL?"text-[#3f2f24]":"text-white",children:ae}),(0,s.jsx)(es,{className:"light"===tL?"text-[#7e6555]":"text-slate-400",children:at})]}),t7?(0,s.jsxs)("div",{className:N("space-y-4","light"===tL?"text-[#4f3d31]":"text-slate-200"),children:[(0,s.jsxs)("div",{className:N("rounded-[24px] border px-4 py-5",(c=eK,p=tL,"success"===c?"light"===p?"border-emerald-300 bg-emerald-50/80 text-emerald-950":"border-emerald-300/25 bg-emerald-300/10 text-emerald-50":"light"===p?"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:N("flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl border",(u=eK,h=tL,"success"===u?"light"===h?"border-emerald-300 bg-white/80 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"light"===h?"border-rose-300 bg-white/80 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200")),children:"success"===eK?(0,s.jsx)(l.A,{className:"h-5 w-5"}):(0,s.jsx)(o.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"===eK?"OpenClaw is up to date":"Update needs attention"}),(0,s.jsx)("p",{className:"mt-1 text-sm leading-6",children:eQ||("success"===eK?"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:N("rounded-[18px] border px-3 py-3","light"===tL?"border-white/70 bg-white/70":"border-white/10 bg-slate-950/30"),children:[(0,s.jsx)("p",{className:"light"===tL?"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",x.diagnostics.version||x.diagnostics.latestVersion||"unknown"]})]}),(0,s.jsxs)("div",{className:N("rounded-[18px] border px-3 py-3","light"===tL?"border-white/70 bg-white/70":"border-white/10 bg-slate-950/30"),children:[(0,s.jsx)("p",{className:"light"===tL?"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:t6||"unknown"})]})]})]}),(0,s.jsxs)("div",{className:N("rounded-[20px] border","light"===tL?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,s.jsxs)("div",{className:N("flex items-center justify-between border-b px-4 py-3","light"===tL?"border-[#eadccf]":"border-white/8"),children:[(0,s.jsx)("p",{className:N("text-[10px] uppercase tracking-[0.24em]","light"===tL?"text-[#9a7f6c]":"text-slate-500"),children:"Update log"}),(0,s.jsx)("span",{className:"light"===tL?"text-xs text-[#8b7262]":"text-xs text-slate-400",children:"success"===eK?"Completed":"Failed"})]}),(0,s.jsx)("pre",{className:N("max-h-[180px] overflow-auto whitespace-pre-wrap break-words px-4 py-3 font-mono text-[11px] leading-5","light"===tL?"text-[#4f3d31]":"text-slate-200"),children:eX||"No command output was captured."})]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:N("grid gap-3 sm:grid-cols-2","light"===tL?"text-[#4f3d31]":"text-slate-200"),children:[(0,s.jsxs)("div",{className:N("rounded-[20px] border px-4 py-4","light"===tL?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,s.jsx)("p",{className:N("text-[10px] uppercase tracking-[0.24em]","light"===tL?"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",x.diagnostics.latestVersion||x.diagnostics.version||"unknown"]}),(0,s.jsxs)("p",{className:"light"===tL?"mt-1 text-xs text-[#8b7262]":"mt-1 text-xs text-slate-400",children:["Current: v",x.diagnostics.version||"unknown"]})]}),(0,s.jsxs)("div",{className:N("rounded-[20px] border px-4 py-4","light"===tL?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,s.jsx)("p",{className:N("text-[10px] uppercase tracking-[0.24em]","light"===tL?"text-[#9a7f6c]":"text-slate-500"),children:"Install mode"}),(0,s.jsx)("p",{className:"mt-2 text-sm font-medium leading-6 text-inherit",children:t6||"unknown"}),(0,s.jsx)("p",{className:"light"===tL?"mt-1 text-xs text-[#8b7262]":"mt-1 text-xs text-slate-400",children:eG(x.diagnostics.updateRoot||"")||"Install root unavailable"})]})]}),(0,s.jsx)("div",{className:N("rounded-[20px] border px-4 py-3 text-sm",t3>0?"light"===tL?"border-rose-300/80 bg-rose-50 text-rose-800":"border-rose-300/25 bg-rose-300/10 text-rose-100":"light"===tL?"border-[#e3d4c8] bg-[#fffaf6] text-[#745e4f]":"border-white/8 bg-white/[0.03] text-slate-300"),children:t3>0?`${t3} running or queued runtime${1===t3?"":"s"} may be interrupted during the update.`:"No running runtimes are currently tracked, so the update risk is lower."}),t9?(0,s.jsxs)("div",{className:N("rounded-[20px] border","light"===tL?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,s.jsxs)("div",{className:N("flex items-center gap-3 border-b px-4 py-3","light"===tL?"border-[#eadccf]":"border-white/8"),children:[(0,s.jsx)("div",{className:N("flex h-9 w-9 items-center justify-center rounded-2xl border","light"===tL?"border-[#dcc6b6] bg-[#f4e8dd] text-[#7b6453]":"border-white/10 bg-white/[0.05] text-slate-200"),children:(0,s.jsx)(i.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"===tL?"text-sm font-medium text-[#4a382c]":"text-sm font-medium text-white",children:"Update in progress"}),(0,s.jsx)("p",{className:"light"===tL?"text-xs text-[#8b7262]":"text-xs text-slate-400",children:eH||"Streaming OpenClaw output..."})]})]}),(0,s.jsx)("pre",{className:N("max-h-[180px] min-h-[120px] overflow-auto whitespace-pre-wrap break-words px-4 py-3 font-mono text-[11px] leading-5","light"===tL?"text-[#4f3d31]":"text-slate-200"),children:eX||"Waiting for command output..."})]}):null]}),(0,s.jsxs)(et,{children:[(0,s.jsx)(T,{type:"button",variant:"secondary",onClick:()=>{eV(!1),au()},disabled:t9,className:"light"===tL?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",children:t7?"Done":"Cancel"}),t7?null:(0,s.jsx)(T,{type:"button",onClick:aj,disabled:t9,className:N(x.diagnostics.updateAvailable?"bg-amber-400 text-slate-950 shadow-lg shadow-amber-400/20 hover:bg-amber-300":"","light"!==tL||x.diagnostics.updateAvailable?"":"bg-[#c8946f] text-white shadow-[0_12px_28px_rgba(200,148,111,0.24)] hover:bg-[#b88461]"),children:t9?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Updating..."]}):"Update now"})]})]})})]})]})}function r9({surfaceTheme:e}){return(0,s.jsxs)("div",{className:N("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:N("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:N("text-[10px] tracking-[0.18em]","light"===e?"text-[#8a7261]":"text-slate-500"),children:"AgentOS"})]}),(0,s.jsx)("span",{"aria-hidden":"true",className:N("h-4 w-px","light"===e?"bg-[#cdb7a8]/80":"bg-white/[0.08]")}),(0,s.jsx)("h2",{className:N("font-display text-[0.88rem]","light"===e?"text-[#816958]/80":"text-slate-400/75"),children:"Mission Control"})]})}function r7({snapshot:e,surfaceTheme:t,settingsRef:a,isSettingsOpen:r,gatewayDraft:l,workspaceRootDraft:m,isSavingGateway:h,isSavingWorkspaceRoot:x,isCheckingForUpdates:g,selectedModelId:b,modelOnboardingRunState:f,gatewayControlAction:w,lastCheckedAt:v,onToggleTheme:y,onToggleSettings:j,onGatewayDraftChange:k,onWorkspaceRootDraftChange:C,onSelectedModelIdChange:S,onSaveGatewaySettings:A,onSaveWorkspaceRootSettings:I,onCheckForUpdates:M,onControlGateway:O,onOpenSetupWizard:$,onRunModelRefresh:_,onRunModelSetDefault:P,onOpenAddModels:E,onOpenUpdateDialog:D,onOpenResetDialog:L}){let U=av(e),F=null!==w,z="running"===f,W=no(t,"secondary"),q=no(t,"primary"),B=no(t,"warning"),V=no(t,"warningSolid"),K=N("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]"),G=N("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]"),J=N("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)(r9,{surfaceTheme:t}),(0,s.jsxs)("div",{ref:a,className:"pointer-events-auto relative",children:[(0,s.jsxs)("div",{className:N("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:N("text-[10px] uppercase tracking-[0.3em]","light"===t?"text-[#8a7261]":"text-slate-500"),children:"OPENCLAW"}),(0,s.jsxs)("span",{className:N("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:N("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:N("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:G,children:(0,s.jsx)("span",{className:J,children:"light"===t?(0,s.jsx)(d.A,{className:"h-3 w-3"}):(0,s.jsx)(c.A,{className:"h-3 w-3"})})}),(0,s.jsx)("button",{type:"button","aria-label":"Open settings","aria-expanded":r,"aria-haspopup":"menu",onClick:j,className:K,children:(0,s.jsx)(p.A,{className:"h-3.5 w-3.5"})})]}),r?(0,s.jsxs)("div",{role:"menu","aria-label":"OpenClaw settings",className:N("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:N("text-[8px] uppercase tracking-[0.24em]","light"===t?"text-[#9a7f6c]":"text-slate-500"),children:"Settings"}),(0,s.jsx)("h3",{className:N("mt-0.5 font-display text-[14px]","light"===t?"text-[#3f2f24]":"text-white"),children:"OpenClaw surface"})]}),(0,s.jsx)("span",{className:N("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:N("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:N("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:N("font-display text-[0.98rem]","light"===t?"text-amber-950":"text-amber-50"),children:["v",e.diagnostics.latestVersion]}),(0,s.jsxs)("p",{className:N("text-[9px]","light"===t?"text-amber-900/70":"text-amber-100/70"),children:["from v",e.diagnostics.version||"unknown"]})]})]}),(0,s.jsx)(u.A,{className:N("mt-0.5 h-4 w-4","light"===t?"text-amber-700":"text-amber-300")})]}),(0,s.jsx)("p",{className:N("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:N("mt-2.5 inline-flex items-center justify-center py-1",V),children:"Update now"})]}):null,(0,s.jsxs)("div",{className:N("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:N("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:N("font-display text-[0.88rem]","light"===t?"text-[#3f2f24]":"text-white"),children:e.diagnostics.version||"Unavailable"}),e.diagnostics.updateChannel?(0,s.jsx)("span",{className:N("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:N("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)(T,{type:"button",size:"sm",variant:"secondary",onClick:()=>{M()},disabled:g,className:N("w-full disabled:cursor-wait",e.diagnostics.updateAvailable?B:W),children:g?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Checking..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Check for updates"]})}),v?(0,s.jsxs)("p",{className:N("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:N("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:N("text-[8px] uppercase tracking-[0.18em]","light"===t?"text-[#9a7f6c]":"text-slate-500"),children:"Setup center"}),(0,s.jsx)("p",{className:N("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:N("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)(T,{type:"button",size:"sm",variant:"secondary",onClick:()=>$(e.diagnostics.rpcOk?"models":"system"),className:W,children:"Open wizard"}),(0,s.jsx)(T,{type:"button",size:"sm",variant:"secondary",disabled:z,onClick:()=>{_()},className:W,children:"Refresh setup"})]}),(0,s.jsxs)("div",{className:N("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:N("text-[11px]","light"===t?"text-[#9a7f6c]":"text-slate-400"),children:"Gateway control"}),(0,s.jsx)("p",{className:N("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:N("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)(T,{type:"button",size:"sm",variant:"secondary",disabled:F||e.diagnostics.rpcOk,onClick:()=>{O("start")},className:W,children:"start"===w?"Starting...":"Start"}),(0,s.jsx)(T,{type:"button",size:"sm",variant:"secondary",disabled:F||!e.diagnostics.loaded,onClick:()=>{O("restart")},className:W,children:"restart"===w?"Restarting...":"Restart"}),(0,s.jsx)(T,{type:"button",size:"sm",variant:"secondary",disabled:F||!e.diagnostics.loaded,onClick:()=>{O("stop")},className:W,children:"stop"===w?"Stopping...":"Stop"})]})]}),(0,s.jsxs)("div",{className:N("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:N("text-[11px]","light"===t?"text-[#9a7f6c]":"text-slate-400"),children:"Model setup"}),(0,s.jsxs)("p",{className:N("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:N("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:N("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)(T,{type:"button",size:"sm",variant:"secondary",disabled:z,onClick:()=>{P()},className:W,children:z?"Working...":"Use selected"}),(0,s.jsx)(T,{type:"button",size:"sm",variant:"secondary",disabled:z,onClick:()=>{E()},className:W,children:"Add models"})]})]})]}),(0,s.jsxs)("div",{className:N("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)(tI,{htmlFor:"workspace-root",className:N("text-[11px]","light"===t?"text-[#9a7f6c]":"text-slate-500"),children:"Workspace root"}),(0,s.jsx)("p",{className:N("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:N("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)(R,{id:"workspace-root",value:m,onChange:e=>C(e.target.value),placeholder:"~/Documents/Shared/projects",disabled:x,style:"light"===t?{colorScheme:"light"}:void 0,className:N("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:N("mt-1.5 break-all font-mono text-[9px] leading-[1rem]","light"===t?"text-[#6f5a4b]":"text-slate-300"),children:["Configured root: ",e.diagnostics.configuredWorkspaceRoot?eG(e.diagnostics.configuredWorkspaceRoot):"default"]}),(0,s.jsxs)("p",{className:N("mt-1 break-all font-mono text-[9px] leading-[1rem]","light"===t?"text-[#6f5a4b]":"text-slate-300"),children:["Effective root: ",eG(e.diagnostics.workspaceRoot)]}),(0,s.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,s.jsx)(T,{type:"button",size:"sm",variant:"secondary",disabled:x,onClick:()=>{I(null)},className:W,children:"Use default"}),(0,s.jsx)(T,{type:"button",size:"sm",disabled:x,onClick:()=>{I(m)},className:q,children:x?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Saving..."]}):"Save root"})]})]}),(0,s.jsxs)("div",{className:N("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)(tI,{htmlFor:"gateway-url",className:N("text-[11px]","light"===t?"text-[#9a7f6c]":"text-slate-500"),children:"OpenClaw gateway"}),(0,s.jsx)("p",{className:N("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:N("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)(R,{id:"gateway-url",value:l,onChange:e=>k(e.target.value),placeholder:"ws://127.0.0.1:18789",disabled:h,style:"light"===t?{colorScheme:"light"}:void 0,className:N("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:N("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:N("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)(T,{type:"button",size:"sm",variant:"secondary",disabled:h,onClick:()=>{A(null)},className:W,children:"Use local"}),(0,s.jsx)(T,{type:"button",size:"sm",disabled:h,onClick:()=>{A(l)},className:q,children:h?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Saving..."]}):"Save gateway"})]})]}),(0,s.jsxs)("div",{className:N("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:N("text-[8px] uppercase tracking-[0.18em]","light"===t?"text-rose-700/80":"text-rose-200/75"),children:"Danger zone"}),(0,s.jsx)("p",{className:N("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)(o.A,{className:N("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)(T,{type:"button",size:"sm",variant:"secondary",onClick:()=>L("mission-control"),className:N("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)(T,{type:"button",size:"sm",variant:"secondary",onClick:()=>L("full-uninstall"),className:N("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 ne(e){return e.mission?.trim()?e.mission.trim():e.title.trim()?e.title.trim():e.subtitle.trim()||"Continue this task."}function nt(e){let t,a;if(t="string"==typeof e.metadata.dispatchStatus?e.metadata.dispatchStatus:null,a=e.status,"cancelled"===t||"aborted"===t||"cancelled"===a||"aborted"===a)return!1;let s=e.status;return"running"===s||"queued"===s}function na(e,t){let a,s=(Array.isArray(a=e.metadata.optimisticEvents)?a.filter(nr):[]).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 ns(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 nr(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 nn(e,t){let a=e.replace(/\s+/g," ").trim();return a.length<=t?a:`${a.slice(0,Math.max(t-1,1)).trimEnd()}…`}function ni(e){return(e.diagnostics.configuredGatewayUrl||e.diagnostics.gatewayUrl).replace(/\/$/,"")}function nl(e){return eG(e.diagnostics.configuredWorkspaceRoot||e.diagnostics.workspaceRoot)}function no(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?N(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?N(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?N(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"):N(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")}},7442:(e,t,a)=>{Promise.resolve().then(a.bind(a,6817))}},e=>{e.O(0,[751,708,583,805,807,424,358],()=>e(e.s=7442)),_N_E=e.O()}]);
|