@sapienx/agentos 0.4.1 → 0.4.6
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/LICENSE +21 -0
- package/README.md +2 -0
- package/bundle/.next/BUILD_ID +1 -1
- package/bundle/.next/app-path-routes-manifest.json +12 -9
- package/bundle/.next/build-manifest.json +6 -6
- package/bundle/.next/prerender-manifest.json +3 -3
- package/bundle/.next/react-loadable-manifest.json +4 -4
- package/bundle/.next/routes-manifest.json +20 -0
- package/bundle/.next/server/app/_global-error/page.js +3 -3
- package/bundle/.next/server/app/_global-error/page.js.nft.json +1 -1
- 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 +7 -7
- package/bundle/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
- package/bundle/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +2 -2
- package/bundle/.next/server/app/_global-error.segments/_global-error.segment.rsc +3 -3
- package/bundle/.next/server/app/_global-error.segments/_head.segment.rsc +3 -3
- package/bundle/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
- 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.js.nft.json +1 -1
- 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 +11 -11
- package/bundle/.next/server/app/_not-found.segments/_full.segment.rsc +11 -11
- package/bundle/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
- package/bundle/.next/server/app/_not-found.segments/_index.segment.rsc +5 -5
- package/bundle/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/bundle/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
- package/bundle/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/bundle/.next/server/app/api/agents/[agentId]/chat/route.js +5 -5
- package/bundle/.next/server/app/api/agents/[agentId]/chat/route.js.nft.json +1 -1
- 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/files/reveal/route.js.nft.json +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/catalog/route.js +2 -1
- package/bundle/.next/server/app/api/models/catalog/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 +5 -5
- 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 +1 -3
- package/bundle/.next/server/app/api/openclaw/capabilities/route.js.nft.json +1 -1
- 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 +3 -3
- 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/openclaw-binary/route.js +1 -0
- package/bundle/.next/server/app/api/settings/openclaw-binary/route.js.nft.json +1 -0
- package/bundle/.next/server/app/api/settings/openclaw-binary/route_client-reference-manifest.js +1 -0
- 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/system/open-terminal/route.js.nft.json +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 +7 -4
- 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 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/discovered-groups/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/route.js +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/route.js.nft.json +1 -1
- 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/[workspaceId]/files/route.js +1 -0
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/files/route.js.nft.json +1 -0
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/files/route_client-reference-manifest.js +1 -0
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/discovery/route.js +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/discovery/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 +2 -194
- 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/settings/page.js +2 -0
- package/bundle/.next/server/app/settings/page.js.nft.json +1 -0
- package/bundle/.next/server/app/settings/page_client-reference-manifest.js +1 -0
- package/bundle/.next/server/app-paths-manifest.json +12 -9
- package/bundle/.next/server/chunks/1721.js +186 -0
- package/bundle/.next/server/chunks/1813.js +1 -0
- package/bundle/.next/server/chunks/2908.js +1 -0
- package/bundle/.next/server/chunks/4741.js +18 -0
- package/bundle/.next/server/chunks/63.js +45 -0
- package/bundle/.next/server/chunks/6645.js +11 -0
- package/bundle/.next/server/chunks/6892.js +98 -0
- package/bundle/.next/server/chunks/707.js +1 -0
- package/bundle/.next/server/chunks/737.js +173 -0
- package/bundle/.next/server/chunks/8064.js +2 -0
- package/bundle/.next/server/chunks/8884.js +255 -0
- package/bundle/.next/server/chunks/9281.js +15 -0
- package/bundle/.next/server/functions-config-manifest.json +2 -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/server/webpack-runtime.js +1 -1
- package/bundle/.next/static/chunks/1287.facd47073fd9ee28.js +1 -0
- package/bundle/.next/static/chunks/1a258343.31cec7fec82d82e7.js +1 -0
- package/bundle/.next/static/chunks/3272.c112ebf2cc12c74d.js +1 -0
- package/bundle/.next/static/chunks/3513-9f504a6f64a919df.js +15 -0
- package/bundle/.next/static/chunks/3794-318642842e814c21.js +32 -0
- package/bundle/.next/static/chunks/4bd1b696-c2f6e0877b6c10aa.js +1 -0
- package/bundle/.next/static/chunks/6609-1948800b7ad9f570.js +1 -0
- package/bundle/.next/static/chunks/9281-33f8488964e956b3.js +186 -0
- package/bundle/.next/static/chunks/app/_global-error/page-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/_not-found/page-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/agents/[agentId]/chat/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/agents/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/diagnostics/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/files/reveal/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/gateway/control/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/mission/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/models/catalog/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/models/providers/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/onboarding/models/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/onboarding/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/openclaw/capabilities/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/planner/[planId]/deploy/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/planner/[planId]/document-rewrite/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/planner/[planId]/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/planner/[planId]/simulate/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/planner/[planId]/turn/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/planner/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/reset/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/runtimes/[runtimeId]/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/settings/gateway/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/settings/openclaw-binary/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/settings/workspace-root/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/snapshot/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/stream/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/system/open-terminal/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/tasks/[taskId]/abort/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/tasks/[taskId]/stream/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/update/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/discovered-groups/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/edit-draft/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/files/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/surfaces/discovery/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/api/workspaces/route-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/layout-7e58cd41078411bc.js +1 -0
- package/bundle/.next/static/chunks/app/not-found-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/app/page-f7cd75289fd01742.js +1 -0
- package/bundle/.next/static/chunks/app/settings/page-8b8870f1f797eded.js +1 -0
- package/bundle/.next/static/chunks/ede5dfc2-bfa57fc44787fda0.js +1 -0
- package/bundle/.next/static/chunks/framework-d1de002210ddaaef.js +1 -0
- package/bundle/.next/static/chunks/main-app-e5953317e55d16ab.js +1 -0
- package/bundle/.next/static/chunks/main-cdd9e49cf451f30f.js +5 -0
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/app-error-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/forbidden-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/global-error-bd2008378c5c1f7c.js +1 -0
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/unauthorized-b0e9d273dcff17f5.js +1 -0
- package/bundle/.next/static/chunks/{webpack-e0accbaa78fb0b56.js → webpack-18bf7c24ea50f9e6.js} +1 -1
- package/bundle/.next/static/css/e7b71a4de4ff8d92.css +3 -0
- package/bundle/.next/static/mwHPYd8h5FgBicMwCH---/_buildManifest.js +1 -0
- package/bundle/package.json +4 -0
- package/bundle/public/assets/openclaw.png +0 -0
- package/bundle/public/assets/screenshots/0.jpeg +0 -0
- package/bundle/public/assets/screenshots/1.jpeg +0 -0
- package/bundle/public/assets/screenshots/2.jpeg +0 -0
- package/bundle/public/assets/screenshots/3.jpeg +0 -0
- package/bundle/public/assets/screenshots/4_1.jpeg +0 -0
- package/bundle/public/assets/screenshots/5.jpeg +0 -0
- package/bundle/public/assets/screenshots/6.jpeg +0 -0
- package/bundle/public/assets/screenshots/7.jpeg +0 -0
- package/bundle/public/readme/readme.jpeg +0 -0
- package/package.json +2 -1
- package/bundle/.next/server/chunks/199.js +0 -412
- package/bundle/.next/server/chunks/35.js +0 -45
- package/bundle/.next/server/chunks/408.js +0 -18
- package/bundle/.next/server/chunks/639.js +0 -98
- package/bundle/.next/server/chunks/661.js +0 -1
- package/bundle/.next/server/chunks/678.js +0 -1
- package/bundle/.next/server/chunks/825.js +0 -1
- package/bundle/.next/static/9OX9mutnH1gpbuj6hICVB/_buildManifest.js +0 -1
- package/bundle/.next/static/chunks/2999.fef298fbe30cd4bd.js +0 -1
- package/bundle/.next/static/chunks/4424-08671f25c8f9ae84.js +0 -32
- package/bundle/.next/static/chunks/4a846800.17bbc9efb621dbb7.js +0 -1
- package/bundle/.next/static/chunks/5261.29ae1e1fe185a617.js +0 -1
- package/bundle/.next/static/chunks/7963-6bd42810c5733ae8.js +0 -15
- package/bundle/.next/static/chunks/8583-0efb0aa0937b762c.js +0 -1
- package/bundle/.next/static/chunks/app/_global-error/page-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/_not-found/page-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/agents/[agentId]/chat/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/agents/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/diagnostics/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/files/reveal/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/gateway/control/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/mission/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/models/catalog/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/models/providers/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/onboarding/models/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/onboarding/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/openclaw/capabilities/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/planner/[planId]/deploy/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/planner/[planId]/document-rewrite/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/planner/[planId]/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/planner/[planId]/simulate/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/planner/[planId]/turn/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/planner/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/reset/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/runtimes/[runtimeId]/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/settings/gateway/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/settings/workspace-root/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/snapshot/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/stream/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/system/open-terminal/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/tasks/[taskId]/abort/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/tasks/[taskId]/stream/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/update/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/discovered-groups/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/edit-draft/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/surfaces/discovery/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/api/workspaces/route-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/layout-7c2d7e515f68248b.js +0 -1
- package/bundle/.next/static/chunks/app/not-found-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/app/page-7bc93c9b4ee30f58.js +0 -179
- package/bundle/.next/static/chunks/d08e407b-a7a2691dd8d9de6b.js +0 -1
- package/bundle/.next/static/chunks/f6503f1c-7df4e7c4564148dc.js +0 -1
- package/bundle/.next/static/chunks/framework-c8a5f18418cd0e86.js +0 -1
- package/bundle/.next/static/chunks/main-app-9a4481b0ab7b57f6.js +0 -1
- package/bundle/.next/static/chunks/main-eb49e7f5b314b5dc.js +0 -5
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/app-error-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/forbidden-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/global-error-38aa72b47d0b8f99.js +0 -1
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/unauthorized-cde9c645dcfceb9f.js +0 -1
- package/bundle/.next/static/css/9f1b31fd4086df59.css +0 -3
- /package/bundle/.next/static/{9OX9mutnH1gpbuj6hICVB → mwHPYd8h5FgBicMwCH---}/_ssgManifest.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/at-rule.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/comment.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/container.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/css-syntax-error.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/declaration.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/document.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/fromJSON.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/input.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/lazy-result.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/list.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/map-generator.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/no-work-result.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/node.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/parse.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/parser.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/postcss.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/previous-map.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/processor.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/result.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/root.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/rule.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/stringifier.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/stringify.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/symbols.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/terminal-highlight.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/tokenize.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/warn-once.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/lib/warning.js +0 -0
- /package/bundle/node_modules/{postcss → next/node_modules/postcss}/package.json +0 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
exports.id=1721,exports.ids=[1721],exports.modules={4648:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,81921,23))},9983:(a,b,c)=>{Promise.resolve().then(c.bind(c,78339))},29766:(a,b,c)=>{Promise.resolve().then(c.bind(c,85561))},32056:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>m,metadata:()=>l,viewport:()=>k});var d=c(5735),e=c(85561);c(82704);let f="AgentOS | Control Plane",g="Human Control Layer for AI Agents and Companies | Built on OpenClaw.",h="/readme/readme.jpeg",i=process.env.NEXT_PUBLIC_SITE_URL??process.env.VERCEL_URL,j=new URL(i?i.startsWith("http")?i:`https://${i}`:"http://localhost:3000"),k={themeColor:"#09101c"},l={metadataBase:j,title:f,description:g,applicationName:"AgentOS | Control Plane",manifest:"/site.webmanifest",openGraph:{type:"website",siteName:"AgentOS | Control Plane",title:f,description:g,images:[{url:h,width:1536,height:1024,alt:"AgentOS control-plane interface"}]},twitter:{card:"summary_large_image",title:f,description:g,images:[h]},icons:{icon:[{url:"/favicon.ico",sizes:"any"},{url:"/favicon-16x16.png",sizes:"16x16",type:"image/png"},{url:"/favicon-32x32.png",sizes:"32x32",type:"image/png"}],apple:[{url:"/apple-touch-icon.png",sizes:"180x180",type:"image/png"}],shortcut:["/favicon.ico"]}};function m({children:a}){return(0,d.jsx)("html",{lang:"en",className:"dark",suppressHydrationWarning:!0,children:(0,d.jsxs)("body",{children:[a,(0,d.jsx)(e.Toaster,{theme:"dark",richColors:!0,closeButton:!0})]})})}},37548:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(5735);function e(){return(0,d.jsx)("main",{className:"flex min-h-screen items-center justify-center bg-[#050816] px-6 text-white",children:(0,d.jsxs)("div",{className:"rounded-[24px] border border-white/10 bg-white/[0.03] px-8 py-10 text-center shadow-[0_24px_80px_rgba(0,0,0,0.35)] backdrop-blur-xl",children:[(0,d.jsx)("p",{className:"text-[11px] uppercase tracking-[0.32em] text-slate-500",children:"OpenClaw"}),(0,d.jsx)("h1",{className:"mt-3 font-display text-3xl",children:"Page not found"}),(0,d.jsx)("p",{className:"mt-3 max-w-md text-sm leading-6 text-slate-400",children:"The requested AgentOS route does not exist in this workspace."})]})})}},41096:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,95547,23))},46935:(a,b,c)=>{Promise.resolve().then(c.bind(c,85359))},47918:(a,b,c)=>{Promise.resolve().then(c.bind(c,99703))},61872:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,95547,23)),Promise.resolve().then(c.t.bind(c,15098,23)),Promise.resolve().then(c.t.bind(c,47644,23)),Promise.resolve().then(c.t.bind(c,33859,23)),Promise.resolve().then(c.t.bind(c,98099,23)),Promise.resolve().then(c.t.bind(c,16237,23)),Promise.resolve().then(c.t.bind(c,98562,23)),Promise.resolve().then(c.t.bind(c,36675,23))},78339:(a,b,c)=>{"use strict";c.d(b,{MissionControlShell:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call MissionControlShell() from the server but MissionControlShell is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/kazimakgul/Documents/GitHub/AgentOS/components/mission-control/mission-control-shell.tsx","MissionControlShell")},82704:()=>{},85359:(a,b,c)=>{"use strict";c.d(b,{MissionControlShell:()=>hY});var d=c(48249),e=c(41479),f=c(69924),g=c(67484),h=c(40560),i=c(66400),j=c(15273),k=c(93026),l=c(10316),m=c(82483),n=c(42742),o=c(31675),p=c(21654),q=c(99314),r=c(96862);function s(...a){return(0,r.QP)((0,q.$)(a))}let t=(0,p.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 u({className:a,variant:b,...c}){return(0,d.jsx)("div",{className:s(t({variant:b}),a),...c})}var v=c(43980);let w=(0,p.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"}}),x=g.forwardRef(({className:a,variant:b,size:c,asChild:e=!1,...f},g)=>{let h=e?v.DX:"button";return(0,d.jsx)(h,{className:s(w({variant:b,size:c,className:a})),ref:g,...f})});x.displayName="Button";let y=g.forwardRef(({className:a,type:b,...c},e)=>(0,d.jsx)("input",{type:b,className:s("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",a),ref:e,...c}));y.displayName="Input";let z=[{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:"google",label:"Gemini",shortLabel:"Gemini",description:"Add a Gemini API key, discover Google models, and pick the routes you want.",category:"other",connectKind:"apiKey",accent:"from-[#e6f7ff] via-[#f4fbff] to-white",helperText:"Simple API key connection.",searchPlaceholder:"Search Gemini models"},{id:"deepseek",label:"DeepSeek",shortLabel:"DeepSeek",description:"Add a DeepSeek API key, discover the catalog, and add the models you need.",category:"other",connectKind:"apiKey",accent:"from-[#e7eeff] via-[#f4f7ff] to-white",helperText:"Simple API key connection.",searchPlaceholder:"Search DeepSeek models"},{id:"mistral",label:"Mistral",shortLabel:"Mistral",description:"Add a Mistral API key, discover Mistral and Codestral models, and curate your routes.",category:"other",connectKind:"apiKey",accent:"from-[#f2e8ff] via-[#fbf7ff] to-white",helperText:"Simple API key connection.",searchPlaceholder:"Search Mistral models"},{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."}];function A(a){let b=z.find(b=>b.id===a);if(!b)throw Error(`Unknown model provider: ${a}`);return b}function B(a){return"string"==typeof a&&z.some(b=>b.id===a)}function C(a){if("gemini"===a)return"google";if(B(a))return a;if(a&&"object"==typeof a&&"id"in a){let b=a.id;if("gemini"===b)return"google";if(B(b))return b}return null}function D(a){let b=z.find(b=>b.id===a);return b?b.shortLabel:a.split("-").map(a=>a?a[0].toUpperCase()+a.slice(1):a).join(" ")}z.filter(a=>"primary"===a.category),z.filter(a=>"other"===a.category);var E=c(89964);function F(a,b=Date.now()){return null==a||Number.isNaN(a)?"No activity":`${(0,E.k)(a,b,{addSuffix:!0})}`}function G(a){if(!a)return Date.now();let b=Date.parse(a);return Number.isNaN(b)?Date.now():b}function H(a){return a?a>=1e3?`${Math.round(a/1e3)}k`:String(a):"n/a"}function I(a){return a.split("/").at(1)||a}function J(a){return a.name?.trim()||a.identityName?.trim()||"OpenClaw"}function K(a){switch(a){case"running":return"default";case"completed":return"success";case"cancelled":return"danger";case"stalled":return"warning";default:return"muted"}}function L(a,b=8){return a?a.length<=b?a:a.slice(0,b):"n/a"}function M(a){return a.replace(/^\/Users\/[^/]+/,"~")}let N=[/^Task output routing:/i,/^Agent operating policy:/i];function O(a,b=64){if(!a)return"";let c=function(a){let b=a.replace(/\r\n/g,"\n").trim();if(!b)return"";let c=[];for(let a of b.split("\n")){let b=a.trim();if(N.some(a=>a.test(b)))break;c.push(a)}return c.join(" ").replace(/\s+/g," ").trim()}(a);return c?c.length<=b?c:`${c.slice(0,Math.max(b-1,1)).trimEnd()}…`:""}function P({models:a,selectedModelIds:b,search:c,onSearchChange:e,onToggleModel:f,onAddSelected:g,onOpenProviders:i,onLoadMore:j,visibleModelCount:k,isAdding:p,isLoading:q}){let r,t=(r=c.trim().toLowerCase())?a.filter(a=>`${a.name} ${a.id} ${a.provider} ${a.input} ${a.tags.join(" ")}`.toLowerCase().includes(r)):a,v=c.trim().length>0,w=v?t:t.slice(0,k),z=!v&&k<t.length,C=t.length-k,E=b.filter(b=>{let c=a.find(a=>a.id===b);return!!c&&!c.alreadyAdded}).length,F=new Set(a.map(a=>a.provider)).size,G=a.filter(a=>a.alreadyAdded).length;return(0,d.jsxs)("div",{className:"rounded-[18px] border border-white/10 bg-[linear-gradient(180deg,rgba(10,15,26,0.94),rgba(7,11,20,0.96))] p-3",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-display text-[0.84rem] text-white",children:"Catalog"}),(0,d.jsx)("p",{className:"mt-1 text-[10px] leading-[0.98rem] text-slate-400",children:"Browse the full OpenClaw catalog. Unavailable entries show which provider setup is missing."})]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[(0,d.jsxs)(u,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:[a.length," models"]}),(0,d.jsxs)(u,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:[F," providers"]}),(0,d.jsxs)(u,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:[G," added"]})]})]}),(0,d.jsxs)("div",{className:"relative mt-3",children:[(0,d.jsx)(l.A,{className:"pointer-events-none absolute left-3 top-1/2 h-3 w-3 -translate-y-1/2 text-slate-500"}),(0,d.jsx)(y,{value:c,onChange:a=>e(a.target.value),placeholder:"Search all discovered models",className:"h-8 pl-8 text-[11px]"})]}),q?(0,d.jsxs)("div",{className:"mt-3 rounded-[16px] border border-white/10 bg-white/[0.03] px-3 py-5 text-center text-[11px] text-slate-400",children:[(0,d.jsx)(h.A,{className:"mx-auto mb-2 h-4 w-4 animate-spin text-slate-400"}),"Loading OpenClaw catalog..."]}):w.length>0?(0,d.jsxs)("div",{className:"mt-3 max-h-[min(38vh,340px)] space-y-1 overflow-y-auto pr-1",children:[w.map(a=>{var c,e;let g=b.includes(a.id),h=a.alreadyAdded,i=!h&&(!1===a.available||a.missing),j=B(a.provider)?A(a.provider):null,k=(c=a,e=j?.shortLabel??a.provider,c.missing?`${e} is configured, but this model is not available locally yet. You can still add it now, then finish setup in Providers.`:!1===c.available?`${e} needs a one-time setup before this model can be used. You can add it now, then connect it in Add Models > Providers.`:"");return(0,d.jsxs)("button",{type:"button",disabled:h,"aria-pressed":g,onClick:()=>{h||f(a.provider,a.id)},className:s("flex w-full items-start justify-between gap-2 rounded-[14px] border px-2.5 py-2 text-left transition-all",h?"cursor-not-allowed border-white/8 bg-white/[0.02] opacity-70":g?"border-cyan-300/35 bg-cyan-300/[0.08]":i?"border-amber-300/20 bg-amber-300/[0.06] hover:border-amber-300/30 hover:bg-amber-300/[0.08]":"border-white/8 bg-white/[0.03] hover:border-white/16 hover:bg-white/[0.05]"),children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[(0,d.jsx)("div",{className:s("mt-0.5 flex h-[16px] w-[16px] shrink-0 items-center justify-center rounded-md border",h?"border-white/10 bg-white/[0.03] text-slate-500":g?"border-cyan-300/50 bg-cyan-300/15 text-cyan-100":i?"border-amber-300/30 bg-amber-300/10 text-amber-100":"border-white/12 bg-white/[0.03] text-transparent"),children:h?(0,d.jsx)(m.A,{className:"h-2 w-2"}):g?(0,d.jsx)(n.A,{className:"h-2 w-2"}):(0,d.jsx)(o.A,{className:"h-2 w-2"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[11px] font-medium text-white",children:a.name}),(0,d.jsx)("p",{className:"mt-0.5 truncate text-[9px] uppercase tracking-[0.16em] text-slate-500",children:a.id}),(0,d.jsxs)("div",{className:"mt-1 flex flex-wrap gap-1.5 text-[9px] text-slate-400",children:[(0,d.jsx)("span",{children:D(a.provider)}),a.input?(0,d.jsx)("span",{children:a.input}):null,a.contextWindow?(0,d.jsxs)("span",{children:[H(a.contextWindow)," ctx"]}):null]}),i?(0,d.jsx)("p",{className:"mt-1 text-[9px] leading-4 text-amber-100/85",children:k}):null]})]}),(0,d.jsx)("div",{className:"shrink-0",children:h?(0,d.jsx)(u,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Already added"}):i?(0,d.jsx)(u,{variant:"warning",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Needs setup"}):a.recommended?(0,d.jsx)(u,{variant:"default",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Recommended"}):a.local?(0,d.jsx)(u,{variant:"success",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Local"}):(0,d.jsx)(u,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Remote"})})]},a.id)}),z?(0,d.jsx)("div",{className:"pt-2",children:(0,d.jsxs)(x,{type:"button",variant:"secondary",onClick:j,className:"h-8 w-full rounded-full px-3 text-[10px]",children:["Load ",Math.min(5,C)," more"]})}):null]}):(0,d.jsxs)("div",{className:"mt-3 rounded-[16px] border border-dashed border-white/10 bg-white/[0.03] px-3 py-5 text-center text-[11px] text-slate-400",children:[c.trim()?"No models matched this search.":"OpenClaw did not return any supported models yet.",(0,d.jsx)("div",{className:"mt-3",children:(0,d.jsx)(x,{type:"button",variant:"secondary",className:"h-8 rounded-full px-3 text-[10px]",onClick:()=>i(),children:"Open providers"})})]}),(0,d.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2 border-t border-white/10 pt-3",children:[(0,d.jsx)("p",{className:"text-[9px] leading-4 text-slate-400",children:E>0?`${E} model${1===E?"":"s"} selected`:"Choose one or more models to add"}),(0,d.jsx)(x,{type:"button",onClick:g,disabled:0===E||p,className:"h-7 rounded-full px-2.5 text-[10px]",children:p?"Adding...":"Add selected models"})]})]})}var Q=c(39210);let R=Q.bL,S=g.forwardRef(({className:a,...b},c)=>(0,d.jsx)(Q.B8,{ref:c,className:s("inline-flex h-11 items-center rounded-2xl border border-white/10 bg-white/5 p-1 text-slate-400",a),...b}));S.displayName=Q.B8.displayName;let T=g.forwardRef(({className:a,...b},c)=>(0,d.jsx)(Q.l9,{ref:c,className:s("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",a),...b}));T.displayName=Q.l9.displayName;let U=g.forwardRef(({className:a,...b},c)=>(0,d.jsx)(Q.UC,{ref:c,className:s("mt-4 outline-none focus-visible:ring-0",a),...b}));function V(a,b){let c=b.trim().toLowerCase();return c?a.filter(a=>`${a.name} ${a.id} ${a.tags.join(" ")}`.toLowerCase().includes(c)):a}function W({provider:a,models:b,selectedModelIds:c,search:e,onSearchChange:f,onToggleModel:g,onAddSelected:h,isAdding:i}){let j=b.filter(a=>a.recommended),k=c.filter(a=>!b.find(b=>b.id===a)?.alreadyAdded).length,m="openrouter"===a,n=A(a).searchPlaceholder,o=b.length>8||!!n,p=V(j,e),q=V(b,e);return(0,d.jsxs)("div",{className:"rounded-[18px] border border-white/10 bg-[linear-gradient(180deg,rgba(10,15,26,0.94),rgba(7,11,20,0.96))] p-3",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,d.jsx)("div",{children:(0,d.jsx)("p",{className:"font-display text-[0.84rem] text-white",children:"Select models to add"})}),(0,d.jsxs)(u,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:[b.filter(a=>a.alreadyAdded).length," already added"]})]}),o?(0,d.jsxs)("div",{className:"relative mt-3",children:[(0,d.jsx)(l.A,{className:"pointer-events-none absolute left-3 top-1/2 h-3 w-3 -translate-y-1/2 text-slate-500"}),(0,d.jsx)(y,{value:e,onChange:a=>f(a.target.value),placeholder:n??"Search models",className:"h-8 pl-8 text-[11px]"})]}):null,m?(0,d.jsxs)(R,{defaultValue:"recommended",className:"mt-3",children:[(0,d.jsxs)(S,{className:"h-8 rounded-[16px] p-0.5",children:[(0,d.jsx)(T,{value:"recommended",className:"rounded-[13px] px-2 py-1 text-[10px]",children:"Recommended"}),(0,d.jsx)(T,{value:"all",className:"rounded-[13px] px-2 py-1 text-[10px]",children:"All models"})]}),(0,d.jsx)(U,{value:"recommended",children:(0,d.jsx)(X,{models:p,selectedModelIds:c,onToggleModel:g,emptyMessage:"No recommended matches. Switch to All models to browse the full catalog."})}),(0,d.jsx)(U,{value:"all",children:(0,d.jsx)(X,{models:q,selectedModelIds:c,onToggleModel:g,emptyMessage:"No models matched this search."})})]}):(0,d.jsx)("div",{className:"mt-3",children:(0,d.jsx)(X,{models:q,selectedModelIds:c,onToggleModel:g,emptyMessage:"No models matched this search."})}),(0,d.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2 border-t border-white/10 pt-3",children:[(0,d.jsx)("p",{className:"text-[9px] leading-4 text-slate-400",children:k>0?`${k} model${1===k?"":"s"} selected`:"Choose at least one model to add"}),(0,d.jsx)(x,{type:"button",onClick:h,disabled:0===k||i,className:"h-7 rounded-full px-2.5 text-[10px]",children:i?"Adding...":"Add selected models"})]})]})}function X({models:a,selectedModelIds:b,onToggleModel:c,emptyMessage:e}){return 0===a.length?(0,d.jsx)("div",{className:"rounded-[16px] border border-dashed border-white/10 bg-white/[0.03] px-3 py-5 text-center text-[11px] text-slate-400",children:e}):(0,d.jsx)("div",{className:"max-h-[min(28vh,220px)] space-y-1 overflow-y-auto pr-1",children:a.map(a=>{var e;let f=b.includes(a.id),g=!a.alreadyAdded&&(!1===a.available||a.missing);return(0,d.jsxs)("button",{type:"button",disabled:a.alreadyAdded,onClick:()=>c(a.id),className:s("flex w-full items-start justify-between gap-2 rounded-[14px] border px-2.5 py-2 text-left transition-all",a.alreadyAdded?"cursor-not-allowed border-white/8 bg-white/[0.02] opacity-70":f?"border-cyan-300/35 bg-cyan-300/[0.08]":g?"border-amber-300/20 bg-amber-300/[0.06] hover:border-amber-300/30 hover:bg-amber-300/[0.08]":"border-white/8 bg-white/[0.03] hover:border-white/16 hover:bg-white/[0.05]"),children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[(0,d.jsx)("div",{className:s("mt-0.5 flex h-[16px] w-[16px] shrink-0 items-center justify-center rounded-md border",a.alreadyAdded?"border-white/10 bg-white/[0.03] text-slate-500":f?"border-cyan-300/50 bg-cyan-300/15 text-cyan-100":g?"border-amber-300/30 bg-amber-300/10 text-amber-100":"border-white/12 bg-white/[0.03] text-transparent"),children:a.alreadyAdded?(0,d.jsx)(m.A,{className:"h-2 w-2"}):f?(0,d.jsx)(n.A,{className:"h-2 w-2"}):(0,d.jsx)(o.A,{className:"h-2 w-2"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[11px] font-medium text-white",children:a.name}),(0,d.jsx)("p",{className:"mt-0.5 truncate text-[9px] uppercase tracking-[0.16em] text-slate-500",children:a.id}),(0,d.jsxs)("div",{className:"mt-1 flex flex-wrap gap-1.5 text-[9px] text-slate-400",children:[(0,d.jsx)("span",{children:a.input}),a.contextWindow?(0,d.jsxs)("span",{children:[Intl.NumberFormat().format(a.contextWindow)," ctx"]}):null,a.isFree?(0,d.jsx)("span",{children:"free"}):null]}),g?(0,d.jsx)("p",{className:"mt-1 text-[9px] leading-4 text-amber-100/85",children:(e=a).missing?"This model is configured, but not available locally yet. You can still add it now, then finish setup in Providers.":!1===e.available?"This model needs provider setup before it will work. You can add it now, then connect the provider in Add Models > Providers.":""}):null]})]}),(0,d.jsx)("div",{className:"shrink-0",children:a.alreadyAdded?(0,d.jsx)(u,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Already added"}):g?(0,d.jsx)(u,{variant:"warning",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Needs setup"}):a.recommended?(0,d.jsx)(u,{variant:"default",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Recommended"}):a.local?(0,d.jsx)(u,{variant:"success",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Local"}):(0,d.jsx)(u,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Remote"})})]},a.id)})})}U.displayName=Q.UC.displayName;var Y=c(81220),Z=c(86742);let $={"openai-codex":{kind:"image",src:"/assets/provider-logos/openai.svg"},openai:{kind:"image",src:"/assets/provider-logos/openai.svg"},anthropic:{kind:"simple",icon:_("siAnthropic","Anthropic")},google:{kind:"simple",icon:_("siGooglegemini","Gemini")},gemini:{kind:"simple",icon:_("siGooglegemini","Gemini")},deepseek:{kind:"image",src:"/assets/provider-logos/deepseek.svg"},mistral:{kind:"simple",icon:_("siMistralai","Mistral")},openrouter:{kind:"simple",icon:_("siOpenrouter","OpenRouter")},ollama:{kind:"simple",icon:_("siOllama","Ollama")},xai:{kind:"image",src:"/assets/provider-logos/xai.svg"}};function _(a,b){let c=Z[a];return c||{title:b,hex:"ffffff",path:"M0 0h24v24H0z"}}function aa({provider:a,className:b}){let c=$[a.trim().toLowerCase()];return c?(0,d.jsx)("div",{className:s("flex shrink-0 items-center justify-center overflow-hidden rounded-[16px] border border-black/5 bg-white/95 text-slate-900 shadow-[0_1px_1px_rgba(0,0,0,0.04)]",b),"aria-hidden":"true",children:"image"===c.kind?(0,d.jsx)(Y.default,{src:c.src,alt:"",width:18,height:18,className:"h-[72%] w-[72%] select-none object-contain",unoptimized:!0}):(0,d.jsx)("svg",{viewBox:"0 0 24 24",className:"h-[72%] w-[72%] select-none",fill:`#${c.icon.hex}`,children:(0,d.jsx)("path",{d:c.icon.path})})}):null}function ab({descriptor:a,active:b,compact:c=!1,micro:e=!1,connected:f=!1,detail:g,onClick:h}){return(0,d.jsxs)("button",{type:"button",onClick:h,className:s("group w-full rounded-[20px] border text-left transition-all",e?"rounded-[16px] p-1.5":c?"p-2.5":"p-3.5",b?e?"border-cyan-300/40 bg-[linear-gradient(180deg,rgba(23,32,52,0.98),rgba(11,18,31,0.98))] shadow-[0_8px_16px_rgba(10,16,28,0.18)]":c?"border-cyan-300/40 bg-[linear-gradient(180deg,rgba(23,32,52,0.98),rgba(11,18,31,0.98))] shadow-[0_12px_26px_rgba(10,16,28,0.22)]":"border-cyan-300/40 bg-[linear-gradient(180deg,rgba(23,32,52,0.98),rgba(11,18,31,0.98))] shadow-[0_16px_36px_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,d.jsxs)("div",{className:s("flex items-start justify-between",e?"gap-1.5":"gap-2.5"),children:[(0,d.jsx)(aa,{className:s(e?"h-5 w-5":c?"h-7 w-7":"h-9 w-9",b?"ring-1 ring-cyan-300/20":""),provider:a.id}),(0,d.jsx)(u,{variant:f?"success":b?"default":"muted",className:s("tracking-[0.12em]",e?"px-1 py-0.5 text-[7px]":c?"px-1.5 py-0.5 text-[9px]":"px-2 py-0.5 text-[10px]"),children:f?"Connected":b?"Selected":"Provider"})]}),(0,d.jsxs)("div",{className:s(e?"mt-1.5":c?"mt-2":"mt-3.5"),children:[(0,d.jsx)("p",{className:s("font-display text-white",e?"text-[0.72rem]":c?"text-[0.82rem]":"text-[0.94rem]"),children:a.label}),(0,d.jsx)("p",{className:s("mt-1 text-slate-300",e?"line-clamp-2 text-[8px] leading-[0.85rem]":c?"text-[9px] leading-[0.95rem]":"text-[11px] leading-5"),children:a.description}),(0,d.jsx)("p",{className:s("mt-2.5 uppercase tracking-[0.18em] text-slate-500",e?"line-clamp-1 text-[7px]":c?"text-[8px]":"text-[9px]"),children:g||a.helperText})]})]})}var ac=c(25358),ad=c(46674);let ae=ac.bL,af=ac.l9,ag=ac.ZL,ah=ac.bm,ai=g.forwardRef(({className:a,...b},c)=>(0,d.jsx)(ac.hJ,{ref:c,className:s("fixed inset-0 z-50 bg-slate-950/75 backdrop-blur-md",a),...b}));ai.displayName=ac.hJ.displayName;let aj=g.forwardRef(({className:a,children:b,overlayClassName:c,closeClassName:e,...f},g)=>(0,d.jsxs)(ag,{children:[(0,d.jsx)(ai,{className:c}),(0,d.jsxs)(ac.UC,{ref:g,className:s("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",a),...f,children:[b,(0,d.jsxs)(ac.bm,{className:s("absolute right-4 top-4 rounded-full p-2 text-slate-400 transition-colors hover:bg-white/5 hover:text-white",e),children:[(0,d.jsx)(ad.A,{className:"h-4 w-4"}),(0,d.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));aj.displayName=ac.UC.displayName;let ak=({className:a,...b})=>(0,d.jsx)("div",{className:s("flex flex-col space-y-2 text-left",a),...b}),al=({className:a,...b})=>(0,d.jsx)("div",{className:s("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",a),...b}),am=g.forwardRef(({className:a,...b},c)=>(0,d.jsx)(ac.hE,{ref:c,className:s("font-display text-xl text-white",a),...b}));am.displayName=ac.hE.displayName;let an=g.forwardRef(({className:a,...b},c)=>(0,d.jsx)(ac.VY,{ref:c,className:s("text-sm text-slate-400",a),...b}));async function ao(a){let b=await fetch("/api/models/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json().catch(()=>null);if(!b.ok||!c)throw Error(c?.error||c?.message||"Model provider request failed.");if(!c.ok&&c.message)throw Error(c.message);return c}an.displayName=ac.VY.displayName;let ap=Object.fromEntries(z.map(a=>{var b;return[a.id,{id:b=a.id,descriptor:A(b),getConnectionStatus:()=>ao({action:"status",provider:b}),connect:a=>ao({action:"connect",provider:b,apiKey:a?.apiKey?.trim()?a.apiKey.trim():void 0,endpoint:a?.endpoint?.trim()?a.endpoint.trim():void 0}),discoverModels:()=>ao({action:"discover",provider:b}),addModels:a=>ao({action:"add-models",provider:b,modelIds:a})}]}));var aq=c(99703);let ar=()=>({flowState:"idle",connection:null,statusMessage:null,errorMessage:null,emptyState:null,manualCommand:null,docsUrl:null,models:[],selectedModelIds:[],apiKey:"",search:"",loaded:!1});function as({open:a,onOpenChange:b,snapshot:c,initialProvider:e=null,onSnapshotChange:l}){var m,n,o;let p,q,r,t,v=C(e),[w,D]=(0,g.useState)("providers"),[E,F]=(0,g.useState)(v),[G,H]=(0,g.useState)({}),[I,J]=(0,g.useState)(!1),[K,L]=(0,g.useState)(!1),[M,N]=(0,g.useState)(""),[O,Q]=(0,g.useState)(5),[V,X]=(0,g.useState)([]),[Y,Z]=(0,g.useState)(!1),[$,_]=(0,g.useState)(null);(0,g.useEffectEvent)(a=>{D("providers"),aG(a)}),(0,g.useEffectEvent)(async()=>{Z(!0),_(null);try{let a=await fetch("/api/models/catalog"),b=await a.json().catch(()=>null);if(!a.ok||!b)throw Error(b?.error||"OpenClaw catalog could not be loaded.");X(Array.isArray(b.models)?b.models:[])}catch(b){let a=b instanceof Error?b.message:"OpenClaw catalog could not be loaded.";X([]),_(a),aq.o.error("OpenClaw catalog could not be loaded.",{description:a})}finally{Z(!1)}});let aa=B(E)?E:null,ac=aa?au(G[aa]):ar(),ad=aa?A(aa):null,af=aa?aw(c,G,aa):null,ag=!!(aa&&ad)&&("discovery-loading"===ac.flowState||"connecting"===ac.flowState&&!ac.manualCommand||ac.statusMessage?.startsWith("Checking ")===!0&&!af?.connected),ah="discovery-loading"===ac.flowState?`Discovering ${ad?.shortLabel??"provider"} models...`:"connecting"===ac.flowState?ac.statusMessage||`Connecting ${ad?.shortLabel??"provider"}...`:ac.statusMessage||`Checking ${ad?.shortLabel??"provider"}...`,ai="discovery-loading"===ac.flowState?"Pulling the provider catalog into AgentOS.":"connecting"===ac.flowState?"Preparing the provider connection.":"Checking provider status before discovery.",al=!!(aa&&ad),ao="discovery-loading"===ac.flowState,ax=ac.models.length>0?"Refresh discovery":"Discover models",ay=ao?"Discovering...":ax,az=af?.connected?"The provider is connected. Pull the available models into this workspace before choosing one.":ad?.connectKind==="oauth"?"Use your account login first, then pull the available models into this workspace.":"Connect the provider first, then pull the available models into this workspace.",aA=(0,g.useMemo)(()=>{let a=new Set(c.models.map(a=>a.id));return V.map(b=>({...b,alreadyAdded:a.has(b.id)})).sort((a,b)=>{let c=a.alreadyAdded;if(c!==b.alreadyAdded)return c?1:-1;let d=a.provider.localeCompare(b.provider);if(0!==d)return d;let e=!av(a);if(!av(b)!==e)return e?1:-1;let f=Number(a.recommended)+Number(a.local),g=Number(b.recommended)+Number(b.local);if(f!==g)return g-f;let h=a.name.localeCompare(b.name);return 0!==h?h:a.id.localeCompare(b.id)})},[V,c.models]),aB=(0,g.useMemo)(()=>Object.values(G).flatMap(a=>a?.selectedModelIds??[]),[G]),aC=(0,g.useMemo)(()=>new Map(aA.map(a=>[a.id,a])),[aA]),aD=(0,g.useMemo)(()=>new Set(aA.map(a=>a.provider)).size,[aA]),aE=(0,g.useMemo)(()=>aA.filter(a=>a.alreadyAdded).length,[aA]),aF=(0,g.useMemo)(()=>{let a=new Set(aB),b=new Map;for(let c of aA){let d=c.provider;if(!a.has(c.id)||c.alreadyAdded)continue;let e=b.get(d)??[];e.push(c.id),b.set(d,e)}return b},[aA,aB]);async function aG(a){F(a),D("providers");let b=au(G[a]);if(b.loaded&&b.models.length>0)return;let c=await aH(a);"ollama"===a&&c?.connection.connected&&await aJ(a,!0)}async function aH(a){let b=ap[a];aP(a,{flowState:"idle",errorMessage:null});try{let c=await b.getConnectionStatus(),d=au(G[a]);return aQ(a,c,c.emptyState?"discovery-empty":"idle",{models:d.loaded&&d.models.length>0?d.models:c.models}),c.snapshot&&l(c.snapshot),c}catch(b){return aP(a,{flowState:"auth-error",errorMessage:b instanceof Error?b.message:"Provider status could not be loaded.",loaded:!0}),null}}async function aI(a){let b=ap[a],c=au(G[a]);aP(a,{flowState:"connecting",errorMessage:null,statusMessage:"openai-codex"===a?"Opening the ChatGPT connection flow...":`Connecting ${A(a).shortLabel}...`});try{let d=await b.connect({apiKey:c.apiKey});aQ(a,d,"openai-codex"===a?"connecting":d.models.length?"discovery-success":"idle"),d.snapshot&&l(d.snapshot)}catch(b){aP(a,{flowState:"auth-error",errorMessage:b instanceof Error?b.message:"Provider connection failed."})}}async function aJ(a,b=!1){let c=ap[a],d=au(G[a]);if(b||"discovery-loading"!==d.flowState){aP(a,{flowState:"discovery-loading",errorMessage:null,statusMessage:"ollama"===a?"Checking the local Ollama runtime...":"Discovering available models..."});try{let b=await c.discoverModels();return aQ(a,b,b.models.length>0?"discovery-success":b.emptyState?"discovery-empty":"idle"),b.snapshot&&l(b.snapshot),b}catch(b){return aP(a,{flowState:"auth-error",errorMessage:b instanceof Error?b.message:"Model discovery failed."}),null}}}async function aK(a,b){let c=ap[a],d=au(G[a]),e=(b?.selectedModelIds??d.selectedModelIds).filter(a=>{let b=aC.get(a)??d.models.find(b=>b.id===a);return!!b&&!b.alreadyAdded});if(0===e.length)return!1;aP(a,{flowState:"connecting",errorMessage:null,statusMessage:"Adding selected models..."});try{let f=await c.addModels(e);return aQ(a,f,"add-success",{selectedModelIds:b?.selectedModelIds?d.selectedModelIds.filter(a=>!e.includes(a)):[]}),f.snapshot&&l(f.snapshot),b?.silent||aq.o.success("Models added.",{description:f.message}),!0}catch(b){return aP(a,{flowState:"add-error",errorMessage:b instanceof Error?b.message:"Models could not be added."}),!1}}async function aL(){let a=[...aF.keys()];if(0!==a.length){L(!0);try{let b=0;for(let[a,c]of aF.entries())(B(a)?await aK(a,{silent:!0,selectedModelIds:c}):await aM(a,c))&&(b+=c.length);b>0?aq.o.success("Models added.",{description:`Added ${b} model${1===b?"":"s"} from ${a.length} provider${1===a.length?"":"s"}.`}):aq.o.error("Models could not be added.",{description:"Select a different catalog entry or open the Providers tab and try again."})}catch(a){aq.o.error("Models could not be added.",{description:a instanceof Error?a.message:"Select a different catalog entry or open the Providers tab and try again."})}finally{L(!1)}}}async function aM(a,b){let c=b.filter(a=>{let b=aC.get(a);return b&&!b.alreadyAdded});if(0===c.length)return!1;let d=await fetch("/api/models/catalog",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:a,modelIds:c})}),e=await d.json().catch(()=>null);if(!d.ok||!e)throw Error(e?.error||e?.message||"Catalog models could not be added.");return e.snapshot&&l(e.snapshot),H(a=>Object.fromEntries(Object.entries(a).map(([a,b])=>[a,b?{...b,selectedModelIds:b.selectedModelIds.filter(a=>!c.includes(a))}:b]))),!0}async function aN(a){try{J(!0);let b=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:a})}),c=await b.json().catch(()=>null);if(!b.ok)throw Error(c?.error||"Terminal could not be opened.");aq.o.success("Terminal opened.",{description:"Finish the provider login there, then return here to discover models."})}catch(a){aq.o.error("Unable to open Terminal.",{description:a instanceof Error?a.message:"Unknown terminal error."})}finally{J(!1)}}async function aO(a){try{await navigator.clipboard.writeText(a),aq.o.success("Copied.",{description:"Command copied to your clipboard."})}catch{aq.o.error("Copy failed.",{description:"Clipboard access is not available."})}}function aP(a,b){H(c=>({...c,[a]:{...au(c[a]),...b}}))}function aQ(a,b,c,d){aP(a,{flowState:c,connection:b.connection,statusMessage:b.message,errorMessage:null,emptyState:b.emptyState??null,manualCommand:b.manualCommand??null,docsUrl:b.docsUrl??null,models:b.models,loaded:!0,...d})}return(0,d.jsx)(ae,{open:a,onOpenChange:b,children:(0,d.jsxs)(aj,{className:"flex h-[80dvh] max-h-[80dvh] w-[calc(100vw-16px)] max-w-[760px] flex-col gap-0 overflow-hidden p-0 sm:h-[min(80dvh,700px)] sm:max-h-[min(80dvh,700px)] sm:w-[min(760px,calc(100vw-40px))]",children:[(0,d.jsxs)(ak,{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-4 py-3.5 pr-10",children:[(0,d.jsx)(am,{className:"text-[1.05rem]",children:"Add Models"}),(0,d.jsx)(an,{className:"max-w-[560px] text-[11px] leading-[1rem] text-slate-400",children:"Connect or refresh providers first, then browse the catalog when you want to add models in bulk."})]}),(0,d.jsxs)(R,{value:w,onValueChange:a=>D(a),className:"min-h-0 flex flex-1 flex-col",children:[(0,d.jsx)("div",{className:"shrink-0 border-b border-white/10 px-4 py-3",children:(0,d.jsxs)(S,{className:"h-8 rounded-[16px] p-0.5",children:[(0,d.jsx)(T,{value:"providers",className:"rounded-[13px] px-2.5 py-1 text-[10px]",children:"Providers"}),(0,d.jsx)(T,{value:"catalog",className:"rounded-[13px] px-2.5 py-1 text-[10px]",children:"Catalog"})]})}),(0,d.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain",children:[(0,d.jsx)(U,{value:"providers",className:"!mt-0 m-0 h-full",children:(0,d.jsxs)("div",{className:"space-y-4 px-3 py-3 sm:px-4 sm:py-4",children:[(0,d.jsxs)("div",{className:"rounded-[22px] border border-white/10 bg-[linear-gradient(180deg,rgba(13,20,34,0.94),rgba(9,13,24,0.96))] p-3",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-display text-[0.84rem] text-white",children:"All providers"}),(0,d.jsx)("p",{className:"mt-1 text-[9px] leading-[0.95rem] text-slate-400",children:"Connect or refresh a provider, then return to the catalog when you want to add models in one pass."})]}),(0,d.jsxs)(u,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:[z.length," total"]})]}),(0,d.jsxs)("div",{className:"relative mt-2.5",children:[(0,d.jsx)("div",{className:"pointer-events-none absolute inset-y-0 left-0 z-10 w-6 bg-gradient-to-r from-[rgba(13,20,34,0.96)] to-transparent"}),(0,d.jsx)("div",{className:"pointer-events-none absolute inset-y-0 right-0 z-10 w-6 bg-gradient-to-l from-[rgba(13,20,34,0.96)] to-transparent"}),(0,d.jsx)("div",{className:"-mx-1 overflow-x-auto overscroll-x-contain pb-1",children:(0,d.jsx)("div",{className:"flex min-w-max gap-2.5 px-1",children:z.map(a=>(0,d.jsx)("div",{className:"w-[236px] shrink-0 snap-start sm:w-[244px]",children:(0,d.jsx)(ab,{descriptor:a,active:aa===a.id,compact:!0,connected:aw(c,G,a.id).connected,detail:aw(c,G,a.id).detail,onClick:()=>{aG(a.id)}})},a.id))})}),(0,d.jsx)("div",{className:"pointer-events-none absolute bottom-1.5 right-3 z-10 rounded-full border border-white/10 bg-slate-950/70 px-2 py-0.5 text-[8px] uppercase tracking-[0.14em] text-slate-400",children:"Scroll ->"})]})]}),(0,d.jsx)("div",{className:"rounded-[22px] border border-white/10 bg-[linear-gradient(180deg,rgba(11,18,32,0.96),rgba(6,10,18,0.98))] p-3",children:aa&&ad?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("div",{children:(0,d.jsx)("p",{className:"font-display text-[0.88rem] text-white",children:ad.label})}),(0,d.jsx)(u,{variant:af?.connected?"success":"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:af?.connected?"Connected":"Not connected"})]}),(0,d.jsx)("div",{className:"mt-3 flex flex-wrap gap-1",children:(m=aa,n=ac,o=af,p="ollama"===m?!!(o?.connected||n.emptyState):!!(o?.connected||n.manualCommand),q=n.models.length>0||!!n.emptyState,r=n.selectedModelIds.length>0,t="add-success"===n.flowState,[{label:"Choose provider",status:"done"},{label:"ollama"===m?"Local check":"Connect",status:"connecting"!==n.flowState||p?p?"done":"pending":"active"},{label:"Discover",status:"discovery-loading"===n.flowState?"active":q?"done":"pending"},{label:"Select",status:t?"done":r?"active":"pending"},{label:"Add",status:t?"done":"add-error"===n.flowState?"active":"pending"}]).map(a=>(0,d.jsxs)("div",{className:s("inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-[9px] uppercase tracking-[0.14em]","done"===a.status?"border-emerald-300/20 bg-emerald-300/10 text-emerald-100":"active"===a.status?"border-cyan-300/20 bg-cyan-300/10 text-cyan-100":"border-white/10 bg-white/[0.03] text-slate-500"),children:[(0,d.jsx)("span",{className:s("h-1.5 w-1.5 rounded-full","done"===a.status?"bg-emerald-300":"active"===a.status?"bg-cyan-300":"bg-slate-600")}),a.label]},a.label))}),ac.statusMessage&&!ag?(0,d.jsx)("div",{className:"mt-3 rounded-[16px] border border-white/10 bg-white/[0.04] px-3 py-2",children:(0,d.jsx)("p",{className:"text-[11px] text-slate-200",children:ac.statusMessage})}):null,ac.errorMessage?(0,d.jsx)("div",{className:"mt-3 rounded-[16px] border border-rose-400/20 bg-rose-400/[0.08] px-3 py-2 text-[11px] text-rose-100",children:ac.errorMessage}):null,ag?(0,d.jsx)("div",{className:"mt-4 flex min-h-[260px] items-center justify-center overflow-hidden rounded-[24px] border border-cyan-300/20 bg-[radial-gradient(circle_at_top,rgba(34,211,238,0.16),rgba(8,15,28,0.98)_70%)] px-4 py-10 text-center shadow-[0_22px_52px_rgba(7,11,20,0.32)]",children:(0,d.jsxs)("div",{className:"relative flex max-w-[340px] flex-col items-center",children:[(0,d.jsx)("div",{className:"absolute inset-x-8 top-8 h-px bg-gradient-to-r from-transparent via-cyan-200/70 to-transparent blur-sm animate-pulse"}),(0,d.jsx)("div",{className:"absolute inset-x-8 bottom-8 h-px bg-gradient-to-r from-transparent via-cyan-200/30 to-transparent blur-sm animate-pulse [animation-delay:180ms]"}),(0,d.jsx)("div",{className:"absolute left-8 top-8 h-24 w-24 rounded-full border border-cyan-300/15 bg-cyan-300/[0.04] blur-[1px] animate-pulse"}),(0,d.jsx)("div",{className:"absolute right-10 top-14 h-16 w-16 rounded-full border border-cyan-300/10 bg-cyan-300/[0.03] blur-[1px] animate-pulse [animation-delay:120ms]"}),(0,d.jsx)("div",{className:"absolute bottom-10 left-1/2 h-20 w-20 -translate-x-1/2 rounded-full border border-cyan-300/10 bg-cyan-300/[0.03] blur-[1px] animate-pulse [animation-delay:240ms]"}),(0,d.jsx)("div",{className:"relative mb-4 flex h-16 w-16 items-center justify-center rounded-full border border-cyan-300/20 bg-cyan-300/[0.08] shadow-[0_0_0_8px_rgba(34,211,238,0.05)]",children:(0,d.jsx)(h.A,{className:"h-8 w-8 animate-spin text-cyan-200"})}),(0,d.jsx)("p",{className:"font-display text-[1.1rem] leading-[1.2rem] tracking-[0.01em] text-white",children:ah}),(0,d.jsx)("p",{className:"mt-2 max-w-[280px] text-[11px] leading-[1rem] text-slate-400",children:ai}),(0,d.jsxs)("div",{className:"mt-4 flex gap-1.5",children:[(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-cyan-300/90"}),(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-cyan-300/60 [animation-delay:120ms]"}),(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-cyan-300/30 [animation-delay:240ms]"})]})]})}):(0,d.jsxs)(d.Fragment,{children:["openai-codex"===aa?(0,d.jsxs)("div",{className:"mt-4 rounded-[20px] border border-white/10 bg-white/[0.03] p-3",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-display text-[0.88rem] text-white",children:"Connect your ChatGPT account"}),(0,d.jsx)("p",{className:"mt-1 max-w-[500px] text-[10px] leading-[0.98rem] text-slate-400",children:"This uses OpenClaw's account-based login flow. No API key is required."})]}),(0,d.jsx)(x,{type:"button",className:"h-8 rounded-full px-3 text-[10px]",disabled:"connecting"===ac.flowState&&!ac.manualCommand,onClick:()=>{aI(aa)},children:"connecting"!==ac.flowState||ac.manualCommand?"Connect ChatGPT":(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Connecting..."]})})]}),ac.manualCommand?(0,d.jsxs)("div",{className:"mt-3 rounded-[16px] border border-cyan-300/15 bg-cyan-300/[0.07] p-3",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-[11px] font-medium text-cyan-50",children:"Finish sign-in in Terminal"}),(0,d.jsx)("p",{className:"mt-1 max-w-[480px] text-[10px] leading-[0.98rem] text-cyan-100/80",children:"Open Terminal, complete the provider login, then return here and check discovery."})]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsx)(x,{type:"button",variant:"secondary",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",disabled:I,onClick:()=>{aN(ac.manualCommand||"")},children:I?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i.A,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}),(0,d.jsxs)(x,{type:"button",variant:"ghost",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:()=>{aO(ac.manualCommand||"")},children:[(0,d.jsx)(j.A,{className:"mr-1.5 h-3 w-3"}),"Copy command"]}),(0,d.jsxs)(x,{type:"button",variant:"ghost",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:()=>{aJ(aa)},children:[(0,d.jsx)(f.A,{className:"mr-1.5 h-3 w-3"}),"I've connected it"]})]})]}),(0,d.jsx)("div",{className:"mt-2.5 overflow-x-auto rounded-[14px] border border-white/10 bg-slate-950/60 px-3 py-2",children:(0,d.jsx)("code",{className:"text-[10px] text-slate-200",children:ac.manualCommand})})]}):null]}):null,"apiKey"===ad.connectKind?(0,d.jsx)("div",{className:"mt-4 rounded-[20px] border border-white/10 bg-white/[0.03] p-3",children:(0,d.jsxs)("div",{className:"flex flex-wrap items-end gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("label",{className:"block text-[9px] uppercase tracking-[0.16em] text-slate-500",children:"API key"}),(0,d.jsx)(y,{type:"password",value:ac.apiKey,onChange:a=>aP(aa,{apiKey:a.target.value}),placeholder:"openrouter"===aa?"sk-or-v1-...":"Paste API key",className:"mt-1.5 h-8 text-[11px]"})]}),(0,d.jsx)(x,{type:"button",className:"h-8 rounded-full px-3 text-[10px]",disabled:"connecting"===ac.flowState||!ac.apiKey.trim(),onClick:()=>{aI(aa)},children:"connecting"===ac.flowState?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Connecting..."]}):`Connect ${ad.shortLabel}`})]})}):null,al?(0,d.jsx)("div",{className:"mt-4 rounded-[24px] border border-cyan-300/20 bg-[linear-gradient(180deg,rgba(17,28,47,0.98),rgba(10,16,28,0.98))] p-4 shadow-[0_18px_42px_rgba(7,11,20,0.28)]",children:(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"font-display text-[0.92rem] text-white",children:ao?"Discovering models...":ax}),(0,d.jsx)("p",{className:"mt-1 max-w-[520px] text-[11px] leading-[1rem] text-slate-400",children:ao?"OpenClaw is pulling the provider catalog into this workspace.":az})]}),(0,d.jsxs)("div",{className:"flex shrink-0 flex-wrap gap-2",children:[(0,d.jsx)(x,{type:"button",variant:"default",className:"h-11 rounded-full px-5 text-[12px] font-medium",disabled:ao,onClick:()=>{aJ(aa)},children:ao?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Discovering..."]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.A,{className:"mr-2 h-4 w-4"}),ay]})}),(0,d.jsx)(x,{type:"button",variant:"ghost",size:"sm",className:"h-11 rounded-full px-4 text-[10px]",onClick:()=>{aH(aa)},children:"Refresh status"})]})]})}):null,ac.emptyState?(0,d.jsx)(at,{emptyState:ac.emptyState,onCopyCommand:a=>{aO(a)}}):null,ac.models.length>0?(0,d.jsx)("div",{className:"mt-5",children:(0,d.jsx)(W,{provider:aa,models:ac.models,selectedModelIds:ac.selectedModelIds,search:ac.search,onSearchChange:a=>aP(aa,{search:a}),onToggleModel:a=>{aP(aa,{selectedModelIds:ac.selectedModelIds.includes(a)?ac.selectedModelIds.filter(b=>b!==a):[...ac.selectedModelIds,a]})},onAddSelected:()=>{aK(aa)},isAdding:"connecting"===ac.flowState&&"Adding selected models..."===ac.statusMessage})}):null,"add-success"===ac.flowState?(0,d.jsxs)("div",{className:"mt-3 flex items-center gap-2.5 rounded-[16px] border border-emerald-300/20 bg-emerald-300/[0.08] px-3 py-2",children:[(0,d.jsx)(k.A,{className:"h-3.5 w-3.5 text-emerald-200"}),(0,d.jsx)("p",{className:"text-[11px] text-emerald-50",children:ac.statusMessage||"Models were added successfully."})]}):null,ac.docsUrl?(0,d.jsx)("a",{href:ac.docsUrl,target:"_blank",rel:"noreferrer",className:"mt-3 inline-flex text-[10px] text-slate-300 underline underline-offset-4",children:"OpenClaw model docs"}):null]})]}):(0,d.jsx)("div",{className:"flex min-h-[180px] items-center justify-center rounded-[20px] border border-dashed border-white/10 bg-white/[0.02] px-4 py-6 text-center",children:(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-display text-[0.88rem] text-white",children:"Choose a provider to begin"}),(0,d.jsx)("p",{className:"mt-1.5 max-w-[360px] text-[11px] leading-[0.98rem] text-slate-400",children:"Start with ChatGPT, OpenRouter, Gemini, DeepSeek, Mistral, or Ollama Local. The flow will guide you through connect, discovery, selection, and add."})]})})})]})}),(0,d.jsx)(U,{value:"catalog",className:"!mt-0 m-0 h-full",children:(0,d.jsxs)("div",{className:"space-y-4 px-3 py-3 sm:px-4 sm:py-4",children:[(0,d.jsx)("div",{className:"rounded-[20px] border border-white/10 bg-[linear-gradient(180deg,rgba(11,18,32,0.96),rgba(6,10,18,0.98))] p-3",children:(0,d.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-display text-[0.84rem] text-white",children:"OpenClaw catalog"}),(0,d.jsx)("p",{className:"mt-1 text-[9px] leading-[0.95rem] text-slate-400",children:"Search the full OpenClaw model catalog, then load five more whenever you want to extend the list."})]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[(0,d.jsxs)(u,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:[aA.length," models"]}),(0,d.jsxs)(u,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:[aD," providers"]}),(0,d.jsxs)(u,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:[aE," added"]})]})]})}),$?(0,d.jsx)("div",{className:"rounded-[18px] border border-rose-400/20 bg-rose-400/[0.08] px-4 py-3 text-[11px] text-rose-100",children:$}):null,(0,d.jsx)(P,{models:aA,selectedModelIds:aB,search:M,onSearchChange:N,onToggleModel:(a,b)=>{let c=au(G[a]);aP(a,{selectedModelIds:c.selectedModelIds.includes(b)?c.selectedModelIds.filter(a=>a!==b):[...c.selectedModelIds,b]})},onAddSelected:()=>{aL()},onOpenProviders:a=>{D("providers"),B(a)&&aG(a)},onLoadMore:()=>Q(a=>a+5),visibleModelCount:O,isAdding:K,isLoading:Y&&0===aA.length}),Y||0!==aA.length||$?null:(0,d.jsx)("div",{className:"rounded-[18px] border border-dashed border-white/10 bg-white/[0.02] px-4 py-5 text-center text-[11px] text-slate-400",children:"OpenClaw did not return any supported models yet. Check your installation or refresh providers."})]})})]})]})]})})}function at({emptyState:a,onCopyCommand:b}){return(0,d.jsxs)("div",{className:"mt-3 rounded-[20px] border border-white/10 bg-white/[0.03] p-3",children:[(0,d.jsx)("p",{className:"font-display text-[0.88rem] text-white",children:a.title}),(0,d.jsx)("p",{className:"mt-1 max-w-[520px] text-[11px] leading-[0.98rem] text-slate-400",children:a.description}),a.commands?.length?(0,d.jsx)("div",{className:"mt-3 space-y-1.5",children:a.commands.map(a=>(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-[14px] border border-white/10 bg-slate-950/60 px-3 py-2",children:[(0,d.jsx)("code",{className:"text-[10px] text-slate-200",children:a}),(0,d.jsxs)(x,{type:"button",size:"sm",variant:"ghost",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:()=>b(a),children:[(0,d.jsx)(j.A,{className:"mr-1.5 h-3 w-3"}),"Copy"]})]},a))}):null]})}function au(a){return a||ar()}function av(a){return!a.missing&&!1!==a.available}function aw(a,b,c){let d=b[c]?.connection;if(d)return d;let e=a.diagnostics.modelReadiness.authProviders.find(a=>a.provider===c),f=a.models.filter(a=>{var b,d;let e;return b=c,d=a.id,e=a.provider||d.split("/",1)[0]||"","openai-codex"===b?"openai-codex"===e||"openai"===e:e===b}).length;if("ollama"===c)return{provider:c,connected:f>0,canConnect:!0,needsTerminal:!1,detail:f>0?`${f} model${1===f?"":"s"} already visible in AgentOS.`:"Detect local models from this machine."};let g=!!e?.connected;return{provider:c,connected:g,canConnect:!0,needsTerminal:"openai-codex"===c,detail:g?e?.detail||A(c).helperText:f>0?`${f} model${1===f?"":"s"} are already saved in AgentOS. Connect ${A(c).shortLabel} to use them.`:A(c).helperText}}var ax=c(24520);function ay({open:a,agentId:b,snapshot:c,onOpenChange:e,onSnapshotChange:f,onRefresh:i,onOpenAddModels:j}){let k=b?c.agents.find(a=>a.id===b)??null:null,m=k?.modelId&&"unassigned"!==k.modelId?k.modelId:"",o=m?c.models.find(a=>a.id===m)??null:null,p=!!o&&az(o),[q,r]=(0,g.useState)(m),[t,v]=(0,g.useState)(""),[w,z]=(0,g.useState)(!1),[A,B]=(0,g.useState)(null);(0,g.useRef)(c);let C=(0,g.useMemo)(()=>{let a=t.trim().toLowerCase();return[...c.models].sort((a,b)=>{let c=!az(a);if(!az(b)!==c)return c?1:-1;let d=a.provider.localeCompare(b.provider);if(0!==d)return d;let e=a.name.localeCompare(b.name);return 0!==e?e:a.id.localeCompare(b.id)}).filter(b=>!a||`${b.name} ${b.id} ${b.provider} ${b.input} ${b.tags.join(" ")}`.toLowerCase().includes(a))},[t,c.models]),E=q?c.models.find(a=>a.id===q)??null:null,F=!!E&&az(E),G=!!q&&q!==m,K=c.models.filter(a=>az(a)).length,L=o?aB(o):m?"Unknown":"Default route",M=o?az(o)?o.local?"success":"default":"warning":m?"warning":"muted",N=async()=>{if(k&&E&&F&&G){z(!0),B(null);try{let a=await fetch("/api/agents",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:k.id,modelId:q})}),b=await a.json();if(!a.ok||b.error)throw Error(b.error||"Unable to update the agent model.");f?.(a=>(function(a,b,c){let d=a.agents.map(a=>a.id===b?{...a,modelId:c}:a),e=new Map;for(let a of d){let b=a.modelId?.trim();b&&"unassigned"!==b&&e.set(b,(e.get(b)??0)+1)}return{...a,agents:d,models:a.models.map(a=>({...a,usageCount:e.get(a.id)??0}))}})(a,k.id,q)),aq.o.success("Agent model updated.",{description:E.name}),e(!1);let c=i?.();c&&c.catch(()=>void 0)}catch(b){let a=b instanceof Error?b.message:"Unable to update the agent model.";B(a),aq.o.error(a)}finally{z(!1)}}};return k?(0,d.jsx)(ae,{open:a,onOpenChange:e,children:(0,d.jsxs)(aj,{className:"flex h-[80dvh] max-h-[80dvh] w-[calc(100vw-16px)] max-w-[760px] flex-col gap-0 overflow-hidden p-0 sm:h-[min(80dvh,720px)] sm:max-h-[min(80dvh,720px)] sm:w-[min(760px,calc(100vw-40px))]",children:[(0,d.jsxs)(ak,{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-4 py-3.5 pr-10",children:[(0,d.jsx)(am,{className:"text-[1.05rem]",children:"Change model"}),(0,d.jsx)(an,{className:"max-w-[520px] text-[11px] leading-[1rem] text-slate-400",children:"Pick a model already available in AgentOS, or add more models if the right one is not listed yet."})]}),(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain",children:(0,d.jsxs)("div",{className:"space-y-4 px-3 py-3 sm:px-4 sm:py-4",children:[(0,d.jsxs)("div",{className:"rounded-[20px] border border-white/10 bg-[linear-gradient(180deg,rgba(13,20,34,0.94),rgba(9,13,24,0.96))] p-3",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-display text-[0.84rem] text-white",children:J(k)}),(0,d.jsx)("p",{className:"mt-1 text-[9px] leading-[0.95rem] text-slate-400",children:k.id})]}),(0,d.jsx)(u,{variant:M,className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:L})]}),(0,d.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,d.jsx)(u,{variant:o?p?"default":o.missing?"danger":"warning":"muted",className:"max-w-full truncate px-2 py-0.5 text-[9px] tracking-[0.12em]",children:o?.name||m||"OpenClaw default"}),(0,d.jsx)("p",{className:"text-[11px] leading-5 text-slate-400",children:o?`${D(o.provider)} \xb7 ${H(o.contextWindow)} ctx`:m?"Model metadata unavailable.":"No model is assigned yet."})]}),o&&!p?(0,d.jsx)("p",{className:"mt-2 text-[11px] leading-5 text-amber-100/85",children:aA(o)}):null]}),(0,d.jsxs)("div",{className:"rounded-[20px] border border-white/10 bg-[linear-gradient(180deg,rgba(11,18,32,0.96),rgba(6,10,18,0.98))] p-3",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-display text-[0.84rem] text-white",children:"Available models"}),(0,d.jsx)("p",{className:"mt-1 text-[9px] leading-[0.95rem] text-slate-400",children:"Select one of the models currently known to this workspace."})]}),(0,d.jsxs)(u,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:[K," ready"]})]}),(0,d.jsxs)("div",{className:"relative mt-2.5",children:[(0,d.jsx)(l.A,{className:"pointer-events-none absolute left-3 top-1/2 h-3 w-3 -translate-y-1/2 text-slate-500"}),(0,d.jsx)(y,{value:t,onChange:a=>v(a.target.value),placeholder:"Search models",className:"h-8 pl-8 text-[11px]"})]}),(0,d.jsx)("div",{className:"mt-3 max-h-[min(36vh,300px)] space-y-1 overflow-y-auto pr-1",children:C.length>0?C.map(a=>{var b;let c=q===a.id,e=az(a);return(0,d.jsxs)("button",{type:"button",disabled:!e,"aria-pressed":c,onClick:()=>{e&&r(a.id)},className:s("flex w-full items-start justify-between gap-2 rounded-[14px] border px-2.5 py-2 text-left transition-all",c?"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]",!e&&"cursor-not-allowed opacity-70"),children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[(0,d.jsx)("div",{className:s("mt-0.5 flex h-[16px] w-[16px] shrink-0 items-center justify-center rounded-md border",c?"border-cyan-300/50 bg-cyan-300/15 text-cyan-100":"border-white/12 bg-white/[0.03] text-transparent",!e&&"border-white/10 bg-white/[0.02] text-slate-500"),children:c?(0,d.jsx)(n.A,{className:"h-2 w-2"}):null}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[11px] font-medium text-white",children:a.name}),(0,d.jsx)("p",{className:"mt-0.5 truncate text-[9px] uppercase tracking-[0.16em] text-slate-500",children:I(a.id)}),(0,d.jsxs)("div",{className:"mt-1 flex flex-wrap gap-1.5 text-[9px] text-slate-400",children:[(0,d.jsx)("span",{children:D(a.provider)}),a.input?(0,d.jsx)("span",{children:a.input}):null,a.contextWindow?(0,d.jsxs)("span",{children:[Intl.NumberFormat().format(a.contextWindow)," ctx"]}):null]}),e?null:(0,d.jsx)("p",{className:"mt-1 text-[9px] leading-4 text-amber-100/85",children:aA(a)})]})]}),(0,d.jsx)("div",{className:"shrink-0",children:(0,d.jsx)(u,{variant:(b=a).missing?"danger":!1===b.available?"warning":b.local?"success":"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:aB(a)})})]},a.id)}):(0,d.jsx)("div",{className:"rounded-[16px] border border-dashed border-white/10 bg-white/[0.03] px-3 py-5 text-center text-[11px] text-slate-400",children:t.trim()?"No models matched this search.":"No usable models are available yet. Add models to connect a provider or discover local routes."})})]}),(0,d.jsxs)("div",{className:"rounded-[16px] border border-white/10 bg-white/[0.03] p-3",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Selection"}),(0,d.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[(0,d.jsx)(u,{variant:F?"default":"muted",className:"max-w-full truncate px-2 py-0.5 text-[9px] tracking-[0.12em]",children:E?.name||q||"No model selected"}),(0,d.jsx)("p",{className:"text-[11px] leading-5 text-slate-400",children:E?F?`${D(E.provider)} \xb7 ${H(E.contextWindow)} ctx`:aA(E):"Pick a model above, then save the assignment."})]})]}),A?(0,d.jsx)("div",{className:"rounded-[16px] border border-rose-400/20 bg-rose-400/[0.08] px-3 py-2 text-[11px] text-rose-100",children:A}):null]})}),(0,d.jsx)("div",{className:"shrink-0 border-t border-white/[0.08] px-4 py-3",children:(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,d.jsxs)(x,{type:"button",variant:"secondary",className:"h-8 rounded-full px-3 text-[10px]",disabled:w,onClick:()=>{j(null),e(!1)},children:[(0,d.jsx)(ax.A,{className:"mr-1.5 h-3 w-3"}),"Add models"]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)(x,{type:"button",variant:"secondary",className:"h-8 rounded-full px-3 text-[10px]",disabled:w,onClick:()=>e(!1),children:"Cancel"}),(0,d.jsxs)(x,{type:"button",className:"h-8 rounded-full px-3 text-[10px]",disabled:w||!G||!F,onClick:()=>{N()},children:[w?(0,d.jsx)(h.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):null,"Save model"]})]})]})})]})}):null}function az(a){return!a.missing&&!1!==a.available}function aA(a){let b=B(a.provider)?A(a.provider):null;return a.missing?b?.connectKind==="local"?`${b.shortLabel} is installed, but this model is not pulled locally yet.`:b?`${b.shortLabel} does not have this model available yet. Open Add Models > Providers to connect or refresh it.`:"This model is not available yet.":!1===a.available?b?.connectKind==="apiKey"?`Connect your ${b.shortLabel} API key in Add Models > Providers to use this model.`:b?.connectKind==="oauth"?`Connect your ${b.shortLabel} account in Add Models > Providers to use this model.`:b?.connectKind==="local"?"Pull this model locally with Ollama, then refresh the list.":b?`Open Add Models > Providers to finish setup for ${b.shortLabel}.`:"Open Add Models > Providers to finish setup.":"This model is not ready for assignment."}function aB(a){return a.missing?"Missing":!1===a.available?"Unavailable":a.local?"Local":"Remote"}var aC=c(90707);function aD({title:a,selectedValues:b,selectedTone:c,selectedEmptyLabel:e,lockedValues:f=[],observedValues:g=[],inputRef:h,inputValue:i,onInputValueChange:j,onRemove:k,onPick:l,suggestions:n,emptySuggestionLabel:o,loading:p,catalogError:q,helperLabel:r,currentHintLabel:t,highlight:v}){let w="cyan"===c?{border:"border-cyan-300/20",chip:"border-cyan-300/15 bg-cyan-400/10 text-cyan-50",chipHover:"hover:border-cyan-200/30 hover:bg-cyan-400/15"}:{border:"border-amber-300/20",chip:"border-amber-300/15 bg-amber-400/10 text-amber-50",chipHover:"hover:border-amber-200/30 hover:bg-amber-400/15"},x=f.length>0,z=new Set(f),A=`Current ${a.toLowerCase()}`,B=`${a}:${i}:${n.length}:${n[0]?.value??""}`;return(0,d.jsxs)("div",{className:s("rounded-[18px] border bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] p-3.5",w.border,v&&"shadow-[0_0_0_1px_rgba(34,211,238,0.08)]"),children:[(0,d.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:a}),(0,d.jsx)(u,{variant:"muted",children:"Declared"})]}),(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:A}),(0,d.jsx)("p",{className:"text-[10px] leading-4 text-slate-400",children:t})]}),(0,d.jsxs)(u,{variant:"muted",children:[b.length," current"]})]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:b.length>0?b.map(a=>{let b=z.has(a);return(0,d.jsxs)("div",{className:s("inline-flex max-w-full items-center gap-1.5 rounded-full border px-2.5 py-1 text-[11px] transition-colors",w.chip,w.chipHover,b&&"cursor-not-allowed pr-2.5"),title:b?`Managed by policy: ${a}`:a,children:[(0,d.jsx)("span",{className:"max-w-full truncate",children:a}),b?(0,d.jsx)("span",{className:"inline-flex items-center gap-1 text-white/70",children:(0,d.jsx)(m.A,{className:"h-3 w-3"})}):(0,d.jsx)("button",{type:"button","aria-label":`Remove ${a}`,title:`Remove ${a}`,className:"inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-white/10 bg-white/10 text-white/70 transition-colors hover:border-white/20 hover:bg-white/20 hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/60 focus-visible:ring-offset-0",onClick:()=>k(a),children:(0,d.jsx)(ad.A,{className:"h-2.5 w-2.5"})})]},a)}):(0,d.jsx)(u,{variant:"muted",children:e})})]}),(0,d.jsx)("div",{children:(0,d.jsx)(y,{ref:h,value:i,onChange:a=>j(a.target.value),onKeyDown:a=>(function(a,b,c){if("Enter"!==a.key)return;a.preventDefault();let d=b[0];d&&c(d.value)})(a,n,l),placeholder:"Skills"===a?"Search OpenClaw or workspace skills":"Search built-in tools or plugin tools",className:"h-8 flex-1 rounded-xl border-white/10 bg-white/5 px-3 text-[12px]"})}),(0,d.jsx)("div",{className:"space-y-2",children:(0,d.jsx)(aE,{kind:"Skills"===a?"skill":"tool",suggestions:n,onPick:l,emptyLabel:o},B)}),x?(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Policy locked"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:f.map(a=>(0,d.jsxs)(u,{variant:"success",children:[(0,d.jsx)(m.A,{className:"mr-1 h-3 w-3"}),a]},a))})]}):null,g.length>0?(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Observed"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:g.slice(0,10).map(a=>(0,d.jsx)(u,{variant:"muted",children:a},a))})]}):null,(0,d.jsx)("p",{className:"text-[11px] leading-5 text-slate-500",children:r}),q?(0,d.jsx)("p",{className:"text-[11px] leading-5 text-slate-500",children:q}):null,p&&0===n.length?(0,d.jsx)("p",{className:"text-[11px] leading-5 text-slate-500",children:"Loading OpenClaw catalog..."}):null]})]})}function aE({kind:a,suggestions:b,onPick:c,emptyLabel:e}){let[f,h]=(0,g.useState)(8),i=b.slice(0,f),j=Math.max(b.length-i.length,0);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Available to add"}),(0,d.jsxs)(u,{variant:"muted",children:[b.length," total"]})]}),(0,d.jsx)("div",{className:"max-h-[280px] space-y-1.5 overflow-y-auto pr-1",children:(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)(aF,{kind:a,options:i,onPick:c,emptyLabel:e}),j>0?(0,d.jsxs)("button",{type:"button",onClick:()=>h(a=>a+8),className:"group flex w-full items-center justify-center gap-2 rounded-xl border border-dashed border-cyan-300/20 bg-cyan-400/[0.04] px-3 py-2 text-[11px] text-cyan-100 transition-colors hover:border-cyan-200/35 hover:bg-cyan-400/[0.08] hover:text-white",children:[(0,d.jsx)("span",{className:"uppercase tracking-[0.18em]",children:"Load more"}),(0,d.jsxs)(u,{variant:"muted",className:"h-5 px-2 py-0 text-[10px]",children:["+",j]})]}):null]})})]})}function aF({kind:a,options:b,onPick:c,emptyLabel:e}){return 0===b.length?(0,d.jsx)("p",{className:"text-[11px] leading-5 text-slate-500",children:e}):(0,d.jsx)("div",{className:"space-y-1.5",children:b.map(b=>{var e;return(0,d.jsxs)("button",{type:"button",className:s("group flex w-full items-start justify-between gap-3 rounded-xl border border-white/[0.08] bg-white/[0.03] px-3 py-1.5 text-left transition-colors hover:border-cyan-300/20 hover:bg-cyan-400/[0.05]","tool"===a&&"hover:border-amber-300/20 hover:bg-amber-400/[0.05]"),onClick:()=>c(b.value),title:b.description,children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("p",{className:"truncate text-[12px] leading-4 text-white",children:b.label}),"group"===b.category?(0,d.jsx)(u,{variant:"muted",children:"group"}):null]}),(0,d.jsx)("p",{className:"line-clamp-2 text-[11px] leading-4 text-slate-400",children:b.description})]}),(0,d.jsx)(u,{variant:"skill"===(e=b).kind?"workspace"===e.category?"success":"custom"===e.category?"muted":"default":"plugin"===e.category?"warning":"group"===e.category||"custom"===e.category?"muted":"default",className:"shrink-0 h-4 max-w-[132px] px-1.5 py-0 text-[8px] font-medium tracking-[0.08em] normal-case",children:(0,d.jsx)("span",{className:"truncate",children:b.sourceLabel})})]},b.value)})})}let aG=[{name:"exec",description:"Run shell commands and manage background processes.",source:"OpenClaw built-in",category:"builtin"},{name:"process",description:"Run shell commands and manage background processes.",source:"OpenClaw built-in",category:"builtin"},{name:"bash",description:"Run shell commands and manage background processes.",source:"OpenClaw built-in",category:"builtin"},{name:"code_execution",description:"Run sandboxed remote Python analysis.",source:"OpenClaw built-in",category:"builtin"},{name:"browser",description:"Control a Chromium browser (navigate, click, screenshot).",source:"OpenClaw built-in",category:"builtin"},{name:"web_search",description:"Search the web and fetch search results.",source:"OpenClaw built-in",category:"builtin"},{name:"x_search",description:"Search X posts.",source:"OpenClaw built-in",category:"builtin"},{name:"web_fetch",description:"Fetch page content.",source:"OpenClaw built-in",category:"builtin"},{name:"read",description:"Read files in the workspace.",source:"OpenClaw built-in",category:"builtin"},{name:"write",description:"Write files in the workspace.",source:"OpenClaw built-in",category:"builtin"},{name:"edit",description:"Edit files in the workspace.",source:"OpenClaw built-in",category:"builtin"},{name:"apply_patch",description:"Apply structured multi-hunk patches.",source:"OpenClaw built-in",category:"builtin"},{name:"message",description:"Send messages across channels.",source:"OpenClaw built-in",category:"builtin"},{name:"canvas",description:"Drive node canvas workflows.",source:"OpenClaw built-in",category:"builtin"},{name:"nodes",description:"Discover and target paired devices.",source:"OpenClaw built-in",category:"builtin"},{name:"cron",description:"Manage scheduled jobs.",source:"OpenClaw built-in",category:"builtin"},{name:"gateway",description:"Inspect and restart gateway services.",source:"OpenClaw built-in",category:"builtin"},{name:"image",description:"Analyze images.",source:"OpenClaw built-in",category:"builtin"},{name:"image_generate",description:"Generate or edit images.",source:"OpenClaw built-in",category:"builtin"},{name:"sessions_list",description:"Session management and sub-agent discovery.",source:"OpenClaw built-in",category:"builtin"},{name:"sessions_history",description:"Session management and sub-agent discovery.",source:"OpenClaw built-in",category:"builtin"},{name:"sessions_send",description:"Session management and sub-agent discovery.",source:"OpenClaw built-in",category:"builtin"},{name:"sessions_spawn",description:"Session management and sub-agent discovery.",source:"OpenClaw built-in",category:"builtin"},{name:"sessions_yield",description:"Session management and sub-agent discovery.",source:"OpenClaw built-in",category:"builtin"},{name:"subagents",description:"Session management and sub-agent discovery.",source:"OpenClaw built-in",category:"builtin"},{name:"session_status",description:"Session management and sub-agent discovery.",source:"OpenClaw built-in",category:"builtin"},{name:"agents_list",description:"Session management and sub-agent discovery.",source:"OpenClaw built-in",category:"builtin"}],aH=[{name:"group:runtime",description:"exec, bash, process, code_execution",source:"OpenClaw docs",category:"group"},{name:"group:fs",description:"read, write, edit, apply_patch",source:"OpenClaw docs",category:"group"},{name:"group:sessions",description:"sessions_list, sessions_history, sessions_send, sessions_spawn, sessions_yield, subagents, session_status",source:"OpenClaw docs",category:"group"},{name:"group:memory",description:"memory_search, memory_get",source:"OpenClaw docs",category:"group"},{name:"group:web",description:"web_search, x_search, web_fetch",source:"OpenClaw docs",category:"group"},{name:"group:ui",description:"browser, canvas",source:"OpenClaw docs",category:"group"},{name:"group:automation",description:"cron, gateway",source:"OpenClaw docs",category:"group"},{name:"group:messaging",description:"message",source:"OpenClaw docs",category:"group"},{name:"group:nodes",description:"nodes",source:"OpenClaw docs",category:"group"},{name:"group:openclaw",description:"All built-in OpenClaw tools (excludes plugin tools).",source:"OpenClaw docs",category:"group"}];aG.map(a=>a.name);let aI={worker:{label:"Worker",description:"Default execution agent for code changes, docs, research, and review work. Best when the task stays inside the workspace and does not need system-level changes.",defaultName:"Worker",defaultEmoji:"\uD83D\uDEE0️",defaultTheme:"slate",badgeVariant:"default",tools:["exec","read","write","edit","apply_patch"],skillIds:["project-builder","project-reviewer","project-tester"]},setup:{label:"Setup / Operator",description:"Bootstraps environments, handles installs, and unblocks the workspace so other agents can move faster.",defaultName:"Setup Operator",defaultEmoji:"\uD83E\uDDF0",defaultTheme:"amber",badgeVariant:"warning",tools:["exec","process","gateway","read","write"],skillIds:["project-builder","project-analyst","project-learner"]},browser:{label:"Browser",description:"Captures browser evidence, screenshots, and user-path validation for UI-heavy work.",defaultName:"Browser Agent",defaultEmoji:"\uD83C\uDF10",defaultTheme:"blue",badgeVariant:"success",tools:["browser","web_search","web_fetch","image"],skillIds:["project-browser","project-tester","project-researcher"]},monitoring:{label:"Monitoring",description:"Runs on a watch cycle, checks health and drift, and leaves concise triage handoffs.",defaultName:"Monitoring Agent",defaultEmoji:"\uD83D\uDEF0️",defaultTheme:"teal",badgeVariant:"warning",tools:["cron","gateway","sessions_list","message","web_fetch"],skillIds:["project-analyst","project-reviewer","project-learner"]},custom:{label:"Custom",description:"Starts from the safe baseline and lets you fine-tune identity, policy, and operating style by hand.",defaultName:"Custom Agent",defaultEmoji:"\uD83E\uDDE9",defaultTheme:"violet",badgeVariant:"muted",tools:["exec","read","edit","message"],skillIds:[]}},aJ={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"}},aK=Object.entries(aI).map(([a,b])=>({value:a,label:b.label,description:b.description})),aL=[{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."}],aM=[{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."}],aN=[{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."}],aO=[{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 aP(a="worker",b){return{...aJ[a],...b??{},preset:a}}function aQ(a){return aI[a].label}function aR(a){return"fs.workspaceOnly"===a?"Workspace only":a.replace(/^agent-policy-/,"").replace(/^project-/,"").replace(/[._-]+/g," ").trim().replace(/\b\w/g,a=>a.toUpperCase())}function aS(a){return aL.find(b=>b.value===a)?.label??a}function aT(a){return aM.find(b=>b.value===a)?.label??a}function aU(a){return aN.find(b=>b.value===a)?.label??a}function aV(a){return aO.find(b=>b.value===a)?.label??a}function aW(a,b){let c=new Map;for(let e of a){var d;let a=e.value.trim();if(!a)continue;let f=c.get(a);if(!f){c.set(a,{...e,value:a,label:e.label||a,description:e.description||"",sourceLabel:e.sourceLabel||"OpenClaw",sourceRank:e.sourceRank??99,kind:e.kind||b,category:e.category});continue}f.description=f.description||e.description,d=f.sourceLabel,f.sourceLabel=aY([d,e.sourceLabel].filter(a=>!!a)).join(" \xb7 "),f.sourceRank=Math.min(f.sourceRank,e.sourceRank??f.sourceRank),f.category=f.category??e.category}return Array.from(c.values()).sort((a,b)=>{let c=a.sourceRank-b.sourceRank;if(0!==c)return c;let d=a.label.localeCompare(b.label);return 0!==d?d:a.value.localeCompare(b.value)})}function aX(a,b,c,d=8){let e=b.trim().toLowerCase(),f=new Set(aY(c));return a.filter(a=>!f.has(a.value)).filter(a=>!e||5>a$(a,e)).sort((a,b)=>{let c=a$(a,e),d=a$(b,e);if(c!==d)return c-d;let f=a.sourceRank-b.sourceRank;return 0!==f?f:a.label.localeCompare(b.label)}).slice(0,d)}function aY(a){let b=new Set,c=[];for(let d of a){if("string"!=typeof d)continue;let a=d.trim();!a||b.has(a)||(b.add(a),c.push(a))}return c}function aZ(a,b){return a.length===b.length&&a.every((a,c)=>a===b[c])}function a$(a,b){if(!b)return 0;let c=[a.value.toLowerCase(),a.label.toLowerCase(),a.description.toLowerCase(),a.sourceLabel.toLowerCase()];return c.some(a=>a===b)?0:c.some(a=>a.startsWith(b))?1:c.some(a=>a.includes(b))?2:5}function a_({open:a,agentId:b,initialFocus:c="skills",snapshot:e,onOpenChange:f,onSnapshotChange:i,onRefresh:j}){let k=b?e.agents.find(a=>a.id===b)??null:null,l=e.workspaces.find(a=>a.id===k?.workspaceId),[m,n]=(0,g.useState)(null),[o,p]=(0,g.useState)(null),[q,r]=(0,g.useState)(!1),[s,t]=(0,g.useState)(!1),[v,w]=(0,g.useState)(null),[y,z]=(0,g.useState)(""),[A,B]=(0,g.useState)(""),[C,D]=(0,g.useState)([]),[E,F]=(0,g.useState)([]),G=(0,g.useRef)(null),H=(0,g.useRef)(null);(0,g.useRef)(e);let I="tools"===c?"tools":"skills",K="skills"===I,L="tools"===I,M=k?aI[k.policy.preset]:null,N=aY(k?.skills??[]),O=aY((k?.tools??[]).filter(a=>"fs.workspaceOnly"!==a)),P=N.length>0?N:aY(M?.skillIds??[]),Q=O.length>0?O:aY(M?.tools??[]),R=k?.tools.includes("fs.workspaceOnly")?["fs.workspaceOnly"]:[],S=aY(k?.observedTools??[]),T=aY(l?.bootstrap.localSkillIds??[]),U=(0,g.useMemo)(()=>[...aG,...aH],[]),V=(0,g.useMemo)(()=>aW([...(m?.skills??[]).map(a=>{var b;return{value:a.name,label:a.name,description:a.description,sourceLabel:"openclaw-bundled"===(b=a.source)?"OpenClaw bundled":"workspace"===b?"Workspace":b,sourceRank:+("openclaw-bundled"!==a.source),kind:"skill"}}),...T.map(a=>({value:a,label:a,description:"Workspace-local SKILL.md scaffold.",sourceLabel:"Workspace",sourceRank:0,kind:"skill",category:"workspace"})),...C.filter(a=>!(m?.skills??[]).some(b=>b.name===a)).map(a=>({value:a,label:a,description:"Already configured on this agent.",sourceLabel:"Current agent",sourceRank:2,kind:"skill",category:"custom"}))],"skill"),[m?.skills,C,T]),W=(0,g.useMemo)(()=>aW([...U.map(a=>({value:a.name,label:a.name,description:a.description,sourceLabel:"builtin"===a.category?"OpenClaw built-in":"group"===a.category?"OpenClaw docs":a.source,sourceRank:"builtin"===a.category?0:"plugin"===a.category?1:2,kind:"tool",category:a.category})),...E.filter(a=>"fs.workspaceOnly"!==a&&!(m?.tools??[]).some(b=>b.name===a)).map(a=>({value:a,label:a,description:"Already configured on this agent.",sourceLabel:"Current agent",sourceRank:3,kind:"tool",category:"custom"})),...S.filter(a=>"fs.workspaceOnly"!==a&&!(m?.tools??[]).some(b=>b.name===a)&&!O.includes(a)).map(a=>({value:a,label:a,description:"Recovered from runtime transcripts.",sourceLabel:"Observed",sourceRank:4,kind:"tool",category:"custom"}))],"tool"),[m?.tools,O,E,U,S]),X=(0,g.useMemo)(()=>aX(V,y,C,1/0),[C,y,V]),Y=(0,g.useMemo)(()=>aX(W,A,E,1/0),[E,A,W]);if(!k)return null;let Z=K?P:N,$=L?Q:O,_=K?aY(C):N,aa=L?aY(E):O,ab=!aZ(_,Z)||!aZ(aa,$),ac=async()=>{if(aZ(_,Z)&&aZ(aa,$))return void f(!1);t(!0),w(null);try{let a={id:k.id};K?a.skills=_:a.tools=aa;let b=await fetch("/api/agents",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json();if(!b.ok)throw Error(c.error||"Unable to update agent capabilities.");i?.(a=>(function(a,b,c,d){let e=aY(c),f=aY(d),g=a.agents.map(a=>a.id===b?{...a,skills:e,tools:f}:a),h=g.find(a=>a.id===b);if(!h)return a;let i=a.workspaces.map(a=>{if(a.id!==h.workspaceId)return a;let b=g.filter(b=>b.workspaceId===a.id);return{...a,capabilities:{...a.capabilities,skills:aY(b.flatMap(a=>a.skills)),tools:aY(b.flatMap(a=>a.tools)),workspaceOnlyAgentCount:b.filter(a=>a.tools.includes("fs.workspaceOnly")).length}}});return{...a,agents:g,workspaces:i}})(a,k.id,_,aa)),aC.oR.success("Agent capabilities updated."),f(!1);let d=j?.();d&&d.catch(()=>void 0)}catch(b){let a=b instanceof Error?b.message:"Unable to update agent capabilities.";w(a),aC.oR.error(a)}finally{t(!1)}};return(0,d.jsx)(ae,{open:a,onOpenChange:f,children:(0,d.jsx)(aj,{className:"w-[min(680px,calc(100vw-1.5rem))] max-h-[calc(100dvh-1.5rem)] overflow-hidden rounded-[24px] border-white/10 bg-[linear-gradient(180deg,rgba(7,10,18,0.98),rgba(4,7,14,0.98))] p-0",children:(0,d.jsxs)("div",{className:"flex max-h-[calc(100dvh-1.5rem)] min-h-0 flex-col",children:[(0,d.jsxs)(ak,{className:"border-b border-white/[0.08] px-4 py-2.5",children:[(0,d.jsx)(am,{className:"text-[0.95rem]",children:`Edit ${K?"skills":"tools"} \xb7 ${J(k)}`}),(0,d.jsx)(an,{className:"sr-only",children:"Edit the selected agent's skills or tools and save the updated capability set."}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1 pt-0.5",children:(0,d.jsx)(u,{variant:"muted",className:"h-5 border-white/[0.08] px-2 py-0 text-[10px] font-normal tracking-[0.06em] normal-case",children:aQ(k.policy.preset)})})]}),(0,d.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[(0,d.jsx)("div",{className:"px-4 py-4",children:(0,d.jsx)(aD,{title:K?"Skills":"Tools",selectedValues:K?C:E,selectedTone:K?"cyan":"amber",selectedEmptyLabel:K?"No explicit skills":"No explicit tools configured",lockedValues:L?R:[],observedValues:L?S:[],inputRef:K?G:H,inputValue:K?y:A,onInputValueChange:K?z:B,onRemove:a=>{K?D(b=>b.filter(b=>b!==a)):F(b=>b.filter(b=>b!==a))},onPick:a=>{K?(D(b=>aY([...b,a])),z("")):(F(b=>aY([...b,a])),B(""))},suggestions:K?X:Y,emptySuggestionLabel:q&&(K?X.length:Y.length)===0?K?"Loading OpenClaw skill catalog...":"Loading OpenClaw tool catalog...":K?"No matching skills found.":"No matching tools found.",loading:q,catalogError:o,helperLabel:K?"Workspace skills and OpenClaw skills are shown first in Available to add.":"Built-ins, plugins, and groups are shown first in Available to add. Observed tools are read-only.",currentHintLabel:K?"Click \xd7 on a current skill to remove it.":"Click \xd7 on a current tool to remove it.",highlight:!0})}),v?(0,d.jsx)("div",{className:"border-t border-white/[0.08] px-4 py-3",children:(0,d.jsx)("p",{className:"text-[12px] leading-5 text-rose-300",children:v})}):null]}),(0,d.jsxs)(al,{className:"border-t border-white/[0.08] px-4 py-2 sm:flex-row",children:[(0,d.jsx)(x,{type:"button",variant:"secondary",onClick:()=>f(!1),disabled:s,className:"h-8 rounded-full px-2.5 text-[10px]",children:"Cancel"}),(0,d.jsxs)(x,{type:"button",onClick:()=>{ac()},disabled:s||!ab,className:"h-8 rounded-full px-2.5 text-[10px]",children:[s?(0,d.jsx)(h.A,{className:"mr-1 h-3.5 w-3.5 animate-spin"}):null,"Save changes"]})]})]})})})}var a0=c(87503),a1=c(59759),a2=c(6079),a3=c(26645),a4=c(44218),a5=c(36411),a6=c(1191),a7=c(65255),a8=c(19794),a9=c(80600);let ba=[{provider:"telegram",label:"Telegram",kind:"chat",description:"Bot accounts, public groups, and delegated community routing.",iconKey:"siTelegram",accentColor:"#26A5E4",supportsProvisioning:!0,provisionFields:[{key:"token",label:"Bot token",placeholder:"123456:ABC...",inputType:"password",secret:!0,required:!0,section:"basic"}],supportsRouteDiscovery:!0,providerManagedByOpenClaw:!0},{provider:"discord",label:"Discord",kind:"chat",description:"Servers, channels, DMs, and thread-aware team routing.",iconKey:"siDiscord",accentColor:"#5865F2",supportsProvisioning:!0,provisionFields:[{key:"token",label:"Bot token",placeholder:"Discord bot token",inputType:"password",secret:!0,required:!0,section:"basic"}],supportsRouteDiscovery:!0,providerManagedByOpenClaw:!0},{provider:"slack",label:"Slack",kind:"chat",description:"Workspace apps, channels, and internal team handoffs.",iconKey:"siSlack",accentColor:"#4A154B",supportsProvisioning:!0,provisionFields:[{key:"botToken",label:"Bot token",placeholder:"xoxb-...",inputType:"password",secret:!0,required:!0,section:"basic"}],supportsRouteDiscovery:!1,providerManagedByOpenClaw:!0},{provider:"googlechat",label:"Google Chat",kind:"chat",description:"Spaces and enterprise chat surfaces backed by OpenClaw.",iconKey:"siGooglechat",accentColor:"#34A853",supportsProvisioning:!0,provisionFields:[{key:"webhookUrl",label:"Webhook URL",placeholder:"https://chat.googleapis.com/...",inputType:"url",secret:!0,required:!0,section:"basic"}],supportsRouteDiscovery:!1,providerManagedByOpenClaw:!0},{provider:"gmail",label:"Gmail",kind:"inbox",description:"Inbox ownership, draft/send workflows, and Gmail-triggered automations.",iconKey:"siGmail",accentColor:"#EA4335",supportsProvisioning:!0,provisionFields:[{key:"account",label:"Account email",placeholder:"agent@example.com",inputType:"text",required:!0,section:"basic"},{key:"project",label:"Project ID",placeholder:"openclaw-project",section:"basic"},{key:"label",label:"Label",placeholder:"inbox",section:"basic"},{key:"hookToken",label:"Hook token",placeholder:"shared-secret",inputType:"password",secret:!0,section:"basic"},{key:"hookUrl",label:"Hook URL",placeholder:"https://your-host.example/gmail-pubsub",inputType:"url",section:"advanced"},{key:"topic",label:"Topic",placeholder:"gmail-topic",section:"advanced"},{key:"subscription",label:"Subscription",placeholder:"gmail-subscription",section:"advanced"},{key:"pushToken",label:"Push token",placeholder:"push-secret",inputType:"password",secret:!0,section:"advanced"},{label:"Serve port",placeholder:"8788",key:"serve.port",inputType:"number",section:"advanced"},{key:"serve.bind",label:"Serve bind",placeholder:"127.0.0.1",section:"advanced"},{key:"serve.path",label:"Serve path",placeholder:"/",section:"advanced"},{key:"includeBody",label:"Include body",inputType:"checkbox",defaultValue:!0,section:"advanced"},{key:"maxBytes",label:"Max bytes",placeholder:"20000",inputType:"number",section:"advanced"},{key:"renewEveryMinutes",label:"Renew interval (minutes)",placeholder:"720",inputType:"number",section:"advanced"},{key:"tailscale.mode",label:"Tailscale mode",placeholder:"funnel",defaultValue:"funnel",inputType:"select",options:[{label:"Off",value:"off"},{label:"Serve",value:"serve"},{label:"Funnel",value:"funnel"}],helpText:"One of funnel, serve, or off.",section:"advanced"},{key:"tailscale.path",label:"Tailscale path",placeholder:"/gmail-pubsub",section:"advanced"},{key:"tailscale.target",label:"Tailscale target",placeholder:"http://127.0.0.1:8788/gmail-pubsub",inputType:"url",section:"advanced"},{key:"pushEndpoint",label:"Push endpoint",placeholder:"https://public.example/gmail-push",inputType:"url",section:"advanced"},{key:"model",label:"Model",placeholder:"openrouter/meta-llama/llama-3.3-70b-instruct:free",section:"advanced"},{key:"thinking",label:"Thinking",placeholder:"off",section:"advanced"}],supportsRouteDiscovery:!1,providerManagedByOpenClaw:!0},{provider:"email",label:"Email",kind:"inbox",description:"Generic email inboxes and send/read workflows exposed through OpenClaw.",iconKey:"siMaildotru",accentColor:"#0F172A",supportsProvisioning:!0,provisionFields:[{key:"address",label:"Address",placeholder:"inbox@example.com",inputType:"text",required:!0,section:"basic"},{key:"oauth",label:"OAuth config",placeholder:'{"clientId":"...","clientSecret":"..."}',inputType:"textarea",helpText:"Paste JSON or a provider-specific OAuth configuration blob.",section:"basic"},{key:"watch",label:"Watch",inputType:"checkbox",defaultValue:!0,section:"basic"},{key:"pubsub",label:"Pub/Sub",placeholder:"projects/project-id/topics/email-events",section:"basic"},{key:"imap.host",label:"IMAP host",placeholder:"imap.example.com",inputType:"text",section:"advanced"},{key:"imap.port",label:"IMAP port",placeholder:"993",inputType:"number",section:"advanced"},{key:"smtp.host",label:"SMTP host",placeholder:"smtp.example.com",inputType:"text",section:"advanced"},{key:"smtp.port",label:"SMTP port",placeholder:"587",inputType:"number",section:"advanced"},{key:"username",label:"Username",placeholder:"mailbox-user",inputType:"text",section:"advanced"},{key:"password",label:"Password",placeholder:"app password",inputType:"password",secret:!0,section:"advanced"}],supportsRouteDiscovery:!1,providerManagedByOpenClaw:!0},{provider:"webhook",label:"Webhook",kind:"trigger",description:"External event triggers delivered into OpenClaw automations.",iconKey:"siWebhook",accentColor:"#0EA5E9",supportsProvisioning:!0,provisionFields:[{key:"token",label:"Hook token",placeholder:"shared-secret",inputType:"password",secret:!0,required:!0,section:"basic"},{key:"path",label:"Path",placeholder:"/hooks",section:"basic"}],supportsRouteDiscovery:!1,providerManagedByOpenClaw:!0},{provider:"cron",label:"Cron",kind:"trigger",description:"Scheduled tasks and recurring automation entry points.",iconKey:"siClockify",accentColor:"#F59E0B",supportsProvisioning:!0,provisionFields:[{key:"webhookToken",label:"Webhook token",placeholder:"replace-with-dedicated-webhook-token",inputType:"password",secret:!0,required:!0,section:"basic"},{key:"sessionRetention",label:"Session retention",placeholder:"24h",section:"basic"},{key:"maxConcurrentRuns",label:"Max concurrent runs",placeholder:"1",inputType:"number",section:"basic"},{key:"store",label:"Store path",placeholder:"~/.openclaw/cron/jobs.json",section:"advanced"},{key:"runLog.maxBytes",label:"Run log max bytes",placeholder:"2mb",section:"advanced"},{key:"runLog.keepLines",label:"Run log keep lines",placeholder:"2000",inputType:"number",section:"advanced"}],supportsRouteDiscovery:!1,providerManagedByOpenClaw:!0}],bb=new Map(ba.map(a=>[a.provider,a]));function bc(a){return bb.get(a)??{provider:a,label:bd(a),kind:"chat",description:"OpenClaw-managed integration surface.",supportsProvisioning:!1,provisionFields:[],supportsRouteDiscovery:!1,providerManagedByOpenClaw:!0}}function bd(a){let b=bb.get(a);return b?b.label:a.split(/[-_]/).filter(Boolean).map(a=>a.slice(0,1).toUpperCase()+a.slice(1)).join(" ")}function be(a){return Array.from(new Set(a.map(a=>a.trim()).filter(Boolean).filter(Boolean)))}function bf(a,b){return a.channelRegistry.channels.filter(a=>a.workspaces.some(a=>a.workspaceId===b)).sort((a,b)=>{let c=bc(a.type).kind,d=bc(b.type).kind;return c!==d?c.localeCompare(d):a.type!==b.type?bc(a.type).label.localeCompare(bc(b.type).label):a.name.localeCompare(b.name)})}function bg(a,b,c){return bf(a,b).filter(a=>a.primaryAgentId===c||a.workspaces.some(a=>a.workspaceId===b&&(a.agentIds.includes(c)||a.groupAssignments.some(a=>!1!==a.enabled&&a.agentId===c)))).map(a=>a.id)}function bh(a,b){return{...a,channelRegistry:b}}async function bi(a){let b=be(a.currentChannelIds),c=be(a.nextChannelIds),d=c.filter(a=>!b.includes(a)),e=b.filter(a=>!c.includes(a));for(let b of d){let c=await fetch(`/api/workspaces/${encodeURIComponent(a.workspaceId)}/channels`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"bind-agent",channelId:b,agentId:a.agentId,workspacePath:a.workspacePath})}),d=await c.json();if(!c.ok||d.error)throw Error(d.error||"OpenClaw could not bind the channel.");d.registry&&a.onRegistryChange&&a.onRegistryChange(a=>bh(a,d.registry))}for(let b of e){let c=await fetch(`/api/workspaces/${encodeURIComponent(a.workspaceId)}/channels`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"unbind-agent",channelId:b,agentId:a.agentId})}),d=await c.json();if(!c.ok||d.error)throw Error(d.error||"OpenClaw could not unbind the channel.");d.registry&&a.onRegistryChange&&a.onRegistryChange(a=>bh(a,d.registry))}}function bj({snapshot:a,workspaceId:b,channelIds:c,agentId:e,isSaving:f,onChange:g,surfaceTheme:i="dark"}){let j=bf(a,b),k=new Set(c),l="light"===i;return 0===j.length?(0,d.jsx)("div",{className:s("rounded-[22px] border p-3.5",l?"border-[#e1d5c8] bg-white/92 shadow-[0_14px_34px_rgba(161,125,101,0.08)]":"border-white/10 bg-white/[0.03]"),children:(0,d.jsx)("div",{className:"flex items-start justify-between gap-3",children:(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:s("text-[13px] font-medium",l?"text-[#3f2f24]":"text-white"),children:"Surface participation"}),(0,d.jsx)("p",{className:s("mt-1 text-[11px] leading-4",l?"text-[#7b6657]":"text-slate-400"),children:"Connect workspace surfaces first. Primary agents own the surface; selected agents assist behind the scenes."})]})})}):(0,d.jsxs)("div",{className:s("rounded-[22px] border p-3.5",l?"border-[#e1d5c8] bg-white/92 shadow-[0_14px_34px_rgba(161,125,101,0.08)]":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsx)("div",{className:"flex items-start justify-between gap-3",children:(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:s("text-[13px] font-medium",l?"text-[#3f2f24]":"text-white"),children:"Surface participation"}),(0,d.jsx)("p",{className:s("mt-1 text-[11px] leading-4",l?"text-[#7b6657]":"text-slate-400"),children:"Primary agents own the surface. Selected surfaces let this agent assist the owner internally."})]})}),f?(0,d.jsxs)("div",{className:s("mt-3 inline-flex items-center gap-2 rounded-full border px-3 py-1 text-[10px]",l?"border-[#c89e73]/25 bg-[#f5eadf] text-[#6b4f39]":"border-cyan-300/20 bg-cyan-400/[0.08] text-cyan-50"),children:[(0,d.jsx)(h.A,{className:"h-3.5 w-3.5 animate-spin"}),(0,d.jsx)("span",{children:"Applying surface changes..."})]}):null,(0,d.jsx)("div",{className:"mt-4 space-y-3",children:j.map(h=>{var i;let j=k.has(h.id),m=!!(e&&h.primaryAgentId===e),n=(i=h.primaryAgentId)?J(a.agents.find(a=>a.id===i)??{name:i}):null,o=h.workspaces.find(a=>a.workspaceId===b)??null,p=o?.agentIds.length??0;return(0,d.jsxs)("div",{className:s("flex items-center justify-between gap-3 rounded-[18px] border px-3.5 py-2.5",j?l?"border-[#c89e73]/45 bg-[#fff7ef]":"border-cyan-300/40 bg-cyan-400/[0.08]":l?"border-[#e2d6ca] bg-white":"border-white/8 bg-white/[0.02]"),children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("p",{className:s("truncate text-[13px] font-medium",l?"text-[#3f2f24]":"text-white"),children:h.name}),(0,d.jsx)(u,{variant:"muted",className:s("h-4 rounded-full px-2 text-[9px]",l?"border-[#e1d5c8] bg-[#fbf7f2] text-[#6f5747]":""),children:h.type}),m?(0,d.jsx)(u,{className:s("h-4 rounded-full px-2 text-[9px]",l?"border-[#c89e73]/35 bg-[#f5e7d8] text-[#6a4a34]":""),children:"Owner"}):j?(0,d.jsx)(u,{className:s("h-4 rounded-full px-2 text-[9px]",l?"border-[#c89e73]/35 bg-[#f5e7d8] text-[#6a4a34]":""),children:"Assistant"}):null,p>1?(0,d.jsx)(u,{variant:"muted",className:s("h-4 rounded-full px-2 text-[9px]",l?"border-[#e1d5c8] bg-[#fbf7f2] text-[#6f5747]":""),children:"Team"}):null]}),(0,d.jsxs)("p",{className:s("mt-1 truncate text-[10px]",l?"text-[#7f6958]":"text-slate-400"),children:[h.id,n?` \xb7 owner ${n}`:""]})]}),(0,d.jsx)(x,{type:"button",variant:j?"secondary":"default",size:"sm",className:s("h-8 rounded-full px-2.5 text-[10px]",l&&!j?"shadow-none":""),disabled:!!f||j&&m,onClick:()=>g(k.has(h.id)?c.filter(a=>a!==h.id):[...c,h.id]),children:j?m?"Owner":"Remove":"Assist"})]},h.id)})})]})}var bk=c(37553);let bl=(0,p.F)("text-xs font-medium uppercase tracking-[0.18em] text-slate-400"),bm=g.forwardRef(({className:a,...b},c)=>(0,d.jsx)(bk.b,{ref:c,className:s(bl(),a),...b}));bm.displayName=bk.b.displayName;let bn=[{value:"15m",label:"15 min"},{value:"30m",label:"30 min"},{value:"60m",label:"1 hour"},{value:"240m",label:"4 hours"}];function bo(a){return"monitoring"===a?{enabled:!0,every:"30m"}:{enabled:!1,every:"30m"}}function bp(a,b){let c=bo(a),d="string"==typeof b?.every&&b.every.trim()&&"disabled"!==b.every?b.every.trim():c.every;return"boolean"==typeof b?.enabled?{enabled:b.enabled,every:d}:b?.every==="disabled"?{enabled:!1,every:d}:c}function bq(a,b,c){let d=bo(b);return a.enabled!==d.enabled||a.every!==d.every?a:bo(c)}function br({label:a,htmlFor:b,children:c,surfaceTheme:e="dark"}){return(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)(bm,{htmlFor:b,className:s("text-[10px] uppercase tracking-[0.16em]","light"===e?"text-[#8d7766]":"text-slate-400"),children:a}),c]})}function bs({preset:a,active:b,onClick:c,surfaceTheme:e="dark"}){let f=aI[a],g=bo(a),h="light"===e;return(0,d.jsx)("button",{type:"button",onClick:c,"aria-pressed":b,className:s("flex h-full min-h-[200px] min-w-0 flex-col justify-between rounded-[24px] border p-4 text-left transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 snap-start",h?"border-[#e3d7cc] bg-white/92 shadow-[0_16px_34px_rgba(161,125,101,0.08)] focus-visible:ring-[#c89e73]/30 hover:border-[#d3c0b2] hover:bg-white":"border-white/10 bg-white/[0.03] shadow-[0_12px_28px_rgba(0,0,0,0.22)] focus-visible:ring-cyan-300/40 hover:border-white/20 hover:bg-white/[0.05]",b&&(h?"border-[#c89e73] bg-[#fff8f0] shadow-[0_18px_44px_rgba(161,125,101,0.14)]":"border-cyan-300/30 bg-cyan-400/10 shadow-[0_0_0_1px_rgba(34,211,238,0.08)]")),children:(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-3",children:[(0,d.jsx)("span",{className:s("inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-2xl border text-[15px]",h?"border-[#ded0c2] bg-[#faf5ef] text-[#7b604c]":"border-white/10 bg-white/5 text-white"),children:f.defaultEmoji??(0,d.jsx)(a2.A,{className:"h-4 w-4"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:s("line-clamp-2 break-words text-[14px] font-semibold leading-5",h?"text-[#2f2016]":"text-white"),children:f.label}),(0,d.jsx)("p",{className:s("mt-1 line-clamp-3 text-[12px] leading-5",h?"text-[#6d5849]":"text-slate-400"),children:f.description})]})]}),(0,d.jsx)(u,{variant:b?"default":"muted",className:s("shrink-0 px-2 py-0.5 text-[9px] normal-case tracking-normal",h?b?"border-[#c89e73]/35 bg-[#f4e6d8] text-[#5f432f]":"border-[#e1d5c8] bg-white text-[#846a58]":b?"border-cyan-300/30 bg-cyan-400/10 text-cyan-50":"border-white/10 bg-white/5 text-slate-300"),children:b?"selected":"preset"})]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsxs)(u,{variant:"muted",className:s("px-2 py-0.5 text-[10px] normal-case tracking-normal",h?"border-[#e1d5c8] bg-[#fbf7f2] text-[#6f5747]":""),children:[f.tools.length," tools"]}),(0,d.jsxs)(u,{variant:"muted",className:s("px-2 py-0.5 text-[10px] normal-case tracking-normal",h?"border-[#e1d5c8] bg-[#fbf7f2] text-[#6f5747]":""),children:[f.skillIds.length," skills"]}),(0,d.jsxs)(u,{variant:g.enabled?"success":"muted",className:s("px-2 py-0.5 text-[10px] normal-case tracking-normal",h?g.enabled?"border-emerald-300/40 bg-emerald-100 text-emerald-800":"border-[#e1d5c8] bg-[#fbf7f2] text-[#6f5747]":""),children:["Heartbeat ",g.enabled?g.every:"off"]})]})]})})}function bt({label:a,htmlFor:b,value:c,options:e,onChange:f,surfaceTheme:g="dark"}){let h="light"===g,i=e.find(a=>a.value===c);return(0,d.jsxs)(br,{label:a,htmlFor:b,surfaceTheme:g,children:[(0,d.jsx)("select",{id:b,value:c,onChange:a=>f(a.target.value),style:h?{colorScheme:"light"}:void 0,className:s("flex h-10 w-full rounded-2xl border px-3.5 py-2 text-[13px] outline-none transition-colors",h?"border-[#dccfc3] bg-white text-[#3f2f24] placeholder:text-[#9b8573] focus:border-[#c89e73] focus:ring-2 focus:ring-[#c89e73]/15":"border-white/10 bg-white/5 text-white placeholder:text-slate-500 focus:border-cyan-300/30 focus:ring-2 focus:ring-cyan-300/15"),children:e.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))}),i?.description?(0,d.jsx)("p",{className:s("mt-1 text-[10px] leading-[1.4]",h?"text-[#9a8070]":"text-slate-500"),children:i.description}):null]})}function bu(a,b={}){let c=aP(b.policy?.preset??"worker",b.policy),d=aI[c.preset],e=bp(c.preset,b.heartbeat);return{workspaceId:a,modelId:b.modelId??"",name:b.name??d.defaultName,emoji:b.emoji??d.defaultEmoji,theme:b.theme??d.defaultTheme,avatar:b.avatar??"",policy:c,heartbeat:e,channelIds:Array.from(new Set((b.channelIds??[]).filter(a=>"string"==typeof a&&!!a.trim())))}}function bv(a){return a.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function bw(a,b){let c=aI[a.policy.preset],d=aI[b],e=aP(b);return{...a,name:a.name&&a.name!==c.defaultName?a.name:d.defaultName,emoji:a.emoji&&a.emoji!==c.defaultEmoji?a.emoji:d.defaultEmoji,theme:a.theme&&a.theme!==c.defaultTheme?a.theme:d.defaultTheme,policy:e,heartbeat:bq(a.heartbeat,a.policy.preset,b)}}function bx({snapshot:a,defaultWorkspaceId:b,onRefresh:c,onSnapshotChange:e,onAgentCreated:f,onAgentCreatedVisible:i,trigger:j,surfaceTheme:k="dark"}){var l,m,n,o,p;let q="light"===k,r=b??a.workspaces[0]?.id??"",[t,v]=(0,g.useState)(!1),[w,z]=(0,g.useState)(!1),[A,B]=(0,g.useState)(!1),[C,D]=(0,g.useState)("start"),[E,F]=(0,g.useState)(null),[G,H]=(0,g.useState)("worker"),[I,K]=(0,g.useState)(null),[L,M]=(0,g.useState)(""),[N,O]=(0,g.useState)(!1),[P,Q]=(0,g.useState)("idle"),[R,S]=(0,g.useState)(null),T=(0,g.useRef)(!1),U=(0,g.useRef)(null),[V,W]=(0,g.useState)(()=>by(r)),X=(0,g.useRef)(null),Y=a.workspaces.find(a=>a.id===V.workspaceId)??null,Z=aI[V.policy.preset],$=function(a,b,c){var d,e;let f,g,h=(d=b,e=c,f=bv(d??""),g=bv(e)||"agent",f?`${f}-${g}`:g);if(!h)return"";let i=new Set(a.map(a=>a.id));if(!i.has(h))return h;let j=2,k=`${h}-${j}`;for(;i.has(k);)j+=1,k=`${h}-${j}`;return k}(a.agents,Y?.slug,V.name||Z.defaultName),_=I?a.agents.find(a=>a.id===I)??null:null,aa=_?a.workspaces.find(a=>a.id===_.workspaceId)??null:null,ab=(0,g.useMemo)(()=>{let b=L.trim().toLowerCase();return[...a.agents].filter(c=>{if(!b)return!0;let d=a.workspaces.find(a=>a.id===c.workspaceId)?.name??c.workspaceId,e=aI[c.policy.preset].label;return[J(c),c.id,c.workspaceId,d,e,c.modelId].join(" ").toLowerCase().includes(b)}).sort((a,b)=>{if(I){if(a.id===I)return -1;if(b.id===I)return 1}return J(a).localeCompare(J(b))})},[L,I,a.agents,a.workspaces]),ac=bz(E),ad=bA(E,C),ag=!!($&&Y)&&!N,ai="details"===C?ag:(l=C,m=E,n=I,"start"===l?!!m:"preset"===l||"import"!==l||!!n);R&&a.agents.some(a=>a.id===R);let ak="creating"===P?"Creating the agent and updating the workspace AGENTS.md role section.":"syncing"===P?"Agent created. Waiting for the canvas card to appear.":null,ao=a=>{if(a||!N&&"idle"===P){let b;B(a),a||(b=by(r),D("start"),F(null),H("worker"),K(null),M(""),W(b),O(!1),Q("idle"),S(null),X.current&&(clearTimeout(X.current),X.current=null),T.current=!1)}},ap=a=>{let b=by(V.workspaceId||r);b.modelId=V.modelId,F(a),H("worker"),K(null),M(""),W(b),"empty"===a?D("details"):D("start")},ar=async()=>{if(!T.current&&$&&Y){T.current=!0,O(!0),Q("creating"),S(null);try{let a=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...V,id:$})}),b=await a.json();if(!a.ok||b.error||!b.agentId)throw Error(b.error||"OpenClaw could not create the agent.");V.channelIds.length>0&&await bi({workspaceId:V.workspaceId,workspacePath:Y.path,agentId:b.agentId,currentChannelIds:[],nextChannelIds:V.channelIds,onRegistryChange:e}),Q("syncing"),S(b.agentId),c().catch(()=>{})}catch(a){X.current&&(clearTimeout(X.current),X.current=null),Q("idle"),S(null),O(!1),aq.o.error("Agent creation failed.",{description:a instanceof Error?a.message:"Unknown agent error."})}finally{T.current=!1}}};if(!t)return(0,d.jsx)(d.Fragment,{children:j});return(0,d.jsxs)(ae,{open:A,onOpenChange:ao,children:[(0,d.jsx)(af,{asChild:!0,children:j}),(0,d.jsx)(aj,{overlayClassName:q?"bg-[#eadfd4]/72 backdrop-blur-[18px]":void 0,closeClassName:"hidden",className:s("flex h-[min(84dvh,800px)] w-[calc(100vw-10px)] max-w-[920px] flex-col overflow-hidden p-0 sm:w-[min(920px,calc(100vw-20px))]",q?"border-[#dfd2c5] bg-[linear-gradient(180deg,rgba(255,252,248,0.99),rgba(247,239,231,0.99))] text-[#3f2f24] shadow-[0_36px_120px_rgba(161,125,101,0.18)]":"border-white/10 bg-[linear-gradient(180deg,rgba(12,18,29,0.98),rgba(7,11,18,0.98))] text-slate-50 shadow-[0_36px_120px_rgba(0,0,0,0.48)]"),style:q?{colorScheme:"light"}:void 0,children:(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,d.jsxs)("div",{className:s("shrink-0 border-b px-4 py-2.5 pr-10",q?"border-[#e5d8cb] bg-[linear-gradient(180deg,rgba(255,252,248,0.98),rgba(244,235,224,0.96))]":"border-white/10 bg-[linear-gradient(180deg,rgba(14,20,34,0.98),rgba(9,13,24,0.99))]"),children:[(0,d.jsx)(an,{className:"sr-only",children:"Create a new OpenClaw agent by choosing a starter mode, editing profile and policy, and saving the workspace agent."}),"start"===C?(0,d.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)(am,{className:s("text-[18px] font-medium sm:text-[20px]",q?"text-[#37291f]":"text-white"),children:"Create New Agent"}),(0,d.jsx)("p",{className:s("mt-1 text-[12px] leading-4",q?"text-[#9a8574]":"text-slate-500"),children:"Choose a starting point."})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)("div",{className:s("inline-flex items-center gap-2 rounded-full border px-3 py-1 text-[11px]",q?"border-[#e2d3c2] bg-[#f5ece1] text-[#7e6554]":"border-white/10 bg-white/[0.04] text-slate-300"),children:[(0,d.jsx)("span",{className:s("inline-flex h-5 w-5 items-center justify-center rounded-full text-[10px] font-medium",q?"bg-[#eadccf] text-[#6f5646]":"bg-white/10 text-slate-200"),children:"1"}),(0,d.jsx)("span",{children:"Start"})]}),(0,d.jsx)(ah,{asChild:!0,children:(0,d.jsx)("button",{type:"button","aria-label":"Close dialog",className:s("inline-flex h-8 w-8 items-center justify-center rounded-full border transition-colors",q?"border-[#e2d3c2] bg-[#f5ece1] text-[#7b6657] hover:bg-[#f2e8df] hover:text-[#3f2f24]":"border-white/10 bg-white/[0.04] text-slate-300 hover:bg-white/[0.08] hover:text-white"),children:(0,d.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"h-4 w-4",children:[(0,d.jsx)("path",{d:"M18 6 6 18"}),(0,d.jsx)("path",{d:"m6 6 12 12"})]})})})]})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,d.jsx)(am,{className:s("text-[15px] font-medium sm:text-[17px]",q?"text-[#37291f]":"text-white"),children:"Create New Agent"}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(bC,{labels:ac,activeIndex:ad,surfaceTheme:k,onStepClick:a=>{if(a>=bA(E,C))return;let b=bz(E)[a];"Start"===b?D("start"):"Preset"===b?D("preset"):"Import"===b&&D("import")}}),(0,d.jsx)(ah,{asChild:!0,children:(0,d.jsx)("button",{type:"button","aria-label":"Close dialog",className:s("inline-flex h-8 w-8 items-center justify-center rounded-full border transition-colors",q?"border-[#e2d3c2] bg-[#f5ece1] text-[#7b6657] hover:bg-[#f2e8df] hover:text-[#3f2f24]":"border-white/10 bg-white/[0.04] text-slate-300 hover:bg-white/[0.08] hover:text-white"),children:(0,d.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"h-4 w-4",children:[(0,d.jsx)("path",{d:"M18 6 6 18"}),(0,d.jsx)("path",{d:"m6 6 12 12"})]})})})]})]}),(0,d.jsx)("p",{className:s("mt-1.5 max-w-[520px] text-[10px] leading-4",q?"text-[#8c7664]":"text-slate-500"),children:(o=E,"start"===(p=C)?"empty"===o?"Empty / Custom is selected. Continue to details.":"preset"===o?"Preset Library is selected. Click Next to browse presets.":"import"===o?"Import Agent is selected. Click Next to choose a source agent.":"Choose a starting point.":"preset"===p?"Pick a preset. Details come next.":"import"===p?"Select an existing agent to clone.":"empty"===o?"Custom baseline loaded. Finish the details and create it.":"preset"===o?"Preset baseline loaded. Finish the details and create it.":"import"===o?"Imported baseline loaded. Review and create.":"")})]})]}),(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 py-3.5",children:"start"===C?(0,d.jsxs)("div",{className:"mx-auto flex h-full w-full max-w-[804px] flex-col items-center justify-center space-y-3 py-6",children:[(0,d.jsxs)("div",{className:"grid w-full gap-4 md:grid-cols-3 md:justify-items-center lg:gap-5",children:[(0,d.jsx)(bE,{icon:ax.A,title:"Empty / Custom",description:"Start from scratch.",helper:"Fastest if you know the shape.",selected:"empty"===E,surfaceTheme:k,onSelect:()=>ap("empty")}),(0,d.jsx)(bE,{icon:a2.A,title:"Preset Library",description:"Use a role template.",helper:"Good for common worker roles.",selected:"preset"===E,surfaceTheme:k,onSelect:()=>ap("preset")}),(0,d.jsx)(bE,{icon:a7.A,title:"Import Agent",description:"Clone an existing agent.",helper:"Best when a baseline already exists.",selected:"import"===E,surfaceTheme:k,onSelect:()=>ap("import")})]}),(0,d.jsx)("p",{className:s("max-w-[760px] text-center text-[10px] leading-4",q?"text-[#8c7664]":"text-slate-500"),children:"Empty is the fastest path. Preset and import prefill the draft so you only adjust what matters."})]}):"preset"===C?(0,d.jsxs)("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1fr)_300px]",children:[(0,d.jsx)(bD,{title:"Browse presets",description:"Choose the role that fits the first job.",surfaceTheme:k,className:"min-w-0",children:(0,d.jsx)("div",{className:"mt-3.5 grid gap-3 sm:grid-cols-2 xl:grid-cols-2",children:aK.map(a=>(0,d.jsx)(bs,{preset:a.value,active:G===a.value,surfaceTheme:k,onClick:()=>{var b;H(b=a.value),W(a=>bw(a,b))}},a.value))})}),(0,d.jsx)(bD,{title:"Selected preset",description:"This seeds the draft before details.",surfaceTheme:k,className:"xl:sticky xl:top-4 xl:self-start xl:h-fit",children:(0,d.jsxs)("div",{className:"space-y-2.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:s("inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-2xl border text-[14px]",q?"border-[#ded0c2] bg-[#faf5ef] text-[#7b604c]":"border-white/10 bg-white/5 text-base"),children:aI[G].defaultEmoji}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:s("truncate text-[13px] font-medium",q?"text-[#3f2f24]":"text-white"),children:aI[G].label}),(0,d.jsx)("p",{className:s("mt-0.5 text-[11px] leading-4",q?"text-[#7f6958]":"text-slate-400"),children:aI[G].description})]})]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsxs)(u,{variant:"muted",className:"px-2 py-0.5 text-[9px] normal-case tracking-normal",children:[aI[G].tools.length," tools"]}),(0,d.jsxs)(u,{variant:"muted",className:"px-2 py-0.5 text-[9px] normal-case tracking-normal",children:[aI[G].skillIds.length," skills"]}),(0,d.jsxs)(u,{variant:bo(G).enabled?"success":"muted",className:"px-2 py-0.5 text-[9px] normal-case tracking-normal",children:["Heartbeat ",bo(G).enabled?bo(G).every:"off"]})]}),(0,d.jsx)(bG,{surfaceTheme:k}),(0,d.jsx)("div",{className:s("rounded-[18px] border p-2.5 text-[11px] leading-5",q?"border-[#e2d5c9] bg-[#faf6f1] text-[#7b6657]":"border-white/10 bg-white/[0.03] text-slate-400"),children:"The preset seeds the draft. You can fine-tune the name, model, policy, and heartbeat next."})]})})]}):"import"===C?(0,d.jsxs)("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1fr)_300px]",children:[(0,d.jsx)(bD,{title:"Import an existing agent",description:"Select an agent to clone.",surfaceTheme:k,className:"min-w-0",children:(0,d.jsxs)("div",{className:"mt-3.5 space-y-3",children:[(0,d.jsx)("div",{className:"relative",children:(0,d.jsx)(y,{value:L,onChange:a=>M(a.target.value),placeholder:"Search by name, id, workspace, preset, or model",className:bB(k)})}),(0,d.jsx)("div",{className:"space-y-2.5",children:ab.length>0?ab.map(b=>(0,d.jsx)(bF,{agent:b,workspaceName:a.workspaces.find(a=>a.id===b.workspaceId)?.name??b.workspaceId,selected:I===b.id,surfaceTheme:k,onSelect:()=>(b=>{var c,d,e;let f=a.agents.find(a=>a.id===b);if(!f)return;let g=V.workspaceId||r,h=g===f.workspaceId?bg(a,f.workspaceId,f.id):[];K(b),W((c=g,d=f,e=h,bu(c,{modelId:"unassigned"===d.modelId?"":d.modelId,name:J(d),emoji:d.identity.emoji??"",theme:d.identity.theme??"",avatar:d.identity.avatar??"",policy:d.policy,heartbeat:bp(d.policy.preset,{enabled:d.heartbeat.enabled,every:d.heartbeat.every??void 0}),channelIds:e})))})(b.id)},b.id)):(0,d.jsx)("div",{className:s("rounded-[20px] border border-dashed p-4 text-sm leading-6",q?"border-[#e1d5c8] bg-white text-[#7f6958]":"border-white/10 bg-white/[0.02] text-slate-400"),children:"No agents match this search. Clear the search or go back to choose another start."})})]})}),(0,d.jsx)(bD,{title:"Import summary",description:"The selected agent seeds the draft.",surfaceTheme:k,className:"xl:sticky xl:top-4 xl:self-start xl:h-fit",children:_?(0,d.jsxs)("div",{className:"space-y-2.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:s("inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-2xl border text-[14px]",q?"border-[#ded0c2] bg-[#faf5ef] text-[#7b604c]":"border-white/10 bg-white/5 text-base"),children:_.identity.emoji??"\uD83E\uDD16"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:s("truncate text-[13px] font-medium",q?"text-[#3f2f24]":"text-white"),children:J(_)}),(0,d.jsx)("p",{className:s("mt-0.5 text-[11px] leading-4",q?"text-[#7f6958]":"text-slate-400"),children:_.id})]})]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsx)(u,{variant:"muted",className:"px-2 py-0.5 text-[9px] normal-case tracking-normal",children:aa?.name??_.workspaceId}),(0,d.jsx)(u,{variant:"muted",className:"px-2 py-0.5 text-[9px] normal-case tracking-normal",children:aI[_.policy.preset].label}),(0,d.jsx)(u,{variant:"muted",className:"px-2 py-0.5 text-[9px] normal-case tracking-normal",children:"unassigned"===_.modelId?"default model":_.modelId})]}),(0,d.jsx)(bG,{surfaceTheme:k}),(0,d.jsx)("div",{className:s("rounded-[18px] border p-2.5 text-[11px] leading-5",q?"border-[#e2d5c9] bg-[#faf6f1] text-[#7b6657]":"border-white/10 bg-white/[0.03] text-slate-400"),children:"The cloned draft keeps the source baseline. You can adjust workspace-specific details next."})]}):(0,d.jsxs)("div",{className:"space-y-2.5",children:[(0,d.jsx)("div",{className:s("rounded-[18px] border border-dashed p-4 text-sm leading-6",q?"border-[#e1d5c8] bg-white text-[#7f6958]":"border-white/10 bg-white/[0.02] text-slate-400"),children:"Choose an existing agent on the left. Its configuration will be cloned into the new draft."}),(0,d.jsx)(bG,{surfaceTheme:k})]})})]}):(0,d.jsxs)("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1fr)_300px]",children:[(0,d.jsxs)("div",{className:"space-y-3.5",children:[(0,d.jsx)(bD,{title:"Core details",description:"Name, workspace, and model.",surfaceTheme:k,children:(0,d.jsxs)("div",{className:"grid gap-3.5 sm:grid-cols-2",children:[(0,d.jsx)(br,{label:"Display name",htmlFor:"create-agent-name",surfaceTheme:k,children:(0,d.jsx)(y,{id:"create-agent-name",ref:U,value:V.name,onChange:a=>W(b=>({...b,name:a.target.value})),placeholder:Z.defaultName,className:bB(k)})}),(0,d.jsx)(br,{label:"Workspace",htmlFor:"create-agent-workspace",surfaceTheme:k,children:(0,d.jsx)("select",{id:"create-agent-workspace",value:V.workspaceId,onChange:a=>W(b=>({...b,workspaceId:a.target.value,channelIds:[]})),style:q?{colorScheme:"light"}:void 0,className:bB(k),children:a.workspaces.map(a=>(0,d.jsx)("option",{value:a.id,children:a.name},a.id))})}),(0,d.jsx)(br,{label:"Model",htmlFor:"create-agent-model",surfaceTheme:k,children:(0,d.jsxs)("select",{id:"create-agent-model",value:V.modelId,onChange:a=>W(b=>({...b,modelId:a.target.value})),style:q?{colorScheme:"light"}:void 0,className:bB(k),children:[(0,d.jsx)("option",{value:"",children:"Use OpenClaw default"}),a.models.map(a=>(0,d.jsx)("option",{value:a.id,children:a.id},a.id))]})}),(0,d.jsx)("p",{className:s("text-[10px] leading-4",q?"text-[#9a8070]":"text-slate-500"),children:"OpenClaw generates the agent id automatically. Review it in the Summary panel."})]})}),(0,d.jsx)(bD,{title:"Visual identity",description:"Emoji and display customization.",surfaceTheme:k,children:(0,d.jsxs)("div",{className:"space-y-3.5",children:[(0,d.jsx)(br,{label:"Emoji",htmlFor:"create-agent-emoji",surfaceTheme:k,children:(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("span",{"aria-hidden":"true",className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 select-none text-base leading-none",children:V.emoji||Z.defaultEmoji}),(0,d.jsx)(y,{id:"create-agent-emoji",value:V.emoji,onChange:a=>W(b=>({...b,emoji:a.target.value})),placeholder:Z.defaultEmoji,className:s(bB(k),"pl-9")})]})}),(0,d.jsxs)("button",{type:"button",onClick:()=>z(a=>!a),className:s("inline-flex items-center gap-1.5 text-[10px] uppercase tracking-[0.16em] transition-colors",q?"text-[#8b7462] hover:text-[#5d4331]":"text-slate-500 hover:text-slate-300"),children:[(0,d.jsx)(a8.A,{className:s("h-3 w-3 transition-transform duration-200",w&&"rotate-90")}),w?"Hide":"Show","theme & avatar"]}),w?(0,d.jsxs)("div",{className:"grid gap-3.5 sm:grid-cols-2",children:[(0,d.jsx)(br,{label:"Theme",htmlFor:"create-agent-theme",surfaceTheme:k,children:(0,d.jsx)(y,{id:"create-agent-theme",value:V.theme,onChange:a=>W(b=>({...b,theme:a.target.value})),placeholder:Z.defaultTheme,className:bB(k)})}),(0,d.jsx)(br,{label:"Avatar URL",htmlFor:"create-agent-avatar",surfaceTheme:k,children:(0,d.jsx)(y,{id:"create-agent-avatar",value:V.avatar,onChange:a=>W(b=>({...b,avatar:a.target.value})),placeholder:"https://example.com/avatar.png",className:bB(k)})})]}):null]})}),(0,d.jsx)(bj,{snapshot:a,workspaceId:V.workspaceId,channelIds:V.channelIds,isSaving:N,surfaceTheme:k,onChange:a=>W(b=>({...b,channelIds:a}))}),(0,d.jsx)(bD,{title:"Heartbeat and policy",description:"Only override what you need.",surfaceTheme:k,children:(0,d.jsxs)("div",{className:"space-y-3.5",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:s("text-sm font-medium",q?"text-[#3f2f24]":"text-white"),children:"Heartbeat"}),(0,d.jsx)("p",{className:s("mt-1 text-xs leading-5",q?"text-[#7f6958]":"text-slate-400"),children:"Enable only for periodic watch or triage agents."})]}),(0,d.jsx)("button",{type:"button",role:"switch","aria-checked":V.heartbeat.enabled,"aria-label":"Toggle heartbeat",onClick:()=>W(a=>({...a,heartbeat:a.heartbeat.enabled?{...a.heartbeat,enabled:!1}:{...a.heartbeat,enabled:!0,every:a.heartbeat.every||bo(a.policy.preset).every}})),className:s("relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2",q?V.heartbeat.enabled?"bg-[#c89e73] focus-visible:ring-[#c89e73]/40":"bg-[#ddd0c6] focus-visible:ring-[#c89e73]/40":V.heartbeat.enabled?"bg-cyan-400 focus-visible:ring-cyan-300/40":"bg-white/20 focus-visible:ring-cyan-300/40"),children:(0,d.jsx)("span",{className:s("pointer-events-none inline-block h-5 w-5 rounded-full bg-white shadow-md ring-0 transition-transform duration-200",V.heartbeat.enabled?"translate-x-5":"translate-x-0")})})]}),V.heartbeat.enabled?(0,d.jsx)(br,{label:"Interval",htmlFor:"create-agent-heartbeat-every",surfaceTheme:k,children:(0,d.jsx)("select",{id:"create-agent-heartbeat-every",value:V.heartbeat.every,onChange:a=>W(b=>({...b,heartbeat:{...b.heartbeat,every:a.target.value}})),style:q?{colorScheme:"light"}:void 0,className:bB(k),children:bn.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))})}):null,(0,d.jsxs)("div",{className:"grid gap-3.5 sm:grid-cols-2",children:[(0,d.jsx)(bt,{label:"Missing tool behavior",htmlFor:"create-agent-missing-tools",value:V.policy.missingToolBehavior,options:aL,surfaceTheme:k,onChange:a=>W(b=>({...b,policy:{...b.policy,missingToolBehavior:a}}))}),(0,d.jsx)(bt,{label:"Install scope",htmlFor:"create-agent-install-scope",value:V.policy.installScope,options:aM,surfaceTheme:k,onChange:a=>W(b=>({...b,policy:{...b.policy,installScope:a}}))}),(0,d.jsx)(bt,{label:"File access",htmlFor:"create-agent-file-access",value:V.policy.fileAccess,options:aN,surfaceTheme:k,onChange:a=>W(b=>({...b,policy:{...b.policy,fileAccess:a}}))}),(0,d.jsx)(bt,{label:"Network access",htmlFor:"create-agent-network-access",value:V.policy.networkAccess,options:aO,surfaceTheme:k,onChange:a=>W(b=>({...b,policy:{...b.policy,networkAccess:a}}))})]})]})})]}),(0,d.jsx)("div",{className:"space-y-4",children:(0,d.jsx)(bD,{title:"Summary",description:"Review the draft before creating.",surfaceTheme:k,className:"xl:sticky xl:top-4 xl:self-start xl:h-fit",children:(0,d.jsxs)("div",{className:"space-y-2.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:s("inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-2xl border text-[14px]",q?"border-[#ded0c2] bg-[#faf5ef] text-[#7b604c]":"border-white/10 bg-white/5 text-base"),children:V.emoji||Z.defaultEmoji}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:s("truncate text-[13px] font-medium",q?"text-[#3f2f24]":"text-white"),children:V.name||Z.defaultName}),(0,d.jsx)("p",{className:s("mt-0.5 text-[11px] leading-4",q?"text-[#7f6958]":"text-slate-400"),children:Y?.name??"No workspace selected"})]})]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsx)(u,{variant:"muted",className:"px-2 py-0.5 text-[9px] normal-case tracking-normal",children:"empty"===E?"Empty / Custom":"preset"===E?`${aI[G].label} preset`:"import"===E?"Imported agent":"Start a flow"}),(0,d.jsx)(u,{variant:"muted",className:"px-2 py-0.5 text-[9px] normal-case tracking-normal",children:V.modelId||"OpenClaw default"}),(0,d.jsxs)(u,{variant:V.heartbeat.enabled?"success":"muted",className:"px-2 py-0.5 text-[9px] normal-case tracking-normal",children:["Heartbeat ",V.heartbeat.enabled?V.heartbeat.every:"off"]})]}),(0,d.jsx)(bG,{surfaceTheme:k}),(0,d.jsxs)("div",{className:s("rounded-[18px] border p-2.5 text-[11px] leading-5",q?"border-[#e2d5c9] bg-[#faf6f1] text-[#7b6657]":"border-white/10 bg-white/[0.03] text-slate-400"),children:[(0,d.jsx)("p",{className:s("text-[10px] uppercase tracking-[0.18em]",q?"text-[#8b7462]":"text-slate-500"),children:"Generated id"}),(0,d.jsx)("code",{className:s("mt-1.5 block break-all rounded-2xl border px-3 py-1.5 text-[11px]",q?"border-[#dccfc3] bg-white text-[#4d392e]":"border-white/10 bg-white/5 text-slate-200"),children:$||"unavailable"})]})]})})})]})}),(0,d.jsx)(al,{className:s("shrink-0 border-t px-6 py-4",q?"border-[#e5d8cb] bg-[#faf6f1]":"border-white/10 bg-transparent"),children:(0,d.jsxs)("div",{className:"flex w-full flex-col gap-3",children:[ak?(0,d.jsxs)("div",{className:s("inline-flex items-start gap-2 rounded-2xl border px-3 py-2 text-[11px] leading-4",q?"border-[#ddcfbf] bg-white text-[#6e5646]":"border-white/10 bg-white/[0.04] text-slate-300"),children:[(0,d.jsx)(h.A,{className:"mt-0.5 h-3.5 w-3.5 animate-spin shrink-0"}),(0,d.jsx)("span",{children:ak})]}):null,(0,d.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsx)(x,{type:"button",variant:"secondary",size:"sm",onClick:()=>ao(!1),disabled:N,className:q?"border-[#d8c7b8] bg-white text-[#4d392f] hover:bg-[#f5efe9]":void 0,children:"Cancel"}),(0,d.jsxs)("div",{className:"flex flex-col-reverse gap-2 sm:flex-row sm:items-center",children:["start"!==C?(0,d.jsx)(x,{type:"button",variant:"secondary",size:"sm",onClick:()=>{"details"===C?D("empty"===E?"start":E??"start"):("preset"===C||"import"===C)&&D("start")},disabled:N,className:q?"border-[#d8c7b8] bg-white text-[#4d392f] hover:bg-[#f5efe9]":void 0,children:"Back"}):null,(0,d.jsx)(x,{type:"button",size:"sm",onClick:()=>{"details"===C?ar():(()=>{if("start"===C){if(!E)return;if("empty"===E)return D("details");if("preset"===E){W(a=>bw(a,G)),D("preset");return}return D(E)}if("preset"===C)return D("details");if("import"===C){if(!I)return;D("details")}})()},disabled:!ai,className:q?"bg-[#c89e73] text-white shadow-[0_10px_26px_rgba(161,125,101,0.22)] hover:bg-[#b47f53]":void 0,children:"details"===C?N?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.A,{className:"mr-2 h-3.5 w-3.5 animate-spin"}),"syncing"===P?"Syncing canvas...":"Creating..."]}):"Create agent":"start"===C&&"empty"===E?"Continue":"Next"})]})]})]})})]})})]})}function by(a){return bw(bu(a),"custom")}function bz(a){return a?"empty"===a?["Start","Details"]:"preset"===a?["Start","Preset","Details"]:["Start","Import","Details"]:["Start"]}function bA(a,b){return a&&"start"!==b?"details"===b?"empty"===a?1:2:1:0}function bB(a){return s("flex h-10 w-full rounded-2xl border px-3.5 py-2 text-[13px] outline-none transition-colors","light"===a?"border-[#dccfc3] bg-white text-[#3f2f24] placeholder:text-[#9b8573] focus:border-[#c89e73] focus:ring-2 focus:ring-[#c89e73]/15":"border-white/10 bg-white/5 text-white placeholder:text-slate-500 focus:border-cyan-300/30 focus:ring-2 focus:ring-cyan-300/15")}function bC({labels:a,activeIndex:b,surfaceTheme:c="dark",onStepClick:e}){let f="light"===c;return(0,d.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:a.map((a,c)=>{let g=c===b,h=c<b,i=h&&!!e,j=(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:s("inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-[9px] font-medium",g?f?"bg-[#c89e73]/15 text-[#5d4331]":"bg-cyan-300/20 text-cyan-50":h?f?"bg-[#f0e7de] text-[#7a6556]":"bg-emerald-300/20 text-emerald-50":f?"bg-[#f2ece6] text-[#917866]":"bg-white/10 text-slate-400"),children:c+1}),(0,d.jsx)("span",{children:a})]}),k=s("inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[10px] transition-colors",g?f?"border-[#c89e73]/35 bg-[#f8efe4] text-[#5d4331]":"border-cyan-300/30 bg-cyan-400/10 text-cyan-50":h?f?"border-[#dccfc3] bg-white text-[#7e6757]":"border-emerald-300/20 bg-emerald-400/10 text-emerald-50":f?"border-[#e6dbd0] bg-white/80 text-[#8b7563]":"border-white/10 bg-white/[0.04] text-slate-400",i&&(f?"cursor-pointer hover:border-[#c89e73]/50 hover:bg-[#faf3ea]":"cursor-pointer hover:border-emerald-300/30 hover:bg-emerald-400/15"));return i?(0,d.jsx)("button",{type:"button",onClick:()=>e?.(c),className:k,children:j},`${a}-${c}`):(0,d.jsx)("div",{className:k,children:j},`${a}-${c}`)})})}function bD({title:a,description:b,children:c,className:e,surfaceTheme:f="dark"}){let g="light"===f;return(0,d.jsxs)("section",{className:s("rounded-[22px] border p-3.5",g?"border-[#e2d5c9] bg-white/92 shadow-[0_14px_34px_rgba(161,125,101,0.08)]":"border-white/10 bg-white/[0.03] shadow-[0_14px_34px_rgba(0,0,0,0.18)]",e),children:[(0,d.jsx)("div",{className:"flex items-start justify-between gap-3",children:(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:s("text-[13px] font-medium",g?"text-[#3f2f24]":"text-white"),children:a}),b?(0,d.jsx)("p",{className:s("mt-1 text-[11px] leading-4",g?"text-[#7f6958]":"text-slate-400"),children:b}):null]})}),(0,d.jsx)("div",{className:"mt-3 min-w-0",children:c})]})}function bE({icon:a,title:b,description:c,helper:e,selected:f,surfaceTheme:g="dark",onSelect:h}){let i="light"===g;return(0,d.jsxs)("button",{type:"button",onClick:h,"aria-pressed":f,className:s("flex w-full min-h-[272px] flex-col rounded-[28px] border p-3.5 text-left transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 md:max-w-[248px]",i?"focus-visible:ring-[#c89e73]/30":"focus-visible:ring-cyan-300/40",f?i?"border-[#d7c1ae] bg-[#fdf7ef] shadow-[0_14px_28px_rgba(161,125,101,0.08)]":"border-cyan-300/30 bg-cyan-400/10 shadow-[0_0_0_1px_rgba(34,211,238,0.1)]":i?"border-[#e7dbcf] bg-[rgba(255,252,247,0.9)] shadow-[0_10px_24px_rgba(161,125,101,0.05)] hover:border-[#d9c7b8] hover:bg-[#fffdf9]":"border-white/10 bg-white/[0.03] hover:border-white/20 hover:bg-white/[0.05]"),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsx)("div",{className:s("inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-[18px] border",i?"border-[#e0d3c6] bg-[#faf6f0] text-[#7a5f4c]":"border-white/10 bg-white/5 text-white"),children:(0,d.jsx)(a,{className:"h-[17px] w-[17px]"})}),(0,d.jsx)(u,{variant:f?"default":"muted",className:s("shrink-0 rounded-full px-2.5 py-0.5 text-[9px] normal-case tracking-normal",i?f?"border-[#d7c1ae] bg-[#f3e5d8] text-[#6a4b38]":"border-[#e3d6c8] bg-[rgba(255,255,255,0.82)] text-[#8a6f5d]":""),children:f?"Selected":"Available"})]}),(0,d.jsxs)("div",{className:"mt-6 space-y-1.5",children:[(0,d.jsx)("p",{className:s("text-[15px] font-medium leading-5",i?"text-[#413126]":"text-white"),children:b}),(0,d.jsx)("p",{className:s("text-[12px] leading-5",i?"text-[#8a7463]":"text-slate-400"),children:c})]}),(0,d.jsx)("div",{className:"mt-auto pt-6",children:(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("span",{className:s("max-w-[116px] text-[9px] uppercase leading-[1.35] tracking-[0.2em]",i?"text-[#9a8572]":"text-slate-500"),children:e}),(0,d.jsxs)("span",{className:s("inline-flex items-center gap-1 text-[9px] uppercase tracking-[0.18em]",i?"text-[#7f6958]":"text-slate-400"),children:["Select",(0,d.jsx)(a8.A,{className:"h-3 w-3"})]})]})})]})}function bF({agent:a,workspaceName:b,selected:c,surfaceTheme:e="dark",onSelect:f}){let g=aI[a.policy.preset],h="unassigned"===a.modelId?"default model":a.modelId,i="light"===e;return(0,d.jsxs)("button",{type:"button",onClick:f,"aria-pressed":c,className:s("flex w-full flex-col rounded-[22px] border p-3.5 text-left transition-all duration-200 focus-visible:outline-none focus-visible:ring-2",i?"focus-visible:ring-[#c89e73]/30":"focus-visible:ring-cyan-300/40",c?i?"border-[#c89e73]/45 bg-[#fff8f0] shadow-[0_16px_40px_rgba(161,125,101,0.12)]":"border-cyan-300/30 bg-cyan-400/10 shadow-[0_0_0_1px_rgba(34,211,238,0.1)]":i?"border-[#e3d7cc] bg-white/92 shadow-[0_14px_34px_rgba(161,125,101,0.08)] hover:border-[#d4c2b4] hover:bg-white":"border-white/10 bg-white/[0.03] hover:border-white/20 hover:bg-white/[0.05]"),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-3",children:[(0,d.jsx)("span",{className:s("inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-2xl border text-[15px]",i?"border-[#ded0c2] bg-[#faf5ef] text-[#7b604c]":"border-white/10 bg-white/5"),children:a.identity.emoji??"\uD83E\uDD16"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:s("truncate text-[13px] font-medium",i?"text-[#3f2f24]":"text-white"),children:J(a)}),(0,d.jsx)("p",{className:s("mt-0.5 truncate text-[11px] leading-4",i?"text-[#7f6958]":"text-slate-500"),children:a.id})]})]}),(0,d.jsx)(u,{variant:c?"default":"muted",className:s("shrink-0 px-2 py-0.5 text-[9px] normal-case tracking-normal",i?c?"border-[#c89e73]/35 bg-[#f5e7d8] text-[#6a4a34]":"border-[#e1d5c8] bg-white text-[#846a58]":""),children:c?"Selected":g.label})]}),(0,d.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,d.jsx)(u,{variant:"muted",className:s("px-2 py-0.5 text-[9px] normal-case tracking-normal",i?"border-[#e1d5c8] bg-[#fbf7f2] text-[#6f5747]":""),children:b}),(0,d.jsx)(u,{variant:"muted",className:s("px-2 py-0.5 text-[9px] normal-case tracking-normal",i?"border-[#e1d5c8] bg-[#fbf7f2] text-[#6f5747]":""),children:h}),(0,d.jsx)(u,{variant:"ready"===a.status?"success":"muted",className:s("px-2 py-0.5 text-[9px] normal-case tracking-normal",i?"ready"===a.status?"border-emerald-300/40 bg-emerald-100 text-emerald-800":"border-[#e1d5c8] bg-[#fbf7f2] text-[#6f5747]":""),children:a.status})]}),(0,d.jsx)("p",{className:s("mt-3 text-[12px] leading-5",i?"text-[#7f6958]":"text-slate-400"),children:g.description}),(0,d.jsxs)("div",{className:"mt-3.5 flex items-center justify-between gap-3",children:[(0,d.jsx)("span",{className:s("text-[10px] uppercase tracking-[0.16em]",i?"text-[#8b7462]":"text-slate-500"),children:"Import this agent as a new draft"}),(0,d.jsxs)("span",{className:s("inline-flex items-center gap-1 text-[10px] uppercase tracking-[0.16em]",i?"text-[#7f6958]":"text-slate-400"),children:["Select",(0,d.jsx)(a8.A,{className:"h-3 w-3"})]})]})]})}function bG({surfaceTheme:a}){let b="light"===a;return(0,d.jsx)("div",{className:s("rounded-[18px] border p-3 text-[11px] leading-5",b?"border-[#e2d5c9] bg-[#faf6f1] text-[#6f5849]":"border-white/10 bg-white/[0.03] text-slate-400"),children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(a9.A,{className:s("mt-0.5 h-3.5 w-3.5 shrink-0",b?"text-[#8b6d56]":"text-cyan-200")}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:s("text-[12px] font-medium",b?"text-[#3f2f24]":"text-slate-100"),children:"Workspace-root context"}),(0,d.jsxs)("p",{className:"mt-1",children:["This agent profile is written to the workspace root ",(0,d.jsx)("code",{children:"AGENTS.md"}),". OpenClaw loads that file as shared runtime context."]})]})]})})}let bH=g.forwardRef(({className:a,...b},c)=>(0,d.jsx)("textarea",{className:s("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",a),ref:c,...b}));bH.displayName="Textarea";let bI="mission-control-recent-prompts";function bJ({snapshot:a,surfaceTheme:b,activeWorkspaceId:c,selectedNodeId:e,composeIntent:f,isComposerActive:i,onTargetAgentChange:j,onTargetAgentSelect:k,onComposerActiveChange:l,onRefresh:m,onOpenWorkspaceCreate:n,onOpenWorkspaceChannels:o,onMissionDispatchStart:p,onMissionDispatchFailure:q,onMissionResponse:r,onAgentCreatedVisible:t}){var u,v;let w,y,[z,A]=(0,g.useState)(""),[B,C]=(0,g.useState)(""),[D,E]=(0,g.useState)("medium"),[F,G]=(0,g.useState)(!1),[H,I]=(0,g.useState)(!1),[K,L]=(0,g.useState)(!1),[M,N]=(0,g.useState)(!1),[O,P]=(0,g.useState)(!1),[Q,R]=(0,g.useState)(!1),[S,T]=(0,g.useState)(!1),[U,V]=(0,g.useState)(null),W=(0,g.useRef)(null);(0,g.useRef)(null);let X=(0,g.useRef)(null);(0,g.useRef)(null);let Y=(0,g.useRef)(!1);(0,g.useRef)(null);let Z=a.workspaces.find(a=>a.id===c)??a.workspaces[0],$=a.agents.filter(a=>!Z||a.workspaceId===Z.id),_=$.find(a=>a.id===B)??$[0]??null,aa=_?J(_):null,ab=_?.id??null,ac=$.map(a=>({label:J(a),value:a.id})),ae=(u=Z?.id??c??null,v=ab,u||v?`mission-control-composer-draft:${u??"global"}:${v??"unassigned"}`:null),af=!!(z.trim()&&ab&&!F),ag=aa?`Compose for ${aa}...`:"Compose a mission...",ah=((w=[]).push({id:"workspace-create",label:"Create workspace",action:"open-workspace-create"}),y=new Set,w.filter(a=>{let b=`${a.action||"mission"}:${a.mission?.trim().toLowerCase()||a.label.toLowerCase()}`;return!y.has(b)&&(y.add(b),!0)}).slice(0,3)),ai=ah.length>0,aj=Q&&!i&&!K&&0===z.trim().length&&null===U,ak=M&&(!O||F)&&!i&&!K&&0===z.trim().length&&null===U,al=aj||ak,am=async a=>{let b=a.mission.trim();if(!b)return;G(!0),R(!0);let d=a.agentId||ab,e=Date.now(),f=globalThis.crypto?.randomUUID?.()||`dispatch:${e}`,g=new AbortController;Y.current=!0,A(""),V(null),L(!1),P(!1),l?.(!1),d&&p({requestId:f,mission:b,agentId:d,workspaceId:Z?.id??c??null,submittedAt:e,abortController:g});try{let h=await fetch("/api/mission",{method:"POST",headers:{"Content-Type":"application/json"},signal:g.signal,body:JSON.stringify({...a,mission:b})}),i=await h.json();if(!h.ok||i.error)throw Error(i.error||"OpenClaw rejected the mission.");r(i,{requestId:f}),ae&&void 0!==globalThis.localStorage&&globalThis.localStorage.removeItem(ae),d&&function(a){let b=[a,...(function(){try{let a=globalThis.localStorage.getItem(bI);if(!a)return[];let b=JSON.parse(a);if(!Array.isArray(b))return[];return b.filter(a=>"object"==typeof a&&null!==a&&"string"==typeof a.id&&"string"==typeof a.mission&&"string"==typeof a.agentId&&"string"==typeof a.agentName&&"number"==typeof a.submittedAt).slice(0,6)}catch{return[]}})().filter(b=>b.mission.trim()!==a.mission.trim()||b.agentId!==a.agentId||b.workspaceId!==a.workspaceId)].slice(0,6);try{globalThis.localStorage.setItem(bI,JSON.stringify(b))}catch{}}({id:globalThis.crypto?.randomUUID?.()||`${e}`,mission:b,agentId:d,agentName:aa??"Agent",workspaceId:Z?.id??c,workspaceName:Z?.name??null,submittedAt:e});let j="string"==typeof i.meta?.outputDirRelative?`${i.status} via ${i.agentId} \xb7 ${i.meta.outputDirRelative}`:`${i.status} via ${i.agentId}`;"stalled"===i.status?aq.o.error("Mission could not start.",{description:i.summary||j}):aq.o.success("Mission queued in OpenClaw.",{description:j}),m().catch(()=>null)}catch(a){if(a instanceof DOMException&&"AbortError"===a.name)return;q(f,a instanceof Error?a.message:"Unknown mission error."),A(b),V(U),L(K),R(!1),P(!0),l?.(!0),requestAnimationFrame(()=>{W.current?.focus(),W.current?.setSelectionRange(b.length,b.length)}),aq.o.error("Mission dispatch failed.",{description:a instanceof Error?a.message:"Unknown mission error."})}finally{G(!1)}},an=(a,b={})=>{R(!1),b.thinking&&E(b.thinking),A(c=>{var d,e;let f,g;return"replace"===b.mode?a:(d=c,e=a,f=d.trim(),g=e.trim(),f?g?`${f}
|
|
2
|
+
|
|
3
|
+
${g}`:f:g)}),requestAnimationFrame(()=>{W.current?.focus();let a=W.current?.value??"";W.current?.setSelectionRange(a.length,a.length)})};return(0,d.jsx)("div",{className:s("mx-auto w-full transition-[width] duration-300",ak&&"lg:w-[360px]"),onMouseEnter:()=>{M&&!F&&P(!0)},onMouseLeave:()=>{M&&!F&&P(!1)},children:(0,d.jsx)(a5.N,{initial:!1,mode:"wait",children:al?(0,d.jsx)(a6.P.button,{type:"button",initial:{opacity:0,y:8,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:8,scale:.98},disabled:F,onFocus:()=>{F||P(!0)},onClick:()=>{F||(R(!1),P(!0),requestAnimationFrame(()=>{W.current?.focus()}))},className:"w-full overflow-hidden rounded-full border border-white/[0.08] bg-[linear-gradient(180deg,rgba(10,16,26,0.96),rgba(6,10,18,0.94))] p-2 text-left shadow-[0_24px_72px_rgba(0,0,0,0.22)] isolate",children:(0,d.jsxs)("div",{className:"flex items-center gap-2 rounded-full border border-white/[0.07] bg-[linear-gradient(180deg,rgba(20,28,43,0.9),rgba(11,17,28,0.88))] px-3 py-2 shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]",children:[(0,d.jsx)("span",{className:"inline-flex h-7 items-center rounded-full border border-white/[0.08] bg-white/[0.04] px-2.5 text-[11px] text-slate-300",children:aa||"No agent"}),(0,d.jsx)("p",{className:"min-w-0 flex-1 truncate text-[13px] text-[#f6eee5]/58",children:F?"Creating task...":ag}),(0,d.jsxs)("span",{className:"inline-flex h-8 items-center rounded-full bg-white px-3 text-[12px] font-medium text-slate-950",children:[F?(0,d.jsx)(h.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(a0.A,{className:"mr-1.5 h-3.5 w-3.5"}),F?"Creating":"Create task"]})]})},"collapsed"):(0,d.jsxs)(a6.P.div,{initial:{opacity:0,y:8,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:8,scale:.985},className:"overflow-hidden rounded-[26px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(10,16,26,0.96),rgba(6,10,18,0.94))] p-2.5 shadow-[0_24px_72px_rgba(0,0,0,0.26)] isolate",children:[(0,d.jsx)(a5.N,{initial:!1,children:U?(0,d.jsxs)(a6.P.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},className:"mb-2 flex flex-wrap items-center gap-2 px-1 text-[12px] text-slate-400",children:[(0,d.jsxs)("span",{className:"truncate",children:["From ",U.sourceLabel]}),(0,d.jsx)("button",{type:"button",className:"text-slate-200 transition-colors hover:text-white",onClick:()=>an(U.mission,{mode:"replace"}),children:"Replace"}),(0,d.jsx)("button",{type:"button",className:"text-slate-200 transition-colors hover:text-white",onClick:()=>an(U.mission),children:"Append"}),(0,d.jsx)("button",{type:"button",className:"inline-flex h-6 w-6 items-center justify-center rounded-full text-slate-400 transition-colors hover:bg-white/[0.06] hover:text-white",onClick:()=>V(null),"aria-label":"Dismiss runtime suggestion",children:(0,d.jsx)(ad.A,{className:"h-3.5 w-3.5"})})]}):null}),(0,d.jsxs)("div",{className:s("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",i&&"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:()=>{R(!1),l?.(!0)},onBlurCapture:a=>{let b=a.relatedTarget;b instanceof Node&&a.currentTarget.contains(b)||l?.(!1)},children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2.5 pb-1 pt-2.5",children:[_?(0,d.jsx)(bK,{value:B,options:ac,onChange:a=>{R(!1),C(a),k?.(a)}}):(0,d.jsx)(bO,{children:"No agent"}),(0,d.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,d.jsx)(bM,{label:"Refresh AgentOS",onClick:async()=>{I(!0),await m(),I(!1)},children:H?(0,d.jsx)(h.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(a1.A,{className:"h-3.5 w-3.5"})}),(0,d.jsx)(bM,{label:"Create workspace",onClick:n,children:(0,d.jsx)(a2.A,{className:"h-3.5 w-3.5"})}),(0,d.jsx)(bM,{label:"Composer settings",onClick:()=>L(a=>!a),active:K||"medium"!==D,children:(0,d.jsxs)("span",{className:"relative inline-flex",children:[(0,d.jsx)(a3.A,{className:"h-3.5 w-3.5"}),"medium"!==D?(0,d.jsx)("span",{className:"absolute -right-1 -top-1 h-1.5 w-1.5 rounded-full bg-white/80"}):null]})})]})]}),(0,d.jsx)("div",{className:"px-2.5 pt-0.5",children:(0,d.jsx)(bH,{ref:W,value:z,onChange:a=>{R(!1),A(a.target.value)},onKeyDown:async a=>{(a.metaKey||a.ctrlKey)&&"Enter"===a.key&&(a.preventDefault(),af&&ab&&await am({mission:z,agentId:ab,workspaceId:c??void 0,thinking:D}))},placeholder:ag,className:"min-h-[50px] max-h-[150px] resize-none overflow-y-auto border-0 bg-transparent px-0 py-0.5 text-[15px] leading-[1.6] text-white placeholder:text-[#f6eee5]/60 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0"})}),(0,d.jsxs)("div",{className:"flex items-end justify-between gap-2.5 px-2.5 pb-2.5 pt-1.5",children:[(0,d.jsx)(a5.N,{initial:!1,children:ai?(0,d.jsxs)(a6.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:[ah.map(a=>(0,d.jsx)(bN,{label:a.label,onClick:()=>{"open-workspace-create"===a.action?n():a.mission&&an(a.mission,{thinking:a.thinking})}},a.id)),Z?(0,d.jsx)(bx,{snapshot:a,defaultWorkspaceId:Z.id,onRefresh:m,onAgentCreated:a=>{X.current=a,C(a)},onAgentCreatedVisible:t,surfaceTheme:b,trigger:(0,d.jsx)("button",{type:"button",className:"inline-flex h-8 items-center rounded-full border border-white/[0.08] bg-white/[0.04] px-3 text-[12px] text-slate-300 transition-all hover:bg-white/[0.08] hover:text-white",children:"+ Create Agent"})}):null,S&&Z?(0,d.jsx)("button",{type:"button",onClick:()=>o(),className:"inline-flex h-8 items-center rounded-full border border-cyan-300/18 bg-cyan-400/[0.1] px-3 text-[12px] text-cyan-50 transition-all hover:border-cyan-300/28 hover:bg-cyan-400/[0.14] hover:text-white",children:"Manage Surfaces"}):null]}):(0,d.jsx)("div",{})}),(0,d.jsxs)(x,{className:"h-9 rounded-full bg-white px-3.5 text-slate-950 shadow-none hover:bg-white/92",disabled:!af,onClick:async()=>{ab&&await am({mission:z,agentId:ab,workspaceId:c??void 0,thinking:D})},children:[F?(0,d.jsx)(h.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(a0.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Create task"]})]})]}),(0,d.jsx)(a5.N,{initial:!1,children:K?(0,d.jsx)(a6.P.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},className:"mt-2 flex justify-end",children:(0,d.jsxs)("div",{className:"w-full max-w-[232px] rounded-[20px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(14,20,31,0.96),rgba(10,15,24,0.94))] p-3 shadow-[0_16px_32px_rgba(0,0,0,0.22)]",children:[(0,d.jsx)("p",{className:"text-[11px] text-slate-300",children:"Thinking"}),(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(bL,{ariaLabel:"Select thinking level",value:D,options:[{label:"off",value:"off"},{label:"minimal",value:"minimal"},{label:"low",value:"low"},{label:"medium",value:"medium"},{label:"high",value:"high"}],onChange:a=>E(a)})}),(0,d.jsx)("button",{type:"button",className:"mt-3 text-[12px] text-slate-400 transition-colors hover:text-white",onClick:()=>{R(!1),A(""),E("medium"),V(null),Y.current=!0,ae&&void 0!==globalThis.localStorage&&globalThis.localStorage.removeItem(ae)},children:"Clear draft"})]})}):null})]},"expanded")})})}function bK({value:a,options:b,onChange:c}){let e=b.find(b=>b.value===a)??b[0],f=b.length>1;return(0,d.jsxs)("div",{className:"relative inline-flex items-center rounded-full border border-white/[0.08] bg-white/[0.04] text-slate-100",children:[f?(0,d.jsx)("select",{"aria-label":"Select mission agent",value:e?.value??"",onChange:a=>c(a.target.value),className:"h-8 appearance-none bg-transparent pl-3 pr-8 text-[12px] outline-none",children:b.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))}):(0,d.jsx)("span",{className:"px-3 text-[12px]",children:e?.label||"No agent"}),f?(0,d.jsx)(a4.A,{className:"pointer-events-none absolute right-3 h-3.5 w-3.5 text-slate-400"}):null]})}function bL({ariaLabel:a,value:b,options:c,onChange:e}){let f=c.find(a=>a.value===b)??c[0];return(0,d.jsxs)("div",{className:"relative inline-flex w-full items-center rounded-full border border-white/[0.08] bg-white/[0.04] text-slate-100",children:[(0,d.jsx)("select",{"aria-label":a,value:f?.value??"",onChange:a=>e(a.target.value),className:"h-9 w-full appearance-none bg-transparent pl-3 pr-9 text-[12px] outline-none",children:c.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))}),(0,d.jsx)(a4.A,{className:"pointer-events-none absolute right-3 h-3.5 w-3.5 text-slate-400"})]})}function bM({label:a,active:b=!1,onClick:c,children:e}){return(0,d.jsx)("button",{type:"button","aria-label":a,title:a,onClick:c,className:s("inline-flex h-8 w-8 items-center justify-center rounded-full border border-transparent text-slate-400 transition-all hover:border-white/[0.08] hover:bg-white/[0.06] hover:text-white",b&&"border-white/[0.08] bg-white/[0.06] text-white"),children:e})}function bN({label:a,onClick:b}){return(0,d.jsx)("button",{type:"button",onClick:b,className:"inline-flex h-8 items-center rounded-full border border-white/[0.08] bg-white/[0.04] px-3 text-[12px] text-slate-300 transition-all hover:bg-white/[0.08] hover:text-white",children:a})}function bO({children:a}){return(0,d.jsx)("div",{className:"inline-flex h-8 items-center rounded-full border border-white/[0.08] bg-white/[0.04] px-3 text-[12px] text-slate-300",children:a})}var bP=c(61075),bQ=c(74241),bR=c(35210),bS=c(1),bT=c(98246),bU=c(66336),bV=c(12625),bW=c(48684);function bX(a){return`mission-control-agent-chat:v1:${a}`}function bY(a){return"object"==typeof a&&null!==a&&("user"===a.role||"assistant"===a.role||"system"===a.role)&&"string"==typeof a.id&&"string"==typeof a.text&&"number"==typeof a.createdAt&&(void 0===a.errorMessage||null===a.errorMessage||"string"==typeof a.errorMessage)&&(void 0===a.status||"sending"===a.status||"sent"===a.status||"error"===a.status)}function bZ(a){try{let b=globalThis.localStorage?.getItem(bX(a));if(!b)return[];let c=JSON.parse(b);if(!Array.isArray(c))return[];return c.filter(bY).slice(-60)}catch{return[]}}function b$(a,b){try{globalThis.localStorage?.setItem(bX(a),JSON.stringify(b.slice(-60)))}catch{}}async function b_(a,b){if(!a.body)throw Error("The server did not return a readable stream.");let c=a.body.getReader(),d=new TextDecoder,e="";for(;;){let{value:a,done:f}=await c.read();if(f)break;let g=(e+=d.decode(a,{stream:!0})).indexOf("\n");for(;g>=0;){let a=e.slice(0,g).trim();e=e.slice(g+1),a&&await b(JSON.parse(a)),g=e.indexOf("\n")}}let f=e.trim();f&&await b(JSON.parse(f))}function b0(a){let b=a.toLowerCase();return(b.includes("couldn't recover")||b.includes("couldn’t recover"))&&b.includes("prior")&&b.includes("context")||b.includes("no prior transcript")&&b.includes("memory")||b.includes("send me")&&b.includes("last goal")&&b.includes("file")||b.includes("can't continue")&&b.includes("recoverable task context")||b.includes("can’t continue")&&b.includes("recoverable task context")||b.includes("checked")&&b.includes("workspace files")&&b.includes("recent session metadata")||b.includes("task state")&&b.includes("resume")||b.includes("failed attempt")&&b.includes("last task")&&b.includes("error")||b.includes("workspace")&&b.includes("memory")&&b.includes("session metadata")&&(b.includes("resume")||b.includes("continue"))}function b1(a){let b=a.toLowerCase();return/\b(name|ad[ıi]n|ismin|called)\b/.test(b)&&/\b(age|old|ya[sş][ıi]n|kaç yaş)\b/.test(b)||/\b(who are you|kimsin)\b/.test(b)}let b2=new Map;function b3({agentId:a,agentName:b,text:c,onRefresh:d,onSnapshotChange:e,onError:f}){let g=c.trim();if(!g)return Promise.resolve();let h=b2.get(a);if(h)return h.promise;let i=Date.now(),j=globalThis.crypto?.randomUUID?.()||`user:${i}`,k=globalThis.crypto?.randomUUID?.()||`assistant:${i}`,l=bZ(a),m={userMessageId:j,assistantMessageId:k,statusMessage:"Starting agent turn...",promise:Promise.resolve()};b2.set(a,m),b$(a,[...l,{id:j,role:"user",text:g,createdAt:i,status:"sending"},{id:k,role:"assistant",text:"",createdAt:i+1,status:"sending"}].slice(-60));let n=l.filter(a=>("user"===a.role||"assistant"===a.role)&&"error"!==a.status&&a.text.trim().length>0).slice(-16).map(a=>({role:a.role,text:a.text})),o=new Set(n.filter(a=>"assistant"===a.role).map(a=>b6(a.text)).filter(Boolean));return m.promise=b4({agentId:a,payload:{message:g,rawMessage:g,history:n,thinking:"low"},agentName:b,userMessageId:j,assistantMessageId:k,previousAssistantTexts:o,run:m,onRefresh:d,onSnapshotChange:e,onError:f}),m.promise}async function b4({agentId:a,payload:b,agentName:c,userMessageId:d,assistantMessageId:e,previousAssistantTexts:f,run:g,onRefresh:h,onSnapshotChange:i,onError:j}){let k="",l=!1;try{let j=await fetch(`/api/agents/${encodeURIComponent(a)}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),m=j.headers.get("content-type")||"";if(!j.ok||!m.includes("application/x-ndjson")){let a=await j.json().catch(()=>null);throw Error(a?.error||"OpenClaw rejected the message.")}b5(a,a=>a.map(a=>a.id===d?{...a,status:"sent"}:a));let n=null;if(await b_(j,async j=>{var m;if("status"===j.type){g.statusMessage=j.message;return}if("assistant"===j.type){let c=b7(j.text),h=b6(c),i=b1(b.rawMessage)&&b0(c);if(!c){g.statusMessage="Agent is thinking...";return}if(i||!l&&h&&f.has(h)){g.statusMessage="Agent is drafting a reply...";return}l=!0,k=c,g.statusMessage="Agent is drafting a reply...",b5(a,a=>a.map(a=>a.id===d?{...a,status:"sent"}:a.id===e?{...a,text:c,status:"sending"}:a));return}if(!j.ok)throw Error(j.message);n=j.response??null;let o=function(a,b,c){return b1(c)&&b0(a)?`My name is ${b}. I do not have a real age; I am an AI agent running inside AgentOS.`:a}(n?(m=n).payloads.map(a=>b7(a.text)).filter(Boolean).join("\n\n")||b7(m.summary):k,c,b.rawMessage);n&&(k=o),b5(a,a=>a.map(a=>a.id===d?{...a,status:"sent"}:a.id===e?{...a,text:o,status:"sent",runId:n?.runId??a.runId}:a));let p=n?function(a){let b=a?.missionControlAction;if(!b||"object"!=typeof b||"rename_agent"!==b.type||!0!==b.applied||"string"!=typeof b.name)return null;let c=b.name.trim();return c.length>0?c:null}(n.meta):null;p&&i&&i(b=>{var c,d,e;return c=b,d=a,e=p,{...c,agents:c.agents.map(a=>a.id===d?{...a,name:e,identityName:e}:a),tasks:c.tasks.map(a=>a.primaryAgentId===d?{...a,primaryAgentName:e}:a)}}),h?.().catch(()=>null)}),!n)throw Error("OpenClaw completed without returning a response.")}catch(f){let b=f instanceof Error?f.message:"Unknown send error.",c=l?k.trim():"";b5(a,a=>a.map(a=>a.id===d?{...a,status:"error",errorMessage:b}:a.id===e&&c.length>0?{...a,text:c,status:"error",errorMessage:b}:a).filter(a=>a.id!==e||c.length>0)),j?.(b)}finally{b2.delete(a)}}function b5(a,b){b$(a,b(bZ(a)).slice(-60))}function b6(a){return a.replace(/\s+/g," ").trim()}function b7(a){return"string"!=typeof a?"":function(a){if(!a||!/^\[thinking\]\b/i.test(a))return a;let b=a.split(/\n{2,}/).map(a=>a.trim()).filter(Boolean);return b.length<=2?"":b.slice(2).join("\n\n").trim()}(a.trim())}function b8(a){var b,c;let d,e;return(b=a,(d=b?.trim()??"")&&(/\bgateway\b[\s\S]*\btoken mismatch\b/i.test(d)||/\btoken mismatch\b[\s\S]*\bgateway\b/i.test(d)||/\bprovide gateway auth token\b/i.test(d)))?{apiAction:"generateLocalToken",cta:"Repair token",label:"Gateway token",detail:"Generate a fresh local Gateway token, restart the Gateway, then retry."}:(c=a,(e=c?.trim()??"")&&(/scope upgrade pending approval/i.test(e)||/device token scope mismatch/i.test(e)||/connected_no_operator_scope/i.test(e)||/more scopes than currently approved/i.test(e)||/\bmissing scope:\s*operator\.(?:read|write|admin)\b/i.test(e)||/\bmissing operator\.(?:read|write|admin) scope\b/i.test(e)))?{apiAction:"repairDeviceAccess",cta:"Repair access",label:"Gateway access",detail:"Approve the local AgentOS device scope request, then retry."}:null}function b9({surfaceTheme:a}){return(0,d.jsx)("span",{className:"inline-flex items-center gap-[3px] align-middle",children:[0,1,2].map(b=>(0,d.jsx)(a6.P.span,{animate:{opacity:[.35,1,.35],y:[0,-1,0]},transition:{duration:1.1,repeat:1/0,delay:.14*b,ease:"easeInOut"},className:s("h-1.5 w-1.5 rounded-full","light"===a?"bg-[#8f7263]":"bg-cyan-300")},b))})}function ca({agentLabel:a,statusLabel:b,surfaceTheme:c}){return(0,d.jsxs)("div",{className:s("flex min-w-0 items-center justify-between gap-3 text-[9px] uppercase tracking-[0.24em]","light"===c?"text-[#8b7262]":"text-slate-400"),children:[(0,d.jsx)("span",{className:"min-w-0 truncate",children:a}),b?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1.5",children:[(0,d.jsx)("span",{children:b}),(0,d.jsx)(b9,{surfaceTheme:c})]}):null]})}function cb({statusMessage:a,expanded:b,onToggle:c,surfaceTheme:e}){var f;let g,h=function(a){let b,c=(b=a?.toLowerCase()??"").includes("finalizing")||b.includes("drafting")?"Shaping the reply before it appears here.":b.includes("thinking")?"Checking recent context before answering.":"Reading your message and preparing a reply.";return c.includes("Shaping")?["Shaping the reply","Preparing the final wording"]:c.includes("Checking")?["Reading your message","Checking recent context"]:["Reading your message","Preparing a reply"]}(a),i=(f=a,(g=f?.toLowerCase()??"").includes("finalizing")||g.includes("drafting")?["The agent has enough context to answer.","It is tightening the response before showing it here.","Raw reasoning stays hidden; only the final reply is saved."]:g.includes("thinking")?["The agent is reading the direct message.","It is checking recent chat and workspace context.","It will replace this activity card with the final reply."]:["The message was sent to the selected agent.","AgentOS is waiting for the first response signal.","This activity is temporary and is not saved to chat history."]);return(0,d.jsxs)("div",{className:s("mt-2 overflow-hidden rounded-[14px] border px-3 py-2","light"===e?"border-[#e7d8cc] bg-[#fff7f1]/70":"border-cyan-300/10 bg-slate-950/24"),children:[(0,d.jsx)("div",{className:"space-y-1.5",children:h.map((a,b)=>(0,d.jsx)(a6.P.div,{animate:{opacity:[.48,.92,.48]},transition:{duration:1.8,repeat:1/0,delay:.18*b,ease:"easeInOut"},className:s("h-3.5 rounded-full","light"===e?"bg-[linear-gradient(90deg,rgba(139,114,98,0.16),rgba(139,114,98,0.34),rgba(139,114,98,0.14))]":"bg-[linear-gradient(90deg,rgba(125,211,252,0.10),rgba(125,211,252,0.27),rgba(125,211,252,0.08))]",0===b?"w-[72%]":"w-[54%]"),children:(0,d.jsx)("span",{className:s("block truncate px-2 text-[10px] leading-3.5","light"===e?"text-[#7d6556]/78":"text-slate-300/72"),children:a})},a))}),(0,d.jsx)("div",{className:"mt-2 flex justify-end",children:(0,d.jsx)("button",{type:"button",onClick:c,className:s("text-[8px] uppercase tracking-[0.18em] transition hover:opacity-80","light"===e?"text-[#8b7262]":"text-cyan-200/70"),children:b?"Hide details":"Show details"})}),b?(0,d.jsx)(a6.P.ul,{initial:{opacity:0,y:-3},animate:{opacity:1,y:0},className:s("mt-2 space-y-1 border-t pt-2 text-[11px] leading-4","light"===e?"border-[#e7d8cc] text-[#7d6556]":"border-white/[0.07] text-slate-400"),children:i.map(a=>(0,d.jsxs)("li",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:s("mt-[7px] h-1 w-1 shrink-0 rounded-full","light"===e?"bg-[#b28f78]":"bg-cyan-300/70")}),(0,d.jsx)("span",{children:a})]},a))}):null]})}function cc({agent:a,surfaceTheme:b,isVisible:c,onRefresh:e,onSnapshotChange:f,onConnectModelProvider:i}){let[j,k]=(0,g.useState)(""),[l,m]=(0,g.useState)([]),[n,o]=(0,g.useState)(()=>{var b;let c;return b=a.id,{isRunning:!!(c=b2.get(b)),userMessageId:c?.userMessageId??null,assistantMessageId:c?.assistantMessageId??null,statusMessage:c?.statusMessage??null}}),[p,q]=(0,g.useState)(null),[r,t]=(0,g.useState)({}),[u,v]=(0,g.useState)({}),[w,y]=(0,g.useState)(null),A=(0,g.useRef)(null),B=(0,g.useRef)(null),E=(0,g.useRef)(c),F=J(a),G=!!j.trim()&&!n.isRunning,H=n.assistantMessageId,I=l.length>0?l:[{id:"system:empty",role:"system",text:"Start a direct chat with this agent. Messages stay in this drawer and are stored locally in your browser.",createdAt:Date.now()}],K=async()=>{let b=j.trim();if(b&&!n.isRunning){k("");try{await b3({agentId:a.id,agentName:F,text:b,onRefresh:e,onSnapshotChange:f,onError:a=>{aq.o.error("Chat message failed.",{description:a})}})}finally{E.current&&requestAnimationFrame(()=>B.current?.focus())}}},L=async(b,c,d)=>{let g=c.trim();if(g&&!w&&!n.isRunning){y(b);try{let b=await fetch("/api/settings/gateway",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:d.apiAction})}),c=await b.json().catch(()=>null);if(!b.ok)throw Error(c?.error||"Gateway access could not be repaired.");if(c?.authStatus?.native&&!1===c.authStatus.native.ok)throw Error(c.authStatus.native.issue||"Gateway access still needs attention.");aq.o.success(`${d.label} repaired.`,{description:"Retrying the chat message."}),await e?.().catch(()=>void 0),y(null),await b3({agentId:a.id,agentName:F,text:g,onRefresh:e,onSnapshotChange:f,onError:a=>{aq.o.error("Chat message failed.",{description:a})}})}catch(a){aq.o.error("Gateway repair failed.",{description:a instanceof Error?a.message:"Unable to repair Gateway access."})}finally{y(null),E.current&&requestAnimationFrame(()=>B.current?.focus())}}};return(0,d.jsxs)("div",{className:s("flex h-full min-h-0 flex-col overflow-hidden","light"===b?"text-[#4a382c]":"text-slate-200"),children:[(0,d.jsx)("div",{ref:A,className:s("mission-scroll min-h-0 flex-1 overflow-y-auto overscroll-contain pr-1","light"===b?"text-[#4a382c]":"text-slate-200"),children:(0,d.jsx)("div",{className:"space-y-2.5",children:I.map(c=>{let e="user"===c.role,f="system"===c.role,g="assistant"===c.role,j=g&&c.id===H&&n.isRunning,k=j&&!c.text.trim(),l=g?r[c.id]:void 0,m=l??c.text,o=g&&!!l&&m!==c.text,p=j||o,q=k?"Thinking":p?"Replying":null,t="user"===c.role&&c.id===n.userMessageId&&n.isRunning,y="sending"===c.status&&t,A=c.errorMessage?.trim(),B=A?b8(A):null,E=A&&!B?function(a,b){var c,d,e,f;let g,h,i=a?.trim()??"";if(!i||(c=i,!/\b(auth|authentication|authenticate|unauthorized|unauthorised|forbidden|expired|token|oauth|api[-\s]?key|credential|login|sign[ -]?in|reconnect|401|403)\b/i.test(c)))return null;let j=(g=(d=i).match(/\bmodels\s+auth\s+(?:login|paste-token)\b[\s\S]*?--provider(?:=|\s+)(["']?)([a-z0-9_-]+)\1/i)??d.match(/\b--provider(?:=|\s+)(["']?)([a-z0-9_-]+)\1/i),C(g?.[2]??null)??function(a){if(/\bChatGPT\/Codex\b|\bChatGPT\b|\bCodex\b/i.test(a))return"openai-codex";let b=a.toLowerCase();for(let a of z){let c=a.id.toLowerCase(),d=a.label.toLowerCase(),e=a.shortLabel.toLowerCase();if(b.includes(c)||b.includes(d)||b.includes(e))return a.id}return null}(i)??(e=b,f=i,(h=e?.split("/",1)[0]?.trim()??"")?"openai"===h&&/\bChatGPT\b|\bCodex\b/i.test(f)?"openai-codex":C(h):null));if(!j)return null;let k=D(j);return{provider:j,label:k,detail:`Connect ${k}, then retry this chat message.`}}(A,a.modelId):null;return(0,d.jsx)("div",{className:s("flex",e?"justify-end":"justify-start"),children:(0,d.jsxs)("div",{className:s("min-w-0 max-w-[92%] rounded-[18px] border px-3 py-2 text-[13px] leading-5 shadow-[0_14px_34px_rgba(0,0,0,0.14)]",t&&"opacity-85",f?"light"===b?"border-[#e3d4c8] bg-[#fffaf6] text-[#6c5647]":"border-white/[0.08] bg-white/[0.03] text-slate-400":e?"light"===b?"border-[#e3d4c8] bg-[#fff3f6] text-[#4a382c]":"border-white/[0.08] bg-[linear-gradient(180deg,rgba(255,255,255,0.07),rgba(255,255,255,0.03))] text-slate-100":"light"===b?"border-[#e3d4c8] bg-[#fffaf6] text-[#4a382c]":"border-cyan-300/12 bg-[linear-gradient(180deg,rgba(34,211,238,0.10),rgba(59,130,246,0.06))] text-slate-100"),children:[k?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(ca,{agentLabel:F,statusLabel:q,surfaceTheme:b}),(0,d.jsx)(cb,{statusMessage:n.statusMessage,expanded:!!u[c.id],onToggle:()=>v(a=>({...a,[c.id]:!a[c.id]})),surfaceTheme:b})]}):(0,d.jsxs)(d.Fragment,{children:[g?(0,d.jsx)(ca,{agentLabel:F,statusLabel:q,surfaceTheme:b}):null,(0,d.jsx)("p",{className:s("whitespace-pre-wrap break-words [overflow-wrap:anywhere]",g&&"mt-1.5"),children:g?m:c.text}),p?(0,d.jsx)(a6.P.span,{"aria-hidden":"true",animate:{opacity:[.2,1,.2]},transition:{duration:.9,repeat:1/0,ease:"easeInOut"},className:"ml-0.5 inline-block h-[1em] w-[1px] translate-y-[2px] bg-current"}):null]}),!k&&y?(0,d.jsx)("p",{className:s("mt-1.5 text-[10px] uppercase tracking-[0.18em]","light"===b?"text-[#8b7262]":"text-slate-500"),children:e?"Sending…":"Drafting…"}):k||"error"!==c.status?null:(0,d.jsxs)("div",{className:"mt-1.5 space-y-1",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-rose-300",children:"Failed to send"}),A?(0,d.jsx)("p",{className:s("text-[11px] leading-4 [overflow-wrap:anywhere]","light"===b?"text-rose-700":"text-rose-200"),children:A}):null,E&&i?(0,d.jsxs)(x,{type:"button",variant:"secondary",size:"sm",onClick:()=>i(E.provider),className:s("mt-1 h-8 rounded-full px-3 text-[11px]","light"===b?"border-rose-200 bg-white text-rose-800 hover:bg-rose-50":"border-rose-300/20 bg-rose-300/10 text-rose-100 hover:bg-rose-300/16"),children:[(0,d.jsx)(bW.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Connect ",E.label]}):null,B?(0,d.jsxs)(x,{type:"button",variant:"secondary",size:"sm",onClick:()=>void L(c.id,c.text,B),disabled:!!w||n.isRunning,title:B.detail,className:s("mt-1 h-8 rounded-full px-3 text-[11px]","light"===b?"border-emerald-200 bg-white text-emerald-800 hover:bg-emerald-50":"border-emerald-300/20 bg-emerald-300/10 text-emerald-100 hover:bg-emerald-300/16"),children:[w===c.id?(0,d.jsx)(h.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(bW.A,{className:"mr-1.5 h-3.5 w-3.5"}),B.cta]}):null]})]})},c.id)})})}),(0,d.jsxs)("div",{className:s("mt-2 shrink-0 rounded-[18px] border p-3","light"===b?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))]"),onPointerDown:a=>{let b=a.target;!b||b.closest("textarea")||b.closest("button")||B.current?.focus()},children:[(0,d.jsx)(bH,{ref:B,value:j,onChange:a=>k(a.target.value),onKeyDown:async a=>{"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),await K())},placeholder:`Message to ${F}...`,className:s("min-h-[60px] cursor-text resize-none border-0 bg-transparent px-3.5 py-2.5 text-[13px] leading-[1.5] shadow-none focus-visible:ring-0 focus-visible:ring-offset-0","light"===b?"text-[#3f2f24] placeholder:text-[#8f7664]":"text-white placeholder:text-slate-500")}),(0,d.jsx)("div",{className:"mt-1.5 flex items-center justify-end gap-1.5",children:(0,d.jsxs)(x,{disabled:!G,className:s("h-8 rounded-full px-3 shadow-none","light"===b?"bg-[#4a382c] text-[#fffaf6] hover:bg-[#3f2f24]":"bg-white text-slate-950 hover:bg-white/92"),onClick:K,children:[n.isRunning?(0,d.jsx)(h.A,{className:"mr-[5px] h-[13px] w-[13px] animate-spin"}):(0,d.jsx)(a0.A,{className:"mr-[5px] h-[13px] w-[13px]"}),"Send"]})})]})]})}var cd=c(86588),ce=c(1339);let cf=/https?:\/\/[^\s<>"'`)\]]+/g,cg=/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi,ch=/(?:^|[\s(])((?:\.{1,2}\/)?(?:deliverables|memory|docs|app|components|lib|public|scripts|packages|hooks|output)\/[^\s`),;]+)/g,ci=/`((?:\/|\.{1,2}\/|deliverables\/|memory\/|docs\/|app\/|components\/|lib\/|public\/|scripts\/|packages\/|hooks\/|output\/)[^`\n]+)`/g;function cj({text:a,className:b,url:c,filePath:e,displayPath:f,basePath:g,compact:h=!1}){let i=function(a,b){let c=new Set;for(let d of(b&&c.add(b),a.matchAll(cf)))d[0]&&c.add(d[0]);return[...c]}(a,c),j=function(a){let b=new Set;for(let c of a.matchAll(cg))c[0]&&b.add(c[0]);return[...b]}(a),k=function(a,b,c){var d,e;let f,g,h=[],i=(d=b,e=c,f=ck(d),g=ck(e),f&&g&&f.startsWith("/")?{path:f.replace(/\/+$/,""),label:g.replace(/\/+$/,"")}:null),j=(a,b)=>{let c=function(a,b){let c=ck(a);if(!c)return null;if(c.startsWith("/")||!b)return c;if(c===b.label)return b.path;let d=`${b.label}/`;if(!c.startsWith(d))return c;let e=c.slice(d.length).replace(/^\/+/,"");return e?`${b.path}/${e}`:b.path}(a,i),d=ck(b||a);c&&d&&(h.some(a=>ck(a.path)===c||ck(a.label)===d)||h.push({path:c,label:d}))};for(let d of(b&&j(b,c||b),a.matchAll(ci))){let a=ck(d[1]);a&&j(a,a)}for(let b of a.matchAll(ch)){let a=ck(b[1]);a&&j(a,a)}return h}(a,e,f);return(0,d.jsxs)("div",{className:s("space-y-2",h&&"space-y-1.5"),children:[(0,d.jsx)("p",{className:s("whitespace-pre-wrap break-words",b),children:function(a){let b=Array.from(a.matchAll(cf));if(0===b.length)return a;let c=[],e=0;for(let[f]of b){let b=a.indexOf(f,e);b>e&&c.push(a.slice(e,b)),c.push((0,d.jsx)("a",{href:f,target:"_blank",rel:"noreferrer",className:"nodrag nopan text-cyan-100 underline decoration-cyan-200/45 underline-offset-2 transition-colors hover:text-cyan-50 hover:decoration-cyan-100",onClick:a=>a.stopPropagation(),children:f},`${f}:${b}`)),e=b+f.length}return e<a.length&&c.push(a.slice(e)),c}(a)}),i.length>0||j.length>0||k.length>0?(0,d.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[i.map(a=>(0,d.jsxs)("a",{href:a,target:"_blank",rel:"noreferrer",className:s("nodrag nopan inline-flex max-w-full items-center gap-1 rounded-full border border-cyan-300/16 bg-cyan-400/[0.08] px-2 py-1 text-[10px] text-cyan-100 transition-colors hover:border-cyan-200/30 hover:bg-cyan-400/[0.14]",h&&"px-1.5 py-[3px] text-[9px]"),onClick:a=>a.stopPropagation(),children:[(0,d.jsx)(cd.A,{className:s("h-3 w-3 shrink-0",h&&"h-2.5 w-2.5")}),(0,d.jsx)("span",{className:"truncate",children:function(a){try{let b=new URL(a);return`${b.hostname}${"/"===b.pathname?"":b.pathname}`}catch{return a}}(a)})]},a)),j.map(a=>(0,d.jsxs)("a",{href:`mailto:${a}`,className:s("nodrag nopan inline-flex max-w-full items-center gap-1 rounded-full border border-sky-300/16 bg-sky-400/[0.08] px-2 py-1 text-[10px] text-sky-50 transition-colors hover:border-sky-200/30 hover:bg-sky-400/[0.14]",h&&"px-1.5 py-[3px] text-[9px]"),onClick:a=>a.stopPropagation(),children:[(0,d.jsx)(cd.A,{className:s("h-3 w-3 shrink-0",h&&"h-2.5 w-2.5")}),(0,d.jsx)("span",{className:"truncate",children:a})]},a)),k.map(a=>(0,d.jsxs)("button",{type:"button",className:s("nodrag nopan inline-flex max-w-full items-center gap-1 rounded-full border border-emerald-300/16 bg-emerald-400/[0.08] px-2 py-1 text-[10px] text-emerald-50 transition-colors hover:border-emerald-200/30 hover:bg-emerald-400/[0.14]",h&&"px-1.5 py-[3px] text-[9px]"),onClick:b=>{b.stopPropagation(),cl(a.path,g)},children:[(0,d.jsx)(ce.A,{className:s("h-3 w-3 shrink-0",h&&"h-2.5 w-2.5")}),(0,d.jsx)("span",{className:"truncate",children:M(a.label)})]},`${a.path}:${a.label}`))]}):null]})}function ck(a){let b=a?.trim();return b?b.replace(/[.,:;]+$/g,""):null}async function cl(a,b){try{let c=await fetch("/api/files/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a,basePath:b??null})}),d=await c.json();if(!c.ok)throw Error(d.error||"Unable to reveal file.");aC.oR.success("Revealed file.",{description:M(a)})}catch(a){aC.oR.error("Could not reveal file.",{description:a instanceof Error?a.message:"Unknown file reveal error."})}}var cm=c(70410);let cn=cm.Kq,co=cm.bL,cp=cm.l9,cq=g.forwardRef(({className:a,sideOffset:b=6,children:c,...e},f)=>(0,d.jsx)(cm.ZL,{children:(0,d.jsx)(cm.UC,{ref:f,sideOffset:b,className:s("relative z-[9999] overflow-hidden rounded-[18px] border border-cyan-300/10 bg-slate-950/45 px-4 py-3 text-xs text-slate-100 shadow-[0_18px_50px_rgba(0,0,0,0.24)] backdrop-blur-xl",a),...e,children:(0,d.jsx)("div",{className:"relative z-10",children:c})})}));function cr({label:a,side:b,surfaceTheme:c,panelCollapsed:e,children:f}){return(0,d.jsx)(cn,{delayDuration:120,children:(0,d.jsxs)(co,{children:[(0,d.jsx)(cp,{asChild:!0,children:f}),(0,d.jsx)(cq,{side:b,align:"center",sideOffset:10,className:s("rounded-[10px] px-2.5 py-1.5 text-[10px] font-medium leading-none tracking-[0.12em] whitespace-nowrap shadow-[0_16px_40px_rgba(0,0,0,0.32)]","light"===c?e?"border border-slate-200/80 bg-white/96 text-slate-900 shadow-[0_16px_40px_rgba(15,23,42,0.18)]":"border border-white/10 bg-slate-950/94 text-white shadow-[0_16px_40px_rgba(0,0,0,0.36)]":"border border-white/10 bg-slate-950/92 text-slate-100"),children:a})]})})}function cs({className:a,...b}){return(0,d.jsx)(u,{...b,className:s("!h-4 !px-1.5 !py-0 !text-[8px] !leading-none !tracking-[0.1em] !whitespace-nowrap",a)})}function ct(a){return(0,d.jsx)(cu,{...a},a.selectedNodeId??"overview")}function cu({snapshot:a,surfaceTheme:b,selectedNodeId:c,agentDetailFocus:e,lastMission:f,onRefresh:h,onSnapshotChange:j,onConfigureAgentCapabilities:k,onConnectModelProvider:l,onAbortTask:m,collapsed:n,onToggleCollapsed:o,activeTab:p,onActiveTabChange:q}){let r=G(a.generatedAt),t=a.workspaces.find(a=>a.id===c),u=a.agents.find(a=>a.id===c),v=a.tasks.find(a=>a.id===c),w=a.runtimes.find(a=>a.id===c),x=a.models.find(a=>a.id===c),y=!!v?.metadata.optimistic,z=t||u||v||w||x||null,A=w?.id??null,B=v?.id??null,C=v&&"string"==typeof v.dispatchId?v.dispatchId:null,[D,E]=(0,g.useState)(null),[H,I]=(0,g.useState)(null),[K,M]=(0,g.useState)(null),[N,P]=(0,g.useState)(null),Q=(0,g.useMemo)(()=>{var a;let b;return y&&v?{task:a=v,runs:[],outputs:[],liveFeed:Array.isArray(b=a.metadata.optimisticEvents)?b.filter(cI).sort((a,b)=>Date.parse(a.timestamp)-Date.parse(b.timestamp)):[],createdFiles:[],warnings:"stalled"===a.status||cK(a)?[a.subtitle]:[],integrity:cE(a)}:null},[y,v]),R=D&&D.runtimeId===A?D:null,S=H?.runtimeId===A?H.message:null,T=K&&(K.task.id===B||C&&"string"==typeof K.task.dispatchId&&K.task.dispatchId===C)?K:null,U=N?.taskId===B?N.message:null,V=T??Q,W=!!B&&(!y||!!C)&&!T&&!U,X=!!A&&!R&&!S,Y=!!u,Z=!!(w||v),$=!!(w||v),_=("chat"!==p||Y)&&("output"!==p||Z)&&("files"!==p||$)?p:"overview",aa="chat"===_&&!!u,ab=v?"Feed":"Output",ac=t?.name||(u?J(u):null)||(v?O(v.title||v.mission||"Task",48)||"Task":null)||(w?O(w.title||"Run",48)||"Run":null)||x?.name||"Gateway overview",ad=t?"workspace":u?"agent":v?"task":w?"run":x?"model":"selection",ae=(0,g.useMemo)(()=>[{id:"overview",label:"Overview",icon:bP.A,enabled:!0},{id:"chat",label:"Chat",icon:bQ.A,enabled:Y},{id:"output",label:ab,icon:i.A,enabled:Z},{id:"files",label:"Files",icon:bR.A,enabled:$},{id:"raw",label:"Raw",icon:bS.A,enabled:!0}],[ab,Y,$,Z]);return(0,d.jsxs)("div",{className:"panel-surface panel-glow flex h-full flex-row-reverse overflow-hidden rounded-none border border-r-0 border-white/[0.08] bg-[#04070e]/88 shadow-[0_28px_90px_rgba(0,0,0,0.42)] backdrop-blur-2xl",children:[(0,d.jsxs)("div",{className:s("flex h-full shrink-0 flex-col items-center bg-[linear-gradient(180deg,rgba(7,10,18,0.98),rgba(3,6,12,0.98))] px-1.5 py-2",n?"w-full":"w-[60px] border-l border-white/[0.08]"),children:[(0,d.jsx)(cr,{label:"Inspector",side:"left",surfaceTheme:b,panelCollapsed:n,children:(0,d.jsx)("button",{type:"button","aria-label":n?"Expand inspector":"Collapse inspector",onClick:o,className:"flex h-9 w-9 items-center justify-center rounded-[8px] border border-cyan-300/18 bg-cyan-400/[0.1] shadow-[0_8px_18px_rgba(34,211,238,0.14)] transition-all hover:border-cyan-200/24 hover:bg-cyan-400/[0.14]",children:(0,d.jsx)(i.A,{className:"h-3.5 w-3.5 text-cyan-200"})})}),(0,d.jsx)("div",{className:"mt-3.5 flex flex-1 flex-col items-center gap-1",children:ae.map(a=>(0,d.jsx)(cP,{icon:a.icon,label:a.label,active:_===a.id,surfaceTheme:b,panelCollapsed:n,tooltipSide:"left",disabled:!a.enabled,onClick:()=>{a.enabled&&(q(a.id),n&&o())}},a.id))}),(0,d.jsxs)("div",{className:"mt-1.5 flex flex-col items-center gap-0.5",children:[(0,d.jsx)(cs,{variant:"muted",className:"h-4 min-w-[28px] rounded-full px-1 py-0 text-[8px] leading-none tracking-[0.12em]",children:z?"live":"idle"}),n?(0,d.jsx)("p",{className:"max-w-[44px] truncate text-center text-[8px] uppercase tracking-[0.14em] text-slate-500",children:ad}):null]})]}),n?null:(0,d.jsx)("div",{className:"min-w-0 flex-1 bg-[linear-gradient(180deg,rgba(6,10,18,0.96),rgba(3,6,14,0.98))]",children:(0,d.jsxs)("div",{className:s("mission-scroll flex h-full min-h-0 flex-col overscroll-contain",aa?"overflow-hidden":"overflow-y-auto"),children:[(0,d.jsxs)("div",{className:"shrink-0 border-b border-white/[0.08] px-3 pb-2 pt-3",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:"text-[9px] font-medium uppercase tracking-[0.24em] text-slate-500",children:"Inspector"}),(0,d.jsxs)("div",{className:"mt-1 flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("h2",{className:"min-w-0 truncate font-display text-[1.02rem] leading-5 text-white",children:ac}),(0,d.jsx)(cs,{variant:"muted",className:"shrink-0 h-4 px-1.5 py-0 text-[8px] leading-none tracking-[0.1em]",children:ad})]}),(0,d.jsx)("p",{className:"mt-1 truncate text-[11px] leading-4 text-slate-400",children:v?`${v.runtimeCount} runs \xb7 ${v.liveRunCount} live \xb7 ${F(v.updatedAt,r)}`:w?`Run ${L(w.runId||w.id,10)} \xb7 ${w.status} \xb7 ${F(w.updatedAt,r)}`:u?`${u.activeRuntimeIds.length} active runs`:t?`${t.agentIds.length} agents attached`:x?`${x.provider} model`:"Live gateway context"})]}),(0,d.jsx)("div",{className:"hidden h-8 w-8 shrink-0 items-center justify-center rounded-none border border-white/10 bg-white/[0.04] text-cyan-200 sm:flex",children:(0,d.jsx)(i.A,{className:"h-3.5 w-3.5"})})]}),(0,d.jsx)("div",{className:"mt-2 flex flex-nowrap gap-1 overflow-x-auto pb-0.5",children:ae.filter(a=>a.enabled).map(a=>(0,d.jsx)(cQ,{label:a.label,active:_===a.id,onClick:()=>q(a.id)},a.id))})]}),(0,d.jsx)("div",{className:s("flex-1 p-3",aa&&"min-h-0 overflow-hidden"),children:(0,d.jsx)(a5.N,{mode:"wait",children:(0,d.jsxs)(a6.P.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},className:s("space-y-3.5",aa&&"flex h-full min-h-0 flex-col space-y-0"),children:["overview"===_?(0,d.jsxs)(d.Fragment,{children:[t?(0,d.jsx)(cw,{snapshot:a,workspaceId:t.id}):null,u?(0,d.jsx)(cx,{snapshot:a,agentId:u.id,focusSection:e,onConfigureAgentCapabilities:k}):null,v?(0,d.jsx)(cy,{snapshot:a,task:v,taskId:v.id,taskDetail:V,taskDetailLoading:W,taskDetailError:U,onAbortTask:m}):null,w?(0,d.jsx)(cL,{snapshot:a,runtimeId:w.id,runtimeOutput:R,runtimeOutputLoading:X,runtimeOutputError:S}):null,x?(0,d.jsx)(cO,{snapshot:a,modelId:x.id}):null,z?null:(0,d.jsx)(cv,{snapshot:a,lastMission:f})]}):null,u?(0,d.jsx)("div",{className:s("min-h-0 flex-1",aa?"block":"hidden"),"aria-hidden":!aa,children:(0,d.jsx)(cc,{agent:u,snapshot:a,surfaceTheme:b,isVisible:aa,onRefresh:h,onSnapshotChange:j,onConnectModelProvider:l})}):null,"output"===_&&v?(0,d.jsx)(cA,{task:v,basePath:cC(a,v,V?.runs),taskDetail:V,taskDetailLoading:W,taskDetailError:U}):null,"output"===_&&w?(0,d.jsx)(cN,{runtime:w,basePath:a.workspaces.find(a=>a.id===w.workspaceId)?.path,runtimeOutput:R,runtimeOutputLoading:X,runtimeOutputError:S}):null,"files"===_&&v?(0,d.jsx)(cB,{snapshot:a,task:v,taskDetail:V}):null,"files"===_&&w?(0,d.jsx)(cM,{runtime:w,runtimeOutput:R}):null,"raw"===_?(0,d.jsx)("pre",{className:"overflow-x-auto rounded-[18px] border border-white/[0.08] bg-slate-950/[0.72] p-3 text-[11px] leading-5 text-slate-300",children:JSON.stringify(v&&V?V:w&&R?{runtime:w,output:R}:z||a,null,2)}):null]},c||"overview")})}),aa?null:(0,d.jsx)("div",{className:"shrink-0 border-t border-white/[0.08] p-3",children:(0,d.jsx)("div",{className:"rounded-[22px] border border-cyan-300/10 bg-[linear-gradient(180deg,rgba(7,22,31,0.95),rgba(5,13,22,0.95))] p-3.5 shadow-[0_16px_40px_rgba(0,0,0,0.22)]",children:(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"flex h-11 w-11 items-center justify-center rounded-full border border-cyan-300/15 bg-cyan-400/[0.12] text-cyan-200",children:(0,d.jsx)(bT.A,{className:"h-4 w-4"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate font-display text-[15px] text-white",children:v?`${v.runtimeCount} runs`:w?`Run ${L(w.runId||w.id,10)}`:u?`${u.activeRuntimeIds.length} active runs`:t?`${t.agentIds.length} agents`:x?x.provider:"Gateway overview"}),(0,d.jsxs)("p",{className:"mt-1 text-[12px] text-slate-400",children:[ad," \xb7"," ",v?`${V?.liveFeed.length??0} live feed events`:w?`${R?.items.length??0} transcript entries`:u?`${u.activeRuntimeIds.length} tracked runs`:t?`${t.agentIds.length} attached`:`${a.presence.length} live beacons`]})]})]})})})]})})]})}function cv({snapshot:a,lastMission:b}){let c=G(a.generatedAt),e=a.diagnostics.runtime.stateWritable&&a.diagnostics.runtime.sessionStoreWritable?"passed"===a.diagnostics.runtime.smokeTest.status?"verified":"pending smoke test":"attention";return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(cR,{icon:bT.A,title:"Gateway health",value:a.diagnostics.health,children:[(0,d.jsx)("p",{children:a.diagnostics.gatewayUrl}),(0,d.jsx)("p",{children:a.diagnostics.dashboardUrl})]}),(0,d.jsxs)(cR,{icon:bR.A,title:"Runtime preflight",value:e,children:[(0,d.jsx)("p",{className:"font-mono text-xs text-slate-400",children:a.diagnostics.runtime.stateRoot}),(0,d.jsx)("p",{children:a.diagnostics.runtime.sessionStores.length>0?`${a.diagnostics.runtime.sessionStores.filter(a=>a.writable).length}/${a.diagnostics.runtime.sessionStores.length} session stores writable`:"No agent session stores have been probed yet."}),a.diagnostics.runtime.smokeTest.checkedAt?(0,d.jsxs)("p",{children:["Smoke test ",a.diagnostics.runtime.smokeTest.status," \xb7"," ",a.diagnostics.runtime.smokeTest.agentId||"unknown agent"," \xb7"," ",F(Date.parse(a.diagnostics.runtime.smokeTest.checkedAt),c)]}):(0,d.jsx)("p",{children:"No runtime smoke test has been recorded yet."}),a.diagnostics.runtime.issues[0]?(0,d.jsx)("div",{className:"rounded-[14px] border border-amber-400/15 bg-amber-400/8 px-3 py-2 text-[13px] text-amber-50",children:a.diagnostics.runtime.issues[0]}):null]}),(0,d.jsxs)(cR,{icon:i.A,title:"Presence beacons",value:String(a.presence.length),children:[0===a.presence.length?(0,d.jsx)("p",{children:"No live presence payloads."}):null,a.presence.map(a=>(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,d.jsx)("div",{className:"text-[13px] text-white",children:a.host}),(0,d.jsxs)("div",{className:"mt-1 text-xs text-slate-400",children:[a.ip," \xb7 ",a.platform," \xb7 ",a.version]})]},a.ts))]}),b?(0,d.jsxs)(cR,{icon:bU.A,title:"Last mission",value:b.status,children:[(0,d.jsx)("p",{className:"text-sm text-white",children:b.summary}),(0,d.jsx)("p",{className:"font-mono text-xs text-slate-500",children:b.runId?`Run ${b.runId}`:`Dispatch ${b.dispatchId??"pending"}`}),"string"==typeof b.meta?.outputDirRelative?(0,d.jsx)("p",{className:"font-mono text-xs text-slate-400",children:b.meta.outputDirRelative}):null,b.payloads[0]?.text?(0,d.jsx)("div",{className:"rounded-[14px] border border-cyan-400/15 bg-cyan-400/8 px-3 py-2 text-[13px] text-cyan-50",children:b.payloads[0].text}):null]}):null]})}function cw({snapshot:a,workspaceId:b}){let c=G(a.generatedAt),e=a.workspaces.find(a=>a.id===b),f=a.agents.filter(a=>a.workspaceId===b),g=e?e.modelIds.map(b=>a.models.find(a=>a.id===b)?.name||b):[],h=a.runtimes.filter(a=>a.workspaceId===b||e?.activeRuntimeIds.includes(a.id)).sort((a,b)=>(b.updatedAt??0)-(a.updatedAt??0));if(!e)return null;let j=h.filter(a=>"running"===a.status||"queued"===a.status||"idle"===a.status),k=h[0]??null,l=cZ(h.flatMap(cY)).slice(0,8),m=e.bootstrap.coreFiles.every(a=>a.present)&&e.bootstrap.projectShell.every(a=>a.present)?"ready":e.bootstrap.coreFiles.some(a=>a.present)||e.bootstrap.projectShell.some(a=>a.present)?"partial":"thin",n=Array.from(new Set(f.flatMap(a=>a.observedTools??[]))),o=0===f.length?"no agents":e.capabilities.workspaceOnlyAgentCount===f.length?"workspace-only":0===e.capabilities.workspaceOnlyAgentCount?"open":"mixed";return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(cR,{icon:bR.A,title:"Overview",value:e.health,children:[(0,d.jsx)("p",{className:"font-mono text-xs text-slate-400",children:M(e.path)}),(0,d.jsx)(cU,{items:[{label:"Agents",value:String(f.length)},{label:"Models",value:String(e.modelIds.length)},{label:"Runs",value:String(h.length)},{label:"Sessions",value:String(e.totalSessions)}]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Models"}),(0,d.jsx)(cW,{emptyLabel:"No models attached",items:g,emptyVariant:"muted",itemVariant:"muted"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Team"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:f.map(a=>(0,d.jsx)(cs,{variant:a.isDefault?"default":"muted",children:J(a)},a.id))})]})]}),(0,d.jsxs)(cR,{icon:bU.A,title:"Bootstrap",value:m,children:[(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsx)(cs,{variant:e.bootstrap.template?"default":"muted",children:e.bootstrap.template||"template unknown"}),(0,d.jsx)(cs,{variant:e.bootstrap.sourceMode?"muted":"warning",children:e.bootstrap.sourceMode||"source unknown"}),e.bootstrap.agentTemplate?(0,d.jsx)(cs,{variant:"muted",children:e.bootstrap.agentTemplate}):null]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Core files"}),(0,d.jsx)(cV,{items:e.bootstrap.coreFiles,missingVariant:"warning"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Optional scaffold"}),(0,d.jsx)(cV,{items:[...e.bootstrap.optionalFiles,...e.bootstrap.folders]})]}),e.bootstrap.contextFiles?.length?(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Context docs"}),(0,d.jsx)(cV,{items:e.bootstrap.contextFiles})]}):null,(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Project shell"}),(0,d.jsx)(cV,{items:e.bootstrap.projectShell})]})]}),(0,d.jsxs)(cR,{icon:bU.A,title:"Capabilities",value:o,children:[(0,d.jsxs)("p",{children:[e.capabilities.workspaceOnlyAgentCount,"/",f.length," agents are configured with"," ",(0,d.jsx)("span",{className:"font-mono text-xs text-slate-300",children:"fs.workspaceOnly"}),"."]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Skills"}),(0,d.jsx)(cW,{emptyLabel:"No explicit skills",items:e.capabilities.skills,emptyVariant:"muted",itemVariant:"muted"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Local workspace skills"}),(0,d.jsx)(cW,{emptyLabel:"No local SKILL.md scaffolds",items:e.bootstrap.localSkillIds,emptyVariant:"muted",itemVariant:"success"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Declared tools"}),(0,d.jsx)(cW,{emptyLabel:"No explicit tools configured",items:e.capabilities.tools,emptyVariant:"muted",itemVariant:"warning"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Observed tools"}),(0,d.jsx)(cW,{emptyLabel:"No runtime tool calls recovered yet",items:n,emptyVariant:"muted",itemVariant:"default"})]})]}),(0,d.jsxs)(cR,{icon:i.A,title:"Activity",value:`${j.length} live`,children:[(0,d.jsxs)("p",{children:[h.length," tracked runs across ",e.totalSessions," recorded sessions."]}),(0,d.jsx)("p",{children:k?`Latest update ${F(k.updatedAt,c)}`:"No runtime activity has been recorded yet."}),h.length>0?(0,d.jsx)("div",{className:"space-y-2 pt-1",children:h.slice(0,3).map(a=>(0,d.jsxs)("div",{className:"flex items-center justify-between rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[13px] text-white",children:a.title}),(0,d.jsxs)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:[a.subtitle," \xb7 ",L(a.runId||a.id,10)]})]}),(0,d.jsx)(cs,{variant:K(a.status),children:a.status})]},a.id))}):null,(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Agent posture"}),(0,d.jsx)("div",{className:"space-y-2",children:f.map(a=>(0,d.jsxs)("div",{className:"flex items-center justify-between rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[13px] text-white",children:J(a)}),(0,d.jsx)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:a.currentAction})]}),(0,d.jsx)(cs,{variant:"engaged"===a.status?"default":"offline"===a.status?"danger":"muted",children:a.status})]},a.id))})]})]}),(0,d.jsx)(cR,{icon:bS.A,title:"Created files",value:String(l.length),children:(0,d.jsx)(cT,{files:l,basePath:e.path,emptyLabel:"No file artifacts have been detected in recent workspace runs."})})]})}function cx({snapshot:a,agentId:b,focusSection:c,onConfigureAgentCapabilities:e}){let f=G(a.generatedAt),h=a.agents.find(a=>a.id===b),j=a.workspaces.find(a=>a.id===h?.workspaceId),k=a.models.find(a=>a.id===h?.modelId),l=(0,g.useRef)(null),n=(0,g.useRef)(null),o=(0,g.useRef)(null),p=h?.observedTools??[],q=h?.skills??[],r=(h?.tools??[]).filter(a=>"fs.workspaceOnly"!==a),t=h?.tools.includes("fs.workspaceOnly")?["fs.workspaceOnly"]:[],u=h?aI[h.policy.preset]:null,v=q.length>0?q:u?.skillIds??[],w=r.length>0?r:u?.tools??[],y=h?[{label:"Preset",value:aQ(h.policy.preset)},{label:"Missing tools",value:aS(h.policy.missingToolBehavior)},{label:"Install scope",value:aT(h.policy.installScope)},{label:"File access",value:aU(h.policy.fileAccess)},{label:"Network",value:aV(h.policy.networkAccess)}]:[],z=a.runtimes.filter(a=>h?.activeRuntimeIds.includes(a.id)).sort((a,b)=>(b.updatedAt??0)-(a.updatedAt??0)),[A,B]=(0,g.useState)(null),C=cZ(z.flatMap(cY)).slice(0,8);return h?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(cR,{icon:bU.A,title:"Agent identity",value:h.id,children:[(0,d.jsx)("p",{children:J(h)}),(0,d.jsx)("p",{children:h.identity.emoji?`${h.identity.emoji} \xb7 ${h.identity.theme??"theme unset"}`:"No identity emoji"}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[h.isDefault?(0,d.jsx)(cs,{variant:"default",children:"default agent"}):null,(0,d.jsx)(cs,{variant:aI[h.policy.preset].badgeVariant,children:aQ(h.policy.preset)}),h.identity.source?(0,d.jsx)(cs,{variant:"muted",children:h.identity.source}):null]})]}),(0,d.jsxs)(cR,{icon:bR.A,title:"Workspace",value:j?.name||"n/a",children:[(0,d.jsx)("p",{className:"font-mono text-xs text-slate-400",children:M(h.workspacePath)}),(0,d.jsxs)("p",{children:[h.sessionCount," recorded sessions"]})]}),(0,d.jsxs)(cR,{icon:bU.A,title:"Model assignment",value:k?.name||h.modelId,children:[(0,d.jsx)("p",{children:k?`${k.provider} \xb7 ${H(k.contextWindow)} ctx`:"Model metadata unavailable"}),(0,d.jsx)("p",{children:k?.available===!1?"Currently unavailable":k?.local?"Local model route":"Remote model route"})]}),(0,d.jsx)(cR,{icon:bU.A,title:"Agent summary",value:aQ(h.policy.preset),actions:(0,d.jsxs)(x,{type:"button",variant:"secondary",size:"sm",onClick:()=>{e?.(h.id,"tools"===c?"tools":"skills")},className:"h-7 rounded-full px-2.5 text-[11px]",children:[(0,d.jsx)(bV.A,{className:"mr-1 h-3 w-3"}),"Edit"]}),children:(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{className:"w-full",children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Purpose"}),(0,d.jsx)("div",{className:"w-full rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:(0,d.jsx)("p",{className:"text-[13px] leading-5 text-slate-200",children:h.profile.purpose||"No explicit purpose was found in the workspace bootstrap files."})})]}),(0,d.jsxs)("div",{ref:l,className:s("scroll-mt-4 rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5 transition-all","skills"===c&&"border-cyan-300/25 bg-cyan-400/[0.05] shadow-[0_0_0_1px_rgba(34,211,238,0.08)]"),children:[(0,d.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Skills"}),(0,d.jsxs)(cs,{variant:"muted",children:[v.length," active"]})]}),(0,d.jsx)(cW,{emptyLabel:"No skills available",items:v,emptyVariant:"muted",itemVariant:"muted"})]}),(0,d.jsxs)("div",{ref:n,className:s("scroll-mt-4 rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5 transition-all","tools"===c&&"border-cyan-300/25 bg-cyan-400/[0.05] shadow-[0_0_0_1px_rgba(34,211,238,0.08)]"),children:[(0,d.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Tools"}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[t.length>0?(0,d.jsxs)(cs,{variant:"success",children:[(0,d.jsx)(m.A,{className:"mr-1 h-3 w-3"}),"policy locked"]}):null,(0,d.jsxs)(cs,{variant:"muted",children:[w.length," active"]})]})]}),(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)(cW,{emptyLabel:"No tools available",items:w,emptyVariant:"muted",itemVariant:"warning"}),t.length>0?(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Policy locked"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:t.map(a=>(0,d.jsxs)(cs,{variant:"success",children:[(0,d.jsx)(m.A,{className:"mr-1 h-3 w-3"}),a]},a))}),(0,d.jsx)("p",{className:"mt-1 text-[11px] leading-5 text-slate-500",children:"This capability is derived from the agent policy and cannot be removed here."})]}):null,p.length>0?(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Observed"}),(0,d.jsx)(cW,{emptyLabel:"No runtime tool calls recovered yet",items:p,emptyVariant:"muted",itemVariant:"default"})]}):null]})]}),(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-3",children:[(0,d.jsx)("p",{className:"text-[12px] leading-5 text-slate-400",children:u?.description??"No policy description available."}),(0,d.jsxs)("div",{className:"mt-3 grid gap-1.5 text-[13px] text-slate-300",children:[y.map(a=>(0,d.jsxs)("p",{children:[a.label,": ",(0,d.jsx)("span",{className:"text-white",children:a.value})]},a.label)),h.profile.outputPreference?(0,d.jsxs)("p",{children:["Output preference: ",(0,d.jsx)("span",{className:"text-white",children:h.profile.outputPreference})]}):null]})]})]})}),(0,d.jsxs)(cR,{icon:bT.A,title:"Runtime posture",value:h.status,children:[(0,d.jsx)("p",{children:h.currentAction}),(0,d.jsxs)("p",{children:["Last active ",F(h.lastActiveAt,f)]}),(0,d.jsx)("p",{children:h.heartbeat.enabled?`Heartbeat ${h.heartbeat.every}`:"Heartbeat disabled"}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsx)(cs,{variant:h.heartbeat.enabled?"success":"muted",children:h.heartbeat.enabled?"heartbeat on":"heartbeat off"}),"number"==typeof h.heartbeat.everyMs?(0,d.jsxs)(cs,{variant:"muted",children:[Math.round(h.heartbeat.everyMs/1e3),"s interval"]}):null]})]}),(0,d.jsx)("div",{ref:o,className:"scroll-mt-4",children:(0,d.jsxs)(cR,{icon:i.A,title:"Activity history",value:String(z.length),className:s("sessions"===c&&"border-cyan-300/25 bg-[linear-gradient(180deg,rgba(12,25,37,0.92),rgba(8,13,24,0.88))] shadow-[0_0_0_1px_rgba(34,211,238,0.08)]"),children:[(0,d.jsxs)("p",{children:[h.sessionCount," recorded sessions overall."]}),(0,d.jsx)("p",{children:z.length>0?`${z.length} history item${1===z.length?"":"s"} recovered from the latest agent activity.`:"No linked runtime records were recovered for this agent in the current snapshot."}),h.sessionCount>z.length?(0,d.jsxs)("p",{className:"text-[12px] text-slate-500",children:[h.sessionCount-z.length," session",h.sessionCount-z.length==1?"":"s"," do not have recovered runtime data yet."]}):null,z.length>0?(0,d.jsx)("div",{className:"space-y-2.5 pt-1",children:z.map(a=>{var b,c;let e=A===a.id,g=function(a){switch(a){case"session":return"Direct chat";case"turn":return"Conversation";case"cron":return"Scheduled";default:return"Unknown source"}}(a.source),h=function(a){if(a.taskId)return"Task";switch(a.source){case"session":return"Chat";case"turn":return"Run";case"cron":return"Scheduled";default:return"Activity"}}(a),i=a.sessionId?`session ${L(a.sessionId,10)}`:a.runId?`run ${L(a.runId,10)}`:"session n/a",j="number"!=typeof(b=a.tokenUsage?.total)||Number.isNaN(b)?"0 Tokens":b>=1e3?`${Math.round(b/1e3)}K Tokens`:`${b} Tokens`,k="number"!=typeof(c=a.updatedAt)||Number.isNaN(c)?"No time":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(c));return(0,d.jsxs)("div",{className:s("overflow-hidden rounded-[14px] border bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] transition-all",e?"border-cyan-300/22 shadow-[0_0_0_1px_rgba(34,211,238,0.08)]":"border-white/[0.08]"),children:[(0,d.jsxs)("button",{type:"button","aria-expanded":e,className:"nodrag nopan flex w-full flex-col gap-2 px-3 py-2.5 text-left transition-colors hover:bg-white/[0.03]",onClick:()=>{B(b=>b===a.id?null:a.id)},onPointerDown:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,d.jsx)(cs,{variant:K(a.status),children:a.status}),(0,d.jsx)(cs,{variant:a.tokenUsage?.total?"default":"muted",children:j})]}),(0,d.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,d.jsx)("p",{className:"line-clamp-2 text-[13px] leading-5 text-white",children:a.title}),(0,d.jsx)("p",{className:"line-clamp-2 text-[12px] leading-5 text-slate-300",children:a.subtitle})]}),(0,d.jsxs)("div",{className:"flex items-end justify-between gap-3",children:[(0,d.jsx)("div",{className:"min-w-0",children:(0,d.jsxs)("p",{className:"truncate text-[9px] uppercase tracking-[0.18em] text-slate-500",children:[h," \xb7 ",i]})}),(0,d.jsx)("p",{className:"shrink-0 text-right text-[9px] uppercase tracking-[0.18em] text-slate-500",children:k})]})]}),(0,d.jsx)(a5.N,{initial:!1,children:e?(0,d.jsx)(a6.P.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.18},className:"overflow-hidden border-t border-white/[0.08]",children:(0,d.jsxs)("div",{className:"space-y-3 px-3 py-3",children:[(0,d.jsx)(cU,{items:[{label:"Source",value:g},{label:"Status",value:a.status},{label:"Updated",value:F(a.updatedAt,f)},{label:"Key",value:L(a.key,12)}]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[a.sessionId?(0,d.jsxs)(cs,{variant:"muted",children:["session ",L(a.sessionId,12)]}):null,a.runId?(0,d.jsxs)(cs,{variant:"muted",children:["run ",L(a.runId,12)]}):null,a.taskId?(0,d.jsxs)(cs,{variant:"muted",children:["task ",L(a.taskId,12)]}):null,a.modelId?(0,d.jsxs)(cs,{variant:"muted",children:["model ",L(a.modelId,12)]}):null]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Preview"}),(0,d.jsx)("div",{className:"rounded-[12px] border border-white/[0.08] bg-white/[0.03] px-3 py-2",children:(0,d.jsx)("p",{className:"text-[12px] leading-5 text-slate-200",children:a.subtitle})})]}),a.toolNames?.length?(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Tools"}),(0,d.jsx)(cW,{emptyLabel:"No tool names recorded",items:a.toolNames,emptyVariant:"muted",itemVariant:"warning"})]}):null]})}):null})]},a.id)})}):null]})}),(0,d.jsx)(cR,{icon:bS.A,title:"Created files",value:String(C.length),children:(0,d.jsx)(cT,{files:C,basePath:h.workspacePath,emptyLabel:"No file artifacts have been detected for this agent yet."})}),(0,d.jsxs)(cR,{icon:bU.A,title:"Capabilities",value:`${h.skills.length} skills`,children:[(0,d.jsx)(cW,{emptyLabel:"No explicit skills",items:h.skills,emptyVariant:"muted",itemVariant:"muted"}),(0,d.jsxs)("div",{className:"pt-1",children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Declared tools"}),(0,d.jsx)(cW,{emptyLabel:"No explicit tools configured",items:h.tools,emptyVariant:"muted",itemVariant:"warning"})]}),(0,d.jsxs)("div",{className:"pt-1",children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Observed tools"}),(0,d.jsx)(cW,{emptyLabel:"No runtime tool calls recovered yet",items:p,emptyVariant:"muted",itemVariant:"default"})]})]})]}):null}function cy({snapshot:a,task:b,taskId:c,taskDetail:e,taskDetailLoading:f,taskDetailError:g,onAbortTask:h}){var j,k,l,m;let n=a.tasks.find(a=>a.id===c)??b,p=cK(n),q=!!h&&function(a){if(cK(a))return!1;let b=a.status;return"running"===b||"queued"===b}(n),r=e?.runs??a.runtimes.filter(a=>b?.runtimeIds.includes(a.id)).sort((a,b)=>(b.updatedAt??0)-(a.updatedAt??0)),s=cC(a,n,r),t=cD(a,n,r),u=a.agents.find(a=>a.id===n?.primaryAgentId),v=e?.createdFiles??cZ(r.flatMap(a=>cY(a))),w=e?.warnings??[];if(!b)return null;let y=e?.integrity??cE(b),z=cF(n),A=("string"==typeof(j=n).metadata.routedMission?j.metadata.routedMission.trim():"")||cF(j),B=(k=z,l=A,cH(k)!==cH(l)),C=("string"==typeof(m=n).metadata.resultPreview?m.metadata.resultPreview.trim():"")||m.subtitle.trim()||"",D=cG(n.metadata.sessionCount,n.sessionIds.length),E=cG(n.metadata.turnCount,r.length),G=(e?.liveFeed??[]).filter(a=>cJ(a)).sort((a,b)=>Date.parse(a.timestamp)-Date.parse(b.timestamp)),H=function(a){for(let b of a)if("string"==typeof b.filePath&&"string"==typeof b.displayPath)return{path:b.filePath,displayPath:b.displayPath};return null}(G);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(cR,{icon:bR.A,title:"Mission",value:p?"aborted":n.status,children:[(0,d.jsx)(cS,{label:"Original prompt",text:z,basePath:s}),(0,d.jsx)(cS,{label:"Sent to OpenClaw",text:B?A:"Same as original prompt.",basePath:s,subtle:!B}),(0,d.jsx)(cS,{label:"Latest task output",text:C||"Waiting for the first OpenClaw update.",basePath:s,subtle:!C}),(0,d.jsx)(cU,{items:[{label:"Sessions",value:String(D)},{label:"Turns",value:String(E)},{label:"Runs",value:String(n.runtimeCount)},{label:"Files",value:String(n.artifactCount)},{label:"Live",value:String(n.liveRunCount)},{label:"Tools",value:String(y.toolNames.length)}]}),h&&(q||p)?(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:(0,d.jsxs)(x,{type:"button",variant:p?"secondary":"destructive",size:"sm",disabled:!q,className:"gap-2",onClick:()=>{q&&h(n)},children:[(0,d.jsx)(o.A,{className:"h-3.5 w-3.5"}),p?"Aborted":"Abort task"]})}):null,(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[t?(0,d.jsx)(cs,{variant:"muted",children:t.name}):null,u?(0,d.jsx)(cs,{variant:"default",children:J(u)}):null,n.dispatchId?(0,d.jsxs)(cs,{variant:"muted",children:["dispatch ",L(n.dispatchId,8)]}):null,p?(0,d.jsx)(cs,{variant:"danger",children:"aborted"}):null]}),f&&!e?(0,d.jsx)("p",{children:"Connecting live task feed…"}):null,g?(0,d.jsx)("p",{className:"rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:g}):null]}),(0,d.jsx)(cz,{task:n,integrity:y,basePath:s}),(0,d.jsxs)(cR,{icon:i.A,title:"Runner logs",value:String(G.length),children:[H?(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Log file"}),(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(cj,{text:H.displayPath,className:"text-[12.5px] leading-5 text-slate-100",filePath:H.path,displayPath:H.displayPath,basePath:s})}),(0,d.jsx)("p",{className:"mt-2 text-[11px] text-slate-400",children:"Only meaningful runner diagnostics are shown here. OpenClaw bootstrap debug noise is hidden."})]}):null,0===G.length?(0,d.jsx)("p",{children:"No meaningful dispatch runner diagnostics have been captured for this task yet."}):(0,d.jsx)("div",{className:"max-h-[300px] space-y-2 overflow-y-auto pr-1",children:G.map(a=>(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2.5",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("div",{className:"flex min-w-0 items-center gap-2",children:(0,d.jsx)(cs,{variant:c$(a.kind,a.isError),children:a.title})}),(0,d.jsx)("span",{className:"shrink-0 text-[10px] uppercase tracking-[0.18em] text-slate-500",children:F(new Date(a.timestamp).getTime())})]}),(0,d.jsx)("pre",{className:"mt-2 whitespace-pre-wrap break-words font-mono text-[11px] leading-5 text-slate-100",children:a.detail})]},a.id))})]}),(0,d.jsxs)(cR,{icon:i.A,title:"Runs",value:String(r.length),children:[0===r.length?(0,d.jsx)("p",{children:"No OpenClaw runs have been grouped into this task yet."}):null,(0,d.jsx)("div",{className:"space-y-2",children:r.map(a=>(0,d.jsxs)("div",{className:"flex items-center justify-between rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[13px] text-white",children:a.title}),(0,d.jsx)("p",{className:"truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:a.subtitle})]}),(0,d.jsx)(cs,{variant:K(a.status),children:a.status})]},a.id))})]}),(0,d.jsx)(cR,{icon:bS.A,title:"Artifacts",value:String(v.length),children:(0,d.jsx)(cT,{files:v,basePath:s,emptyLabel:"This task has not produced a detectable file artifact yet."})}),w.length>0?(0,d.jsx)(cR,{icon:bT.A,title:"Warnings",value:String(w.length),children:(0,d.jsx)(cX,{items:w,emptyLabel:"No warnings detected."})}):null]})}function cz({task:a,integrity:b,basePath:c}){let e=cK(a),f=!!a.metadata.optimistic&&!e&&"stalled"!==a.status,g=b.issues.find(a=>"missing-final-response"===a.id),h=b.issues.find(a=>"partial-final-response"===a.id),i=e?"This task was aborted by an operator. Captured evidence may be incomplete.":f?"OpenClaw accepted this task. Session, tool, and file evidence will appear here as soon as the first runtime reports in.":g?g.detail:"verified"===b.status?"AgentOS found a matching transcript and the captured result looks internally consistent.":b.sessionMismatch?"The linked transcript belongs to a different mission or stale session, so this completion cannot be trusted yet.":b.issues.some(a=>"empty-output-dir"===a.id)?"The task is marked completed, but the expected deliverables are missing from the output folder.":"error"===b.status?"The captured evidence does not line up with the requested mission.":"AgentOS recovered partial evidence, but this result still needs operator review.";return(0,d.jsxs)(cR,{icon:bT.A,title:"Result integrity",value:e?"aborted":"stalled"===a.status?"stalled":f?"pending":b.status,children:[(0,d.jsx)("p",{children:i}),(0,d.jsx)(cU,{items:[{label:"Output files",value:String(b.outputFileCount)},{label:"Transcript turns",value:String(b.transcriptTurnCount)},{label:"Matched turns",value:String(b.matchingTranscriptTurnCount)},{label:"Tools",value:String(b.toolNames.length)},{label:"Emails",value:String(b.emails.length)}]}),b.outputDir||b.outputDirRelative?(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Output folder"}),(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(cj,{text:b.outputDirRelative||b.outputDir||"Output folder",className:"text-[12.5px] leading-5 text-slate-100",filePath:b.outputDir,displayPath:b.outputDirRelative||b.outputDir,basePath:c})}),(0,d.jsx)("p",{className:"mt-2 text-[11px] text-slate-400",children:b.outputDirExists?`${b.outputFileCount} file${1===b.outputFileCount?"":"s"} detected in the folder.`:"The output folder is not currently accessible."})]}):null,(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,d.jsxs)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:["Final response ","none"!==b.finalResponseSource?`(${b.finalResponseSource})`:""]}),h?(0,d.jsx)("p",{className:"mt-2 rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:h.detail}):null,(0,d.jsx)("div",{className:"mt-2",children:b.finalResponseText?(0,d.jsx)(cj,{text:b.finalResponseText,className:"text-[12.5px] leading-5 text-slate-100",basePath:c}):(0,d.jsx)("p",{className:"text-[12.5px] leading-5 text-slate-400",children:"No final response was captured."})})]}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Recovered tools"}),b.toolNames.length>0?(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:b.toolNames.map(a=>(0,d.jsx)(cs,{variant:"muted",children:a},a))}):(0,d.jsx)("p",{children:"No tool calls were recovered from a matching transcript turn."})]}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Detected emails"}),b.emails.length>0?(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:b.emails.map(a=>(0,d.jsx)(cs,{variant:"muted",children:a},a))}):(0,d.jsx)("p",{children:"No email addresses were detected in the captured result."})]}),b.dispatchSessionId?(0,d.jsxs)("p",{className:"font-mono text-xs text-slate-400",children:["session ",L(b.dispatchSessionId,12),b.sessionMismatch?" \xb7 mismatch detected":""]}):null,b.issues.length>0?(0,d.jsxs)("div",{className:"rounded-[14px] border border-amber-400/16 bg-amber-400/[0.06] px-3 py-2.5",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-amber-100/80",children:"Review issues"}),(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(cX,{items:b.issues.map(a=>`${a.title}: ${a.detail}`),emptyLabel:"No integrity issues detected."})})]}):null]})}function cA({task:a,basePath:b,taskDetail:c,taskDetailLoading:e,taskDetailError:f}){if(e&&!c)return(0,d.jsx)(cR,{icon:i.A,title:"Live feed",value:"connecting",children:(0,d.jsx)("p",{children:"Connecting to the task feed…"})});if(f&&!c)return(0,d.jsx)(cR,{icon:i.A,title:"Live feed",value:"error",children:(0,d.jsx)("p",{children:f})});let g=(c?.liveFeed??[]).filter(a=>!cJ(a)),h=c?.integrity??cE(a);return(0,d.jsxs)(cR,{icon:i.A,title:"Live feed",value:String(g.length),children:[f?(0,d.jsx)("p",{className:"rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:f}):null,h.issues.length>0?(0,d.jsx)("p",{className:"rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:h.issues[0]?.detail}):null,0===g.length?(0,d.jsx)("p",{children:"No streamed task events have arrived yet."}):null,(0,d.jsx)("div",{className:"space-y-2",children:g.map(a=>(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2.5",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,d.jsx)(cs,{variant:c$(a.kind,a.isError),children:a.kind}),(0,d.jsx)("p",{className:"truncate text-[12px] text-white",children:a.title})]}),(0,d.jsx)("span",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:F(new Date(a.timestamp).getTime())})]}),(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(cj,{text:a.detail,className:"text-[12.5px] leading-5 text-slate-100",url:a.url,filePath:a.filePath,displayPath:a.displayPath,basePath:b})})]},a.id))})]})}function cB({snapshot:a,task:b,taskDetail:c}){let e=c?.runs??a.runtimes.filter(a=>b.runtimeIds.includes(a.id)).sort((a,b)=>(b.updatedAt??0)-(a.updatedAt??0)),f=c?.createdFiles??cZ(e.flatMap(a=>cY(a))),g=c?.integrity??cE(b),h=cC(a,b,e);return(0,d.jsxs)(cR,{icon:bS.A,title:"Files",value:String(f.length),children:[(0,d.jsxs)("p",{children:[e.length," run",1===e.length?"":"s"," contributed to this task."]}),g.outputDir||g.outputDirRelative?(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Output folder"}),(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(cj,{text:g.outputDirRelative||g.outputDir||"Output folder",className:"text-[12.5px] leading-5 text-slate-100",filePath:g.outputDir,displayPath:g.outputDirRelative||g.outputDir,basePath:h})}),(0,d.jsx)("p",{className:"mt-2 text-[11px] text-slate-400",children:g.outputDirExists?`${g.outputFileCount} file${1===g.outputFileCount?"":"s"} detected in the folder.`:"The output folder is not currently accessible."})]}):null,(0,d.jsx)(cT,{files:f,basePath:h,emptyLabel:"This task has not produced a detectable file artifact yet."})]})}function cC(a,b,c=[]){return cD(a,b,c)?.path??function(a,b,c=[]){for(let d of[b.primaryAgentId,...c.map(a=>a.agentId)].filter(a=>"string"==typeof a&&a.trim().length>0)){let b=a.agents.find(a=>a.id===d)?.workspacePath;if(b)return b}}(a,b,c)}function cD(a,b,c=[]){for(let d of[b.workspaceId,...c.map(a=>a.workspaceId),b.primaryAgentId?a.agents.find(a=>a.id===b.primaryAgentId)?.workspaceId:void 0,...c.map(b=>b.agentId?a.agents.find(a=>a.id===b.agentId)?.workspaceId:void 0)].filter(a=>"string"==typeof a&&a.trim().length>0)){let b=a.workspaces.find(a=>a.id===d);if(b)return b}return null}function cE(a){let b=!!a.metadata.optimistic&&!cK(a)&&"stalled"!==a.status,c=cK(a)?[{id:"task-cancelled",severity:"warning",title:"Task was cancelled by the operator",detail:"The mission dispatch was stopped before completion, so the captured evidence is intentionally incomplete."}]:"stalled"===a.status?[{id:"stalled-dispatch",severity:"warning",title:"Dispatch stalled before evidence was captured",detail:a.subtitle}]:[];return{status:c.some(a=>"error"===a.severity)?"error":b||c.length>0?"warning":"verified",outputDir:"string"==typeof a.metadata.outputDir&&a.metadata.outputDir.trim().length>0?a.metadata.outputDir:null,outputDirRelative:"string"==typeof a.metadata.outputDirRelative&&a.metadata.outputDirRelative.trim().length>0?a.metadata.outputDirRelative:null,outputDirExists:!1,outputFileCount:0,transcriptTurnCount:0,matchingTranscriptTurnCount:0,finalResponseText:null,finalResponseSource:"none",dispatchSessionId:null,sessionMismatch:!1,toolNames:[],emails:[],issues:c}}function cF(a){return a.mission?.trim()||a.title.trim()||"Untitled task"}function cG(a,b){return"number"==typeof a&&Number.isFinite(a)?a:b}function cH(a){return a.replace(/\s+/g," ").trim()}function cI(a){return"object"==typeof a&&null!==a&&"string"==typeof a.id&&"string"==typeof a.kind&&"string"==typeof a.timestamp&&"string"==typeof a.title&&"string"==typeof a.detail}function cJ(a){return a.id.startsWith("runner-log:")}function cK(a){let b="string"==typeof a.metadata.dispatchStatus?a.metadata.dispatchStatus:null,c=a.status;return"cancelled"===b||"aborted"===b||"cancelled"===c||"aborted"===c}function cL({snapshot:a,runtimeId:b,runtimeOutput:c,runtimeOutputLoading:e,runtimeOutputError:f}){var g;let h,j=G(a.generatedAt),k=a.runtimes.find(a=>a.id===b),l=cZ(c?.createdFiles??(k?cY(k):[])),m=c?.warnings??(k&&Array.isArray(h=k.metadata.warnings)?h.filter(a=>"string"==typeof a&&a.trim().length>0):[]),n=c?.warningSummary??m[0]??null,o=k?a.workspaces.find(a=>a.id===k.workspaceId)?.path:void 0;return k?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(cR,{icon:i.A,title:"Runtime key",value:k.status,children:[(0,d.jsx)("p",{className:"font-mono text-xs text-slate-400",children:k.key}),(0,d.jsxs)("p",{children:["Session ",L(k.sessionId,12)]}),k.taskId?(0,d.jsxs)("p",{children:["Task ",L(k.taskId,12)]}):null,k.runId?(0,d.jsxs)("p",{children:["Run ",L(k.runId,12)]}):null]}),(0,d.jsxs)(cR,{icon:bT.A,title:"Activity",value:F(k.updatedAt,j),children:[(0,d.jsx)("p",{children:k.subtitle}),(0,d.jsxs)("p",{children:["number"!=typeof(g=k.tokenUsage?.total)?"n/a":g>=1e3?`${(g/1e3).toFixed(g>=1e4?0:1)}k`:String(g)," tokens"]})]}),(0,d.jsxs)(cR,{icon:bU.A,title:"Latest output",value:c?.stopReason||(e?"loading":"no transcript"),children:[e?(0,d.jsx)("p",{children:"Loading transcript output…"}):null,f?(0,d.jsx)("p",{children:f}):null,e||f?null:(0,d.jsx)(cj,{text:c?.finalText||c?.errorMessage||"No assistant output has been recorded for this runtime yet.",className:"text-[13px] leading-5 text-slate-100",basePath:o}),n?(0,d.jsxs)("p",{className:"mt-3 rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:["Fallback used: ",n]}):null,c?.finalTimestamp?(0,d.jsxs)("p",{className:"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:["Updated ",F(new Date(c.finalTimestamp).getTime())]}):null]}),(0,d.jsx)(cR,{icon:bS.A,title:"Created files",value:String(l.length),children:(0,d.jsx)(cT,{files:l,basePath:a.workspaces.find(a=>a.id===k.workspaceId)?.path,emptyLabel:"This runtime has not produced a detectable file artifact."})})]}):null}function cM({runtime:a,runtimeOutput:b}){let c=cZ(b?.createdFiles??cY(a));return(0,d.jsxs)(cR,{icon:bS.A,title:"Files",value:String(c.length),children:[(0,d.jsx)("p",{children:a.title}),(0,d.jsx)(cT,{files:c,emptyLabel:"This runtime has not produced a detectable file artifact."})]})}function cN({runtime:a,basePath:b,runtimeOutput:c,runtimeOutputLoading:e,runtimeOutputError:f}){return e?(0,d.jsx)(cR,{icon:i.A,title:"Runtime output",value:"loading",children:(0,d.jsxs)("p",{children:["Loading transcript output for ",a.title,"…"]})}):f?(0,d.jsx)(cR,{icon:i.A,title:"Runtime output",value:"error",children:(0,d.jsx)("p",{children:f})}):c?(0,d.jsxs)("div",{className:"space-y-3.5",children:[c.warningSummary?(0,d.jsx)(cR,{icon:bT.A,title:"Warnings",value:String(c.warnings.length),children:(0,d.jsx)("p",{children:c.warningSummary})}):null,(0,d.jsx)(cR,{icon:bS.A,title:"Created files",value:String(c.createdFiles.length),children:(0,d.jsx)(cT,{files:c.createdFiles,basePath:b,emptyLabel:"This runtime transcript does not include a successful file creation."})}),(0,d.jsxs)(cR,{icon:i.A,title:"Final response",value:"stalled"===a.status||"cancelled"===a.status?a.status:c.stopReason||c.status,children:["stalled"===a.status||"cancelled"===a.status?(0,d.jsx)("p",{className:"mb-2 rounded-[12px] border border-amber-400/20 bg-amber-400/10 px-3 py-2 text-[12px] leading-5 text-amber-100",children:"This runtime did not complete cleanly. The text below is the last captured assistant output, not a verified completion."}):null,c.errorMessage?(0,d.jsx)("p",{className:"mb-2 rounded-[12px] border border-rose-400/20 bg-rose-400/10 px-3 py-2 text-[12px] leading-5 text-rose-100",children:c.errorMessage}):null,(0,d.jsx)(cj,{text:c.finalText||c.errorMessage||"No assistant output has been recorded for this runtime yet.",className:"text-[13px] leading-5 text-slate-100",basePath:b}),c.finalTimestamp?(0,d.jsx)("p",{className:"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:new Date(c.finalTimestamp).toLocaleString()}):null]}),(0,d.jsxs)(cR,{icon:bT.A,title:"Transcript trail",value:String(c.items.length),children:[0===c.items.length?(0,d.jsx)("p",{children:"No transcript entries were found."}):null,(0,d.jsx)("div",{className:"space-y-2",children:c.items.map(a=>(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2.5",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(cs,{variant:"assistant"===a.role?a.isError?"danger":"default":"toolResult"===a.role?"warning":"muted",children:a.role}),a.toolName?(0,d.jsx)(cs,{variant:"muted",children:a.toolName}):null]}),(0,d.jsx)("span",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:F(new Date(a.timestamp).getTime())})]}),(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(cj,{text:a.text,className:"text-[12.5px] leading-5 text-slate-100",basePath:b})})]},a.id))})]})]}):(0,d.jsx)(cR,{icon:i.A,title:"Runtime output",value:"missing",children:(0,d.jsx)("p",{children:"No transcript data is available for this runtime."})})}function cO({snapshot:a,modelId:b}){let c=a.models.find(a=>a.id===b);return c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(cR,{icon:bU.A,title:"Model routing",value:c.provider,children:[(0,d.jsx)("p",{children:c.name}),(0,d.jsx)("p",{children:c.local?"Local model":"Remote model"})]}),(0,d.jsxs)(cR,{icon:bT.A,title:"Capacity",value:`${H(c.contextWindow)} ctx`,children:[(0,d.jsx)("p",{children:c.input}),(0,d.jsx)("p",{children:!1===c.available?"Unavailable":"Available"}),(0,d.jsxs)("p",{children:[c.usageCount," attached agents"]})]})]}):null}function cP({icon:a,label:b,active:c,surfaceTheme:e,panelCollapsed:f,tooltipSide:g,disabled:h=!1,onClick:i}){return(0,d.jsx)(cr,{label:b,side:g,surfaceTheme:e,panelCollapsed:f,children:(0,d.jsx)("button",{type:"button","aria-label":b,"aria-disabled":h,tabIndex:h?-1:0,onClick:i,className:s("inline-flex h-8 w-8 items-center justify-center rounded-[8px] border transition-all",h?"border-white/5 bg-white/[0.02] text-slate-600":c?"border-cyan-300/18 bg-cyan-400 text-slate-950 shadow-[0_10px_22px_rgba(96,165,250,0.28)]":"border-white/10 bg-white/[0.03] text-slate-400 hover:border-white/15 hover:bg-white/[0.08] hover:text-white"),children:(0,d.jsx)(a,{className:"h-3 w-3"})})})}function cQ({label:a,active:b,onClick:c}){return(0,d.jsx)("button",{type:"button",onClick:c,className:s("inline-flex items-center rounded-full border px-2.5 py-1.5 text-[10px] uppercase tracking-[0.14em] whitespace-nowrap transition-all",b?"border-cyan-300/20 bg-cyan-400 text-slate-950 shadow-[0_10px_24px_rgba(96,165,250,0.28)]":"border-white/[0.08] bg-white/[0.03] text-slate-300 hover:bg-white/[0.07] hover:text-white"),children:a})}function cR({icon:a,title:b,value:c,actions:e,children:f,className:g}){return(0,d.jsxs)("section",{className:s("rounded-[18px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(12,19,34,0.86),rgba(8,13,24,0.82))] p-3 transition-all",g),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.24em] text-slate-500",children:b}),(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,d.jsx)("p",{className:"min-w-0 font-display text-[1rem] text-white",children:c}),e?(0,d.jsx)("div",{className:"shrink-0",children:e}):null]})]}),(0,d.jsx)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/5 p-2 text-slate-300",children:(0,d.jsx)(a,{className:"h-3.5 w-3.5"})})]}),(0,d.jsx)("div",{className:"mt-3 space-y-1.5 text-[12.5px] leading-5 text-slate-300",children:f})]})}function cS({label:a,text:b,basePath:c,subtle:e=!1}){return(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:a}),(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(cj,{text:b,className:s("text-[12.5px] leading-5",e?"text-slate-400":"text-slate-100"),basePath:c})})]})}function cT({files:a,basePath:b,emptyLabel:c}){return 0===a.length?(0,d.jsx)("p",{className:"text-[12px] text-slate-400",children:c}):(0,d.jsx)("div",{className:"space-y-2",children:a.map(a=>{var c;let e=(c=a.path).startsWith("/")||/^[A-Za-z]:[\\/]/.test(c)||!!b;return(0,d.jsx)("button",{type:"button",disabled:!e,onClick:()=>void c_(a.path,b),className:s("w-full rounded-[14px] border border-cyan-300/12 bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2 text-left transition-all",e?"hover:border-cyan-300/28 hover:bg-cyan-400/[0.08]":"cursor-not-allowed opacity-60"),children:(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate font-mono text-[12px] text-cyan-100",children:a.displayPath}),(0,d.jsx)("p",{className:"truncate text-[11px] text-slate-400",children:M(a.path)})]}),(0,d.jsx)(cs,{variant:"muted",children:e?"reveal":"relative"})]})},a.path)})})}function cU({items:a}){return(0,d.jsx)("div",{className:"grid grid-cols-2 gap-2",children:a.map(a=>(0,d.jsxs)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:a.label}),(0,d.jsx)("p",{className:"mt-1 text-[13px] text-white",children:a.value})]},a.label))})}function cV({items:a,missingVariant:b="muted"}){return(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map(a=>(0,d.jsx)(cs,{variant:a.present?"success":b,children:a.label},a.id))})}function cW({items:a,emptyLabel:b,itemVariant:c,emptyVariant:e}){return 0===a.length?(0,d.jsx)(cs,{variant:e,children:b}):(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map(a=>(0,d.jsx)(cs,{variant:c,children:a},a))})}function cX({items:a,emptyLabel:b}){return 0===a.length?(0,d.jsx)("p",{className:"text-[12px] text-slate-400",children:b}):(0,d.jsx)("div",{className:"space-y-2",children:a.map(a=>(0,d.jsx)("div",{className:"rounded-[14px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] px-3 py-2",children:(0,d.jsx)("p",{className:"text-[12px] leading-5 text-slate-200",children:a})},a))})}function cY(a){let b=a.metadata.createdFiles;return Array.isArray(b)?b.flatMap(a=>{if(!a||"object"!=typeof a)return[];let b="path"in a&&"string"==typeof a.path?a.path:null,c="displayPath"in a&&"string"==typeof a.displayPath?a.displayPath:b;return b&&c?[{path:b,displayPath:c}]:[]}):[]}function cZ(a){let b=new Set,c=[];for(let d of a)!d.path||b.has(d.path)||(b.add(d.path),c.push(d));return c}function c$(a,b){if(b)return"danger";switch(a){case"assistant":return"default";case"tool":case"warning":return"warning";case"artifact":return"success";default:return"muted"}}async function c_(a,b){try{let c=await fetch("/api/files/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a,basePath:b??null})}),d=await c.json();if(!c.ok)throw Error(d.error||"Unable to reveal file.");aC.oR.success("Revealed file.",{description:M(a)})}catch(a){aC.oR.error("Could not reveal file.",{description:a instanceof Error?a.message:"Unknown file reveal error."})}}cq.displayName=cm.UC.displayName;var c0=c(49681);function c1(a){return a.diagnostics.installed&&a.diagnostics.rpcOk}function c2(a){return c1(a)&&a.diagnostics.modelReadiness.ready}function c3(a){return!!(a&&/[\\/]\.openclaw([\\/]|$)/.test(a))}function c4(a){return!!(a&&/[\\/]node_modules[\\/]/.test(a))}function c5(a){return a.mission?.trim()?a.mission.trim():a.title.trim()?a.title.trim():a.subtitle.trim()||"Continue this task."}function c6(a){let b,c;if(b="string"==typeof a.metadata.dispatchStatus?a.metadata.dispatchStatus:null,c=a.status,"cancelled"===b||"aborted"===b||"cancelled"===c||"aborted"===c)return!1;let d=a.status;return"running"===d||"queued"===d}function c7(a,b){let c,d=(Array.isArray(c=a.metadata.optimisticEvents)?c.filter(c9):[]).concat(b.feedEvent);return{...a,dispatchId:b.dispatchId??a.dispatchId,status:b.status,subtitle:b.subtitle,updatedAt:Date.now(),liveRunCount:+("stalled"!==b.status&&"cancelled"!==b.status),warningCount:"stalled"===b.status||"cancelled"===b.status?1:a.warningCount,metadata:{...a.metadata,bootstrapStage:b.bootstrapStage,optimisticEvents:function(a){let b=new Map;for(let c of a)b.set(c.id,c);return[...b.values()].sort((a,b)=>Date.parse(a.timestamp)-Date.parse(b.timestamp))}(d)}}}function c8(a,b,c,d){let e=Array.isArray(b)?b:[],f=Array.isArray(c)?c:[];return!(Array.isArray(d)?d:[]).includes(a.key)&&(!!f.includes(a.key)||0!==a.runtimeIds.length&&a.runtimeIds.every(a=>e.includes(a)))}function c9(a){return"object"==typeof a&&null!==a&&"string"==typeof a.id&&"string"==typeof a.kind&&"string"==typeof a.timestamp&&"string"==typeof a.title&&"string"==typeof a.detail}function da(a,b){let c=a.replace(/\s+/g," ").trim();return c.length<=b?c:`${c.slice(0,Math.max(b-1,1)).trimEnd()}…`}function db(a){return(a.diagnostics.configuredGatewayUrl||a.diagnostics.gatewayUrl).replace(/\/$/,"")}function dc(a){return M(a.diagnostics.configuredWorkspaceRoot||a.diagnostics.workspaceRoot)}function dd(a){return(a.workspaces?.length??0)>0&&(a.agents?.length??0)>0}function de(a){let b=(function(a){let b=a?.trim();if(!b)return null;let c=0;for(;c<b.length&&/\s/.test(b[c]);)c+=1;if(c>=b.length)return null;let d="",e="unquoted";for(;c<b.length;){let a=b[c];if("unquoted"===e){if(/\s/.test(a))break;if("'"===a){e="single",c+=1;continue}if('"'===a){e="double",c+=1;continue}if("\\"===a&&c+1<b.length){d+=b[c+1],c+=2;continue}d+=a,c+=1;continue}if("single"===e){if("'"===a){e="unquoted",c+=1;continue}d+=a,c+=1;continue}if('"'===a){e="unquoted",c+=1;continue}if("\\"===a&&c+1<b.length){d+=b[c+1],c+=2;continue}d+=a,c+=1}return d})(a)?.toLowerCase();return!!b&&("openclaw"===b||b.endsWith("/openclaw")||b.endsWith("\\openclaw"))}function df({snapshot:a,surfaceTheme:b,isInspectorOpen:c,taskAbortRequest:e,taskAbortRunState:f,taskAbortMessage:k,onTaskAbortOpenChange:l,onTaskAbortConfirm:m,updateDialogOpen:n,updateRunState:p,updateStatusMessage:q,updateResultMessage:r,updateLog:t,updateManualCommand:u,activeRuntimeCount:v,updateInstallSummary:w,onUpdateDialogOpenChange:y,onRunOpenClawUpdate:z}){let A="running"===p,B="success"===p||"error"===p,C="running"===p?"OpenClaw is being updated now. Local gateway activity may pause briefly while the CLI is replaced.":"success"===p?"The CLI update finished. Review the result below, then close this panel when you are done.":"error"===p?"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.",[D,E]=(0,g.useState)(!1),F=de(u),G=async()=>{if(u)try{await navigator.clipboard.writeText(u),aC.oR.success("Command copied.",{description:"Open Terminal and paste it."})}catch(a){aC.oR.error("Could not copy command.",{description:a instanceof Error?a.message:"Clipboard access is unavailable."})}},H=async()=>{if(u&&F){E(!0);try{let a=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:u})}),b=await a.json().catch(()=>null);if(!a.ok||b?.error)throw Error(b?.error||"Unable to open Terminal.");aC.oR.success("Terminal opened.",{description:"Confirm the update there, then return to AgentOS."})}catch(a){aC.oR.error("Could not open Terminal.",{description:a instanceof Error?a.message:"Open Terminal manually and run the command."})}finally{E(!1)}}};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(ae,{open:null!==e,onOpenChange:a=>{"running"!==f&&l(a)},children:(0,d.jsxs)(aj,{className:s("max-w-[480px] gap-5 p-5 sm:p-6","light"===b?"border-[#d7c5b7] bg-[rgba(252,247,241,0.98)] text-[#4a382c] shadow-[0_30px_80px_rgba(161,125,101,0.2)]":"border-white/10 bg-slate-950/94 text-slate-100"),children:[(0,d.jsxs)(ak,{children:[(0,d.jsx)(am,{className:"light"===b?"text-[#3f2f24]":"text-white",children:"Abort task?"}),(0,d.jsx)(an,{className:"light"===b?"text-[#7e6555]":"text-slate-400",children:"This stops the current OpenClaw dispatch for the selected task. It does not delete captured evidence or files."})]}),e?(0,d.jsxs)("div",{className:s("rounded-[20px] border px-4 py-4","light"===b?"border-[#e3d4c8] bg-[#fffaf6] text-[#4f3d31]":"border-rose-400/20 bg-rose-400/10 text-rose-50"),children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.24em] text-slate-500",children:"Selected task"}),(0,d.jsx)("p",{className:"mt-2 font-display text-[1.02rem] leading-6 text-inherit",children:e.title}),(0,d.jsx)("p",{className:s("mt-1 text-sm leading-6","light"===b?"text-[#8b7262]":"text-rose-100/80"),children:e.subtitle}),k?(0,d.jsx)("p",{className:"mt-3 rounded-[16px] border border-rose-400/20 bg-rose-400/10 px-3 py-2 text-sm text-rose-50",children:k}):null]}):null,(0,d.jsxs)(al,{children:[(0,d.jsx)(x,{type:"button",variant:"secondary",disabled:"running"===f,className:"light"===b?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",onClick:()=>{"running"!==f&&l(!1)},children:"Cancel"}),(0,d.jsx)(x,{type:"button",variant:"destructive",disabled:!e||"running"===f,onClick:()=>{m()},children:"running"===f?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Aborting..."]}):"Abort task"})]})]})}),c?null:(0,d.jsxs)("div",{className:s("pointer-events-auto absolute bottom-3 right-[74px] z-30 text-[11px] tracking-[0.04em] lg:bottom-4","light"===b?"text-[#8f7664]":"text-slate-500"),children:["Built on"," ",(0,d.jsx)("a",{href:"https://openclaw.ai/",target:"_blank",rel:"noreferrer",className:s("transition-colors","light"===b?"text-[#6f5a4b] hover:text-[#4f3d31]":"text-slate-300 hover:text-slate-100"),children:"OpenClaw"})," ","by"," ",(0,d.jsx)("a",{href:"https://sapienx.app/",target:"_blank",rel:"noreferrer",className:s("transition-colors","light"===b?"text-[#6f5a4b] hover:text-[#4f3d31]":"text-slate-300 hover:text-slate-100"),children:"SapienX"})]}),(0,d.jsx)(ae,{open:n,onOpenChange:a=>{A||y(a)},children:(0,d.jsxs)(aj,{className:s("max-h-[calc(100vh-48px)] max-w-[468px] gap-5 overflow-y-auto p-5 sm:p-6","light"===b?"border-[#d7c5b7] bg-[rgba(252,247,241,0.98)] text-[#4a382c] shadow-[0_30px_80px_rgba(161,125,101,0.2)]":"border-white/10 bg-slate-950/94 text-slate-100"),children:[(0,d.jsxs)(ak,{children:[(0,d.jsx)(am,{className:"light"===b?"text-[#3f2f24]":"text-white",children:"running"===p?"Updating OpenClaw":"success"===p?"Update complete":"error"===p?"Update failed":"Update OpenClaw"}),(0,d.jsx)(an,{className:"light"===b?"text-[#7e6555]":"text-slate-400",children:C})]}),B?(0,d.jsxs)("div",{className:s("space-y-4","light"===b?"text-[#4f3d31]":"text-slate-200"),children:[(0,d.jsxs)("div",{className:s("rounded-[24px] border px-4 py-5","success"===p?"light"===b?"border-emerald-300 bg-emerald-50/80 text-emerald-950":"border-emerald-300/25 bg-emerald-300/10 text-emerald-50":"light"===b?"border-rose-300 bg-rose-50/90 text-rose-950":"border-rose-300/25 bg-rose-300/10 text-rose-50"),children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("div",{className:s("flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl border","success"===p?"light"===b?"border-emerald-300 bg-white/80 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"light"===b?"border-rose-300 bg-white/80 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200"),children:"success"===p?(0,d.jsx)(c0.A,{className:"h-5 w-5"}):(0,d.jsx)(o.A,{className:"h-5 w-5"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:"font-display text-[1.05rem] leading-6",children:"success"===p?"OpenClaw is up to date":"Update needs attention"}),(0,d.jsx)("p",{className:"mt-1 text-sm leading-6",children:r||("success"===p?"The update finished successfully.":"The update did not finish cleanly.")})]})]}),(0,d.jsxs)("div",{className:"mt-4 grid gap-3 sm:grid-cols-3",children:[(0,d.jsxs)("div",{className:s("rounded-[18px] border px-3 py-3","light"===b?"border-white/70 bg-white/70":"border-white/10 bg-slate-950/30"),children:[(0,d.jsx)("p",{className:"light"===b?"text-[10px] uppercase tracking-[0.22em] text-[#8d725f]":"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Installed version"}),(0,d.jsxs)("p",{className:"mt-2 font-display text-lg text-inherit",children:["v",a.diagnostics.version||a.diagnostics.latestVersion||"unknown"]})]}),(0,d.jsxs)("div",{className:s("rounded-[18px] border px-3 py-3","light"===b?"border-white/70 bg-white/70":"border-white/10 bg-slate-950/30"),children:[(0,d.jsx)("p",{className:"light"===b?"text-[10px] uppercase tracking-[0.22em] text-[#8d725f]":"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Latest reported"}),(0,d.jsxs)("p",{className:"mt-2 font-display text-lg text-inherit",children:["v",a.diagnostics.latestVersion||a.diagnostics.version||"unknown"]})]}),(0,d.jsxs)("div",{className:s("rounded-[18px] border px-3 py-3","light"===b?"border-white/70 bg-white/70":"border-white/10 bg-slate-950/30"),children:[(0,d.jsx)("p",{className:"light"===b?"text-[10px] uppercase tracking-[0.22em] text-[#8d725f]":"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Detected install"}),(0,d.jsx)("p",{className:"mt-2 text-sm font-medium text-inherit",children:w.label}),(0,d.jsx)("p",{className:"light"===b?"mt-1 text-xs text-[#8b7262]":"mt-1 text-xs text-slate-400",children:w.detail})]})]})]}),(0,d.jsxs)("div",{className:s("rounded-[20px] border","light"===b?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,d.jsxs)("div",{className:s("flex items-center justify-between border-b px-4 py-3","light"===b?"border-[#eadccf]":"border-white/8"),children:[(0,d.jsx)("p",{className:s("text-[10px] uppercase tracking-[0.24em]","light"===b?"text-[#9a7f6c]":"text-slate-500"),children:"Update log"}),(0,d.jsx)("span",{className:"light"===b?"text-xs text-[#8b7262]":"text-xs text-slate-400",children:"success"===p?"Completed":"Failed"})]}),(0,d.jsx)("pre",{className:s("max-h-[180px] overflow-auto whitespace-pre-wrap break-words px-4 py-3 font-mono text-[11px] leading-5","light"===b?"text-[#4f3d31]":"text-slate-200"),children:t||"No command output was captured."})]}),u?(0,d.jsxs)("div",{className:s("rounded-[20px] border px-4 py-3","light"===b?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,d.jsx)("p",{className:s("text-[10px] uppercase tracking-[0.24em]","light"===b?"text-[#9a7f6c]":"text-slate-500"),children:F?"Terminal":"Manual"}),F?(0,d.jsx)("p",{className:s("mt-1 text-sm leading-6","light"===b?"text-[#705b4d]":"text-slate-400"),children:"Open Terminal and run this command to confirm the update."}):null,(0,d.jsx)("p",{className:s("mt-2 break-all font-mono text-[11px] leading-5","light"===b?"text-[#4f3d31]":"text-slate-200"),children:u}),(0,d.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,d.jsxs)(x,{type:"button",variant:"secondary",size:"sm",onClick:()=>{G()},className:"light"===b?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",children:[(0,d.jsx)(j.A,{className:"mr-1.5 h-3 w-3"}),"Copy command"]}),F?(0,d.jsx)(x,{type:"button",variant:"secondary",size:"sm",onClick:()=>{H()},disabled:D,className:"light"===b?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",children:D?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i.A,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}):null]})]}):null]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:s("grid gap-3 sm:grid-cols-2","light"===b?"text-[#4f3d31]":"text-slate-200"),children:[(0,d.jsxs)("div",{className:s("rounded-[20px] border px-4 py-4","light"===b?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,d.jsx)("p",{className:s("text-[10px] uppercase tracking-[0.24em]","light"===b?"text-[#9a7f6c]":"text-slate-500"),children:"Version target"}),(0,d.jsxs)("p",{className:"mt-2 font-display text-[1.1rem] leading-6 text-inherit",children:["v",a.diagnostics.latestVersion||a.diagnostics.version||"unknown"]}),(0,d.jsxs)("p",{className:"light"===b?"mt-1 text-xs text-[#8b7262]":"mt-1 text-xs text-slate-400",children:["Current: v",a.diagnostics.version||"unknown"]})]}),(0,d.jsxs)("div",{className:s("rounded-[20px] border px-4 py-4","light"===b?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,d.jsx)("p",{className:s("text-[10px] uppercase tracking-[0.24em]","light"===b?"text-[#9a7f6c]":"text-slate-500"),children:"Detected install"}),(0,d.jsx)("p",{className:"mt-2 text-sm font-medium leading-6 text-inherit",children:w.label}),(0,d.jsx)("p",{className:"light"===b?"mt-1 text-xs text-[#8b7262]":"mt-1 text-xs text-slate-400",children:w.detail})]})]}),(0,d.jsx)("div",{className:s("rounded-[20px] border px-4 py-3 text-sm",v>0?"light"===b?"border-rose-300/80 bg-rose-50 text-rose-800":"border-rose-300/25 bg-rose-300/10 text-rose-100":"light"===b?"border-[#e3d4c8] bg-[#fffaf6] text-[#745e4f]":"border-white/8 bg-white/[0.03] text-slate-300"),children:v>0?`${v} running or queued runtime${1===v?"":"s"} may be interrupted during the update.`:"No running runtimes are currently tracked, so the update risk is lower."}),A?(0,d.jsxs)("div",{className:s("rounded-[20px] border","light"===b?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,d.jsxs)("div",{className:s("flex items-center gap-3 border-b px-4 py-3","light"===b?"border-[#eadccf]":"border-white/8"),children:[(0,d.jsx)("div",{className:s("flex h-9 w-9 items-center justify-center rounded-2xl border","light"===b?"border-[#dcc6b6] bg-[#f4e8dd] text-[#7b6453]":"border-white/10 bg-white/[0.05] text-slate-200"),children:(0,d.jsx)(h.A,{className:"h-4 w-4 animate-spin"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:"light"===b?"text-sm font-medium text-[#4a382c]":"text-sm font-medium text-white",children:"Update in progress"}),(0,d.jsx)("p",{className:"light"===b?"text-xs text-[#8b7262]":"text-xs text-slate-400",children:q||"Streaming OpenClaw output..."})]})]}),(0,d.jsx)("pre",{className:s("max-h-[180px] min-h-[120px] overflow-auto whitespace-pre-wrap break-words px-4 py-3 font-mono text-[11px] leading-5","light"===b?"text-[#4f3d31]":"text-slate-200"),children:t||"Waiting for command output..."})]}):null]}),(0,d.jsxs)(al,{children:[(0,d.jsx)(x,{type:"button",variant:"secondary",onClick:()=>{y(!1)},className:"light"===b?"border-[#d9c9bc] bg-[#f5ebe3] text-[#6c5647] hover:bg-[#eddccf]":"",children:A?"Run in background":B?"Done":"Cancel"}),B?null:(0,d.jsx)(x,{type:"button",onClick:z,disabled:A,className:s(a.diagnostics.updateAvailable?"bg-amber-400 text-slate-950 shadow-lg shadow-amber-400/20 hover:bg-amber-300":"","light"!==b||a.diagnostics.updateAvailable?"":"bg-[#c8946f] text-white shadow-[0_12px_28px_rgba(200,148,111,0.24)] hover:bg-[#b88461]"),children:A?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Updating..."]}):"Update now"})]})]})})]})}var dg=c(51381),dh=c(31724);function di(a,b,c,d,e,f,g){return"cli"===a?b.diagnostics.installed?`Installed${b.diagnostics.version?` \xb7 v${b.diagnostics.version}`:""}`:"installing-cli"===c?"Installing the CLI and local wrapper.":"detecting"!==c&&b.diagnostics.installed?"Install the OpenClaw CLI.":"Checking whether the CLI is already installed.":"gateway"===a?b.diagnostics.loaded?"Gateway is already registered.":"installing-gateway"===c?"Registering the gateway service.":"starting-gateway"===c?"Starting the gateway service.":"detecting"===c&&d?"Checking gateway registration.":f||"verifying"===c?"Gateway is up and waiting on RPC.":b.diagnostics.rpcOk?"Gateway is running directly.":"Register the gateway service once.":g?"RPC, state, and session store are ready.":"verifying"===c?"Verifying RPC, state writes, and session store access.":"starting-gateway"===c?"Starting the gateway and waiting for RPC.":e?"Gateway is up; verify RPC and runtime state.":f?"RPC is online; final runtime checks continue.":"Start the gateway and verify RPC."}function dj(a,b){if(!a.trim())return null;let c=b.find(b=>b.id===a);return c?.name||I(a)}function dk(a,b){return a?"complete":b?"current":"pending"}function dl(a){return"light"===a?"border-[#b89374] bg-[#ecd4c1] text-[#4a3426] shadow-[inset_0_1px_0_rgba(255,255,255,0.55)] hover:bg-[#e4c6af] hover:text-[#38261b]":"border-white/10 bg-white/[0.05] text-slate-200 hover:bg-white/[0.1]"}function dm(a){let b=a.trim().toLowerCase();return"openrouter"===b?"OpenRouter":"openai-codex"===b?"ChatGPT":"openai"===b?"OpenAI":"anthropic"===b?"Anthropic":"ollama"===b?"Ollama":"xai"===b?"xAI":"google"===b||"gemini"===b?"Gemini":"deepseek"===b?"DeepSeek":"mistral"===b?"Mistral":a.split("-").map(a=>a?a[0].toUpperCase()+a.slice(1):a).join(" ")}function dn(a){let b=a?.trim();if(!b)return null;let[c]=b.split("/",1);return c||null}function dp(a,b){let c=dn(b);return c?"openai"===c&&dq(a)?"openai-codex":B(c)?c:null:null}function dq(a){let b=a.diagnostics.modelReadiness.authProviders,c=b.find(a=>"openai-codex"===a.provider),d=b.find(a=>"openai"===a.provider);return!!c?.connected||"openai-codex"===a.diagnostics.modelReadiness.preferredLoginProvider||!!(c?.canLogin&&!d?.connected)}function dr(a,b){return"complete"===a?"light"===b?"border-emerald-200 bg-emerald-50/60":"border-emerald-400/20 bg-emerald-400/8":"current"===a?"light"===b?"border-[#d9c2b3] bg-white/70":"border-white/12 bg-white/[0.05]":"light"===b?"border-[#eadcd0] bg-[#fffaf6]/80":"border-white/6 bg-white/[0.02]"}function ds(a,b){return"complete"===a?"light"===b?"border-emerald-300 bg-emerald-100 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"current"===a?"light"===b?"border-[#d5b9a5] bg-[#f5ebe3] text-[#8b6d5a]":"border-white/12 bg-white/[0.06] text-white":"light"===b?"border-[#e1ccc0] bg-white text-[#9a7f6c]":"border-white/8 bg-white/[0.03] text-slate-400"}function dt(a,b){return"complete"===a?"light"===b?"bg-emerald-100 text-emerald-700":"bg-emerald-300/10 text-emerald-200":"current"===a?"light"===b?"bg-[#efe1d4] text-[#876c5a]":"bg-white/[0.06] text-slate-300":"light"===b?"bg-[#f6ece4] text-[#a08471]":"bg-white/[0.04] text-slate-500"}var du=c(54295);function dv({snapshot:a,selectedModelId:b,onSelectedModelIdChange:c,onOpenAddModels:e,autoDiscover:k=!0}){let[m,n]=(0,g.useState)(()=>(function(a,b){let c=dp(a,b);if(c)return c;let d=a.diagnostics.modelReadiness.authProviders.find(a=>a.connected&&B(a.provider))?.provider;if(d)return d;let e=a.diagnostics.modelReadiness.preferredLoginProvider;if(B(e))return e;let f=dn(a.diagnostics.modelReadiness.recommendedModelId);return B(f)?f:"openrouter"})(a,b)),[o,p]=(0,g.useState)({}),[q,r]=(0,g.useState)(!1),t=(0,g.useMemo)(()=>Object.values(o).flatMap(a=>a?.models??[]),[o]),v=(0,g.useMemo)(()=>(function(a,b,c=[]){let d=b?.trim();if(!d)return null;let e=c.find(a=>a.id===d&&B(a.provider))?.provider;if(B(e))return e;let f=a.models.find(a=>a.id===d&&B(a.provider))?.provider;return B(f)?"openai"===f&&dq(a)?"openai-codex":f:dp(a,d)})(a,b,t),[t,b,a]),w=A(m),C=dx(o[m]),D=C.connection??dy(a,m),E=(0,g.useMemo)(()=>a.models.filter(a=>dz(m,a.id,a.provider)&&!1!==a.available&&!a.missing).map(b=>({id:b.id,name:b.name,provider:b.provider,input:b.input,contextWindow:b.contextWindow,local:!!b.local,available:!1!==b.available,missing:b.missing,alreadyAdded:!0,recommended:b.id===a.diagnostics.modelReadiness.recommendedModelId||b.id===a.diagnostics.modelReadiness.resolvedDefaultModel||b.id===a.diagnostics.modelReadiness.defaultModel,supportsTools:b.tags.includes("tools"),isFree:b.tags.includes("free"),tags:b.tags})),[m,a.diagnostics.modelReadiness.defaultModel,a.diagnostics.modelReadiness.recommendedModelId,a.diagnostics.modelReadiness.resolvedDefaultModel,a.models]),F=C.models.length>0?C.models:E,G=(0,g.useMemo)(()=>{let a=C.search.trim().toLowerCase();return F.slice().sort((a,b)=>{let c=Number(b.recommended)+Number(b.isFree)+Number(b.supportsTools),d=Number(a.recommended)+Number(a.isFree)+Number(a.supportsTools);return c!==d?c-d:a.name.localeCompare(b.name)}).filter(b=>!a||`${b.name} ${b.id} ${b.tags.join(" ")}`.toLowerCase().includes(a))},[F,C.search]),H=a.models.find(a=>a.id===b)?.name||G.find(a=>a.id===b)?.name||b.trim()||null,I="connecting"===C.flowState||"discovering"===C.flowState||C.statusMessage?.startsWith("Checking ")===!0&&!D.connected,J="discovering"===C.flowState?`Discovering ${w.shortLabel} models...`:"connecting"===C.flowState?C.statusMessage||`Connecting ${w.shortLabel}...`:C.statusMessage||`Checking ${w.shortLabel}...`,K=G.length>6||!!w.searchPlaceholder;function L(a,b){p(c=>({...c,[a]:{...dx(c[a]),...b}}))}function M(a,b,c,d){L(a,{flowState:c,connection:b.connection,statusMessage:b.message,errorMessage:null,emptyState:b.emptyState??null,manualCommand:b.manualCommand??null,docsUrl:b.docsUrl??null,models:b.models,loaded:!0,...d})}async function N(a){let b=ap[a];L(a,{flowState:"idle",errorMessage:null,statusMessage:`Checking ${dm(a)}...`});try{let c=await b.getConnectionStatus(),d=c.connection.connected&&k&&!Q(a);M(a,c,d?"discovering":"idle"),d&&await P(a,!0)}catch(b){L(a,{flowState:"error",errorMessage:b instanceof Error?b.message:"Provider status could not be loaded.",loaded:!0})}}async function O(a){let b=ap[a],c=dx(o[a]);L(a,{flowState:"connecting",errorMessage:null,statusMessage:"openai-codex"===a?"Opening the ChatGPT sign-in flow...":`Connecting ${A(a).shortLabel}...`});try{let d=await b.connect({apiKey:c.apiKey}),e=d.connection.connected&&!d.manualCommand&&!Q(a);M(a,d,e?"discovering":"idle",{apiKey:d.manualCommand?c.apiKey:""}),e&&await P(a,!0)}catch(b){L(a,{flowState:"error",errorMessage:b instanceof Error?b.message:"Provider connection failed."})}}async function P(a,b=!1){let c=ap[a],d=dx(o[a]);if(b||"discovering"!==d.flowState){L(a,{flowState:"discovering",errorMessage:null,statusMessage:"ollama"===a?"Checking the local Ollama runtime...":`Discovering ${A(a).shortLabel} models...`});try{let b=await c.discoverModels();M(a,b,b.models.length>0?"ready":"idle",{search:d.search})}catch(b){L(a,{flowState:"error",errorMessage:b instanceof Error?b.message:"Provider discovery failed."})}}}function Q(b){return a.models.some(a=>dz(b,a.id,a.provider)&&!1!==a.available&&!a.missing)}async function R(a){try{await navigator.clipboard.writeText(a),aq.o.success("Copied.",{description:"Command copied to your clipboard."})}catch(a){aq.o.error("Copy failed.",{description:a instanceof Error?a.message:"Clipboard access is not available."})}}async function S(a){if(!de(a))return void await R(a);r(!0);try{let b=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:a})}),c=await b.json().catch(()=>null);if(!b.ok||c?.error)throw Error(c?.error||"Unable to open Terminal.");aq.o.success("Terminal opened.",{description:"Finish auth there, then refresh this provider."})}catch(a){aq.o.error("Could not open Terminal.",{description:a instanceof Error?a.message:"Open Terminal manually and run the command."})}finally{r(!1)}}return(0,d.jsxs)("div",{className:s("mt-3 rounded-[16px] border px-3 py-3","border-white/8 bg-[rgba(255,255,255,0.03)]"),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("div",{className:"min-w-0",children:(0,d.jsxs)("p",{className:"whitespace-nowrap text-[8px] font-medium text-slate-500",children:["Provider first : ",z.length," providers"]})}),(0,d.jsx)("div",{className:"flex shrink-0 flex-wrap gap-1.5",children:H?(0,d.jsx)(u,{variant:"default",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Selected"}):null})]}),(0,d.jsx)("div",{className:"mt-3 flex snap-x snap-mandatory flex-nowrap gap-2 overflow-x-auto overflow-y-hidden pb-2 pr-1",children:z.map(b=>{let e=dx(o[b.id]).connection??dy(a,b.id);return(0,d.jsx)("div",{className:"w-[128px] shrink-0 snap-start sm:w-[136px]",children:(0,d.jsx)(ab,{descriptor:b,active:m===b.id,compact:!0,micro:!0,connected:e.connected,detail:e.detail,onClick:()=>{n(b.id),v&&v!==b.id&&c("")}})},b.id)})}),(0,d.jsxs)("div",{className:"mt-3 rounded-[18px] border border-white/10 bg-[linear-gradient(180deg,rgba(11,18,32,0.96),rgba(6,10,18,0.98))] p-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("div",{children:(0,d.jsx)("p",{className:"font-display text-[0.88rem] text-white",children:w.label})}),(0,d.jsx)(u,{variant:D.connected?"success":"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:D.connected?"Connected":"Not connected"})]}),C.statusMessage&&!I?(0,d.jsx)("div",{className:"mt-3 rounded-[16px] border border-white/10 bg-white/[0.04] px-3 py-2",children:(0,d.jsx)("p",{className:"text-[11px] text-slate-200",children:C.statusMessage})}):null,C.errorMessage?(0,d.jsx)("div",{className:"mt-3 rounded-[16px] border border-rose-400/20 bg-rose-400/[0.08] px-3 py-2 text-[11px] text-rose-100",children:C.errorMessage}):null,"apiKey"!==w.connectKind||D.connected||I?null:(0,d.jsxs)("div",{className:"mt-4 flex flex-wrap items-end gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("label",{className:"block text-[9px] uppercase tracking-[0.16em] text-slate-500",children:"API key"}),(0,d.jsx)(y,{type:"password",value:C.apiKey,onChange:a=>L(m,{apiKey:a.target.value}),placeholder:"openrouter"===m?"sk-or-v1-...":"Paste API key",className:"mt-1.5 h-8 text-[11px]"})]}),(0,d.jsx)(x,{type:"button",className:"h-8 rounded-full px-3 text-[10px]",disabled:"connecting"===C.flowState||!C.apiKey.trim(),onClick:()=>{O(m)},children:"connecting"===C.flowState?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Connecting..."]}):`Connect ${w.shortLabel}`})]}),I?(0,d.jsxs)("div",{className:"relative mt-4 flex min-h-[280px] items-center justify-center overflow-hidden rounded-[28px] border border-cyan-300/20 bg-[radial-gradient(circle_at_top,rgba(34,211,238,0.16),rgba(8,15,28,0.98)_70%)] px-4 py-10 text-center shadow-[0_22px_52px_rgba(7,11,20,0.32)]",children:[(0,d.jsx)("div",{className:"absolute inset-x-8 top-8 h-px bg-gradient-to-r from-transparent via-cyan-200/70 to-transparent blur-sm animate-pulse"}),(0,d.jsx)("div",{className:"absolute inset-x-8 bottom-8 h-px bg-gradient-to-r from-transparent via-cyan-200/30 to-transparent blur-sm animate-pulse [animation-delay:180ms]"}),(0,d.jsx)("div",{className:"absolute left-8 top-8 h-24 w-24 rounded-full border border-cyan-300/15 bg-cyan-300/[0.04] blur-[1px] animate-pulse"}),(0,d.jsx)("div",{className:"absolute right-10 top-14 h-16 w-16 rounded-full border border-cyan-300/10 bg-cyan-300/[0.03] blur-[1px] animate-pulse [animation-delay:120ms]"}),(0,d.jsx)("div",{className:"absolute bottom-10 left-1/2 h-20 w-20 -translate-x-1/2 rounded-full border border-cyan-300/10 bg-cyan-300/[0.03] blur-[1px] animate-pulse [animation-delay:240ms]"}),(0,d.jsxs)("div",{className:"relative flex max-w-[340px] flex-col items-center",children:[(0,d.jsx)("div",{className:"mb-4 flex h-16 w-16 items-center justify-center rounded-full border border-cyan-300/20 bg-cyan-300/[0.08] shadow-[0_0_0_8px_rgba(34,211,238,0.05)]",children:(0,d.jsx)(h.A,{className:"h-8 w-8 animate-spin text-cyan-200"})}),(0,d.jsx)("p",{className:"font-display text-[1.1rem] leading-[1.2rem] tracking-[0.01em] text-white",children:J}),(0,d.jsx)("p",{className:"mt-2 max-w-[280px] text-[11px] leading-[1rem] text-slate-400",children:"discovering"===C.flowState?"Pulling the provider catalog into AgentOS.":"connecting"===C.flowState?"Preparing the provider connection.":"Checking provider status before discovery."}),(0,d.jsxs)("div",{className:"mt-4 flex gap-1.5",children:[(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-cyan-300/90"}),(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-cyan-300/60 [animation-delay:120ms]"}),(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-cyan-300/30 [animation-delay:240ms]"})]})]})]}):null,"oauth"!==w.connectKind||D.connected||I?null:(0,d.jsxs)("div",{className:"mt-4 rounded-[20px] border border-white/10 bg-white/[0.03] p-3",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-display text-[0.88rem] text-white",children:"Connect your ChatGPT account"}),(0,d.jsx)("p",{className:"mt-1 max-w-[500px] text-[10px] leading-[0.98rem] text-slate-400",children:"This uses OpenClaw's account-based login flow. No API key is required."})]}),(0,d.jsx)(x,{type:"button",className:"h-8 rounded-full px-3 text-[10px]",disabled:"connecting"===C.flowState&&!C.manualCommand,onClick:()=>{O(m)},children:"connecting"!==C.flowState||C.manualCommand?"Connect ChatGPT":(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Connecting..."]})})]}),C.manualCommand?(0,d.jsxs)("div",{className:"mt-3 rounded-[16px] border border-cyan-300/15 bg-cyan-300/[0.07] p-3",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-[11px] font-medium text-cyan-50",children:"Finish sign-in in Terminal"}),(0,d.jsx)("p",{className:"mt-1 max-w-[460px] text-[10px] leading-[0.98rem] text-cyan-100/80",children:"Open Terminal, complete the provider login, then come back and refresh this provider."})]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsx)(x,{type:"button",variant:"secondary",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",disabled:q,onClick:()=>{S(C.manualCommand||"")},children:q?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i.A,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}),(0,d.jsxs)(x,{type:"button",variant:"ghost",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:()=>{R(C.manualCommand||"")},children:[(0,d.jsx)(j.A,{className:"mr-1.5 h-3 w-3"}),"Copy command"]}),(0,d.jsxs)(x,{type:"button",variant:"ghost",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:()=>{N(m)},children:[(0,d.jsx)(f.A,{className:"mr-1.5 h-3 w-3"}),"I've connected it"]})]})]}),(0,d.jsx)("div",{className:"mt-2.5 overflow-x-auto rounded-[14px] border border-white/10 bg-slate-950/60 px-3 py-2",children:(0,d.jsx)("code",{className:"text-[10px] text-slate-200",children:C.manualCommand})})]}):null]}),D.connected&&!I?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"mt-4 flex flex-nowrap items-center justify-between gap-2 overflow-x-auto pb-1",children:[(0,d.jsx)("p",{className:"shrink-0 whitespace-nowrap text-[9px] uppercase tracking-[0.16em] text-slate-500",children:G.length>0?`Found ${G.length} model${1===G.length?"":"s"}`:"No models found"}),(0,d.jsxs)("div",{className:"flex shrink-0 flex-nowrap gap-1.5",children:[(0,d.jsxs)(x,{type:"button",variant:"secondary",size:"sm",onClick:()=>{N(m)},className:"h-6 rounded-full px-2 text-[9px]",children:[(0,d.jsx)(f.A,{className:"mr-1 h-2.5 w-2.5"}),"Refresh"]}),(0,d.jsx)(x,{type:"button",variant:"ghost",size:"sm",onClick:()=>e(m),className:"h-6 rounded-full px-2 text-[9px]",children:"Add Models"})]})]}),K?(0,d.jsxs)("div",{className:"relative mt-3",children:[(0,d.jsx)(l.A,{className:"pointer-events-none absolute left-3 top-1/2 h-3 w-3 -translate-y-1/2 text-slate-500"}),(0,d.jsx)(y,{value:C.search,onChange:a=>L(m,{search:a.target.value}),placeholder:w.searchPlaceholder??"Search models",className:"h-8 pl-8 text-[11px]"})]}):null,C.emptyState?(0,d.jsx)(dw,{emptyState:C.emptyState,onRefresh:()=>{N(m)}}):null,G.length>0?(0,d.jsx)("div",{className:"mt-3 max-h-[min(34vh,260px)] space-y-1 overflow-y-auto pr-1",children:G.map(a=>{let e=b===a.id;return(0,d.jsxs)("button",{type:"button",onClick:()=>{B(a.provider)&&n(a.provider),c(a.id)},className:s("flex w-full items-start justify-between gap-2 rounded-[14px] border px-2.5 py-2 text-left transition-all",e?"border-cyan-300/35 bg-cyan-300/[0.08]":"border-white/8 bg-white/[0.03] hover:border-white/16 hover:bg-white/[0.05]"),children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[11px] font-medium text-white",children:a.name}),(0,d.jsx)("p",{className:"mt-0.5 truncate text-[9px] uppercase tracking-[0.16em] text-slate-500",children:a.id}),(0,d.jsxs)("div",{className:"mt-1 flex flex-wrap gap-1.5 text-[9px] text-slate-400",children:[(0,d.jsx)("span",{children:a.input}),a.contextWindow?(0,d.jsxs)("span",{children:[Intl.NumberFormat().format(a.contextWindow)," ctx"]}):null,a.isFree?(0,d.jsx)("span",{children:"free"}):null]})]}),(0,d.jsx)("div",{className:"shrink-0",children:e?(0,d.jsx)(u,{variant:"default",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Selected"}):a.recommended?(0,d.jsx)(u,{variant:"default",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Recommended"}):a.local?(0,d.jsx)(u,{variant:"success",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Local"}):(0,d.jsx)(u,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Remote"})})]},a.id)})}):(0,d.jsx)("div",{className:"mt-3 rounded-[16px] border border-dashed border-white/10 bg-white/[0.02] px-3 py-4 text-[11px] text-slate-400",children:"No models are visible yet. Refresh this provider or open the full Add Models flow."})]}):null,H&&!I?(0,d.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2 rounded-[16px] border border-emerald-300/15 bg-emerald-300/[0.06] px-3 py-2",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"text-[8px] uppercase tracking-[0.16em] text-emerald-200/75",children:"Selected model"}),(0,d.jsx)("p",{className:"truncate text-[11px] text-emerald-50",children:H})]}),(0,d.jsx)(u,{variant:"default",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Selected"})]}):null]})]})}function dw({emptyState:a,onRefresh:b}){return(0,d.jsxs)("div",{className:"mt-3 rounded-[18px] border border-white/10 bg-white/[0.03] p-3",children:[(0,d.jsx)("p",{className:"font-display text-[0.88rem] text-white",children:a.title}),(0,d.jsx)("p",{className:"mt-1 max-w-[520px] text-[11px] leading-[0.98rem] text-slate-400",children:a.description}),(0,d.jsx)("div",{className:"mt-3 flex flex-wrap gap-1.5",children:(0,d.jsxs)(x,{type:"button",variant:"secondary",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:b,children:[(0,d.jsx)(f.A,{className:"mr-1.5 h-3 w-3"}),"Refresh provider"]})})]})}function dx(a){return a||{loaded:!1,connection:null,statusMessage:null,errorMessage:null,emptyState:null,manualCommand:null,docsUrl:null,models:[],apiKey:"",search:"",flowState:"idle"}}function dy(a,b){let c=a.diagnostics.modelReadiness.authProviders.find(a=>a.provider===b),d=a.models.filter(a=>dz(b,a.id,a.provider)).length;if("ollama"===b)return{connected:d>0,detail:d>0?`${d} model${1===d?"":"s"} already visible in AgentOS.`:"Detect local models from this machine."};let e=!!c?.connected;return{connected:e,detail:e?c?.detail||A(b).helperText:d>0?`${d} model${1===d?"":"s"} are already saved in AgentOS. Connect ${dm(b)} to use them.`:A(b).helperText}}function dz(a,b,c){let d=c||b.split("/",1)[0]||"";return"openai-codex"===a?"openai-codex"===d||"openai"===d:d===a}function dA({steps:a,surfaceTheme:b,statusCopy:c,showDetails:e,phaseLabel:f,run:i,gatewayAuthNeedsSetup:j,onOpenGatewayAuthSettings:k}){let[l,m]=(0,g.useState)(!1);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"mt-3",children:[(0,d.jsx)("p",{className:s("text-[7px] uppercase tracking-[0.18em]","light"===b?"text-[#977b69]":"text-slate-500"),children:"Step 1"}),(0,d.jsx)("h2",{className:s("mt-1 text-[13px] font-medium","light"===b?"text-[#33251c]":"text-white"),children:"System setup"}),(0,d.jsx)("p",{className:s("mt-1 text-[10px] leading-[0.95rem]","light"===b?"text-[#705b4d]":"text-slate-400"),children:"Install the CLI, start the gateway, and verify RPC."})]}),(0,d.jsx)("div",{className:"mt-2.5 space-y-1.5",children:a.map((a,c)=>{let e="runtime"===a.id,f="current"===a.state&&"running"===i.runState,g="complete"===a.state?"Ready":"current"===a.state?f?"Checking":e?"Needs verification":"Pending":"Pending";return(0,d.jsxs)("div",{className:s("relative flex items-center gap-1.5 overflow-hidden rounded-[12px] border px-2 py-1.5",f?"light"===b?"shadow-[inset_0_1px_0_rgba(255,255,255,0.55),0_0_0_1px_rgba(215,178,154,0.18)]":"shadow-[inset_0_1px_0_rgba(255,255,255,0.03),0_0_0_1px_rgba(103,232,249,0.08)]":"",dr(a.state,b)),children:[f?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a6.P.div,{"aria-hidden":"true",className:s("pointer-events-none absolute inset-y-0 left-0 w-1/3 blur-[1px]","light"===b?"bg-gradient-to-r from-transparent via-[#d9b08d]/26 to-transparent":"bg-gradient-to-r from-transparent via-cyan-200/12 to-transparent"),animate:{x:["-30%",e?"250%":"230%"]},transition:{duration:e?1.45:2.05,repeat:1/0,ease:"linear"}}),(0,d.jsx)(a6.P.div,{"aria-hidden":"true",className:s("pointer-events-none absolute inset-x-2 bottom-0 h-px rounded-full","light"===b?"bg-gradient-to-r from-transparent via-[#c99672] to-transparent":"bg-gradient-to-r from-transparent via-cyan-200/70 to-transparent"),animate:{opacity:[.28,.92,.28],scaleX:[.86,1,.86]},transition:{duration:e?1.2:1.65,repeat:1/0,ease:"easeInOut"}})]}):null,(0,d.jsxs)("span",{className:s("relative mt-0.5 inline-flex h-5 w-5 items-center justify-center overflow-hidden rounded-full border text-[9px] font-medium",ds(a.state,b)),children:[f?(0,d.jsx)(a6.P.span,{"aria-hidden":"true",className:s("absolute inset-0 rounded-full border","light"===b?"border-[#d9b59a]/35 bg-[#f7eee7]/80":"border-cyan-200/16 bg-cyan-300/[0.06]"),animate:{scale:[1,1.16,1],opacity:[.45,.95,.45]},transition:{duration:e?1.5:1.9,repeat:1/0,ease:"easeInOut"}}):null,(0,d.jsx)("span",{className:"relative z-[1]",children:"complete"===a.state?(0,d.jsx)(n.A,{className:"h-2.5 w-2.5"}):f?(0,d.jsx)(h.A,{className:"h-2.5 w-2.5 animate-spin"}):c+1})]}),(0,d.jsxs)("div",{className:"relative z-[1] min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[(0,d.jsx)("p",{className:s("text-[11px]","light"===b?"text-[#3e2f24]":"text-white"),children:a.label}),(0,d.jsx)("span",{className:s("rounded-full px-1.5 py-0.5 text-[6px] uppercase tracking-[0.14em]",dt(a.state,b)),children:g})]}),(0,d.jsx)("p",{className:s("mt-0.5 text-[8px] leading-[0.82rem]","light"===b?"text-[#8f7664]":"text-slate-500"),children:a.description})]})]},a.id)})}),(0,d.jsx)(dJ,{surfaceTheme:b,statusCopy:c,showDetails:e,phaseLabel:f,detailsOpen:l,onDetailsOpenChange:m,run:i}),j?(0,d.jsx)("div",{className:s("mt-2.5 rounded-[14px] border px-2.5 py-2","light"===b?"border-amber-300 bg-amber-50 text-amber-950":"border-amber-300/22 bg-amber-300/10 text-amber-100"),children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(o.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"text-[10px] font-medium",children:"Native Gateway auth needs an env credential"}),(0,d.jsx)("p",{className:s("mt-1 text-[9px] leading-[0.95rem]","light"===b?"text-amber-900/78":"text-amber-100/78"),children:"OpenClaw reports the Gateway secret as redacted. Generate a local token in Settings so AgentOS can use native WS instead of CLI fallback."}),(0,d.jsx)(x,{type:"button",size:"sm",variant:"secondary",onClick:k,className:s("mt-2",dl(b)),children:"Configure Gateway auth"})]})]})}):null]})}function dB({snapshot:a,surfaceTheme:b,statusCopy:c,showDetails:e,phaseLabel:f,run:h,modelPhase:i,selectedModelId:j,modelSwitchFeedback:k,onSelectedModelIdChange:l,onClearModelSwitchFeedback:m,onOpenAddModels:n}){let[o,p]=(0,g.useState)(!0),q=(0,g.useMemo)(()=>a.models.filter(a=>!1!==a.available&&!a.missing),[a.models]),r=(0,g.useMemo)(()=>dj(j,q),[q,j]),t=a.diagnostics.modelReadiness.resolvedDefaultModel||a.diagnostics.modelReadiness.defaultModel||null,u=c2(a),v=dF(t,q),w=dF(j,q),x=!!(j.trim()&&j.trim()!==(t?.trim()??"")),y=(0,g.useMemo)(()=>(function({statusCopy:a,run:b,selectedModelLabel:c,phase:d}){var e;let f=`${a}
|
|
4
|
+
${b.log}`.toLowerCase(),g=!!b.manualCommand||/terminal|sign-in|login|oauth|api key|provider auth/.test(f),h="verifying"===d&&(/creating a demo workspace/.test(f)||/resolving workspace settings and reserving the target directory/.test(f)||/preparing workspace folder/.test(f)||/checking input and target path/.test(f)||/reserved target directory/.test(f)||/creating a fresh workspace folder/.test(f)||/fresh workspace folder created at/.test(f)||/preparing an empty workspace scaffold/.test(f)||/generating workspace docs/.test(f)||/scaffolding workspace files/.test(f)||/workspace files and starter docs are in place/.test(f)||/workspace bootstrap is wrapping up without a kickoff mission/.test(f)||/creating the first workspace agent/.test(f)||/provisioning the first workspace agent/.test(f)||/creating agent \d+ of \d+/.test(f)||/linked to the workspace/.test(f)||/finalizing workspace bootstrap/.test(f)||/workspace bootstrap finished/.test(f)||/demo workspace is ready/.test(f));if("running"!==b.runState||g||!h)return null;let i=(e=f,/resolving workspace settings/.test(e)||/checking input and target path/.test(e)||/reserved target directory/.test(e)||/creating a demo workspace/.test(e)?1:/preparing workspace folder/.test(e)||/creating a fresh workspace folder/.test(e)||/preparing an empty workspace scaffold/.test(e)||/scaffolding workspace files/.test(e)||/fresh workspace folder created at/.test(e)||/generating workspace docs/.test(e)||/workspace files and starter docs are in place/.test(e)?2:/creating the first workspace agent/.test(e)||/provisioning the first workspace agent/.test(e)||/creating agent \d+ of \d+/.test(e)||/linked to the workspace/.test(e)?3:/finalizing workspace bootstrap/.test(e)||/workspace bootstrap is wrapping up without a kickoff mission/.test(e)||/workspace bootstrap finished/.test(e)||/demo workspace is ready/.test(e)?4:1),j=[{id:"model",label:"Default model",detail:c?`${c} is now the route powering the workspace.`:"The selected route is being saved locally."},{id:"path",label:"Workspace shell",detail:"Validating the destination and preparing the workspace folder."},{id:"scaffold",label:"Workspace scaffold",detail:"Writing docs, memory, and the bootstrap metadata."},{id:"agent",label:"Starter agent",detail:"Provisioning the first agent and wiring it into the workspace."},{id:"handoff",label:"Canvas handoff",detail:"Refreshing the graph and selecting the new workspace."}].map((a,b)=>({...a,state:b<i?"done":b===i?"current":"pending"}));return{stepIndex:i,steps:j,logLines:b.log.split(/\r?\n/).map(a=>a.trim().replace(/^>\s*/,"")).filter(a=>!!a).slice(-4),headline:"Building your demo workspace",summary:"Workspace files, the first agent, and the initial canvas handoff are being assembled in real time.",selectedModelLabel:c}})({statusCopy:c,run:h,selectedModelLabel:r,phase:i}),[i,h,r,c]);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"mt-3",children:(0,d.jsx)("p",{className:s("text-[11px] font-medium","light"===b?"text-[#33251c]":"text-white"),children:"Step 2: Model setup"})}),y?(0,d.jsx)(dK,{surfaceTheme:b,statusCopy:c,phaseLabel:f,buildScene:y}):"idle"!==k.phase?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(dD,{surfaceTheme:b,feedback:k,defaultModelLabel:dF(k.previousModelId,q),nextModelLabel:dF(k.nextModelId,q),onChangeAgain:m}),(0,d.jsx)(dJ,{surfaceTheme:b,statusCopy:c,showDetails:e,phaseLabel:f,detailsOpen:o,onDetailsOpenChange:p,run:h})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(dC,{surfaceTheme:b,defaultModelLabel:v,switchTargetLabel:w,hasPendingModelSwitch:x}),(0,d.jsx)(dv,{snapshot:a,selectedModelId:j,onSelectedModelIdChange:l,onOpenAddModels:n,autoDiscover:!u}),(0,d.jsx)(dJ,{surfaceTheme:b,statusCopy:c,showDetails:e,phaseLabel:f,detailsOpen:o,onDetailsOpenChange:p,run:h})]})]})}function dC({surfaceTheme:a,defaultModelLabel:b,switchTargetLabel:c,hasPendingModelSwitch:e}){return(0,d.jsx)("div",{className:s("mt-2 rounded-[14px] border px-2.5 py-2","light"===a?"border-[#e8d8ca] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:s("text-[7px] uppercase tracking-[0.16em]","light"===a?"text-[#9a7a65]":"text-slate-500"),children:"Detected default"}),(0,d.jsx)("p",{className:s("mt-1 truncate text-[10px]","light"===a?"text-[#3e2f24]":"text-white"),children:b??"Not set"})]}),e?(0,d.jsxs)("div",{className:"min-w-0 text-right",children:[(0,d.jsx)("p",{className:s("text-[7px] uppercase tracking-[0.16em]","light"===a?"text-[#9a7a65]":"text-slate-500"),children:"Switch to"}),(0,d.jsx)("p",{className:s("mt-1 truncate text-[10px]","light"===a?"text-[#7a4d2d]":"text-cyan-100"),children:c})]}):null]})})}function dD({surfaceTheme:a,feedback:b,defaultModelLabel:c,nextModelLabel:e,onChangeAgain:f}){let g="light"===a,i="saving"===b.phase,j="success"===b.phase,k="error"===b.phase,l=b.message||(j?"AgentOS will use this route for new actions.":k?"Review the log below, then try again.":"Saving the route, refreshing OpenClaw config, and updating AgentOS.");return(0,d.jsx)("div",{className:s("mt-3 overflow-hidden rounded-[22px] border",g?"border-[#e1d0c2] bg-[linear-gradient(180deg,rgba(255,250,246,0.98),rgba(248,240,232,0.98))]":"border-cyan-300/16 bg-[radial-gradient(circle_at_top,rgba(16,28,44,0.98),rgba(6,10,18,0.98)_72%)]"),children:(0,d.jsxs)("div",{className:"relative isolate min-h-[300px] overflow-hidden px-4 py-4 text-center",children:[(0,d.jsx)("div",{"aria-hidden":"true",className:s("pointer-events-none absolute inset-0",g?"bg-[radial-gradient(circle_at_50%_0%,rgba(232,186,151,0.22),transparent_34%),linear-gradient(135deg,rgba(255,255,255,0.4),transparent_48%)]":"bg-[radial-gradient(circle_at_50%_0%,rgba(34,211,238,0.18),transparent_34%),linear-gradient(135deg,rgba(255,255,255,0.04),transparent_48%)]")}),(0,d.jsxs)("div",{className:"relative z-[1] flex flex-col items-center",children:[(0,d.jsxs)("div",{className:"relative flex h-20 w-20 items-center justify-center",children:[i?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a6.P.div,{"aria-hidden":"true",className:s("absolute h-20 w-20 rounded-full border",g?"border-[#d1a98b]":"border-cyan-200/24"),animate:{rotate:360},transition:{duration:8,repeat:1/0,ease:"linear"}}),(0,d.jsx)(a6.P.div,{"aria-hidden":"true",className:s("absolute h-14 w-14 rounded-full border border-dashed",g?"border-[#c8946f]":"border-cyan-200/40"),animate:{rotate:-360},transition:{duration:6,repeat:1/0,ease:"linear"}})]}):null,(0,d.jsx)("span",{className:s("relative z-[1] inline-flex h-12 w-12 items-center justify-center rounded-full border",j?g?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":k?g?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200":g?"border-[#d7b59a] bg-white text-[#9a6a48]":"border-cyan-300/20 bg-cyan-300/10 text-cyan-100"),children:j?(0,d.jsx)(n.A,{className:"h-5 w-5"}):i?(0,d.jsx)(h.A,{className:"h-5 w-5 animate-spin"}):(0,d.jsx)(du.A,{className:"h-5 w-5"})})]}),(0,d.jsx)("p",{className:s("mt-3 text-[8px] uppercase tracking-[0.22em]",g?"text-[#94735e]":"text-cyan-200/70"),children:"Model route"}),(0,d.jsx)("h3",{className:s("mt-1 text-[17px] font-medium tracking-[-0.03em]",g?"text-[#2d2118]":"text-white"),children:j?"Default model updated":k?"Default model could not be changed":"Switching default model"}),(0,d.jsx)("p",{className:s("mt-1 max-w-[320px] text-[10px] leading-[1rem]",g?"text-[#6d5647]":"text-slate-300"),children:l}),(0,d.jsxs)("div",{className:s("mt-4 grid w-full gap-2 rounded-[16px] border px-3 py-3 text-left",g?"border-[#ead8c8] bg-white/70":"border-white/8 bg-white/[0.04]"),children:[(0,d.jsx)(dE,{label:"Previous",value:c??"Not set",surfaceTheme:a,muted:!0}),(0,d.jsx)(dE,{label:"New default",value:e??"Not selected",surfaceTheme:a})]}),i?(0,d.jsx)("div",{className:"mt-4 grid w-full gap-1.5 text-left",children:["Saving model route","Refreshing OpenClaw config","Verifying selected provider","Updating AgentOS snapshot"].map((a,b)=>(0,d.jsxs)("div",{className:s("flex items-center gap-2 rounded-[12px] border px-2.5 py-2",g?"border-[#ead8c8] bg-white/55":"border-white/8 bg-white/[0.03]"),children:[(0,d.jsx)("span",{className:s("inline-flex h-4 w-4 items-center justify-center rounded-full border text-[8px]",0===b?g?"border-[#c8946f] bg-[#f8eadf] text-[#8c5d3d]":"border-cyan-300/30 bg-cyan-300/10 text-cyan-100":g?"border-[#e0cec0] bg-white text-[#9a7f6c]":"border-white/10 bg-white/[0.03] text-slate-500"),children:b+1}),(0,d.jsx)("p",{className:s("text-[10px]",g?"text-[#5f4b3e]":"text-slate-300"),children:a})]},a))}):null,i?null:(0,d.jsx)(x,{type:"button",variant:"secondary",size:"sm",onClick:f,className:s("mt-4 h-8 rounded-full px-3 text-[10px]",dl(a)),children:"Change again"})]})]})})}function dE({label:a,value:b,surfaceTheme:c,muted:e=!1}){return(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("span",{className:s("text-[7px] uppercase tracking-[0.16em]","light"===c?"text-[#9a7f6c]":"text-slate-500"),children:a}),(0,d.jsx)("span",{className:s("min-w-0 truncate text-right text-[10px]",e?"light"===c?"text-[#8a7261]":"text-slate-400":"light"===c?"text-[#3e2f24]":"text-white"),children:b})]})}function dF(a,b){return a?.trim()?dj(a,b)??I(a):null}function dG({surfaceTheme:a,workspaceCount:b,defaultModelLabel:c,createProgress:e,createRunState:f}){let g=b>0,h="running"===f&&!!e,i="error"===f&&!!e,j=!!e&&(h||i),k=g?`You already have ${b} workspace${1===b?"":"s"} online. Use AgentOS to inspect them or create another workspace for a new mission.`:h?"AgentOS Workspace is being provisioned now. The scaffold and starter agent are being built in the background.":i?"The first workspace creation needs attention. Review the output, then try again.":"No workspace exists yet. Create one first so the live system has a place to keep context and deliverables.";return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:s("mt-3 rounded-[16px] border px-3 py-3","light"===a?"border-emerald-200/80 bg-[linear-gradient(180deg,rgba(240,250,245,0.95),rgba(248,244,236,0.95))]":"border-emerald-300/15 bg-[linear-gradient(180deg,rgba(9,18,19,0.96),rgba(7,11,18,0.94))]"),children:[(0,d.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,d.jsx)("span",{className:s("mt-0.5 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full border","light"===a?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/10 text-emerald-200"),children:(0,d.jsx)(n.A,{className:"h-3.5 w-3.5"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:s("text-[7px] uppercase tracking-[0.18em]","light"===a?"text-emerald-700/75":"text-emerald-200/75"),children:"Launchpad"}),(0,d.jsx)("h2",{className:s("mt-1 text-[13px] font-medium","light"===a?"text-[#2d2118]":"text-white"),children:"OpenClaw is ready."}),(0,d.jsx)("p",{className:s("mt-1 text-[10px] leading-[0.95rem]","light"===a?"text-[#5f4b3e]":"text-slate-300"),children:k})]})]}),j?null:(0,d.jsxs)("div",{className:"mt-3 grid gap-1.5 sm:grid-cols-2",children:[(0,d.jsx)(dI,{surfaceTheme:a,label:"System",value:"Online",detail:"CLI, gateway, and runtime access verified"}),(0,d.jsx)(dI,{surfaceTheme:a,label:g?"Default model":"Detected default",value:c,detail:g?"Usable model route selected":"Detected on this machine, not yet confirmed by a workspace."}),(0,d.jsx)(dI,{surfaceTheme:a,label:"Runtime",value:"Smoke test passed",detail:"A live agent turn was verified"}),(0,d.jsx)(dI,{surfaceTheme:a,label:"Workspaces",value:String(b),detail:g?"Ready for mission planning":"Create one to begin"})]})]}),j?(0,d.jsx)(dH,{surfaceTheme:a,progress:e,runState:f}):(0,d.jsxs)("div",{className:s("mt-2.5 rounded-[12px] border px-2.5 py-2","light"===a?"border-[#e5d5c9] bg-[#fffaf6]":"border-white/8 bg-[rgba(255,255,255,0.02)]"),children:[(0,d.jsx)("p",{className:s("text-[7px] uppercase tracking-[0.16em]","light"===a?"text-[#977b69]":"text-slate-500"),children:"Next step"}),(0,d.jsx)("p",{className:s("mt-1 text-[11px] leading-[1rem]","light"===a?"text-[#5f4b3e]":"text-slate-300"),children:g?"Open AgentOS to inspect the live graph, or create another workspace if you want a separate mission lane.":"Create the first workspace now. That is the shortest path from a ready system to a real mission."})]})]})}function dH({surfaceTheme:a,progress:b,runState:c}){let e="light"===a,f=b.steps.find(a=>"active"===a.status)??b.steps[0]??null,g="error"===c;return(0,d.jsxs)("div",{className:s("relative mt-2.5 overflow-hidden rounded-[18px] border px-2.5 py-2.5",e?g?"border-rose-200 bg-[linear-gradient(180deg,rgba(255,248,247,0.98),rgba(252,242,242,0.96))]":"border-[#dcc7b8] bg-[linear-gradient(180deg,rgba(255,251,248,0.98),rgba(249,243,236,0.96))]":g?"border-rose-300/18 bg-[radial-gradient(circle_at_top,rgba(49,18,24,0.95),rgba(12,8,14,0.98)_72%)]":"border-cyan-300/16 bg-[radial-gradient(circle_at_top,rgba(11,21,34,0.98),rgba(5,10,18,0.98)_72%)]"),children:[(0,d.jsx)("div",{"aria-hidden":"true",className:s("pointer-events-none absolute inset-0",e?"bg-[radial-gradient(circle_at_20%_0%,rgba(255,255,255,0.95),transparent_28%),radial-gradient(circle_at_84%_18%,rgba(201,148,111,0.14),transparent_22%)]":g?"bg-[radial-gradient(circle_at_20%_0%,rgba(251,113,133,0.14),transparent_26%),radial-gradient(circle_at_84%_18%,rgba(248,113,113,0.08),transparent_22%)]":"bg-[radial-gradient(circle_at_20%_0%,rgba(34,211,238,0.12),transparent_26%),radial-gradient(circle_at_84%_18%,rgba(59,130,246,0.08),transparent_22%)]")}),(0,d.jsx)(a6.P.div,{"aria-hidden":"true",className:s("pointer-events-none absolute -left-8 top-5 h-24 w-24 rounded-full blur-3xl",e?"bg-[#efc6a8]/20":g?"bg-rose-300/10":"bg-cyan-300/10"),animate:{x:[0,10,0],y:[0,-6,0],opacity:[.45,.75,.45]},transition:{duration:7.5,repeat:1/0,ease:"easeInOut"}}),(0,d.jsx)(a6.P.div,{"aria-hidden":"true",className:s("pointer-events-none absolute -right-4 top-8 h-28 w-28 rounded-full blur-3xl",e?"bg-[#f6d9c2]/18":g?"bg-rose-300/8":"bg-sky-300/8"),animate:{x:[0,-12,0],y:[0,8,0],opacity:[.35,.7,.35]},transition:{duration:9.5,repeat:1/0,ease:"easeInOut"}}),(0,d.jsxs)("div",{className:"relative z-[1] flex items-start justify-between gap-2",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[(0,d.jsx)(a6.P.div,{className:s("mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full border",e?g?"border-rose-300 bg-white text-rose-700":"border-[#d9b59a] bg-white text-[#8b6d5a]":g?"border-rose-300/25 bg-rose-300/10 text-rose-100":"border-cyan-200/20 bg-cyan-300/10 text-cyan-100"),animate:{scale:[1,1.06,1],opacity:[.82,1,.82]},transition:{duration:3.2,repeat:1/0,ease:"easeInOut"},children:g?(0,d.jsx)(o.A,{className:"h-3.5 w-3.5"}):(0,d.jsx)(h.A,{className:"h-3.5 w-3.5 animate-spin"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:s("text-[7px] uppercase tracking-[0.18em]",e?g?"text-rose-600/75":"text-[#977b69]":g?"text-rose-200/75":"text-cyan-200/70"),children:g?"Needs attention":"Building"}),(0,d.jsx)("h3",{className:s("mt-1 text-[13px] font-medium",e?g?"text-rose-950":"text-[#281d17]":g?"text-rose-50":"text-white"),children:g?"Workspace creation needs attention":b.title}),(0,d.jsx)("p",{className:s("mt-1 text-[10px] leading-[0.95rem]",e?g?"text-rose-700":"text-[#6f5a4c]":g?"text-rose-100/80":"text-slate-300"),children:g?"Review the captured output and retry when the workspace state is clean.":b.description})]})]}),(0,d.jsxs)("div",{className:"flex shrink-0 flex-col items-end gap-1",children:[(0,d.jsx)("span",{className:s("rounded-full border px-2 py-0.5 text-[8px] uppercase tracking-[0.16em]",e?g?"border-rose-200 bg-white text-rose-700":"border-[#dcc7b8] bg-white/75 text-[#8b6f5c]":g?"border-rose-300/20 bg-rose-300/8 text-rose-100":"border-cyan-300/16 bg-cyan-300/10 text-cyan-100"),children:g?"Error":`${b.percent}%`}),f?(0,d.jsx)("span",{className:s("max-w-[140px] truncate rounded-full border px-2 py-0.5 text-[7px] uppercase tracking-[0.14em]",e?g?"border-rose-200 bg-white text-rose-700":"border-[#e9d7ca] bg-white text-[#8b6f5c]":g?"border-rose-300/18 bg-rose-300/8 text-rose-100":"border-white/10 bg-white/[0.04] text-slate-300"),children:f.label}):null]})]}),(0,d.jsx)("div",{className:"relative z-[1] mt-2.5 h-1.5 overflow-hidden rounded-full bg-white/8",children:(0,d.jsx)(a6.P.div,{className:s("h-full rounded-full transition-[width] duration-500 ease-out",e?g?"bg-rose-300/85":"bg-amber-300/85":g?"bg-rose-300/85":"bg-cyan-300/85"),style:{width:`${b.percent}%`}})}),(0,d.jsx)("div",{className:"relative z-[1] mt-2.5 space-y-1.5",children:b.steps.map((a,b)=>{let c="active"===a.status,f="done"===a.status?e?"border-emerald-200 bg-emerald-50/75":"border-emerald-400/20 bg-emerald-400/10":c?e?"border-[#d9bca5] bg-white":"border-cyan-300/18 bg-cyan-300/[0.05]":e?"border-[#eadccc] bg-white/70":"border-white/6 bg-white/[0.03]",i="done"===a.status?e?"border-emerald-300 bg-emerald-100 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":c?e?"border-[#d5b9a5] bg-[#f5ebe3] text-[#8b6d5a]":"border-cyan-200/20 bg-cyan-300/10 text-cyan-100":e?"border-[#e1ccc0] bg-white text-[#9a7f6c]":"border-white/8 bg-white/[0.03] text-slate-400";return(0,d.jsxs)("div",{className:s("relative overflow-hidden rounded-[12px] border px-2.5 py-1.5",f),children:[c?(0,d.jsx)(a6.P.div,{"aria-hidden":"true",className:s("pointer-events-none absolute inset-y-0 left-0 w-1/3 blur-[1px]",e?"bg-gradient-to-r from-transparent via-[#d9b08d]/24 to-transparent":g?"bg-gradient-to-r from-transparent via-rose-300/10 to-transparent":"bg-gradient-to-r from-transparent via-cyan-200/12 to-transparent"),animate:{x:["-25%","230%"]},transition:{duration:1.7,repeat:1/0,ease:"linear"}}):null,(0,d.jsxs)("div",{className:"relative z-[1] flex items-start gap-1.5",children:[(0,d.jsx)("span",{className:s("mt-0.5 inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full border text-[9px] font-medium",i),children:"done"===a.status?(0,d.jsx)(n.A,{className:"h-2.5 w-2.5"}):c?(0,d.jsx)(h.A,{className:"h-2.5 w-2.5 animate-spin"}):b+1}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-1",children:[(0,d.jsx)("p",{className:s("text-[10px]",e?"text-[#3e2f24]":"text-white"),children:a.label}),(0,d.jsxs)("span",{className:s("text-[7px] tabular-nums",e?"text-[#8f7664]":"text-slate-400"),children:[a.percent,"%"]})]}),(0,d.jsx)("p",{className:s("mt-0.5 text-[8px] leading-[0.82rem]",e?"text-[#8f7664]":"text-slate-500"),children:a.detail||a.description}),(0,d.jsx)("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-white/8",children:(0,d.jsx)(a6.P.div,{className:s("h-full rounded-full transition-[width] duration-500 ease-out","done"===a.status?"bg-emerald-300/85":c?e?g?"bg-rose-300/85":"bg-amber-300/85":g?"bg-rose-300/85":"bg-cyan-300/85":"bg-transparent"),style:{width:`${Math.max(a.percent,10*!!c)}%`}})}),c&&a.activities.length>0?(0,d.jsx)("div",{className:"mt-1 space-y-0.5",children:a.activities.slice(-2).map(a=>(0,d.jsxs)("div",{className:s("flex items-start gap-1.5 text-[8px] leading-[0.9rem]",e?"text-[#705b4d]":"text-slate-300"),children:[(0,d.jsx)("span",{className:s("mt-[5px] h-1.5 w-1.5 shrink-0 rounded-full","done"===a.status&&"bg-emerald-300","active"===a.status&&"bg-cyan-300","error"===a.status&&"bg-rose-300","pending"===a.status&&(e?"bg-[#c9b4a2]":"bg-slate-500"))}),(0,d.jsx)("span",{className:"min-w-0",children:a.message})]},a.id))}):null]})]})]},a.id)})})]})}function dI({surfaceTheme:a,label:b,value:c,detail:e}){return(0,d.jsxs)("div",{className:s("rounded-[12px] border px-2.5 py-2","light"===a?"border-[#e6d7cb] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsx)("p",{className:s("text-[7px] uppercase tracking-[0.16em]","light"===a?"text-[#977b69]":"text-slate-500"),children:b}),(0,d.jsx)("p",{title:c,className:s("mt-1 truncate text-[10px]","light"===a?"text-[#33251c]":"text-white"),children:c}),(0,d.jsx)("p",{className:s("mt-0.5 text-[8px] leading-[0.85rem]","light"===a?"text-[#8f7664]":"text-slate-500"),children:e})]})}function dJ({surfaceTheme:a,statusCopy:b,showDetails:c,phaseLabel:e,detailsOpen:f,onDetailsOpenChange:k,run:l}){let[m,n]=(0,g.useState)(!1),o=de(l.manualCommand),p=async()=>{if(l.manualCommand)try{await navigator.clipboard.writeText(l.manualCommand),aq.o.success("Command copied.",{description:"Open Terminal and paste it."})}catch(a){aq.o.error("Could not copy command.",{description:a instanceof Error?a.message:"Clipboard access is unavailable."})}},q=async()=>{if(l.manualCommand&&o){n(!0);try{let a=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:l.manualCommand})}),b=await a.json().catch(()=>null);if(!a.ok||b?.error)throw Error(b?.error||"Unable to open Terminal.");aq.o.success("Terminal opened.",{description:"Finish auth there, then refresh."})}catch(a){aq.o.error("Could not open Terminal.",{description:a instanceof Error?a.message:"Open Terminal manually and run the command."})}finally{n(!1)}}};return(0,d.jsxs)("div",{className:s("mt-2.5 rounded-[12px] border","light"===a?"border-[#e5d5c9] bg-[#fffaf6]":"border-white/8 bg-[rgba(255,255,255,0.02)]"),children:[(0,d.jsxs)("div",{className:"px-2.5 py-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:s("text-[7px] uppercase tracking-[0.16em]","light"===a?"text-[#977b69]":"text-slate-500"),children:"Status"}),c?(0,d.jsx)("button",{type:"button",onClick:()=>k(!f),className:s("text-[8px] uppercase tracking-[0.16em] transition-colors","light"===a?"text-[#8f7664] hover:text-[#6f5949]":"text-slate-500 hover:text-slate-300"),children:f?"Hide details":"Show details"}):null]}),(0,d.jsx)("p",{className:s("mt-1 text-[11px] leading-[1rem]","light"===a?"text-[#5f4b3e]":"text-slate-300"),children:b})]}),c&&f?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:s("flex items-center justify-between border-y px-2.5 py-1.5","light"===a?"border-[#ebddd2]":"border-white/8"),children:[(0,d.jsx)("p",{className:s("text-[8px] uppercase tracking-[0.16em]","light"===a?"text-[#977b69]":"text-slate-500"),children:"Log"}),(0,d.jsx)("span",{className:"light"===a?"text-[10px] text-[#8c7362]":"text-[10px] text-slate-400",children:e})]}),(0,d.jsx)("pre",{className:s("max-h-[120px] min-h-[68px] overflow-auto whitespace-pre-wrap break-words px-2.5 py-2 font-mono text-[8px] leading-[0.82rem]","light"===a?"text-[#4f3d31]":"text-slate-200"),children:l.log||"No output yet.\n\nStart the step to stream logs."}),l.manualCommand?(0,d.jsxs)("div",{className:s("border-t px-2.5 py-2","light"===a?"border-[#ebddd2]":"border-white/8"),children:[(0,d.jsx)("p",{className:s("text-[8px] uppercase tracking-[0.16em]","light"===a?"text-[#977b69]":"text-slate-500"),children:o?"Terminal":"Manual"}),o?(0,d.jsx)("p",{className:s("mt-1 text-[9px] leading-[0.95rem]","light"===a?"text-[#705b4d]":"text-slate-400"),children:"Open Terminal and run this command."}):null,(0,d.jsx)("p",{className:s("mt-1 break-all font-mono text-[9px] leading-[0.92rem]","light"===a?"text-[#4f3d31]":"text-slate-200"),children:l.manualCommand}),(0,d.jsxs)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[(0,d.jsxs)(x,{type:"button",variant:"secondary",size:"sm",onClick:p,className:dl(a),children:[(0,d.jsx)(j.A,{className:"mr-1.5 h-3 w-3"}),"Copy command"]}),o?(0,d.jsx)(x,{type:"button",variant:"secondary",size:"sm",onClick:q,disabled:m,className:dl(a),children:m?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i.A,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}):null]}),l.docsUrl?(0,d.jsxs)("a",{href:l.docsUrl,target:"_blank",rel:"noreferrer",className:s("mt-2 inline-flex items-center gap-1 text-[9px] underline underline-offset-4","light"===a?"text-[#7f6554]":"text-slate-300"),children:["Setup docs",(0,d.jsx)(dh.A,{className:"h-2.5 w-2.5"})]}):null]}):null]}):null]})}function dK({surfaceTheme:a,statusCopy:b,phaseLabel:c,buildScene:e}){let f="light"===a;return(0,d.jsx)("div",{className:s("mt-3 overflow-hidden rounded-[24px] border",f?"border-[#e1d4c6] bg-[linear-gradient(180deg,rgba(255,251,247,0.96),rgba(248,241,233,0.98))]":"border-cyan-300/18 bg-[radial-gradient(circle_at_top,rgba(12,24,40,0.98),rgba(5,10,18,0.98)_72%)]"),children:(0,d.jsxs)("div",{className:"relative isolate min-h-[440px] overflow-hidden px-4 py-4 sm:px-5 sm:py-5",children:[(0,d.jsx)("div",{className:s("pointer-events-none absolute inset-0",f?"bg-[radial-gradient(circle_at_20%_20%,rgba(255,255,255,0.96),transparent_30%),radial-gradient(circle_at_80%_10%,rgba(221,182,152,0.18),transparent_24%),linear-gradient(135deg,rgba(255,255,255,0.06),transparent_30%,rgba(218,193,176,0.12)_58%,transparent_72%)]":"bg-[radial-gradient(circle_at_20%_20%,rgba(34,211,238,0.16),transparent_24%),radial-gradient(circle_at_82%_12%,rgba(56,189,248,0.11),transparent_20%),linear-gradient(135deg,rgba(255,255,255,0.03),transparent_34%,rgba(34,211,238,0.05)_58%,transparent_74%)]")}),(0,d.jsx)(a6.P.div,{"aria-hidden":"true",className:s("pointer-events-none absolute -left-12 top-8 h-36 w-36 rounded-full blur-3xl",f?"bg-[#f1b27d]/25":"bg-cyan-300/12"),animate:{x:[0,16,0],y:[0,-10,0],opacity:[.55,.8,.55]},transition:{duration:8,repeat:1/0,ease:"easeInOut"}}),(0,d.jsx)(a6.P.div,{"aria-hidden":"true",className:s("pointer-events-none absolute right-0 top-24 h-44 w-44 rounded-full blur-3xl",f?"bg-[#f9d8b6]/22":"bg-sky-300/10"),animate:{x:[0,-18,0],y:[0,8,0],opacity:[.35,.7,.35]},transition:{duration:10,repeat:1/0,ease:"easeInOut"}}),(0,d.jsxs)("div",{className:"relative z-[1] flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:s("text-[9px] uppercase tracking-[0.24em]",f?"text-[#8f6f5d]":"text-cyan-200/70"),children:"Building"}),(0,d.jsx)("h3",{className:s("mt-1 text-[18px] font-medium tracking-[-0.03em] sm:text-[22px]",f?"text-[#231a15]":"text-white"),children:"Creating your demo workspace"}),(0,d.jsx)("p",{className:s("mt-1 max-w-[42rem] text-[11px] leading-[1rem] sm:text-[12px] sm:leading-[1.05rem]",f?"text-[#6f5a4c]":"text-slate-300"),children:b})]}),(0,d.jsxs)("div",{className:"flex shrink-0 flex-col items-end gap-1.5",children:[(0,d.jsx)("span",{className:s("inline-flex items-center rounded-full border px-2.5 py-1 text-[8px] uppercase tracking-[0.16em]",f?"border-[#d9c3b1] bg-white/70 text-[#8b6f5c]":"border-cyan-300/18 bg-cyan-300/10 text-cyan-100"),children:c}),e.selectedModelLabel?(0,d.jsxs)("span",{className:s("inline-flex max-w-[220px] truncate rounded-full border px-2.5 py-1 text-[9px]",f?"border-[#ead8c8] bg-white text-[#5a4638]":"border-white/10 bg-white/[0.04] text-slate-200"),children:["Default model: ",e.selectedModelLabel]}):null]})]}),(0,d.jsxs)("div",{className:"relative z-[1] mt-5 grid gap-4 xl:grid-cols-[minmax(0,1.2fr)_minmax(280px,0.8fr)]",children:[(0,d.jsxs)("div",{className:s("relative min-h-[290px] overflow-hidden rounded-[28px] border",f?"border-[#ead8c8] bg-[linear-gradient(180deg,rgba(255,255,255,0.92),rgba(252,246,239,0.98))] shadow-[0_18px_50px_rgba(165,126,98,0.08)]":"border-white/10 bg-[linear-gradient(180deg,rgba(9,16,28,0.98),rgba(5,10,18,0.98))] shadow-[0_18px_50px_rgba(0,0,0,0.3)]"),children:[(0,d.jsx)("div",{className:s("absolute inset-0 opacity-80",f?"bg-[linear-gradient(rgba(116,85,65,0.05)_1px,transparent_1px),linear-gradient(90deg,rgba(116,85,65,0.05)_1px,transparent_1px)] bg-[size:28px_28px]":"bg-[linear-gradient(rgba(56,189,248,0.08)_1px,transparent_1px),linear-gradient(90deg,rgba(56,189,248,0.08)_1px,transparent_1px)] bg-[size:28px_28px]")}),(0,d.jsx)(a6.P.div,{"aria-hidden":"true",className:s("absolute inset-x-0 top-0 h-px",f?"bg-gradient-to-r from-transparent via-[#caa789] to-transparent":"bg-gradient-to-r from-transparent via-cyan-200/70 to-transparent"),animate:{opacity:[.4,1,.4]},transition:{duration:3.2,repeat:1/0,ease:"easeInOut"}}),(0,d.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,d.jsxs)("div",{className:"relative flex flex-col items-center text-center",children:[(0,d.jsx)(a6.P.div,{className:s("absolute h-56 w-56 rounded-full border",f?"border-[#d8bda5]/45":"border-cyan-200/14"),animate:{rotate:360},transition:{duration:28,repeat:1/0,ease:"linear"}}),(0,d.jsx)(a6.P.div,{className:s("absolute h-40 w-40 rounded-full border",f?"border-[#e2c4ad]/65":"border-cyan-200/16"),animate:{rotate:-360},transition:{duration:18,repeat:1/0,ease:"linear"}}),(0,d.jsx)(a6.P.div,{className:s("absolute h-24 w-24 rounded-full border",f?"border-[#f0d8c8] bg-white/90":"border-cyan-300/18 bg-cyan-300/[0.08]"),animate:{scale:[1,1.04,1],opacity:[.75,1,.75]},transition:{duration:3.8,repeat:1/0,ease:"easeInOut"}}),(0,d.jsx)("div",{className:s("relative flex h-24 w-24 items-center justify-center rounded-full border shadow-[0_0_0_14px_rgba(255,255,255,0.03)]",f?"border-[#d7b9a0] bg-[radial-gradient(circle_at_top,rgba(255,255,255,0.98),rgba(246,232,219,0.98))] text-[#7c5b46]":"border-cyan-300/24 bg-[radial-gradient(circle_at_top,rgba(16,30,48,0.96),rgba(7,12,21,0.98))] text-cyan-100"),children:(0,d.jsx)(h.A,{className:"h-10 w-10 animate-spin"})}),(0,d.jsx)("p",{className:s("mt-5 text-[9px] uppercase tracking-[0.22em]",f?"text-[#9a7d69]":"text-cyan-200/70"),children:"Workspace fabric"}),(0,d.jsx)("p",{className:s("mt-1 text-[18px] font-medium tracking-[-0.03em]",f?"text-[#281d17]":"text-white"),children:e.headline}),(0,d.jsx)("p",{className:s("mt-2 max-w-[28rem] text-[11px] leading-[1rem]",f?"text-[#6a5547]":"text-slate-300"),children:e.summary}),(0,d.jsxs)("div",{className:"mt-5 flex flex-wrap items-center justify-center gap-2",children:[(0,d.jsxs)("span",{className:s("inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-[9px]",f?"border-[#dec8b8] bg-white text-[#634d3d]":"border-white/10 bg-white/[0.04] text-slate-200"),children:[(0,d.jsx)("span",{className:s("h-1.5 w-1.5 rounded-full",f?"bg-[#c98a5f]":"bg-cyan-300")}),"Building workspace"]}),(0,d.jsxs)("span",{className:s("inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-[9px]",f?"border-[#dec8b8] bg-white text-[#634d3d]":"border-white/10 bg-white/[0.04] text-slate-200"),children:[(0,d.jsx)("span",{className:s("h-1.5 w-1.5 rounded-full",f?"bg-emerald-500":"bg-emerald-300")}),"Default model locked"]})]})]})}),(0,d.jsx)("div",{className:"absolute inset-x-5 bottom-5",children:(0,d.jsx)("div",{className:s("relative h-2 overflow-hidden rounded-full border",f?"border-[#dec8b8] bg-white/90":"border-white/10 bg-white/[0.04]"),children:(0,d.jsx)(a6.P.div,{className:s("absolute inset-y-0 left-0 w-1/3 rounded-full",f?"bg-gradient-to-r from-[#b97b4c] via-[#f1c59b] to-[#e39e69]":"bg-gradient-to-r from-cyan-400 via-sky-200 to-cyan-500"),animate:{x:["-15%","125%"]},transition:{duration:2.4,repeat:1/0,ease:"linear"}})})})]}),(0,d.jsxs)("div",{className:"flex min-h-0 flex-col gap-3",children:[e.steps.map((a,b)=>(0,d.jsx)(a6.P.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.35,delay:.05*b},className:s("rounded-[18px] border px-3 py-2.5","current"===a.state?f?"border-[#d9b79f] bg-white shadow-[0_10px_28px_rgba(185,122,77,0.08)]":"border-cyan-300/24 bg-white/[0.05] shadow-[0_10px_28px_rgba(0,0,0,0.18)]":"done"===a.state?f?"border-[#e7d5c6] bg-[rgba(255,255,255,0.76)]":"border-white/10 bg-white/[0.03]":f?"border-[#eadccf] bg-[rgba(255,250,246,0.8)]":"border-white/8 bg-white/[0.02]"),children:(0,d.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,d.jsx)("div",{className:s("mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full border text-[10px] font-medium","current"===a.state?f?"border-[#c78e61] bg-[#f7e6d7] text-[#6b4d39]":"border-cyan-300/28 bg-cyan-300/12 text-cyan-50":"done"===a.state?f?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/12 text-emerald-200":f?"border-[#e2d4c7] bg-white text-[#9a7f6c]":"border-white/10 bg-white/[0.03] text-slate-400"),children:"done"===a.state?(0,d.jsx)(n.A,{className:"h-3.5 w-3.5"}):b+1}),(0,d.jsx)("div",{className:"min-w-0 flex-1",children:(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:s("text-[11px] font-medium",f?"text-[#2b1f18]":"text-white"),children:a.label}),(0,d.jsx)("p",{className:s("mt-0.5 text-[9px] leading-[0.95rem]",f?"text-[#7c6554]":"text-slate-400"),children:a.detail})]}),(0,d.jsx)("span",{className:s("rounded-full px-1.5 py-0.5 text-[7px] uppercase tracking-[0.14em]","current"===a.state?f?"bg-[#f1dfd0] text-[#835f48]":"bg-cyan-300/12 text-cyan-100":"done"===a.state?f?"bg-emerald-100 text-emerald-700":"bg-emerald-300/12 text-emerald-200":f?"bg-[#f6ece3] text-[#a0826e]":"bg-white/[0.04] text-slate-500"),children:"done"===a.state?"Ready":"current"===a.state?"Building":"Queued"})]})})]})},a.id)),(0,d.jsxs)("div",{className:s("mt-auto rounded-[20px] border p-3",f?"border-[#ead8c8] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:s("text-[8px] uppercase tracking-[0.18em]",f?"text-[#8f6f5d]":"text-cyan-200/60"),children:"Live build feed"}),(0,d.jsx)("span",{className:s("text-[9px]",f?"text-[#8a6f5e]":"text-slate-400"),children:c})]}),(0,d.jsx)("div",{className:"mt-2 space-y-1.5",children:e.logLines.length>0?e.logLines.slice(-4).map((a,b)=>(0,d.jsxs)(a6.P.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.25,delay:.04*b},className:s("flex items-start gap-2 rounded-[14px] border px-2.5 py-2 text-[10px] leading-[0.98rem]",b===e.logLines.length-1?f?"border-[#d8b79e] bg-[#fff7f0] text-[#5a4638]":"border-cyan-300/18 bg-cyan-300/[0.06] text-slate-100":f?"border-[#eee0d3] bg-[#fffdfb] text-[#735d4e]":"border-white/8 bg-white/[0.02] text-slate-300"),children:[(0,d.jsx)("span",{className:s("mt-1 h-1.5 w-1.5 shrink-0 rounded-full",b===e.logLines.length-1?f?"bg-[#c98758]":"bg-cyan-300":f?"bg-[#e3c8b2]":"bg-slate-500")}),(0,d.jsx)("span",{className:"min-w-0",children:a})]},`${a}-${b}`)):(0,d.jsx)("div",{className:s("rounded-[14px] border border-dashed px-2.5 py-3 text-[10px]",f?"border-[#e8d7c8] text-[#7e6453]":"border-white/10 text-slate-400"),children:"Waiting for the first build signal..."})})]})]})]})]})})}function dL({snapshot:a,surfaceTheme:b,stage:c,showReadyState:e,systemActionLabel:f,systemActionDescription:g,systemPhase:i,modelPhase:j,systemRun:k,modelRun:l,modelSwitchFeedback:m,selectedModelId:o,discoveredModels:p,onSelectedModelIdChange:q,onClearModelSwitchFeedback:r,onRunSystemSetup:t,onRunModelSetDefault:u,onOpenAddModels:v,onOpenGatewayAuthSettings:w,onCreateWorkspace:y,onEnterAgentOS:z,onContinueToModels:A,onBackToSystem:B,onSelectStage:C,launchpadCreateProgress:D,launchpadCreateRunState:E}){var F,G,H,I;let J,K,L,M,N,O,P="success"===k.runState||c1(a),Q=dd(a),R="success"===m.phase||e||c2(a),S=R&&(e||!Q),T="running"===E,U=a.workspaces.length,V=U>0,W=a.diagnostics.modelReadiness.resolvedDefaultModel||a.diagnostics.modelReadiness.defaultModel||"Ready",X=a.diagnostics.modelReadiness.resolvedDefaultModel||a.diagnostics.modelReadiness.defaultModel||null,Y=[{id:"system",order:1,label:"System setup",description:"CLI, gateway, RPC",state:dk(P,"system"===c&&!P)},{id:"models",order:2,label:"Model setup",description:"Default model, auth",state:dk(R,"models"===c&&!R)}],Z=(F=P?"ready":i,J=a.diagnostics.rpcOk&&!a.diagnostics.loaded,K=a.diagnostics.installed||"installing-gateway"===F||"starting-gateway"===F||"verifying"===F||"ready"===F,L=a.diagnostics.loaded||J||"starting-gateway"===F||"verifying"===F||"ready"===F,M=a.diagnostics.rpcOk||"ready"===F,N=a.diagnostics.runtime.stateWritable&&a.diagnostics.runtime.sessionStoreWritable||"ready"===F,O=M&&N,[{id:"cli",label:"OpenClaw CLI",description:di("cli",a,F,K,L,M,O),state:dk(K,!K&&("detecting"===F||"installing-cli"===F))},{id:"gateway",label:"Gateway service",description:di("gateway",a,F,K,L,M,O),state:dk(L,!L&&("installing-gateway"===F||K&&"detecting"===F))},{id:"runtime",label:"Runtime ready",description:di("runtime",a,F,K,L,M,O),state:dk(O,!O&&("starting-gateway"===F||"verifying"===F||L&&"detecting"===F||L||M))}]),$=dj(o,a.models.filter(a=>!1!==a.available&&!a.missing)),_="system"===c?k:l,aa=_.statusMessage||_.resultMessage||("system"===c?g:$?`Selected model: ${$}.`:"Choose a provider, connect it, and then pick a model."),ab="system"===c?P?"ready":a.diagnostics.installed&&a.diagnostics.rpcOk&&(G=a).diagnostics.runtime.stateWritable&&G.diagnostics.runtime.sessionStoreWritable?"ready":a.diagnostics.rpcOk?"verifying access":a.diagnostics.loaded&&!a.diagnostics.rpcOk?"verifying"===i?"connecting":"starting gateway":i?i.replace("-"," "):"waiting":c2(a)?"ready":a.diagnostics.modelReadiness.ready&&"passed"!==a.diagnostics.runtime.smokeTest.status?"smoke test":j?j.replace("-"," "):"waiting",ac="idle"!==_.runState||!!_.manualCommand||_.log.trim().length>0||"models"===c&&p.length>0,ad=(H=_.runState,"running"===H?"Running":R?"Ready":"success"===H?"models"===c?"Updated":"Step complete":"error"===H?"Needs attention":"system"===c?"Step 1":"Step 2"),ae=a.diagnostics.issues.some(a=>/gateway\..*auth|redacted secret|AGENTOS_OPENCLAW_GATEWAY_TOKEN|OPENCLAW_GATEWAY_TOKEN/i.test(a)),af=function(a){if("system"===a.stage)return a.systemReady&&a.modelReady?{kind:"dismiss",label:"Enter AgentOS"}:a.systemReady?{kind:"continue",label:"Continue to model setup"}:{kind:"system",label:a.systemActionLabel};let b=a.selectedModelId.trim(),c=a.defaultModelId?.trim()??"";return b?b===c?{kind:"dismiss",label:"Enter AgentOS"}:{kind:"set-default",label:"Set as default"}:a.modelReady?{kind:"dismiss",label:"Enter AgentOS"}:{kind:"select-model",label:"Select a model"}}({stage:c,systemReady:P,modelReady:R,systemActionLabel:f,selectedModelId:o,defaultModelId:X});return(0,d.jsx)(a6.P.div,{initial:{opacity:0,backdropFilter:"blur(0px)"},animate:{opacity:1,backdropFilter:"blur(12px)"},exit:{opacity:0,backdropFilter:"blur(0px)"},className:s("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"===b?"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,d.jsxs)(a6.P.div,{initial:{opacity:0,y:18,scale:.985},animate:{opacity:1,y:0,scale:1},className:s("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"===b?"border-[#dccabd]/90 bg-[rgba(255,250,246,0.92)] text-[#47362b] shadow-[0_18px_50px_rgba(161,125,101,0.15)]":"border-white/10 bg-[rgba(6,10,18,0.84)] text-slate-100"),children:[(0,d.jsxs)("div",{className:"overflow-y-auto px-2.5 py-2.5 sm:px-3 sm:py-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsxs)("span",{className:s("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[8px] uppercase tracking-[0.18em]","light"===b?"border-[#d8c0b0] bg-[#f3e7dc] text-[#8d725f]":"border-white/10 bg-white/[0.06] text-slate-300"),children:[(0,d.jsx)(a2.A,{className:"h-2 w-2"}),S?V?"Launchpad":T?"Building":"error"===E?"Needs attention":"Launchpad":"Welcome"]}),(0,d.jsx)("span",{className:s("rounded-full border px-1.5 py-0.5 text-[8px] uppercase tracking-[0.16em]",(I=_.runState,"error"===I?"light"===b?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200":"success"===I||R?"light"===b?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"running"===I?"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:ad})]}),(0,d.jsx)("div",{className:"mt-3",children:(0,d.jsx)("p",{className:s("whitespace-nowrap text-[9px] leading-[1rem] tracking-[0.08em]","light"===b?"text-[#33251c]":"text-slate-100"),children:S?V?"AGENTOS : OpenClaw is ready. Choose your first action below.":T?"AGENTOS : Building AgentOS Workspace.":"error"===E?"AGENTOS : Workspace creation needs attention.":"AGENTOS : OpenClaw is ready. Create the first workspace below.":"AGENTOS : Bring your local OpenClaw online."})}),(0,d.jsx)("div",{className:"mt-3 grid gap-1.5 sm:grid-cols-2",children:Y.map(a=>(0,d.jsx)("button",{type:"button",onClick:()=>C(a.id),className:s("rounded-[14px] border px-2.5 py-2 text-left transition-colors hover:opacity-95 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2","light"===b?"focus-visible:ring-[#c8946f] focus-visible:ring-offset-[#fff7f1]":"focus-visible:ring-white/70 focus-visible:ring-offset-[#060a12]",dr(a.state,b)),"aria-pressed":c===a.id,children:(0,d.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:s("inline-flex h-5 w-5 items-center justify-center rounded-full border text-[9px] font-medium",ds(a.state,b)),children:"complete"===a.state?(0,d.jsx)(n.A,{className:"h-2.5 w-2.5"}):a.order}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:s("text-[11px]","light"===b?"text-[#3e2f24]":"text-white"),children:a.label}),(0,d.jsx)("p",{className:s("mt-0.5 text-[8px] leading-[0.85rem]","light"===b?"text-[#8f7664]":"text-slate-500"),children:a.description})]})]}),(0,d.jsx)("span",{className:s("rounded-full px-1.5 py-0.5 text-[6px] uppercase tracking-[0.14em]",dt(a.state,b)),children:"complete"===a.state?"Ready":"current"===a.state?"Active":"Pending"})]})},a.id))}),S?(0,d.jsx)(dG,{surfaceTheme:b,workspaceCount:U,defaultModelLabel:W,createProgress:D,createRunState:E}):"system"===c?(0,d.jsx)(dA,{steps:Z,surfaceTheme:b,statusCopy:aa,showDetails:ac,phaseLabel:ab,run:_,gatewayAuthNeedsSetup:ae,onOpenGatewayAuthSettings:w}):(0,d.jsx)(dB,{snapshot:a,surfaceTheme:b,statusCopy:aa,showDetails:ac,phaseLabel:ab,run:_,modelPhase:j,selectedModelId:o,modelSwitchFeedback:m,onSelectedModelIdChange:q,onClearModelSwitchFeedback:r,onOpenAddModels:v})]}),(0,d.jsxs)("div",{className:s("mt-auto flex flex-wrap items-center justify-between gap-1.5 border-t px-2.5 py-2 sm:px-3","light"===b?"border-[#ebddd2]":"border-white/8"),children:[(0,d.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:S?(0,d.jsx)("span",{className:s("rounded-full border px-2 py-0.5 text-[8px] uppercase tracking-[0.16em]","light"===b?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/10 text-emerald-200"),children:V?"Setup complete":"running"===E?"Building workspace":"error"===E?"Needs attention":"Ready"}):"models"===c?(0,d.jsxs)(x,{type:"button",variant:"ghost",size:"sm",onClick:B,disabled:"running"===_.runState,className:"light"===b?"border border-[#d7bca7] bg-[#f8ede4] text-[#5a4131] hover:bg-[#eedbcc] hover:text-[#3f2d21]":"text-slate-500 hover:bg-white/[0.08] hover:text-slate-200",children:[(0,d.jsx)(dg.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Back"]}):null}),(0,d.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:S?(0,d.jsx)(d.Fragment,{children:Q?(0,d.jsxs)(x,{type:"button",onClick:z,className:s("h-8 min-w-[156px] rounded-full px-3 text-[11px]","light"===b?"bg-[#c8946f] text-white shadow-[0_14px_34px_rgba(200,148,111,0.24)] hover:bg-[#b88461]":"bg-white text-slate-950 hover:bg-white/92"),children:["Enter AgentOS",(0,d.jsx)(dh.A,{className:"ml-1.5 h-3 w-3"})]}):T?(0,d.jsxs)("span",{className:s("inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-[9px] uppercase tracking-[0.16em]","light"===b?"border-[#d8c0b0] bg-white/85 text-[#8d725f]":"border-white/10 bg-white/[0.06] text-slate-300"),children:[(0,d.jsx)(h.A,{className:"h-3 w-3 animate-spin"}),"Building workspace"]}):(0,d.jsxs)(x,{type:"button",onClick:y,className:s("h-8 min-w-[156px] rounded-full px-3 text-[11px]","light"===b?"bg-[#c8946f] text-white shadow-[0_14px_34px_rgba(200,148,111,0.24)] hover:bg-[#b88461]":"bg-white text-slate-950 hover:bg-white/92"),children:["Create Workspace",(0,d.jsx)(dh.A,{className:"ml-1.5 h-3 w-3"})]})}):(0,d.jsxs)(d.Fragment,{children:["models"!==c||R?null:(0,d.jsx)(x,{type:"button",variant:"secondary",size:"sm",onClick:()=>v(),className:dl(b),children:"Open full Add Models"}),(0,d.jsx)(x,{type:"button",onClick:()=>{"system"===c?"dismiss"===af.kind?z():P?A():t():"dismiss"===af.kind?z():"set-default"===af.kind&&u(o||void 0)},disabled:"running"===_.runState||"select-model"===af.kind,className:s("h-8 min-w-[156px] rounded-full px-3 text-[11px]","light"===b?"bg-[#c8946f] text-white shadow-[0_14px_34px_rgba(200,148,111,0.24)] hover:bg-[#b88461]":"bg-white text-slate-950 hover:bg-white/92"),children:"running"===_.runState?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Working..."]}):(0,d.jsxs)(d.Fragment,{children:[af.label,(0,d.jsx)(dh.A,{className:"ml-1.5 h-3 w-3"})]})})]})})]})]})})}var dM=c(72251),dN=c(89165),dO=c(59347);function dP({open:a,target:b,surfaceTheme:c,previewState:e,preview:f,previewError:g,runState:i,statusMessage:j,resultMessage:k,backgroundLogPath:l,log:m,confirmText:n,onConfirmTextChange:p,onRefreshPreview:q,onExecute:r,onBackToSetup:t,onOpenChange:u}){let v="full-uninstall"===b?"FULL UNINSTALL":"RESET MISSION CONTROL",w="running"===i,z="success"===i||"error"===i,A=null!==b&&"ready"===e&&!w&&!z&&n.trim()===v,B="full-uninstall"===b?"Full Uninstall":"Reset AgentOS",C="light"===c?"border-rose-400/80 bg-rose-600 text-white hover:bg-rose-700":"border-rose-400/35 bg-rose-500/90 text-white hover:bg-rose-500";return(0,d.jsx)(ae,{open:a,onOpenChange:a=>{(a||!w)&&u(a)},children:(0,d.jsxs)(aj,{className:s("max-h-[88vh] w-[min(92vw,56rem)] max-w-[92vw] min-w-0 overflow-x-hidden overflow-y-auto sm:max-w-3xl","light"===c?"border-[#dcc8bb] bg-[rgba(252,247,241,0.98)] text-[#402f24]":"border-white/12 bg-[rgba(7,12,22,0.96)] text-slate-100"),children:[(0,d.jsxs)(ak,{children:[(0,d.jsxs)(am,{className:s("flex items-center gap-2","light"===c?"text-[#3f2f24]":"text-white"),children:["full-uninstall"===b?(0,d.jsx)(dM.A,{className:"h-4 w-4"}):(0,d.jsx)(dN.A,{className:"h-4 w-4"}),B]}),(0,d.jsx)(an,{className:"light"===c?"text-[#7e6555]":"text-slate-400",children:"full-uninstall"===b?"Remove AgentOS state, task history, OpenClaw service and local state, then attempt to remove detected OpenClaw and AgentOS CLI installs.":"Remove AgentOS-managed workspaces, attached agents, task history, planner state, and browser state."})]}),"loading"===e?(0,d.jsxs)("div",{className:s("flex items-center gap-2 rounded-[16px] border px-4 py-4 text-sm","light"===c?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsx)(h.A,{className:"h-4 w-4 animate-spin"}),"Loading the reset preview..."]}):null,"error"===e?(0,d.jsxs)("div",{className:s("rounded-[16px] border px-4 py-4","light"===c?"border-rose-200 bg-rose-50 text-rose-900":"border-rose-400/25 bg-rose-500/10 text-rose-100"),children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:"Preview could not be prepared."}),(0,d.jsx)("p",{className:"mt-1 text-sm",children:g||"Unknown reset preview error."})]}):null,f?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"grid gap-3 md:grid-cols-4",children:[(0,d.jsx)(dQ,{label:"Delete folders",value:String(f.summary.deleteFolderCount),surfaceTheme:c}),(0,d.jsx)(dQ,{label:"Keep folders",value:String(f.summary.metadataOnlyCount),surfaceTheme:c}),(0,d.jsx)(dQ,{label:"Agents",value:String(f.summary.agentCount),surfaceTheme:c}),(0,d.jsx)(dQ,{label:"Live agents",value:String(f.summary.liveAgentCount),surfaceTheme:c,danger:f.summary.liveAgentCount>0})]}),f.warnings.length>0?(0,d.jsx)("div",{className:s("mt-3 rounded-[16px] border px-4 py-4","light"===c?"border-amber-300/90 bg-amber-50 text-amber-950":"border-amber-300/25 bg-amber-300/10 text-amber-50"),children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(o.A,{className:"mt-0.5 h-4 w-4 shrink-0"}),(0,d.jsx)("div",{className:"space-y-1 text-sm",children:f.warnings.map(a=>(0,d.jsx)("p",{children:a},a))})]})}):null,(0,d.jsxs)("div",{className:s("mt-3 rounded-[16px] border px-4 py-4","light"===c?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:s("text-xs uppercase tracking-[0.18em]","light"===c?"text-[#9a7f6c]":"text-slate-500"),children:"Workspace impact"}),(0,d.jsx)("p",{className:s("mt-1 text-sm","light"===c?"text-[#6d5647]":"text-slate-400"),children:"`Delete folder` removes the workspace directory. `Keep folder` only removes OpenClaw and AgentOS integration from that location."})]}),(0,d.jsx)(x,{type:"button",size:"sm",variant:"secondary",onClick:q,className:"light"===c?"border-[#dcc6b6] bg-white text-[#5d4739] hover:bg-[#f7eee7] hover:text-[#5d4739]":void 0,children:"Refresh preview"})]}),(0,d.jsx)("div",{className:"mt-3 space-y-2",children:f.workspaces.map(a=>(0,d.jsxs)("div",{className:s("rounded-[14px] border px-3 py-3","light"===c?"border-[#ece0d6] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:s("text-sm font-medium","light"===c?"text-[#3f2f24]":"text-white"),children:a.name}),(0,d.jsx)("p",{className:s("mt-1 break-all font-mono text-[11px]","light"===c?"text-[#7e6555]":"text-slate-400"),children:a.path})]}),(0,d.jsx)("span",{className:s("rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]","delete-folder"===a.action?"light"===c?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-400/25 bg-rose-500/10 text-rose-200":"light"===c?"border-amber-300 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-200"),children:"delete-folder"===a.action?"Delete folder":"Keep folder"})]}),(0,d.jsxs)("p",{className:s("mt-2 text-xs","light"===c?"text-[#6d5647]":"text-slate-400"),children:[a.agentCount," agents, ",a.runtimeCount," tracked runs, ",a.liveAgentCount," live agents."]}),(0,d.jsx)("div",{className:"mt-2 space-y-1",children:a.reasons.map(a=>(0,d.jsx)("p",{className:s("text-xs","light"===c?"text-[#7e6555]":"text-slate-500"),children:a},a))})]},a.workspaceId))})]}),(0,d.jsxs)("div",{className:"mt-3 grid gap-3 md:grid-cols-2",children:[(0,d.jsx)(dR,{title:"AgentOS state",items:f.missionControlPaths,surfaceTheme:c}),(0,d.jsx)(dR,{title:"Browser state",items:f.browserStorageKeys,surfaceTheme:c})]}),"full-uninstall"===b?(0,d.jsxs)("div",{className:"mt-3 grid gap-3 md:grid-cols-2",children:[(0,d.jsx)(dR,{title:"OpenClaw state",items:f.openClawPaths,surfaceTheme:c}),(0,d.jsxs)("div",{className:s("rounded-[16px] border px-4 py-4","light"===c?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsx)("p",{className:s("text-xs uppercase tracking-[0.18em]","light"===c?"text-[#9a7f6c]":"text-slate-500"),children:"CLI cleanup"}),(0,d.jsx)("div",{className:"mt-3 space-y-2",children:f.packageActions.map(a=>(0,d.jsxs)("div",{className:s("min-w-0 overflow-hidden rounded-[14px] border px-3 py-3","light"===c?"border-[#ece0d6] bg-[#fffaf6]":"border-white/8 bg-white/[0.03]"),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,d.jsx)("p",{className:s("min-w-0 break-all text-sm font-medium","light"===c?"text-[#3f2f24]":"text-white"),children:a.packageName}),(0,d.jsx)("span",{className:s("shrink-0 rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",a.detected?"light"===c?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-400/25 bg-rose-500/10 text-rose-200":"light"===c?"border-[#dcc6b6] bg-[#f4e8dd] text-[#876c5a]":"border-white/10 bg-white/[0.05] text-slate-300"),children:a.detected?"Scheduled":"Manual"})]}),(0,d.jsx)("p",{className:s("mt-1 break-words text-xs","light"===c?"text-[#6d5647]":"text-slate-400"),children:a.reason||"No extra detail."}),(0,d.jsx)("p",{className:s("mt-1 whitespace-pre-wrap break-all font-mono text-[11px]","light"===c?"text-[#7e6555]":"text-slate-500"),children:a.command||"Automatic cleanup is not available."})]},a.packageName))})]})]}):null,(0,d.jsxs)("div",{className:s("mt-3 rounded-[16px] border px-4 py-4","light"===c?"border-rose-200 bg-rose-50/70 text-rose-950":"border-rose-400/25 bg-rose-500/10 text-rose-50"),children:[(0,d.jsxs)(bm,{htmlFor:"reset-confirm",className:"text-sm font-medium text-inherit",children:["Type ",v," to continue"]}),(0,d.jsx)(y,{id:"reset-confirm",value:n,onChange:a=>p(a.target.value),placeholder:v,disabled:w,className:s("mt-2 h-10","light"===c?"border-rose-200 bg-white text-rose-950 placeholder:text-rose-300":"border-rose-300/20 bg-slate-950/50 text-rose-50 placeholder:text-rose-200/35")})]})]}):null,"idle"!==i||k||m?(0,d.jsxs)("div",{className:s("min-w-0 overflow-hidden rounded-[16px] border px-4 py-4","error"===i?"light"===c?"border-rose-200 bg-rose-50 text-rose-950":"border-rose-400/25 bg-rose-500/10 text-rose-50":"success"===i?"light"===c?"border-emerald-200 bg-emerald-50 text-emerald-950":"border-emerald-400/25 bg-emerald-500/10 text-emerald-50":"light"===c?"border-[#e6d6ca] bg-white text-[#3f2f24]":"border-white/10 bg-white/[0.03] text-slate-100"),children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:j||k||"Reset status"}),k?(0,d.jsx)("p",{className:"mt-1 text-sm",children:k}):null,l?(0,d.jsxs)("p",{className:"mt-2 break-all font-mono text-[11px]",children:["Background cleanup log: ",l]}):null,(0,d.jsx)("pre",{className:s("mt-3 max-h-56 w-full max-w-full overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words rounded-[14px] border px-3 py-3 text-[11px] leading-relaxed","light"===c?"border-[#e6d6ca] bg-[#fffaf6] text-[#5f4a3d]":"border-white/10 bg-slate-950/45 text-slate-300"),children:m||"Waiting for command output..."})]}):null,(0,d.jsxs)(al,{children:[(0,d.jsx)(x,{type:"button",variant:z?"default":"secondary",onClick:()=>{"full-uninstall"===b&&"success"===i?t():u(!1)},disabled:w,className:z&&"light"===c?"bg-[#5c4437] text-white hover:bg-[#4d382d]":z?"bg-cyan-400 text-slate-950 hover:bg-cyan-300":void 0,children:"full-uninstall"===b&&"success"===i?"Back to setup":z?"Done":"Close"}),z?null:(0,d.jsx)(x,{type:"button",onClick:r,disabled:!A,className:C,children:w?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Running..."]}):(0,d.jsxs)(d.Fragment,{children:["full-uninstall"===b?(0,d.jsx)(dM.A,{className:"mr-1.5 h-3.5 w-3.5"}):(0,d.jsx)(dO.A,{className:"mr-1.5 h-3.5 w-3.5"}),B]})})]})]})})}function dQ({label:a,value:b,surfaceTheme:c,danger:e=!1}){return(0,d.jsxs)("div",{className:s("rounded-[16px] border px-4 py-3",e?"light"===c?"border-rose-200 bg-rose-50":"border-rose-400/20 bg-rose-500/10":"light"===c?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsx)("p",{className:s("text-[11px] uppercase tracking-[0.16em]","light"===c?"text-[#9a7f6c]":"text-slate-500"),children:a}),(0,d.jsx)("p",{className:s("mt-1 font-display text-lg","light"===c?"text-[#3f2f24]":"text-white"),children:b})]})}function dR({title:a,items:b,surfaceTheme:c}){return(0,d.jsxs)("div",{className:s("rounded-[16px] border px-4 py-4","light"===c?"border-[#e6d6ca] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsx)("p",{className:s("text-xs uppercase tracking-[0.18em]","light"===c?"text-[#9a7f6c]":"text-slate-500"),children:a}),(0,d.jsx)("div",{className:"mt-3 space-y-2",children:b.map(a=>(0,d.jsx)("p",{className:s("break-all rounded-[12px] border px-3 py-2 font-mono text-[11px]","light"===c?"border-[#ece0d6] bg-[#fffaf6] text-[#6d5647]":"border-white/8 bg-white/[0.03] text-slate-400"),children:a},a))})]})}var dS=c(2116),dT=c.n(dS),dU=c(1353),dV=c(89203),dW=c(145),dX=c(53549),dY=c(17512),dZ=c(26875),d$=c(65032),d_=c(91282);function d0(a){if(!a)return"Not yet";let b=new Date(a);return Number.isNaN(b.getTime())?a:b.toLocaleString()}let d1=[{value:"auto",label:"Auto"},{value:"local-prefix",label:"Local prefix"},{value:"global-path",label:"Global PATH"},{value:"custom",label:"Custom"}];function d2(a){var b,c,e,k,l,m,p,q;let{snapshot:r,surfaceTheme:t,connectionState:u,gatewayDraft:v,workspaceRootDraft:w,openClawBinarySelection:z,isSavingGateway:A,isSavingWorkspaceRoot:B,isSavingOpenClawBinary:C,isCheckingForUpdates:D,updateRunState:E,selectedModelId:F,modelOnboardingRunState:G,gatewayControlAction:H,lastCheckedAt:I,onGatewayDraftChange:J,onWorkspaceRootDraftChange:K,onSelectedModelIdChange:L,onSaveGatewaySettings:M,onSaveWorkspaceRootSettings:N,onCheckForUpdates:O,onControlGateway:P,onOpenSetupWizard:Q,onRunModelRefresh:R,onRunModelSetDefault:S,onOpenAddModels:T,onOpenUpdateDialog:U,onOpenResetDialog:V,onOpenClawBinarySelectionModeChange:W,onOpenClawBinarySelectionPathChange:X,onSaveOpenClawBinarySettings:Y,installSummary:Z}=a,[$,_]=(0,g.useState)(null),[aa,ab]=(0,g.useState)(null),[ac,ad]=(0,g.useState)("token"),[ae,af]=(0,g.useState)(""),[ag,ah]=(0,g.useState)(null),[ai,aj]=(0,g.useState)(!1),[ak,al]=(0,g.useState)(!1),[am,an]=(0,g.useState)(!1),[ao,ap]=(0,g.useState)(!1),[aq,ar]=(0,g.useState)(()=>"openclaw"),as=!!(r.diagnostics.updateAvailable&&r.diagnostics.latestVersion),at=!!(r.diagnostics.version&&!r.diagnostics.latestVersion&&!r.diagnostics.updateError),au=r.diagnostics.version||"unknown",av=r.diagnostics.latestVersion||null,aw=r.diagnostics.updateInfo?.trim()||null,ax=r.diagnostics.updateError?.trim()||null,ay=r.diagnostics.modelReadiness.resolvedDefaultModel||r.diagnostics.modelReadiness.defaultModel||"",az=F||ay||"",aA=r.models.find(a=>a.id===az),aB=aA?.provider||r.diagnostics.modelReadiness.preferredLoginProvider||function(a){if(!a)return null;let[b]=a.split("/");return b||null}(ay)||"Not connected",aC=(0,g.useMemo)(()=>r.diagnostics.commandHistory??[],[r.diagnostics.commandHistory]).slice(0,6),aD=(0,g.useMemo)(()=>({ok:aC.filter(a=>"ok"===a.status).length,failed:aC.filter(a=>"ok"!==a.status).length}),[aC]),aE=(0,g.useMemo)(()=>{var a,b,c,d;let e,f,g;return a=r.diagnostics.transport,e=Object.values(a?.fallbackCounts??{}).reduce((a,b)=>Number.isFinite(b)&&b>0?a+b:a,0),f=function(a){switch(a){case"cli-forced":return"CLI forced";case"connected":return"Connected";case"connecting":return"Connecting";case"idle":return"Idle";case"closed":return"Closed";case"error":return"Error";default:return"Unknown"}}(a?.connectionState),g=function(a){switch(a){case"live":return"Live";case"retrying":return"Retrying";default:return"Connecting"}}(u),{modeLabel:"native-ws"===(b=a?.mode)?"Native WS":"cli"===b?"CLI forced":"Unknown",connectionLabel:f,protocolLabel:"number"==typeof(c=a?.protocolVersion)&&Number.isFinite(c)?`v${c}`:"Unknown",streamLabel:g,fallbackTotal:e,lastConnectedLabel:d0(a?.lastConnectedAt),lastDisconnectedLabel:d0(a?.lastDisconnectedAt),lastNativeError:a?.lastNativeError?.trim()||null,statusTone:"retrying"===(d={connectionState:a?.connectionState,mode:a?.mode,streamState:u,fallbackTotal:e}).streamState||"error"===d.connectionState?"danger":"cli"===d.mode||"cli-forced"===d.connectionState||"closed"===d.connectionState||"connecting"===d.connectionState||d.fallbackTotal>0?"warning":"connected"===d.connectionState&&"live"===d.streamState?"success":"neutral"}},[u,r.diagnostics.transport]),aF=r.diagnostics.capabilityMatrix,aG=aF?.compatibility,aH=aF?.fallbackDiagnostics?.slice(0,4)??[],aI=$?$.native.ok?"Authenticated":function(a){switch(a){case"auth":return"Needs credential";case"scope-limited":return"Needs scope repair";case"disabled":return"Disabled";case"unreachable":return"Unreachable";case"timeout":return"Timed out";case"malformed-response":return"Invalid response";default:return"Check failed"}}($.native.kind):"Unknown",aJ=(0,g.useCallback)(async()=>{aj(!0),ab(null);try{_(await ea())}catch(a){ab(a instanceof Error?a.message:"Unable to check Gateway auth status.")}finally{aj(!1)}},[]),aK=async()=>{let a=ae.trim();if(!a)return void ab("Gateway token/password is required.");al(!0),ab(null),ah(null);try{let b=await fetch("/api/settings/gateway",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"saveCredential",kind:ac,value:a})});if(!b.ok){let a=await b.json().catch(()=>null);throw Error(a?.error||"Gateway credential could not be saved.")}let c=await b.json();_(c.authStatus),af(""),ah("Saved to .env.local and applied to the current AgentOS server session.")}catch(a){ab(a instanceof Error?a.message:"Unable to save Gateway credential.")}finally{al(!1)}},aL=async()=>{an(!0),ab(null),ah(null);try{let a=await fetch("/api/settings/gateway",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"generateLocalToken"})});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"Gateway token could not be generated.")}let b=await a.json();_(b.authStatus),ah("Generated a local Gateway token and applied it to AgentOS.")}catch(a){ab(a instanceof Error?a.message:"Unable to generate Gateway token.")}finally{an(!1)}},aM=async()=>{ap(!0),ab(null),ah(null);try{let a=await fetch("/api/settings/gateway",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"repairDeviceAccess"})});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"Gateway device access could not be repaired.")}let b=await a.json();_(b.authStatus),ah("Local Gateway device access repaired for AgentOS.")}catch(a){ab(a instanceof Error?a.message:"Unable to repair Gateway access.")}finally{ap(!1)}};return(0,d.jsx)("main",{className:s("relative z-10 min-h-screen","light"===t?"text-[#2c211a]":"text-slate-100"),children:(0,d.jsx)("section",{className:"min-w-0 px-4 pb-8 pt-[86px] sm:px-6 lg:ml-[384px] lg:mr-[84px] lg:px-7 xl:px-8",children:(0,d.jsxs)("div",{className:"mx-auto max-w-[1160px] 2xl:max-w-[1240px]",children:[(0,d.jsx)("div",{className:"flex flex-col",children:(0,d.jsxs)(dT(),{href:"/",className:s("mb-2 inline-flex w-fit items-center gap-2 rounded-full border px-3 py-2 text-xs shadow-[0_12px_28px_rgba(91,63,43,0.08)] lg:hidden","light"===t?"border-[#decfc2] bg-[#fffaf3]/86 text-[#6f5a4b]":"border-white/10 bg-[#0e1726]/96 text-slate-200 shadow-[0_12px_28px_rgba(0,0,0,0.24)]"),children:[(0,d.jsx)(dg.A,{className:"h-3.5 w-3.5"}),"Mission Control"]})}),(0,d.jsxs)("div",{className:"mt-5 flex flex-col gap-4",children:["openclaw"===aq?(0,d.jsx)("section",{id:"openclaw",className:"scroll-mt-24",children:(0,d.jsxs)("div",{className:s("panel-surface panel-glow min-h-full overflow-hidden rounded-[22px] p-4","light"===t?"border-white/[0.08] bg-[linear-gradient(180deg,rgba(12,19,32,0.98),rgba(6,10,18,0.97))] text-white":"border-white/[0.08] bg-[linear-gradient(180deg,rgba(16,24,38,0.98),rgba(7,11,18,0.96))] text-slate-100"),children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:s("flex h-10 w-10 shrink-0 items-center justify-center rounded-full border","light"===t?"border-white/10 bg-white/[0.04] text-emerald-200":"border-cyan-300/15 bg-cyan-300/10 text-cyan-200"),children:(0,d.jsx)(dU.A,{className:"h-4 w-4"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("h2",{className:"font-display text-lg",children:"OpenClaw"}),(0,d.jsx)("p",{className:s("mt-0.5 text-xs leading-5","light"===t?"text-white/54":"text-slate-400"),children:"Source of truth for runtime and control state."})]})]}),(0,d.jsxs)("div",{className:"mt-5 grid grid-cols-2 gap-3",children:[(0,d.jsx)(d4,{label:"Current version",value:`v${r.diagnostics.version||"unknown"}`,surfaceTheme:t,dark:!0}),(0,d.jsx)(d4,{label:"Latest available",value:r.diagnostics.latestVersion?`v${r.diagnostics.latestVersion}`:"Unknown",badge:as?"Update":"Stable",surfaceTheme:t,dark:!0})]}),(0,d.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,d.jsxs)(x,{type:"button",onClick:U,disabled:!as||"running"===E,className:"h-9 rounded-full bg-emerald-600 px-4 text-xs text-white hover:bg-emerald-500",children:["running"===E?(0,d.jsx)(h.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(dV.A,{className:"h-3.5 w-3.5"}),"Update now"]}),(0,d.jsxs)(x,{type:"button",variant:"secondary",onClick:()=>void O(),disabled:D||"running"===E,className:eg(t,"px-4"),children:[(0,d.jsx)(f.A,{className:"h-3.5 w-3.5"}),"Check"]}),(0,d.jsxs)(x,{type:"button",variant:"secondary",onClick:()=>Q(),className:eg(t,"px-4"),children:[(0,d.jsx)(dW.A,{className:"h-3.5 w-3.5"}),"Open wizard"]})]}),(0,d.jsx)(d9,{surfaceTheme:t,isCheckingForUpdates:D,isUpdateRegistryLoading:at,hasUpdateAvailable:as,currentVersion:au,latestVersion:av,updateInfo:aw,updateError:ax,lastCheckedAt:I,isUpdateRunning:"running"===E}),(0,d.jsxs)("div",{className:"mt-5 grid gap-3 border-t border-white/10 pt-4 sm:grid-cols-2",children:[(0,d.jsx)(d4,{label:"Detected install",value:Z.label||"Unknown",surfaceTheme:t,dark:!0,compact:!0}),(0,d.jsx)(d4,{label:"Resolved path",value:ed(z.resolvedPath||"openclaw",26),surfaceTheme:t,dark:!0,compact:!0})]}),(0,d.jsxs)("div",{className:"mt-4 rounded-[18px] border border-white/10 bg-white/[0.035] p-3.5",children:[(0,d.jsx)(bm,{className:ee(t),children:"OpenClaw binary mode"}),(0,d.jsx)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:d1.map(a=>(0,d.jsx)("button",{type:"button",onClick:()=>W(a.value),className:s("h-9 rounded-full border px-3 text-xs transition-colors",z.mode===a.value?"border-emerald-300 bg-emerald-300/14 text-emerald-100":"light"===t?"border-white/10 bg-white/[0.03] text-white/70 hover:bg-white/[0.08]":"border-white/10 bg-[#121d2d] text-slate-200 hover:bg-[#182538]"),children:a.label},a.value))}),"custom"===z.mode?(0,d.jsx)(y,{value:z.path??"",onChange:a=>X(a.target.value),placeholder:"/path/to/openclaw",className:ef(t,"mt-3")}):null,(0,d.jsxs)(x,{type:"button",variant:"secondary",onClick:()=>void Y(z),disabled:C,className:eg(t,"mt-3 w-full"),children:[C?(0,d.jsx)(h.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(dX.A,{className:"h-3.5 w-3.5"}),"Save selection"]})]})]})}):null,"gateway"===aq?(0,d.jsx)("section",{id:"gateway",className:"scroll-mt-24",children:(0,d.jsxs)(d3,{title:"Gateway",icon:dY.A,surfaceTheme:t,children:[(0,d.jsx)(d5,{surfaceTheme:t,rows:[["Status",`${"remote"===(b=r).diagnostics.bindMode||b.diagnostics.configuredGatewayUrl?"Remote":"Local"} / ${r.diagnostics.loaded||r.diagnostics.rpcOk?"Online":"Offline"}`],["Endpoint",r.diagnostics.gatewayUrl||"Not configured"],["Auth status",aI],["Protocol",aF?.gatewayProtocolVersion||"Unknown"],["Compatibility",function(a){switch(a?.protocol.status){case"compatible":return"Compatible";case"unsupported":return"Unsupported";default:return"Unknown"}}(aG)],["Contract audit",function(a){if(!a)return"Unknown";let b=function(a){switch(a){case"gateway-handshake":return"handshake";case"disabled":return"disabled";case"unavailable":return"unavailable";default:return a}}(a.source);switch(a.status){case"advertised":return`Advertised via ${b}`;case"verified":return`Verified via ${b}`;case"drift":return`Drift via ${b}`;default:return`Unknown via ${b}`}}(aG?.methodContract)],["Contract gaps",(c=aG?.methodContract,e=aF?.operations,c?"advertised"===c.status||"verified"===c.status?"None":"unknown"===c.status?c.reason:c.missingOperations.length>0?ec(c.missingOperations,e):`${c.missingMethodCount} methods`:"Unknown")],["Native ops",(k=aG)?`${k.nativeOperationCount} native / ${k.degradedOperationCount} fallback`:"Unknown"],["Alias ops",(l=aG?.aliasOperations,m=aF?.operations,l?l.length>0?ec(l,m):"None":"Unknown")],["Fallback ops",(p=aG?.degradedOperations,q=aF?.operations,p?p.length>0?ec(p,q):"None":"Unknown")],["Native chat",eb(aF?.nativeMissionDispatch)],["Config patch",eb(aF?.configPatch)],["Events",eb(aF?.eventBridge)]],successIndex:2}),(0,d.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)(bm,{className:ee(t),children:"Gateway endpoint"}),(0,d.jsx)(y,{value:v,onChange:a=>J(a.target.value),placeholder:"ws://127.0.0.1:18789",className:ef(t,"mt-2")})]}),(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,d.jsxs)(x,{type:"button",onClick:()=>void M(v.trim()||null),disabled:A,className:"h-9 rounded-full bg-emerald-600 text-xs text-white hover:bg-emerald-500",children:[A?(0,d.jsx)(h.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(dX.A,{className:"h-3.5 w-3.5"}),"Save endpoint"]}),(0,d.jsxs)(x,{type:"button",variant:"secondary",onClick:()=>void M(null),disabled:A,className:eg(t),children:[(0,d.jsx)(dN.A,{className:"h-3.5 w-3.5"}),"Clear"]})]})]}),(0,d.jsx)("div",{className:"mt-4 grid grid-cols-3 gap-2",children:["start","stop","restart"].map(a=>(0,d.jsxs)(x,{type:"button",variant:"secondary",onClick:()=>void P(a),disabled:null!==H,className:s(eg(t),"capitalize"),children:[H===a?(0,d.jsx)(h.A,{className:"h-3.5 w-3.5 animate-spin"}):null,a]},a))}),(0,d.jsxs)("div",{className:s("mt-4 rounded-[18px] p-3.5","light"===t?"border border-emerald-200 bg-emerald-50/55":"border border-cyan-300/12 bg-cyan-300/[0.06]"),children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)(bW.A,{className:s("mt-0.5 h-4 w-4","light"===t?"text-emerald-700":"text-cyan-200")}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:s("text-sm font-medium","light"===t?"text-[#2f624b]":"text-slate-100"),children:"Native Gateway auth"}),(0,d.jsx)("p",{className:s("mt-1 text-xs leading-5","light"===t?"text-[#6f836f]":"text-slate-400"),children:"Use local repair when AgentOS reports missing operator scopes."})]})]}),(0,d.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[(0,d.jsxs)(x,{type:"button",variant:"secondary",onClick:()=>void aM(),disabled:ao,className:eg(t,"px-3","gateway-contrast"),children:[ao?(0,d.jsx)(h.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(dW.A,{className:"h-3.5 w-3.5"}),"Repair local access"]}),(0,d.jsxs)(x,{type:"button",variant:"secondary",onClick:()=>void aL(),disabled:am,className:eg(t,"px-3","gateway-contrast"),children:[am?(0,d.jsx)(h.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(bW.A,{className:"h-3.5 w-3.5"}),"Generate token"]})]}),(0,d.jsxs)("div",{className:"mt-3 grid gap-2 sm:grid-cols-[112px_1fr]",children:[(0,d.jsxs)("select",{value:ac,onChange:a=>ad(a.target.value),className:ef(t),children:[(0,d.jsx)("option",{value:"token",children:"Token"}),(0,d.jsx)("option",{value:"password",children:"Password"})]}),(0,d.jsx)(y,{type:"password",value:ae,onChange:a=>af(a.target.value),placeholder:"Paste known credential",className:ef(t)})]}),(0,d.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[(0,d.jsxs)(x,{type:"button",onClick:()=>void aK(),disabled:ak,className:"h-9 rounded-full bg-emerald-600 text-xs text-white hover:bg-emerald-500",children:[ak?(0,d.jsx)(h.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(dX.A,{className:"h-3.5 w-3.5"}),"Save credential"]}),(0,d.jsxs)(x,{type:"button",variant:"secondary",onClick:()=>void aJ(),disabled:ai,className:eg(t,void 0,"gateway-contrast"),children:[ai?(0,d.jsx)(h.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(f.A,{className:"h-3.5 w-3.5"}),"Test auth"]})]}),aa||ag||$?.native.issue?(0,d.jsx)("p",{className:s("mt-3 text-xs leading-5",aa?"light"===t?"text-red-700":"text-rose-300":"light"===t?"text-[#52735e]":"text-slate-400"),children:aa||ag||$?.native.issue}):null]})]})}):null,"models"===aq?(0,d.jsx)("section",{id:"models",className:"scroll-mt-24",children:(0,d.jsxs)(d3,{title:"Models",icon:dZ.A,surfaceTheme:t,children:[(0,d.jsx)(d5,{surfaceTheme:t,rows:[["Default model",ay||"Not selected"],["Provider",aB],["Available",`${r.diagnostics.modelReadiness.availableModelCount} of ${r.diagnostics.modelReadiness.totalModelCount}`]]}),(0,d.jsxs)("div",{className:"mt-4",children:[(0,d.jsx)(bm,{className:ee(t),children:"Model"}),(0,d.jsxs)("select",{value:az,onChange:a=>L(a.target.value),className:ef(t,"mt-2"),children:[(0,d.jsx)("option",{value:"",children:"Choose model"}),r.models.map(a=>(0,d.jsx)("option",{value:a.id,children:a.name||a.id},a.id))]})]}),(0,d.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-2",children:[(0,d.jsxs)(x,{type:"button",onClick:()=>void S(az),disabled:!az||"running"===G,className:"h-9 rounded-full bg-emerald-600 text-xs text-white hover:bg-emerald-500",children:["running"===G?(0,d.jsx)(h.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(n.A,{className:"h-3.5 w-3.5"}),"Use selected"]}),(0,d.jsx)(x,{type:"button",variant:"secondary",onClick:()=>T(null),className:eg(t),children:"Add models"})]}),(0,d.jsxs)(x,{type:"button",variant:"secondary",onClick:()=>void R(),disabled:"running"===G,className:s(eg(t),"mt-3 w-full"),children:[(0,d.jsx)(f.A,{className:"h-3.5 w-3.5"}),"Refresh models"]})]})}):null,"workspace"===aq?(0,d.jsx)("section",{id:"workspace",className:"scroll-mt-24",children:(0,d.jsxs)(d3,{title:"Workspace",icon:d$.A,surfaceTheme:t,children:[(0,d.jsxs)("div",{children:[(0,d.jsx)(bm,{className:ee(t),children:"Workspace root"}),(0,d.jsxs)("div",{className:"mt-2 flex gap-2",children:[(0,d.jsx)(y,{value:w,onChange:a=>K(a.target.value),placeholder:"~/Documents/AgentOS",className:ef(t)}),(0,d.jsx)("button",{type:"button","aria-label":"Copy workspace root",onClick:()=>{var a;return a=w||r.diagnostics.workspaceRoot,void("u">typeof navigator&&navigator.clipboard&&navigator.clipboard.writeText(a))},className:s("flex h-10 w-10 shrink-0 items-center justify-center rounded-[16px] border","light"===t?"border-[#e2d1c4] bg-white text-[#7b6353]":"border-white/10 bg-[#121d2d] text-slate-200 hover:bg-[#182538]"),children:(0,d.jsx)(j.A,{className:"h-3.5 w-3.5"})})]})]}),(0,d.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-2",children:[(0,d.jsxs)(x,{type:"button",onClick:()=>void N(w.trim()||null),disabled:B,className:"h-9 rounded-full bg-emerald-600 text-xs text-white hover:bg-emerald-500",children:[B?(0,d.jsx)(h.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(dX.A,{className:"h-3.5 w-3.5"}),"Save"]}),(0,d.jsxs)(x,{type:"button",variant:"secondary",onClick:()=>void N(null),disabled:B,className:eg(t),children:[(0,d.jsx)(dN.A,{className:"h-3.5 w-3.5"}),"Reset"]})]}),(0,d.jsxs)("div",{className:s("mt-4 rounded-[18px] p-3.5","light"===t?"border border-[#eadbcf] bg-[#fbf4ec]/78":"border border-white/[0.08] bg-[#101a2a]/92"),children:[(0,d.jsx)("p",{className:ee(t),children:"Current root"}),(0,d.jsx)("p",{className:s("mt-2 break-all text-sm","light"===t?"text-[#4f3e34]":"text-slate-200"),children:ed(r.diagnostics.workspaceRoot,56)})]})]})}):null,"diagnostics"===aq?(0,d.jsx)("section",{id:"diagnostics",className:"scroll-mt-24",children:(0,d.jsx)(d3,{title:"Diagnostics",icon:i.A,surfaceTheme:t,action:(0,d.jsxs)("span",{className:s("inline-flex items-center gap-2 rounded-full border px-3 py-1.5 text-xs","light"===t?"border-[#e2d1c4] bg-white text-[#7b6353]":"border-white/[0.08] bg-[#101a2a]/92 text-slate-300"),children:[(0,d.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),aD.ok," OK",aD.failed?(0,d.jsxs)("span",{className:"text-red-600",children:[aD.failed," failed"]}):null]}),children:(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)(d7,{summary:aE,surfaceTheme:t}),aH.length?(0,d.jsxs)("div",{className:s("border-l-2 py-1 pl-3","light"===t?"border-amber-300":"border-amber-300/45"),children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:ee(t),children:"Gateway fallback diagnostics"}),(0,d.jsxs)("span",{className:s("text-[11px]","light"===t?"text-[#8a7464]":"text-slate-400"),children:[aH.length," recent"]})]}),(0,d.jsx)("div",{className:"mt-2 space-y-2",children:aH.map(a=>(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("span",{className:s("text-sm font-medium","light"===t?"text-[#3b2d24]":"text-slate-100"),children:a.operationLabel}),(0,d.jsx)("code",{className:s("rounded-full px-2 py-0.5 text-[10px]","light"===t?"bg-[#f3e5d8] text-[#7b6353]":"bg-white/[0.06] text-slate-300"),children:a.operation}),(0,d.jsx)("span",{className:s("text-[11px]","light"===t?"text-amber-700":"text-amber-200"),children:function(a){switch(a){case"auth":return"Needs credential";case"scope-limited":return"Needs scope repair";case"protocol-mismatch":return"Protocol mismatch";case"unsupported":return"Unsupported method";case"disabled":return"Disabled";case"unreachable":return"Unreachable";case"timeout":return"Timed out";case"malformed-response":return"Invalid response";default:return"Gateway fallback"}}(a.kind)})]}),(0,d.jsx)("p",{className:s("mt-1 text-xs","light"===t?"text-[#7b6353]":"text-slate-400"),children:a.issue}),(0,d.jsx)("p",{className:s("mt-0.5 text-xs","light"===t?"text-[#8a7464]":"text-slate-500"),children:a.recovery})]},`${a.at}-${a.operation}`))})]}):null,aC.length?aC.map(a=>{var b;let c;return(0,d.jsxs)("details",{className:s("group rounded-[16px] border","light"===t?"border-[#e7d8ca] bg-[#fffdf9]":"border-white/[0.08] bg-[#101a2a]/92"),children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-3 px-3.5 py-2.5",children:[(0,d.jsxs)("code",{className:s("min-w-0 flex-1 truncate font-mono text-[11px]","light"===t?"text-[#3b2d24]":"text-slate-200"),children:[a.command," ",a.args.join(" ")]}),(0,d.jsx)("span",{className:s("inline-flex shrink-0 items-center gap-1.5 rounded-full border px-2 py-1 text-[9px] uppercase tracking-[0.12em]","ok"===a.status?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-red-200 bg-red-50 text-red-700"),children:a.status}),(0,d.jsxs)("span",{className:s("hidden text-xs sm:inline","light"===t?"text-[#9a8271]":"text-slate-400"),children:[a.durationMs," ms"]}),(0,d.jsx)(a4.A,{className:s("h-4 w-4 transition-transform group-open:rotate-180","light"===t?"text-[#9a8271]":"text-slate-400")})]}),(0,d.jsxs)("div",{className:s("border-t p-3.5","light"===t?"border-[#eadbcf]":"border-white/[0.08]"),children:[(0,d.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,d.jsx)(d6,{title:"stdout",value:a.stdoutPreview,surfaceTheme:t}),(0,d.jsx)(d6,{title:"stderr",value:a.stderrPreview,surfaceTheme:t})]}),(0,d.jsxs)("p",{className:s("mt-3 text-xs","light"===t?"text-[#8a7464]":"text-slate-400"),children:["Exit code: ",a.exitCode??"n/a"," | Started: ",Number.isNaN((c=new Date(b=a.startedAt)).getTime())?b:c.toLocaleString()]})]})]},a.id)}):(0,d.jsx)(d8,{title:"No recent CLI calls",detail:"Diagnostics will appear after AgentOS uses fallback commands.",surfaceTheme:t})]})})}):null,"agents"===aq?(0,d.jsx)("section",{id:"agents",className:"scroll-mt-24",children:(0,d.jsxs)(d3,{title:"Agents",icon:a7.A,surfaceTheme:t,children:[(0,d.jsx)(d5,{surfaceTheme:t,rows:[["Agents",String(r.agents.length)],["Workspaces",String(r.workspaces.length)],["Active runtimes",String(r.runtimes.filter(a=>"running"===a.status).length)]]}),(0,d.jsx)(x,{asChild:!0,variant:"secondary",className:s(eg(t),"mt-4 w-full"),children:(0,d.jsx)(dT(),{href:"/",children:"Open mission control"})})]})}):null,"advanced"===aq?(0,d.jsx)("section",{id:"advanced",className:"scroll-mt-24",children:(0,d.jsxs)(d3,{title:"Advanced",icon:d_.A,surfaceTheme:t,children:[(0,d.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,d.jsx)(d4,{label:"Install method",value:r.diagnostics.updateInstallKind||Z.label||"Unknown",surfaceTheme:t}),(0,d.jsx)(d4,{label:"Updater",value:r.diagnostics.updatePackageManager||"Unknown",surfaceTheme:t}),(0,d.jsx)(d4,{label:"Last checked",value:I?new Date(I).toLocaleTimeString():"Not checked",surfaceTheme:t})]}),(0,d.jsxs)("div",{className:s("mt-4 rounded-[18px] p-3.5","light"===t?"border border-[#eadbcf] bg-[#fbf4ec]/78":"border border-white/[0.08] bg-[#101a2a]/92"),children:[(0,d.jsx)("p",{className:ee(t),children:"Install root"}),(0,d.jsx)("p",{className:s("mt-2 break-all text-sm","light"===t?"text-[#4f3e34]":"text-slate-200"),children:ed(r.diagnostics.updateRoot||Z.root||"Not detected",80)})]})]})}):null,"danger-zone"===aq?(0,d.jsx)("section",{id:"danger-zone",className:"scroll-mt-24",children:(0,d.jsx)("div",{className:s("rounded-[22px] p-4 shadow-[0_18px_44px_rgba(185,28,28,0.06)]","light"===t?"border border-red-200 bg-red-50/58":"border border-rose-400/20 bg-rose-500/[0.08]"),children:(0,d.jsxs)("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:s("flex h-10 w-10 shrink-0 items-center justify-center rounded-full border","light"===t?"border-red-200 bg-white text-red-600":"border-rose-300/20 bg-rose-400/10 text-rose-200"),children:(0,d.jsx)(o.A,{className:"h-4 w-4"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h2",{className:s("font-display text-lg","light"===t?"text-red-700":"text-rose-100"),children:"Danger Zone"}),(0,d.jsx)("p",{className:s("mt-1.5 max-w-2xl text-sm leading-6","light"===t?"text-red-700/72":"text-rose-100/80"),children:"These actions are destructive and cannot be undone. Confirmation is required before anything runs."})]})]}),(0,d.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2 md:min-w-[340px]",children:[(0,d.jsxs)(x,{type:"button",variant:"destructive",onClick:()=>V("mission-control"),className:"h-9 rounded-full bg-red-600 text-xs text-white hover:bg-red-500",children:[(0,d.jsx)(dO.A,{className:"h-3.5 w-3.5"}),"Reset AgentOS"]}),(0,d.jsxs)(x,{type:"button",variant:"secondary",onClick:()=>V("full-uninstall"),className:s("h-9 rounded-full text-xs","light"===t?"border-red-200 bg-white text-red-700 hover:bg-red-50":"border-rose-300/20 bg-[#121d2d] text-rose-100 hover:bg-[#182538]"),children:[(0,d.jsx)(dO.A,{className:"h-3.5 w-3.5"}),"Full uninstall"]})]})]})})}):null]})]})})})}function d3({title:a,icon:b,children:c,action:e,surfaceTheme:f}){return(0,d.jsxs)("div",{className:s("min-h-full rounded-[22px] p-4 shadow-[0_20px_54px_rgba(101,74,54,0.07)] backdrop-blur-xl","light"===f?"border-[#dfd0c2]/90 bg-[#fffaf3]/80 text-[#2d211b]":"border-white/[0.08] bg-[#0d1624]/96 text-slate-100 shadow-[0_20px_54px_rgba(0,0,0,0.26)]"),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("span",{className:"light"===f?"flex h-10 w-10 items-center justify-center rounded-full border border-emerald-200 bg-emerald-50 text-emerald-700":"flex h-10 w-10 items-center justify-center rounded-full border border-cyan-300/15 bg-cyan-300/10 text-cyan-200",children:(0,d.jsx)(b,{className:"h-4 w-4"})}),(0,d.jsx)("h2",{className:s("font-display text-lg","light"===f?"text-[#2d211b]":"text-slate-100"),children:a})]}),e]}),(0,d.jsx)("div",{className:"mt-4",children:c})]})}function d4({label:a,value:b,badge:c,surfaceTheme:e,dark:f=!1,compact:g=!1}){let h=f||"dark"===e;return(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:s("text-[11px]",h?"text-white/54":"text-[#8a7464]"),children:a}),(0,d.jsxs)("div",{className:"mt-1.5 flex items-center gap-2",children:[(0,d.jsx)("p",{className:s("min-w-0 truncate font-medium",g?"text-sm":"text-[1.05rem]",h?"text-white":"text-[#2f251f]"),title:b,children:b}),c?(0,d.jsx)("span",{className:s("shrink-0 rounded-full border px-2 py-0.5 text-[9px] uppercase tracking-[0.12em]",h?"border-emerald-300/20 bg-emerald-300/10 text-emerald-100":"border-emerald-200 bg-emerald-50 text-emerald-700"),children:c}):null]})]})}function d5({rows:a,successIndex:b,surfaceTheme:c}){let e="dark"===c;return(0,d.jsx)("div",{className:s("overflow-hidden rounded-[18px] border","light"===c?"border-[#eadbcf] bg-[#fffdf9]":"border-white/[0.08] bg-[#0f1826]"),children:a.map(([a,f],g)=>(0,d.jsxs)("div",{className:s("flex items-center justify-between gap-3 px-3.5 py-2.5 last:border-b-0","light"===c?"border-b border-[#eadbcf]":"border-b border-white/[0.08]"),children:[(0,d.jsx)("span",{className:s("text-sm",e?"text-slate-400":"text-[#8a7464]"),children:a}),(0,d.jsx)("span",{className:s("min-w-0 truncate text-right text-sm",e?"text-slate-100":"text-[#352820]",b===g?e?"rounded-full border border-emerald-300/20 bg-emerald-300/10 px-2 py-1 text-xs text-emerald-100":"rounded-full border border-emerald-200 bg-emerald-50 px-2 py-1 text-xs text-emerald-700":""),title:f,children:f})]},a))})}function d6({title:a,value:b,surfaceTheme:c}){let e="dark"===c;return(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:ee(c),children:a}),(0,d.jsx)("pre",{className:s("mt-2 max-h-40 overflow-auto rounded-[14px] border p-3 text-xs",e?"border-white/[0.08] bg-[#0d1624]/92 text-slate-200":"border-[#eadbcf] bg-[#fbf4ec] text-[#4b3a30]"),children:b||"No output"})]})}function d7({summary:a,surfaceTheme:b}){var c,e;let f;return(0,d.jsxs)("div",{className:s("rounded-[18px] border p-3.5",eh(b)),children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:ee(b),children:"Gateway Transport"}),(0,d.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-2",children:[(0,d.jsx)("p",{className:s("font-medium","light"===b?"text-[#2f251f]":"text-slate-100"),children:a.connectionLabel}),(0,d.jsx)("span",{className:(c=a.statusTone,e=b,f="inline-flex shrink-0 items-center rounded-full border px-2 py-1 text-[9px] uppercase tracking-[0.12em]","success"===c?s(f,"light"===e?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/10 text-emerald-100"):"danger"===c?s(f,"light"===e?"border-red-200 bg-red-50 text-red-700":"border-rose-300/20 bg-rose-300/10 text-rose-100"):"warning"===c?s(f,"light"===e?"border-amber-200 bg-amber-50 text-amber-700":"border-amber-300/20 bg-amber-300/10 text-amber-100"):s(f,"light"===e?"border-[#e2d1c4] bg-white text-[#7b6353]":"border-white/[0.08] bg-[#101a2a]/92 text-slate-300")),children:a.modeLabel})]})]}),(0,d.jsxs)("div",{className:"text-left sm:text-right",children:[(0,d.jsx)("p",{className:ee(b),children:"Snapshot stream"}),(0,d.jsx)("p",{className:s("mt-1.5 text-sm","light"===b?"text-[#4f3e34]":"text-slate-200"),children:a.streamLabel})]})]}),(0,d.jsxs)("div",{className:"mt-3 grid gap-3 sm:grid-cols-4",children:[(0,d.jsx)(d4,{label:"Protocol",value:a.protocolLabel,surfaceTheme:b,dark:"dark"===b,compact:!0}),(0,d.jsx)(d4,{label:"Fallbacks",value:String(a.fallbackTotal),badge:a.fallbackTotal>0?"Used":"Clean",surfaceTheme:b,dark:"dark"===b,compact:!0}),(0,d.jsx)(d4,{label:"Last connected",value:a.lastConnectedLabel,surfaceTheme:b,dark:"dark"===b,compact:!0}),(0,d.jsx)(d4,{label:"Last disconnected",value:a.lastDisconnectedLabel,surfaceTheme:b,dark:"dark"===b,compact:!0})]}),a.lastNativeError?(0,d.jsx)("div",{className:"mt-3",children:(0,d.jsx)(d6,{title:"Last native error",value:a.lastNativeError,surfaceTheme:b})}):null]})}function d8({title:a,detail:b,surfaceTheme:c}){return(0,d.jsxs)("div",{className:s("rounded-[18px] border border-dashed p-4 text-center","light"===c?"border-[#decfc2] bg-[#fbf4ec]/60":"border-white/[0.08] bg-[#0d1624]/60"),children:[(0,d.jsx)("p",{className:s("text-sm font-medium","light"===c?"text-[#5f493b]":"text-slate-100"),children:a}),(0,d.jsx)("p",{className:s("mt-1 text-xs","light"===c?"text-[#8a7464]":"text-slate-400"),children:b})]})}function d9({surfaceTheme:a,isCheckingForUpdates:b,isUpdateRegistryLoading:c,hasUpdateAvailable:e,currentVersion:f,latestVersion:g,updateInfo:i,updateError:j,lastCheckedAt:k,isUpdateRunning:l}){let m=b||l,n=b?"Checking registry":l?"Updating":e?"Update available":j?"Check failed":c?"Registry loading":"Up to date",o=e?"light"===a?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-300/20 bg-emerald-300/10 text-emerald-100":j?"light"===a?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-300/20 bg-rose-300/10 text-rose-100":m||c?"light"===a?"border-amber-300 bg-amber-50 text-amber-700":"border-amber-300/20 bg-amber-300/10 text-amber-100":"light"===a?"border-slate-300 bg-white text-slate-600":"border-white/10 bg-[#0f1826] text-slate-300",p=b?"Refreshing OpenClaw update registry...":l?"Installing the selected OpenClaw update.":e?"A newer release is available and ready to install.":j?"OpenClaw returned an error while checking updates.":c?"OpenClaw has not reported a latest release yet.":"No newer release is currently available.";return(0,d.jsxs)("div",{className:s("mt-3 rounded-[20px] border p-3.5",eh(a)),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:s("text-[10px] uppercase tracking-[0.18em]",ei(a)),children:"Update status"}),(0,d.jsxs)("div",{className:"mt-1 flex items-center gap-2",children:[m?(0,d.jsx)(h.A,{className:"h-3.5 w-3.5 animate-spin text-emerald-400"}):null,(0,d.jsx)("p",{className:s("font-medium","light"===a?"text-[#2f251f]":"text-slate-100"),children:n}),(0,d.jsx)("span",{className:s("rounded-full border px-2 py-0.5 text-[9px] uppercase tracking-[0.12em]",o),children:e?"Ready":m?"Working":j?"Attention":"Stable"})]})]}),(0,d.jsxs)("div",{className:"text-right",children:[(0,d.jsx)("p",{className:s("text-[10px] uppercase tracking-[0.18em]",ei(a)),children:"Last checked"}),(0,d.jsx)("p",{className:s("mt-1 text-[11px]","light"===a?"text-[#6b5546]":"text-slate-300"),children:k?new Date(k).toLocaleTimeString():"Not yet"})]})]}),(0,d.jsx)("div",{className:"mt-3 h-2 overflow-hidden rounded-full bg-black/10 dark:bg-white/10",children:(0,d.jsx)("div",{className:s("h-full rounded-full transition-all",m?"w-1/2 animate-pulse bg-emerald-400/80":e?"w-full bg-emerald-500":j?"w-2/3 bg-rose-400":"w-5/6 bg-slate-400/70")})}),(0,d.jsxs)("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:[(0,d.jsx)(d4,{label:"Current version",value:`v${f}`,surfaceTheme:a,dark:"dark"===a,compact:!0}),(0,d.jsx)(d4,{label:"Latest available",value:g?`v${g}`:"Unknown",badge:e?"Ready":j?"Error":m||c?"Loading":"Stable",surfaceTheme:a,dark:"dark"===a,compact:!0})]}),(0,d.jsxs)("div",{className:s("mt-3 rounded-[18px] border p-3 text-[11px] leading-5","light"===a?"border-[#eadbcf] bg-[#fffdf9] text-[#5a4638]":"border-white/[0.08] bg-[#0d1624] text-slate-300"),children:[(0,d.jsx)("p",{className:s("text-[10px] uppercase tracking-[0.18em]",ei(a)),children:"Details"}),(0,d.jsx)("p",{className:"mt-1.5",children:p}),i?(0,d.jsx)("p",{className:"mt-1.5 opacity-90",children:i}):null,j?(0,d.jsx)("p",{className:s("mt-1.5","light"===a?"text-rose-700":"text-rose-200"),children:j}):null,e?(0,d.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2 text-[10px] uppercase tracking-[0.16em]",children:[(0,d.jsx)("span",{className:s("rounded-full border px-2 py-1",o),children:"Update ready"}),(0,d.jsx)("span",{className:s("rounded-full border px-2 py-1",ei(a)),children:"Review before install"})]}):null]})]})}async function ea(){let a=await fetch("/api/settings/gateway",{method:"GET",cache:"no-store"});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"Unable to check Gateway auth status.")}return(await a.json()).authStatus}function eb(a){return"supported"===a?"Supported":"unsupported"===a?"Fallback":"Unknown"}function ec(a,b){let c=a.slice(0,3).map(a=>(function(a,b){let[c,d]=a.split(/:\s*/,2),e=b?.[c]?.label??((c||a).replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[._-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,a=>a.toUpperCase())||"Gateway operation");return d?`${e} via ${d}`:e})(a,b)),d=a.length>c.length?` +${a.length-c.length}`:"";return`${a.length}: ${c.join(", ")}${d}`}function ed(a,b){let c=M(a);return c.length<=b?c:`${c.slice(0,Math.max(0,b-3))}...`}function ee(a){return s("text-[10px] uppercase tracking-[0.18em]","light"===a?"text-[#9a8271]":"text-slate-400")}function ef(a,b){return s("h-10 rounded-[16px] px-3 text-sm outline-none",b,"light"===a?"border-[#e2d1c4] bg-[#fffdf9] text-[#2d211b] placeholder:text-[#ad9889]":"border-white/10 bg-[#0f1826] text-slate-100 placeholder:text-slate-500")}function eg(a,b,c){return s("h-9 rounded-full px-3 text-xs",b,"light"===a?"border-[#d7c4b6] bg-white text-[#6b5546] hover:bg-[#f4e9de]":"gateway-contrast"===c?"border-emerald-300/15 bg-[#0f1826] text-slate-100 hover:bg-[#182538]":"border-white/10 bg-[#121d2d] text-slate-200 hover:bg-[#182538]")}function eh(a){return"light"===a?"border-[#eadbcf] bg-[#f9f1e8]/80":"border-white/[0.08] bg-[#101a2a]/92"}function ei(a){return"light"===a?"text-[#8c7564]":"text-slate-400"}var ej=c(19099),ek=c(45577),el=c(78606),em=c(90110),en=c(72419),eo=c(24703);function ep({tone:a,pulse:b=!1,className:c}){return(0,d.jsxs)("span",{className:s("relative inline-flex h-2.5 w-2.5 items-center justify-center",c),children:[b?(0,d.jsx)(a6.P.span,{className:s("absolute inset-0 rounded-full",a),animate:{opacity:[.4,0],scale:[1,2.2]},transition:{duration:1.8,repeat:1/0,ease:"easeOut"}}):null,(0,d.jsx)("span",{className:s("relative inline-flex h-2.5 w-2.5 rounded-full",a)})]})}let eq=[{id:"openclaw",label:"OpenClaw",icon:ek.A},{id:"gateway",label:"Gateway",icon:bU.A},{id:"models",label:"Models",icon:bU.A},{id:"workspace",label:"Workspace",icon:el.A},{id:"agents",label:"Agents",icon:a7.A},{id:"diagnostics",label:"Diagnostics",icon:o.A},{id:"advanced",label:"Advanced",icon:d_.A},{id:"danger-zone",label:"Danger Zone",icon:o.A,danger:!0}];function er({snapshot:a,surfaceTheme:b,activeWorkspaceId:c,requestedAgentAction:e,connectionState:i,collapsed:j,modelManager:k,onToggleCollapsed:l,onSelectWorkspace:m,onRefresh:n,onRunModelRefresh:p,onRunModelDiscover:q,onRunModelSetDefault:r,onConnectModelProvider:t,onOpenModelSetup:v,onOpenAddModels:w,onEditWorkspace:z,onSnapshotChange:A,onAgentCreatedVisible:B,settingsMode:C=!1}){var D;let E=(0,ej.useRouter)(),[F,G]=(0,g.useState)(!1),K=function(a){switch(a){case"healthy":return"text-emerald-300";case"degraded":return"text-amber-200";default:return"text-rose-200"}}(a.diagnostics.health),L="healthy"===a.diagnostics.health?"bg-emerald-300":"degraded"===a.diagnostics.health?"bg-amber-200":"bg-rose-300",N=a.diagnostics.gatewayUrl.replace(/^wss?:\/\//,"").replace(/\/$/,""),O=a.diagnostics.issues.find(a=>{var b;return b=a,!(/Reusing the last successful payload while a slow OpenClaw command refreshes in the background\./.test(b)||/Reusing the last successful gateway status after a transient OpenClaw check failure\./.test(b)||/^gateway\.[^:]+: Gateway-first request fell back to CLI \(unsupported\):/.test(b)||/^gateway\.(?:agents\.list|models\.list|sessions\.list|status|health): Gateway-first request fell back to CLI \(timeout\):/i.test(b)||/^gateway\.config\.(?:get|patch|apply|set|unset): Gateway-first request fell back to CLI \(timeout\):/i.test(b)||/^gateway\.[^:]+: Gateway-first request fell back to CLI \([^)]*\): .*unknown method:/i.test(b))})??null,P=b8(O),[Q,R]=(0,g.useState)(!1),[S,T]=(0,g.useState)(!1),[U,V]=(0,g.useState)(!1),[W,X]=(0,g.useState)(!1),[Z,$]=(0,g.useState)(!1),[_,aa]=(0,g.useState)(!1),[ab,ac]=(0,g.useState)(!1),[ad,af]=(0,g.useState)(!1),[ag,ah]=(0,g.useState)(null),[ai,ao]=(0,g.useState)([]),[ap,ar]=(0,g.useState)(null),[as,at]=(0,g.useState)(""),[au,av]=(0,g.useState)(null),[aw,ax]=(0,g.useState)(""),[ay,az]=(0,g.useState)(()=>C?"settings":"workspaces"),[aA,aB]=(0,g.useState)("");(0,g.useRef)(null);let aC=(0,g.useMemo)(()=>a.agents.filter(a=>!c||a.workspaceId===c).sort((a,b)=>a.workspaceId!==b.workspaceId?a.workspaceId.localeCompare(b.workspaceId):J(a).localeCompare(J(b))),[a.agents,c]),aD=c?a.workspaces.find(a=>a.id===c)??null:null,aE=(0,g.useMemo)(()=>a.models.filter(a=>!1!==a.available&&!a.missing),[a.models]),aF=(0,g.useMemo)(()=>k.discoveredModels.filter(b=>!a.models.some(a=>a.id===b.modelId)),[k.discoveredModels,a.models]),aG=aA&&(aE.some(a=>a.id===aA)||aF.some(a=>a.modelId===aA))?aA:(D=a).diagnostics.modelReadiness.resolvedDefaultModel||D.diagnostics.modelReadiness.defaultModel||D.models.find(a=>!1!==a.available&&!a.missing)?.id||"",aH=!!ag&&(S||"monitoring"===ag.policy.preset),aJ=()=>{F&&G(!1),j&&l()},aW=async a=>{aa(!0);try{let b=await fetch("/api/settings/gateway",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:a.apiAction})}),c=await b.json().catch(()=>null);if(!b.ok)throw Error(c?.error||"Gateway access could not be repaired.");if(c?.authStatus?.native&&!1===c.authStatus.native.ok)throw Error(c.authStatus.native.issue||"Gateway access still needs attention.");aq.o.success(`${a.label} repaired.`,{description:"Refreshing OpenClaw status."}),await n().catch(()=>void 0)}catch(a){aq.o.error("Gateway repair failed.",{description:a instanceof Error?a.message:"Unable to repair Gateway access."})}finally{aa(!1)}},aX=(0,g.useCallback)(a=>{if(C&&"settings"!==a){globalThis.localStorage?.setItem("mission-control-sidebar-open","true"),E.push(`/#${a}`);return}"settings"!==a||C?az(a):E.push("/settings")},[E,C]),aY=[{id:"overview",label:"Overview",icon:em.A},{id:"workspaces",label:"Workspaces",icon:el.A,badge:String(a.workspaces.length)},{id:"agents",label:"Agents",icon:a7.A,badge:String(aC.length)},{id:"models",label:"Models",icon:bU.A,badge:String(a.models.length)},{id:"settings",label:"Settings",icon:d_.A}],aZ=(0,g.useMemo)(()=>ap?a.agents.filter(a=>a.workspaceId===ap.id):[],[ap,a.agents]),a$=(0,g.useMemo)(()=>aZ.filter(a=>"engaged"===a.status||"monitoring"===a.status||"ready"===a.status),[aZ]),a_=(0,g.useMemo)(()=>ap?a.runtimes.filter(a=>a.workspaceId===ap.id):[],[ap,a.runtimes]),a0=(0,g.useMemo)(()=>au?a.runtimes.filter(a=>a.agentId===au.id):[],[au,a.runtimes]),a1=au?a.workspaces.find(a=>a.id===au.workspaceId)??null:null,a2=!!au&&("engaged"===au.status||"monitoring"===au.status||"ready"===au.status),a3=(0,g.useCallback)(a=>{av(a),ax(""),ac(!0)},[]),a5=a=>{R(a),a||(ah(null),ao([]),T(!1))},a6=(0,g.useCallback)(b=>{let c=bg(a,b.workspaceId,b.id);ah({...function(a,b={}){let c=aP(b.policy?.preset??"worker",b.policy),d=aI[c.preset],e=bp(c.preset,b.heartbeat);return{id:b.id??"",workspaceId:a,modelId:b.modelId??"",name:b.name??d.defaultName,emoji:b.emoji??d.defaultEmoji,theme:b.theme??d.defaultTheme,avatar:b.avatar??"",policy:c,heartbeat:e,channelIds:Array.from(new Set((b.channelIds??[]).filter(a=>"string"==typeof a&&!!a.trim())))}}(b.workspaceId,{id:b.id,modelId:"unassigned"===b.modelId?"":b.modelId,name:J(b),emoji:b.identity.emoji??"",theme:b.identity.theme??"",avatar:b.identity.avatar??"",policy:b.policy,heartbeat:bp(b.policy.preset,{enabled:b.heartbeat.enabled,every:b.heartbeat.every??void 0}),channelIds:c})}),ao(c),T(!1),R(!0)},[a]),a8=async()=>{if(!ag)return;let b=a.workspaces.find(a=>a.id===ag.workspaceId)??null;V(!0);let c=!1;try{let a=await fetch("/api/agents",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(ag)}),d=await a.json();if(!a.ok||d.error)throw Error(d.error||"OpenClaw could not update the agent.");b&&await bi({workspaceId:ag.workspaceId,workspacePath:b.path,agentId:ag.id,currentChannelIds:ai,nextChannelIds:ag.channelIds,onRegistryChange:A}),a5(!1),c=!0}catch(a){aq.o.error("Agent update failed.",{description:a instanceof Error?a.message:"Unknown agent error."})}finally{V(!1)}c&&(n().catch(()=>{}),aq.o.success("Agent updated in OpenClaw.",{description:ag.id}))},a9=async()=>{if(!ap)return;$(!0);let b=!1,d=ap.path;try{let e=await fetch("/api/workspaces",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceId:ap.id})}),f=await e.json();if(!e.ok||f.error)throw Error(f.error||"OpenClaw could not delete the workspace.");X(!1),ar(null),at("");let g=c===ap.id?a.workspaces.find(a=>a.id!==ap.id)?.id??null:c;m(g),d=f.workspacePath||ap.path,b=!0}catch(a){aq.o.error("Workspace deletion failed.",{description:a instanceof Error?a.message:"Unknown workspace error."})}finally{$(!1)}b&&(n().catch(()=>{}),aq.o.success("Workspace deleted from OpenClaw.",{description:d}))},ba=async()=>{if(!au)return;af(!0);let a=!1,b=au.id;try{let c=await fetch("/api/agents",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentId:au.id})}),d=await c.json();if(!c.ok||d.error)throw Error(d.error||"OpenClaw could not delete the agent.");ag?.id===au.id&&a5(!1),ac(!1),av(null),ax(""),b=d.agentId||au.id,a=!0}catch(a){aq.o.error("Agent deletion failed.",{description:a instanceof Error?a.message:"Unknown agent error."})}finally{af(!1)}a&&(n().catch(()=>{}),aq.o.success("Agent deleted from OpenClaw.",{description:b}))};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"relative flex h-full items-start overflow-visible",children:[(0,d.jsxs)("div",{className:s("panel-surface panel-glow mission-ease-smooth relative flex h-full shrink-0 self-stretch flex-col items-center overflow-hidden px-1.5 py-2 transition-[max-height] duration-500",j?"w-full":"w-[60px] border-r border-white/[0.08]",F?"max-h-[164px]":"max-h-full"),children:[(0,d.jsx)(cr,{label:"AgentOS",side:"right",surfaceTheme:b,panelCollapsed:j,children:(0,d.jsx)("button",{type:"button","aria-label":j?"Open AgentOS":"Collapse AgentOS",onClick:()=>{j?aJ():l()},className:"flex h-9 w-9 shrink-0 aspect-square items-center justify-center overflow-hidden rounded-[8px] border border-cyan-300/20 bg-cyan-400/[0.12] shadow-[0_10px_24px_rgba(34,211,238,0.18)]",children:(0,d.jsx)(Y.default,{src:"/assets/logo.webp",alt:"",width:32,height:32,"aria-hidden":"true",className:"pointer-events-none h-full w-full select-none object-cover",priority:!0})})}),(0,d.jsx)("div",{className:s("mission-ease-smooth mt-3.5 flex w-full flex-1 flex-col items-center gap-1 overflow-hidden transition-[max-height,opacity,transform] duration-500",F?"max-h-0 -translate-y-3 opacity-0 pointer-events-none":"max-h-[420px] translate-y-0 opacity-100"),children:aY.map(a=>(0,d.jsx)(es,{icon:a.icon,label:a.label,active:ay===a.id,surfaceTheme:b,panelCollapsed:j,tooltipSide:"right",onClick:()=>{(aX(a.id),j)?aJ():ay===a.id&&l()}},a.id))}),(0,d.jsxs)("div",{className:"mt-auto flex w-full flex-col items-center gap-1 pb-1",children:[(0,d.jsxs)("div",{className:"flex flex-col items-center gap-1",children:[(0,d.jsx)(ep,{tone:L,pulse:"healthy"===a.diagnostics.health}),j?(0,d.jsx)("p",{className:"text-[8px] uppercase tracking-[0.16em] text-slate-500",children:a.mode}):null]}),(0,d.jsx)(cr,{label:F?"Expand rail":"Collapse rail",side:"right",surfaceTheme:b,panelCollapsed:j,children:(0,d.jsx)("button",{type:"button","aria-label":F?"Expand rail":"Collapse rail",onClick:()=>{j||l(),G(a=>!a)},className:"inline-flex h-8 w-8 items-center justify-center rounded-[8px] 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:F?(0,d.jsx)(a4.A,{className:"h-3.5 w-3.5"}):(0,d.jsx)(en.A,{className:"h-3.5 w-3.5"})})})]})]}),(0,d.jsx)("div",{className:s("panel-surface panel-glow mission-ease-smooth h-full min-w-0 flex-1 overflow-hidden rounded-none 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",j?"-translate-x-4 opacity-0 pointer-events-none":"translate-x-0 opacity-100",!j&&"border-l-0"),children:(0,d.jsxs)("div",{className:"mission-scroll flex h-full min-h-0 flex-col overflow-y-auto overscroll-contain",children:[(0,d.jsxs)("div",{className:"shrink-0 px-4 pb-3 pt-4",children:[(0,d.jsxs)("div",{className:"flex w-full items-baseline justify-center gap-2 whitespace-nowrap text-center",children:[(0,d.jsx)("span",{className:"font-display text-[14px] font-semibold tracking-[0.18em] text-slate-100",children:"AgentOS"}),(0,d.jsx)("span",{className:"text-[11px] font-medium text-slate-600",children:"|"}),(0,d.jsx)("span",{className:"font-display text-[10px] font-normal tracking-[0.18em] text-slate-500",children:"Control Plane"})]}),(0,d.jsx)("div",{className:"mt-3 h-px w-full bg-white/[0.08]"}),(0,d.jsxs)("div",{className:"mt-3 rounded-[18px] border border-white/[0.08] bg-[linear-gradient(180deg,rgba(13,20,34,0.98),rgba(6,10,18,0.96))] p-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)(ep,{tone:L,pulse:"healthy"===a.diagnostics.health}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:s("text-[12px] font-medium capitalize",K),children:a.diagnostics.health}),(0,d.jsxs)("p",{className:"truncate text-[9px] uppercase tracking-[0.18em] text-slate-500",children:["live"===i?"online":i,(0,d.jsx)("span",{className:"mx-2 text-slate-600",children:"\xb7"}),N]})]})]}),O?(0,d.jsxs)("div",{className:"mt-2.5 rounded-[14px] border border-amber-400/15 bg-amber-400/[0.08] px-2.5 py-2 text-[11px] text-amber-100",children:[(0,d.jsx)("p",{children:O}),P?(0,d.jsxs)(x,{type:"button",variant:"secondary",size:"sm",onClick:()=>void aW(P),disabled:_,title:P.detail,className:"mt-2 h-7 w-full justify-center rounded-none border-emerald-300/20 bg-emerald-300/10 px-3 text-[10px] text-emerald-50 transition-all duration-200 hover:-translate-y-0.5 hover:border-emerald-300/30 hover:bg-emerald-300/16 hover:text-emerald-50",children:[_?(0,d.jsx)(h.A,{className:"mr-1.5 h-3 w-3 animate-spin"}):(0,d.jsx)(bW.A,{className:"mr-1.5 h-3 w-3"}),P.cta]}):null]}):null,"offline"===a.diagnostics.health?(0,d.jsx)("div",{className:"mt-2.5",children:(0,d.jsxs)(x,{type:"button",variant:"secondary",size:"sm",onClick:v,className:"h-8 w-full justify-center rounded-none border-amber-300/20 bg-amber-300/10 px-3 text-[10px] text-amber-50 transition-all duration-200 hover:-translate-y-0.5 hover:border-amber-300/30 hover:bg-amber-300/16 hover:text-amber-50",children:[(0,d.jsx)(ek.A,{className:"mr-1.5 h-3 w-3"}),"Open setup"]})}):null]})]}),(0,d.jsxs)("div",{className:"flex-1 space-y-6 p-4",children:["overview"===ay?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(eu,{eyebrow:"Overview",title:"System summary",detail:"Current health, active focus, and runtime inventory."}),(0,d.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,d.jsx)(ev,{label:"Workspaces",value:String(a.workspaces.length)}),(0,d.jsx)(ev,{label:"Agents",value:String(a.agents.length)}),(0,d.jsx)(ev,{label:"Models",value:String(a.models.length)}),(0,d.jsx)(ev,{label:"Runs",value:String(a.runtimes.length)})]}),aD?(0,d.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,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate font-display text-[15px] text-white",children:aD.name}),(0,d.jsx)("p",{className:"mt-1 truncate text-[10px] uppercase tracking-[0.22em] text-slate-500",children:aD.slug})]}),(0,d.jsx)(u,{variant:"muted",children:aD.health})]}),(0,d.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2 text-[10px] uppercase tracking-[0.16em] text-slate-400",children:[(0,d.jsxs)("span",{children:[aD.agentIds.length," agents"]}),(0,d.jsxs)("span",{children:[aD.modelIds.length," models"]}),(0,d.jsxs)("span",{children:[aD.activeRuntimeIds.length," runs"]})]}),(0,d.jsx)("p",{className:"mt-3 text-[12px] text-slate-400",children:function(a){let b=M(a),c=b.split("/").filter(Boolean).filter(a=>{var b;return b=a,!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(b)});if(c.length<=3)return b;let d="~"===c[0]?"~/":"/";return`${d}…/${c.slice(-2).join("/")}`}(aD.path)})]}):(0,d.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,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate font-display text-[15px] text-white",children:"All workspaces"}),(0,d.jsxs)("p",{className:"mt-1 truncate text-[10px] uppercase tracking-[0.22em] text-slate-500",children:[a.workspaces.length," workspaces"]})]}),(0,d.jsxs)(u,{variant:"muted",children:[a.agents.length," agents"]})]}),(0,d.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2 text-[10px] uppercase tracking-[0.16em] text-slate-400",children:[(0,d.jsxs)("span",{children:[a.workspaces.length," workspaces"]}),(0,d.jsxs)("span",{children:[a.agents.length," agents"]}),(0,d.jsxs)("span",{children:[a.runtimes.length," runs"]})]}),(0,d.jsx)("p",{className:"mt-3 text-[12px] text-slate-400",children:"Showing every workspace in its own canvas area."})]})]}):null,"workspaces"===ay?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(eu,{eyebrow:"Home",title:"Workspaces",detail:"Select, rename, or remove real OpenClaw workspaces.",action:(0,d.jsx)(x,{variant:null===c?"secondary":"ghost",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>m(null),"aria-pressed":null===c,children:"All"})}),(0,d.jsx)("div",{className:"space-y-3",children:a.workspaces.map(a=>{let b=a.id===c;return(0,d.jsxs)("div",{className:s("rounded-[20px] border p-3.5 transition-all",b?"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,d.jsx)("button",{type:"button",onClick:()=>m(a.id),className:"w-full text-left",children:(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate font-display text-[15px] text-white",children:a.name}),(0,d.jsx)("p",{className:"mt-1 truncate text-[10px] uppercase tracking-[0.22em] text-slate-500",children:a.slug})]}),(0,d.jsx)(u,{variant:b?"default":"muted",children:a.health})]})}),(0,d.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2 text-[10px] uppercase tracking-[0.16em] text-slate-400",children:[(0,d.jsxs)("span",{children:[a.agentIds.length," agents"]}),(0,d.jsxs)("span",{children:[a.modelIds.length," models"]}),(0,d.jsxs)("span",{children:[a.activeRuntimeIds.length," runs"]})]}),(0,d.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,d.jsx)(x,{variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>z(a.id),children:"Edit"}),(0,d.jsx)(x,{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:()=>{ar(a),at(""),X(!0)},children:"Delete"})]})]},a.id)})})]}):null,"agents"===ay?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(eu,{eyebrow:"Apps",title:"Agents",detail:"Create and tune live isolated OpenClaw operators.",action:(0,d.jsx)(bx,{snapshot:a,defaultWorkspaceId:c??a.workspaces[0]?.id??null,onRefresh:n,onSnapshotChange:A,onAgentCreatedVisible:B,surfaceTheme:b,trigger:(0,d.jsx)(x,{variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",disabled:0===a.workspaces.length,children:"Add"})})}),(0,d.jsxs)("div",{className:"space-y-3",children:[0===aC.length?(0,d.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:c?"No agents are attached to this workspace yet.":"No agents are attached to any workspace yet."}):null,aC.map(b=>{var e,f;let g,h=J(b),i=aI[b.policy.preset],j=b.skills,k=b.tools.filter(a=>"fs.workspaceOnly"!==a),l=j.length>0?j:i.skillIds,m=k.length>0?k:i.tools,n=b.heartbeat.enabled?b.heartbeat.every??("number"==typeof b.heartbeat.everyMs?`${Math.round(b.heartbeat.everyMs/1e3)}s`:null):null,o=l.slice(0,2),p=m.slice(0,2),q=Math.max(l.length-o.length,0),r=Math.max(m.length-p.length,0),s=i.badgeVariant;return(0,d.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,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("p",{className:"truncate text-[13px] font-medium text-white",children:[b.identity.emoji?`${b.identity.emoji} `:"",h]}),(0,d.jsx)("p",{className:"mt-1 truncate text-[10px] uppercase tracking-[0.22em] text-slate-500",children:b.id}),(0,d.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2",children:[(0,d.jsx)(u,{variant:s,children:aQ(b.policy.preset)}),(0,d.jsx)(u,{variant:"engaged"===b.status?"default":"muted",children:b.status})]})]}),(0,d.jsx)(eC,{agentName:h,onEdit:()=>a6(b),onDelete:()=>a3(b)})]}),(0,d.jsx)("div",{className:"mt-3 flex items-center gap-2",children:(0,d.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,d.jsx)("span",{className:"truncate",children:(e=b.modelId,f=a.models,(g="string"==typeof e?e.trim():"")&&"unassigned"!==g?f.find(a=>a.id===g)?.name?.trim()||I(g):"Unassigned")})})}),(0,d.jsxs)("div",{className:"mt-3 space-y-2 rounded-[16px] border border-white/[0.06] bg-white/[0.03] p-3",children:[(0,d.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[(0,d.jsxs)(u,{variant:"muted",className:"px-2 py-1 text-[9px] normal-case tracking-normal",children:["Skills ",l.length]}),(0,d.jsxs)(u,{variant:"muted",className:"px-2 py-1 text-[9px] normal-case tracking-normal",children:["Tools ",m.length]}),(0,d.jsx)(u,{variant:s,className:"px-2 py-1 text-[9px] normal-case tracking-normal",children:aQ(b.policy.preset)})]}),(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)("p",{className:"text-[8px] uppercase tracking-[0.22em] text-slate-500",children:"Skills"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1",children:o.length>0?(0,d.jsxs)(d.Fragment,{children:[o.map(a=>(0,d.jsx)(u,{variant:"muted",className:"max-w-full truncate px-2 py-1 text-[10px] normal-case tracking-normal",children:aR(a)},a)),q>0?(0,d.jsxs)(u,{variant:"muted",className:"px-2 py-1 text-[10px] normal-case tracking-normal",children:["+",q]}):null]}):(0,d.jsx)(u,{variant:"muted",className:"px-2 py-1 text-[10px] normal-case tracking-normal",children:"No explicit skills"})})]}),(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)("p",{className:"text-[8px] uppercase tracking-[0.22em] text-slate-500",children:"Tools"}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-1",children:[p.length>0?p.map(a=>(0,d.jsx)(u,{variant:"warning",className:"max-w-full truncate px-2 py-1 text-[10px] normal-case tracking-normal",children:aR(a)},a)):(0,d.jsx)(u,{variant:"muted",className:"px-2 py-1 text-[10px] normal-case tracking-normal",children:"No explicit tools"}),r>0?(0,d.jsxs)(u,{variant:"muted",className:"px-2 py-1 text-[10px] normal-case tracking-normal",children:["+",r]}):null]})]}),(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)("p",{className:"text-[8px] uppercase tracking-[0.22em] text-slate-500",children:"Policy"}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[(0,d.jsxs)(u,{variant:"muted",className:"px-2 py-1 text-[9px] normal-case tracking-normal",children:["Missing ",aS(b.policy.missingToolBehavior)]}),(0,d.jsxs)(u,{variant:"muted",className:"px-2 py-1 text-[9px] normal-case tracking-normal",children:["Install ",aT(b.policy.installScope)]}),(0,d.jsxs)(u,{variant:"muted",className:"px-2 py-1 text-[9px] normal-case tracking-normal",children:["File ",aU(b.policy.fileAccess)]}),(0,d.jsxs)(u,{variant:"muted",className:"px-2 py-1 text-[9px] normal-case tracking-normal",children:["Network ",aV(b.policy.networkAccess)]})]})]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:(0,d.jsxs)(u,{variant:"muted",className:"px-2 py-1 text-[9px] normal-case tracking-normal",children:["Heartbeat ",b.heartbeat.enabled?n?`On \xb7 ${n}`:"On":"Off"]})})]}),c?null:(0,d.jsx)("p",{className:"mt-2 truncate text-[10px] uppercase tracking-[0.18em] text-slate-500",children:a.workspaces.find(a=>a.id===b.workspaceId)?.name||"Workspace"})]},b.id)})]})]}):null,"models"===ay?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(eu,{eyebrow:"Models",title:"Models & providers",detail:"Connect providers, choose a default route, and manage live model readiness."}),(0,d.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,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Default"}),(0,d.jsx)("p",{className:"font-display text-[15px] text-white",children:a.diagnostics.modelReadiness.resolvedDefaultModel||a.diagnostics.modelReadiness.defaultModel||"Not set"}),(0,d.jsx)("p",{className:"text-[12px] leading-5 text-slate-400",children:"Connect providers, choose a default route, and keep live model readiness visible."})]}),(0,d.jsxs)("div",{className:"mt-4 grid gap-3 border-t border-white/[0.06] pt-4 sm:grid-cols-2",children:[(0,d.jsxs)("div",{className:"rounded-[16px] border border-white/[0.06] bg-white/[0.03] px-3 py-2.5",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Providers"}),(0,d.jsxs)("p",{className:"mt-1.5 text-[13px] leading-5 text-white",children:[a.diagnostics.modelReadiness.authProviders.filter(a=>a.connected).length," ","connected"]})]}),(0,d.jsxs)("div",{className:"rounded-[16px] border border-white/[0.06] bg-white/[0.03] px-3 py-2.5",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Routes"}),(0,d.jsxs)("p",{className:"mt-1.5 text-[13px] leading-5 text-white",children:[a.diagnostics.modelReadiness.availableModelCount,"/",a.diagnostics.modelReadiness.totalModelCount," available"]})]})]}),k.systemReady?null:(0,d.jsxs)("div",{className:"mt-4 rounded-[16px] border border-amber-400/15 bg-amber-400/[0.08] px-3 py-2.5",children:[(0,d.jsx)("p",{className:"text-[13px] font-medium text-amber-50",children:"Finish system setup first"}),(0,d.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,d.jsx)("div",{className:"mt-3",children:(0,d.jsx)(x,{variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:v,children:"Open setup"})})]}),(0,d.jsxs)("label",{className:"mt-4 block space-y-1 border-t border-white/[0.06] pt-4",children:[(0,d.jsx)("span",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Default model"}),(0,d.jsxs)("select",{value:aG,onChange:a=>aB(a.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,d.jsx)("option",{value:"",children:"Auto choose"}),aE.map(a=>(0,d.jsxs)("option",{value:a.id,children:[a.name," \xb7 ",a.provider]},a.id))]})]}),(0,d.jsxs)("div",{className:"mt-4 grid gap-2",children:[(0,d.jsx)(x,{variant:"secondary",size:"sm",className:"h-8 w-full justify-center rounded-full px-3 text-[11px]",disabled:!k.systemReady||"running"===k.runState,onClick:()=>r(aG||void 0),children:"running"===k.runState?"Working...":"Use selected model"}),(0,d.jsx)(x,{variant:"ghost",size:"sm",className:"h-8 w-full justify-center rounded-full px-3 text-[11px]",disabled:!k.systemReady||"running"===k.runState,onClick:q,children:"Discover routes"})]})]}),(0,d.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[(0,d.jsx)(x,{variant:"secondary",size:"sm",className:"h-8 w-full justify-center rounded-full px-3 text-[11px]",onClick:w,children:"Add models"}),(0,d.jsxs)(x,{variant:"ghost",size:"sm",className:"h-8 w-full justify-center rounded-full px-3 text-[11px]",disabled:"running"===k.runState,onClick:p,children:["running"===k.runState?(0,d.jsx)(h.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(f.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Refresh"]})]}),(0,d.jsx)("div",{className:"space-y-3",children:a.diagnostics.modelReadiness.authProviders.map(a=>(0,d.jsx)(ew,{provider:a,disabled:!k.systemReady||"running"===k.runState,onConnect:()=>t(a.provider)},a.provider))}),aF.length>0?(0,d.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,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-display text-[15px] text-white",children:"Discovered routes"}),(0,d.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,d.jsx)(u,{variant:"muted",children:aF.length})]}),(0,d.jsx)("div",{className:"mt-3 space-y-2",children:aF.slice(0,6).map(a=>(0,d.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,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[13px] font-medium text-white",children:a.name}),(0,d.jsxs)("p",{className:"mt-1 text-[10px] uppercase tracking-[0.18em] text-slate-500",children:[ex(a.provider),a.isFree?" \xb7 free":"",a.supportsTools?" \xb7 tools":""]})]}),(0,d.jsx)(x,{variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",disabled:!k.systemReady||"running"===k.runState,onClick:()=>r(a.modelId),children:"Use"})]},a.modelId))})]}):null,(0,d.jsx)("div",{className:"space-y-3",children:a.models.slice(0,8).map(a=>(0,d.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,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[13px] font-medium text-white",children:I(a.id)}),(0,d.jsx)("p",{className:"mt-1 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:a.provider})]}),(0,d.jsx)(u,{variant:a.local?"success":a.missing?"danger":"muted",children:a.local?"local":a.missing?"missing":"remote"})]}),(0,d.jsxs)("div",{className:"mt-3 flex items-center justify-between text-[11px] text-slate-400",children:[(0,d.jsxs)("span",{children:[H(a.contextWindow)," ctx"]}),(0,d.jsxs)("span",{children:[a.usageCount," agents"]})]})]},a.id))})]}):null,"settings"===ay?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(eu,{eyebrow:"Settings",title:"Control Center",detail:"Open system, gateway, model, workspace, and diagnostics controls."}),(0,d.jsx)("div",{className:"space-y-2",children:eq.map(a=>(0,d.jsx)(et,{item:a},a.id))})]}):null]}),(0,d.jsx)("div",{className:"shrink-0 border-t border-white/[0.08] p-4",children:(0,d.jsx)("div",{className:"rounded-[22px] border border-cyan-300/10 bg-[linear-gradient(180deg,rgba(7,22,31,0.95),rgba(5,13,22,0.95))] p-4 shadow-[0_16px_40px_rgba(0,0,0,0.22)]",children:(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"flex h-11 w-11 items-center justify-center rounded-full border border-cyan-300/15 bg-cyan-400/[0.12] text-cyan-200",children:(0,d.jsx)(ek.A,{className:"h-4 w-4"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate font-display text-[15px] text-white",children:aD?.name||"All workspaces"}),(0,d.jsx)("p",{className:"mt-1 text-[12px] text-slate-400",children:aD?`${aD.agentIds.length} agents \xb7 ${aD.activeRuntimeIds.length} runs`:`${a.workspaces.length} workspaces \xb7 ${a.agents.length} agents \xb7 ${a.runtimes.length} runs`})]})]})})})]})})]}),(0,d.jsx)(ae,{open:W,onOpenChange:X,children:(0,d.jsxs)(aj,{children:[(0,d.jsxs)(ak,{children:[(0,d.jsx)(am,{children:"Delete OpenClaw workspace"}),(0,d.jsx)(an,{children:"This permanently removes the workspace directory and all OpenClaw agents bound to it."})]}),ap?(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)("div",{className:"rounded-[20px] border border-rose-400/20 bg-rose-500/[0.08] px-4 py-3.5",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("div",{className:"mt-0.5 rounded-full border border-rose-300/20 bg-rose-400/10 p-2 text-rose-200",children:(0,d.jsx)(o.A,{className:"h-4 w-4"})}),(0,d.jsxs)("div",{className:"space-y-1.5 text-sm text-rose-50",children:[(0,d.jsx)("p",{className:"font-medium",children:"This action cannot be undone."}),(0,d.jsx)("p",{className:"text-rose-100/80",children:"OpenClaw will remove the workspace folder from disk and prune the attached agents/state."})]})]})}),(0,d.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,d.jsx)(eE,{label:"Agents",value:String(aZ.length)}),(0,d.jsx)(eE,{label:"Runs",value:String(a_.length)}),(0,d.jsx)(eE,{label:"Live agents",value:String(a$.length),danger:a$.length>0})]}),(0,d.jsxs)("div",{className:"rounded-[18px] border border-white/10 bg-white/[0.03] px-3.5 py-3",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:"Workspace path"}),(0,d.jsx)("p",{className:"mt-1.5 break-all font-mono text-xs text-slate-300",children:ap.path})]}),a$.length>0||a_.length>0?(0,d.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:a$.length>0?`${a$.length} active or recently engaged agents are still attached to this workspace.`:`${a_.length} runtime records are still associated with this workspace.`}):null,(0,d.jsx)(ey,{label:`Type ${ap.slug} to confirm`,htmlFor:"delete-workspace-confirm",children:(0,d.jsx)(y,{id:"delete-workspace-confirm",value:as,onChange:a=>at(a.target.value),placeholder:ap.slug})})]}):null,(0,d.jsxs)(al,{children:[(0,d.jsx)(x,{variant:"secondary",onClick:()=>{X(!1),ar(null),at("")},children:"Cancel"}),(0,d.jsx)(x,{variant:"destructive",onClick:a9,disabled:Z||!ap||as.trim()!==ap.slug,children:Z?"Deleting…":"Delete workspace"})]})]})}),(0,d.jsx)(ae,{open:ab,onOpenChange:ac,children:(0,d.jsxs)(aj,{children:[(0,d.jsxs)(ak,{children:[(0,d.jsx)(am,{children:"Delete OpenClaw agent"}),(0,d.jsx)(an,{children:"This removes the selected agent from OpenClaw and detaches its workspace binding."})]}),au?(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)("div",{className:"rounded-[20px] border border-rose-400/20 bg-rose-500/[0.08] px-4 py-3.5",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("div",{className:"mt-0.5 rounded-full border border-rose-300/20 bg-rose-400/10 p-2 text-rose-200",children:(0,d.jsx)(o.A,{className:"h-4 w-4"})}),(0,d.jsxs)("div",{className:"space-y-1.5 text-sm text-rose-50",children:[(0,d.jsx)("p",{className:"font-medium",children:"This action cannot be undone."}),(0,d.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,d.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,d.jsx)(eE,{label:"Status",value:au.status,danger:a2}),(0,d.jsx)(eE,{label:"Runs",value:String(a0.length)}),(0,d.jsx)(eE,{label:"Workspace",value:a1?.name??"Unknown"})]}),(0,d.jsxs)("div",{className:"rounded-[18px] border border-white/10 bg-white/[0.03] px-3.5 py-3",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:"Agent id"}),(0,d.jsx)("p",{className:"mt-1.5 break-all font-mono text-xs text-slate-300",children:au.id})]}),a2||a0.length>0?(0,d.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:a2?"This agent is still active or recently engaged. Delete it only if you want to stop using it entirely.":`${a0.length} runtime records are still associated with this agent.`}):null,(0,d.jsx)(ey,{label:`Type ${au.id} to confirm`,htmlFor:"delete-agent-confirm",children:(0,d.jsx)(y,{id:"delete-agent-confirm",value:aw,onChange:a=>ax(a.target.value),placeholder:au.id})})]}):null,(0,d.jsxs)(al,{children:[(0,d.jsx)(x,{variant:"secondary",onClick:()=>{ac(!1),av(null),ax("")},children:"Cancel"}),(0,d.jsx)(x,{variant:"destructive",onClick:ba,disabled:ad||!au||aw.trim()!==au.id,children:ad?"Deleting…":"Delete agent"})]})]})}),(0,d.jsx)(ae,{open:Q,onOpenChange:a5,children:(0,d.jsxs)(aj,{className:"max-h-[90vh] overflow-y-auto sm:max-w-3xl",children:[(0,d.jsxs)(ak,{children:[(0,d.jsx)(am,{children:"Edit OpenClaw agent"}),(0,d.jsx)(an,{children:"Update the selected agent identity, preset, and operating policy."})]}),ag?(0,d.jsxs)("div",{className:"space-y-5",children:[(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)("p",{className:"text-[11px] uppercase tracking-[0.18em] text-slate-400",children:"Agent preset"}),(0,d.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:aK.map(a=>(0,d.jsx)(ez,{label:a.label,description:a.description,active:ag.policy.preset===a.value,badgeVariant:aI[a.value].badgeVariant,onClick:()=>ah(b=>{var c,d;let e,f,g;return b?(c=b,d=a.value,e=aI[c.policy.preset],f=aI[d],g=aP(d),{...c,name:c.name&&c.name!==e.defaultName?c.name:f.defaultName,emoji:c.emoji&&c.emoji!==e.defaultEmoji?c.emoji:f.defaultEmoji,theme:c.theme&&c.theme!==e.defaultTheme?c.theme:f.defaultTheme,policy:g,heartbeat:bq(c.heartbeat,c.policy.preset,d)}):b})},a.value))})]}),(0,d.jsx)(eA,{policy:ag.policy}),(0,d.jsx)(ey,{label:"Agent id",htmlFor:"edit-agent-id",children:(0,d.jsx)(y,{id:"edit-agent-id",value:ag.id,disabled:!0})}),(0,d.jsx)(ey,{label:"Display name",htmlFor:"edit-agent-name",children:(0,d.jsx)(y,{id:"edit-agent-name",value:ag.name,onChange:a=>ah(b=>b?{...b,name:a.target.value}:b),placeholder:aI[ag.policy.preset].defaultName})}),(0,d.jsx)(ey,{label:"Workspace",htmlFor:"edit-agent-workspace",children:(0,d.jsx)(y,{id:"edit-agent-workspace",value:a.workspaces.find(a=>a.id===ag.workspaceId)?.name||ag.workspaceId,disabled:!0})}),(0,d.jsx)(ey,{label:"Model",htmlFor:"edit-agent-model",children:(0,d.jsxs)("select",{id:"edit-agent-model",value:ag.modelId,onChange:a=>ah(b=>b?{...b,modelId:a.target.value}:b),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,d.jsx)("option",{value:"",children:"Use OpenClaw default"}),a.models.map(a=>(0,d.jsx)("option",{value:a.id,children:a.id},a.id))]})}),(0,d.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,d.jsx)(ey,{label:"Emoji",htmlFor:"edit-agent-emoji",children:(0,d.jsx)(y,{id:"edit-agent-emoji",value:ag.emoji,onChange:a=>ah(b=>b?{...b,emoji:a.target.value}:b),placeholder:aI[ag.policy.preset].defaultEmoji})}),(0,d.jsx)(ey,{label:"Theme",htmlFor:"edit-agent-theme",children:(0,d.jsx)(y,{id:"edit-agent-theme",value:ag.theme,onChange:a=>ah(b=>b?{...b,theme:a.target.value}:b),placeholder:aI[ag.policy.preset].defaultTheme})})]}),(0,d.jsx)(ey,{label:"Avatar URL",htmlFor:"edit-agent-avatar",children:(0,d.jsx)(y,{id:"edit-agent-avatar",value:ag.avatar,onChange:a=>ah(b=>b?{...b,avatar:a.target.value}:b),placeholder:"https://example.com/avatar.png"})}),(0,d.jsx)(bj,{snapshot:a,workspaceId:ag.workspaceId,channelIds:ag.channelIds,agentId:ag.id,isSaving:U,surfaceTheme:b,onChange:a=>ah(b=>b?{...b,channelIds:a}:b)}),(0,d.jsxs)("div",{className:"rounded-[20px] border border-white/10 bg-white/[0.03] p-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium text-white",children:"Advanced policy"}),(0,d.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,d.jsx)(x,{type:"button",variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>T(a=>!a),children:S?"Hide":"Show"})]}),aH?(0,d.jsxs)("div",{className:"mt-4 rounded-[18px] border border-white/10 bg-slate-950/40 p-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium text-white",children:"Heartbeat"}),(0,d.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,d.jsx)(x,{type:"button",variant:ag.heartbeat.enabled?"default":"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>ah(a=>a?{...a,heartbeat:a.heartbeat.enabled?{...a.heartbeat,enabled:!1}:{...a.heartbeat,enabled:!0,every:a.heartbeat.every||bo(a.policy.preset).every}}:a),children:ag.heartbeat.enabled?"On":"Off"})]}),ag.heartbeat.enabled?(0,d.jsx)("div",{className:"mt-3",children:(0,d.jsx)(ey,{label:"Interval",htmlFor:"edit-agent-heartbeat-every",children:(0,d.jsx)("select",{id:"edit-agent-heartbeat-every",value:ag.heartbeat.every,onChange:a=>ah(b=>b?{...b,heartbeat:{...b.heartbeat,every:a.target.value}}:b),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:bn.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))})})}):null]}):null,S?(0,d.jsxs)("div",{className:"mt-4 grid gap-4 sm:grid-cols-2",children:[(0,d.jsx)(eB,{label:"Missing tool behavior",htmlFor:"edit-agent-missing-tools",value:ag.policy.missingToolBehavior,options:aL,onChange:a=>ah(b=>b?{...b,policy:{...b.policy,missingToolBehavior:a}}:b)}),(0,d.jsx)(eB,{label:"Install scope",htmlFor:"edit-agent-install-scope",value:ag.policy.installScope,options:aM,onChange:a=>ah(b=>b?{...b,policy:{...b.policy,installScope:a}}:b)}),(0,d.jsx)(eB,{label:"File access",htmlFor:"edit-agent-file-access",value:ag.policy.fileAccess,options:aN,onChange:a=>ah(b=>b?{...b,policy:{...b.policy,fileAccess:a}}:b)}),(0,d.jsx)(eB,{label:"Network access",htmlFor:"edit-agent-network-access",value:ag.policy.networkAccess,options:aO,onChange:a=>ah(b=>b?{...b,policy:{...b.policy,networkAccess:a}}:b)})]}):null]})]}):null,(0,d.jsxs)(al,{children:[(0,d.jsx)(x,{variant:"secondary",onClick:()=>a5(!1),children:"Cancel"}),(0,d.jsx)(x,{onClick:a8,disabled:U||!ag,children:U?"Saving…":"Save changes"})]})]})})]})}function es({icon:a,label:b,active:c,surfaceTheme:e,panelCollapsed:f,tooltipSide:g,onClick:h}){return(0,d.jsx)(cr,{label:b,side:g,surfaceTheme:e,panelCollapsed:f,children:(0,d.jsx)("button",{type:"button",onClick:h,"aria-label":b,className:s("inline-flex h-8 w-8 items-center justify-center rounded-[8px] border transition-all",c?"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,d.jsx)(a,{className:"h-3.5 w-3.5"})})})}function et({item:a}){let b=a.icon;return(0,d.jsxs)("a",{href:`/settings#${a.id}`,className:s("flex h-10 items-center gap-3 rounded-[16px] border px-3 text-[12px] transition-all",a.danger?"border-transparent text-rose-200/86 hover:border-rose-300/16 hover:bg-rose-300/10 hover:text-rose-100":"border-white/[0.06] bg-white/[0.03] text-slate-300 hover:border-cyan-300/[0.18] hover:bg-cyan-300/[0.06] hover:text-cyan-100"),children:[(0,d.jsx)(b,{className:s("h-3.5 w-3.5",a.danger?"text-rose-300":"text-slate-500")}),(0,d.jsx)("span",{className:"truncate",children:a.label})]})}function eu({eyebrow:a,title:b,detail:c,action:e}){return(0,d.jsxs)("div",{className:"flex items-end justify-between gap-4",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:a}),(0,d.jsx)("h2",{className:"mt-1.5 font-display text-[1.02rem] text-white",children:b}),(0,d.jsx)("p",{className:"mt-1.5 text-[12px] leading-5 text-slate-400",children:c})]}),e?(0,d.jsx)("div",{className:"shrink-0",children:e}):null]})}function ev({label:a,value:b}){return(0,d.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,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:a}),(0,d.jsx)("p",{className:"mt-1.5 font-display text-[1.2rem] text-white",children:b})]})}function ew({provider:a,disabled:b,onConnect:c}){let e,f="openai-codex"===a.provider?"Connect ChatGPT":"openrouter"===a.provider?"Add API key":"Connect";return(0,d.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,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)(aa,{className:"h-8 w-8",provider:a.provider}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("p",{className:"truncate font-display text-[15px] text-white",children:ex(a.provider)}),(0,d.jsx)(u,{variant:a.connected?"success":a.canLogin?"warning":"muted",children:a.connected?"connected":a.canLogin?"needs auth":"local"})]}),(0,d.jsx)("p",{className:"mt-1 text-[12px] leading-5 text-slate-400",children:a.detail||("openai-codex"===(e=a.provider.trim().toLowerCase())?"Use the OpenClaw OpenAI Codex route. If your ChatGPT plan includes Codex access, connect that account here.":"openrouter"===e?"Paste an API key to unlock OpenRouter-hosted routes.":"google"===e||"gemini"===e?"Paste a Gemini API key to unlock Gemini-hosted routes.":"deepseek"===e?"Paste a DeepSeek API key to unlock DeepSeek-hosted routes.":"mistral"===e?"Paste a Mistral API key to unlock Mistral and Codestral routes.":"xai"===e?"Paste an xAI API key to unlock Grok routes.":"ollama"===e?"Local model provider. Pull models locally to make new routes available.":"Connect this provider to make its remote routes available inside AgentOS.")})]})]}),(0,d.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[a.canLogin?(0,d.jsx)(x,{variant:a.connected?"ghost":"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",disabled:b,onClick:c,children:f}):null,"openai-codex"===a.provider?(0,d.jsx)(u,{variant:"muted",children:"ChatGPT/Codex route"}):null]})]})}function ex(a){let b=a.trim().toLowerCase();return"openrouter"===b?"OpenRouter":"openai-codex"===b?"OpenAI Codex":"openai"===b?"OpenAI":"anthropic"===b?"Anthropic":"ollama"===b?"Ollama":"xai"===b?"xAI":"google"===b||"gemini"===b?"Gemini":"deepseek"===b?"DeepSeek":"mistral"===b?"Mistral":a.split("-").map(a=>a?a[0].toUpperCase()+a.slice(1):a).join(" ")}function ey({label:a,htmlFor:b,children:c}){return(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)(bm,{htmlFor:b,className:"text-[11px] uppercase tracking-[0.18em] text-slate-400",children:a}),c]})}function ez({label:a,description:b,active:c,badgeVariant:e,onClick:f}){return(0,d.jsx)("button",{type:"button",onClick:f,className:s("rounded-[20px] border p-4 text-left transition-colors",c?"border-cyan-300/30 bg-cyan-400/10":"border-white/10 bg-white/[0.03]"),children:(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsx)("p",{className:"text-sm font-medium text-white",children:a}),(0,d.jsx)("p",{className:"text-xs leading-5 text-slate-400",children:b})]}),(0,d.jsx)(u,{variant:e,children:c?"selected":"preset"})]})})}function eA({policy:a}){let b=aI[a.preset];return(0,d.jsxs)("div",{className:"rounded-[20px] border border-white/10 bg-slate-950/50 p-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium text-white",children:b.label}),(0,d.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:b.description})]}),(0,d.jsx)(u,{variant:b.badgeVariant,children:b.label})]}),(0,d.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,d.jsx)(u,{variant:"muted",children:aS(a.missingToolBehavior)}),(0,d.jsx)(u,{variant:"muted",children:aT(a.installScope)}),(0,d.jsx)(u,{variant:"muted",children:aU(a.fileAccess)}),(0,d.jsxs)(u,{variant:"muted",children:["Network ",aV(a.networkAccess)]})]})]})}function eB({label:a,htmlFor:b,value:c,options:e,onChange:f}){return(0,d.jsx)(ey,{label:a,htmlFor:b,children:(0,d.jsx)("select",{id:b,value:c,onChange:a=>f(a.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.map(a=>(0,d.jsxs)("option",{value:a.value,children:[a.label," - ",a.description]},a.value))})})}function eC({agentName:a,onEdit:b,onDelete:c}){let[e,f]=(0,g.useState)(!1),h=(0,g.useRef)(null);return(0,d.jsxs)("div",{className:"relative",ref:h,children:[(0,d.jsx)("button",{type:"button","aria-label":`${a} actions`,onClick:()=>f(a=>!a),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,d.jsx)(eo.A,{className:"h-3.5 w-3.5"})}),e?(0,d.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,d.jsx)(eD,{label:"Edit",onClick:()=>{f(!1),b()}}),(0,d.jsx)(eD,{label:"Delete",danger:!0,onClick:()=>{f(!1),c()}})]}):null]})}function eD({label:a,onClick:b,danger:c=!1}){return(0,d.jsx)("button",{type:"button",className:s("flex w-full items-center rounded-[10px] px-2.5 py-2 text-left text-[11px] transition-colors",c?"text-rose-200 hover:bg-rose-400/10 hover:text-rose-100":"text-slate-200 hover:bg-white/[0.06] hover:text-white"),onClick:b,children:(0,d.jsx)("span",{children:a})})}function eE({label:a,value:b,danger:c=!1}){return(0,d.jsxs)("div",{className:s("rounded-[18px] border px-3.5 py-3",c?"border-amber-300/20 bg-amber-400/[0.08]":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:a}),(0,d.jsx)("p",{className:s("mt-1.5 font-display text-lg",c?"text-amber-100":"text-white"),children:b})]})}var eF=c(11035),eG=c(37526);function eH({provider:a,className:b}){let c=bc(a),e=c.iconKey?Z[c.iconKey]:void 0;return(0,d.jsx)("div",{className:s("flex items-center justify-center rounded-full border border-white/12 bg-slate-950/72 text-white shadow-[0_8px_18px_rgba(0,0,0,0.28)] backdrop-blur-xl",b),"aria-hidden":"true",children:e?(0,d.jsx)("svg",{viewBox:"0 0 24 24",className:"h-[58%] w-[58%] select-none",fill:c.accentColor||`#${e.hex}`,children:(0,d.jsx)("path",{d:e.path})}):(0,d.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-white/88",children:c.label.slice(0,1)})})}function eI(a,b){let c=a[b];return"string"==typeof c?c:""}function eJ(a){let b={name:""};for(let c of a.provisionFields){if("boolean"==typeof c.defaultValue||"string"==typeof c.defaultValue){b[c.key]=c.defaultValue;continue}b[c.key]="checkbox"!==c.inputType&&""}return b}function eK(a,b){let c={};for(let d of a){let a,e=b[d.key];if("checkbox"===d.inputType)a=!!e;else if("number"===d.inputType){let b="string"==typeof e?Number(e.trim()):Number(e);if(!Number.isFinite(b))continue;a=b}else{if("string"!=typeof e)continue;let b=e.trim();if(0===b.length)continue;a=function(a){if(a.startsWith("{")&&a.endsWith("}")||a.startsWith("[")&&a.endsWith("]"))try{return JSON.parse(a)}catch{}return a}(b)}!function(a,b,c){let d=b.split(".").filter(Boolean);if(d.length<=1){a[b]=c;return}let e=a;for(let a of d.slice(0,-1)){var f;(f=e[a])&&"object"==typeof f&&!Array.isArray(f)||(e[a]={}),e=e[a]}e[d[d.length-1]]=c}(c,d.key,a)}return c}let eL=["chat","inbox","trigger"];function eM({snapshot:a,workspaceId:b,open:c,onOpenChange:e,onRefresh:i,onSnapshotChange:j}){let k=(0,g.useMemo)(()=>a.workspaces.find(a=>a.id===b)??null,[a.workspaces,b]),l=(0,g.useMemo)(()=>a.agents.filter(a=>a.workspaceId===k?.id),[a.agents,k?.id]),m=(0,g.useMemo)(()=>k?bf(a,k.id):[],[a,k]),n=(0,g.useMemo)(()=>[...a.channelAccounts].sort((a,b)=>{let c=bc(a.type),d=bc(b.type);return c.kind!==d.kind?c.kind.localeCompare(d.kind):a.type!==b.type?bd(a.type).localeCompare(bd(b.type)):a.name.localeCompare(b.name)}),[a.channelAccounts]),p=(0,g.useMemo)(()=>{let a=new Set(ba.map(a=>a.kind));return eL.filter(b=>a.has(b))},[]),[q,r]=(0,g.useState)("chat"),[t,v]=(0,g.useState)("telegram"),[w,z]=(0,g.useState)(!1),[A,B]=(0,g.useState)(null),[C,D]=(0,g.useState)(""),[E,F]=(0,g.useState)({}),[G,H]=(0,g.useState)({}),[I,K]=(0,g.useState)({}),[L,M]=(0,g.useState)({}),[N,O]=(0,g.useState)({}),[P,Q]=(0,g.useState)(null),[U,V]=(0,g.useState)(""),[W,X]=(0,g.useState)(eJ(bc(t))),Y=(0,g.useMemo)(()=>n.filter(a=>a.type===t),[t,n]),Z=(0,g.useMemo)(()=>m.filter(a=>a.type===t),[t,m]),$=(0,g.useMemo)(()=>bc(t),[t]),_=$.provisionFields.filter(a=>"advanced"!==a.section),aa=$.provisionFields.filter(a=>"advanced"===a.section),ab=(0,g.useCallback)(a=>Z.some(b=>b.id===a||b.id===eQ(a)),[Z]),ac=(0,g.useCallback)((b,c="Unset")=>b?J(a.agents.find(a=>a.id===b)??{name:b}):c,[a.agents]),ad=(0,g.useCallback)(b=>a.workspaces.find(a=>a.id===b)?.name??b,[a.workspaces]),af=(0,g.useMemo)(()=>{let a=ba.filter(a=>a.kind===q),b=new Set(a.map(a=>a.provider)),c=n.filter(a=>bc(a.type).kind===q&&!b.has(a.type)).map(a=>a.type);return[...a.map(a=>a.provider),...Array.from(new Set(c))]},[q,n]),ag=(0,g.useCallback)(async(a,b)=>{if(k?.id){M(b=>({...b,[a]:!0})),O(b=>({...b,[a]:null}));try{let c=await fetch(`/api/workspaces/${encodeURIComponent(k.id)}/surfaces/discovery?provider=${encodeURIComponent(b)}&accountId=${encodeURIComponent(a)}`),d=await c.json();if(!c.ok||d.error)throw Error(d.error||`${bc(b).label} route discovery failed.`);if(K(b=>({...b,[a]:!1!==d.supported&&Array.isArray(d.routes)?d.routes:[]})),"telegram"===b&&Array.isArray(d.routes)&&d.routes.length>0){let b=m.find(b=>b.id===a)??null,c=b?.workspaces.find(a=>a.workspaceId===k.id)??null;if(b&&c){let b=(c.groupAssignments??[]).filter(a=>!1!==a.enabled),e=new Set(b.map(a=>a.chatId)),f=d.routes.filter(a=>a.routeId&&!e.has(a.routeId)),g=new Map(d.routes.filter(a=>a.routeId&&a.title?.trim()).map(a=>[a.routeId,a.title?.trim()??null])),h=b.map(a=>{let b=g.get(a.chatId);return b&&a.title!==b?{...a,title:b}:a}),l=h.some((a,c)=>a.title!==b[c]?.title);if(f.length>0||l)try{let b=await fetch(`/api/workspaces/${encodeURIComponent(k.id)}/channels`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"groups",channelId:a,groupAssignments:[...h,...f.map(a=>({chatId:a.routeId,title:a.title??null,agentId:null,enabled:!0}))]})}),c=await b.json();if(!b.ok||c.error)throw Error(c.error||"Discovered groups could not be enabled.");c.registry&&j&&j(a=>bh(a,c.registry)),aq.o.success("Telegram routes enabled.",{description:1===f.length?`${f[0].title??f[0].routeId} now falls back to the primary agent.`:f.length>1?`${f.length} discovered groups now fall back to the primary agent.`:"Discovered group names were synced."}),i().catch(()=>{})}catch(a){aq.o.error("Telegram route sync failed.",{description:a instanceof Error?a.message:"Discovered groups could not be enabled."})}}}}catch(c){O(d=>({...d,[a]:c instanceof Error?c.message:`${bc(b).label} discovery failed.`}))}finally{M(b=>({...b,[a]:!1}))}}},[i,j,k,m]),ah=a=>{z(!0),B(a)},ai=()=>{z(!1),B(null)},ao=async a=>{if(!k)throw Error("Workspace was not found.");let b=await fetch(`/api/workspaces/${encodeURIComponent(k.id)}/channels`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json();if(!b.ok||c.error)throw Error(c.error||"OpenClaw could not update this surface right now.");return c},ap=async a=>{if(!k)throw Error("Workspace was not found.");let b=await fetch(`/api/workspaces/${encodeURIComponent(k.id)}/channels`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json();if(!b.ok||c.error)throw Error(c.error||"OpenClaw could not update this surface right now.");return c},ar=async a=>{if(!k)throw Error("Workspace was not found.");let b=await fetch(`/api/workspaces/${encodeURIComponent(k.id)}/channels`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json();if(!b.ok||c.error)throw Error(c.error||"OpenClaw could not update this surface right now.");return c},as=a=>{a.registry&&j&&j(b=>{var c,d;let e,f=bh(b,a.registry);return a.account&&(c=f,d=a.account,e=c.channelAccounts.filter(a=>a.id!==d.id),f={...c,channelAccounts:[...e,d]}),f})},at=async a=>{if(k){ah(`Connecting ${a.name}...`);try{let b=await ao({channelId:a.id,type:t,name:a.name,workspacePath:k.path,primaryAgentId:C||null,agentId:C||void 0});as(b),aq.o.success(`${bc(t).label} connected to this workspace.`),i().catch(()=>{})}catch(a){aq.o.error("Surface connection failed.",{description:a instanceof Error?a.message:"Unknown surface error."})}finally{ai()}}},au=async()=>{if(k){if(!eI(W,"name").trim())return void aq.o.error("A surface name is required.");ah(`Provisioning ${$.label}...`);try{let a=eK($.provisionFields,W),b={type:t,name:eI(W,"name").trim(),workspacePath:k.path,config:a,primaryAgentId:C||null,agentId:C||void 0};for(let c of $.provisionFields)"token"===c.key&&"string"==typeof a.token&&(b.token=a.token),"botToken"===c.key&&"string"==typeof a.botToken&&(b.botToken=a.botToken),"webhookUrl"===c.key&&"string"==typeof a.webhookUrl&&(b.webhookUrl=a.webhookUrl);let c=await ao(b);as(c),X(eJ($)),aq.o.success(`${$.label} provisioned and connected.`),i().catch(()=>{})}catch(a){aq.o.error("Surface provisioning failed.",{description:a instanceof Error?a.message:"Unknown surface error."})}finally{ai()}}},av=async(a,b)=>{if(k&&b){ah("Updating owner agent...");try{let c=m.find(b=>b.id===a)??null,d=c?.workspaces.find(a=>a.workspaceId===k.id)??null;if(c&&d&&!d.agentIds.includes(b)){let c=await ap({action:"bind-agent",channelId:a,agentId:b,workspacePath:k.path});as(c)}let e=await ap({action:"primary",channelId:a,primaryAgentId:b});as(e),aq.o.success("Owner agent updated."),i().catch(()=>{})}catch(a){aq.o.error("Surface update failed.",{description:a instanceof Error?a.message:"Unknown surface error."})}finally{ai()}}},aw=async a=>{ah("Disconnecting surface from workspace...");try{let b=await ar({channelId:a});as(b),aq.o.success("Surface disconnected from this workspace."),i().catch(()=>{})}catch(a){aq.o.error("Surface disconnect failed.",{description:a instanceof Error?a.message:"Unknown surface error."})}finally{ai()}},ay=async a=>{let b=E[a]?.trim(),c=G[a]?.trim();if(k&&b){ah(c?"Adding assistant and assigning route...":"Adding assistant agent...");try{let d=await ap({action:"bind-agent",channelId:a,agentId:b,workspacePath:k.path});as(d);let e=null;if(c){let d=m.find(b=>b.id===a)??null,f=d?.workspaces.find(a=>a.workspaceId===k.id)??null;if(!d||!f)throw Error("Surface route binding was not found.");let g=(f.groupAssignments??[]).filter(a=>!1!==a.enabled),h=d.workspaces.flatMap(a=>(a.groupAssignments??[]).filter(a=>!1!==a.enabled)),i=eO(I[a]??[],h,d.type).find(a=>a.routeId===c)??null;e=i?.title??c;let j={chatId:c,title:i?.title??g.find(a=>a.chatId===c)?.title??null,agentId:b,enabled:!0},l=g.some(a=>a.chatId===c)?g.map(a=>a.chatId===c?{...a,...j}:a):[...g,j],n=await ap({action:"groups",channelId:a,groupAssignments:l});as(n)}F(b=>({...b,[a]:""})),H(b=>({...b,[a]:""})),aq.o.success(c?"Assistant added and assigned.":"Assistant agent added.",{description:c&&e?`${ac(b,b)} now owns ${e}.`:void 0}),i().catch(()=>{})}catch(a){aq.o.error("Assistant update failed.",{description:a instanceof Error?a.message:"Unknown surface error."})}finally{ai()}}},az=async(a,b)=>{ah("Removing assistant agent...");try{let c=await ap({action:"unbind-agent",channelId:a,agentId:b});as(c),aq.o.success("Assistant agent removed."),i().catch(()=>{})}catch(a){aq.o.error("Assistant update failed.",{description:a instanceof Error?a.message:"Unknown surface error."})}finally{ai()}},aA=async(a,b)=>{ah("Updating surface routes...");try{let c=await ap({action:"groups",channelId:a,groupAssignments:b});as(c),i().catch(()=>{})}catch(a){aq.o.error("Surface route update failed.",{description:a instanceof Error?a.message:"Unknown surface routing error."})}finally{ai()}},aB=async()=>{if(P){ah(`Deleting ${P.name} from OpenClaw...`);try{let a=await ar({channelId:P.id,scope:"global"});a.registry&&j&&j(b=>{var c,d;return c=bh(b,a.registry),d=P.id,{...c,channelAccounts:c.channelAccounts.filter(a=>a.id!==d)}}),Q(null),V(""),aq.o.success("Surface account deleted everywhere."),i().catch(()=>{})}catch(a){aq.o.error("Surface deletion failed.",{description:a instanceof Error?a.message:"Unknown surface error."})}finally{ai()}}},aC=!!P&&U.trim().toLowerCase()===P.name.trim().toLowerCase(),aD="chat"===$.kind?null:eK($.provisionFields,W),aE="chat"===$.kind?null:function(a){switch(a){case"gmail":return"hooks.gmail";case"email":return"email";case"webhook":return"hooks";case"cron":return"cron";default:return a}}($.provider),aF=$.provisionFields.every(a=>(function(a,b){if(!a.required)return!0;let c=b[a.key];return"checkbox"===a.inputType?!0===c:"number"===a.inputType?"string"==typeof c&&c.trim().length>0&&Number.isFinite(Number(c.trim())):"string"==typeof c&&c.trim().length>0})(a,W)),aG=$.supportsProvisioning&&!w&&!!C&&!!eI(W,"name").trim()&&aF,aH=a=>{let b=`surface-${a.key}`,c=W[a.key];return"checkbox"===a.inputType?(0,d.jsxs)("label",{htmlFor:b,className:"flex cursor-pointer items-start gap-3 rounded-xl border border-white/8 bg-white/[0.02] px-3 py-2.5 transition-colors hover:bg-white/[0.04]",children:[(0,d.jsx)("input",{id:b,type:"checkbox",checked:!!c,disabled:w,onChange:b=>X(c=>({...c,[a.key]:b.target.checked})),className:"mt-0.5 h-4 w-4 rounded border-white/20 bg-white/5 text-cyan-400 focus:ring-cyan-400/60"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"text-sm font-medium text-white",children:a.label}),a.helpText?(0,d.jsx)("p",{className:"mt-1 text-[11px] leading-4 text-slate-500",children:a.helpText}):null]})]},a.key):(0,d.jsxs)(eN,{label:a.label,htmlFor:b,children:["select"===a.inputType?(0,d.jsxs)("select",{id:b,value:"string"==typeof c?c:"",onChange:b=>X(c=>({...c,[a.key]:b.target.value})),className:"flex h-10 w-full rounded-xl border border-white/10 bg-white/5 px-3 py-2 text-sm text-white outline-none",disabled:w,children:[(0,d.jsx)("option",{value:"",children:"Select one"}),(a.options??[]).map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))]}):"textarea"===a.inputType?(0,d.jsx)(bH,{id:b,value:"string"==typeof c?c:"",onChange:b=>X(c=>({...c,[a.key]:b.target.value})),placeholder:a.placeholder,disabled:w,className:"min-h-20 rounded-xl px-3 py-2"}):(0,d.jsx)(y,{id:b,type:"number"===a.inputType?"number":a.secret?"password":a.inputType??"text",value:"string"==typeof c?c:"",onChange:b=>X(c=>({...c,[a.key]:b.target.value})),placeholder:a.placeholder,disabled:w,className:"h-10 rounded-xl px-3"}),a.helpText?(0,d.jsx)("p",{className:"text-[11px] leading-4 text-slate-500",children:a.helpText}):null]},a.key)};return(0,d.jsxs)(ae,{open:c,onOpenChange:e,children:[(0,d.jsx)(aj,{className:"flex max-h-[calc(100dvh-2rem)] w-[calc(100vw-1rem)] max-w-5xl flex-col overflow-hidden rounded-[22px] p-0",closeClassName:"right-3 top-3",children:(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,d.jsx)(ak,{className:"border-b border-white/10 px-4 py-3 pr-12 sm:px-5",children:(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)(am,{className:"text-lg",children:"Workspace surfaces"}),(0,d.jsx)(an,{className:"mt-1 text-xs",children:"Manage accounts, owners, and routes for this workspace."})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 text-[10px] text-slate-400",children:[(0,d.jsxs)(u,{variant:"muted",className:"h-6 rounded-full px-2 text-[10px]",children:[m.length," linked"]}),(0,d.jsxs)(u,{variant:"muted",className:"h-6 rounded-full px-2 text-[10px]",children:[n.length," accounts"]})]})]})}),w&&A?(0,d.jsx)("div",{className:"mx-4 mt-4 rounded-2xl border border-cyan-300/20 bg-cyan-400/[0.08] px-3 py-2 sm:mx-6",children:(0,d.jsxs)("div",{className:"flex items-center gap-2 text-[11px] text-cyan-50",children:[(0,d.jsx)(h.A,{className:"h-3.5 w-3.5 animate-spin"}),(0,d.jsx)("span",{children:A})]})}):null,(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 py-4 sm:px-5",children:(0,d.jsxs)("div",{className:"grid min-h-0 gap-4 sm:grid-cols-[220px_minmax(0,1fr)]",children:[(0,d.jsxs)("aside",{className:"h-fit rounded-2xl border border-white/10 bg-white/[0.025] p-2.5 sm:sticky sm:top-0",children:[(0,d.jsx)(R,{value:q,onValueChange:a=>r(a),children:(0,d.jsx)(S,{className:"grid h-9 w-full grid-cols-3 rounded-xl",children:p.map(a=>(0,d.jsx)(T,{className:"h-7 rounded-lg px-2 text-[11px]",value:a,children:eP(a)},a))})}),(0,d.jsx)("div",{className:"mt-2.5 space-y-1.5",children:af.map(a=>{let b=bc(a),c=m.filter(b=>b.type===a).length,e=n.filter(b=>b.type===a).length;return(0,d.jsxs)("button",{type:"button",onClick:()=>v(a),className:s("flex w-full items-center justify-between gap-3 rounded-xl border px-2.5 py-2 text-left transition-colors",t===a?"border-cyan-300/35 bg-cyan-400/[0.08]":"border-white/8 bg-white/[0.02] hover:bg-white/[0.04]"),children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2.5",children:[(0,d.jsx)(eH,{provider:a,className:"h-8 w-8 shrink-0"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-sm font-medium text-white",children:b.label}),(0,d.jsxs)("p",{className:"mt-0.5 truncate text-[10px] text-slate-500",children:[e," account",1===e?"":"s"]})]})]}),(0,d.jsx)(u,{variant:"muted",className:"h-5 shrink-0 rounded-full px-2 text-[10px]",children:c})]},a)})})]}),(0,d.jsxs)("div",{className:"min-w-0 space-y-4",children:[(0,d.jsxs)("section",{className:"rounded-2xl border border-white/10 bg-white/[0.025] p-3.5",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("p",{className:"min-w-0 truncate text-sm font-medium text-white",children:[$.label," surfaces"]}),(0,d.jsxs)(u,{variant:"muted",className:"h-6 rounded-full px-2 text-[10px]",children:[Z.length," linked"]})]}),Z.length>0?(0,d.jsx)("div",{className:"mt-3 space-y-2.5",children:Z.map(a=>{var b;let c=a.workspaces.find(a=>a.workspaceId===k?.id)??null,e=(c?.agentIds??[]).filter(b=>b!==a.primaryAgentId),g=l.filter(b=>b.id!==a.primaryAgentId&&!(c?.agentIds??[]).includes(b.id)),i=(c?.groupAssignments??[]).filter(a=>!1!==a.enabled),j=a.workspaces.flatMap(a=>(a.groupAssignments??[]).filter(a=>!1!==a.enabled)),m=a.workspaces.filter(a=>a.workspaceId!==k?.id).flatMap(b=>(b.groupAssignments??[]).filter(a=>!1!==a.enabled&&a.chatId).map(c=>({routeId:c.chatId,workspaceName:ad(b.workspaceId),ownerName:c.agentId?ac(c.agentId,c.agentId):`${ac(a.primaryAgentId,"Primary agent")} fallback`}))).reduce((a,b)=>({...a,[b.routeId]:[...a[b.routeId]??[],{workspaceName:b.workspaceName,ownerName:b.ownerName}]}),{}),n=I[a.id]??[],o=!!L[a.id],p=N[a.id]??null,q=eO(n,j.length>0?j:i,a.type),r=l.some(b=>b.id===a.primaryAgentId);return(0,d.jsxs)("div",{className:"rounded-2xl border border-white/8 bg-white/[0.02] p-3",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)(eH,{provider:a.type,className:"h-9 w-9 shrink-0"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("p",{className:"truncate text-sm font-medium text-white",children:a.name}),(0,d.jsx)(u,{variant:"muted",className:"h-5 rounded-full px-2 text-[10px]",children:eP($.kind)})]}),(0,d.jsx)("p",{className:"mt-1 truncate text-[11px] text-slate-500",children:a.id})]})]}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,d.jsxs)(x,{type:"button",variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",disabled:w,onClick:()=>void aw(a.id),children:[(0,d.jsx)(eF.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Disconnect"]}),(0,d.jsx)(x,{type:"button",variant:"destructive",size:"sm",className:"h-8 w-8 rounded-full p-0",disabled:w,"aria-label":`Delete ${a.name}`,title:"Delete everywhere",onClick:()=>{let b=Y.find(b=>b.id===a.id)??null,c=b??Y.find(b=>eQ(b.id)===a.id)??null,d=b??(c?{...c,id:a.id}:null);d&&(Q(d),V(""))},children:(0,d.jsx)(dO.A,{className:"h-3.5 w-3.5"})})]})]}),(0,d.jsxs)("div",{className:"mt-3 grid gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]",children:[(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)(eN,{label:"chat"===$.kind?"Primary agent":"Owner agent",htmlFor:`primary-${a.id}`,children:(0,d.jsxs)("select",{id:`primary-${a.id}`,value:a.primaryAgentId??"",disabled:w,onChange:b=>void av(a.id,b.target.value),className:"flex h-9 w-full rounded-xl border border-white/10 bg-white/5 px-3 text-sm text-white outline-none",children:[(0,d.jsx)("option",{value:"",children:"Select agent"}),a.primaryAgentId&&!r?(0,d.jsxs)("option",{value:a.primaryAgentId,children:[ac(a.primaryAgentId,a.primaryAgentId)," \xb7 outside this workspace"]}):null,l.map(a=>(0,d.jsx)("option",{value:a.id,children:J(a)},a.id))]})}),(0,d.jsxs)("p",{className:"flex items-center gap-1.5 text-[11px] text-slate-500",children:[(0,d.jsx)(eG.A,{className:"h-3 w-3"}),ac(a.primaryAgentId)]})]}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.16em] text-slate-400",children:"Assistants available for routes"}),(0,d.jsx)("p",{className:"text-[11px] leading-4 text-slate-500",children:"Add an agent to the surface, then optionally assign it to a route."})]}),e.length>0?(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map(b=>(0,d.jsxs)("button",{type:"button",disabled:w,onClick:()=>void az(a.id,b),className:"inline-flex items-center gap-2 rounded-full border border-white/10 bg-white/[0.04] px-2.5 py-1 text-[11px] text-slate-200 transition-colors hover:bg-white/[0.08]",children:[(0,d.jsx)("span",{children:ac(b,b)}),(0,d.jsx)("span",{className:"text-slate-500",children:"remove"})]},`${a.id}-${b}`))}):(0,d.jsx)("p",{className:"text-[11px] text-slate-400",children:"No assistant agents attached yet."}),g.length>0?(0,d.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-end",children:[(0,d.jsxs)("div",{className:"grid flex-1 gap-2 sm:grid-cols-2",children:[(0,d.jsxs)("select",{value:E[a.id]??"",disabled:w,"aria-label":"Assistant agent",onChange:b=>F(c=>({...c,[a.id]:b.target.value})),className:"flex h-9 w-full rounded-xl border border-white/10 bg-white/5 px-3 text-sm text-white outline-none",children:[(0,d.jsx)("option",{value:"",children:"Select assistant"}),g.map(a=>(0,d.jsx)("option",{value:a.id,children:J(a)},a.id))]}),(0,d.jsxs)("select",{value:G[a.id]??"",disabled:w||0===q.length,"aria-label":"Initial route assignment",onChange:b=>H(c=>({...c,[a.id]:b.target.value})),className:"flex h-9 w-full rounded-xl border border-white/10 bg-white/5 px-3 text-sm text-white outline-none disabled:cursor-not-allowed disabled:opacity-50",children:[(0,d.jsx)("option",{value:"",children:q.length>0?"No route yet":"No discovered routes"}),q.map(b=>(0,d.jsxs)("option",{value:b.routeId,children:["Assign to ",b.title??b.routeId]},`${a.id}-target-${b.routeId}`))]})]}),(0,d.jsxs)(x,{type:"button",size:"sm",className:"h-9 rounded-full px-3 text-[11px] sm:shrink-0",disabled:w||!(E[a.id]??"").trim(),onClick:()=>void ay(a.id),children:[(0,d.jsx)(ax.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Add"]})]}):null]})]}),$.supportsRouteDiscovery?(0,d.jsxs)("div",{className:"mt-3 rounded-2xl border border-white/8 bg-white/[0.025] p-3",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("p",{className:"text-sm font-medium text-white",children:[bc(a.type).label," routes"]}),(0,d.jsx)("p",{className:"mt-0.5 text-[11px] text-slate-500",children:"Unassigned routes use the primary agent."})]}),(0,d.jsxs)(x,{type:"button",variant:"ghost",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",disabled:w||o,onClick:()=>void ag(a.id,a.type),children:[o?(0,d.jsx)(h.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(f.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Routes"]})]}),p?(0,d.jsx)("p",{className:"mt-3 text-[11px] text-rose-300",children:p}):null,q.length>0?(0,d.jsx)("div",{className:"mt-3 space-y-2",children:q.map(b=>{var c;let e,f=i.find(a=>a.chatId===b.routeId)??null,g=m[b.routeId]??[],h=!!f,j=h?i.filter(a=>a.chatId!==b.routeId):[...i,{chatId:b.routeId,title:b.title??null,agentId:null,enabled:!0}];return(0,d.jsx)("div",{className:"rounded-xl border border-white/8 bg-white/[0.02] px-3 py-2.5",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("input",{type:"checkbox",className:"mt-0.5 h-4 w-4 rounded border-white/15 bg-white/5 accent-cyan-300",checked:h,disabled:w,onChange:()=>void aA(a.id,j)}),(0,d.jsx)("div",{className:"min-w-0 flex-1",children:(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("p",{className:"truncate text-sm font-medium text-white",children:b.title??b.routeId}),(0,d.jsx)(u,{variant:"muted",className:"h-5 rounded-full px-2 text-[10px]",children:b.kind})]}),(0,d.jsxs)("p",{className:"mt-1 truncate text-[11px] text-slate-500",children:[b.subtitle??b.routeId,b.lastSeen?` \xb7 seen ${Number.isNaN(e=Date.parse(c=b.lastSeen))?c:new Date(e).toISOString().replace("T"," ").slice(0,16)}`:""]}),g.length>0?(0,d.jsxs)("p",{className:"mt-1 text-[11px] leading-4 text-amber-100/75",children:["Also routed in"," ",g.map(a=>`${a.workspaceName} by ${a.ownerName}`).join(", ")]}):null]}),(0,d.jsxs)("div",{className:"min-w-[190px] space-y-1",children:[(0,d.jsx)("p",{className:"px-1 text-[9px] uppercase tracking-[0.14em] text-slate-500",children:"Route owner"}),(0,d.jsxs)("select",{value:f?.agentId??"",disabled:w||!h,onChange:c=>void aA(a.id,i.map(a=>a.chatId===b.routeId?{...a,title:b.title??a.title??null,agentId:c.target.value||null}:a)),className:"flex h-8 w-full rounded-full border border-white/10 bg-white/5 px-3 text-[11px] text-white outline-none disabled:cursor-not-allowed disabled:opacity-50",children:[(0,d.jsx)("option",{value:"",children:"Primary fallback"}),l.map(a=>(0,d.jsx)("option",{value:a.id,children:J(a)},a.id))]})]})]})})]})},`${a.id}:${b.routeId}`)})}):(0,d.jsx)("div",{className:"mt-3 rounded-xl border border-dashed border-white/10 bg-white/[0.02] px-3 py-3 text-[11px] text-slate-500",children:"telegram"===(b=a.type)?"No Telegram groups found yet. Send one message in the target group, then refresh surface discovery.":"discord"===b?"No Discord surfaces were discovered yet. Send one message in the target server, then refresh surface discovery.":"No surfaces were discovered yet for this provider."})]}):null]},a.id)})}):(0,d.jsxs)("div",{className:"mt-3 rounded-xl border border-dashed border-white/10 bg-white/[0.02] px-3 py-3 text-sm text-slate-500",children:["No ",$.label," surfaces are linked to this workspace yet."]})]}),(0,d.jsxs)("section",{className:"rounded-2xl border border-white/10 bg-white/[0.025] p-3.5",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("p",{className:"min-w-0 truncate text-sm font-medium text-white",children:["Connect ",$.label]}),(0,d.jsxs)(u,{variant:"muted",className:"h-6 rounded-full px-2 text-[10px]",children:[Y.length," available"]})]}),(0,d.jsxs)("div",{className:"mt-3 grid gap-3 xl:grid-cols-[minmax(0,1.1fr)_minmax(0,0.9fr)]",children:[(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.16em] text-slate-500",children:"Existing accounts"}),Y.length>0?Y.map(a=>{let b=ab(a.id);return(0,d.jsxs)("div",{className:"flex flex-col gap-3 rounded-xl border border-white/8 bg-white/[0.02] px-3 py-2.5 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)(eH,{provider:a.type,className:"h-8 w-8 shrink-0"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-sm font-medium text-white",children:a.name}),(0,d.jsx)("p",{className:"mt-1 truncate text-[11px] text-slate-500",children:a.id})]})]}),(0,d.jsx)(x,{type:"button",size:"sm",variant:b?"secondary":"default",className:"h-8 rounded-full px-3 text-[11px]",disabled:w||b,onClick:()=>void at(a),children:b?"Linked":(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(eF.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Connect"]})})]},a.id)}):(0,d.jsxs)("div",{className:"rounded-xl border border-dashed border-white/10 bg-white/[0.02] px-3 py-3 text-sm text-slate-500",children:["No ",$.label," accounts found."]})]}),(0,d.jsxs)("div",{className:"space-y-3 rounded-xl border border-white/8 bg-white/[0.02] p-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:"text-sm font-medium text-white",children:"Provision"}),(0,d.jsx)(u,{variant:"muted",className:"h-5 rounded-full px-2 text-[10px]",children:$.supportsProvisioning?"AgentOS":"OpenClaw"})]}),(0,d.jsx)(eN,{label:"Surface name",htmlFor:"surface-name",children:(0,d.jsx)(y,{id:"surface-name",value:eI(W,"name"),onChange:a=>X(b=>({...b,name:a.target.value})),placeholder:`${$.label} workspace surface`,className:"h-10 rounded-xl px-3"})}),_.length>0?(0,d.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:_.map(aH)}):null,aa.length>0?(0,d.jsxs)("details",{className:"rounded-xl border border-white/8 bg-white/[0.015] p-3",children:[(0,d.jsx)("summary",{className:"cursor-pointer list-none text-xs font-medium uppercase tracking-[0.16em] text-slate-500",children:"Advanced settings"}),(0,d.jsx)("div",{className:"mt-3 grid gap-3 md:grid-cols-2",children:aa.map(aH)})]}):null,aD&&aE?(0,d.jsxs)("details",{className:"rounded-xl border border-cyan-300/15 bg-cyan-400/[0.04] p-3",children:[(0,d.jsx)("summary",{className:"cursor-pointer list-none text-xs font-medium uppercase tracking-[0.16em] text-cyan-100",children:"Config preview"}),(0,d.jsx)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:(0,d.jsx)(u,{variant:"muted",className:"h-6 rounded-full px-2 text-[10px]",children:aE})}),"gmail"===$.provider?(0,d.jsx)("p",{className:"mt-2 text-[11px] leading-5 text-cyan-100/70",children:"Includes Gmail hook enablement."}):null,(0,d.jsx)("pre",{className:"mt-3 max-h-52 overflow-auto rounded-xl border border-white/10 bg-slate-950/80 p-3 text-[11px] leading-5 text-slate-100",children:JSON.stringify(aD,null,2)})]}):null,(0,d.jsx)(eN,{label:"Primary agent",htmlFor:"surface-primary-agent",children:(0,d.jsxs)("select",{id:"surface-primary-agent",value:C,onChange:a=>D(a.target.value),className:"flex h-10 w-full rounded-xl border border-white/10 bg-white/5 px-3 py-2 text-sm text-white outline-none",children:[(0,d.jsx)("option",{value:"",children:"Select agent"}),l.map(a=>(0,d.jsx)("option",{value:a.id,children:J(a)},a.id))]})}),(0,d.jsx)(x,{type:"button",className:"h-10 rounded-full px-4 text-sm",disabled:!aG,onClick:()=>void au(),children:w?"Provisioning...":(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(ax.A,{className:"mr-1.5 h-4 w-4"}),"Provision"]})})]})]})]})]})]})}),(0,d.jsx)(al,{className:"border-t border-white/10 px-4 py-3 sm:px-5",children:(0,d.jsx)(x,{variant:"secondary",onClick:()=>e(!1),children:"Close"})})]})}),(0,d.jsx)(ae,{open:!!P,onOpenChange:a=>!a&&Q(null),children:(0,d.jsxs)(aj,{className:"sm:max-w-2xl",children:[(0,d.jsxs)(ak,{children:[(0,d.jsx)(am,{children:"Delete OpenClaw account"}),(0,d.jsx)(an,{children:"This removes the account from every workspace overlay. For provider-backed chat accounts, AgentOS also asks OpenClaw to delete the underlying account when supported."})]}),(0,d.jsx)("div",{className:"rounded-[20px] border border-rose-500/25 bg-rose-500/[0.08] p-4",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)(o.A,{className:"mt-0.5 h-4 w-4 shrink-0 text-rose-200"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("p",{className:"text-sm font-medium text-rose-50",children:["Type ",P?.name??"the account name"," to confirm deletion."]}),(0,d.jsx)("p",{className:"mt-1 text-xs leading-5 text-rose-100/80",children:"This action removes the account overlay everywhere and may delete the underlying OpenClaw provider account if the provider supports it."})]})]})}),(0,d.jsx)(eN,{label:`Type ${P?.name??""} to confirm`,htmlFor:"delete-surface-confirm",children:(0,d.jsx)(y,{id:"delete-surface-confirm",value:U,onChange:a=>V(a.target.value),placeholder:P?.name??""})}),(0,d.jsxs)(al,{children:[(0,d.jsx)(x,{variant:"secondary",onClick:()=>{Q(null),V("")},children:"Cancel"}),(0,d.jsx)(x,{variant:"destructive",disabled:!aC||w,onClick:()=>void aB(),children:w?"Deleting...":"Delete everywhere"})]})]})})]})}function eN({label:a,htmlFor:b,children:c}){return(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)(bm,{htmlFor:b,className:"text-[10px] uppercase tracking-[0.16em] text-slate-400",children:a}),c]})}function eO(a,b,c){let d=new Map;for(let b of a)d.set(b.routeId,b);for(let a of b)d.set(a.chatId,{routeId:a.chatId,provider:c,kind:function(a,b){if("telegram"===a)return"group";if("discord"===a){if(b.startsWith("thread:"))return"thread";if(b.startsWith("role:"))return"role"}return"channel"}(c,a.chatId),title:a.title??d.get(a.chatId)?.title??null,subtitle:d.get(a.chatId)?.subtitle??null,lastSeen:d.get(a.chatId)?.lastSeen??null});return Array.from(d.values()).sort((a,b)=>{let c=a.title??a.routeId,d=b.title??b.routeId;return c.localeCompare(d)})}function eP(a){return a.slice(0,1).toUpperCase()+a.slice(1)}function eQ(a){return a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}var eR=c(41160),eS=c(97621),eT=c(75842),eU=c(68762),eV=c(43032);let eW={context:"Context",memory:"Memory",identity:"Identity",tools:"Tools",boot:"Boot",skills:"Skills","project-config":"Project Config","agent-policy-config":"Agent Policy/Config"};function eX({snapshot:a,workspaceId:b,open:c,onOpenChange:e}){let i=(0,g.useMemo)(()=>a.workspaces.find(a=>a.id===b)??null,[a.workspaces,b]),[j,k]=(0,g.useState)([]),[l,m]=(0,g.useState)(null),[n,p]=(0,g.useState)(null),[q,r]=(0,g.useState)(""),[t,v]=(0,g.useState)(""),[w,y]=(0,g.useState)(!1),[z,A]=(0,g.useState)(!1),[B,C]=(0,g.useState)(!1),[D,E]=(0,g.useState)(null),[F,G]=(0,g.useState)(null),[H,I]=(0,g.useState)(!0),[J,K]=(0,g.useState)([]),[L,M]=(0,g.useState)(!1),N=q!==t,O=n??j.find(a=>a.path===l)??null,P=!!(O?.editable&&!z),Q=(0,g.useMemo)(()=>{if(!b)return[];let c=a.agents.filter(a=>a.workspaceId===b),d=new Map((i?.agentIds??[]).map((a,b)=>[a,b]));return c.toSorted((a,b)=>(d.get(a.id)??Number.MAX_SAFE_INTEGER)-(d.get(b.id)??Number.MAX_SAFE_INTEGER)||a.name.localeCompare(b.name))},[a.agents,i?.agentIds,b]),R=(0,g.useMemo)(()=>(function(a,b){let c=[],d=new Map(b.map(a=>[a.id,[]]));for(let e of a){let a=e3(e,b);if(!a){c.push(e);continue}let f=d.get(a)??[];f.push(e),d.set(a,f)}for(let a of b)d.set(a.id,(d.get(a.id)??[]).toSorted((a,b)=>Number(e1(b))-Number(e1(a))||Number(e2(a))-Number(e2(b))||a.path.localeCompare(b.path)));return{workspaceFiles:c,agentFilesByAgentId:d,agentGroups:b.map(a=>({agent:a,files:d.get(a.id)??[]}))}})(j,Q),[j,Q]),S=(0,g.useMemo)(()=>O?e3(O,Q):null,[O,Q]),T=!!(O&&!S),U=(0,g.useCallback)(async()=>{if(b){y(!0),E(null);try{let a=await fetch(`/api/workspaces/${encodeURIComponent(b)}/files`,{cache:"no-store"}),c=await a.json();if(!a.ok||c.error)throw Error(c.error||"Workspace file list could not be loaded.");k(c.files),G(c.maxFileBytes),m(a=>{var b;return a&&c.files.some(b=>b.path===a)?a:(b=c.files,b.find(a=>"AGENTS.md"===a.path)?.path??b.find(a=>a.exists)?.path??b[0]?.path??null)})}catch(a){k([]),m(null),p(null),r(""),v(""),E(a instanceof Error?a.message:"Workspace file list could not be loaded.")}finally{y(!1)}}},[b]),V=(0,g.useCallback)(a=>a.path===l||(!N||!!window.confirm("Discard unsaved changes?"))&&(m(a.path),p(a),!0),[N,l]),W=(0,g.useCallback)(a=>{if(!J.includes(a)){let b=R.agentFilesByAgentId.get(a)?.[0];if(b&&!V(b))return}K(b=>b.includes(a)?b.filter(b=>b!==a):[...b,a])},[J,R.agentFilesByAgentId,V]),X=(0,g.useCallback)(()=>{if(!H){let a=R.workspaceFiles[0];if(a&&!V(a))return}I(a=>!a)},[R.workspaceFiles,V,H]),Y=(0,g.useCallback)(async()=>{if(b&&O&&O.editable){if(F&&new Blob([q]).size>F)return void E(`File exceeds ${e4(F)}.`);if("json"===O.language)try{JSON.parse(q)}catch(a){E(a instanceof Error?`Invalid JSON: ${a.message}`:"Invalid JSON.");return}C(!0),E(null);try{let a=!O.exists,c=await fetch(`/api/workspaces/${encodeURIComponent(b)}/files`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:O.path,content:q})}),d=await c.json();if(!c.ok||d.error)throw Error(d.error||"Workspace file could not be saved.");p(d.file),k(a=>{var b,c;return b=a,c=d.file,b.some(a=>a.path===c.path)?b.map(a=>a.path===c.path?c:a):[...b,c]}),r(d.content),v(d.content),G(d.maxFileBytes),aq.o.success(a?"Workspace file created.":"Workspace file saved.")}catch(b){let a=b instanceof Error?b.message:"Workspace file could not be saved.";E(a),aq.o.error("Workspace file save failed.",{description:a})}finally{C(!1)}}},[O,q,F,b]),Z=(0,g.useCallback)(()=>{r(t),E(null)},[t]);return(0,d.jsx)(ae,{open:c,onOpenChange:e,children:(0,d.jsxs)(aj,{className:"flex h-[min(780px,calc(100vh-48px))] max-w-[min(1120px,calc(100vw-32px))] flex-col gap-0 overflow-hidden rounded-[24px] p-0",children:[(0,d.jsxs)(ak,{className:"border-b border-white/10 px-6 py-5",children:[(0,d.jsx)(am,{className:"text-lg",children:"OpenClaw Workspace Files"}),(0,d.jsx)(an,{className:"truncate",children:i?`${i.name} \xb7 ${i.path}`:"Workspace context, memory, policy, and config files."})]}),(0,d.jsxs)("div",{className:"grid min-h-0 flex-1 grid-cols-1 md:grid-cols-[340px_minmax(0,1fr)]",children:[(0,d.jsxs)("aside",{className:"min-h-0 overflow-y-auto border-b border-white/10 bg-white/[0.02] p-3 md:border-b-0 md:border-r",children:[(0,d.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-3",children:[(0,d.jsx)("p",{className:"text-xs font-medium uppercase tracking-[0.16em] text-slate-400",children:"Files"}),(0,d.jsxs)(x,{type:"button",variant:"ghost",size:"sm",onClick:()=>void U(),disabled:w||!b,className:"h-8 rounded-xl px-2 text-xs",children:[(0,d.jsx)(f.A,{className:s("mr-1.5 h-3.5 w-3.5",w&&"animate-spin")}),"Refresh"]})]}),w?(0,d.jsxs)("div",{className:"flex items-center gap-2 rounded-2xl border border-white/10 bg-white/[0.03] px-3 py-3 text-xs text-slate-300",children:[(0,d.jsx)(h.A,{className:"h-3.5 w-3.5 animate-spin"}),"Loading workspace files"]}):0===j.length?(0,d.jsx)("div",{className:"rounded-2xl border border-white/10 bg-white/[0.03] px-3 py-3 text-xs text-slate-400",children:"No editable OpenClaw workspace files were found."}):(0,d.jsxs)("div",{className:"space-y-5",children:[(0,d.jsx)("div",{className:"space-y-2",children:(0,d.jsx)(e$,{files:R.workspaceFiles,expanded:H,active:T,activePath:O?.path??null,onToggle:X,onSelectFile:V})}),(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)(eZ,{label:"Agents",detail:`${Q.length} members`}),(0,d.jsx)("div",{className:"space-y-2",children:0===Q.length?(0,d.jsx)("div",{className:"rounded-2xl border border-white/10 bg-white/[0.03] px-3 py-3 text-xs text-slate-400",children:"No agents are assigned to this workspace."}):R.agentGroups.map(a=>(0,d.jsx)(e_,{group:a,expanded:J.includes(a.agent.id),active:S===a.agent.id,activePath:O?.path??null,onToggle:W,onSelectFile:V},a.agent.id))})]}),Q.length>0&&R.agentGroups.every(a=>0===a.files.length)?(0,d.jsx)("div",{className:"rounded-2xl border border-white/10 bg-white/[0.03] px-3 py-3 text-xs text-slate-400",children:"No agent-specific editable files were found."}):null]})]}),(0,d.jsxs)("section",{className:"flex min-h-0 flex-col",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-4 border-b border-white/10 px-5 py-4",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("p",{className:"truncate font-display text-base text-white",children:O?.path??"Select a workspace file"}),O?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(u,{variant:"muted",className:"rounded-full px-2 py-0.5 text-[10px] uppercase",children:O.language}),!O.exists&&O.createable?(0,d.jsx)(u,{variant:"muted",className:"rounded-full px-2 py-0.5 text-[10px] uppercase",children:"New file"}):null]}):null]}),(0,d.jsx)("p",{className:"mt-1 text-xs text-slate-500",children:O?.description??(O?.size?`${e4(O.size)}`:"Markdown and JSON only.")})]}),O?(0,d.jsxs)("div",{className:"relative flex shrink-0 items-center gap-2",children:[(0,d.jsx)(x,{type:"button",variant:"ghost",size:"icon","aria-label":`Show information for ${O.path}`,"aria-expanded":L,onClick:()=>M(a=>!a),className:"h-8 w-8 rounded-full border border-white/10 bg-white/[0.03] text-slate-300 hover:bg-white/[0.08] hover:text-white",children:(0,d.jsx)(eR.A,{className:"h-4 w-4"})}),O.source?(0,d.jsx)(u,{variant:"muted",className:"rounded-full px-2.5 py-1 text-[10px] uppercase",children:O.source}):null,L?(0,d.jsx)(eY,{file:O}):null]}):null]}),(0,d.jsxs)("div",{className:"min-h-0 flex-1 p-5",children:[D?(0,d.jsxs)("div",{className:"mb-3 flex items-start gap-2 rounded-2xl border border-rose-300/20 bg-rose-400/10 px-3 py-2 text-xs text-rose-100",children:[(0,d.jsx)(o.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,d.jsx)("span",{children:D})]}):null,O?z?(0,d.jsxs)("div",{className:"flex h-full items-center justify-center gap-2 rounded-2xl border border-white/10 bg-white/[0.02] text-sm text-slate-300",children:[(0,d.jsx)(h.A,{className:"h-4 w-4 animate-spin"}),"Loading file"]}):O.editable?(0,d.jsx)(bH,{value:q,onChange:a=>r(a.target.value),spellCheck:!1,className:"h-full min-h-[360px] resize-none rounded-2xl font-mono text-xs leading-5"}):(0,d.jsx)("div",{className:"flex h-full items-center justify-center rounded-2xl border border-white/10 bg-white/[0.02] px-6 text-center text-sm text-slate-400",children:O.reason??"This file is not editable from AgentOS."}):(0,d.jsx)("div",{className:"flex h-full items-center justify-center rounded-2xl border border-dashed border-white/10 bg-white/[0.02] text-sm text-slate-400",children:"Select an OpenClaw workspace file."})]}),(0,d.jsxs)(al,{className:"border-t border-white/10 px-5 py-4",children:[(0,d.jsxs)(x,{type:"button",variant:"secondary",onClick:Z,disabled:!N||B,children:[(0,d.jsx)(eS.A,{className:"mr-2 h-4 w-4"}),"Discard"]}),(0,d.jsxs)(x,{type:"button",onClick:()=>void Y(),disabled:!P||O?.exists!==!1&&!N||B,children:[B?(0,d.jsx)(h.A,{className:"mr-2 h-4 w-4 animate-spin"}):O?.exists?(0,d.jsx)(dX.A,{className:"mr-2 h-4 w-4"}):(0,d.jsx)(eT.A,{className:"mr-2 h-4 w-4"}),O?.exists?"Save":"Create"]})]})]})]})]})})}function eY({file:a}){return(0,d.jsxs)("div",{className:"absolute right-0 top-10 z-20 w-[min(360px,calc(100vw-48px))] rounded-2xl border border-white/10 bg-[#0b1220] p-3 text-left shadow-[0_18px_70px_rgba(0,0,0,0.42)]",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(eR.A,{className:"mt-0.5 h-4 w-4 shrink-0 text-cyan-200"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-sm font-medium text-white",children:a.path}),(0,d.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-300",children:a.description??"Workspace-managed OpenClaw Markdown or JSON file."})]})]}),a.usage?(0,d.jsxs)("div",{className:"mt-3 rounded-xl border border-white/10 bg-white/[0.03] p-2.5",children:[(0,d.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-[0.16em] text-slate-500",children:"How to use it"}),(0,d.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-300",children:a.usage})]}):null,a.runtimeBehavior?(0,d.jsxs)("div",{className:"mt-2 rounded-xl border border-cyan-300/10 bg-cyan-300/[0.04] p-2.5",children:[(0,d.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-[0.16em] text-cyan-200/80",children:"Runtime behavior"}),(0,d.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-300",children:a.runtimeBehavior})]}):null]})}function eZ({label:a,detail:b}){return(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3 px-2",children:[(0,d.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-[0.18em] text-slate-500",children:a}),b?(0,d.jsx)("p",{className:"shrink-0 text-[10px] text-slate-600",children:b}):null]})}function e$({files:a,expanded:b,active:c,activePath:e,onToggle:f,onSelectFile:g}){let h="workspace-core-files",i=a.length>0;return(0,d.jsxs)("div",{className:s("rounded-2xl border bg-white/[0.025] p-1.5 transition-colors",c?"border-cyan-300/35 bg-cyan-300/10":"border-white/5"),children:[(0,d.jsxs)("button",{type:"button",onClick:f,disabled:!i,"aria-expanded":i?b:void 0,"aria-controls":i?h:void 0,className:s("flex w-full min-w-0 items-center gap-2 rounded-xl px-2 py-2 text-left transition-colors disabled:cursor-default",c?"text-white":"text-slate-300 hover:bg-white/[0.04] disabled:text-slate-500 disabled:hover:bg-transparent"),children:[(0,d.jsx)(a4.A,{className:s("h-3.5 w-3.5 shrink-0 text-slate-500 transition-transform",b?"rotate-0":"-rotate-90",c&&"text-cyan-200")}),(0,d.jsx)(a9.A,{className:"h-3.5 w-3.5 shrink-0 text-cyan-200"}),(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,d.jsx)("span",{className:"block truncate text-xs font-medium",children:"Workspace Files"}),(0,d.jsx)("span",{className:"mt-0.5 block truncate text-[10px] text-slate-500",children:"Shared project context and config"})]}),(0,d.jsx)(u,{variant:"muted",className:"shrink-0 rounded-full px-1.5 py-0 text-[10px]",children:a.length})]}),b&&i?(0,d.jsx)("div",{id:h,className:"ml-6 mt-1 space-y-1 border-l border-white/10 pl-2",children:a.map(a=>(0,d.jsx)(e0,{file:a,active:a.path===e,onSelect:g},a.path))}):null]})}function e_({group:a,expanded:b,active:c,activePath:e,onToggle:f,onSelectFile:g}){let h=`workspace-agent-files-${a.agent.id}`,i=a.files.length>0;return(0,d.jsxs)("div",{className:s("rounded-2xl border bg-white/[0.025] p-1.5 transition-colors",c?"border-cyan-300/35 bg-cyan-300/10":"border-white/5"),children:[(0,d.jsxs)("button",{type:"button",onClick:()=>f(a.agent.id),disabled:!i,"aria-expanded":i?b:void 0,"aria-controls":i?h:void 0,className:s("flex w-full min-w-0 items-center gap-2 rounded-xl px-2 py-2 text-left transition-colors disabled:cursor-default",c?"text-white":"text-slate-300 hover:bg-white/[0.04] disabled:text-slate-500 disabled:hover:bg-transparent"),children:[(0,d.jsx)(a4.A,{className:s("h-3.5 w-3.5 shrink-0 text-slate-500 transition-transform",b?"rotate-0":"-rotate-90",c&&"text-cyan-200")}),(0,d.jsx)(eU.A,{className:"h-3.5 w-3.5 shrink-0 text-cyan-200"}),(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,d.jsx)("span",{className:"block truncate text-xs font-medium",children:a.agent.name}),(0,d.jsx)("span",{className:"mt-0.5 block truncate text-[10px] text-slate-500",children:a.agent.id})]}),(0,d.jsx)(u,{variant:"muted",className:"shrink-0 rounded-full px-1.5 py-0 text-[10px]",children:a.files.length})]}),b&&i?(0,d.jsx)("div",{id:h,className:"ml-6 mt-1 space-y-1 border-l border-white/10 pl-2",children:a.files.map(a=>(0,d.jsx)(e0,{file:a,active:a.path===e,onSelect:g},a.path))}):null]})}function e0({file:a,active:b,onSelect:c}){return(0,d.jsxs)("button",{type:"button",onClick:()=>c(a),className:s("w-full rounded-2xl border px-3 py-2 text-left transition-colors",b?"border-cyan-300/40 bg-cyan-300/10 text-white":"border-transparent text-slate-300 hover:border-white/10 hover:bg-white/[0.04]"),children:[(0,d.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:["json"===a.language?(0,d.jsx)(eV.A,{className:"h-3.5 w-3.5 shrink-0 text-cyan-200"}):(0,d.jsx)(a9.A,{className:"h-3.5 w-3.5 shrink-0 text-slate-300"}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:a.label}),(0,d.jsx)(u,{variant:"muted",className:"rounded-full px-1.5 py-0 text-[10px]",children:eW[a.category]}),!a.exists&&a.createable?(0,d.jsx)(u,{variant:"muted",className:"rounded-full px-1.5 py-0 text-[10px]",children:"Create"}):null]}),(0,d.jsx)("span",{className:"mt-1 block truncate text-[10px] text-slate-500",children:a.path})]})}function e1(a){return/^agents\/[^/]+\/PROFILE\.md$/.test(a.path)}function e2(a){return"HEARTBEAT.md"===a.path||a.path.endsWith("/HEARTBEAT.md")}function e3(a,b){let c=/^agents\/([^/]+)\/PROFILE\.md$/.exec(a.path);if(c?.[1]&&b.some(a=>a.id===c[1]))return c[1];let d=/^\.openclaw\/agents\/([^/]+)\/agent\//.exec(a.path);if(d?.[1]&&b.some(a=>a.id===d[1]))return d[1];let e=b.find(b=>{var c;return a.path===`skills/${c=b.id,`agent-policy-${c.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64)||"agent"}`}/SKILL.md`});return e?.id??null}function e4(a){return a<1024?`${a} B`:`${Math.round(a/1024)} KB`}var e5=c(22242),e6=c(1619),e7=c(41023),e8=c(7309),e9=c(95801);function fa({progress:a,className:b}){return(0,d.jsxs)("div",{className:s("rounded-[18px] border border-white/10 bg-slate-950/50 p-4",b),children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"max-w-2xl",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:a.title}),(0,d.jsx)("p",{className:"mt-2 text-sm text-slate-200",children:a.description})]}),(0,d.jsxs)("div",{className:"shrink-0 text-right",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Progress"}),(0,d.jsxs)("p",{className:"mt-1 text-lg font-semibold text-white",children:[a.percent,"%"]})]})]}),(0,d.jsx)("div",{className:"mt-4 h-2 overflow-hidden rounded-full bg-white/8",children:(0,d.jsx)("div",{className:"h-full rounded-full bg-cyan-300/85 transition-[width] duration-500 ease-out",style:{width:`${a.percent}%`}})}),(0,d.jsx)("div",{className:"mt-4 space-y-2.5",children:a.steps.map((a,b)=>{let c="done"===a.status?"border-emerald-400/20 bg-emerald-400/10":"active"===a.status?"border-cyan-400/25 bg-cyan-400/10":"error"===a.status?"border-amber-400/25 bg-amber-400/10":"border-white/10 bg-white/[0.03]",e="done"===a.status?"border-emerald-300/30 bg-emerald-300/15 text-emerald-100":"active"===a.status?"border-cyan-300/30 bg-cyan-300/15 text-cyan-100":"error"===a.status?"border-amber-300/30 bg-amber-300/15 text-amber-100":"border-white/10 bg-slate-950/65 text-slate-400",f="done"===a.status?"bg-emerald-300/85":"active"===a.status?"bg-cyan-300/85":"error"===a.status?"bg-amber-300/85":"bg-transparent";return(0,d.jsx)("div",{className:s("rounded-[14px] border px-3 py-2.5 transition-colors",c),children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:s("mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full border text-[10px] font-medium",e),children:"done"===a.status?(0,d.jsx)(n.A,{className:"h-3.5 w-3.5"}):"active"===a.status?(0,d.jsx)(h.A,{className:"h-3.5 w-3.5 animate-spin"}):"error"===a.status?(0,d.jsx)(o.A,{className:"h-3.5 w-3.5"}):b+1}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[(0,d.jsx)("p",{className:"text-sm text-white",children:a.label}),(0,d.jsxs)("span",{className:"text-xs tabular-nums text-slate-400",children:[a.percent,"%"]})]}),(0,d.jsx)("p",{className:"mt-0.5 text-xs leading-5 text-slate-400",children:a.detail||a.description}),(0,d.jsx)("div",{className:"mt-2 h-1.5 overflow-hidden rounded-full bg-white/8",children:(0,d.jsx)("div",{className:s("h-full rounded-full transition-[width] duration-500 ease-out",f),style:{width:`${a.percent}%`}})}),a.activities.length>0?(0,d.jsx)("div",{className:"mt-2.5 space-y-1.5",children:a.activities.map(a=>(0,d.jsxs)("div",{className:"flex items-start gap-2 text-[11px] leading-5 text-slate-300",children:[(0,d.jsx)("span",{className:s("mt-[7px] h-1.5 w-1.5 shrink-0 rounded-full","done"===a.status&&"bg-emerald-300","active"===a.status&&"bg-cyan-300","error"===a.status&&"bg-amber-300","pending"===a.status&&"bg-slate-500")}),(0,d.jsx)("span",{className:"min-w-0",children:a.message})]},a.id))}):null]})]})},a.id)})})]})}var fb=c(551);let fc=g.forwardRef(({className:a,children:b,...c},e)=>(0,d.jsxs)(fb.bL,{ref:e,className:s("relative overflow-hidden",a),...c,children:[(0,d.jsx)(fb.LM,{className:"mission-scroll h-full w-full rounded-[inherit] [&>div]:!block [&>div]:!w-full [&>div]:!min-w-0",children:b}),(0,d.jsx)(fd,{}),(0,d.jsx)(fb.OK,{})]}));fc.displayName=fb.bL.displayName;let fd=g.forwardRef(({className:a,orientation:b="vertical",...c},e)=>(0,d.jsx)(fb.VM,{ref:e,orientation:b,className:s("flex touch-none select-none transition-colors","vertical"===b&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===b&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",a),...c,children:(0,d.jsx)(fb.lr,{className:"relative flex-1 rounded-full bg-white/[0.12]"})}));function fe(a){let b=a.policy,c=a.skillIds,d=fh([...a.toolIds??[],...b?.fileAccess==="workspace-only"?["fs.workspaceOnly"]:[]]),e=fh(a.channelIds??[]);return[`### ${a.name} (\`${a.id}\`)`,`- Agent id: \`${a.id}\``,`- Runtime rule: when the current OpenClaw agent id is \`${a.id}\`, use this section as the agent-specific role and persona.`,`- Role: ${a.role||"Agent"}`,`- Primary: ${a.isPrimary?"yes":"no"}`,...b?[`- Preset: ${aQ(b.preset)}`]:[],...a.modelId?[`- Model: \`${a.modelId}\``]:[],...c.length>0?[`- Skills: ${c.map(a=>`\`${a}\``).join(", ")}`]:[],...d.length>0?[`- Tools: ${d.map(a=>`\`${a}\``).join(", ")}`]:[],...b?[`- File access: ${b.fileAccess}`,`- Network access: ${b.networkAccess}`,`- Install scope: ${b.installScope}`,`- Missing tools: ${b.missingToolBehavior}`]:[],...e.length>0?[`- Channels: ${e.map(a=>`\`${a}\``).join(", ")}`]:[]].join("\n")}function ff(a,b){return[...a].map((a,c)=>{let d=fg(a.id)??fi(fg(a.name)??`agent-${c+1}`),e=b&&!d.startsWith(`${b}-`)?`${b}-${fi(d)||"agent"}`:d,f=fg(a.role),g=fh([...a.skillIds??[],fg(a.skillId)??""]);return{id:e,name:fg(a.name)??f??e,role:f,enabled:!1!==a.enabled,isPrimary:!!a.isPrimary,skillId:g[0]??null,skillIds:g,toolIds:fh(a.toolIds??[]),modelId:fg(a.modelId),policy:a.policy??null,channelIds:fh(a.channelIds??[])}}).sort((a,b)=>a.isPrimary!==b.isPrimary?a.isPrimary?-1:1:a.name.localeCompare(b.name))}function fg(a){return"string"==typeof a&&a.trim().length>0?a.trim():null}function fh(a){return Array.from(new Set(a.map(a=>a.trim()).filter(Boolean)))}function fi(a){return a.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64)}fd.displayName=fb.VM.displayName;let fj=["AGENTS.md","SOUL.md","IDENTITY.md","TOOLS.md","HEARTBEAT.md"],fk={software:"Software project",frontend:"Frontend app",backend:"Backend/API",research:"Research",content:"Content/Growth"},fl=["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 fm(a){let b=[{id:"agents",label:"AGENTS.md",relativePath:"AGENTS.md",kind:"file",headings:["Workspace","Team","Customize","Safety defaults","Daily memory","Output"]},{id:"soul",label:"SOUL.md",relativePath:"SOUL.md",kind:"file",headings:["My Purpose","How I Operate","My Quirks","Active Focus"]},{id:"identity",label:"IDENTITY.md",relativePath:"IDENTITY.md",kind:"file",headings:["Role"]},{id:"tools",label:"TOOLS.md",relativePath:"TOOLS.md",kind:"file",headings:["Examples","Notes"]},{id:"heartbeat",label:"HEARTBEAT.md",relativePath:"HEARTBEAT.md",kind:"file",headings:[]},{id:"memory-md",label:"MEMORY.md",relativePath:"MEMORY.md",kind:"file",headings:["Current brief","Stable facts"]},{id:"memory-blueprint",label:"memory/blueprint.md",relativePath:"memory/blueprint.md",kind:"file",headings:["Outcome","Constraints","Unknowns"]},{id:"memory-decisions",label:"memory/decisions.md",relativePath:"memory/decisions.md",kind:"file",headings:["Template"]},{id:"docs-brief",label:"docs/brief.md",relativePath:"docs/brief.md",kind:"file",headings:["Objective","Success signals","Open questions"]},{id:"docs-architecture",label:"docs/architecture.md",relativePath:"docs/architecture.md",kind:"file",headings:["Current shape","Dependencies","Risks"]},{id:"deliverables-readme",label:"deliverables/README.md",relativePath:"deliverables/README.md",kind:"file",headings:["Deliverables"]}];return"frontend"===a&&b.push({id:"docs-ux-notes",label:"docs/ux-notes.md",relativePath:"docs/ux-notes.md",kind:"file",headings:["UX Notes"]}),"backend"===a&&b.push({id:"docs-service-map",label:"docs/service-map.md",relativePath:"docs/service-map.md",kind:"file",headings:["Service Map"]}),"research"===a&&b.push({id:"docs-research-plan",label:"docs/research-plan.md",relativePath:"docs/research-plan.md",kind:"file",headings:["Research Plan"]}),"content"===a&&b.push({id:"docs-content-brief",label:"docs/content-brief.md",relativePath:"docs/content-brief.md",kind:"file",headings:["Content Brief"]}),b}function fn(a,b){let c=new Map(fm(a??null).map(a=>[a.relativePath,a])),d=a=>a.map(a=>c.get(a)).filter(Boolean),e=[{id:"core",title:"Core bootstrap",description:"Required for every workspace and shared by all agents.",enabled:!0,resources:d(fj)},{id:"memory",title:"Memory",description:"Durable notes and decisions that survive across sessions.",enabled:b.generateMemory,resources:b.generateMemory?d(["MEMORY.md","memory/blueprint.md","memory/decisions.md"]):[]},{id:"starter",title:"Starter docs",description:"Planning, architecture, and handoff docs used for the first pass.",enabled:b.generateStarterDocs,resources:b.generateStarterDocs?d(["docs/brief.md","docs/architecture.md","deliverables/README.md",..."frontend"===a?["docs/ux-notes.md"]:"backend"===a?["docs/service-map.md"]:"research"===a?["docs/research-plan.md"]:"content"===a?["docs/content-brief.md"]:[]]):[]}];return{template:a??null,rules:b,sections:e,resources:e.flatMap(a=>a.resources)}}function fo(a){let b=fr(a.template,a.rules),c=new Map(fq(a.docOverrides).map(a=>[a.path,a.content]));return b.map(b=>{let d=b.render(a),e=c.has(b.path);return{path:b.path,title:b.title,description:b.description,category:b.category,baseContent:d,content:e?c.get(b.path)??"":d,overridden:e}})}function fp(a){let b=fo(a).map(a=>({...a,generated:!0})),c=new Set(b.map(a=>a.path));return[...b,...fq(a.docOverrides).filter(a=>!c.has(a.path)).map(a=>{var b;return{path:a.path,title:a.path,description:"Existing workspace file.",category:(b=a.path).startsWith("memory/")?"memory":b.startsWith("docs/")?"docs":b.startsWith("deliverables/")?"deliverables":"core",baseContent:a.content,content:a.content,overridden:!1,generated:!1}})]}function fq(a){let b=new Map;for(let c of a??[]){let a=c.path.trim();a&&b.set(a,c.content)}return Array.from(b.entries()).map(([a,b])=>({path:a,content:b}))}function fr(a,b){let c=[{path:"AGENTS.md",title:"AGENTS.md",description:"Shared operating instructions for all agents.",category:"core",render:fs},{path:"SOUL.md",title:"SOUL.md",description:"Purpose, operating style, and active focus.",category:"core",render:({template:a,brief:b,contextSources:c})=>{var d,e,f;return d=a,e=b,f=c,`# SOUL
|
|
5
|
+
|
|
6
|
+
## My Purpose
|
|
7
|
+
Help this ${fk[d].toLowerCase()} workspace turn intent into real outcomes with pragmatic execution, verification, and durable memory.
|
|
8
|
+
|
|
9
|
+
## How I Operate
|
|
10
|
+
- Start from the current workspace reality before proposing large moves.
|
|
11
|
+
- Prefer concrete action, visible artifacts, and clear handoffs.
|
|
12
|
+
- Keep docs, memory, and deliverables aligned with the actual state of the work.
|
|
13
|
+
|
|
14
|
+
## My Quirks
|
|
15
|
+
- Pragmatic
|
|
16
|
+
- Direct
|
|
17
|
+
- Product-aware
|
|
18
|
+
- Quality-minded
|
|
19
|
+
|
|
20
|
+
${e?`## Active Focus
|
|
21
|
+
${e}
|
|
22
|
+
`:""}${fu(f)}`}},{path:"IDENTITY.md",title:"IDENTITY.md",description:"Workspace identity and vibe.",category:"core",render:({template:a})=>{var b;return b=a,`# IDENTITY
|
|
23
|
+
|
|
24
|
+
## Role
|
|
25
|
+
This workspace hosts a ${fk[b].toLowerCase()} team coordinated through OpenClaw.
|
|
26
|
+
|
|
27
|
+
**Vibe:** pragmatic, concise, quality-minded, workspace-grounded
|
|
28
|
+
`}},{path:"TOOLS.md",title:"TOOLS.md",description:"Repository commands and workflow notes.",category:"core",render:({template:a,toolExamples:b})=>{var c,d;return c=a,d=b??fl,`# TOOLS
|
|
29
|
+
|
|
30
|
+
Repository commands and workflow notes for this ${fk[c].toLowerCase()} workspace.
|
|
31
|
+
|
|
32
|
+
## Examples
|
|
33
|
+
${d.map(a=>`- ${a}`).join("\n")}
|
|
34
|
+
|
|
35
|
+
## Notes
|
|
36
|
+
- Replace these examples with sharper project-specific commands when the repo exposes them.
|
|
37
|
+
- Prefer repeatable commands that other agents can run without interpretation drift.
|
|
38
|
+
`}},{path:"HEARTBEAT.md",title:"HEARTBEAT.md",description:"Refresh ritual and coherence checks.",category:"core",render:({template:a})=>{var b;return b=a,`# HEARTBEAT
|
|
39
|
+
|
|
40
|
+
- Start each substantial task by refreshing the brief, docs, and current files.
|
|
41
|
+
- Keep the ${fk[b].toLowerCase()} workspace coherent across code, docs, and memory.
|
|
42
|
+
- Prefer explicit handoffs between implementation, review, testing, and knowledge capture.
|
|
43
|
+
`}}];return b.generateMemory&&c.push({path:"MEMORY.md",title:"MEMORY.md",description:"Durable project memory.",category:"memory",render:({name:a,template:b,brief:c,contextSources:d})=>{var e,f,g,h;return e=a,f=b,g=c,h=d,`# ${e} Memory
|
|
44
|
+
|
|
45
|
+
Durable project facts for this ${fk[f].toLowerCase()} workspace.
|
|
46
|
+
|
|
47
|
+
## Current brief
|
|
48
|
+
${g||"No brief captured yet. Fill this in as soon as the project goal is clarified."}
|
|
49
|
+
|
|
50
|
+
## Stable facts
|
|
51
|
+
- Add durable architecture, product, or workflow facts here.
|
|
52
|
+
- Move longer notes into memory/*.md when they outgrow this file.
|
|
53
|
+
|
|
54
|
+
${fu(h)}`}},{path:"memory/blueprint.md",title:"memory/blueprint.md",description:"Project blueprint and current outcome.",category:"memory",render:({name:a,template:b,brief:c})=>{var d,e,f;return d=a,e=b,f=c,`# ${d} Blueprint
|
|
55
|
+
|
|
56
|
+
## Workspace type
|
|
57
|
+
${fk[e]}
|
|
58
|
+
|
|
59
|
+
## Outcome
|
|
60
|
+
${f||"Define the target outcome, user impact, and quality bar for this workspace."}
|
|
61
|
+
|
|
62
|
+
## Constraints
|
|
63
|
+
- Add technical, product, legal, or operational constraints here.
|
|
64
|
+
|
|
65
|
+
## Unknowns
|
|
66
|
+
- Capture unresolved questions that block confident execution.
|
|
67
|
+
`}},{path:"memory/decisions.md",title:"memory/decisions.md",description:"Decision log.",category:"memory",render:()=>`# Decisions
|
|
68
|
+
|
|
69
|
+
Use this file for durable decisions that should survive across sessions.
|
|
70
|
+
|
|
71
|
+
## Template
|
|
72
|
+
- Date:
|
|
73
|
+
- Decision:
|
|
74
|
+
- Context:
|
|
75
|
+
- Consequence:
|
|
76
|
+
`}),b.generateStarterDocs&&c.push({path:"docs/brief.md",title:"docs/brief.md",description:"Objective, source mode, and success signals.",category:"docs",render:({name:a,template:b,brief:c,sourceMode:d,contextSources:e})=>{var f,g,h,i,j;return f=a,g=b,h=c,i=d,j=e,`# ${f} Brief
|
|
77
|
+
|
|
78
|
+
## Template
|
|
79
|
+
${fk[g]}
|
|
80
|
+
|
|
81
|
+
## Source mode
|
|
82
|
+
${i}
|
|
83
|
+
|
|
84
|
+
## Objective
|
|
85
|
+
${h||"Clarify the main goal, target user, and success definition for this workspace."}
|
|
86
|
+
|
|
87
|
+
## Success signals
|
|
88
|
+
- Define what success looks like in observable terms.
|
|
89
|
+
|
|
90
|
+
## Open questions
|
|
91
|
+
- List the unknowns worth resolving first.
|
|
92
|
+
|
|
93
|
+
${fu(j)}`}},{path:"docs/architecture.md",title:"docs/architecture.md",description:"Current system shape and dependencies.",category:"docs",render:({template:a,contextSources:b})=>{var c,d;return c=a,d=b,`# Architecture
|
|
94
|
+
|
|
95
|
+
## Current shape
|
|
96
|
+
- Describe the main components, systems, or content lanes in this ${fk[c].toLowerCase()} workspace.
|
|
97
|
+
|
|
98
|
+
## Dependencies
|
|
99
|
+
- List critical external services, repos, data sources, or channels.
|
|
100
|
+
|
|
101
|
+
## Risks
|
|
102
|
+
- Capture structural, operational, or delivery risks here.
|
|
103
|
+
|
|
104
|
+
${fu(d)}`}},{path:"deliverables/README.md",title:"deliverables/README.md",description:"Guidance for handoff artifacts.",category:"deliverables",render:()=>`# Deliverables
|
|
105
|
+
|
|
106
|
+
Use this folder for substantial output artifacts that should be easy to hand off or review.
|
|
107
|
+
|
|
108
|
+
- Create one subfolder per task or run, for example \`deliverables/2026-03-07-15-30-00-launch-brief/\`.
|
|
109
|
+
- Put drafts, reports, docs, and publishable assets for that task inside its run folder.
|
|
110
|
+
- Keep filenames descriptive and tied to the task or audience.
|
|
111
|
+
`}),"frontend"===a&&c.push({path:"docs/ux-notes.md",title:"docs/ux-notes.md",description:"Interaction patterns and UI risks.",category:"docs",render:()=>ft("ux")}),"backend"===a&&c.push({path:"docs/service-map.md",title:"docs/service-map.md",description:"Service, queue, and dependency map.",category:"docs",render:()=>ft("backend")}),"research"===a&&c.push({path:"docs/research-plan.md",title:"docs/research-plan.md",description:"Question framing and evidence plan.",category:"docs",render:()=>ft("research")}),"content"===a&&c.push({path:"docs/content-brief.md",title:"docs/content-brief.md",description:"Audience, channel, and campaign brief.",category:"docs",render:()=>ft("content")}),c}function fs({name:a,brief:b,template:c,sourceMode:d,rules:e,agents:f=[]}){var g,h,i,j;let k;return g={name:a,brief:b,templateLabel:fk[c],sourceMode:d,workspaceOnly:e.workspaceOnly,workspaceSlug:a.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64),agents:f},`# ${g.name}
|
|
112
|
+
|
|
113
|
+
Shared project context for all agents working in this workspace.
|
|
114
|
+
|
|
115
|
+
## Workspace
|
|
116
|
+
- Template: ${g.templateLabel}
|
|
117
|
+
- Source mode: ${g.sourceMode}
|
|
118
|
+
- Workspace-only access: ${g.workspaceOnly?"enabled":"disabled"}
|
|
119
|
+
|
|
120
|
+
${h=g.agents,k=ff(h,g.workspaceSlug).filter(a=>a.enabled).map(a=>{let b=[a.isPrimary?"primary":null,a.role,a.policy?aQ(a.policy.preset):null].filter(a=>!!a);return`- ${a.name} (\`${a.id}\`)${b.length>0?` \xb7 ${b.join(" \xb7 ")}`:""}`}),`## Team
|
|
121
|
+
${k.length>0?k.join("\n"):"- No active agents configured yet."}`}
|
|
122
|
+
|
|
123
|
+
${i=g.agents,j=ff(i,g.workspaceSlug).filter(a=>a.enabled).map(fe),`## Agent Roles
|
|
124
|
+
Each agent should use only the subsection matching its current OpenClaw agent id as its personal role/persona. Other subsections describe teammates in the same workspace.
|
|
125
|
+
|
|
126
|
+
${j.length>0?j.join("\n\n"):"- No active agent role sections are configured yet."}`}
|
|
127
|
+
|
|
128
|
+
## Customize
|
|
129
|
+
${g.brief||"Clarify the project goal, definition of done, constraints, and success signals before large changes."}
|
|
130
|
+
|
|
131
|
+
## Safety defaults
|
|
132
|
+
- Stay inside the attached workspace unless the task explicitly requires another location.
|
|
133
|
+
- Prefer direct, reviewable changes over speculative rewrites.
|
|
134
|
+
- Preserve user work and avoid destructive actions without clear approval.
|
|
135
|
+
- Update durable docs when stable architecture, workflow, or product decisions change.
|
|
136
|
+
- Worker and browser agents should not install tooling unless their explicit policy allows it.
|
|
137
|
+
- Route environment preparation to setup-oriented agents when the work depends on new tooling.
|
|
138
|
+
|
|
139
|
+
## Daily memory
|
|
140
|
+
- Capture durable facts in MEMORY.md and memory/*.md.
|
|
141
|
+
- Record stable decisions in memory/decisions.md.
|
|
142
|
+
- Keep temporary chatter and scratch notes in memory/.
|
|
143
|
+
|
|
144
|
+
## Output
|
|
145
|
+
- Be concise in chat and write longer output to files when the artifact matters.
|
|
146
|
+
- Put task-specific deliverables, drafts, reports, and docs inside per-run folders under deliverables/.
|
|
147
|
+
- Avoid writing final artifacts to the workspace root unless explicitly requested.
|
|
148
|
+
`}function ft(a){return"ux"===a?`# UX Notes
|
|
149
|
+
|
|
150
|
+
- Track interaction patterns, responsive edge cases, and visual risk areas here.
|
|
151
|
+
`:"backend"===a?`# Service Map
|
|
152
|
+
|
|
153
|
+
- Document services, jobs, queues, external dependencies, and critical flows here.
|
|
154
|
+
`:"research"===a?`# Research Plan
|
|
155
|
+
|
|
156
|
+
- State the question, method, evidence sources, and expected output before large investigation work.
|
|
157
|
+
`:`# Content Brief
|
|
158
|
+
|
|
159
|
+
- Capture audience, channel, tone, CTA, and distribution assumptions for this content workspace.
|
|
160
|
+
`}function fu(a){let b=(a??[]).filter(a=>"error"!==a.status&&a.summary.trim().length>0).slice(0,4);if(0===b.length)return"";let c=b.filter(a=>(a.confidence??100)>=80),d=b.filter(a=>(a.confidence??100)<80),e=a=>{let b="website"===a.kind?"Website":"repo"===a.kind?"Repo":"folder"===a.kind?"Folder":"Prompt",c="number"==typeof a.confidence?` (${a.confidence}%)`:"";return`- ${b}: ${a.label}${c} - ${a.summary}`},f=[];return c.length>0&&f.push(`## Evidence
|
|
161
|
+
${c.map(e).join("\n")}`),d.length>0&&f.push(`## Assumptions
|
|
162
|
+
${d.map(e).join("\n")}`),f.length>0?`
|
|
163
|
+
${f.join("\n\n")}
|
|
164
|
+
`:""}let fv=[{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."}],fw=[{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."}],fx=[{value:"solo",label:"Solo",description:"One primary agent with a shared workspace scaffold."},{value:"core",label:"Core team",description:"Multi-agent setup with role-specific specialists and a strong shared context."},{value:"custom",label:"Custom",description:"Start from a recommended team and toggle which specialist agents are enabled."}],fy=[{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."}],fz={workspaceOnly:!0,generateStarterDocs:!0,generateMemory:!0,kickoffMission:!0},fA={software:{label:"Software project",description:"Default project template for engineering delivery.",icon:"\uD83D\uDEE0"},frontend:{label:"Frontend app",description:"UI and experience work with browser-aware support.",icon:"\uD83C\uDFA8"},backend:{label:"Backend/API",description:"Services, infrastructure, and backend-oriented workflows.",icon:"⚙️"},research:{label:"Research",description:"Investigation-heavy workspace with synthesis and memory capture.",icon:"\uD83E\uDDE0"},content:{label:"Content/Growth",description:"Messaging, content production, campaign review, and analysis.",icon:"\uD83D\uDCE3"}},fB={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 fC(a,b,c){let d=fB[a];if("solo"===b){let a=d.find(a=>a.isPrimary)??d[0];return[{...a,name:fD(c,a.role,"Builder"===a.role?"Default Agent":a.name),policy:aP("browser"===a.id?"browser":"worker"),enabled:!0}]}return d.map(a=>({id:a.id,role:a.role,name:a.isPrimary?fD(c,a.role,a.name):a.name,emoji:a.emoji,theme:a.theme,skillId:a.skillId,modelId:a.modelId,isPrimary:!!a.isPrimary,policy:aP("browser"===a.id?"browser":"worker"),enabled:!0}))}function fD(a,b,c){let d=function(a){let b=a?.trim();if(!b)return"";let c=(!/\s/.test(b)&&b.includes(".")?b.split(".")[0]:b).replace(/[^A-Za-z0-9\u00C0-\u024F]+/g," ").trim();return c?c.split(/\s+/).filter(Boolean).map(a=>a[0].toUpperCase()+a.slice(1)).join(" "):""}(a);if(!d)return c;let e=b.trim();return e?`${d} ${e}`:d}function fE({open:a,surfaceTheme:b,plan:c,focus:e,busy:f=!1,onClose:i,onSave:j}){var k;let[l,m]=(0,g.useState)(()=>"raw"===e?"raw":"fields"),[n,o]=(0,g.useState)(()=>{var a;return c?{companyName:(a=c).company.name,companyMission:a.company.mission,companyTargetCustomer:a.company.targetCustomer,companyConstraints:fG(a.company.constraints),companySuccessSignals:fG(a.company.successSignals),productOffer:a.product.offer,productRevenueModel:a.product.revenueModel,productScopeV1:fG(a.product.scopeV1),productNonGoals:fG(a.product.nonGoals),productLaunchPriority:fG(a.product.launchPriority),workspaceName:a.workspace.name,workspaceDirectory:a.workspace.directory??"",workspaceSourceMode:a.workspace.sourceMode,workspaceRepoUrl:a.workspace.repoUrl??"",workspaceExistingPath:a.workspace.existingPath??"",workspaceTemplate:a.workspace.template,workspaceModelProfile:a.workspace.modelProfile,workspaceModelId:a.workspace.modelId??"",workspaceStackDecisions:fG(a.workspace.stackDecisions),workspaceDocs:fG(a.workspace.docs),workspaceRuleGenerateStarterDocs:a.workspace.rules.generateStarterDocs,workspaceRuleGenerateMemory:a.workspace.rules.generateMemory,workspaceRuleKickoffMission:a.workspace.rules.kickoffMission,intakeReviewRequested:a.intake.reviewRequested,intakeAutopilot:a.autopilot,teamAllowEphemeralSubagents:a.team.allowEphemeralSubagents,teamMaxParallelRuns:String(a.team.maxParallelRuns),teamEscalationRules:fG(a.team.escalationRules),deployBlockers:fG(a.deploy.blockers),deployWarnings:fG(a.deploy.warnings),deployFirstMissions:fG(a.deploy.firstMissions)}:null}),[p,q]=(0,g.useState)(()=>c?JSON.stringify(c,null,2):""),[r,t]=(0,g.useState)(null),u=(0,g.useRef)({}),v=(0,g.useRef)({}),w="light"===b,z=e&&"raw"!==e?function(a){if("raw"===a)return"workspace";let[b]=a.split(".");return b}(e):null,A=e&&"raw"!==e&&(k=e).includes(".")?k:null,B=!!(c&&n);if(!a||!c||!n)return null;let C=(a,b)=>{o(c=>c?{...c,[a]:b}:c)},D=a=>b=>{v.current[a]=b},E=async()=>{var a,b,d,e;let f,g,h,k,l,m,o,p,q=(a=c,b=n,f=structuredClone(a),g=a.company.name.trim(),h=a.workspace.name.trim(),k=b.companyName.trim(),l=b.workspaceName.trim(),m=k!==g,o=l!==h,f.company.name=k,f.company.mission=b.companyMission.trim(),f.company.targetCustomer=b.companyTargetCustomer.trim(),f.company.constraints=fH(b.companyConstraints),f.company.successSignals=fH(b.companySuccessSignals),f.product.offer=b.productOffer.trim(),f.product.revenueModel=b.productRevenueModel.trim(),f.product.scopeV1=fH(b.productScopeV1),f.product.nonGoals=fH(b.productNonGoals),f.product.launchPriority=fH(b.productLaunchPriority),f.workspace.name=l,f.workspace.directory=fI(b.workspaceDirectory),f.workspace.sourceMode=b.workspaceSourceMode,f.workspace.repoUrl=fI(b.workspaceRepoUrl),f.workspace.existingPath=fI(b.workspaceExistingPath),f.workspace.template=b.workspaceTemplate,f.workspace.modelProfile=b.workspaceModelProfile,f.workspace.modelId=fI(b.workspaceModelId),f.workspace.stackDecisions=fH(b.workspaceStackDecisions),f.workspace.docs=fH(b.workspaceDocs),f.workspace.rules={...f.workspace.rules,workspaceOnly:!0,generateStarterDocs:b.workspaceRuleGenerateStarterDocs,generateMemory:b.workspaceRuleGenerateMemory,kickoffMission:b.workspaceRuleKickoffMission},o&&!m?f.company.name=l:m&&!o&&(f.workspace.name=k),f.team.allowEphemeralSubagents=b.teamAllowEphemeralSubagents,f.team.maxParallelRuns=Number.isFinite(Number(b.teamMaxParallelRuns))?Math.max(1,Number(b.teamMaxParallelRuns)):f.team.maxParallelRuns,f.team.escalationRules=fH(b.teamEscalationRules),f.intake.reviewRequested=b.intakeReviewRequested,f.autopilot=b.intakeAutopilot,f.deploy.blockers=fH(b.deployBlockers),f.deploy.warnings=fH(b.deployWarnings),f.deploy.firstMissions=fH(b.deployFirstMissions),f),r=(d=c,e=q,p=[],(fF(d.company,e.company)&&p.push("company"),fF(d.product,e.product)&&p.push("product"),fF(d.workspace,e.workspace)&&p.push("workspace"),fF(d.team,e.team)&&p.push("team"),fF({reviewRequested:d.intake.reviewRequested,autopilot:d.autopilot},{reviewRequested:e.intake.reviewRequested,autopilot:e.autopilot})&&p.push("intake"),fF(d.deploy,e.deploy)&&p.push("deploy"),0===p.length)?"Manual blueprint edit applied.":`Manual blueprint edit applied to ${p.join(", ")}.`);await j(q,r)&&i()},F=async()=>{try{let a=JSON.parse(p);await j(a,"Manual raw blueprint edit applied.")&&i()}catch(a){t(a instanceof Error?a.message:"Raw JSON could not be parsed.")}};return(0,d.jsxs)("div",{className:"absolute inset-0 z-30",children:[(0,d.jsx)("button",{type:"button","aria-label":"Close blueprint editor",onClick:i,className:s("absolute inset-0 h-full w-full cursor-default",w?"bg-[rgba(17,14,10,0.26)]":"bg-[rgba(2,6,13,0.56)]")}),(0,d.jsxs)("div",{className:s("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]",w?"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:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:s("flex items-start justify-between gap-4 border-b px-4 py-4 md:px-5",w?"border-[#e7dfd4]":"border-white/10"),children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:s("text-[11px] uppercase tracking-[0.18em]",w?"text-[#9a9085]":"text-slate-500"),children:"Blueprint editor"}),(0,d.jsx)("h2",{className:s("mt-1 text-[18px] font-semibold tracking-[-0.03em]",w?"text-[#171410]":"text-white"),children:"Edit any detail, then keep chatting with Architect"}),(0,d.jsx)("p",{className:s("mt-1 text-[13px] leading-6",w?"text-[#6f675e]":"text-slate-300"),children:"Structured fields cover the common edits. Raw JSON lets you change anything else in the same plan."})]}),(0,d.jsx)("button",{type:"button",onClick:i,className:s("inline-flex size-9 shrink-0 items-center justify-center rounded-full border transition-colors",w?"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,d.jsx)(ad.A,{className:"h-4 w-4"})})]}),(0,d.jsxs)("div",{className:s("flex items-center gap-2 border-b px-4 py-3 md:px-5",w?"border-[#e7dfd4]":"border-white/10"),children:[(0,d.jsx)(fJ,{surfaceTheme:b,label:`Stage \xb7 ${c.stage}`}),(0,d.jsx)(fJ,{surfaceTheme:b,label:`Status \xb7 ${c.status}`}),(0,d.jsx)(fJ,{surfaceTheme:b,label:`Readiness \xb7 ${c.readinessScore}%`})]}),(0,d.jsxs)(R,{value:l,onValueChange:a=>m(a),className:"flex min-h-0 flex-1 flex-col px-4 py-4 md:px-5",children:[(0,d.jsxs)(S,{className:s("w-fit",w?"bg-[#f2ece4] text-[#645b52]":"bg-white/5"),children:[(0,d.jsx)(T,{value:"fields",children:"Fields"}),(0,d.jsx)(T,{value:"raw",children:"Raw JSON"})]}),(0,d.jsx)(U,{value:"fields",className:"min-h-0 flex-1",children:(0,d.jsx)(fc,{className:"h-full pr-1",children:(0,d.jsxs)("div",{className:"space-y-4 pb-4",children:[(0,d.jsxs)("div",{className:"grid gap-4 xl:grid-cols-2",children:[(0,d.jsxs)(fK,{surfaceTheme:b,sectionId:"company",highlighted:"company"===z,title:"Company",description:"Mission and audience details.",register:a=>{u.current.company=a},children:[(0,d.jsx)(fL,{label:"Name",children:(0,d.jsx)(y,{ref:D("company.name"),value:n.companyName,onChange:a=>C("companyName",a.target.value)})}),(0,d.jsx)(fL,{label:"Mission",children:(0,d.jsx)(bH,{ref:D("company.mission"),value:n.companyMission,onChange:a=>C("companyMission",a.target.value),className:"min-h-[96px]"})}),(0,d.jsx)(fL,{label:"Target customer",children:(0,d.jsx)(y,{ref:D("company.targetCustomer"),value:n.companyTargetCustomer,onChange:a=>C("companyTargetCustomer",a.target.value)})}),(0,d.jsx)(fL,{label:"Constraints",children:(0,d.jsx)(bH,{ref:D("company.constraints"),value:n.companyConstraints,onChange:a=>C("companyConstraints",a.target.value),placeholder:"One constraint per line",className:"min-h-[84px]"})}),(0,d.jsx)(fL,{label:"Success signals",children:(0,d.jsx)(bH,{ref:D("company.successSignals"),value:n.companySuccessSignals,onChange:a=>C("companySuccessSignals",a.target.value),placeholder:"One signal per line",className:"min-h-[84px]"})})]}),(0,d.jsxs)(fK,{surfaceTheme:b,sectionId:"product",highlighted:"product"===z,title:"Product",description:"Offer and V1 shape.",register:a=>{u.current.product=a},children:[(0,d.jsx)(fL,{label:"Offer",children:(0,d.jsx)(bH,{ref:D("product.offer"),value:n.productOffer,onChange:a=>C("productOffer",a.target.value),className:"min-h-[96px]"})}),(0,d.jsx)(fL,{label:"Revenue model",children:(0,d.jsx)(y,{ref:D("product.revenueModel"),value:n.productRevenueModel,onChange:a=>C("productRevenueModel",a.target.value)})}),(0,d.jsx)(fL,{label:"Scope V1",children:(0,d.jsx)(bH,{ref:D("product.scopeV1"),value:n.productScopeV1,onChange:a=>C("productScopeV1",a.target.value),placeholder:"One item per line",className:"min-h-[84px]"})}),(0,d.jsx)(fL,{label:"Non-goals",children:(0,d.jsx)(bH,{ref:D("product.nonGoals"),value:n.productNonGoals,onChange:a=>C("productNonGoals",a.target.value),placeholder:"One item per line",className:"min-h-[84px]"})}),(0,d.jsx)(fL,{label:"Launch priority",children:(0,d.jsx)(bH,{ref:D("product.launchPriority"),value:n.productLaunchPriority,onChange:a=>C("productLaunchPriority",a.target.value),placeholder:"One item per line",className:"min-h-[84px]"})})]})]}),(0,d.jsxs)(fK,{surfaceTheme:b,sectionId:"workspace",highlighted:"workspace"===z,title:"Workspace",description:"Provisioning path and bootstrap rules.",register:a=>{u.current.workspace=a},children:[(0,d.jsxs)("div",{className:"grid gap-4 xl:grid-cols-2",children:[(0,d.jsx)(fL,{label:"Workspace name",children:(0,d.jsx)(y,{ref:D("workspace.name"),value:n.workspaceName,onChange:a=>C("workspaceName",a.target.value)})}),(0,d.jsx)(fL,{label:"Workspace directory",children:(0,d.jsx)(y,{ref:D("workspace.directory"),value:n.workspaceDirectory,onChange:a=>C("workspaceDirectory",a.target.value)})}),(0,d.jsx)(fL,{label:"Repository URL",children:(0,d.jsx)(y,{ref:D("workspace.repoUrl"),value:n.workspaceRepoUrl,onChange:a=>C("workspaceRepoUrl",a.target.value)})}),(0,d.jsx)(fL,{label:"Existing folder path",children:(0,d.jsx)(y,{ref:D("workspace.existingPath"),value:n.workspaceExistingPath,onChange:a=>C("workspaceExistingPath",a.target.value)})}),(0,d.jsx)(fL,{label:"Model id",children:(0,d.jsx)(y,{ref:D("workspace.modelId"),value:n.workspaceModelId,onChange:a=>C("workspaceModelId",a.target.value)})})]}),(0,d.jsx)(fM,{surfaceTheme:b,label:"Source mode",value:n.workspaceSourceMode,options:fv,onChange:a=>C("workspaceSourceMode",a),fieldRef:D("workspace.sourceMode"),highlighted:"workspace.sourceMode"===A}),(0,d.jsx)(fM,{surfaceTheme:b,label:"Template",value:n.workspaceTemplate,options:fw,onChange:a=>C("workspaceTemplate",a),fieldRef:D("workspace.template"),highlighted:"workspace.template"===A}),(0,d.jsx)(fM,{surfaceTheme:b,label:"Model profile",value:n.workspaceModelProfile,options:fy,onChange:a=>C("workspaceModelProfile",a),fieldRef:D("workspace.modelProfile"),highlighted:"workspace.modelProfile"===A}),(0,d.jsxs)("div",{className:"grid gap-4 xl:grid-cols-2",children:[(0,d.jsx)(fL,{label:"Stack decisions",children:(0,d.jsx)(bH,{ref:D("workspace.stackDecisions"),value:n.workspaceStackDecisions,onChange:a=>C("workspaceStackDecisions",a.target.value),placeholder:"One item per line",className:"min-h-[84px]"})}),(0,d.jsx)(fL,{label:"Docs",children:(0,d.jsx)(bH,{ref:D("workspace.docs"),value:n.workspaceDocs,onChange:a=>C("workspaceDocs",a.target.value),placeholder:"One item per line",className:"min-h-[84px]"})})]}),(0,d.jsx)(fN,{surfaceTheme:b,label:"Starter docs",description:"Generate the first brief, architecture, and deliverables scaffold.",checked:n.workspaceRuleGenerateStarterDocs,onToggle:()=>C("workspaceRuleGenerateStarterDocs",!n.workspaceRuleGenerateStarterDocs),fieldRef:D("workspace.ruleGenerateStarterDocs"),highlighted:"workspace.ruleGenerateStarterDocs"===A}),(0,d.jsx)(fN,{surfaceTheme:b,label:"Memory",description:"Generate the persistent memory files for blueprint decisions.",checked:n.workspaceRuleGenerateMemory,onToggle:()=>C("workspaceRuleGenerateMemory",!n.workspaceRuleGenerateMemory),fieldRef:D("workspace.ruleGenerateMemory"),highlighted:"workspace.ruleGenerateMemory"===A}),(0,d.jsx)(fN,{surfaceTheme:b,label:"Kickoff mission",description:"Run the first mission immediately after bootstrap.",checked:n.workspaceRuleKickoffMission,onToggle:()=>C("workspaceRuleKickoffMission",!n.workspaceRuleKickoffMission),fieldRef:D("workspace.ruleKickoffMission"),highlighted:"workspace.ruleKickoffMission"===A})]}),(0,d.jsxs)("div",{className:"grid gap-4 xl:grid-cols-2",children:[(0,d.jsxs)(fK,{surfaceTheme:b,sectionId:"team",highlighted:"team"===z,title:"Team",description:"Planner behavior and coordination rules.",register:a=>{u.current.team=a},children:[(0,d.jsx)(fN,{surfaceTheme:b,label:"Allow ephemeral subagents",description:"Let the planner spin up temporary helpers when useful.",checked:n.teamAllowEphemeralSubagents,onToggle:()=>C("teamAllowEphemeralSubagents",!n.teamAllowEphemeralSubagents),fieldRef:D("team.allowEphemeralSubagents"),highlighted:"team.allowEphemeralSubagents"===A}),(0,d.jsx)(fN,{surfaceTheme:b,label:"Autopilot",description:"Let the planner take a stronger lead when the shape is clear.",checked:n.intakeAutopilot,onToggle:()=>C("intakeAutopilot",!n.intakeAutopilot),fieldRef:D("team.autopilot"),highlighted:"team.autopilot"===A}),(0,d.jsx)(fN,{surfaceTheme:b,label:"Review requested",description:"Keep the planner in a review-heavy shaping mode.",checked:n.intakeReviewRequested,onToggle:()=>C("intakeReviewRequested",!n.intakeReviewRequested),fieldRef:D("team.reviewRequested"),highlighted:"team.reviewRequested"===A}),(0,d.jsx)(fL,{label:"Max parallel runs",children:(0,d.jsx)(y,{ref:D("team.maxParallelRuns"),type:"number",min:1,value:n.teamMaxParallelRuns,onChange:a=>C("teamMaxParallelRuns",a.target.value)})}),(0,d.jsx)(fL,{label:"Escalation rules",children:(0,d.jsx)(bH,{ref:D("team.escalationRules"),value:n.teamEscalationRules,onChange:a=>C("teamEscalationRules",a.target.value),placeholder:"One rule per line",className:"min-h-[84px]"})})]}),(0,d.jsxs)(fK,{surfaceTheme:b,sectionId:"deploy",highlighted:"deploy"===z,title:"Deploy",description:"Review blockers, warnings, and first missions.",register:a=>{u.current.deploy=a},children:[(0,d.jsx)(fL,{label:"Blockers",children:(0,d.jsx)(bH,{ref:D("deploy.blockers"),value:n.deployBlockers,onChange:a=>C("deployBlockers",a.target.value),placeholder:"One blocker per line",className:"min-h-[84px]"})}),(0,d.jsx)(fL,{label:"Warnings",children:(0,d.jsx)(bH,{ref:D("deploy.warnings"),value:n.deployWarnings,onChange:a=>C("deployWarnings",a.target.value),placeholder:"One warning per line",className:"min-h-[84px]"})}),(0,d.jsx)(fL,{label:"First missions",children:(0,d.jsx)(bH,{ref:D("deploy.firstMissions"),value:n.deployFirstMissions,onChange:a=>C("deployFirstMissions",a.target.value),placeholder:"One mission per line",className:"min-h-[84px]"})})]}),(0,d.jsxs)(fK,{surfaceTheme:b,title:"Note",description:"What happens on save?",children:[(0,d.jsx)("p",{className:s("text-[13px] leading-6",w?"text-[#6f675e]":"text-slate-300"),children:"Derived plan fields like readiness score, stage, and recommended missions are recalculated after you save."}),(0,d.jsx)("p",{className:s("mt-3 text-[13px] leading-6",w?"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,d.jsx)(U,{value:"raw",className:"min-h-0 flex-1",children:(0,d.jsxs)("div",{className:"flex h-full min-h-0 flex-col gap-3",children:[(0,d.jsx)("div",{className:s("rounded-[18px] border px-4 py-3",w?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:(0,d.jsx)("p",{className:s("text-[13px] leading-6",w?"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,d.jsx)(bH,{value:p,onChange:a=>{q(a.target.value),t(null)},className:s("min-h-0 flex-1 font-mono text-[12px] leading-5",w?"border-[#dcd4c9] bg-white text-[#1a1714]":"border-white/10 bg-[#03060d] text-slate-100")}),r?(0,d.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:r}):null,(0,d.jsx)("p",{className:s("text-[12px] leading-5",w?"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,d.jsxs)("div",{className:s("flex items-center justify-between gap-3 border-t px-4 py-4 md:px-5",w?"border-[#e7dfd4]":"border-white/10"),children:[(0,d.jsx)(x,{type:"button",variant:"secondary",onClick:i,className:w?"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,d.jsxs)(x,{type:"button",onClick:"raw"===l?F:E,disabled:!B||f,className:w?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",children:[f?(0,d.jsx)(h.A,{className:"mr-2 h-4 w-4 animate-spin"}):(0,d.jsx)(bV.A,{className:"mr-2 h-4 w-4"}),"Apply changes"]})]})]})]})}function fF(a,b){return JSON.stringify(a)!==JSON.stringify(b)}function fG(a){return a.join("\n")}function fH(a){return a.split(/\r?\n/).map(a=>a.trim()).filter(Boolean)}function fI(a){let b=a.trim();return b.length>0?b:void 0}function fJ({surfaceTheme:a,label:b}){return(0,d.jsx)("span",{className:s("inline-flex items-center rounded-full border px-2.5 py-1 text-[10px] uppercase tracking-[0.16em]","light"===a?"border-[#e4ddd3] bg-[#f7f2eb] text-[#746b61]":"border-white/10 bg-white/[0.05] text-slate-300"),children:b})}function fK({surfaceTheme:a,sectionId:b,highlighted:c=!1,title:e,description:f,register:g,children:h}){let i="light"===a;return(0,d.jsxs)("section",{ref:g,"data-blueprint-section":b,className:s("rounded-[22px] border p-4 transition-all duration-300",i?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]",c&&(i?"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,d.jsxs)("div",{className:"mb-4",children:[(0,d.jsx)("p",{className:s("text-[11px] uppercase tracking-[0.18em]",i?"text-[#a0978b]":"text-slate-500"),children:e}),(0,d.jsx)("p",{className:s("mt-1 text-[13px] leading-6",i?"text-[#6f675e]":"text-slate-300"),children:f})]}),(0,d.jsx)("div",{className:"space-y-4",children:h})]})}function fL({label:a,children:b}){return(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)(bm,{children:a}),b]})}function fM({surfaceTheme:a,label:b,value:c,options:e,onChange:f,fieldRef:g,highlighted:h=!1}){let i="light"===a;return(0,d.jsxs)("div",{ref:g,tabIndex:-1,className:s("space-y-2 rounded-[18px] border p-3 transition-all",i?"border-[#e8e0d6] bg-[#faf6f1]":"border-white/10 bg-white/[0.03]",h&&(i?"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,d.jsx)(bm,{children:b}),(0,d.jsx)("div",{className:"grid gap-2 md:grid-cols-2",children:e.map(a=>{let b=a.value===c;return(0,d.jsx)("button",{type:"button",onClick:()=>f(a.value),className:s("rounded-[16px] border px-3 py-3 text-left transition-colors",b?i?"border-[#161514] bg-[#161514] text-white":"border-cyan-300 bg-cyan-300/15 text-cyan-50":i?"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,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"text-[13px] font-medium",children:a.label}),(0,d.jsx)("p",{className:s("mt-1 text-[12px] leading-5",b?"opacity-80":i?"text-[#70685e]":"text-slate-400"),children:a.description})]}),b?(0,d.jsx)(n.A,{className:"mt-0.5 h-4 w-4 shrink-0"}):null]})},a.value)})})]})}function fN({surfaceTheme:a,label:b,description:c,checked:e,onToggle:f,fieldRef:g,highlighted:h=!1}){let i="light"===a;return(0,d.jsx)("button",{type:"button",onClick:f,ref:g,className:s("w-full rounded-[16px] border px-3 py-3 text-left transition-colors",e?i?"border-[#1f1b17] bg-[#1f1b17] text-white":"border-cyan-300 bg-cyan-300/15 text-cyan-50":i?"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]",h&&(i?"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,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"text-[13px] font-medium",children:b}),(0,d.jsx)("p",{className:s("mt-1 text-[12px] leading-5",e?"opacity-80":i?"text-[#70685e]":"text-slate-400"),children:c})]}),(0,d.jsx)("span",{className:s("mt-0.5 inline-flex size-5 shrink-0 items-center justify-center rounded-full border",e?i?"border-white/25 bg-white text-[#171410]":"border-white/20 bg-white text-slate-950":i?"border-[#cfc6ba] bg-transparent text-transparent":"border-white/15 bg-transparent text-transparent"),children:(0,d.jsx)(n.A,{className:"h-3 w-3"})})]})})}function fO({open:a,surfaceTheme:b,plan:c,path:e,busy:f=!1,rewriteBusy:i=!1,onClose:j,onSave:k,onRewriteWithArchitect:l}){let m="light"===b,n=(0,g.useMemo)(()=>a&&c?fp({name:c.workspace.name||"Workspace",brief:c.company.mission||c.product.offer||void 0,template:c.workspace.template,sourceMode:c.workspace.sourceMode,rules:c.workspace.rules,agents:c.team.persistentAgents.filter(a=>a.enabled),docOverrides:c.workspace.docOverrides,toolExamples:[],contextSources:c.intake.sources}).find(a=>a.path===e)??null:null,[a,e,c]),[o,p]=(0,g.useState)(()=>n?.content??""),[q,r]=(0,g.useState)(""),[t,u]=(0,g.useState)(null),v=f||i||!!t;if(!a||!c||!n)return null;let w=async()=>{let a=await l({path:n.path,currentContent:o,instruction:q.trim()||void 0});if(!a)return;let b=function(a,b){if(a===b)return null;let c=a.split(/\r?\n/),d=b.split(/\r?\n/),e=0;for(;e<c.length&&e<d.length&&c[e]===d[e];)e+=1;let f=0;for(;f<c.length-e&&f<d.length-e&&c[c.length-1-f]===d[d.length-1-f];)f+=1;let g=d.slice(0,e),h=c.slice(e,c.length-f),i=d.slice(e,d.length-f),j=d.slice(d.length-f),k=i.join("\n"),l=Array.from(k).length;return{prefixLines:g,changedFromLines:h,changedToLines:i,suffixLines:j,changedToText:k,changedToCharCount:l,revealedCharCount:0,nextContent:b}}(o,a);if(!b){p(a),r("");return}u(b),r("")},y=async()=>{let a=structuredClone(c),b=fq([...a.workspace.docOverrides.filter(a=>a.path!==n.path),...o===n.baseContent?[]:[{path:n.path,content:o}]]);a.workspace.docOverrides=b;let d=o===n.baseContent?n.generated?`Reset ${n.path} to the generated default scaffold.`:`Kept ${n.path} at the loaded workspace content.`:n.generated?`Updated ${n.path} scaffold content.`:`Updated ${n.path} existing file content.`;await k(a,d)&&j()};return(0,d.jsxs)("div",{className:"absolute inset-0 z-30",children:[(0,d.jsx)("button",{type:"button","aria-label":"Close document editor",onClick:j,className:s("absolute inset-0 h-full w-full cursor-default",m?"bg-[rgba(17,14,10,0.26)]":"bg-[rgba(2,6,13,0.56)]")}),(0,d.jsxs)("div",{className:s("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]",m?"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:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:s("flex items-center justify-between gap-4 border-b px-4 py-3 md:px-5",m?"border-[#e7dfd4]":"border-white/10"),children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,d.jsx)("p",{className:s("text-[11px] uppercase tracking-[0.18em]",m?"text-[#9a9085]":"text-slate-500"),children:"Document editor"}),(0,d.jsx)("span",{className:s("text-[11px] uppercase tracking-[0.18em]",m?"text-[#c2b6a5]":"text-slate-600"),children:"/"}),(0,d.jsx)("p",{className:s("truncate font-mono text-[12px]",m?"text-[#4a433b]":"text-slate-300"),children:n.path}),(0,d.jsx)("span",{className:s("inline-flex shrink-0 items-center rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",n.generated?n.overridden?m?"border-emerald-200 bg-emerald-50 text-emerald-900":"border-emerald-300/30 bg-emerald-300/12 text-emerald-100":m?"border-[#e0d7cc] bg-white text-[#7a7168]":"border-white/10 bg-white/[0.05] text-slate-400":m?"border-cyan-200 bg-cyan-50 text-cyan-900":"border-cyan-300/25 bg-cyan-300/12 text-cyan-100"),children:n.generated?n.overridden?"Customized":"Generated":"Existing"})]}),(0,d.jsx)("button",{type:"button",onClick:j,className:s("inline-flex size-9 shrink-0 items-center justify-center rounded-full border transition-colors",m?"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,d.jsx)(ad.A,{className:"h-4 w-4"})})]}),(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-3 px-4 py-3 md:px-5",children:[(0,d.jsx)(fc,{className:"min-h-0 flex-1",children:t?(0,d.jsx)(fP,{surfaceTheme:b,animation:t}):(0,d.jsx)(bH,{value:o,onChange:a=>p(a.target.value),className:s("min-h-[60vh] font-mono text-[12px] leading-5",m?"border-[#dcd4c9] bg-white text-[#1a1714]":"border-white/10 bg-[#03060d] text-slate-100"),disabled:v})}),(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3 border-t pt-2",style:{borderColor:m?"#e7dfd4":"rgba(255,255,255,0.1)"},children:[(0,d.jsx)(x,{type:"button",variant:"secondary",onClick:()=>{p(n.baseContent)},disabled:v,className:m?"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:n.generated?"Reset to default":"Reset to loaded content"}),(0,d.jsxs)(x,{type:"button",onClick:y,disabled:v,className:m?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",children:[f?(0,d.jsx)(h.A,{className:"mr-2 h-4 w-4 animate-spin"}):(0,d.jsx)(bV.A,{className:"mr-2 h-4 w-4"}),"Apply changes"]})]}),(0,d.jsx)("div",{className:s("rounded-[18px] border px-4 py-3",m?"border-[#e5ded3] bg-white":"border-white/10 bg-white/[0.04]"),children:(0,d.jsxs)("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr),auto] md:items-end",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("label",{htmlFor:"architect-rewrite-prompt",className:s("text-[11px] uppercase tracking-[0.18em]",m?"text-[#8b8278]":"text-slate-400"),children:"Architect instructions"}),(0,d.jsx)(bH,{id:"architect-rewrite-prompt",value:q,onChange:a=>r(a.target.value),placeholder:"Tell Architect what to rewrite in this document.",className:s("mt-2 min-h-[88px] font-sans text-[13px] leading-6",m?"border-[#dcd4c9] bg-white text-[#1a1714]":"border-white/10 bg-[#03060d] text-slate-100"),disabled:v}),(0,d.jsx)("p",{className:s("mt-2 text-[12px] leading-5",m?"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,d.jsxs)(x,{type:"button",variant:"secondary",onClick:w,disabled:v,className:m?"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:[i?(0,d.jsx)(h.A,{className:"mr-2 h-4 w-4 animate-spin"}):(0,d.jsx)(a2.A,{className:"mr-2 h-4 w-4"}),"Rewrite with Architect"]})]})})]})]})]})}function fP({surfaceTheme:a,animation:b}){var c,e;let f="light"===a,g=s("whitespace-pre-wrap break-words rounded-lg border px-3 py-2",f?"border-[#e4ddd2] bg-white text-[#1a1714]":"border-white/10 bg-[#040810] text-slate-100"),h=(c=b.changedToText,(e=b.revealedCharCount)<=0?"":Array.from(c).slice(0,e).join(""));return(0,d.jsxs)("div",{className:s("rounded-[18px] border px-4 py-3",f?"border-[#e5ded3] bg-white":"border-white/10 bg-white/[0.04]"),children:[(0,d.jsxs)("div",{className:s("flex items-center justify-between gap-2 whitespace-nowrap text-[9px] uppercase tracking-[0.18em] leading-none",f?"text-[#8b8278]":"text-slate-400"),children:[(0,d.jsx)("span",{className:"min-w-0 truncate",children:"Rewriting"}),(0,d.jsxs)("span",{className:s("shrink-0 rounded-full border px-2 py-0.5",f?"border-[#dfd7cc] bg-[#faf6f1] text-[#6e6458]":"border-white/10 bg-white/[0.04] text-slate-300"),children:[b.revealedCharCount,"/",b.changedToCharCount||1]})]}),(0,d.jsxs)("div",{className:"mt-2 space-y-2 font-mono text-[12px] leading-5",children:[b.prefixLines.length?(0,d.jsx)("div",{className:s("space-y-1.5",f?"text-[#27231e]":"text-slate-100"),children:b.prefixLines.map((a,b)=>(0,d.jsx)("div",{className:"whitespace-pre-wrap break-words",children:a||"\xa0"},`prefix-${b}`))}):null,(0,d.jsx)("div",{className:s("rounded-2xl border px-3 py-2.5",f?"border-[#d8cdbc] bg-[#f9f5ef]":"border-cyan-300/20 bg-cyan-300/6"),children:(0,d.jsxs)("div",{className:"grid gap-2 md:grid-cols-2",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:s("mb-1 text-[9px] uppercase tracking-[0.18em]",f?"text-[#968a7c]":"text-slate-400"),children:"Old"}),(0,d.jsx)("div",{className:g,children:b.changedFromLines.length?b.changedFromLines.map((a,b)=>(0,d.jsx)("div",{className:"whitespace-pre-wrap break-words opacity-55 line-through",children:a||"\xa0"},`before-${b}`)):(0,d.jsx)("div",{className:"opacity-45",children:"[empty]"})})]}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:s("mb-1 text-[9px] uppercase tracking-[0.18em]",f?"text-[#968a7c]":"text-slate-400"),children:"New"}),(0,d.jsx)("div",{className:s(g,"min-h-[96px]"),children:b.changedToCharCount>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"whitespace-pre-wrap break-words",children:h}),b.revealedCharCount<b.changedToCharCount?(0,d.jsx)(a6.P.span,{"aria-hidden":"true",className:s("ml-0.5 inline-block align-[-0.15em] text-[1.1em] leading-none",f?"text-[#161514]":"text-cyan-100"),animate:{opacity:[0,1,0]},transition:{duration:.8,repeat:1/0,ease:"easeInOut"},children:"|"}):null]}):(0,d.jsx)("span",{className:s("opacity-45",f?"text-[#7d7266]":"text-slate-400"),children:"[removed]"})})]})]})}),b.suffixLines.length?(0,d.jsx)("div",{className:s("space-y-1.5",f?"text-[#27231e]":"text-slate-100"),children:b.suffixLines.map((a,b)=>(0,d.jsx)("div",{className:"whitespace-pre-wrap break-words",children:a||"\xa0"},`suffix-${b}`))}):null]})]})}var fQ=c(2188),fR=c(40023),fS=c(45655),fT=c(13291),fU=c(29509);let fV=[{id:"company",label:"Company",icon:fT.A},{id:"product",label:"Product",icon:fU.A},{id:"workspace",label:"Workspace",icon:fS.A},{id:"team",label:"Team",icon:a7.A},{id:"operations",label:"Operations",icon:ek.A},{id:"deploy",label:"Deploy",icon:fQ.A}],fW=[{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 fX(a){return fW.find(b=>b.id===a)?.label??"Draft"}function fY(a,b){switch(b){case"company":{let b=[a.company.name,a.company.mission,a.company.targetCustomer].filter(a=>!a.trim()).length;return 0===b?{label:"Ready to review",variant:"success"}:{label:`${b} core field${1===b?"":"s"} missing`,variant:"warning"}}case"product":{let b=[+!a.product.offer.trim(),a.product.scopeV1.length>0?0:1,a.product.launchPriority.length>0?0:1].reduce((a,b)=>a+b,0);return 0===b?{label:"Scope is defined",variant:"success"}:{label:`${b} product decision${1===b?"":"s"} pending`,variant:"warning"}}case"workspace":{let b=+!a.workspace.name.trim();return"clone"!==a.workspace.sourceMode||a.workspace.repoUrl?.trim()||(b+=1),"existing"!==a.workspace.sourceMode||a.workspace.existingPath?.trim()||(b+=1),0===b?{label:"Provisioning path set",variant:"success"}:{label:`${b} workspace input${1===b?"":"s"} missing`,variant:"warning"}}case"team":{let b=a.team.persistentAgents.filter(a=>a.enabled).length,c=a.team.persistentAgents.some(a=>a.enabled&&a.isPrimary);if(0===b)return{label:"Add at least one agent",variant:"danger"};if(!c)return{label:"Primary agent missing",variant:"warning"};return{label:`${b} active agent${1===b?"":"s"}`,variant:"success"}}case"operations":{let b=a.operations.workflows.filter(a=>a.enabled).length,c=a.operations.automations.filter(a=>a.enabled).length;if(0===b&&0===c)return{label:"No runtime loops yet",variant:"warning"};return{label:`${b} workflows, ${c} automations`,variant:"success"}}default:if(!a.intake.reviewRequested&&"deploying"!==a.status&&"deployed"!==a.status)return{label:"Review not opened yet",variant:"muted"};if(a.deploy.blockers.length>0)return{label:`${a.deploy.blockers.length} blocker${1===a.deploy.blockers.length?"":"s"}`,variant:"danger"};if(a.deploy.warnings.length>0)return{label:`${a.deploy.warnings.length} warning${1===a.deploy.warnings.length?"":"s"}`,variant:"warning"};return{label:"Ready to deploy",variant:"success"}}}function fZ(a,b){switch(b){case"company":return a.company.name?`${a.company.name}${a.company.mission?` \xb7 ${a.company.mission}`:""}`:"Mission and audience are still being shaped.";case"product":return a.product.offer||"Offer and V1 scope are still being drafted.";case"workspace":return`${f$(a.workspace.template)} \xb7 ${f$(a.workspace.sourceMode)}`;case"team":return`${a.team.persistentAgents.filter(a=>a.enabled).length} agents drafted`;case"operations":return`${a.operations.workflows.filter(a=>a.enabled).length} workflows \xb7 ${a.operations.automations.filter(a=>a.enabled).length} automations`;default:return a.intake.reviewRequested?"Deploy review is open.":"Review not started."}}function f$(a){return a.split(/[-_]/g).filter(Boolean).map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" ")}let f_=Object.fromEntries(fw.map(a=>[a.value,a.label])),f0={prompt:{label:"Prompt",icon:a2.A},website:{label:"Website",icon:e7.A},repo:{label:"Repo",icon:e6.A},folder:{label:"Folder",icon:e8.A}};function f1({surfaceTheme:a,plan:b,variant:c="panel",summaryText:e,className:f,onOpenBlueprintEditor:h,onOpenDocumentEditor:i}){var j;let k,l="light"===a,m=(0,g.useMemo)(()=>fn(b.workspace.template,b.workspace.rules),[b.workspace.rules,b.workspace.template]),n=(0,g.useMemo)(()=>new Set(fq(b.workspace.docOverrides).map(a=>a.path)),[b.workspace.docOverrides]),o=b.company.name||b.workspace.name||"Workspace",p=b.company.mission||b.product.offer||"Mission still being shaped.",q=b.company.targetCustomer||"Audience still being confirmed.",r=f$(b.workspace.sourceMode),t=f_[b.workspace.template],u=f$(b.company.type),v=fX(b.stage),w="blocked"===b.status?"Blocked":"ready"===b.status?"Ready":"deployed"===b.status?"Live":"deploying"===b.status?"Deploying":"Draft",y=e?.trim()||b.architectSummary,z=b.intake.sources.find(a=>"ready"===a.status)??b.intake.sources[0]??null,A=b.intake.inferences.slice(0,4),B=m.resources.length,C=((k=(j=o).trim().split(/\s+/).filter(Boolean)).length>1?`${k[0][0]??""}${k[1][0]??""}`:j.slice(0,2)).toUpperCase(),D=z?f0[z.kind].icon:"clone"===b.workspace.sourceMode?e6.A:"existing"===b.workspace.sourceMode?e8.A:a2.A,E=z?z.label:r,F=z?`${f0[z.kind].label} \xb7 ${gc(z.status)}`:r,G=function(a){switch(a){case"blocked":return"danger";case"ready":case"deployed":return"success";case"review":return"warning";default:return"muted"}}(b.status),H="panel"===c,[I,J]=(0,g.useState)(0),K=H?["Collecting context from the prompt and sources…","Shaping the draft with the first signal set…","Writing the scaffold files now…","Draft ready."]:["Collecting context from the prompt and sources…","Pulling evidence from the website and files…","Extracting structured facts…","Grouping the file scaffold…","Checking remaining decisions…","Draft ready."],L=K[Math.min(I,K.length-1)]??K[0],M=I>=1,N=I>=1,O=I>=2,P=I>=(H?3:5),Q=!H&&I>=3,R=!H&&I>=4,S=!H&&I>=5,T=H?m.sections.filter(a=>a.enabled):m.sections,U=T.reduce((a,b)=>a+b.resources.length,0),V=H?U:B;return H?(0,d.jsxs)("div",{className:s("workspace-architect-card-enter relative overflow-hidden rounded-[28px] border p-4 md:p-5",l?"border-[#e5ddd2] bg-white shadow-[0_16px_42px_rgba(56,47,38,0.06)]":"border-white/10 bg-[rgba(6,10,18,0.96)] shadow-[0_16px_42px_rgba(0,0,0,0.2)]",f),children:[(0,d.jsx)("div",{className:s("pointer-events-none absolute inset-0",l?"bg-[radial-gradient(circle_at_top_right,rgba(216,177,132,0.14),transparent_36%),radial-gradient(circle_at_bottom_left,rgba(94,193,255,0.06),transparent_42%)]":"bg-[radial-gradient(circle_at_top_right,rgba(103,232,249,0.12),transparent_34%),radial-gradient(circle_at_bottom_left,rgba(59,130,246,0.12),transparent_42%)]")}),(0,d.jsxs)("div",{className:"relative space-y-4",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-3",children:[(0,d.jsx)("div",{className:s("inline-flex size-11 shrink-0 items-center justify-center rounded-2xl border text-[12px] font-semibold tracking-[0.12em]",l?"border-[#e4ddd2] bg-[#fcfaf7] text-[#4f4942]":"border-white/10 bg-white/[0.05] text-slate-100"),children:C}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:s("text-[10px] uppercase tracking-[0.24em]",l?"text-[#8d8174]":"text-slate-500"),children:"Architect"}),(0,d.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[(0,d.jsx)(f3,{surfaceTheme:a,text:o,className:s("text-[18px] font-semibold tracking-[-0.04em]",l?"text-[#171410]":"text-white"),startDelayMs:0,wordDelayMs:95},`hero-title:${H?"panel":"message"}:${o}`),(0,d.jsx)(ga,{surfaceTheme:a,tone:G,label:w})]}),(0,d.jsx)(f3,{surfaceTheme:a,text:M?y:L,className:s("workspace-architect-card-enter mt-1 line-clamp-2 text-[12px] leading-5",l?"text-[#6f685f]":"text-slate-300",!M&&"italic"),startDelayMs:80,wordDelayMs:115},`hero-status:${H?"panel":"message"}:${M?y:L}`)]})]}),(0,d.jsxs)("div",{className:"shrink-0 text-right",children:[(0,d.jsx)("p",{className:s("text-[10px] uppercase tracking-[0.2em]",l?"text-[#918577]":"text-slate-500"),children:"Readiness"}),(0,d.jsxs)("p",{className:s("mt-1 text-[24px] font-semibold tracking-[-0.05em]",l?"text-[#181612]":"text-white"),children:[b.readinessScore,"%"]}),h?(0,d.jsxs)(x,{type:"button",variant:"secondary",size:"sm",onClick:()=>h("workspace.name"),className:l?"mt-2 rounded-full border-[#ddd6cb] bg-[#f7f2eb] px-3 text-[#403934] hover:bg-[#f1ebe3]":"mt-2 rounded-full border-white/10 bg-white/[0.04] px-3 text-slate-200 hover:bg-white/[0.08]",children:[(0,d.jsx)(bV.A,{className:"mr-2 h-3.5 w-3.5"}),"Edit"]}):null]})]}),N?(0,d.jsxs)("div",{className:"workspace-architect-card-enter grid gap-2.5 sm:grid-cols-3",style:gd(90),children:[(0,d.jsx)(f2,{surfaceTheme:a,label:"Mission",value:p,icon:a2.A,revealDelayMs:120}),(0,d.jsx)(f2,{surfaceTheme:a,label:"Audience",value:q,icon:eU.A,revealDelayMs:220}),(0,d.jsx)(f2,{surfaceTheme:a,label:"Source",value:E,detail:F,icon:D,revealDelayMs:320})]}):null,O?(0,d.jsxs)("div",{className:"workspace-architect-card-enter flex flex-wrap gap-1.5",style:gd(170),children:[(0,d.jsx)(f4,{surfaceTheme:a,label:"Mission",value:f9(p,48),icon:a2.A,revealDelayMs:0}),(0,d.jsx)(f4,{surfaceTheme:a,label:"Source",value:f9(E,34),icon:D,revealDelayMs:110}),(0,d.jsx)(f4,{surfaceTheme:a,label:"Template",value:t,icon:fS.A,revealDelayMs:220}),(0,d.jsx)(f4,{surfaceTheme:a,label:"Files",value:String(B),icon:a9.A,revealDelayMs:330})]}):null,P?(0,d.jsxs)("div",{className:"space-y-2.5",children:[(0,d.jsx)("div",{className:"flex items-center justify-between gap-2",children:(0,d.jsx)(f5,{surfaceTheme:a,title:"Files",subtitle:`${T.length} groups in the canonical scaffold.`})}),(0,d.jsx)("div",{className:"space-y-2",children:T.map((b,c)=>(0,d.jsxs)("div",{className:s("workspace-architect-card-enter rounded-[18px] border px-3 py-3",l?"border-[#e4ddd3] bg-[#faf6f1]":"border-white/10 bg-white/[0.03]"),style:gd(72*c),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)(f3,{surfaceTheme:a,text:b.title,className:s("text-[13px] font-semibold",l?"text-[#171410]":"text-white"),startDelayMs:120*c,wordDelayMs:70},`files-section-title:${b.id}:${c}:${b.title}`),(0,d.jsx)(ga,{surfaceTheme:a,tone:b.enabled?"success":"muted",label:b.enabled?"Included":"Skipped"})]}),H?null:(0,d.jsx)("p",{className:s("mt-1 text-[11px] leading-5",l?"text-[#7a7168]":"text-slate-400"),children:b.description})]}),(0,d.jsxs)("span",{className:s("text-[11px] uppercase tracking-[0.16em]",l?"text-[#95897c]":"text-slate-500"),children:[b.resources.length," file",1===b.resources.length?"":"s"]})]}),b.resources.length>0?(0,d.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:b.resources.map((e,f)=>(0,d.jsx)(f8,{surfaceTheme:a,label:e.label,tone:n.has(e.relativePath)?"success":"core"===b.id?"default":"accent",animated:!0,delayMs:(6*c+f)*88,interactive:!!i,onClick:i?()=>i(e.relativePath):void 0},e.relativePath))}):(0,d.jsx)("p",{className:s("mt-2 text-[11px] leading-5",l?"text-[#7a7168]":"text-slate-400"),children:"Disabled by the current workspace rules."})]},b.id))})]}):null]})]}):(0,d.jsxs)("div",{className:s("workspace-architect-card-enter relative overflow-hidden border",H?"rounded-[28px] p-4 md:p-5":"rounded-[26px] p-3.5 md:p-4",l?"border-[#e5ddd2] bg-white shadow-[0_22px_60px_rgba(56,47,38,0.07)]":"border-white/10 bg-[rgba(6,10,18,0.96)] shadow-[0_22px_60px_rgba(0,0,0,0.22)]",f),children:[(0,d.jsx)("div",{className:s("pointer-events-none absolute inset-0",l?"bg-[radial-gradient(circle_at_top_right,rgba(216,177,132,0.16),transparent_36%),radial-gradient(circle_at_bottom_left,rgba(94,193,255,0.08),transparent_42%)]":"bg-[radial-gradient(circle_at_top_right,rgba(103,232,249,0.18),transparent_34%),radial-gradient(circle_at_bottom_left,rgba(59,130,246,0.16),transparent_42%)]")}),(0,d.jsxs)("div",{className:"relative space-y-4",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-3",children:[(0,d.jsx)("div",{className:s("inline-flex size-12 shrink-0 items-center justify-center rounded-2xl border text-[12px] font-semibold tracking-[0.12em]",l?"border-[#e4ddd2] bg-[#fcfaf7] text-[#4f4942]":"border-white/10 bg-white/[0.05] text-slate-100"),children:C}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:s("text-[10px] uppercase tracking-[0.24em]",l?"text-[#8d8174]":"text-slate-500"),children:"Architect"}),(0,d.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[(0,d.jsx)("p",{className:s("text-[20px] font-semibold tracking-[-0.04em]",l?"text-[#171410]":"text-white"),children:o}),(0,d.jsx)(ga,{surfaceTheme:a,tone:G,label:w})]}),(0,d.jsx)(f3,{surfaceTheme:a,text:M?y:L,className:s("workspace-architect-card-enter mt-1 line-clamp-3 text-[13px] leading-6",l?"text-[#6f685f]":"text-slate-300",!M&&"italic"),startDelayMs:80,wordDelayMs:120},`hero-status:${H?"panel":"message"}:${M?y:L}`)]})]}),(0,d.jsxs)("div",{className:"shrink-0 text-right",children:[(0,d.jsx)("p",{className:s("text-[10px] uppercase tracking-[0.2em]",l?"text-[#918577]":"text-slate-500"),children:"Readiness"}),(0,d.jsxs)("p",{className:s("mt-1 text-[28px] font-semibold tracking-[-0.05em]",l?"text-[#181612]":"text-white"),children:[b.readinessScore,"%"]}),H&&h?(0,d.jsxs)(x,{type:"button",variant:"secondary",size:"sm",onClick:()=>h("workspace.name"),className:l?"mt-2 rounded-full border-[#ddd6cb] bg-[#f7f2eb] text-[#403934] hover:bg-[#f1ebe3]":"mt-2 rounded-full border-white/10 bg-white/[0.04] text-slate-200 hover:bg-white/[0.08]",children:[(0,d.jsx)(bV.A,{className:"mr-2 h-3.5 w-3.5"}),"Edit details"]}):null]})]}),N?(0,d.jsxs)("div",{className:"workspace-architect-card-enter grid gap-2.5 sm:grid-cols-3",style:gd(90),children:[(0,d.jsx)(f2,{surfaceTheme:a,label:"Mission",value:p,icon:a2.A,revealDelayMs:120}),(0,d.jsx)(f2,{surfaceTheme:a,label:"Audience",value:q,icon:eU.A,revealDelayMs:220}),(0,d.jsx)(f2,{surfaceTheme:a,label:"Source",value:E,detail:F,icon:D,revealDelayMs:320})]}):null,O?(0,d.jsx)("div",{className:"workspace-architect-card-enter flex flex-wrap gap-1.5",style:gd(170),children:H?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f4,{surfaceTheme:a,label:"Template",value:t,icon:fS.A,revealDelayMs:0}),(0,d.jsx)(f4,{surfaceTheme:a,label:"Stage",value:v,icon:a8.A,revealDelayMs:110}),(0,d.jsx)(f4,{surfaceTheme:a,label:"Files",value:String(V),icon:a9.A,revealDelayMs:220})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f4,{surfaceTheme:a,label:"Template",value:t,icon:fS.A,revealDelayMs:0}),(0,d.jsx)(f4,{surfaceTheme:a,label:"Company",value:u,icon:fT.A,revealDelayMs:110}),(0,d.jsx)(f4,{surfaceTheme:a,label:"Stage",value:v,icon:a8.A,revealDelayMs:220}),(0,d.jsx)(f4,{surfaceTheme:a,label:"Sources",value:String(b.intake.sources.length),icon:e7.A,revealDelayMs:330}),(0,d.jsx)(f4,{surfaceTheme:a,label:"Files",value:String(B),icon:a9.A,revealDelayMs:440})]})}):null,Q?(0,d.jsxs)("section",{className:"space-y-3",children:[(0,d.jsx)(f5,{surfaceTheme:a,title:"Evidence",subtitle:"What the architect pulled from the prompt, website, repo, or existing folder.",revealDelayMs:0}),b.intake.sources.length>0?(0,d.jsx)("div",{className:"grid gap-2 md:grid-cols-2",children:b.intake.sources.map((b,c)=>(0,d.jsx)(f6,{surfaceTheme:a,source:b,delayMs:120*c},b.id))}):(0,d.jsx)(gb,{surfaceTheme:a,title:"No sources yet",description:"Add a website, repo, folder, or short brief and the architect will start grounding the draft."})]}):null,R?(0,d.jsxs)("section",{className:"space-y-3",children:[(0,d.jsx)(f5,{surfaceTheme:a,title:"Inferred facts",subtitle:"Structured fields the architect is using to shape the workspace.",revealDelayMs:0}),A.length>0?(0,d.jsx)("div",{className:"grid gap-2 md:grid-cols-2",children:A.map((b,c)=>(0,d.jsx)(f7,{surfaceTheme:a,inference:b,delayMs:120*c},b.id))}):(0,d.jsx)(gb,{surfaceTheme:a,title:"No inferences yet",description:"Architect will populate structured facts once it has enough source signal."})]}):null,P?(0,d.jsxs)("section",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,d.jsx)(f5,{surfaceTheme:a,title:"Files to create",subtitle:H?"Canonical scaffold derived from the current workspace rules.":"The same file set the workspace will scaffold on the next pass.",revealDelayMs:0}),(0,d.jsx)(ga,{surfaceTheme:a,tone:"muted",label:`${V} file${1===V?"":"s"}`})]}),(0,d.jsx)("div",{className:"space-y-2.5",children:T.map((b,c)=>(0,d.jsxs)("div",{className:s("workspace-architect-card-enter rounded-[18px] border px-3 py-3",l?"border-[#e4ddd3] bg-[#faf6f1]":"border-white/10 bg-white/[0.03]"),style:gd(72*c),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsx)("div",{className:"min-w-0",children:(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("p",{className:s("text-[13px] font-semibold",l?"text-[#171410]":"text-white"),children:b.title}),(0,d.jsx)(ga,{surfaceTheme:a,tone:b.enabled?"success":"muted",label:b.enabled?"Included":"Skipped"})]})}),(0,d.jsxs)("span",{className:s("text-[11px] uppercase tracking-[0.16em]",l?"text-[#95897c]":"text-slate-500"),children:[b.resources.length," file",1===b.resources.length?"":"s"]})]}),b.resources.length>0?(0,d.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:b.resources.map((e,f)=>(0,d.jsx)(f8,{surfaceTheme:a,label:e.label,tone:n.has(e.relativePath)?"success":"core"===b.id?"default":"accent",animated:!0,delayMs:(6*c+f)*52,interactive:!!i,onClick:i?()=>i(e.relativePath):void 0},e.relativePath))}):(0,d.jsx)("p",{className:s("mt-2 text-[11px] leading-5",l?"text-[#7a7168]":"text-slate-400"),children:"Disabled by the current workspace rules."})]},b.id))})]}):null,S&&b.intake.confirmations.length>0?(0,d.jsxs)("section",{className:"space-y-3",children:[(0,d.jsx)(f5,{surfaceTheme:a,title:"Open decisions",subtitle:"These are the remaining items the architect still wants to confirm."}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:b.intake.confirmations.map((a,b)=>(0,d.jsxs)("span",{className:s("workspace-architect-chip-enter inline-flex items-center rounded-full border px-2.5 py-1 text-[10px] leading-4",l?"border-[#ddd6cb] bg-white text-[#6a6157]":"border-white/10 bg-white/[0.05] text-slate-300"),style:gd(48*b),children:[(0,d.jsx)(a8.A,{className:"mr-1 h-3 w-3 shrink-0"}),(0,d.jsx)("span",{className:"max-w-[28rem] truncate",children:a})]},`decision:${b}:${a}`))})]}):null]})]})}function f2({surfaceTheme:a,label:b,value:c,detail:e,icon:f,revealDelayMs:g=0}){let h="light"===a;return(0,d.jsx)("div",{className:s("rounded-[18px] border px-3 py-3",h?"border-[#e4ddd3] bg-white":"border-white/10 bg-white/[0.03]"),children:(0,d.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,d.jsx)("span",{className:s("inline-flex size-8 shrink-0 items-center justify-center rounded-full border",h?"border-[#e4ddd2] bg-[#faf6f1] text-[#5f5952]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,d.jsx)(f,{className:"h-3.5 w-3.5"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)(f3,{surfaceTheme:a,text:b,className:s("text-[10px] uppercase tracking-[0.18em]",h?"text-[#8f8274]":"text-slate-500"),startDelayMs:g,wordDelayMs:55},`detail-label:${b}:${g}`),(0,d.jsx)(f3,{surfaceTheme:a,text:c,className:s("mt-1 text-[13px] font-medium leading-5",h?"text-[#171410]":"text-white"),startDelayMs:g+80,wordDelayMs:110},`detail-value:${b}:${g}`),e?(0,d.jsx)(f3,{surfaceTheme:a,text:e,className:s("mt-1 text-[11px] leading-5",h?"text-[#7a7168]":"text-slate-400"),startDelayMs:g+200,wordDelayMs:95},`detail-extra:${b}:${g}`):null]})]})})}function f3({surfaceTheme:a,text:b,className:c,startDelayMs:e=0,wordDelayMs:f=110}){let h=(0,g.useMemo)(()=>b.trim().split(/\s+/).filter(Boolean),[b]),[i,j]=(0,g.useState)(0);return(0,d.jsxs)("p",{className:c,children:[h.slice(0,i).map((a,b)=>(0,d.jsxs)("span",{children:[b>0?" ":"",a]},`${b}:${a}`)),i<h.length?(0,d.jsx)("span",{"aria-hidden":"true",className:s("ml-0.5 inline-block animate-pulse","light"===a?"text-[#6f685f]":"text-slate-300"),children:"▍"}):null]})}function f4({surfaceTheme:a,label:b,value:c,icon:e,revealDelayMs:f=0}){let g="light"===a;return(0,d.jsxs)("div",{className:s("inline-flex items-center gap-2 rounded-full border px-3 py-1.5 text-[11px]",g?"border-[#e4ddd2] bg-white text-[#5f5851]":"border-white/10 bg-white/[0.04] text-slate-300"),children:[(0,d.jsx)(e,{className:"h-3.5 w-3.5 shrink-0"}),(0,d.jsx)(f3,{surfaceTheme:a,text:b,className:"uppercase tracking-[0.16em]",startDelayMs:f,wordDelayMs:55},`stat-label:${b}:${f}`),(0,d.jsx)(f3,{surfaceTheme:a,text:c,className:"font-medium normal-case tracking-normal",startDelayMs:f+80,wordDelayMs:80},`stat-value:${b}:${f}`)]})}function f5({surfaceTheme:a,title:b,subtitle:c,revealDelayMs:e=0}){let f="light"===a;return(0,d.jsxs)("div",{children:[(0,d.jsx)(f3,{surfaceTheme:a,text:b,className:s("text-[11px] uppercase tracking-[0.18em]",f?"text-[#8f8274]":"text-slate-500"),startDelayMs:e,wordDelayMs:60},`heading-title:${b}:${e}`),(0,d.jsx)(f3,{surfaceTheme:a,text:c,className:s("mt-1 text-[12px] leading-5",f?"text-[#70665c]":"text-slate-400"),startDelayMs:e+100,wordDelayMs:90},`heading-subtitle:${b}:${e}`)]})}function f6({surfaceTheme:a,source:b,delayMs:c=0}){var e;let f="light"===a,g=f0[b.kind].icon;return(0,d.jsx)("div",{className:s("workspace-architect-chip-enter rounded-[18px] border px-3 py-3",f?"border-[#e4ddd3] bg-white":"border-white/10 bg-white/[0.03]"),style:gd(c),children:(0,d.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,d.jsx)("span",{className:s("inline-flex size-8 shrink-0 items-center justify-center rounded-full border",f?"border-[#e4ddd2] bg-[#faf6f1] text-[#5f5952]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,d.jsx)(g,{className:"h-3.5 w-3.5"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)(f3,{surfaceTheme:a,text:b.label,className:s("text-[12px] font-semibold",f?"text-[#171410]":"text-white"),startDelayMs:c,wordDelayMs:70},`source-label:${b.id}:${c}`),(0,d.jsx)(f3,{surfaceTheme:a,text:b.summary,className:s("mt-1 text-[11px] leading-5",f?"text-[#7a7168]":"text-slate-400"),startDelayMs:c+90,wordDelayMs:95},`source-summary:${b.id}:${c}`)]}),(0,d.jsxs)("div",{className:"flex shrink-0 flex-col items-end gap-1",children:[(0,d.jsx)(ga,{surfaceTheme:a,tone:"ready"===b.status?"success":"danger",label:gc(b.status)}),"number"==typeof b.confidence?(0,d.jsx)("span",{className:s("text-[10px] uppercase tracking-[0.16em]",f?"text-[#8f8274]":"text-slate-500"),children:(e=b.confidence,`${Math.round(100*e)}%`)}):null]})]}),b.details.length>0?(0,d.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:b.details.slice(0,2).map((a,c)=>(0,d.jsx)("span",{className:s("inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] leading-4",f?"border-[#e4ddd2] bg-[#faf6f1] text-[#6d645b]":"border-white/10 bg-white/[0.04] text-slate-300"),children:a},`source-detail:${b.id}:${c}:${a}`))}):null]})]})})}function f7({surfaceTheme:a,inference:b,delayMs:c}){let e="light"===a;return(0,d.jsxs)("div",{className:s("workspace-architect-chip-enter rounded-[18px] border px-3 py-3",e?"border-[#e4ddd3] bg-white":"border-white/10 bg-white/[0.03]"),style:gd(c),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)(f3,{surfaceTheme:a,text:f$(b.section),className:s("text-[10px] uppercase tracking-[0.18em]",e?"text-[#8f8274]":"text-slate-500"),startDelayMs:c,wordDelayMs:55},`inference-section:${b.id}:${c}`),(0,d.jsx)(f3,{surfaceTheme:a,text:b.label,className:s("mt-1 text-[12px] font-semibold leading-5",e?"text-[#171410]":"text-white"),startDelayMs:c+80,wordDelayMs:75},`inference-label:${b.id}:${c}`)]}),(0,d.jsx)(ga,{surfaceTheme:a,tone:function(a){switch(a){case"confirmed":return"success";case"needs-confirmation":return"warning";default:return"muted"}}(b.status),label:"confirmed"===b.status?"Confirmed":"needs-confirmation"===b.status?"Needs check":"Inferred"})]}),(0,d.jsx)(f3,{surfaceTheme:a,text:b.value,className:s("mt-2 text-[13px] leading-6",e?"text-[#5f564e]":"text-slate-300"),startDelayMs:c+120,wordDelayMs:100},`inference-value:${b.id}:${c}`),(0,d.jsx)(f3,{surfaceTheme:a,text:b.rationale,className:s("mt-2 text-[11px] leading-5",e?"text-[#7a7168]":"text-slate-400"),startDelayMs:c+250,wordDelayMs:90},`inference-rationale:${b.id}:${c}`),b.sourceLabels.length>0?(0,d.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:b.sourceLabels.slice(0,3).map((a,c)=>(0,d.jsx)("span",{className:s("inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] leading-4",e?"border-[#e4ddd2] bg-[#faf6f1] text-[#6d645b]":"border-white/10 bg-white/[0.04] text-slate-300"),children:a},`inference-source:${b.id}:${c}:${a}`))}):null]})}function f8({surfaceTheme:a,label:b,tone:c="default",animated:e=!1,delayMs:f=0,interactive:g=!1,onClick:h}){let i="light"===a,j=s("inline-flex items-center rounded-full border px-2.5 py-1 font-mono text-[10px] leading-4 transition-colors",e&&"workspace-architect-chip-enter","accent"===c?i?"border-[#d8b184] bg-[#f8efe3] text-[#7c5a34]":"border-cyan-300/30 bg-cyan-300/10 text-cyan-100":"success"===c?i?"border-emerald-300 bg-emerald-50 text-emerald-900":"border-emerald-300/30 bg-emerald-300/12 text-emerald-100":"muted"===c?i?"border-[#e4ddd3] bg-[#faf6f1] text-[#6d645b]":"border-white/10 bg-white/[0.04] text-slate-400":i?"border-[#e4ddd3] bg-white text-[#6d645b]":"border-white/10 bg-white/[0.05] text-slate-300",g?"success"===c?i?"cursor-pointer hover:border-emerald-400 hover:bg-emerald-100":"cursor-pointer hover:border-emerald-300/45 hover:bg-emerald-300/16":i?"cursor-pointer hover:border-[#d8c8ba] hover:bg-[#f6efe6]":"cursor-pointer hover:border-white/15 hover:bg-white/[0.08]":""),k=g?bV.A:n.A;return g?(0,d.jsxs)("button",{type:"button",onClick:h,"aria-label":`Edit ${b}`,className:j,style:gd(f),children:[(0,d.jsx)(k,{className:"mr-1 h-3 w-3"}),b]}):(0,d.jsxs)("span",{className:j,style:gd(f),children:[(0,d.jsx)(k,{className:"mr-1 h-3 w-3"}),b]})}function f9(a,b){let c=a.trim();return c.length<=b?c:`${c.slice(0,Math.max(0,b-1)).trimEnd()}…`}function ga({surfaceTheme:a,tone:b,label:c}){return(0,d.jsx)("span",{className:s("inline-flex items-center rounded-full border px-2.5 py-1 text-[10px] uppercase tracking-[0.16em]","muted"===b&&("light"===a?"border-[#e4ddd3] bg-[#f7f2eb] text-[#746b61]":"border-white/10 bg-white/[0.05] text-slate-300"),"success"===b&&"border-emerald-200 bg-emerald-50 text-emerald-700","warning"===b&&"border-amber-200 bg-amber-50 text-amber-700","danger"===b&&"border-rose-200 bg-rose-50 text-rose-700"),children:c})}function gb({surfaceTheme:a,title:b,description:c}){let e="light"===a;return(0,d.jsxs)("div",{className:s("rounded-[18px] border border-dashed px-3 py-3",e?"border-[#ddd5ca] bg-white/80":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsx)(f3,{surfaceTheme:a,text:b,className:s("text-[12px] font-medium",e?"text-[#171410]":"text-white"),startDelayMs:0,wordDelayMs:65},`empty-title:${b}`),(0,d.jsx)(f3,{surfaceTheme:a,text:c,className:s("mt-1 text-[12px] leading-5",e?"text-[#70665c]":"text-slate-400"),startDelayMs:90,wordDelayMs:90},`empty-description:${b}`)]})}function gc(a){return"ready"===a?"Ready":"Needs check"}function gd(a){return{animationDelay:`${a}ms`}}let ge=Object.fromEntries(fw.map(a=>[a.value,a.label]));function gf({className:a,surfaceTheme:b,workspaceMode:c="create",mode:e,snapshot:f,plan:h,resolvedName:i,resolvedTemplate:j,sourceAnalysis:k,workspacePath:l,notice:m,basicRules:n,basicPreset:o,onOpenBlueprintEditor:p,onOpenDocumentEditor:q,onBasicPresetChange:r,onBasicRuleToggle:t,progress:u}){let v="light"===b,w=(0,g.useRef)({});(0,g.useRef)(null);let[y,z]=(0,g.useState)(null),A=(a="workspace.name")=>{p?.(a)};(0,g.useMemo)(()=>(function({mode:a,plan:b,notice:c,progress:d,resolvedName:e,resolvedTemplate:f,basicRules:g,basicPreset:h,sourceAnalysis:i,workspacePath:j}){return{mode:a,noticeSignature:c?`${c.tone}:${c.title}:${c.description}`:"",progressSignature:d?JSON.stringify(d):"",basic:{architectSignature:b?[b.architectSummary,b.company.name,b.company.mission,b.company.targetCustomer,b.workspace.template,JSON.stringify(b.workspace.rules),b.intake.sources.map(a=>`${a.kind}:${a.status}:${a.label}:${Math.round((a.confidence??0)*100)}`).join("|"),b.intake.inferences.map(a=>`${a.section}:${a.status}:${a.label}:${a.value}`).join("|"),b.intake.confirmations.join("|")].join(":"):"",summarySignature:[e,f,i.kind,i.label,i.hint,i.repoUrl??"",i.existingPath??"",i.websiteUrl??"",j].join(":"),defaultsSignature:`${h}:${g.generateStarterDocs}:${g.generateMemory}:${g.kickoffMission}`},advanced:{stage:b?.stage??null,readinessSignature:b?`${b.readinessScore}:${b.architectSummary}`:"",deploySignature:b?`${b.intake.reviewRequested}:${b.deploy.blockers.join("|")}:${b.deploy.warnings.join("|")}`:"",sectionSignatures:Object.fromEntries(fV.map(a=>[a.id,b?`${fY(b,a.id).label}:${fY(b,a.id).variant}:${fZ(b,a.id)}`:""]))}}})({mode:e,plan:h,notice:m,progress:u,resolvedName:i,resolvedTemplate:j,basicRules:n,basicPreset:o,sourceAnalysis:k,workspacePath:l}),[o,n,e,m,h,u,i,j,k,l]);let B=(0,g.useMemo)(()=>h?fp({name:h.workspace.name||"Workspace",brief:h.company.mission||h.product.offer||void 0,template:h.workspace.template,sourceMode:h.workspace.sourceMode,rules:h.workspace.rules,agents:h.team.persistentAgents.filter(a=>a.enabled),docOverrides:h.workspace.docOverrides,toolExamples:[],contextSources:h.intake.sources}):[],[h]),C=(0,g.useMemo)(()=>new Map(B.map(a=>[a.path,a])),[B]),D=(0,g.useMemo)(()=>fn(h?.workspace.template??j,h?.workspace.rules??n),[n,h?.workspace.rules,h?.workspace.template,j]);return(0,d.jsx)("aside",{className:s("min-h-0 border-t lg:border-l lg:border-t-0",v?"border-[#ebe5dd] bg-[#f7f2eb]":"border-white/10 bg-[rgba(5,9,18,0.92)]",a),children:(0,d.jsx)(fc,{className:"h-full",children:(0,d.jsxs)("div",{className:"space-y-4 p-4 md:p-5",children:[(0,d.jsx)(gh,{surfaceTheme:b,title:"basic"===e?"Workspace draft":"Workspace blueprint",subtitle:"basic"===e?"Live draft view. The fast path stays available while Architect fills in the details.":"Structured blueprint synced with the conversation.",action:h&&p?(0,d.jsxs)(x,{type:"button",variant:"secondary",size:"sm",onClick:()=>A("workspace.name"),className:v?"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,d.jsx)(bV.A,{className:"mr-2 h-3.5 w-3.5"}),"Edit details"]}):null}),"create"===c?(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(gg,{sectionKey:"setup-speed",activeSection:y,surfaceTheme:b,register:a=>{w.current["setup-speed"]=a},children:(0,d.jsx)(gm,{surfaceTheme:b,mode:e,preset:o,onPresetChange:r,onOpenBlueprintEditor:A})})}):null,m?(0,d.jsx)(gg,{sectionKey:"notice",activeSection:y,surfaceTheme:b,register:a=>{w.current.notice=a},children:(0,d.jsxs)("div",{className:s("rounded-[18px] border px-4 py-3","warning"===m.tone?v?"border-amber-200 bg-amber-50 text-amber-900":"border-amber-400/25 bg-amber-400/10 text-amber-100":v?"border-[#e3ddd4] bg-white text-[#3f3933]":"border-white/10 bg-white/[0.04] text-slate-200"),children:[(0,d.jsx)("p",{className:s("text-[11px] uppercase tracking-[0.18em]",v?"text-[#9c9389]":"text-slate-500"),children:m.title}),(0,d.jsx)("p",{className:"mt-1 text-[13px] leading-6",children:m.description})]})}):null,u?(0,d.jsx)(gg,{sectionKey:"progress",activeSection:y,surfaceTheme:b,register:a=>{w.current.progress=a},children:(0,d.jsx)(fa,{progress:u,className:s(v?"border-[#e5ded3] bg-white text-slate-900 [&_p]:text-inherit":"border-white/10 bg-slate-950/50")})}):null,"basic"===e?(0,d.jsxs)("div",{className:"space-y-3",children:[h?(0,d.jsx)(gg,{sectionKey:"architect-readout",activeSection:y,surfaceTheme:b,register:a=>{w.current["architect-readout"]=a},children:(0,d.jsx)(f1,{surfaceTheme:b,plan:h,variant:"panel",onOpenBlueprintEditor:A,onOpenDocumentEditor:q},h.updatedAt)}):null,(0,d.jsx)(gg,{sectionKey:"summary",activeSection:y,surfaceTheme:b,register:a=>{w.current.summary=a},children:(0,d.jsx)(gi,{surfaceTheme:b,resolvedName:i,resolvedTemplate:j,sourceAnalysis:k,workspacePath:l,workspaceRoot:f.diagnostics.workspaceRoot,summaryLabel:h?"Architect refreshed the draft.":"Resolved from quick setup.",onOpenBlueprintEditor:A})}),(0,d.jsx)(gg,{sectionKey:"defaults",activeSection:y,surfaceTheme:b,register:a=>{w.current.defaults=a},children:(0,d.jsxs)("div",{className:s("rounded-[22px] border p-4",v?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:[(0,d.jsx)("p",{className:s("text-[11px] uppercase tracking-[0.18em]",v?"text-[#a0978b]":"text-slate-500"),children:"Fast-path defaults"}),(0,d.jsx)(gl,{surfaceTheme:b,plan:h,template:j,rules:n,preset:o,onRuleToggle:t,onOpenBlueprintEditor:A,onOpenDocumentEditor:q})]})})]}):h?(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)(gg,{sectionKey:"readiness",activeSection:y,surfaceTheme:b,register:a=>{w.current.readiness=a},children:(0,d.jsx)("button",{type:"button",onClick:()=>A("deploy.blockers"),className:s("w-full rounded-[22px] border p-4 text-left transition-colors",v?"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,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:s("text-[11px] uppercase tracking-[0.18em]",v?"text-[#a0978b]":"text-slate-500"),children:"Readiness"}),(0,d.jsxs)("p",{className:s("mt-1 text-[28px] font-semibold tracking-[-0.03em]",v?"text-[#181612]":"text-white"),children:[h.readinessScore,"%"]}),(0,d.jsx)("p",{className:s("text-[13px] leading-6",v?"text-[#6e665d]":"text-slate-300"),children:h.architectSummary})]}),(0,d.jsx)("span",{className:s("inline-flex size-10 items-center justify-center rounded-full border",v?"border-[#e5ddd2] bg-[#f5f0e8] text-[#6a635b]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,d.jsx)(a7.A,{className:"h-4 w-4"})})]})})}),fV.map(a=>{let c=fY(h,a.id),e=a.icon,f=`section-${a.id}`;return(0,d.jsx)(gg,{sectionKey:f,activeSection:y,surfaceTheme:b,register:a=>{w.current[f]=a},children:(0,d.jsx)("button",{type:"button",onClick:()=>A("company"===a.id?"company.mission":"product"===a.id?"product.offer":"workspace"===a.id?"workspace.name":"team"===a.id?"team.maxParallelRuns":"deploy.blockers"),className:s("w-full rounded-[22px] border p-4 text-left transition-colors",v?"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,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:s("inline-flex size-9 shrink-0 items-center justify-center rounded-full border",v?"border-[#e7e0d6] bg-[#faf6f1] text-[#5e5750]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,d.jsx)(e,{className:"h-4 w-4"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:s("text-[14px] font-semibold",v?"text-[#171410]":"text-white"),children:a.label}),(0,d.jsx)(gk,{surfaceTheme:b,tone:c.variant,label:c.label})]}),(0,d.jsx)("p",{className:s("mt-1 text-[13px] leading-6",v?"text-[#70685f]":"text-slate-300"),children:fZ(h,a.id)})]})]})})},a.id)}),(0,d.jsx)(gg,{sectionKey:"documents",activeSection:y,surfaceTheme:b,register:a=>{w.current.documents=a},children:(0,d.jsxs)("div",{className:s("rounded-[22px] border p-4",v?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(a9.A,{className:s("h-4 w-4",v?"text-[#5f5952]":"text-slate-300")}),(0,d.jsx)("p",{className:s("text-[14px] font-semibold",v?"text-[#171410]":"text-white"),children:"Documents"})]}),(0,d.jsx)("div",{className:"mt-3 space-y-3",children:D.sections.map(a=>{let c=a.resources.map(a=>C.get(a.relativePath)).filter(a=>!!a);return(0,d.jsxs)("div",{className:s("rounded-[18px] border px-3 py-3",v?"border-[#e8e0d6] bg-[#faf6f1]":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:s("text-[12px] font-semibold",v?"text-[#171410]":"text-white"),children:a.title}),(0,d.jsx)("p",{className:s("mt-1 text-[11px] leading-5",v?"text-[#7a7168]":"text-slate-400"),children:a.description})]}),(0,d.jsx)(gk,{surfaceTheme:b,tone:a.enabled?"success":"muted",label:a.enabled?"Included":"Skipped"})]}),c.length>0?(0,d.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:c.map(a=>(0,d.jsx)(go,{surfaceTheme:b,label:a.path,tone:a.generated?a.overridden?"success":"default":"accent",interactive:!!q,onClick:q?()=>q(a.path):void 0},a.path))}):(0,d.jsx)("p",{className:s("mt-2 text-[11px] leading-5",v?"text-[#7a7168]":"text-slate-400"),children:"Disabled by the current workspace rules."})]},a.id)})}),q?(0,d.jsx)("p",{className:s("mt-2 text-[11px] leading-5",v?"text-[#7a7168]":"text-slate-400"),children:"edit"===c?"These are the current workspace files grouped by the canonical context manifest.":"These are the scaffold documents that will be written for this workspace."}):null]})}),(0,d.jsx)(gg,{sectionKey:"deploy-review",activeSection:y,surfaceTheme:b,register:a=>{w.current["deploy-review"]=a},children:(0,d.jsxs)("button",{type:"button",onClick:()=>A("deploy.blockers"),className:s("w-full rounded-[22px] border p-4 text-left transition-colors",v?"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,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(fQ.A,{className:s("h-4 w-4",v?"text-[#5f5952]":"text-slate-300")}),(0,d.jsx)("p",{className:s("text-[14px] font-semibold",v?"text-[#171410]":"text-white"),children:"Deploy review"})]}),h.deploy.blockers.length>0?(0,d.jsx)(gp,{surfaceTheme:b,title:"Blockers",tone:"danger",items:h.deploy.blockers}):null,h.deploy.warnings.length>0?(0,d.jsx)(gp,{surfaceTheme:b,title:"Warnings",tone:"warning",items:h.deploy.warnings}):null,0===h.deploy.blockers.length&&0===h.deploy.warnings.length?(0,d.jsx)("p",{className:s("mt-3 text-[13px] leading-6",v?"text-[#70685f]":"text-slate-300"),children:"Architect has not surfaced blockers or warnings yet. Request review when the blueprint feels directionally right."}):null]})})]}):(0,d.jsxs)("div",{className:s("rounded-[22px] border border-dashed p-5",v?"border-[#ddd5ca] bg-white/80":"border-white/10 bg-white/[0.04]"),children:[(0,d.jsx)("p",{className:s("text-[14px] font-medium",v?"text-[#211d19]":"text-white"),children:"Architect is preparing the blueprint."}),(0,d.jsx)("p",{className:s("mt-1 text-[13px] leading-6",v?"text-[#776f65]":"text-slate-300"),children:"Once the first plan is ready, this pane will start reflecting the structured workspace draft."})]})]})})})}function gg({sectionKey:a,activeSection:b,surfaceTheme:c,register:e,children:f}){return(0,d.jsx)("div",{ref:e,className:s("scroll-mt-6 rounded-[26px] transition-all duration-500",b===a&&("light"===c?"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:f})}function gh({surfaceTheme:a,title:b,subtitle:c,action:e}){let f="light"===a;return(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:s("text-[11px] uppercase tracking-[0.18em]",f?"text-[#8b7262]":"text-slate-500"),children:b}),(0,d.jsx)("p",{className:s("mt-1 text-[13px] leading-6",f?"text-[#705b4d]":"text-slate-300"),children:c})]}),e?(0,d.jsx)("div",{className:"shrink-0",children:e}):null]})}function gi({surfaceTheme:a,resolvedName:b,resolvedTemplate:c,sourceAnalysis:e,workspacePath:f,workspaceRoot:g,summaryLabel:h,onOpenBlueprintEditor:i}){let j="light"===a;return(0,d.jsx)("div",{className:s("rounded-[22px] border p-4",j?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:s("inline-flex size-9 shrink-0 items-center justify-center rounded-full border",j?"border-[#e7e0d6] bg-[#faf6f1] text-[#5e5750]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,d.jsx)(a2.A,{className:"h-4 w-4"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:s("text-[11px] uppercase tracking-[0.18em]",j?"text-[#a0978b]":"text-slate-500"),children:"Fast-path snapshot"}),(0,d.jsx)("p",{className:s("mt-1 text-[12px] leading-5",j?"text-[#776f65]":"text-slate-400"),children:h}),(0,d.jsxs)("div",{className:"mt-4 space-y-2",children:[(0,d.jsx)(gj,{surfaceTheme:a,label:"Name",value:b,icon:a2.A,onClick:()=>i?.("workspace.name")}),(0,d.jsx)(gj,{surfaceTheme:a,label:"Template",value:ge[c],icon:e9.A,onClick:()=>i?.("workspace.template")}),(0,d.jsx)(gj,{surfaceTheme:a,label:"Source",value:e.label,icon:"clone"===e.kind?e6.A:"website"===e.kind?e7.A:e8.A,onClick:()=>i?.("workspace.sourceMode")}),(0,d.jsx)(gj,{surfaceTheme:a,label:"Path",value:f,icon:e8.A,mono:!0,title:`Root: ${g}`,onClick:()=>i?.("workspace.directory")})]})]})]})})}function gj({surfaceTheme:a,label:b,value:c,icon:e,detail:f,mono:g=!1,title:h,onClick:i}){let j="light"===a,k=!!i;return(0,d.jsx)("button",{type:"button",onClick:i,className:s("w-full rounded-[14px] border px-3 py-2.5 text-left transition-colors",j?"border-[#e8e0d6] bg-[#faf6f1]":"border-white/10 bg-white/[0.03]",k&&(j?"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:h,children:(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)("span",{className:s("inline-flex size-6 shrink-0 items-center justify-center rounded-full border",j?"border-[#e0d7cc] bg-white text-[#615a52]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,d.jsx)(e,{className:"h-3 w-3"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:s("text-[10px] uppercase tracking-[0.16em]",j?"text-[#8d8276]":"text-slate-500"),children:b}),(0,d.jsx)("p",{className:s("truncate text-[12px] font-medium leading-4",j?"text-[#171410]":"text-white",g&&"font-mono text-[12px]"),title:c,children:c})]}),k?(0,d.jsx)(bV.A,{className:s("h-3.5 w-3.5 shrink-0",j?"text-[#8f8377]":"text-slate-400")}):null,f?(0,d.jsx)("span",{className:s("shrink-0 text-[10px] leading-4",j?"text-[#776f65]":"text-slate-400"),children:f}):null]})})}function gk({surfaceTheme:a,tone:b,label:c}){return(0,d.jsx)("span",{className:s("inline-flex items-center rounded-full border px-2.5 py-1 text-[10px] uppercase tracking-[0.16em]","muted"===b&&("light"===a?"border-[#e4ddd3] bg-[#f7f2eb] text-[#746b61]":"border-white/10 bg-white/[0.05] text-slate-300"),"success"===b&&"border-emerald-200 bg-emerald-50 text-emerald-700","warning"===b&&"border-amber-200 bg-amber-50 text-amber-700","danger"===b&&"border-rose-200 bg-rose-50 text-rose-700"),children:c})}function gl({surfaceTheme:a,plan:b,template:c,rules:e,preset:f,onRuleToggle:h,onOpenBlueprintEditor:i,onOpenDocumentEditor:j}){var k,l;let m,o,p,q,r,t="light"===a,u=fn(c,e),v=(k=c,l=e,m=fm(k),o=new Set(fj),p=m.filter(a=>o.has(a.relativePath)).map(a=>a.label),q=m.filter(a=>a.relativePath.startsWith("docs/")||a.relativePath.startsWith("deliverables/")).map(a=>a.label),r=m.filter(a=>"MEMORY.md"===a.relativePath||a.relativePath.startsWith("memory/")).map(a=>a.label),[{id:"core",title:"Core agent files",description:"Identity and operating rules.",checked:!0,locked:!0,files:p,rule:void 0},{id:"docs",title:"Starter docs",description:"Brief, architecture, handoff.",checked:l.generateStarterDocs,locked:!1,files:q,rule:"generateStarterDocs"},{id:"memory",title:"Memory files",description:"Durable decisions and context.",checked:l.generateMemory,locked:!1,files:r,rule:"generateMemory"},{id:"kickoff",title:"Kickoff mission",description:"Starts the first mission.",checked:l.kickoffMission,locked:!1,files:[],rule:"kickoffMission"}]),w=(0,g.useMemo)(()=>new Set(fq(b?.workspace.docOverrides).map(a=>a.path)),[b?.workspace.docOverrides]),y=!!b;return(0,d.jsxs)("div",{className:"mt-3 space-y-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:["custom"===f?(0,d.jsx)(gk,{surfaceTheme:a,tone:"muted",label:"Custom mix"}):(0,d.jsx)("span",{}),i?(0,d.jsxs)(x,{type:"button",variant:"secondary",size:"sm",onClick:()=>i("workspace.ruleGenerateStarterDocs"),className:t?"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,d.jsx)(bV.A,{className:"mr-2 h-3.5 w-3.5"}),"Edit section"]}):null]}),(0,d.jsx)("div",{className:"space-y-2",children:v.map(b=>(0,d.jsx)("button",{type:"button",onClick:b.rule?()=>h(b.rule):void 0,disabled:!b.rule,className:s("w-full rounded-[18px] border px-3 py-3 text-left transition-colors",t?"border-[#e8e0d6] bg-[#faf6f1]":"border-white/10 bg-white/[0.03]",b.rule?t?"hover:border-[#d8c9ba] hover:bg-[#f6efe6]":"hover:border-white/15 hover:bg-white/[0.05]":"cursor-default"),children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:s("mt-0.5 inline-flex size-5 shrink-0 items-center justify-center rounded-md border",b.checked?t?"border-[#1f1b17] bg-[#1f1b17] text-white":"border-cyan-300 bg-cyan-300 text-slate-950":t?"border-[#d9d0c6] bg-white text-transparent":"border-white/15 bg-transparent text-transparent"),children:(0,d.jsx)(n.A,{className:"h-3 w-3"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("p",{className:s("text-[13px] font-medium",t?"text-[#171410]":"text-white"),children:b.title}),b.locked?(0,d.jsxs)("span",{className:s("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-[0.16em]",t?"border-[#e0d7cc] bg-white text-[#7a7168]":"border-white/10 bg-white/[0.05] text-slate-400"),children:[(0,d.jsx)(fR.A,{className:"h-3 w-3"}),"Required"]}):null]}),(0,d.jsx)("p",{className:s("mt-1 text-[12px] leading-5",t?"text-[#776f65]":"text-slate-400"),children:b.description}),b.files.length>0?(0,d.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:b.files.map(b=>(0,d.jsx)(go,{surfaceTheme:a,label:b},b))}):null]})]})},b.id))}),(0,d.jsxs)("div",{className:s("rounded-[18px] border px-3 py-3",t?"border-[#e8e0d6] bg-[#faf6f1]":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(a9.A,{className:s("h-4 w-4",t?"text-[#5f5952]":"text-slate-300")}),(0,d.jsx)("p",{className:s("text-[12px] uppercase tracking-[0.16em]",t?"text-[#8d8276]":"text-slate-500"),children:"Canonical manifest"})]}),(0,d.jsx)("div",{className:"mt-3 space-y-3",children:u.sections.map(b=>(0,d.jsxs)("div",{className:s("rounded-[16px] border px-3 py-3",t?"border-[#e2d9cc] bg-white":"border-white/10 bg-white/[0.02]"),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:s("text-[12px] font-semibold",t?"text-[#171410]":"text-white"),children:b.title}),(0,d.jsx)("p",{className:s("mt-1 text-[11px] leading-5",t?"text-[#7b7269]":"text-slate-400"),children:b.description})]}),(0,d.jsx)(gk,{surfaceTheme:a,tone:b.enabled?"success":"muted",label:b.enabled?"Included":"Skipped"})]}),b.resources.length>0?(0,d.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:b.resources.map(b=>(0,d.jsx)(go,{surfaceTheme:a,label:b.label,tone:w.has(b.relativePath)?"success":"default",interactive:!!(y&&j),onClick:y&&j?()=>j(b.relativePath):void 0},b.relativePath))}):(0,d.jsx)("p",{className:s("mt-2 text-[11px] leading-5",t?"text-[#7a7168]":"text-slate-400"),children:"Disabled by the current workspace rules."})]},b.id))}),e.kickoffMission?(0,d.jsx)(go,{surfaceTheme:a,label:"Kickoff mission",tone:"accent"}):null,y&&j?(0,d.jsx)("p",{className:s("mt-2 text-[11px] leading-5",t?"text-[#7a7168]":"text-slate-400"),children:"Click a file chip to edit its scaffold or override."}):null]}),(0,d.jsxs)("p",{className:s("text-[13px] leading-6",t?"text-[#70685f]":"text-slate-300"),children:["fastest"===f?"Core files only.":"custom"===f?"Only the extras you kept.":"Starter docs, memory, kickoff."," Switch to Advanced later if you need more control."]})]})}function gm({surfaceTheme:a,mode:b,preset:c,onPresetChange:e,onOpenBlueprintEditor:f}){let g="light"===a;return(0,d.jsxs)("div",{className:s("rounded-xl border p-3",g?"border-[#e5ddd2] bg-white":"border-white/10 bg-white/[0.04]"),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:s("text-[10px] uppercase tracking-[0.18em]",g?"text-[#a0978b]":"text-slate-500"),children:"Setup speed"}),(0,d.jsx)("p",{className:s("mt-1 text-[11px] leading-5",g?"text-[#70685f]":"text-slate-300"),children:"basic"===b?"Choose how much scaffold the fast path should write.":"These presets also update the bootstrap rules."})]}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:["custom"===c?(0,d.jsx)(gk,{surfaceTheme:a,tone:"muted",label:"Custom"}):null,f?(0,d.jsxs)(x,{type:"button",variant:"secondary",size:"sm",onClick:()=>f("workspace.ruleGenerateStarterDocs"),className:g?"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,d.jsx)(bV.A,{className:"mr-2 h-3.5 w-3.5"}),"Edit"]}):null]})]}),(0,d.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,d.jsx)(gn,{surfaceTheme:a,active:"standard"===c,title:"Standard",description:"Docs, memory, kickoff",onClick:()=>e("standard")}),(0,d.jsx)(gn,{surfaceTheme:a,active:"fastest"===c,title:"Fastest setup",description:"Core files only",onClick:()=>e("fastest")})]})]})}function gn({surfaceTheme:a,active:b,title:c,description:e,onClick:f}){let g="light"===a;return(0,d.jsx)("button",{type:"button",onClick:f,className:s("w-full rounded-[14px] border px-3 py-2 text-left transition-colors",b?g?"border-[#1f1b17] bg-[#1f1b17] text-white":"border-cyan-300 bg-cyan-300/15 text-cyan-50":g?"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,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,d.jsx)(e9.A,{className:"h-3.5 w-3.5 shrink-0"}),(0,d.jsx)("p",{className:"truncate text-[12px] font-medium",children:c})]}),(0,d.jsx)("p",{className:s("truncate text-right text-[11px] leading-4",b?"opacity-80":g?"text-[#776f65]":"text-slate-400"),children:e})]})})}function go({surfaceTheme:a,label:b,tone:c="default",interactive:e=!1,onClick:f}){let g=s("inline-flex items-center rounded-full border px-2.5 py-1 font-mono text-[10px] transition-colors","accent"===c?"light"===a?"border-[#d8b184] bg-[#f8efe3] text-[#7c5a34]":"border-cyan-300/30 bg-cyan-300/10 text-cyan-100":"success"===c?"light"===a?"border-emerald-300 bg-emerald-50 text-emerald-900":"border-emerald-300/30 bg-emerald-300/12 text-emerald-100":"light"===a?"border-[#e4ddd3] bg-white text-[#6c645b]":"border-white/10 bg-white/[0.05] text-slate-300",e?"success"===c?"light"===a?"cursor-pointer hover:border-emerald-400 hover:bg-emerald-100":"cursor-pointer hover:border-emerald-300/45 hover:bg-emerald-300/16":"light"===a?"cursor-pointer hover:border-[#d8c8ba] hover:bg-[#f6efe6]":"cursor-pointer hover:border-white/15 hover:bg-white/[0.08]":"");return e?(0,d.jsxs)("button",{type:"button",onClick:f,"aria-label":`Edit ${b}`,className:g,children:[(0,d.jsx)(bV.A,{className:"mr-1 h-3 w-3"}),b]}):(0,d.jsxs)("span",{className:g,children:[(0,d.jsx)(n.A,{className:"mr-1 h-3 w-3"}),b]})}function gp({surfaceTheme:a,title:b,tone:c,items:e}){let f="light"===a;return(0,d.jsxs)("div",{className:s("mt-3 rounded-[18px] border px-4 py-3","danger"===c?f?"border-rose-200 bg-rose-50":"border-rose-400/25 bg-rose-400/10":f?"border-amber-200 bg-amber-50":"border-amber-400/25 bg-amber-400/10"),children:[(0,d.jsx)("p",{className:s("text-[11px] uppercase tracking-[0.18em]",f?"text-[#9f958a]":"text-slate-500"),children:b}),(0,d.jsx)("div",{className:"mt-2 space-y-2",children:e.map(a=>(0,d.jsxs)("div",{className:s("flex items-start gap-2 text-[13px] leading-6",f?"text-[#403934]":"text-slate-200"),children:[(0,d.jsx)(o.A,{className:"mt-1 h-3.5 w-3.5 shrink-0"}),(0,d.jsx)("span",{children:a})]},a))})]})}function gq({surfaceTheme:a,mode:b,onModeChange:c,onNewDraft:e,badges:f,title:g="Create workspace",showModeToggle:h=!0,showNewDraft:i=!0}){let j="light"===a;return(0,d.jsx)("div",{className:s("relative z-[1] border-b px-4 py-2 md:px-5",j?"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,d.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,d.jsx)("div",{className:"min-w-0",children:(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2.5",children:[(0,d.jsx)("span",{className:s("inline-flex size-8 shrink-0 items-center justify-center rounded-full border shadow-[0_8px_20px_rgba(56,47,38,0.08)]",j?"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,d.jsx)(a7.A,{className:"h-3.5 w-3.5"})}),(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,d.jsx)("p",{className:s("text-[10px] uppercase tracking-[0.22em]",j?"text-[#7f6554]":"text-slate-500"),children:"Architect"}),(0,d.jsx)("span",{className:s("text-[10px] uppercase tracking-[0.18em]",j?"text-[#a59a8e]":"text-slate-600"),children:"/"}),(0,d.jsx)("h2",{className:s("truncate text-[16px] font-semibold tracking-[-0.02em]",j?"text-[#2d2118]":"text-white"),children:g})]})]})}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2 md:flex-nowrap md:justify-end",children:[f.length>0?(0,d.jsx)("div",{className:"flex flex-wrap items-center gap-1.5 md:flex-nowrap",children:f.map(a=>(0,d.jsx)("span",{className:s("inline-flex items-center rounded-full border px-2.5 py-0.5 text-[9px] font-medium uppercase tracking-[0.16em]","success"===a.tone&&"border-emerald-200 bg-emerald-50 text-emerald-700","warning"===a.tone&&"border-amber-200 bg-amber-50 text-amber-700","danger"===a.tone&&"border-rose-200 bg-rose-50 text-rose-700",(!a.tone||"muted"===a.tone)&&(j?"border-[#e4ddd3] bg-white text-[#5f5348]":"border-white/10 bg-white/[0.05] text-slate-300")),children:a.label},a.id))}):null,h?(0,d.jsxs)("div",{className:s("inline-flex rounded-full border p-0.5",j?"border-[#e4ddd3] bg-[#f4efe7]":"border-white/10 bg-white/[0.04]"),children:[(0,d.jsx)(gr,{surfaceTheme:a,active:"basic"===b,label:"Basic",onClick:()=>c("basic")}),(0,d.jsx)(gr,{surfaceTheme:a,active:"advanced"===b,label:"Advanced",onClick:()=>c("advanced")})]}):null,i&&e?(0,d.jsxs)("button",{type:"button",onClick:e,className:s("inline-flex h-8 items-center gap-2 rounded-full border px-2.5 text-[11px] transition-colors",j?"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,d.jsx)(ax.A,{className:"h-3.5 w-3.5"}),"New draft"]}):null]})]})})}function gr({surfaceTheme:a,active:b,label:c,onClick:e}){let f="light"===a;return(0,d.jsx)("button",{type:"button",onClick:e,className:s("inline-flex min-w-[78px] items-center justify-center rounded-full px-2.5 py-1 text-[11px] transition-colors",b?f?"bg-white text-[#151310] shadow-sm":"bg-[#0f1726] text-white shadow-[0_8px_18px_rgba(0,0,0,0.28)]":f?"text-[#6d584a] hover:text-[#2d2824]":"text-slate-400 hover:text-slate-100"),children:c})}var gs=c(45817);function gt({surfaceTheme:a,value:b,placeholder:c,onChange:e,onSubmit:f,disabled:i=!1,isBusy:j=!1,helperText:k,toolbar:l,className:m}){let n=(0,g.useRef)(null),o=!!b.trim()&&!i,p=async a=>{a.preventDefault(),o&&await f()},q=async a=>{"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),o&&await f())},r="light"===a;return(0,d.jsxs)("form",{onSubmit:p,className:s("rounded-[20px] border p-2.5 transition-all duration-200 focus-within:shadow-[0_0_0_1px_rgba(0,0,0,0.02)]",r?"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",m),children:[(0,d.jsx)("textarea",{ref:n,value:b,onChange:a=>e(a.target.value),onKeyDown:q,placeholder:c,className:s("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",r?"text-[#191714] placeholder:text-[#9b948c]":"text-slate-100 placeholder:text-slate-500")}),(0,d.jsxs)("div",{className:"mt-2 flex flex-wrap items-center justify-between gap-2",children:[(0,d.jsxs)("div",{className:"flex min-h-8 items-center gap-2",children:[l,k?(0,d.jsx)("p",{className:s("text-[11px]",r?"text-[#8b837a]":"text-slate-400"),children:k}):null]}),(0,d.jsx)("button",{type:"submit",disabled:!o,className:s("inline-flex size-8 items-center justify-center rounded-full transition-colors disabled:cursor-not-allowed",r?"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:j?(0,d.jsx)(h.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(gs.A,{className:"h-3.5 w-3.5"})})]})]})}function gu({surfaceTheme:a,messages:b,architectMessageId:c=null,architectPlan:e=null,isTyping:f=!1,typingLabel:h="Typing…",emptyState:i,auxiliary:j,className:k}){let l=(0,g.useRef)(null),m=(0,g.useRef)(null);return(0,d.jsx)(fc,{className:s("h-full",k),children:(0,d.jsxs)("div",{ref:m,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:[i,j,b.map(b=>(0,d.jsx)(gv,{message:b,surfaceTheme:a,architectMessageId:c,architectPlan:e},b.id)),f?(0,d.jsx)(gw,{surfaceTheme:a,label:h}):null,(0,d.jsx)("div",{ref:l,className:"h-6 w-full shrink-0"})]})})}function gv({message:a,surfaceTheme:b,architectMessageId:c,architectPlan:e}){let f="light"===b;if("assistant"===a.role&&e&&a.id===c)return(0,d.jsx)("div",{className:"mx-auto w-full max-w-3xl",children:(0,d.jsx)(f1,{surfaceTheme:b,plan:e,variant:"message",summaryText:a.text},`${a.id}:${e.updatedAt}`)});if("system"===a.role)return(0,d.jsxs)("div",{className:s("mx-auto w-full max-w-2xl rounded-2xl border px-4 py-3 text-[13px] leading-6",f?"border-[#e3ddd4] bg-[#f5f0e8] text-[#5b544d]":"border-white/10 bg-white/[0.05] text-slate-300"),children:[(0,d.jsx)("p",{className:s("text-[11px] uppercase tracking-[0.18em]",f?"text-[#8b8074]":"text-slate-500"),children:a.author||"Workspace Wizard"}),(0,d.jsx)("p",{className:"mt-1",children:a.text})]});let g="user"===a.role,h="pending"===a.status;return(0,d.jsxs)("div",{className:s("flex w-full items-start gap-2.5",g?"justify-end":"justify-start"),children:[g?null:(0,d.jsx)("div",{className:s("mt-0.5 inline-flex size-8 shrink-0 items-center justify-center rounded-full border",f?"border-[#e6dfd4] bg-white text-[#5f5a53]":"border-white/10 bg-white/[0.05] text-slate-300"),children:"Architect"===a.author?(0,d.jsx)(a7.A,{className:"h-3.5 w-3.5"}):(0,d.jsx)(a2.A,{className:"h-3.5 w-3.5"})}),(0,d.jsxs)("div",{className:s("max-w-[min(100%,680px)]",g?f?"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",h&&"opacity-75"),children:[!g&&a.author?(0,d.jsx)("p",{className:s("text-[10px] uppercase tracking-[0.2em]",f?"text-[#8f857a]":"text-slate-500"),children:a.author}):null,(0,d.jsx)("p",{className:s("whitespace-pre-wrap text-[14px] leading-7",g&&"leading-6"),children:a.text})]})]})}function gw({surfaceTheme:a,label:b}){let c="light"===a;return(0,d.jsxs)("div",{className:"flex w-full items-start gap-2.5",children:[(0,d.jsx)("div",{className:s("mt-0.5 inline-flex size-8 shrink-0 items-center justify-center rounded-full border",c?"border-[#e6dfd4] bg-white text-[#5f5a53]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,d.jsx)(a7.A,{className:"h-3.5 w-3.5"})}),(0,d.jsxs)("div",{className:"max-w-[min(100%,680px)]",children:[(0,d.jsx)("p",{className:s("text-[10px] uppercase tracking-[0.2em]",c?"text-[#8f857a]":"text-slate-500"),children:"Architect"}),(0,d.jsxs)("div",{className:"mt-1 flex items-center gap-2.5",children:[(0,d.jsxs)("div",{className:s("inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5",c?"border-[#e6dfd5] bg-white text-[#5a534c]":"border-white/10 bg-white/[0.05] text-slate-300"),children:[(0,d.jsx)("span",{className:s("inline-flex size-1.5 animate-pulse rounded-full",c?"bg-[#5a534c]":"bg-slate-300")}),(0,d.jsx)("span",{className:s("inline-flex size-1.5 animate-pulse rounded-full [animation-delay:120ms]",c?"bg-[#5a534c]":"bg-slate-300")}),(0,d.jsx)("span",{className:s("inline-flex size-1.5 animate-pulse rounded-full [animation-delay:240ms]",c?"bg-[#5a534c]":"bg-slate-300")})]}),(0,d.jsx)("p",{className:s("text-[12px] leading-5",c?"text-[#6f685f]":"text-slate-400"),children:b})]})]})]})}let gx={founder:"Founder",product:"Product Lead",architect:"System Architect",ops:"Operations",growth:"Growth",reviewer:"Reviewer"},gy={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 gz(a){return gy[a]??gy.medium}let gA={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 gB(){return globalThis.crypto?.randomUUID?.()??`plan-${Date.now()}`}function gC(a,b,c){return{id:gB(),role:a,author:b,text:c,createdAt:new Date().toISOString()}}function gD(a){return{id:a.id?.trim()||gB(),kind:a.kind,label:a.label.trim(),summary:a.summary.trim(),details:gY(a.details),status:a.status??"ready",createdAt:a.createdAt??new Date().toISOString(),confidence:"number"==typeof a.confidence?Math.max(0,Math.min(100,Math.round(a.confidence))):void 0,url:gX(a.url),error:gX(a.error)}}function gE(a){return{id:a.id?.trim()||gB(),section:a.section,label:a.label.trim(),value:a.value.trim(),confidence:Math.max(0,Math.min(100,Math.round(a.confidence??72))),status:a.status??"inferred",rationale:gW(a.rationale??""),sourceLabels:gY(a.sourceLabels)}}function gF(a){let b=g_(a?.id||a?.name||"operator")||"operator",c=a?.role?.trim()||"Operator",d=a?.name?.trim()||g0(b);return{id:b,role:c,name:d,purpose:a?.purpose?.trim()||`${d} owns ${c.toLowerCase()} execution and handoffs.`,enabled:a?.enabled!==!1,isPrimary:!!a?.isPrimary,emoji:a?.emoji?.trim(),theme:a?.theme?.trim(),skillId:a?.skillId?.trim(),modelId:a?.modelId?.trim(),policy:a?.policy??aP("worker"),heartbeat:a?.heartbeat??{enabled:!1},responsibilities:gY(a?.responsibilities),outputs:gY(a?.outputs),channelIds:gY(a?.channelIds)}}function gG(a){return{id:g_(a?.id||a?.name||`workflow-${Date.now()}`)||`workflow-${Date.now()}`,name:a?.name?.trim()||"New workflow",goal:a?.goal?.trim()||"",trigger:a?.trigger??"manual",ownerAgentId:a?.ownerAgentId?.trim(),collaboratorAgentIds:gY(a?.collaboratorAgentIds),successDefinition:a?.successDefinition?.trim()||"",outputs:gY(a?.outputs),channelIds:gY(a?.channelIds),enabled:a?.enabled!==!1}}function gH(a="internal",b){let c=gA[a];return{id:g_(b?.id||b?.name||`${a}-${Date.now()}`)||`${a}-${Date.now()}`,type:a,name:b?.name?.trim()||c.label,purpose:b?.purpose?.trim()||"",target:b?.target?.trim(),enabled:b?.enabled!==!1,announce:!!b?.announce,requiresCredentials:c.requiresCredentials,accountId:b?.accountId?.trim(),primaryAgentId:b?.primaryAgentId?.trim()??null,allowedChatIds:gY(b?.allowedChatIds),groupAssignments:Array.isArray(b?.groupAssignments)?b.groupAssignments.map(a=>({chatId:"string"==typeof a.chatId?a.chatId.trim():"",agentId:"string"==typeof a.agentId?a.agentId.trim():null,title:"string"==typeof a.title?a.title.trim():null,enabled:!1!==a.enabled})).filter(a=>!!a.chatId):[],credentials:b?.credentials?.map(a=>({...a,value:a.value??""}))??c.credentials.map(a=>({...a,value:""}))}}function gI(a){return{id:g_(a?.id||a?.name||`automation-${Date.now()}`)||`automation-${Date.now()}`,name:a?.name?.trim()||"New automation",description:a?.description?.trim()||"",enabled:a?.enabled!==!1,scheduleKind:a?.scheduleKind??"every",scheduleValue:a?.scheduleValue?.trim()||"24h",agentId:a?.agentId?.trim(),mission:a?.mission?.trim()||"",thinking:a?.thinking??"medium",announce:!!a?.announce,channelId:a?.channelId?.trim()}}function gJ(a,b){return fC(a,"core",b).map(b=>{var c,d,e,f,g,h,i;return gF({id:b.id,role:b.role,name:b.name,purpose:(c=b.id,d=b.role,e=a,/review/i.test(c)||/review/i.test(d)?`Pressure-test ${e} work for correctness, regression risk, and missing validation.`:/test/i.test(c)||/test/i.test(d)?`Validate behavior, environment assumptions, and release confidence for this ${e} workspace.`:/learn/i.test(c)||/learn/i.test(d)?"Keep the workspace memory, conventions, and durable decisions coherent over time.":/browser/i.test(c)||/browser/i.test(d)?"Exercise real UI flows and collect evidence for browser-facing work.":`Own hands-on delivery and keep the ${e} workspace moving.`),enabled:b.enabled,isPrimary:b.isPrimary,emoji:b.emoji,theme:b.theme,skillId:b.skillId,modelId:b.modelId,policy:b.policy??aP("worker"),heartbeat:b.heartbeat??{enabled:!1},responsibilities:(f=b.id,g=a,/review/i.test(f)?["Review active work","Call out regressions","Protect launch quality"]:/test/i.test(f)?["Run verification loops","Capture evidence","Surface failing assumptions"]:/learn/i.test(f)?["Update durable memory","Track decisions","Reduce restart friction"]:/browser/i.test(f)?["Exercise flows","Capture screenshots","Validate responsive states"]:"content"===g?["Drive content production","Coordinate handoffs","Prepare launch artifacts"]:["Implement the next increment","Coordinate specialists","Keep execution momentum"]),outputs:(h=b.id,i=a,/review/i.test(h)?["review notes","risk checklist"]:/test/i.test(h)?["verification report","repro steps"]:/learn/i.test(h)?["memory updates","decision log entries"]:/browser/i.test(h)?["screenshots","browser validation notes"]:"research"===i?["research summary","evidence log"]:["implementation artifacts","handoff summary"])})})}function gK(a,b){let c=b.find(a=>a.enabled&&a.isPrimary)?.id,d=gU(b,"review"),e=gU(b,"test"),f=gU(b,"learn"),g=gU(b,"browser");if("research"===a)return[gG({id:"research-loop",name:"Research loop",goal:"Turn the main question into evidence-backed findings and explicit unknowns.",trigger:"manual",ownerAgentId:c,collaboratorAgentIds:[f,d].filter(Boolean),successDefinition:"Question, evidence, synthesis, and next-step recommendations are documented.",outputs:["docs/research-plan.md","deliverables/<run>/research-summary.md"]}),gG({id:"finding-review",name:"Finding review",goal:"Pressure-test claims before publishing or acting on them.",trigger:"manual",ownerAgentId:d??c,collaboratorAgentIds:[c].filter(Boolean),successDefinition:"Assumptions, risks, and evidence gaps are explicit.",outputs:["deliverables/<run>/review-notes.md"]})];if("content"===a)return[gG({id:"strategy",name:"Strategy and briefing",goal:"Clarify audience, offer, channels, and campaign bets before production.",trigger:"manual",ownerAgentId:c,collaboratorAgentIds:[d,f].filter(Boolean),successDefinition:"The team agrees on brief, priorities, and success signals.",outputs:["docs/content-brief.md","deliverables/<run>/campaign-brief.md"]}),gG({id:"production",name:"Production and QA",goal:"Create assets, review them, and prepare a launch package.",trigger:"manual",ownerAgentId:c,collaboratorAgentIds:[d].filter(Boolean),successDefinition:"Assets are approved and delivery-ready.",outputs:["deliverables/<run>/drafts/","deliverables/<run>/launch-package.md"]}),gG({id:"performance-loop",name:"Performance loop",goal:"Review outcomes, learn from results, and feed the next iteration.",trigger:"cron",ownerAgentId:f??d??c,collaboratorAgentIds:[c].filter(Boolean),successDefinition:"Measured results and next changes are documented.",outputs:["deliverables/<run>/performance-review.md"]})];let h=g&&"frontend"===a?g:c;return[gG({id:"scope-v1",name:"V1 shaping",goal:"Turn the product goal into a constrained first delivery batch.",trigger:"manual",ownerAgentId:c,collaboratorAgentIds:[f,d].filter(Boolean),successDefinition:"Scope, non-goals, and critical path are documented.",outputs:["docs/brief.md","memory/blueprint.md"]}),gG({id:"delivery",name:"Delivery loop",goal:"Implement, validate, and hand off the next meaningful increment.",trigger:"manual",ownerAgentId:h,collaboratorAgentIds:[e,d].filter(Boolean),successDefinition:"A tested increment ships with review notes and clear handoff.",outputs:["deliverables/<run>/release-notes.md","deliverables/<run>/verification.md"]}),gG({id:"launch-readiness",name:"Launch readiness",goal:"Check blockers, rollback posture, and communication before launch.",trigger:"launch",ownerAgentId:d??c,collaboratorAgentIds:[e,f].filter(Boolean),successDefinition:"Launch risks, open blockers, and go/no-go signal are explicit.",outputs:["deliverables/<run>/launch-checklist.md"]})]}function gL(){return[gH("internal",{id:"internal-ops",name:"Internal ops",purpose:"Default internal coordination surface for planner outputs and deploy notes.",announce:!1})]}function gM(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C;let D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X=g$(a),Y=X.intake.sources.some(a=>"workspace-edit-source"===a.id);if(X.runtime=(b=X.id,c=X.runtime,R=c?.architectSessionId?.trim()||`planner-${b}-architect`,S=Object.fromEntries(Object.entries(c?.advisorAgentIds??{}).filter(([,a])=>"string"==typeof a&&a.trim())),T=Object.fromEntries(Object.entries(gx).map(([a])=>[a,c?.advisorSessionIds?.[a]?.trim()||`planner-${b}-${a}`])),{mode:c?.mode==="fallback"?"fallback":"agent",status:c?.status==="error"?"error":c?.status==="ready"?"ready":"pending",workspaceId:gX(c?.workspaceId),workspacePath:gX(c?.workspacePath),architectAgentId:gX(c?.architectAgentId),architectSessionId:R,advisorAgentIds:S,advisorSessionIds:T,lastArchitectRunId:gX(c?.lastArchitectRunId),lastAdvisorRunIds:gY(c?.lastAdvisorRunIds),lastError:gX(c?.lastError)}),X.intake=(d={...X.intake,started:!!X.intake?.started||X.conversation.some(a=>"user"===a.role)},{started:!!d?.started,initialPrompt:gW(d?.initialPrompt??""),latestPrompt:gW(d?.latestPrompt??""),sources:(d?.sources??[]).map(a=>gD(a)),confirmations:gY(d?.confirmations).map(a=>a.trim()).filter(Boolean).slice(0,3),mode:d?.mode==="advanced"?"advanced":"guided",size:d?.size==="small"||d?.size==="large"?d.size:"medium",reviewRequested:!!d?.reviewRequested,turnCount:Math.max(0,Math.floor(d?.turnCount??0)),inferences:(d?.inferences??[]).map(a=>gE(a)),suggestedReplies:gY(d?.suggestedReplies).slice(0,4)}),X.company.name=gW(X.company.name),X.company.mission=gW(X.company.mission),X.company.targetCustomer=gW(X.company.targetCustomer),X.company.constraints=gY(X.company.constraints),X.company.successSignals=gY(X.company.successSignals),X.product.offer=gW(X.product.offer),X.product.scopeV1=gY(X.product.scopeV1),X.product.nonGoals=gY(X.product.nonGoals),X.product.revenueModel=gW(X.product.revenueModel),X.product.launchPriority=gY(X.product.launchPriority),X.workspace.name=gW(X.workspace.name),X.workspace.directory=gX(X.workspace.directory),X.workspace.repoUrl=gX(X.workspace.repoUrl),X.workspace.existingPath=gX(X.workspace.existingPath),X.workspace.stackDecisions=gY(X.workspace.stackDecisions),X.workspace.docs=gZ(gY(X.workspace.docs).concat((g=X.workspace.template,fr(g,X.workspace.rules).map(a=>a.path)))),X.workspace.docOverrides=fq(X.workspace.docOverrides),X.team.persistentAgents=X.team.persistentAgents.map(a=>gF({...a,id:a.id,role:a.role,name:a.name,purpose:a.purpose,enabled:a.enabled,isPrimary:a.isPrimary,emoji:a.emoji,theme:a.theme,skillId:a.skillId,modelId:a.modelId,policy:a.policy,heartbeat:a.heartbeat,responsibilities:a.responsibilities,outputs:a.outputs})).filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b),Y){if(!X.team.persistentAgents.some(a=>a.enabled&&a.isPrimary)){let a=X.team.persistentAgents.find(a=>a.enabled);a&&(a.isPrimary=!0)}}else{let a,b;if(0===X.team.persistentAgents.length&&(X.team.persistentAgents=gJ(X.workspace.template,X.workspace.name)),!X.team.persistentAgents.some(a=>a.enabled&&a.isPrimary)){let a=X.team.persistentAgents.find(a=>a.enabled);a&&(a.isPrimary=!0)}let c=X.team.persistentAgents.find(a=>a.enabled&&a.isPrimary);c&&X.workspace.name&&(h=c.name,i=c.role,a=h.trim().toLowerCase(),b=i.trim().toLowerCase(),!a||"default agent"===a||a===b||"primary agent"===a||"workspace agent"===a)&&(c.name=fD(X.workspace.name,c.role,c.name))}X.operations.channels=X.operations.channels.map(a=>gH(a.type,a)).filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b),Y||0!==X.operations.channels.length||(X.operations.channels=gL()),X.operations.workflows=X.operations.workflows.map(a=>gG(a)).filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b),Y||0!==X.operations.workflows.length||(X.operations.workflows=gK(X.workspace.template,X.team.persistentAgents)),X.operations.automations=X.operations.automations.map(a=>gI(a)).filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b),Y||(V=gz((U=g$(X)).intake.size),U.team.persistentAgents=function(a,b,c){var d;let e,f;if(c<=0)return[];return gV((f=(d=[...b,...gJ(a),...(e=gF({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"===a?[gF({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"]}),e]:[e])]).find(a=>a.isPrimary)??d[0])?[f,...d.filter(a=>a.id!==f.id)]:d).slice(0,c).map((a,b)=>gF({...a,enabled:!0,isPrimary:a.isPrimary||0===b}))}(U.workspace.template,U.team.persistentAgents,V.agentCount),U.operations.channels=function(a,b,c){let d=b.find(a=>"internal"===a.type)??gL()[0],e=[...b.filter(a=>"internal"!==a.type),...("content"===a?["telegram","discord","slack"]:["slack","discord","telegram"]).map(b=>gH(b,{id:`${b}-ops`,purpose:"content"===a?"Optional distribution or community surface for a larger operating setup.":"Optional external operating surface for a larger workspace.",enabled:!1,announce:!0}))].filter((a,b,c)=>c.findIndex(b=>b.type===a.type)===b);return[gH("internal",{...d,enabled:!0}),...e.slice(0,c)]}(U.workspace.template,U.operations.channels,V.externalChannelCount),U.operations.workflows=function(a,b,c,d){let e,f,g,h;return d<=0?[]:gV([...b,...gK(a,c),...(e=c.find(a=>a.enabled&&a.isPrimary)?.id,f=gU(c,"review"),g=gU(c,"learn"),h=gU(c,"ops"),[gG({id:"context-sync",name:"research"===a?"Evidence sync":"Context sync",goal:"Pull new context from linked sources and keep the blueprint aligned with reality.",trigger:"manual",ownerAgentId:g??e,collaboratorAgentIds:[e,f].filter(Boolean),successDefinition:"New context is reflected in durable docs, scope, and decision notes.",outputs:["memory/blueprint.md","deliverables/<run>/context-sync.md"]}),gG({id:"ops-rhythm",name:"Operating rhythm",goal:"Review handoffs, automations, and next-step ownership on a repeatable cadence.",trigger:"cron",ownerAgentId:h??f??g??e,collaboratorAgentIds:[e].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,d).map(a=>{var b,d;let e,f,g,h,i;return b=a,e=new Set((d=c).filter(a=>a.enabled).map(a=>a.id)),f=d.find(a=>a.enabled&&a.isPrimary)?.id,g=gU(d,"review"),h=gU(d,"learn"),i=b.ownerAgentId&&e.has(b.ownerAgentId)?b.ownerAgentId:g??h??f,gG({...b,ownerAgentId:i,collaboratorAgentIds:b.collaboratorAgentIds.filter(a=>e.has(a)&&a!==i),enabled:!0})})}(U.workspace.template,U.operations.workflows,U.team.persistentAgents,V.workflowCount),U.operations.automations=function(a,b,c,d,e){let f,g,h;return e<=0?[]:gV([...b,...(f=gU(c,"review")??c.find(a=>a.enabled)?.id,g=gU(c,"learn")??f,[gI({id:"daily-triage",name:"Daily triage",description:"Review drift, blockers, and next handoffs every day.",scheduleKind:"every",scheduleValue:"24h",agentId:f,mission:"content"===a?"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:h=d[0]?.id}),gI({id:"weekly-review",name:"Weekly review",description:"Capture progress, decisions, and next bets once per week.",scheduleKind:"every",scheduleValue:"168h",agentId:g,mission:"research"===a?"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:h})].filter(a=>a.agentId))]).slice(0,e).map(a=>{var b,e,f;let g,h,i,j,k;return b=a,e=c,f=d,g=new Set(e.filter(a=>a.enabled).map(a=>a.id)),h=new Set(f.map(a=>a.id)),i=e.find(a=>a.enabled&&a.isPrimary)?.id,j=gU(e,"review"),k=gU(e,"learn"),gI({...b,agentId:b.agentId&&g.has(b.agentId)?b.agentId:j??k??i,channelId:b.channelId&&h.has(b.channelId)?b.channelId:f[0]?.id,enabled:!0})})}(U.workspace.template,U.operations.automations,U.team.persistentAgents,U.operations.channels,V.automationCount),X=U),X.operations.hooks=X.operations.hooks.map(a=>({id:g_(a?.id||a?.name||`hook-${Date.now()}`)||`hook-${Date.now()}`,name:a?.name?.trim()||"New hook",source:a?.source?.trim()||"",enabled:a?.enabled!==!1,notes:a?.notes?.trim()||""})).filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b),X.operations.sandbox=(e=X.operations.sandbox,{workspaceOnly:e?.workspaceOnly??!0,mode:e?.mode??"default",notes:gY(e?.notes)}),Y||(X.deploy.firstMissions=(W=(f=X).team.persistentAgents.find(a=>a.enabled&&a.isPrimary),gZ([W?"Inspect the new workspace, refine docs to match the blueprint, and break the first delivery batch into concrete tasks.":"",f.team.persistentAgents.find(a=>/review/i.test(a.role)&&a.enabled)?"Review the blueprint against the created workspace, call out execution risks, and leave a launch-readiness checklist.":"",f.team.persistentAgents.find(a=>/learn/i.test(a.role)&&a.enabled)?"Capture durable facts, decisions, and conventions in memory files so the team can continue without drift.":""].filter(Boolean))));let Z=gS(X.company.name),$=gS(X.workspace.name);if((!X.company.name||Z)&&X.workspace.name&&!$&&(X.company.name=X.workspace.name),(!X.workspace.name||$)&&X.company.name&&!Z&&(X.workspace.name=X.company.name),!X.intake.started)return X.deploy.blockers=[],X.deploy.warnings=[],X.intake.confirmations=[],X.intake.inferences=[],X.intake.suggestedReplies=[],X.readinessScore=0,X.architectSummary="Start with one prompt. Paste the project goal, website URL, repo, or existing folder and the architect will draft the workspace for you.",X.stage="intake",X.status="draft",X.updatedAt=new Date().toISOString(),X;let _=function(a){let b=[],c=gz(a.intake.size);for(let c of a.intake.sources.filter(a=>"error"===a.status))b.push("tr"===gO(a)?`${c.label} kaynağını inceleyemedim. Bu kaynak \xf6nemliyse şirket bağlamını manuel olarak doğrula.`:`I could not inspect ${c.label}. Confirm the company context manually if this source matters.`);return gZ(b).slice(0,c.confirmationLimit)}(X),aa=function(a){let b=[];for(let c of(a.company.name||b.push("Company or workspace name is missing."),a.company.mission||b.push("Mission is missing."),a.company.targetCustomer||b.push("Target customer is missing."),a.workspace.name||b.push("Workspace name is missing."),"clone"!==a.workspace.sourceMode||a.workspace.repoUrl||b.push("Clone mode needs a repository URL."),"existing"!==a.workspace.sourceMode||a.workspace.existingPath||b.push("Existing-folder mode needs a folder path."),a.team.persistentAgents.some(a=>a.enabled)||b.push("At least one persistent agent must be enabled."),a.team.persistentAgents.some(a=>a.enabled&&a.isPrimary)||b.push("One enabled agent must be marked as primary."),a.operations.workflows.some(a=>a.enabled)||b.push("At least one enabled workflow is required."),a.operations.workflows.filter(a=>a.enabled)))c.name&&c.goal&&c.successDefinition||b.push(`Workflow "${c.name||c.id}" is incomplete.`),c.ownerAgentId&&!a.team.persistentAgents.some(a=>a.id===c.ownerAgentId&&a.enabled)&&b.push(`Workflow "${c.name}" points to a missing or disabled owner agent.`);for(let c of a.operations.automations.filter(a=>a.enabled))c.mission&&c.scheduleValue||b.push(`Automation "${c.name}" is incomplete.`),c.agentId&&!a.team.persistentAgents.some(a=>a.id===c.agentId&&a.enabled)&&b.push(`Automation "${c.name}" points to a missing or disabled agent.`);for(let c of a.operations.channels.filter(a=>a.enabled&&a.requiresCredentials))c.credentials.filter(a=>!a.value.trim()).length>0&&b.push(`Channel "${c.name}" is missing required credentials.`);return gZ(b)}(X),ab=(D=[],E=gz((j=X).intake.size),0===j.product.nonGoals.length&&D.push("No non-goals are defined for V1."),0===j.product.launchPriority.length&&D.push("Launch priorities are not ordered yet."),0===j.company.successSignals.length&&D.push("Success signals are still empty."),0===j.workspace.stackDecisions.length&&"content"!==j.workspace.template&&D.push("Critical stack decisions are not captured yet."),E.automationCount>0&&!j.operations.automations.some(a=>a.enabled)&&D.push("No automation loops are enabled."),E.externalChannelCount>0&&!j.operations.channels.some(a=>"internal"!==a.type)&&D.push("Only internal channels are configured."),E.agentCount>=3&&j.team.maxParallelRuns<2&&D.push("Parallel run limit is conservative for a multi-agent workspace."),gZ(D)),ac=(k=X).intake.reviewRequested||"deploying"===k.status||"deployed"===k.status;return X.intake.confirmations=_,X.intake.inferences=(F=[],G=(l=X).intake.sources.filter(a=>"ready"===a.status).map(a=>a.label),H=l.intake.confirmations.join(" ").toLowerCase(),l.company.name&&F.push(gE({section:"company",label:"Company",value:l.company.name,confidence:gQ(l,"company-name"),status:gR(H,"company"),rationale:G.length>0?"Derived from linked context and the current brief.":"Derived from the current brief.",sourceLabels:G})),l.company.mission&&F.push(gE({section:"company",label:"Mission",value:l.company.mission,confidence:gQ(l,"mission"),status:gR(H,"outcome"),rationale:"Architect condensed the first business outcome from the request.",sourceLabels:G})),l.company.targetCustomer&&F.push(gE({section:"company",label:"First audience",value:l.company.targetCustomer,confidence:gQ(l,"target-customer"),status:gR(H,"audience"),rationale:"This is the current best guess for the first user or buyer segment.",sourceLabels:G})),F.push(gE({section:"workspace",label:"Workspace type",value:g0(l.workspace.template),confidence:gQ(l,"template"),status:"inferred",rationale:"Template is inferred from the requested operating model and linked context.",sourceLabels:G})),F.push(gE({section:"workspace",label:"Starting point",value:"clone"===l.workspace.sourceMode?l.workspace.repoUrl||"Clone an existing repository":"existing"===l.workspace.sourceMode?l.workspace.existingPath||"Attach an existing folder":"Start from scratch",confidence:gQ(l,"source-mode"),status:gR(H,"start"),rationale:"This is how the workspace will be materialized when you deploy.",sourceLabels:G})),l.product.offer&&F.push(gE({section:"product",label:"Offer",value:l.product.offer,confidence:gQ(l,"offer"),status:"inferred",rationale:"Architect turned the brief into a concrete operator-facing offer.",sourceLabels:G})),(I=l.operations.channels.filter(a=>a.enabled&&"internal"!==a.type)).length>0&&F.push(gE({section:"operations",label:"External channels",value:I.map(a=>a.name).join(", "),confidence:gQ(l,"channels"),status:"inferred",rationale:"The request implies these operating channels should exist after deploy.",sourceLabels:G})),(J=l.team.persistentAgents.find(a=>a.enabled&&a.isPrimary))&&F.push(gE({section:"team",label:"Primary operator",value:`${J.name} (${J.role})`,confidence:gQ(l,"team"),status:"inferred",rationale:"Architect drafted a primary agent to own the first delivery loop.",sourceLabels:G})),(K=l.operations.workflows.find(a=>a.enabled))&&F.push(gE({section:"operations",label:"First workflow",value:K.name,confidence:gQ(l,"workflow"),status:"inferred",rationale:"This is the first operational loop the company would run after deploy.",sourceLabels:G})),F.slice(0,8)),X.intake.suggestedReplies=(m=X,n=_,L=gO(m),M=[],N=gz(m.intake.size),O=function(a){let b=a.intake.sources.filter(a=>"ready"===a.status).flatMap(a=>[a.label,a.summary,...a.details]).join(" ").toLowerCase();if(!b)return;let c=/\bweb3|onchain|crypto|blockchain|token\b/.test(b),d=/\bstartup|startups|founder|founders|business(?:es)?\b/.test(b),e=/\bcommunity|communities|member|members|holder|holders|nft|dao|governance\b/.test(b),f=/\bdeveloper|developers|builder|builders|engineer|engineers\b/.test(b),g=/\boperator|operators|moderator|moderators|admin|admins|ops\b/.test(b);return d&&e?c?"Web3 startups and token-led communities":"startups and their communities":d?c?"Web3 startups and founders":"startups and founders":e?c?"DAO, NFT, and Web3 communities":"community leads and members":f&&g?"developers and internal operators":f?"developers and technical teams":g?"internal operators and moderators":void 0}(m),P=gN(m),m.company.targetCustomer||(O&&M.push("tr"===L?`İlk hedef kitle ${gT(O)} gibi g\xf6r\xfcn\xfcyor.`:`The first audience looks like ${gT(O)}.`),"content"===m.workspace.template?(M.push("tr"===L?"İlk kullanıcılar topluluk y\xf6neticileri ve moderat\xf6rler.":"The first users are community managers and moderators."),M.push("tr"===L?"İ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.")):M.push("tr"===L?"İ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.")),m.company.mission||M.push("tr"===L?"İlk hedef, hacmi en y\xfcksek manuel iş akışını otomatikleştirmek.":"The first outcome is automating the highest-volume manual workflow."),!m.product.scopeV1.length&&m.company.mission&&m.company.targetCustomer&&M.push("tr"===L?"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."),m.workspace.repoUrl||m.workspace.existingPath||gP(m.intake.latestPrompt||m.intake.initialPrompt)||(M.push("tr"===L?"Ş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."),M.push("tr"===L?"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===m.company.successSignals.length&&m.intake.turnCount>=2&&M.push("tr"===L?"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!==n.length||P||(M.push("tr"===L?"İstersen bu taslağı şimdi daha keskin hale getirebiliriz.":"If you want, we can tighten this draft right now."),M.push("tr"===L?"Gelişmiş edit\xf6r\xfc a\xe7.":"Open the advanced editor.")),gZ(M).slice(0,N.suggestedReplyLimit)),X.deploy.blockers=ac?aa:[],X.deploy.warnings=ac?ab:[],X.readinessScore=(o=X,p=aa,q=ab,r=ac,Q=14,o.company.name&&(Q+=10),o.company.mission&&(Q+=15),o.company.targetCustomer&&(Q+=15),o.product.offer&&(Q+=10),o.product.scopeV1.length>0&&(Q+=10),o.workspace.name&&(Q+=10),o.intake.sources.length>0&&(Q+=6),o.team.persistentAgents.some(a=>a.enabled&&a.isPrimary)&&(Q+=10),o.operations.workflows.some(a=>a.enabled)&&(Q+=10),o.operations.automations.some(a=>a.enabled)&&(Q+=5),r?(Q-=12*p.length,Q-=3*q.length):Q-=4*Math.max(0,o.intake.confirmations.length-1),Math.max(0,Math.min(100,Q))),X.architectSummary=function(a,b,c,d){let e=gO(a),f=gN(a),g=a.intake.sources.find(a=>"website"===a.kind&&"ready"===a.status&&"number"==typeof a.confidence&&a.confidence<80&&!!a.label),h=a.team.persistentAgents.filter(a=>a.enabled).length,i=a.operations.workflows.filter(a=>a.enabled).length,j=a.operations.automations.filter(a=>a.enabled).length,k=a.intake.confirmations.length;if(!a.intake.started)return"tr"===e?"Tek mesajla başla.":"Start with one prompt.";if(!d&&f){let b=a.company.mission||a.product.offer||a.company.name||a.workspace.name,c="clone"===a.workspace.sourceMode?"tr"===e?"klon repo":"a cloned repo":"existing"===a.workspace.sourceMode?"tr"===e?"mevcut klas\xf6r":"an existing folder":"tr"===e?"sıfırdan":"scratch",d=!g||a.company.name||a.workspace.name?"":"tr"===e?`Site adı i\xe7in ${g.label} varsayımını kullandım.`:`I used ${g.label} as the site name.`;return"tr"===e?[d,b?`İlk taslak ${b} etrafında hazır.`:`İlk taslak ${c} başlangıcıyla hazır.`].filter(Boolean).join(" "):[d,b?`First pass ready around ${b}.`:`First pass ready from ${c}.`].filter(Boolean).join(" ")}return d?"tr"===e?[a.company.mission?`Odak: ${a.company.mission}.`:"Misyon kısa bir c\xfcmle istiyor.",a.company.targetCustomer?`Kitle: ${a.company.targetCustomer}.`:"Kitle a\xe7ık.",`${h} agent, ${i} g\xf6rev, ${j} automation.`,k>0?`${k} revizyon kaldı.`:b.length>0?`${b.length} blocker kaldı.`:c.length>0?`${c.length} warning var.`:"Deploy'a hazır."].join(" "):[a.company.mission?`Focus: ${a.company.mission}.`:"Mission still needs a short sentence.",a.company.targetCustomer?`Audience: ${a.company.targetCustomer}.`:"Audience open.",`${h} agents, ${i} workflows, ${j} automations.`,k>0?`${k} revision${1===k?"":"s"} left.`:b.length>0?`${b.length} blocker${1===b.length?"":"s"} remain.`:c.length>0?`${c.length} warning${1===c.length?"":"s"} remain.`:"Ready to deploy."].join(" "):"tr"===e?[a.company.mission?`Odak: ${a.company.mission}.`:a.company.name||a.workspace.name?`İlk \xe7ıktı: ${a.company.name||a.workspace.name}.`:"İlk \xe7ıktı netleşiyor.",a.company.targetCustomer?`Kitle: ${a.company.targetCustomer}.`:"Kitle a\xe7ık.",a.intake.sources.length>0?`${a.intake.sources.length} kaynak topladım.`:"URL, repo ya da kısa brief yeterli.",`${h} agent, ${i} g\xf6rev, ${j} automation.`,k>0?`${k} revizyon kaldı.`:"Revizyona hazır."].join(" "):[a.company.mission?`Focus: ${a.company.mission}.`:`First outcome: ${a.company.name||a.workspace.name||"this workspace"}.`,a.company.targetCustomer?`Audience: ${a.company.targetCustomer}.`:"Audience open.",a.intake.sources.length>0?`I have ${a.intake.sources.length} source${1===a.intake.sources.length?"":"s"}.`:"Add a URL, repo, or short brief.",`${h} agents, ${i} workflows, ${j} automations.`,k>0?`${k} revision${1===k?"":"s"} left.`:"Ready to revise."].join(" ")}(X,aa,ab,ac),X.stage=(s=X,t=aa,u=ab,v=_,w=ac,s.intake.started?!w&&gN(s)?s.intake.sources.length>0?"context-harvest":"intake":"deploying"===s.status?"deploying":"deployed"===s.status?"deployed":(x=s).company.mission||x.product.offer||x.workspace.name||x.intake.sources.length>0?((y=s).company.name||y.workspace.name)&&y.company.mission&&y.team.persistentAgents.some(a=>a.enabled)&&y.operations.workflows.some(a=>a.enabled)?w?t.length>0?"pressure-test":u.length>0||s.readinessScore<90?"decision-lock":"ready":v.length>0?"team-synthesis":"decision-lock":"team-synthesis":s.intake.turnCount>1?"context-harvest":"intake":"intake"),X.status=(z=X,A=aa,B=_,C=ac,z.intake.started?"deploying"===z.status||"deployed"===z.status?z.status:C?"blocked"===z.status&&A.length>0||A.length>0?"blocked":z.readinessScore>=90?"ready":"review":gN(z)||B.length>0?"draft":"review":"draft"),X.updatedAt=new Date().toISOString(),X}function gN(a){return a.intake.turnCount<=1&&!a.intake.reviewRequested}function gO(a,b){for(let d of[b,...a.conversation.slice().reverse().filter(a=>"user"===a.role).map(a=>a.text),a.intake.latestPrompt,a.intake.initialPrompt]){var c;let a=!function(a){let b=a?.trim();if(!b)return!1;if(/[çğıöşüÇĞİÖŞÜ]/.test(b))return!0;let c=b.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!!(c&&c.length>=2)}(c=d)?!function(a){let b=a?.trim();if(!b||/[çğıöşüÇĞİÖŞÜ]/.test(b))return!1;let c=b.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!!(c&&c.length>=2)}(c)?null:"en":"tr";if(a)return a}return"en"}function gP(a){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(a)}function gQ(a,b){let c=`${a.intake.initialPrompt} ${a.intake.latestPrompt}`.toLowerCase(),d=a.intake.sources.filter(a=>"ready"===a.status),e=66;return d.length>0&&(e+=8),a.intake.turnCount>1&&(e+=6),("template"===b&&/\b(telegram|discord|community|topluluk|grup|content|marketing|research|frontend|backend)\b/.test(c)||"source-mode"===b&&gP(c)||"channels"===b&&/\b(slack|telegram|discord|google chat)\b/.test(c))&&(e+=10),"company-name"===b&&d.some(a=>"website"===a.kind)&&(e+=6),"target-customer"!==b||a.company.targetCustomer||(e-=18),("workflow"===b||"team"===b)&&(e-=4),Math.max(52,Math.min(96,e))}function gR(a,b){return a.includes(b)?"needs-confirmation":"inferred"}function gS(a){let b=a.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(b)}function gT(a){return a?a.charAt(0).toLowerCase()+a.slice(1):a}function gU(a,b){return a.find(a=>RegExp(b,"i").test(`${a.id} ${a.role} ${a.name}`))?.id}function gV(a){return a.filter((a,b,c)=>c.findIndex(b=>b.id===a.id)===b)}function gW(a){return a.trim()}function gX(a){return a?.trim()||void 0}function gY(a){return gZ((a??[]).flatMap(a=>a.split(/\r?\n|,/g).map(a=>a.trim()).filter(Boolean)).map(a=>a.trim()).filter(Boolean))}function gZ(a){return Array.from(new Set(a.filter(Boolean)))}function g$(a){return structuredClone(a)}function g_(a){return a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function g0(a){return a.split(/[-_]/g).filter(Boolean).map(a=>a[0].toUpperCase()+a.slice(1)).join(" ")}function g1(a){let b="clone"===a.sourceMode?{label:"Cloning repository",description:"The repository is being cloned before workspace files are added."}:"existing"===a.sourceMode?{label:"Attaching existing folder",description:"AgentOS 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:"AgentOS 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:b.label,description:b.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===a.agentCount?"Creating the first agent":"Creating workspace agents",description:1===a.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:a.kickoffMission?"Running kickoff mission":"Finalizing workspace",description:a.kickoffMission?"The primary agent is inspecting the new workspace and refining the initial setup.":"Workspace bootstrap is wrapping up without a kickoff mission."}]}}function g2(a){return{title:a.title,description:a.description,percent:0,steps:a.steps.map(a=>({...a,status:"pending",percent:0,activities:[]}))}}let g3=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 g4(){return{name:"",goal:"",source:""}}function g5(a){let b=a.trim();if(!b)return{kind:"empty",createSourceMode:"empty",label:"Fresh workspace",hint:"AgentOS will scaffold a new project folder."};if(g9(b))return{kind:"existing",createSourceMode:"existing",label:"Existing folder",hint:b,existingPath:b};if(ha(b))return{kind:"clone",createSourceMode:"clone",label:"Clone repository",hint:b,repoUrl:b};let c=hb(b);return c?hc(c)?{kind:"clone",createSourceMode:"clone",label:"Clone repository",hint:c,repoUrl:c}:{kind:"website",createSourceMode:"empty",label:"Fresh workspace + website",hint:c,websiteUrl:c}:{kind:"context",createSourceMode:"empty",label:"Fresh workspace + context",hint:"The pasted source will be attached to the brief.",contextText:b}}function g6(a){let b=a.toLowerCase();return/\b(telegram|discord|community|channel automation|campaign|content|marketing|growth|seo|newsletter)\b/.test(b)?"content":/\b(frontend|ui|website|landing page|design system|dashboard)\b/.test(b)?"frontend":/\b(backend|api|service|microservice|worker|cron|queue|sdk)\b/.test(b)?"backend":/\b(research|investigation|analysis|benchmark|thesis)\b/.test(b)?"research":"software"}function g7(a){return a.name.trim()||function(a,b){let c=function(a){let b=a.trim();if(!b)return;if(ha(b))return hd(b.split(":").at(-1)??"");let c=hb(b);return c?hc(c)?hd(new URL(c).pathname):function(a){try{let[b]=new URL(a).hostname.replace(/^www\./,"").split(".");if(!b)return;return b.split(/[-_]+/g).filter(Boolean).map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" ")}catch{return}}(c):g9(b)?hd(b):void 0}(a);if(c)return c;let d=function(a){let b=a.match(/["“]([^"”]+)["”]/)?.[1]?.trim();if(b)return b;for(let b 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 c=(a.match(b)?.[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(c)return c}}(b);if(d)return d;let e=b.toLowerCase().replace(/[^a-z0-9\s-]+/g," ").split(/\s+/).map(a=>a.trim()).filter(a=>a&&!g3.has(a)).slice(0,4);return 0===e.length?"":e.map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" ")}(a.source,a.goal)||"New Workspace"}function g8(a){let b=a.workspace.repoUrl?.trim()||a.workspace.existingPath?.trim()||a.intake.sources.find(a=>"website"===a.kind)?.url||a.intake.sources.find(a=>"prompt"===a.kind)?.summary||"";return{name:a.workspace.name||"",goal:a.company.mission||a.product.offer||a.intake.latestPrompt||"",source:b}}function g9(a){return a.startsWith("/")||a.startsWith("./")||a.startsWith("../")}function ha(a){return/^git@[^:]+:[^/].+/.test(a)}function hb(a){if(a.includes("@"))return null;let b=a.replace(/[),.;!?]+$/g,""),c=/^https?:\/\//i.test(b)?b:`https://${b}`;try{let a=new URL(c);return a.hostname.includes(".")?a.toString():null}catch{return null}}function hc(a){try{let b=new URL(a),c=b.hostname.toLowerCase(),d=b.pathname.toLowerCase();return"github.com"===c||"gitlab.com"===c||"bitbucket.org"===c||d.endsWith(".git")}catch{return!1}}function hd(a){let b=a.replace(/\\/g,"/").replace(/\/+$/g,"").split("/").filter(Boolean).at(-1)?.replace(/\.git$/i,"");if(b)return b.split(/[-_]+/g).filter(Boolean).map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" ")}let he="workspace-wizard-basic-source",hf="Imported quick setup assumptions:";function hg(a="standard"){return{...fz,workspaceOnly:!0,generateStarterDocs:"fastest"!==a,generateMemory:"fastest"!==a,kickoffMission:"fastest"!==a}}function hh(a){return{...hg(),...a,workspaceOnly:!0}}function hi(a,b,c,d){let e=structuredClone(a),f=g5(b.source),g=g7(b),h=b.goal.trim();return e.intake.mode=e.intake.mode||"guided",e.intake.started=!!(h||b.source.trim()),h&&(e.intake.initialPrompt||(e.intake.initialPrompt=h),e.intake.latestPrompt=h,e.company.mission=h,e.product.offer.trim()||(e.product.offer=h)),e.workspace.name=g,e.workspace.sourceMode=f.createSourceMode,e.workspace.repoUrl=f.repoUrl,e.workspace.existingPath=f.existingPath,e.workspace.template=d?.template??g6(`${h}
|
|
165
|
+
${b.source}`),e.workspace.modelProfile=d?.modelProfile??e.workspace.modelProfile??"balanced",e.workspace.rules=hh(c??e.workspace.rules),e.intake.sources=e.intake.sources.filter(a=>a.id!==he),"empty"!==f.kind&&e.intake.sources.unshift(gD({id:he,kind:"clone"===f.kind?"repo":"existing"===f.kind?"folder":"website"===f.kind?"website":"prompt",label:f.label,summary:f.hint,details:[f.hint],url:f.repoUrl??f.websiteUrl})),gM(e)}function hj(a){return hh(a.workspace.rules)}let hk="mission-control-workspace-plan-id";function hl({open:a,onOpenChange:b,initialMode:c="basic",workspaceEditId:e=null,surfaceTheme:f,snapshot:i,onRefresh:j,onWorkspaceCreated:k,onWorkspaceUpdated:l}){let m=!!e,n=function({open:a,initialMode:b,workspaceEditId:c,onRefresh:d,onWorkspaceCreated:e,onWorkspaceUpdated:f}){let[h,i]=(0,g.useState)(b),[j,k]=(0,g.useState)(null),[l,m]=(0,g.useState)(null),[n,o]=(0,g.useState)(!1),[p,q]=(0,g.useState)(g4),[r,s]=(0,g.useState)(()=>hg("fastest")),[t,u]=(0,g.useState)(!0),[v,w]=(0,g.useState)(()=>g6("")),[x,y]=(0,g.useState)("solo"),[z,A]=(0,g.useState)("balanced"),[B,C]=(0,g.useState)(null),[D,E]=(0,g.useState)(!1),[F,G]=(0,g.useState)(!1),[H,I]=(0,g.useState)(!1),[J,K]=(0,g.useState)(!1),[L,M]=(0,g.useState)(!1),[N,O]=(0,g.useState)(!1),[P,Q]=(0,g.useState)(!1),[R,S]=(0,g.useState)(!1),[,T]=(0,g.useState)(null),[U,V]=(0,g.useState)(null),[W,X]=(0,g.useState)(null),[Y,Z]=(0,g.useState)(0),[$,_]=(0,g.useState)(null),aa=(0,g.useRef)(null),ab=(0,g.useRef)(null),ac=(0,g.useRef)(null),ad=(0,g.useMemo)(()=>c?`${hk}:${c}`:hk,[c]),ae=(0,g.useMemo)(()=>g5(p.source),[p.source]),af=(0,g.useMemo)(()=>{let a;return(a=hh(r)).generateStarterDocs||a.generateMemory||a.kickoffMission?a.generateStarterDocs&&a.generateMemory&&a.kickoffMission?"standard":"custom":"fastest"},[r]),ag=(0,g.useMemo)(()=>(function({initialTurn:a,step:b,active:c}){return c?a?b>=2?{title:"Still working",description:"The first turn is the slowest. The planner is usually inspecting links, extracting intent, and narrowing the plan."}:b>=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."}:b>=2?{title:"Still working",description:"The architect is waiting on the planner runtime. This can happen when linked context or advisor runs take longer."}:b>=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:!j?.intake.started,step:F?Y:0,active:F||P||R}),[R,P,F,j?.intake.started,Y]),ah=(0,g.useCallback)(a=>(ab.current=a,k(a),o(!!a),a)?(m(a.id),q(g8(a)),s(hj(a)),globalThis.localStorage?.setItem(ad,a.id),a):(m(null),null),[ad]),ai=(0,g.useCallback)(a=>{if(!j)return null;let b=gM(a(structuredClone(j)));return ah(b),b},[ah,j]),aj=(0,g.useCallback)(()=>globalThis.localStorage?.getItem(ad)??null,[ad]),ak=(0,g.useCallback)(()=>{globalThis.localStorage?.removeItem(ad),o(!1)},[ad]),al=(0,g.useCallback)(async({resumeStored:a})=>{if(c){let b=a?globalThis.localStorage?.getItem(ad):null;if(b){let a=await fetch(`/api/planner/${b}`,{cache:"no-store"});if(a.ok)return(await a.json()).plan}let d=await fetch(`/api/workspaces/${c}/edit-draft`,{method:"POST"}),e=await d.json();if(!d.ok||!e.plan)throw Error(e.error||"Unable to create workspace edit draft.");return e.seed&&(ac.current=e.seed,T(e.seed)),e.plan}let b=a?globalThis.localStorage?.getItem(ad):null;if(b){let a=await fetch(`/api/planner/${b}`,{cache:"no-store"});if(a.ok)return(await a.json()).plan}let d=await fetch("/api/planner",{method:"POST"}),e=await d.json();if(!d.ok||!e.plan)throw Error(e.error||"Unable to create planner workspace.");return e.plan},[ad,c]),am=(0,g.useCallback)(async({resumeStored:a,draftOverride:b})=>{if(j)return j;if(aa.current)return aa.current;let c=(async()=>{E(!0);try{let c=await al({resumeStored:a}),d=b??p,e=d.goal.trim()||d.source.trim()||d.name.trim()?hi(c,d,r,{template:v,modelProfile:z}):c;return ah(e)}catch(a){return aq.o.error("Workspace architect could not start.",{description:a instanceof Error?a.message:"Unknown planner error."}),null}finally{E(!1),aa.current=null}})();return aa.current=c,c},[p,z,r,v,ah,j,al]),an=(0,g.useCallback)(async()=>{if(C(null),V(null),X(null),G(!1),I(!1),K(!1),M(!1),O(!1),Q(!1),_(null),aa.current=null,c){ak(),k(null),ab.current=null,m(null),await am({resumeStored:!1,draftOverride:void 0})&&i("advanced");return}if("basic"===h){ak(),k(null),ab.current=null,m(null),q(g4()),s(hg("fastest")),u(!0),w(g6("")),y("solo"),A("balanced");return}ak(),k(null),ab.current=null,m(null);let a=g4();q(a),s(hg("fastest")),u(!0),w(g6("")),y("solo"),A("balanced"),await am({resumeStored:!1,draftOverride:a})&&i("advanced")},[ak,am,h,c]),ao=(0,g.useCallback)(()=>{ak(),C(null)},[ak]),ap=(0,g.useCallback)(async a=>{let b=a??ab.current;if(!b||!l)return!1;I(!0);try{let a=await fetch(`/api/planner/${l}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:b})}),c=await a.json();if(!a.ok||!c.plan)throw Error(c.error||"Unable to save planner workspace.");return ah(c.plan),aq.o.success("Planner draft saved."),!0}catch(a){return aq.o.error("Planner draft could not be saved.",{description:a instanceof Error?a.message:"Unknown planner save error."}),!1}finally{I(!1)}},[ah,l]),ar=(0,g.useCallback)(async a=>{let b=a??ab.current;if(!b||!l)return!1;K(!0);try{let a=await fetch(`/api/planner/${l}/simulate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:b})}),c=await a.json();if(!a.ok||!c.plan)throw Error(c.error||"Unable to simulate planner team.");return ah(c.plan),aq.o.success("Planner team simulated."),!0}catch(a){return aq.o.error("Planner simulation failed.",{description:a instanceof Error?a.message:"Unknown planner simulation error."}),!1}finally{K(!1)}},[ah,l]),as=(0,g.useCallback)(()=>{ai(a=>(a.intake.mode="advanced",a.intake.reviewRequested=!0,a.advisorNotes=[],a.conversation.push(gC("assistant","Workspace Architect","Deploy review is open now. I am surfacing the real blockers and warnings that matter before launch.")),a))},[ai]),at=(0,g.useCallback)(async()=>{if(c)return null;let a=await am({resumeStored:!1,draftOverride:p})??ab.current;if(!a)return null;let b=hi(a,p,r,{template:v,modelProfile:z});ah(b),O(!0),X(g2({...g1({sourceMode:b.workspace.sourceMode,agentCount:fC(b.workspace.template,x,b.workspace.name).filter(a=>a.enabled).length,kickoffMission:b.workspace.rules.kickoffMission??!0})}));try{let a=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...function(a,b={}){var c;return{name:a.workspace.name,brief:[(c=a).company.mission.trim()||c.product.offer.trim(),c.company.name.trim()?`Company: ${c.company.name.trim()}`:null,c.company.targetCustomer.trim()?`Audience: ${c.company.targetCustomer.trim()}`:null,c.product.offer.trim()?`Offer: ${c.product.offer.trim()}`:null,c.company.successSignals.length>0?`Success signals: ${c.company.successSignals.join(", ")}`:null,c.product.scopeV1.length>0?`Scope: ${c.product.scopeV1.join(", ")}`:null,...c.intake.sources.flatMap(a=>{if(a.id!==he&&"website"!==a.kind)return[];if("repo"===a.kind&&a.url)return[`Bootstrap source: clone ${a.url}`];if("folder"===a.kind)return[`Bootstrap source: existing folder ${a.summary}`];if("website"===a.kind&&a.url){let b="number"==typeof a.confidence?` (${a.confidence}%)`:"";return[`Reference website${b}: ${a.url} - ${a.summary}`]}return"prompt"===a.kind?[`Additional context: ${a.summary}`]:[]})].filter(a=>!!a?.trim()).join("\n"),directory:a.workspace.directory,modelId:a.workspace.modelId,sourceMode:a.workspace.sourceMode,repoUrl:a.workspace.repoUrl,existingPath:a.workspace.existingPath,template:a.workspace.template,teamPreset:b.teamPreset??"solo",modelProfile:a.workspace.modelProfile||"balanced",docOverrides:a.workspace.docOverrides,rules:hh(a.workspace.rules),contextSources:a.intake.sources}}(b,{teamPreset:x}),stream:!0})});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"OpenClaw could not create the workspace.")}let c=null,f=null;if(await b_(a,async a=>{"progress"===a.type?X(a.progress):(a.progress&&X(a.progress),a.ok?c=a.result:f=a.error)}),f||!c)throw Error(f||"OpenClaw could not create the workspace.");let g=c;return ak(),await d(),e(g.workspaceId),aq.o.success("Workspace created.",{description:`${g.agentIds.length} agent${1===g.agentIds.length?"":"s"} created at ${g.workspacePath}`}),g.kickoffError&&aq.o.message("Workspace created, but kickoff needs attention.",{description:g.kickoffError}),g}catch(a){return aq.o.error("Workspace creation failed.",{description:a instanceof Error?a.message:"Unknown workspace error."}),null}finally{O(!1)}},[p,z,r,x,v,ak,ah,am,d,e,c]),au=(0,g.useCallback)(async()=>{let a=ab.current,b=ac.current;if(!a||!c)return null;S(!0);try{let e=await fetch("/api/workspaces",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceId:c,name:a.workspace.name,directory:a.workspace.directory,plan:a,baseline:b})}),g=await e.json();if(!e.ok||g.error)throw Error(g.error||"OpenClaw could not update the workspace.");return ak(),await d(),f?.(g.workspaceId??c),aq.o.success("Workspace updated.",{description:g.workspacePath||a.workspace.directory||a.workspace.name}),g}catch(a){return aq.o.error("Workspace update failed.",{description:a instanceof Error?a.message:"Unknown workspace error."}),null}finally{S(!1)}},[ak,d,f,c]),av=(0,g.useCallback)(async()=>{var a;let b=ab.current;if(!b||!l)return null;M(!0),V(g2({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."},...g1({sourceMode:(a={sourceMode:b.workspace.sourceMode??"empty",agentCount:b.team.persistentAgents.filter(a=>a.enabled).length,kickoffMission:b.workspace.rules.kickoffMission??!0,hasChannels:!!b.operations.channels.some(a=>a.enabled&&"internal"!==a.type),hasAutomations:!!b.operations.automations.some(a=>a.enabled),hasPlannerKickoffs:!!b.deploy.firstMissions.some(a=>a.trim().length>0)}).sourceMode,agentCount:a.agentCount,kickoffMission:a.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:a.hasChannels?"Provisioning channels":"Checking channels",description:a.hasChannels?"Enabled external channels are being provisioned and connected.":"No external channels are enabled, so this stage will pass quickly."},{id:"automations",label:a.hasAutomations?"Provisioning automations":"Checking automation loops",description:a.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:a.hasPlannerKickoffs?"Running planner kickoff missions":"Finalizing deploy",description:a.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 a=await fetch(`/api/planner/${l}/deploy`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:b,stream:!0})});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"Unable to deploy planner workspace.")}let c=null,f=null;if(await b_(a,async a=>{"progress"===a.type?V(a.progress):(a.progress&&V(a.progress),a.ok?c=a.result:f=a.error)}),f||!c)throw Error(f||"Unable to deploy planner workspace.");let g=c;return ah(g.plan),ak(),await d(),e(g.workspaceId),aq.o.success("Workspace deployed.",{description:g.workspacePath}),g}catch(a){return aq.o.error("Planner deploy failed.",{description:a instanceof Error?a.message:"Unknown deploy error."}),null}finally{M(!1)}},[ak,ah,d,e,l]),aw=(0,g.useCallback)(async a=>{if(!a.trim())return!1;G(!0),_(a.trim());try{let c="advanced"===b&&!j&&!p.goal.trim()&&!p.source.trim()&&!p.name.trim(),d=await am({resumeStored:c,draftOverride:p})??j;if(!d)return!1;let e=await fetch(`/api/planner/${d.id}/turn`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:a,plan:d})}),f=await e.json();if(!e.ok||!f.plan)throw Error(f.error||"Unable to process planner turn.");return ah(f.plan),C(null),!0}catch(a){return aq.o.error("Planner turn failed.",{description:a instanceof Error?a.message:"Unknown planner turn error."}),!1}finally{_(null),G(!1)}},[p,ah,am,b,j]),ax=(0,g.useCallback)(async({path:a,currentContent:b,instruction:c})=>{if(!j||!l)return null;let d=a.trim();if(!d)return null;Q(!0);try{let a=await fetch(`/api/planner/${l}/document-rewrite`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:j,path:d,currentContent:b,instruction:c?.trim()||"Rewrite this document to improve clarity, usefulness, and consistency with the workspace context."})}),e=await a.json();if(!a.ok||!e.plan)throw Error(e.error||"Unable to rewrite the document.");ah(e.plan),C(null);let f=fo({name:e.plan.workspace.name||"Workspace",brief:e.plan.company.mission||e.plan.product.offer||void 0,template:e.plan.workspace.template,sourceMode:e.plan.workspace.sourceMode,rules:e.plan.workspace.rules,agents:e.plan.team.persistentAgents.filter(a=>a.enabled),docOverrides:e.plan.workspace.docOverrides,toolExamples:[],contextSources:e.plan.intake.sources}).find(a=>a.path===d);return aq.o.success(`Architect rewrote ${d}.`,{description:e.reply||"The document override has been updated."}),f?.content??null}catch(a){return aq.o.error("Document rewrite failed.",{description:a instanceof Error?a.message:"Unknown document rewrite error."}),null}finally{Q(!1)}},[ah,j,l]),ay=(0,g.useCallback)(async()=>{let a=aj();if(!a)return o(!1),!1;E(!0);try{let b=await fetch(`/api/planner/${a}`,{cache:"no-store"}),d=await b.json();if(!b.ok||!d.plan)throw Error(d.error||"Unable to load the stored planner draft.");return ah(d.plan),w(d.plan.workspace.template),A(d.plan.workspace.modelProfile),y(d.plan.team.persistentAgents.filter(a=>a.enabled).length>1?"core":"solo"),i("advanced"),C({tone:"muted",title:c?"Resumed workspace edit":"Resumed previous draft",description:c?"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(a){return aq.o.error("Stored draft could not be resumed.",{description:a instanceof Error?a.message:"Unknown planner error."}),!1}finally{E(!1),aa.current=null}},[ah,aj,c]),az=(0,g.useCallback)(async a=>{if(a!==h){if(c){if("basic"===a)return;i("advanced");return}if("advanced"===a){let a=await am({resumeStored:!1,draftOverride:p});if(!a)return;let b=hi(a,p,r,{template:v,modelProfile:z}),c=!b.intake.started&&b.conversation.filter(a=>"system"!==a.role).length<=1?function(a,b){let c=structuredClone(a),d=b.goal.trim(),e=b.source.trim();if(c.conversation=c.conversation.filter(a=>!("system"===a.role&&"Workspace Wizard"===a.author&&a.text.startsWith(hf))),!d&&!e)return gM(c);let f=[d?`goal: ${d}`:null,e?`source: ${e}`:null,`fast-path name: ${g7(b)}`].filter(Boolean);return c.conversation.push(gC("system","Workspace Wizard",`${hf} ${f.join(" \xb7 ")}`)),gM(c)}(b,p):b;ah(c),C(c.intake.started||p.goal.trim()||p.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),i("advanced");return}if(j)q(g8(j)),s(hj(j)),w(j.workspace.template),A(j.workspace.modelProfile),y(j.team.persistentAgents.filter(a=>a.enabled).length>1?"core":"solo"),C(j&&(j.team.persistentAgents.filter(a=>a.enabled).length>1||j.operations.workflows.some(a=>a.enabled)||j.operations.automations.some(a=>a.enabled)||j.operations.channels.some(a=>a.enabled&&"internal"!==a.type)||j.operations.hooks.some(a=>a.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 C(null);i("basic")}},[p,z,r,v,ah,am,h,j,c]),aA=(0,g.useCallback)(a=>{q(b=>{let c={...b,goal:a},d=t?g6(`${c.goal}
|
|
166
|
+
${c.source}`):v;return t&&w(d),"basic"===h&&k(a=>{let b=a?hi(a,c,r,{template:d,modelProfile:z}):a;return ab.current=b,b}),c})},[z,r,v,t,h]),aB=(0,g.useCallback)(a=>{q(b=>{let c={...b,source:a},d=t?g6(`${c.goal}
|
|
167
|
+
${c.source}`):v;return t&&w(d),"basic"===h&&k(a=>{let b=a?hi(a,c,r,{template:d,modelProfile:z}):a;return ab.current=b,b}),c})},[z,r,v,t,h]),aC=(0,g.useCallback)(a=>{q(b=>{let c={...b,name:a};return"basic"===h&&k(a=>{let b=a?hi(a,c,r,{template:v,modelProfile:z}):a;return ab.current=b,b}),c})},[z,r,v,h]),aD=(0,g.useCallback)(a=>{u(!1),w(a),k(b=>{let c=b?hi(b,p,r,{template:a,modelProfile:z}):b;return ab.current=c,c})},[p,z,r]),aE=(0,g.useCallback)(a=>{y(a)},[]),aF=(0,g.useCallback)(a=>{A(a),k(b=>{let c=b?hi(b,p,r,{template:v,modelProfile:a}):b;return ab.current=c,c})},[p,r,v]),aG=(0,g.useCallback)(a=>{let b=hg(a);s(b),k(a=>{let c=a?hi(a,p,b,{template:v,modelProfile:z}):a;return ab.current=c,c})},[p,z,v]),aH=(0,g.useCallback)(a=>{s(b=>{let c={...b,[a]:!b[a],workspaceOnly:!0};return k(a=>{let b=a?hi(a,p,c,{template:v,modelProfile:z}):a;return ab.current=b,b}),c})},[p,z,v]);return{mode:h,plan:j,planId:l,hasStoredDraft:n,notice:B,sourceAnalysis:ae,basicDraft:p,basicRules:r,basicPreset:af,basicTemplate:v,basicTeamPreset:x,basicModelProfile:z,isPlanLoading:D,isSending:F,isSaving:H,isSimulating:J,isDeploying:L,isCreating:N,isApplyingWorkspaceChanges:R,isDocumentRewriting:P,createProgress:W,deployProgress:U,architectBusyStatus:ag,pendingUserMessage:$,setBasicGoal:aA,setBasicSource:aB,setBasicName:aC,setBasicTemplate:aD,setBasicTeamPreset:aE,setBasicModelProfile:aF,setBasicPreset:aG,toggleBasicRule:aH,setNotice:C,updatePlan:ai,switchMode:az,startFreshDraft:an,discardStoredDraft:ao,resumeStoredDraft:ay,savePlan:ap,simulatePlan:ar,requestReview:as,createWorkspace:at,deployPlan:av,applyWorkspaceChanges:au,submitArchitectTurn:aw,rewriteDocumentWithArchitect:ax}}({open:a,initialMode:c,workspaceEditId:e,onRefresh:j,onWorkspaceCreated:k,onWorkspaceUpdated:l}),[o,p]=(0,g.useState)(""),[q,r]=(0,g.useState)(!1),[s,t]=(0,g.useState)(!1),[u,v]=(0,g.useState)(!1),[w,y]=(0,g.useState)("intake"),[z,A]=(0,g.useState)("workspace.name"),[B,C]=(0,g.useState)("AGENTS.md"),D="light"===f,E=m?i.workspaces.find(a=>a.id===e)??null:null,F=a=>{a||(p(""),r(!1),t(!1),v(!1),y("intake"),A("workspace.name"),C("AGENTS.md")),b(a)},G=m?n.plan?.workspace.name??E?.name??g7(n.basicDraft):g7(n.basicDraft),H=m?n.plan?.workspace.template??E?.bootstrap.template??n.basicTemplate:n.plan?.workspace.template??n.basicTemplate,I=m?n.plan?.workspace.directory??E?.path??i.diagnostics.workspaceRoot:function(a,b,c=g5(b.source)){if("existing"===c.kind&&c.existingPath)return c.existingPath;let d=g7(b).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return`${M(a)}/${d||"workspace"}`}(i.diagnostics.workspaceRoot,n.basicDraft,n.sourceAnalysis),J=(0,g.useMemo)(()=>(function(a,b,c,d){let e=[{id:"surface",label:c?"Editing workspace":"basic"===a?"Architect-assisted fast path":"Architect co-design",tone:"muted"}];return!c&&"basic"===a&&d&&e.push({id:"step",label:`Step ${hs.findIndex(a=>a.id===d)+1} / 3 \xb7 ${hs.find(a=>a.id===d)?.label??"Intake"}`,tone:"muted"}),b&&("basic"===a?b.intake.confirmations.length>0?e.push({id:"confirmations",label:`${b.intake.confirmations.length} decision${1===b.intake.confirmations.length?"":"s"} needed`,tone:b.intake.confirmations.length>1?"warning":"muted"}):b.intake.started&&e.push({id:"draft",label:"Draft synced live",tone:"muted"}):(b.intake.confirmations.length>0&&e.push({id:"confirmations",label:`${b.intake.confirmations.length} decision${1===b.intake.confirmations.length?"":"s"} needed`,tone:b.intake.confirmations.length>1?"warning":"muted"}),e.push({id:"stage",label:`Stage \xb7 ${fX(b.stage)}`,tone:"muted"}),e.push({id:"readiness",label:`${b.readinessScore}% drafted`,tone:b.readinessScore>=85?"success":b.readinessScore>=45?"warning":"muted"}),e.push({id:"status",label:`Status \xb7 ${b.status}`,tone:"blocked"===b.status?"danger":"ready"===b.status||"deployed"===b.status?"success":"review"===b.status?"warning":"muted"}))),e})(n.mode,n.plan,m,w),[w,m,n.mode,n.plan]),K=(0,g.useMemo)(()=>{var a,b;let c;return a=n.plan,b=n.pendingUserMessage,c=a?.conversation.map(a=>({id:a.id,role:a.role,author:"assistant"===a.role?"Architect":"system"===a.role?"Workspace Wizard":a.author,text:a.text}))??[],b?.trim()&&c.push({id:"pending-user-message",role:"user",text:b.trim(),status:"pending"}),c},[n.pendingUserMessage,n.plan]),L=(0,g.useMemo)(()=>{for(let a=K.length-1;a>=0;a-=1){let b=K[a];if("assistant"===b.role&&"Architect"===b.author)return b.id}return null},[K]),N=n.isCreating?n.createProgress:n.isDeploying?n.deployProgress:null,O=n.isSending||n.isPlanLoading||n.isDeploying||n.isCreating||n.isDocumentRewriting||n.isApplyingWorkspaceChanges,P="basic"===n.mode&&n.hasStoredDraft&&!n.plan&&!n.isPlanLoading,Q=m?!!(n.plan||o.trim()):!!(n.plan?.intake.started||n.basicDraft.goal.trim()||o.trim()),R=!!(n.plan?.intake.started||n.basicDraft.name.trim()||n.basicDraft.goal.trim()||n.basicDraft.source.trim()||o.trim()),S=async a=>{let b=(a??o).trim();if(!b)return!1;let c=void 0===a;c&&p("");let d=await n.submitArchitectTurn(b);return!d&&c&&p(o),d},T=async()=>{if(m){if(!(!o.trim()||await S()))return;await n.applyWorkspaceChanges()&&F(!1);return}(!o.trim()||await S())&&await n.createWorkspace()&&F(!1)},U=async()=>{m||await n.deployPlan()&&F(!1)},V=async(a,b)=>{let c=b.trim()?{...a,conversation:[...a.conversation,gC("system","Workspace Wizard",b)]}:a;return n.savePlan(c)},W=async(a,b)=>{let c=b.trim()?{...a,conversation:[...a.conversation,gC("system","Workspace Wizard",b)]}:a;return n.savePlan(c)},X=(a="workspace.name")=>{A(a),r(!1),t(!0),v(!1)},Y=a=>{C(a),r(!1),t(!1),v(!0)};return(0,d.jsx)(ae,{open:a,onOpenChange:F,children:(0,d.jsxs)(aj,{className:D?"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,d.jsx)(am,{className:"sr-only",children:m?"Edit workspace":"Create workspace"}),(0,d.jsx)(an,{className:"sr-only",children:m?"Edit the existing workspace blueprint, documents, and agents using Architect.":"Create a workspace in Basic or Advanced mode using the Architect wizard."}),(0,d.jsxs)("div",{className:"relative flex h-full min-h-0 flex-col overflow-hidden",children:[(0,d.jsx)("div",{className:D?"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,d.jsx)(gq,{surfaceTheme:f,mode:n.mode,onModeChange:a=>{n.switchMode(a)},onNewDraft:m?void 0:()=>{p(""),r(!1),t(!1),v(!1),y("intake"),n.startFreshDraft()},title:m?"Edit workspace":"Create workspace",showModeToggle:!m,showNewDraft:!m,badges:J}),(0,d.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,d.jsx)("div",{className:D?"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:"basic"!==n.mode||m?(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[n.architectBusyStatus?(0,d.jsx)("div",{className:D?"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,d.jsxs)("div",{className:D?"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,d.jsx)("p",{className:D?"text-[10px] uppercase tracking-[0.2em] text-[#8b7262]":"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:n.architectBusyStatus.title}),(0,d.jsx)("p",{className:D?"mt-1 text-[12px] leading-5 text-[#6d665e]":"mt-1 text-[12px] leading-5 text-slate-300",children:n.architectBusyStatus.description})]})}):null,(0,d.jsx)("div",{className:"min-h-0 flex-1",children:(0,d.jsx)(gu,{surfaceTheme:f,messages:K,architectMessageId:L,architectPlan:n.plan,isTyping:n.isSending,typingLabel:"Architect is shaping the next pass...",emptyState:n.isPlanLoading&&0===K.length?(0,d.jsx)(ho,{surfaceTheme:f}):0===K.length&&"basic"===n.mode?(0,d.jsx)(hm,{surfaceTheme:f}):0===K.length?(0,d.jsx)(hn,{surfaceTheme:f}):null,auxiliary:(0,d.jsxs)(d.Fragment,{children:[P?(0,d.jsx)(hq,{surfaceTheme:f,isBusy:O,onResume:()=>{n.resumeStoredDraft()},onStartFresh:n.discardStoredDraft}):null,N?(0,d.jsx)("div",{className:"mx-auto w-full max-w-3xl",children:(0,d.jsx)(fa,{progress:N,className:D?"border-[#e6dfd5] bg-white":"border-white/10 bg-slate-950/50"})}):null]})})}),(0,d.jsx)("div",{className:D?"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,d.jsx)("div",{className:"mx-auto w-full max-w-3xl",children:(0,d.jsx)(gt,{surfaceTheme:f,value:o,onChange:p,onSubmit:async()=>{await S()},placeholder:m?"Tell Architect what to change in this workspace...":"basic"===n.mode?"Describe what this workspace should do...":"Refine the blueprint with Architect...",disabled:O,isBusy:n.isSending,helperText:m?"Architect updates the existing workspace draft as you chat.":"basic"===n.mode?"Architect keeps the fast-path draft synced as you chat.":"Architect updates the shared blueprint on every turn.",toolbar:m?(0,d.jsx)("span",{className:D?"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"!==n.mode||n.plan?n.plan?(0,d.jsxs)("span",{className:D?"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 ",fX(n.plan.stage)]}):null:(0,d.jsx)("span",{className:D?"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,d.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 py-4 md:px-5",children:(0,d.jsxs)("div",{className:"mx-auto flex w-full max-w-3xl flex-col gap-4",children:[P?(0,d.jsx)(hq,{surfaceTheme:f,isBusy:O,onResume:()=>{n.resumeStoredDraft()},onStartFresh:n.discardStoredDraft}):null,n.isPlanLoading?(0,d.jsx)(ho,{surfaceTheme:f}):(0,d.jsx)(hm,{surfaceTheme:f}),(0,d.jsx)(ht,{surfaceTheme:f,step:w,isBusy:O,basicDraft:n.basicDraft,basicTemplate:n.basicTemplate,basicTeamPreset:n.basicTeamPreset,basicModelProfile:n.basicModelProfile,basicRules:n.basicRules,basicPreset:n.basicPreset,resolvedName:G,resolvedTemplate:H,sourceAnalysis:n.sourceAnalysis,workspacePath:I,onStepChange:y,onBasicNameChange:n.setBasicName,onBasicGoalChange:n.setBasicGoal,onBasicSourceChange:n.setBasicSource,onBasicTemplateChange:n.setBasicTemplate,onBasicTeamPresetChange:n.setBasicTeamPreset,onBasicModelProfileChange:n.setBasicModelProfile,onBasicPresetChange:n.setBasicPreset,onBasicRuleToggle:n.toggleBasicRule})]})})})}),(0,d.jsx)(gf,{className:"hidden lg:block",surfaceTheme:f,workspaceMode:m?"edit":"create",mode:n.mode,snapshot:i,plan:n.plan,resolvedName:G,resolvedTemplate:H,sourceAnalysis:n.sourceAnalysis,workspacePath:I,notice:n.notice,basicRules:n.basicRules,basicPreset:n.basicPreset,onOpenBlueprintEditor:X,onOpenDocumentEditor:Y,onBasicPresetChange:n.setBasicPreset,onBasicRuleToggle:n.toggleBasicRule,progress:m?null:"basic"===n.mode?n.createProgress:n.isDeploying?n.deployProgress:null})]}),q?(0,d.jsxs)("div",{className:D?"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,d.jsxs)("div",{className:D?"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,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:D?"text-[11px] uppercase tracking-[0.18em] text-[#9f958a]":"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:"basic"===n.mode?"Workspace draft":"Workspace blueprint"}),(0,d.jsx)("p",{className:D?"text-[13px] text-[#6f675e]":"text-[13px] text-slate-300",children:"Review the structured side of the same wizard."})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[n.plan?(0,d.jsx)(x,{type:"button",variant:"secondary",size:"sm",onClick:()=>X(),className:D?"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,d.jsx)("button",{type:"button",onClick:()=>r(!1),className:D?"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,d.jsx)(ad.A,{className:"h-4 w-4"})})]})]}),(0,d.jsx)(gf,{className:"min-h-0 flex-1 border-t-0 lg:hidden",surfaceTheme:f,workspaceMode:m?"edit":"create",mode:n.mode,snapshot:i,plan:n.plan,resolvedName:G,resolvedTemplate:H,sourceAnalysis:n.sourceAnalysis,workspacePath:I,notice:n.notice,basicRules:n.basicRules,basicPreset:n.basicPreset,onOpenBlueprintEditor:X,onOpenDocumentEditor:Y,onBasicPresetChange:n.setBasicPreset,onBasicRuleToggle:n.toggleBasicRule,progress:m?null:"basic"===n.mode?n.createProgress:n.isDeploying?n.deployProgress:null})]}):null,s&&n.plan?(0,d.jsx)(fE,{open:s,surfaceTheme:f,plan:n.plan,busy:n.isSaving,focus:z,onClose:()=>t(!1),onSave:V},`${n.plan.id}:${z}`):null,u&&n.plan?(0,d.jsx)(fO,{open:u,surfaceTheme:f,plan:n.plan,path:B,busy:n.isSaving,rewriteBusy:n.isDocumentRewriting,onClose:()=>v(!1),onSave:W,onRewriteWithArchitect:n.rewriteDocumentWithArchitect},`${n.plan.id}:${B}`):null,(0,d.jsx)("div",{className:D?"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,d.jsxs)("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[(0,d.jsx)("p",{className:D?"text-[13px] text-[#776f65]":"text-[13px] text-slate-300",children:"basic"===n.mode?"intake"===w?"Step 1 of 3. Capture the mission and source first.":"shape"===w?"Step 2 of 3. Pick the template and default shape.":"Step 3 of 3. Review the draft before creating.":"Chat and blueprint stay synced as you refine the plan."}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsxs)(x,{variant:"secondary",size:"sm",className:D?"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:()=>r(!0),children:[(0,d.jsx)(e5.A,{className:"mr-2 h-4 w-4"}),"View blueprint"]}),m?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(x,{variant:"secondary",size:"sm",className:D?"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 n.savePlan(),disabled:!n.plan||n.isSaving||n.isPlanLoading,children:[n.isSaving?(0,d.jsx)(h.A,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save draft"]}),(0,d.jsxs)(x,{size:"sm",className:D?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",onClick:()=>void T(),disabled:!Q||n.isPlanLoading||n.isSending||n.isSaving||n.isApplyingWorkspaceChanges,children:[n.isApplyingWorkspaceChanges?(0,d.jsx)(h.A,{className:"mr-2 h-4 w-4 animate-spin"}):(0,d.jsx)(a2.A,{className:"mr-2 h-4 w-4"}),"Apply changes"]})]}):"basic"===n.mode?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(x,{variant:"secondary",size:"sm",className:D?"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:"intake"===w?()=>{n.switchMode("advanced")}:()=>{"shape"===w?y("intake"):"review"===w&&y("shape")},disabled:n.isCreating||n.isSending||n.isPlanLoading,children:"intake"===w?"Advanced details":"Back"}),(0,d.jsxs)(x,{size:"sm",className:D?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",onClick:()=>{"intake"===w?y("shape"):"shape"===w?y("review"):T()},disabled:n.isCreating||n.isSending||n.isPlanLoading||"review"===w&&!R,children:["review"===w?n.isCreating?(0,d.jsx)(h.A,{className:"mr-2 h-4 w-4 animate-spin"}):(0,d.jsx)(a2.A,{className:"mr-2 h-4 w-4"}):(0,d.jsx)(a8.A,{className:"mr-2 h-4 w-4"}),"intake"===w?"Continue":"shape"===w?"Review draft":"Create workspace"]})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(x,{variant:"secondary",size:"sm",className:D?"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 n.savePlan(),disabled:!n.plan||n.isSaving||n.isPlanLoading,children:[n.isSaving?(0,d.jsx)(h.A,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save draft"]}),n.plan?.intake.reviewRequested?(0,d.jsxs)(x,{size:"sm",className:D?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",onClick:()=>void U(),disabled:!n.plan||n.plan.deploy.blockers.length>0||n.isDeploying||n.isPlanLoading,children:[n.isDeploying?(0,d.jsx)(h.A,{className:"mr-2 h-4 w-4 animate-spin"}):(0,d.jsx)(a7.A,{className:"mr-2 h-4 w-4"}),"Deploy workspace"]}):(0,d.jsx)(x,{size:"sm",className:D?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",onClick:()=>n.requestReview(),disabled:!n.plan||n.isSending||n.isDeploying,children:"Review blueprint"})]})]})]})})]})]})})}function hm({surfaceTheme:a}){let b="light"===a;return(0,d.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,d.jsx)("p",{className:s("text-[10px] uppercase tracking-[0.22em]",b?"text-[#8b7262]":"text-slate-500"),children:"Fast path"}),(0,d.jsx)("p",{className:b?"text-[24px] font-semibold tracking-[-0.03em] text-[#181612]":"text-[24px] font-semibold tracking-[-0.03em] text-white",children:"Start with one prompt."}),(0,d.jsx)("p",{className:b?"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 hn({surfaceTheme:a}){let b="light"===a;return(0,d.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,d.jsx)("p",{className:s("text-[10px] uppercase tracking-[0.22em]",b?"text-[#8b7262]":"text-slate-500"),children:"Blueprint mode"}),(0,d.jsx)("p",{className:b?"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,d.jsx)("p",{className:b?"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 ho({surfaceTheme:a}){return(0,d.jsxs)("div",{className:"light"===a?"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,d.jsx)(h.A,{className:"h-4 w-4 animate-spin"}),"Architect is opening the planning session and extracting intent from the latest brief."]})}function hp({surfaceTheme:a,name:b,goal:c,source:e,resolvedName:f,resolvedTemplate:g,workspacePath:h,sourceAnalysis:i,disabled:j,onNameChange:k,onGoalChange:l,onSourceChange:m}){let n="light"===a,o="clone"===i.kind?e6.A:"website"===i.kind?e7.A:e8.A;return(0,d.jsxs)("div",{className:s("mx-auto w-full rounded-[24px] border p-4 shadow-[0_18px_56px_rgba(56,47,38,0.06)] md:p-5",n?"border-[#e4ddd3] bg-white":"border-white/10 bg-white/[0.04]"),children:[(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:s("inline-flex size-8 shrink-0 items-center justify-center rounded-full border",n?"border-[#e4ddd3] bg-[#faf6f1] text-[#5e5750]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,d.jsx)(a2.A,{className:"h-3.5 w-3.5"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:n?"text-[10px] uppercase tracking-[0.2em] text-[#8b7262]":"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:"Step 1 \xb7 Intake"}),(0,d.jsx)("p",{className:n?"mt-1 text-[12px] leading-5 text-[#70685f]":"mt-1 text-[12px] leading-5 text-slate-300",children:"Give Architect the mission and source. The name can stay optional."})]})]}),(0,d.jsxs)("div",{className:"mt-4 grid gap-3",children:[(0,d.jsx)(hr,{surfaceTheme:a,label:"Workspace name",children:(0,d.jsx)(y,{value:b,onChange:a=>k(a.target.value),placeholder:"Optional. Architect can infer it.",disabled:j,className:n?"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,d.jsx)(hr,{surfaceTheme:a,label:"Goal",children:(0,d.jsx)(bH,{value:c,onChange:a=>l(a.target.value),placeholder:"What should this workspace help you accomplish?",disabled:j,className:n?"min-h-[100px] border-[#e4ddd3] bg-[#fcfaf6] text-[#1c1916] placeholder:text-[#9b948c] focus-visible:ring-[#b8ada1]":"min-h-[100px] border-white/10 bg-[rgba(4,8,15,0.64)] text-slate-100 placeholder:text-slate-500 focus-visible:ring-cyan-300/60"})}),(0,d.jsx)(hr,{surfaceTheme:a,label:"Source",children:(0,d.jsx)(y,{value:e,onChange:a=>m(a.target.value),placeholder:"Repo URL, website URL, or existing folder path",disabled:j,className:n?"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,d.jsxs)("div",{className:s("mt-4 rounded-[20px] border px-3 py-3",n?"border-[#e8e0d6] bg-[#faf6f1]":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(a2.A,{className:s("h-4 w-4",n?"text-[#5f5952]":"text-slate-300")}),(0,d.jsx)("p",{className:s("text-[11px] uppercase tracking-[0.18em]",n?"text-[#a0978b]":"text-slate-500"),children:"Live preview"})]}),(0,d.jsxs)("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:[(0,d.jsx)(hB,{surfaceTheme:a,label:"Name",value:f,icon:a2.A}),(0,d.jsx)(hB,{surfaceTheme:a,label:"Template",value:fA[g].label,icon:e9.A}),(0,d.jsx)(hB,{surfaceTheme:a,label:"Source",value:i.label,icon:o}),(0,d.jsx)(hB,{surfaceTheme:a,label:"Path",value:h,icon:e8.A,mono:!0})]})]})]})}function hq({surfaceTheme:a,isBusy:b,onResume:c,onStartFresh:e}){let f="light"===a;return(0,d.jsx)("div",{className:f?"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,d.jsxs)("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:f?"text-[11px] uppercase tracking-[0.18em] text-[#8b7262]":"text-[11px] uppercase tracking-[0.18em] text-slate-500",children:"Previous draft found"}),(0,d.jsx)("p",{className:f?"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,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)(x,{variant:"secondary",size:"sm",className:f?"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:e,disabled:b,children:"Start fresh"}),(0,d.jsx)(x,{size:"sm",className:f?"rounded-full bg-[#161514] text-white hover:bg-[#26231f]":"rounded-full bg-cyan-300 text-slate-950 hover:bg-cyan-200",onClick:c,disabled:b,children:"Resume blueprint"})]})]})})}function hr({surfaceTheme:a,label:b,children:c}){return(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)("p",{className:"light"===a?"text-[11px] uppercase tracking-[0.16em] text-[#8d8276]":"text-[11px] uppercase tracking-[0.16em] text-slate-500",children:b}),c]})}let hs=[{id:"intake",label:"Intake",hint:"Mission, name, source"},{id:"shape",label:"Shape",hint:"Template and defaults"},{id:"review",label:"Review",hint:"Confirm and launch"}];function ht({surfaceTheme:a,step:b,isBusy:c,basicDraft:e,basicTemplate:f,basicTeamPreset:g,basicModelProfile:h,basicRules:i,basicPreset:j,resolvedName:k,resolvedTemplate:l,sourceAnalysis:m,workspacePath:n,onStepChange:o,onBasicNameChange:p,onBasicGoalChange:q,onBasicSourceChange:r,onBasicTemplateChange:s,onBasicTeamPresetChange:t,onBasicModelProfileChange:u,onBasicPresetChange:v,onBasicRuleToggle:w}){return(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)(hu,{surfaceTheme:a,step:b,onStepChange:o}),"intake"===b?(0,d.jsx)(hp,{surfaceTheme:a,name:e.name,goal:e.goal,source:e.source,resolvedName:k,resolvedTemplate:l,workspacePath:n,sourceAnalysis:m,onNameChange:p,onGoalChange:q,onSourceChange:r}):"shape"===b?(0,d.jsx)(hv,{surfaceTheme:a,basicTemplate:f,basicTeamPreset:g,basicModelProfile:h,basicRules:i,basicPreset:j,onBasicTemplateChange:s,onBasicTeamPresetChange:t,onBasicModelProfileChange:u,onBasicPresetChange:v,onBasicRuleToggle:w,isBusy:c}):(0,d.jsx)(hw,{surfaceTheme:a,basicDraft:e,basicTeamPreset:g,basicModelProfile:h,basicRules:i,basicPreset:j,resolvedName:k,resolvedTemplate:l,sourceAnalysis:m,workspacePath:n,onStepChange:o})]})}function hu({surfaceTheme:a,step:b,onStepChange:c}){let e="light"===a,f=hs.findIndex(a=>a.id===b);return(0,d.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:hs.map((a,g)=>{let h=a.id===b,i=g<f;return(0,d.jsxs)("button",{type:"button",onClick:()=>c(a.id),className:s("inline-flex items-center gap-2 rounded-full border px-3 py-1.5 text-left transition-colors",h?e?"border-[#c89e73]/35 bg-[#f8efe4] text-[#5d4331]":"border-cyan-300/30 bg-cyan-400/10 text-cyan-50":i?e?"border-[#dccfc3] bg-white text-[#7e6757]":"border-emerald-300/20 bg-emerald-400/10 text-emerald-50":e?"border-[#e6dbd0] bg-white/80 text-[#8b7563]":"border-white/10 bg-white/[0.04] text-slate-400"),children:[(0,d.jsx)("span",{className:s("inline-flex h-5 w-5 items-center justify-center rounded-full text-[10px] font-medium",h?e?"bg-[#c89e73]/15 text-[#5d4331]":"bg-cyan-300/20 text-cyan-50":i?e?"bg-[#f0e7de] text-[#7a6556]":"bg-emerald-300/20 text-emerald-50":e?"bg-[#f2ece6] text-[#917866]":"bg-white/10 text-slate-400"),children:g+1}),(0,d.jsxs)("span",{className:"min-w-0",children:[(0,d.jsx)("span",{className:"block text-[10px] font-medium uppercase tracking-[0.16em]",children:a.label}),(0,d.jsx)("span",{className:"block text-[10px] leading-4 opacity-75",children:a.hint})]})]},a.id)})})}function hv({surfaceTheme:a,basicTemplate:b,basicTeamPreset:c,basicModelProfile:e,basicRules:f,basicPreset:g,onBasicTemplateChange:h,onBasicTeamPresetChange:i,onBasicModelProfileChange:j,onBasicPresetChange:k,onBasicRuleToggle:l,isBusy:m}){let n="light"===a,o=fA[b];return(0,d.jsxs)("section",{className:s("rounded-[24px] border p-4 md:p-5",n?"border-[#e4ddd3] bg-white":"border-white/10 bg-white/[0.04]"),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:s("text-[10px] uppercase tracking-[0.2em]",n?"text-[#8b7262]":"text-slate-500"),children:"Step 2 \xb7 Shape"}),(0,d.jsx)("p",{className:s("mt-1 text-[12px] leading-5",n?"text-[#70685f]":"text-slate-300"),children:"Pick the template and defaults that best match the workspace."})]}),(0,d.jsx)(u,{variant:"muted",className:s("shrink-0",n?"border-[#ddd6cb] bg-[#f7f2eb] text-[#574a40]":""),children:o.label})]}),(0,d.jsxs)("div",{className:"mt-4 space-y-4",children:[(0,d.jsx)(hx,{surfaceTheme:a,title:"Template",summary:"This sets the scaffold, documents, and default capabilities.",children:(0,d.jsx)("div",{className:"grid gap-2 md:grid-cols-2 xl:grid-cols-3",children:fw.map(c=>{let e=fA[c.value];return(0,d.jsx)(hy,{surfaceTheme:a,selected:b===c.value,title:c.label,description:c.description,icon:(0,d.jsx)("span",{className:"text-[14px] leading-none","aria-hidden":"true",children:e.icon}),onClick:()=>h(c.value),disabled:m},c.value)})})}),(0,d.jsx)(hx,{surfaceTheme:a,title:"Team preset",summary:"Choose how many permanent agents the workspace should start with.",children:(0,d.jsx)("div",{className:"grid gap-2 md:grid-cols-3",children:fx.map(b=>(0,d.jsx)(hy,{surfaceTheme:a,selected:c===b.value,title:b.label,description:b.description,icon:(0,d.jsx)(a7.A,{className:"h-4 w-4"}),onClick:()=>i(b.value),disabled:m},b.value))})}),(0,d.jsx)(hx,{surfaceTheme:a,title:"Model profile",summary:"Favor speed, balance, or quality for the default workspace runs.",children:(0,d.jsx)("div",{className:"grid gap-2 md:grid-cols-3",children:fy.map(b=>(0,d.jsx)(hy,{surfaceTheme:a,selected:e===b.value,title:b.label,description:b.description,icon:(0,d.jsx)(e9.A,{className:"h-4 w-4"}),onClick:()=>j(b.value),disabled:m},b.value))})}),(0,d.jsxs)("div",{className:s("rounded-[20px] border p-3",n?"border-[#e8e0d6] bg-[#faf6f1]":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:s("text-[11px] uppercase tracking-[0.18em]",n?"text-[#8d8276]":"text-slate-500"),children:"Bootstrap speed"}),(0,d.jsx)("p",{className:s("mt-1 text-[12px] leading-5",n?"text-[#766e64]":"text-slate-400"),children:"Use a preset or tune the bootstrap rules manually."})]}),(0,d.jsx)(u,{variant:"muted",children:g})]}),(0,d.jsxs)("div",{className:"mt-3 grid gap-2 md:grid-cols-3",children:[(0,d.jsx)(hA,{surfaceTheme:a,active:"standard"===g,title:"Standard",description:"Docs, memory, kickoff",disabled:m,onClick:()=>k("standard")}),(0,d.jsx)(hA,{surfaceTheme:a,active:"fastest"===g,title:"Fastest",description:"Core files only",disabled:m,onClick:()=>k("fastest")}),(0,d.jsx)(hA,{surfaceTheme:a,active:"custom"===g,title:"Custom",description:"Manually choose rules",disabled:m,onClick:()=>k("custom")})]})]}),(0,d.jsxs)("div",{className:s("rounded-[20px] border p-3",n?"border-[#e8e0d6] bg-[#faf6f1]":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:s("text-[11px] uppercase tracking-[0.18em]",n?"text-[#8d8276]":"text-slate-500"),children:"Workspace rules"}),(0,d.jsx)("p",{className:s("mt-1 text-[12px] leading-5",n?"text-[#766e64]":"text-slate-400"),children:"Toggle the bootstrap steps that should ship with the workspace."})]}),(0,d.jsxs)(u,{variant:"muted",children:[[f.generateStarterDocs,f.generateMemory,f.kickoffMission].filter(Boolean).length,"/3"]})]}),(0,d.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,d.jsx)(hz,{surfaceTheme:a,title:"Starter docs",description:"Generate the brief, scaffolding notes, and handoff docs.",checked:f.generateStarterDocs,disabled:m,onToggle:()=>l("generateStarterDocs")}),(0,d.jsx)(hz,{surfaceTheme:a,title:"Memory",description:"Write durable context and decisions into memory files.",checked:f.generateMemory,disabled:m,onToggle:()=>l("generateMemory")}),(0,d.jsx)(hz,{surfaceTheme:a,title:"Kickoff mission",description:"Launch the first mission right after bootstrap.",checked:f.kickoffMission,disabled:m,onToggle:()=>l("kickoffMission")})]})]})]})]})}function hw({surfaceTheme:a,basicDraft:b,basicTeamPreset:c,basicModelProfile:e,basicRules:f,basicPreset:g,resolvedName:h,resolvedTemplate:i,sourceAnalysis:j,workspacePath:k,onStepChange:l}){let m="light"===a,n="clone"===j.kind?e6.A:"website"===j.kind?e7.A:e8.A,o=[f.generateStarterDocs,f.generateMemory,f.kickoffMission].filter(Boolean).length;return(0,d.jsxs)("section",{className:s("rounded-[24px] border p-4 md:p-5",m?"border-[#e4ddd3] bg-white":"border-white/10 bg-white/[0.04]"),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:s("text-[10px] uppercase tracking-[0.2em]",m?"text-[#8b7262]":"text-slate-500"),children:"Step 3 \xb7 Review"}),(0,d.jsx)("p",{className:s("mt-1 text-[12px] leading-5",m?"text-[#70685f]":"text-slate-300"),children:"Check the final draft before creating the workspace."})]}),(0,d.jsx)(u,{variant:"success",children:"Ready"})]}),(0,d.jsxs)("div",{className:"mt-4 grid gap-2 sm:grid-cols-2",children:[(0,d.jsx)(hB,{surfaceTheme:a,label:"Name",value:h,icon:a2.A}),(0,d.jsx)(hB,{surfaceTheme:a,label:"Template",value:fA[i].label,icon:e9.A}),(0,d.jsx)(hB,{surfaceTheme:a,label:"Source",value:j.label,icon:n}),(0,d.jsx)(hB,{surfaceTheme:a,label:"Path",value:k,icon:e8.A,mono:!0}),(0,d.jsx)(hB,{surfaceTheme:a,label:"Team",value:fx.find(a=>a.value===c)?.label??c,icon:a7.A}),(0,d.jsx)(hB,{surfaceTheme:a,label:"Model",value:fy.find(a=>a.value===e)?.label??e,icon:e9.A})]}),(0,d.jsxs)("div",{className:s("mt-4 rounded-[20px] border p-3",m?"border-[#e8e0d6] bg-[#faf6f1]":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:s("text-[11px] uppercase tracking-[0.18em]",m?"text-[#8d8276]":"text-slate-500"),children:"Launch summary"}),(0,d.jsx)("p",{className:s("mt-1 text-[12px] leading-5",m?"text-[#766e64]":"text-slate-400"),children:"fastest"===g?"Fast path will keep the scaffold lean.":"custom"===g?"Custom bootstrap rules are active.":"Starter docs, memory, and kickoff are enabled."})]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsxs)(u,{variant:"muted",children:[o,"/3 rules"]}),(0,d.jsx)(x,{type:"button",variant:"secondary",size:"sm",onClick:()=>l("intake"),className:m?"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]",children:"Edit intake"}),(0,d.jsx)(x,{type:"button",variant:"secondary",size:"sm",onClick:()=>l("shape"),className:m?"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]",children:"Edit shape"})]})]}),(0,d.jsxs)("div",{className:"mt-3 grid gap-2 md:grid-cols-2",children:[(0,d.jsxs)("div",{className:s("rounded-[18px] border px-3 py-2.5",m?"border-[#e8e0d6] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsx)("p",{className:s("text-[10px] uppercase tracking-[0.16em]",m?"text-[#8d8276]":"text-slate-500"),children:"Goal"}),(0,d.jsx)("p",{className:s("mt-1 text-[13px] leading-6",m?"text-[#34281f]":"text-slate-200"),children:b.goal.trim()||"No goal provided yet."})]}),(0,d.jsxs)("div",{className:s("rounded-[18px] border px-3 py-2.5",m?"border-[#e8e0d6] bg-white":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsx)("p",{className:s("text-[10px] uppercase tracking-[0.16em]",m?"text-[#8d8276]":"text-slate-500"),children:"Source kind"}),(0,d.jsx)("p",{className:s("mt-1 text-[13px] leading-6",m?"text-[#34281f]":"text-slate-200"),children:"empty"===j.kind?"Fresh workspace":j.label})]})]})]})]})}function hx({surfaceTheme:a,title:b,summary:c,children:e}){let f="light"===a;return(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:s("text-[11px] uppercase tracking-[0.18em]",f?"text-[#8d8276]":"text-slate-500"),children:b}),(0,d.jsx)("p",{className:s("mt-1 text-[12px] leading-5",f?"text-[#766e64]":"text-slate-400"),children:c})]}),e]})}function hy({surfaceTheme:a,selected:b,title:c,description:e,icon:f,onClick:g,disabled:h=!1}){let i="light"===a;return(0,d.jsxs)("button",{type:"button",onClick:g,disabled:h,className:s("group flex h-full min-h-[90px] flex-col justify-between rounded-[18px] border p-3 text-left transition-colors",b?i?"border-[#1f1b17] bg-[#1f1b17] text-white":"border-cyan-300 bg-cyan-300/10 text-white":i?"border-[#e8e0d6] bg-[#faf6f1] text-[#171410] hover:border-[#d7c8ba] hover:bg-[#f6efe6]":"border-white/10 bg-white/[0.03] text-white hover:border-white/15 hover:bg-white/[0.05]",h&&"cursor-not-allowed opacity-70"),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,d.jsx)("span",{className:s("inline-flex size-8 shrink-0 items-center justify-center rounded-full border",b?"border-white/15 bg-white/10 text-white":i?"border-[#ddd3c5] bg-white text-[#5f564b]":"border-white/10 bg-white/[0.04] text-slate-200"),children:f}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[13px] font-medium",children:c}),(0,d.jsx)("p",{className:s("mt-0.5 text-[11px] leading-4",b?"text-current/80":i?"text-[#766e64]":"text-slate-400"),children:e})]})]}),b?(0,d.jsx)(u,{variant:i?"muted":"default",className:i?"bg-white text-[#3d342b]":"",children:"Selected"}):null]}),(0,d.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2",children:[(0,d.jsx)("span",{className:s("text-[10px] uppercase tracking-[0.16em]",b?"text-current/70":i?"text-[#8d8276]":"text-slate-500"),children:b?"Active choice":"Select"}),(0,d.jsx)("span",{className:s("inline-flex size-5 items-center justify-center rounded-full border",b?"border-white/15 bg-white/10 text-white":i?"border-[#d9cec2] bg-white text-transparent":"border-white/10 bg-transparent text-transparent"),children:(0,d.jsx)(n.A,{className:"h-3 w-3"})})]})]})}function hz({surfaceTheme:a,title:b,description:c,checked:e,onToggle:f,disabled:g=!1}){let h="light"===a;return(0,d.jsxs)("button",{type:"button",onClick:f,disabled:g,className:s("flex w-full items-start gap-3 rounded-[18px] border px-3 py-3 text-left transition-colors",h?"border-[#e8e0d6] bg-white":"border-white/10 bg-white/[0.03]",g?"cursor-not-allowed opacity-70":h?"hover:border-[#d7c8ba] hover:bg-[#f7f0e6]":"hover:border-white/15 hover:bg-white/[0.05]"),children:[(0,d.jsx)("span",{className:s("mt-0.5 inline-flex size-5 shrink-0 items-center justify-center rounded-md border",e?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,d.jsx)(n.A,{className:"h-3 w-3"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:s("text-[13px] font-medium",h?"text-[#171410]":"text-white"),children:b}),(0,d.jsx)("p",{className:s("mt-1 text-[12px] leading-5",h?"text-[#766e64]":"text-slate-400"),children:c})]})]})}function hA({surfaceTheme:a,active:b,title:c,description:e,disabled:f=!1,onClick:g}){let h="light"===a;return(0,d.jsx)("button",{type:"button",onClick:g,disabled:f,className:s("w-full rounded-[14px] border px-3 py-2 text-left transition-colors",b?h?"border-[#1f1b17] bg-[#1f1b17] text-white":"border-cyan-300 bg-cyan-300/15 text-cyan-50":h?"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]",f&&"cursor-not-allowed opacity-70"),children:(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,d.jsx)(e9.A,{className:"h-3.5 w-3.5 shrink-0"}),(0,d.jsx)("p",{className:"truncate text-[12px] font-medium",children:c})]}),(0,d.jsx)("p",{className:s("truncate text-right text-[11px] leading-4",b?"opacity-80":h?"text-[#776f65]":"text-slate-400"),children:e})]})})}function hB({surfaceTheme:a,label:b,value:c,icon:e,mono:f=!1}){let g="light"===a;return(0,d.jsx)("div",{className:s("rounded-[16px] border px-3 py-2.5",g?"border-[#e8e0d6] bg-white":"border-white/10 bg-white/[0.03]"),children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:s("inline-flex size-6 shrink-0 items-center justify-center rounded-full border",g?"border-[#e0d7cc] bg-[#faf6f1] text-[#615a52]":"border-white/10 bg-white/[0.05] text-slate-300"),children:(0,d.jsx)(e,{className:"h-3 w-3"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:s("text-[10px] uppercase tracking-[0.16em]",g?"text-[#8d8276]":"text-slate-500"),children:b}),(0,d.jsx)("p",{className:s("truncate text-[12px] font-medium leading-4",f&&"font-mono text-[12px]",g?"text-[#171410]":"text-white"),title:c,children:c})]})]})})}var hC=c(90314),hD=c(88255),hE=c(28442),hF=c(59154),hG=c(82150);function hH({snapshot:a,surfaceTheme:b,isCheckingForUpdates:c,updateRunState:e,lastCheckedAt:i,onCheckForUpdates:j,onOpenSetupWizard:k,onOpenUpdateDialog:l}){let[m,n]=(0,g.useState)(null),[p,q]=(0,g.useState)(null),[r,t]=(0,g.useState)(!1),[u,v]=(0,g.useState)(!1),w="running"===e,y=c2(a),z=!!(a.diagnostics.updateAvailable&&a.diagnostics.latestVersion),A=!!(a.diagnostics.version&&!a.diagnostics.latestVersion&&!a.diagnostics.updateError),B=c?"Checking update registry...":z?`Latest v${a.diagnostics.latestVersion}`:a.diagnostics.updateError?"Check failed":A?a.diagnostics.updateInfo?.trim()||"Registry status is still loading.":"Up to date",C=a.diagnostics.modelReadiness.resolvedDefaultModel||a.diagnostics.modelReadiness.defaultModel||"Not selected",D=function(a){let{diagnostics:b}=a,c="remote"===b.bindMode||b.configuredGatewayUrl?"Remote":"Local",d=b.rpcOk||b.loaded?"Online":"Offline";return`${c} / ${d}`}(a),E=!!(m&&!m.native.ok&&("auth"===m.native.kind||"scope-limited"===m.native.kind)),F=(0,g.useCallback)(async()=>{t(!0),q(null);try{n(await hK())}catch(a){q(a instanceof Error?a.message:"Unable to check Gateway auth status.")}finally{t(!1)}},[]),G=async()=>{v(!0),q(null);try{let a=await fetch("/api/settings/gateway",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"repairDeviceAccess"})});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"Gateway access could not be repaired.")}let b=await a.json();n(b.authStatus)}catch(a){q(a instanceof Error?a.message:"Unable to repair Gateway access.")}finally{v(!1)}};return(0,d.jsxs)("div",{role:"menu","aria-label":"System menu",className:s("absolute right-0 top-14 z-50 w-[336px] overflow-hidden rounded-[24px] border p-3 shadow-[0_24px_68px_rgba(40,28,20,0.22)] backdrop-blur-2xl","light"===b?"border-[#dfcfc2] bg-[#fffaf3]/96 text-[#2b211c]":"border-white/[0.10] bg-[#08101c]/98 text-slate-100 shadow-[0_28px_80px_rgba(0,0,0,0.48)]"),children:[(0,d.jsxs)("div",{className:s("rounded-[20px] border p-3.5",hM(b)),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2.5",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:s("text-[9px] uppercase tracking-[0.22em]",hN(b)),children:"OpenClaw"}),(0,d.jsxs)("div",{className:"mt-0.5 flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"font-display text-[1rem]",children:hL(a.diagnostics.health)}),(0,d.jsx)(hI,{health:a.diagnostics.health,surfaceTheme:b})]})]}),(0,d.jsxs)("div",{className:"text-right",children:[(0,d.jsx)("p",{className:s("text-[9px] uppercase tracking-[0.2em]",hN(b)),children:"Version"}),(0,d.jsxs)("p",{className:"mt-0.5 font-mono text-[11px]",children:["v",a.diagnostics.version||"unknown"]})]})]}),(0,d.jsx)("div",{className:s("mt-3 rounded-[18px] border p-3","light"===b?"border-[#eadbcf] bg-[#f9f1e8]/80":"border-white/[0.08] bg-[#101a2a]/92"),children:(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2.5",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:s("text-[9px] uppercase tracking-[0.18em]",hN(b)),children:"Updates"}),(0,d.jsx)("p",{className:"mt-0.5 text-[13px]",children:B})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)(x,{type:"button",size:"sm",variant:"secondary",onClick:()=>void j(),disabled:c||w,className:hO(b),children:[c?(0,d.jsx)(h.A,{className:"h-3 w-3 animate-spin"}):(0,d.jsx)(f.A,{className:"h-3 w-3"}),c?"Checking...":"Check"]}),z?(0,d.jsxs)(x,{type:"button",size:"sm",onClick:l,disabled:w,className:"rounded-full bg-emerald-600 px-2.5 text-[11px] text-white shadow-[0_12px_24px_rgba(16,185,129,0.24)] hover:bg-emerald-500",children:[(0,d.jsx)(hG.A,{className:"h-3 w-3"}),"Update"]}):null]})]})})]}),(0,d.jsxs)("div",{className:s("mt-2 rounded-[16px] border px-3 py-2","light"===b?"border-[#e6d7c9] bg-white text-[#6b5546]":"border-white/[0.08] bg-[#0f1826] text-slate-300"),children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em]",children:c?"Checking":"Registry"}),(0,d.jsx)("p",{className:"mt-1 text-[11px] leading-4",children:c?"Refreshing OpenClaw update registry...":a.diagnostics.updateInfo?.trim()||(i?`Last checked ${new Date(i).toLocaleTimeString()}.`:"No registry check run yet.")})]}),(0,d.jsxs)("div",{className:"mt-2.5 grid gap-1.5",children:[(0,d.jsx)(hJ,{surfaceTheme:b,icon:(0,d.jsx)(dW.A,{className:"h-3.5 w-3.5"}),label:"Gateway",value:D,detail:a.diagnostics.gatewayUrl||"No endpoint"}),(0,d.jsx)(hJ,{surfaceTheme:b,icon:(0,d.jsx)(a3.A,{className:"h-3.5 w-3.5"}),label:"Default model",value:C,wrapValue:!0,action:(0,d.jsx)(x,{asChild:!0,size:"sm",variant:"secondary",className:hO(b),children:(0,d.jsxs)(dT(),{href:"/settings#models",children:[(0,d.jsx)(ax.A,{className:"h-3 w-3"}),"Models"]})})}),(0,d.jsx)(hJ,{surfaceTheme:b,icon:y?(0,d.jsx)(c0.A,{className:"h-3.5 w-3.5"}):(0,d.jsx)(o.A,{className:"h-3.5 w-3.5"}),label:"Setup",value:y?"Ready":"Needs setup",action:(0,d.jsx)(x,{type:"button",size:"sm",variant:"secondary",onClick:()=>k(y?"system":void 0),className:hO(b),children:"Open"})})]}),E||p?(0,d.jsxs)("div",{className:s("mt-2.5 rounded-[18px] border p-2.5","light"===b?"border-amber-300/70 bg-amber-50/80 text-amber-950":"border-amber-300/20 bg-amber-300/10 text-amber-100"),children:[(0,d.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,d.jsx)(bW.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:"text-[13px] font-medium",children:"Gateway auth needs attention"}),(0,d.jsx)("p",{className:"mt-0.5 line-clamp-2 text-[11px] leading-4 opacity-80",children:p||m?.native.issue||"Native Gateway auth is not ready. Open Settings to repair access."})]})]}),(0,d.jsxs)("div",{className:"mt-2.5 flex items-center gap-1.5",children:[(0,d.jsxs)(x,{type:"button",size:"sm",variant:"secondary",onClick:()=>void F(),disabled:r||u,className:hO(b),children:[r?(0,d.jsx)(h.A,{className:"h-3 w-3 animate-spin"}):null,"Test"]}),m?.native.kind==="scope-limited"?(0,d.jsxs)(x,{type:"button",size:"sm",onClick:()=>void G(),disabled:r||u,className:"rounded-full bg-emerald-600 px-2.5 text-[11px] text-white hover:bg-emerald-500",children:[u?(0,d.jsx)(h.A,{className:"h-3 w-3 animate-spin"}):null,"Repair"]}):null,(0,d.jsx)(x,{asChild:!0,size:"sm",variant:"secondary",className:hO(b),children:(0,d.jsx)(dT(),{href:"/settings#gateway",children:"Open settings"})})]})]}):null,(0,d.jsxs)("div",{className:s("mt-2.5 grid grid-cols-2 gap-1.5 border-t pt-2.5","light"===b?"border-[#e6d7c9]":"border-white/[0.08]"),children:[(0,d.jsx)(x,{asChild:!0,variant:"secondary",className:hP(b),children:(0,d.jsxs)(dT(),{href:"/settings",children:[(0,d.jsx)(d_.A,{className:"h-3.5 w-3.5"}),"Control Center"]})}),(0,d.jsx)(x,{asChild:!0,variant:"secondary",className:hP(b),children:(0,d.jsxs)(dT(),{href:"/settings#diagnostics",children:[(0,d.jsx)(o.A,{className:"h-3.5 w-3.5"}),"Diagnostics"]})})]})]})}function hI({health:a,surfaceTheme:b}){return(0,d.jsxs)("span",{className:s("inline-flex items-center gap-1.5 rounded-full border px-2 py-1 text-[10px] uppercase tracking-[0.18em]","healthy"===a?"light"===b?"border-emerald-300 bg-emerald-50 text-emerald-700":"border-emerald-400/30 bg-emerald-400/10 text-emerald-200":"degraded"===a?"light"===b?"border-amber-300 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-100":"light"===b?"border-rose-300 bg-rose-50 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-100"),children:[(0,d.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}),hL(a)]})}function hJ({surfaceTheme:a,icon:b,label:c,value:e,detail:f,action:g,wrapValue:h=!1}){return(0,d.jsxs)("div",{className:s("flex items-center gap-3 rounded-[20px] border p-3",hM(a)),children:[(0,d.jsx)("span",{className:s("flex h-9 w-9 shrink-0 items-center justify-center rounded-full border","light"===a?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-cyan-300/15 bg-cyan-300/10 text-cyan-200"),children:b}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:s("text-[10px] uppercase tracking-[0.18em]",hN(a)),children:c}),(0,d.jsx)("p",{className:s("mt-1 text-sm font-medium",h?"break-words leading-4":"truncate"),title:e,children:e}),f?(0,d.jsx)("p",{className:s("mt-0.5",h?"break-words text-[11px] leading-4":"truncate text-xs",hN(a)),children:f}):null]}),g?(0,d.jsx)("div",{className:"shrink-0",children:g}):null]})}async function hK(){let a=await fetch("/api/settings/gateway",{method:"GET",cache:"no-store"});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"Unable to check Gateway auth status.")}return(await a.json()).authStatus}function hL(a){switch(a){case"healthy":return"Online";case"degraded":return"Degraded";default:return"Offline"}}function hM(a){return"light"===a?"border-[#e5d7c9] bg-[#fffaf4]/86 shadow-[0_18px_48px_rgba(119,91,70,0.08)]":"border-white/[0.08] bg-[#0d1624]/96"}function hN(a){return"light"===a?"text-[#8c7564]":"text-slate-400"}function hO(a){return s("h-8 rounded-full px-3 text-xs","light"===a?"border-[#dcc9bb] bg-[#fffaf3] text-[#5d493b] hover:bg-[#f3e7dc]":"border-white/10 bg-[#121d2d] text-slate-200 hover:bg-[#182538]")}function hP(a){return s("h-10 rounded-full text-xs","light"===a?"border-[#dcc9bb] bg-[#fffaf3] text-[#4d3c32] hover:bg-[#f3e7dc]":"border-white/10 bg-[#121d2d] text-slate-200 hover:bg-[#182538]")}function hQ({surfaceTheme:a}){return(0,d.jsxs)("div",{className:s("flex h-11 items-center gap-3 rounded-full border px-4 shadow-[0_18px_50px_rgba(0,0,0,0.24)] backdrop-blur-xl","light"===a?"border-[#d9c9bc]/90 bg-[#f8f5f0]/86 shadow-[0_18px_42px_rgba(161,125,101,0.14)]":"border-cyan-300/10 bg-slate-950/45"),children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:s("inline-flex h-7 w-7 items-center justify-center overflow-hidden rounded-[8px] border","light"===a?"border-[#d1bcad] bg-[#f5ece4]":"border-white/[0.08] bg-white/[0.03]"),children:(0,d.jsx)("video",{"aria-hidden":"true",autoPlay:!0,loop:!0,muted:!0,playsInline:!0,preload:"auto",className:"h-full w-full scale-[1.15] object-cover",children:(0,d.jsx)("source",{src:"/assets/logo.webm",type:"video/webm"})})}),(0,d.jsx)("p",{className:s("text-[10px] tracking-[0.18em]","light"===a?"text-[#8a7261]":"text-slate-500"),children:"AgentOS"})]}),(0,d.jsx)("span",{"aria-hidden":"true",className:s("h-4 w-px","light"===a?"bg-[#cdb7a8]/80":"bg-white/[0.08]")}),(0,d.jsx)("h2",{className:s("font-display text-[0.88rem]","light"===a?"text-[#816958]/80":"text-slate-400/75"),children:"Control Plane"})]})}function hR({settingsRef:a,isSettingsOpen:b,onToggleTheme:c,onToggleSettings:e,...f}){let{snapshot:g,surfaceTheme:h}=f,{onOpenSetupWizard:i}=f,j=g.diagnostics.health,k="offline"===j,l=function(a){switch(a){case"healthy":return"Online";case"degraded":return"Degraded";default:return"Offline"}}(j),m=s("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"===h?"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]"),n=s("relative inline-flex h-7 w-14 items-center rounded-full border transition-[background-color,border-color,transform] duration-150 active:scale-[0.98]","light"===h?"border-[#d0bcae] bg-[#eaded3] shadow-[inset_0_1px_0_rgba(255,255,255,0.55)] hover:bg-[#e3d5c8] hover:border-[#c8b09f] active:bg-[#d9c8ba]":"border-white/12 bg-white/[0.08] hover:bg-white/[0.12] hover:border-white/16 active:bg-white/[0.16]"),o=s("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"===h?"translate-x-7 bg-[#c8946f] text-white":"translate-x-0 bg-cyan-300 text-slate-950");return(0,d.jsx)("div",{className:"flex w-full items-center px-0 pt-6",children:(0,d.jsxs)("div",{ref:a,className:"pointer-events-auto relative ml-auto",children:[(0,d.jsxs)("div",{className:s("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"===h?"border-[#d9c9bc]/90 bg-[#f8f5f0]/86 shadow-[0_18px_42px_rgba(161,125,101,0.14)]":"border-cyan-300/10 bg-slate-950/45"),children:[(0,d.jsxs)("div",{className:"flex items-baseline gap-[3px]",children:[(0,d.jsx)("span",{className:s("text-[10px] uppercase tracking-[0.3em]","light"===h?"text-[#8a7261]":"text-slate-500"),children:"OPENCLAW"}),(0,d.jsxs)("span",{className:s("font-mono text-[8px] tracking-[0.04em]","light"===h?"text-[#6f5a4b]/85":"text-slate-300/80"),children:["v",g.diagnostics.version||"unknown"]})]}),k?(0,d.jsxs)(a6.P.button,{type:"button",onClick:()=>i(),title:"System is offline. Open the setup wizard.","aria-label":"System is offline. Open the setup wizard.",whileHover:{scale:1.03,y:-1},whileTap:{scale:.98},transition:{type:"spring",stiffness:420,damping:28},className:s("group relative inline-flex cursor-pointer select-none items-center gap-2 overflow-hidden rounded-full border px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.22em] transition-[background-color,border-color,color,box-shadow,transform] duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/40 focus-visible:ring-offset-2 focus-visible:ring-offset-transparent",hS(j,h),"light"===h?"shadow-[0_10px_24px_rgba(244,63,94,0.12)] hover:border-rose-300 hover:bg-rose-100 hover:text-rose-800":"shadow-[0_10px_24px_rgba(244,63,94,0.18)] hover:border-rose-300/40 hover:bg-rose-300/15 hover:text-rose-100"),children:[(0,d.jsx)(a6.P.span,{"aria-hidden":"true",className:s("pointer-events-none absolute inset-0 rounded-full","light"===h?"bg-[radial-gradient(circle_at_top,rgba(244,63,94,0.18),rgba(244,63,94,0))]":"bg-[radial-gradient(circle_at_top,rgba(251,113,133,0.18),rgba(251,113,133,0))]"),animate:{opacity:[.35,.65,.35],scale:[.98,1.02,.98]},transition:{duration:2.8,repeat:1/0,ease:"easeInOut"}}),(0,d.jsx)("span",{"aria-hidden":"true",className:s("relative z-10 h-2 w-2 rounded-full shadow-[0_0_12px_currentColor]",hT(j))}),(0,d.jsxs)("span",{className:"relative z-10 inline-flex items-center gap-1.5",children:[(0,d.jsx)("span",{children:l}),(0,d.jsx)("span",{className:s("rounded-full border px-1.5 py-0.5 text-[7px] uppercase tracking-[0.18em]","light"===h?"border-rose-300/40 bg-rose-100/70 text-rose-800":"border-rose-300/25 bg-rose-300/10 text-rose-100/90"),children:"Setup"}),(0,d.jsx)(hD.A,{className:"h-3 w-3 opacity-80 transition-transform duration-200 group-hover:-translate-y-0.5 group-hover:translate-x-0.5"})]})]}):(0,d.jsxs)("span",{className:s("inline-flex items-center gap-2 rounded-full border px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.22em]",hS(j,h)),children:[(0,d.jsx)("span",{"aria-hidden":"true",className:s("h-2 w-2 rounded-full shadow-[0_0_12px_currentColor]",hT(j))}),l]}),(0,d.jsx)("button",{type:"button",role:"switch","aria-label":"light"===h?"Switch to dark theme":"Switch to light theme","aria-checked":"light"===h,onClick:c,className:n,children:(0,d.jsx)("span",{className:o,children:"light"===h?(0,d.jsx)(hE.A,{className:"h-3 w-3"}):(0,d.jsx)(hF.A,{className:"h-3 w-3"})})}),(0,d.jsx)("button",{type:"button","aria-label":"Open settings","aria-expanded":b,"aria-haspopup":"menu",onClick:e,className:m,children:(0,d.jsx)(d_.A,{className:"h-3.5 w-3.5"})})]}),b?(0,d.jsx)(hH,{...f}):null]})})}function hS(a,b){switch(a){case"healthy":return"light"===b?"border-emerald-300/80 bg-emerald-50 text-emerald-700":"border-emerald-400/25 bg-emerald-400/10 text-emerald-200";case"degraded":return"light"===b?"border-amber-300/90 bg-amber-50 text-amber-700":"border-amber-300/25 bg-amber-300/10 text-amber-200";default:return"light"===b?"border-rose-300/80 bg-rose-50 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200"}}function hT(a){switch(a){case"healthy":return"bg-emerald-400";case"degraded":return"bg-amber-300";default:return"bg-rose-300"}}let hU=(0,hC.default)(async()=>{},{loadableGenerated:{modules:["components/mission-control/mission-control-shell.tsx -> @/components/mission-control/canvas"]},ssr:!1,loading:()=>(0,d.jsx)("div",{className:"h-full w-full"})}),hV=[4e3,8e3,15e3,3e4,45e3,6e4],hW=void 0===globalThis.window?g.useEffect:g.useLayoutEffect,hX={phase:"idle",previousModelId:null,nextModelId:null,message:null};function hY({initialSnapshot:a,mode:b="mission"}){var c;let h,i,j,k,l,{snapshot:m,connectionState:n,refresh:o,refreshSnapshot:p,setSnapshot:q}=function(a){let[b,c]=(0,g.useState)(a),[d,e]=(0,g.useState)("connecting"),f=async(a={})=>{let b=a.force?"/api/snapshot?force=true":"/api/snapshot",d=await fetch(b,{cache:"no-store"}),f=await d.json();return(0,g.startTransition)(()=>{c(a=>!function(a,b){let c=a.revision??0,d=b.revision??0;if(c!==d)return c>d;if("live"===b.mode&&"fallback"===a.mode)return!1;if("fallback"===b.mode&&"live"===a.mode)return!0;let e=Date.parse(a.generatedAt),f=Date.parse(b.generatedAt);return!!(Number.isNaN(e)||Number.isNaN(f))||e>=f}(f,a)?a:f),e("live")}),f};return{snapshot:b,connectionState:d,refresh:async()=>{await f()},refreshSnapshot:f,setSnapshot:c}}(a),[r,t]=(0,g.useState)(a.workspaces[0]?.id??null),[u,v]=(0,g.useState)(a.workspaces[0]?.id??null),[w,x]=(0,g.useState)(null),[y,z]=(0,g.useState)(null),[B,D]=(0,g.useState)(null),[E,F]=(0,g.useState)(!1),[G,H]=(0,g.useState)(0),[I,K]=(0,g.useState)("overview"),[L,N]=(0,g.useState)(null),[O,P]=(0,g.useState)(null),[Q,R]=(0,g.useState)([]),[S,T]=(0,g.useState)(null),[U,V]=(0,g.useState)([]),[W,X]=(0,g.useState)([]),[Y,Z]=(0,g.useState)([]),[$,_]=(0,g.useState)(null),[aa,ab]=(0,g.useState)(null),[ac,ad]=(0,g.useState)(null),[ae,af]=(0,g.useState)("idle"),[ag,ah]=(0,g.useState)(null),ai=(0,g.useRef)(new Map),[aj,ak]=(0,g.useState)(null),[al,am]=(0,g.useState)(!1),[an,ao]=(0,g.useState)(!1),[ap,ar]=(0,g.useState)(!1),[at,au]=(0,g.useState)(!1),[av,aw]=(0,g.useState)(null),[ax,az]=(0,g.useState)("idle"),[aA,aB]=(0,g.useState)(null),[aC,aD]=(0,g.useState)(null),[aE,aF]=(0,g.useState)("idle"),[aG,aH]=(0,g.useState)(null),[aI,aJ]=(0,g.useState)(null),[aK,aL]=(0,g.useState)(null),[aM,aN]=(0,g.useState)(""),[aO,aP]=(0,g.useState)(""),[aQ,aR]=(0,g.useState)("idle"),[aS,aT]=(0,g.useState)(null),aU=(0,g.useRef)(null),[aV,aW]=(0,g.useState)(()=>db(a)),[aX,aY]=(0,g.useState)(()=>dc(a)),[aZ,a$]=(0,g.useState)(()=>a.diagnostics.openClawBinarySelection),[a0,a1]=(0,g.useState)(!1),[a2,a3]=(0,g.useState)(!1),[a4,a5]=(0,g.useState)(!1),[a6,a7]=(0,g.useState)(!1),[a8,a9]=(0,g.useState)("idle"),[ba,bb]=(0,g.useState)(null),[bc,bd]=(0,g.useState)(null),[be,bf]=(0,g.useState)(""),[bg,bh]=(0,g.useState)(null),[bi,bj]=(0,g.useState)("idle"),[bk,bl]=(0,g.useState)(null),[bm,bn]=(0,g.useState)(null),[bo,bp]=(0,g.useState)(null),[bq,br]=(0,g.useState)(""),[bs,bt]=(0,g.useState)(null),[bu,bv]=(0,g.useState)(null),[bw,bx]=(0,g.useState)("system"),[by,bz]=(0,g.useState)(""),[bA,bB]=(0,g.useState)([]),[bC,bD]=(0,g.useState)("idle"),[bE,bF]=(0,g.useState)(null),[bG,bH]=(0,g.useState)(null),[bI,bK]=(0,g.useState)(null),[bL,bM]=(0,g.useState)(""),[bN,bO]=(0,g.useState)(null),[bP,bQ]=(0,g.useState)(null),[bR,bS]=(0,g.useState)(hX),[bT,bU]=(0,g.useState)(!1),[bV,bW]=(0,g.useState)(!1),[bX,bY]=(0,g.useState)(!1),[bZ,b$]=(0,g.useState)(!1),[b0,b1]=(0,g.useState)(null),[b2,b3]=(0,g.useState)(null),[b4,b5]=(0,g.useState)("dark"),[b6,b7]=(0,g.useState)(!1),[b8,b9]=(0,g.useState)("basic"),[ca,cb]=(0,g.useState)(null),[cc,cd]=(0,g.useState)(!1),[ce,cf]=(0,g.useState)(null),[cg,ch]=(0,g.useState)(!1),[ci,cj]=(0,g.useState)(null),[ck,cl]=(0,g.useState)(null),[cm,cn]=(0,g.useState)(null),[co,cp]=(0,g.useState)(null);(0,g.useRef)(null);let cq=(0,g.useRef)(null),cr=(0,g.useRef)(null),cs=(0,g.useRef)(null),cu=(0,g.useRef)(0),cv=(0,g.useRef)(null),cw=an&&"chat"===I?u:null,cx=(0,g.useMemo)(()=>(function(a,b){if(0===b.length)return a;let c=b.filter(b=>{var c,d;return c=a.tasks,d=b,!c.find(a=>{var b,c;let e;return b=a,c=d,!!(e=c.dispatchId?.trim())&&(b.dispatchId===e||b.key===`dispatch:${e}`)})}).map(a=>a.task);return 0===c.length?a:{...a,tasks:[...c,...a.tasks]}})(m,Q),[m,Q]),cy=(0,g.useMemo)(()=>Array.isArray(U)?U:[],[U]),cz=(0,g.useMemo)(()=>Array.isArray(W)?W:[],[W]),cA=(0,g.useMemo)(()=>Array.isArray(Y)?Y:[],[Y]),cB=(0,g.useCallback)((a,b="overview",c=null)=>{v(a),K(b),x(c)},[]),cC=(0,g.useRef)(null),cD=(0,g.useRef)(!1),cE=(0,g.useRef)(!1),cF=m.runtimes.filter(a=>("running"===a.status||"queued"===a.status)&&("string"!=typeof a.metadata.kind||"direct"!==a.metadata.kind)).length,cG=c1(m),cH=c2(m),cI=dd(m),cJ=(h=m.diagnostics.updateRoot?.trim()||null,i=m.diagnostics.updateInstallKind?.trim().toLowerCase()||null,k=function(a){let{root:b,installKind:c,packageManager:d}=a,e=d?.trim()||null;return"git"===c?"Git checkout":"package"===c?c3(b)?e?`Local prefix \xb7 ${e}`:"Local prefix":(c4(b),e?`${e} package`:"Package install"):c3(b)?e?`Local prefix \xb7 ${e}`:"Local prefix":c4(b)?e?`${e} package`:"Package install":e?`${e} package`:b?"Detected install":"Install unavailable"}({root:h,installKind:i,packageManager:j=m.diagnostics.updatePackageManager?.trim().toLowerCase()||null}),l=[],h&&l.push(`Install root: ${M(h)}`),j&&l.push(`Updater: ${j}`),0===l.length&&l.push("Install root unavailable."),{label:k,detail:l.join(" \xb7 "),root:h}),cK=(c=m).diagnostics.installed?c1(c)?dd(c)?{label:"Enter AgentOS",description:"OpenClaw is online. Runtime checks continue in the background."}:{label:"Continue setup",description:"Create the first AgentOS workspace and agent before entering the canvas."}:c.diagnostics.loaded?(!c.diagnostics.rpcOk,{label:"Start OpenClaw",description:"Start the local gateway and wait for RPC."}):{label:"Prepare local gateway",description:"Register and start the local gateway."}:{label:"Install OpenClaw",description:"Download the CLI and get AgentOS ready."},cL=cF>0||Q.length>0,cM=function(a,b={}){let c;return!!c1(a)&&(!!b.hasSeenMissionReady||!!b.modelSwitchSucceeded||(c=a.diagnostics.modelReadiness.resolvedDefaultModel||a.diagnostics.modelReadiness.defaultModel||null,dd(a)&&!!c))}(m,{hasSeenMissionReady:bZ,modelSwitchSucceeded:"success"===bR.phase}),cN=cG&&cH&&!cI,cO=!cL&&(!bT||cN)&&(!cH||cN)&&!cM||bX||bV,cP=cx.tasks.filter(a=>!r||a.workspaceId===r).filter(a=>c8(a,cy,cz,cA)).length,cQ=(0,g.useCallback)(a=>{let b=cx.tasks.filter(b=>b.workspaceId===a).filter(a=>!cA.includes(a.key));if(0===b.length)return;let c=b.every(a=>c8(a,cy,cz,cA)),d=new Set(b.map(a=>a.key)),e=new Set(b.flatMap(a=>a.runtimeIds));if(c){X(a=>a.filter(a=>!d.has(a))),V(a=>a.filter(a=>!e.has(a)));return}X(a=>Array.from(new Set([...a,...d]))),V(a=>Array.from(new Set([...a,...e])))},[cx.tasks,cy,cz,cA]),cR=(0,g.useCallback)(a=>{let b=cx.agents.find(b=>b.id===a);b&&(z(b=>b===a?null:a),t(b.workspaceId),cB(a))},[cB,cx.agents]),cS=(0,g.useCallback)((a,b)=>{let c=cx.agents.find(b=>b.id===a);c&&(t(c.workspaceId),ao(!0),cB(c.id,"overview",b))},[cB,cx.agents]),cT=(0,g.useCallback)((a,b)=>{let c=cx.agents.find(b=>b.id===a);c&&(t(c.workspaceId),cB(c.id),ab({requestId:`capabilities:${a}:${b}:${Date.now()}`,agentId:a,focus:b}))},[cB,cx.agents]),cU=(0,g.useCallback)(a=>{let b=cx.agents.find(b=>b.id===a);b&&(t(b.workspaceId),cB(b.id),cl({requestId:`model:${a}:${Date.now()}`,agentId:a}))},[cB,cx.agents]),cV=(0,g.useCallback)(a=>{ak(a),aU.current&&clearTimeout(aU.current),aU.current=setTimeout(()=>{aU.current=null,ak(null)},2400)},[]),cW=(0,g.useCallback)(a=>{a||cl(null)},[]),cX=(0,g.useCallback)(a=>{a||ab(null)},[]),cY=(0,g.useCallback)(a=>{if(!y)return;let b=cx.agents.find(b=>b.id===a);b&&(y!==a||r!==b.workspaceId||u!==a)&&(z(a),t(b.workspaceId),cB(a))},[r,y,cB,u,cx.agents]),cZ=(0,g.useCallback)(()=>{cD.current=!0},[]),c$=(0,g.useCallback)(a=>{if(a){cE.current=!1,F(!0);return}if(cD.current){cE.current=!0;return}cE.current=!1,F(!1)},[]),c_=(0,g.useCallback)(()=>{z(null),cB(r??cx.workspaces[0]?.id??null)},[r,cB,cx.workspaces]),c0=(0,g.useCallback)((a="basic")=>{cb(null),b9(a),b7(!0)},[]),c9=(0,g.useCallback)(a=>{cb(a),b9("advanced"),b7(!0)},[]),de=(0,g.useCallback)(a=>{b7(a),a||(cb(null),b9("basic"))},[]),dg=(0,g.useCallback)(a=>{a&&t(a),cd(!0)},[]),dh=(0,g.useCallback)(a=>{t(a),cB(a),cf(a)},[cB]),di=(0,g.useCallback)(a=>{a||cf(null)},[]);hW(()=>{let a=m.diagnostics.workspaceRoot;if(co===a||"fallback"===m.mode&&m.diagnostics.loaded&&!m.diagnostics.rpcOk)return;let b=`mission-control-active-workspace-id:${a}`,c=globalThis.localStorage?.getItem(b)??null,d=function(a,b,c=null){return"__all__"===b?null:b&&a.includes(b)?b:c&&a.includes(c)?c:a[0]??null}(m.workspaces.map(a=>a.id),c,r);d&&d!==r&&(t(d),v(d)),cp(a)},[r,co,m.diagnostics.loaded,m.diagnostics.rpcOk,m.diagnostics.workspaceRoot,m.mode,m.workspaces]);let dj=()=>{"running"!==a8&&(a9("idle"),bb(null),bd(null),bf(""),bh(null))},dk=()=>{bj("idle"),bl(null),bn(null),bp(null),br(""),bt(null),bv(null),bD("idle"),bF(null),bH(null),bK(null),bO(null),bQ(null),bM(""),bB([]),bz(""),bS(hX),bY(!1),b$(!1),aR("idle"),aT(null),cq.current=null},dl=a=>{bf(b=>{let c=`${b}${a}`;return c.length>4e4?c.slice(c.length-4e4):c})},dm=a=>{br(b=>{let c=`${b}${a}`;return c.length>4e4?c.slice(c.length-4e4):c})},dn=a=>{bM(b=>{let c=`${b}${a}`;return c.length>4e4?c.slice(c.length-4e4):c})},dp=a=>{aN(b=>{let c=`${b}${a}`;return c.length>4e4?c.slice(c.length-4e4):c})},dq=(0,g.useCallback)(a=>{let b=function(a){let b=a.diagnostics.modelReadiness.resolvedDefaultModel||a.diagnostics.modelReadiness.defaultModel||null;if(b&&a.diagnostics.modelReadiness.defaultModelReady)return b;let c=a.diagnostics.modelReadiness.recommendedModelId||null;return c&&a.workspaces.length>0?c:null}(a);b&&(cq.current=b,bz(a=>a.trim()?a:b))},[]),dr=(0,g.useCallback)(async a=>{let b=a??null;try{b=await p({force:!0})}catch{}return b&&(q(b),dq(b)),b},[dq,p,q]),ds=(0,g.useCallback)(async()=>{if(!ac||"running"===ae)return;let a="string"==typeof ac.metadata.optimisticRequestId?ac.metadata.optimisticRequestId:null,b=a?Q.find(b=>b.requestId===a):Q.find(a=>a.task.id===ac.id),c="string"==typeof ac.dispatchId?ac.dispatchId:b?.dispatchId??null;if(a&&!c){ai.current.get(a)?.abort(),ai.current.delete(a),R(b=>b.map(b=>b.requestId===a?{...b,task:c7(b.task,{status:"cancelled",subtitle:"Mission submission cancelled before dispatch.",bootstrapStage:"cancelled",feedEvent:{id:`${b.task.id}:cancelled:${Date.now()}`,kind:"warning",timestamp:new Date().toISOString(),title:"Dispatch cancelled",detail:"Mission submission cancelled before dispatch.",isError:!1}})}:b)),aq.o.success("Mission submission cancelled.",{description:ac.title}),ad(null),af("idle"),ah(null);return}af("running"),ah(null);try{let a=await fetch(`/api/tasks/${encodeURIComponent(ac.id)}/abort`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Aborted from AgentOS.",dispatchId:c})}),b=await a.json().catch(()=>null);if(!a.ok)throw Error(b?.error||b?.message||b?.summary||"Unable to abort task.");aq.o.success("Task abort requested.",{description:ac.title}),ad(null),af("idle"),await o()}catch(b){let a=b instanceof Error?b.message:"Unknown abort error.";af("error"),ah(a),aq.o.error("Task abort failed.",{description:a})}},[Q,o,ac,ae]),dt=a=>{a&&bB(a)},du=async()=>{if("running"===a8)return void a7(!0);let a=a=>{cv.current=aq.o.loading("Updating OpenClaw...",{id:cv.current??void 0,description:a,duration:1/0,action:{label:"View",onClick:()=>a7(!0)}})},b=(a,b)=>{let c={id:cv.current??void 0,description:b,duration:a?6e3:1e4,action:{label:"View details",onClick:()=>a7(!0)}};a?aq.o.success("OpenClaw updated.",c):aq.o.error("OpenClaw update failed.",c),cv.current=null},c=!1,d=a=>{if(dl(`
|
|
168
|
+
> ${a.message}
|
|
169
|
+
`),c)return;let b=a.stdout.trimEnd(),d=a.stderr.trimEnd();b&&dl(`
|
|
170
|
+
[stdout]
|
|
171
|
+
${b}
|
|
172
|
+
`),d&&dl(`
|
|
173
|
+
[stderr]
|
|
174
|
+
${d}
|
|
175
|
+
`)};a7(!0),a9("running"),bb("Starting OpenClaw update..."),bd(null),bf(""),bh(null),a("Starting OpenClaw update...");try{let e=await fetch("/api/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirmed:!0})});if(!e.ok){let a=await e.json().catch(()=>null);throw Error(a?.error||"OpenClaw update request failed.")}if(!e.body)throw Error("OpenClaw update did not return a readable stream.");let f=e.body.getReader(),g=new TextDecoder,h="",i=!1;for(;;){let{value:e,done:j}=await f.read();if(j)break;let k=(h+=g.decode(e,{stream:!0})).indexOf("\n");for(;k>=0;){let e=h.slice(0,k).trim();if(h=h.slice(k+1),e){let f=JSON.parse(e);"status"===f.type?(bb(f.message),dl(`
|
|
176
|
+
> ${f.message}
|
|
177
|
+
`),a(f.message)):"log"===f.type?(c=!0,dl(f.text)):(i=!0,d(f),bb(null),bd(f.message),a9(f.ok?"success":"error"),bh(f.manualCommand??null),f.snapshot&&q(f.snapshot),f.ok?b(!0,f.message):b(!1,f.message))}k=h.indexOf("\n")}}let j=h.trim();if(j){let a=JSON.parse(j);"done"===a.type&&(i=!0,d(a),bb(null),bd(a.message),a9(a.ok?"success":"error"),bh(a.manualCommand??null),a.snapshot&&q(a.snapshot),b(a.ok,a.message))}if(!i)throw Error("OpenClaw update stream ended unexpectedly.")}catch(a){a9("error"),bb(null),bd(a instanceof Error?a.message:"OpenClaw update failed."),b(!1,a instanceof Error?a.message:"Unknown update error.")}},dv=async()=>{bU(!1),dk(),bx("system"),bj("running"),bl("detecting"),bn("Checking local OpenClaw status..."),bp(null),bt(null),bv(null),br("");try{let a=await fetch("/api/onboarding",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intent:"auto"})});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"OpenClaw onboarding request failed.")}if(!a.body)throw Error("OpenClaw onboarding did not return a readable stream.");let b=a.body.getReader(),c=new TextDecoder,d="",e=!1;for(;;){let{value:a,done:f}=await b.read();if(f)break;let g=(d+=c.decode(a,{stream:!0})).indexOf("\n");for(;g>=0;){let a=d.slice(0,g).trim();if(d=d.slice(g+1),a){let b=JSON.parse(a);"status"===b.type?(bl(b.phase),bn(b.message),dm(`
|
|
178
|
+
> ${b.message}
|
|
179
|
+
`)):"log"===b.type?dm(b.text):(e=!0,bl(b.phase),bp(b.message),bt(b.manualCommand??null),bv(b.docsUrl??null),b.ok?(bn("Refreshing model status..."),await dr(b.snapshot??null)):(bn(null),b.snapshot&&q(b.snapshot)),bn(null),bj(b.ok?"success":"error"),b.ok?aq.o.success("System setup ready.",{description:b.message}):aq.o.error("OpenClaw onboarding failed.",{description:b.message}))}g=d.indexOf("\n")}}let f=d.trim();if(f){let a=JSON.parse(f);"done"===a.type&&(e=!0,bl(a.phase),bp(a.message),bt(a.manualCommand??null),bv(a.docsUrl??null),a.ok?(bn("Refreshing model status..."),await dr(a.snapshot??null)):(bn(null),a.snapshot&&q(a.snapshot)),bn(null),bj(a.ok?"success":"error"))}if(!e)throw Error("OpenClaw onboarding stream ended unexpectedly.")}catch(a){bj("error"),bn(null),bp(a instanceof Error?a.message:"OpenClaw onboarding failed."),aq.o.error("OpenClaw onboarding failed.",{description:a instanceof Error?a.message:"Unknown onboarding error."})}},dw=async(a,b={})=>{let c=b.timeoutMs?new AbortController:null,d=b.timeoutMs?globalThis.setTimeout(()=>c?.abort(),b.timeoutMs):null;try{let d=await fetch("/api/models/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"status",provider:a,includeSnapshot:b.includeSnapshot}),signal:c?.signal}),e=await d.json().catch(()=>null);if(!d.ok||!e)throw Error(e?.error||e?.message||"Provider status could not be loaded.");return e}finally{d&&globalThis.clearTimeout(d)}},dx=(a,b,c)=>{let d=A(a);cu.current+=1,bx("models"),bW(!0),bU(!1),bF("ready"),bH("Refreshing OpenClaw model status..."),bO(null),bQ(null),c?(q(c),dq(c)):dr(null),bH(null),bD("success"),bK(`${d.shortLabel} is connected. You can discover or add models now.`),dn(`
|
|
180
|
+
> ${d.shortLabel} connected. AgentOS refreshed OpenClaw model status.
|
|
181
|
+
`),aq.o.success(`${d.shortLabel} connected.`,{description:b||"AgentOS refreshed OpenClaw model status."})},dy=async a=>{let b=a.trim();if(!b)return!1;let c=cs.current;if(c?.command===b&&Date.now()-c.openedAt<12e4)return!1;try{let a=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:b})}),c=await a.json().catch(()=>null);if(!a.ok||c?.error)throw Error(c?.error||"Unable to open Terminal.");return cs.current={command:b,openedAt:Date.now()},aq.o.success("Terminal opened.",{description:"Finish provider auth there, then refresh models."}),!0}catch(a){return aq.o.error("Could not open Terminal.",{description:a instanceof Error?a.message:"Open Terminal manually and run the command."}),!1}},dz=async(a,b={})=>{var c,d;let e="discover"===(c=a.intent)?{statusMessage:"Scanning models...",successTitle:"Models discovered.",errorTitle:"Model discovery failed."}:"login-provider"===c?{statusMessage:"Checking auth...",successTitle:"Provider connected.",errorTitle:"Provider auth needs attention."}:"refresh"===c?{statusMessage:"Refreshing...",successTitle:"Model setup refreshed.",errorTitle:"Model refresh failed."}:"set-default"===c?{statusMessage:"Saving default model...",successTitle:"Default model saved.",errorTitle:"Default model save failed."}:{statusMessage:"Checking models...",successTitle:"Model setup ready.",errorTitle:"Model setup failed."},f=m.diagnostics.modelReadiness.resolvedDefaultModel||m.diagnostics.modelReadiness.defaultModel||null,g=b=>{"set-default"===a.intent&&(cr.current=aq.o.loading("Setting default model...",{id:cr.current??void 0,description:b,duration:1/0}))},h=(b,c,d)=>{if("set-default"!==a.intent)return!1;let e={id:cr.current??void 0,description:d,duration:"message"===b?1/0:6e3};return"success"===b?aq.o.success(c,e):"message"===b?aq.o.message(c,e):aq.o.error(c,e),cr.current=null,!0},i=!1,j=c=>{let d=b.verifyProvider??("login-provider"===a.intent?C(a.provider):null);b.autoOpenTerminal&&!i&&"done"===c.type&&"authenticating"===c.phase&&c.manualCommand&&(i=!0,dy(c.manualCommand).finally(()=>{d&&(a=>{let b=A(a),c=cu.current+1;for(let[d,e]of(cu.current=c,hV.entries()))globalThis.setTimeout(()=>{cu.current===c&&(async()=>{try{let e=await dw(a);if(cu.current!==c)return;if(e.connection.connected){cu.current+=1,dx(a,e.connection.detail,e.snapshot);return}d===hV.length-1&&(bH(null),bK(`Still waiting for ${b.shortLabel} auth. Finish the browser sign-in, then refresh models.`))}catch{d===hV.length-1&&bH(null)}})()},e)})(d)}))};b.forceOpen&&bW(!0),bU(!1),bx("models"),bD("running"),bF("refresh"===(d=a.intent)?"refreshing":"discover"===d?"discovering":"set-default"===d?"configuring-default":"detecting"),bH(e.statusMessage),bK(null),bO(null),bQ(null),bM(""),bS("set-default"===a.intent?{phase:"saving",previousModelId:f,nextModelId:a.modelId,message:e.statusMessage}:hX),g(e.statusMessage);try{let b=await fetch("/api/onboarding/models",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!b.ok){let a=await b.json().catch(()=>null);throw Error(a?.error||"Model onboarding request failed.")}if(!b.body)throw Error("Model onboarding did not return a readable stream.");let c=b.body.getReader(),d=new TextDecoder,i="",k=!1;for(;;){let{value:b,done:l}=await c.read();if(l)break;let m=(i+=d.decode(b,{stream:!0})).indexOf("\n");for(;m>=0;){let b=i.slice(0,m).trim();if(i=i.slice(m+1),b){let c=JSON.parse(b);"status"===c.type?(bF(c.phase),bH(c.message),dn(`
|
|
182
|
+
> ${c.message}
|
|
183
|
+
`),"set-default"===a.intent&&(g(c.message),bS({phase:"saving",previousModelId:f,nextModelId:a.modelId,message:c.message}))):"log"===c.type?dn(c.text):(k=!0,bF(c.phase),bH(null),bK(c.message),bO(c.manualCommand??null),bQ(c.docsUrl??null),bD(c.ok?"success":"error"),j(c),dt(c.discoveredModels),"set-default"===a.intent&&bS({phase:c.ok?"success":"error",previousModelId:f,nextModelId:a.modelId,message:c.message}),c.snapshot&&q(c.snapshot),c.ok?(h("success",e.successTitle,c.message)||aq.o.success(e.successTitle,{description:c.message}),"set-default"===a.intent&&bY(!0)):"authenticating"===c.phase&&c.manualCommand?h("message","Continue in terminal.",c.message)||aq.o.message("Continue in terminal.",{description:c.message}):h("error",e.errorTitle,c.message)||aq.o.error(e.errorTitle,{description:c.message}))}m=i.indexOf("\n")}}let l=i.trim();if(l){let b=JSON.parse(l);"done"===b.type&&(k=!0,bF(b.phase),bH(null),bK(b.message),bO(b.manualCommand??null),bQ(b.docsUrl??null),bD(b.ok?"success":"error"),j(b),dt(b.discoveredModels),"set-default"===a.intent&&bS({phase:b.ok?"success":"error",previousModelId:f,nextModelId:a.modelId,message:b.message}),b.snapshot&&q(b.snapshot),b.ok?h("success",e.successTitle,b.message):"authenticating"===b.phase&&b.manualCommand?h("message","Continue in terminal.",b.message):h("error",e.errorTitle,b.message),b.ok&&"set-default"===a.intent&&bY(!0))}if(!k)throw Error("Model onboarding stream ended unexpectedly.")}catch(c){"set-default"===a.intent&&bS({phase:"error",previousModelId:f,nextModelId:a.modelId,message:c instanceof Error?c.message:"Default model save failed."});let b=c instanceof Error?c.message:"Unknown model onboarding error.";bD("error"),bH(null),bK(c instanceof Error?c.message:"Model onboarding failed."),h("error",e.errorTitle,b)||aq.o.error(e.errorTitle,{description:b})}},dA=async()=>{await dz({intent:"refresh"})},dB=async()=>{await dz({intent:"discover"})},dC=async(a,b={})=>{let c=C(a);if(!c)return void aq.o.error("Unknown model provider.",{description:"AgentOS could not match this auth request to a supported provider."});bW(!0);let d=m.diagnostics.modelReadiness.authProviders.find(a=>a.provider===c);if(d?.connected)return void dx(c,d.detail,m);try{let a=await dw(c,{timeoutMs:2500});if(a.connection.connected)return void dx(c,a.connection.detail,a.snapshot)}catch{}await dz({intent:"login-provider",provider:c},{forceOpen:!0,verifyProvider:c,...b})},dD=async a=>{let b=a||by,c=m.diagnostics.modelReadiness.resolvedDefaultModel||m.diagnostics.modelReadiness.defaultModel||null;!b||c&&b.trim()===c.trim()||await dz({intent:"set-default",modelId:b})},dE=(0,g.useCallback)(()=>{bW(!1),bY(!1),bU(!0),aR("idle"),aT(null)},[]),dF=(0,g.useCallback)(async()=>{if("running"===aQ)return null;let a=by.trim()||m.diagnostics.modelReadiness.resolvedDefaultModel||m.diagnostics.modelReadiness.defaultModel||null;if(!a)return aq.o.error("Choose a model first.",{description:"OpenClaw needs a usable default model before it can create the first workspace."}),null;aR("running"),aT(g2(g1({sourceMode:"empty",agentCount:1,kickoffMission:!0})));try{let b=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"AgentOS Workspace",brief:"First workspace created from the AgentOS launchpad.",modelId:a,sourceMode:"empty",template:"software",teamPreset:"solo",modelProfile:"balanced",rules:{workspaceOnly:!0,generateStarterDocs:!0,generateMemory:!0,kickoffMission:!0},stream:!0})});if(!b.ok){let a=await b.json().catch(()=>null);throw Error(a?.error||"OpenClaw could not create the workspace.")}let c=null,d=null;if(await b_(b,async a=>{"progress"===a.type?aT(a.progress):(a.progress&&aT(a.progress),a.ok?c=a.result:d=a.error)}),d||!c)throw Error(d||"OpenClaw could not create the workspace.");let e=c;aR("success");let f=await p({force:!0}).catch(()=>null),g=f?.workspaces.some(a=>a.id===e.workspaceId)?e.workspaceId:f?.workspaces[0]?.id??e.workspaceId;return cn(g),t(g),cB(g),f?q(f):await o().catch(()=>{}),dE(),aq.o.success("Workspace created.",{description:`${e.agentIds.length} agent${1===e.agentIds.length?"":"s"} created at ${e.workspacePath}`}),e.kickoffError&&aq.o.message("Workspace created, but kickoff needs attention.",{description:e.kickoffError}),e}catch(b){aR("error");let a=b instanceof Error?b.message:"Unknown workspace error.";return aq.o.error("Workspace creation failed.",{description:a}),null}},[dE,aQ,o,p,by,cB,m.diagnostics.modelReadiness.defaultModel,m.diagnostics.modelReadiness.resolvedDefaultModel,q]),dG=a=>{let b=c1(m);ar(!1),bx(a??(b?"models":"system")),bU(!1),bY(void 0===a&&cM),bW(!0)},dH=()=>{bW(!1),bY(!1),bU(!0),ar(!0)},dI=(0,g.useCallback)(()=>{if(!dd(m))return void dF();let a=(r&&m.workspaces.some(a=>a.id===r)?r:m.workspaces[0]?.id)??null;a&&(t(a),cn(null),cB(a)),dE()},[r,dE,dF,cB,m]),dJ=async a=>{b1(a);try{let b=await fetch("/api/gateway/control",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:a})}),c=await b.json();if(!b.ok||c.error||!c.snapshot)throw Error(c.error||"Gateway control request failed.");q(c.snapshot),aq.o.success("Gateway updated.",{description:c.message||"Gateway state changed."})}catch(a){aq.o.error("Gateway action failed.",{description:a instanceof Error?a.message:"Unknown gateway control error."})}finally{b1(null)}},dK=a=>{cj(C(a)),ch(!0)},dM=async()=>{au(!0);try{let a=await p({force:!0}),b=Date.now(),c=a.diagnostics.updateInfo?.trim(),d=!!a.diagnostics.version&&!a.diagnostics.latestVersion&&!a.diagnostics.updateError;if(b3(b),!a.diagnostics.installed)return void aq.o.message("OpenClaw is unavailable.",{description:a.diagnostics.issues[0]||"AgentOS is running in fallback mode."});if(a.diagnostics.updateAvailable)return void aq.o.message("Update available.",{description:c||`v${a.diagnostics.latestVersion} is available. Current version: v${a.diagnostics.version||"unknown"}.`});if(d)return void aq.o.message("Update registry is still loading.",{description:c||`Running v${a.diagnostics.version||"unknown"}. OpenClaw has not reported a latest release yet.`});if(a.diagnostics.latestVersion&&!a.diagnostics.version)return void aq.o.message("Update status refreshed.",{description:c||`Latest available version: v${a.diagnostics.latestVersion}.`});if(a.diagnostics.updateError)return void aq.o.error("Update check could not reach the registry.",{description:c||a.diagnostics.updateError});aq.o.success("OpenClaw is up to date.",{description:c||`Current version: v${a.diagnostics.version||"unknown"}. No newer release was reported.`})}catch(a){aq.o.error("Update check failed.",{description:a instanceof Error?a.message:"Unable to refresh OpenClaw status."})}finally{au(!1)}},dN=async a=>{a1(!0);try{let b=await fetch("/api/settings/gateway",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({gatewayUrl:a})});if(!b.ok){let a=await b.json().catch(()=>null);throw Error(a?.error||"Gateway settings could not be updated.")}let c=await b.json();q(c.snapshot),aW(db(c.snapshot)),aq.o.success("Gateway updated.",{description:a?.trim()?`AgentOS now targets ${c.snapshot.diagnostics.configuredGatewayUrl||c.snapshot.diagnostics.gatewayUrl}.`:"AgentOS reverted to the local default gateway."})}catch(a){aq.o.error("Gateway update failed.",{description:a instanceof Error?a.message:"Unable to update the OpenClaw gateway."})}finally{a1(!1)}},dO=async a=>{a3(!0);try{let b=await fetch("/api/settings/workspace-root",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceRoot:a})});if(!b.ok){let a=await b.json().catch(()=>null);throw Error(a?.error||"Workspace root could not be updated.")}let c=await b.json();q(c.snapshot),aY(dc(c.snapshot)),aq.o.success("Workspace root updated.",{description:a?.trim()?`New workspaces will default to ${M(c.snapshot.diagnostics.workspaceRoot)}. Existing workspaces stay where they are.`:"AgentOS reverted to the default workspace root. Existing workspaces were not moved."})}catch(a){aq.o.error("Workspace root update failed.",{description:a instanceof Error?a.message:"Unable to update the default workspace root."})}finally{a3(!1)}},dQ=(0,g.useCallback)((a,b)=>{switch(a){case"auto":return{mode:"auto",path:null,resolvedPath:null,label:"Auto",detail:"Use the managed resolution order."};case"local-prefix":return{mode:"local-prefix",path:null,resolvedPath:null,label:"Local prefix",detail:"Use the managed local prefix install."};case"global-path":return{mode:"global-path",path:null,resolvedPath:null,label:"Global PATH",detail:"Resolve the first executable named openclaw on PATH when saved."};default:{let a="string"==typeof b?b.trim():"";return{mode:"custom",path:a||null,resolvedPath:a||null,label:"Custom path",detail:a||"Enter an absolute path to an executable OpenClaw binary."}}}},[]),dR=(0,g.useCallback)(a=>{a$(b=>a===b.mode?"custom"===a?dQ(a,b.path):b:"custom"===a?dQ(a,b.path):dQ(a))},[dQ]),dS=(0,g.useCallback)(a=>{a$(dQ("custom",a))},[dQ]),dT=()=>{if(void 0===globalThis.localStorage)return;let a=["mission-control-active-workspace-id:","mission-control-node-positions:v2:","mission-control-composer-draft:","mission-control-agent-chat:v1:","mission-control-agent-chat-seen:v1:"];for(let a of["mission-control-surface-theme","mission-control-hidden-runtime-ids","mission-control-hidden-task-keys","mission-control-locked-task-keys","mission-control-workspace-plan-id","mission-control-recent-prompts","mission-control-node-positions"])globalThis.localStorage.removeItem(a);for(let b=globalThis.localStorage.length-1;b>=0;b-=1){let c=globalThis.localStorage.key(b);c&&a.some(a=>c.startsWith(a))&&globalThis.localStorage.removeItem(c)}V([]),X([]),Z([])},dU=()=>{az("idle"),aB(null),aD(null),aF("idle"),aH(null),aJ(null),aL(null),aN(""),aP("")},dV=async a=>{az("loading"),aB(null),aD(null);try{let b=await fetch("/api/reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intent:"preview",target:a})}),c=await b.json().catch(()=>null);if(!b.ok||!c?.preview)throw Error(c?.error||"Reset preview could not be loaded.");aB(c.preview),az("ready")}catch(a){az("error"),aD(a instanceof Error?a.message:"Reset preview failed.")}},dW=async a=>{ar(!1),aw(a),dU(),await dV(a)},dX=async()=>{if(av){aF("running"),aH("full-uninstall"===av?"Starting full uninstall...":"Starting AgentOS reset..."),aJ(null),aL(null),aN("");try{let a=await fetch("/api/reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intent:"execute",target:av,confirmed:!0})});if(!a.ok){let b=await a.json().catch(()=>null);throw Error(b?.error||"Reset request failed.")}if(!a.body)throw Error("Reset request did not return a readable stream.");let b=a.body.getReader(),c=new TextDecoder,d="",e=!1;for(;;){let{value:a,done:f}=await b.read();if(f)break;let g=(d+=c.decode(a,{stream:!0})).indexOf("\n");for(;g>=0;){let a=d.slice(0,g).trim();if(d=d.slice(g+1),a){let b=JSON.parse(a);"status"===b.type?(aH(b.message),dp(`
|
|
184
|
+
> ${b.message}
|
|
185
|
+
`)):"log"===b.type?dp(`${b.text}
|
|
186
|
+
`):(e=!0,aH(null),aJ(b.message),aL(b.backgroundLogPath??null),aF(b.ok?"success":"error"),b.snapshot&&q(b.snapshot),b.ok?("full-uninstall"===av&&dk(),dT(),aq.o.success("full-uninstall"===av?"Full uninstall started.":"AgentOS reset completed.",{description:b.message})):aq.o.error("full-uninstall"===av?"Full uninstall failed.":"AgentOS reset failed.",{description:b.message}))}g=d.indexOf("\n")}}let f=d.trim();if(f){let a=JSON.parse(f);"done"===a.type&&(e=!0,aH(null),aJ(a.message),aL(a.backgroundLogPath??null),aF(a.ok?"success":"error"),a.snapshot&&q(a.snapshot),a.ok&&("full-uninstall"===av&&dk(),dT()))}if(!e)throw Error("Reset stream ended unexpectedly.")}catch(a){aF("error"),aH(null),aJ(a instanceof Error?a.message:"Reset failed."),aq.o.error("full-uninstall"===av?"Full uninstall failed.":"AgentOS reset failed.",{description:a instanceof Error?a.message:"Unknown reset error."})}}},dY=a=>{a||"running"!==aE&&(aw(null),dU())},dZ=()=>{aw(null),dU(),dG("system")},d$=()=>{bn("Refreshing model status..."),dr(m).catch(()=>{}).finally(()=>{bn(null),bx("models")})},d_={snapshot:m,surfaceTheme:b4,connectionState:n,gatewayDraft:aV,workspaceRootDraft:aX,isSavingGateway:a0,isSavingWorkspaceRoot:a2,isCheckingForUpdates:at,updateRunState:a8,selectedModelId:by,modelOnboardingRunState:bC,gatewayControlAction:b0,lastCheckedAt:b2,onGatewayDraftChange:aW,onWorkspaceRootDraftChange:aY,onSelectedModelIdChange:bz,onSaveGatewaySettings:dN,onSaveWorkspaceRootSettings:dO,onCheckForUpdates:dM,onControlGateway:dJ,onOpenSetupWizard:dG,onRunModelRefresh:dA,onRunModelSetDefault:dD,onOpenAddModels:dK,onOpenUpdateDialog:()=>{"idle"===a8&&dj(),a7(!0)},onOpenResetDialog:a=>{dW(a)},openClawBinarySelection:aZ,isSavingOpenClawBinary:a4,onOpenClawBinarySelectionModeChange:dR,onOpenClawBinarySelectionPathChange:dS,onSaveOpenClawBinarySettings:async a=>{a5(!0);try{let b=await fetch("/api/settings/openclaw-binary",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!b.ok){let a=await b.json().catch(()=>null);throw Error(a?.error||"OpenClaw binary selection could not be updated.")}let c=await b.json();q(c.snapshot),a$(c.selection);let d=c.selection.label||"OpenClaw binary";aq.o.success("OpenClaw binary updated.",{description:"auto"===c.selection.mode?"AgentOS will use the managed resolution order.":`${d} is now the active choice.`})}catch(a){aq.o.error("OpenClaw binary update failed.",{description:a instanceof Error?a.message:"Unable to update the OpenClaw binary."})}finally{a5(!1)}},installSummary:cJ},d0=(0,d.jsxs)(d.Fragment,{children:[cO?(0,d.jsx)(dL,{snapshot:m,surfaceTheme:b4,stage:bw,showReadyState:bX,systemActionLabel:cK.label,systemActionDescription:cK.description,systemPhase:bk,modelPhase:bE,systemRun:{runState:bi,statusMessage:bm,resultMessage:bo,log:bq,manualCommand:bs,docsUrl:bu},modelRun:{runState:bC,statusMessage:bG,resultMessage:bI,log:bL,manualCommand:bN,docsUrl:bP},modelSwitchFeedback:bR,selectedModelId:by,discoveredModels:bA,onSelectedModelIdChange:bz,onClearModelSwitchFeedback:()=>bS(hX),onRunSystemSetup:dv,onRunModelSetDefault:dD,onOpenAddModels:dK,onOpenGatewayAuthSettings:dH,onEnterAgentOS:dI,onCreateWorkspace:dF,onContinueToModels:d$,onBackToSystem:()=>bx("system"),onSelectStage:a=>{bY(!1),bx(a)},launchpadCreateProgress:aS,launchpadCreateRunState:aQ}):null,(0,d.jsx)(hl,{open:b6,onOpenChange:de,initialMode:b8,workspaceEditId:ca,surfaceTheme:b4,snapshot:m,onRefresh:o,onWorkspaceCreated:a=>{cn(a),t(a),cB(a)},onWorkspaceUpdated:a=>{cn(a),t(a),cB(a)}},ca?`workspace-edit:${ca}`:"workspace-create"),(0,d.jsx)(as,{open:cg,onOpenChange:ch,snapshot:m,initialProvider:ci,onSnapshotChange:q}),(0,d.jsx)(dP,{open:null!==av,target:av,surfaceTheme:b4,previewState:ax,preview:aA,previewError:aC,runState:aE,statusMessage:aG,resultMessage:aI,backgroundLogPath:aK,log:aM,confirmText:aO,onConfirmTextChange:aP,onRefreshPreview:()=>{av&&dV(av)},onExecute:()=>{dX()},onBackToSetup:dZ,onOpenChange:dY}),(0,d.jsx)(df,{snapshot:m,surfaceTheme:b4,isInspectorOpen:!1,taskAbortRequest:ac,taskAbortRunState:ae,taskAbortMessage:ag,onTaskAbortOpenChange:a=>{"running"!==ae&&(a||(ad(null),af("idle"),ah(null)))},onTaskAbortConfirm:()=>{ds()},updateDialogOpen:a6,updateRunState:a8,updateStatusMessage:ba,updateResultMessage:bc,updateLog:be,updateManualCommand:bg,activeRuntimeCount:cF,updateInstallSummary:cJ,onUpdateDialogOpenChange:a=>{"running"===a8?a7(a):(a7(a),a||dj())},onRunOpenClawUpdate:()=>{du()}})]});return"settings"===b?(0,d.jsxs)("div",{className:s("mission-shell relative min-h-screen overflow-hidden","light"===b4&&"mission-shell--light"),children:[(0,d.jsx)("div",{className:"mission-canvas-backdrop fixed inset-0 z-0",children:(0,d.jsx)("div",{"aria-hidden":"true",className:"mission-canvas-pattern absolute inset-0 z-0"})}),(0,d.jsx)("div",{className:"pointer-events-auto fixed left-0 top-0 z-30 hidden h-[100dvh] w-[360px] overflow-visible lg:block",children:(0,d.jsx)(er,{snapshot:cx,surfaceTheme:b4,activeWorkspaceId:r,requestedAgentAction:$,connectionState:n,collapsed:!1,settingsMode:!0,modelManager:{runState:bC,statusMessage:bG,resultMessage:bI,log:bL,manualCommand:bN,docsUrl:bP,discoveredModels:bA,systemReady:cG},onToggleCollapsed:()=>am(a=>!a),onSelectWorkspace:a=>{z(null),t(a),cB(a)},onRefresh:o,onRunModelRefresh:dA,onRunModelDiscover:dB,onRunModelSetDefault:dD,onConnectModelProvider:dC,onOpenModelSetup:()=>dG(),onOpenAddModels:dK,onEditWorkspace:c9,onSnapshotChange:q,onAgentCreatedVisible:cV})}),(0,d.jsx)(d2,{...d_}),(0,d.jsx)("div",{className:"pointer-events-none fixed top-0 z-40 hidden lg:left-[384px] lg:right-[84px] lg:block",children:(0,d.jsx)(hR,{settingsRef:cC,isSettingsOpen:ap,onToggleTheme:()=>b5(a=>"light"===a?"dark":"light"),onToggleSettings:()=>ar(a=>!a),...d_})}),d0]}):(0,d.jsxs)("div",{className:s("mission-shell relative min-h-screen overflow-hidden","light"===b4&&"mission-shell--light"),children:[(0,d.jsxs)("div",{className:"mission-canvas-backdrop absolute inset-0 z-0",children:[(0,d.jsx)("div",{"aria-hidden":"true",className:"mission-canvas-pattern absolute inset-0 z-0"}),(0,d.jsx)("div",{className:"absolute inset-0 z-10",children:(0,d.jsx)(hU,{snapshot:cx,activeWorkspaceId:r,selectedNodeId:u,focusedAgentId:y,recentCreatedAgentId:aj,composerTargetAgentId:B,activeChatAgentId:cw,isComposerActive:E,composerViewportResetNonce:G,recentDispatchId:O,hiddenRuntimeIds:U,hiddenTaskKeys:W,lockedTaskKeys:Y,onToggleWorkspaceTaskCards:cQ,className:"rounded-none",onEditAgent:a=>{cB(a),_({requestId:`edit:${a}:${Date.now()}`,kind:"edit",agentId:a})},onDeleteAgent:a=>{cB(a),_({requestId:`delete:${a}:${Date.now()}`,kind:"delete",agentId:a})},onFocusAgent:cR,onConfigureAgentModel:cU,onConfigureAgentCapabilities:cT,onInspectAgentDetail:cS,onOpenWorkspaceChannels:dg,onOpenWorkspaceFiles:dh,onMessageAgent:a=>{let b=cx.agents.find(b=>b.id===a);b&&(_(null),t(b.workspaceId),cB(a,"chat"),ao(!0))},onReplyTask:a=>{let b=c5(a);T({id:`reply:${a.id}:${Date.now()}`,mission:b,agentId:a.primaryAgentId,sourceKind:"reply",sourceLabel:a.title.trim()||a.subtitle.trim()||a.id})},onCopyTaskPrompt:async a=>{let b=c5(a);T({id:`copy:${a.id}:${Date.now()}`,mission:b,agentId:a.primaryAgentId,sourceKind:"copy",sourceLabel:a.title.trim()||a.subtitle.trim()||a.id});try{await navigator.clipboard.writeText(b),aq.o.success("Prompt copied to clipboard.",{description:"The mission input was also populated."})}catch{aq.o.message("Prompt moved into mission input.",{description:"Clipboard access was not available."})}},onHideTask:a=>{cA.includes(a.key)||(X(b=>b.includes(a.key)?b:[...b,a.key]),V(b=>{let c=new Set(b);return a.runtimeIds.forEach(a=>c.add(a)),Array.from(c)}))},onToggleTaskLock:a=>{Z(b=>{let c=Array.isArray(b)?b:[];return c.includes(a.key)?c.filter(b=>b!==a.key):[...c,a.key]})},onAbortTask:a=>{c6(a)&&(ad(a),af("idle"),ah(null))},onInspectTask:(a,b)=>{cB(a.id,b),ao(!0)},onSelectNode:a=>{cB(a)},onCanvasNodePointerDownCapture:cZ})})]}),(0,d.jsx)("div",{className:s("pointer-events-none absolute top-0 z-40 hidden lg:block",al?"lg:left-[384px]":"lg:left-[84px]",an?"lg:right-[426px]":"lg:right-[84px]"),children:(0,d.jsx)(hR,{settingsRef:cC,isSettingsOpen:ap,onToggleTheme:()=>b5(a=>"light"===a?"dark":"light"),onToggleSettings:()=>ar(a=>!a),...d_})}),(0,d.jsxs)("div",{className:"relative z-20 min-h-screen pointer-events-none lg:h-screen",children:[(0,d.jsx)("div",{className:"pointer-events-none absolute left-1/2 top-4 z-30 -translate-x-1/2 lg:hidden",children:(0,d.jsx)(hQ,{surfaceTheme:b4})}),(0,d.jsx)("div",{className:"pointer-events-none absolute left-[84px] top-6 z-10 hidden lg:block",children:(0,d.jsx)(hQ,{surfaceTheme:b4})}),(0,d.jsx)("div",{className:s("pointer-events-auto absolute left-0 top-0 z-30 h-[100dvh] overflow-visible mission-ease-smooth transition-[width] duration-500",al?"w-[calc(100vw-96px)] max-w-[280px] lg:w-[360px] lg:max-w-none":"w-[60px]"),children:(0,d.jsx)(er,{snapshot:cx,surfaceTheme:b4,activeWorkspaceId:r,requestedAgentAction:$,connectionState:n,collapsed:!al,modelManager:{runState:bC,statusMessage:bG,resultMessage:bI,log:bL,manualCommand:bN,docsUrl:bP,discoveredModels:bA,systemReady:cG},onToggleCollapsed:()=>am(a=>!a),onSelectWorkspace:a=>{z(null),t(a),cB(a)},onRefresh:o,onRunModelRefresh:dA,onRunModelDiscover:dB,onRunModelSetDefault:dD,onConnectModelProvider:dC,onOpenModelSetup:()=>dG(),onOpenAddModels:dK,onEditWorkspace:c9,onSnapshotChange:q,onAgentCreatedVisible:cV})}),(0,d.jsx)("div",{className:s("pointer-events-auto absolute right-0 top-0 z-30 h-[100dvh] overflow-visible mission-ease-smooth transition-[width] duration-500",an?"w-[calc(100vw-112px)] max-w-[300px] lg:w-[394px] lg:max-w-none":"w-[60px]"),children:(0,d.jsx)(ct,{snapshot:cx,surfaceTheme:b4,selectedNodeId:u,agentDetailFocus:w,lastMission:L,onRefresh:o,onSnapshotChange:q,onConfigureAgentCapabilities:cT,onConnectModelProvider:a=>{dC(a,{autoOpenTerminal:!0})},collapsed:!an,onToggleCollapsed:()=>ao(a=>!a),activeTab:I,onActiveTabChange:K,onAbortTask:a=>{c6(a)&&(ad(a),af("idle"),ah(null))}})}),(0,d.jsx)(a_,{open:!!aa,agentId:aa?.agentId??null,initialFocus:aa?.focus??"skills",snapshot:cx,onOpenChange:cX,onSnapshotChange:a=>q(a),onRefresh:o}),(0,d.jsx)(ay,{open:!!ck,agentId:ck?.agentId??null,snapshot:cx,onOpenChange:cW,onSnapshotChange:a=>q(a),onRefresh:o,onOpenAddModels:()=>{cl(null),dK(null)}}),(0,d.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,d.jsxs)("div",{className:"mx-auto mb-1 flex w-fit flex-col items-start gap-1",children:[cP>0?(0,d.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,d.jsx)(e.A,{className:"h-3 w-3 text-slate-400"}),(0,d.jsxs)("span",{className:"leading-3 text-slate-300",children:[cP," hidden"]})]}):null,y?(0,d.jsxs)("button",{type:"button",onClick:c_,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,d.jsx)(f.A,{className:"h-3 w-3 text-cyan-300"}),(0,d.jsx)("span",{className:"leading-3 text-cyan-50",children:"Reset Focus"})]}):null]}),(0,d.jsx)(bJ,{snapshot:cx,surfaceTheme:b4,activeWorkspaceId:r,selectedNodeId:u,composeIntent:S,isComposerActive:E,onTargetAgentChange:D,onTargetAgentSelect:cY,onComposerActiveChange:c$,onRefresh:o,onOpenWorkspaceCreate:()=>{c0("basic")},onOpenWorkspaceChannels:dg,onAgentCreatedVisible:cV,onMissionDispatchStart:a=>{let b,c,d;ai.current.set(a.requestId,a.abortController);let e=(b=new Date(a.submittedAt).toISOString(),c=m.agents.find(b=>b.id===a.agentId),d={id:`optimistic:${a.requestId}:submitted`,kind:"user",timestamp:b,title:"Mission submitted",detail:da(a.mission,220),agentId:a.agentId},{requestId:a.requestId,dispatchId:null,task:{id:`optimistic-task:${a.requestId}`,key:`optimistic:${a.requestId}`,title:da(a.mission,86),mission:a.mission,subtitle:"Sending mission to AgentOS. Waiting for a dispatch id.",status:"queued",updatedAt:a.submittedAt,ageMs:0,workspaceId:a.workspaceId??void 0,primaryAgentId:a.agentId,primaryAgentName:J(c??{name:"OpenClaw"}),runtimeIds:[],agentIds:[a.agentId],sessionIds:[],runIds:[],runtimeCount:0,updateCount:0,liveRunCount:0,artifactCount:0,warningCount:0,metadata:{optimistic:!0,optimisticRequestId:a.requestId,bootstrapStage:"submitting",dispatchSubmittedAt:b,optimisticEvents:[d]}}});R(b=>[e,...b.filter(b=>b.requestId!==a.requestId)]),a.workspaceId&&t(a.workspaceId),cB(e.task.id),ao(!0)},onMissionDispatchFailure:(a,b)=>{ai.current.delete(a),R(c=>c.map(c=>c.requestId===a?{...c,task:c7(c.task,{status:"stalled",subtitle:b,bootstrapStage:"stalled",feedEvent:{id:`${c.task.id}:failed:${Date.now()}`,kind:"warning",timestamp:new Date().toISOString(),title:"Dispatch failed",detail:b,isError:!0}})}:c))},onMissionResponse:(a,b)=>{ai.current.delete(b.requestId),N(a),R(c=>c.map(c=>c.requestId===b.requestId?{...c,dispatchId:a.dispatchId??c.dispatchId,task:c7(c.task,{dispatchId:a.dispatchId,status:"stalled"===a.status?"stalled":"cancelled"===a.status?"cancelled":"queued",subtitle:a.summary,bootstrapStage:"stalled"===a.status?"stalled":"cancelled"===a.status?"cancelled":"accepted",feedEvent:{id:`${c.task.id}:response:${Date.now()}`,kind:"stalled"===a.status||"cancelled"===a.status?"warning":"status",timestamp:new Date().toISOString(),title:"stalled"===a.status?"Dispatch blocked":"cancelled"===a.status?"Dispatch cancelled":"Mission accepted",detail:a.summary||"Mission accepted and queued for OpenClaw execution.",isError:"stalled"===a.status||"cancelled"===a.status}})}:c)),a.dispatchId&&P(a.dispatchId)}})]}),(0,d.jsx)(eM,{snapshot:cx,workspaceId:r??cx.workspaces[0]?.id??null,open:cc,onOpenChange:cd,onRefresh:o,onSnapshotChange:q}),(0,d.jsx)(eX,{snapshot:cx,workspaceId:ce,open:null!==ce,onOpenChange:di}),cO?(0,d.jsx)(dL,{snapshot:m,surfaceTheme:b4,stage:bw,showReadyState:bX,systemActionLabel:cK.label,systemActionDescription:cK.description,systemPhase:bk,modelPhase:bE,systemRun:{runState:bi,statusMessage:bm,resultMessage:bo,log:bq,manualCommand:bs,docsUrl:bu},modelRun:{runState:bC,statusMessage:bG,resultMessage:bI,log:bL,manualCommand:bN,docsUrl:bP},modelSwitchFeedback:bR,selectedModelId:by,discoveredModels:bA,onSelectedModelIdChange:bz,onClearModelSwitchFeedback:()=>bS(hX),onRunSystemSetup:dv,onRunModelSetDefault:dD,onOpenAddModels:dK,onOpenGatewayAuthSettings:dH,onEnterAgentOS:dI,onCreateWorkspace:dF,onContinueToModels:d$,onBackToSystem:()=>bx("system"),onSelectStage:a=>{bY(!1),bx(a)},launchpadCreateProgress:aS,launchpadCreateRunState:aQ}):null,(0,d.jsx)(hl,{open:b6,onOpenChange:de,initialMode:b8,workspaceEditId:ca,surfaceTheme:b4,snapshot:m,onRefresh:o,onWorkspaceCreated:a=>{cn(a),t(a),cB(a)},onWorkspaceUpdated:a=>{cn(a),t(a),cB(a)}},ca?`workspace-edit:${ca}`:"workspace-create"),(0,d.jsx)(as,{open:cg,onOpenChange:ch,snapshot:m,initialProvider:ci,onSnapshotChange:q}),(0,d.jsx)(dP,{open:null!==av,target:av,surfaceTheme:b4,previewState:ax,preview:aA,previewError:aC,runState:aE,statusMessage:aG,resultMessage:aI,backgroundLogPath:aK,log:aM,confirmText:aO,onConfirmTextChange:aP,onRefreshPreview:()=>{av&&dV(av)},onExecute:()=>{dX()},onBackToSetup:dZ,onOpenChange:dY}),(0,d.jsx)(df,{snapshot:m,surfaceTheme:b4,isInspectorOpen:an,taskAbortRequest:ac,taskAbortRunState:ae,taskAbortMessage:ag,onTaskAbortOpenChange:a=>{"running"!==ae&&(a||(ad(null),af("idle"),ah(null)))},onTaskAbortConfirm:()=>{ds()},updateDialogOpen:a6,updateRunState:a8,updateStatusMessage:ba,updateResultMessage:bc,updateLog:be,updateManualCommand:bg,activeRuntimeCount:cF,updateInstallSummary:cJ,onUpdateDialogOpenChange:a=>{"running"===a8?a7(a):(a7(a),a||dj())},onRunOpenClawUpdate:()=>{du()}})]})]})}},85561:(a,b,c)=>{"use strict";c.d(b,{Toaster:()=>e});var d=c(77943);let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call Toaster() from the server but Toaster is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/kazimakgul/Documents/GitHub/AgentOS/components/ui/sonner.tsx","Toaster");(0,d.registerClientReference)(function(){throw Error("Attempted to call toast() from the server but toast is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/kazimakgul/Documents/GitHub/AgentOS/components/ui/sonner.tsx","toast")},96720:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,81921,23)),Promise.resolve().then(c.t.bind(c,60440,23)),Promise.resolve().then(c.t.bind(c,84342,23)),Promise.resolve().then(c.t.bind(c,82265,23)),Promise.resolve().then(c.t.bind(c,35421,23)),Promise.resolve().then(c.t.bind(c,61335,23)),Promise.resolve().then(c.t.bind(c,70664,23)),Promise.resolve().then(c.bind(c,74661))},99703:(a,b,c)=>{"use strict";c.d(b,{Toaster:()=>d.l$,o:()=>d.oR});var d=c(90707)}};
|