@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,1041 @@
|
|
|
1
|
+
import crypto from "node:crypto";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import net from "node:net";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { DEFAULT_AGENT_ID } from "../routing/session-key.js";
|
|
7
|
+
const DEFAULT_SECURITY = "deny";
|
|
8
|
+
const DEFAULT_ASK = "on-miss";
|
|
9
|
+
const DEFAULT_ASK_FALLBACK = "deny";
|
|
10
|
+
const DEFAULT_AUTO_ALLOW_SKILLS = false;
|
|
11
|
+
const DEFAULT_SOCKET = "~/.openclaw/exec-approvals.sock";
|
|
12
|
+
const DEFAULT_FILE = "~/.openclaw/exec-approvals.json";
|
|
13
|
+
export const DEFAULT_SAFE_BINS = ["jq", "grep", "cut", "sort", "uniq", "head", "tail", "tr", "wc"];
|
|
14
|
+
function hashExecApprovalsRaw(raw) {
|
|
15
|
+
return crypto
|
|
16
|
+
.createHash("sha256")
|
|
17
|
+
.update(raw ?? "")
|
|
18
|
+
.digest("hex");
|
|
19
|
+
}
|
|
20
|
+
function expandHome(value) {
|
|
21
|
+
if (!value)
|
|
22
|
+
return value;
|
|
23
|
+
if (value === "~")
|
|
24
|
+
return os.homedir();
|
|
25
|
+
if (value.startsWith("~/"))
|
|
26
|
+
return path.join(os.homedir(), value.slice(2));
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
export function resolveExecApprovalsPath() {
|
|
30
|
+
return expandHome(DEFAULT_FILE);
|
|
31
|
+
}
|
|
32
|
+
export function resolveExecApprovalsSocketPath() {
|
|
33
|
+
return expandHome(DEFAULT_SOCKET);
|
|
34
|
+
}
|
|
35
|
+
function normalizeAllowlistPattern(value) {
|
|
36
|
+
const trimmed = value?.trim() ?? "";
|
|
37
|
+
return trimmed ? trimmed.toLowerCase() : null;
|
|
38
|
+
}
|
|
39
|
+
function mergeLegacyAgent(current, legacy) {
|
|
40
|
+
const allowlist = [];
|
|
41
|
+
const seen = new Set();
|
|
42
|
+
const pushEntry = (entry) => {
|
|
43
|
+
const key = normalizeAllowlistPattern(entry.pattern);
|
|
44
|
+
if (!key || seen.has(key))
|
|
45
|
+
return;
|
|
46
|
+
seen.add(key);
|
|
47
|
+
allowlist.push(entry);
|
|
48
|
+
};
|
|
49
|
+
for (const entry of current.allowlist ?? [])
|
|
50
|
+
pushEntry(entry);
|
|
51
|
+
for (const entry of legacy.allowlist ?? [])
|
|
52
|
+
pushEntry(entry);
|
|
53
|
+
return {
|
|
54
|
+
security: current.security ?? legacy.security,
|
|
55
|
+
ask: current.ask ?? legacy.ask,
|
|
56
|
+
askFallback: current.askFallback ?? legacy.askFallback,
|
|
57
|
+
autoAllowSkills: current.autoAllowSkills ?? legacy.autoAllowSkills,
|
|
58
|
+
allowlist: allowlist.length > 0 ? allowlist : undefined,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function ensureDir(filePath) {
|
|
62
|
+
const dir = path.dirname(filePath);
|
|
63
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
64
|
+
}
|
|
65
|
+
function ensureAllowlistIds(allowlist) {
|
|
66
|
+
if (!Array.isArray(allowlist) || allowlist.length === 0)
|
|
67
|
+
return allowlist;
|
|
68
|
+
let changed = false;
|
|
69
|
+
const next = allowlist.map((entry) => {
|
|
70
|
+
if (entry.id)
|
|
71
|
+
return entry;
|
|
72
|
+
changed = true;
|
|
73
|
+
return { ...entry, id: crypto.randomUUID() };
|
|
74
|
+
});
|
|
75
|
+
return changed ? next : allowlist;
|
|
76
|
+
}
|
|
77
|
+
export function normalizeExecApprovals(file) {
|
|
78
|
+
const socketPath = file.socket?.path?.trim();
|
|
79
|
+
const token = file.socket?.token?.trim();
|
|
80
|
+
const agents = { ...file.agents };
|
|
81
|
+
const legacyDefault = agents.default;
|
|
82
|
+
if (legacyDefault) {
|
|
83
|
+
const main = agents[DEFAULT_AGENT_ID];
|
|
84
|
+
agents[DEFAULT_AGENT_ID] = main ? mergeLegacyAgent(main, legacyDefault) : legacyDefault;
|
|
85
|
+
delete agents.default;
|
|
86
|
+
}
|
|
87
|
+
for (const [key, agent] of Object.entries(agents)) {
|
|
88
|
+
const allowlist = ensureAllowlistIds(agent.allowlist);
|
|
89
|
+
if (allowlist !== agent.allowlist) {
|
|
90
|
+
agents[key] = { ...agent, allowlist };
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const normalized = {
|
|
94
|
+
version: 1,
|
|
95
|
+
socket: {
|
|
96
|
+
path: socketPath && socketPath.length > 0 ? socketPath : undefined,
|
|
97
|
+
token: token && token.length > 0 ? token : undefined,
|
|
98
|
+
},
|
|
99
|
+
defaults: {
|
|
100
|
+
security: file.defaults?.security,
|
|
101
|
+
ask: file.defaults?.ask,
|
|
102
|
+
askFallback: file.defaults?.askFallback,
|
|
103
|
+
autoAllowSkills: file.defaults?.autoAllowSkills,
|
|
104
|
+
},
|
|
105
|
+
agents,
|
|
106
|
+
};
|
|
107
|
+
return normalized;
|
|
108
|
+
}
|
|
109
|
+
function generateToken() {
|
|
110
|
+
return crypto.randomBytes(24).toString("base64url");
|
|
111
|
+
}
|
|
112
|
+
export function readExecApprovalsSnapshot() {
|
|
113
|
+
const filePath = resolveExecApprovalsPath();
|
|
114
|
+
if (!fs.existsSync(filePath)) {
|
|
115
|
+
const file = normalizeExecApprovals({ version: 1, agents: {} });
|
|
116
|
+
return {
|
|
117
|
+
path: filePath,
|
|
118
|
+
exists: false,
|
|
119
|
+
raw: null,
|
|
120
|
+
file,
|
|
121
|
+
hash: hashExecApprovalsRaw(null),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
const raw = fs.readFileSync(filePath, "utf8");
|
|
125
|
+
let parsed = null;
|
|
126
|
+
try {
|
|
127
|
+
parsed = JSON.parse(raw);
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
parsed = null;
|
|
131
|
+
}
|
|
132
|
+
const file = parsed?.version === 1
|
|
133
|
+
? normalizeExecApprovals(parsed)
|
|
134
|
+
: normalizeExecApprovals({ version: 1, agents: {} });
|
|
135
|
+
return {
|
|
136
|
+
path: filePath,
|
|
137
|
+
exists: true,
|
|
138
|
+
raw,
|
|
139
|
+
file,
|
|
140
|
+
hash: hashExecApprovalsRaw(raw),
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
export function loadExecApprovals() {
|
|
144
|
+
const filePath = resolveExecApprovalsPath();
|
|
145
|
+
try {
|
|
146
|
+
if (!fs.existsSync(filePath)) {
|
|
147
|
+
return normalizeExecApprovals({ version: 1, agents: {} });
|
|
148
|
+
}
|
|
149
|
+
const raw = fs.readFileSync(filePath, "utf8");
|
|
150
|
+
const parsed = JSON.parse(raw);
|
|
151
|
+
if (parsed?.version !== 1) {
|
|
152
|
+
return normalizeExecApprovals({ version: 1, agents: {} });
|
|
153
|
+
}
|
|
154
|
+
return normalizeExecApprovals(parsed);
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
return normalizeExecApprovals({ version: 1, agents: {} });
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
export function saveExecApprovals(file) {
|
|
161
|
+
const filePath = resolveExecApprovalsPath();
|
|
162
|
+
ensureDir(filePath);
|
|
163
|
+
fs.writeFileSync(filePath, `${JSON.stringify(file, null, 2)}\n`, { mode: 0o600 });
|
|
164
|
+
try {
|
|
165
|
+
fs.chmodSync(filePath, 0o600);
|
|
166
|
+
}
|
|
167
|
+
catch {
|
|
168
|
+
// best-effort on platforms without chmod
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
export function ensureExecApprovals() {
|
|
172
|
+
const loaded = loadExecApprovals();
|
|
173
|
+
const next = normalizeExecApprovals(loaded);
|
|
174
|
+
const socketPath = next.socket?.path?.trim();
|
|
175
|
+
const token = next.socket?.token?.trim();
|
|
176
|
+
const updated = {
|
|
177
|
+
...next,
|
|
178
|
+
socket: {
|
|
179
|
+
path: socketPath && socketPath.length > 0 ? socketPath : resolveExecApprovalsSocketPath(),
|
|
180
|
+
token: token && token.length > 0 ? token : generateToken(),
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
saveExecApprovals(updated);
|
|
184
|
+
return updated;
|
|
185
|
+
}
|
|
186
|
+
function normalizeSecurity(value, fallback) {
|
|
187
|
+
if (value === "allowlist" || value === "full" || value === "deny")
|
|
188
|
+
return value;
|
|
189
|
+
return fallback;
|
|
190
|
+
}
|
|
191
|
+
function normalizeAsk(value, fallback) {
|
|
192
|
+
if (value === "always" || value === "off" || value === "on-miss")
|
|
193
|
+
return value;
|
|
194
|
+
return fallback;
|
|
195
|
+
}
|
|
196
|
+
export function resolveExecApprovals(agentId, overrides) {
|
|
197
|
+
const file = ensureExecApprovals();
|
|
198
|
+
return resolveExecApprovalsFromFile({
|
|
199
|
+
file,
|
|
200
|
+
agentId,
|
|
201
|
+
overrides,
|
|
202
|
+
path: resolveExecApprovalsPath(),
|
|
203
|
+
socketPath: expandHome(file.socket?.path ?? resolveExecApprovalsSocketPath()),
|
|
204
|
+
token: file.socket?.token ?? "",
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
export function resolveExecApprovalsFromFile(params) {
|
|
208
|
+
const file = normalizeExecApprovals(params.file);
|
|
209
|
+
const defaults = file.defaults ?? {};
|
|
210
|
+
const agentKey = params.agentId ?? DEFAULT_AGENT_ID;
|
|
211
|
+
const agent = file.agents?.[agentKey] ?? {};
|
|
212
|
+
const wildcard = file.agents?.["*"] ?? {};
|
|
213
|
+
const fallbackSecurity = params.overrides?.security ?? DEFAULT_SECURITY;
|
|
214
|
+
const fallbackAsk = params.overrides?.ask ?? DEFAULT_ASK;
|
|
215
|
+
const fallbackAskFallback = params.overrides?.askFallback ?? DEFAULT_ASK_FALLBACK;
|
|
216
|
+
const fallbackAutoAllowSkills = params.overrides?.autoAllowSkills ?? DEFAULT_AUTO_ALLOW_SKILLS;
|
|
217
|
+
const resolvedDefaults = {
|
|
218
|
+
security: normalizeSecurity(defaults.security, fallbackSecurity),
|
|
219
|
+
ask: normalizeAsk(defaults.ask, fallbackAsk),
|
|
220
|
+
askFallback: normalizeSecurity(defaults.askFallback ?? fallbackAskFallback, fallbackAskFallback),
|
|
221
|
+
autoAllowSkills: Boolean(defaults.autoAllowSkills ?? fallbackAutoAllowSkills),
|
|
222
|
+
};
|
|
223
|
+
const resolvedAgent = {
|
|
224
|
+
security: normalizeSecurity(agent.security ?? wildcard.security ?? resolvedDefaults.security, resolvedDefaults.security),
|
|
225
|
+
ask: normalizeAsk(agent.ask ?? wildcard.ask ?? resolvedDefaults.ask, resolvedDefaults.ask),
|
|
226
|
+
askFallback: normalizeSecurity(agent.askFallback ?? wildcard.askFallback ?? resolvedDefaults.askFallback, resolvedDefaults.askFallback),
|
|
227
|
+
autoAllowSkills: Boolean(agent.autoAllowSkills ?? wildcard.autoAllowSkills ?? resolvedDefaults.autoAllowSkills),
|
|
228
|
+
};
|
|
229
|
+
const allowlist = [
|
|
230
|
+
...(Array.isArray(wildcard.allowlist) ? wildcard.allowlist : []),
|
|
231
|
+
...(Array.isArray(agent.allowlist) ? agent.allowlist : []),
|
|
232
|
+
];
|
|
233
|
+
return {
|
|
234
|
+
path: params.path ?? resolveExecApprovalsPath(),
|
|
235
|
+
socketPath: expandHome(params.socketPath ?? file.socket?.path ?? resolveExecApprovalsSocketPath()),
|
|
236
|
+
token: params.token ?? file.socket?.token ?? "",
|
|
237
|
+
defaults: resolvedDefaults,
|
|
238
|
+
agent: resolvedAgent,
|
|
239
|
+
allowlist,
|
|
240
|
+
file,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
function isExecutableFile(filePath) {
|
|
244
|
+
try {
|
|
245
|
+
const stat = fs.statSync(filePath);
|
|
246
|
+
if (!stat.isFile())
|
|
247
|
+
return false;
|
|
248
|
+
if (process.platform !== "win32") {
|
|
249
|
+
fs.accessSync(filePath, fs.constants.X_OK);
|
|
250
|
+
}
|
|
251
|
+
return true;
|
|
252
|
+
}
|
|
253
|
+
catch {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
function parseFirstToken(command) {
|
|
258
|
+
const trimmed = command.trim();
|
|
259
|
+
if (!trimmed)
|
|
260
|
+
return null;
|
|
261
|
+
const first = trimmed[0];
|
|
262
|
+
if (first === '"' || first === "'") {
|
|
263
|
+
const end = trimmed.indexOf(first, 1);
|
|
264
|
+
if (end > 1)
|
|
265
|
+
return trimmed.slice(1, end);
|
|
266
|
+
return trimmed.slice(1);
|
|
267
|
+
}
|
|
268
|
+
const match = /^[^\s]+/.exec(trimmed);
|
|
269
|
+
return match ? match[0] : null;
|
|
270
|
+
}
|
|
271
|
+
function resolveExecutablePath(rawExecutable, cwd, env) {
|
|
272
|
+
const expanded = rawExecutable.startsWith("~") ? expandHome(rawExecutable) : rawExecutable;
|
|
273
|
+
if (expanded.includes("/") || expanded.includes("\\")) {
|
|
274
|
+
if (path.isAbsolute(expanded)) {
|
|
275
|
+
return isExecutableFile(expanded) ? expanded : undefined;
|
|
276
|
+
}
|
|
277
|
+
const base = cwd && cwd.trim() ? cwd.trim() : process.cwd();
|
|
278
|
+
const candidate = path.resolve(base, expanded);
|
|
279
|
+
return isExecutableFile(candidate) ? candidate : undefined;
|
|
280
|
+
}
|
|
281
|
+
const envPath = env?.PATH ?? env?.Path ?? process.env.PATH ?? process.env.Path ?? "";
|
|
282
|
+
const entries = envPath.split(path.delimiter).filter(Boolean);
|
|
283
|
+
const hasExtension = process.platform === "win32" && path.extname(expanded).length > 0;
|
|
284
|
+
const extensions = process.platform === "win32"
|
|
285
|
+
? hasExtension
|
|
286
|
+
? [""]
|
|
287
|
+
: (env?.PATHEXT ??
|
|
288
|
+
env?.Pathext ??
|
|
289
|
+
process.env.PATHEXT ??
|
|
290
|
+
process.env.Pathext ??
|
|
291
|
+
".EXE;.CMD;.BAT;.COM")
|
|
292
|
+
.split(";")
|
|
293
|
+
.map((ext) => ext.toLowerCase())
|
|
294
|
+
: [""];
|
|
295
|
+
for (const entry of entries) {
|
|
296
|
+
for (const ext of extensions) {
|
|
297
|
+
const candidate = path.join(entry, expanded + ext);
|
|
298
|
+
if (isExecutableFile(candidate))
|
|
299
|
+
return candidate;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
return undefined;
|
|
303
|
+
}
|
|
304
|
+
export function resolveCommandResolution(command, cwd, env) {
|
|
305
|
+
const rawExecutable = parseFirstToken(command);
|
|
306
|
+
if (!rawExecutable)
|
|
307
|
+
return null;
|
|
308
|
+
const resolvedPath = resolveExecutablePath(rawExecutable, cwd, env);
|
|
309
|
+
const executableName = resolvedPath ? path.basename(resolvedPath) : rawExecutable;
|
|
310
|
+
return { rawExecutable, resolvedPath, executableName };
|
|
311
|
+
}
|
|
312
|
+
export function resolveCommandResolutionFromArgv(argv, cwd, env) {
|
|
313
|
+
const rawExecutable = argv[0]?.trim();
|
|
314
|
+
if (!rawExecutable)
|
|
315
|
+
return null;
|
|
316
|
+
const resolvedPath = resolveExecutablePath(rawExecutable, cwd, env);
|
|
317
|
+
const executableName = resolvedPath ? path.basename(resolvedPath) : rawExecutable;
|
|
318
|
+
return { rawExecutable, resolvedPath, executableName };
|
|
319
|
+
}
|
|
320
|
+
function normalizeMatchTarget(value) {
|
|
321
|
+
if (process.platform === "win32") {
|
|
322
|
+
const stripped = value.replace(/^\\\\[?.]\\/, "");
|
|
323
|
+
return stripped.replace(/\\/g, "/").toLowerCase();
|
|
324
|
+
}
|
|
325
|
+
return value.replace(/\\\\/g, "/").toLowerCase();
|
|
326
|
+
}
|
|
327
|
+
function tryRealpath(value) {
|
|
328
|
+
try {
|
|
329
|
+
return fs.realpathSync(value);
|
|
330
|
+
}
|
|
331
|
+
catch {
|
|
332
|
+
return null;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
function globToRegExp(pattern) {
|
|
336
|
+
let regex = "^";
|
|
337
|
+
let i = 0;
|
|
338
|
+
while (i < pattern.length) {
|
|
339
|
+
const ch = pattern[i];
|
|
340
|
+
if (ch === "*") {
|
|
341
|
+
const next = pattern[i + 1];
|
|
342
|
+
if (next === "*") {
|
|
343
|
+
regex += ".*";
|
|
344
|
+
i += 2;
|
|
345
|
+
continue;
|
|
346
|
+
}
|
|
347
|
+
regex += "[^/]*";
|
|
348
|
+
i += 1;
|
|
349
|
+
continue;
|
|
350
|
+
}
|
|
351
|
+
if (ch === "?") {
|
|
352
|
+
regex += ".";
|
|
353
|
+
i += 1;
|
|
354
|
+
continue;
|
|
355
|
+
}
|
|
356
|
+
regex += ch.replace(/[.*+?^${}()|[\\]\\\\]/g, "\\$&");
|
|
357
|
+
i += 1;
|
|
358
|
+
}
|
|
359
|
+
regex += "$";
|
|
360
|
+
return new RegExp(regex, "i");
|
|
361
|
+
}
|
|
362
|
+
function matchesPattern(pattern, target) {
|
|
363
|
+
const trimmed = pattern.trim();
|
|
364
|
+
if (!trimmed)
|
|
365
|
+
return false;
|
|
366
|
+
const expanded = trimmed.startsWith("~") ? expandHome(trimmed) : trimmed;
|
|
367
|
+
const hasWildcard = /[*?]/.test(expanded);
|
|
368
|
+
let normalizedPattern = expanded;
|
|
369
|
+
let normalizedTarget = target;
|
|
370
|
+
if (process.platform === "win32" && !hasWildcard) {
|
|
371
|
+
normalizedPattern = tryRealpath(expanded) ?? expanded;
|
|
372
|
+
normalizedTarget = tryRealpath(target) ?? target;
|
|
373
|
+
}
|
|
374
|
+
normalizedPattern = normalizeMatchTarget(normalizedPattern);
|
|
375
|
+
normalizedTarget = normalizeMatchTarget(normalizedTarget);
|
|
376
|
+
const regex = globToRegExp(normalizedPattern);
|
|
377
|
+
return regex.test(normalizedTarget);
|
|
378
|
+
}
|
|
379
|
+
function resolveAllowlistCandidatePath(resolution, cwd) {
|
|
380
|
+
if (!resolution)
|
|
381
|
+
return undefined;
|
|
382
|
+
if (resolution.resolvedPath)
|
|
383
|
+
return resolution.resolvedPath;
|
|
384
|
+
const raw = resolution.rawExecutable?.trim();
|
|
385
|
+
if (!raw)
|
|
386
|
+
return undefined;
|
|
387
|
+
const expanded = raw.startsWith("~") ? expandHome(raw) : raw;
|
|
388
|
+
if (!expanded.includes("/") && !expanded.includes("\\"))
|
|
389
|
+
return undefined;
|
|
390
|
+
if (path.isAbsolute(expanded))
|
|
391
|
+
return expanded;
|
|
392
|
+
const base = cwd && cwd.trim() ? cwd.trim() : process.cwd();
|
|
393
|
+
return path.resolve(base, expanded);
|
|
394
|
+
}
|
|
395
|
+
export function matchAllowlist(entries, resolution) {
|
|
396
|
+
if (!entries.length || !resolution?.resolvedPath)
|
|
397
|
+
return null;
|
|
398
|
+
const resolvedPath = resolution.resolvedPath;
|
|
399
|
+
for (const entry of entries) {
|
|
400
|
+
const pattern = entry.pattern?.trim();
|
|
401
|
+
if (!pattern)
|
|
402
|
+
continue;
|
|
403
|
+
const hasPath = pattern.includes("/") || pattern.includes("\\") || pattern.includes("~");
|
|
404
|
+
if (!hasPath)
|
|
405
|
+
continue;
|
|
406
|
+
if (matchesPattern(pattern, resolvedPath))
|
|
407
|
+
return entry;
|
|
408
|
+
}
|
|
409
|
+
return null;
|
|
410
|
+
}
|
|
411
|
+
const DISALLOWED_PIPELINE_TOKENS = new Set([">", "<", "`", "\n", "\r", "(", ")"]);
|
|
412
|
+
/**
|
|
413
|
+
* Iterates through a command string while respecting shell quoting rules.
|
|
414
|
+
* The callback receives each character and the next character, and returns an action:
|
|
415
|
+
* - "split": push current buffer as a segment and start a new one
|
|
416
|
+
* - "skip": skip this character (and optionally the next via skip count)
|
|
417
|
+
* - "include": add this character to the buffer
|
|
418
|
+
* - { reject: reason }: abort with an error
|
|
419
|
+
*/
|
|
420
|
+
function iterateQuoteAware(command, onChar) {
|
|
421
|
+
const parts = [];
|
|
422
|
+
let buf = "";
|
|
423
|
+
let inSingle = false;
|
|
424
|
+
let inDouble = false;
|
|
425
|
+
let escaped = false;
|
|
426
|
+
let hasSplit = false;
|
|
427
|
+
const pushPart = () => {
|
|
428
|
+
const trimmed = buf.trim();
|
|
429
|
+
if (trimmed) {
|
|
430
|
+
parts.push(trimmed);
|
|
431
|
+
}
|
|
432
|
+
buf = "";
|
|
433
|
+
};
|
|
434
|
+
for (let i = 0; i < command.length; i += 1) {
|
|
435
|
+
const ch = command[i];
|
|
436
|
+
const next = command[i + 1];
|
|
437
|
+
if (escaped) {
|
|
438
|
+
buf += ch;
|
|
439
|
+
escaped = false;
|
|
440
|
+
continue;
|
|
441
|
+
}
|
|
442
|
+
if (!inSingle && !inDouble && ch === "\\") {
|
|
443
|
+
escaped = true;
|
|
444
|
+
buf += ch;
|
|
445
|
+
continue;
|
|
446
|
+
}
|
|
447
|
+
if (inSingle) {
|
|
448
|
+
if (ch === "'")
|
|
449
|
+
inSingle = false;
|
|
450
|
+
buf += ch;
|
|
451
|
+
continue;
|
|
452
|
+
}
|
|
453
|
+
if (inDouble) {
|
|
454
|
+
if (ch === '"')
|
|
455
|
+
inDouble = false;
|
|
456
|
+
buf += ch;
|
|
457
|
+
continue;
|
|
458
|
+
}
|
|
459
|
+
if (ch === "'") {
|
|
460
|
+
inSingle = true;
|
|
461
|
+
buf += ch;
|
|
462
|
+
continue;
|
|
463
|
+
}
|
|
464
|
+
if (ch === '"') {
|
|
465
|
+
inDouble = true;
|
|
466
|
+
buf += ch;
|
|
467
|
+
continue;
|
|
468
|
+
}
|
|
469
|
+
const action = onChar(ch, next, i);
|
|
470
|
+
if (typeof action === "object" && "reject" in action) {
|
|
471
|
+
return { ok: false, reason: action.reject };
|
|
472
|
+
}
|
|
473
|
+
if (action === "split") {
|
|
474
|
+
pushPart();
|
|
475
|
+
hasSplit = true;
|
|
476
|
+
continue;
|
|
477
|
+
}
|
|
478
|
+
if (action === "skip") {
|
|
479
|
+
continue;
|
|
480
|
+
}
|
|
481
|
+
buf += ch;
|
|
482
|
+
}
|
|
483
|
+
if (escaped || inSingle || inDouble) {
|
|
484
|
+
return { ok: false, reason: "unterminated shell quote/escape" };
|
|
485
|
+
}
|
|
486
|
+
pushPart();
|
|
487
|
+
return { ok: true, parts, hasSplit };
|
|
488
|
+
}
|
|
489
|
+
function splitShellPipeline(command) {
|
|
490
|
+
let emptySegment = false;
|
|
491
|
+
const result = iterateQuoteAware(command, (ch, next) => {
|
|
492
|
+
if (ch === "|" && next === "|") {
|
|
493
|
+
return { reject: "unsupported shell token: ||" };
|
|
494
|
+
}
|
|
495
|
+
if (ch === "|" && next === "&") {
|
|
496
|
+
return { reject: "unsupported shell token: |&" };
|
|
497
|
+
}
|
|
498
|
+
if (ch === "|") {
|
|
499
|
+
emptySegment = true;
|
|
500
|
+
return "split";
|
|
501
|
+
}
|
|
502
|
+
if (ch === "&" || ch === ";") {
|
|
503
|
+
return { reject: `unsupported shell token: ${ch}` };
|
|
504
|
+
}
|
|
505
|
+
if (DISALLOWED_PIPELINE_TOKENS.has(ch)) {
|
|
506
|
+
return { reject: `unsupported shell token: ${ch}` };
|
|
507
|
+
}
|
|
508
|
+
if (ch === "$" && next === "(") {
|
|
509
|
+
return { reject: "unsupported shell token: $()" };
|
|
510
|
+
}
|
|
511
|
+
emptySegment = false;
|
|
512
|
+
return "include";
|
|
513
|
+
});
|
|
514
|
+
if (!result.ok) {
|
|
515
|
+
return { ok: false, reason: result.reason, segments: [] };
|
|
516
|
+
}
|
|
517
|
+
if (emptySegment || result.parts.length === 0) {
|
|
518
|
+
return {
|
|
519
|
+
ok: false,
|
|
520
|
+
reason: result.parts.length === 0 ? "empty command" : "empty pipeline segment",
|
|
521
|
+
segments: [],
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
return { ok: true, segments: result.parts };
|
|
525
|
+
}
|
|
526
|
+
function tokenizeShellSegment(segment) {
|
|
527
|
+
const tokens = [];
|
|
528
|
+
let buf = "";
|
|
529
|
+
let inSingle = false;
|
|
530
|
+
let inDouble = false;
|
|
531
|
+
let escaped = false;
|
|
532
|
+
const pushToken = () => {
|
|
533
|
+
if (buf.length > 0) {
|
|
534
|
+
tokens.push(buf);
|
|
535
|
+
buf = "";
|
|
536
|
+
}
|
|
537
|
+
};
|
|
538
|
+
for (let i = 0; i < segment.length; i += 1) {
|
|
539
|
+
const ch = segment[i];
|
|
540
|
+
if (escaped) {
|
|
541
|
+
buf += ch;
|
|
542
|
+
escaped = false;
|
|
543
|
+
continue;
|
|
544
|
+
}
|
|
545
|
+
if (!inSingle && !inDouble && ch === "\\") {
|
|
546
|
+
escaped = true;
|
|
547
|
+
continue;
|
|
548
|
+
}
|
|
549
|
+
if (inSingle) {
|
|
550
|
+
if (ch === "'") {
|
|
551
|
+
inSingle = false;
|
|
552
|
+
}
|
|
553
|
+
else {
|
|
554
|
+
buf += ch;
|
|
555
|
+
}
|
|
556
|
+
continue;
|
|
557
|
+
}
|
|
558
|
+
if (inDouble) {
|
|
559
|
+
if (ch === '"') {
|
|
560
|
+
inDouble = false;
|
|
561
|
+
}
|
|
562
|
+
else {
|
|
563
|
+
buf += ch;
|
|
564
|
+
}
|
|
565
|
+
continue;
|
|
566
|
+
}
|
|
567
|
+
if (ch === "'") {
|
|
568
|
+
inSingle = true;
|
|
569
|
+
continue;
|
|
570
|
+
}
|
|
571
|
+
if (ch === '"') {
|
|
572
|
+
inDouble = true;
|
|
573
|
+
continue;
|
|
574
|
+
}
|
|
575
|
+
if (/\s/.test(ch)) {
|
|
576
|
+
pushToken();
|
|
577
|
+
continue;
|
|
578
|
+
}
|
|
579
|
+
buf += ch;
|
|
580
|
+
}
|
|
581
|
+
if (escaped || inSingle || inDouble) {
|
|
582
|
+
return null;
|
|
583
|
+
}
|
|
584
|
+
pushToken();
|
|
585
|
+
return tokens;
|
|
586
|
+
}
|
|
587
|
+
function parseSegmentsFromParts(parts, cwd, env) {
|
|
588
|
+
const segments = [];
|
|
589
|
+
for (const raw of parts) {
|
|
590
|
+
const argv = tokenizeShellSegment(raw);
|
|
591
|
+
if (!argv || argv.length === 0) {
|
|
592
|
+
return null;
|
|
593
|
+
}
|
|
594
|
+
segments.push({
|
|
595
|
+
raw,
|
|
596
|
+
argv,
|
|
597
|
+
resolution: resolveCommandResolutionFromArgv(argv, cwd, env),
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
return segments;
|
|
601
|
+
}
|
|
602
|
+
export function analyzeShellCommand(params) {
|
|
603
|
+
// First try splitting by chain operators (&&, ||, ;)
|
|
604
|
+
const chainParts = splitCommandChain(params.command);
|
|
605
|
+
if (chainParts) {
|
|
606
|
+
const chains = [];
|
|
607
|
+
const allSegments = [];
|
|
608
|
+
for (const part of chainParts) {
|
|
609
|
+
const pipelineSplit = splitShellPipeline(part);
|
|
610
|
+
if (!pipelineSplit.ok) {
|
|
611
|
+
return { ok: false, reason: pipelineSplit.reason, segments: [] };
|
|
612
|
+
}
|
|
613
|
+
const segments = parseSegmentsFromParts(pipelineSplit.segments, params.cwd, params.env);
|
|
614
|
+
if (!segments) {
|
|
615
|
+
return { ok: false, reason: "unable to parse shell segment", segments: [] };
|
|
616
|
+
}
|
|
617
|
+
chains.push(segments);
|
|
618
|
+
allSegments.push(...segments);
|
|
619
|
+
}
|
|
620
|
+
return { ok: true, segments: allSegments, chains };
|
|
621
|
+
}
|
|
622
|
+
// No chain operators, parse as simple pipeline
|
|
623
|
+
const split = splitShellPipeline(params.command);
|
|
624
|
+
if (!split.ok) {
|
|
625
|
+
return { ok: false, reason: split.reason, segments: [] };
|
|
626
|
+
}
|
|
627
|
+
const segments = parseSegmentsFromParts(split.segments, params.cwd, params.env);
|
|
628
|
+
if (!segments) {
|
|
629
|
+
return { ok: false, reason: "unable to parse shell segment", segments: [] };
|
|
630
|
+
}
|
|
631
|
+
return { ok: true, segments };
|
|
632
|
+
}
|
|
633
|
+
export function analyzeArgvCommand(params) {
|
|
634
|
+
const argv = params.argv.filter((entry) => entry.trim().length > 0);
|
|
635
|
+
if (argv.length === 0) {
|
|
636
|
+
return { ok: false, reason: "empty argv", segments: [] };
|
|
637
|
+
}
|
|
638
|
+
return {
|
|
639
|
+
ok: true,
|
|
640
|
+
segments: [
|
|
641
|
+
{
|
|
642
|
+
raw: argv.join(" "),
|
|
643
|
+
argv,
|
|
644
|
+
resolution: resolveCommandResolutionFromArgv(argv, params.cwd, params.env),
|
|
645
|
+
},
|
|
646
|
+
],
|
|
647
|
+
};
|
|
648
|
+
}
|
|
649
|
+
function isPathLikeToken(value) {
|
|
650
|
+
const trimmed = value.trim();
|
|
651
|
+
if (!trimmed)
|
|
652
|
+
return false;
|
|
653
|
+
if (trimmed === "-")
|
|
654
|
+
return false;
|
|
655
|
+
if (trimmed.startsWith("./") || trimmed.startsWith("../") || trimmed.startsWith("~"))
|
|
656
|
+
return true;
|
|
657
|
+
if (trimmed.startsWith("/"))
|
|
658
|
+
return true;
|
|
659
|
+
return /^[A-Za-z]:[\\/]/.test(trimmed);
|
|
660
|
+
}
|
|
661
|
+
function defaultFileExists(filePath) {
|
|
662
|
+
try {
|
|
663
|
+
return fs.existsSync(filePath);
|
|
664
|
+
}
|
|
665
|
+
catch {
|
|
666
|
+
return false;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
export function normalizeSafeBins(entries) {
|
|
670
|
+
if (!Array.isArray(entries))
|
|
671
|
+
return new Set();
|
|
672
|
+
const normalized = entries
|
|
673
|
+
.map((entry) => entry.trim().toLowerCase())
|
|
674
|
+
.filter((entry) => entry.length > 0);
|
|
675
|
+
return new Set(normalized);
|
|
676
|
+
}
|
|
677
|
+
export function resolveSafeBins(entries) {
|
|
678
|
+
if (entries === undefined)
|
|
679
|
+
return normalizeSafeBins(DEFAULT_SAFE_BINS);
|
|
680
|
+
return normalizeSafeBins(entries ?? []);
|
|
681
|
+
}
|
|
682
|
+
export function isSafeBinUsage(params) {
|
|
683
|
+
if (params.safeBins.size === 0)
|
|
684
|
+
return false;
|
|
685
|
+
const resolution = params.resolution;
|
|
686
|
+
const execName = resolution?.executableName?.toLowerCase();
|
|
687
|
+
if (!execName)
|
|
688
|
+
return false;
|
|
689
|
+
const matchesSafeBin = params.safeBins.has(execName) ||
|
|
690
|
+
(process.platform === "win32" && params.safeBins.has(path.parse(execName).name));
|
|
691
|
+
if (!matchesSafeBin)
|
|
692
|
+
return false;
|
|
693
|
+
if (!resolution?.resolvedPath)
|
|
694
|
+
return false;
|
|
695
|
+
const cwd = params.cwd ?? process.cwd();
|
|
696
|
+
const exists = params.fileExists ?? defaultFileExists;
|
|
697
|
+
const argv = params.argv.slice(1);
|
|
698
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
699
|
+
const token = argv[i];
|
|
700
|
+
if (!token)
|
|
701
|
+
continue;
|
|
702
|
+
if (token === "-")
|
|
703
|
+
continue;
|
|
704
|
+
if (token.startsWith("-")) {
|
|
705
|
+
const eqIndex = token.indexOf("=");
|
|
706
|
+
if (eqIndex > 0) {
|
|
707
|
+
const value = token.slice(eqIndex + 1);
|
|
708
|
+
if (value && (isPathLikeToken(value) || exists(path.resolve(cwd, value)))) {
|
|
709
|
+
return false;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
continue;
|
|
713
|
+
}
|
|
714
|
+
if (isPathLikeToken(token))
|
|
715
|
+
return false;
|
|
716
|
+
if (exists(path.resolve(cwd, token)))
|
|
717
|
+
return false;
|
|
718
|
+
}
|
|
719
|
+
return true;
|
|
720
|
+
}
|
|
721
|
+
function evaluateSegments(segments, params) {
|
|
722
|
+
const matches = [];
|
|
723
|
+
const allowSkills = params.autoAllowSkills === true && (params.skillBins?.size ?? 0) > 0;
|
|
724
|
+
const satisfied = segments.every((segment) => {
|
|
725
|
+
const candidatePath = resolveAllowlistCandidatePath(segment.resolution, params.cwd);
|
|
726
|
+
const candidateResolution = candidatePath && segment.resolution
|
|
727
|
+
? { ...segment.resolution, resolvedPath: candidatePath }
|
|
728
|
+
: segment.resolution;
|
|
729
|
+
const match = matchAllowlist(params.allowlist, candidateResolution);
|
|
730
|
+
if (match)
|
|
731
|
+
matches.push(match);
|
|
732
|
+
const safe = isSafeBinUsage({
|
|
733
|
+
argv: segment.argv,
|
|
734
|
+
resolution: segment.resolution,
|
|
735
|
+
safeBins: params.safeBins,
|
|
736
|
+
cwd: params.cwd,
|
|
737
|
+
});
|
|
738
|
+
const skillAllow = allowSkills && segment.resolution?.executableName
|
|
739
|
+
? params.skillBins?.has(segment.resolution.executableName)
|
|
740
|
+
: false;
|
|
741
|
+
return Boolean(match || safe || skillAllow);
|
|
742
|
+
});
|
|
743
|
+
return { satisfied, matches };
|
|
744
|
+
}
|
|
745
|
+
export function evaluateExecAllowlist(params) {
|
|
746
|
+
const allowlistMatches = [];
|
|
747
|
+
if (!params.analysis.ok || params.analysis.segments.length === 0) {
|
|
748
|
+
return { allowlistSatisfied: false, allowlistMatches };
|
|
749
|
+
}
|
|
750
|
+
// If the analysis contains chains, evaluate each chain part separately
|
|
751
|
+
if (params.analysis.chains) {
|
|
752
|
+
for (const chainSegments of params.analysis.chains) {
|
|
753
|
+
const result = evaluateSegments(chainSegments, {
|
|
754
|
+
allowlist: params.allowlist,
|
|
755
|
+
safeBins: params.safeBins,
|
|
756
|
+
cwd: params.cwd,
|
|
757
|
+
skillBins: params.skillBins,
|
|
758
|
+
autoAllowSkills: params.autoAllowSkills,
|
|
759
|
+
});
|
|
760
|
+
if (!result.satisfied) {
|
|
761
|
+
return { allowlistSatisfied: false, allowlistMatches: [] };
|
|
762
|
+
}
|
|
763
|
+
allowlistMatches.push(...result.matches);
|
|
764
|
+
}
|
|
765
|
+
return { allowlistSatisfied: true, allowlistMatches };
|
|
766
|
+
}
|
|
767
|
+
// No chains, evaluate all segments together
|
|
768
|
+
const result = evaluateSegments(params.analysis.segments, {
|
|
769
|
+
allowlist: params.allowlist,
|
|
770
|
+
safeBins: params.safeBins,
|
|
771
|
+
cwd: params.cwd,
|
|
772
|
+
skillBins: params.skillBins,
|
|
773
|
+
autoAllowSkills: params.autoAllowSkills,
|
|
774
|
+
});
|
|
775
|
+
return { allowlistSatisfied: result.satisfied, allowlistMatches: result.matches };
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* Splits a command string by chain operators (&&, ||, ;) while respecting quotes.
|
|
779
|
+
* Returns null when no chain is present or when the chain is malformed.
|
|
780
|
+
*/
|
|
781
|
+
function splitCommandChain(command) {
|
|
782
|
+
const parts = [];
|
|
783
|
+
let buf = "";
|
|
784
|
+
let inSingle = false;
|
|
785
|
+
let inDouble = false;
|
|
786
|
+
let escaped = false;
|
|
787
|
+
let foundChain = false;
|
|
788
|
+
let invalidChain = false;
|
|
789
|
+
const pushPart = () => {
|
|
790
|
+
const trimmed = buf.trim();
|
|
791
|
+
if (trimmed) {
|
|
792
|
+
parts.push(trimmed);
|
|
793
|
+
buf = "";
|
|
794
|
+
return true;
|
|
795
|
+
}
|
|
796
|
+
buf = "";
|
|
797
|
+
return false;
|
|
798
|
+
};
|
|
799
|
+
for (let i = 0; i < command.length; i += 1) {
|
|
800
|
+
const ch = command[i];
|
|
801
|
+
if (escaped) {
|
|
802
|
+
buf += ch;
|
|
803
|
+
escaped = false;
|
|
804
|
+
continue;
|
|
805
|
+
}
|
|
806
|
+
if (!inSingle && !inDouble && ch === "\\") {
|
|
807
|
+
escaped = true;
|
|
808
|
+
buf += ch;
|
|
809
|
+
continue;
|
|
810
|
+
}
|
|
811
|
+
if (inSingle) {
|
|
812
|
+
if (ch === "'")
|
|
813
|
+
inSingle = false;
|
|
814
|
+
buf += ch;
|
|
815
|
+
continue;
|
|
816
|
+
}
|
|
817
|
+
if (inDouble) {
|
|
818
|
+
if (ch === '"')
|
|
819
|
+
inDouble = false;
|
|
820
|
+
buf += ch;
|
|
821
|
+
continue;
|
|
822
|
+
}
|
|
823
|
+
if (ch === "'") {
|
|
824
|
+
inSingle = true;
|
|
825
|
+
buf += ch;
|
|
826
|
+
continue;
|
|
827
|
+
}
|
|
828
|
+
if (ch === '"') {
|
|
829
|
+
inDouble = true;
|
|
830
|
+
buf += ch;
|
|
831
|
+
continue;
|
|
832
|
+
}
|
|
833
|
+
if (ch === "&" && command[i + 1] === "&") {
|
|
834
|
+
if (!pushPart())
|
|
835
|
+
invalidChain = true;
|
|
836
|
+
i += 1;
|
|
837
|
+
foundChain = true;
|
|
838
|
+
continue;
|
|
839
|
+
}
|
|
840
|
+
if (ch === "|" && command[i + 1] === "|") {
|
|
841
|
+
if (!pushPart())
|
|
842
|
+
invalidChain = true;
|
|
843
|
+
i += 1;
|
|
844
|
+
foundChain = true;
|
|
845
|
+
continue;
|
|
846
|
+
}
|
|
847
|
+
if (ch === ";") {
|
|
848
|
+
if (!pushPart())
|
|
849
|
+
invalidChain = true;
|
|
850
|
+
foundChain = true;
|
|
851
|
+
continue;
|
|
852
|
+
}
|
|
853
|
+
buf += ch;
|
|
854
|
+
}
|
|
855
|
+
const pushedFinal = pushPart();
|
|
856
|
+
if (!foundChain)
|
|
857
|
+
return null;
|
|
858
|
+
if (invalidChain || !pushedFinal)
|
|
859
|
+
return null;
|
|
860
|
+
return parts.length > 0 ? parts : null;
|
|
861
|
+
}
|
|
862
|
+
/**
|
|
863
|
+
* Evaluates allowlist for shell commands (including &&, ||, ;) and returns analysis metadata.
|
|
864
|
+
*/
|
|
865
|
+
export function evaluateShellAllowlist(params) {
|
|
866
|
+
const chainParts = splitCommandChain(params.command);
|
|
867
|
+
if (!chainParts) {
|
|
868
|
+
const analysis = analyzeShellCommand({
|
|
869
|
+
command: params.command,
|
|
870
|
+
cwd: params.cwd,
|
|
871
|
+
env: params.env,
|
|
872
|
+
});
|
|
873
|
+
if (!analysis.ok) {
|
|
874
|
+
return {
|
|
875
|
+
analysisOk: false,
|
|
876
|
+
allowlistSatisfied: false,
|
|
877
|
+
allowlistMatches: [],
|
|
878
|
+
segments: [],
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
const evaluation = evaluateExecAllowlist({
|
|
882
|
+
analysis,
|
|
883
|
+
allowlist: params.allowlist,
|
|
884
|
+
safeBins: params.safeBins,
|
|
885
|
+
cwd: params.cwd,
|
|
886
|
+
skillBins: params.skillBins,
|
|
887
|
+
autoAllowSkills: params.autoAllowSkills,
|
|
888
|
+
});
|
|
889
|
+
return {
|
|
890
|
+
analysisOk: true,
|
|
891
|
+
allowlistSatisfied: evaluation.allowlistSatisfied,
|
|
892
|
+
allowlistMatches: evaluation.allowlistMatches,
|
|
893
|
+
segments: analysis.segments,
|
|
894
|
+
};
|
|
895
|
+
}
|
|
896
|
+
const allowlistMatches = [];
|
|
897
|
+
const segments = [];
|
|
898
|
+
for (const part of chainParts) {
|
|
899
|
+
const analysis = analyzeShellCommand({
|
|
900
|
+
command: part,
|
|
901
|
+
cwd: params.cwd,
|
|
902
|
+
env: params.env,
|
|
903
|
+
});
|
|
904
|
+
if (!analysis.ok) {
|
|
905
|
+
return {
|
|
906
|
+
analysisOk: false,
|
|
907
|
+
allowlistSatisfied: false,
|
|
908
|
+
allowlistMatches: [],
|
|
909
|
+
segments: [],
|
|
910
|
+
};
|
|
911
|
+
}
|
|
912
|
+
segments.push(...analysis.segments);
|
|
913
|
+
const evaluation = evaluateExecAllowlist({
|
|
914
|
+
analysis,
|
|
915
|
+
allowlist: params.allowlist,
|
|
916
|
+
safeBins: params.safeBins,
|
|
917
|
+
cwd: params.cwd,
|
|
918
|
+
skillBins: params.skillBins,
|
|
919
|
+
autoAllowSkills: params.autoAllowSkills,
|
|
920
|
+
});
|
|
921
|
+
allowlistMatches.push(...evaluation.allowlistMatches);
|
|
922
|
+
if (!evaluation.allowlistSatisfied) {
|
|
923
|
+
return {
|
|
924
|
+
analysisOk: true,
|
|
925
|
+
allowlistSatisfied: false,
|
|
926
|
+
allowlistMatches,
|
|
927
|
+
segments,
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
return {
|
|
932
|
+
analysisOk: true,
|
|
933
|
+
allowlistSatisfied: true,
|
|
934
|
+
allowlistMatches,
|
|
935
|
+
segments,
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
export function requiresExecApproval(params) {
|
|
939
|
+
return (params.ask === "always" ||
|
|
940
|
+
(params.ask === "on-miss" &&
|
|
941
|
+
params.security === "allowlist" &&
|
|
942
|
+
(!params.analysisOk || !params.allowlistSatisfied)));
|
|
943
|
+
}
|
|
944
|
+
export function recordAllowlistUse(approvals, agentId, entry, command, resolvedPath) {
|
|
945
|
+
const target = agentId ?? DEFAULT_AGENT_ID;
|
|
946
|
+
const agents = approvals.agents ?? {};
|
|
947
|
+
const existing = agents[target] ?? {};
|
|
948
|
+
const allowlist = Array.isArray(existing.allowlist) ? existing.allowlist : [];
|
|
949
|
+
const nextAllowlist = allowlist.map((item) => item.pattern === entry.pattern
|
|
950
|
+
? {
|
|
951
|
+
...item,
|
|
952
|
+
id: item.id ?? crypto.randomUUID(),
|
|
953
|
+
lastUsedAt: Date.now(),
|
|
954
|
+
lastUsedCommand: command,
|
|
955
|
+
lastResolvedPath: resolvedPath,
|
|
956
|
+
}
|
|
957
|
+
: item);
|
|
958
|
+
agents[target] = { ...existing, allowlist: nextAllowlist };
|
|
959
|
+
approvals.agents = agents;
|
|
960
|
+
saveExecApprovals(approvals);
|
|
961
|
+
}
|
|
962
|
+
export function addAllowlistEntry(approvals, agentId, pattern) {
|
|
963
|
+
const target = agentId ?? DEFAULT_AGENT_ID;
|
|
964
|
+
const agents = approvals.agents ?? {};
|
|
965
|
+
const existing = agents[target] ?? {};
|
|
966
|
+
const allowlist = Array.isArray(existing.allowlist) ? existing.allowlist : [];
|
|
967
|
+
const trimmed = pattern.trim();
|
|
968
|
+
if (!trimmed)
|
|
969
|
+
return;
|
|
970
|
+
if (allowlist.some((entry) => entry.pattern === trimmed))
|
|
971
|
+
return;
|
|
972
|
+
allowlist.push({ id: crypto.randomUUID(), pattern: trimmed, lastUsedAt: Date.now() });
|
|
973
|
+
agents[target] = { ...existing, allowlist };
|
|
974
|
+
approvals.agents = agents;
|
|
975
|
+
saveExecApprovals(approvals);
|
|
976
|
+
}
|
|
977
|
+
export function minSecurity(a, b) {
|
|
978
|
+
const order = { deny: 0, allowlist: 1, full: 2 };
|
|
979
|
+
return order[a] <= order[b] ? a : b;
|
|
980
|
+
}
|
|
981
|
+
export function maxAsk(a, b) {
|
|
982
|
+
const order = { off: 0, "on-miss": 1, always: 2 };
|
|
983
|
+
return order[a] >= order[b] ? a : b;
|
|
984
|
+
}
|
|
985
|
+
export async function requestExecApprovalViaSocket(params) {
|
|
986
|
+
const { socketPath, token, request } = params;
|
|
987
|
+
if (!socketPath || !token)
|
|
988
|
+
return null;
|
|
989
|
+
const timeoutMs = params.timeoutMs ?? 15_000;
|
|
990
|
+
return await new Promise((resolve) => {
|
|
991
|
+
const client = new net.Socket();
|
|
992
|
+
let settled = false;
|
|
993
|
+
let buffer = "";
|
|
994
|
+
const finish = (value) => {
|
|
995
|
+
if (settled)
|
|
996
|
+
return;
|
|
997
|
+
settled = true;
|
|
998
|
+
try {
|
|
999
|
+
client.destroy();
|
|
1000
|
+
}
|
|
1001
|
+
catch {
|
|
1002
|
+
// ignore
|
|
1003
|
+
}
|
|
1004
|
+
resolve(value);
|
|
1005
|
+
};
|
|
1006
|
+
const timer = setTimeout(() => finish(null), timeoutMs);
|
|
1007
|
+
const payload = JSON.stringify({
|
|
1008
|
+
type: "request",
|
|
1009
|
+
token,
|
|
1010
|
+
id: crypto.randomUUID(),
|
|
1011
|
+
request,
|
|
1012
|
+
});
|
|
1013
|
+
client.on("error", () => finish(null));
|
|
1014
|
+
client.connect(socketPath, () => {
|
|
1015
|
+
client.write(`${payload}\n`);
|
|
1016
|
+
});
|
|
1017
|
+
client.on("data", (data) => {
|
|
1018
|
+
buffer += data.toString("utf8");
|
|
1019
|
+
let idx = buffer.indexOf("\n");
|
|
1020
|
+
while (idx !== -1) {
|
|
1021
|
+
const line = buffer.slice(0, idx).trim();
|
|
1022
|
+
buffer = buffer.slice(idx + 1);
|
|
1023
|
+
idx = buffer.indexOf("\n");
|
|
1024
|
+
if (!line)
|
|
1025
|
+
continue;
|
|
1026
|
+
try {
|
|
1027
|
+
const msg = JSON.parse(line);
|
|
1028
|
+
if (msg?.type === "decision" && msg.decision) {
|
|
1029
|
+
clearTimeout(timer);
|
|
1030
|
+
finish(msg.decision);
|
|
1031
|
+
return;
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
catch {
|
|
1035
|
+
// ignore
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
});
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
//# sourceMappingURL=exec-approvals.js.map
|