@phnx-labs/agents-cli 1.22.35 → 1.22.38
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 +708 -2
- package/README.md +83 -43
- package/dist/bin/agents +0 -0
- package/dist/bootstrap.d.ts +15 -0
- package/dist/bootstrap.js +1212 -0
- package/dist/commands/accounts.d.ts +4 -11
- package/dist/commands/accounts.js +159 -27
- package/dist/commands/artifacts-setup.d.ts +53 -0
- package/dist/commands/artifacts-setup.js +161 -0
- package/dist/commands/artifacts.d.ts +18 -0
- package/dist/commands/artifacts.js +58 -0
- 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 +17 -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 +86 -42
- 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 +71 -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/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.d.ts +5 -0
- package/dist/commands/setup.js +31 -5
- package/dist/commands/share.d.ts +87 -7
- package/dist/commands/share.js +320 -58
- 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/hygiene.d.ts +90 -0
- package/dist/lib/browser/hygiene.js +146 -0
- package/dist/lib/browser/ipc.d.ts +30 -0
- package/dist/lib/browser/ipc.js +93 -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 +79 -1
- package/dist/lib/browser/service.js +231 -14
- 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 +63 -1
- 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 +21 -7
- package/dist/lib/git.js +122 -18
- 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 +44 -7
- 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/analytics.js +1 -1
- package/dist/lib/share/capture.d.ts +1 -1
- package/dist/lib/share/capture.js +3 -3
- package/dist/lib/share/config.d.ts +6 -2
- package/dist/lib/share/config.js +6 -5
- package/dist/lib/share/delete.js +3 -3
- package/dist/lib/share/provision.d.ts +38 -0
- package/dist/lib/share/provision.js +51 -1
- package/dist/lib/share/publish.d.ts +40 -1
- package/dist/lib/share/publish.js +119 -6
- package/dist/lib/share/worker-template.d.ts +12 -1
- package/dist/lib/share/worker-template.js +83 -7
- 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 +16 -14
- package/dist/lib/startup/command-registry.js +26 -37
- 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 +316 -0
- package/dist/lib/tmux/orphan-reap.js +638 -0
- package/dist/lib/tmux/session.d.ts +68 -3
- package/dist/lib/tmux/session.js +96 -5
- package/dist/lib/triggers/handlers.d.ts +20 -0
- package/dist/lib/triggers/handlers.js +16 -1
- package/dist/lib/triggers/webhook.js +10 -0
- package/dist/lib/types.d.ts +47 -35
- 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/set.d.ts +0 -15
- package/dist/commands/set.js +0 -79
- package/dist/commands/setup-share.d.ts +0 -17
- package/dist/commands/setup-share.js +0 -85
- 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
package/dist/lib/self-update.js
CHANGED
|
@@ -16,9 +16,19 @@ import * as os from 'os';
|
|
|
16
16
|
import * as path from 'path';
|
|
17
17
|
import { createHash, timingSafeEqual } from 'crypto';
|
|
18
18
|
import { spawnSync } from 'child_process';
|
|
19
|
-
|
|
19
|
+
// Leaf comparator only — do not pull the full versions.ts graph into every
|
|
20
|
+
// bootstrap that imports self-update (RUSH-2331).
|
|
21
|
+
import { compareVersions } from './agent-spec/primitives.js';
|
|
20
22
|
import { needsWindowsShell } from './platform/index.js';
|
|
21
23
|
export const NPM_PACKAGE_NAME = '@phnx-labs/agents-cli';
|
|
24
|
+
/**
|
|
25
|
+
* First published release that stopped the usage/auth-health probe from reading
|
|
26
|
+
* Claude Code's interactive login (commit 3f3554c51). Pre-this versions on a
|
|
27
|
+
* macOS box re-introduce the Touch ID storm + fleet-wide revocation class
|
|
28
|
+
* (RUSH-2415 / RUSH-1822). Anything older is a latent regression while a fixed
|
|
29
|
+
* copy sits next to it.
|
|
30
|
+
*/
|
|
31
|
+
export const TOUCH_ID_STORM_FIXED_SINCE = '1.22.30';
|
|
22
32
|
/**
|
|
23
33
|
* The directory bun installs global packages into:
|
|
24
34
|
* <BUN_INSTALL>/install/global (BUN_INSTALL defaults to ~/.bun)
|
|
@@ -116,6 +126,84 @@ export function shouldPromptUpgrade(cache, currentVersion) {
|
|
|
116
126
|
compareVersions(cache.latestVersion, currentVersion) > 0 &&
|
|
117
127
|
cache.latestVersion !== cache.dismissed);
|
|
118
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Short TTL for the multi-install PATH scan cache (RUSH-2324). The full
|
|
131
|
+
* `findAgentsCliInstalls` walk over PATH + known roots costs ~1ms on a warm
|
|
132
|
+
* box and runs on every ordinary CLI invocation via `maybeWarnMultiInstall`.
|
|
133
|
+
* Same 5-minute window as the detached-sync spawn gate so both bootstrap
|
|
134
|
+
* savings share one recency policy.
|
|
135
|
+
*/
|
|
136
|
+
export const MULTI_INSTALL_SCAN_TTL_MS = 5 * 60 * 1000;
|
|
137
|
+
/** Read a multi-install scan cache. Returns null if missing or corrupt. */
|
|
138
|
+
export function readMultiInstallScanCache(file) {
|
|
139
|
+
try {
|
|
140
|
+
const raw = JSON.parse(fs.readFileSync(file, 'utf-8'));
|
|
141
|
+
if (typeof raw.scannedAt !== 'number' ||
|
|
142
|
+
typeof raw.pathEnv !== 'string' ||
|
|
143
|
+
typeof raw.runningRoot !== 'string' ||
|
|
144
|
+
typeof raw.runningVersion !== 'string' ||
|
|
145
|
+
!Array.isArray(raw.inventory)) {
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
return raw;
|
|
149
|
+
}
|
|
150
|
+
catch {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/** Persist a multi-install scan result. Best-effort. */
|
|
155
|
+
export function writeMultiInstallScanCache(file, cache) {
|
|
156
|
+
try {
|
|
157
|
+
const dir = path.dirname(file);
|
|
158
|
+
if (!fs.existsSync(dir))
|
|
159
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
160
|
+
fs.writeFileSync(file, JSON.stringify(cache));
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
/* best-effort */
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Whether a multi-install scan cache is still usable for this invocation.
|
|
168
|
+
* Invalid when missing, past TTL, PATH changed, or the running copy identity
|
|
169
|
+
* (root / version) changed — those are exactly the cases where a re-scan can
|
|
170
|
+
* surface a different inventory and re-fire the warning.
|
|
171
|
+
*/
|
|
172
|
+
export function isMultiInstallScanFresh(cache, pathEnv, runningRoot, runningVersion, now = Date.now(), ttlMs = MULTI_INSTALL_SCAN_TTL_MS) {
|
|
173
|
+
if (!cache)
|
|
174
|
+
return false;
|
|
175
|
+
if (now - cache.scannedAt >= ttlMs)
|
|
176
|
+
return false;
|
|
177
|
+
if (cache.pathEnv !== pathEnv)
|
|
178
|
+
return false;
|
|
179
|
+
if (cache.runningRoot !== runningRoot)
|
|
180
|
+
return false;
|
|
181
|
+
if (cache.runningVersion !== runningVersion)
|
|
182
|
+
return false;
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Resolve the multi-install inventory, hitting the on-disk scan cache when
|
|
187
|
+
* fresh. Callers that only need the inventory (the bootstrap multi-install
|
|
188
|
+
* warning) avoid the ~1ms PATH walk on the warm path (RUSH-2324).
|
|
189
|
+
*/
|
|
190
|
+
export function resolveMultiInstallInventory(runningRoot, runningVersion, pathEnv, cacheFile, opts = {}) {
|
|
191
|
+
const now = opts.now ?? Date.now();
|
|
192
|
+
const ttlMs = opts.ttlMs ?? MULTI_INSTALL_SCAN_TTL_MS;
|
|
193
|
+
const cached = readMultiInstallScanCache(cacheFile);
|
|
194
|
+
if (isMultiInstallScanFresh(cached, pathEnv, runningRoot, runningVersion, now, ttlMs)) {
|
|
195
|
+
return cached.inventory;
|
|
196
|
+
}
|
|
197
|
+
const inventory = buildMultiInstallInventory(runningRoot, runningVersion, findAgentsCliInstalls(pathEnv, opts.findOpts));
|
|
198
|
+
writeMultiInstallScanCache(cacheFile, {
|
|
199
|
+
scannedAt: now,
|
|
200
|
+
pathEnv,
|
|
201
|
+
runningRoot,
|
|
202
|
+
runningVersion,
|
|
203
|
+
inventory,
|
|
204
|
+
});
|
|
205
|
+
return inventory;
|
|
206
|
+
}
|
|
119
207
|
/**
|
|
120
208
|
* Whether `p` is Bun's embedded virtual filesystem — where a standalone
|
|
121
209
|
* executable exposes its bundled sources. Nothing there exists on disk: it
|
|
@@ -346,6 +434,193 @@ export function buildMultiInstallInventory(runningRoot, runningVersion, installs
|
|
|
346
434
|
}
|
|
347
435
|
return [...byRoot.values()];
|
|
348
436
|
}
|
|
437
|
+
/** True when the package root lives under npm's `_npx` cache (ephemeral runs). */
|
|
438
|
+
export function isNpxCacheInstall(packageRoot) {
|
|
439
|
+
// Split on either separator so a POSIX-shaped path is still recognized when
|
|
440
|
+
// this runs on Windows (doctor --fix / tests pass forward literal `_npx`
|
|
441
|
+
// paths from other boxes). `path.sep` alone missed `/home/…/_npx/…` on win32.
|
|
442
|
+
const parts = packageRoot.split(/[\\/]/);
|
|
443
|
+
return parts.includes('_npx');
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* A release string that is at least TOUCH_ID_STORM_FIXED_SINCE, or a side-by-side
|
|
447
|
+
* dev build (`0.0.0-dev.*`) which tracks main and therefore carries the fix.
|
|
448
|
+
* Non-semver junk never qualifies as "fixed" — better to leave a weird copy
|
|
449
|
+
* alone than delete the only working install.
|
|
450
|
+
*/
|
|
451
|
+
export function isTouchIdStormFixedVersion(version) {
|
|
452
|
+
if (version.startsWith('0.0.0-dev.') || version === '0.0.0-dev')
|
|
453
|
+
return true;
|
|
454
|
+
// compareVersions is numeric-segment only; refuse anything that does not
|
|
455
|
+
// look like a release before treating it as "older than fixed".
|
|
456
|
+
if (!/^\d+(\.\d+)*/.test(version))
|
|
457
|
+
return false;
|
|
458
|
+
return compareVersions(version, TOUCH_ID_STORM_FIXED_SINCE) >= 0;
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Classify discovered installs that doctor --fix / upgrade may delete.
|
|
462
|
+
*
|
|
463
|
+
* Never marks the running package root. Auto-purge is limited to copies that
|
|
464
|
+
* cannot be the intended primary install:
|
|
465
|
+
* - npx-cache trees (ephemeral)
|
|
466
|
+
* - pre-atomic-helper-installer trees ("unsafe legacy helper installer")
|
|
467
|
+
* - pre-TOUCH_ID_STORM_FIXED_SINCE trees, but only when at least one fixed
|
|
468
|
+
* copy already exists on the box (so we never strand the machine)
|
|
469
|
+
*
|
|
470
|
+
* A pre-fixed copy that is also the only install stays — the user must upgrade
|
|
471
|
+
* it in place rather than delete it.
|
|
472
|
+
*/
|
|
473
|
+
export function classifyRemovableAgentsCliInstalls(runningRoot, installs, opts = {}) {
|
|
474
|
+
const fixedSince = opts.fixedSince ?? TOUCH_ID_STORM_FIXED_SINCE;
|
|
475
|
+
let runningCanonical = runningRoot;
|
|
476
|
+
try {
|
|
477
|
+
runningCanonical = fs.realpathSync(runningRoot);
|
|
478
|
+
}
|
|
479
|
+
catch {
|
|
480
|
+
/* keep as given */
|
|
481
|
+
}
|
|
482
|
+
// A fixed peer is any install (including the running copy) that carries the
|
|
483
|
+
// Touch-ID-storm fix. Pre-fixed trees are only deleted when such a peer
|
|
484
|
+
// exists, so a lone stale install is never purged out from under the user.
|
|
485
|
+
const hasFixedPeer = installs.some((install) => isTouchIdStormFixedVersion(install.version));
|
|
486
|
+
const out = [];
|
|
487
|
+
for (const install of installs) {
|
|
488
|
+
let root = install.packageRoot;
|
|
489
|
+
try {
|
|
490
|
+
root = fs.realpathSync(install.packageRoot);
|
|
491
|
+
}
|
|
492
|
+
catch {
|
|
493
|
+
/* keep */
|
|
494
|
+
}
|
|
495
|
+
if (root === runningCanonical)
|
|
496
|
+
continue;
|
|
497
|
+
const reasons = [];
|
|
498
|
+
if (isNpxCacheInstall(root) || isNpxCacheInstall(install.packageRoot)) {
|
|
499
|
+
reasons.push('npx-cache');
|
|
500
|
+
}
|
|
501
|
+
if (!install.atomicHelperInstall) {
|
|
502
|
+
reasons.push('unsafe-legacy-helper');
|
|
503
|
+
}
|
|
504
|
+
if (hasFixedPeer
|
|
505
|
+
&& /^\d+(\.\d+)*/.test(install.version)
|
|
506
|
+
&& compareVersions(install.version, fixedSince) < 0) {
|
|
507
|
+
reasons.push('pre-fixed-version');
|
|
508
|
+
}
|
|
509
|
+
if (reasons.length === 0)
|
|
510
|
+
continue;
|
|
511
|
+
out.push({ packageRoot: root, version: install.version, reasons });
|
|
512
|
+
}
|
|
513
|
+
return out;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Delete classified removable package roots from disk. Re-reads package.json
|
|
517
|
+
* immediately before the unlink so a path that is no longer @phnx-labs/agents-cli
|
|
518
|
+
* is never removed. Best-effort: one failure does not stop the rest.
|
|
519
|
+
*/
|
|
520
|
+
export function purgeRemovableAgentsCliInstalls(candidates, opts = {}) {
|
|
521
|
+
const result = {
|
|
522
|
+
removed: [],
|
|
523
|
+
failed: [],
|
|
524
|
+
skippedRunning: 0,
|
|
525
|
+
};
|
|
526
|
+
let runningCanonical;
|
|
527
|
+
if (opts.runningRoot) {
|
|
528
|
+
try {
|
|
529
|
+
runningCanonical = fs.realpathSync(opts.runningRoot);
|
|
530
|
+
}
|
|
531
|
+
catch {
|
|
532
|
+
runningCanonical = opts.runningRoot;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
for (const candidate of candidates) {
|
|
536
|
+
let root = candidate.packageRoot;
|
|
537
|
+
try {
|
|
538
|
+
root = fs.realpathSync(candidate.packageRoot);
|
|
539
|
+
}
|
|
540
|
+
catch {
|
|
541
|
+
/* keep */
|
|
542
|
+
}
|
|
543
|
+
if (runningCanonical && root === runningCanonical) {
|
|
544
|
+
result.skippedRunning += 1;
|
|
545
|
+
continue;
|
|
546
|
+
}
|
|
547
|
+
// Refuse anything that no longer looks like our package.
|
|
548
|
+
try {
|
|
549
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf-8'));
|
|
550
|
+
if (pkg.name !== NPM_PACKAGE_NAME) {
|
|
551
|
+
result.failed.push({
|
|
552
|
+
...candidate,
|
|
553
|
+
packageRoot: root,
|
|
554
|
+
error: `package.json name is ${String(pkg.name)}, not ${NPM_PACKAGE_NAME}`,
|
|
555
|
+
});
|
|
556
|
+
continue;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
catch (err) {
|
|
560
|
+
result.failed.push({
|
|
561
|
+
...candidate,
|
|
562
|
+
packageRoot: root,
|
|
563
|
+
error: err instanceof Error ? err.message : String(err),
|
|
564
|
+
});
|
|
565
|
+
continue;
|
|
566
|
+
}
|
|
567
|
+
if (opts.dryRun) {
|
|
568
|
+
result.removed.push({ ...candidate, packageRoot: root });
|
|
569
|
+
continue;
|
|
570
|
+
}
|
|
571
|
+
try {
|
|
572
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
573
|
+
result.removed.push({ ...candidate, packageRoot: root });
|
|
574
|
+
}
|
|
575
|
+
catch (err) {
|
|
576
|
+
result.failed.push({
|
|
577
|
+
...candidate,
|
|
578
|
+
packageRoot: root,
|
|
579
|
+
error: err instanceof Error ? err.message : String(err),
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
return result;
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* Scan + classify + purge in one call. Used by `agents doctor --fix` and
|
|
587
|
+
* `agents upgrade` so both paths remediate the same set of latent copies.
|
|
588
|
+
*/
|
|
589
|
+
export function remediateStaleAgentsCliInstalls(opts) {
|
|
590
|
+
const pathEnv = opts.pathEnv ?? (process.env.PATH || '');
|
|
591
|
+
const installs = findAgentsCliInstalls(pathEnv, opts.findOpts);
|
|
592
|
+
// Ensure the running root participates in "has a fixed peer" even when the
|
|
593
|
+
// PATH scan missed it (source tree, unusual layout).
|
|
594
|
+
if (opts.runningVersion) {
|
|
595
|
+
const already = installs.some((i) => {
|
|
596
|
+
try {
|
|
597
|
+
return fs.realpathSync(i.packageRoot) === fs.realpathSync(opts.runningRoot);
|
|
598
|
+
}
|
|
599
|
+
catch {
|
|
600
|
+
return i.packageRoot === opts.runningRoot;
|
|
601
|
+
}
|
|
602
|
+
});
|
|
603
|
+
if (!already) {
|
|
604
|
+
installs.push({
|
|
605
|
+
packageRoot: opts.runningRoot,
|
|
606
|
+
version: opts.runningVersion,
|
|
607
|
+
// Unknown for a synthetic entry — classify only uses version for the
|
|
608
|
+
// fixed-peer check; the running root is never deleted regardless.
|
|
609
|
+
atomicHelperInstall: true,
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
const candidates = classifyRemovableAgentsCliInstalls(opts.runningRoot, installs);
|
|
614
|
+
const purge = purgeRemovableAgentsCliInstalls(candidates, {
|
|
615
|
+
dryRun: opts.dryRun,
|
|
616
|
+
runningRoot: opts.runningRoot,
|
|
617
|
+
});
|
|
618
|
+
return {
|
|
619
|
+
...purge,
|
|
620
|
+
candidates,
|
|
621
|
+
inventory: buildMultiInstallInventory(opts.runningRoot, opts.runningVersion ?? 'unknown', installs),
|
|
622
|
+
};
|
|
623
|
+
}
|
|
349
624
|
function childDirectories(parent) {
|
|
350
625
|
try {
|
|
351
626
|
return fs.readdirSync(parent, { withFileTypes: true })
|
|
@@ -108,7 +108,7 @@ export interface ActiveSession {
|
|
|
108
108
|
activity?: SessionActivity;
|
|
109
109
|
/**
|
|
110
110
|
* Output-token throughput (tokens/sec) over a rolling 60s window, from the
|
|
111
|
-
* transcript tail. The number the
|
|
111
|
+
* transcript tail. The number the Fleet shows next to a running agent;
|
|
112
112
|
* absent when no transcript is resolvable or the agent format reports no usage.
|
|
113
113
|
*/
|
|
114
114
|
tokPerSec?: number;
|
|
@@ -124,7 +124,7 @@ export interface ActiveSession {
|
|
|
124
124
|
plan?: string;
|
|
125
125
|
/**
|
|
126
126
|
* Live plan progress from the most recent `TodoWrite` (RUSH-1380): the checklist
|
|
127
|
-
* items + a done/total tally + the current step. The
|
|
127
|
+
* items + a done/total tally + the current step. The Fleet renders this
|
|
128
128
|
* as an N/M pill + checklist for every session — including remote and
|
|
129
129
|
* device-dispatched agents that have no local tool-call stream to parse.
|
|
130
130
|
*/
|
|
@@ -227,8 +227,19 @@ export interface ActiveSession {
|
|
|
227
227
|
* form). Set when merging cross-machine results so the grouped `--active`
|
|
228
228
|
* view can bucket by computer. Absent for a purely local query (the renderer
|
|
229
229
|
* falls back to provenance.host, then the local machine).
|
|
230
|
+
*
|
|
231
|
+
* For a host-dispatched run this is the EXECUTION host, not the box holding
|
|
232
|
+
* the live shim process — see {@link foldExecutionMachine}.
|
|
230
233
|
*/
|
|
231
234
|
machine?: string;
|
|
235
|
+
/**
|
|
236
|
+
* Set only on the dispatching box's own row for a host-dispatched run
|
|
237
|
+
* (`agents run --device <peer>`): the live process here is the ssh/TTY shim,
|
|
238
|
+
* while the agent itself runs on {@link machine}. Names the box the dispatch
|
|
239
|
+
* was issued from, so a merged fleet view can prefer the executing machine's
|
|
240
|
+
* own richer row over this shim (see `dedupeByMachineSession`).
|
|
241
|
+
*/
|
|
242
|
+
offloadedFrom?: string;
|
|
232
243
|
teamName?: string;
|
|
233
244
|
/**
|
|
234
245
|
* For a teams teammate: the session id of the ORCHESTRATOR that spawned the
|
|
@@ -553,11 +564,16 @@ export declare function readAncestorSessionEntry(pid: number, ppidMap: Map<numbe
|
|
|
553
564
|
* as its own headless row. Two exceptions keep their own row: a candidate with
|
|
554
565
|
* its own registry entry — on its pid OR on a wrapper ancestor strictly below
|
|
555
566
|
* the pid it would fold into (the shim's entry lands on the cmd.exe
|
|
556
|
-
* intermediary on Windows) —
|
|
557
|
-
*
|
|
567
|
+
* intermediary on Windows) — a child whose live argv carries `--session-id`
|
|
568
|
+
* (RUSH-2384: empty by-pid must not fold a real session into a parent and
|
|
569
|
+
* drop it from the active set) — and a child of a *different* agent kind
|
|
570
|
+
* (claude shelling out to codex is a real second session, not a fork).
|
|
558
571
|
* Returns the kept roots plus, per root pid, how many descendants folded in.
|
|
572
|
+
*
|
|
573
|
+
* `hasLiveSessionId` defaults to reading `--session-id` from the live process
|
|
574
|
+
* argv; tests inject a pure predicate so they do not need real agent pids.
|
|
559
575
|
*/
|
|
560
|
-
export declare function foldSubordinateAgents(candidates: AgentCandidate[], ppidMap: Map<number, number>, readEntry: (pid: number) => PidSessionEntry | undefined): {
|
|
576
|
+
export declare function foldSubordinateAgents(candidates: AgentCandidate[], ppidMap: Map<number, number>, readEntry: (pid: number) => PidSessionEntry | undefined, hasLiveSessionId?: (pid: number) => boolean): {
|
|
561
577
|
kept: AgentCandidate[];
|
|
562
578
|
foldedByRoot: Map<number, number>;
|
|
563
579
|
};
|
|
@@ -625,6 +641,21 @@ export declare function listTmuxAgentSessions(): Promise<ActiveSession[]>;
|
|
|
625
641
|
* terminal/headless row for the same session id.
|
|
626
642
|
*/
|
|
627
643
|
export declare function getActiveSessions(opts?: ActiveQueryOptions): Promise<ActiveSession[]>;
|
|
644
|
+
/**
|
|
645
|
+
* True when a live agent process on this host carries `--session-id <id>` in
|
|
646
|
+
* its argv. RUSH-2384 last-resort for `agents message`: getActiveSessions can
|
|
647
|
+
* still miss a row (teams status flap, attributed-ancestor skip), but the
|
|
648
|
+
* process table + argv are ground truth for "this session is alive and
|
|
649
|
+
* mailbox-reachable". Only UUID-shaped ids are accepted so a short prefix
|
|
650
|
+
* never false-matches.
|
|
651
|
+
*/
|
|
652
|
+
export declare function isSessionIdLiveOnProcessTable(sessionId: string, deps?: {
|
|
653
|
+
readTable?: () => Promise<Array<{
|
|
654
|
+
pid: number;
|
|
655
|
+
kind?: string;
|
|
656
|
+
}>>;
|
|
657
|
+
sessionIdOf?: (pid: number) => string | undefined;
|
|
658
|
+
}): Promise<boolean>;
|
|
628
659
|
/**
|
|
629
660
|
* Fold tmux's attached-client count onto every tmux-hosted row.
|
|
630
661
|
*
|
|
@@ -662,6 +693,59 @@ export declare function foldTmuxClients(rows: ActiveSession[]): Promise<void>;
|
|
|
662
693
|
* bury the real signal. A session sitting idle — or worse, waiting on a
|
|
663
694
|
* question — with no client attached is the stranded case: nobody is coming.
|
|
664
695
|
*/
|
|
696
|
+
/**
|
|
697
|
+
* Attribute each live row to the machine the session actually EXECUTES on.
|
|
698
|
+
*
|
|
699
|
+
* A host-dispatched run (`agents run --device <peer>`) leaves a live process on
|
|
700
|
+
* the DISPATCHING box — the ssh/TTY shim — carrying the remote run's session id.
|
|
701
|
+
* Nothing about that local process knows the agent is on the peer, so the row
|
|
702
|
+
* was tagged with THIS machine: `--device <dispatcher>` then claimed a session
|
|
703
|
+
* that is not running here, and its preview dead-ended at "full transcript not
|
|
704
|
+
* indexed here" because the transcript lives on the peer (RUSH-2479).
|
|
705
|
+
*
|
|
706
|
+
* The dispatch already recorded the truth. `registerHostSession` /
|
|
707
|
+
* `registerInteractiveHostSession` write the index row with
|
|
708
|
+
* `machine: normalizeHost(task.host)` (`lib/hosts/session-index.ts:55,134`), so
|
|
709
|
+
* this folds that recorded machine back onto the live row. Every consumer then
|
|
710
|
+
* agrees on one owner: the `--host`/`--device` scope, the browser's device
|
|
711
|
+
* filter, `_remote`/preview routing (`liveSessionToMeta`), and the id resolver.
|
|
712
|
+
*
|
|
713
|
+
* Two rows are deliberately left alone:
|
|
714
|
+
* - one the cross-machine fan-out already attributed to a peer — that is the
|
|
715
|
+
* peer's own self-report, which outranks this box's index copy;
|
|
716
|
+
* - one whose indexed machine IS this box — nothing was offloaded.
|
|
717
|
+
*
|
|
718
|
+
* Pure over the array; `machineOf` is injected so the join is unit-tested
|
|
719
|
+
* without a SQLite index.
|
|
720
|
+
*/
|
|
721
|
+
export declare function foldExecutionMachine(rows: ActiveSession[], machineOf: (sessionId: string) => string | undefined, self: string): void;
|
|
722
|
+
/**
|
|
723
|
+
* Is the PROCESS behind this row running on this machine?
|
|
724
|
+
*
|
|
725
|
+
* `machine` answers a different question — "where does the agent execute" —
|
|
726
|
+
* which is what a `--device` scope, preview routing, and resume ownership need.
|
|
727
|
+
* For an offloaded run the two answers diverge: {@link foldExecutionMachine}
|
|
728
|
+
* points `machine` at the peer, while the shim process, its tmux pane, and its
|
|
729
|
+
* terminal window are all still HERE. `offloadedFrom` marks exactly that row.
|
|
730
|
+
*
|
|
731
|
+
* Any caller reaching for a LOCAL pid, pane, or window must ask this rather
|
|
732
|
+
* than `machine === self`. A local tmux pane id (`%N`) handed to a peer's tmux
|
|
733
|
+
* server does not fail — pane ids are small per-server integers, so it can
|
|
734
|
+
* resolve against an unrelated pane and attach the user to someone else's
|
|
735
|
+
* session. That is why this predicate exists instead of ten copies of the
|
|
736
|
+
* comparison.
|
|
737
|
+
*/
|
|
738
|
+
export declare function sessionProcessIsLocal(s: Pick<ActiveSession, 'machine' | 'offloadedFrom'>, self: string): boolean;
|
|
739
|
+
/**
|
|
740
|
+
* The machine to reach for this session's PROCESS — its pid, tmux pane, and
|
|
741
|
+
* window — or `undefined` when that process is right here.
|
|
742
|
+
*
|
|
743
|
+
* Not the same as `machine`, which is where the AGENT executes. For an offloaded
|
|
744
|
+
* run the process lives on the dispatcher (`offloadedFrom`) while the agent runs
|
|
745
|
+
* on the peer, so a caller that ssh'd to `machine` would carry the dispatcher's
|
|
746
|
+
* pane id to a box that never had it.
|
|
747
|
+
*/
|
|
748
|
+
export declare function sessionProcessHost(s: Pick<ActiveSession, 'machine' | 'offloadedFrom'>, self: string): string | undefined;
|
|
665
749
|
export declare function foldHostLink(rows: ActiveSession[]): void;
|
|
666
750
|
/**
|
|
667
751
|
* Resolve each teams row's `orchestratorLabel` from the orchestrator's own row,
|