@phnx-labs/agents-cli 1.22.35 → 1.22.37
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 +666 -2
- package/README.md +75 -35
- package/dist/bin/agents +0 -0
- package/dist/bootstrap.d.ts +15 -0
- package/dist/bootstrap.js +1211 -0
- package/dist/commands/accounts.d.ts +4 -11
- package/dist/commands/accounts.js +159 -27
- package/dist/commands/attach.js +17 -4
- package/dist/commands/audit.d.ts +8 -8
- package/dist/commands/audit.js +57 -47
- package/dist/commands/browser.js +15 -11
- package/dist/commands/cloud.js +1 -1
- package/dist/commands/commands.js +0 -11
- package/dist/commands/computer-actions.js +33 -0
- package/dist/commands/computer-sessions-picker.d.ts +21 -0
- package/dist/commands/computer-sessions-picker.js +141 -0
- package/dist/commands/computer.d.ts +16 -0
- package/dist/commands/computer.js +37 -0
- package/dist/commands/config.d.ts +17 -0
- package/dist/commands/config.js +401 -0
- package/dist/commands/cp.d.ts +84 -0
- package/dist/commands/cp.js +231 -0
- package/dist/commands/daemon.js +243 -14
- package/dist/commands/detach-core.d.ts +1 -1
- package/dist/commands/detach-core.js +12 -2
- package/dist/commands/detach.js +1 -1
- package/dist/commands/doctor.js +64 -5
- package/dist/commands/events.d.ts +24 -12
- package/dist/commands/events.js +144 -28
- package/dist/commands/exec.js +85 -41
- package/dist/commands/feed.d.ts +1 -1
- package/dist/commands/feed.js +16 -8
- package/dist/commands/focus.d.ts +33 -1
- package/dist/commands/focus.js +177 -17
- package/dist/commands/funnel.d.ts +1 -1
- package/dist/commands/go.js +9 -8
- package/dist/commands/harness-wizard.d.ts +1 -0
- package/dist/commands/harness-wizard.js +18 -20
- package/dist/commands/harness.d.ts +2 -0
- package/dist/commands/harness.js +59 -26
- package/dist/commands/hooks.js +0 -11
- package/dist/commands/inspect.d.ts +94 -1
- package/dist/commands/inspect.js +866 -40
- package/dist/commands/lease.d.ts +4 -4
- package/dist/commands/lease.js +6 -6
- package/dist/commands/login.js +0 -13
- package/dist/commands/logs.d.ts +2 -2
- package/dist/commands/logs.js +2 -2
- package/dist/commands/mcp.js +7 -2
- package/dist/commands/memory.js +7 -2
- package/dist/commands/message.d.ts +1 -1
- package/dist/commands/message.js +37 -6
- package/dist/commands/models.js +4 -0
- package/dist/commands/monitors.d.ts +0 -1
- package/dist/commands/monitors.js +199 -16
- package/dist/commands/open.d.ts +18 -0
- package/dist/commands/open.js +57 -0
- package/dist/commands/packages.js +2 -107
- package/dist/commands/plugins.js +6 -3
- package/dist/commands/profiles.d.ts +1 -0
- package/dist/commands/profiles.js +16 -160
- package/dist/commands/projects.d.ts +28 -0
- package/dist/commands/projects.js +125 -5
- package/dist/commands/reconnect.js +9 -3
- package/dist/commands/repo.js +42 -1
- package/dist/commands/resource-view.d.ts +17 -0
- package/dist/commands/resource-view.js +36 -14
- package/dist/commands/resume.js +9 -2
- package/dist/commands/routines.d.ts +0 -2
- package/dist/commands/routines.js +473 -289
- package/dist/commands/secrets.js +52 -9
- package/dist/commands/sessions-export.d.ts +47 -0
- package/dist/commands/sessions-export.js +116 -6
- package/dist/commands/sessions-import.d.ts +17 -0
- package/dist/commands/sessions-import.js +114 -6
- package/dist/commands/sessions-migrate.d.ts +27 -0
- package/dist/commands/sessions-migrate.js +50 -9
- package/dist/commands/sessions-picker.js +23 -4
- package/dist/commands/sessions-resume.d.ts +5 -3
- package/dist/commands/sessions-resume.js +30 -8
- package/dist/commands/sessions-watch.d.ts +2 -0
- package/dist/commands/sessions-watch.js +53 -0
- package/dist/commands/sessions.d.ts +66 -3
- package/dist/commands/sessions.js +298 -47
- package/dist/commands/set.d.ts +1 -1
- package/dist/commands/set.js +2 -2
- package/dist/commands/setup-browser.js +2 -2
- package/dist/commands/setup-mine.js +0 -1
- package/dist/commands/setup-preferences.js +1 -1
- package/dist/commands/setup-share.js +34 -4
- package/dist/commands/setup.d.ts +5 -0
- package/dist/commands/setup.js +26 -0
- package/dist/commands/share.d.ts +67 -0
- package/dist/commands/share.js +275 -12
- package/dist/commands/skills.js +0 -11
- package/dist/commands/snapshot.js +1 -1
- package/dist/commands/ssh.d.ts +18 -0
- package/dist/commands/ssh.js +549 -210
- package/dist/commands/sync.d.ts +5 -0
- package/dist/commands/sync.js +212 -32
- package/dist/commands/teams.d.ts +13 -0
- package/dist/commands/teams.js +187 -30
- package/dist/commands/tickets.d.ts +2 -0
- package/dist/commands/tickets.js +43 -0
- package/dist/commands/update.js +2 -4
- package/dist/commands/usage.js +5 -3
- package/dist/commands/versions.js +11 -5
- package/dist/commands/view.js +15 -7
- package/dist/commands/webhook.d.ts +2 -2
- package/dist/commands/webhook.js +7 -7
- package/dist/index.d.ts +18 -2
- package/dist/index.js +53 -1264
- package/dist/lib/account-catalog.d.ts +18 -0
- package/dist/lib/account-catalog.js +38 -0
- package/dist/lib/account-provider-registry.d.ts +18 -0
- package/dist/lib/account-provider-registry.js +59 -0
- package/dist/lib/account-registry.d.ts +40 -0
- package/dist/lib/account-registry.js +239 -0
- package/dist/lib/account-schema.d.ts +44 -0
- package/dist/lib/account-schema.js +91 -0
- package/dist/lib/account-state-service.d.ts +21 -0
- package/dist/lib/account-state-service.js +60 -0
- package/dist/lib/activity.d.ts +1 -1
- package/dist/lib/activity.js +8 -1
- package/dist/lib/add-dir.d.ts +80 -0
- package/dist/lib/add-dir.js +241 -0
- package/dist/lib/agent-cli-commands.d.ts +11 -0
- package/dist/lib/agent-cli-commands.js +30 -0
- package/dist/lib/agents.js +44 -36
- package/dist/lib/answer-router.js +1 -1
- package/dist/lib/audit/log.d.ts +10 -27
- package/dist/lib/audit/log.js +20 -33
- package/dist/lib/auth-health.d.ts +9 -2
- package/dist/lib/auth-health.js +42 -9
- package/dist/lib/auto-pull-worker.js +7 -3
- package/dist/lib/auto-pull.d.ts +44 -3
- package/dist/lib/auto-pull.js +88 -5
- package/dist/lib/binary-shadow.d.ts +28 -0
- package/dist/lib/binary-shadow.js +121 -0
- package/dist/lib/brand.js +9 -3
- package/dist/lib/browser/ipc.d.ts +30 -0
- package/dist/lib/browser/ipc.js +81 -4
- package/dist/lib/browser/profiles.d.ts +3 -2
- package/dist/lib/browser/profiles.js +65 -22
- package/dist/lib/browser/service.d.ts +4 -0
- package/dist/lib/browser/service.js +30 -3
- package/dist/lib/browser/sessions-list.d.ts +22 -2
- package/dist/lib/browser/sessions-list.js +54 -6
- package/dist/lib/browser/stream.d.ts +2 -0
- package/dist/lib/browser/stream.js +1 -0
- package/dist/lib/browser/types.d.ts +19 -0
- package/dist/lib/byok-usage.d.ts +9 -2
- package/dist/lib/byok-usage.js +133 -31
- package/dist/lib/cli-entry.d.ts +11 -0
- package/dist/lib/cli-entry.js +46 -0
- package/dist/lib/cloud/host.d.ts +1 -1
- package/dist/lib/cloud/host.js +2 -2
- package/dist/lib/cloud/registry.js +1 -1
- package/dist/lib/cloud/types.d.ts +1 -1
- package/dist/lib/commands.d.ts +2 -0
- package/dist/lib/commands.js +2 -0
- package/dist/lib/computer/sessions-list.d.ts +150 -0
- package/dist/lib/computer/sessions-list.js +363 -0
- package/dist/lib/config-keys.d.ts +86 -0
- package/dist/lib/config-keys.js +193 -0
- package/dist/lib/config-machine-keys.d.ts +12 -0
- package/dist/lib/config-machine-keys.js +17 -0
- package/dist/lib/config-transfer.js +3 -4
- package/dist/lib/crabbox/cli.d.ts +2 -2
- package/dist/lib/crabbox/cli.js +3 -3
- package/dist/lib/daemon-health.d.ts +22 -0
- package/dist/lib/daemon-health.js +33 -3
- package/dist/lib/daemon-services.d.ts +50 -0
- package/dist/lib/daemon-services.js +147 -0
- package/dist/lib/daemon-ticks.d.ts +35 -66
- package/dist/lib/daemon-ticks.js +77 -159
- package/dist/lib/daemon.d.ts +72 -4
- package/dist/lib/daemon.js +792 -202
- package/dist/lib/deeplink/register.d.ts +49 -0
- package/dist/lib/deeplink/register.js +253 -0
- package/dist/lib/deeplink/url.d.ts +34 -0
- package/dist/lib/deeplink/url.js +78 -0
- package/dist/lib/device-config.d.ts +124 -29
- package/dist/lib/device-config.js +346 -141
- package/dist/lib/devices/config-migration.d.ts +42 -0
- package/dist/lib/devices/config-migration.js +203 -0
- package/dist/lib/devices/connect.js +14 -7
- package/dist/lib/devices/doctor-findings.d.ts +4 -1
- package/dist/lib/devices/doctor-findings.js +20 -1
- package/dist/lib/devices/harness-inventory.d.ts +11 -2
- package/dist/lib/devices/harness-inventory.js +0 -0
- package/dist/lib/devices/health.d.ts +1 -1
- package/dist/lib/devices/health.js +1 -1
- package/dist/lib/devices/pending.d.ts +22 -1
- package/dist/lib/devices/pending.js +67 -2
- package/dist/lib/devices/registry.d.ts +0 -25
- package/dist/lib/devices/registry.js +2 -83
- package/dist/lib/devices/resolve-profile.d.ts +20 -0
- package/dist/lib/devices/resolve-profile.js +44 -0
- package/dist/lib/devices/rollout-verify.d.ts +101 -0
- package/dist/lib/devices/rollout-verify.js +193 -0
- package/dist/lib/devices/ssh-config.js +10 -6
- package/dist/lib/event-families.d.ts +28 -0
- package/dist/lib/event-families.js +159 -0
- package/dist/lib/event-stream.d.ts +9 -1
- package/dist/lib/event-stream.js +26 -9
- package/dist/lib/events.d.ts +9 -1
- package/dist/lib/events.js +21 -6
- package/dist/lib/exec.d.ts +30 -0
- package/dist/lib/exec.js +219 -121
- package/dist/lib/feed-broadcast.d.ts +25 -0
- package/dist/lib/feed-broadcast.js +33 -0
- package/dist/lib/feed.d.ts +1 -1
- package/dist/lib/feed.js +12 -2
- package/dist/lib/fleet/capture.js +15 -0
- package/dist/lib/fleet/manifest.js +9 -0
- package/dist/lib/fleet/types.d.ts +9 -0
- package/dist/lib/fleet-status.js +10 -8
- package/dist/lib/git.d.ts +20 -6
- package/dist/lib/git.js +121 -17
- package/dist/lib/hosts/dispatch.d.ts +8 -3
- package/dist/lib/hosts/dispatch.js +29 -3
- package/dist/lib/hosts/logs.d.ts +2 -2
- package/dist/lib/hosts/logs.js +2 -2
- package/dist/lib/hosts/option.js +1 -1
- package/dist/lib/hosts/passthrough.d.ts +2 -3
- package/dist/lib/hosts/passthrough.js +10 -24
- package/dist/lib/hosts/progress.js +2 -2
- package/dist/lib/hosts/providers/devices.d.ts +3 -3
- package/dist/lib/hosts/providers/devices.js +18 -12
- package/dist/lib/hosts/ready.d.ts +5 -1
- package/dist/lib/hosts/ready.js +9 -3
- package/dist/lib/hosts/reconcile.d.ts +2 -2
- package/dist/lib/hosts/reconcile.js +2 -2
- package/dist/lib/hosts/registry.js +14 -9
- package/dist/lib/hosts/remote-cmd.js +1 -1
- package/dist/lib/hosts/remote-os.d.ts +9 -6
- package/dist/lib/hosts/remote-os.js +13 -6
- package/dist/lib/hosts/routing-flag.d.ts +23 -0
- package/dist/lib/hosts/routing-flag.js +41 -0
- package/dist/lib/hosts/run-target.js +1 -1
- package/dist/lib/hosts/session-index.js +1 -1
- package/dist/lib/hosts/tasks.d.ts +6 -6
- package/dist/lib/hosts/tasks.js +4 -4
- package/dist/lib/hosts/types.js +1 -2
- package/dist/lib/installations/resolve.js +2 -8
- package/dist/lib/isolation-boundary-report.js +0 -1
- package/dist/lib/linear-cache.d.ts +7 -0
- package/dist/lib/linear-cache.js +31 -4
- package/dist/lib/linear-project-counts.d.ts +1 -1
- package/dist/lib/linear-project-counts.js +2 -3
- package/dist/lib/linear-projects.js +1 -1
- package/dist/lib/loop.d.ts +2 -2
- package/dist/lib/loop.js +1 -1
- package/dist/lib/mailbox-target.d.ts +1 -1
- package/dist/lib/mailbox-target.js +1 -1
- package/dist/lib/manifest.js +7 -4
- 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/snapshot.d.ts +3 -2
- package/dist/lib/menubar/snapshot.js +6 -2
- package/dist/lib/migrate-fold.d.ts +33 -0
- package/dist/lib/migrate-fold.js +130 -0
- package/dist/lib/migrate.d.ts +34 -34
- package/dist/lib/migrate.js +106 -128
- package/dist/lib/model-tier-overrides.d.ts +1 -1
- package/dist/lib/model-tier-overrides.js +15 -2
- package/dist/lib/monitors/config.d.ts +17 -3
- package/dist/lib/monitors/config.js +52 -18
- package/dist/lib/monitors/engine.d.ts +32 -1
- package/dist/lib/monitors/engine.js +94 -11
- package/dist/lib/monitors/fingerprint.d.ts +46 -0
- package/dist/lib/monitors/fingerprint.js +100 -0
- package/dist/lib/monitors/remote.d.ts +47 -0
- package/dist/lib/monitors/remote.js +81 -0
- package/dist/lib/monitors/state.d.ts +39 -0
- package/dist/lib/monitors/state.js +56 -0
- package/dist/lib/onepassword.d.ts +17 -0
- package/dist/lib/onepassword.js +52 -22
- package/dist/lib/open-url.js +1 -1
- package/dist/lib/picker.d.ts +14 -2
- package/dist/lib/picker.js +35 -13
- package/dist/lib/placement.d.ts +1 -1
- package/dist/lib/placement.js +1 -1
- package/dist/lib/pr-land-detach.d.ts +32 -0
- package/dist/lib/pr-land-detach.js +79 -0
- package/dist/lib/profiles-presets.js +13 -0
- package/dist/lib/profiles.d.ts +2 -0
- package/dist/lib/profiles.js +44 -1
- package/dist/lib/project-focus.d.ts +1 -1
- package/dist/lib/project-focus.js +1 -1
- package/dist/lib/project-probe.d.ts +4 -1
- package/dist/lib/project-probe.js +5 -4
- package/dist/lib/project-resources.js +2 -18
- package/dist/lib/project-root.d.ts +16 -0
- package/dist/lib/project-root.js +20 -2
- package/dist/lib/projects.d.ts +20 -1
- package/dist/lib/projects.js +78 -1
- package/dist/lib/refresh-coordinator.d.ts +24 -0
- package/dist/lib/refresh-coordinator.js +52 -0
- package/dist/lib/registry.d.ts +2 -2
- package/dist/lib/registry.js +1 -1
- package/dist/lib/resource-aliases.d.ts +13 -0
- package/dist/lib/resource-aliases.js +26 -0
- package/dist/lib/resources/types.d.ts +1 -1
- package/dist/lib/resources.d.ts +16 -0
- package/dist/lib/resources.js +66 -10
- package/dist/lib/rotate.d.ts +3 -4
- package/dist/lib/rotate.js +4 -5
- package/dist/lib/routine-activation.d.ts +22 -2
- package/dist/lib/routine-activation.js +63 -16
- package/dist/lib/routine-context.d.ts +9 -2
- package/dist/lib/routine-context.js +21 -6
- package/dist/lib/routines-project.d.ts +58 -48
- package/dist/lib/routines-project.js +190 -159
- package/dist/lib/routines.d.ts +41 -6
- package/dist/lib/routines.js +92 -34
- package/dist/lib/run-defaults.d.ts +5 -0
- package/dist/lib/run-defaults.js +11 -1
- package/dist/lib/runner.d.ts +10 -8
- package/dist/lib/runner.js +122 -39
- 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.d.ts +10 -3
- package/dist/lib/secrets/agent.js +43 -8
- package/dist/lib/secrets/bundles.d.ts +1 -0
- package/dist/lib/secrets/bundles.js +92 -80
- package/dist/lib/secrets/index.js +32 -9
- package/dist/lib/secrets/install-helper.d.ts +4 -4
- package/dist/lib/secrets/install-helper.js +4 -4
- package/dist/lib/secrets/push.d.ts +40 -6
- package/dist/lib/secrets/push.js +58 -11
- package/dist/lib/secrets/read-backoff.d.ts +1 -1
- package/dist/lib/secrets/read-backoff.js +1 -1
- package/dist/lib/secrets/remote.d.ts +24 -0
- package/dist/lib/secrets/remote.js +54 -4
- package/dist/lib/self-update.d.ts +108 -0
- package/dist/lib/self-update.js +276 -1
- package/dist/lib/session/active.d.ts +89 -5
- package/dist/lib/session/active.js +165 -10
- package/dist/lib/session/actor-sidecar.d.ts +1 -1
- package/dist/lib/session/actor-sidecar.js +2 -1
- package/dist/lib/session/db.d.ts +176 -2
- package/dist/lib/session/db.js +484 -17
- package/dist/lib/session/discover.js +27 -4
- package/dist/lib/session/hook-sessions.js +2 -2
- package/dist/lib/session/host-link.d.ts +2 -2
- package/dist/lib/session/host-link.js +2 -2
- package/dist/lib/session/pid-registry.d.ts +21 -0
- package/dist/lib/session/pid-registry.js +57 -0
- package/dist/lib/session/remote-active.js +15 -1
- package/dist/lib/session/remote.js +2 -2
- package/dist/lib/session/session-cache.d.ts +14 -7
- package/dist/lib/session/session-cache.js +51 -9
- package/dist/lib/session/state.d.ts +2 -2
- package/dist/lib/session/state.js +1 -1
- package/dist/lib/session/sync/config.d.ts +10 -10
- package/dist/lib/session/sync/config.js +10 -10
- package/dist/lib/session/sync/r2.d.ts +34 -0
- package/dist/lib/session/sync/r2.js +123 -0
- package/dist/lib/session/throughput.d.ts +1 -1
- package/dist/lib/session/throughput.js +1 -1
- package/dist/lib/session/types.d.ts +23 -1
- package/dist/lib/session/types.js +15 -0
- package/dist/lib/session/viewing-in.d.ts +1 -1
- package/dist/lib/session/viewing-in.js +1 -1
- package/dist/lib/session/watch.d.ts +101 -0
- package/dist/lib/session/watch.js +242 -0
- package/dist/lib/share/config.d.ts +4 -0
- package/dist/lib/share/config.js +1 -0
- package/dist/lib/share/provision.d.ts +38 -0
- package/dist/lib/share/provision.js +50 -0
- package/dist/lib/share/publish.d.ts +40 -1
- package/dist/lib/share/publish.js +116 -3
- package/dist/lib/share/worker-template.js +71 -6
- package/dist/lib/shims.d.ts +17 -3
- package/dist/lib/shims.js +98 -26
- package/dist/lib/signin-badge.js +3 -2
- package/dist/lib/skills.js +2 -0
- package/dist/lib/smart-launch.d.ts +8 -8
- package/dist/lib/smart-launch.js +80 -59
- package/dist/lib/ssh-exec.d.ts +1 -1
- package/dist/lib/ssh-exec.js +1 -1
- package/dist/lib/staleness/prune.d.ts +88 -0
- package/dist/lib/staleness/prune.js +69 -0
- package/dist/lib/staleness/registry.d.ts +1 -1
- package/dist/lib/staleness/writers/commands.js +34 -2
- package/dist/lib/staleness/writers/hooks.js +16 -0
- package/dist/lib/staleness/writers/kinds.d.ts +6 -0
- package/dist/lib/staleness/writers/skills.js +19 -0
- package/dist/lib/staleness/writers/subagents.d.ts +2 -3
- package/dist/lib/staleness/writers/subagents.js +0 -4
- package/dist/lib/staleness/writers/types.d.ts +32 -0
- package/dist/lib/startup/command-registry.d.ts +6 -12
- package/dist/lib/startup/command-registry.js +11 -31
- package/dist/lib/startup/dev-build.d.ts +10 -0
- package/dist/lib/startup/dev-build.js +13 -1
- package/dist/lib/startup/spellcheck.d.ts +18 -0
- package/dist/lib/startup/spellcheck.js +45 -0
- package/dist/lib/state.d.ts +36 -9
- package/dist/lib/state.js +96 -46
- package/dist/lib/subagents-registry.d.ts +0 -7
- package/dist/lib/subagents-registry.js +38 -65
- package/dist/lib/subagents.d.ts +0 -33
- package/dist/lib/subagents.js +0 -75
- package/dist/lib/sync-umbrella.js +1 -1
- package/dist/lib/teams/agents.d.ts +41 -1
- package/dist/lib/teams/agents.js +187 -9
- package/dist/lib/teams/api.d.ts +11 -1
- package/dist/lib/teams/api.js +11 -2
- package/dist/lib/teams/delivery.d.ts +41 -0
- package/dist/lib/teams/delivery.js +60 -0
- package/dist/lib/teams/registry.d.ts +14 -0
- package/dist/lib/teams/registry.js +51 -1
- package/dist/lib/teams/remoteWorktree.d.ts +19 -0
- package/dist/lib/teams/remoteWorktree.js +29 -0
- package/dist/lib/teams/scheduler.d.ts +1 -1
- package/dist/lib/teams/scheduler.js +1 -1
- package/dist/lib/teams/worktree.d.ts +24 -0
- package/dist/lib/teams/worktree.js +42 -0
- package/dist/lib/terminal/backends/vscodium-agent.d.ts +10 -1
- package/dist/lib/terminal/backends/vscodium-agent.js +16 -5
- package/dist/lib/terminal/engine.d.ts +4 -0
- package/dist/lib/terminal/engine.js +8 -2
- package/dist/lib/terminal/types.d.ts +21 -2
- package/dist/lib/testdata/refresh-coordinator-worker.d.ts +1 -0
- package/dist/lib/testdata/refresh-coordinator-worker.js +23 -0
- package/dist/lib/tickets/list.d.ts +53 -0
- package/dist/lib/tickets/list.js +153 -0
- package/dist/lib/tmux/orphan-reap.d.ts +320 -0
- package/dist/lib/tmux/orphan-reap.js +644 -0
- package/dist/lib/tmux/session.d.ts +68 -3
- package/dist/lib/tmux/session.js +95 -5
- package/dist/lib/triggers/handlers.d.ts +20 -0
- package/dist/lib/triggers/handlers.js +6 -1
- package/dist/lib/types.d.ts +46 -34
- package/dist/lib/usage-fleet.d.ts +32 -0
- package/dist/lib/usage-fleet.js +125 -0
- package/dist/lib/usage-refresh.d.ts +3 -3
- package/dist/lib/usage-refresh.js +19 -16
- package/dist/lib/usage.d.ts +51 -47
- package/dist/lib/usage.js +145 -153
- package/dist/lib/version-duplicates.js +2 -2
- package/dist/lib/versions.d.ts +56 -13
- package/dist/lib/versions.js +195 -45
- package/dist/lib/watchdog/log.d.ts +1 -1
- package/dist/lib/watchdog/log.js +3 -3
- package/dist/lib/watchdog/rotate.d.ts +6 -6
- package/dist/lib/watchdog/rotate.js +6 -6
- package/dist/lib/workflows.d.ts +1 -1
- package/dist/lib/yaml-io.d.ts +47 -0
- package/dist/lib/yaml-io.js +55 -0
- package/package.json +2 -1
- package/scripts/install-helper.js +2 -2
- package/scripts/postinstall.js +23 -20
- package/dist/commands/defaults.d.ts +0 -7
- package/dist/commands/defaults.js +0 -107
- package/dist/commands/export.d.ts +0 -11
- package/dist/commands/export.js +0 -215
- package/dist/commands/helper.d.ts +0 -12
- package/dist/commands/helper.js +0 -87
- package/dist/commands/hosts.d.ts +0 -11
- package/dist/commands/hosts.js +0 -330
- package/dist/commands/lock.d.ts +0 -12
- package/dist/commands/lock.js +0 -70
- package/dist/commands/pull.d.ts +0 -17
- package/dist/commands/pull.js +0 -39
- package/dist/commands/push.d.ts +0 -14
- package/dist/commands/push.js +0 -30
- package/dist/commands/wallet.d.ts +0 -20
- package/dist/commands/wallet.js +0 -216
- package/dist/commands/worktree.d.ts +0 -19
- package/dist/commands/worktree.js +0 -272
- package/dist/lib/account-labels.d.ts +0 -24
- package/dist/lib/account-labels.js +0 -72
- package/dist/lib/auto-dispatch-linear.d.ts +0 -18
- package/dist/lib/auto-dispatch-linear.js +0 -107
- package/dist/lib/auto-dispatch-provider.d.ts +0 -10
- package/dist/lib/auto-dispatch-provider.js +0 -30
- package/dist/lib/auto-dispatch.d.ts +0 -93
- package/dist/lib/auto-dispatch.js +0 -128
- package/dist/lib/export.d.ts +0 -72
- package/dist/lib/export.js +0 -269
- package/dist/lib/lock.d.ts +0 -93
- package/dist/lib/lock.js +0 -207
- package/dist/lib/wallet/index.d.ts +0 -78
- package/dist/lib/wallet/index.js +0 -253
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Daemon-owned usage refresher (
|
|
2
|
+
* Daemon-owned usage refresher (publisher host).
|
|
3
3
|
*
|
|
4
4
|
* The routing hot path (`agents run` → collectRunCandidates) reads usage
|
|
5
|
-
* CACHE-ONLY (`getUsageInfoForIdentity
|
|
5
|
+
* CACHE-ONLY (`getUsageInfoForIdentity`, RUSH-2061) and never blocks
|
|
6
6
|
* on a provider fetch. Something still has to keep that cache fresh — this
|
|
7
|
-
* module is that something, running inside the daemon on
|
|
7
|
+
* module is that something, running inside the daemon on the configured
|
|
8
|
+
* `usage.primary-host` (or locally when no primary is configured).
|
|
8
9
|
*
|
|
9
10
|
* Design:
|
|
10
11
|
*
|
|
11
|
-
* - **
|
|
12
|
-
*
|
|
12
|
+
* - **Fleet sole writer.** Only the configured primary lists credential-backed
|
|
13
|
+
* accounts and calls providers. It exports derived snapshots/headroom;
|
|
14
|
+
* subscriber hosts import that token-free envelope (`usage-fleet.ts`).
|
|
13
15
|
* - **Fixed 5-minute cadence** (`REFRESH_INTERVAL_MS`). Enough to keep
|
|
14
16
|
* balanced/`agents view` off multi-hour stale data without thrashing
|
|
15
17
|
* provider APIs when the user runs agents frequently. The delay helpers
|
|
@@ -48,7 +50,7 @@ import * as fs from 'fs';
|
|
|
48
50
|
import * as path from 'path';
|
|
49
51
|
import { getCacheDir } from './state.js';
|
|
50
52
|
import { atomicWriteFileSync, ensureLockTarget, withFileLock } from './fs-atomic.js';
|
|
51
|
-
import { deriveUsageHeadroom,
|
|
53
|
+
import { deriveUsageHeadroom, buildCanonicalUsageContext, USAGE_SOURCE_AGENT_IDS, } from './usage.js';
|
|
52
54
|
import { getAccountInfo } from './agents.js';
|
|
53
55
|
import { listInstalledVersions, getVersionHomePath } from './versions.js';
|
|
54
56
|
/**
|
|
@@ -170,18 +172,16 @@ export function nextHeadroomEntry(prev, snapshot, now) {
|
|
|
170
172
|
};
|
|
171
173
|
}
|
|
172
174
|
/**
|
|
173
|
-
* Enumerate the
|
|
175
|
+
* Enumerate the usage accounts whose credentials live on THIS host — one
|
|
174
176
|
* per unique usage key, deduped to the most-recently-active version (the same
|
|
175
177
|
* canonicalization `getUsageInfoByIdentity` uses). Each carries a closure that
|
|
176
178
|
* live-fetches its usage. This is the daemon's `listAccounts`; because it only
|
|
177
179
|
* ever lists local, signed-in accounts, each host is the sole writer for its own
|
|
178
|
-
* accounts' caches
|
|
180
|
+
* accounts' caches. `runUsageRefreshTick` calls this only on the fleet publisher.
|
|
179
181
|
*/
|
|
180
182
|
export async function buildLocalUsageAccounts() {
|
|
181
183
|
const accounts = [];
|
|
182
184
|
for (const agentId of USAGE_SOURCE_AGENT_IDS) {
|
|
183
|
-
if (!agentUsesNetworkUsage(agentId))
|
|
184
|
-
continue;
|
|
185
185
|
const versions = listInstalledVersions(agentId);
|
|
186
186
|
if (versions.length === 0)
|
|
187
187
|
continue;
|
|
@@ -201,12 +201,15 @@ export async function buildLocalUsageAccounts() {
|
|
|
201
201
|
// that path is the Touch ID storm. Usage reads the file-based setup-token
|
|
202
202
|
// only, never the interactive login (see loadClaudeOauth); no setup-token
|
|
203
203
|
// reads as "usage pending".
|
|
204
|
-
fetch: () =>
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
204
|
+
fetch: async () => {
|
|
205
|
+
const { getUsageInfoForIdentity } = await import('./usage.js');
|
|
206
|
+
return getUsageInfoForIdentity({
|
|
207
|
+
agentId,
|
|
208
|
+
home: fetchInput.home,
|
|
209
|
+
cliVersion: fetchInput.cliVersion,
|
|
210
|
+
info: canonical,
|
|
211
|
+
}, { forceRefresh: true, fileOnly: true });
|
|
212
|
+
},
|
|
210
213
|
});
|
|
211
214
|
}
|
|
212
215
|
}
|
package/dist/lib/usage.d.ts
CHANGED
|
@@ -23,6 +23,29 @@ import type { AgentId } from './types.js';
|
|
|
23
23
|
export declare function usageNoCredentialError(agent: string): string;
|
|
24
24
|
export declare function usageExpiredCredentialError(agent: string): string;
|
|
25
25
|
export declare function usageRejectedError(agent: string, status: number): string;
|
|
26
|
+
/**
|
|
27
|
+
* Canonical phrase for the Anthropic setup-token scope gap (RUSH-2392).
|
|
28
|
+
* `claude setup-token` mints `user:inference` only; the usage endpoint requires
|
|
29
|
+
* `user:profile`. The account can still run; usage bars cannot populate via
|
|
30
|
+
* that token. Callers detect this string with {@link isUsageHeadlessScopeError}
|
|
31
|
+
* so the UI can render it distinctly from a generic "unverified" failure.
|
|
32
|
+
*/
|
|
33
|
+
export declare const USAGE_HEADLESS_SCOPE_MARKER = "usage unavailable (headless)";
|
|
34
|
+
/**
|
|
35
|
+
* Distinct error when Claude's usage API returns 403 because the setup-token
|
|
36
|
+
* lacks `user:profile` (RUSH-2392). Not a revocation, not a missing mint —
|
|
37
|
+
* a permanent tradeoff of the headless credential.
|
|
38
|
+
*/
|
|
39
|
+
export declare function usageHeadlessScopeError(agent?: string): string;
|
|
40
|
+
/** True when an error string is the setup-token scope gap (RUSH-2392). */
|
|
41
|
+
export declare function isUsageHeadlessScopeError(error: string | null | undefined): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Detect Anthropic's usage-endpoint scope denial: HTTP 403 whose body names
|
|
44
|
+
* `user:profile` (or "scope requirement"). A bare 403 without that body stays
|
|
45
|
+
* classified as a real rejection — only the known setup-token shape is special
|
|
46
|
+
* (RUSH-2392).
|
|
47
|
+
*/
|
|
48
|
+
export declare function isClaudeUsageScopeDenied(status: number, bodyText: string | null | undefined): boolean;
|
|
26
49
|
/**
|
|
27
50
|
* The read threw rather than answering — a timeout, DNS/TLS failure, a payload
|
|
28
51
|
* that would not parse, a credential that would not decrypt. Every provider
|
|
@@ -169,9 +192,9 @@ export declare function buildCanonicalUsageContext(inputs: UsageIdentityInput[])
|
|
|
169
192
|
export declare function agentReportsUsage(agentId: AgentId): boolean;
|
|
170
193
|
/**
|
|
171
194
|
* Whether an agent's usage source makes a live NETWORK call (Claude/Kimi/Droid/
|
|
172
|
-
* Cursor/Antigravity) versus reading local session logs (Codex/Grok).
|
|
173
|
-
*
|
|
174
|
-
*
|
|
195
|
+
* Cursor/Antigravity) versus reading local session logs (Codex/Grok). Both
|
|
196
|
+
* kinds publish through the shared cache; callers use this only to distinguish
|
|
197
|
+
* provider I/O from local collection.
|
|
175
198
|
*/
|
|
176
199
|
export declare function agentUsesNetworkUsage(agentId: AgentId): boolean;
|
|
177
200
|
/**
|
|
@@ -181,56 +204,24 @@ export declare function agentUsesNetworkUsage(agentId: AgentId): boolean;
|
|
|
181
204
|
* (and cannot stack behind delayed responses until the process is pegged).
|
|
182
205
|
*/
|
|
183
206
|
export declare const USAGE_FETCH_CONCURRENCY = 3;
|
|
184
|
-
/**
|
|
185
|
-
* How long a cached snapshot is treated as fresh enough that we skip the network
|
|
186
|
-
* entirely. Five minutes balances "still accurate enough to glance at" against
|
|
187
|
-
* "don't re-hit every account on every `agents view` in a tight loop". Was 2
|
|
188
|
-
* minutes; that re-fired too often when delayed responses stacked.
|
|
189
|
-
*/
|
|
190
|
-
export declare const USAGE_CACHE_FRESH_MS: number;
|
|
191
|
-
export declare const USAGE_CACHE_SWR_MS: number;
|
|
192
207
|
/**
|
|
193
208
|
* Unified entry for every multi-account usage lookup (`agents view`, rotation,
|
|
194
|
-
* JSON export). Deduplicates by usage identity
|
|
195
|
-
*
|
|
196
|
-
* cannot pile up.
|
|
209
|
+
* JSON export). Deduplicates by usage identity and reads the shared snapshot.
|
|
210
|
+
* Only an explicit `forceRefresh` call may collect provider or local-log state.
|
|
197
211
|
*/
|
|
198
|
-
export
|
|
212
|
+
export interface UsageLookupOptions {
|
|
199
213
|
forceRefresh?: boolean;
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
214
|
+
fileOnly?: boolean;
|
|
215
|
+
}
|
|
216
|
+
export declare function getUsageInfoByIdentity(inputs: UsageIdentityInput[], opts?: UsageLookupOptions): Promise<{
|
|
203
217
|
canonicalByUsageKey: Map<string, AccountInfo>;
|
|
204
218
|
usageByKey: Map<string, UsageInfo>;
|
|
205
219
|
}>;
|
|
206
220
|
/**
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
* caller that is about to ROUTE on the number passes a shorter `maxAgeMs` and
|
|
210
|
-
* gets a live read instead of a day-old one. Never widens past 24h — a caller
|
|
211
|
-
* cannot opt into more staleness than the cache policy allows.
|
|
221
|
+
* Fetch usage for one identity. Ordinary callers always read the shared cache;
|
|
222
|
+
* the daemon and explicit `--refresh` calls collect through one device lease.
|
|
212
223
|
*/
|
|
213
|
-
export declare function
|
|
214
|
-
/**
|
|
215
|
-
* Fetch usage for a single identity using stale-while-revalidate.
|
|
216
|
-
*
|
|
217
|
-
* - Cache fresh (< 5 min): return cached snapshot, NO network.
|
|
218
|
-
* - Cache stale but < 24h: return cached snapshot instantly, enqueue a
|
|
219
|
-
* concurrency-capped background refresh.
|
|
220
|
-
* - Cache too stale or absent: block on live fetch (shared in-flight promise),
|
|
221
|
-
* fall back to cache on error.
|
|
222
|
-
*
|
|
223
|
-
* This keeps `agents run` / `agents view` off the network on the hot path. The
|
|
224
|
-
* first invocation after a cold install or 24h gap still blocks once to seed
|
|
225
|
-
* the cache; every run after that returns instantly while the cache silently
|
|
226
|
-
* refreshes in the background — never more than {@link USAGE_BG_REFRESH_CONCURRENCY}
|
|
227
|
-
* at a time.
|
|
228
|
-
*/
|
|
229
|
-
export declare function getUsageInfoForIdentity(input: UsageIdentityInput, opts?: {
|
|
230
|
-
forceRefresh?: boolean;
|
|
231
|
-
maxAgeMs?: number;
|
|
232
|
-
readOnly?: boolean;
|
|
233
|
-
}): Promise<UsageInfo>;
|
|
224
|
+
export declare function getUsageInfoForIdentity(input: UsageIdentityInput, opts?: UsageLookupOptions): Promise<UsageInfo>;
|
|
234
225
|
/**
|
|
235
226
|
* Pick which usage windows to render in a compact one-line summary.
|
|
236
227
|
*
|
|
@@ -245,6 +236,12 @@ export declare function pickCompactUsageWindows(windows: UsageWindow[], maxWindo
|
|
|
245
236
|
export interface FormatUsageSummaryOpts {
|
|
246
237
|
unavailable?: boolean;
|
|
247
238
|
unverified?: boolean;
|
|
239
|
+
/**
|
|
240
|
+
* Setup-token lacks `user:profile` so usage cannot be read headlessly
|
|
241
|
+
* (RUSH-2392). Distinct from generic `unverified` (cache unconfirmed) —
|
|
242
|
+
* minting again will not help; the account still runs.
|
|
243
|
+
*/
|
|
244
|
+
headless?: boolean;
|
|
248
245
|
/**
|
|
249
246
|
* Cap how many usage windows render on one line. Overview (`agents view`
|
|
250
247
|
* with no agent filter) passes 2 so multi-window agents cannot blow out
|
|
@@ -392,7 +389,7 @@ interface DroidLimitWindow {
|
|
|
392
389
|
usedPercent?: number | null;
|
|
393
390
|
windowEnd?: string | null;
|
|
394
391
|
}
|
|
395
|
-
/** Response shape from Factory's billing limits endpoint (subset we render). */
|
|
392
|
+
/** Response shape from Factory.ai's billing limits endpoint (subset we render). */
|
|
396
393
|
export interface DroidBillingLimitsResponse {
|
|
397
394
|
usesTokenRateLimitsBilling?: boolean | null;
|
|
398
395
|
limits?: {
|
|
@@ -404,7 +401,7 @@ export interface DroidBillingLimitsResponse {
|
|
|
404
401
|
} | null;
|
|
405
402
|
}
|
|
406
403
|
/**
|
|
407
|
-
* Fetch Droid usage via Factory's billing limits API — the same endpoint the
|
|
404
|
+
* Fetch Droid usage via Factory.ai's billing limits API — the same endpoint the
|
|
408
405
|
* droid CLI polls for its token-limit banner. The WorkOS access token comes
|
|
409
406
|
* from the locally decrypted ~/.factory/auth.v2.file (the same credential
|
|
410
407
|
* account identity in agents.ts reads).
|
|
@@ -435,6 +432,13 @@ export interface ProviderProbe {
|
|
|
435
432
|
token: 'present' | 'missing' | 'expired';
|
|
436
433
|
/** Network/parse error message when status is null but a token was present. */
|
|
437
434
|
error?: string;
|
|
435
|
+
/**
|
|
436
|
+
* Known non-revocation cause for a non-2xx status.
|
|
437
|
+
* `usage_scope` — Anthropic returned 403 because the setup-token lacks
|
|
438
|
+
* `user:profile` (RUSH-2392). Token is valid for inference; usage is unreadable.
|
|
439
|
+
* Auth-health MUST NOT map this to `revoked`.
|
|
440
|
+
*/
|
|
441
|
+
reason?: 'usage_scope';
|
|
438
442
|
}
|
|
439
443
|
/** Probe Claude's OAuth token against the usage endpoint. Never refreshes — reports `expired` for a near-expiry token; see the comment below (RUSH-1822). */
|
|
440
444
|
export declare function probeClaudeStatus(home?: string, cliVersion?: string | null): Promise<ProviderProbe>;
|
|
@@ -471,7 +475,7 @@ export declare function normalizeDroidWindows(data: DroidBillingLimitsResponse):
|
|
|
471
475
|
* a file-based setup-token and, when none is provisioned, gets `null` — it never
|
|
472
476
|
* reads Claude Code's interactive login (transmitting that ACL-bound OAuth token
|
|
473
477
|
* to Anthropic's API is what gets it revoked; see the branch body and
|
|
474
|
-
* docs/
|
|
478
|
+
* docs/credential-management.md). It is OFF by default so full-credential
|
|
475
479
|
* callers that refresh (`isClaudeAuthValid` -> `getClaudeAccessToken`) or export
|
|
476
480
|
* the full blob (`readClaudeCredentialsBlob` for Rush Cloud dispatch) still read
|
|
477
481
|
* the interactive login.
|