@phnx-labs/agents-cli 1.22.38 → 1.22.40
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 +302 -0
- package/README.md +111 -70
- package/dist/bin/agents +0 -0
- package/dist/bootstrap.js +46 -27
- package/dist/browser.js +2 -2
- package/dist/cli/command-registry.d.ts +135 -0
- package/dist/cli/command-registry.js +260 -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.js +206 -94
- 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 +47 -4
- 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 +161 -216
- package/dist/commands/factory.js +1 -1
- package/dist/commands/feed.d.ts +2 -2
- package/dist/commands/feed.js +9 -12
- 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 +72 -63
- 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 +13 -0
- package/dist/commands/sessions-picker.js +182 -8
- package/dist/commands/sessions-resume.d.ts +7 -3
- package/dist/commands/sessions-resume.js +81 -33
- package/dist/commands/sessions-stats.js +2 -2
- package/dist/commands/sessions.d.ts +75 -68
- package/dist/commands/sessions.js +142 -180
- 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-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 +318 -48
- 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 +11 -25
- 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 +1 -1
- package/dist/lib/browser/drivers/ssh.d.ts +1 -1
- package/dist/lib/browser/drivers/ssh.js +2 -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 +67 -3
- package/dist/lib/browser/profiles.js +129 -7
- 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 +113 -1
- package/dist/lib/browser/service.js +454 -40
- 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 +18 -0
- 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 +12 -3
- package/dist/lib/config-keys.js +29 -6
- package/dist/lib/config-machine-keys.d.ts +4 -2
- package/dist/lib/config-machine-keys.js +6 -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 +102 -0
- package/dist/lib/daemon-webhooks.js +210 -0
- package/dist/lib/device-config.d.ts +116 -72
- package/dist/lib/device-config.js +366 -132
- 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 +61 -0
- package/dist/lib/devices/pool.js +83 -0
- 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 +8 -5
- package/dist/lib/exec.js +19 -13
- 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} +49 -1
- package/dist/lib/{migrate.js → installations/migrate.js} +265 -38
- 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 +2 -2
- package/dist/lib/observe-aliases.js +2 -11
- 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-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 +241 -62
- 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 +3 -3
- package/dist/lib/secrets/bundles.js +7 -7
- 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 +12 -10
- package/dist/lib/secrets/remote.js +21 -14
- 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/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/share/delete.d.ts +21 -0
- package/dist/lib/share/delete.js +42 -0
- package/dist/lib/share/publish.d.ts +82 -0
- package/dist/lib/share/publish.js +170 -18
- package/dist/lib/share/worker-template.js +172 -9
- package/dist/lib/shims.js +35 -7
- package/dist/lib/smart-launch.d.ts +36 -6
- package/dist/lib/smart-launch.js +65 -8
- 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 +5 -147
- package/dist/lib/startup/command-registry.js +38 -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 +1 -1
- package/dist/lib/triggers/handlers.js +2 -2
- package/dist/lib/triggers/webhook.d.ts +36 -2
- package/dist/lib/triggers/webhook.js +97 -42
- package/dist/lib/types.d.ts +18 -6
- 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/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
|
@@ -8,19 +8,24 @@ import * as fs from 'fs';
|
|
|
8
8
|
import * as path from 'path';
|
|
9
9
|
import * as os from 'os';
|
|
10
10
|
import * as yaml from 'yaml';
|
|
11
|
-
import { stringifyDoc } from '
|
|
11
|
+
import { stringifyDoc } from '../yaml-io.js';
|
|
12
12
|
import { execSync } from 'child_process';
|
|
13
|
-
import { atomicWriteFileSync } from '
|
|
14
|
-
import { machineId } from '
|
|
15
|
-
import { AGENTS, agentConfigDirName, findInPath } from '
|
|
16
|
-
import { createLink } from '
|
|
17
|
-
import { foldLegacySystemRepo, copyDirSkipExisting } from '
|
|
18
|
-
export { foldLegacySystemRepo } from '
|
|
19
|
-
import { migrateLegacyRoutineActivation, listJobs, validateJob } from '
|
|
20
|
-
import { setConfigValue } from '
|
|
21
|
-
import { enabledRoutineNames, replaceEnabledRoutines } from '
|
|
22
|
-
import { evaluateActivationReadiness } from '
|
|
23
|
-
import {
|
|
13
|
+
import { atomicWriteFileSync } from '../fs-atomic.js';
|
|
14
|
+
import { machineId } from '../machine-id.js';
|
|
15
|
+
import { AGENTS, agentConfigDirName, findInPath } from '../agents.js';
|
|
16
|
+
import { createLink } from '../platform/index.js';
|
|
17
|
+
import { foldLegacySystemRepo, copyDirSkipExisting } from '../migrate-fold.js';
|
|
18
|
+
export { foldLegacySystemRepo } from '../migrate-fold.js';
|
|
19
|
+
import { migrateLegacyRoutineActivation, listJobs, validateJob } from '../scheduling/routines.js';
|
|
20
|
+
import { setConfigValue } from '../device-config.js';
|
|
21
|
+
import { enabledRoutineNames, replaceEnabledRoutines } from '../routine-activation.js';
|
|
22
|
+
import { evaluateActivationReadiness } from '../routine-readiness.js';
|
|
23
|
+
import { migrateDeviceConfigStores } from '../devices/config-migration.js';
|
|
24
|
+
// Two constants only, never the read/write API — migrations still operate on raw
|
|
25
|
+
// YAML so they never take the meta lock or prime the meta cache mid-migration.
|
|
26
|
+
import { DEFAULT_BROWSER_PROFILE_NAME } from '../browser/profiles.js';
|
|
27
|
+
import { META_HEADER as DEVICE_META_HEADER } from '../state.js';
|
|
28
|
+
import { COMPILED_HEADER_PROJECT } from '../rules/compile.js';
|
|
24
29
|
const HOME = process.env.HOME ?? os.homedir();
|
|
25
30
|
const USER_DIR = path.join(HOME, '.agents');
|
|
26
31
|
/** Canonical system-repo location (post-fold). */
|
|
@@ -640,11 +645,28 @@ function migratePermissionSetsToPresets() {
|
|
|
640
645
|
* switching is owned by `agents use`, not the migrator.
|
|
641
646
|
*/
|
|
642
647
|
function repairAgentConfigSymlinks() {
|
|
643
|
-
// Version pins live in the
|
|
644
|
-
//
|
|
645
|
-
//
|
|
648
|
+
// Version pins live in the machine-local pins JSON (~/.agents/.history/
|
|
649
|
+
// devices/pins-<machine>.json); the tracked device doc and central
|
|
650
|
+
// agents.yaml may still carry them mid-transition. Read pins first
|
|
651
|
+
// (authoritative), then the legacy locations, first-seen-agent wins.
|
|
646
652
|
const defaults = [];
|
|
647
|
-
const
|
|
653
|
+
const seen = new Set();
|
|
654
|
+
const collectJsonPins = (file) => {
|
|
655
|
+
let pins;
|
|
656
|
+
try {
|
|
657
|
+
pins = JSON.parse(fs.readFileSync(file, 'utf-8'));
|
|
658
|
+
}
|
|
659
|
+
catch {
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
for (const [agent, version] of Object.entries(pins?.agents ?? {})) {
|
|
663
|
+
if (!seen.has(agent)) {
|
|
664
|
+
seen.add(agent);
|
|
665
|
+
defaults.push({ agent, version });
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
const collectYamlPins = (file) => {
|
|
648
670
|
let text;
|
|
649
671
|
try {
|
|
650
672
|
text = fs.readFileSync(file, 'utf-8');
|
|
@@ -657,12 +679,15 @@ function repairAgentConfigSymlinks() {
|
|
|
657
679
|
return;
|
|
658
680
|
for (const line of block[1].split('\n')) {
|
|
659
681
|
const m = line.match(/^\s+([a-z][a-z0-9_-]*):\s*([^\s#]+)/);
|
|
660
|
-
if (m && !
|
|
682
|
+
if (m && !seen.has(m[1])) {
|
|
683
|
+
seen.add(m[1]);
|
|
661
684
|
defaults.push({ agent: m[1], version: m[2] });
|
|
685
|
+
}
|
|
662
686
|
}
|
|
663
687
|
};
|
|
664
|
-
|
|
665
|
-
|
|
688
|
+
collectJsonPins(path.join(USER_DIR, '.history', 'devices', `pins-${machineId()}.json`));
|
|
689
|
+
collectYamlPins(path.join(USER_DIR, 'devices', machineId(), 'agents.yaml'));
|
|
690
|
+
collectYamlPins(path.join(USER_DIR, 'agents.yaml'));
|
|
666
691
|
if (defaults.length === 0)
|
|
667
692
|
return;
|
|
668
693
|
let repaired = 0;
|
|
@@ -1127,7 +1152,7 @@ async function mergeSqliteDb(src, dest) {
|
|
|
1127
1152
|
// every user table. Dynamic import keeps the sqlite shim off the hot path
|
|
1128
1153
|
// for CLI starts that don't actually need a merge.
|
|
1129
1154
|
try {
|
|
1130
|
-
const sqliteMod = (await import('
|
|
1155
|
+
const sqliteMod = (await import('../sqlite.js'));
|
|
1131
1156
|
const Database = sqliteMod.default;
|
|
1132
1157
|
const db = new Database(dest);
|
|
1133
1158
|
try {
|
|
@@ -1624,8 +1649,8 @@ function migrateVersionResourcesToPatterns() {
|
|
|
1624
1649
|
/**
|
|
1625
1650
|
* Split the machine-local fields out of the committed central agents.yaml so it
|
|
1626
1651
|
* becomes portable and syncs cleanly (no more skip-worktree band-aid):
|
|
1627
|
-
* agents: -> ~/.agents/devices
|
|
1628
|
-
* versions: -> ~/.agents/.history/version-resources.json
|
|
1652
|
+
* agents: -> ~/.agents/.history/devices/pins-<machineId>.json (untracked, machine-local)
|
|
1653
|
+
* versions: -> ~/.agents/.history/version-resources.json (gitignored, machine-local)
|
|
1629
1654
|
* Then clear any externally-set skip-worktree bit. Idempotent: no-op once central
|
|
1630
1655
|
* carries neither field. Operates on raw YAML (never through state.ts).
|
|
1631
1656
|
*/
|
|
@@ -1647,18 +1672,16 @@ function migrateSplitDeviceLocalMeta() {
|
|
|
1647
1672
|
// Only rewrite central when it actually carries machine-local fields — a
|
|
1648
1673
|
// machine whose agents.yaml is already portable-only is left untouched.
|
|
1649
1674
|
if (hasLocal) {
|
|
1650
|
-
// agents: ->
|
|
1675
|
+
// agents: -> machine-local pins JSON (merge, existing pins win).
|
|
1651
1676
|
if (agents && Object.keys(agents).length > 0) {
|
|
1652
|
-
const
|
|
1677
|
+
const pinsPath = path.join(USER_DIR, '.history', 'devices', `pins-${machineId()}.json`);
|
|
1653
1678
|
let existing = {};
|
|
1654
1679
|
try {
|
|
1655
|
-
|
|
1656
|
-
if (dm?.agents)
|
|
1657
|
-
existing = dm.agents;
|
|
1680
|
+
existing = JSON.parse(fs.readFileSync(pinsPath, 'utf-8')) || {};
|
|
1658
1681
|
}
|
|
1659
1682
|
catch { /* absent */ }
|
|
1660
|
-
fs.mkdirSync(path.dirname(
|
|
1661
|
-
atomicWriteFileSync(
|
|
1683
|
+
fs.mkdirSync(path.dirname(pinsPath), { recursive: true });
|
|
1684
|
+
atomicWriteFileSync(pinsPath, JSON.stringify({ ...existing, agents: { ...agents, ...existing.agents } }, null, 2) + '\n');
|
|
1662
1685
|
}
|
|
1663
1686
|
// versions: -> machine-local history JSON (merge, existing wins).
|
|
1664
1687
|
if (versions && Object.keys(versions).length > 0) {
|
|
@@ -1672,7 +1695,7 @@ function migrateSplitDeviceLocalMeta() {
|
|
|
1672
1695
|
atomicWriteFileSync(vrPath, JSON.stringify({ ...versions, ...existing }, null, 2) + '\n');
|
|
1673
1696
|
}
|
|
1674
1697
|
// Strip machine-local fields from central and rewrite (portable only) — after
|
|
1675
|
-
// the
|
|
1698
|
+
// the pins/history writes above, so a crash never loses data.
|
|
1676
1699
|
delete meta.agents;
|
|
1677
1700
|
delete meta.versions;
|
|
1678
1701
|
atomicWriteFileSync(metaFile, HEADER + yaml.stringify(meta));
|
|
@@ -1685,8 +1708,105 @@ function migrateSplitDeviceLocalMeta() {
|
|
|
1685
1708
|
}
|
|
1686
1709
|
catch { /* not a git repo / bit not set */ }
|
|
1687
1710
|
if (hasLocal) {
|
|
1688
|
-
console.error('Split agents.yaml: agents: -> devices
|
|
1711
|
+
console.error('Split agents.yaml: agents: -> .history/devices/pins-*.json, versions: -> .history/version-resources.json');
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
/**
|
|
1715
|
+
* Move the auto-detected `default` browser profile OUT of the committed central
|
|
1716
|
+
* agents.yaml and into this machine's per-device file.
|
|
1717
|
+
*
|
|
1718
|
+
* `browser` is a CENTRAL key because named profiles a user creates are real fleet
|
|
1719
|
+
* config, but the ONE `default` entry inside it is machine-local: its `binary` is
|
|
1720
|
+
* an OS-specific path and its endpoint is a locally-chosen free port.
|
|
1721
|
+
* `createProfile`/`updateProfile` already route that entry to `deviceBrowser`
|
|
1722
|
+
* (`isMachineLocalProfile`, browser/profiles.ts) — but nothing ever removed the
|
|
1723
|
+
* copy older versions had already written into the shared file, and
|
|
1724
|
+
* `serializeCentral` cannot: it deletes whole KEYS that are device-scoped, and
|
|
1725
|
+
* `browser` is not one.
|
|
1726
|
+
*
|
|
1727
|
+
* So the entry sat in the committed file and every box rewrote it with its own
|
|
1728
|
+
* browser. Measured 2026-08-13, all three boxes on 1.22.38 (which HAS the writer
|
|
1729
|
+
* fix) with an empty `deviceBrowser` and a machine-specific `default` in central:
|
|
1730
|
+
*
|
|
1731
|
+
* zion browser: chrome binary: /Applications/Google Chrome.app/...
|
|
1732
|
+
* yosemite-s1 browser: brave binary: /opt/brave.com/brave/brave
|
|
1733
|
+
* mark-1 (same shape)
|
|
1734
|
+
*
|
|
1735
|
+
* `agents repos pull user` refuses when an incoming change touches a locally
|
|
1736
|
+
* modified path, so agents.yaml being permanently dirty wedged the fleet config
|
|
1737
|
+
* sync outright — those boxes sat 5, 8 and 79 commits behind. (RUSH-2161)
|
|
1738
|
+
*
|
|
1739
|
+
* Idempotent: no-op once central carries no `default` entry. The device file is
|
|
1740
|
+
* written FIRST so a crash between the two writes can never lose the profile,
|
|
1741
|
+
* and an entry already in the device file wins (this machine's live value is
|
|
1742
|
+
* newer than the stale central copy by construction).
|
|
1743
|
+
*
|
|
1744
|
+
* Central is edited through a `yaml.Document` rather than re-stringified, so the
|
|
1745
|
+
* hand-written comments in the committed agents.yaml survive — a plain
|
|
1746
|
+
* `yaml.stringify` would drop every one of them and rewrite the whole file,
|
|
1747
|
+
* which is the same churn this migration exists to stop (see `serializeCentral`).
|
|
1748
|
+
*/
|
|
1749
|
+
export function migrateMachineLocalBrowserProfileOutOfCentral(userDir = USER_DIR, machine = machineId()) {
|
|
1750
|
+
const metaFile = path.join(userDir, 'agents.yaml');
|
|
1751
|
+
if (!fs.existsSync(metaFile))
|
|
1752
|
+
return;
|
|
1753
|
+
let doc;
|
|
1754
|
+
try {
|
|
1755
|
+
doc = yaml.parseDocument(fs.readFileSync(metaFile, 'utf-8'));
|
|
1756
|
+
}
|
|
1757
|
+
catch {
|
|
1758
|
+
return;
|
|
1689
1759
|
}
|
|
1760
|
+
if (doc.errors.length > 0)
|
|
1761
|
+
return;
|
|
1762
|
+
const central = doc.toJSON() ?? {};
|
|
1763
|
+
const browser = central.browser;
|
|
1764
|
+
if (!browser || typeof browser !== 'object' || Array.isArray(browser))
|
|
1765
|
+
return;
|
|
1766
|
+
const entry = browser[DEFAULT_BROWSER_PROFILE_NAME];
|
|
1767
|
+
if (entry === undefined)
|
|
1768
|
+
return;
|
|
1769
|
+
// Device file first — a crash before central is rewritten leaves a harmless
|
|
1770
|
+
// duplicate, while the reverse order would drop the profile entirely.
|
|
1771
|
+
const devicePath = path.join(userDir, 'devices', machine, 'agents.yaml');
|
|
1772
|
+
let deviceDoc = {};
|
|
1773
|
+
try {
|
|
1774
|
+
deviceDoc = yaml.parse(fs.readFileSync(devicePath, 'utf-8')) || {};
|
|
1775
|
+
}
|
|
1776
|
+
catch { /* absent — first write */ }
|
|
1777
|
+
const deviceBrowser = (deviceDoc.browser && typeof deviceDoc.browser === 'object' && !Array.isArray(deviceDoc.browser))
|
|
1778
|
+
? deviceDoc.browser
|
|
1779
|
+
: {};
|
|
1780
|
+
if (deviceBrowser[DEFAULT_BROWSER_PROFILE_NAME] === undefined) {
|
|
1781
|
+
deviceBrowser[DEFAULT_BROWSER_PROFILE_NAME] = entry;
|
|
1782
|
+
deviceDoc.browser = deviceBrowser;
|
|
1783
|
+
fs.mkdirSync(path.dirname(devicePath), { recursive: true });
|
|
1784
|
+
atomicWriteFileSync(devicePath, DEVICE_META_HEADER + yaml.stringify(deviceDoc));
|
|
1785
|
+
}
|
|
1786
|
+
// Then strip it from the synced file, dropping `browser:` entirely when the
|
|
1787
|
+
// machine-local entry was its only member.
|
|
1788
|
+
doc.deleteIn(['browser', DEFAULT_BROWSER_PROFILE_NAME]);
|
|
1789
|
+
if (Object.keys(browser).length === 1) {
|
|
1790
|
+
const itemsOf = () => (doc.contents?.items) ?? [];
|
|
1791
|
+
const idx = itemsOf().findIndex((pair) => pair.key?.value === 'browser');
|
|
1792
|
+
const orphaned = idx >= 0 ? itemsOf()[idx]?.key?.commentBefore ?? undefined : undefined;
|
|
1793
|
+
doc.delete('browser');
|
|
1794
|
+
if (orphaned) {
|
|
1795
|
+
// Deleting shifted the following pair down into `idx`.
|
|
1796
|
+
const next = itemsOf()[idx]?.key;
|
|
1797
|
+
if (next)
|
|
1798
|
+
next.commentBefore = next.commentBefore ? `${orphaned}\n${next.commentBefore}` : orphaned;
|
|
1799
|
+
else
|
|
1800
|
+
doc.commentBefore = orphaned;
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
// Everything cleared -> header only, never a bare `{}`. stringifyDoc emits a
|
|
1804
|
+
// FLOW empty map for an empty root, and a later parseDocument inherits that
|
|
1805
|
+
// flow and renders the whole rewritten file inline. serializeCentral guards
|
|
1806
|
+
// the identical case (state.ts, `isEmpty ? META_HEADER : stringifyDoc(doc)`).
|
|
1807
|
+
const remaining = Object.keys(doc.toJSON() ?? {}).length;
|
|
1808
|
+
atomicWriteFileSync(metaFile, remaining === 0 ? DEVICE_META_HEADER : stringifyDoc(doc));
|
|
1809
|
+
console.error(`Migrated agents.yaml: browser '${DEFAULT_BROWSER_PROFILE_NAME}' profile -> devices/${machine}/agents.yaml`);
|
|
1690
1810
|
}
|
|
1691
1811
|
/**
|
|
1692
1812
|
* Rename the legacy `extras-extras/` plugin-marketplace dir to `agents-extras/`
|
|
@@ -2260,6 +2380,88 @@ export function migrateKimiSubagentsToMarkdown(versionsDir) {
|
|
|
2260
2380
|
console.error(`Removed ${removed} pre-markdown Kimi subagent file(s); run 'agents sync kimi' to write the new format`);
|
|
2261
2381
|
}
|
|
2262
2382
|
}
|
|
2383
|
+
/**
|
|
2384
|
+
* Remove the compiled "project" ruleset the compiler used to write into $HOME
|
|
2385
|
+
* (RUSH-2725). `compileRulesForProject` treated any cwd with `.agents/rules`
|
|
2386
|
+
* as a project — and the user layer at ~/.agents satisfies that test — so it
|
|
2387
|
+
* wrote ~/AGENTS.md plus per-agent symlinks, and every session under $HOME
|
|
2388
|
+
* then loaded the entire ruleset twice (global memory + "project" memory).
|
|
2389
|
+
* The compiler now refuses reserved roots; this removes the artifact already
|
|
2390
|
+
* on disk. Only files we provably own are touched: an AGENTS.md carrying the
|
|
2391
|
+
* compiled-project header, symlinks pointing at it, and copy-fallback files
|
|
2392
|
+
* (symlink-less filesystems) carrying the same header.
|
|
2393
|
+
*/
|
|
2394
|
+
export function removeHomeCompiledProjectRules(homeDir = HOME) {
|
|
2395
|
+
const agentsPath = path.join(homeDir, 'AGENTS.md');
|
|
2396
|
+
let agentsLstat;
|
|
2397
|
+
try {
|
|
2398
|
+
agentsLstat = fs.lstatSync(agentsPath);
|
|
2399
|
+
}
|
|
2400
|
+
catch {
|
|
2401
|
+
return;
|
|
2402
|
+
}
|
|
2403
|
+
if (!agentsLstat.isFile())
|
|
2404
|
+
return;
|
|
2405
|
+
let content = '';
|
|
2406
|
+
try {
|
|
2407
|
+
content = fs.readFileSync(agentsPath, 'utf8');
|
|
2408
|
+
}
|
|
2409
|
+
catch {
|
|
2410
|
+
return;
|
|
2411
|
+
}
|
|
2412
|
+
if (!content.startsWith(COMPILED_HEADER_PROJECT))
|
|
2413
|
+
return;
|
|
2414
|
+
const seen = new Set(['AGENTS.md']);
|
|
2415
|
+
for (const agent of Object.values(AGENTS)) {
|
|
2416
|
+
const fname = agent.instructionsFile;
|
|
2417
|
+
if (seen.has(fname) || fname.includes('/') || fname.includes('\\'))
|
|
2418
|
+
continue;
|
|
2419
|
+
seen.add(fname);
|
|
2420
|
+
const linkPath = path.join(homeDir, fname);
|
|
2421
|
+
let lstat;
|
|
2422
|
+
try {
|
|
2423
|
+
lstat = fs.lstatSync(linkPath);
|
|
2424
|
+
}
|
|
2425
|
+
catch {
|
|
2426
|
+
continue;
|
|
2427
|
+
}
|
|
2428
|
+
if (lstat.isSymbolicLink()) {
|
|
2429
|
+
let target = '';
|
|
2430
|
+
try {
|
|
2431
|
+
target = fs.readlinkSync(linkPath);
|
|
2432
|
+
}
|
|
2433
|
+
catch {
|
|
2434
|
+
continue;
|
|
2435
|
+
}
|
|
2436
|
+
if (target === 'AGENTS.md') {
|
|
2437
|
+
try {
|
|
2438
|
+
fs.unlinkSync(linkPath);
|
|
2439
|
+
}
|
|
2440
|
+
catch { /* next run retries */ }
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
else if (lstat.isFile()) {
|
|
2444
|
+
// Symlink-less filesystems got a copy of AGENTS.md instead — same header.
|
|
2445
|
+
let copy = '';
|
|
2446
|
+
try {
|
|
2447
|
+
copy = fs.readFileSync(linkPath, 'utf8');
|
|
2448
|
+
}
|
|
2449
|
+
catch {
|
|
2450
|
+
continue;
|
|
2451
|
+
}
|
|
2452
|
+
if (copy.startsWith(COMPILED_HEADER_PROJECT)) {
|
|
2453
|
+
try {
|
|
2454
|
+
fs.unlinkSync(linkPath);
|
|
2455
|
+
}
|
|
2456
|
+
catch { /* next run retries */ }
|
|
2457
|
+
}
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
try {
|
|
2461
|
+
fs.unlinkSync(agentsPath);
|
|
2462
|
+
}
|
|
2463
|
+
catch { /* next run retries */ }
|
|
2464
|
+
}
|
|
2263
2465
|
/** Run all idempotent migrations. Safe to call multiple times. */
|
|
2264
2466
|
export async function runMigration() {
|
|
2265
2467
|
// MUST run first: every other migrator reads SYSTEM_DIR (the new path).
|
|
@@ -2299,13 +2501,20 @@ export async function runMigration() {
|
|
|
2299
2501
|
// agents.yaml. After migrateVersionResourcesToPatterns so versions: is already
|
|
2300
2502
|
// in pattern form when it moves to the history file.
|
|
2301
2503
|
migrateSplitDeviceLocalMeta();
|
|
2302
|
-
//
|
|
2303
|
-
//
|
|
2304
|
-
//
|
|
2305
|
-
//
|
|
2306
|
-
//
|
|
2307
|
-
|
|
2308
|
-
|
|
2504
|
+
// Same split, one level deeper: `browser` stays central (named profiles are
|
|
2505
|
+
// fleet config) but its auto-detected `default` entry is machine-local and was
|
|
2506
|
+
// left behind in the synced file, keeping every box dirty. After
|
|
2507
|
+
// migrateSplitDeviceLocalMeta so the device file is already in its canonical
|
|
2508
|
+
// location before this merges an entry into it.
|
|
2509
|
+
migrateMachineLocalBrowserProfileOutOfCentral();
|
|
2510
|
+
// Converge the device-config/pins stores: fold the central
|
|
2511
|
+
// fleet.devices.<name>.config block + legacy auto-launch.json into the
|
|
2512
|
+
// per-device docs' config:, and extract pins from tracked docs into the
|
|
2513
|
+
// untracked pins JSON. After migrateSplitDeviceLocalMeta so the pins file is
|
|
2514
|
+
// in its canonical location. Also invoked on daemon boot and on the first
|
|
2515
|
+
// device-config read/write in a process, so sentinel'd installs (which skip
|
|
2516
|
+
// this whole run) still converge.
|
|
2517
|
+
migrateDeviceConfigStores();
|
|
2309
2518
|
// Bucket moves: collapse runtime state into ~/.agents/.history and ~/.agents/.cache.
|
|
2310
2519
|
migrateRuntimeToHistory();
|
|
2311
2520
|
migrateLegacySessionMarkersToBookmarks();
|
|
@@ -2343,6 +2552,10 @@ export async function runMigration() {
|
|
|
2343
2552
|
// Fold the legacy watchdog enable sentinel into `watchdog.enabled` config so a
|
|
2344
2553
|
// user who opted in under the old build stays opted in after upgrading.
|
|
2345
2554
|
migrateWatchdogSentinelToConfig();
|
|
2555
|
+
// Delete the compiled "project" ruleset older builds wrote into $HOME — the
|
|
2556
|
+
// duplicate-injection artifact of RUSH-2725. The compiler no longer writes
|
|
2557
|
+
// it; this cleans up what is already on every machine.
|
|
2558
|
+
removeHomeCompiledProjectRules();
|
|
2346
2559
|
// Deactivate any routine whose execution context no longer resolves ready, so
|
|
2347
2560
|
// an anchor-less agent/workflow routine cannot keep firing-and-failing after the
|
|
2348
2561
|
// fold (RUSH-2290). Runs AFTER the tick/watchdog routines are added so those
|
|
@@ -2354,4 +2567,18 @@ export async function runMigration() {
|
|
|
2354
2567
|
// infinite-exec-loop). Also runs after the bucket moves so it scans the
|
|
2355
2568
|
// canonical HISTORY_DIR/versions tree.
|
|
2356
2569
|
repairSelfReferentialBinShims();
|
|
2570
|
+
// Version-skew one-shot (RUSH-2435): retrofit the current pane-died hook
|
|
2571
|
+
// onto any managed tmux session an older binary left with a stale one. Runs
|
|
2572
|
+
// at upgrade time in addition to the daemon-startup call (daemon.ts) so a
|
|
2573
|
+
// machine that upgrades without immediately restarting its daemon still
|
|
2574
|
+
// repairs on the next `agents` invocation. Idempotent/non-destructive.
|
|
2575
|
+
try {
|
|
2576
|
+
const { reconcileSessionHooks } = await import('../tmux/session.js');
|
|
2577
|
+
const { isTmuxInstalled } = await import('../tmux/binary.js');
|
|
2578
|
+
if (isTmuxInstalled())
|
|
2579
|
+
await reconcileSessionHooks();
|
|
2580
|
+
}
|
|
2581
|
+
catch {
|
|
2582
|
+
// best-effort — a migration must never fail because tmux wasn't reachable
|
|
2583
|
+
}
|
|
2357
2584
|
}
|
|
@@ -6,7 +6,7 @@ import * as path from 'path';
|
|
|
6
6
|
import { AGENTS, findInPath, isSelfUpdatingAgent } from '../agents.js';
|
|
7
7
|
import { VERSION_RE } from '../agent-spec/primitives.js';
|
|
8
8
|
import { importInstallScriptBinary } from '../import.js';
|
|
9
|
-
import { getBinaryPath, getLatestNpmVersion, getOldestNpmVersion, getLiveVersion, getVersionHomePath, invalidateLiveVersionCache, isGlobalBinaryAgent, } from '
|
|
9
|
+
import { getBinaryPath, getLatestNpmVersion, getOldestNpmVersion, getLiveVersion, getVersionHomePath, invalidateLiveVersionCache, isGlobalBinaryAgent, } from './versions.js';
|
|
10
10
|
import { installationDir } from './store.js';
|
|
11
11
|
const execAsync = promisify(exec);
|
|
12
12
|
const execFileAsync = promisify(execFile);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import { AGENTS, isAgentHardDeprecated, hardDeprecationError } from '../agents.js';
|
|
3
|
-
import { emit } from '../events.js';
|
|
4
|
-
import { getBinaryPath, invalidateInstalledVersionsCache, invalidateLiveVersionCache, verifyBinaryLaunches, } from '
|
|
3
|
+
import { emit } from '../feed/events.js';
|
|
4
|
+
import { getBinaryPath, invalidateInstalledVersionsCache, invalidateLiveVersionCache, verifyBinaryLaunches, } from './versions.js';
|
|
5
5
|
import { assertValidRelease, selectUpdateStrategy, } from './strategies.js';
|
|
6
6
|
import { listInstallations, recordRelease } from './store.js';
|
|
7
7
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AgentId } from '
|
|
2
|
-
import { compareVersions } from '
|
|
3
|
-
import { type PrunableKind } from '
|
|
1
|
+
import type { AgentId } from '../types.js';
|
|
2
|
+
import { compareVersions } from '../agent-spec/primitives.js';
|
|
3
|
+
import { type PrunableKind } from '../staleness/prune.js';
|
|
4
4
|
/**
|
|
5
5
|
* Resource selection for syncing to a version.
|
|
6
6
|
* Each field can be:
|
|
@@ -519,6 +519,15 @@ export interface SyncResult {
|
|
|
519
519
|
* repo-scope reconcile that ran the prune pass; empty otherwise.
|
|
520
520
|
*/
|
|
521
521
|
pruned: Record<PrunableKind, string[]>;
|
|
522
|
+
/**
|
|
523
|
+
* Resources this sync refused to write, as user-facing sentences (RUSH-2677).
|
|
524
|
+
*
|
|
525
|
+
* An empty `mcp`/`subagents`/… list means "nothing to write"; it cannot also
|
|
526
|
+
* mean "declined and here is why", which is how a harness with no config
|
|
527
|
+
* writer reported a clean sync while writing nothing. The rendering command
|
|
528
|
+
* MUST surface these — a decline nobody prints is the silent no-op again.
|
|
529
|
+
*/
|
|
530
|
+
declined: string[];
|
|
522
531
|
}
|
|
523
532
|
/**
|
|
524
533
|
* Enumerate the DotAgent repo names that resources can be scoped to:
|
|
@@ -21,36 +21,36 @@ import { exec, execFile } from 'child_process';
|
|
|
21
21
|
import { promisify } from 'util';
|
|
22
22
|
import chalk from 'chalk';
|
|
23
23
|
import { checkbox, select } from '@inquirer/prompts';
|
|
24
|
-
import { getVersionsDir, ensureAgentsDir, readMeta, writeMeta, getSkillsDir, getResolvedRulesDir, getUserRulesDir, getVersionResources, ensureVersionResourcePatterns, getProjectAgentsDir, getPromptcutsPath, getUserPromptcutsPath, getEnabledExtraRepos, getAgentsDir, getUserAgentsDir, getTrashVersionsDir, getActiveRulesPreset, getHomeDir } from '
|
|
25
|
-
import { defaultPatterns, expandPatterns } from '
|
|
26
|
-
import { listResources } from '
|
|
27
|
-
import { activeRulesPreset, filterNamesForActiveResourceProfile } from '
|
|
24
|
+
import { getVersionsDir, ensureAgentsDir, readMeta, writeMeta, getSkillsDir, getResolvedRulesDir, getUserRulesDir, getVersionResources, ensureVersionResourcePatterns, getProjectAgentsDir, getPromptcutsPath, getUserPromptcutsPath, getEnabledExtraRepos, getAgentsDir, getUserAgentsDir, getTrashVersionsDir, getActiveRulesPreset, getHomeDir } from '../state.js';
|
|
25
|
+
import { defaultPatterns, expandPatterns } from '../resource-patterns.js';
|
|
26
|
+
import { listResources } from '../resources.js';
|
|
27
|
+
import { activeRulesPreset, filterNamesForActiveResourceProfile } from '../resource-profiles.js';
|
|
28
28
|
// VERSION_RE + compareVersions are owned by the agent-spec engine primitives
|
|
29
29
|
// (single source of truth). Re-exported below so existing importers of
|
|
30
30
|
// `compareVersions` from './versions.js' keep working.
|
|
31
|
-
import { VERSION_RE, compareVersions } from '
|
|
32
|
-
import { AGENTS, agentConfigDirName, getAccountEmail, resolveAgentName, formatAgentError, findInPath, isSelfUpdatingAgent, isAgentHardDeprecated, hardDeprecationError } from '
|
|
33
|
-
import { discoverPermissionGroups, getActivePermissionPresetName, readPermissionPresetRecipe, PERMISSION_PRESET_ENV_VAR } from '
|
|
34
|
-
import { parseMcpConfigForScan, isProjectMcpTrusted } from '
|
|
35
|
-
import { createVersionedAlias, removeVersionedAlias, getConfigSymlinkVersion, ensureClaudeInsideSymlink, assertIsolationBoundary, } from '
|
|
36
|
-
import { importInstallScriptBinary } from '
|
|
37
|
-
import { createInstallation } from './
|
|
38
|
-
import { INSTALLATION_RECORD_FILE } from './
|
|
39
|
-
import { IS_WINDOWS, composeWin32CommandLine } from '
|
|
40
|
-
import { listInstalledSubagents } from '
|
|
41
|
-
import { listInstalledWorkflows } from '
|
|
42
|
-
import { parseHookManifest, registerHooksToSettings, selectHookManifest, pruneVersionHomeHookEntriesFromSettings } from '
|
|
43
|
-
import { supports, explainSkip } from '
|
|
44
|
-
import { discoverPlugins, syncPluginToVersion, pluginSupportsAgent, cleanOrphanedPluginSkills, marketplaceSpecForName } from '
|
|
45
|
-
import { loadManifest, saveManifest, buildManifest as buildSyncManifest, isStale } from '
|
|
46
|
-
import { pruneRemovedResources } from '
|
|
47
|
-
import { emit } from '
|
|
48
|
-
import { safeJoin } from '
|
|
49
|
-
import { readSkillSourceCommandMarker, shouldAlsoInstallCommandAsSkill, shouldInstallCommandAsSkill, } from '
|
|
50
|
-
import { getWriter, getDetector } from '
|
|
51
|
-
import { syncMemoryToVersionHome } from '
|
|
52
|
-
import { listPluginSkillNames, resolveCommandSource, resolveSkillSource } from '
|
|
53
|
-
import { syncProjectResourcesToAgent } from '
|
|
31
|
+
import { VERSION_RE, compareVersions } from '../agent-spec/primitives.js';
|
|
32
|
+
import { AGENTS, agentConfigDirName, getAccountEmail, resolveAgentName, formatAgentError, findInPath, isSelfUpdatingAgent, isAgentHardDeprecated, hardDeprecationError } from '../agents.js';
|
|
33
|
+
import { discoverPermissionGroups, getActivePermissionPresetName, readPermissionPresetRecipe, PERMISSION_PRESET_ENV_VAR } from '../permissions.js';
|
|
34
|
+
import { parseMcpConfigForScan, isProjectMcpTrusted } from '../mcp.js';
|
|
35
|
+
import { createVersionedAlias, removeVersionedAlias, getConfigSymlinkVersion, ensureClaudeInsideSymlink, assertIsolationBoundary, } from '../shims.js';
|
|
36
|
+
import { importInstallScriptBinary } from '../import.js';
|
|
37
|
+
import { createInstallation } from './store.js';
|
|
38
|
+
import { INSTALLATION_RECORD_FILE } from './types.js';
|
|
39
|
+
import { IS_WINDOWS, composeWin32CommandLine } from '../platform/index.js';
|
|
40
|
+
import { listInstalledSubagents } from '../subagents.js';
|
|
41
|
+
import { listInstalledWorkflows } from '../workflows.js';
|
|
42
|
+
import { parseHookManifest, registerHooksToSettings, selectHookManifest, pruneVersionHomeHookEntriesFromSettings, installSessionTrackerHookSync, installSessionTrackerHook } from '../hooks.js';
|
|
43
|
+
import { supports, explainSkip } from '../capabilities.js';
|
|
44
|
+
import { discoverPlugins, syncPluginToVersion, pluginSupportsAgent, cleanOrphanedPluginSkills, marketplaceSpecForName } from '../plugins/plugins.js';
|
|
45
|
+
import { loadManifest, saveManifest, buildManifest as buildSyncManifest, isStale } from '../staleness/index.js';
|
|
46
|
+
import { pruneRemovedResources } from '../staleness/prune.js';
|
|
47
|
+
import { emit } from '../feed/events.js';
|
|
48
|
+
import { safeJoin } from '../paths.js';
|
|
49
|
+
import { readSkillSourceCommandMarker, shouldAlsoInstallCommandAsSkill, shouldInstallCommandAsSkill, } from '../command-skills.js';
|
|
50
|
+
import { getWriter, getDetector } from '../staleness/registry.js';
|
|
51
|
+
import { syncMemoryToVersionHome } from '../memory.js';
|
|
52
|
+
import { listPluginSkillNames, resolveCommandSource, resolveSkillSource } from '../staleness/writers/sources.js';
|
|
53
|
+
import { syncProjectResourcesToAgent } from '../project-resources.js';
|
|
54
54
|
/** Promisified exec for running shell commands. */
|
|
55
55
|
const execAsync = promisify(exec);
|
|
56
56
|
const execFileAsync = promisify(execFile);
|
|
@@ -1638,6 +1638,10 @@ export async function installVersion(agent, version, onProgress, opts) {
|
|
|
1638
1638
|
// here on; the release it carries is recorded separately so `agents update`
|
|
1639
1639
|
// can move the release without invalidating any reference to the label.
|
|
1640
1640
|
createInstallation(agent, installedVersion, installedVersion);
|
|
1641
|
+
const trackerInstall = await installSessionTrackerHook(agent, installedVersion);
|
|
1642
|
+
if (!trackerInstall.installed && trackerInstall.error) {
|
|
1643
|
+
console.warn(`agents: SessionStart hook not installed for ${agent}@${installedVersion}: ${trackerInstall.error}`);
|
|
1644
|
+
}
|
|
1641
1645
|
// The self-updating binary just changed on disk — drop the cached
|
|
1642
1646
|
// `--version` so `agents view` reflects the freshly-installed release.
|
|
1643
1647
|
invalidateLiveVersionCache(agent);
|
|
@@ -1797,6 +1801,10 @@ export async function installVersion(agent, version, onProgress, opts) {
|
|
|
1797
1801
|
}
|
|
1798
1802
|
// Freeze this installation's identity (see the installScript branch above).
|
|
1799
1803
|
createInstallation(agent, healthyVersion, healthyVersion);
|
|
1804
|
+
const trackerInstall = await installSessionTrackerHook(agent, healthyVersion);
|
|
1805
|
+
if (!trackerInstall.installed && trackerInstall.error) {
|
|
1806
|
+
console.warn(`agents: SessionStart hook not installed for ${agent}@${healthyVersion}: ${trackerInstall.error}`);
|
|
1807
|
+
}
|
|
1800
1808
|
emit('version.install', { agent, version: healthyVersion });
|
|
1801
1809
|
return { success: true, installedVersion: healthyVersion };
|
|
1802
1810
|
}
|
|
@@ -1924,7 +1932,7 @@ async function reconcileGlobalBinaryVersions(agent) {
|
|
|
1924
1932
|
const staleDir = getVersionDir(agent, version);
|
|
1925
1933
|
const trashPath = softDeleteVersionDir(agent, version);
|
|
1926
1934
|
if (trashPath) {
|
|
1927
|
-
const { updateSessionFilePaths } = await import('
|
|
1935
|
+
const { updateSessionFilePaths } = await import('../session/db.js');
|
|
1928
1936
|
updateSessionFilePaths(staleDir, trashPath);
|
|
1929
1937
|
foldedAny = true;
|
|
1930
1938
|
}
|
|
@@ -1962,7 +1970,7 @@ export async function reconcileStaleLatestDir(agent, installedVersion) {
|
|
|
1962
1970
|
// harness can't statically transform, so it must stay out of the eager graph.
|
|
1963
1971
|
const trashPath = softDeleteVersionDir(agent, 'latest');
|
|
1964
1972
|
if (trashPath) {
|
|
1965
|
-
const { updateSessionFilePaths } = await import('
|
|
1973
|
+
const { updateSessionFilePaths } = await import('../session/db.js');
|
|
1966
1974
|
updateSessionFilePaths(staleLatestDir, trashPath);
|
|
1967
1975
|
}
|
|
1968
1976
|
return 'trashed';
|
|
@@ -2711,7 +2719,7 @@ export function mergeRepoScopedSelections(repos, cwd = process.cwd()) {
|
|
|
2711
2719
|
*/
|
|
2712
2720
|
export function syncResourcesToVersion(agent, version, selection, options = {}) {
|
|
2713
2721
|
if (isAgentHardDeprecated(agent)) {
|
|
2714
|
-
return { commands: false, skills: false, hooks: false, memory: [], permissions: false, mcp: [], subagents: [], plugins: [], workflows: [], projectSkipped: [], pruned: { commands: [], skills: [] } };
|
|
2722
|
+
return { commands: false, skills: false, hooks: false, memory: [], permissions: false, mcp: [], subagents: [], plugins: [], workflows: [], projectSkipped: [], pruned: { commands: [], skills: [] }, declined: [] };
|
|
2715
2723
|
}
|
|
2716
2724
|
const agentConfig = AGENTS[agent];
|
|
2717
2725
|
const versionHome = getVersionHomePath(agent, version);
|
|
@@ -2722,7 +2730,7 @@ export function syncResourcesToVersion(agent, version, selection, options = {})
|
|
|
2722
2730
|
// care about the ORIGINAL intent: a caller passing no selection means
|
|
2723
2731
|
// "full sync; persist the staleness manifest after."
|
|
2724
2732
|
const userPassedSelection = selection !== undefined;
|
|
2725
|
-
const result = { commands: false, skills: false, hooks: false, memory: [], permissions: false, mcp: [], subagents: [], plugins: [], workflows: [], projectSkipped: [], pruned: { commands: [], skills: [] } };
|
|
2733
|
+
const result = { commands: false, skills: false, hooks: false, memory: [], permissions: false, mcp: [], subagents: [], plugins: [], workflows: [], projectSkipped: [], pruned: { commands: [], skills: [] }, declined: [] };
|
|
2726
2734
|
const cwd = options.cwd || process.cwd();
|
|
2727
2735
|
const projectAgentsDir = options.projectDir || getProjectAgentsDir(cwd);
|
|
2728
2736
|
const userAgentsDir = getUserAgentsDir();
|
|
@@ -2734,6 +2742,16 @@ export function syncResourcesToVersion(agent, version, selection, options = {})
|
|
|
2734
2742
|
if (projectAgentsDir) {
|
|
2735
2743
|
result.projectSkipped = syncProjectResourcesToAgent(agent, version, projectAgentsDir).skipped;
|
|
2736
2744
|
}
|
|
2745
|
+
// Install the shared SessionStart state-writer hook for every hook-capable
|
|
2746
|
+
// harness. This must run even when the rest of the sync is skipped by the
|
|
2747
|
+
// staleness guard, because the hook is registered in the harness's native
|
|
2748
|
+
// config (not in the version-home resource tree the manifest tracks).
|
|
2749
|
+
if (supports(agent, 'hooks', version).ok) {
|
|
2750
|
+
const trackerResult = installSessionTrackerHookSync(agent, version);
|
|
2751
|
+
if (!trackerResult.installed && trackerResult.error) {
|
|
2752
|
+
console.warn(`agents: SessionStart hook not installed for ${agent}@${version}: ${trackerResult.error}`);
|
|
2753
|
+
}
|
|
2754
|
+
}
|
|
2737
2755
|
// Fast guard BEFORE getAvailableResources / pattern expansion /
|
|
2738
2756
|
// ensureVersionResourcePatterns. Guard needs only loadManifest + isStale
|
|
2739
2757
|
// (~6 ms); the work that used to sit ahead of it was ~12.5 ms of the 21.5 ms
|
|
@@ -3104,6 +3122,8 @@ export function syncResourcesToVersion(agent, version, selection, options = {})
|
|
|
3104
3122
|
if (mcpToSync.length > 0 && mcpWriter) {
|
|
3105
3123
|
const r = mcpWriter.write({ version, versionHome, selection: mcpToSync, cwd });
|
|
3106
3124
|
result.mcp = r.synced;
|
|
3125
|
+
if (r.errors?.length)
|
|
3126
|
+
result.declined.push(...r.errors.map((e) => `mcp: ${e}`));
|
|
3107
3127
|
// mcp patterns already written via ensureVersionResourcePatterns above.
|
|
3108
3128
|
}
|
|
3109
3129
|
// Sync subagents — dispatch through WRITERS.subagents. listInstalledSubagents
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import { IsolationBoundaryError } from './shims.js';
|
|
3
|
-
import { listInstalledVersions } from './versions.js';
|
|
3
|
+
import { listInstalledVersions } from './installations/versions.js';
|
|
4
4
|
/**
|
|
5
5
|
* Turn an {@link IsolationBoundaryError} into guidance. The boundary is enforced by a
|
|
6
6
|
* throw so it cannot be forgotten; this is what keeps that from surfacing as a stack
|
|
@@ -60,3 +60,31 @@ export declare function pickLinearProject(query: string, projects: LinearProject
|
|
|
60
60
|
* the user down a wrong "no matches" path.
|
|
61
61
|
*/
|
|
62
62
|
export declare function listLinearProjects(): LinearProjectLite[];
|
|
63
|
+
/**
|
|
64
|
+
* The `linear` block a def should carry after binding it to `project`.
|
|
65
|
+
*
|
|
66
|
+
* Pure so the write rule is testable without a `linear` CLI or a filesystem —
|
|
67
|
+
* `agents projects link` is the only caller and does nothing else to the field.
|
|
68
|
+
*
|
|
69
|
+
* Two rules, both learned from real drift:
|
|
70
|
+
*
|
|
71
|
+
* - `name` is REFRESHED, never merely preserved. It used to be written by
|
|
72
|
+
* spreading `prior`, so a project renamed on the board kept its old label in
|
|
73
|
+
* the YAML forever — and that label is what the status card, the AGI EXT
|
|
74
|
+
* Fleet panel (`linearProjectName`), and agents naming the work all read.
|
|
75
|
+
* - `url` is dropped when the projectId CHANGES and the incoming row has none.
|
|
76
|
+
* Carrying it over would leave a def pointing at the previous project's page
|
|
77
|
+
* beside the new project's name, and the status card prefers `url` over the
|
|
78
|
+
* id — so the one field a reader clicks would go to the wrong project.
|
|
79
|
+
* Re-linking the SAME id keeps a previously stored url, since the CLI's list
|
|
80
|
+
* row omitting `url` says nothing about whether the project has one.
|
|
81
|
+
*/
|
|
82
|
+
export declare function nextLinearLink(prior: {
|
|
83
|
+
projectId?: string;
|
|
84
|
+
url?: string;
|
|
85
|
+
name?: string;
|
|
86
|
+
} | undefined, project: LinearProjectLite): {
|
|
87
|
+
projectId: string;
|
|
88
|
+
url?: string;
|
|
89
|
+
name: string;
|
|
90
|
+
};
|