@farazirfan/costar-server-executor 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +53 -0
- package/README.md +313 -0
- package/costar.mjs +19 -0
- package/dist/agent/agent-old.d.ts +61 -0
- package/dist/agent/agent-old.d.ts.map +1 -0
- package/dist/agent/agent-old.js +282 -0
- package/dist/agent/agent-old.js.map +1 -0
- package/dist/agent/agent.d.ts +110 -0
- package/dist/agent/agent.d.ts.map +1 -0
- package/dist/agent/agent.js +349 -0
- package/dist/agent/agent.js.map +1 -0
- package/dist/agent/context-loader.d.ts +41 -0
- package/dist/agent/context-loader.d.ts.map +1 -0
- package/dist/agent/context-loader.js +166 -0
- package/dist/agent/context-loader.js.map +1 -0
- package/dist/agent/index.d.ts +13 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +11 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/model-fallback.d.ts +48 -0
- package/dist/agent/model-fallback.d.ts.map +1 -0
- package/dist/agent/model-fallback.js +103 -0
- package/dist/agent/model-fallback.js.map +1 -0
- package/dist/agent/pi-embedded-runner/model.d.ts +31 -0
- package/dist/agent/pi-embedded-runner/model.d.ts.map +1 -0
- package/dist/agent/pi-embedded-runner/model.js +65 -0
- package/dist/agent/pi-embedded-runner/model.js.map +1 -0
- package/dist/agent/pi-embedded-runner/run.d.ts +10 -0
- package/dist/agent/pi-embedded-runner/run.d.ts.map +1 -0
- package/dist/agent/pi-embedded-runner/run.js +230 -0
- package/dist/agent/pi-embedded-runner/run.js.map +1 -0
- package/dist/agent/pi-embedded-runner/subscribe.d.ts +42 -0
- package/dist/agent/pi-embedded-runner/subscribe.d.ts.map +1 -0
- package/dist/agent/pi-embedded-runner/subscribe.js +237 -0
- package/dist/agent/pi-embedded-runner/subscribe.js.map +1 -0
- package/dist/agent/pi-embedded-runner/system-prompt.d.ts +52 -0
- package/dist/agent/pi-embedded-runner/system-prompt.d.ts.map +1 -0
- package/dist/agent/pi-embedded-runner/system-prompt.js +331 -0
- package/dist/agent/pi-embedded-runner/system-prompt.js.map +1 -0
- package/dist/agent/pi-embedded-runner/tools.d.ts +16 -0
- package/dist/agent/pi-embedded-runner/tools.d.ts.map +1 -0
- package/dist/agent/pi-embedded-runner/tools.js +52 -0
- package/dist/agent/pi-embedded-runner/tools.js.map +1 -0
- package/dist/agent/pi-embedded-runner/types.d.ts +176 -0
- package/dist/agent/pi-embedded-runner/types.d.ts.map +1 -0
- package/dist/agent/pi-embedded-runner/types.js +5 -0
- package/dist/agent/pi-embedded-runner/types.js.map +1 -0
- package/dist/agent/tool-executor.d.ts +44 -0
- package/dist/agent/tool-executor.d.ts.map +1 -0
- package/dist/agent/tool-executor.js +159 -0
- package/dist/agent/tool-executor.js.map +1 -0
- package/dist/api/chat.d.ts +22 -0
- package/dist/api/chat.d.ts.map +1 -0
- package/dist/api/chat.js +66 -0
- package/dist/api/chat.js.map +1 -0
- package/dist/browser/bridge-server.d.ts +18 -0
- package/dist/browser/bridge-server.d.ts.map +1 -0
- package/dist/browser/bridge-server.js +46 -0
- package/dist/browser/bridge-server.js.map +1 -0
- package/dist/browser/cdp.d.ts +124 -0
- package/dist/browser/cdp.d.ts.map +1 -0
- package/dist/browser/cdp.helpers.d.ts +10 -0
- package/dist/browser/cdp.helpers.d.ts.map +1 -0
- package/dist/browser/cdp.helpers.js +137 -0
- package/dist/browser/cdp.helpers.js.map +1 -0
- package/dist/browser/cdp.js +294 -0
- package/dist/browser/cdp.js.map +1 -0
- package/dist/browser/chrome.d.ts +21 -0
- package/dist/browser/chrome.d.ts.map +1 -0
- package/dist/browser/chrome.executables.d.ts +10 -0
- package/dist/browser/chrome.executables.d.ts.map +1 -0
- package/dist/browser/chrome.executables.js +510 -0
- package/dist/browser/chrome.executables.js.map +1 -0
- package/dist/browser/chrome.js +254 -0
- package/dist/browser/chrome.js.map +1 -0
- package/dist/browser/chrome.profile-decoration.d.ts +11 -0
- package/dist/browser/chrome.profile-decoration.d.ts.map +1 -0
- package/dist/browser/chrome.profile-decoration.js +145 -0
- package/dist/browser/chrome.profile-decoration.js.map +1 -0
- package/dist/browser/client-actions-core.d.ts +144 -0
- package/dist/browser/client-actions-core.d.ts.map +1 -0
- package/dist/browser/client-actions-core.js +101 -0
- package/dist/browser/client-actions-core.js.map +1 -0
- package/dist/browser/client-actions-observe.d.ts +69 -0
- package/dist/browser/client-actions-observe.d.ts.map +1 -0
- package/dist/browser/client-actions-observe.js +101 -0
- package/dist/browser/client-actions-observe.js.map +1 -0
- package/dist/browser/client-actions-state.d.ts +91 -0
- package/dist/browser/client-actions-state.d.ts.map +1 -0
- package/dist/browser/client-actions-state.js +170 -0
- package/dist/browser/client-actions-state.js.map +1 -0
- package/dist/browser/client-actions-types.d.ts +19 -0
- package/dist/browser/client-actions-types.d.ts.map +1 -0
- package/dist/browser/client-actions-types.js +2 -0
- package/dist/browser/client-actions-types.js.map +1 -0
- package/dist/browser/client-actions.d.ts +5 -0
- package/dist/browser/client-actions.d.ts.map +1 -0
- package/dist/browser/client-actions.js +5 -0
- package/dist/browser/client-actions.js.map +1 -0
- package/dist/browser/client-fetch.d.ts +4 -0
- package/dist/browser/client-fetch.d.ts.map +1 -0
- package/dist/browser/client-fetch.js +92 -0
- package/dist/browser/client-fetch.js.map +1 -0
- package/dist/browser/client.d.ts +148 -0
- package/dist/browser/client.d.ts.map +1 -0
- package/dist/browser/client.js +138 -0
- package/dist/browser/client.js.map +1 -0
- package/dist/browser/config.d.ts +40 -0
- package/dist/browser/config.d.ts.map +1 -0
- package/dist/browser/config.js +181 -0
- package/dist/browser/config.js.map +1 -0
- package/dist/browser/constants.d.ts +9 -0
- package/dist/browser/constants.d.ts.map +1 -0
- package/dist/browser/constants.js +9 -0
- package/dist/browser/constants.js.map +1 -0
- package/dist/browser/control-service.d.ts +6 -0
- package/dist/browser/control-service.d.ts.map +1 -0
- package/dist/browser/control-service.js +73 -0
- package/dist/browser/control-service.js.map +1 -0
- package/dist/browser/extension-relay.d.ts +15 -0
- package/dist/browser/extension-relay.d.ts.map +1 -0
- package/dist/browser/extension-relay.js +542 -0
- package/dist/browser/extension-relay.js.map +1 -0
- package/dist/browser/profiles-service.d.ts +26 -0
- package/dist/browser/profiles-service.d.ts.map +1 -0
- package/dist/browser/profiles-service.js +133 -0
- package/dist/browser/profiles-service.js.map +1 -0
- package/dist/browser/profiles.d.ts +31 -0
- package/dist/browser/profiles.d.ts.map +1 -0
- package/dist/browser/profiles.js +94 -0
- package/dist/browser/profiles.js.map +1 -0
- package/dist/browser/pw-ai-module.d.ts +7 -0
- package/dist/browser/pw-ai-module.d.ts.map +1 -0
- package/dist/browser/pw-ai-module.js +38 -0
- package/dist/browser/pw-ai-module.js.map +1 -0
- package/dist/browser/pw-ai.d.ts +3 -0
- package/dist/browser/pw-ai.d.ts.map +1 -0
- package/dist/browser/pw-ai.js +3 -0
- package/dist/browser/pw-ai.js.map +1 -0
- package/dist/browser/pw-role-snapshot.d.ts +36 -0
- package/dist/browser/pw-role-snapshot.d.ts.map +1 -0
- package/dist/browser/pw-role-snapshot.js +311 -0
- package/dist/browser/pw-role-snapshot.js.map +1 -0
- package/dist/browser/pw-session.d.ts +136 -0
- package/dist/browser/pw-session.d.ts.map +1 -0
- package/dist/browser/pw-session.js +432 -0
- package/dist/browser/pw-session.js.map +1 -0
- package/dist/browser/pw-tools-core.activity.d.ts +22 -0
- package/dist/browser/pw-tools-core.activity.d.ts.map +1 -0
- package/dist/browser/pw-tools-core.activity.js +45 -0
- package/dist/browser/pw-tools-core.activity.js.map +1 -0
- package/dist/browser/pw-tools-core.d.ts +9 -0
- package/dist/browser/pw-tools-core.d.ts.map +1 -0
- package/dist/browser/pw-tools-core.downloads.d.ts +35 -0
- package/dist/browser/pw-tools-core.downloads.d.ts.map +1 -0
- package/dist/browser/pw-tools-core.downloads.js +177 -0
- package/dist/browser/pw-tools-core.downloads.js.map +1 -0
- package/dist/browser/pw-tools-core.interactions.d.ts +113 -0
- package/dist/browser/pw-tools-core.interactions.d.ts.map +1 -0
- package/dist/browser/pw-tools-core.interactions.js +421 -0
- package/dist/browser/pw-tools-core.interactions.js.map +1 -0
- package/dist/browser/pw-tools-core.js +9 -0
- package/dist/browser/pw-tools-core.js.map +1 -0
- package/dist/browser/pw-tools-core.responses.d.ts +14 -0
- package/dist/browser/pw-tools-core.responses.d.ts.map +1 -0
- package/dist/browser/pw-tools-core.responses.js +84 -0
- package/dist/browser/pw-tools-core.responses.js.map +1 -0
- package/dist/browser/pw-tools-core.shared.d.ts +7 -0
- package/dist/browser/pw-tools-core.shared.d.ts.map +1 -0
- package/dist/browser/pw-tools-core.shared.js +49 -0
- package/dist/browser/pw-tools-core.shared.js.map +1 -0
- package/dist/browser/pw-tools-core.snapshot.d.ts +65 -0
- package/dist/browser/pw-tools-core.snapshot.d.ts.map +1 -0
- package/dist/browser/pw-tools-core.snapshot.js +143 -0
- package/dist/browser/pw-tools-core.snapshot.js.map +1 -0
- package/dist/browser/pw-tools-core.state.d.ts +47 -0
- package/dist/browser/pw-tools-core.state.d.ts.map +1 -0
- package/dist/browser/pw-tools-core.state.js +148 -0
- package/dist/browser/pw-tools-core.state.js.map +1 -0
- package/dist/browser/pw-tools-core.storage.d.ts +48 -0
- package/dist/browser/pw-tools-core.storage.d.ts.map +1 -0
- package/dist/browser/pw-tools-core.storage.js +73 -0
- package/dist/browser/pw-tools-core.storage.js.map +1 -0
- package/dist/browser/pw-tools-core.trace.d.ts +13 -0
- package/dist/browser/pw-tools-core.trace.d.ts.map +1 -0
- package/dist/browser/pw-tools-core.trace.js +26 -0
- package/dist/browser/pw-tools-core.trace.js.map +1 -0
- package/dist/browser/routes/agent.act.d.ts +4 -0
- package/dist/browser/routes/agent.act.d.ts.map +1 -0
- package/dist/browser/routes/agent.act.js +467 -0
- package/dist/browser/routes/agent.act.js.map +1 -0
- package/dist/browser/routes/agent.act.shared.d.ts +11 -0
- package/dist/browser/routes/agent.act.shared.d.ts.map +1 -0
- package/dist/browser/routes/agent.act.shared.js +39 -0
- package/dist/browser/routes/agent.act.shared.js.map +1 -0
- package/dist/browser/routes/agent.d.ts +4 -0
- package/dist/browser/routes/agent.d.ts.map +1 -0
- package/dist/browser/routes/agent.debug.d.ts +4 -0
- package/dist/browser/routes/agent.debug.d.ts.map +1 -0
- package/dist/browser/routes/agent.debug.js +134 -0
- package/dist/browser/routes/agent.debug.js.map +1 -0
- package/dist/browser/routes/agent.js +11 -0
- package/dist/browser/routes/agent.js.map +1 -0
- package/dist/browser/routes/agent.shared.d.ts +10 -0
- package/dist/browser/routes/agent.shared.d.ts.map +1 -0
- package/dist/browser/routes/agent.shared.js +46 -0
- package/dist/browser/routes/agent.shared.js.map +1 -0
- package/dist/browser/routes/agent.snapshot.d.ts +4 -0
- package/dist/browser/routes/agent.snapshot.d.ts.map +1 -0
- package/dist/browser/routes/agent.snapshot.js +270 -0
- package/dist/browser/routes/agent.snapshot.js.map +1 -0
- package/dist/browser/routes/agent.storage.d.ts +4 -0
- package/dist/browser/routes/agent.storage.d.ts.map +1 -0
- package/dist/browser/routes/agent.storage.js +387 -0
- package/dist/browser/routes/agent.storage.js.map +1 -0
- package/dist/browser/routes/basic.d.ts +4 -0
- package/dist/browser/routes/basic.d.ts.map +1 -0
- package/dist/browser/routes/basic.js +174 -0
- package/dist/browser/routes/basic.js.map +1 -0
- package/dist/browser/routes/dispatcher.d.ts +16 -0
- package/dist/browser/routes/dispatcher.d.ts.map +1 -0
- package/dist/browser/routes/dispatcher.js +87 -0
- package/dist/browser/routes/dispatcher.js.map +1 -0
- package/dist/browser/routes/index.d.ts +4 -0
- package/dist/browser/routes/index.d.ts.map +1 -0
- package/dist/browser/routes/index.js +9 -0
- package/dist/browser/routes/index.js.map +1 -0
- package/dist/browser/routes/tabs.d.ts +4 -0
- package/dist/browser/routes/tabs.d.ts.map +1 -0
- package/dist/browser/routes/tabs.js +121 -0
- package/dist/browser/routes/tabs.js.map +1 -0
- package/dist/browser/routes/types.d.ts +16 -0
- package/dist/browser/routes/types.d.ts.map +1 -0
- package/dist/browser/routes/types.js +2 -0
- package/dist/browser/routes/types.js.map +1 -0
- package/dist/browser/routes/utils.d.ts +16 -0
- package/dist/browser/routes/utils.d.ts.map +1 -0
- package/dist/browser/routes/utils.js +58 -0
- package/dist/browser/routes/utils.js.map +1 -0
- package/dist/browser/screenshot.d.ts +10 -0
- package/dist/browser/screenshot.d.ts.map +1 -0
- package/dist/browser/screenshot.js +40 -0
- package/dist/browser/screenshot.js.map +1 -0
- package/dist/browser/server-context.d.ts +4 -0
- package/dist/browser/server-context.d.ts.map +1 -0
- package/dist/browser/server-context.js +534 -0
- package/dist/browser/server-context.js.map +1 -0
- package/dist/browser/server-context.types.d.ts +79 -0
- package/dist/browser/server-context.types.d.ts.map +1 -0
- package/dist/browser/server-context.types.js +2 -0
- package/dist/browser/server-context.types.js.map +1 -0
- package/dist/browser/server.d.ts +4 -0
- package/dist/browser/server.d.ts.map +1 -0
- package/dist/browser/server.js +91 -0
- package/dist/browser/server.js.map +1 -0
- package/dist/browser/target-id.d.ts +12 -0
- package/dist/browser/target-id.d.ts.map +1 -0
- package/dist/browser/target-id.js +17 -0
- package/dist/browser/target-id.js.map +1 -0
- package/dist/browser/trash.d.ts +2 -0
- package/dist/browser/trash.d.ts.map +1 -0
- package/dist/browser/trash.js +22 -0
- package/dist/browser/trash.js.map +1 -0
- package/dist/chat-server.d.ts +2 -0
- package/dist/chat-server.d.ts.map +1 -0
- package/dist/chat-server.js +91 -0
- package/dist/chat-server.js.map +1 -0
- package/dist/cli/command-format.d.ts +2 -0
- package/dist/cli/command-format.d.ts.map +1 -0
- package/dist/cli/command-format.js +19 -0
- package/dist/cli/command-format.js.map +1 -0
- package/dist/cli/config-cmd.d.ts +6 -0
- package/dist/cli/config-cmd.d.ts.map +1 -0
- package/dist/cli/config-cmd.js +52 -0
- package/dist/cli/config-cmd.js.map +1 -0
- package/dist/cli/doctor.d.ts +6 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +198 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/env-loader.d.ts +23 -0
- package/dist/cli/env-loader.d.ts.map +1 -0
- package/dist/cli/env-loader.js +104 -0
- package/dist/cli/env-loader.js.map +1 -0
- package/dist/cli/paths.d.ts +22 -0
- package/dist/cli/paths.d.ts.map +1 -0
- package/dist/cli/paths.js +38 -0
- package/dist/cli/paths.js.map +1 -0
- package/dist/cli/service.d.ts +11 -0
- package/dist/cli/service.d.ts.map +1 -0
- package/dist/cli/service.js +481 -0
- package/dist/cli/service.js.map +1 -0
- package/dist/cli/setup.d.ts +16 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js +317 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/cli/skill-cmd.d.ts +12 -0
- package/dist/cli/skill-cmd.d.ts.map +1 -0
- package/dist/cli/skill-cmd.js +297 -0
- package/dist/cli/skill-cmd.js.map +1 -0
- package/dist/cli/status.d.ts +6 -0
- package/dist/cli/status.d.ts.map +1 -0
- package/dist/cli/status.js +81 -0
- package/dist/cli/status.js.map +1 -0
- package/dist/cli.d.ts +18 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +157 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/config.d.ts +16 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +64 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/paths.d.ts +58 -0
- package/dist/config/paths.d.ts.map +1 -0
- package/dist/config/paths.js +195 -0
- package/dist/config/paths.js.map +1 -0
- package/dist/config/port-defaults.d.ts +14 -0
- package/dist/config/port-defaults.d.ts.map +1 -0
- package/dist/config/port-defaults.js +31 -0
- package/dist/config/port-defaults.js.map +1 -0
- package/dist/config/types.d.ts +86 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +5 -0
- package/dist/config/types.js.map +1 -0
- package/dist/cron/index.d.ts +7 -0
- package/dist/cron/index.d.ts.map +1 -0
- package/dist/cron/index.js +6 -0
- package/dist/cron/index.js.map +1 -0
- package/dist/cron/job-executor.d.ts +14 -0
- package/dist/cron/job-executor.d.ts.map +1 -0
- package/dist/cron/job-executor.js +106 -0
- package/dist/cron/job-executor.js.map +1 -0
- package/dist/cron/scheduler.d.ts +64 -0
- package/dist/cron/scheduler.d.ts.map +1 -0
- package/dist/cron/scheduler.js +220 -0
- package/dist/cron/scheduler.js.map +1 -0
- package/dist/cron/types.d.ts +75 -0
- package/dist/cron/types.d.ts.map +1 -0
- package/dist/cron/types.js +6 -0
- package/dist/cron/types.js.map +1 -0
- package/dist/heartbeat/index.d.ts +6 -0
- package/dist/heartbeat/index.d.ts.map +1 -0
- package/dist/heartbeat/index.js +5 -0
- package/dist/heartbeat/index.js.map +1 -0
- package/dist/heartbeat/runner.d.ts +94 -0
- package/dist/heartbeat/runner.d.ts.map +1 -0
- package/dist/heartbeat/runner.js +528 -0
- package/dist/heartbeat/runner.js.map +1 -0
- package/dist/heartbeat/types.d.ts +30 -0
- package/dist/heartbeat/types.d.ts.map +1 -0
- package/dist/heartbeat/types.js +5 -0
- package/dist/heartbeat/types.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +183 -0
- package/dist/index.js.map +1 -0
- package/dist/infra/agent-events.d.ts +22 -0
- package/dist/infra/agent-events.d.ts.map +1 -0
- package/dist/infra/agent-events.js +58 -0
- package/dist/infra/agent-events.js.map +1 -0
- package/dist/infra/archive.d.ts +17 -0
- package/dist/infra/archive.d.ts.map +1 -0
- package/dist/infra/archive.js +98 -0
- package/dist/infra/archive.js.map +1 -0
- package/dist/infra/backoff.d.ts +9 -0
- package/dist/infra/backoff.d.ts.map +1 -0
- package/dist/infra/backoff.js +20 -0
- package/dist/infra/backoff.js.map +1 -0
- package/dist/infra/binaries.d.ts +4 -0
- package/dist/infra/binaries.d.ts.map +1 -0
- package/dist/infra/binaries.js +10 -0
- package/dist/infra/binaries.js.map +1 -0
- package/dist/infra/bonjour-ciao.d.ts +2 -0
- package/dist/infra/bonjour-ciao.d.ts.map +1 -0
- package/dist/infra/bonjour-ciao.js +11 -0
- package/dist/infra/bonjour-ciao.js.map +1 -0
- package/dist/infra/bonjour-discovery.d.ts +27 -0
- package/dist/infra/bonjour-discovery.d.ts.map +1 -0
- package/dist/infra/bonjour-discovery.js +450 -0
- package/dist/infra/bonjour-discovery.js.map +1 -0
- package/dist/infra/bonjour-errors.d.ts +2 -0
- package/dist/infra/bonjour-errors.d.ts.map +1 -0
- package/dist/infra/bonjour-errors.js +8 -0
- package/dist/infra/bonjour-errors.js.map +1 -0
- package/dist/infra/bonjour.d.ts +20 -0
- package/dist/infra/bonjour.d.ts.map +1 -0
- package/dist/infra/bonjour.js +211 -0
- package/dist/infra/bonjour.js.map +1 -0
- package/dist/infra/brew.d.ts +9 -0
- package/dist/infra/brew.d.ts.map +1 -0
- package/dist/infra/brew.js +56 -0
- package/dist/infra/brew.js.map +1 -0
- package/dist/infra/canvas-host-url.d.ts +12 -0
- package/dist/infra/canvas-host-url.d.ts.map +1 -0
- package/dist/infra/canvas-host-url.js +53 -0
- package/dist/infra/canvas-host-url.js.map +1 -0
- package/dist/infra/channel-activity.d.ts +19 -0
- package/dist/infra/channel-activity.d.ts.map +1 -0
- package/dist/infra/channel-activity.js +33 -0
- package/dist/infra/channel-activity.js.map +1 -0
- package/dist/infra/channel-summary.d.ts +8 -0
- package/dist/infra/channel-summary.d.ts.map +1 -0
- package/dist/infra/channel-summary.js +184 -0
- package/dist/infra/channel-summary.js.map +1 -0
- package/dist/infra/channels-status-issues.d.ts +3 -0
- package/dist/infra/channels-status-issues.d.ts.map +1 -0
- package/dist/infra/channels-status-issues.js +16 -0
- package/dist/infra/channels-status-issues.js.map +1 -0
- package/dist/infra/clipboard.d.ts +2 -0
- package/dist/infra/clipboard.d.ts.map +1 -0
- package/dist/infra/clipboard.js +25 -0
- package/dist/infra/clipboard.js.map +1 -0
- package/dist/infra/control-ui-assets.d.ts +12 -0
- package/dist/infra/control-ui-assets.d.ts.map +1 -0
- package/dist/infra/control-ui-assets.js +99 -0
- package/dist/infra/control-ui-assets.js.map +1 -0
- package/dist/infra/dedupe.d.ts +12 -0
- package/dist/infra/dedupe.d.ts.map +1 -0
- package/dist/infra/dedupe.js +48 -0
- package/dist/infra/dedupe.js.map +1 -0
- package/dist/infra/device-auth-store.d.ts +24 -0
- package/dist/infra/device-auth-store.d.ts.map +1 -0
- package/dist/infra/device-auth-store.js +98 -0
- package/dist/infra/device-auth-store.js.map +1 -0
- package/dist/infra/device-identity.d.ts +12 -0
- package/dist/infra/device-identity.d.ts.map +1 -0
- package/dist/infra/device-identity.js +150 -0
- package/dist/infra/device-identity.js.map +1 -0
- package/dist/infra/device-pairing.d.ts +97 -0
- package/dist/infra/device-pairing.d.ts.map +1 -0
- package/dist/infra/device-pairing.js +402 -0
- package/dist/infra/device-pairing.js.map +1 -0
- package/dist/infra/diagnostic-events.d.ts +122 -0
- package/dist/infra/diagnostic-events.d.ts.map +1 -0
- package/dist/infra/diagnostic-events.js +29 -0
- package/dist/infra/diagnostic-events.js.map +1 -0
- package/dist/infra/diagnostic-flags.d.ts +5 -0
- package/dist/infra/diagnostic-flags.d.ts.map +1 -0
- package/dist/infra/diagnostic-flags.js +67 -0
- package/dist/infra/diagnostic-flags.js.map +1 -0
- package/dist/infra/dotenv.d.ts +4 -0
- package/dist/infra/dotenv.d.ts.map +1 -0
- package/dist/infra/dotenv.js +16 -0
- package/dist/infra/dotenv.js.map +1 -0
- package/dist/infra/env-file.d.ts +10 -0
- package/dist/infra/env-file.d.ts.map +1 -0
- package/dist/infra/env-file.js +44 -0
- package/dist/infra/env-file.js.map +1 -0
- package/dist/infra/env.d.ts +12 -0
- package/dist/infra/env.d.ts.map +1 -0
- package/dist/infra/env.js +35 -0
- package/dist/infra/env.js.map +1 -0
- package/dist/infra/errors.d.ts +4 -0
- package/dist/infra/errors.d.ts.map +1 -0
- package/dist/infra/errors.js +36 -0
- package/dist/infra/errors.js.map +1 -0
- package/dist/infra/exec-approval-forwarder.d.ts +45 -0
- package/dist/infra/exec-approval-forwarder.d.ts.map +1 -0
- package/dist/infra/exec-approval-forwarder.js +213 -0
- package/dist/infra/exec-approval-forwarder.js.map +1 -0
- package/dist/infra/exec-approvals.d.ts +154 -0
- package/dist/infra/exec-approvals.d.ts.map +1 -0
- package/dist/infra/exec-approvals.js +1041 -0
- package/dist/infra/exec-approvals.js.map +1 -0
- package/dist/infra/exec-host.d.ts +38 -0
- package/dist/infra/exec-host.d.ts.map +1 -0
- package/dist/infra/exec-host.js +76 -0
- package/dist/infra/exec-host.js.map +1 -0
- package/dist/infra/exec-safety.d.ts +2 -0
- package/dist/infra/exec-safety.d.ts.map +1 -0
- package/dist/infra/exec-safety.js +32 -0
- package/dist/infra/exec-safety.js.map +1 -0
- package/dist/infra/fetch.d.ts +3 -0
- package/dist/infra/fetch.d.ts.map +1 -0
- package/dist/infra/fetch.js +59 -0
- package/dist/infra/fetch.js.map +1 -0
- package/dist/infra/format-duration.d.ts +11 -0
- package/dist/infra/format-duration.d.ts.map +1 -0
- package/dist/infra/format-duration.js +21 -0
- package/dist/infra/format-duration.js.map +1 -0
- package/dist/infra/fs-safe.d.ts +17 -0
- package/dist/infra/fs-safe.d.ts.map +1 -0
- package/dist/infra/fs-safe.js +77 -0
- package/dist/infra/fs-safe.js.map +1 -0
- package/dist/infra/gateway-lock.d.ts +19 -0
- package/dist/infra/gateway-lock.d.ts.map +1 -0
- package/dist/infra/gateway-lock.js +204 -0
- package/dist/infra/gateway-lock.js.map +1 -0
- package/dist/infra/git-commit.d.ts +5 -0
- package/dist/infra/git-commit.d.ts.map +1 -0
- package/dist/infra/git-commit.js +107 -0
- package/dist/infra/git-commit.js.map +1 -0
- package/dist/infra/heartbeat-events.d.ts +21 -0
- package/dist/infra/heartbeat-events.d.ts.map +1 -0
- package/dist/infra/heartbeat-events.js +35 -0
- package/dist/infra/heartbeat-events.js.map +1 -0
- package/dist/infra/heartbeat-runner.d.ts +45 -0
- package/dist/infra/heartbeat-runner.d.ts.map +1 -0
- package/dist/infra/heartbeat-runner.js +745 -0
- package/dist/infra/heartbeat-runner.js.map +1 -0
- package/dist/infra/heartbeat-visibility.d.ts +18 -0
- package/dist/infra/heartbeat-visibility.d.ts.map +1 -0
- package/dist/infra/heartbeat-visibility.js +46 -0
- package/dist/infra/heartbeat-visibility.js.map +1 -0
- package/dist/infra/heartbeat-wake.d.ts +21 -0
- package/dist/infra/heartbeat-wake.d.ts.map +1 -0
- package/dist/infra/heartbeat-wake.js +62 -0
- package/dist/infra/heartbeat-wake.js.map +1 -0
- package/dist/infra/is-main.d.ts +9 -0
- package/dist/infra/is-main.d.ts.map +1 -0
- package/dist/infra/is-main.js +34 -0
- package/dist/infra/is-main.js.map +1 -0
- package/dist/infra/json-file.d.ts +3 -0
- package/dist/infra/json-file.d.ts.map +1 -0
- package/dist/infra/json-file.js +22 -0
- package/dist/infra/json-file.js.map +1 -0
- package/dist/infra/machine-name.d.ts +2 -0
- package/dist/infra/machine-name.d.ts.map +1 -0
- package/dist/infra/machine-name.js +44 -0
- package/dist/infra/machine-name.js.map +1 -0
- package/dist/infra/node-pairing.d.ts +63 -0
- package/dist/infra/node-pairing.d.ts.map +1 -0
- package/dist/infra/node-pairing.js +229 -0
- package/dist/infra/node-pairing.js.map +1 -0
- package/dist/infra/node-shell.d.ts +2 -0
- package/dist/infra/node-shell.d.ts.map +1 -0
- package/dist/infra/node-shell.js +10 -0
- package/dist/infra/node-shell.js.map +1 -0
- package/dist/infra/openclaw-root.d.ts +6 -0
- package/dist/infra/openclaw-root.d.ts.map +1 -0
- package/dist/infra/openclaw-root.js +58 -0
- package/dist/infra/openclaw-root.js.map +1 -0
- package/dist/infra/os-summary.d.ts +8 -0
- package/dist/infra/os-summary.d.ts.map +1 -0
- package/dist/infra/os-summary.js +24 -0
- package/dist/infra/os-summary.js.map +1 -0
- package/dist/infra/path-env.d.ts +14 -0
- package/dist/infra/path-env.d.ts.map +1 -0
- package/dist/infra/path-env.js +95 -0
- package/dist/infra/path-env.js.map +1 -0
- package/dist/infra/ports-format.d.ts +6 -0
- package/dist/infra/ports-format.d.ts.map +1 -0
- package/dist/infra/ports-format.js +55 -0
- package/dist/infra/ports-format.js.map +1 -0
- package/dist/infra/ports-inspect.d.ts +3 -0
- package/dist/infra/ports-inspect.d.ts.map +1 -0
- package/dist/infra/ports-inspect.js +241 -0
- package/dist/infra/ports-inspect.js.map +1 -0
- package/dist/infra/ports-lsof.d.ts +3 -0
- package/dist/infra/ports-lsof.d.ts.map +1 -0
- package/dist/infra/ports-lsof.js +34 -0
- package/dist/infra/ports-lsof.js.map +1 -0
- package/dist/infra/ports-types.d.ts +18 -0
- package/dist/infra/ports-types.d.ts.map +1 -0
- package/dist/infra/ports-types.js +2 -0
- package/dist/infra/ports-types.js.map +1 -0
- package/dist/infra/ports.d.ts +15 -0
- package/dist/infra/ports.d.ts.map +1 -0
- package/dist/infra/ports.js +76 -0
- package/dist/infra/ports.js.map +1 -0
- package/dist/infra/provider-usage.auth.d.ts +12 -0
- package/dist/infra/provider-usage.auth.d.ts.map +1 -0
- package/dist/infra/provider-usage.auth.js +222 -0
- package/dist/infra/provider-usage.auth.js.map +1 -0
- package/dist/infra/provider-usage.d.ts +5 -0
- package/dist/infra/provider-usage.d.ts.map +1 -0
- package/dist/infra/provider-usage.fetch.antigravity.d.ts +3 -0
- package/dist/infra/provider-usage.fetch.antigravity.d.ts.map +1 -0
- package/dist/infra/provider-usage.fetch.antigravity.js +213 -0
- package/dist/infra/provider-usage.fetch.antigravity.js.map +1 -0
- package/dist/infra/provider-usage.fetch.claude.d.ts +3 -0
- package/dist/infra/provider-usage.fetch.claude.d.ts.map +1 -0
- package/dist/infra/provider-usage.fetch.claude.js +130 -0
- package/dist/infra/provider-usage.fetch.claude.js.map +1 -0
- package/dist/infra/provider-usage.fetch.codex.d.ts +3 -0
- package/dist/infra/provider-usage.fetch.codex.d.ts.map +1 -0
- package/dist/infra/provider-usage.fetch.codex.js +63 -0
- package/dist/infra/provider-usage.fetch.codex.js.map +1 -0
- package/dist/infra/provider-usage.fetch.copilot.d.ts +3 -0
- package/dist/infra/provider-usage.fetch.copilot.d.ts.map +1 -0
- package/dist/infra/provider-usage.fetch.copilot.js +43 -0
- package/dist/infra/provider-usage.fetch.copilot.js.map +1 -0
- package/dist/infra/provider-usage.fetch.d.ts +8 -0
- package/dist/infra/provider-usage.fetch.d.ts.map +1 -0
- package/dist/infra/provider-usage.fetch.gemini.d.ts +3 -0
- package/dist/infra/provider-usage.fetch.gemini.d.ts.map +1 -0
- package/dist/infra/provider-usage.fetch.gemini.js +58 -0
- package/dist/infra/provider-usage.fetch.gemini.js.map +1 -0
- package/dist/infra/provider-usage.fetch.js +8 -0
- package/dist/infra/provider-usage.fetch.js.map +1 -0
- package/dist/infra/provider-usage.fetch.minimax.d.ts +3 -0
- package/dist/infra/provider-usage.fetch.minimax.d.ts.map +1 -0
- package/dist/infra/provider-usage.fetch.minimax.js +333 -0
- package/dist/infra/provider-usage.fetch.minimax.js.map +1 -0
- package/dist/infra/provider-usage.fetch.shared.d.ts +2 -0
- package/dist/infra/provider-usage.fetch.shared.d.ts.map +1 -0
- package/dist/infra/provider-usage.fetch.shared.js +11 -0
- package/dist/infra/provider-usage.fetch.shared.js.map +1 -0
- package/dist/infra/provider-usage.fetch.zai.d.ts +3 -0
- package/dist/infra/provider-usage.fetch.zai.d.ts.map +1 -0
- package/dist/infra/provider-usage.fetch.zai.js +63 -0
- package/dist/infra/provider-usage.fetch.zai.js.map +1 -0
- package/dist/infra/provider-usage.format.d.ts +14 -0
- package/dist/infra/provider-usage.format.d.ts.map +1 -0
- package/dist/infra/provider-usage.format.js +97 -0
- package/dist/infra/provider-usage.format.js.map +1 -0
- package/dist/infra/provider-usage.js +4 -0
- package/dist/infra/provider-usage.js.map +1 -0
- package/dist/infra/provider-usage.load.d.ts +13 -0
- package/dist/infra/provider-usage.load.d.ts.map +1 -0
- package/dist/infra/provider-usage.load.js +66 -0
- package/dist/infra/provider-usage.load.js.map +1 -0
- package/dist/infra/provider-usage.shared.d.ts +9 -0
- package/dist/infra/provider-usage.shared.d.ts.map +1 -0
- package/dist/infra/provider-usage.shared.js +54 -0
- package/dist/infra/provider-usage.shared.js.map +1 -0
- package/dist/infra/provider-usage.types.d.ts +18 -0
- package/dist/infra/provider-usage.types.d.ts.map +1 -0
- package/dist/infra/provider-usage.types.js +2 -0
- package/dist/infra/provider-usage.types.js.map +1 -0
- package/dist/infra/restart-sentinel.d.ts +51 -0
- package/dist/infra/restart-sentinel.d.ts.map +1 -0
- package/dist/infra/restart-sentinel.js +66 -0
- package/dist/infra/restart-sentinel.js.map +1 -0
- package/dist/infra/restart.d.ts +29 -0
- package/dist/infra/restart.d.ts.map +1 -0
- package/dist/infra/restart.js +172 -0
- package/dist/infra/restart.js.map +1 -0
- package/dist/infra/retry-policy.d.ts +26 -0
- package/dist/infra/retry-policy.d.ts.map +1 -0
- package/dist/infra/retry-policy.js +72 -0
- package/dist/infra/retry-policy.js.map +1 -0
- package/dist/infra/retry.d.ts +22 -0
- package/dist/infra/retry.d.ts.map +1 -0
- package/dist/infra/retry.js +86 -0
- package/dist/infra/retry.js.map +1 -0
- package/dist/infra/runtime-guard.d.ts +21 -0
- package/dist/infra/runtime-guard.d.ts.map +1 -0
- package/dist/infra/runtime-guard.js +61 -0
- package/dist/infra/runtime-guard.js.map +1 -0
- package/dist/infra/session-cost-usage.d.ts +37 -0
- package/dist/infra/session-cost-usage.d.ts.map +1 -0
- package/dist/infra/session-cost-usage.js +191 -0
- package/dist/infra/session-cost-usage.js.map +1 -0
- package/dist/infra/shell-env.d.ts +34 -0
- package/dist/infra/shell-env.d.ts.map +1 -0
- package/dist/infra/shell-env.js +126 -0
- package/dist/infra/shell-env.js.map +1 -0
- package/dist/infra/skills-remote.d.ts +25 -0
- package/dist/infra/skills-remote.d.ts.map +1 -0
- package/dist/infra/skills-remote.js +283 -0
- package/dist/infra/skills-remote.js.map +1 -0
- package/dist/infra/ssh-config.d.ts +13 -0
- package/dist/infra/ssh-config.d.ts.map +1 -0
- package/dist/infra/ssh-config.js +85 -0
- package/dist/infra/ssh-config.js.map +1 -0
- package/dist/infra/ssh-tunnel.d.ts +22 -0
- package/dist/infra/ssh-tunnel.d.ts.map +1 -0
- package/dist/infra/ssh-tunnel.js +174 -0
- package/dist/infra/ssh-tunnel.js.map +1 -0
- package/dist/infra/state-migrations.d.ts +88 -0
- package/dist/infra/state-migrations.d.ts.map +1 -0
- package/dist/infra/state-migrations.fs.d.ts +15 -0
- package/dist/infra/state-migrations.fs.d.ts.map +1 -0
- package/dist/infra/state-migrations.fs.js +50 -0
- package/dist/infra/state-migrations.fs.js.map +1 -0
- package/dist/infra/state-migrations.js +658 -0
- package/dist/infra/state-migrations.js.map +1 -0
- package/dist/infra/system-events.d.ts +17 -0
- package/dist/infra/system-events.d.ts.map +1 -0
- package/dist/infra/system-events.js +76 -0
- package/dist/infra/system-events.js.map +1 -0
- package/dist/infra/system-presence.d.ts +46 -0
- package/dist/infra/system-presence.d.ts.map +1 -0
- package/dist/infra/system-presence.js +232 -0
- package/dist/infra/system-presence.js.map +1 -0
- package/dist/infra/tailnet.d.ts +8 -0
- package/dist/infra/tailnet.d.ts.map +1 -0
- package/dist/infra/tailnet.js +47 -0
- package/dist/infra/tailnet.js.map +1 -0
- package/dist/infra/tailscale.d.ts +35 -0
- package/dist/infra/tailscale.d.ts.map +1 -0
- package/dist/infra/tailscale.js +369 -0
- package/dist/infra/tailscale.js.map +1 -0
- package/dist/infra/transport-ready.d.ts +17 -0
- package/dist/infra/transport-ready.d.ts.map +1 -0
- package/dist/infra/transport-ready.js +39 -0
- package/dist/infra/transport-ready.js.map +1 -0
- package/dist/infra/unhandled-rejections.d.ts +16 -0
- package/dist/infra/unhandled-rejections.d.ts.map +1 -0
- package/dist/infra/unhandled-rejections.js +140 -0
- package/dist/infra/unhandled-rejections.js.map +1 -0
- package/dist/infra/update-channels.d.ts +27 -0
- package/dist/infra/update-channels.d.ts.map +1 -0
- package/dist/infra/update-channels.js +58 -0
- package/dist/infra/update-channels.js.map +1 -0
- package/dist/infra/update-check.d.ts +69 -0
- package/dist/infra/update-check.d.ts.map +1 -0
- package/dist/infra/update-check.js +294 -0
- package/dist/infra/update-check.js.map +1 -0
- package/dist/infra/update-global.d.ts +16 -0
- package/dist/infra/update-global.d.ts.map +1 -0
- package/dist/infra/update-global.js +96 -0
- package/dist/infra/update-global.js.map +1 -0
- package/dist/infra/update-runner.d.ts +59 -0
- package/dist/infra/update-runner.d.ts.map +1 -0
- package/dist/infra/update-runner.js +578 -0
- package/dist/infra/update-runner.js.map +1 -0
- package/dist/infra/update-startup.d.ts +17 -0
- package/dist/infra/update-startup.d.ts.map +1 -0
- package/dist/infra/update-startup.js +87 -0
- package/dist/infra/update-startup.js.map +1 -0
- package/dist/infra/voicewake.d.ts +8 -0
- package/dist/infra/voicewake.d.ts.map +1 -0
- package/dist/infra/voicewake.js +75 -0
- package/dist/infra/voicewake.js.map +1 -0
- package/dist/infra/warnings.d.ts +2 -0
- package/dist/infra/warnings.d.ts.map +1 -0
- package/dist/infra/warnings.js +26 -0
- package/dist/infra/warnings.js.map +1 -0
- package/dist/infra/widearea-dns.d.ts +28 -0
- package/dist/infra/widearea-dns.d.ts.map +1 -0
- package/dist/infra/widearea-dns.js +149 -0
- package/dist/infra/widearea-dns.js.map +1 -0
- package/dist/infra/ws.d.ts +3 -0
- package/dist/infra/ws.d.ts.map +1 -0
- package/dist/infra/ws.js +14 -0
- package/dist/infra/ws.js.map +1 -0
- package/dist/infra/wsl.d.ts +3 -0
- package/dist/infra/wsl.d.ts.map +1 -0
- package/dist/infra/wsl.js +26 -0
- package/dist/infra/wsl.js.map +1 -0
- package/dist/logging/config.d.ts +5 -0
- package/dist/logging/config.d.ts.map +1 -0
- package/dist/logging/config.js +20 -0
- package/dist/logging/config.js.map +1 -0
- package/dist/logging/console.d.ts +20 -0
- package/dist/logging/console.d.ts.map +1 -0
- package/dist/logging/console.js +238 -0
- package/dist/logging/console.js.map +1 -0
- package/dist/logging/diagnostic.d.ts +59 -0
- package/dist/logging/diagnostic.d.ts.map +1 -0
- package/dist/logging/diagnostic.js +237 -0
- package/dist/logging/diagnostic.js.map +1 -0
- package/dist/logging/levels.d.ts +5 -0
- package/dist/logging/levels.d.ts.map +1 -0
- package/dist/logging/levels.js +27 -0
- package/dist/logging/levels.js.map +1 -0
- package/dist/logging/logger.d.ts +43 -0
- package/dist/logging/logger.d.ts.map +1 -0
- package/dist/logging/logger.js +186 -0
- package/dist/logging/logger.js.map +1 -0
- package/dist/logging/parse-log-line.d.ts +10 -0
- package/dist/logging/parse-log-line.d.ts.map +1 -0
- package/dist/logging/parse-log-line.js +53 -0
- package/dist/logging/parse-log-line.js.map +1 -0
- package/dist/logging/redact.d.ts +10 -0
- package/dist/logging/redact.d.ts.map +1 -0
- package/dist/logging/redact.js +116 -0
- package/dist/logging/redact.js.map +1 -0
- package/dist/logging/state.d.ts +18 -0
- package/dist/logging/state.d.ts.map +1 -0
- package/dist/logging/state.js +13 -0
- package/dist/logging/state.js.map +1 -0
- package/dist/logging/subsystem.d.ts +17 -0
- package/dist/logging/subsystem.d.ts.map +1 -0
- package/dist/logging/subsystem.js +235 -0
- package/dist/logging/subsystem.js.map +1 -0
- package/dist/media/audio-tags.d.ts +11 -0
- package/dist/media/audio-tags.d.ts.map +1 -0
- package/dist/media/audio-tags.js +15 -0
- package/dist/media/audio-tags.js.map +1 -0
- package/dist/media/audio.d.ts +5 -0
- package/dist/media/audio.d.ts.map +1 -0
- package/dist/media/audio.js +16 -0
- package/dist/media/audio.js.map +1 -0
- package/dist/media/constants.d.ts +8 -0
- package/dist/media/constants.d.ts.map +1 -0
- package/dist/media/constants.js +34 -0
- package/dist/media/constants.js.map +1 -0
- package/dist/media/fetch.d.ts +20 -0
- package/dist/media/fetch.d.ts.map +1 -0
- package/dist/media/fetch.js +152 -0
- package/dist/media/fetch.js.map +1 -0
- package/dist/media/host.d.ts +12 -0
- package/dist/media/host.d.ts.map +1 -0
- package/dist/media/host.js +44 -0
- package/dist/media/host.js.map +1 -0
- package/dist/media/image-ops.d.ts +40 -0
- package/dist/media/image-ops.d.ts.map +1 -0
- package/dist/media/image-ops.js +386 -0
- package/dist/media/image-ops.js.map +1 -0
- package/dist/media/input-files.d.ts +77 -0
- package/dist/media/input-files.d.ts.map +1 -0
- package/dist/media/input-files.js +277 -0
- package/dist/media/input-files.js.map +1 -0
- package/dist/media/mime.d.ts +16 -0
- package/dist/media/mime.d.ts.map +1 -0
- package/dist/media/mime.js +151 -0
- package/dist/media/mime.js.map +1 -0
- package/dist/media/parse.d.ts +9 -0
- package/dist/media/parse.d.ts.map +1 -0
- package/dist/media/parse.js +176 -0
- package/dist/media/parse.js.map +1 -0
- package/dist/media/server.d.ts +6 -0
- package/dist/media/server.d.ts.map +1 -0
- package/dist/media/server.js +89 -0
- package/dist/media/server.js.map +1 -0
- package/dist/media/store.d.ts +19 -0
- package/dist/media/store.d.ts.map +1 -0
- package/dist/media/store.js +201 -0
- package/dist/media/store.js.map +1 -0
- package/dist/process/exec.d.ts +23 -0
- package/dist/process/exec.d.ts.map +1 -0
- package/dist/process/exec.js +99 -0
- package/dist/process/exec.js.map +1 -0
- package/dist/schema/typebox.d.ts +40 -0
- package/dist/schema/typebox.d.ts.map +1 -0
- package/dist/schema/typebox.js +796 -0
- package/dist/schema/typebox.js.map +1 -0
- package/dist/server.d.ts +52 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +322 -0
- package/dist/server.js.map +1 -0
- package/dist/services/supabase.d.ts +67 -0
- package/dist/services/supabase.d.ts.map +1 -0
- package/dist/services/supabase.js +106 -0
- package/dist/services/supabase.js.map +1 -0
- package/dist/skills/index.d.ts +24 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +26 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/loader.d.ts +29 -0
- package/dist/skills/loader.d.ts.map +1 -0
- package/dist/skills/loader.js +176 -0
- package/dist/skills/loader.js.map +1 -0
- package/dist/skills/manager.d.ts +85 -0
- package/dist/skills/manager.d.ts.map +1 -0
- package/dist/skills/manager.js +179 -0
- package/dist/skills/manager.js.map +1 -0
- package/dist/skills/status.d.ts +26 -0
- package/dist/skills/status.d.ts.map +1 -0
- package/dist/skills/status.js +238 -0
- package/dist/skills/status.js.map +1 -0
- package/dist/skills/types.d.ts +182 -0
- package/dist/skills/types.d.ts.map +1 -0
- package/dist/skills/types.js +9 -0
- package/dist/skills/types.js.map +1 -0
- package/dist/supabase/client.d.ts +18 -0
- package/dist/supabase/client.d.ts.map +1 -0
- package/dist/supabase/client.js +43 -0
- package/dist/supabase/client.js.map +1 -0
- package/dist/supabase/context.d.ts +25 -0
- package/dist/supabase/context.d.ts.map +1 -0
- package/dist/supabase/context.js +109 -0
- package/dist/supabase/context.js.map +1 -0
- package/dist/supabase/cron-jobs.d.ts +79 -0
- package/dist/supabase/cron-jobs.d.ts.map +1 -0
- package/dist/supabase/cron-jobs.js +396 -0
- package/dist/supabase/cron-jobs.js.map +1 -0
- package/dist/supabase/heartbeat-items.d.ts +50 -0
- package/dist/supabase/heartbeat-items.d.ts.map +1 -0
- package/dist/supabase/heartbeat-items.js +179 -0
- package/dist/supabase/heartbeat-items.js.map +1 -0
- package/dist/supabase/index.d.ts +13 -0
- package/dist/supabase/index.d.ts.map +1 -0
- package/dist/supabase/index.js +12 -0
- package/dist/supabase/index.js.map +1 -0
- package/dist/supabase/memory.d.ts +49 -0
- package/dist/supabase/memory.d.ts.map +1 -0
- package/dist/supabase/memory.js +157 -0
- package/dist/supabase/memory.js.map +1 -0
- package/dist/supabase/notifications.d.ts +35 -0
- package/dist/supabase/notifications.d.ts.map +1 -0
- package/dist/supabase/notifications.js +46 -0
- package/dist/supabase/notifications.js.map +1 -0
- package/dist/supabase/requests.d.ts +69 -0
- package/dist/supabase/requests.d.ts.map +1 -0
- package/dist/supabase/requests.js +246 -0
- package/dist/supabase/requests.js.map +1 -0
- package/dist/supabase/types.d.ts +65 -0
- package/dist/supabase/types.d.ts.map +1 -0
- package/dist/supabase/types.js +5 -0
- package/dist/supabase/types.js.map +1 -0
- package/dist/supabase/workspace-storage.d.ts +54 -0
- package/dist/supabase/workspace-storage.d.ts.map +1 -0
- package/dist/supabase/workspace-storage.js +217 -0
- package/dist/supabase/workspace-storage.js.map +1 -0
- package/dist/tools/bash-tools.shared.d.ts +26 -0
- package/dist/tools/bash-tools.shared.d.ts.map +1 -0
- package/dist/tools/bash-tools.shared.js +135 -0
- package/dist/tools/bash-tools.shared.js.map +1 -0
- package/dist/tools/browser-new.d.ts +7 -0
- package/dist/tools/browser-new.d.ts.map +1 -0
- package/dist/tools/browser-new.js +329 -0
- package/dist/tools/browser-new.js.map +1 -0
- package/dist/tools/browser-openclaw.d.ts +6 -0
- package/dist/tools/browser-openclaw.d.ts.map +1 -0
- package/dist/tools/browser-openclaw.js +597 -0
- package/dist/tools/browser-openclaw.js.map +1 -0
- package/dist/tools/browser-tool.schema.d.ts +51 -0
- package/dist/tools/browser-tool.schema.d.ts.map +1 -0
- package/dist/tools/browser-tool.schema.js +106 -0
- package/dist/tools/browser-tool.schema.js.map +1 -0
- package/dist/tools/browser.d.ts +9 -0
- package/dist/tools/browser.d.ts.map +1 -0
- package/dist/tools/browser.js +1629 -0
- package/dist/tools/browser.js.map +1 -0
- package/dist/tools/built-in-tools.d.ts +27 -0
- package/dist/tools/built-in-tools.d.ts.map +1 -0
- package/dist/tools/built-in-tools.js +86 -0
- package/dist/tools/built-in-tools.js.map +1 -0
- package/dist/tools/calendar.d.ts +16 -0
- package/dist/tools/calendar.d.ts.map +1 -0
- package/dist/tools/calendar.js +244 -0
- package/dist/tools/calendar.js.map +1 -0
- package/dist/tools/cron.d.ts +22 -0
- package/dist/tools/cron.d.ts.map +1 -0
- package/dist/tools/cron.js +273 -0
- package/dist/tools/cron.js.map +1 -0
- package/dist/tools/email.d.ts +16 -0
- package/dist/tools/email.d.ts.map +1 -0
- package/dist/tools/email.js +435 -0
- package/dist/tools/email.js.map +1 -0
- package/dist/tools/exec.d.ts +40 -0
- package/dist/tools/exec.d.ts.map +1 -0
- package/dist/tools/exec.js +446 -0
- package/dist/tools/exec.js.map +1 -0
- package/dist/tools/fetch-api-data.d.ts +9 -0
- package/dist/tools/fetch-api-data.d.ts.map +1 -0
- package/dist/tools/fetch-api-data.js +120 -0
- package/dist/tools/fetch-api-data.js.map +1 -0
- package/dist/tools/file-ops.d.ts +14 -0
- package/dist/tools/file-ops.d.ts.map +1 -0
- package/dist/tools/file-ops.js +19 -0
- package/dist/tools/file-ops.js.map +1 -0
- package/dist/tools/generate-image.d.ts +8 -0
- package/dist/tools/generate-image.d.ts.map +1 -0
- package/dist/tools/generate-image.js +99 -0
- package/dist/tools/generate-image.js.map +1 -0
- package/dist/tools/generate-video.d.ts +9 -0
- package/dist/tools/generate-video.d.ts.map +1 -0
- package/dist/tools/generate-video.js +178 -0
- package/dist/tools/generate-video.js.map +1 -0
- package/dist/tools/google-maps.d.ts +11 -0
- package/dist/tools/google-maps.d.ts.map +1 -0
- package/dist/tools/google-maps.js +285 -0
- package/dist/tools/google-maps.js.map +1 -0
- package/dist/tools/image.d.ts +9 -0
- package/dist/tools/image.d.ts.map +1 -0
- package/dist/tools/image.js +124 -0
- package/dist/tools/image.js.map +1 -0
- package/dist/tools/index.d.ts +40 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +104 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/memory.d.ts +16 -0
- package/dist/tools/memory.d.ts.map +1 -0
- package/dist/tools/memory.js +118 -0
- package/dist/tools/memory.js.map +1 -0
- package/dist/tools/message.d.ts +8 -0
- package/dist/tools/message.d.ts.map +1 -0
- package/dist/tools/message.js +60 -0
- package/dist/tools/message.js.map +1 -0
- package/dist/tools/process-registry.d.ts +73 -0
- package/dist/tools/process-registry.d.ts.map +1 -0
- package/dist/tools/process-registry.js +185 -0
- package/dist/tools/process-registry.js.map +1 -0
- package/dist/tools/process.d.ts +24 -0
- package/dist/tools/process.d.ts.map +1 -0
- package/dist/tools/process.js +586 -0
- package/dist/tools/process.js.map +1 -0
- package/dist/tools/pty-dsr.d.ts +12 -0
- package/dist/tools/pty-dsr.d.ts.map +1 -0
- package/dist/tools/pty-dsr.js +20 -0
- package/dist/tools/pty-dsr.js.map +1 -0
- package/dist/tools/pty-keys.d.ts +20 -0
- package/dist/tools/pty-keys.d.ts.map +1 -0
- package/dist/tools/pty-keys.js +242 -0
- package/dist/tools/pty-keys.js.map +1 -0
- package/dist/tools/session-slug.d.ts +8 -0
- package/dist/tools/session-slug.d.ts.map +1 -0
- package/dist/tools/session-slug.js +136 -0
- package/dist/tools/session-slug.js.map +1 -0
- package/dist/tools/session-status.d.ts +7 -0
- package/dist/tools/session-status.d.ts.map +1 -0
- package/dist/tools/session-status.js +55 -0
- package/dist/tools/session-status.js.map +1 -0
- package/dist/tools/shell-utils.d.ts +13 -0
- package/dist/tools/shell-utils.d.ts.map +1 -0
- package/dist/tools/shell-utils.js +106 -0
- package/dist/tools/shell-utils.js.map +1 -0
- package/dist/tools/tts.d.ts +9 -0
- package/dist/tools/tts.d.ts.map +1 -0
- package/dist/tools/tts.js +102 -0
- package/dist/tools/tts.js.map +1 -0
- package/dist/tools/web-fetch.d.ts +9 -0
- package/dist/tools/web-fetch.d.ts.map +1 -0
- package/dist/tools/web-fetch.js +129 -0
- package/dist/tools/web-fetch.js.map +1 -0
- package/dist/tools/web-search.d.ts +15 -0
- package/dist/tools/web-search.d.ts.map +1 -0
- package/dist/tools/web-search.js +119 -0
- package/dist/tools/web-search.js.map +1 -0
- package/dist/types/tool.d.ts +31 -0
- package/dist/types/tool.d.ts.map +1 -0
- package/dist/types/tool.js +5 -0
- package/dist/types/tool.js.map +1 -0
- package/dist/updates/checker.d.ts +51 -0
- package/dist/updates/checker.d.ts.map +1 -0
- package/dist/updates/checker.js +237 -0
- package/dist/updates/checker.js.map +1 -0
- package/dist/updates/index.d.ts +6 -0
- package/dist/updates/index.d.ts.map +1 -0
- package/dist/updates/index.js +6 -0
- package/dist/updates/index.js.map +1 -0
- package/dist/updates/notifier.d.ts +17 -0
- package/dist/updates/notifier.d.ts.map +1 -0
- package/dist/updates/notifier.js +44 -0
- package/dist/updates/notifier.js.map +1 -0
- package/dist/utils/google-oauth.d.ts +58 -0
- package/dist/utils/google-oauth.d.ts.map +1 -0
- package/dist/utils/google-oauth.js +161 -0
- package/dist/utils/google-oauth.js.map +1 -0
- package/dist/utils/log-buffer.d.ts +35 -0
- package/dist/utils/log-buffer.d.ts.map +1 -0
- package/dist/utils/log-buffer.js +100 -0
- package/dist/utils/log-buffer.js.map +1 -0
- package/dist/utils/tool-helpers.d.ts +48 -0
- package/dist/utils/tool-helpers.d.ts.map +1 -0
- package/dist/utils/tool-helpers.js +125 -0
- package/dist/utils/tool-helpers.js.map +1 -0
- package/dist/utils/utils.d.ts +44 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/utils/utils.js +257 -0
- package/dist/utils/utils.js.map +1 -0
- package/dist/web-server.d.ts +30 -0
- package/dist/web-server.d.ts.map +1 -0
- package/dist/web-server.js +367 -0
- package/dist/web-server.js.map +1 -0
- package/dist/workspace/context.d.ts +23 -0
- package/dist/workspace/context.d.ts.map +1 -0
- package/dist/workspace/context.js +88 -0
- package/dist/workspace/context.js.map +1 -0
- package/dist/workspace/generator.d.ts +47 -0
- package/dist/workspace/generator.d.ts.map +1 -0
- package/dist/workspace/generator.js +261 -0
- package/dist/workspace/generator.js.map +1 -0
- package/dist/workspace/index.d.ts +9 -0
- package/dist/workspace/index.d.ts.map +1 -0
- package/dist/workspace/index.js +9 -0
- package/dist/workspace/index.js.map +1 -0
- package/dist/workspace/templates.d.ts +36 -0
- package/dist/workspace/templates.d.ts.map +1 -0
- package/dist/workspace/templates.js +280 -0
- package/dist/workspace/templates.js.map +1 -0
- package/dist/workspace/workspace.d.ts +79 -0
- package/dist/workspace/workspace.d.ts.map +1 -0
- package/dist/workspace/workspace.js +234 -0
- package/dist/workspace/workspace.js.map +1 -0
- package/package.json +98 -0
- package/public/index.html +1625 -0
- package/scripts/install.sh +311 -0
- package/scripts/postinstall.js +135 -0
- package/skills/commit/SKILL.md +69 -0
- package/skills/review-pr/SKILL.md +105 -0
- package/skills/skill-creator/SKILL.md +236 -0
- package/skills/test/SKILL.md +57 -0
|
@@ -0,0 +1,658 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { resolveDefaultAgentId } from "../agents/agent-scope.js";
|
|
5
|
+
import { resolveLegacyStateDirs, resolveNewStateDir, resolveOAuthDir, resolveStateDir, } from "../config/paths.js";
|
|
6
|
+
import { saveSessionStore } from "../config/sessions.js";
|
|
7
|
+
import { createSubsystemLogger } from "../logging/subsystem.js";
|
|
8
|
+
import { buildAgentMainSessionKey, DEFAULT_ACCOUNT_ID, DEFAULT_MAIN_KEY, normalizeAgentId, } from "../routing/session-key.js";
|
|
9
|
+
import { canonicalizeMainSessionAlias } from "../config/sessions/main-session.js";
|
|
10
|
+
import { ensureDir, existsDir, fileExists, isLegacyWhatsAppAuthFile, readSessionStoreJson5, safeReadDir, } from "./state-migrations.fs.js";
|
|
11
|
+
let autoMigrateChecked = false;
|
|
12
|
+
let autoMigrateStateDirChecked = false;
|
|
13
|
+
function isSurfaceGroupKey(key) {
|
|
14
|
+
return key.includes(":group:") || key.includes(":channel:");
|
|
15
|
+
}
|
|
16
|
+
function isLegacyGroupKey(key) {
|
|
17
|
+
const trimmed = key.trim();
|
|
18
|
+
if (!trimmed)
|
|
19
|
+
return false;
|
|
20
|
+
if (trimmed.startsWith("group:"))
|
|
21
|
+
return true;
|
|
22
|
+
const lower = trimmed.toLowerCase();
|
|
23
|
+
if (!lower.includes("@g.us"))
|
|
24
|
+
return false;
|
|
25
|
+
// Legacy WhatsApp group keys: bare JID or "whatsapp:<jid>" without explicit ":group:" kind.
|
|
26
|
+
if (!trimmed.includes(":"))
|
|
27
|
+
return true;
|
|
28
|
+
if (lower.startsWith("whatsapp:") && !trimmed.includes(":group:"))
|
|
29
|
+
return true;
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
function canonicalizeSessionKeyForAgent(params) {
|
|
33
|
+
const agentId = normalizeAgentId(params.agentId);
|
|
34
|
+
const raw = params.key.trim();
|
|
35
|
+
if (!raw)
|
|
36
|
+
return raw;
|
|
37
|
+
if (raw.toLowerCase() === "global" || raw.toLowerCase() === "unknown")
|
|
38
|
+
return raw.toLowerCase();
|
|
39
|
+
const canonicalMain = canonicalizeMainSessionAlias({
|
|
40
|
+
cfg: { session: { scope: params.scope, mainKey: params.mainKey } },
|
|
41
|
+
agentId,
|
|
42
|
+
sessionKey: raw,
|
|
43
|
+
});
|
|
44
|
+
if (canonicalMain !== raw)
|
|
45
|
+
return canonicalMain.toLowerCase();
|
|
46
|
+
if (raw.toLowerCase().startsWith("agent:"))
|
|
47
|
+
return raw.toLowerCase();
|
|
48
|
+
if (raw.toLowerCase().startsWith("subagent:")) {
|
|
49
|
+
const rest = raw.slice("subagent:".length);
|
|
50
|
+
return `agent:${agentId}:subagent:${rest}`.toLowerCase();
|
|
51
|
+
}
|
|
52
|
+
if (raw.startsWith("group:")) {
|
|
53
|
+
const id = raw.slice("group:".length).trim();
|
|
54
|
+
if (!id)
|
|
55
|
+
return raw;
|
|
56
|
+
const channel = id.toLowerCase().includes("@g.us") ? "whatsapp" : "unknown";
|
|
57
|
+
return `agent:${agentId}:${channel}:group:${id}`.toLowerCase();
|
|
58
|
+
}
|
|
59
|
+
if (!raw.includes(":") && raw.toLowerCase().includes("@g.us")) {
|
|
60
|
+
return `agent:${agentId}:whatsapp:group:${raw}`.toLowerCase();
|
|
61
|
+
}
|
|
62
|
+
if (raw.toLowerCase().startsWith("whatsapp:") && raw.toLowerCase().includes("@g.us")) {
|
|
63
|
+
const remainder = raw.slice("whatsapp:".length).trim();
|
|
64
|
+
const cleaned = remainder.replace(/^group:/i, "").trim();
|
|
65
|
+
if (cleaned && !isSurfaceGroupKey(raw)) {
|
|
66
|
+
return `agent:${agentId}:whatsapp:group:${cleaned}`.toLowerCase();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (isSurfaceGroupKey(raw)) {
|
|
70
|
+
return `agent:${agentId}:${raw}`.toLowerCase();
|
|
71
|
+
}
|
|
72
|
+
return `agent:${agentId}:${raw}`.toLowerCase();
|
|
73
|
+
}
|
|
74
|
+
function pickLatestLegacyDirectEntry(store) {
|
|
75
|
+
let best = null;
|
|
76
|
+
let bestUpdated = -1;
|
|
77
|
+
for (const [key, entry] of Object.entries(store)) {
|
|
78
|
+
if (!entry || typeof entry !== "object")
|
|
79
|
+
continue;
|
|
80
|
+
const normalized = key.trim();
|
|
81
|
+
if (!normalized)
|
|
82
|
+
continue;
|
|
83
|
+
if (normalized === "global")
|
|
84
|
+
continue;
|
|
85
|
+
if (normalized.startsWith("agent:"))
|
|
86
|
+
continue;
|
|
87
|
+
if (normalized.toLowerCase().startsWith("subagent:"))
|
|
88
|
+
continue;
|
|
89
|
+
if (isLegacyGroupKey(normalized) || isSurfaceGroupKey(normalized))
|
|
90
|
+
continue;
|
|
91
|
+
const updatedAt = typeof entry.updatedAt === "number" ? entry.updatedAt : 0;
|
|
92
|
+
if (updatedAt > bestUpdated) {
|
|
93
|
+
bestUpdated = updatedAt;
|
|
94
|
+
best = entry;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return best;
|
|
98
|
+
}
|
|
99
|
+
function normalizeSessionEntry(entry) {
|
|
100
|
+
const sessionId = typeof entry.sessionId === "string" ? entry.sessionId : null;
|
|
101
|
+
if (!sessionId)
|
|
102
|
+
return null;
|
|
103
|
+
const updatedAt = typeof entry.updatedAt === "number" && Number.isFinite(entry.updatedAt)
|
|
104
|
+
? entry.updatedAt
|
|
105
|
+
: Date.now();
|
|
106
|
+
const normalized = { ...entry, sessionId, updatedAt };
|
|
107
|
+
const rec = normalized;
|
|
108
|
+
if (typeof rec.groupChannel !== "string" && typeof rec.room === "string") {
|
|
109
|
+
rec.groupChannel = rec.room;
|
|
110
|
+
}
|
|
111
|
+
delete rec.room;
|
|
112
|
+
return normalized;
|
|
113
|
+
}
|
|
114
|
+
function resolveUpdatedAt(entry) {
|
|
115
|
+
return typeof entry.updatedAt === "number" && Number.isFinite(entry.updatedAt)
|
|
116
|
+
? entry.updatedAt
|
|
117
|
+
: 0;
|
|
118
|
+
}
|
|
119
|
+
function mergeSessionEntry(params) {
|
|
120
|
+
if (!params.existing)
|
|
121
|
+
return params.incoming;
|
|
122
|
+
const existingUpdated = resolveUpdatedAt(params.existing);
|
|
123
|
+
const incomingUpdated = resolveUpdatedAt(params.incoming);
|
|
124
|
+
if (incomingUpdated > existingUpdated)
|
|
125
|
+
return params.incoming;
|
|
126
|
+
if (incomingUpdated < existingUpdated)
|
|
127
|
+
return params.existing;
|
|
128
|
+
return params.preferIncomingOnTie ? params.incoming : params.existing;
|
|
129
|
+
}
|
|
130
|
+
function canonicalizeSessionStore(params) {
|
|
131
|
+
const canonical = {};
|
|
132
|
+
const meta = new Map();
|
|
133
|
+
const legacyKeys = [];
|
|
134
|
+
for (const [key, entry] of Object.entries(params.store)) {
|
|
135
|
+
if (!entry || typeof entry !== "object")
|
|
136
|
+
continue;
|
|
137
|
+
const canonicalKey = canonicalizeSessionKeyForAgent({
|
|
138
|
+
key,
|
|
139
|
+
agentId: params.agentId,
|
|
140
|
+
mainKey: params.mainKey,
|
|
141
|
+
scope: params.scope,
|
|
142
|
+
});
|
|
143
|
+
const isCanonical = canonicalKey === key;
|
|
144
|
+
if (!isCanonical)
|
|
145
|
+
legacyKeys.push(key);
|
|
146
|
+
const existing = canonical[canonicalKey];
|
|
147
|
+
if (!existing) {
|
|
148
|
+
canonical[canonicalKey] = entry;
|
|
149
|
+
meta.set(canonicalKey, { isCanonical, updatedAt: resolveUpdatedAt(entry) });
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
const existingMeta = meta.get(canonicalKey);
|
|
153
|
+
const incomingUpdated = resolveUpdatedAt(entry);
|
|
154
|
+
const existingUpdated = existingMeta?.updatedAt ?? resolveUpdatedAt(existing);
|
|
155
|
+
if (incomingUpdated > existingUpdated) {
|
|
156
|
+
canonical[canonicalKey] = entry;
|
|
157
|
+
meta.set(canonicalKey, { isCanonical, updatedAt: incomingUpdated });
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
if (incomingUpdated < existingUpdated)
|
|
161
|
+
continue;
|
|
162
|
+
if (existingMeta?.isCanonical && !isCanonical)
|
|
163
|
+
continue;
|
|
164
|
+
if (!existingMeta?.isCanonical && isCanonical) {
|
|
165
|
+
canonical[canonicalKey] = entry;
|
|
166
|
+
meta.set(canonicalKey, { isCanonical, updatedAt: incomingUpdated });
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return { store: canonical, legacyKeys };
|
|
171
|
+
}
|
|
172
|
+
function listLegacySessionKeys(params) {
|
|
173
|
+
const legacy = [];
|
|
174
|
+
for (const key of Object.keys(params.store)) {
|
|
175
|
+
const canonical = canonicalizeSessionKeyForAgent({
|
|
176
|
+
key,
|
|
177
|
+
agentId: params.agentId,
|
|
178
|
+
mainKey: params.mainKey,
|
|
179
|
+
scope: params.scope,
|
|
180
|
+
});
|
|
181
|
+
if (canonical !== key)
|
|
182
|
+
legacy.push(key);
|
|
183
|
+
}
|
|
184
|
+
return legacy;
|
|
185
|
+
}
|
|
186
|
+
function emptyDirOrMissing(dir) {
|
|
187
|
+
if (!existsDir(dir))
|
|
188
|
+
return true;
|
|
189
|
+
return safeReadDir(dir).length === 0;
|
|
190
|
+
}
|
|
191
|
+
function removeDirIfEmpty(dir) {
|
|
192
|
+
if (!existsDir(dir))
|
|
193
|
+
return;
|
|
194
|
+
if (!emptyDirOrMissing(dir))
|
|
195
|
+
return;
|
|
196
|
+
try {
|
|
197
|
+
fs.rmdirSync(dir);
|
|
198
|
+
}
|
|
199
|
+
catch {
|
|
200
|
+
// ignore
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
export function resetAutoMigrateLegacyStateForTest() {
|
|
204
|
+
autoMigrateChecked = false;
|
|
205
|
+
}
|
|
206
|
+
export function resetAutoMigrateLegacyAgentDirForTest() {
|
|
207
|
+
resetAutoMigrateLegacyStateForTest();
|
|
208
|
+
}
|
|
209
|
+
export function resetAutoMigrateLegacyStateDirForTest() {
|
|
210
|
+
autoMigrateStateDirChecked = false;
|
|
211
|
+
}
|
|
212
|
+
function resolveSymlinkTarget(linkPath) {
|
|
213
|
+
try {
|
|
214
|
+
const target = fs.readlinkSync(linkPath);
|
|
215
|
+
return path.resolve(path.dirname(linkPath), target);
|
|
216
|
+
}
|
|
217
|
+
catch {
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
function formatStateDirMigration(legacyDir, targetDir) {
|
|
222
|
+
return `State dir: ${legacyDir} → ${targetDir} (legacy path now symlinked)`;
|
|
223
|
+
}
|
|
224
|
+
function isDirPath(filePath) {
|
|
225
|
+
try {
|
|
226
|
+
return fs.statSync(filePath).isDirectory();
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
export async function autoMigrateLegacyStateDir(params) {
|
|
233
|
+
if (autoMigrateStateDirChecked) {
|
|
234
|
+
return { migrated: false, skipped: true, changes: [], warnings: [] };
|
|
235
|
+
}
|
|
236
|
+
autoMigrateStateDirChecked = true;
|
|
237
|
+
const env = params.env ?? process.env;
|
|
238
|
+
if (env.OPENCLAW_STATE_DIR?.trim()) {
|
|
239
|
+
return { migrated: false, skipped: true, changes: [], warnings: [] };
|
|
240
|
+
}
|
|
241
|
+
const homedir = params.homedir ?? os.homedir;
|
|
242
|
+
const targetDir = resolveNewStateDir(homedir);
|
|
243
|
+
const legacyDirs = resolveLegacyStateDirs(homedir);
|
|
244
|
+
let legacyDir = legacyDirs.find((dir) => {
|
|
245
|
+
try {
|
|
246
|
+
return fs.existsSync(dir);
|
|
247
|
+
}
|
|
248
|
+
catch {
|
|
249
|
+
return false;
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
const warnings = [];
|
|
253
|
+
const changes = [];
|
|
254
|
+
let legacyStat = null;
|
|
255
|
+
try {
|
|
256
|
+
legacyStat = legacyDir ? fs.lstatSync(legacyDir) : null;
|
|
257
|
+
}
|
|
258
|
+
catch {
|
|
259
|
+
legacyStat = null;
|
|
260
|
+
}
|
|
261
|
+
if (!legacyStat) {
|
|
262
|
+
return { migrated: false, skipped: false, changes, warnings };
|
|
263
|
+
}
|
|
264
|
+
if (!legacyStat.isDirectory() && !legacyStat.isSymbolicLink()) {
|
|
265
|
+
warnings.push(`Legacy state path is not a directory: ${legacyDir}`);
|
|
266
|
+
return { migrated: false, skipped: false, changes, warnings };
|
|
267
|
+
}
|
|
268
|
+
let symlinkDepth = 0;
|
|
269
|
+
while (legacyStat.isSymbolicLink()) {
|
|
270
|
+
const legacyTarget = legacyDir ? resolveSymlinkTarget(legacyDir) : null;
|
|
271
|
+
if (!legacyTarget) {
|
|
272
|
+
warnings.push(`Legacy state dir is a symlink (${legacyDir ?? "unknown"}); could not resolve target.`);
|
|
273
|
+
return { migrated: false, skipped: false, changes, warnings };
|
|
274
|
+
}
|
|
275
|
+
if (path.resolve(legacyTarget) === path.resolve(targetDir)) {
|
|
276
|
+
return { migrated: false, skipped: false, changes, warnings };
|
|
277
|
+
}
|
|
278
|
+
if (legacyDirs.some((dir) => path.resolve(dir) === path.resolve(legacyTarget))) {
|
|
279
|
+
legacyDir = legacyTarget;
|
|
280
|
+
try {
|
|
281
|
+
legacyStat = fs.lstatSync(legacyDir);
|
|
282
|
+
}
|
|
283
|
+
catch {
|
|
284
|
+
legacyStat = null;
|
|
285
|
+
}
|
|
286
|
+
if (!legacyStat) {
|
|
287
|
+
warnings.push(`Legacy state dir missing after symlink resolution: ${legacyDir}`);
|
|
288
|
+
return { migrated: false, skipped: false, changes, warnings };
|
|
289
|
+
}
|
|
290
|
+
if (!legacyStat.isDirectory() && !legacyStat.isSymbolicLink()) {
|
|
291
|
+
warnings.push(`Legacy state path is not a directory: ${legacyDir}`);
|
|
292
|
+
return { migrated: false, skipped: false, changes, warnings };
|
|
293
|
+
}
|
|
294
|
+
symlinkDepth += 1;
|
|
295
|
+
if (symlinkDepth > 2) {
|
|
296
|
+
warnings.push(`Legacy state dir symlink chain too deep: ${legacyDir}`);
|
|
297
|
+
return { migrated: false, skipped: false, changes, warnings };
|
|
298
|
+
}
|
|
299
|
+
continue;
|
|
300
|
+
}
|
|
301
|
+
warnings.push(`Legacy state dir is a symlink (${legacyDir ?? "unknown"} → ${legacyTarget}); skipping auto-migration.`);
|
|
302
|
+
return { migrated: false, skipped: false, changes, warnings };
|
|
303
|
+
}
|
|
304
|
+
if (isDirPath(targetDir)) {
|
|
305
|
+
warnings.push(`State dir migration skipped: target already exists (${targetDir}). Remove or merge manually.`);
|
|
306
|
+
return { migrated: false, skipped: false, changes, warnings };
|
|
307
|
+
}
|
|
308
|
+
try {
|
|
309
|
+
if (!legacyDir)
|
|
310
|
+
throw new Error("Legacy state dir not found");
|
|
311
|
+
fs.renameSync(legacyDir, targetDir);
|
|
312
|
+
}
|
|
313
|
+
catch (err) {
|
|
314
|
+
warnings.push(`Failed to move legacy state dir (${legacyDir ?? "unknown"} → ${targetDir}): ${String(err)}`);
|
|
315
|
+
return { migrated: false, skipped: false, changes, warnings };
|
|
316
|
+
}
|
|
317
|
+
try {
|
|
318
|
+
if (!legacyDir)
|
|
319
|
+
throw new Error("Legacy state dir not found");
|
|
320
|
+
fs.symlinkSync(targetDir, legacyDir, "dir");
|
|
321
|
+
changes.push(formatStateDirMigration(legacyDir, targetDir));
|
|
322
|
+
}
|
|
323
|
+
catch (err) {
|
|
324
|
+
try {
|
|
325
|
+
if (process.platform === "win32") {
|
|
326
|
+
if (!legacyDir)
|
|
327
|
+
throw new Error("Legacy state dir not found");
|
|
328
|
+
fs.symlinkSync(targetDir, legacyDir, "junction");
|
|
329
|
+
changes.push(formatStateDirMigration(legacyDir, targetDir));
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
throw err;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
catch (fallbackErr) {
|
|
336
|
+
try {
|
|
337
|
+
if (!legacyDir)
|
|
338
|
+
throw new Error("Legacy state dir not found");
|
|
339
|
+
fs.renameSync(targetDir, legacyDir);
|
|
340
|
+
warnings.push(`State dir migration rolled back (failed to link legacy path): ${String(fallbackErr)}`);
|
|
341
|
+
return { migrated: false, skipped: false, changes: [], warnings };
|
|
342
|
+
}
|
|
343
|
+
catch (rollbackErr) {
|
|
344
|
+
warnings.push(`State dir moved but failed to link legacy path (${legacyDir ?? "unknown"} → ${targetDir}): ${String(fallbackErr)}`);
|
|
345
|
+
warnings.push(`Rollback failed; set OPENCLAW_STATE_DIR=${targetDir} to avoid split state: ${String(rollbackErr)}`);
|
|
346
|
+
changes.push(`State dir: ${legacyDir ?? "unknown"} → ${targetDir}`);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
return { migrated: changes.length > 0, skipped: false, changes, warnings };
|
|
351
|
+
}
|
|
352
|
+
export async function detectLegacyStateMigrations(params) {
|
|
353
|
+
const env = params.env ?? process.env;
|
|
354
|
+
const homedir = params.homedir ?? os.homedir;
|
|
355
|
+
const stateDir = resolveStateDir(env, homedir);
|
|
356
|
+
const oauthDir = resolveOAuthDir(env, stateDir);
|
|
357
|
+
const targetAgentId = normalizeAgentId(resolveDefaultAgentId(params.cfg));
|
|
358
|
+
const rawMainKey = params.cfg.session?.mainKey;
|
|
359
|
+
const targetMainKey = typeof rawMainKey === "string" && rawMainKey.trim().length > 0
|
|
360
|
+
? rawMainKey.trim()
|
|
361
|
+
: DEFAULT_MAIN_KEY;
|
|
362
|
+
const targetScope = params.cfg.session?.scope;
|
|
363
|
+
const sessionsLegacyDir = path.join(stateDir, "sessions");
|
|
364
|
+
const sessionsLegacyStorePath = path.join(sessionsLegacyDir, "sessions.json");
|
|
365
|
+
const sessionsTargetDir = path.join(stateDir, "agents", targetAgentId, "sessions");
|
|
366
|
+
const sessionsTargetStorePath = path.join(sessionsTargetDir, "sessions.json");
|
|
367
|
+
const legacySessionEntries = safeReadDir(sessionsLegacyDir);
|
|
368
|
+
const hasLegacySessions = fileExists(sessionsLegacyStorePath) ||
|
|
369
|
+
legacySessionEntries.some((e) => e.isFile() && e.name.endsWith(".jsonl"));
|
|
370
|
+
const targetSessionParsed = fileExists(sessionsTargetStorePath)
|
|
371
|
+
? readSessionStoreJson5(sessionsTargetStorePath)
|
|
372
|
+
: { store: {}, ok: true };
|
|
373
|
+
const legacyKeys = targetSessionParsed.ok
|
|
374
|
+
? listLegacySessionKeys({
|
|
375
|
+
store: targetSessionParsed.store,
|
|
376
|
+
agentId: targetAgentId,
|
|
377
|
+
mainKey: targetMainKey,
|
|
378
|
+
scope: targetScope,
|
|
379
|
+
})
|
|
380
|
+
: [];
|
|
381
|
+
const legacyAgentDir = path.join(stateDir, "agent");
|
|
382
|
+
const targetAgentDir = path.join(stateDir, "agents", targetAgentId, "agent");
|
|
383
|
+
const hasLegacyAgentDir = existsDir(legacyAgentDir);
|
|
384
|
+
const targetWhatsAppAuthDir = path.join(oauthDir, "whatsapp", DEFAULT_ACCOUNT_ID);
|
|
385
|
+
const hasLegacyWhatsAppAuth = fileExists(path.join(oauthDir, "creds.json")) &&
|
|
386
|
+
!fileExists(path.join(targetWhatsAppAuthDir, "creds.json"));
|
|
387
|
+
const preview = [];
|
|
388
|
+
if (hasLegacySessions) {
|
|
389
|
+
preview.push(`- Sessions: ${sessionsLegacyDir} → ${sessionsTargetDir}`);
|
|
390
|
+
}
|
|
391
|
+
if (legacyKeys.length > 0) {
|
|
392
|
+
preview.push(`- Sessions: canonicalize legacy keys in ${sessionsTargetStorePath}`);
|
|
393
|
+
}
|
|
394
|
+
if (hasLegacyAgentDir) {
|
|
395
|
+
preview.push(`- Agent dir: ${legacyAgentDir} → ${targetAgentDir}`);
|
|
396
|
+
}
|
|
397
|
+
if (hasLegacyWhatsAppAuth) {
|
|
398
|
+
preview.push(`- WhatsApp auth: ${oauthDir} → ${targetWhatsAppAuthDir} (keep oauth.json)`);
|
|
399
|
+
}
|
|
400
|
+
return {
|
|
401
|
+
targetAgentId,
|
|
402
|
+
targetMainKey,
|
|
403
|
+
targetScope,
|
|
404
|
+
stateDir,
|
|
405
|
+
oauthDir,
|
|
406
|
+
sessions: {
|
|
407
|
+
legacyDir: sessionsLegacyDir,
|
|
408
|
+
legacyStorePath: sessionsLegacyStorePath,
|
|
409
|
+
targetDir: sessionsTargetDir,
|
|
410
|
+
targetStorePath: sessionsTargetStorePath,
|
|
411
|
+
hasLegacy: hasLegacySessions || legacyKeys.length > 0,
|
|
412
|
+
legacyKeys,
|
|
413
|
+
},
|
|
414
|
+
agentDir: {
|
|
415
|
+
legacyDir: legacyAgentDir,
|
|
416
|
+
targetDir: targetAgentDir,
|
|
417
|
+
hasLegacy: hasLegacyAgentDir,
|
|
418
|
+
},
|
|
419
|
+
whatsappAuth: {
|
|
420
|
+
legacyDir: oauthDir,
|
|
421
|
+
targetDir: targetWhatsAppAuthDir,
|
|
422
|
+
hasLegacy: hasLegacyWhatsAppAuth,
|
|
423
|
+
},
|
|
424
|
+
preview,
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
async function migrateLegacySessions(detected, now) {
|
|
428
|
+
const changes = [];
|
|
429
|
+
const warnings = [];
|
|
430
|
+
if (!detected.sessions.hasLegacy)
|
|
431
|
+
return { changes, warnings };
|
|
432
|
+
ensureDir(detected.sessions.targetDir);
|
|
433
|
+
const legacyParsed = fileExists(detected.sessions.legacyStorePath)
|
|
434
|
+
? readSessionStoreJson5(detected.sessions.legacyStorePath)
|
|
435
|
+
: { store: {}, ok: true };
|
|
436
|
+
const targetParsed = fileExists(detected.sessions.targetStorePath)
|
|
437
|
+
? readSessionStoreJson5(detected.sessions.targetStorePath)
|
|
438
|
+
: { store: {}, ok: true };
|
|
439
|
+
const legacyStore = legacyParsed.store;
|
|
440
|
+
const targetStore = targetParsed.store;
|
|
441
|
+
const canonicalizedTarget = canonicalizeSessionStore({
|
|
442
|
+
store: targetStore,
|
|
443
|
+
agentId: detected.targetAgentId,
|
|
444
|
+
mainKey: detected.targetMainKey,
|
|
445
|
+
scope: detected.targetScope,
|
|
446
|
+
});
|
|
447
|
+
const canonicalizedLegacy = canonicalizeSessionStore({
|
|
448
|
+
store: legacyStore,
|
|
449
|
+
agentId: detected.targetAgentId,
|
|
450
|
+
mainKey: detected.targetMainKey,
|
|
451
|
+
scope: detected.targetScope,
|
|
452
|
+
});
|
|
453
|
+
const merged = { ...canonicalizedTarget.store };
|
|
454
|
+
for (const [key, entry] of Object.entries(canonicalizedLegacy.store)) {
|
|
455
|
+
merged[key] = mergeSessionEntry({
|
|
456
|
+
existing: merged[key],
|
|
457
|
+
incoming: entry,
|
|
458
|
+
preferIncomingOnTie: false,
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
const mainKey = buildAgentMainSessionKey({
|
|
462
|
+
agentId: detected.targetAgentId,
|
|
463
|
+
mainKey: detected.targetMainKey,
|
|
464
|
+
});
|
|
465
|
+
if (!merged[mainKey]) {
|
|
466
|
+
const latest = pickLatestLegacyDirectEntry(legacyStore);
|
|
467
|
+
if (latest?.sessionId) {
|
|
468
|
+
merged[mainKey] = latest;
|
|
469
|
+
changes.push(`Migrated latest direct-chat session → ${mainKey}`);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
if (!legacyParsed.ok) {
|
|
473
|
+
warnings.push(`Legacy sessions store unreadable; left in place at ${detected.sessions.legacyStorePath}`);
|
|
474
|
+
}
|
|
475
|
+
if ((legacyParsed.ok || targetParsed.ok) &&
|
|
476
|
+
(Object.keys(legacyStore).length > 0 || Object.keys(targetStore).length > 0)) {
|
|
477
|
+
const normalized = {};
|
|
478
|
+
for (const [key, entry] of Object.entries(merged)) {
|
|
479
|
+
const normalizedEntry = normalizeSessionEntry(entry);
|
|
480
|
+
if (!normalizedEntry)
|
|
481
|
+
continue;
|
|
482
|
+
normalized[key] = normalizedEntry;
|
|
483
|
+
}
|
|
484
|
+
await saveSessionStore(detected.sessions.targetStorePath, normalized);
|
|
485
|
+
changes.push(`Merged sessions store → ${detected.sessions.targetStorePath}`);
|
|
486
|
+
if (canonicalizedTarget.legacyKeys.length > 0) {
|
|
487
|
+
changes.push(`Canonicalized ${canonicalizedTarget.legacyKeys.length} legacy session key(s)`);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
const entries = safeReadDir(detected.sessions.legacyDir);
|
|
491
|
+
for (const entry of entries) {
|
|
492
|
+
if (!entry.isFile())
|
|
493
|
+
continue;
|
|
494
|
+
if (entry.name === "sessions.json")
|
|
495
|
+
continue;
|
|
496
|
+
const from = path.join(detected.sessions.legacyDir, entry.name);
|
|
497
|
+
const to = path.join(detected.sessions.targetDir, entry.name);
|
|
498
|
+
if (fileExists(to))
|
|
499
|
+
continue;
|
|
500
|
+
try {
|
|
501
|
+
fs.renameSync(from, to);
|
|
502
|
+
changes.push(`Moved ${entry.name} → agents/${detected.targetAgentId}/sessions`);
|
|
503
|
+
}
|
|
504
|
+
catch (err) {
|
|
505
|
+
warnings.push(`Failed moving ${from}: ${String(err)}`);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
if (legacyParsed.ok) {
|
|
509
|
+
try {
|
|
510
|
+
if (fileExists(detected.sessions.legacyStorePath)) {
|
|
511
|
+
fs.rmSync(detected.sessions.legacyStorePath, { force: true });
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
catch {
|
|
515
|
+
// ignore
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
removeDirIfEmpty(detected.sessions.legacyDir);
|
|
519
|
+
const legacyLeft = safeReadDir(detected.sessions.legacyDir).filter((e) => e.isFile());
|
|
520
|
+
if (legacyLeft.length > 0) {
|
|
521
|
+
const backupDir = `${detected.sessions.legacyDir}.legacy-${now()}`;
|
|
522
|
+
try {
|
|
523
|
+
fs.renameSync(detected.sessions.legacyDir, backupDir);
|
|
524
|
+
warnings.push(`Left legacy sessions at ${backupDir}`);
|
|
525
|
+
}
|
|
526
|
+
catch {
|
|
527
|
+
// ignore
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
return { changes, warnings };
|
|
531
|
+
}
|
|
532
|
+
export async function migrateLegacyAgentDir(detected, now) {
|
|
533
|
+
const changes = [];
|
|
534
|
+
const warnings = [];
|
|
535
|
+
if (!detected.agentDir.hasLegacy)
|
|
536
|
+
return { changes, warnings };
|
|
537
|
+
ensureDir(detected.agentDir.targetDir);
|
|
538
|
+
const entries = safeReadDir(detected.agentDir.legacyDir);
|
|
539
|
+
for (const entry of entries) {
|
|
540
|
+
const from = path.join(detected.agentDir.legacyDir, entry.name);
|
|
541
|
+
const to = path.join(detected.agentDir.targetDir, entry.name);
|
|
542
|
+
if (fs.existsSync(to))
|
|
543
|
+
continue;
|
|
544
|
+
try {
|
|
545
|
+
fs.renameSync(from, to);
|
|
546
|
+
changes.push(`Moved agent file ${entry.name} → agents/${detected.targetAgentId}/agent`);
|
|
547
|
+
}
|
|
548
|
+
catch (err) {
|
|
549
|
+
warnings.push(`Failed moving ${from}: ${String(err)}`);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
removeDirIfEmpty(detected.agentDir.legacyDir);
|
|
553
|
+
if (!emptyDirOrMissing(detected.agentDir.legacyDir)) {
|
|
554
|
+
const backupDir = path.join(detected.stateDir, "agents", detected.targetAgentId, `agent.legacy-${now()}`);
|
|
555
|
+
try {
|
|
556
|
+
fs.renameSync(detected.agentDir.legacyDir, backupDir);
|
|
557
|
+
warnings.push(`Left legacy agent dir at ${backupDir}`);
|
|
558
|
+
}
|
|
559
|
+
catch (err) {
|
|
560
|
+
warnings.push(`Failed relocating legacy agent dir: ${String(err)}`);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
return { changes, warnings };
|
|
564
|
+
}
|
|
565
|
+
async function migrateLegacyWhatsAppAuth(detected) {
|
|
566
|
+
const changes = [];
|
|
567
|
+
const warnings = [];
|
|
568
|
+
if (!detected.whatsappAuth.hasLegacy)
|
|
569
|
+
return { changes, warnings };
|
|
570
|
+
ensureDir(detected.whatsappAuth.targetDir);
|
|
571
|
+
const entries = safeReadDir(detected.whatsappAuth.legacyDir);
|
|
572
|
+
for (const entry of entries) {
|
|
573
|
+
if (!entry.isFile())
|
|
574
|
+
continue;
|
|
575
|
+
if (entry.name === "oauth.json")
|
|
576
|
+
continue;
|
|
577
|
+
if (!isLegacyWhatsAppAuthFile(entry.name))
|
|
578
|
+
continue;
|
|
579
|
+
const from = path.join(detected.whatsappAuth.legacyDir, entry.name);
|
|
580
|
+
const to = path.join(detected.whatsappAuth.targetDir, entry.name);
|
|
581
|
+
if (fileExists(to))
|
|
582
|
+
continue;
|
|
583
|
+
try {
|
|
584
|
+
fs.renameSync(from, to);
|
|
585
|
+
changes.push(`Moved WhatsApp auth ${entry.name} → whatsapp/default`);
|
|
586
|
+
}
|
|
587
|
+
catch (err) {
|
|
588
|
+
warnings.push(`Failed moving ${from}: ${String(err)}`);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
return { changes, warnings };
|
|
592
|
+
}
|
|
593
|
+
export async function runLegacyStateMigrations(params) {
|
|
594
|
+
const now = params.now ?? (() => Date.now());
|
|
595
|
+
const detected = params.detected;
|
|
596
|
+
const sessions = await migrateLegacySessions(detected, now);
|
|
597
|
+
const agentDir = await migrateLegacyAgentDir(detected, now);
|
|
598
|
+
const whatsappAuth = await migrateLegacyWhatsAppAuth(detected);
|
|
599
|
+
return {
|
|
600
|
+
changes: [...sessions.changes, ...agentDir.changes, ...whatsappAuth.changes],
|
|
601
|
+
warnings: [...sessions.warnings, ...agentDir.warnings, ...whatsappAuth.warnings],
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
export async function autoMigrateLegacyAgentDir(params) {
|
|
605
|
+
return await autoMigrateLegacyState(params);
|
|
606
|
+
}
|
|
607
|
+
export async function autoMigrateLegacyState(params) {
|
|
608
|
+
if (autoMigrateChecked) {
|
|
609
|
+
return { migrated: false, skipped: true, changes: [], warnings: [] };
|
|
610
|
+
}
|
|
611
|
+
autoMigrateChecked = true;
|
|
612
|
+
const env = params.env ?? process.env;
|
|
613
|
+
const stateDirResult = await autoMigrateLegacyStateDir({
|
|
614
|
+
env,
|
|
615
|
+
homedir: params.homedir,
|
|
616
|
+
log: params.log,
|
|
617
|
+
});
|
|
618
|
+
if (env.OPENCLAW_AGENT_DIR?.trim() || env.PI_CODING_AGENT_DIR?.trim()) {
|
|
619
|
+
return {
|
|
620
|
+
migrated: stateDirResult.migrated,
|
|
621
|
+
skipped: true,
|
|
622
|
+
changes: stateDirResult.changes,
|
|
623
|
+
warnings: stateDirResult.warnings,
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
const detected = await detectLegacyStateMigrations({
|
|
627
|
+
cfg: params.cfg,
|
|
628
|
+
env,
|
|
629
|
+
homedir: params.homedir,
|
|
630
|
+
});
|
|
631
|
+
if (!detected.sessions.hasLegacy && !detected.agentDir.hasLegacy) {
|
|
632
|
+
return {
|
|
633
|
+
migrated: stateDirResult.migrated,
|
|
634
|
+
skipped: false,
|
|
635
|
+
changes: stateDirResult.changes,
|
|
636
|
+
warnings: stateDirResult.warnings,
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
const now = params.now ?? (() => Date.now());
|
|
640
|
+
const sessions = await migrateLegacySessions(detected, now);
|
|
641
|
+
const agentDir = await migrateLegacyAgentDir(detected, now);
|
|
642
|
+
const changes = [...stateDirResult.changes, ...sessions.changes, ...agentDir.changes];
|
|
643
|
+
const warnings = [...stateDirResult.warnings, ...sessions.warnings, ...agentDir.warnings];
|
|
644
|
+
const logger = params.log ?? createSubsystemLogger("state-migrations");
|
|
645
|
+
if (changes.length > 0) {
|
|
646
|
+
logger.info(`Auto-migrated legacy state:\n${changes.map((entry) => `- ${entry}`).join("\n")}`);
|
|
647
|
+
}
|
|
648
|
+
if (warnings.length > 0) {
|
|
649
|
+
logger.warn(`Legacy state migration warnings:\n${warnings.map((entry) => `- ${entry}`).join("\n")}`);
|
|
650
|
+
}
|
|
651
|
+
return {
|
|
652
|
+
migrated: changes.length > 0,
|
|
653
|
+
skipped: false,
|
|
654
|
+
changes,
|
|
655
|
+
warnings,
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
//# sourceMappingURL=state-migrations.js.map
|