@sapienx/agentos 0.6.7 → 0.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/.next/BUILD_ID +1 -1
- package/bundle/.next/app-path-routes-manifest.json +11 -10
- package/bundle/.next/build-manifest.json +3 -3
- package/bundle/.next/prerender-manifest.json +3 -3
- package/bundle/.next/react-loadable-manifest.json +1 -1
- package/bundle/.next/required-server-files.json +1 -1
- package/bundle/.next/routes-manifest.json +6 -0
- package/bundle/.next/server/app/_global-error/page.js +2 -2
- package/bundle/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/bundle/.next/server/app/_global-error.html +1 -1
- package/bundle/.next/server/app/_global-error.rsc +1 -1
- package/bundle/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/bundle/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/bundle/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/bundle/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/bundle/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/bundle/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/bundle/.next/server/app/_not-found/page.js +2 -2
- package/bundle/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/bundle/.next/server/app/_not-found.html +2 -2
- package/bundle/.next/server/app/_not-found.rsc +2 -2
- package/bundle/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/bundle/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/bundle/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/bundle/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/bundle/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/bundle/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/bundle/.next/server/app/accounts/page.js +2 -2
- package/bundle/.next/server/app/accounts/page.js.nft.json +1 -1
- package/bundle/.next/server/app/accounts/page_client-reference-manifest.js +1 -1
- package/bundle/.next/server/app/agents/page.js +2 -2
- package/bundle/.next/server/app/agents/page.js.nft.json +1 -1
- package/bundle/.next/server/app/agents/page_client-reference-manifest.js +1 -1
- package/bundle/.next/server/app/api/accounts/access-rules/route.js +1 -1
- package/bundle/.next/server/app/api/accounts/access-rules/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/accounts/browser-profiles/route.js +1 -1
- package/bundle/.next/server/app/api/accounts/browser-profiles/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/accounts/login-targets/route.js +2 -2
- package/bundle/.next/server/app/api/accounts/login-targets/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/agents/[agentId]/chat/route.js +4 -4
- 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/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/integrations/[integrationId]/status/route.js +1 -1
- package/bundle/.next/server/app/api/integrations/[integrationId]/status/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/mission/route.js +3 -3
- package/bundle/.next/server/app/api/mission/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/models/catalog/route.js +1 -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 +1 -1
- package/bundle/.next/server/app/api/models/providers/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/onboarding/models/route.js +2 -2
- package/bundle/.next/server/app/api/onboarding/models/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/onboarding/route.js +2 -2
- package/bundle/.next/server/app/api/onboarding/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/openclaw/capabilities/route.js +1 -1
- package/bundle/.next/server/app/api/openclaw/capabilities/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/openclaw/compatibility-smoke/route.js +1 -1
- package/bundle/.next/server/app/api/openclaw/compatibility-smoke/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 +2 -2
- package/bundle/.next/server/app/api/reset/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/runtimes/[runtimeId]/route.js +1 -1
- package/bundle/.next/server/app/api/runtimes/[runtimeId]/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/settings/config-pacing/route.js +1 -0
- package/bundle/.next/server/app/api/settings/config-pacing/route.js.nft.json +1 -0
- package/bundle/.next/server/app/api/settings/config-pacing/route_client-reference-manifest.js +1 -0
- 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 -1
- package/bundle/.next/server/app/api/settings/openclaw-binary/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/settings/workspace-root/route.js +1 -1
- package/bundle/.next/server/app/api/settings/workspace-root/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/snapshot/route.js +1 -1
- package/bundle/.next/server/app/api/snapshot/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/stream/route.js +2 -2
- package/bundle/.next/server/app/api/stream/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/system/open-terminal/route.js +1 -1
- package/bundle/.next/server/app/api/tasks/[taskId]/abort/route.js +1 -1
- package/bundle/.next/server/app/api/tasks/[taskId]/abort/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/tasks/[taskId]/control/route.js +1 -1
- package/bundle/.next/server/app/api/tasks/[taskId]/control/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/tasks/[taskId]/stream/route.js +2 -2
- package/bundle/.next/server/app/api/tasks/[taskId]/stream/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/update/route.js +2 -2
- package/bundle/.next/server/app/api/update/route.js.nft.json +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/discovered-groups/route.js +1 -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 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/files/route.js.nft.json +1 -1
- 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/[workspaceId]/surfaces/reconcile/route.js +1 -1
- package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/reconcile/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/files/page.js +2 -2
- package/bundle/.next/server/app/files/page.js.nft.json +1 -1
- package/bundle/.next/server/app/files/page_client-reference-manifest.js +1 -1
- package/bundle/.next/server/app/integrations/page.js +2 -2
- package/bundle/.next/server/app/integrations/page.js.nft.json +1 -1
- package/bundle/.next/server/app/integrations/page_client-reference-manifest.js +1 -1
- package/bundle/.next/server/app/models/page.js +2 -2
- package/bundle/.next/server/app/models/page.js.nft.json +1 -1
- package/bundle/.next/server/app/models/page_client-reference-manifest.js +1 -1
- package/bundle/.next/server/app/page.js +2 -2
- 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 -2
- package/bundle/.next/server/app/settings/page.js.nft.json +1 -1
- package/bundle/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/bundle/.next/server/app/tasks/page.js +2 -2
- package/bundle/.next/server/app/tasks/page.js.nft.json +1 -1
- package/bundle/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
- package/bundle/.next/server/app-paths-manifest.json +11 -10
- package/bundle/.next/server/chunks/1718.js +1 -1
- package/bundle/.next/server/chunks/1752.js +12 -0
- package/bundle/.next/server/chunks/4391.js +35 -35
- package/bundle/.next/server/chunks/4767.js +2 -2
- package/bundle/.next/server/chunks/4983.js +2 -2
- package/bundle/.next/server/chunks/5010.js +14 -0
- package/bundle/.next/server/chunks/{7085.js → 5271.js} +2 -2
- package/bundle/.next/server/chunks/7092.js +2 -0
- package/bundle/.next/server/chunks/{2307.js → 8215.js} +1 -1
- package/bundle/.next/server/chunks/8533.js +182 -0
- package/bundle/.next/server/functions-config-manifest.json +1 -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 +2 -2
- package/bundle/.next/server/pages/500.html +1 -1
- package/bundle/.next/server/server-reference-manifest.json +1 -1
- package/bundle/.next/static/chunks/2083-3f878fa838a1a0ca.js +1 -0
- package/bundle/.next/static/chunks/{4176-f5f581e6cd26d962.js → 2366-16384dc528c25ced.js} +4 -4
- package/bundle/.next/static/chunks/7197.ddf4cc08de4fe3ee.js +1 -0
- package/bundle/.next/static/chunks/{7442-717620617b49de55.js → 7442-2c0e6d9ebff0ac6a.js} +16 -16
- package/bundle/.next/static/chunks/9069-70706bf0dcf0a557.js +1 -0
- package/bundle/.next/static/chunks/{2603-769710adda1d633d.js → 9679-b7f81b3d55f1ea2d.js} +2 -2
- package/bundle/.next/static/chunks/app/_global-error/{page-32f399461697d08e.js → page-f27867b999a8b8f9.js} +1 -1
- package/bundle/.next/static/chunks/app/_not-found/{page-32f399461697d08e.js → page-f27867b999a8b8f9.js} +1 -1
- package/bundle/.next/static/chunks/app/accounts/page-28d2ce28785650e2.js +1 -0
- package/bundle/.next/static/chunks/app/agents/page-00e158069677f65e.js +1 -0
- package/bundle/.next/static/chunks/app/api/accounts/access-rules/{route-32f399461697d08e.js → route-f27867b999a8b8f9.js} +1 -1
- package/bundle/.next/static/chunks/app/api/accounts/browser-profiles/{route-32f399461697d08e.js → route-f27867b999a8b8f9.js} +1 -1
- package/bundle/.next/static/chunks/app/api/accounts/login-targets/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/agents/[agentId]/chat/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/agents/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/diagnostics/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/files/reveal/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/gateway/control/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/integrations/[integrationId]/status/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/mission/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/models/catalog/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/models/providers/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/onboarding/models/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/onboarding/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/openclaw/capabilities/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/openclaw/compatibility-smoke/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/planner/[planId]/deploy/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/planner/[planId]/document-rewrite/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/planner/[planId]/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/planner/[planId]/simulate/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/planner/[planId]/turn/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/planner/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/reset/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/runtimes/[runtimeId]/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/settings/config-pacing/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/settings/gateway/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/settings/openclaw-binary/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/settings/workspace-root/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/snapshot/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/stream/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/system/open-terminal/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/tasks/[taskId]/abort/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/tasks/[taskId]/control/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/tasks/[taskId]/stream/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/update/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/discovered-groups/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/edit-draft/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/files/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/surfaces/discovery/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/surfaces/reconcile/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/api/workspaces/route-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/files/page-ad284ddbf86c04e5.js +1 -0
- package/bundle/.next/static/chunks/app/integrations/page-4f68bceee5abc789.js +1 -0
- package/bundle/.next/static/chunks/app/models/page-66e93f913af5e8e2.js +1 -0
- package/bundle/.next/static/chunks/app/not-found-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/app/page-caa416df80d1e4aa.js +1 -0
- package/bundle/.next/static/chunks/app/settings/page-87e643a9b8cbb811.js +1 -0
- package/bundle/.next/static/chunks/app/tasks/page-f3ff8c14f4e6516d.js +1 -0
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/app-error-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/forbidden-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/unauthorized-f27867b999a8b8f9.js +1 -0
- package/bundle/.next/static/chunks/{webpack-0a8ad3b5f2b4bb1b.js → webpack-4c600b16521adac0.js} +1 -1
- package/bundle/.next/static/css/90ba0f48862473e6.css +3 -0
- package/bundle/.next/static/hXnwH-mOOsX_EiS-3twK3/_buildManifest.js +1 -0
- package/bundle/package.json +1 -0
- package/bundle/server.js +1 -1
- package/package.json +1 -1
- package/bundle/.next/server/chunks/1908.js +0 -12
- package/bundle/.next/server/chunks/6476.js +0 -14
- package/bundle/.next/server/chunks/9494.js +0 -183
- package/bundle/.next/static/Lmp1cZ9_c9K3sYYLpgFsg/_buildManifest.js +0 -1
- package/bundle/.next/static/chunks/2083-e309043f80c43402.js +0 -1
- package/bundle/.next/static/chunks/7197.866876dffb806516.js +0 -1
- package/bundle/.next/static/chunks/8373-cadb82a39137601c.js +0 -1
- package/bundle/.next/static/chunks/app/accounts/page-2caea77f8a44146b.js +0 -1
- package/bundle/.next/static/chunks/app/agents/page-d4c7bfe64d44b003.js +0 -1
- package/bundle/.next/static/chunks/app/api/accounts/login-targets/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/agents/[agentId]/chat/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/agents/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/diagnostics/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/files/reveal/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/gateway/control/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/integrations/[integrationId]/status/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/mission/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/models/catalog/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/models/providers/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/onboarding/models/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/onboarding/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/openclaw/capabilities/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/openclaw/compatibility-smoke/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/planner/[planId]/deploy/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/planner/[planId]/document-rewrite/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/planner/[planId]/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/planner/[planId]/simulate/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/planner/[planId]/turn/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/planner/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/reset/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/runtimes/[runtimeId]/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/settings/gateway/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/settings/openclaw-binary/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/settings/workspace-root/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/snapshot/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/stream/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/system/open-terminal/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/tasks/[taskId]/abort/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/tasks/[taskId]/control/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/tasks/[taskId]/stream/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/update/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/discovered-groups/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/edit-draft/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/files/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/surfaces/discovery/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/surfaces/reconcile/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/api/workspaces/route-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/files/page-a16b11d418e6dbe5.js +0 -1
- package/bundle/.next/static/chunks/app/integrations/page-2314a29ba4274466.js +0 -1
- package/bundle/.next/static/chunks/app/models/page-7850176ce8455112.js +0 -1
- package/bundle/.next/static/chunks/app/not-found-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/app/page-da330bca609cd094.js +0 -1
- package/bundle/.next/static/chunks/app/settings/page-a6c7770571bf5fe1.js +0 -1
- package/bundle/.next/static/chunks/app/tasks/page-af0098a4b77a7e2e.js +0 -1
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/app-error-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/forbidden-32f399461697d08e.js +0 -1
- package/bundle/.next/static/chunks/next/dist/client/components/builtin/unauthorized-32f399461697d08e.js +0 -1
- package/bundle/.next/static/css/39bff2e14c799896.css +0 -3
- package/bundle/public/readme/banner.jpeg +0 -0
- /package/bundle/.next/static/{Lmp1cZ9_c9K3sYYLpgFsg → hXnwH-mOOsX_EiS-3twK3}/_ssgManifest.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";exports.id=4767,exports.ids=[4767],exports.modules={185:(a,b,c)=>{c.d(b,{oC:()=>m});var d=c(51455),e=c(48161),f=c.n(e),g=c(76760),h=c.n(g),i=c(39503),j=c(11782),k=c(49922);let l=new Map;async function m({agentId:a,modelId:b,agentDir:c}){var d;let e;if(!a.trim()||!b||!(0,j.JC)(b))return{repaired:!1,reason:"not-codex-model"};try{e=await (0,i.rw)().getAgentModelStatus({agentId:a},{timeoutMs:8e3})}catch(b){let a=c&&t()?await p(c).catch(()=>[]):[];return{repaired:a.length>0,reason:a.length>0?"profile-copy-fallback":"status-failed",profileIds:a,error:b}}let f=function(a){let b=a.auth?.oauth?.providers?.find(a=>"openai"===a.provider)??a.auth?.oauth?.providers?.find(a=>"openai-codex"===a.provider),c=(Array.isArray(b?.profiles)?b.profiles:[]).filter(u).map(a=>v(a.profileId)).filter(w);if(0===c.length)return{needsRepair:!1,profileIds:[],reason:"no-usable-profile"};let d=(Array.isArray(b?.effectiveProfiles)?b.effectiveProfiles:[]).find(x),e=d?v(d.profileId):null;return"ok"===v(b?.status)?.toLowerCase()&&e&&c.includes(e)?{needsRepair:!1,profileIds:c,reason:"not-needed"}:{needsRepair:!0,profileIds:c,reason:"needs-order"}}(e),g=(d=e,(Array.isArray(d.auth?.unusableProfiles)?d.auth.unusableProfiles:[]).find(a=>{if(!x(a))return!1;let b=v(a.provider)?.toLowerCase(),c=v(a.profileId)?.toLowerCase(),d=v(a.kind)?.toLowerCase(),e=v(a.status)?.toLowerCase(),f=v(a.issue)?.toLowerCase();return("openai"===b||"openai-codex"===b||c?.startsWith("openai:"))&&["cooldown","expired","missing","invalid","error","disabled","revoked"].some(a=>d===a||e===a||f?.includes(a))})?(0,k.ox)((0,k.MF)("openclaw",{force:!0})):null);if(g)throw Error(g);if(!f.needsRepair)return{repaired:!1,reason:f.reason};let h=f.profileIds.join("\n"),q=`${a}:${h}`,r=l.get(q);if(r&&r.expiresAt>Date.now())return{repaired:!1,reason:"recently-repaired"};let s=v(e.agentDir)??c??null;s&&t()&&await o(s,f.profileIds).catch(()=>void 0);try{return"main"!==a&&await n("main",f.profileIds).catch(()=>void 0),await n(a,f.profileIds),l.set(q,{expiresAt:Date.now()+3e5,profileKey:h}),{repaired:!0,reason:"order-set",profileIds:f.profileIds}}catch(a){return{repaired:!1,reason:"repair-failed",error:a}}}async function n(a,b){let c=null;for(let d of[0,750,1500]){d>0&&await function(a){return new Promise(b=>globalThis.setTimeout(b,a))}(d);try{await (0,i.rw)().setModelAuthOrder({provider:"openai",agentId:a,profileIds:b},{timeoutMs:8e3});return}catch(a){c=a}}throw c}async function o(a,b){let c=await r(q()),e=h().join(a,"auth-profiles.json"),f=await r(e),g=!1;for(let a of(f.version=1,f.profiles=f.profiles??{},b)){let b=c.profiles?.[a];s(b)&&JSON.stringify(f.profiles[a])!==JSON.stringify(b)&&(f.profiles[a]=b,g=!0)}g&&(await (0,d.mkdir)(h().dirname(e),{recursive:!0}),await (0,d.writeFile)(e,`${JSON.stringify(f,null,2)}
|
|
2
|
-
`,"utf8"))}async function p(a){let b=Object.entries((await r(q())).profiles??{}).filter(([,a])=>s(a)).map(([a])=>a);return 0===b.length?[]:(await o(a,b),b)}function q(){return h().join(f().homedir(),".openclaw","agents","main","agent","auth-profiles.json")}async function r(a){try{let b=await (0,d.readFile)(a,"utf8"),c=JSON.parse(b);if(x(c))return{version:"number"==typeof c.version?c.version:1,profiles:x(c.profiles)?Object.fromEntries(Object.entries(c.profiles).filter(a=>x(a[1]))):{}}}catch{}return{version:1,profiles:{}}}function s(a){return x(a)&&"oauth"===a.type&&("openai"===a.provider||"openai-codex"===a.provider)&&x(a.oauthRef)}function t(){let a=process.env.AGENTOS_OPENCLAW_LEGACY_PROVIDER_FILE_FALLBACK;return"1"===a||a?.toLowerCase()==="true"||a?.toLowerCase()==="on"}function u(a){if(!x(a)||!v(a.profileId))return!1;let b=v(a.status)?.toLowerCase();return!b||!["expired","missing","invalid","error","disabled","revoked"].includes(b)}function v(a){return"string"==typeof a&&a.trim()?a.trim():null}function w(a){return!!a}function x(a){return!!a&&"object"==typeof a&&!Array.isArray(a)}},3334:(a,b,c)=>{c.d(b,{Z:()=>o});var d=c(27091),e=c(39802),f=c(93628);function g(a){return Array.from(new Set(a.filter(Boolean)))}function h(a){let b=new Map;for(let c of a)c.chatId&&b.set(c.chatId,c);return Array.from(b.values())}function i(a){return a.title&&a.title!==a.chatId?`${a.title} (\`${a.chatId}\`)`:`\`${a.chatId}\``}function j(a){if(!a)return"no capability snapshot";let b=[(0,f._P)(a.policy.preset)],c=a.profile.purpose?.trim();c&&b.push(c);let d=g(a.skills).slice(0,2);d.length>0&&b.push(`skills: ${d.join(", ")}`);let e=g(a.tools).slice(0,2);return e.length>0&&b.push(`tools: ${e.join(", ")}`),b.join(" \xb7 ")}function k(a){return Array.from(new Set(a.filter(Boolean)))}function l(a){let b=new Map;for(let c of a)c.chatId&&b.set(c.chatId,c);return Array.from(b.values())}function m(a,b,c){let e=new Map(a?.agents.map(a=>[a.id,(0,d.CK)(a)])??[]),f=new Map(a?.agents.map(a=>[a.id,a])??[]);return k(b.filter(a=>!c.includes(a))).map(a=>{let b=f.get(a)??null;return{agentId:a,name:e.get(a)??a,summary:function(a){if(!a)return"no capability snapshot";let b=[(0,d.CK)(a)],c=a.profile.purpose?.trim();c&&b.push(c);let e=k(a.skills).slice(0,2);e.length>0&&b.push(`skills: ${e.join(", ")}`);let f=k(a.tools).slice(0,2);return f.length>0&&b.push(`tools: ${f.join(", ")}`),b.join(" \xb7 ")}(b)}})}function n(a){let b=(0,e.S)(a.chatId),c=b?.kind==="role"?`@${b.targetId}`:b?.kind==="thread"?`Thread ${b.targetId}`:b?.kind==="channel"?`#${b.targetId}`:a.chatId;return{routeId:a.chatId,label:a.title?.trim()||c,kind:b?.kind??"channel",guildId:b?.guildId??null}}function o(a,b,c=b?.channelRegistry??null){let e=[function(a){if(!a||0===a.primaryChannels.length&&0===a.ownedGroups.length&&0===a.delegateChannels.length)return null;let b=["## Telegram coordination"];if(b.push("- Telegram credentials are managed by OpenClaw for the listed channels. Do not ask the operator for `TELEGRAM_BOT_TOKEN` or `channels.telegram.botToken` when sending to listed groups."),b.push('- To send or post, call the `message` tool with `action: "send"`, `channel: "telegram"`, `target: "<chatId>"`, and the exact message text. Use the listed chat id as `target`.'),b.push("- If sending fails, report the actual tool error instead of inventing a missing-token error."),a.primaryChannels.length>0){for(let c of(b.push("- You are the public Telegram fallback for these channels:"),a.primaryChannels)){let a=c.groups.length>0?c.groups.map(i).join(", "):"no allowed groups yet";if(b.push(` - ${c.channelName} (\`${c.channelId}\`) \xb7 fallback groups: ${a}.`),c.peers.length>0)for(let a of(b.push(" - Internal assistants:"),c.peers))b.push(` - ${a.name} (\`${a.agentId}\`) \xb7 ${a.summary}.`)}b.push("- Keep public Telegram replies under your own voice for unassigned groups, even when you ask another agent for help."),b.push("- For specialist help, call another agent from the workspace terminal with:"),b.push("```bash"),b.push('node .openclaw/tools/telegram-delegate-agent.mjs --agent <delegate-agent-id> --message "Summarize what I need from you"'),b.push("```"),b.push("- Use delegate turns for internal research, drafting, or analysis only. Do not ask them to answer Telegram directly."),b.push("- After a delegate responds, decide what to share publicly and send the final Telegram reply yourself.")}if(a.ownedGroups.length>0){for(let c of(b.push("- You are the public Telegram voice for these assigned groups:"),a.ownedGroups))if(b.push(` - ${c.channelName} (\`${c.channelId}\`) \xb7 ${c.title??c.chatId} (\`${c.chatId}\`) \xb7 primary ${c.primaryAgentName} (\`${c.primaryAgentId}\`).`),c.peers.length>0)for(let a of(b.push(" - Internal assistants for this group:"),c.peers))b.push(` - ${a.name} (\`${a.agentId}\`) \xb7 ${a.summary}.`);b.push("- Reply directly to those groups as the public voice. Use other agents only for internal help.")}if(a.delegateChannels.length>0){for(let c of(b.push("- You can assist these Telegram admin channels when the primary agent asks:"),a.delegateChannels)){let a=c.groups.length>0?c.groups.map(i).join(", "):"no allowed groups yet";if(b.push(` - ${c.channelName} (\`${c.channelId}\`) \xb7 primary ${c.primaryAgentName} (\`${c.primaryAgentId}\`) \xb7 groups: ${a}.`),c.peers.length>0)for(let a of(b.push(" - Nearby assistants:"),c.peers))b.push(` - ${a.name} (\`${a.agentId}\`) \xb7 ${a.summary}.`)}b.push("- When helping with Telegram work for groups not assigned to you, return concise internal findings or draft language. Do not speak as the public Telegram agent for those unassigned groups.")}return b.join("\n")}(function(a,b,c=b?.channelRegistry??null){if(!c)return null;let e=new Map(b?.agents.map(a=>[a.id,(0,d.CK)(a)])??[]),f=new Map(b?.agents.map(a=>[a.id,a])??[]),i=f.get(a)??null,k=i?.workspaceId??null,l=[],m=[],n=[];for(let b of c.channels.filter(a=>"telegram"===a.type)){let c=b.workspaces.filter(a=>a.workspaceId===k);if(0===c.length)continue;let i=h(c.flatMap(a=>a.groupAssignments.filter(a=>!1!==a.enabled))).map(a=>({chatId:a.chatId,title:a.title??null})),o=h(c.flatMap(b=>b.groupAssignments.filter(b=>!1!==b.enabled&&b.agentId===a))),p=i.filter(a=>!o.some(b=>b.chatId===a.chatId)&&!c.some(b=>b.groupAssignments.some(b=>!1!==b.enabled&&b.chatId===a.chatId&&b.agentId)));if(b.primaryAgentId===a){let d=g(c.flatMap(b=>b.agentIds.filter(b=>b!==a))).map(a=>{let b=f.get(a)??null;return{agentId:a,name:e.get(a)??a,summary:j(b)}});l.push({channelId:b.id,channelName:b.name,groups:p,peers:d})}for(let d of o){let h=g(c.flatMap(c=>c.agentIds.filter(c=>c!==a&&c!==b.primaryAgentId))).map(a=>{let b=f.get(a)??null;return{agentId:a,name:e.get(a)??a,summary:j(b)}});m.push({channelId:b.id,channelName:b.name,chatId:d.chatId,title:d.title??null,primaryAgentId:b.primaryAgentId??a,primaryAgentName:e.get(b.primaryAgentId??a)??b.primaryAgentId??a,peers:h})}if(b.primaryAgentId&&b.primaryAgentId!==a&&0===o.length){let h=f.get(b.primaryAgentId)??null,i=g(c.flatMap(c=>c.agentIds.filter(c=>c!==b.primaryAgentId&&c!==a))).map(a=>{let b=f.get(a)??null;return{agentId:a,name:e.get(a)??a,summary:j(b)}});n.push({channelId:b.id,channelName:b.name,groups:p,peers:i,primaryAgentId:b.primaryAgentId,primaryAgentName:e.get(b.primaryAgentId)??(h?(0,d.CK)(h):b.primaryAgentId)})}}return{primaryChannels:l.sort((a,b)=>a.channelName.localeCompare(b.channelName)),ownedGroups:m.sort((a,b)=>{let c=`${a.channelName}:${a.title??a.chatId}`,d=`${b.channelName}:${b.title??b.chatId}`;return c.localeCompare(d)}),delegateChannels:n.sort((a,b)=>a.channelName.localeCompare(b.channelName))}}(a,b,c)),function(a){if(!a||0===a.primaryChannels.length&&0===a.ownedRoutes.length&&0===a.delegateChannels.length)return null;let b=["## Discord coordination"];if(a.primaryChannels.length>0){for(let c of(b.push("- You are the public Discord fallback for these channels:"),a.primaryChannels)){let a=c.routes.length>0?c.routes.map(a=>`${a.label} (\`${a.routeId}\`)`).join(", "):"no allowed routes yet";if(b.push(` - ${c.channelName} (\`${c.channelId}\`) \xb7 fallback routes: ${a}.`),c.peers.length>0)for(let a of(b.push(" - Internal assistants:"),c.peers))b.push(` - ${a.name} (\`${a.agentId}\`) \xb7 ${a.summary}.`)}b.push("- Keep public Discord replies under your own voice for unassigned routes, even when you ask another agent for help.")}if(a.ownedRoutes.length>0){for(let c of(b.push("- You are the public Discord voice for these assigned routes:"),a.ownedRoutes))if(b.push(` - ${c.channelName} (\`${c.channelId}\`) \xb7 ${c.label} (\`${c.routeId}\`) \xb7 primary ${c.primaryAgentName} (\`${c.primaryAgentId}\`).`),c.peers.length>0)for(let a of(b.push(" - Internal assistants for this route:"),c.peers))b.push(` - ${a.name} (\`${a.agentId}\`) \xb7 ${a.summary}.`);b.push("- Reply directly to those routes as the public voice. Use other agents only for internal help.")}if(a.delegateChannels.length>0){for(let c of(b.push("- You can assist these Discord admin channels when the primary agent asks:"),a.delegateChannels)){let a=c.routes.length>0?c.routes.map(a=>`${a.label} (\`${a.routeId}\`)`).join(", "):"no allowed routes yet";if(b.push(` - ${c.channelName} (\`${c.channelId}\`) \xb7 primary ${c.primaryAgentName} (\`${c.primaryAgentId}\`) \xb7 routes: ${a}.`),c.peers.length>0)for(let a of(b.push(" - Nearby assistants:"),c.peers))b.push(` - ${a.name} (\`${a.agentId}\`) \xb7 ${a.summary}.`)}b.push("- When helping with Discord work, return concise internal findings or draft language. Do not speak as the public Discord agent.")}return b.join("\n")}(function(a,b,c=b?.channelRegistry??null){if(!c)return null;let e=b?.agents.find(b=>b.id===a)??null,f=e?.workspaceId??null,g=[],h=[],i=[];for(let e of c.channels.filter(a=>"discord"===a.type)){var j,k,o,p;let c=e.workspaces.filter(a=>a.workspaceId===f);if(0===c.length)continue;let q=l(c.flatMap(a=>a.groupAssignments.filter(a=>!1!==a.enabled))).map(n),r=l(c.flatMap(b=>b.groupAssignments.filter(b=>!1!==b.enabled&&b.agentId===a))).map(n),s=q.filter(a=>!r.some(b=>b.routeId===a.routeId)&&!c.some(b=>b.groupAssignments.some(b=>!1!==b.enabled&&b.chatId===a.routeId&&b.agentId)));if(e.primaryAgentId===a){let d=m(b,c.flatMap(b=>b.agentIds.filter(b=>b!==a)),[a]);g.push({channelId:e.id,channelName:e.name,routes:s,peers:d})}for(let f of r){let g=m(b,c.flatMap(b=>b.agentIds.filter(b=>b!==a&&b!==e.primaryAgentId)),[a,e.primaryAgentId??""]);h.push({channelId:e.id,channelName:e.name,routeId:f.routeId,label:f.label,kind:f.kind,guildId:f.guildId,primaryAgentId:e.primaryAgentId??a,primaryAgentName:(j=b?.agents.find(b=>b.id===(e.primaryAgentId??a))??null,k=e.primaryAgentId??a,j?(0,d.CK)(j):k),peers:g})}if(e.primaryAgentId&&e.primaryAgentId!==a){let f=m(b,c.flatMap(b=>b.agentIds.filter(b=>b!==e.primaryAgentId&&b!==a)),[a,e.primaryAgentId]);i.push({channelId:e.id,channelName:e.name,routes:s,peers:f,primaryAgentId:e.primaryAgentId,primaryAgentName:(o=b?.agents.find(a=>a.id===e.primaryAgentId)??null,p=e.primaryAgentId,o?(0,d.CK)(o):p)})}}return{primaryChannels:g.sort((a,b)=>a.channelName.localeCompare(b.channelName)),ownedRoutes:h.sort((a,b)=>{let c=`${a.channelName}:${a.label}`,d=`${b.channelName}:${b.label}`;return c.localeCompare(d)}),delegateChannels:i.sort((a,b)=>a.channelName.localeCompare(b.channelName))}}(a,b,c))].filter(a=>!!a);return e.length>0?e.join("\n\n"):null}},24767:(a,b,c)=>{c.d(b,{yw:()=>b0,DM:()=>cj,er:()=>d.er,us:()=>b1,Sn:()=>al,MP:()=>cm,zw:()=>by,RB:()=>as,kd:()=>cf,qu:()=>bB,B5:()=>ce,H6:()=>b7.H6,lC:()=>b7.lC,dM:()=>bs,MQ:()=>b6.MQ,W6:()=>b6.W6,GM:()=>c4,Y9:()=>bt,pf:()=>bu,FJ:()=>bC,tq:()=>cg,f5:()=>b6.f5,MG:()=>b6.MG,W9:()=>ci,lT:()=>ch,xE:()=>b_,ct:()=>br,o6:()=>ck,x4:()=>ar,Vg:()=>b6.Vg,sQ:()=>bA,PR:()=>b6.PR,Oz:()=>cd});var d=c(69494),e=c(51455),f=c(76760),g=c.n(f),h=c(93628);function i(a,b){let c="monitoring"===a?{enabled:!0,every:"30m"}:{enabled:!1,every:"30m"},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 j(a){return a?.enabled?{every:"string"==typeof a.every&&a.every.trim()?a.every.trim():"30m"}:null}var k=c(39503),l=c(76414),m=c(71065),n=c(27091),o=c(98752),p=c(31421),q=c(57975),r=c(14853),s=c(15612),t=c(54252);let u=(0,q.promisify)(p.execFile);function v(a){return"string"==typeof a&&a.trim().length>0?a.trim():null}function w(a){return Array.from(new Set(a.filter(Boolean)))}function x(a){return w([...(a.skillIds??[]).map(a=>v(a)??""),v(a.skillId)??""])}function y(a){return a.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}async function z(a){try{return await (0,e.access)(a),!0}catch{return!1}}async function A(a,b,c={}){try{await u(a,b,{cwd:c.cwd??process.cwd(),timeout:c.timeoutMs??12e4,maxBuffer:8388608})}catch(a){throw Error("object"==typeof a&&a&&"stderr"in a&&"string"==typeof a.stderr&&a.stderr.trim()?a.stderr.trim():a instanceof Error?a.message:"Unknown system command failure.")}}async function B(a,b){try{await (0,e.access)(a)}catch{await (0,e.mkdir)(g().dirname(a),{recursive:!0}),await (0,e.writeFile)(a,b,"utf8")}}async function C(a,b){await (0,e.mkdir)(g().dirname(a),{recursive:!0}),await (0,e.writeFile)(a,b,"utf8")}async function D(a){try{throw await (0,e.access)(a),Error("Target workspace directory already exists.")}catch(a){if("ENOENT"===("object"==typeof a&&a&&"code"in a?a.code:void 0))return;if(a instanceof Error)throw a;throw Error("Unable to verify target workspace directory.")}}async function E(a){try{if(!(await (0,e.stat)(a)).isDirectory())throw Error("Target workspace path exists and is not a directory.");if((await (0,e.readdir)(a)).length>0)throw Error("Target workspace directory already contains files. Use Existing folder instead.")}catch(b){if("ENOENT"===("object"==typeof b&&b&&"code"in b?b.code:void 0))return void await (0,e.mkdir)(a,{recursive:!0});if(b instanceof Error)throw b;throw Error("Unable to prepare the workspace directory.")}await (0,e.mkdir)(a,{recursive:!0})}async function F(a){try{if(!(await (0,e.stat)(a)).isDirectory())throw Error("The selected existing path is not a directory.")}catch(a){if("ENOENT"===("object"==typeof a&&a&&"code"in a?a.code:void 0))throw Error("The selected existing folder does not exist.");if(a instanceof Error)throw a;throw Error("Unable to access the selected existing folder.")}}async function G(a,b){let c=v(b);return c?c.split("@")[0]:await z(g().join(a,"pnpm-lock.yaml"))?"pnpm":await z(g().join(a,"yarn.lock"))?"yarn":"npm"}async function H(a){let b=g().join(a,"package.json");try{let c=await (0,e.readFile)(b,"utf8"),d=JSON.parse(c),f=d.scripts??{},g=await G(a,d.packageManager),h=[`Use \`${g} install\` before the first local run.`];for(let a of["dev","start","test","lint","build"])f[a]&&h.push(`Use \`${"yarn"===g?`yarn ${a}`:`${g} run ${a}`}\` for the ${a} workflow.`);return h}catch{return[]}}async function I(a){let b=g().join(a,"Makefile");try{return((await (0,e.readFile)(b,"utf8")).match(/^(dev|test|lint|build|run):/gm)??[]).map(a=>`Use \`make ${a.replace(/:$/,"")}\` if the Makefile is the primary entry point.`)}catch{return[]}}async function J(a){let b=[];return await z(g().join(a,"pyproject.toml"))&&b.push("Use `pytest` for Python verification if the project exposes a test suite."),await z(g().join(a,"requirements.txt"))&&b.push("Install Python dependencies in a virtualenv before running project commands."),b}async function K(a){let b=[],c=await H(a),d=await I(a),e=await J(a);return b.push(...c,...d,...e),0===b.length&&b.push("Use repository-local scripts or documented commands for repeatable workflows.","Update this file when the project exposes a cleaner build, test, or release path."),w(b).slice(0,6)}function L(a,b){switch(a){case"project-builder":return`# Project Builder
|
|
2
|
+
`,"utf8"))}async function p(a){let b=Object.entries((await r(q())).profiles??{}).filter(([,a])=>s(a)).map(([a])=>a);return 0===b.length?[]:(await o(a,b),b)}function q(){return h().join(f().homedir(),".openclaw","agents","main","agent","auth-profiles.json")}async function r(a){try{let b=await (0,d.readFile)(a,"utf8"),c=JSON.parse(b);if(x(c))return{version:"number"==typeof c.version?c.version:1,profiles:x(c.profiles)?Object.fromEntries(Object.entries(c.profiles).filter(a=>x(a[1]))):{}}}catch{}return{version:1,profiles:{}}}function s(a){return x(a)&&"oauth"===a.type&&("openai"===a.provider||"openai-codex"===a.provider)&&x(a.oauthRef)}function t(){let a=process.env.AGENTOS_OPENCLAW_LEGACY_PROVIDER_FILE_FALLBACK;return"1"===a||a?.toLowerCase()==="true"||a?.toLowerCase()==="on"}function u(a){if(!x(a)||!v(a.profileId))return!1;let b=v(a.status)?.toLowerCase();return!b||!["expired","missing","invalid","error","disabled","revoked"].includes(b)}function v(a){return"string"==typeof a&&a.trim()?a.trim():null}function w(a){return!!a}function x(a){return!!a&&"object"==typeof a&&!Array.isArray(a)}},3334:(a,b,c)=>{c.d(b,{Z:()=>o});var d=c(27091),e=c(39802),f=c(93628);function g(a){return Array.from(new Set(a.filter(Boolean)))}function h(a){let b=new Map;for(let c of a)c.chatId&&b.set(c.chatId,c);return Array.from(b.values())}function i(a){return a.title&&a.title!==a.chatId?`${a.title} (\`${a.chatId}\`)`:`\`${a.chatId}\``}function j(a){if(!a)return"no capability snapshot";let b=[(0,f._P)(a.policy.preset)],c=a.profile.purpose?.trim();c&&b.push(c);let d=g(a.skills).slice(0,2);d.length>0&&b.push(`skills: ${d.join(", ")}`);let e=g(a.tools).slice(0,2);return e.length>0&&b.push(`tools: ${e.join(", ")}`),b.join(" \xb7 ")}function k(a){return Array.from(new Set(a.filter(Boolean)))}function l(a){let b=new Map;for(let c of a)c.chatId&&b.set(c.chatId,c);return Array.from(b.values())}function m(a,b,c){let e=new Map(a?.agents.map(a=>[a.id,(0,d.CK)(a)])??[]),f=new Map(a?.agents.map(a=>[a.id,a])??[]);return k(b.filter(a=>!c.includes(a))).map(a=>{let b=f.get(a)??null;return{agentId:a,name:e.get(a)??a,summary:function(a){if(!a)return"no capability snapshot";let b=[(0,d.CK)(a)],c=a.profile.purpose?.trim();c&&b.push(c);let e=k(a.skills).slice(0,2);e.length>0&&b.push(`skills: ${e.join(", ")}`);let f=k(a.tools).slice(0,2);return f.length>0&&b.push(`tools: ${f.join(", ")}`),b.join(" \xb7 ")}(b)}})}function n(a){let b=(0,e.S)(a.chatId),c=b?.kind==="role"?`@${b.targetId}`:b?.kind==="thread"?`Thread ${b.targetId}`:b?.kind==="channel"?`#${b.targetId}`:a.chatId;return{routeId:a.chatId,label:a.title?.trim()||c,kind:b?.kind??"channel",guildId:b?.guildId??null}}function o(a,b,c=b?.channelRegistry??null){let e=[function(a){if(!a||0===a.primaryChannels.length&&0===a.ownedGroups.length&&0===a.delegateChannels.length)return null;let b=["## Telegram coordination"];if(b.push("- Telegram credentials are managed by OpenClaw for the listed channels. Do not ask the operator for `TELEGRAM_BOT_TOKEN` or `channels.telegram.botToken` when sending to listed groups."),b.push('- To send or post, call the `message` tool with `action: "send"`, `channel: "telegram"`, `target: "<chatId>"`, and the exact message text. Use the listed chat id as `target`.'),b.push("- If sending fails, report the actual tool error instead of inventing a missing-token error."),a.primaryChannels.length>0){for(let c of(b.push("- You are the public Telegram fallback for these channels:"),a.primaryChannels)){let a=c.groups.length>0?c.groups.map(i).join(", "):"no allowed groups yet";if(b.push(` - ${c.channelName} (\`${c.channelId}\`) \xb7 fallback groups: ${a}.`),c.peers.length>0)for(let a of(b.push(" - Internal assistants:"),c.peers))b.push(` - ${a.name} (\`${a.agentId}\`) \xb7 ${a.summary}.`)}b.push("- Keep public Telegram replies under your own voice for unassigned groups, even when you ask another agent for help."),b.push("- For specialist help, call another agent from the workspace terminal with:"),b.push("```bash"),b.push('node .openclaw/tools/telegram-delegate-agent.mjs --agent <delegate-agent-id> --message "Summarize what I need from you"'),b.push("```"),b.push("- Use delegate turns for internal research, drafting, or analysis only. Do not ask them to answer Telegram directly."),b.push("- After a delegate responds, decide what to share publicly and send the final Telegram reply yourself.")}if(a.ownedGroups.length>0){for(let c of(b.push("- You are the public Telegram voice for these assigned groups:"),a.ownedGroups))if(b.push(` - ${c.channelName} (\`${c.channelId}\`) \xb7 ${c.title??c.chatId} (\`${c.chatId}\`) \xb7 primary ${c.primaryAgentName} (\`${c.primaryAgentId}\`).`),c.peers.length>0)for(let a of(b.push(" - Internal assistants for this group:"),c.peers))b.push(` - ${a.name} (\`${a.agentId}\`) \xb7 ${a.summary}.`);b.push("- Reply directly to those groups as the public voice. Use other agents only for internal help.")}if(a.delegateChannels.length>0){for(let c of(b.push("- You can assist these Telegram admin channels when the primary agent asks:"),a.delegateChannels)){let a=c.groups.length>0?c.groups.map(i).join(", "):"no allowed groups yet";if(b.push(` - ${c.channelName} (\`${c.channelId}\`) \xb7 primary ${c.primaryAgentName} (\`${c.primaryAgentId}\`) \xb7 groups: ${a}.`),c.peers.length>0)for(let a of(b.push(" - Nearby assistants:"),c.peers))b.push(` - ${a.name} (\`${a.agentId}\`) \xb7 ${a.summary}.`)}b.push("- When helping with Telegram work for groups not assigned to you, return concise internal findings or draft language. Do not speak as the public Telegram agent for those unassigned groups.")}return b.join("\n")}(function(a,b,c=b?.channelRegistry??null){if(!c)return null;let e=new Map(b?.agents.map(a=>[a.id,(0,d.CK)(a)])??[]),f=new Map(b?.agents.map(a=>[a.id,a])??[]),i=f.get(a)??null,k=i?.workspaceId??null,l=[],m=[],n=[];for(let b of c.channels.filter(a=>"telegram"===a.type)){let c=b.workspaces.filter(a=>a.workspaceId===k);if(0===c.length)continue;let i=h(c.flatMap(a=>a.groupAssignments.filter(a=>!1!==a.enabled))).map(a=>({chatId:a.chatId,title:a.title??null})),o=h(c.flatMap(b=>b.groupAssignments.filter(b=>!1!==b.enabled&&b.agentId===a))),p=i.filter(a=>!o.some(b=>b.chatId===a.chatId)&&!c.some(b=>b.groupAssignments.some(b=>!1!==b.enabled&&b.chatId===a.chatId&&b.agentId)));if(b.primaryAgentId===a){let d=g(c.flatMap(b=>b.agentIds.filter(b=>b!==a))).map(a=>{let b=f.get(a)??null;return{agentId:a,name:e.get(a)??a,summary:j(b)}});l.push({channelId:b.id,channelName:b.name,groups:p,peers:d})}for(let d of o){let h=g(c.flatMap(c=>c.agentIds.filter(c=>c!==a&&c!==b.primaryAgentId))).map(a=>{let b=f.get(a)??null;return{agentId:a,name:e.get(a)??a,summary:j(b)}});m.push({channelId:b.id,channelName:b.name,chatId:d.chatId,title:d.title??null,primaryAgentId:b.primaryAgentId??a,primaryAgentName:e.get(b.primaryAgentId??a)??b.primaryAgentId??a,peers:h})}if(b.primaryAgentId&&b.primaryAgentId!==a&&0===o.length){let h=f.get(b.primaryAgentId)??null,i=g(c.flatMap(c=>c.agentIds.filter(c=>c!==b.primaryAgentId&&c!==a))).map(a=>{let b=f.get(a)??null;return{agentId:a,name:e.get(a)??a,summary:j(b)}});n.push({channelId:b.id,channelName:b.name,groups:p,peers:i,primaryAgentId:b.primaryAgentId,primaryAgentName:e.get(b.primaryAgentId)??(h?(0,d.CK)(h):b.primaryAgentId)})}}return{primaryChannels:l.sort((a,b)=>a.channelName.localeCompare(b.channelName)),ownedGroups:m.sort((a,b)=>{let c=`${a.channelName}:${a.title??a.chatId}`,d=`${b.channelName}:${b.title??b.chatId}`;return c.localeCompare(d)}),delegateChannels:n.sort((a,b)=>a.channelName.localeCompare(b.channelName))}}(a,b,c)),function(a){if(!a||0===a.primaryChannels.length&&0===a.ownedRoutes.length&&0===a.delegateChannels.length)return null;let b=["## Discord coordination"];if(a.primaryChannels.length>0){for(let c of(b.push("- You are the public Discord fallback for these channels:"),a.primaryChannels)){let a=c.routes.length>0?c.routes.map(a=>`${a.label} (\`${a.routeId}\`)`).join(", "):"no allowed routes yet";if(b.push(` - ${c.channelName} (\`${c.channelId}\`) \xb7 fallback routes: ${a}.`),c.peers.length>0)for(let a of(b.push(" - Internal assistants:"),c.peers))b.push(` - ${a.name} (\`${a.agentId}\`) \xb7 ${a.summary}.`)}b.push("- Keep public Discord replies under your own voice for unassigned routes, even when you ask another agent for help.")}if(a.ownedRoutes.length>0){for(let c of(b.push("- You are the public Discord voice for these assigned routes:"),a.ownedRoutes))if(b.push(` - ${c.channelName} (\`${c.channelId}\`) \xb7 ${c.label} (\`${c.routeId}\`) \xb7 primary ${c.primaryAgentName} (\`${c.primaryAgentId}\`).`),c.peers.length>0)for(let a of(b.push(" - Internal assistants for this route:"),c.peers))b.push(` - ${a.name} (\`${a.agentId}\`) \xb7 ${a.summary}.`);b.push("- Reply directly to those routes as the public voice. Use other agents only for internal help.")}if(a.delegateChannels.length>0){for(let c of(b.push("- You can assist these Discord admin channels when the primary agent asks:"),a.delegateChannels)){let a=c.routes.length>0?c.routes.map(a=>`${a.label} (\`${a.routeId}\`)`).join(", "):"no allowed routes yet";if(b.push(` - ${c.channelName} (\`${c.channelId}\`) \xb7 primary ${c.primaryAgentName} (\`${c.primaryAgentId}\`) \xb7 routes: ${a}.`),c.peers.length>0)for(let a of(b.push(" - Nearby assistants:"),c.peers))b.push(` - ${a.name} (\`${a.agentId}\`) \xb7 ${a.summary}.`)}b.push("- When helping with Discord work, return concise internal findings or draft language. Do not speak as the public Discord agent.")}return b.join("\n")}(function(a,b,c=b?.channelRegistry??null){if(!c)return null;let e=b?.agents.find(b=>b.id===a)??null,f=e?.workspaceId??null,g=[],h=[],i=[];for(let e of c.channels.filter(a=>"discord"===a.type)){var j,k,o,p;let c=e.workspaces.filter(a=>a.workspaceId===f);if(0===c.length)continue;let q=l(c.flatMap(a=>a.groupAssignments.filter(a=>!1!==a.enabled))).map(n),r=l(c.flatMap(b=>b.groupAssignments.filter(b=>!1!==b.enabled&&b.agentId===a))).map(n),s=q.filter(a=>!r.some(b=>b.routeId===a.routeId)&&!c.some(b=>b.groupAssignments.some(b=>!1!==b.enabled&&b.chatId===a.routeId&&b.agentId)));if(e.primaryAgentId===a){let d=m(b,c.flatMap(b=>b.agentIds.filter(b=>b!==a)),[a]);g.push({channelId:e.id,channelName:e.name,routes:s,peers:d})}for(let f of r){let g=m(b,c.flatMap(b=>b.agentIds.filter(b=>b!==a&&b!==e.primaryAgentId)),[a,e.primaryAgentId??""]);h.push({channelId:e.id,channelName:e.name,routeId:f.routeId,label:f.label,kind:f.kind,guildId:f.guildId,primaryAgentId:e.primaryAgentId??a,primaryAgentName:(j=b?.agents.find(b=>b.id===(e.primaryAgentId??a))??null,k=e.primaryAgentId??a,j?(0,d.CK)(j):k),peers:g})}if(e.primaryAgentId&&e.primaryAgentId!==a){let f=m(b,c.flatMap(b=>b.agentIds.filter(b=>b!==e.primaryAgentId&&b!==a)),[a,e.primaryAgentId]);i.push({channelId:e.id,channelName:e.name,routes:s,peers:f,primaryAgentId:e.primaryAgentId,primaryAgentName:(o=b?.agents.find(a=>a.id===e.primaryAgentId)??null,p=e.primaryAgentId,o?(0,d.CK)(o):p)})}}return{primaryChannels:g.sort((a,b)=>a.channelName.localeCompare(b.channelName)),ownedRoutes:h.sort((a,b)=>{let c=`${a.channelName}:${a.label}`,d=`${b.channelName}:${b.label}`;return c.localeCompare(d)}),delegateChannels:i.sort((a,b)=>a.channelName.localeCompare(b.channelName))}}(a,b,c))].filter(a=>!!a);return e.length>0?e.join("\n\n"):null}},24767:(a,b,c)=>{c.d(b,{yw:()=>b0,DM:()=>cj,er:()=>d.er,us:()=>b1,Sn:()=>al,MP:()=>cm,zw:()=>by,RB:()=>as,kd:()=>cf,qu:()=>bB,B5:()=>ce,H6:()=>b7.H6,lC:()=>b7.lC,dM:()=>bs,MQ:()=>b6.MQ,W6:()=>b6.W6,GM:()=>c4,Y9:()=>bt,pf:()=>bu,FJ:()=>bC,tq:()=>cg,f5:()=>b6.f5,MG:()=>b6.MG,W9:()=>ci,lT:()=>ch,xE:()=>b_,ct:()=>br,o6:()=>ck,x4:()=>ar,Vg:()=>b6.Vg,sQ:()=>bA,PR:()=>b6.PR,Oz:()=>cd});var d=c(8533),e=c(51455),f=c(76760),g=c.n(f),h=c(93628);function i(a,b){let c="monitoring"===a?{enabled:!0,every:"30m"}:{enabled:!1,every:"30m"},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 j(a){return a?.enabled?{every:"string"==typeof a.every&&a.every.trim()?a.every.trim():"30m"}:null}var k=c(39503),l=c(76414),m=c(71065),n=c(27091),o=c(98752),p=c(31421),q=c(57975),r=c(14853),s=c(15612),t=c(54252);let u=(0,q.promisify)(p.execFile);function v(a){return"string"==typeof a&&a.trim().length>0?a.trim():null}function w(a){return Array.from(new Set(a.filter(Boolean)))}function x(a){return w([...(a.skillIds??[]).map(a=>v(a)??""),v(a.skillId)??""])}function y(a){return a.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}async function z(a){try{return await (0,e.access)(a),!0}catch{return!1}}async function A(a,b,c={}){try{await u(a,b,{cwd:c.cwd??process.cwd(),timeout:c.timeoutMs??12e4,maxBuffer:8388608})}catch(a){throw Error("object"==typeof a&&a&&"stderr"in a&&"string"==typeof a.stderr&&a.stderr.trim()?a.stderr.trim():a instanceof Error?a.message:"Unknown system command failure.")}}async function B(a,b){try{await (0,e.access)(a)}catch{await (0,e.mkdir)(g().dirname(a),{recursive:!0}),await (0,e.writeFile)(a,b,"utf8")}}async function C(a,b){await (0,e.mkdir)(g().dirname(a),{recursive:!0}),await (0,e.writeFile)(a,b,"utf8")}async function D(a){try{throw await (0,e.access)(a),Error("Target workspace directory already exists.")}catch(a){if("ENOENT"===("object"==typeof a&&a&&"code"in a?a.code:void 0))return;if(a instanceof Error)throw a;throw Error("Unable to verify target workspace directory.")}}async function E(a){try{if(!(await (0,e.stat)(a)).isDirectory())throw Error("Target workspace path exists and is not a directory.");if((await (0,e.readdir)(a)).length>0)throw Error("Target workspace directory already contains files. Use Existing folder instead.")}catch(b){if("ENOENT"===("object"==typeof b&&b&&"code"in b?b.code:void 0))return void await (0,e.mkdir)(a,{recursive:!0});if(b instanceof Error)throw b;throw Error("Unable to prepare the workspace directory.")}await (0,e.mkdir)(a,{recursive:!0})}async function F(a){try{if(!(await (0,e.stat)(a)).isDirectory())throw Error("The selected existing path is not a directory.")}catch(a){if("ENOENT"===("object"==typeof a&&a&&"code"in a?a.code:void 0))throw Error("The selected existing folder does not exist.");if(a instanceof Error)throw a;throw Error("Unable to access the selected existing folder.")}}async function G(a,b){let c=v(b);return c?c.split("@")[0]:await z(g().join(a,"pnpm-lock.yaml"))?"pnpm":await z(g().join(a,"yarn.lock"))?"yarn":"npm"}async function H(a){let b=g().join(a,"package.json");try{let c=await (0,e.readFile)(b,"utf8"),d=JSON.parse(c),f=d.scripts??{},g=await G(a,d.packageManager),h=[`Use \`${g} install\` before the first local run.`];for(let a of["dev","start","test","lint","build"])f[a]&&h.push(`Use \`${"yarn"===g?`yarn ${a}`:`${g} run ${a}`}\` for the ${a} workflow.`);return h}catch{return[]}}async function I(a){let b=g().join(a,"Makefile");try{return((await (0,e.readFile)(b,"utf8")).match(/^(dev|test|lint|build|run):/gm)??[]).map(a=>`Use \`make ${a.replace(/:$/,"")}\` if the Makefile is the primary entry point.`)}catch{return[]}}async function J(a){let b=[];return await z(g().join(a,"pyproject.toml"))&&b.push("Use `pytest` for Python verification if the project exposes a test suite."),await z(g().join(a,"requirements.txt"))&&b.push("Install Python dependencies in a virtualenv before running project commands."),b}async function K(a){let b=[],c=await H(a),d=await I(a),e=await J(a);return b.push(...c,...d,...e),0===b.length&&b.push("Use repository-local scripts or documented commands for repeatable workflows.","Update this file when the project exposes a cleaner build, test, or release path."),w(b).slice(0,6)}function L(a,b){switch(a){case"project-builder":return`# Project Builder
|
|
3
3
|
|
|
4
4
|
Use this skill when implementing changes in the current project.
|
|
5
5
|
|
|
@@ -269,7 +269,7 @@ async function main() {
|
|
|
269
269
|
|
|
270
270
|
await main();
|
|
271
271
|
`}
|
|
272
|
-
`)}function ad(a){if(!a)return"no capability snapshot";let b=[(0,h._P)(a.policy.preset)],c=a.profile.purpose?.trim();c&&b.push(c);let d=W(a.skills).slice(0,2);d.length>0&&b.push(`skills: ${d.join(", ")}`);let e=W(a.tools).slice(0,2);return e.length>0&&b.push(`tools: ${e.join(", ")}`),b.join(" \xb7 ")}async function ae(a,b,c){if(!c)return null;let d=c.agents.find(a=>a.id===b);if(!d)return null;let e=new Map((await (0,T.OL)(a)).agents.map(a=>[a.id,a])),f=c.agents.filter(a=>a.workspaceId===d.workspaceId).sort((a,c)=>{if(a.id===b&&c.id!==b)return -1;if(c.id===b&&a.id!==b)return 1;let d=e.get(a.id),f=e.get(c.id),g=d?.isPrimary??!1;return g!==(f?.isPrimary??!1)?g?-1:1:(0,n.CK)(a).localeCompare((0,n.CK)(c))}).map(a=>{let c=e.get(a.id);return{agentId:a.id,name:(0,n.CK)(a),role:c?.role?.trim()||(0,h._P)(a.policy.preset),isPrimary:c?.isPrimary??!1,isCurrent:a.id===b}});return f.length>0?{members:f}:null}var af=c(21916),ag=c(11782),ah=c(31273),ai=c(96109),aj=c(55828);let ak=["project-researcher","project-builder","project-analyst"];async function al(a){var b,c,e;let f,l=aE(a.id.trim());if(!l)throw Error("Agent id is required.");let n=await (0,d.GM)({includeHidden:!0}),o=aD(n,a.workspaceId),p=(0,af.Nk)(a.workspacePath)??o?.path;p||(o=aD(n=await (0,d.GM)({force:!0,includeHidden:!0}),a.workspaceId),p=(0,af.Nk)(a.workspacePath)??o?.path);let q=o?.id??(p?(0,ai.S_)(p):a.workspaceId||null);if(function(a,b,c){var d,e;let f=a.agents.find(a=>a.id===b);if(!f)return;let h=(d=a,e=f,d.workspaces.find(a=>a.id===e.workspaceId)?.name??g().basename(e.workspacePath));if(f.workspaceId===c)throw Error(`Agent id "${b}" already exists in workspace "${h}".`);throw Error(`Agent id "${b}" is already used by workspace "${h}". Choose a different id.`)}(n,l,q),!p||!q)throw Error("Workspace was not found for this agent.");let r=(0,af.Nk)(a.modelId)??at(n)??(b=n,c=q,b.agents.filter(a=>a.workspaceId===c).map(a=>(0,af.Nk)(a.modelId)).find(a=>a&&"unassigned"!==a&&au(b,a)))??(e=n,(f=(0,af.Nk)(e.diagnostics.modelReadiness.recommendedModelId))&&au(e,f)?f:e.models.map(a=>(0,af.Nk)(a.id)).find(a=>a&&au(e,a))),s=(0,aj.tP)(n,r);if(s)throw Error(s);let u=(0,h.g0)(a.policy?.preset??h.iN,a.policy),v=(0,h.Cf)(u.preset),w=(0,h._Y)(v.skillIds),x=(0,h.X0)(v.tools),y=void 0===a.skills?w:(0,m.H5)(a.skills),z=void 0===a.tools?x:(0,m.at)(a.tools),A=(0,af.Nk)(a.name)??v.defaultName,B=(0,af.Nk)(a.emoji)??v.defaultEmoji,C=(0,af.Nk)(a.theme)??v.defaultTheme,D=(0,af.Nk)(a.avatar),E=j(i(u.preset,a.heartbeat)),F=n.agents.find(a=>a.workspaceId===q&&"setup"===a.policy.preset)?.id??null,G=(0,m.N2)(p,l),H=[];await (0,k.rw)().addAgent({id:l,workspace:p,agentDir:G,model:r,name:A,emoji:B,avatar:D});let I=await $({workspacePath:p,agentId:l,agentName:A,policy:u,setupAgentId:F,snapshot:n});for(let a of y)await _(p,a);try{await aw(l,p,{agentDir:G,name:A,model:r,heartbeat:E,skills:aB([...y,I]),tools:"workspace-only"===u.fileAccess?{fs:{workspaceOnly:!0}}:null,identity:{name:A,emoji:B,theme:C,avatar:D}},n)}catch(a){H.push(an(a))}await az(p,{id:l,name:A,role:(0,h._P)(u.preset),emoji:B,theme:C,enabled:!0,skillId:y[0]??null,skillIds:y,toolIds:z,modelId:r,isPrimary:!1,policy:u,channelIds:a.channelIds??[]}),await (0,t.u)(p),await aa(p,aC(n,p,new Map([[l,y]]))),await (0,m.rH)(l,p,G),(0,d.ZZ)();try{await ay(p)}catch(a){H.push(an(a))}return{agentId:l,workspaceId:q,warnings:aB(H)}}function am(a){var b;return!(!(b=ao(a))||/Refusing to write a redacted OpenClaw secret|path traversal|Workspace was not found|already exists/i.test(b))&&/Timed out waiting for OpenClaw Gateway method "config\.(?:patch|apply|set)"|UNAVAILABLE:.*config\.(?:patch|apply|set)|Gateway-native operation failed; CLI fallback disabled/i.test(b)?"AgentOS created the agent, but OpenClaw could not finish the config sync in time. Restart or refresh the OpenClaw Gateway if the agent profile looks incomplete, then refresh AgentOS.":null}function an(a){let b=am(a);if(!b)throw a;return b}function ao(a){return a instanceof Error?a.message:"string"==typeof a?a:""}async function ap(a){a&&(0,ag.JC)(a)&&await ax("preparing the agent model runtime",()=>(0,l.TP)(a,{provider:"openai-codex"}))}async function aq(a,b){try{await ax(b,()=>(0,k.rw)().updateAgent(a,{timeoutMs:15e3}))}catch(b){let a;if(a=ao(b),/INVALID_REQUEST:\s*agent\s+"[^"]+"\s+not found/i.test(a)&&/Gateway-native operation failed;\s*CLI fallback disabled/i.test(a))return;throw b}}async function ar(a){var b,c,e;let f,g,k,l=a.id.trim();if(!l)throw Error("Agent id is required.");let n=await (0,d.GM)({includeHidden:!0}),o=n.agents.find(a=>a.id===l);if(o||(o=(n=await (0,d.GM)({force:!0,includeHidden:!0})).agents.find(a=>a.id===l)),!o)throw Error("Agent was not found.");let p=aD(n,a.workspaceId||o.workspaceId),q=(0,af.Nk)(a.workspacePath)??p?.path??o.workspacePath,r=p?.id??(q?(0,ai.S_)(q):a.workspaceId||o.workspaceId);if(!q||!r)throw Error("Workspace was not found for this agent.");let s=(0,h.g0)(a.policy?.preset??o.policy.preset,a.policy??o.policy),u=(0,h.Cf)(s.preset),v=(0,h._Y)(u.skillIds),w=(0,h.X0)(u.tools),x=(0,af.Nk)(o.name),y=(0,af.Nk)(o.identity.emoji),z=(0,af.Nk)(o.identity.theme),A=j(i(s.preset,a.heartbeat??(0,m.D9)(o.heartbeat))),B=n.agents.find(a=>a.workspaceId===r&&"setup"===a.policy.preset&&a.id!==l)?.id??null,C=void 0!==a.modelId?(b=a.modelId,(k=(0,af.Nk)(b))&&(0,ag.JC)(k)?(0,ag.JN)(k):k):"unassigned"===o.modelId?at(n):o.modelId;if(void 0!==a.modelId&&void 0===a.name&&void 0===a.emoji&&void 0===a.theme&&void 0===a.avatar&&void 0===a.policy&&void 0===a.heartbeat&&void 0===a.channelIds&&void 0===a.skills&&void 0===a.tools)return await ap(C),await aq({id:l,workspace:q,model:C},"updating the agent model"),await aw(l,q,{agentDir:o.agentDir??(0,m.N2)(q,l),model:C},n),await az(q,{id:l,name:x??o.name??l,emoji:y,theme:z,enabled:!0,modelId:C,isPrimary:o.isDefault,policy:s}),await (0,t.u)(q),await (0,m.rH)(l,q,o.agentDir??(0,m.N2)(q,l)),(0,d.ZZ)(),{agentId:l,workspaceId:r};let D=await $({workspacePath:q,agentId:l,agentName:(0,af.Nk)(a.name)??x??l,policy:s,setupAgentId:B,snapshot:n}),E=(0,m.AB)(o.skills),F=(0,m.at)(o.tools),G=s.preset!==o.policy.preset||0===E.length,H=s.preset!==o.policy.preset||0===F.length,I=void 0===a.skills&&"custom"===s.preset&&(c=E,e=ak,f=new Set(c),g=new Set(e),f.size===g.size&&Array.from(f).every(a=>g.has(a))),J=void 0===a.skills?I?[]:G?v:E:(0,m.H5)(a.skills);for(let a of J)await _(q,a);await ap(C),await aq({id:l,workspace:q,model:C},"updating the agent");let K=await aw(l,q,{agentDir:o.agentDir??(0,m.N2)(q,l),name:void 0!==a.name?(0,af.Nk)(a.name):void 0,model:C,heartbeat:A,skills:aB([...J,D]),tools:"workspace-only"===s.fileAccess?{fs:{workspaceOnly:!0}}:null,identity:{name:(0,af.Nk)(a.name)??x??l,emoji:(0,af.Nk)(a.emoji)??y,theme:(0,af.Nk)(a.theme)??z,avatar:(0,af.Nk)(a.avatar)}},n),L=void 0===a.tools?H?w:void 0:(0,m.at)(a.tools);return await az(q,{id:l,name:(0,af.Nk)(a.name)??x??K.name??l,emoji:(0,af.Nk)(a.emoji)??y,theme:(0,af.Nk)(a.theme)??z,enabled:!0,modelId:C,isPrimary:o.isDefault,policy:s,channelIds:a.channelIds,skillId:J[0]??null,skillIds:J,toolIds:L}),await (0,t.u)(q),await aa(q,aC(n,q,new Map([[l,J]]))),await (0,m.rH)(l,q,o.agentDir??(0,m.N2)(q,l)),(0,d.ZZ)(),await ay(q),{agentId:l,workspaceId:r}}async function as(a){let b=a.agentId.trim();if(!b)throw Error("Agent id is required.");let c=await (0,d.GM)({includeHidden:!0}),f=c.agents.find(a=>a.id===b);if(f||(f=(c=await (0,d.GM)({force:!0,includeHidden:!0})).agents.find(a=>a.id===b)),!f)throw Error("Agent was not found.");let h=c.workspaces.find(a=>a.id===f.workspaceId)??null,i=c.runtimes.filter(a=>a.agentId===f.id).length;await (0,k.rw)().deleteAgent(f.id);try{let a=await (0,m.CI)(c),b=a.filter(a=>a.id!==f.id);b.length!==a.length&&await (0,m.ZF)(b)}catch{}if(h){await aA(h.path,f.id),await (0,t.u)(h.path),await aa(h.path,aC(c,h.path,new Map([[f.id,[]]]))),await (0,m.rH)(f.id,h.path,f.agentDir);try{await (0,e.rm)(g().join(h.path,"skills",(0,m.Uo)(f.id)),{recursive:!0,force:!0})}catch{}(0,d.ZZ)(),await ay(h.path)}return(0,d.b7)(),{agentId:f.id,workspaceId:f.workspaceId,workspacePath:f.workspacePath,deletedRuntimeCount:i}}function at(a){if(a.diagnostics.modelReadiness.defaultModelReady)return(0,af.Nk)(a.diagnostics.modelReadiness.resolvedDefaultModel)??(0,af.Nk)(a.diagnostics.modelReadiness.defaultModel)??void 0}function au(a,b){let c=a.models.find(a=>a.id===b);return!!c&&!0!==c.missing&&!1!==c.available}async function av(a,b){let c=aB(a);if(0===c.length)return;let e=b??await (0,d.GM)({includeHidden:!0});for(let a of c){let b=e.agents.find(b=>b.id===a);if(!b)continue;let c=e.agents.find(a=>a.workspaceId===b.workspaceId&&"setup"===a.policy.preset&&a.id!==b.id)?.id??null,d=await $({workspacePath:b.workspacePath,agentId:b.id,agentName:b.name,policy:b.policy,setupAgentId:c,snapshot:e});await aw(b.id,b.workspacePath,{agentDir:b.agentDir??(0,m.N2)(b.workspacePath,b.id),name:b.name,model:(0,af.Nk)(b.modelId),heartbeat:b.heartbeat.enabled&&b.heartbeat.every?{every:b.heartbeat.every}:null,skills:[...(0,m.AB)(b.skills),d],tools:b.tools.includes("fs.workspaceOnly")?{fs:{workspaceOnly:!0}}:null,identity:{name:b.identityName??b.name,emoji:b.identity.emoji,theme:b.identity.theme,avatar:b.identity.avatar}},e)}}async function aw(...a){return ax("syncing the agent config",()=>(0,m.jq)(...a))}async function ax(a,b){return(await (0,ah.g7)(b,{operationLabel:a})).value}async function ay(a,b){let c=b??await (0,d.GM)({includeHidden:!0}),e=c.agents.filter(b=>b.workspacePath===a).map(a=>a.id);await av(e,c)}async function az(a,b){let c=g().join(a,".openclaw","project.json"),d={},f=null;try{let a=await (0,e.readFile)(c,"utf8"),g=JSON.parse(a);d=aF(g)?g:{},Array.isArray(d.agents)&&(f=d.agents.map(a=>(0,T.aW)(a)).filter(a=>!!a).find(a=>a.id===b.id)??null)}catch{d={}}let h=Array.isArray(b.skillIds)?aB(b.skillIds.map(a=>a.trim()).filter(Boolean)):void 0!==b.skillId?[(0,af.Nk)(b.skillId)].filter(a=>!!a):f?.skillIds??(f?.skillId?[f.skillId]:[]),i={id:b.id,name:b.name??f?.name??null,role:b.role??f?.role??null,isPrimary:b.isPrimary??f?.isPrimary??!1,enabled:b.enabled??f?.enabled??!0,emoji:b.emoji??f?.emoji??null,theme:b.theme??f?.theme??null,skillId:h[0]??null,skillIds:h,toolIds:Array.isArray(b.toolIds)?aB(b.toolIds.map(a=>a.trim()).filter(a=>!!a&&"fs.workspaceOnly"!==a)):f?.toolIds??[],modelId:b.modelId??f?.modelId??null,policy:b.policy,channelIds:Array.isArray(b.channelIds)?Array.from(new Set(b.channelIds.filter(a=>"string"==typeof a&&a.trim()))):f?.channelIds??[]},j=Array.isArray(d.agents)?d.agents.filter(a=>aF(a)&&"string"==typeof a.id&&a.id!==b.id):[];j.push(i),d.version="number"==typeof d.version?d.version:1,d.slug="string"==typeof d.slug?d.slug:aE(g().basename(a)),d.name="string"==typeof d.name?d.name:g().basename(a),d.updatedAt=new Date().toISOString(),d.agents=j,await C(c,`${JSON.stringify(d,null,2)}
|
|
272
|
+
`)}function ad(a){if(!a)return"no capability snapshot";let b=[(0,h._P)(a.policy.preset)],c=a.profile.purpose?.trim();c&&b.push(c);let d=W(a.skills).slice(0,2);d.length>0&&b.push(`skills: ${d.join(", ")}`);let e=W(a.tools).slice(0,2);return e.length>0&&b.push(`tools: ${e.join(", ")}`),b.join(" \xb7 ")}async function ae(a,b,c){if(!c)return null;let d=c.agents.find(a=>a.id===b);if(!d)return null;let e=new Map((await (0,T.OL)(a)).agents.map(a=>[a.id,a])),f=c.agents.filter(a=>a.workspaceId===d.workspaceId).sort((a,c)=>{if(a.id===b&&c.id!==b)return -1;if(c.id===b&&a.id!==b)return 1;let d=e.get(a.id),f=e.get(c.id),g=d?.isPrimary??!1;return g!==(f?.isPrimary??!1)?g?-1:1:(0,n.CK)(a).localeCompare((0,n.CK)(c))}).map(a=>{let c=e.get(a.id);return{agentId:a.id,name:(0,n.CK)(a),role:c?.role?.trim()||(0,h._P)(a.policy.preset),isPrimary:c?.isPrimary??!1,isCurrent:a.id===b}});return f.length>0?{members:f}:null}var af=c(21916),ag=c(11782),ah=c(31273),ai=c(96109),aj=c(55828);let ak=["project-researcher","project-builder","project-analyst"];async function al(a){var b,c,e;let f,l=aE(a.id.trim());if(!l)throw Error("Agent id is required.");let n=await (0,d.GM)({includeHidden:!0}),o=aD(n,a.workspaceId),p=(0,af.Nk)(a.workspacePath)??o?.path;p||(o=aD(n=await (0,d.GM)({force:!0,includeHidden:!0}),a.workspaceId),p=(0,af.Nk)(a.workspacePath)??o?.path);let q=o?.id??(p?(0,ai.S_)(p):a.workspaceId||null);if(function(a,b,c){var d,e;let f=a.agents.find(a=>a.id===b);if(!f)return;let h=(d=a,e=f,d.workspaces.find(a=>a.id===e.workspaceId)?.name??g().basename(e.workspacePath));if(f.workspaceId===c)throw Error(`Agent id "${b}" already exists in workspace "${h}".`);throw Error(`Agent id "${b}" is already used by workspace "${h}". Choose a different id.`)}(n,l,q),!p||!q)throw Error("Workspace was not found for this agent.");let r=(0,af.Nk)(a.modelId),s=at(n)??(b=n,c=q,b.agents.filter(a=>a.workspaceId===c).map(a=>(0,af.Nk)(a.modelId)).find(a=>a&&"unassigned"!==a&&au(b,a)))??(e=n,(f=(0,af.Nk)(e.diagnostics.modelReadiness.recommendedModelId))&&au(e,f)?f:e.models.map(a=>(0,af.Nk)(a.id)).find(a=>a&&au(e,a))),u=function(a,b,c){let d=b??c,e=[];if(!b||!c||c===b)return{modelId:d,warnings:e};let f=(0,aj.tP)(a,b),g=(0,aj.tP)(a,c);return f&&!g&&(d=c,e.push(`Requested model ${b} is not ready. AgentOS created the agent with ${c}; configure ${b} before assigning it.`)),{modelId:d,warnings:e}}(n,r,s),v=u.modelId,w=(0,aj.tP)(n,v);if(w)throw Error(w);let x=(0,h.g0)(a.policy?.preset??h.iN,a.policy),y=(0,h.Cf)(x.preset),z=(0,h._Y)(y.skillIds),A=(0,h.X0)(y.tools),B=void 0===a.skills?z:(0,m.H5)(a.skills),C=void 0===a.tools?A:(0,m.at)(a.tools),D=(0,af.Nk)(a.name)??y.defaultName,E=(0,af.Nk)(a.emoji)??y.defaultEmoji,F=(0,af.Nk)(a.theme)??y.defaultTheme,G=(0,af.Nk)(a.avatar),H=j(i(x.preset,a.heartbeat)),I=n.agents.find(a=>a.workspaceId===q&&"setup"===a.policy.preset)?.id??null,J=(0,m.N2)(p,l),K=[...u.warnings];await (0,k.rw)().addAgent({id:l,workspace:p,agentDir:J,model:v,name:D,emoji:E,avatar:G});let L=await $({workspacePath:p,agentId:l,agentName:D,policy:x,setupAgentId:I,snapshot:n});for(let a of B)await _(p,a);try{await aw(l,p,{agentDir:J,name:D,model:v,heartbeat:H,skills:aB([...B,L]),tools:"workspace-only"===x.fileAccess?{fs:{workspaceOnly:!0}}:null,identity:{name:D,emoji:E,theme:F,avatar:G}},n)}catch(a){K.push(an(a))}await az(p,{id:l,name:D,role:(0,h._P)(x.preset),emoji:E,theme:F,enabled:!0,skillId:B[0]??null,skillIds:B,toolIds:C,modelId:v,isPrimary:!1,policy:x,channelIds:a.channelIds??[]}),await (0,t.u)(p),await aa(p,aC(n,p,new Map([[l,B]]))),await (0,m.rH)(l,p,J),(0,d.ZZ)();try{await ay(p)}catch(a){K.push(an(a))}return{agentId:l,workspaceId:q,warnings:aB(K)}}function am(a){var b;return!(!(b=ao(a))||/Refusing to write a redacted OpenClaw secret|path traversal|Workspace was not found|already exists/i.test(b))&&/Timed out waiting for OpenClaw Gateway method "config\.(?:patch|apply|set)"|UNAVAILABLE:.*config\.(?:patch|apply|set)|Gateway-native operation failed; CLI fallback disabled/i.test(b)?"AgentOS created the agent, but OpenClaw could not finish the config sync in time. Restart or refresh the OpenClaw Gateway if the agent profile looks incomplete, then refresh AgentOS.":null}function an(a){let b=am(a);if(!b)throw a;return b}function ao(a){return a instanceof Error?a.message:"string"==typeof a?a:""}async function ap(a){a&&(0,ag.JC)(a)&&await ax("preparing the agent model runtime",()=>(0,l.TP)(a,{provider:"openai-codex"}))}async function aq(a,b){try{await ax(b,()=>(0,k.rw)().updateAgent(a,{timeoutMs:15e3}))}catch(b){let a;if(a=ao(b),/INVALID_REQUEST:\s*agent\s+"[^"]+"\s+not found/i.test(a)&&/Gateway-native operation failed;\s*CLI fallback disabled/i.test(a))return;throw b}}async function ar(a){var b,c,e;let f,g,k,l=a.id.trim();if(!l)throw Error("Agent id is required.");let n=await (0,d.GM)({includeHidden:!0}),o=n.agents.find(a=>a.id===l);if(o||(o=(n=await (0,d.GM)({force:!0,includeHidden:!0})).agents.find(a=>a.id===l)),!o)throw Error("Agent was not found.");let p=aD(n,a.workspaceId||o.workspaceId),q=(0,af.Nk)(a.workspacePath)??p?.path??o.workspacePath,r=p?.id??(q?(0,ai.S_)(q):a.workspaceId||o.workspaceId);if(!q||!r)throw Error("Workspace was not found for this agent.");let s=(0,h.g0)(a.policy?.preset??o.policy.preset,a.policy??o.policy),u=(0,h.Cf)(s.preset),v=(0,h._Y)(u.skillIds),w=(0,h.X0)(u.tools),x=(0,af.Nk)(o.name),y=(0,af.Nk)(o.identity.emoji),z=(0,af.Nk)(o.identity.theme),A=j(i(s.preset,a.heartbeat??(0,m.D9)(o.heartbeat))),B=n.agents.find(a=>a.workspaceId===r&&"setup"===a.policy.preset&&a.id!==l)?.id??null,C=void 0!==a.modelId?(b=a.modelId,(k=(0,af.Nk)(b))&&(0,ag.JC)(k)?(0,ag.JN)(k):k):"unassigned"===o.modelId?at(n):o.modelId;if(void 0!==a.modelId&&void 0===a.name&&void 0===a.emoji&&void 0===a.theme&&void 0===a.avatar&&void 0===a.policy&&void 0===a.heartbeat&&void 0===a.channelIds&&void 0===a.skills&&void 0===a.tools)return await ap(C),await aq({id:l,workspace:q,model:C},"updating the agent model"),await aw(l,q,{agentDir:o.agentDir??(0,m.N2)(q,l),model:C},n),await az(q,{id:l,name:x??o.name??l,emoji:y,theme:z,enabled:!0,modelId:C,isPrimary:o.isDefault,policy:s}),await (0,t.u)(q),await (0,m.rH)(l,q,o.agentDir??(0,m.N2)(q,l)),(0,d.ZZ)(),{agentId:l,workspaceId:r};let D=await $({workspacePath:q,agentId:l,agentName:(0,af.Nk)(a.name)??x??l,policy:s,setupAgentId:B,snapshot:n}),E=(0,m.AB)(o.skills),F=(0,m.at)(o.tools),G=s.preset!==o.policy.preset||0===E.length,H=s.preset!==o.policy.preset||0===F.length,I=void 0===a.skills&&"custom"===s.preset&&(c=E,e=ak,f=new Set(c),g=new Set(e),f.size===g.size&&Array.from(f).every(a=>g.has(a))),J=void 0===a.skills?I?[]:G?v:E:(0,m.H5)(a.skills);for(let a of J)await _(q,a);await ap(C),await aq({id:l,workspace:q,model:C},"updating the agent");let K=await aw(l,q,{agentDir:o.agentDir??(0,m.N2)(q,l),name:void 0!==a.name?(0,af.Nk)(a.name):void 0,model:C,heartbeat:A,skills:aB([...J,D]),tools:"workspace-only"===s.fileAccess?{fs:{workspaceOnly:!0}}:null,identity:{name:(0,af.Nk)(a.name)??x??l,emoji:(0,af.Nk)(a.emoji)??y,theme:(0,af.Nk)(a.theme)??z,avatar:(0,af.Nk)(a.avatar)}},n),L=void 0===a.tools?H?w:void 0:(0,m.at)(a.tools);return await az(q,{id:l,name:(0,af.Nk)(a.name)??x??K.name??l,emoji:(0,af.Nk)(a.emoji)??y,theme:(0,af.Nk)(a.theme)??z,enabled:!0,modelId:C,isPrimary:o.isDefault,policy:s,channelIds:a.channelIds,skillId:J[0]??null,skillIds:J,toolIds:L}),await (0,t.u)(q),await aa(q,aC(n,q,new Map([[l,J]]))),await (0,m.rH)(l,q,o.agentDir??(0,m.N2)(q,l)),(0,d.ZZ)(),await ay(q),{agentId:l,workspaceId:r}}async function as(a){let b=a.agentId.trim();if(!b)throw Error("Agent id is required.");let c=await (0,d.GM)({includeHidden:!0}),f=c.agents.find(a=>a.id===b);if(f||(f=(c=await (0,d.GM)({force:!0,includeHidden:!0})).agents.find(a=>a.id===b)),!f)throw Error("Agent was not found.");let h=c.workspaces.find(a=>a.id===f.workspaceId)??null,i=c.runtimes.filter(a=>a.agentId===f.id).length;await (0,k.rw)().deleteAgent(f.id);try{let a=await (0,m.CI)(c),b=a.filter(a=>a.id!==f.id);b.length!==a.length&&await (0,m.ZF)(b)}catch{}if(h){await aA(h.path,f.id),await (0,t.u)(h.path),await aa(h.path,aC(c,h.path,new Map([[f.id,[]]]))),await (0,m.rH)(f.id,h.path,f.agentDir);try{await (0,e.rm)(g().join(h.path,"skills",(0,m.Uo)(f.id)),{recursive:!0,force:!0})}catch{}(0,d.ZZ)(),await ay(h.path)}return(0,d.b7)(),{agentId:f.id,workspaceId:f.workspaceId,workspacePath:f.workspacePath,deletedRuntimeCount:i}}function at(a){if(a.diagnostics.modelReadiness.defaultModelReady)return(0,af.Nk)(a.diagnostics.modelReadiness.resolvedDefaultModel)??(0,af.Nk)(a.diagnostics.modelReadiness.defaultModel)??void 0}function au(a,b){let c=a.models.find(a=>a.id===b);return!!c&&!0!==c.missing&&!1!==c.available}async function av(a,b){let c=aB(a);if(0===c.length)return;let e=b??await (0,d.GM)({includeHidden:!0});for(let a of c){let b=e.agents.find(b=>b.id===a);if(!b)continue;let c=e.agents.find(a=>a.workspaceId===b.workspaceId&&"setup"===a.policy.preset&&a.id!==b.id)?.id??null,d=await $({workspacePath:b.workspacePath,agentId:b.id,agentName:b.name,policy:b.policy,setupAgentId:c,snapshot:e});await aw(b.id,b.workspacePath,{agentDir:b.agentDir??(0,m.N2)(b.workspacePath,b.id),name:b.name,model:(0,af.Nk)(b.modelId),heartbeat:b.heartbeat.enabled&&b.heartbeat.every?{every:b.heartbeat.every}:null,skills:[...(0,m.AB)(b.skills),d],tools:b.tools.includes("fs.workspaceOnly")?{fs:{workspaceOnly:!0}}:null,identity:{name:b.identityName??b.name,emoji:b.identity.emoji,theme:b.identity.theme,avatar:b.identity.avatar}},e)}}async function aw(...a){return ax("syncing the agent config",()=>(0,m.jq)(...a))}async function ax(a,b){return(await (0,ah.g7)(b,{operationLabel:a})).value}async function ay(a,b){let c=b??await (0,d.GM)({includeHidden:!0}),e=c.agents.filter(b=>b.workspacePath===a).map(a=>a.id);await av(e,c)}async function az(a,b){let c=g().join(a,".openclaw","project.json"),d={},f=null;try{let a=await (0,e.readFile)(c,"utf8"),g=JSON.parse(a);d=aF(g)?g:{},Array.isArray(d.agents)&&(f=d.agents.map(a=>(0,T.aW)(a)).filter(a=>!!a).find(a=>a.id===b.id)??null)}catch{d={}}let h=Array.isArray(b.skillIds)?aB(b.skillIds.map(a=>a.trim()).filter(Boolean)):void 0!==b.skillId?[(0,af.Nk)(b.skillId)].filter(a=>!!a):f?.skillIds??(f?.skillId?[f.skillId]:[]),i={id:b.id,name:b.name??f?.name??null,role:b.role??f?.role??null,isPrimary:b.isPrimary??f?.isPrimary??!1,enabled:b.enabled??f?.enabled??!0,emoji:b.emoji??f?.emoji??null,theme:b.theme??f?.theme??null,skillId:h[0]??null,skillIds:h,toolIds:Array.isArray(b.toolIds)?aB(b.toolIds.map(a=>a.trim()).filter(a=>!!a&&"fs.workspaceOnly"!==a)):f?.toolIds??[],modelId:b.modelId??f?.modelId??null,policy:b.policy,channelIds:Array.isArray(b.channelIds)?Array.from(new Set(b.channelIds.filter(a=>"string"==typeof a&&a.trim()))):f?.channelIds??[]},j=Array.isArray(d.agents)?d.agents.filter(a=>aF(a)&&"string"==typeof a.id&&a.id!==b.id):[];j.push(i),d.version="number"==typeof d.version?d.version:1,d.slug="string"==typeof d.slug?d.slug:aE(g().basename(a)),d.name="string"==typeof d.name?d.name:g().basename(a),d.updatedAt=new Date().toISOString(),d.agents=j,await C(c,`${JSON.stringify(d,null,2)}
|
|
273
273
|
`)}async function aA(a,b){let c=g().join(a,".openclaw","project.json"),d={};try{let a=await (0,e.readFile)(c,"utf8"),b=JSON.parse(a);d=aF(b)?b:{}}catch{return}if(!Array.isArray(d.agents))return;let f=d.agents.map(a=>(0,T.aW)(a)).filter(a=>!!a),h=f.filter(a=>a.id!==b);h.length!==f.length&&(h.length>0&&!h.some(a=>a.isPrimary)&&(h[0]={...h[0],isPrimary:!0}),d.updatedAt=new Date().toISOString(),d.agents=h,await C(c,`${JSON.stringify(d,null,2)}
|
|
274
274
|
`))}function aB(a){return Array.from(new Set(a.filter(Boolean)))}function aC(a,b,c){return aB([...a.agents.flatMap(a=>a.workspacePath!==b?[]:c.has(a.id)?c.get(a.id)??[]:a.skills),...Array.from(c.values()).flat()])}function aD(a,b){if(b)return a.workspaces.find(a=>a.id===b)??a.workspaces.find(a=>(0,ai.xV)(a.path,b))}function aE(a){return a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function aF(a){return"object"==typeof a&&null!==a}var aG=c(48161),aH=c.n(aG),aI=c(57419),aJ=c(9443),aK=c(185),aL=c(78446),aM=c(14414),aN=c(25793);let aO=/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi;function aP(a){if(!a)return!1;let b=a.trim().toLowerCase();return"ready"===b||"completed"===b||"complete"===b||"ok"===b||"success"===b}async function aQ(a){var b,c,d,e;let f,{task:g,dispatchRecord:h,createdFiles:i,snapshot:j}=a,k=await aT(h?.outputDir??null),l=h?await aR(h,j,a.runs):[],m=g.mission||h?.mission||null,n=m&&l.length>0?l.filter(a=>(0,aM.Dm)(a.prompt,m)):l,o=[...n].sort((a,b)=>Date.parse(b.updatedAt)-Date.parse(a.updatedAt))[0]??null,p=o?.finalText?.trim()||null,q=h?aP(f=((b=h.result)&&"object"==typeof b?(Array.isArray(b.result?.payloads)?b.result.payloads:Array.isArray(b.payloads)?b.payloads:[]).filter(a=>!!a&&"string"==typeof a.text):[]).find(a=>a.text.trim().length>0)?.text.trim()??null)?null:f:null,r=p||q||null,s=p?"runtime":q?"dispatch":"none",t=!!(h&&l.length>0&&0===n.length),u=(0,aN.xZ)(n),v=function(a){let b=new Set;for(let c of a)if(c)for(let a of c.match(aO)??[])b.add(a.toLowerCase());return[...b]}([r,q,...n.flatMap(a=>a.items.map(a=>a.text))]),w=[],x=aP(r),y=!!(c=m)&&(/\.(txt|md|json|csv|html|pdf|docx?)\b/i.test(c)||/\b(file|files|artifact|artifacts|report|document|save|export|attachment)\b/i.test(c)||/\b(dosya|dosyasi|kaydet|kaydi|cikti)\b/i.test(c)),z=!!(d=m)&&/\b(email|e-mail|mail|mail address|mail adres|eposta|e-posta)\b/i.test(d),A=!!(e=m)&&(/https?:\/\//i.test(e)||/\b[a-z0-9-]+\.(com|net|org|io|ai|co|tr|app|dev|me|info|biz|edu|gov)\b/i.test(e)||/\b(site|website|web|browser|browse|fetch|sitesine|siteye|siteyi)\b/i.test(e));return h?.outputDir&&!k.exists&&w.push({id:"missing-output-dir",severity:"warning",title:"Output folder is missing",detail:`The dispatch points at ${h.outputDirRelative||h.outputDir}, but that folder is not accessible now.`}),"completed"===g.status&&y&&h?.outputDir&&k.exists&&0===k.fileCount&&0===i.length&&w.push({id:"empty-output-dir",severity:"error",title:"Deliverables folder is empty",detail:"The task asked for a file deliverable, but the assigned deliverables folder does not contain any files."}),"completed"===g.status&&0===l.length&&w.push({id:"missing-transcript",severity:"warning",title:"No runtime transcript was captured",detail:"AgentOS could not verify what the agent actually did because no transcript was recovered for this dispatch."}),"cancelled"===g.status&&w.push({id:"task-cancelled",severity:"warning",title:"Task was cancelled by the operator",detail:h?.error||"The mission dispatch was stopped before completion, so the captured evidence is intentionally incomplete."}),t&&h?.agentId&&w.push({id:"session-mismatch",severity:"error",title:"Recovered session does not match the mission",detail:"The linked transcript session exists, but none of its user turns match this task mission. The dispatch likely reused or attached the wrong session."}),"completed"!==g.status||r?"stalled"===g.status&&r&&o?.status!=="completed"?w.push({id:"partial-final-response",severity:"warning",title:"Final response came from an incomplete runtime",detail:"The assistant produced output, but the runtime stalled before the task completed. Treat this as the last captured response, not a verified completion."}):"completed"===g.status&&x&&r&&w.push({id:"placeholder-final-response",severity:0===k.fileCount&&0===i.length&&0===n.length?"error":"warning",title:"Completion response looks like a placeholder",detail:`The captured final response was "${r}", which is not enough evidence that the requested work actually finished.`}):w.push({id:"missing-final-response",severity:"warning",title:"No final answer was captured",detail:"The task completed without a final assistant response in either the runtime transcript or the dispatch payload."}),"completed"===g.status&&A&&n.length>0&&0===u.length&&w.push({id:"missing-tool-evidence",severity:"warning",title:"No tool usage was recovered",detail:"This mission looks like it needed external lookup or browsing, but the matching transcript turn does not show any recovered tool calls."}),"completed"===g.status&&z&&0===v.length&&w.push({id:"missing-email",severity:"warning",title:"Requested email address was not captured",detail:"The task appears to ask for an email address, but none was detected in the final response or the matching transcript."}),{status:w.some(a=>"error"===a.severity)?"error":w.length>0?"warning":"verified",outputDir:h?.outputDir??null,outputDirRelative:h?.outputDirRelative??null,outputDirExists:k.exists,outputFileCount:k.fileCount,transcriptTurnCount:l.length,matchingTranscriptTurnCount:n.length,finalResponseText:r,finalResponseSource:s,dispatchSessionId:h?aS(h,a.runs)[0]??null:null,sessionMismatch:t,toolNames:u,emails:v,issues:w}}async function aR(a,b,c){let d=aS(a,c);if(0===d.length)return[];let f=b.agents.find(b=>b.id===a.agentId);for(let b of d){let c=await (0,aN.WU)(a.agentId,b,a.workspacePath??f?.workspacePath);if(c)try{let d=await (0,e.readFile)(c,"utf8"),g={id:`runtime:dispatch:${a.id}`,sessionId:b,agentId:a.agentId,taskId:a.id,metadata:{dispatchSubmittedAt:a.submittedAt}},h=(0,aN.qv)(g,(0,aN.SI)(d,g,a.workspacePath??f?.workspacePath));if(h.length>0)return h}catch{continue}}return[]}function aS(a,b){var c;let d;return Array.from(new Set([...b.filter(b=>{var c,d;let e,f;return c=a,e="string"==typeof(d=b).metadata.dispatchId?d.metadata.dispatchId.trim():"",f=d.runId?.trim()||"",e===c.id||f===c.id}).map(a=>a.sessionId?.trim()||null),(c=function(a){var b;let c=((b=a).result&&"object"==typeof b.result?b.result:null)?.meta;if(!c||"object"!=typeof c){let b=a.meta;return b&&"object"==typeof b?aV(b):null}return aV(c)}(a),("string"==typeof(d=c?.sessionId)&&d.trim().length>0?d:null)??function(a){let b=a?.trim();if(!b?.startsWith("runtime:"))return null;let c=b.split(":")[1];return c&&"dispatch"!==c?c:null}(a.observation.runtimeId)??(a.sessionId?.trim()||null))].filter(a=>!!a)))}async function aT(a){if(!a)return{exists:!1,fileCount:0};try{if(!(await (0,e.stat)(a)).isDirectory())return{exists:!0,fileCount:1};return{exists:!0,fileCount:await aU(a)}}catch{return{exists:!1,fileCount:0}}}async function aU(a){let b=await (0,e.readdir)(a,{withFileTypes:!0}),c=0;for(let d of b){let b=g().join(a,d.name);if(d.isDirectory()){c+=await aU(b);continue}d.isFile()&&(c+=1)}return c}function aV(a){if(!a||"object"!=typeof a)return null;let b=a.agentMeta;return b&&"object"==typeof b?b:null}var aW=c(69699);let aX=new Set(["cause","code","details","error","message","reason","stack","stderr","stdout","warning"]);async function aY(a,b=18){let c=a.runner.logPath?.trim();if(!c)return[];try{return(await (0,e.readFile)(c,"utf8")).split(/\r?\n/).map(a=>(function(a){let b=a.trim();if(!b)return null;try{var c;let a=JSON.parse(b);if(!a||"string"!=typeof a.id||"string"!=typeof a.timestamp||"string"!=typeof a.text||(c=a.stream,"status"!==c&&"stdout"!==c&&"stderr"!==c))return null;return{id:a.id,timestamp:a.timestamp,stream:a.stream,text:a.text}}catch{return null}})(a)).filter(a=>!!a).map(a=>{var b;let c;return b=a,(c=aZ(b.text))?{...b,text:c}:null}).filter(a=>!!a).slice(-b)}catch{return[]}}function aZ(a){let b=a.trim();if(!b||function(a){if(/^[\[\]{}(),]+$/.test(a))return!0;let b=a.match(/^"([^"]+)"\s*:\s*(.+?)(,)?$/);return b?!aX.has(b[1].toLowerCase()):(a.match(/^([A-Za-z0-9_.-]+)\s*:\s*(.+)$/),!1)}(b))return null;let c=b.match(/^"([^"]+)"\s*:\s*(.+?)(,)?$/);if(c){let[,a,b]=c;return aX.has(a.toLowerCase())?`${a$(a)}: ${a_(b)}`:null}let d=b.match(/^([A-Za-z0-9_.-]+)\s*:\s*(.+)$/);return d&&aX.has(d[1].toLowerCase())?`${a$(d[1])}: ${a_(d[2])}`:b}function a$(a){return a.charAt(0).toUpperCase()+a.slice(1)}function a_(a){let b=a.trim().replace(/,$/,"");if(!b)return"";try{let a=JSON.parse(b);if("string"==typeof a)return a;if("number"==typeof a||"boolean"==typeof a)return String(a)}catch{}return b.replace(/^"(.*)"$/,"$1")}var a0=c(80410),a1=c(28182);async function a2(a,b,c){if(!b)return[];let d=(0,n.CK)(c.agents.find(b=>b.id===a.primaryAgentId)??{name:"OpenClaw"}),e=await aY(b),f=b.runner.logPath&&b.runner.logPath.trim()?{path:b.runner.logPath,displayPath:g().basename(b.runner.logPath)}:null,h=[a3({id:`${b.id}:accepted`,kind:"user",timestamp:b.submittedAt,title:"Mission accepted",detail:a8(a.mission||b.mission||"Mission queued for dispatch.",220),agentId:a.primaryAgentId},{urlSources:[a.mission,b.mission,b.routedMission]})];if((b.runner.startedAt||b.runner.pid)&&h.push(a3({id:`${b.id}:runner-started`,kind:"status",timestamp:b.runner.startedAt??b.updatedAt,title:"Dispatch runner started",detail:b.outputDirRelative?`Preparing the first OpenClaw runtime in ${b.outputDirRelative}.`:"Preparing the first OpenClaw runtime."},{file:b.outputDir&&b.outputDirRelative?{path:b.outputDir,displayPath:b.outputDirRelative}:null})),b.runner.lastHeartbeatAt&&(b.observation.observedAt||"completed"===b.status||h.push(a3({id:`${b.id}:heartbeat`,kind:"status",timestamp:b.runner.lastHeartbeatAt,title:"Heartbeat received",detail:`${d} is online. Waiting for the first runtime session.`},{urlSources:[d,b.outputDirRelative]}))),b.observation.observedAt&&"completed"!==b.status&&h.push(a3({id:`${b.id}:runtime-observed`,kind:"status",timestamp:b.observation.observedAt,title:"Runtime observed",detail:"OpenClaw observed a runtime. Waiting for the first output update."},{urlSources:[b.outputDirRelative]})),"completed"===b.status){let c="string"==typeof a.metadata.finalResponseText?a.metadata.finalResponseText.trim():"",d=(0,aW.Bx)(b)||(0,aW.v0)(b)||c,e=(0,aW.E_)(b);h.push(a3({id:`${b.id}:completed`,kind:"status",timestamp:b.runner.finishedAt??b.updatedAt,title:d?"Mission finished":"Dispatch runner finished",detail:a8(d||(0,aW.kc)(b),220)},{urlSources:[d,(0,aW.kc)(b),b.outputDirRelative],file:e??(b.outputDir&&b.outputDirRelative?{path:b.outputDir,displayPath:b.outputDirRelative}:null)}))}"cancelled"===b.status&&h.push(a3({id:`${b.id}:cancelled`,kind:"warning",timestamp:b.runner.finishedAt??b.updatedAt,title:"Mission cancelled",detail:a8((0,aW.kc)(b),220),isError:!1},{urlSources:[b.error,b.outputDirRelative],file:b.outputDir&&b.outputDirRelative?{path:b.outputDir,displayPath:b.outputDirRelative}:null}));let i=(0,aW.gv)(b);if(i&&h.push(a3({id:`${b.id}:integrity-warning`,kind:"warning",timestamp:b.runner.finishedAt??b.updatedAt,title:"Result needs review",detail:a8(i,220),isError:!0},{urlSources:[b.outputDirRelative],file:b.outputDir&&b.outputDirRelative?{path:b.outputDir,displayPath:b.outputDirRelative}:null})),"stalled"===b.status){var j,k;let a,c,e=(j=b,k=d,a=a5(j.error),c=!!(j.observation.observedAt||j.runner.lastHeartbeatAt),a||!j.error&&c?{kind:"status",title:a?"Waiting for output":"Working silently",detail:a?`${k} has a runtime, but AgentOS has not captured transcript output yet. Updates will stream here when the session writes its first entry.`:`${k} is still being observed, but no transcript output has arrived yet. AgentOS will keep the feed attached.`,isError:!1}:{kind:"warning",title:"Needs attention",detail:j.error||(j.runner.lastHeartbeatAt?"OpenClaw stopped reporting progress while waiting for the first runtime.":"OpenClaw did not produce the first heartbeat in time."),isError:!0});h.push(a3({id:`${b.id}:stalled`,kind:e.kind,timestamp:b.updatedAt,title:e.title,detail:a8(e.detail,220),isError:e.isError},{urlSources:[b.error,b.outputDirRelative]}))}for(let b of e){let c=function(a){let b=aZ(a.text);if(!b)return null;if("status"===a.stream)return{kind:"status",title:"Dispatch runner",detail:b,isError:!1};if("stdout"===a.stream)return{kind:"status",title:"Runner output",detail:b,isError:!1};let c=function(a){let b=a.trim().toLowerCase();return!(!b||b.includes("exited successfully")||b.includes("booted for agent")||b.includes("launched openclaw agent process"))&&/(aborted|denied|enoent|eacces|error|exception|failed|failure|invalid|killed|not found|panic|refused|stalled|timeout|timed out|traceback)/i.test(a)}(b);return{kind:c?"warning":"status",title:c?"Runner warning":"Runner note",detail:b,isError:c}}(b);c&&h.push(a3({id:b.id,kind:c.kind,timestamp:b.timestamp,title:c.title,detail:a8(c.detail,220),agentId:a.primaryAgentId,isError:c.isError},{file:f}))}return h}function a3(a,b){let c=function(a){for(let b of a){if("string"!=typeof b)continue;let a=b.match(/https?:\/\/[^\s<>"'`]+/i);if(!a)continue;let c=a[0].replace(/[)\].,;:!?]+$/g,"");if(c)return c}return null}(b?.urlSources??[]);return{...a,...c?{url:c}:{},...b?.file?{filePath:b.file.path,displayPath:b.file.displayPath}:{}}}function a4(a){return"available"===a.status||a.items.length>0||!!a.finalText?.trim()||a.createdFiles.length>0}function a5(a){return"string"==typeof a&&(/No transcript file was found for this runtime session/i.test(a)||/No transcript entries were found for this runtime/i.test(a))}function a6(a){return a.map(a=>(a??"").replace(/\s+/g," ").trim().toLowerCase()).join("|")}function a7(a){return"number"==typeof a&&Number.isFinite(a)?new Date(a).toISOString():new Date().toISOString()}function a8(a,b){let c=a.replace(/\s+/g," ").trim();return c.length<=b?c:`${c.slice(0,Math.max(b-1,1)).trimEnd()}…`}var a9=c(37110),ba=c(24254);async function bb(a,b,c){let d=a.runtimeIds.map(a=>b.runtimes.find(b=>b.id===a)).filter(a=>!!a),e=(function(a,b,c){let d=new Map(b.map(a=>[a.id,a])),e=a.dispatchId?.trim()||null,f=new Set(a.sessionIds.flatMap(a=>bg(a))),g=new Set(a.runIds.map(a=>a.trim()).filter(Boolean)),h=new Set(a.agentIds.map(a=>a.trim()).filter(Boolean));for(let b of(a.primaryAgentId&&h.add(a.primaryAgentId),c))!d.has(b.id)&&function(a,b){let c=function(a,b){let c=a.metadata[b];return"string"==typeof c&&c.trim().length>0?c.trim():null}(a,"dispatchId");if(b.dispatchId&&c===b.dispatchId||a.runId&&b.runIds.has(a.runId))return!0;let d=bg(a.sessionId);return 0!==d.length&&!!d.some(a=>b.sessionIds.has(a))&&(0===b.agentIds.size||!!(a.agentId&&b.agentIds.has(a.agentId)))}(b,{dispatchId:e,sessionIds:f,runIds:g,agentIds:h})&&d.set(b.id,b);return function(a,b){let c=new Set([...a.values()].map(a=>a.runId?.trim()).filter(a=>!!a));if(0!==c.size)for(let d of b)!a.has(d.id)&&d.runId&&c.has(d.runId)&&a.set(d.id,d)}(d,c),[...d.values()]})(a,d,b.runtimes).sort(bi);return bd(a,e,b,c)}async function bc(a,b){let c=new Map(b.agents.map(a=>[a.id,(0,n.CK)(a)])),d=b.runtimes.filter(b=>(function(a,b){if(("string"==typeof a.metadata.dispatchId?a.metadata.dispatchId.trim():"")===b.id)return!0;let c=(0,aW.Xy)(b);return!!c&&a.sessionId===c&&a.agentId===b.agentId})(b,a)).sort(bi),e=d[0]??await (0,a9.DO)(a)??(0,a0.Bi)(a,Date.now()),f=d.length>0?d:[e];return bd((0,a1.bE)(`dispatch:${a.id}`,f,c),f,b,a)}async function bd(a,b,c,d){var e,f,g,h,i,j,k,l,m,o,p;let q,r,s,t,u,v,w,x,y,z,A,B,C,D,E=await Promise.all(b.map(a=>(0,aN.pY)(a,c))),F=new Map(E.map(a=>[a.runtimeId,a])),G=(0,a1.T$)(E.flatMap(a=>a.createdFiles).concat(b.flatMap(a=>(0,a1.Y8)(a)))),H=bh(E.flatMap(a=>a.warnings).concat(b.flatMap(a=>(0,a1.qA)(a)))),I=(i=(e=d?(0,aW.Ck)(a,d):a,f=b,g=G,h=H,r=(q=[...f].sort(bi))[0]??null,s=q.map(a=>a.id),t=bh(q.flatMap(a=>a.runId?[a.runId]:[])),u=bh(q.flatMap(a=>a.sessionId?[a.sessionId]:[])),{...e,updatedAt:r?.updatedAt??e.updatedAt,ageMs:r?.ageMs??e.ageMs,primaryRuntimeId:e.primaryRuntimeId&&s.includes(e.primaryRuntimeId)?e.primaryRuntimeId:r?.id??e.primaryRuntimeId,runtimeIds:s,runIds:t,sessionIds:u,runtimeCount:s.length,updateCount:q.filter(a=>"turn"===a.source).length,liveRunCount:q.filter(a=>"running"===a.status||"queued"===a.status).length,artifactCount:g.length,warningCount:h.length,tokenUsage:function(a){let b=a.map(a=>a.tokenUsage).filter(a=>!!a);if(0!==b.length)return b.reduce((a,b)=>({input:a.input+(b?.input??0),output:a.output+(b?.output??0),total:a.total+(b?.total??0),cacheRead:(a.cacheRead??0)+(b?.cacheRead??0)}),{input:0,output:0,total:0,cacheRead:0})}(q)??e.tokenUsage,metadata:{...e.metadata,turnCount:t.length||e.metadata.turnCount,sessionCount:u.length||e.metadata.sessionCount}}),j=b,k=E,l=G,m=H,x=(v=(o=k).filter(a=>a.finalText?.trim()).sort(be)).length>0?v[0]??null:o.filter(a=>{var b;return a.errorMessage?.trim()&&!("string"==typeof(b=a.errorMessage)&&(/No transcript file was found for this runtime session/i.test(b)||/No transcript entries were found for this runtime/i.test(b)))}).sort(be)[0]??null,z=(y=x?.finalText?.trim()||null)||("string"==typeof i.metadata.resultPreview?i.metadata.resultPreview.trim():"")||i.subtitle,A=k.filter(a=>a.items.length>0).length,B="stalled"===i.status&&!!x&&(p=x,w=p.stopReason?.trim(),!!(p.finalText?.trim()&&"available"===p.status&&!p.errorMessage&&w&&"toolUse"!==w&&"error"!==w&&"aborted"!==w)),C=(0,ba.tt)((0,ba.kT)(i.metadata),(0,ba.FW)(i,j,k)),{...i,status:B?"completed":i.status,subtitle:y?(D=y.replace(/\s+/g," ").trim()).length<=160?D:`${D.slice(0,Math.max(159,1)).trimEnd()}…`:i.subtitle,artifactCount:l.length,warningCount:m.length,metadata:{...i.metadata,resultPreview:z,turnCount:A||i.metadata.turnCount,finalResponseText:y,finalResponseRuntimeId:x?.runtimeId??null,followUps:C}}),J=await a2(I,d,c),K=function(a,b,c,d){var e,f,g,h,i,j;let k=new Map(d.agents.map(a=>[a.id,(0,n.CK)(a)])),l=[],m=[...b].sort((a,b)=>(a.updatedAt??0)-(b.updatedAt??0)),o=Array.from(c.values()).some(a4),p=null,q=new Set,r=new Set,s=new Set,t=new Set;for(let b of m){if(a.dispatchId&&(0,a0.U8)(b))continue;let d=c.get(b.id),j=b.agentId?k.get(b.agentId)??null:null,m=(e=b,(f=d?.finalTimestamp)||a7(e.updatedAt));if(d?.items.length)for(let a of d.items){let c=a8(a.text.trim()||d.errorMessage||b.subtitle,220),e=a6(["item",a.role,a.toolName??"",a.timestamp,c]);q.has(e)||(q.add(e),l.push(a3({id:`${b.id}:${a.id}`,kind:"assistant"===a.role?"assistant":"toolCall"===a.role||"toolResult"===a.role?"tool":"user",timestamp:a.timestamp,title:"assistant"===a.role?j||"Agent update":"toolCall"===a.role||"toolResult"===a.role?a.toolName?`Tool \xb7 ${a.toolName}`:"Tool update":"Mission",detail:c,runtimeId:b.id,agentId:b.agentId,toolName:a.toolName,isError:a.isError},{urlSources:[a.text,d?.finalText,d?.errorMessage,b.subtitle]})))}else{let a=a8(d?.errorMessage||b.subtitle,220);if(g=d,h=a,g?.status==="missing"||a5(h)){o||"queued"!==(i=b).status&&"running"!==i.status&&"stalled"!==i.status||(p={runtime:b,agentName:j,timestamp:m});continue}let c=a6(["status",b.status,a]);if(r.has(c))continue;r.add(c);let e=function(a,b,c){let d=b||"Run";return"stalled"===a.status?{kind:"warning",title:`${d} \xb7 needs attention`,detail:c,isError:!0}:{kind:"status",title:`${d} \xb7 ${a.status}`,detail:c,isError:!1}}(b,j,a);l.push(a3({id:`${b.id}:status`,kind:e.kind,timestamp:m,title:e.title,detail:e.detail,runtimeId:b.id,agentId:b.agentId,isError:e.isError},{urlSources:[d?.errorMessage,b.subtitle]}))}for(let a of Array.from(new Set((d?.warnings??[]).concat((0,a1.qA)(b)).map(a=>a.trim()).filter(Boolean)))){let c=a6(["warning",a]);s.has(c)||(s.add(c),l.push(a3({id:`${b.id}:warning:${(0,a1.vC)(a)}`,kind:"warning",timestamp:m,title:"Fallback",detail:a8(a,220),runtimeId:b.id,agentId:b.agentId},{urlSources:[a]})))}for(let a of function(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}((d?.createdFiles??[]).concat((0,a1.Y8)(b))))t.has(a.path)||(t.add(a.path),l.push(a3({id:`${b.id}:artifact:${(0,a1.vC)(a.path)}`,kind:"artifact",timestamp:m,title:"Created file",detail:a.displayPath,runtimeId:b.id,agentId:b.agentId},{file:a})))}if(p&&!l.some(a=>{var b;return"assistant"===(b=a).kind||"tool"===b.kind||"artifact"===b.kind})){let a,b=(j=p.runtime,a=p.agentName||"Agent","running"===j.status?{title:`${a} \xb7 working silently`,detail:"The runtime is live, but no transcript output has been captured yet. The first assistant, tool, or file update will stream here."}:{title:`${a} \xb7 waiting for output`,detail:"AgentOS has not captured transcript output yet. This can happen while the agent is starting, attaching a session, or writing its first update."});l.push(a3({id:`${p.runtime.id}:waiting-for-output`,kind:"status",timestamp:p.timestamp,title:b.title,detail:b.detail,runtimeId:p.runtime.id,agentId:p.runtime.agentId,isError:!1},{urlSources:[p.runtime.subtitle]}))}return 0===l.length&&a.mission&&!a.dispatchId&&l.push(a3({id:`${a.id}:mission`,kind:"user",timestamp:a7(a.updatedAt),title:"Mission",detail:a8(a.mission,220),agentId:a.primaryAgentId},{urlSources:[a.mission]})),l.sort((a,b)=>Date.parse(a.timestamp)-Date.parse(b.timestamp)).slice(-36)}(I,b,F,c),L=await aQ({task:I,runs:b,outputs:E,createdFiles:G,dispatchRecord:d,snapshot:c});return{task:I,runs:b,outputs:E,liveFeed:function(...a){let b=new Map;for(let c of a.flat())b.set(c.id,c);return[...b.values()].sort((a,b)=>Date.parse(a.timestamp)-Date.parse(b.timestamp)).slice(-48)}(J,K),createdFiles:G,warnings:H,integrity:L}}function be(a,b){return bf(b.finalTimestamp)-bf(a.finalTimestamp)}function bf(a){let b=a?Date.parse(a):NaN;return Number.isNaN(b)?0:b}function bg(a){let b=a?.trim();if(!b)return[];let c=b.match(/^agent:([^:]+):explicit:(.+)$/);return c?[b,c[2]??""]:[b]}function bh(a){return Array.from(new Set(a.map(a=>a.trim()).filter(Boolean)))}function bi(a,b){return(b.updatedAt??0)-(a.updatedAt??0)}var bj=c(35456),bk=c(49922),bl=c(88366),bm=c(75402),bn=c(88978);function bo(){(0,d.ZZ)()}function bp(){(0,d.b7)()}async function bq(a,b){let c=await (0,bn.t)(bm.wh,a?[a]:[],{agentDirs:a?{[a]:b}:void 0,touch:!0});if(c.issues.length>0)throw bo(),Error(`OpenClaw runtime state is not writable. AgentOS needs write access to ${c.stateRoot} and the agent session store before missions can run.`)}async function br(a={}){await bq(a.agentId??null,a.agentDir),bo()}async function bs(a={}){var b;let c=await (0,d.GM)({force:!0,includeHidden:!0}),e=(b=a.agentId)&&c.agents.some(a=>a.id===b)?b:c.agents.find(a=>a.isDefault)?.id||c.agents[0]?.id||null;if(!e)return{status:"not-run",checkedAt:null,agentId:null,runId:null,summary:null,error:"AgentOS could not find an OpenClaw agent for the runtime smoke test."};let f=await (0,bj.tl)(),g=(0,bj.Yt)(f,e);if(!a.force&&(0,bj.SK)(g))return(0,bj.Az)(e,g);let h=c.agents.find(a=>a.id===e);await bq(e,h?.agentDir);try{await (0,aK.oC)({agentId:e,modelId:h?.modelId,agentDir:h?.agentDir});let a=await (0,k.rw)().runAgentTurn({agentId:e,message:"AgentOS runtime smoke test. Reply with a brief READY status.",thinking:"off",timeoutSeconds:45},{timeoutMs:5e4}),b={status:"passed",checkedAt:new Date().toISOString(),agentId:e,runId:a.runId??null,summary:a.summary||(0,aW.Ym)(a)[0]?.text||"AgentOS verified a real OpenClaw turn.",error:null};return await (0,bj.go)(b),bo(),b}catch(d){let a=(0,aL.t)(d)||"OpenClaw runtime smoke test failed.",b=(0,bk.YG)(a)?(0,bk.ox)((0,bk.MF)(await (0,bl.XP)().catch(()=>"openclaw"))):a,c={status:"failed",checkedAt:new Date().toISOString(),agentId:e,runId:null,summary:null,error:b};return await (0,bj.go)(c),bo(),c}}async function bt(a){let b=await (0,d.GM)({includeHidden:!0}),c=b.runtimes.find(b=>b.id===a);return(c||(c=(b=await (0,d.GM)({force:!0,includeHidden:!0})).runtimes.find(b=>b.id===a)),c)?(0,aN.pY)(c,b):{runtimeId:a,status:"missing",finalText:null,finalTimestamp:null,stopReason:null,errorMessage:"Runtime was not found in the current OpenClaw snapshot.",items:[],createdFiles:[],warnings:[],warningSummary:null}}async function bu(a,b={}){let c=await (0,d.GM)({includeHidden:!0}),e=c.tasks.find(b=>b.id===a);if(!e&&b.dispatchId&&(e=c.tasks.find(a=>a.dispatchId===b.dispatchId)),!e&&((e=(c=await (0,d.GM)({force:!0,includeHidden:!0})).tasks.find(b=>b.id===a))||!b.dispatchId||(e=c.tasks.find(a=>a.dispatchId===b.dispatchId))),!e){let a="string"==typeof b.dispatchId?b.dispatchId.trim():"";if(a){let b=await (0,a9.O1)(a);if(b)return bc(b,c)}throw Error("Task was not found in the current OpenClaw snapshot.")}let f=e.dispatchId?await (0,a9.O1)(e.dispatchId):null;return bb(e,c,f)}var bv=c(37037),bw=c(16588);function bx(){(0,d.ZZ)()}async function by(a,b={}){var c,e,f,j;let k,l,m,n,o=function(a){let b=a.name.trim();if(!b)throw Error("Workspace name is required.");let c=y(b);if(!c)throw Error("Workspace name must include letters or numbers.");let d=a.template??"software",e=a.teamPreset??"core",f=a.sourceMode??"empty",g=a.modelProfile??"balanced",j={...s.eY,...a.rules??{}},k=(a.agents?.length?a.agents:(0,s.P0)(d,e,b)).map(a=>{let c=x(a),d=a.policy?.preset??(0,h.qF)({skills:c,id:a.id,name:a.name});return{id:y(a.id)||"agent",role:a.role.trim()||S(a.id),name:v(a.name)??(a.isPrimary?(0,s.sg)(b,a.role,S(a.id)):S(a.id)),enabled:!1!==a.enabled,emoji:v(a.emoji)??void 0,theme:v(a.theme)??void 0,skillId:c[0]??void 0,skillIds:c,modelId:v(a.modelId)??void 0,isPrimary:!!a.isPrimary,heartbeat:i(d,a.heartbeat),policy:(0,h.g0)(d,{...a.policy,fileAccess:j.workspaceOnly?a.policy?.fileAccess??"workspace-only":"extended"})}});if(!k.some(a=>a.enabled&&a.isPrimary)){let a=k.find(a=>a.enabled);a&&(a.isPrimary=!0)}let l=function(a){let b=new Set,c=new Set;for(let d of a){if(b.has(d)){c.add(d);continue}b.add(d)}return Array.from(c).sort((a,b)=>a.localeCompare(b))}(k.filter(a=>a.enabled).map(a=>a.id));if(l.length>0)throw Error(`Enabled agents must have unique ids. Conflicts: ${l.join(", ")}.`);return{name:b,slug:c,brief:v(a.brief)??void 0,directory:v(a.directory)??void 0,modelId:v(a.modelId)??void 0,repoUrl:v(a.repoUrl)??void 0,existingPath:v(a.existingPath)??void 0,sourceMode:f,template:d,teamPreset:e,modelProfile:g,rules:j,docOverrides:(0,r.Iy)(a.docOverrides),agents:k,contextSources:(a.contextSources??[]).flatMap(a=>{var b;if(!a||"object"!=typeof a)return[];let c="prompt"===(b=a.kind)||"website"===b||"repo"===b||"folder"===b?a.kind:"prompt",d=v(a.label)??c,e=v(a.summary)??d,f="error"===a.status?"error":"ready",g=v(a.createdAt)??new Date().toISOString();if(!d||!e)return[];let h={id:v(a.id)??`${c}-${y(d)||"context"}`,kind:c,label:d,summary:e,details:Array.isArray(a.details)?a.details.map(a=>v(a)??"").filter(a=>!!a):[],status:f,createdAt:g},i="number"==typeof a.confidence?a.confidence:void 0,j=v(a.error)??void 0,k=v(a.url)??void 0;return void 0!==i&&(h.confidence=i),void 0!==j&&(h.error=j),void 0!==k&&(h.url=k),[h]})}}(a),p=o.agents.filter(a=>a.enabled),q=(0,bv.X6)({template:(0,bv.fV)({sourceMode:o.sourceMode,agentCount:p.length,kickoffMission:o.rules.kickoffMission}),onProgress:b.onProgress});if(0===p.length)throw Error("Enable at least one agent for the workspace.");await q.startStep("validate","Resolving workspace settings and reserving the target directory."),await q.addActivity("validate",`Validated workspace name "${o.name}".`);let u=await function(a,b){if("existing"===a.sourceMode){let b=a.existingPath||a.directory;if(!b)throw Error("Choose an existing folder for this workspace.");return g().isAbsolute(b)?b:g().resolve(b)}return a.directory?g().isAbsolute(a.directory)?a.directory:g().join(b,a.directory):g().join(b,a.slug)}(o,await (0,bj.wL)()||g().join(aH().homedir(),"Documents","Shared","projects"));await q.updateStep("validate",{percent:38,detail:`Reserved target directory at ${u}.`}),await q.addActivity("validate",`Reserved target directory ${u}.`,"done");let w=await (0,d.GM)({force:!0,includeHidden:!0}),z=o.modelId??(f=w,p.map(a=>(0,af.Nk)(a.modelId)).find(a=>a&&bK(f,a)))??function(a){if(a.diagnostics.modelReadiness.defaultModelReady)return(0,af.Nk)(a.diagnostics.modelReadiness.resolvedDefaultModel)??(0,af.Nk)(a.diagnostics.modelReadiness.defaultModel)??void 0}(w)??(j=w,(k=(0,af.Nk)(j.diagnostics.modelReadiness.recommendedModelId))&&bK(j,k)?k:j.models.map(a=>(0,af.Nk)(a.id)).find(a=>a&&bK(j,a))),A=(0,aj.d9)(w,z);if(A)throw Error(A);await q.updateStep("validate",{percent:72,detail:"Checking current OpenClaw snapshot and agent ids."}),function(a,b,c){let d=c.map(a=>Y(b,a.id)),e=function(a){let b=new Set,c=new Set;for(let d of a){if(b.has(d)){c.add(d);continue}b.add(d)}return Array.from(c).sort((a,b)=>a.localeCompare(b))}(d);if(e.length>0)throw Error(`Workspace bootstrap would create duplicate agent ids: ${e.join(", ")}.`);for(let b of d){let c=a.agents.find(a=>a.id===b);if(c)throw Error(`Workspace bootstrap would create agent id "${b}", but it already exists in workspace "${function(a,b){return a.workspaces.find(a=>a.id===b.workspaceId)?.name??g().basename(b.workspacePath)}(a,c)}". Rename the workspace or adjust the agent ids.`)}}(w,o.slug,p),await q.completeStep("validate",`Workspace input and ${p.length} agent configuration${1===p.length?"":"s"} are ready.`);let B=await bN(u,w,o.slug);if(B)return await q.startStep("source",P(o.sourceMode,u)),await q.addActivity("source","Workspace already exists. Reusing the existing folder.","done"),await q.completeStep("source","Existing workspace folder reused."),await q.startStep("scaffold","Writing the initial workspace scaffold and local metadata."),await q.addActivity("scaffold","Workspace scaffold already exists. Reusing existing files.","done"),await q.completeStep("scaffold","Workspace files and starter docs are already in place."),await q.startStep("agents",1===B.agentIds.length?"Reusing the existing workspace agent.":`Reusing ${B.agentIds.length} workspace agents.`),await q.addActivity("agents",`${B.agentIds.length} agent${1===B.agentIds.length?"":"s"} already linked to the workspace.`,"done"),await q.completeStep("agents",`${B.agentIds.length} agent${1===B.agentIds.length?"":"s"} already linked to the workspace.`),await q.startStep("kickoff","Finalizing workspace bootstrap."),await q.addActivity("kickoff","Kickoff was already handled by the existing workspace.","done"),await q.completeStep("kickoff","Workspace bootstrap is already complete."),bx(),bp(),B;await q.startStep("source",P(o.sourceMode,u)),await q.addActivity("source",(c=o.sourceMode,"clone"===c?o.repoUrl?`Cloning ${o.repoUrl}.`:"Cloning the requested repository.":"existing"===c?o.existingPath?`Attaching ${o.existingPath}.`:"Attaching the requested folder.":"Preparing an empty workspace scaffold."),"active"),await N({targetDir:u,sourceMode:o.sourceMode,repoUrl:o.repoUrl}),await q.completeStep("source",(e=o.sourceMode,"clone"===e?`Repository content is available at ${u}.`:"existing"===e?`Existing folder linked and ready at ${u}.`:`Fresh workspace folder created at ${u}.`)),await q.startStep("scaffold","Writing the initial workspace scaffold and local metadata."),await q.addActivity("scaffold","Generating workspace docs, memory, and configuration files."),await O(u,{name:o.name,brief:o.brief,template:o.template,teamPreset:o.teamPreset,modelProfile:o.modelProfile,rules:o.rules,docOverrides:o.docOverrides,sourceMode:o.sourceMode,agents:p,contextSources:o.contextSources}),await q.completeStep("scaffold","Workspace files and starter docs are in place.");let C=[],D=[];for(let a of(await q.startStep("agents",1===p.length?"Provisioning the first workspace agent.":`Provisioning ${p.length} workspace agents.`),p)){let b,c=C.length,d=c+1;await q.updateStep("agents",{percent:Math.round(c/p.length*100),detail:`Creating agent ${d} of ${p.length}: ${a.name}.`}),await q.addActivity("agents",`Creating ${a.name} (${a.role}).`);let e=Y(o.slug,a.id),f=null;try{b=await Z({workspacePath:u,workspaceSlug:o.slug,workspaceModelId:z,agent:a})}catch(a){f=bz(a),D.push(f),b=e}C.push(b),await q.addActivity("agents",f?`Created ${a.name} as ${b}; config sync needs a Gateway refresh.`:`Created ${a.name} as ${b}.`,"done"),await q.updateStep("agents",{percent:Math.round(C.length/p.length*100),detail:`${C.length} of ${p.length} agent${1===p.length?"":"s"} ready.`})}await q.completeStep("agents",`${C.length} agent${1===C.length?"":"s"} linked to the workspace.`),bx();try{await bP(u)}catch(a){D.push(bz(a)),await q.addActivity("agents","Agent policy config sync needs a Gateway refresh.","done")}await (0,t.u)(u);let E=C.find(a=>p.some(b=>b.isPrimary&&Y(o.slug,b.id)===a))??C[0];if(o.rules.kickoffMission){await q.startStep("kickoff",`Dispatching the kickoff mission to ${E}.`),await q.addActivity("kickoff",`Selected ${E} as the primary agent.`);try{let a=await bQ({agentId:E,brief:o.brief,modelProfile:o.modelProfile,template:o.template,rules:o.rules},{onProgress:async({message:a,percent:b})=>{await q.updateStep("kickoff",{percent:b,detail:a}),await q.addActivity("kickoff",a,b>=100?"done":"active")}});l=a.runId,m=a.status,await q.completeStep("kickoff",`Kickoff mission finished with status ${m||"unknown"}.`)}catch(a){n=a instanceof Error?a.message:"Kickoff mission could not be started.",await q.addActivity("kickoff",n,"error"),await q.failStep("kickoff",n)}}else await q.startStep("kickoff","Finalizing workspace bootstrap."),await q.addActivity("kickoff","Kickoff mission is disabled for this workspace.","done"),await q.completeStep("kickoff","Workspace bootstrap finished without kickoff.");return bx(),bp(),{workspaceId:bI(w.workspaces,u),workspacePath:u,agentIds:C,primaryAgentId:E,kickoffRunId:l,kickoffStatus:m,kickoffError:n,warnings:bE(D)}}function bz(a){let b=am(a)?"AgentOS created the workspace, but OpenClaw could not finish the agent config sync in time. Restart or refresh the OpenClaw Gateway if the workspace agent profile looks incomplete, then refresh AgentOS.":null;if(!b)throw a;return b}async function bA(a){let b=a.workspaceId.trim();if(!b)throw Error("Workspace id is required.");if(a.plan){let c=a.baseline??await bC(b);return bG((0,bw.co)(c),a.plan,{name:a.name,directory:a.directory,baseline:c})}let c=await (0,d.GM)({force:!0}),f=bH(c.workspaces,b);if(!f)throw Error("Workspace was not found.");let h=bM(f.path,a.name,a.directory);if(h!==f.path){await bL(h,f.path);try{await (0,e.rename)(f.path,h)}catch(a){throw Error(a instanceof Error?`Unable to move workspace directory. ${a.message}`:"Unable to move workspace directory.")}let a=(await (0,m.CI)(c)).map(a=>a.workspace===f.path?{...a,workspace:h,agentDir:"string"==typeof a.agentDir&&a.agentDir.startsWith(`${f.path}${g().sep}`)?g().join(h,g().relative(f.path,a.agentDir)):a.agentDir}:a);await (0,m.ZF)(a)}return bx(),bp(),{workspaceId:bI(c.workspaces,h,f.path),previousWorkspaceId:f.id,workspacePath:h}}async function bB(a){let b=a.workspaceId.trim();if(!b)throw Error("Workspace id is required.");let c=await (0,d.GM)({force:!0,includeHidden:!0}),f=bH(c.workspaces,b);if(!f)throw Error("Workspace was not found.");let g=c.agents.filter(a=>a.workspaceId===f.id),h=c.runtimes.filter(a=>a.workspaceId===f.id).length;for(let a of g)await (0,k.rw)().deleteAgent(a.id);try{let a=await (0,m.CI)(c),b=a.filter(a=>a.workspace!==f.path&&!g.some(b=>b.id===a.id));b.length!==a.length&&await (0,m.ZF)(b)}catch{}return await (0,e.rm)(f.path,{recursive:!0,force:!0}),(0,d.er)(),{workspaceId:f.id,workspacePath:f.path,deletedAgentIds:g.map(a=>a.id),deletedRuntimeCount:h}}async function bC(a){let b=await (0,d.GM)({force:!0,includeHidden:!0}),c=bH(b.workspaces,a);if(!c)throw Error("Workspace was not found.");let f=await (0,T.OL)(c.path),i=f.name??c.name,j=b.agents.filter(a=>a.workspaceId===c.id),k=bE(j.flatMap(a=>a.skills)),l=bE(j.flatMap(a=>a.tools)),m=f.template??c.bootstrap.template??"software",n=f.sourceMode??c.bootstrap.sourceMode??"empty",o=f.teamPreset??(j.length<=1?"solo":"core"),p=f.modelProfile??"balanced",q=f.rules??s.eY,t=await (0,aJ.xL)(c.path,f.template,f.rules??s.eY),u=await (0,aI.L)(c.path,{agentId:j[0]?.id??c.id,agentName:j[0]?.name??i,configuredSkills:k,configuredTools:l,template:m,rules:q,workspaceBootstrapProfile:t}),v=f.agents.length>0?f.agents.map(a=>{let b=bD(j,c.slug,a.id),d=(0,h.g0)(a.policy?.preset??b?.policy.preset??h.iN,a.policy??b?.policy);return{id:a.id,role:a.role??(0,h._P)(d.preset),name:a.name??b?.name??a.role??a.id,enabled:a.enabled,emoji:a.emoji??b?.identity.emoji,theme:a.theme??b?.identity.theme,skillId:a.skillId??void 0,modelId:a.modelId??(b?.modelId&&"unassigned"!==b.modelId?b.modelId:void 0),isPrimary:a.isPrimary,policy:d,channelIds:a.channelIds??[],heartbeat:{enabled:b?.heartbeat.enabled??!1,...b?.heartbeat.every?{every:b.heartbeat.every}:{}}}}):(0,s.P0)(m,o,i),w=(0,r.Q5)({name:i,brief:u.purpose||i,template:m,sourceMode:n,rules:q,agents:v,toolExamples:await K(c.path),docOverrides:[],contextSources:f.contextSources??[]}),x=[],y=new Set(w.map(a=>a.path)),z=await (0,bw.wZ)(c.path);for(let a of w){let b=g().join(c.path,a.path);try{let c=await (0,e.readFile)(b,"utf8");c!==a.baseContent&&x.push({path:a.path,content:c})}catch{continue}}for(let a of z){if(y.has(a))continue;let b=g().join(c.path,a);try{let c=await (0,e.readFile)(b,"utf8");x.push({path:a,content:c})}catch{continue}}return{workspaceId:c.id,workspacePath:c.path,name:i,directory:c.path,template:m,sourceMode:n,teamPreset:o,modelProfile:p,modelId:c.modelIds[0]&&"unassigned"!==c.modelIds[0]?c.modelIds[0]:void 0,rules:q,docOverrides:x,agents:v,brief:u.purpose||i,contextSources:f.contextSources??[]}}function bD(a,b,c){let d=bF(c),e=`${b}-`;return a.find(a=>{var d,e;return a.id===(d=b,e=c,`${d}-${bF(e)||"agent"}`)})??a.find(a=>a.id===`${e}${d}`)??a.find(a=>d.length>0&&a.id.endsWith(`-${d}`))??a.find(a=>a.id===d)??null}function bE(a){return Array.from(new Set(a.filter(Boolean)))}function bF(a){return a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}async function bG(a,b,c){let f=(0,af.Nk)(c.name)??(0,af.Nk)(b.workspace.name)??a.name,h=(0,af.Nk)(c.directory),i=(0,af.Nk)(c.baseline.directory)??a.path,j=(0,af.Nk)(c.baseline.name)??a.name,k=(0,af.Nk)(c.baseline.brief)??"",l=(0,af.Nk)(b.company.mission)??(0,af.Nk)(b.product.offer)??"",n=(0,r.Iy)(b.workspace.docOverrides),o=(0,r.Iy)(c.baseline.docOverrides),p=new Map(n.map(a=>[a.path,a.content])),q=new Map(o.map(a=>[a.path,a.content])),u=b.team.persistentAgents.filter(a=>a.enabled),v=c.baseline.agents.filter(a=>a.enabled),w=f.trim()!==j.trim(),x=w||l!==k||b.workspace.template!==c.baseline.template||b.workspace.sourceMode!==c.baseline.sourceMode||!(0,bw.Rp)(b.workspace.rules,c.baseline.rules)||!(0,bw.cD)(u,v),y=h&&h!==i?bM(a.path,void 0,h):w?bM(a.path,f,void 0):a.path,z=y!==a.path,A=z?await (0,d.GM)({force:!0,includeHidden:!0}):null;if(z){await bL(y,a.path);try{await (0,e.rename)(a.path,y)}catch(a){throw Error(a instanceof Error?`Unable to move workspace directory. ${a.message}`:"Unable to move workspace directory.")}let b=(await (0,m.CI)(A??void 0)).map(b=>b.workspace===a.path?{...b,workspace:y,agentDir:"string"==typeof b.agentDir&&b.agentDir.startsWith(`${a.path}${g().sep}`)?g().join(y,g().relative(a.path,b.agentDir)):b.agentDir}:b);await (0,m.ZF)(b)}let B=g().join(y,".openclaw","project.json"),D=new Date().toISOString(),E=!1,F=null;try{var G;let a=await (0,e.readFile)(B,"utf8"),b=JSON.parse(a);G=b,"object"!=typeof G||null===G||Array.isArray(G)||(D="string"==typeof b.createdAt?b.createdAt:D,E=!0===b.hidden,F="string"==typeof b.systemTag?b.systemTag:null)}catch{}let H=b.team.persistentAgents.map(a=>({id:a.id,name:a.name,role:a.role,enabled:a.enabled,emoji:(0,af.Nk)(a.emoji)??null,theme:(0,af.Nk)(a.theme)??null,isPrimary:!!a.isPrimary,skillId:(0,af.Nk)(a.skillId)??null,modelId:(0,af.Nk)(a.modelId)??null,policy:a.policy??null,channelIds:Array.from(new Set((a.channelIds??[]).map(a=>"string"==typeof a?a.trim():"").filter(a=>!!a)))})),I=H.length<=1?"solo":H.every(a=>a.enabled)?"core":"custom",J={version:1,slug:bF(g().basename(y)),name:f,directory:y,icon:(0,s.hh)(b.workspace.template).icon,createdAt:D,updatedAt:new Date().toISOString(),template:b.workspace.template,sourceMode:b.workspace.sourceMode,teamPreset:I,modelProfile:b.workspace.modelProfile,agentTemplate:"solo"===I?"solo":"core-team",rules:{workspaceOnly:b.workspace.rules.workspaceOnly,generateStarterDocs:b.workspace.rules.generateStarterDocs,generateMemory:b.workspace.rules.generateMemory,kickoffMission:b.workspace.rules.kickoffMission},contextSources:b.intake.sources,hidden:E,systemTag:F,agents:H};if(x){let a=(0,r.Q5)({name:f,brief:l||f,template:b.workspace.template,sourceMode:b.workspace.sourceMode,rules:b.workspace.rules,agents:u,toolExamples:await K(y),docOverrides:n,contextSources:b.intake.sources}),c=new Set(a.map(a=>a.path));for(let b of a)await C(g().join(y,b.path),b.content);for(let a of n)c.has(a.path)||await C(g().join(y,a.path),a.content)}else{let a=(0,r.Q5)({name:j,brief:k||j,template:c.baseline.template,sourceMode:c.baseline.sourceMode,rules:c.baseline.rules,agents:v,toolExamples:[],docOverrides:[],contextSources:c.baseline.contextSources??[]}),b=new Set(a.map(a=>a.path));for(let a of n)q.get(a.path)!==a.content&&await C(g().join(y,a.path),a.content);for(let c of o){if(p.has(c.path))continue;let d=a.find(a=>a.path===c.path);d&&b.has(d.path)&&await C(g().join(y,d.path),d.baseContent)}}if(z||!(0,bw.cD)(u,v)){let d=z?bI(A?.workspaces??[],y,a.path):a.id,e={...a,id:d,path:y};await bJ({currentWorkspace:e,desiredAgents:b.team.persistentAgents,workspaceSlug:bF(g().basename(y)),previousWorkspaceId:c.baseline.workspaceId,previousWorkspacePath:c.baseline.workspacePath})}return await C(B,`${JSON.stringify(J,null,2)}
|
|
275
275
|
`),await (0,t.u)(y),bx(),bp(),{workspaceId:z?bI(A?.workspaces??[],y,a.path):a.id,previousWorkspaceId:a.id,workspacePath:y}}function bH(a,b){return a.find(a=>a.id===b)??a.find(a=>(0,ai.xV)(a.path,b))}function bI(a,b,c){let d=c?g().resolve(c):null,e=[...a.map(a=>a.path).filter(a=>!d||g().resolve(a)!==d),b];return(0,ai.hv)(b,e)}async function bJ(a){let b=Array.from(new Map((await (0,d.GM)({force:!0,includeHidden:!0})).agents.filter(b=>b.workspaceId===a.currentWorkspace.id||!!a.previousWorkspaceId&&b.workspaceId===a.previousWorkspaceId||!!(a.previousWorkspacePath&&b.workspacePath===a.previousWorkspacePath)).map(a=>[a.id,a])).values()),c=new Set;for(let d of a.desiredAgents){let e=bD(b,a.workspaceSlug,d.id);if(!d.enabled){e&&(c.add(e.id),await as({agentId:e.id}));continue}if(e){c.add(e.id),await ar({id:e.id,workspaceId:a.currentWorkspace.id,workspacePath:a.currentWorkspace.path,name:(0,af.Nk)(d.name)??e.name,emoji:(0,af.Nk)(d.emoji)??e.identity.emoji,theme:(0,af.Nk)(d.theme)??e.identity.theme,modelId:(0,af.Nk)(d.modelId)??("unassigned"===e.modelId?void 0:e.modelId),policy:d.policy,heartbeat:d.heartbeat,channelIds:d.channelIds});continue}let f=await al({id:Y(a.workspaceSlug,d.id),workspaceId:a.currentWorkspace.id,workspacePath:a.currentWorkspace.path,name:(0,af.Nk)(d.name)??void 0,emoji:(0,af.Nk)(d.emoji)??void 0,theme:(0,af.Nk)(d.theme)??void 0,modelId:(0,af.Nk)(d.modelId)??void 0,policy:d.policy,heartbeat:d.heartbeat,channelIds:d.channelIds});c.add(f.agentId)}for(let a of b)c.has(a.id)||await as({agentId:a.id})}function bK(a,b){let c=a.models.find(a=>a.id===b);return!!c&&!0!==c.missing&&!1!==c.available}async function bL(a,b){if(a!==b)try{throw await (0,e.access)(a),Error("Target workspace directory already exists.")}catch(a){if("ENOENT"===("object"==typeof a&&a&&"code"in a?a.code:void 0))return;if(a instanceof Error)throw a;throw Error("Unable to verify target workspace directory.")}}function bM(a,b,c){let d=(0,af.Nk)(c);if(d)return g().isAbsolute(d)?d:g().join(g().dirname(a),d);let e=(0,af.Nk)(b);if(!e)return a;let f=bF(e);if(!f)throw Error("Workspace name is required.");return g().join(g().dirname(a),f)}async function bN(a,b,c){let d=await (0,T.OL)(a),e=d.agents.filter(a=>a.enabled);if(!(d.name||d.template||d.sourceMode||d.agentTemplate||e.length>0||d.channels.length>0||d.contextSources.length>0))return null;let f=bI(b.workspaces,a),h=bH(b.workspaces,f)??b.workspaces.find(b=>g().resolve(b.path)===g().resolve(a))??null,i=h?.id??f,j=b.agents.filter(b=>b.workspaceId===i||g().resolve(b.workspacePath)===g().resolve(a)),k=new Set(j.map(a=>a.id)),l=e.map(a=>bO(c,a)),m=[];for(let b of l){if(k.has(b.agentId))continue;let d=await Z({workspacePath:a,workspaceSlug:c,workspaceModelId:b.agent.modelId,agent:b.agent});m.push(d),k.add(d)}let n=bE(l.map(a=>a.agentId)),o=bE([...j.map(a=>a.id),...m,...n]);if(0===o.length)return null;let p=d.agents.find(a=>a.enabled&&a.isPrimary)??null,q=p?bO(c,p):null,r=j[0]?.id??q?.agentId??o[0];return{workspaceId:h?.id??i,workspacePath:h?.path??a,agentIds:o,primaryAgentId:r,kickoffRunId:void 0,kickoffStatus:void 0,kickoffError:void 0}}function bO(a,b){let c=`${a}-`,d=(b.id.startsWith(c)?b.id.slice(c.length):b.id)||b.id;return{agentId:b.id.startsWith(c)?b.id:Y(a,b.id),agent:{id:d,name:b.name??d,role:b.role??"Agent",enabled:b.enabled,emoji:b.emoji??void 0,theme:b.theme??void 0,skillId:b.skillId??void 0,skillIds:b.skillIds,modelId:b.modelId??void 0,isPrimary:b.isPrimary,policy:b.policy??void 0,channelIds:b.channelIds}}}async function bP(a){let b=await (0,d.GM)({includeHidden:!0});for(let c of bE(b.agents.filter(b=>b.workspacePath===a).map(a=>a.id))){let a=b.agents.find(a=>a.id===c);if(!a)continue;let d=b.agents.find(b=>b.workspaceId===a.workspaceId&&"setup"===b.policy.preset&&b.id!==a.id)?.id??null,e=await $({workspacePath:a.workspacePath,agentId:a.id,agentName:a.name,policy:a.policy,setupAgentId:d,snapshot:b});await (0,m.jq)(a.id,a.workspacePath,{name:a.name,model:(0,af.Nk)(a.modelId),heartbeat:a.heartbeat.enabled&&a.heartbeat.every?{every:a.heartbeat.every}:null,skills:[...(0,m.AB)(a.skills),e],tools:a.tools.includes("fs.workspaceOnly")?{fs:{workspaceOnly:!0}}:null},b)}}async function bQ(a,b={}){var c,d,e;let f,g,h=(c=a.template,d=a.brief,e=a.rules,f=(0,s.hh)(c),g=(0,r.Q4)(c,e).sections.map(a=>{let b=a.resources.map(a=>a.label).join(", ");return a.enabled?`${a.title}: ${b||"none"}`:`${a.title}: disabled by workspace rules`}).join("\n"),[`You are bootstrapping a newly created ${f.label.toLowerCase()} workspace.`,d?`Project brief: ${d}`:"No detailed project brief was provided yet.","Inspect the current files and improve the starter workspace without rewriting files that already had meaningful content.","Treat the following workspace context manifest as the source of truth:",g,"If those docs exist, refine the brief, architecture, memory, and deliverables guidance based on the real repository state instead of guessing.","Leave the workspace with a concise first task batch and any critical unknowns clearly called out.","Prefer concrete workspace-grounded edits over verbose chat output."].join("\n\n")),i="fast"===a.modelProfile?"low":"quality"===a.modelProfile?"high":"medium",j=new Set;await b.onProgress?.({message:"Submitting the kickoff brief to the primary agent.",percent:18});let l=await (0,k.rw)().streamAgentTurn({agentId:a.agentId,message:h,thinking:i,timeoutSeconds:90},{onStdout:async a=>{let c,d=(c=a.replace(/\u001b\[[0-?]*[ -/]*[@-~]/g,"").trim())?Array.from(new Set(c.split(/\r?\n/).map(a=>a.trim()).filter(Boolean).map(a=>a.replace(/^[>•*-]\s*/,"")).filter(a=>!a.startsWith("{")&&!a.startsWith("[")).filter(a=>!/auth-profiles/i.test(a)))).slice(0,3):[];if(0===d.length&&a.trim())return void await b.onProgress?.({message:"Primary agent responded. Finalizing kickoff output.",percent:82});for(let a of d)await b.onProgress?.({message:a,percent:72})},onStderr:async a=>{let c=a.trim();if(!c)return;let d=function(a){let b,c=a.replace(/\u001b\[[0-?]*[ -/]*[@-~]/g,"").split(/\r?\n/).map(a=>a.trim()).filter(Boolean).join(" ");if(!c)return null;let d=c.toLowerCase();return d.includes("scope upgrade pending approval")||d.includes("pairing required")||d.includes("more scopes than currently approved")?"Gateway permissions need approval; continuing with the embedded runtime.":d.includes("falling back to embedded")?"Gateway agent is unavailable; continuing with the embedded runtime.":d.includes("gateway connect failed")?"Gateway connection is not ready; continuing with the embedded runtime.":`Runtime notice: ${(b=c.replace(/\(requestId:\s*[^)]+\)/gi,"").replace(/\brequestId:\s*\S+/gi,"").replace(/\s+/g," ").trim()).length>160?`${b.slice(0,157).trim()}...`:b}`}(c);!d||j.has(d)||(j.add(d),await b.onProgress?.({message:d,percent:64}))}},{timeoutMs:12e4});return await b.onProgress?.({message:"Kickoff mission completed. Recording the resulting run metadata.",percent:100}),l}function bR(a){return a.split(g().sep).join("/")}async function bS(a,b){var c;let d,f,h,i=(c=b,f=[(d=new Date).getFullYear(),String(d.getMonth()+1).padStart(2,"0"),String(d.getDate()).padStart(2,"0"),String(d.getHours()).padStart(2,"0"),String(d.getMinutes()).padStart(2,"0"),String(d.getSeconds()).padStart(2,"0")].join("-"),h=c.replace(/^\[[^\]]+\]\s*/i,"").trim().normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48).replace(/^-+|-+$/g,"")||"task",`${f}-${h}`),j=g().join(a,"deliverables",i),k=bR(g().join("deliverables",i)),l=bR("memory");return await (0,e.mkdir)(j,{recursive:!0}),await (0,e.mkdir)(g().join(a,"memory"),{recursive:!0}),{runFolder:i,absoluteOutputDir:j,relativeOutputDir:k,notesDirRelative:l}}var bT=c(25303),bU=c(3334);async function bV(a,b){var c,d,e;let f,g,i=a.mission.trim();if(!i)throw Error("Mission text is required.");let j=await b.getMissionControlSnapshot({includeHidden:!0}),l=a.agentId||b.resolveAgentForMission(j,a.workspaceId);if(!l)throw Error("No OpenClaw agent is available for mission dispatch. Finish OpenClaw setup, create a workspace, then create or select an agent.");let m=j.agents.find(a=>a.id===l),n=j.workspaces.find(b=>b.id===(a.workspaceId||m?.workspaceId))??(m?{id:m.workspaceId,path:m.workspacePath}:null),o=n?j.agents.filter(a=>a.workspaceId===n.id):[],p=o.find(a=>"setup"===a.policy.preset&&a.id!==m?.id)?.id??null,q=n?await bS(n.path,i):null,r=a.thinking??"medium",s=(0,bU.Z)(l,j),t=q?(c=m?.policy,d=m?{id:m.id,name:m.name}:null,f=c??(0,h.g0)(h.iN),[i,...(g=d?["Agent workspace context:",`- Your current OpenClaw agent id is \`${d.id}\`${d.name?` and your AgentOS display name is ${d.name}`:""}.`,"- Use the matching subsection in workspace root `AGENTS.md` as your agent-specific role/persona.","- Treat other `AGENTS.md` agent subsections as teammates in the same workspace.","- Use root `SOUL.md`, `USER.md`, `TOOLS.md`, `MEMORY.md`, `memory/*.md`, and `docs/*.md` as shared workspace/project context."]:[]).length>0?["",...g]:[],"","Task output routing:",`- Put substantial outputs, drafts, reports, docs, and file deliverables under \`${q.relativeOutputDir}/\`.`,`- If a file is requested, default to \`${q.relativeOutputDir}/<descriptive-file-name>\` unless the user explicitly asks for another path.`,`- Use \`${q.notesDirRelative}/\` only for temporary notes or durable workspace memory, not final deliverables.`,"- Avoid writing final artifacts to the workspace root.","- Only update shared workspace docs when the change is durable and workspace-wide; task-specific docs should stay inside this run folder.","","Agent operating policy:",...M(f,p),...s?["",s]:[]].join("\n")):i,u=(0,aj.l9)(j,m?.modelId==="unassigned"?null:m?.modelId),v=(0,a9._z)({agentId:l,mission:i,routedMission:t,thinking:r,workspaceId:n?.id??null,workspacePath:n?.path??null,outputDir:q?.absoluteOutputDir??null,outputDirRelative:q?.relativeOutputDir??null,notesDirRelative:q?.notesDirRelative??null});if(await (0,a9.lm)(v),u)return v={...v,status:"stalled",updatedAt:new Date().toISOString(),error:u},await (0,a9.lm)(v),b.invalidateMissionControlCaches(),{dispatchId:v.id,runId:null,agentId:l,status:v.status,summary:u,payloads:[],meta:{outputDir:q?.absoluteOutputDir,outputDirRelative:q?.relativeOutputDir,notesDirRelative:q?.notesDirRelative}};try{let a=await (0,bT.N3)().catch(()=>null);if(a?.nativeMissionDispatch!=="unsupported"){let a,b=await (0,k.rw)().runAgentTurn({agentId:l,sessionId:v.sessionId??void 0,message:t,thinking:r,timeoutSeconds:45,workspace:n?.path??null,dispatchId:v.id},{timeoutMs:6e4}),c=new Date().toISOString(),d=(e=b.status,a=e?.trim().toLowerCase(),"completed"===a||"complete"===a||"succeeded"===a||"success"===a?"completed":"cancelled"===a||"canceled"===a?"cancelled":"stalled"===a||"timeout"===a||"timed_out"===a||"failed"===a||"error"===a?"stalled":"running");v={...v,status:d,updatedAt:c,runner:{...v.runner,startedAt:c,finishedAt:"completed"===d||"stalled"===d?c:null,lastHeartbeatAt:c},observation:{runtimeId:b.runId?`runtime:gateway:${b.runId}`:v.observation.runtimeId,observedAt:c},result:b,error:"stalled"===d?function(a){let b=a.summary?.trim();if(b)return b;let c=a.status?.trim().toLowerCase(),d="string"==typeof a.timeoutPhase?a.timeoutPhase.trim():"";return"timeout"===c||"timed_out"===c?d?`OpenClaw Gateway wait timed out during ${d}.`:"OpenClaw Gateway wait timed out before an agent response was captured.":"OpenClaw Gateway dispatch stalled before an agent response was captured."}(b):null},await (0,a9.lm)(v)}else v=await (0,a9.gb)(v)}catch(a){throw v={...v,status:"stalled",updatedAt:new Date().toISOString(),error:(0,aL.t)(a)||"Mission dispatch runner could not be started."},await (0,a9.lm)(v),b.invalidateMissionControlCaches(),Error(v.error??"Mission dispatch runner could not be started.")}b.invalidateMissionControlCaches();let w=(0,aW.Ym)(v.result),x="completed"===v.status||"stalled"===v.status||"cancelled"===v.status?(0,aW.kc)(v):v.result?.summary||"Mission accepted and queued for OpenClaw execution.";return{dispatchId:v.id,runId:v.result?.runId??null,agentId:l,status:v.status,summary:x,payloads:w,meta:{outputDir:q?.absoluteOutputDir,outputDirRelative:q?.relativeOutputDir,notesDirRelative:q?.notesDirRelative}}}async function bW(a,b,c,d){let e=(await d.getMissionControlSnapshot({includeHidden:!0})).tasks.find(b=>b.id===a),f=e?await (0,a9.ji)(e):c?await (0,a9.O1)(c):null;if(!e&&!f)throw Error("Task was not found in the current OpenClaw snapshot.");if(!f)return bY(e,a,b,d);if((0,a9.VW)(f.status))return{taskId:a,dispatchId:f.id,status:f.status,summary:(0,aW.kc)(f),reason:f.error,runnerPid:f.runner.pid,childPid:f.runner.childPid,abortedAt:f.runner.finishedAt??f.updatedAt};let g=new Date().toISOString(),h=(0,a9.GG)(b),i={...f,status:"cancelled",updatedAt:g,error:h,runner:{...f.runner,finishedAt:g,lastHeartbeatAt:g}};await (0,a9.lm)(i),d.invalidateMissionControlCaches();let j=null,l=f.result?.runId??null,m=(0,k.rw)();for(let a of bX(e,f))await m.cancelTask({taskId:a,reason:h},{timeoutMs:15e3}).catch(()=>null);return(l||f.sessionId)&&await m.abortAgentTurn({runId:l,sessionId:f.sessionId,agentId:f.agentId,reason:h},{timeoutMs:15e3}).catch(()=>null),j=await (0,a9.e4)(i),{taskId:a,dispatchId:i.id,status:i.status,summary:h,reason:h,runnerPid:i.runner.pid,childPid:j??i.runner.childPid,abortedAt:g}}function bX(a,b){let c=[bZ(b?.result),bZ(b?.result?.task),bZ(a?.metadata),a?.metadata.gatewayObjectKind==="task"?a.metadata.taskId:null,a?.metadata.gatewayObjectKind==="task"?a?.key:null],d=new Set;for(let a of c)"string"==typeof a&&a.trim()&&a!==b?.id&&d.add(a.trim());return[...d]}async function bY(a,b,c,d){if(!a)throw Error("Task was not found in the current OpenClaw snapshot.");if("completed"===a.status||"stalled"===a.status||"cancelled"===a.status)return{taskId:b,dispatchId:null,status:a.status,summary:a.subtitle||"Task is already terminal.",reason:null,runnerPid:null,childPid:null,abortedAt:new Date().toISOString()};let e=(0,a9.GG)(c),f=bX(a,null);if(0===f.length)throw Error("Mission dispatch record was not found and the task does not expose a Gateway task id.");for(let a of f)await (0,k.rw)().cancelTask({taskId:a,reason:e},{timeoutMs:15e3});return d.invalidateMissionControlCaches(),{taskId:b,dispatchId:null,status:"cancelled",summary:e,reason:e,runnerPid:null,childPid:null,abortedAt:new Date().toISOString()}}function bZ(a){if(!a||"object"!=typeof a||Array.isArray(a))return null;let b=a.gatewayTaskId??a.openClawTaskId??a.taskId??a.id;return"string"==typeof b&&b.trim()?b.trim():null}function b$(a,b){if(!b)return a.agents.find(a=>a.isDefault)?.id||a.agents[0]?.id;let c=a.agents.filter(a=>a.workspaceId===b);return c.find(a=>a.isDefault)?.id||c.find(a=>"engaged"===a.status)?.id||c[0]?.id}async function b_(a){return bV(a,{getMissionControlSnapshot:d.GM,resolveAgentForMission:b$,invalidateMissionControlCaches:d.er})}async function b0(a,b,c){return bW(a,b,c,{getMissionControlSnapshot:d.GM,resolveAgentForMission:b$,invalidateMissionControlCaches:d.er})}async function b1(a,b,c={}){var e,f,g,h;let i,j,l,m,n,o=b.message.trim();if(!o)throw Error("Control message is required.");let p=c.getTaskDetail??bu,q=await p(a,{dispatchId:b.dispatchId??null}),r=(i=(e=q).task,j=e.runs.find(a=>b3(a.status))??e.runs[0]??null,l=j?.agentId?.trim()||i.primaryAgentId?.trim()||b4(i.agentIds)||null,m=j?.sessionId?.trim()||b4(i.sessionIds)||b5(i.metadata,"sessionId")||b5(i.metadata,"gatewaySessionId")||b5(i.metadata,"openClawSessionId")||null,n=(b5(i.metadata,"sessionKey")||b5(i.metadata,"gatewaySessionKey")||(j?.key.trim().startsWith("agent:")?j.key.trim():null))??(f=l,(g=m)?g.startsWith("agent:")?g:f?`agent:${f}:explicit:${g}`:null:null),{agentId:l,sessionId:m,sessionKey:n,runId:j?.runId?.trim()||b4(i.runIds)||null}),s=c.adapter??(0,k.rw)();if("continue"===b.action){let a=await b2(q,r,o,s,c);return(c.invalidateMissionControlSnapshotCache??d.ZZ)(),{ok:!0,action:b.action,taskId:q.task.id,target:r,result:a}}if(!(b3((h=q).task.status)||h.task.liveRunCount>0||h.runs.some(a=>b3(a.status))))throw Error("Task is not currently running.");if(!r.sessionKey&&!r.sessionId)throw Error("Task does not expose an active OpenClaw session.");let t="steer"===b.action?await s.steerSession({key:r.sessionKey,sessionId:r.sessionKey?null:r.sessionId,message:o},{timeoutMs:1e4}):await s.injectChat({sessionKey:r.sessionKey,sessionId:r.sessionKey?null:r.sessionId,message:o},{timeoutMs:1e4});return(c.invalidateMissionControlSnapshotCache??d.ZZ)(),{ok:!0,action:b.action,taskId:q.task.id,target:r,result:t}}async function b2(a,b,c,e,f){var g,h;let i,j;if(!b.agentId)throw Error("Task does not expose an OpenClaw agent.");if(!e.runAgentTurn)throw Error("Task continuation requires OpenClaw mission dispatch support.");let k=await (f.getMissionControlSnapshot??d.GM)({includeHidden:!0}).catch(()=>null),l=a.task.dispatchId??null,m=b.sessionId??b.sessionKey??void 0;return await e.runAgentTurn({agentId:b.agentId,sessionId:m??void 0,message:c,thinking:"medium",timeoutSeconds:45,workspace:(g=a,h=k,i=g.task,j=i.workspaceId?.trim(),h&&j?h.workspaces.find(a=>a.id===j)?.path??h.agents.find(a=>a.id===i.primaryAgentId)?.workspacePath??null:null),dispatchId:l,idempotencyKey:l?`${l}:continue:${Date.now()}`:void 0},{timeoutMs:6e4})}function b3(a){return"running"===a||"queued"===a}function b4(a){return a.find(a=>a.trim().length>0)?.trim()??null}function b5(a,b){let c=a[b];return"string"==typeof c&&c.trim().length>0?c.trim():null}var b6=c(1718),b7=c(99254),b8=c(74497),b9=c(70262),ca=c(96972);let cb=new Set(["bindings","channels.telegram.enabled","channels.telegram.defaultAccount","channels.telegram.groups"]);function cc(){(0,d.ZZ)()}async function cd(a,b){let c=c$(a.channelId);if(!c)throw Error("Channel id is required.");return await (0,o.rh)(b,"workspace-channel.registry-upsert",()=>cY(b=>{let d=b.channels.find(a=>a.id===c)??{id:c,type:a.type,name:a.name.trim()||c,primaryAgentId:(0,af.Nk)(a.primaryAgentId)??null,workspaces:[]},e=a.workspaceId.trim(),f=a.workspacePath.trim(),g=d.workspaces.find(a=>a.workspaceId===e)??{workspaceId:e,workspacePath:f,agentIds:[],groupAssignments:[]},h=cZ([...g.agentIds,...(a.agentIds??[]).map(a=>a.trim()).filter(Boolean)]),i=(0,T.qc)([...g.groupAssignments,...(a.groupAssignments??[]).filter(a=>!!a.chatId)]),j={...g,workspacePath:f,agentIds:h,groupAssignments:i},k=d.workspaces.filter(a=>a.workspaceId!==e);k.push(j);let l=(0,af.Nk)(a.primaryAgentId)??d.primaryAgentId;b.channels=[...b.channels.filter(a=>a.id!==c),{...d,id:c,type:a.type,name:a.name.trim()||d.name||c,primaryAgentId:l||j.agentIds[0]||j.groupAssignments.find(a=>a.agentId)?.agentId||null,workspaces:k}]},{},b)),cc(),(0,b7.VW)()}async function ce(a,b){let c=c$(a.channelId);if(!c)throw Error("Channel id is required.");return await (0,o.rh)(b,"channel-registry.disconnect",()=>cY(b=>{b.channels=b.channels.map(b=>{if(b.id!==c)return b;let d=b.workspaces.filter(b=>b.workspaceId!==a.workspaceId),e=cZ([...d.flatMap(a=>a.agentIds),...d.flatMap(a=>a.groupAssignments.filter(a=>!1!==a.enabled&&a.agentId).map(a=>a.agentId))]);return{...b,primaryAgentId:b.primaryAgentId&&e.includes(b.primaryAgentId)?b.primaryAgentId:e[0]??null,workspaces:d}}).filter(a=>a.workspaces.length>0||a.primaryAgentId)},{},b)),cc(),(0,b7.VW)()}async function cf(a,b){let c=c$(a.channelId);if(!c)throw Error("Channel id is required.");let d=(await (0,o.rh)(b,"channel-registry.read-before-delete",()=>(0,b7.vg)())).channels.find(a=>a.id===c);if(!d)throw Error("Channel was not found.");let e=cZ(d.workspaces.flatMap(a=>a.groupAssignments.filter(a=>!!a.chatId).map(a=>a.chatId))),f=cZ(d.workspaces.map(a=>a.workspacePath));return c_(d.type)&&"internal"!==d.type&&await (0,o.rh)(b,"channel.delete-openclaw-remove",()=>(0,k.rw)().removeChannelAccount({channel:d.type,account:c,delete:!0},{timeoutMs:6e4})),await (0,o.rh)(b,"channel.delete-registry-sync",()=>cY(a=>{a.channels=a.channels.filter(a=>a.id!==c)},{removedAccountIds:[c],removedGroupIds:e},b)),await (0,o.rh)(b,"channel.delete-project-cleanup",()=>Promise.all(f.map(a=>cp(a,c,b)))),cc(),(0,o.rh)(b,"channel.delete-read-final-registry",()=>(0,b7.VW)())}async function cg(a,b){var c;let d,e,f,h,i,j=a.scope??"workspace",l=!0===a.dryRun,m=(0,af.Nk)(a.workspaceId)??null,n=(0,af.Nk)(a.confirmedPreviewAuditId)??null;if("workspace"===j&&!m)throw Error("Workspace id is required.");let p=l?null:await cu(n),q=await (0,o.rh)(b,"surface-reconcile.registry-read",()=>(0,b7.vg)());if("workspace"===j&&!q.channels.some(a=>a.workspaces.some(a=>a.workspaceId===m)))throw Error("Workspace binding was not found for any surface.");let r=await (0,o.rh)(b,"surface-reconcile.bindings-read",()=>(0,k.rw)().getConfig("bindings").then(a=>Array.isArray(a)?a:[])),s=(0,b9.xC)({registry:q,currentBindings:r,scope:j,workspaceId:m}),t=q.channels.filter(a=>c_(a.type)&&"internal"!==a.type),u="all"===j?await (0,o.rh)(b,"surface-reconcile.telegram-settings-plan",()=>cO(t.filter(a=>"telegram"===a.type),b)):{patch:null,defaultAccountId:null},v=ct({bindings:s},u.patch),w=v?cA(v).map(a=>a.path):[];cv(w),p&&(0,b9.V7)({preview:p,previewMaxAgeMs:9e5,scope:j,workspaceId:"workspace"===j?m:null,plannedConfigPaths:w,currentBindings:r,nextBindings:s});let x=(d=new Date().toISOString().replace(/[:.]/g,"-"),e=Math.random().toString(36).slice(2,8),`surface-reconcile-${d}-${e}`),y=g().join(bm.BY,"surface-reconcile",`${x}.json`),z=l?null:(f=new Date().toISOString().replace(/[:.]/g,"-"),h=Math.random().toString(36).slice(2,8),`surface-reconcile-backup-${f}-${h}`),A=z?g().join(bm.BY,"surface-reconcile",`${z}.json`):null,B=l?null:await cw(w,b),C=(i=Array.from(new Set((c={auditId:x,createdAt:new Date().toISOString(),configPaths:w,confirmedPreviewAuditId:n??void 0,backupId:z??void 0,backupPath:A??void 0}).configPaths)).sort(),{auditId:c.auditId,createdAt:c.createdAt,configPaths:i,...c.backupId?{backupId:c.backupId}:{},...c.backupPath?{backupPath:c.backupPath}:{},...c.confirmedPreviewAuditId?{confirmedPreviewAuditId:c.confirmedPreviewAuditId}:{},instructions:function(a){if(0===a.configPaths.length)return[`Review audit ${a.auditId}; no OpenClaw config path changes were planned.`];let b=a.backupId&&a.backupPath?` Use backup ${a.backupId} at ${a.backupPath} as the redacted previous-value reference.`:" Run a new dry-run preview before applying a rollback.";return a.configPaths.map(c=>`Review audit ${a.auditId}, verify the previous ${c} value, then restore only that OpenClaw config path if rollback is required.${b}`)}({auditId:c.auditId,configPaths:i,backupId:c.backupId,backupPath:c.backupPath})});z&&A&&await cx({backupId:z,backupPath:A,auditId:x,confirmedPreviewAuditId:n,scope:j,workspaceId:"workspace"===j?m:null,previousBindings:r,nextBindings:s,reconcilePatch:v,plannedConfigPaths:w,previousConfigValues:B},b);let D=l?void 0:await (0,o.rh)(b,"surface-reconcile.config-write",()=>cz(v,b));if("all"===j&&!l){let a=t.filter(a=>"telegram"===a.type);await (0,o.rh)(b,"surface-reconcile.telegram-settings-side-effects",()=>cP(a,u.defaultAccountId,b)),await (0,o.rh)(b,"surface-reconcile.discord-settings",()=>cT(t.filter(a=>"discord"===a.type),b))}let E=await (0,o.rh)(b,"surface-reconcile.accounts-read",()=>(0,b7.QT)()),F=(0,b9.U$)(E,q),G=(0,b9.LB)({registry:q,currentBindings:s,surfaceRuntime:F,configuredAccounts:E,workspaceId:"workspace"===j?m:null}),H=(0,b9.Pe)({scope:j,workspaceId:"workspace"===j?m:null,registry:q,previousBindings:r,nextBindings:s,configMutations:D,dryRun:l,applied:!l,auditId:x,auditPath:y,confirmedPreviewAuditId:n??void 0,backupId:z??void 0,backupPath:A??void 0,restorePlan:C,drift:G});return await cy({auditPath:y,repair:H,previousBindings:r,nextBindings:s,reconcilePatch:v,plannedConfigPaths:w},b),l||cc(),H}async function ch(a,b){let c=c$(a.channelId);if(!c)throw Error("Channel id is required.");return await (0,o.rh)(b,"channel.primary-update",()=>cY(b=>{let d=b.channels.find(a=>a.id===c);if(!d)throw Error("Channel was not found.");d.primaryAgentId=(0,af.Nk)(a.primaryAgentId)??null},{},b)),cc(),(0,b7.VW)()}async function ci(a,b){let c=c$(a.channelId);if(!c)throw Error("Channel id is required.");let d=[];return await (0,o.rh)(b,"channel.groups-update",()=>cY(b=>{let e=b.channels.find(a=>a.id===c);if(!e)throw Error("Channel was not found.");let f=e.workspaces.find(b=>b.workspaceId===a.workspaceId);if(!f)throw Error("Workspace binding was not found for this channel.");let g=new Set(f.groupAssignments.filter(a=>!1!==a.enabled&&!!a.chatId).map(a=>a.chatId));f.groupAssignments=(0,T.qc)(a.groupAssignments.map(a=>({chatId:a.chatId.trim(),agentId:(0,af.Nk)(a.agentId)??null,title:(0,af.Nk)(a.title)??null,enabled:!1!==a.enabled}))),f.agentIds=cZ([...f.agentIds,...f.groupAssignments.filter(a=>!1!==a.enabled&&a.agentId).map(a=>a.agentId)]);let h=new Set(f.groupAssignments.filter(a=>!1!==a.enabled&&!!a.chatId).map(a=>a.chatId));for(let a of g)h.has(a)||d.push(a)},{removedGroupIds:d},b)),cc(),(0,b7.VW)()}async function cj(a,b){let c=c$(a.channelId),d=c0(a.agentId.trim());if(!c||!d)throw Error("Channel id and agent id are required.");return await (0,o.rh)(b,"channel.bind-agent",()=>cY(b=>{let e=b.channels.find(a=>a.id===c);if(!e)throw Error("Channel was not found.");let f=e.workspaces.find(b=>b.workspaceId===a.workspaceId)??{workspaceId:a.workspaceId,workspacePath:a.workspacePath,agentIds:[],groupAssignments:[]};f.agentIds=cZ([...f.agentIds,d]),f.workspacePath=a.workspacePath,e.workspaces=[...e.workspaces.filter(b=>b.workspaceId!==a.workspaceId),f],e.primaryAgentId||(e.primaryAgentId=d)},{},b)),cc(),(0,b7.VW)()}async function ck(a,b){let c=c$(a.channelId),d=c0(a.agentId.trim());if(!c||!d)throw Error("Channel id and agent id are required.");return await (0,o.rh)(b,"channel.unbind-agent",()=>cY(b=>{let e=b.channels.find(a=>a.id===c);if(!e)throw Error("Channel was not found.");let f=e.workspaces.find(b=>b.workspaceId===a.workspaceId);if(f){if(f.agentIds=f.agentIds.filter(a=>a!==d),f.groupAssignments=f.groupAssignments.filter(a=>a.agentId!==d),e.primaryAgentId===d){let a=f.agentIds[0]??f.groupAssignments.find(a=>!1!==a.enabled&&a.agentId)?.agentId??e.workspaces.flatMap(a=>a.agentIds).find(a=>a!==d)??e.workspaces.flatMap(a=>a.groupAssignments).find(a=>!1!==a.enabled&&a.agentId&&a.agentId!==d)?.agentId??null;e.primaryAgentId=a}e.workspaces=[...e.workspaces.filter(b=>b.workspaceId!==a.workspaceId),{...f,agentIds:f.agentIds,groupAssignments:f.groupAssignments}]}},{},b)),cc(),(0,b7.VW)()}async function cl(a,b){if("telegram"===a.provider){if(!a.token?.trim())throw Error("Telegram bot token is required.");return cn({name:a.name,token:a.token,accountId:a.accountId},b)}let c=(0,af.Nk)(a.accountId)??await cC(a.provider,a.name,b),d=new Set((await (0,o.rh)(b,`managed-chat.${a.provider}.read-before`,()=>(0,b7.QT)())).filter(b=>b.type===a.provider).map(a=>a.id)),e=(()=>{switch(a.provider){case"discord":if(!a.token?.trim())throw Error("Discord bot token is required.");return{channel:"discord",account:c,token:a.token,name:a.name};case"slack":if(!a.botToken?.trim())throw Error("Slack bot token is required.");return{channel:"slack",account:c,botToken:a.botToken,name:a.name};case"googlechat":if(!a.webhookUrl?.trim())throw Error("Google Chat webhook URL is required.");return{channel:"googlechat",account:c,webhookUrl:a.webhookUrl,name:a.name};default:throw Error(`OpenClaw provisioning is not implemented for ${a.provider}.`)}})();await (0,o.rh)(b,`managed-chat.${a.provider}.provision-openclaw`,()=>(0,k.rw)().provisionChannelAccount(e,{timeoutMs:6e4}));let f=(await (0,o.rh)(b,`managed-chat.${a.provider}.read-after`,()=>(0,b7.QT)())).filter(b=>b.type===a.provider);return f.find(a=>a.id===c)??f.find(b=>!d.has(b.id)&&b.name===a.name)??f.find(a=>!d.has(a.id))??null??{id:c,type:a.provider,kind:(0,b8.Yx)(a.provider),name:a.name.trim()||c,enabled:!0}}async function cm(a,b){var c;if("telegram"===(c=a.provider)||"discord"===c||"slack"===c||"googlechat"===c)return cl({provider:a.provider,name:a.name,accountId:a.accountId,token:a.token,botToken:a.botToken,webhookUrl:a.webhookUrl},b);let d=function(a){let b={};if(!cq(a))return b;for(let[c,d]of Object.entries(a))cI(b,c,cJ(d));return b}(a.config),e=a.name.trim(),f=function(a,b){switch(a){case"gmail":return cK(b.account)??cK(b.email)??cK(b.address);case"email":return cK(b.address)??cK(b.email);case"webhook":case"cron":return cK(b.accountId)??cK(b.name);default:return null}}(a.provider,d),g=(0,af.Nk)(a.accountId)??f??await cC(a.provider,a.name,b),h=function(a){switch(a){case"gmail":return"hooks.gmail";case"email":return"email";case"webhook":return"hooks";case"cron":return"cron";default:throw Error(`OpenClaw provisioning is not implemented for ${a}.`)}}(a.provider);switch(a.provider){case"gmail":{let a=(0,af.Nk)(d.account??d.email??d.address);if(!a)throw Error("Gmail account email is required.");await (0,o.rh)(b,"managed-surface.gmail.setup-openclaw",()=>(0,k.rw)().setupGmailWebhook({account:a,config:d},{timeoutMs:6e4}));let c=await (0,o.rh)(b,"managed-surface.gmail.read-config",()=>(0,k.rw)().getConfig(h,{timeoutMs:6e4})),f=await (0,o.rh)(b,"managed-surface.gmail.read-hooks",()=>(0,k.rw)().getConfig("hooks",{timeoutMs:6e4})),i=f?.presets,j=cH(f,{enabled:!0,presets:cZ([...Array.isArray(i)?i.filter(a=>"string"==typeof a):[],"gmail"])});await (0,o.rh)(b,"managed-surface.gmail.write-hooks",()=>(0,k.rw)().setConfig("hooks",j,{strictJson:!0,timeoutMs:6e4}));let l=cH(c,{enabled:!0,name:e||a,label:e||a,accountId:g,account:a,email:a,address:a,...d});await (0,o.rh)(b,"managed-surface.gmail.write-config",()=>(0,k.rw)().setConfig(h,l,{strictJson:!0,timeoutMs:6e4}));break}case"webhook":{let a=await (0,o.rh)(b,"managed-surface.webhook.read-config",()=>(0,k.rw)().getConfig(h,{timeoutMs:6e4})),c=cK(d.token);if(!c)throw Error("Webhook token is required.");let f=cH(a,{enabled:!0,name:e||g,label:e||g,accountId:g,token:c,...d});await (0,o.rh)(b,"managed-surface.webhook.write-config",()=>(0,k.rw)().setConfig(h,f,{strictJson:!0,timeoutMs:6e4}));break}case"cron":{let a=await (0,o.rh)(b,"managed-surface.cron.read-config",()=>(0,k.rw)().getConfig(h,{timeoutMs:6e4})),c=cK(d.webhookToken);if(!c)throw Error("Cron webhook token is required.");let f=cH(a,{enabled:!0,name:e||g,label:e||g,accountId:g,webhookToken:c,...d});await (0,o.rh)(b,"managed-surface.cron.write-config",()=>(0,k.rw)().setConfig(h,f,{strictJson:!0,timeoutMs:6e4}));break}case"email":{let a=await (0,o.rh)(b,"managed-surface.email.read-config",()=>(0,k.rw)().getConfig(h,{timeoutMs:6e4})),c=cK(d.address??d.email);if(!c)throw Error("Email address is required.");let f=cH(a,{enabled:!0,name:e||c,label:e||c,accountId:g,address:c,email:c,...d});await (0,o.rh)(b,"managed-surface.email.write-config",()=>(0,k.rw)().setConfig(h,f,{strictJson:!0,timeoutMs:6e4}));break}default:throw Error(`OpenClaw provisioning is not implemented for ${a.provider}.`)}let i=(await (0,o.rh)(b,`managed-surface.${a.provider}.read-after`,()=>(0,b7.QT)())).filter(b=>b.type===a.provider);return i.find(a=>a.id===g)??i.find(b=>b.name.trim().toLowerCase()===a.name.trim().toLowerCase())??i[0]??null??{id:g,type:a.provider,kind:(0,b8.Yx)(a.provider),name:e||g,enabled:!0}}async function cn(a,b){let c=(0,af.Nk)(a.accountId)??await cD(a.name,b),d=new Set((await (0,o.rh)(b,"telegram.read-before",()=>(0,b7.QT)())).filter(a=>"telegram"===a.type).map(a=>a.id));await (0,o.rh)(b,"telegram.openclaw-add",()=>(0,k.rw)().provisionChannelAccount({channel:"telegram",account:c,token:a.token,name:a.name},{timeoutMs:6e4}));let e={id:c,type:"telegram",name:a.name.trim()||c,enabled:!0},f=(await (0,o.rh)(b,"telegram.read-after",()=>(0,b7.QT)())).filter(a=>"telegram"===a.type).find(a=>a.id===c);if(f)return{...f,name:a.name.trim()||f.name};let g=Date.now()+8e3,h=null,i=0;for(;Date.now()<g;){i+=1;let e=(await (0,o.rh)(b,`telegram.resolve.${i}.read-channel-accounts`,()=>(0,b7.QT)())).filter(a=>"telegram"===a.type);if(h=e.find(a=>a.id===c)??e.find(b=>!d.has(b.id)&&b.name===a.name)??e.find(a=>!d.has(a.id))??e.find(b=>b.name===a.name)??null)break;let f=await (0,o.rh)(b,`telegram.resolve.${i}.read-pairing-accounts`,()=>cE());if(h=f.find(b=>!d.has(b.id)&&b.name===a.name)??f.find(a=>!d.has(a.id))??f.find(b=>b.name===a.name)??null)break;await (0,o.rh)(b,`telegram.resolve.${i}.sleep`,()=>new Promise(a=>setTimeout(a,750)))}if(!h){let c=await (0,o.rh)(b,"telegram.resolve.token-lookup",async()=>cG(a.token,(await (0,o.rh)(b,"telegram.resolve.token-lookup.read-channel-accounts",()=>(0,b7.QT)())).filter(a=>"telegram"===a.type),b));h=c||e}return{...h,name:a.name.trim()||h.name}}async function co(a){await C(bm.q6,`${JSON.stringify(a,null,2)}
|