@phnx-labs/agents-cli 1.22.39 → 1.22.41
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/CHANGELOG.md +316 -0
- package/README.md +116 -70
- package/dist/bin/agents +0 -0
- package/dist/bootstrap.js +45 -27
- package/dist/browser.js +2 -2
- package/dist/cli/command-registry.d.ts +135 -0
- package/dist/cli/command-registry.js +259 -0
- package/dist/commands/accounts.d.ts +20 -0
- package/dist/commands/accounts.js +186 -25
- package/dist/commands/apply.d.ts +3 -3
- package/dist/commands/apply.js +20 -63
- package/dist/commands/browser.d.ts +15 -0
- package/dist/commands/browser.js +318 -131
- package/dist/commands/budget.d.ts +7 -6
- package/dist/commands/budget.js +8 -7
- package/dist/commands/cloud.js +17 -20
- package/dist/commands/commands.js +1 -1
- package/dist/commands/computer-actions.d.ts +1 -35
- package/dist/commands/computer-actions.js +13 -181
- package/dist/commands/computer.d.ts +28 -3
- package/dist/commands/computer.js +93 -65
- package/dist/commands/config.js +16 -3
- package/dist/commands/cost.d.ts +2 -1
- package/dist/commands/cost.js +7 -6
- package/dist/commands/daemon.js +151 -4
- package/dist/commands/detach.js +1 -1
- package/dist/commands/doctor.js +19 -11
- package/dist/commands/events.js +1 -1
- package/dist/commands/exec.d.ts +2 -50
- package/dist/commands/exec.js +160 -215
- package/dist/commands/factory.js +1 -1
- package/dist/commands/feed.d.ts +2 -2
- package/dist/commands/feed.js +12 -23
- package/dist/commands/fleet-capture.js +25 -27
- package/dist/commands/focus.d.ts +2 -3
- package/dist/commands/focus.js +34 -9
- package/dist/commands/go.js +15 -5
- package/dist/commands/harness.d.ts +3 -3
- package/dist/commands/harness.js +53 -5
- package/dist/commands/hooks.js +1 -1
- package/dist/commands/import.js +2 -2
- package/dist/commands/insights.d.ts +5 -5
- package/dist/commands/insights.js +15 -9
- package/dist/commands/inspect.d.ts +2 -3
- package/dist/commands/inspect.js +4 -16
- package/dist/commands/logs.d.ts +2 -2
- package/dist/commands/logs.js +9 -9
- package/dist/commands/mcp.js +2 -2
- package/dist/commands/memory.js +1 -1
- package/dist/commands/message.d.ts +1 -1
- package/dist/commands/message.js +7 -7
- package/dist/commands/mine.d.ts +11 -8
- package/dist/commands/mine.js +11 -10
- package/dist/commands/models.js +1 -1
- package/dist/commands/modes.js +1 -1
- package/dist/commands/monitors.js +23 -6
- package/dist/commands/output.d.ts +7 -6
- package/dist/commands/output.js +11 -10
- package/dist/commands/packages.js +4 -4
- package/dist/commands/perf.js +1 -1
- package/dist/commands/permissions.js +49 -32
- package/dist/commands/plugins.d.ts +1 -1
- package/dist/commands/plugins.js +3 -3
- package/dist/commands/profiles.d.ts +6 -9
- package/dist/commands/profiles.js +8 -321
- package/dist/commands/projects.d.ts +9 -0
- package/dist/commands/projects.js +140 -8
- package/dist/commands/prune.js +5 -13
- package/dist/commands/refresh-rules.js +1 -1
- package/dist/commands/repo.d.ts +5 -7
- package/dist/commands/repo.js +34 -18
- package/dist/commands/resource-view.js +4 -0
- package/dist/commands/resume.d.ts +11 -7
- package/dist/commands/resume.js +82 -98
- package/dist/commands/route.d.ts +12 -0
- package/dist/commands/route.js +261 -0
- package/dist/commands/routines.d.ts +2 -3
- package/dist/commands/routines.js +120 -145
- package/dist/commands/rules.js +1 -1
- package/dist/commands/run-account-picker.d.ts +1 -1
- package/dist/commands/run-account-picker.js +2 -2
- package/dist/commands/run-broadcast.d.ts +21 -0
- package/dist/commands/run-broadcast.js +89 -0
- package/dist/commands/run-cloud.js +1 -1
- package/dist/commands/secrets-vault.d.ts +10 -0
- package/dist/commands/{login.js → secrets-vault.js} +34 -14
- package/dist/commands/secrets.d.ts +4 -4
- package/dist/commands/secrets.js +158 -159
- package/dist/commands/sessions-backfill.js +1 -1
- package/dist/commands/sessions-browser.d.ts +1 -1
- package/dist/commands/sessions-browser.js +9 -5
- package/dist/commands/sessions-export.js +2 -2
- package/dist/commands/sessions-inject.js +4 -5
- package/dist/commands/sessions-migrate.js +16 -27
- package/dist/commands/sessions-picker.d.ts +14 -0
- package/dist/commands/sessions-picker.js +209 -13
- package/dist/commands/sessions-resume.d.ts +7 -3
- package/dist/commands/sessions-resume.js +81 -33
- package/dist/commands/sessions-share.d.ts +25 -0
- package/dist/commands/sessions-share.js +166 -0
- package/dist/commands/sessions-stats.js +2 -2
- package/dist/commands/sessions.d.ts +75 -68
- package/dist/commands/sessions.js +144 -180
- package/dist/commands/setup-browser.js +1 -1
- package/dist/commands/setup-computer.js +1 -1
- package/dist/commands/setup-fleet.js +3 -0
- package/dist/commands/setup-mine.d.ts +7 -3
- package/dist/commands/setup-mine.js +13 -8
- package/dist/commands/setup-preferences.js +2 -2
- package/dist/commands/setup-secrets.js +2 -2
- package/dist/commands/setup-watchdog.js +2 -2
- package/dist/commands/setup.js +7 -2
- package/dist/commands/share.d.ts +65 -0
- package/dist/commands/share.js +253 -20
- package/dist/commands/skills.js +3 -3
- package/dist/commands/snapshot.d.ts +2 -2
- package/dist/commands/snapshot.js +9 -9
- package/dist/commands/ssh.d.ts +1 -1
- package/dist/commands/ssh.js +186 -64
- package/dist/commands/subagents.js +1 -1
- package/dist/commands/sync.js +24 -9
- package/dist/commands/teams.d.ts +2 -2
- package/dist/commands/teams.js +9 -18
- package/dist/commands/tmux.js +5 -1
- package/dist/commands/trash.js +1 -1
- package/dist/commands/usage.d.ts +1 -1
- package/dist/commands/usage.js +2 -2
- package/dist/commands/utils.d.ts +4 -14
- package/dist/commands/utils.js +6 -27
- package/dist/commands/versions.js +2 -2
- package/dist/commands/view.d.ts +9 -77
- package/dist/commands/view.js +23 -8
- package/dist/commands/watchdog.js +1 -1
- package/dist/commands/webhook.js +25 -34
- package/dist/commands/workflows.js +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/account-capabilities.d.ts +39 -0
- package/dist/lib/account-capabilities.js +59 -0
- package/dist/lib/account-catalog.js +1 -1
- package/dist/lib/account-registry.d.ts +66 -0
- package/dist/lib/account-registry.js +151 -5
- package/dist/lib/{rotate.d.ts → accounting/rotate.d.ts} +4 -4
- package/dist/lib/{rotate.js → accounting/rotate.js} +8 -8
- package/dist/lib/{usage.d.ts → accounting/usage.d.ts} +4 -4
- package/dist/lib/{usage.js → accounting/usage.js} +11 -11
- package/dist/lib/agent-spec/provider.js +1 -1
- package/dist/lib/agents.d.ts +72 -4
- package/dist/lib/agents.js +231 -199
- package/dist/lib/answer-router.d.ts +2 -2
- package/dist/lib/ask-classifier.d.ts +1 -1
- package/dist/lib/ask-classifier.js +1 -1
- package/dist/lib/audit/log.js +1 -1
- package/dist/lib/auth-health.d.ts +1 -1
- package/dist/lib/auth-health.js +2 -2
- package/dist/lib/brand.js +1 -1
- package/dist/lib/browser/caller-identity.d.ts +28 -0
- package/dist/lib/browser/caller-identity.js +156 -0
- package/dist/lib/browser/cdp.js +5 -1
- package/dist/lib/browser/chrome.js +12 -1
- package/dist/lib/browser/drivers/ssh.d.ts +1 -1
- package/dist/lib/browser/drivers/ssh.js +3 -2
- package/dist/lib/browser/hygiene.d.ts +10 -2
- package/dist/lib/browser/hygiene.js +7 -4
- package/dist/lib/browser/ipc.d.ts +22 -2
- package/dist/lib/browser/ipc.js +185 -21
- package/dist/lib/browser/profiles.d.ts +69 -5
- package/dist/lib/browser/profiles.js +135 -13
- package/dist/lib/browser/remote-control.d.ts +2 -2
- package/dist/lib/browser/remote-control.js +3 -3
- package/dist/lib/browser/runtime-state.d.ts +79 -0
- package/dist/lib/browser/runtime-state.js +119 -1
- package/dist/lib/browser/service.d.ts +137 -2
- package/dist/lib/browser/service.js +492 -54
- package/dist/lib/browser/sessions-list.d.ts +2 -1
- package/dist/lib/browser/sessions-list.js +4 -13
- package/dist/lib/browser/types.d.ts +19 -1
- package/dist/lib/budget/config.js +1 -1
- package/dist/lib/budget/ledger.js +1 -1
- package/dist/lib/byok-usage.js +1 -1
- package/dist/lib/capabilities.js +3 -15
- package/dist/lib/catchup.d.ts +1 -1
- package/dist/lib/catchup.js +1 -1
- package/dist/lib/cloud/dispatch.js +1 -1
- package/dist/lib/cloud/host.d.ts +3 -3
- package/dist/lib/cloud/host.js +5 -5
- package/dist/lib/cloud/rush.d.ts +9 -21
- package/dist/lib/cloud/rush.js +33 -120
- package/dist/lib/cloud/types.d.ts +2 -2
- package/dist/lib/commands.js +3 -13
- package/dist/lib/computer/actions.d.ts +36 -0
- package/dist/lib/computer/actions.js +162 -0
- package/dist/lib/computer/dispatch.d.ts +2 -2
- package/dist/lib/computer/dispatch.js +2 -2
- package/dist/lib/computer/sessions-list.d.ts +3 -3
- package/dist/lib/computer/sessions-list.js +2 -2
- package/dist/lib/config-keys.d.ts +2 -1
- package/dist/lib/config-keys.js +8 -4
- package/dist/lib/config-machine-keys.d.ts +4 -2
- package/dist/lib/config-machine-keys.js +5 -2
- package/dist/lib/crabbox/lease.js +9 -1
- package/dist/lib/crabbox/runtimes.d.ts +32 -7
- package/dist/lib/crabbox/runtimes.js +72 -30
- package/dist/lib/{daemon.d.ts → daemon/daemon.d.ts} +59 -1
- package/dist/lib/{daemon.js → daemon/daemon.js} +237 -49
- package/dist/lib/daemon-services.d.ts +1 -1
- package/dist/lib/daemon-services.js +5 -0
- package/dist/lib/daemon-ticks.d.ts +25 -0
- package/dist/lib/daemon-ticks.js +31 -1
- package/dist/lib/daemon-webhooks.d.ts +104 -0
- package/dist/lib/daemon-webhooks.js +215 -0
- package/dist/lib/device-config.d.ts +85 -75
- package/dist/lib/device-config.js +280 -142
- package/dist/lib/devices/config-migration.d.ts +29 -34
- package/dist/lib/devices/config-migration.js +209 -130
- package/dist/lib/devices/connect.d.ts +2 -2
- package/dist/lib/devices/connect.js +2 -2
- package/dist/lib/devices/discovery-policy.d.ts +30 -0
- package/dist/lib/devices/discovery-policy.js +101 -0
- package/dist/lib/devices/fleet-inventory.js +8 -3
- package/dist/lib/devices/harness-inventory.d.ts +1 -1
- package/dist/lib/devices/harness-inventory.js +12 -3
- package/dist/lib/devices/known-hosts.js +1 -1
- package/dist/lib/devices/pool.d.ts +10 -5
- package/dist/lib/devices/pool.js +5 -7
- package/dist/lib/devices/registry.d.ts +1 -1
- package/dist/lib/devices/registry.js +1 -1
- package/dist/lib/devices/resolve-profile.d.ts +2 -2
- package/dist/lib/devices/resolve-profile.js +2 -2
- package/dist/lib/devices/resolve-target.d.ts +1 -1
- package/dist/lib/devices/resolve-target.js +4 -4
- package/dist/lib/devices/self-host.d.ts +1 -1
- package/dist/lib/devices/self-host.js +3 -3
- package/dist/lib/devices/ssh-config.d.ts +1 -1
- package/dist/lib/devices/stats-cache.js +1 -1
- package/dist/lib/devices/sync.d.ts +3 -1
- package/dist/lib/devices/sync.js +3 -3
- package/dist/lib/doctor-diff.js +4 -4
- package/dist/lib/drift-sync.js +2 -2
- package/dist/lib/drift.js +2 -2
- package/dist/lib/event-families.d.ts +1 -1
- package/dist/lib/event-stream.d.ts +1 -1
- package/dist/lib/event-stream.js +2 -2
- package/dist/lib/events-ingest.js +2 -2
- package/dist/lib/exec.d.ts +4 -4
- package/dist/lib/exec.js +11 -11
- package/dist/lib/factory/snapshot.d.ts +1 -1
- package/dist/lib/factory/snapshot.js +1 -1
- package/dist/lib/{activity.d.ts → feed/activity.d.ts} +1 -1
- package/dist/lib/{activity.js → feed/activity.js} +7 -7
- package/dist/lib/{events.d.ts → feed/events.d.ts} +2 -2
- package/dist/lib/{events.js → feed/events.js} +5 -5
- package/dist/lib/{feed.js → feed/feed.js} +4 -4
- package/dist/lib/feed-outcome.d.ts +1 -1
- package/dist/lib/feed-policy.d.ts +1 -1
- package/dist/lib/feed-policy.js +1 -1
- package/dist/lib/feed-post.d.ts +1 -1
- package/dist/lib/feed-post.js +1 -1
- package/dist/lib/feed-ranking.d.ts +1 -1
- package/dist/lib/fleet/apply.d.ts +0 -6
- package/dist/lib/fleet/apply.js +18 -45
- package/dist/lib/fleet/auth-sync.d.ts +16 -35
- package/dist/lib/fleet/auth-sync.js +16 -75
- package/dist/lib/fleet/capture.js +8 -6
- package/dist/lib/fleet/manifest.js +23 -11
- package/dist/lib/fleet/types.d.ts +19 -7
- package/dist/lib/fleet-cache.d.ts +1 -1
- package/dist/lib/fleet-cache.js +1 -1
- package/dist/lib/format.d.ts +19 -0
- package/dist/lib/format.js +44 -1
- package/dist/lib/friction-heuristics.d.ts +1 -1
- package/dist/lib/git.d.ts +24 -1
- package/dist/lib/git.js +82 -38
- package/dist/lib/heal.js +3 -3
- package/dist/lib/hooks.d.ts +18 -0
- package/dist/lib/hooks.js +113 -1
- package/dist/lib/hosts/credentials.d.ts +30 -10
- package/dist/lib/hosts/credentials.js +38 -26
- package/dist/lib/hosts/dispatch.d.ts +3 -3
- package/dist/lib/hosts/dispatch.js +3 -3
- package/dist/lib/hosts/option.d.ts +3 -3
- package/dist/lib/hosts/option.js +7 -8
- package/dist/lib/hosts/passthrough.d.ts +17 -17
- package/dist/lib/hosts/passthrough.js +67 -50
- package/dist/lib/hosts/providers/devices.d.ts +1 -1
- package/dist/lib/hosts/providers/devices.js +1 -1
- package/dist/lib/hosts/reconcile.d.ts +1 -1
- package/dist/lib/hosts/reconcile.js +1 -1
- package/dist/lib/hosts/reconnect.d.ts +1 -1
- package/dist/lib/hosts/reconnect.js +2 -2
- package/dist/lib/hosts/registry.d.ts +5 -5
- package/dist/lib/hosts/registry.js +5 -5
- package/dist/lib/hosts/remote-cmd.d.ts +10 -10
- package/dist/lib/hosts/remote-cmd.js +25 -18
- package/dist/lib/hosts/remote-os.d.ts +4 -4
- package/dist/lib/hosts/remote-os.js +4 -4
- package/dist/lib/hosts/remote-session-id.d.ts +2 -2
- package/dist/lib/hosts/remote-session-id.js +2 -2
- package/dist/lib/hosts/routing-flag.d.ts +3 -3
- package/dist/lib/hosts/routing-flag.js +4 -5
- package/dist/lib/hosts/run-target.d.ts +4 -4
- package/dist/lib/hosts/run-target.js +4 -4
- package/dist/lib/hosts/session-index.d.ts +2 -2
- package/dist/lib/hosts/session-index.js +1 -1
- package/dist/lib/hosts/session-marker.d.ts +1 -1
- package/dist/lib/hosts/session-marker.js +1 -1
- package/dist/lib/hosts/types.d.ts +2 -2
- package/dist/lib/hosts/types.js +2 -2
- package/dist/lib/import.js +1 -1
- package/dist/lib/{migrate.d.ts → installations/migrate.d.ts} +13 -1
- package/dist/lib/{migrate.js → installations/migrate.js} +160 -40
- package/dist/lib/installations/resolve.js +1 -1
- package/dist/lib/installations/strategies.js +1 -1
- package/dist/lib/installations/update.js +2 -2
- package/dist/lib/{versions.d.ts → installations/versions.d.ts} +12 -3
- package/dist/lib/{versions.js → installations/versions.js} +51 -31
- package/dist/lib/isolation-boundary-report.js +1 -1
- package/dist/lib/linear-projects.d.ts +28 -0
- package/dist/lib/linear-projects.js +30 -0
- package/dist/lib/loop.js +1 -1
- package/dist/lib/mailbox-gc.js +1 -1
- package/dist/lib/mailbox.js +1 -1
- package/dist/lib/mcp-registry.d.ts +62 -0
- package/dist/lib/mcp-registry.js +177 -0
- package/dist/lib/mcp.d.ts +5 -0
- package/dist/lib/mcp.js +124 -307
- package/dist/lib/menubar/MenubarHelper.app/Contents/CodeResources +0 -0
- package/dist/lib/menubar/MenubarHelper.app/Contents/MacOS/MenubarHelper +0 -0
- package/dist/lib/menubar/install-menubar.d.ts +7 -0
- package/dist/lib/menubar/install-menubar.js +24 -6
- package/dist/lib/menubar/snapshot.d.ts +7 -0
- package/dist/lib/menubar/snapshot.js +8 -6
- package/dist/lib/models.js +1 -1
- package/dist/lib/monitors/config.d.ts +12 -0
- package/dist/lib/monitors/config.js +3 -0
- package/dist/lib/monitors/dispatch.js +26 -5
- package/dist/lib/monitors/engine.js +10 -0
- package/dist/lib/monitors/sources/webhook.d.ts +1 -1
- package/dist/lib/monitors/state.d.ts +42 -0
- package/dist/lib/monitors/state.js +30 -0
- package/dist/lib/notify.d.ts +1 -1
- package/dist/lib/observe-aliases.d.ts +3 -3
- package/dist/lib/observe-aliases.js +3 -21
- package/dist/lib/output/git-output.js +2 -2
- package/dist/lib/overdue.d.ts +1 -1
- package/dist/lib/overdue.js +1 -1
- package/dist/lib/permissions-registry.d.ts +65 -0
- package/dist/lib/permissions-registry.js +599 -0
- package/dist/lib/permissions.d.ts +24 -13
- package/dist/lib/permissions.js +52 -271
- package/dist/lib/picker.d.ts +16 -0
- package/dist/lib/picker.js +33 -3
- package/dist/lib/placement.d.ts +1 -1
- package/dist/lib/placement.js +4 -4
- package/dist/lib/platform/paths.d.ts +8 -0
- package/dist/lib/platform/paths.js +11 -0
- package/dist/lib/platform/posixpath.js +3 -3
- package/dist/lib/{plugin-marketplace.d.ts → plugins/plugin-marketplace.d.ts} +1 -1
- package/dist/lib/{plugin-marketplace.js → plugins/plugin-marketplace.js} +2 -2
- package/dist/lib/{plugins.d.ts → plugins/plugins.d.ts} +1 -1
- package/dist/lib/{plugins.js → plugins/plugins.js} +7 -7
- package/dist/lib/{skills.d.ts → plugins/skills.d.ts} +1 -1
- package/dist/lib/{skills.js → plugins/skills.js} +7 -7
- package/dist/lib/pricing/cost.d.ts +1 -1
- package/dist/lib/pricing/cost.js +1 -1
- package/dist/lib/profiles-presets.d.ts +1 -1
- package/dist/lib/profiles-presets.js +1 -1
- package/dist/lib/profiles.js +2 -2
- package/dist/lib/project-import.js +4 -1
- package/dist/lib/project-key.js +7 -0
- package/dist/lib/project-launch.d.ts +1 -1
- package/dist/lib/project-launch.js +3 -3
- package/dist/lib/project-pull.d.ts +128 -0
- package/dist/lib/project-pull.js +384 -0
- package/dist/lib/project-root.d.ts +2 -2
- package/dist/lib/project-root.js +2 -2
- package/dist/lib/project-status.js +1 -1
- package/dist/lib/projects.d.ts +23 -0
- package/dist/lib/projects.js +29 -6
- package/dist/lib/refresh.d.ts +12 -1
- package/dist/lib/refresh.js +16 -9
- package/dist/lib/registry.d.ts +9 -2
- package/dist/lib/registry.js +11 -4
- package/dist/lib/resources.d.ts +2 -2
- package/dist/lib/resources.js +2 -2
- package/dist/lib/routers.d.ts +81 -0
- package/dist/lib/routers.js +153 -0
- package/dist/lib/routine-context.d.ts +1 -0
- package/dist/lib/routine-context.js +7 -2
- package/dist/lib/routine-notify-owner.d.ts +1 -1
- package/dist/lib/routine-notify.d.ts +1 -1
- package/dist/lib/routine-notify.js +1 -1
- package/dist/lib/routine-process-cleanup.d.ts +1 -1
- package/dist/lib/routine-readiness.d.ts +1 -1
- package/dist/lib/routine-readiness.js +11 -4
- package/dist/lib/routines-placement.d.ts +12 -2
- package/dist/lib/routines-placement.js +20 -3
- package/dist/lib/routines-project.d.ts +1 -1
- package/dist/lib/routines-project.js +1 -1
- package/dist/lib/rules/compile.d.ts +1 -0
- package/dist/lib/rules/compile.js +10 -2
- package/dist/lib/rules/rules.js +1 -1
- package/dist/lib/run-notify.js +1 -1
- package/dist/lib/runner.d.ts +80 -2
- package/dist/lib/runner.js +261 -67
- package/dist/lib/sandbox.d.ts +1 -1
- package/dist/lib/scheduler.d.ts +1 -1
- package/dist/lib/scheduler.js +1 -1
- package/dist/lib/{routines.d.ts → scheduling/routines.d.ts} +54 -9
- package/dist/lib/{routines.js → scheduling/routines.js} +173 -14
- package/dist/lib/secrets/Agents CLI.app/Contents/CodeResources +0 -0
- package/dist/lib/secrets/Agents CLI.app/Contents/MacOS/Agents CLI +0 -0
- package/dist/lib/secrets/agent.js +2 -2
- package/dist/lib/secrets/audit.js +1 -1
- package/dist/lib/secrets/bundles.d.ts +4 -4
- package/dist/lib/secrets/bundles.js +8 -8
- package/dist/lib/secrets/headless.d.ts +16 -0
- package/dist/lib/secrets/headless.js +21 -0
- package/dist/lib/secrets/index.js +1 -1
- package/dist/lib/secrets/list-filter.d.ts +1 -1
- package/dist/lib/secrets/list-filter.js +2 -2
- package/dist/lib/secrets/push.d.ts +1 -1
- package/dist/lib/secrets/push.js +10 -12
- package/dist/lib/secrets/remote.d.ts +21 -17
- package/dist/lib/secrets/remote.js +39 -23
- package/dist/lib/secrets/vault.js +2 -2
- package/dist/lib/self-heal/checks/shadowing.js +1 -1
- package/dist/lib/self-heal/checks/shims.js +1 -1
- package/dist/lib/self-update.d.ts +39 -4
- package/dist/lib/self-update.js +78 -25
- package/dist/lib/serve/control.d.ts +1 -1
- package/dist/lib/serve/control.js +4 -4
- package/dist/lib/serve/data.d.ts +1 -1
- package/dist/lib/serve/data.js +1 -1
- package/dist/lib/serve/stream.js +1 -1
- package/dist/lib/service-manifest.d.ts +29 -0
- package/dist/lib/service-manifest.js +80 -0
- package/dist/lib/session/active.d.ts +59 -7
- package/dist/lib/session/active.js +158 -17
- package/dist/lib/session/bash-command.js +1 -1
- package/dist/lib/session/claude-accounts.d.ts +1 -1
- package/dist/lib/session/claude-accounts.js +1 -1
- package/dist/lib/session/db.d.ts +10 -2
- package/dist/lib/session/db.js +25 -6
- package/dist/lib/session/discover.d.ts +77 -0
- package/dist/lib/session/discover.js +130 -25
- package/dist/lib/session/fork.js +1 -1
- package/dist/lib/session/inject.d.ts +1 -1
- package/dist/lib/session/insights.d.ts +1 -1
- package/dist/lib/session/insights.js +1 -1
- package/dist/lib/session/live-metadata.d.ts +15 -0
- package/dist/lib/session/live-metadata.js +76 -0
- package/dist/lib/session/migrate-targets.d.ts +1 -1
- package/dist/lib/session/recovery.d.ts +1 -1
- package/dist/lib/session/recovery.js +2 -2
- package/dist/lib/session/remote-active.d.ts +10 -1
- package/dist/lib/session/remote-active.js +8 -3
- package/dist/lib/session/remote-bundle.d.ts +1 -1
- package/dist/lib/session/remote-bundle.js +2 -2
- package/dist/lib/session/remote-list.d.ts +15 -4
- package/dist/lib/session/remote-list.js +40 -3
- package/dist/lib/session/remote.d.ts +5 -5
- package/dist/lib/session/remote.js +13 -17
- package/dist/lib/session/resume-command.d.ts +3 -2
- package/dist/lib/session/resume-command.js +4 -3
- package/dist/lib/session/resume-owner.d.ts +3 -3
- package/dist/lib/session/resume-owner.js +3 -3
- package/dist/lib/session/session-cache.d.ts +12 -0
- package/dist/lib/session/session-cache.js +2 -0
- package/dist/lib/session/share-html.d.ts +55 -0
- package/dist/lib/session/share-html.js +319 -0
- package/dist/lib/session/shell-programs.js +1 -1
- package/dist/lib/session/state.js +5 -5
- package/dist/lib/session/team-filter.d.ts +1 -1
- package/dist/lib/session/team-filter.js +1 -1
- package/dist/lib/session/types.d.ts +3 -3
- package/dist/lib/session/width.d.ts +2 -2
- package/dist/lib/session/width.js +2 -2
- package/dist/lib/settings-manifest.d.ts +2 -0
- package/dist/lib/settings-manifest.js +81 -3
- package/dist/lib/share/delete.d.ts +21 -0
- package/dist/lib/share/delete.js +42 -0
- package/dist/lib/share/publish.d.ts +120 -0
- package/dist/lib/share/publish.js +243 -18
- package/dist/lib/share/worker-template.js +172 -9
- package/dist/lib/shims.js +35 -7
- package/dist/lib/smart-launch.d.ts +4 -4
- package/dist/lib/smart-launch.js +6 -4
- package/dist/lib/snapshot.d.ts +4 -4
- package/dist/lib/snapshot.js +2 -2
- package/dist/lib/ssh-exec.d.ts +1 -1
- package/dist/lib/ssh-exec.js +2 -2
- package/dist/lib/ssh-tunnel.d.ts +10 -10
- package/dist/lib/ssh-tunnel.js +12 -12
- package/dist/lib/staleness/checkers/hooks.d.ts +1 -1
- package/dist/lib/staleness/checkers/hooks.js +1 -1
- package/dist/lib/staleness/detectors/permissions.js +0 -23
- package/dist/lib/staleness/detectors/plugins.js +1 -1
- package/dist/lib/staleness/fingerprint.js +1 -1
- package/dist/lib/staleness/layers.d.ts +1 -1
- package/dist/lib/staleness/layers.js +1 -1
- package/dist/lib/staleness/writers/mcp.js +3 -1
- package/dist/lib/staleness/writers/plugins.js +1 -1
- package/dist/lib/staleness/writers/types.d.ts +8 -0
- package/dist/lib/startup/command-registry.d.ts +6 -147
- package/dist/lib/startup/command-registry.js +40 -303
- package/dist/lib/startup/dev-build.d.ts +0 -21
- package/dist/lib/startup/dev-build.js +29 -8
- package/dist/lib/state.d.ts +19 -1
- package/dist/lib/state.js +120 -51
- package/dist/lib/subagents.js +1 -1
- package/dist/lib/sync-status.js +1 -1
- package/dist/lib/sync-umbrella.d.ts +6 -1
- package/dist/lib/sync-umbrella.js +9 -4
- package/dist/lib/teams/agents.js +2 -2
- package/dist/lib/teams/registry.js +1 -1
- package/dist/lib/terminal/backends/vscodium-agent.js +1 -1
- package/dist/lib/terminal/engine.js +1 -1
- package/dist/lib/terminal/index.d.ts +4 -0
- package/dist/lib/terminal/index.js +3 -0
- package/dist/lib/terminal/inject.d.ts +2 -2
- package/dist/lib/terminal/inject.js +2 -2
- package/dist/lib/terminal/transport.js +1 -1
- package/dist/lib/tmux/index.d.ts +1 -1
- package/dist/lib/tmux/index.js +1 -1
- package/dist/lib/tmux/session.d.ts +21 -5
- package/dist/lib/tmux/session.js +76 -22
- package/dist/lib/triggers/handlers.d.ts +38 -3
- package/dist/lib/triggers/handlers.js +58 -7
- package/dist/lib/triggers/webhook.d.ts +113 -5
- package/dist/lib/triggers/webhook.js +223 -44
- package/dist/lib/types.d.ts +19 -7
- package/dist/lib/usage-fleet.d.ts +1 -1
- package/dist/lib/usage-fleet.js +1 -1
- package/dist/lib/usage-refresh.d.ts +1 -1
- package/dist/lib/usage-refresh.js +3 -3
- package/dist/lib/version-duplicates.js +2 -2
- package/dist/lib/view-types.d.ts +56 -0
- package/dist/lib/view-types.js +1 -0
- package/dist/lib/watchdog/rotate.d.ts +2 -2
- package/dist/lib/watchdog/rotate.js +3 -3
- package/dist/lib/watchdog/runner.d.ts +2 -3
- package/dist/lib/watchdog/runner.js +3 -4
- package/dist/lib/workflows.js +1 -1
- package/dist/lib/wrap.d.ts +33 -0
- package/dist/lib/wrap.js +70 -0
- package/package.json +2 -1
- package/scripts/postinstall.js +2 -2
- package/dist/commands/bench.d.ts +0 -2
- package/dist/commands/bench.js +0 -101
- package/dist/commands/cp.d.ts +0 -84
- package/dist/commands/cp.js +0 -231
- package/dist/commands/login.d.ts +0 -2
- package/dist/lib/resources/commands.d.ts +0 -46
- package/dist/lib/resources/commands.js +0 -211
- package/dist/lib/resources/hooks.d.ts +0 -16
- package/dist/lib/resources/hooks.js +0 -153
- package/dist/lib/resources/mcp.d.ts +0 -34
- package/dist/lib/resources/mcp.js +0 -250
- package/dist/lib/resources/memory.d.ts +0 -15
- package/dist/lib/resources/memory.js +0 -46
- package/dist/lib/resources/permissions.d.ts +0 -13
- package/dist/lib/resources/permissions.js +0 -202
- package/dist/lib/resources/rules.d.ts +0 -46
- package/dist/lib/resources/rules.js +0 -179
- package/dist/lib/resources/skills.d.ts +0 -37
- package/dist/lib/resources/skills.js +0 -247
- package/dist/lib/resources/subagents.d.ts +0 -46
- package/dist/lib/resources/subagents.js +0 -202
- /package/dist/lib/{feed.d.ts → feed/feed.d.ts} +0 -0
package/dist/lib/wrap.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal word-wrap — one shared helper for the whole CLI.
|
|
3
|
+
*
|
|
4
|
+
* Multi-line word wrapping is the gap the single-line helpers in
|
|
5
|
+
* `session/width.ts` (`truncateToWidth`, `padToWidth`) do not fill. Anywhere that
|
|
6
|
+
* renders variable-length text into a fixed-width terminal wraps through THIS,
|
|
7
|
+
* never a per-field slice.
|
|
8
|
+
*
|
|
9
|
+
* Width is measured with `stringWidth` (from the canonical `session/width.ts`),
|
|
10
|
+
* NOT `String.length`: the text this wraps is routinely ANSI-coloured (chalk /
|
|
11
|
+
* marked-terminal output) and may carry OSC-8 hyperlinks, where `.length`
|
|
12
|
+
* over-counts the invisible escape bytes. Words are split on whitespace, so a
|
|
13
|
+
* wrap boundary always falls between escape sequences, never inside one.
|
|
14
|
+
*/
|
|
15
|
+
import { stringWidth } from './session/width.js';
|
|
16
|
+
/**
|
|
17
|
+
* Hard-wrap `text` to `cols` visible columns.
|
|
18
|
+
*
|
|
19
|
+
* - Splits on existing newlines first (each paragraph wraps independently).
|
|
20
|
+
* - Wraps on whitespace; a single word wider than the available width is emitted
|
|
21
|
+
* on its own line rather than split mid-word (and never mid-escape).
|
|
22
|
+
* - Width is the visible display width via `stringWidth`, so ANSI colour and
|
|
23
|
+
* OSC-8 hyperlink escapes do not inflate the count.
|
|
24
|
+
* - `hangingIndent` pads every line AFTER the first with that many spaces, so a
|
|
25
|
+
* labelled value ("Latest <text>") keeps its continuation lines aligned under
|
|
26
|
+
* the value. The wrapping width is `cols - indent`.
|
|
27
|
+
* - Floor: when `hangingIndent` is set, the width is floored at 8 so a
|
|
28
|
+
* pathologically large indent still makes forward progress. With no indent the
|
|
29
|
+
* floor is 1, so a legitimately small `cols` is respected, never overridden. A
|
|
30
|
+
* non-finite `cols` degrades to the floor rather than silently disabling wrap.
|
|
31
|
+
*
|
|
32
|
+
* Returns the wrapped lines (never mutates input). An empty string yields [''].
|
|
33
|
+
*/
|
|
34
|
+
export function wrapToWidth(text, cols, hangingIndent = 0) {
|
|
35
|
+
const indent = Math.max(0, Math.trunc(hangingIndent));
|
|
36
|
+
const floor = indent > 0 ? 8 : 1;
|
|
37
|
+
const width = Number.isFinite(cols) ? Math.max(floor, cols - indent) : floor;
|
|
38
|
+
const pad = ' '.repeat(indent);
|
|
39
|
+
const out = [];
|
|
40
|
+
for (const para of String(text).split('\n')) {
|
|
41
|
+
const words = para.split(/\s+/).filter(w => w.length > 0);
|
|
42
|
+
if (words.length === 0) {
|
|
43
|
+
out.push('');
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
let line = '';
|
|
47
|
+
let lineWidth = 0;
|
|
48
|
+
for (const word of words) {
|
|
49
|
+
const wordWidth = stringWidth(word);
|
|
50
|
+
if (line === '') {
|
|
51
|
+
line = word;
|
|
52
|
+
lineWidth = wordWidth;
|
|
53
|
+
}
|
|
54
|
+
else if (lineWidth + 1 + wordWidth > width) {
|
|
55
|
+
out.push(line);
|
|
56
|
+
line = word;
|
|
57
|
+
lineWidth = wordWidth;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
line = `${line} ${word}`;
|
|
61
|
+
lineWidth += 1 + wordWidth;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (line !== '')
|
|
65
|
+
out.push(line);
|
|
66
|
+
}
|
|
67
|
+
if (out.length === 0)
|
|
68
|
+
out.push('');
|
|
69
|
+
return out.map((l, i) => (i === 0 ? l : pad + l));
|
|
70
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phnx-labs/agents-cli",
|
|
3
|
-
"version": "1.22.
|
|
3
|
+
"version": "1.22.41",
|
|
4
4
|
"description": "One CLI for all your AI coding agents - versions, config, cloud dispatch, sessions, and teams (now with first-class Grok Build CLI support)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"dist/**/*.js",
|
|
25
25
|
"dist/**/*.d.ts",
|
|
26
26
|
"dist/**/*.json",
|
|
27
|
+
"dist/**/*.sh",
|
|
27
28
|
"dist/bin/**",
|
|
28
29
|
"dist/lib/secrets/Agents CLI.app/**",
|
|
29
30
|
"dist/lib/menubar/MenubarHelper.app/**",
|
package/scripts/postinstall.js
CHANGED
|
@@ -291,7 +291,7 @@ To enable version-aware shims, add this to your shell config:
|
|
|
291
291
|
* non-interactive login shell's PATH, so `bash -lc 'agents …'` fails with
|
|
292
292
|
* command-not-found — which breaks `agents secrets export --host` (it runs
|
|
293
293
|
* `bash -lc 'agents secrets import …'` on the remote) and the routines daemon
|
|
294
|
-
* (src/lib/daemon.ts falls back to bare `agents`). This is the POSIX symmetric
|
|
294
|
+
* (src/lib/daemon/daemon.ts falls back to bare `agents`). This is the POSIX symmetric
|
|
295
295
|
* counterpart of the Windows branch in main() that registers npm's global-bin
|
|
296
296
|
* dir on the user PATH.
|
|
297
297
|
*
|
|
@@ -406,7 +406,7 @@ async function healLongRunningProcesses() {
|
|
|
406
406
|
// starts (SING-4a). If it was already running under a disable, stop and leave
|
|
407
407
|
// it down so upgrade does not resurrect a killed switch.
|
|
408
408
|
try {
|
|
409
|
-
const d = await import('../dist/lib/daemon.js');
|
|
409
|
+
const d = await import('../dist/lib/daemon/daemon.js');
|
|
410
410
|
const { isDaemonEnabled } = await import('../dist/lib/device-config.js');
|
|
411
411
|
const wasRunning = Boolean(d.isDaemonRunning?.());
|
|
412
412
|
const enabled = typeof isDaemonEnabled === 'function' ? isDaemonEnabled() : true;
|
package/dist/commands/bench.d.ts
DELETED
package/dist/commands/bench.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import * as fs from "fs";
|
|
2
|
-
import * as path from "path";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
import { detectSignedInRuntimes } from "../lib/crabbox/runtimes.js";
|
|
5
|
-
import { listRuns, loadRun, loadTask, runCells, saveRun, } from "../lib/bench/index.js";
|
|
6
|
-
import { setHelpSections } from "../lib/help.js";
|
|
7
|
-
const TASKS_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../bench/tasks");
|
|
8
|
-
function csv(value) {
|
|
9
|
-
return (value
|
|
10
|
-
?.split(",")
|
|
11
|
-
.map((item) => item.trim())
|
|
12
|
-
.filter(Boolean) ?? []);
|
|
13
|
-
}
|
|
14
|
-
function taskIds(root = TASKS_ROOT) {
|
|
15
|
-
if (!fs.existsSync(root))
|
|
16
|
-
return [];
|
|
17
|
-
return fs
|
|
18
|
-
.readdirSync(root, { withFileTypes: true })
|
|
19
|
-
.filter((entry) => entry.isDirectory() &&
|
|
20
|
-
fs.existsSync(path.join(root, entry.name, "task.json")))
|
|
21
|
-
.map((entry) => entry.name)
|
|
22
|
-
.sort();
|
|
23
|
-
}
|
|
24
|
-
function renderResult(result) {
|
|
25
|
-
console.log(`Run ${result.run_id}${result.task_id ? ` · ${result.task_id}` : ""}`);
|
|
26
|
-
for (const cell of result.cells)
|
|
27
|
-
console.log(`${cell.status === "passed" ? "PASS" : "FAIL"} ${cell.agent}${cell.model ? `/${cell.model}` : ""} ${cell.wall_ms} ms exit ${cell.exit ?? "spawn-error"}`);
|
|
28
|
-
}
|
|
29
|
-
export function registerBenchCommand(program) {
|
|
30
|
-
const bench = program
|
|
31
|
-
.command("bench")
|
|
32
|
-
.description("Run the same task across agent and model cells, with isolated fixtures and durable JSON results.");
|
|
33
|
-
setHelpSections(bench, {
|
|
34
|
-
examples: `agents bench list\nagents bench run hello-repo --agent claude,codex --model cheap,default\nagents bench results --json`,
|
|
35
|
-
notes: `Task definitions live under apps/cli/bench/tasks/<id>/task.json. Custom harness names accepted by agents run are valid --agent values.`,
|
|
36
|
-
});
|
|
37
|
-
bench
|
|
38
|
-
.command("list")
|
|
39
|
-
.description("List available benchmark tasks.")
|
|
40
|
-
.option("--json", "Emit JSON.")
|
|
41
|
-
.action((options) => {
|
|
42
|
-
const tasks = taskIds();
|
|
43
|
-
if (options.json)
|
|
44
|
-
console.log(JSON.stringify(tasks, null, 2));
|
|
45
|
-
else if (tasks.length === 0)
|
|
46
|
-
console.log("No benchmark tasks installed.");
|
|
47
|
-
else
|
|
48
|
-
tasks.forEach((id) => console.log(id));
|
|
49
|
-
});
|
|
50
|
-
bench
|
|
51
|
-
.command("results [run-id]")
|
|
52
|
-
.description("Show one saved run, or list saved runs newest first.")
|
|
53
|
-
.option("--json", "Emit JSON.")
|
|
54
|
-
.action((runId, options) => {
|
|
55
|
-
const value = runId ? loadRun(runId) : listRuns();
|
|
56
|
-
if (options.json)
|
|
57
|
-
console.log(JSON.stringify(value, null, 2));
|
|
58
|
-
else if (Array.isArray(value)) {
|
|
59
|
-
if (value.length === 0)
|
|
60
|
-
console.log("No benchmark results yet.");
|
|
61
|
-
else
|
|
62
|
-
value.forEach(renderResult);
|
|
63
|
-
}
|
|
64
|
-
else
|
|
65
|
-
renderResult(value);
|
|
66
|
-
});
|
|
67
|
-
bench
|
|
68
|
-
.command("run [task-id]")
|
|
69
|
-
.description("Run one task or prompt across an agent × model matrix.")
|
|
70
|
-
.option("--prompt <text>", "Prompt to benchmark instead of a house task.")
|
|
71
|
-
.option("--agent <names>", "Comma-separated native agents or custom harness names. Defaults to signed-in native agents.")
|
|
72
|
-
.option("--model <models>", "Comma-separated model tiers or concrete model ids.")
|
|
73
|
-
.option("--concurrency <n>", "Maximum cells running at once.", "3")
|
|
74
|
-
.option("--json", "Emit the saved JSON result.")
|
|
75
|
-
.action(async (taskId, options) => {
|
|
76
|
-
if (!!taskId === !!options.prompt)
|
|
77
|
-
throw new Error("Pass exactly one of <task-id> or --prompt.");
|
|
78
|
-
const task = taskId ? loadTask(taskId, TASKS_ROOT) : undefined;
|
|
79
|
-
const prompt = options.prompt ?? task.prompt;
|
|
80
|
-
let agents = csv(options.agent);
|
|
81
|
-
if (agents.length === 0)
|
|
82
|
-
agents = (await detectSignedInRuntimes())
|
|
83
|
-
.filter((runtime) => runtime.signedIn)
|
|
84
|
-
.map((runtime) => runtime.id);
|
|
85
|
-
if (agents.length === 0)
|
|
86
|
-
throw new Error("No signed-in native agents found. Pass --agent <name>.");
|
|
87
|
-
const models = csv(options.model);
|
|
88
|
-
const cells = agents.flatMap((agent) => models.length > 0
|
|
89
|
-
? models.map((model) => ({ agent, model }))
|
|
90
|
-
: [{ agent }]);
|
|
91
|
-
const concurrency = Number(options.concurrency);
|
|
92
|
-
const result = await runCells({ task, prompt, cells, concurrency });
|
|
93
|
-
saveRun(result);
|
|
94
|
-
if (options.json)
|
|
95
|
-
console.log(JSON.stringify(result, null, 2));
|
|
96
|
-
else
|
|
97
|
-
renderResult(result);
|
|
98
|
-
if (result.cells.some((cell) => cell.status === "failed"))
|
|
99
|
-
process.exitCode = 1;
|
|
100
|
-
});
|
|
101
|
-
}
|
package/dist/commands/cp.d.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `agents cp <src> <dst>` — first-class fleet file transfer.
|
|
3
|
-
*
|
|
4
|
-
* Accepts `host:path` on either side (local = bare absolute path). Resolves
|
|
5
|
-
* `~` and `$HOME` remote paths ON the remote before transfer so a `$HOME` in
|
|
6
|
-
* the remote spec can never silently expand to the local user's home directory
|
|
7
|
-
* — the documented silent-failure class in `remote-dispatch-mutation-safety`.
|
|
8
|
-
*
|
|
9
|
-
* Reuses the same SSH fabric (SSH_OPTS, deviceIdentityArgs, resolveDeviceTarget)
|
|
10
|
-
* that `agents ssh` and `--host` dispatch use.
|
|
11
|
-
*/
|
|
12
|
-
import type { Command } from 'commander';
|
|
13
|
-
/**
|
|
14
|
-
* A remote endpoint — host (device name or user@device) and a path on that
|
|
15
|
-
* host. The path may begin with `~` or `$HOME`; {@link resolveRemotePath}
|
|
16
|
-
* expands those on the remote before transfer.
|
|
17
|
-
*/
|
|
18
|
-
export interface RemoteEndpoint {
|
|
19
|
-
isRemote: true;
|
|
20
|
-
/** Device name, user@device, or ad-hoc host literal. */
|
|
21
|
-
host: string;
|
|
22
|
-
/** Path as given by the caller — may contain `~` or `$HOME`. */
|
|
23
|
-
path: string;
|
|
24
|
-
}
|
|
25
|
-
/** A local endpoint — an absolute local path. */
|
|
26
|
-
export interface LocalEndpoint {
|
|
27
|
-
isRemote: false;
|
|
28
|
-
/** Absolute local path. */
|
|
29
|
-
path: string;
|
|
30
|
-
}
|
|
31
|
-
export type Endpoint = RemoteEndpoint | LocalEndpoint;
|
|
32
|
-
/**
|
|
33
|
-
* Parse one CLI token into an {@link Endpoint}.
|
|
34
|
-
*
|
|
35
|
-
* Grammar: `host:path` is remote; anything else is local. The host part must
|
|
36
|
-
* not contain a `/` (that would be a local absolute path with a colon in it —
|
|
37
|
-
* unusual but valid; the colon test covers the common fleet pattern and rejects
|
|
38
|
-
* the almost-never-seen edge case in favour of local-path semantics).
|
|
39
|
-
*
|
|
40
|
-
* Windows drive letters (`C:path`) are excluded by requiring the host part to
|
|
41
|
-
* be at least two characters and not a single capital letter.
|
|
42
|
-
*/
|
|
43
|
-
export declare function parseEndpoint(token: string): Endpoint;
|
|
44
|
-
/**
|
|
45
|
-
* Resolve the remote HOME directory in one SSH round-trip. Returns the
|
|
46
|
-
* absolute path (always starts with `/`), or throws on failure.
|
|
47
|
-
*/
|
|
48
|
-
export declare function resolveRemoteHome(target: string, extraSshArgs: string[]): Promise<string>;
|
|
49
|
-
/**
|
|
50
|
-
* Pure home-prefix expansion. Given a remote HOME (already resolved on the
|
|
51
|
-
* remote) and a raw path token, substitute a leading `~` or `$HOME`. Paths
|
|
52
|
-
* without those prefixes are returned unchanged. Never consults
|
|
53
|
-
* `process.env.HOME` — the local home must not leak into a remote path.
|
|
54
|
-
*/
|
|
55
|
-
export declare function expandRemoteHomePrefix(rawPath: string, remoteHome: string): string;
|
|
56
|
-
/**
|
|
57
|
-
* Expand a remote path's leading `~` or literal `$HOME` to an absolute path
|
|
58
|
-
* resolved **on the remote**, not locally. A path that already starts with `/`
|
|
59
|
-
* is returned unchanged (no round-trip).
|
|
60
|
-
*
|
|
61
|
-
* This is the safeguard against the silent-failure class: a `$HOME` or `~`
|
|
62
|
-
* that would expand to the **local** user's home if left in a shell command.
|
|
63
|
-
*/
|
|
64
|
-
export declare function resolveRemotePath(rawPath: string, target: string, extraSshArgs: string[]): Promise<string>;
|
|
65
|
-
/**
|
|
66
|
-
* Build the argv for the `scp` invocation. Pure — no spawning — so it is
|
|
67
|
-
* unit-testable.
|
|
68
|
-
*
|
|
69
|
-
* `scp` accepts ssh `-o` options, so `SSH_OPTS` flows through unchanged.
|
|
70
|
-
* Identity args (`-i key -o IdentitiesOnly=yes`) are included only when a
|
|
71
|
-
* single remote device is involved; for two-remote transfers the identity
|
|
72
|
-
* applies to both connections, which works when the fleet uses a shared key.
|
|
73
|
-
*
|
|
74
|
-
* Remote endpoints are formatted as `user@host:path` (or bare `host:path`),
|
|
75
|
-
* local endpoints as their absolute path. Paths have already been resolved
|
|
76
|
-
* (no `~` or `$HOME`) by the time this is called.
|
|
77
|
-
*/
|
|
78
|
-
export declare function buildScpArgv({ srcSpec, dstSpec, identityArgs, recursive, }: {
|
|
79
|
-
srcSpec: string;
|
|
80
|
-
dstSpec: string;
|
|
81
|
-
identityArgs: string[];
|
|
82
|
-
recursive: boolean;
|
|
83
|
-
}): string[];
|
|
84
|
-
export declare function registerCpCommand(program: Command): void;
|
package/dist/commands/cp.js
DELETED
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `agents cp <src> <dst>` — first-class fleet file transfer.
|
|
3
|
-
*
|
|
4
|
-
* Accepts `host:path` on either side (local = bare absolute path). Resolves
|
|
5
|
-
* `~` and `$HOME` remote paths ON the remote before transfer so a `$HOME` in
|
|
6
|
-
* the remote spec can never silently expand to the local user's home directory
|
|
7
|
-
* — the documented silent-failure class in `remote-dispatch-mutation-safety`.
|
|
8
|
-
*
|
|
9
|
-
* Reuses the same SSH fabric (SSH_OPTS, deviceIdentityArgs, resolveDeviceTarget)
|
|
10
|
-
* that `agents ssh` and `--host` dispatch use.
|
|
11
|
-
*/
|
|
12
|
-
import { spawnSync } from 'child_process';
|
|
13
|
-
import chalk from 'chalk';
|
|
14
|
-
import { setHelpSections } from '../lib/help.js';
|
|
15
|
-
import { resolveDeviceTarget } from '../lib/devices/resolve-target.js';
|
|
16
|
-
import { sshTargetFor, deviceIdentityArgs } from '../lib/devices/connect.js';
|
|
17
|
-
import { sshExec, SSH_OPTS } from '../lib/ssh-exec.js';
|
|
18
|
-
/**
|
|
19
|
-
* Parse one CLI token into an {@link Endpoint}.
|
|
20
|
-
*
|
|
21
|
-
* Grammar: `host:path` is remote; anything else is local. The host part must
|
|
22
|
-
* not contain a `/` (that would be a local absolute path with a colon in it —
|
|
23
|
-
* unusual but valid; the colon test covers the common fleet pattern and rejects
|
|
24
|
-
* the almost-never-seen edge case in favour of local-path semantics).
|
|
25
|
-
*
|
|
26
|
-
* Windows drive letters (`C:path`) are excluded by requiring the host part to
|
|
27
|
-
* be at least two characters and not a single capital letter.
|
|
28
|
-
*/
|
|
29
|
-
export function parseEndpoint(token) {
|
|
30
|
-
const colonIdx = token.indexOf(':');
|
|
31
|
-
if (colonIdx > 1 && !token.startsWith('/')) {
|
|
32
|
-
const host = token.slice(0, colonIdx);
|
|
33
|
-
const path = token.slice(colonIdx + 1);
|
|
34
|
-
// A bare single uppercase letter before `:` looks like a Windows drive
|
|
35
|
-
// letter — treat as local to avoid a confusing error.
|
|
36
|
-
if (!/^[A-Z]$/.test(host) && !host.includes('/')) {
|
|
37
|
-
return { isRemote: true, host, path };
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return { isRemote: false, path: token };
|
|
41
|
-
}
|
|
42
|
-
// ---------------------------------------------------------------------------
|
|
43
|
-
// Remote path resolution — the core safeguard
|
|
44
|
-
// ---------------------------------------------------------------------------
|
|
45
|
-
/**
|
|
46
|
-
* Resolve the remote HOME directory in one SSH round-trip. Returns the
|
|
47
|
-
* absolute path (always starts with `/`), or throws on failure.
|
|
48
|
-
*/
|
|
49
|
-
export async function resolveRemoteHome(target, extraSshArgs) {
|
|
50
|
-
const res = sshExec(target, 'printf "%s" "$HOME"', {
|
|
51
|
-
extraSshArgs,
|
|
52
|
-
timeoutMs: 10_000,
|
|
53
|
-
});
|
|
54
|
-
if (res.code !== 0) {
|
|
55
|
-
throw new Error(`Cannot resolve remote $HOME on ${target}: ${res.stderr.trim() || 'ssh exited ' + String(res.code)}`);
|
|
56
|
-
}
|
|
57
|
-
const home = res.stdout.trim();
|
|
58
|
-
if (!home || !home.startsWith('/')) {
|
|
59
|
-
throw new Error(`Remote $HOME on ${target} is not an absolute path: ${JSON.stringify(home)}`);
|
|
60
|
-
}
|
|
61
|
-
return home;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Pure home-prefix expansion. Given a remote HOME (already resolved on the
|
|
65
|
-
* remote) and a raw path token, substitute a leading `~` or `$HOME`. Paths
|
|
66
|
-
* without those prefixes are returned unchanged. Never consults
|
|
67
|
-
* `process.env.HOME` — the local home must not leak into a remote path.
|
|
68
|
-
*/
|
|
69
|
-
export function expandRemoteHomePrefix(rawPath, remoteHome) {
|
|
70
|
-
if (rawPath === '~' || rawPath.startsWith('~/')) {
|
|
71
|
-
return rawPath === '~' ? remoteHome : remoteHome + rawPath.slice(1);
|
|
72
|
-
}
|
|
73
|
-
if (rawPath === '$HOME' || rawPath.startsWith('$HOME/')) {
|
|
74
|
-
return rawPath === '$HOME' ? remoteHome : remoteHome + rawPath.slice(5);
|
|
75
|
-
}
|
|
76
|
-
return rawPath;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Expand a remote path's leading `~` or literal `$HOME` to an absolute path
|
|
80
|
-
* resolved **on the remote**, not locally. A path that already starts with `/`
|
|
81
|
-
* is returned unchanged (no round-trip).
|
|
82
|
-
*
|
|
83
|
-
* This is the safeguard against the silent-failure class: a `$HOME` or `~`
|
|
84
|
-
* that would expand to the **local** user's home if left in a shell command.
|
|
85
|
-
*/
|
|
86
|
-
export async function resolveRemotePath(rawPath, target, extraSshArgs) {
|
|
87
|
-
if (rawPath === '~' ||
|
|
88
|
-
rawPath.startsWith('~/') ||
|
|
89
|
-
rawPath === '$HOME' ||
|
|
90
|
-
rawPath.startsWith('$HOME/')) {
|
|
91
|
-
const home = await resolveRemoteHome(target, extraSshArgs);
|
|
92
|
-
return expandRemoteHomePrefix(rawPath, home);
|
|
93
|
-
}
|
|
94
|
-
return rawPath;
|
|
95
|
-
}
|
|
96
|
-
// ---------------------------------------------------------------------------
|
|
97
|
-
// scp invocation
|
|
98
|
-
// ---------------------------------------------------------------------------
|
|
99
|
-
/**
|
|
100
|
-
* Build the argv for the `scp` invocation. Pure — no spawning — so it is
|
|
101
|
-
* unit-testable.
|
|
102
|
-
*
|
|
103
|
-
* `scp` accepts ssh `-o` options, so `SSH_OPTS` flows through unchanged.
|
|
104
|
-
* Identity args (`-i key -o IdentitiesOnly=yes`) are included only when a
|
|
105
|
-
* single remote device is involved; for two-remote transfers the identity
|
|
106
|
-
* applies to both connections, which works when the fleet uses a shared key.
|
|
107
|
-
*
|
|
108
|
-
* Remote endpoints are formatted as `user@host:path` (or bare `host:path`),
|
|
109
|
-
* local endpoints as their absolute path. Paths have already been resolved
|
|
110
|
-
* (no `~` or `$HOME`) by the time this is called.
|
|
111
|
-
*/
|
|
112
|
-
export function buildScpArgv({ srcSpec, dstSpec, identityArgs, recursive, }) {
|
|
113
|
-
const opts = [...SSH_OPTS, ...identityArgs];
|
|
114
|
-
if (recursive)
|
|
115
|
-
opts.push('-r');
|
|
116
|
-
// Two-remote transfers route through the local machine (-3) to avoid
|
|
117
|
-
// requiring direct SSH access between the two fleet boxes.
|
|
118
|
-
if (srcSpec.includes(':') && dstSpec.includes(':'))
|
|
119
|
-
opts.push('-3');
|
|
120
|
-
return [...opts, srcSpec, dstSpec];
|
|
121
|
-
}
|
|
122
|
-
async function resolveEndpoint(ep) {
|
|
123
|
-
if (!ep.isRemote) {
|
|
124
|
-
return { spec: ep.path, identityArgs: [] };
|
|
125
|
-
}
|
|
126
|
-
const device = await resolveDeviceTarget(ep.host);
|
|
127
|
-
if (!device) {
|
|
128
|
-
throw new Error(`Unknown device ${JSON.stringify(ep.host)}. Register it with \`agents devices add\` or check \`agents devices\`.`);
|
|
129
|
-
}
|
|
130
|
-
const target = sshTargetFor(device);
|
|
131
|
-
const idArgs = deviceIdentityArgs(device);
|
|
132
|
-
const resolvedPath = await resolveRemotePath(ep.path, target, idArgs);
|
|
133
|
-
if (!resolvedPath.startsWith('/')) {
|
|
134
|
-
throw new Error(`Remote path on ${ep.host} must be absolute after expansion, got: ${JSON.stringify(resolvedPath)}. Use an absolute path or start with ~/`);
|
|
135
|
-
}
|
|
136
|
-
return { spec: `${target}:${resolvedPath}`, identityArgs: idArgs };
|
|
137
|
-
}
|
|
138
|
-
// ---------------------------------------------------------------------------
|
|
139
|
-
// Validation
|
|
140
|
-
// ---------------------------------------------------------------------------
|
|
141
|
-
/** Validate a local path: must be absolute. */
|
|
142
|
-
function validateLocalPath(raw) {
|
|
143
|
-
if (!raw.startsWith('/')) {
|
|
144
|
-
throw new Error(`Local path must be absolute, got: ${JSON.stringify(raw)}`);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
/** Validate a remote path: non-empty. */
|
|
148
|
-
function validateRemotePath(raw, host) {
|
|
149
|
-
if (!raw) {
|
|
150
|
-
throw new Error(`Remote path for ${JSON.stringify(host)} is empty. Expected: ${host}:/abs/path`);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
// ---------------------------------------------------------------------------
|
|
154
|
-
// Command registration
|
|
155
|
-
// ---------------------------------------------------------------------------
|
|
156
|
-
export function registerCpCommand(program) {
|
|
157
|
-
const cmd = program
|
|
158
|
-
.command('cp <src> <dst>')
|
|
159
|
-
.description('Copy a file or directory between fleet hosts. Either endpoint may be host:path (remote) or an absolute local path.')
|
|
160
|
-
.option('-r, --recursive', 'Copy directories recursively')
|
|
161
|
-
.action(async (srcToken, dstToken, opts) => {
|
|
162
|
-
const recursive = opts.recursive ?? false;
|
|
163
|
-
const srcEp = parseEndpoint(srcToken);
|
|
164
|
-
const dstEp = parseEndpoint(dstToken);
|
|
165
|
-
if (!srcEp.isRemote && !dstEp.isRemote) {
|
|
166
|
-
process.stderr.write(chalk.red('error:') +
|
|
167
|
-
' At least one endpoint must be remote (host:path). For local-only copies use `cp`.\n');
|
|
168
|
-
process.exit(1);
|
|
169
|
-
}
|
|
170
|
-
let srcResolved;
|
|
171
|
-
let dstResolved;
|
|
172
|
-
try {
|
|
173
|
-
// Validate shapes before any network calls.
|
|
174
|
-
if (!srcEp.isRemote)
|
|
175
|
-
validateLocalPath(srcEp.path);
|
|
176
|
-
if (srcEp.isRemote)
|
|
177
|
-
validateRemotePath(srcEp.path, srcEp.host);
|
|
178
|
-
if (!dstEp.isRemote)
|
|
179
|
-
validateLocalPath(dstEp.path);
|
|
180
|
-
if (dstEp.isRemote)
|
|
181
|
-
validateRemotePath(dstEp.path, dstEp.host);
|
|
182
|
-
[srcResolved, dstResolved] = await Promise.all([
|
|
183
|
-
resolveEndpoint(srcEp),
|
|
184
|
-
resolveEndpoint(dstEp),
|
|
185
|
-
]);
|
|
186
|
-
}
|
|
187
|
-
catch (err) {
|
|
188
|
-
process.stderr.write(chalk.red('error:') + ' ' + err.message + '\n');
|
|
189
|
-
process.exit(1);
|
|
190
|
-
}
|
|
191
|
-
// Merge identity args: for two-remote transfers, omit per-device identity
|
|
192
|
-
// args (they apply to both connections via -3; a conflict would need
|
|
193
|
-
// separate -i per connection which scp doesn't support). A shared fleet
|
|
194
|
-
// key works without explicit -i.
|
|
195
|
-
const identityArgs = srcResolved.identityArgs.length > 0 && dstResolved.identityArgs.length === 0
|
|
196
|
-
? srcResolved.identityArgs
|
|
197
|
-
: dstResolved.identityArgs.length > 0 && srcResolved.identityArgs.length === 0
|
|
198
|
-
? dstResolved.identityArgs
|
|
199
|
-
: srcResolved.identityArgs.join(',') === dstResolved.identityArgs.join(',')
|
|
200
|
-
? srcResolved.identityArgs
|
|
201
|
-
: []; // two remotes with different keys — skip per-device flag, use agent's default key
|
|
202
|
-
const argv = buildScpArgv({
|
|
203
|
-
srcSpec: srcResolved.spec,
|
|
204
|
-
dstSpec: dstResolved.spec,
|
|
205
|
-
identityArgs,
|
|
206
|
-
recursive,
|
|
207
|
-
});
|
|
208
|
-
const res = spawnSync('scp', argv, { stdio: 'inherit' });
|
|
209
|
-
const code = typeof res.status === 'number' ? res.status : 1;
|
|
210
|
-
if (code !== 0) {
|
|
211
|
-
// scp already printed a diagnostic; just exit non-zero.
|
|
212
|
-
process.exit(code);
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
setHelpSections(cmd, {
|
|
216
|
-
examples: `
|
|
217
|
-
agents cp yosemite-s0:/abs/data.json /tmp/data.json # download a file from a fleet host
|
|
218
|
-
agents cp /tmp/build.tar.gz mac-mini:/abs/deploy/ # upload a local file to a fleet host
|
|
219
|
-
agents cp -r yosemite-s0:/abs/src/ mac-mini:/abs/dst/ # copy a directory between two fleet hosts
|
|
220
|
-
agents cp yosemite-s0:~/logs/run.log /tmp/run.log # ~ is resolved on the remote host
|
|
221
|
-
`,
|
|
222
|
-
notes: `
|
|
223
|
-
Local paths must be absolute (use /abs/path, not ./relative).
|
|
224
|
-
Remote paths must be absolute after ~ / $HOME expansion.
|
|
225
|
-
Remote $HOME is resolved on the remote host — never in the local shell.
|
|
226
|
-
Both local-to-remote and remote-to-local transfers are supported.
|
|
227
|
-
Remote-to-remote transfers route through the local machine (-3).
|
|
228
|
-
Devices must be registered: 'agents devices' to list, 'agents devices add' to enroll.
|
|
229
|
-
`,
|
|
230
|
-
});
|
|
231
|
-
}
|
package/dist/commands/login.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Commands resource handler.
|
|
3
|
-
*
|
|
4
|
-
* Commands are slash-command definitions stored as .md files (Claude/Codex/Cursor/OpenCode)
|
|
5
|
-
* or .toml files (Gemini). This handler resolves commands across layers (project > user > system),
|
|
6
|
-
* handles format conversion during sync, and provides consistent list/resolve/sync behavior.
|
|
7
|
-
*/
|
|
8
|
-
import type { AgentId, ResolvedItem, ResourceHandler, ResourceKind } from './types.js';
|
|
9
|
-
/** Command item metadata. */
|
|
10
|
-
export interface CommandItem {
|
|
11
|
-
name: string;
|
|
12
|
-
description: string;
|
|
13
|
-
content: string;
|
|
14
|
-
format: 'md' | 'toml';
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Commands resource handler implementing ResourceHandler<CommandItem>.
|
|
18
|
-
*/
|
|
19
|
-
export declare class CommandsHandler implements ResourceHandler<CommandItem> {
|
|
20
|
-
readonly kind: ResourceKind;
|
|
21
|
-
/**
|
|
22
|
-
* List all commands across layers, with higher layer winning on name conflict.
|
|
23
|
-
* Returns a union of all commands, deduplicated by name.
|
|
24
|
-
*/
|
|
25
|
-
listAll(agent: AgentId, cwd?: string): ResolvedItem<CommandItem>[];
|
|
26
|
-
/**
|
|
27
|
-
* Resolve a single command by name.
|
|
28
|
-
* Returns the winning layer's version, or null if not found.
|
|
29
|
-
*/
|
|
30
|
-
resolve(agent: AgentId, name: string, cwd?: string): ResolvedItem<CommandItem> | null;
|
|
31
|
-
/**
|
|
32
|
-
* Sync resolved commands to the agent's version home directory.
|
|
33
|
-
* Copies/transforms commands as needed for the agent's expected format.
|
|
34
|
-
*/
|
|
35
|
-
sync(agent: AgentId, versionHome: string, cwd?: string): void;
|
|
36
|
-
/**
|
|
37
|
-
* Get the file format this resource uses for a given agent.
|
|
38
|
-
*/
|
|
39
|
-
format(agent: AgentId): 'md' | 'toml';
|
|
40
|
-
/**
|
|
41
|
-
* Get the target directory name in the agent's version home.
|
|
42
|
-
*/
|
|
43
|
-
targetDir(agent: AgentId): string;
|
|
44
|
-
}
|
|
45
|
-
/** Singleton instance of the commands handler. */
|
|
46
|
-
export declare const commandsHandler: CommandsHandler;
|