@phnx-labs/agents-cli 1.22.119 → 1.22.121
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 +236 -0
- package/README.md +19 -2
- package/dist/bootstrap.d.ts +0 -15
- package/dist/bootstrap.js +10 -409
- package/dist/cli/command-registry.d.ts +0 -58
- package/dist/cli/command-registry.js +2 -74
- package/dist/commands/accounts.d.ts +0 -17
- package/dist/commands/accounts.js +1 -52
- package/dist/commands/alias.d.ts +0 -12
- package/dist/commands/alias.js +0 -6
- package/dist/commands/apply.d.ts +0 -15
- package/dist/commands/apply.js +0 -63
- package/dist/commands/audit.d.ts +0 -12
- package/dist/commands/audit.js +0 -13
- package/dist/commands/auth.js +4 -12
- package/dist/commands/beta.d.ts +0 -6
- package/dist/commands/beta.js +2 -6
- package/dist/commands/browser-sessions-picker.d.ts +0 -8
- package/dist/commands/browser-sessions-picker.js +0 -26
- package/dist/commands/browser.d.ts +0 -57
- package/dist/commands/browser.js +0 -80
- package/dist/commands/budget.d.ts +0 -13
- package/dist/commands/budget.js +0 -2
- package/dist/commands/cli.d.ts +0 -12
- package/dist/commands/cli.js +0 -4
- package/dist/commands/cloud.d.ts +0 -9
- package/dist/commands/cloud.js +0 -43
- package/dist/commands/commands.d.ts +0 -9
- package/dist/commands/commands.js +0 -18
- package/dist/commands/computer-sessions-picker.d.ts +0 -11
- package/dist/commands/computer-sessions-picker.js +0 -29
- package/dist/commands/computer.d.ts +0 -62
- package/dist/commands/computer.js +3 -114
- package/dist/commands/config.d.ts +0 -14
- package/dist/commands/config.js +21 -60
- package/dist/commands/cost.d.ts +0 -11
- package/dist/commands/cost.js +1 -17
- package/dist/commands/daemon-test-harness.d.ts +0 -32
- package/dist/commands/daemon-test-harness.js +1 -36
- package/dist/commands/daemon.d.ts +0 -46
- package/dist/commands/daemon.js +8 -255
- package/dist/commands/detach-core.d.ts +0 -28
- package/dist/commands/detach-core.js +0 -30
- package/dist/commands/detach.d.ts +1 -12
- package/dist/commands/detach.js +16 -52
- package/dist/commands/device-config-test-harness.js +0 -12
- package/dist/commands/doctor.d.ts +0 -103
- package/dist/commands/doctor.js +3 -279
- package/dist/commands/events.d.ts +0 -29
- package/dist/commands/events.js +1 -55
- package/dist/commands/exec.d.ts +0 -163
- package/dist/commands/exec.js +15 -964
- package/dist/commands/factory.d.ts +0 -6
- package/dist/commands/factory.js +0 -2
- package/dist/commands/feed-watch.js +0 -20
- package/dist/commands/feed.d.ts +0 -38
- package/dist/commands/feed.js +1 -151
- package/dist/commands/feedback.d.ts +0 -5
- package/dist/commands/feedback.js +0 -5
- package/dist/commands/fleet-capture.d.ts +0 -12
- package/dist/commands/fleet-capture.js +1 -39
- package/dist/commands/focus.d.ts +6 -94
- package/dist/commands/focus.js +13 -183
- package/dist/commands/fork.d.ts +0 -21
- package/dist/commands/fork.js +0 -45
- package/dist/commands/funnel.d.ts +0 -3
- package/dist/commands/go.d.ts +2 -71
- package/dist/commands/go.js +5 -99
- package/dist/commands/harness-hooks.d.ts +0 -41
- package/dist/commands/harness-hooks.js +0 -48
- package/dist/commands/harness-wizard.d.ts +0 -137
- package/dist/commands/harness-wizard.js +0 -109
- package/dist/commands/harness.d.ts +0 -63
- package/dist/commands/harness.js +0 -103
- package/dist/commands/hooks.d.ts +0 -9
- package/dist/commands/hooks.js +0 -26
- package/dist/commands/humans.d.ts +0 -8
- package/dist/commands/humans.js +0 -8
- package/dist/commands/import.d.ts +0 -22
- package/dist/commands/import.js +0 -79
- package/dist/commands/insights.d.ts +0 -37
- package/dist/commands/insights.js +3 -115
- package/dist/commands/inspect.d.ts +0 -117
- package/dist/commands/inspect.js +2 -448
- package/dist/commands/lease.d.ts +0 -28
- package/dist/commands/lease.js +0 -43
- package/dist/commands/logs.d.ts +0 -23
- package/dist/commands/logs.js +0 -30
- package/dist/commands/mailboxes.d.ts +0 -18
- package/dist/commands/mailboxes.js +0 -29
- package/dist/commands/mcp.d.ts +0 -9
- package/dist/commands/mcp.js +0 -53
- package/dist/commands/memory.d.ts +0 -7
- package/dist/commands/memory.js +0 -7
- package/dist/commands/menubar.d.ts +0 -8
- package/dist/commands/menubar.js +0 -24
- package/dist/commands/message.d.ts +0 -23
- package/dist/commands/message.js +0 -50
- package/dist/commands/mine.d.ts +0 -22
- package/dist/commands/mine.js +0 -21
- package/dist/commands/models.d.ts +0 -8
- package/dist/commands/models.js +0 -33
- package/dist/commands/modes.d.ts +0 -10
- package/dist/commands/modes.js +0 -13
- package/dist/commands/monitors.d.ts +0 -9
- package/dist/commands/monitors.js +3 -160
- package/dist/commands/open.d.ts +0 -26
- package/dist/commands/open.js +0 -10
- package/dist/commands/output.d.ts +0 -18
- package/dist/commands/output.js +1 -34
- package/dist/commands/packages-materialize.d.ts +0 -11
- package/dist/commands/packages-materialize.js +0 -3
- package/dist/commands/packages.d.ts +0 -10
- package/dist/commands/packages.js +0 -50
- package/dist/commands/perf.d.ts +0 -41
- package/dist/commands/perf.js +0 -55
- package/dist/commands/permissions.d.ts +0 -9
- package/dist/commands/permissions.js +0 -43
- package/dist/commands/plugins.d.ts +0 -14
- package/dist/commands/plugins.js +2 -55
- package/dist/commands/profiles.d.ts +0 -25
- package/dist/commands/profiles.js +0 -27
- package/dist/commands/projects-todo.d.ts +2 -0
- package/dist/commands/projects-todo.js +132 -0
- package/dist/commands/projects.d.ts +0 -85
- package/dist/commands/projects.js +344 -291
- package/dist/commands/prune.js +0 -30
- package/dist/commands/ps-roster.d.ts +92 -0
- package/dist/commands/ps-roster.js +744 -0
- package/dist/commands/ps.d.ts +6 -0
- package/dist/commands/ps.js +98 -0
- package/dist/commands/refresh-rules.d.ts +0 -13
- package/dist/commands/refresh-rules.js +0 -14
- package/dist/commands/reminders.d.ts +0 -7
- package/dist/commands/repo.d.ts +0 -89
- package/dist/commands/repo.js +7 -205
- package/dist/commands/resource-view.d.ts +0 -33
- package/dist/commands/resource-view.js +0 -49
- package/dist/commands/resume.d.ts +1 -19
- package/dist/commands/resume.js +0 -50
- package/dist/commands/route.d.ts +0 -10
- package/dist/commands/route.js +0 -19
- package/dist/commands/routines.d.ts +0 -42
- package/dist/commands/routines.js +5 -290
- package/dist/commands/routines.test-fixture.d.ts +0 -34
- package/dist/commands/routines.test-fixture.js +4 -100
- package/dist/commands/rules.d.ts +0 -9
- package/dist/commands/rules.js +1 -6
- package/dist/commands/run-account-picker.d.ts +0 -59
- package/dist/commands/run-account-picker.js +0 -71
- package/dist/commands/run-broadcast.d.ts +0 -9
- package/dist/commands/run-broadcast.js +0 -7
- package/dist/commands/run-cloud.d.ts +0 -15
- package/dist/commands/run-cloud.js +0 -37
- package/dist/commands/run-device-picker.d.ts +0 -25
- package/dist/commands/run-device-picker.js +1 -53
- package/dist/commands/secrets-passthrough.d.ts +0 -31
- package/dist/commands/secrets-passthrough.js +0 -10
- package/dist/commands/send.d.ts +0 -20
- package/dist/commands/send.js +14 -18
- package/dist/commands/sessions-backfill.d.ts +0 -7
- package/dist/commands/sessions-backfill.js +1 -16
- package/dist/commands/sessions-backup-setup.js +0 -11
- package/dist/commands/sessions-bookmark.d.ts +0 -8
- package/dist/commands/sessions-bookmark.js +0 -28
- package/dist/commands/sessions-browser.d.ts +2 -117
- package/dist/commands/sessions-browser.js +5 -243
- package/dist/commands/sessions-export.d.ts +1 -26
- package/dist/commands/sessions-export.js +3 -81
- package/dist/commands/sessions-import.d.ts +0 -14
- package/dist/commands/sessions-import.js +0 -59
- package/dist/commands/sessions-inject.d.ts +0 -60
- package/dist/commands/sessions-inject.js +3 -96
- package/dist/commands/sessions-migrate.d.ts +2 -37
- package/dist/commands/sessions-migrate.js +7 -159
- package/dist/commands/sessions-optimize.d.ts +0 -12
- package/dist/commands/sessions-picker-factory.d.ts +0 -7
- package/dist/commands/sessions-picker-factory.js +0 -8
- package/dist/commands/sessions-picker.d.ts +4 -103
- package/dist/commands/sessions-picker.js +13 -352
- package/dist/commands/sessions-render.d.ts +1 -2
- package/dist/commands/sessions-render.js +3 -7
- package/dist/commands/sessions-resume.d.ts +1 -24
- package/dist/commands/sessions-resume.js +2 -65
- package/dist/commands/sessions-share.d.ts +1 -9
- package/dist/commands/sessions-share.js +1 -45
- package/dist/commands/sessions-stats.d.ts +0 -24
- package/dist/commands/sessions-stats.js +0 -49
- package/dist/commands/sessions-stop.d.ts +1 -20
- package/dist/commands/sessions-stop.js +4 -9
- package/dist/commands/sessions-tail.d.ts +1 -19
- package/dist/commands/sessions-tail.js +3 -36
- package/dist/commands/sessions-trace.d.ts +5 -36
- package/dist/commands/sessions-trace.js +7 -82
- package/dist/commands/sessions.d.ts +1 -666
- package/dist/commands/sessions.js +30 -2279
- package/dist/commands/sessions.test-fixture.d.ts +0 -9
- package/dist/commands/sessions.test-fixture.js +8 -23
- package/dist/commands/setup-accounts.d.ts +0 -6
- package/dist/commands/setup-browser.d.ts +0 -23
- package/dist/commands/setup-browser.js +0 -28
- package/dist/commands/setup-computer.d.ts +0 -16
- package/dist/commands/setup-computer.js +0 -28
- package/dist/commands/setup-fleet.d.ts +0 -8
- package/dist/commands/setup-fleet.js +0 -11
- package/dist/commands/setup-mine.d.ts +0 -14
- package/dist/commands/setup-mine.js +0 -25
- package/dist/commands/setup-preferences.d.ts +0 -47
- package/dist/commands/setup-preferences.js +0 -53
- package/dist/commands/setup-secrets.d.ts +2 -24
- package/dist/commands/setup-secrets.js +0 -24
- package/dist/commands/setup-term.d.ts +0 -21
- package/dist/commands/setup-term.js +0 -21
- package/dist/commands/setup-terminal.d.ts +0 -1
- package/dist/commands/setup-terminal.js +0 -1
- package/dist/commands/setup-tools.d.ts +2 -0
- package/dist/commands/setup-tools.js +73 -0
- package/dist/commands/setup.d.ts +0 -20
- package/dist/commands/setup.js +4 -57
- package/dist/commands/skills.d.ts +0 -9
- package/dist/commands/skills.js +1 -22
- package/dist/commands/snapshot.d.ts +0 -9
- package/dist/commands/snapshot.js +0 -10
- package/dist/commands/ssh.d.ts +0 -64
- package/dist/commands/ssh.js +9 -420
- package/dist/commands/status.d.ts +0 -12
- package/dist/commands/status.js +0 -26
- package/dist/commands/subagents.d.ts +0 -8
- package/dist/commands/subagents.js +0 -31
- package/dist/commands/sync.d.ts +0 -37
- package/dist/commands/sync.js +0 -256
- package/dist/commands/teams-picker.d.ts +0 -3
- package/dist/commands/teams-picker.js +0 -34
- package/dist/commands/teams.d.ts +1 -76
- package/dist/commands/teams.js +9 -477
- package/dist/commands/tmux.d.ts +0 -25
- package/dist/commands/tmux.js +0 -46
- package/dist/commands/traces.js +0 -19
- package/dist/commands/trash.d.ts +0 -17
- package/dist/commands/trash.js +1 -11
- package/dist/commands/uninstall.d.ts +0 -9
- package/dist/commands/uninstall.js +0 -6
- package/dist/commands/update.d.ts +0 -22
- package/dist/commands/update.js +0 -44
- package/dist/commands/upgrade.d.ts +0 -1
- package/dist/commands/upgrade.js +0 -1
- package/dist/commands/utils.d.ts +0 -85
- package/dist/commands/utils.js +1 -95
- package/dist/commands/versions.d.ts +0 -16
- package/dist/commands/versions.js +0 -134
- package/dist/commands/view.d.ts +0 -90
- package/dist/commands/view.js +4 -343
- package/dist/commands/watchdog.d.ts +0 -19
- package/dist/commands/watchdog.js +3 -43
- package/dist/commands/webhook.d.ts +0 -8
- package/dist/commands/webhook.js +0 -14
- package/dist/commands/workflows.d.ts +0 -8
- package/dist/commands/workflows.js +0 -6
- package/dist/index.d.ts +0 -25
- package/dist/index.js +5 -119
- package/dist/lib/account-capabilities.d.ts +0 -34
- package/dist/lib/account-capabilities.js +0 -32
- package/dist/lib/account-catalog.d.ts +0 -128
- package/dist/lib/account-catalog.js +8 -154
- package/dist/lib/account-provider-registry.d.ts +0 -14
- package/dist/lib/account-provider-registry.js +0 -8
- package/dist/lib/account-registry.d.ts +0 -74
- package/dist/lib/account-registry.js +14 -189
- package/dist/lib/account-schema.d.ts +0 -19
- package/dist/lib/account-schema.js +0 -43
- package/dist/lib/accounting/account-launch.d.ts +0 -15
- package/dist/lib/accounting/account-launch.js +1 -3
- package/dist/lib/accounting/account-pool-collect.d.ts +0 -26
- package/dist/lib/accounting/account-pool-collect.js +0 -42
- package/dist/lib/accounting/account-pool.d.ts +0 -41
- package/dist/lib/accounting/account-pool.js +0 -17
- package/dist/lib/accounting/capacity.d.ts +0 -32
- package/dist/lib/accounting/capacity.js +0 -32
- package/dist/lib/accounting/rotate.d.ts +0 -518
- package/dist/lib/accounting/rotate.js +4 -598
- package/dist/lib/accounting/usage-ingest.d.ts +0 -1
- package/dist/lib/accounting/usage-ingest.js +0 -44
- package/dist/lib/accounting/usage-sync.d.ts +0 -60
- package/dist/lib/accounting/usage-sync.js +4 -51
- package/dist/lib/accounting/usage.d.ts +0 -632
- package/dist/lib/accounting/usage.js +14 -1055
- package/dist/lib/accounts/add.d.ts +0 -60
- package/dist/lib/accounts/add.js +0 -127
- package/dist/lib/accounts/auth-operation-lock.d.ts +0 -1
- package/dist/lib/accounts/auth-operation-lock.js +0 -4
- package/dist/lib/accounts/migrate.d.ts +0 -9
- package/dist/lib/accounts/migrate.js +3 -42
- package/dist/lib/accounts/slots.d.ts +0 -25
- package/dist/lib/accounts/slots.js +1 -49
- package/dist/lib/acp/client.d.ts +0 -16
- package/dist/lib/acp/client.js +0 -29
- package/dist/lib/acp/harnesses.d.ts +0 -15
- package/dist/lib/acp/harnesses.js +0 -16
- package/dist/lib/acp/run.d.ts +0 -8
- package/dist/lib/acp/run.js +0 -8
- package/dist/lib/actor.d.ts +1 -71
- package/dist/lib/actor.js +1 -99
- package/dist/lib/add-dir.d.ts +0 -46
- package/dist/lib/add-dir.js +1 -70
- package/dist/lib/address.d.ts +0 -17
- package/dist/lib/address.js +0 -15
- package/dist/lib/agent-cli-commands.d.ts +0 -10
- package/dist/lib/agent-cli-commands.js +0 -10
- package/dist/lib/agent-modes.d.ts +0 -29
- package/dist/lib/agent-modes.js +0 -31
- package/dist/lib/agent-spec/agents.d.ts +0 -426
- package/dist/lib/agent-spec/agents.js +37 -924
- package/dist/lib/agent-spec/index.d.ts +0 -5
- package/dist/lib/agent-spec/index.js +0 -14
- package/dist/lib/agent-spec/materialize.d.ts +0 -10
- package/dist/lib/agent-spec/materialize.js +2 -139
- package/dist/lib/agent-spec/package-resolve.d.ts +0 -8
- package/dist/lib/agent-spec/package-resolve.js +1 -44
- package/dist/lib/agent-spec/package-schema.d.ts +0 -2
- package/dist/lib/agent-spec/package-schema.js +0 -11
- package/dist/lib/agent-spec/package-types.d.ts +0 -27
- package/dist/lib/agent-spec/package-types.js +0 -1
- package/dist/lib/agent-spec/primitives.d.ts +0 -18
- package/dist/lib/agent-spec/primitives.js +0 -27
- package/dist/lib/agent-spec/provider.js +0 -2
- package/dist/lib/agent-spec/resolve.d.ts +0 -23
- package/dist/lib/agent-spec/resolve.js +0 -41
- package/dist/lib/agent-spec/types.d.ts +0 -34
- package/dist/lib/agent-spec/types.js +0 -6
- package/dist/lib/agents.d.ts +0 -1
- package/dist/lib/agents.js +0 -1
- package/dist/lib/analytics/mix-commands.d.ts +0 -23
- package/dist/lib/analytics/mix-commands.js +0 -26
- package/dist/lib/analytics/recipes.d.ts +0 -1
- package/dist/lib/analytics/recipes.js +5 -10
- package/dist/lib/analytics/usage-db.js +4 -6
- package/dist/lib/answer-router.d.ts +0 -61
- package/dist/lib/answer-router.js +0 -57
- package/dist/lib/app-bundle-install.d.ts +0 -13
- package/dist/lib/app-bundle-install.js +0 -50
- package/dist/lib/artifact-actions.d.ts +0 -15
- package/dist/lib/artifact-actions.js +0 -18
- package/dist/lib/artifacts-client.d.ts +0 -10
- package/dist/lib/artifacts-client.js +0 -17
- package/dist/lib/ask-classifier.d.ts +0 -38
- package/dist/lib/ask-classifier.js +0 -27
- package/dist/lib/audit/log.d.ts +0 -47
- package/dist/lib/audit/log.js +1 -59
- package/dist/lib/auth-health.d.ts +0 -213
- package/dist/lib/auth-health.js +16 -266
- package/dist/lib/auth-mint.d.ts +0 -83
- package/dist/lib/auth-mint.js +8 -85
- package/dist/lib/auto-pull-worker.d.ts +0 -10
- package/dist/lib/auto-pull-worker.js +3 -48
- package/dist/lib/auto-pull.d.ts +0 -64
- package/dist/lib/auto-pull.js +0 -79
- package/dist/lib/beta.d.ts +0 -9
- package/dist/lib/beta.js +0 -9
- package/dist/lib/binary-shadow.d.ts +0 -22
- package/dist/lib/binary-shadow.js +4 -34
- package/dist/lib/boot-profile.d.ts +0 -10
- package/dist/lib/boot-profile.js +1 -31
- package/dist/lib/brand.d.ts +0 -20
- package/dist/lib/brand.js +0 -50
- package/dist/lib/browser/context.d.ts +0 -54
- package/dist/lib/browser/context.js +0 -49
- package/dist/lib/browser/paths.d.ts +0 -21
- package/dist/lib/browser/paths.js +0 -26
- package/dist/lib/browser/record.d.ts +0 -34
- package/dist/lib/browser/record.js +0 -38
- package/dist/lib/browser/sessions-list.d.ts +1 -79
- package/dist/lib/browser/sessions-list.js +2 -98
- package/dist/lib/browser-client.d.ts +0 -112
- package/dist/lib/browser-client.js +1 -90
- package/dist/lib/budget/config.d.ts +0 -6
- package/dist/lib/budget/config.js +0 -29
- package/dist/lib/budget/enforce.d.ts +0 -50
- package/dist/lib/budget/enforce.js +0 -27
- package/dist/lib/budget/ledger.d.ts +0 -23
- package/dist/lib/budget/ledger.js +0 -28
- package/dist/lib/budget/live-cloud.d.ts +0 -26
- package/dist/lib/budget/live-cloud.js +0 -12
- package/dist/lib/budget/live-team.d.ts +0 -17
- package/dist/lib/budget/live-team.js +1 -35
- package/dist/lib/budget/preflight.d.ts +0 -51
- package/dist/lib/budget/preflight.js +0 -36
- package/dist/lib/byok-usage.d.ts +0 -20
- package/dist/lib/byok-usage.js +1 -24
- package/dist/lib/capabilities.d.ts +0 -24
- package/dist/lib/capabilities.js +0 -29
- package/dist/lib/catchup.d.ts +0 -87
- package/dist/lib/catchup.js +1 -81
- package/dist/lib/channels/owner-forward.d.ts +0 -70
- package/dist/lib/channels/owner-forward.js +1 -43
- package/dist/lib/channels/owner-sink.js +0 -21
- package/dist/lib/channels/providers/desktop.d.ts +0 -37
- package/dist/lib/channels/providers/desktop.js +0 -72
- package/dist/lib/channels/providers/index.d.ts +0 -1
- package/dist/lib/channels/providers/index.js +2 -6
- package/dist/lib/channels/providers/mailbox.js +0 -7
- package/dist/lib/channels/providers/openclaw-telegram.js +0 -8
- package/dist/lib/channels/providers/rush.d.ts +0 -2
- package/dist/lib/channels/providers/rush.js +0 -26
- package/dist/lib/channels/providers/session.d.ts +2 -0
- package/dist/lib/channels/providers/session.js +26 -0
- package/dist/lib/channels/registry.d.ts +0 -27
- package/dist/lib/channels/registry.js +0 -10
- package/dist/lib/channels/resolve.d.ts +0 -19
- package/dist/lib/channels/resolve.js +0 -2
- package/dist/lib/channels/send.d.ts +0 -50
- package/dist/lib/channels/send.js +0 -25
- package/dist/lib/checkpoint.d.ts +0 -36
- package/dist/lib/checkpoint.js +0 -28
- package/dist/lib/claude-account-token.d.ts +0 -98
- package/dist/lib/claude-account-token.js +7 -169
- package/dist/lib/claude-statusline.d.ts +0 -41
- package/dist/lib/claude-statusline.js +0 -68
- package/dist/lib/cli-entry.d.ts +0 -26
- package/dist/lib/cli-entry.js +1 -61
- package/dist/lib/cli-resources.d.ts +31 -89
- package/dist/lib/cli-resources.js +116 -152
- package/dist/lib/cloud/antigravity.d.ts +0 -29
- package/dist/lib/cloud/antigravity.js +0 -36
- package/dist/lib/cloud/codex.d.ts +0 -8
- package/dist/lib/cloud/codex.js +0 -41
- package/dist/lib/cloud/cursor.d.ts +0 -5
- package/dist/lib/cloud/cursor.js +2 -7
- package/dist/lib/cloud/dispatch.d.ts +0 -13
- package/dist/lib/cloud/dispatch.js +1 -48
- package/dist/lib/cloud/factory.d.ts +0 -52
- package/dist/lib/cloud/factory.js +3 -67
- package/dist/lib/cloud/host.d.ts +0 -39
- package/dist/lib/cloud/host.js +5 -48
- package/dist/lib/cloud/registry.d.ts +0 -25
- package/dist/lib/cloud/registry.js +0 -29
- package/dist/lib/cloud/rush.d.ts +0 -47
- package/dist/lib/cloud/rush.js +1 -82
- package/dist/lib/cloud/session-index.d.ts +0 -27
- package/dist/lib/cloud/session-index.js +1 -32
- package/dist/lib/cloud/store.d.ts +0 -18
- package/dist/lib/cloud/store.js +0 -28
- package/dist/lib/cloud/stream.d.ts +0 -14
- package/dist/lib/cloud/stream.js +0 -25
- package/dist/lib/cloud/types.d.ts +0 -168
- package/dist/lib/cloud/types.js +0 -46
- package/dist/lib/cloudflare/creds.d.ts +0 -2
- package/dist/lib/cloudflare/creds.js +0 -14
- package/dist/lib/cloudflare/provision.d.ts +0 -8
- package/dist/lib/cloudflare/provision.js +1 -19
- package/dist/lib/codex-home.d.ts +0 -60
- package/dist/lib/codex-home.js +2 -72
- package/dist/lib/codex-policy.d.ts +0 -10
- package/dist/lib/codex-policy.js +0 -13
- package/dist/lib/command-skills.d.ts +0 -10
- package/dist/lib/command-skills.js +0 -10
- package/dist/lib/commands.d.ts +0 -74
- package/dist/lib/commands.js +0 -112
- package/dist/lib/comms-render.d.ts +0 -5
- package/dist/lib/comms-render.js +0 -5
- package/dist/lib/computer/context.d.ts +0 -23
- package/dist/lib/computer/context.js +0 -14
- package/dist/lib/computer/policy.d.ts +0 -20
- package/dist/lib/computer/policy.js +0 -53
- package/dist/lib/computer/record.d.ts +0 -33
- package/dist/lib/computer/record.js +1 -48
- package/dist/lib/computer/sessions-list.d.ts +1 -128
- package/dist/lib/computer/sessions-list.js +6 -165
- package/dist/lib/computer-client.d.ts +0 -106
- package/dist/lib/computer-client.js +5 -86
- package/dist/lib/concurrency.d.ts +0 -14
- package/dist/lib/concurrency.js +0 -3
- package/dist/lib/config-drift.d.ts +0 -31
- package/dist/lib/config-drift.js +0 -32
- package/dist/lib/config-keys.d.ts +1 -65
- package/dist/lib/config-keys.js +6 -52
- package/dist/lib/config-transfer.d.ts +0 -14
- package/dist/lib/config-transfer.js +0 -26
- package/dist/lib/convert.d.ts +0 -17
- package/dist/lib/convert.js +0 -18
- package/dist/lib/crabbox/cli.d.ts +0 -156
- package/dist/lib/crabbox/cli.js +1 -188
- package/dist/lib/crabbox/config.d.ts +0 -18
- package/dist/lib/crabbox/config.js +1 -19
- package/dist/lib/crabbox/lease.d.ts +0 -93
- package/dist/lib/crabbox/lease.js +4 -148
- package/dist/lib/crabbox/progress.d.ts +0 -56
- package/dist/lib/crabbox/progress.js +2 -49
- package/dist/lib/crabbox/runtimes.d.ts +0 -94
- package/dist/lib/crabbox/runtimes.js +1 -111
- package/dist/lib/crabbox/setup-copy.d.ts +0 -64
- package/dist/lib/crabbox/setup-copy.js +1 -53
- package/dist/lib/daemon/account-state-daemon-service.d.ts +0 -48
- package/dist/lib/daemon/account-state-daemon-service.js +2 -63
- package/dist/lib/daemon/attention-notify-service.d.ts +0 -12
- package/dist/lib/daemon/attention-notify-service.js +1 -24
- package/dist/lib/daemon/auth-sync-service.d.ts +0 -28
- package/dist/lib/daemon/auth-sync-service.js +0 -56
- package/dist/lib/daemon/catchup-service.d.ts +0 -34
- package/dist/lib/daemon/catchup-service.js +0 -30
- package/dist/lib/daemon/daemon.d.ts +0 -374
- package/dist/lib/daemon/daemon.js +44 -1049
- package/dist/lib/daemon/daemon.test-fixture.d.ts +0 -19
- package/dist/lib/daemon/daemon.test-fixture.js +1 -24
- package/dist/lib/daemon/device-probe-service.d.ts +0 -16
- package/dist/lib/daemon/device-probe-service.js +0 -20
- package/dist/lib/daemon/feed-stream-service.d.ts +0 -15
- package/dist/lib/daemon/feed-stream-service.js +0 -20
- package/dist/lib/daemon/harness-update-service.d.ts +2 -61
- package/dist/lib/daemon/harness-update-service.js +6 -86
- package/dist/lib/daemon/heartbeat-service.d.ts +0 -1
- package/dist/lib/daemon/heartbeat-service.js +0 -1
- package/dist/lib/daemon/leaked-daemons.d.ts +0 -46
- package/dist/lib/daemon/leaked-daemons.js +2 -78
- package/dist/lib/daemon/monitor-engine-service.d.ts +0 -13
- package/dist/lib/daemon/monitor-engine-service.js +3 -15
- package/dist/lib/daemon/runner.d.ts +0 -194
- package/dist/lib/daemon/runner.js +39 -760
- package/dist/lib/daemon/self-heal-service.d.ts +18 -17
- package/dist/lib/daemon/self-heal-service.js +83 -37
- package/dist/lib/daemon/self-update-service.d.ts +1 -131
- package/dist/lib/daemon/self-update-service.js +26 -189
- package/dist/lib/daemon/service.d.ts +0 -73
- package/dist/lib/daemon/service.js +0 -34
- package/dist/lib/daemon/session-index-service.d.ts +0 -12
- package/dist/lib/daemon/session-index-service.js +0 -23
- package/dist/lib/daemon/session-state-service.d.ts +0 -8
- package/dist/lib/daemon/session-state-service.js +0 -8
- package/dist/lib/daemon/session-summarizer-service.d.ts +0 -14
- package/dist/lib/daemon/session-summarizer-service.js +1 -19
- package/dist/lib/daemon/session-title-service.d.ts +0 -25
- package/dist/lib/daemon/session-title-service.js +0 -32
- package/dist/lib/daemon/state-dir-check-service.d.ts +0 -24
- package/dist/lib/daemon/state-dir-check-service.js +0 -29
- package/dist/lib/daemon/supervisor.d.ts +0 -112
- package/dist/lib/daemon/supervisor.js +4 -147
- package/dist/lib/daemon/testdata/process-view-daemon.js +0 -2
- package/dist/lib/daemon/testdata/process-view-start.js +0 -5
- package/dist/lib/daemon/tmux-reap-service.d.ts +0 -1
- package/dist/lib/daemon/tmux-reap-service.js +0 -1
- package/dist/lib/daemon/usage-sync-service.d.ts +0 -23
- package/dist/lib/daemon/usage-sync-service.js +0 -26
- package/dist/lib/daemon/watchdog-service.d.ts +0 -9
- package/dist/lib/daemon/watchdog-service.js +0 -13
- package/dist/lib/daemon/webhook-receiver-service.d.ts +0 -1
- package/dist/lib/daemon/webhook-receiver-service.js +0 -1
- package/dist/lib/daemon-health.d.ts +0 -55
- package/dist/lib/daemon-health.js +4 -77
- package/dist/lib/daemon-services.d.ts +0 -36
- package/dist/lib/daemon-services.js +0 -45
- package/dist/lib/daemon-ticks.d.ts +0 -126
- package/dist/lib/daemon-ticks.js +1 -156
- package/dist/lib/daemon-webhooks.d.ts +0 -57
- package/dist/lib/daemon-webhooks.js +2 -54
- package/dist/lib/deeplink/register.d.ts +0 -15
- package/dist/lib/deeplink/register.js +0 -60
- package/dist/lib/deeplink/url.d.ts +0 -24
- package/dist/lib/deeplink/url.js +1 -33
- package/dist/lib/device-config.d.ts +1 -192
- package/dist/lib/device-config.js +86 -240
- package/dist/lib/devices/config-migration.d.ts +0 -43
- package/dist/lib/devices/config-migration.js +7 -127
- package/dist/lib/devices/connect.d.ts +0 -168
- package/dist/lib/devices/connect.js +6 -254
- package/dist/lib/devices/device-docs.d.ts +0 -24
- package/dist/lib/devices/device-docs.js +0 -46
- package/dist/lib/devices/discovery-policy.d.ts +0 -30
- package/dist/lib/devices/discovery-policy.js +3 -34
- package/dist/lib/devices/doctor-findings.d.ts +0 -109
- package/dist/lib/devices/doctor-findings.js +30 -326
- package/dist/lib/devices/doctor-overview-cache.d.ts +0 -33
- package/dist/lib/devices/doctor-overview-cache.js +0 -81
- package/dist/lib/devices/fleet-divergence.d.ts +0 -89
- package/dist/lib/devices/fleet-divergence.js +1 -60
- package/dist/lib/devices/fleet-inventory.d.ts +0 -27
- package/dist/lib/devices/fleet-inventory.js +0 -38
- package/dist/lib/devices/fleet.d.ts +0 -95
- package/dist/lib/devices/fleet.js +0 -79
- package/dist/lib/devices/harness-inventory.d.ts +0 -75
- package/dist/lib/devices/harness-inventory.js +0 -101
- package/dist/lib/devices/health-report.d.ts +0 -37
- package/dist/lib/devices/health-report.js +0 -73
- package/dist/lib/devices/health.d.ts +0 -71
- package/dist/lib/devices/health.js +2 -82
- package/dist/lib/devices/interactive-host.d.ts +0 -10
- package/dist/lib/devices/interactive-host.js +0 -34
- package/dist/lib/devices/known-hosts.d.ts +0 -45
- package/dist/lib/devices/known-hosts.js +0 -77
- package/dist/lib/devices/pending.d.ts +0 -31
- package/dist/lib/devices/pending.js +7 -67
- package/dist/lib/devices/pool.d.ts +0 -36
- package/dist/lib/devices/pool.js +0 -30
- package/dist/lib/devices/reachability.d.ts +0 -25
- package/dist/lib/devices/reachability.js +0 -14
- package/dist/lib/devices/registry.d.ts +0 -141
- package/dist/lib/devices/registry.js +4 -151
- package/dist/lib/devices/resolve-profile.d.ts +0 -18
- package/dist/lib/devices/resolve-profile.js +0 -18
- package/dist/lib/devices/resolve-target.d.ts +0 -20
- package/dist/lib/devices/resolve-target.js +1 -51
- package/dist/lib/devices/rollout-verify.d.ts +1 -81
- package/dist/lib/devices/rollout-verify.js +0 -77
- package/dist/lib/devices/self-host.d.ts +0 -7
- package/dist/lib/devices/self-host.js +1 -29
- package/dist/lib/devices/ssh-config.d.ts +0 -18
- package/dist/lib/devices/ssh-config.js +0 -9
- package/dist/lib/devices/stats-cache.d.ts +0 -48
- package/dist/lib/devices/stats-cache.js +0 -80
- package/dist/lib/devices/sync.d.ts +0 -97
- package/dist/lib/devices/sync.js +0 -88
- package/dist/lib/devices/tailscale.d.ts +0 -18
- package/dist/lib/devices/tailscale.js +1 -38
- package/dist/lib/devices/terminfo.d.ts +0 -27
- package/dist/lib/devices/terminfo.js +2 -64
- package/dist/lib/devices/worker-pick.d.ts +0 -15
- package/dist/lib/devices/worker-pick.js +0 -48
- package/dist/lib/diff-text.d.ts +0 -18
- package/dist/lib/diff-text.js +0 -15
- package/dist/lib/doctor-diff.d.ts +0 -79
- package/dist/lib/doctor-diff.js +2 -181
- package/dist/lib/drift-sync.d.ts +0 -29
- package/dist/lib/drift-sync.js +0 -40
- package/dist/lib/drift.d.ts +0 -43
- package/dist/lib/drift.js +0 -31
- package/dist/lib/event-families.d.ts +0 -17
- package/dist/lib/event-families.js +0 -33
- package/dist/lib/event-provenance.d.ts +0 -4
- package/dist/lib/event-provenance.js +0 -5
- package/dist/lib/event-stream.d.ts +0 -29
- package/dist/lib/event-stream.js +0 -36
- package/dist/lib/events-ingest.d.ts +0 -27
- package/dist/lib/events-ingest.js +0 -54
- package/dist/lib/exec-account-home.d.ts +0 -24
- package/dist/lib/exec-account-home.js +0 -41
- package/dist/lib/exec-bounded.d.ts +1 -37
- package/dist/lib/exec-bounded.js +10 -46
- package/dist/lib/exec.d.ts +3 -583
- package/dist/lib/exec.js +18 -1025
- package/dist/lib/factory/snapshot.js +1 -15
- package/dist/lib/feed/activity-stream.d.ts +0 -27
- package/dist/lib/feed/activity-stream.js +4 -80
- package/dist/lib/feed/activity.d.ts +1 -243
- package/dist/lib/feed/activity.js +8 -273
- package/dist/lib/feed/answer.d.ts +0 -103
- package/dist/lib/feed/answer.js +0 -267
- package/dist/lib/feed/attention.d.ts +0 -56
- package/dist/lib/feed/attention.js +0 -161
- package/dist/lib/feed/envelope.d.ts +2 -17
- package/dist/lib/feed/envelope.js +0 -14
- package/dist/lib/feed/events.d.ts +0 -118
- package/dist/lib/feed/events.js +13 -213
- package/dist/lib/feed/feed.d.ts +1 -250
- package/dist/lib/feed/feed.js +24 -334
- package/dist/lib/feed/hub-server.d.ts +0 -100
- package/dist/lib/feed/hub-server.js +1 -191
- package/dist/lib/feed/hub.d.ts +0 -53
- package/dist/lib/feed/hub.js +0 -89
- package/dist/lib/feed/pr-status.d.ts +1 -19
- package/dist/lib/feed/pr-status.js +0 -18
- package/dist/lib/feed/tool-activity.d.ts +0 -59
- package/dist/lib/feed/tool-activity.js +1 -119
- package/dist/lib/feed/tools.d.ts +0 -100
- package/dist/lib/feed/tools.js +0 -89
- package/dist/lib/feed/watch.d.ts +0 -33
- package/dist/lib/feed/watch.js +2 -94
- package/dist/lib/feed-broadcast.d.ts +0 -148
- package/dist/lib/feed-broadcast.js +1 -283
- package/dist/lib/feed-outcome.d.ts +0 -50
- package/dist/lib/feed-outcome.js +1 -67
- package/dist/lib/feed-policy.d.ts +0 -6
- package/dist/lib/feed-policy.js +1 -27
- package/dist/lib/feed-post.d.ts +0 -61
- package/dist/lib/feed-post.js +4 -61
- package/dist/lib/feed-ranking.d.ts +1 -1
- package/dist/lib/fleet/apply.d.ts +0 -64
- package/dist/lib/fleet/apply.js +0 -125
- package/dist/lib/fleet/auth-sync.d.ts +0 -48
- package/dist/lib/fleet/auth-sync.js +4 -49
- package/dist/lib/fleet/capture.d.ts +0 -26
- package/dist/lib/fleet/capture.js +1 -36
- package/dist/lib/fleet/manifest.d.ts +0 -38
- package/dist/lib/fleet/manifest.js +0 -40
- package/dist/lib/fleet/types.d.ts +1 -138
- package/dist/lib/fleet/types.js +0 -12
- package/dist/lib/fleet-cache.d.ts +0 -12
- package/dist/lib/fleet-cache.js +0 -24
- package/dist/lib/fleet-shared-state.d.ts +6 -59
- package/dist/lib/fleet-shared-state.js +5 -51
- package/dist/lib/fleet-status.d.ts +0 -27
- package/dist/lib/fleet-status.js +0 -48
- package/dist/lib/format.d.ts +0 -74
- package/dist/lib/format.js +3 -77
- package/dist/lib/friction-heuristics.d.ts +0 -20
- package/dist/lib/friction-heuristics.js +0 -8
- package/dist/lib/fs-atomic.d.ts +0 -51
- package/dist/lib/fs-atomic.js +8 -66
- package/dist/lib/fs-walk.d.ts +0 -13
- package/dist/lib/fs-walk.js +0 -22
- package/dist/lib/fuzzy.d.ts +0 -29
- package/dist/lib/fuzzy.js +0 -31
- package/dist/lib/gemini-settings.js +0 -12
- package/dist/lib/git.d.ts +0 -366
- package/dist/lib/git.js +7 -574
- package/dist/lib/github/ci-failure.d.ts +30 -0
- package/dist/lib/github/ci-failure.js +95 -0
- package/dist/lib/github/gh-overload.d.ts +0 -38
- package/dist/lib/github/gh-overload.js +3 -55
- package/dist/lib/github/pr-mergeable.d.ts +3 -34
- package/dist/lib/github/pr-mergeable.js +2 -42
- package/dist/lib/github/pr-verdict.d.ts +0 -44
- package/dist/lib/github/pr-verdict.js +0 -36
- package/dist/lib/github/project-prs.d.ts +135 -105
- package/dist/lib/github/project-prs.js +530 -170
- package/dist/lib/github/release-drift.d.ts +45 -0
- package/dist/lib/github/release-drift.js +91 -0
- package/dist/lib/github/rest.d.ts +0 -50
- package/dist/lib/github/rest.js +0 -49
- package/dist/lib/github/viewer.d.ts +27 -0
- package/dist/lib/github/viewer.js +101 -0
- package/dist/lib/goose-commands.d.ts +0 -29
- package/dist/lib/goose-commands.js +3 -48
- package/dist/lib/harness/adapter.d.ts +0 -151
- package/dist/lib/harness/adapter.js +0 -41
- package/dist/lib/harness/adapters/claude.d.ts +0 -8
- package/dist/lib/harness/adapters/claude.js +0 -89
- package/dist/lib/harness/adapters/codex.js +0 -18
- package/dist/lib/harness/adapters/copilot.js +0 -3
- package/dist/lib/harness/adapters/cursor.js +0 -16
- package/dist/lib/harness/adapters/droid.js +0 -3
- package/dist/lib/harness/adapters/kimi.js +0 -19
- package/dist/lib/harness/adapters/muse.js +0 -9
- package/dist/lib/harness/adapters/opencode.js +0 -2
- package/dist/lib/harness/exec-config-version.d.ts +0 -2
- package/dist/lib/harness/exec-config-version.js +0 -13
- package/dist/lib/harness/index.js +0 -10
- package/dist/lib/harness-auth-capabilities.d.ts +0 -26
- package/dist/lib/harness-auth-capabilities.js +0 -18
- package/dist/lib/harness-connection-test.d.ts +0 -27
- package/dist/lib/harness-connection-test.js +2 -20
- package/dist/lib/heal.d.ts +0 -45
- package/dist/lib/heal.js +2 -82
- package/dist/lib/help.d.ts +0 -32
- package/dist/lib/help.js +0 -41
- package/dist/lib/helper-download.d.ts +0 -85
- package/dist/lib/helper-download.js +0 -95
- package/dist/lib/helper-versions.d.ts +0 -51
- package/dist/lib/helper-versions.js +1 -45
- package/dist/lib/hooks/cache.d.ts +0 -40
- package/dist/lib/hooks/cache.js +8 -122
- package/dist/lib/hooks/install.d.ts +0 -253
- package/dist/lib/hooks/install.js +49 -822
- package/dist/lib/hooks/match.d.ts +0 -24
- package/dist/lib/hooks/match.js +0 -31
- package/dist/lib/hooks/profile.d.ts +0 -21
- package/dist/lib/hooks/profile.js +0 -28
- package/dist/lib/hosts/credential-transport.d.ts +0 -6
- package/dist/lib/hosts/credential-transport.js +0 -17
- package/dist/lib/hosts/credentials.d.ts +0 -35
- package/dist/lib/hosts/credentials.js +0 -38
- package/dist/lib/hosts/dispatch.d.ts +0 -140
- package/dist/lib/hosts/dispatch.js +0 -176
- package/dist/lib/hosts/logs.d.ts +0 -25
- package/dist/lib/hosts/logs.js +1 -51
- package/dist/lib/hosts/option.d.ts +0 -12
- package/dist/lib/hosts/option.js +0 -12
- package/dist/lib/hosts/passthrough.d.ts +0 -129
- package/dist/lib/hosts/passthrough.js +12 -249
- package/dist/lib/hosts/progress.d.ts +0 -90
- package/dist/lib/hosts/progress.js +5 -115
- package/dist/lib/hosts/providers/devices.d.ts +0 -19
- package/dist/lib/hosts/providers/devices.js +1 -34
- package/dist/lib/hosts/providers/local.d.ts +0 -14
- package/dist/lib/hosts/providers/local.js +0 -22
- package/dist/lib/hosts/ready.d.ts +0 -99
- package/dist/lib/hosts/ready.js +0 -101
- package/dist/lib/hosts/reconcile.d.ts +0 -38
- package/dist/lib/hosts/reconcile.js +1 -50
- package/dist/lib/hosts/reconnect.d.ts +0 -75
- package/dist/lib/hosts/reconnect.js +0 -98
- package/dist/lib/hosts/registry.d.ts +0 -74
- package/dist/lib/hosts/registry.js +0 -110
- package/dist/lib/hosts/remote-cmd.d.ts +1 -228
- package/dist/lib/hosts/remote-cmd.js +19 -294
- package/dist/lib/hosts/remote-cmd.test-fixture.d.ts +0 -1
- package/dist/lib/hosts/remote-cmd.test-fixture.js +0 -12
- package/dist/lib/hosts/remote-os.d.ts +0 -19
- package/dist/lib/hosts/remote-os.js +0 -22
- package/dist/lib/hosts/remote-session-id.d.ts +0 -22
- package/dist/lib/hosts/remote-session-id.js +0 -24
- package/dist/lib/hosts/routing-flag.d.ts +0 -21
- package/dist/lib/hosts/routing-flag.js +0 -21
- package/dist/lib/hosts/run-target.d.ts +0 -53
- package/dist/lib/hosts/run-target.js +0 -56
- package/dist/lib/hosts/session-index.d.ts +1 -53
- package/dist/lib/hosts/session-index.js +2 -59
- package/dist/lib/hosts/session-marker.d.ts +0 -31
- package/dist/lib/hosts/session-marker.js +0 -32
- package/dist/lib/hosts/ssh-config.d.ts +0 -25
- package/dist/lib/hosts/ssh-config.js +1 -32
- package/dist/lib/hosts/tasks.d.ts +0 -54
- package/dist/lib/hosts/tasks.js +0 -35
- package/dist/lib/hosts/types.d.ts +0 -39
- package/dist/lib/hosts/types.js +0 -22
- package/dist/lib/humans.d.ts +0 -21
- package/dist/lib/humans.js +0 -30
- package/dist/lib/identity/client.d.ts +1 -35
- package/dist/lib/identity/client.js +3 -29
- package/dist/lib/identity/index.d.ts +3 -27
- package/dist/lib/identity/index.js +8 -24
- package/dist/lib/import.d.ts +0 -104
- package/dist/lib/import.js +1 -137
- package/dist/lib/installations/active-check.d.ts +0 -53
- package/dist/lib/installations/active-check.js +0 -49
- package/dist/lib/installations/index.d.ts +0 -9
- package/dist/lib/installations/index.js +0 -9
- package/dist/lib/installations/installation-lock.js +0 -8
- package/dist/lib/installations/launch-gate.d.ts +0 -56
- package/dist/lib/installations/launch-gate.js +0 -83
- package/dist/lib/installations/migrate.d.ts +0 -100
- package/dist/lib/installations/migrate.js +105 -572
- package/dist/lib/installations/native-command.d.ts +0 -1
- package/dist/lib/installations/native-command.js +0 -6
- package/dist/lib/installations/resolve.d.ts +0 -24
- package/dist/lib/installations/resolve.js +0 -24
- package/dist/lib/installations/shims.d.ts +0 -395
- package/dist/lib/installations/shims.js +30 -957
- package/dist/lib/installations/store.d.ts +0 -199
- package/dist/lib/installations/store.js +1 -297
- package/dist/lib/installations/strategies.d.ts +0 -44
- package/dist/lib/installations/strategies.js +0 -87
- package/dist/lib/installations/types.d.ts +1 -67
- package/dist/lib/installations/types.js +0 -6
- package/dist/lib/installations/update-cancellation.d.ts +0 -74
- package/dist/lib/installations/update-cancellation.js +0 -74
- package/dist/lib/installations/update-policy.d.ts +0 -57
- package/dist/lib/installations/update-policy.js +0 -62
- package/dist/lib/installations/update-runtime.d.ts +0 -88
- package/dist/lib/installations/update-runtime.js +1 -127
- package/dist/lib/installations/update.d.ts +0 -53
- package/dist/lib/installations/update.js +0 -95
- package/dist/lib/installations/versions.d.ts +0 -310
- package/dist/lib/installations/versions.js +14 -837
- package/dist/lib/isolation-boundary-report.d.ts +0 -7
- package/dist/lib/isolation-boundary-report.js +0 -7
- package/dist/lib/launch-identity.d.ts +0 -8
- package/dist/lib/launch-identity.js +0 -8
- package/dist/lib/linear-autoclose.d.ts +0 -25
- package/dist/lib/linear-autoclose.js +0 -19
- package/dist/lib/linear-cache.d.ts +0 -57
- package/dist/lib/linear-cache.js +1 -81
- package/dist/lib/linear-project-counts.d.ts +0 -83
- package/dist/lib/linear-project-counts.js +2 -64
- package/dist/lib/linear-projects.d.ts +0 -62
- package/dist/lib/linear-projects.js +0 -85
- package/dist/lib/linear-rate-limit.d.ts +0 -21
- package/dist/lib/linear-rate-limit.js +1 -93
- package/dist/lib/linux-userns.d.ts +1 -42
- package/dist/lib/linux-userns.js +0 -47
- package/dist/lib/lock-compromise.d.ts +0 -7
- package/dist/lib/lock-compromise.js +0 -7
- package/dist/lib/log-follow.d.ts +0 -2
- package/dist/lib/log-follow.js +5 -15
- package/dist/lib/loop.d.ts +0 -106
- package/dist/lib/loop.js +0 -135
- package/dist/lib/machine-id.d.ts +0 -19
- package/dist/lib/machine-id.js +0 -19
- package/dist/lib/mailbox-gc.d.ts +0 -7
- package/dist/lib/mailbox-gc.js +0 -25
- package/dist/lib/mailbox-target.d.ts +0 -31
- package/dist/lib/mailbox-target.js +0 -27
- package/dist/lib/mailbox.d.ts +0 -77
- package/dist/lib/mailbox.js +5 -105
- package/dist/lib/manifest.d.ts +0 -4
- package/dist/lib/manifest.js +0 -36
- package/dist/lib/markdown.d.ts +0 -3
- package/dist/lib/markdown.js +0 -9
- package/dist/lib/mcp-registry.d.ts +1 -50
- package/dist/lib/mcp-registry.js +0 -64
- package/dist/lib/mcp.d.ts +0 -115
- package/dist/lib/mcp.js +3 -199
- package/dist/lib/memory-cache.d.ts +0 -11
- package/dist/lib/memory-cache.js +0 -9
- package/dist/lib/memory.d.ts +0 -52
- package/dist/lib/memory.js +12 -74
- package/dist/lib/menubar/download-menubar.d.ts +0 -35
- package/dist/lib/menubar/download-menubar.js +0 -38
- package/dist/lib/menubar/install-menubar.d.ts +0 -405
- package/dist/lib/menubar/install-menubar.js +25 -667
- package/dist/lib/menubar/migrate-prefs.d.ts +0 -47
- package/dist/lib/menubar/migrate-prefs.js +1 -70
- package/dist/lib/menubar/notify-desktop.d.ts +0 -82
- package/dist/lib/menubar/notify-desktop.js +0 -68
- package/dist/lib/menubar/resolve-version.d.ts +0 -41
- package/dist/lib/menubar/resolve-version.js +2 -44
- package/dist/lib/menubar/snapshot.d.ts +13 -66
- package/dist/lib/menubar/snapshot.js +45 -39
- package/dist/lib/merged-resources.d.ts +0 -10
- package/dist/lib/merged-resources.js +0 -10
- package/dist/lib/migrate-fold.d.ts +0 -31
- package/dist/lib/migrate-fold.js +6 -38
- package/dist/lib/model-tier-overrides.d.ts +0 -30
- package/dist/lib/model-tier-overrides.js +0 -14
- package/dist/lib/model-tiers.d.ts +0 -43
- package/dist/lib/model-tiers.js +5 -78
- package/dist/lib/models.d.ts +0 -145
- package/dist/lib/models.js +3 -333
- package/dist/lib/monitors/config.d.ts +0 -187
- package/dist/lib/monitors/config.js +4 -101
- package/dist/lib/monitors/dispatch.d.ts +0 -22
- package/dist/lib/monitors/dispatch.js +0 -35
- package/dist/lib/monitors/engine.d.ts +1 -53
- package/dist/lib/monitors/engine.js +17 -106
- package/dist/lib/monitors/fingerprint.d.ts +0 -43
- package/dist/lib/monitors/fingerprint.js +0 -57
- package/dist/lib/monitors/pid-watch.d.ts +0 -31
- package/dist/lib/monitors/pid-watch.js +0 -31
- package/dist/lib/monitors/remote.d.ts +0 -52
- package/dist/lib/monitors/remote.js +0 -42
- package/dist/lib/monitors/sources/command.d.ts +2 -9
- package/dist/lib/monitors/sources/command.js +13 -34
- package/dist/lib/monitors/sources/device.d.ts +0 -10
- package/dist/lib/monitors/sources/device.js +0 -14
- package/dist/lib/monitors/sources/failure.d.ts +0 -27
- package/dist/lib/monitors/sources/failure.js +0 -27
- package/dist/lib/monitors/sources/file.d.ts +0 -10
- package/dist/lib/monitors/sources/file.js +0 -11
- package/dist/lib/monitors/sources/http.d.ts +0 -7
- package/dist/lib/monitors/sources/http.js +0 -9
- package/dist/lib/monitors/sources/index.d.ts +0 -9
- package/dist/lib/monitors/sources/index.js +0 -9
- package/dist/lib/monitors/sources/poll.d.ts +0 -8
- package/dist/lib/monitors/sources/poll.js +0 -8
- package/dist/lib/monitors/sources/types.d.ts +0 -18
- package/dist/lib/monitors/sources/types.js +0 -8
- package/dist/lib/monitors/sources/webhook.d.ts +0 -7
- package/dist/lib/monitors/sources/webhook.js +0 -7
- package/dist/lib/monitors/sources/ws.d.ts +0 -10
- package/dist/lib/monitors/sources/ws.js +3 -13
- package/dist/lib/monitors/state.d.ts +0 -132
- package/dist/lib/monitors/state.js +2 -86
- package/dist/lib/native-accounts.d.ts +0 -32
- package/dist/lib/native-accounts.js +0 -17
- package/dist/lib/net-close.d.ts +0 -9
- package/dist/lib/net-close.js +0 -5
- package/dist/lib/notify.d.ts +0 -47
- package/dist/lib/notify.js +0 -30
- package/dist/lib/onepassword.d.ts +0 -14
- package/dist/lib/onepassword.js +0 -12
- package/dist/lib/open-url.d.ts +0 -38
- package/dist/lib/open-url.js +1 -69
- package/dist/lib/openclaw-keychain.js +2 -7
- package/dist/lib/operator.d.ts +0 -9
- package/dist/lib/operator.js +0 -34
- package/dist/lib/origin-machine.d.ts +0 -16
- package/dist/lib/origin-machine.js +0 -16
- package/dist/lib/output/git-output.d.ts +0 -31
- package/dist/lib/output/git-output.js +4 -43
- package/dist/lib/overdue.d.ts +0 -35
- package/dist/lib/overdue.js +0 -60
- package/dist/lib/owner-message.d.ts +0 -20
- package/dist/lib/owner-message.js +1 -40
- package/dist/lib/packages/output-home.d.ts +0 -28
- package/dist/lib/packages/output-home.js +0 -114
- package/dist/lib/paths.d.ts +0 -26
- package/dist/lib/paths.js +1 -27
- package/dist/lib/percentile.d.ts +0 -11
- package/dist/lib/percentile.js +0 -11
- package/dist/lib/perf/db.d.ts +0 -16
- package/dist/lib/perf/db.js +3 -32
- package/dist/lib/perf/spool.d.ts +0 -12
- package/dist/lib/perf/spool.js +0 -13
- package/dist/lib/perf/types.d.ts +0 -26
- package/dist/lib/perf/types.js +0 -1
- package/dist/lib/permissions-registry.d.ts +0 -48
- package/dist/lib/permissions-registry.js +0 -108
- package/dist/lib/permissions.d.ts +0 -215
- package/dist/lib/permissions.js +4 -407
- package/dist/lib/picker.d.ts +0 -124
- package/dist/lib/picker.js +0 -140
- package/dist/lib/placement.d.ts +0 -57
- package/dist/lib/placement.js +0 -47
- package/dist/lib/platform/exec.d.ts +0 -73
- package/dist/lib/platform/exec.js +0 -80
- package/dist/lib/platform/index.d.ts +0 -14
- package/dist/lib/platform/index.js +0 -14
- package/dist/lib/platform/ipc.d.ts +0 -10
- package/dist/lib/platform/ipc.js +0 -13
- package/dist/lib/platform/links.d.ts +0 -14
- package/dist/lib/platform/links.js +0 -25
- package/dist/lib/platform/paths.d.ts +0 -48
- package/dist/lib/platform/paths.js +0 -52
- package/dist/lib/platform/posixpath.d.ts +0 -18
- package/dist/lib/platform/posixpath.js +0 -62
- package/dist/lib/platform/process.d.ts +0 -67
- package/dist/lib/platform/process.js +5 -99
- package/dist/lib/platform/winpath.d.ts +0 -50
- package/dist/lib/platform/winpath.js +0 -81
- package/dist/lib/plugins/plugin-marketplace.d.ts +0 -165
- package/dist/lib/plugins/plugin-marketplace.js +10 -238
- package/dist/lib/plugins/plugins.d.ts +0 -238
- package/dist/lib/plugins/plugins.js +20 -454
- package/dist/lib/plugins/skills.d.ts +0 -86
- package/dist/lib/plugins/skills.js +1 -139
- package/dist/lib/pr-land-detach.d.ts +0 -17
- package/dist/lib/pr-land-detach.js +0 -30
- package/dist/lib/pricing/cost.d.ts +0 -29
- package/dist/lib/pricing/cost.js +0 -38
- package/dist/lib/pricing/index.d.ts +0 -6
- package/dist/lib/pricing/index.js +0 -6
- package/dist/lib/pricing/table.d.ts +0 -8
- package/dist/lib/pricing/table.js +3 -56
- package/dist/lib/probe.d.ts +0 -5
- package/dist/lib/probe.js +0 -40
- package/dist/lib/profiles-presets.d.ts +0 -20
- package/dist/lib/profiles-presets.js +1 -36
- package/dist/lib/profiles.d.ts +0 -185
- package/dist/lib/profiles.js +1 -158
- package/dist/lib/project-doctor.d.ts +0 -29
- package/dist/lib/project-doctor.js +0 -26
- package/dist/lib/project-focus.d.ts +0 -41
- package/dist/lib/project-focus.js +0 -49
- package/dist/lib/project-import.d.ts +0 -41
- package/dist/lib/project-import.js +0 -36
- package/dist/lib/project-key.d.ts +0 -65
- package/dist/lib/project-key.js +0 -70
- package/dist/lib/project-launch.d.ts +0 -49
- package/dist/lib/project-launch.js +2 -91
- package/dist/lib/project-probe.d.ts +0 -86
- package/dist/lib/project-probe.js +1 -88
- package/dist/lib/project-pull.d.ts +0 -96
- package/dist/lib/project-pull.js +0 -122
- package/dist/lib/project-resources.d.ts +0 -44
- package/dist/lib/project-resources.js +7 -171
- package/dist/lib/project-root.d.ts +0 -95
- package/dist/lib/project-root.js +0 -101
- package/dist/lib/project-schedule.d.ts +0 -43
- package/dist/lib/project-schedule.js +0 -52
- package/dist/lib/project-status.d.ts +0 -108
- package/dist/lib/project-status.js +0 -117
- package/dist/lib/projects.d.ts +0 -197
- package/dist/lib/projects.js +1 -213
- package/dist/lib/pwsh.d.ts +0 -41
- package/dist/lib/pwsh.js +0 -51
- package/dist/lib/quick-todo.d.ts +84 -0
- package/dist/lib/quick-todo.js +243 -0
- package/dist/lib/reconcile-and-repair.d.ts +0 -78
- package/dist/lib/reconcile-and-repair.js +3 -66
- package/dist/lib/redact.d.ts +0 -29
- package/dist/lib/redact.js +0 -54
- package/dist/lib/refresh-coordinator.d.ts +0 -15
- package/dist/lib/refresh-coordinator.js +0 -10
- package/dist/lib/refresh.d.ts +0 -39
- package/dist/lib/refresh.js +0 -45
- package/dist/lib/registry.d.ts +0 -65
- package/dist/lib/registry.js +0 -127
- package/dist/lib/reminders.d.ts +0 -21
- package/dist/lib/reminders.js +0 -30
- package/dist/lib/remote-agents-json.d.ts +0 -44
- package/dist/lib/remote-agents-json.js +1 -44
- package/dist/lib/reserved-stores.d.ts +0 -28
- package/dist/lib/reserved-stores.js +2 -28
- package/dist/lib/resource-aliases.d.ts +0 -12
- package/dist/lib/resource-aliases.js +0 -12
- package/dist/lib/resource-content-diff.d.ts +0 -28
- package/dist/lib/resource-content-diff.js +7 -34
- package/dist/lib/resource-inventory.d.ts +0 -51
- package/dist/lib/resource-inventory.js +0 -45
- package/dist/lib/resource-patterns.d.ts +0 -32
- package/dist/lib/resource-patterns.js +0 -34
- package/dist/lib/resource-profiles.d.ts +0 -7
- package/dist/lib/resource-profiles.js +0 -11
- package/dist/lib/resources/types.d.ts +0 -50
- package/dist/lib/resources/types.js +0 -7
- package/dist/lib/resources/workflows.d.ts +0 -7
- package/dist/lib/resources/workflows.js +0 -13
- package/dist/lib/resources.d.ts +0 -65
- package/dist/lib/resources.js +0 -78
- package/dist/lib/routers.d.ts +0 -67
- package/dist/lib/routers.js +0 -60
- package/dist/lib/routine-activation.d.ts +0 -23
- package/dist/lib/routine-activation.js +0 -24
- package/dist/lib/routine-context.d.ts +1 -91
- package/dist/lib/routine-context.js +0 -107
- package/dist/lib/routine-notify-owner.d.ts +0 -79
- package/dist/lib/routine-notify-owner.js +1 -103
- package/dist/lib/routine-notify.d.ts +0 -70
- package/dist/lib/routine-notify.js +1 -75
- package/dist/lib/routine-process-cleanup.d.ts +0 -1
- package/dist/lib/routine-process-cleanup.js +1 -4
- package/dist/lib/routine-readiness.d.ts +0 -63
- package/dist/lib/routine-readiness.js +4 -86
- package/dist/lib/routines-format.d.ts +0 -40
- package/dist/lib/routines-format.js +0 -67
- package/dist/lib/routines-placement.d.ts +0 -33
- package/dist/lib/routines-placement.js +0 -40
- package/dist/lib/routines-project.d.ts +0 -57
- package/dist/lib/routines-project.js +6 -80
- package/dist/lib/rules/compile.d.ts +0 -66
- package/dist/lib/rules/compile.js +6 -118
- package/dist/lib/rules/compose.d.ts +0 -56
- package/dist/lib/rules/compose.js +2 -83
- package/dist/lib/rules/rules.d.ts +0 -23
- package/dist/lib/rules/rules.js +0 -35
- package/dist/lib/rules/run-sync.d.ts +0 -16
- package/dist/lib/rules/run-sync.js +1 -44
- package/dist/lib/run-config.d.ts +0 -7
- package/dist/lib/run-config.js +0 -8
- package/dist/lib/run-defaults.d.ts +0 -14
- package/dist/lib/run-defaults.js +0 -14
- package/dist/lib/run-notify.d.ts +0 -18
- package/dist/lib/run-notify.js +0 -36
- package/dist/lib/run-trace-sync.d.ts +0 -21
- package/dist/lib/run-trace-sync.js +2 -66
- package/dist/lib/rush-session.d.ts +0 -26
- package/dist/lib/rush-session.js +0 -28
- package/dist/lib/sandbox.d.ts +0 -45
- package/dist/lib/sandbox.js +5 -93
- package/dist/lib/scheduler.d.ts +0 -28
- package/dist/lib/scheduler.js +0 -45
- package/dist/lib/scheduling/routines.d.ts +0 -652
- package/dist/lib/scheduling/routines.js +8 -475
- package/dist/lib/secrets-cli.d.ts +3 -8
- package/dist/lib/secrets-cli.js +1 -19
- package/dist/lib/secrets-client.d.ts +0 -117
- package/dist/lib/secrets-client.js +4 -275
- package/dist/lib/secrets-policy.d.ts +0 -142
- package/dist/lib/secrets-policy.js +4 -237
- package/dist/lib/secrets-types.d.ts +0 -87
- package/dist/lib/secrets-types.js +0 -13
- package/dist/lib/self-heal/checks/hook-manifest.js +0 -25
- package/dist/lib/self-heal/checks/hook-runtime.js +0 -5
- package/dist/lib/self-heal/checks/install-staging.d.ts +0 -1
- package/dist/lib/self-heal/checks/install-staging.js +1 -28
- package/dist/lib/self-heal/checks/menubar-helper.js +0 -5
- package/dist/lib/self-heal/checks/path.js +0 -9
- package/dist/lib/self-heal/checks/resources.js +0 -5
- package/dist/lib/self-heal/checks/shadowing.js +2 -16
- package/dist/lib/self-heal/checks/shims.js +0 -14
- package/dist/lib/self-heal/child.d.ts +12 -0
- package/dist/lib/self-heal/child.js +23 -0
- package/dist/lib/self-heal/registry.d.ts +0 -9
- package/dist/lib/self-heal/registry.js +0 -16
- package/dist/lib/self-heal/types.d.ts +0 -12
- package/dist/lib/self-heal/types.js +0 -15
- package/dist/lib/self-update.d.ts +0 -312
- package/dist/lib/self-update.js +9 -360
- package/dist/lib/service-manifest.d.ts +0 -39
- package/dist/lib/service-manifest.js +0 -72
- package/dist/lib/session/active.d.ts +13 -869
- package/dist/lib/session/active.js +20 -976
- package/dist/lib/session/actor-sidecar.d.ts +1 -32
- package/dist/lib/session/actor-sidecar.js +1 -41
- package/dist/lib/session/bookmarks.d.ts +0 -33
- package/dist/lib/session/bookmarks.js +0 -37
- package/dist/lib/session/bundle.d.ts +0 -86
- package/dist/lib/session/bundle.js +0 -54
- package/dist/lib/session/claude-accounts.d.ts +0 -40
- package/dist/lib/session/claude-accounts.js +0 -49
- package/dist/lib/session/cloud.d.ts +1 -23
- package/dist/lib/session/cloud.js +0 -26
- package/dist/lib/session/db.d.ts +5 -658
- package/dist/lib/session/db.js +22 -1443
- package/dist/lib/session/detached.d.ts +0 -21
- package/dist/lib/session/detached.js +0 -29
- package/dist/lib/session/discover.d.ts +3 -420
- package/dist/lib/session/discover.js +30 -1123
- package/dist/lib/session/fork.d.ts +1 -41
- package/dist/lib/session/fork.js +0 -19
- package/dist/lib/session/ghostty-tabs.d.ts +0 -24
- package/dist/lib/session/ghostty-tabs.js +0 -37
- package/dist/lib/session/glance-files.d.ts +19 -0
- package/dist/lib/session/glance-files.js +258 -0
- package/dist/lib/session/hook-sessions.d.ts +0 -33
- package/dist/lib/session/hook-sessions.js +4 -99
- package/dist/lib/session/host-link.d.ts +1 -94
- package/dist/lib/session/host-link.js +1 -81
- package/dist/lib/session/inject-target.d.ts +8 -0
- package/dist/lib/session/inject-target.js +32 -0
- package/dist/lib/session/inject.d.ts +0 -15
- package/dist/lib/session/inject.js +0 -15
- package/dist/lib/session/live-metadata.d.ts +1 -34
- package/dist/lib/session/live-metadata.js +1 -73
- package/dist/lib/session/local-tmux-attach.d.ts +0 -37
- package/dist/lib/session/local-tmux-attach.js +1 -76
- package/dist/lib/session/migrate-targets.d.ts +0 -46
- package/dist/lib/session/migrate-targets.js +0 -24
- package/dist/lib/session/migrations.d.ts +0 -12
- package/dist/lib/session/migrations.js +1 -20
- package/dist/lib/session/mirror.d.ts +0 -32
- package/dist/lib/session/mirror.js +0 -77
- package/dist/lib/session/origin-machine.js +0 -3
- package/dist/lib/session/pid-registry.d.ts +0 -80
- package/dist/lib/session/pid-registry.js +2 -81
- package/dist/lib/session/presence.d.ts +0 -39
- package/dist/lib/session/presence.js +2 -52
- package/dist/lib/session/process-view.d.ts +0 -11
- package/dist/lib/session/process-view.js +0 -25
- package/dist/lib/session/projection.d.ts +0 -3
- package/dist/lib/session/projection.js +0 -10
- package/dist/lib/session/provenance.d.ts +1 -37
- package/dist/lib/session/provenance.js +0 -69
- package/dist/lib/session/recovery.d.ts +1 -40
- package/dist/lib/session/recovery.js +2 -80
- package/dist/lib/session/relative-time.js +0 -3
- package/dist/lib/session/remote/peer-stream.d.ts +0 -42
- package/dist/lib/session/remote/peer-stream.js +0 -64
- package/dist/lib/session/remote/remote-bundle.d.ts +0 -6
- package/dist/lib/session/remote/remote-bundle.js +0 -21
- package/dist/lib/session/remote/remote-list.d.ts +1 -110
- package/dist/lib/session/remote/remote-list.js +5 -139
- package/dist/lib/session/remote/remote.d.ts +0 -98
- package/dist/lib/session/remote/remote.js +3 -119
- package/dist/lib/session/remote/watch.d.ts +1 -34
- package/dist/lib/session/remote/watch.js +12 -72
- package/dist/lib/session/remote-active.d.ts +0 -35
- package/dist/lib/session/remote-active.js +0 -48
- package/dist/lib/session/remote-bundle.js +0 -2
- package/dist/lib/session/remote-list.js +0 -2
- package/dist/lib/session/remote-preview-cache.d.ts +0 -7
- package/dist/lib/session/remote-preview-cache.js +1 -76
- package/dist/lib/session/remote.js +0 -2
- package/dist/lib/session/resume-command.d.ts +0 -6
- package/dist/lib/session/resume-command.js +0 -6
- package/dist/lib/session/resume-owner.d.ts +1 -52
- package/dist/lib/session/resume-owner.js +0 -56
- package/dist/lib/session/run-names.d.ts +0 -24
- package/dist/lib/session/run-names.js +0 -26
- package/dist/lib/session/session-cache.d.ts +2 -146
- package/dist/lib/session/session-cache.js +26 -203
- package/dist/lib/session/short-id.js +0 -3
- package/dist/lib/session/sync/agents.d.ts +0 -68
- package/dist/lib/session/sync/agents.js +0 -0
- package/dist/lib/session/sync/backend.d.ts +0 -39
- package/dist/lib/session/sync/backend.js +0 -45
- package/dist/lib/session/sync/config.d.ts +0 -27
- package/dist/lib/session/sync/config.js +0 -56
- package/dist/lib/session/sync/managed-config.d.ts +0 -17
- package/dist/lib/session/sync/managed-config.js +0 -17
- package/dist/lib/session/sync/managed-key.d.ts +0 -38
- package/dist/lib/session/sync/managed-key.js +1 -42
- package/dist/lib/session/sync/net-client.d.ts +0 -36
- package/dist/lib/session/sync/net-client.js +0 -30
- package/dist/lib/session/sync/provision.d.ts +0 -2
- package/dist/lib/session/sync/provision.js +0 -13
- package/dist/lib/session/sync/r2.d.ts +0 -20
- package/dist/lib/session/sync/r2.js +0 -20
- package/dist/lib/session/sync/transcript-crypto.d.ts +0 -37
- package/dist/lib/session/sync/transcript-crypto.js +5 -37
- package/dist/lib/session/sync/worker-template.d.ts +0 -5
- package/dist/lib/session/sync/worker-template.js +0 -40
- package/dist/lib/session/testdata/pid-registry-namespace.js +0 -2
- package/dist/lib/session/testdata/process-view-private.js +0 -1
- package/dist/lib/session/throughput.d.ts +0 -24
- package/dist/lib/session/throughput.js +1 -25
- package/dist/lib/session/timeline-pass.d.ts +1 -63
- package/dist/lib/session/timeline-pass.js +161 -148
- package/dist/lib/session/title.d.ts +0 -182
- package/dist/lib/session/title.js +0 -139
- package/dist/lib/session/tool-index.d.ts +2 -21
- package/dist/lib/session/tool-index.js +3 -75
- package/dist/lib/session/tool-store.d.ts +2 -48
- package/dist/lib/session/tool-store.js +1 -33
- package/dist/lib/session/viewing-in.d.ts +0 -67
- package/dist/lib/session/viewing-in.js +1 -71
- package/dist/lib/session/watch.js +0 -2
- package/dist/lib/session/width.js +0 -3
- package/dist/lib/sessions-client.d.ts +0 -46
- package/dist/lib/sessions-client.js +36 -113
- package/dist/lib/settings-manifest.d.ts +1 -17
- package/dist/lib/settings-manifest.js +4 -57
- package/dist/lib/setup-tool-install.d.ts +0 -1
- package/dist/lib/setup-tool-install.js +2 -7
- package/dist/lib/setup-tool-status.d.ts +0 -3
- package/dist/lib/setup-tool-status.js +4 -14
- package/dist/lib/sha256-asset.d.ts +0 -20
- package/dist/lib/sha256-asset.js +0 -20
- package/dist/lib/share-runtime.d.ts +0 -10
- package/dist/lib/share-runtime.js +1 -27
- package/dist/lib/shim-heal.d.ts +0 -15
- package/dist/lib/shim-heal.js +3 -29
- package/dist/lib/signin-badge.d.ts +0 -72
- package/dist/lib/signin-badge.js +0 -86
- package/dist/lib/sink-format.d.ts +0 -32
- package/dist/lib/sink-format.js +0 -14
- package/dist/lib/smart-launch.d.ts +0 -75
- package/dist/lib/smart-launch.js +1 -83
- package/dist/lib/snapshot.d.ts +0 -46
- package/dist/lib/snapshot.js +5 -31
- package/dist/lib/spinner.d.ts +0 -37
- package/dist/lib/spinner.js +0 -37
- package/dist/lib/sqlite.d.ts +0 -13
- package/dist/lib/sqlite.js +3 -71
- package/dist/lib/ssh-exec.d.ts +0 -209
- package/dist/lib/ssh-exec.js +11 -248
- package/dist/lib/ssh-tunnel.d.ts +0 -43
- package/dist/lib/ssh-tunnel.js +2 -48
- package/dist/lib/staleness/checkers/commands.d.ts +0 -4
- package/dist/lib/staleness/checkers/commands.js +0 -4
- package/dist/lib/staleness/checkers/hooks.d.ts +0 -10
- package/dist/lib/staleness/checkers/hooks.js +0 -15
- package/dist/lib/staleness/checkers/mcp.d.ts +0 -9
- package/dist/lib/staleness/checkers/mcp.js +0 -9
- package/dist/lib/staleness/checkers/permissions.d.ts +0 -12
- package/dist/lib/staleness/checkers/permissions.js +0 -13
- package/dist/lib/staleness/checkers/plugins.d.ts +0 -8
- package/dist/lib/staleness/checkers/plugins.js +0 -8
- package/dist/lib/staleness/checkers/rules.d.ts +0 -15
- package/dist/lib/staleness/checkers/rules.js +0 -26
- package/dist/lib/staleness/checkers/skills.d.ts +0 -4
- package/dist/lib/staleness/checkers/skills.js +0 -4
- package/dist/lib/staleness/checkers/subagents.d.ts +0 -9
- package/dist/lib/staleness/checkers/subagents.js +0 -9
- package/dist/lib/staleness/checkers/types.d.ts +0 -34
- package/dist/lib/staleness/checkers/types.js +0 -19
- package/dist/lib/staleness/checkers/workflows.d.ts +0 -7
- package/dist/lib/staleness/checkers/workflows.js +0 -7
- package/dist/lib/staleness/detectors/commands.js +0 -17
- package/dist/lib/staleness/detectors/hooks.js +1 -6
- package/dist/lib/staleness/detectors/mcp.js +0 -4
- package/dist/lib/staleness/detectors/permissions.js +10 -23
- package/dist/lib/staleness/detectors/rules.js +0 -6
- package/dist/lib/staleness/detectors/skills.d.ts +0 -1
- package/dist/lib/staleness/detectors/skills.js +1 -12
- package/dist/lib/staleness/detectors/types.d.ts +0 -10
- package/dist/lib/staleness/fingerprint.d.ts +0 -19
- package/dist/lib/staleness/fingerprint.js +0 -35
- package/dist/lib/staleness/index.d.ts +0 -28
- package/dist/lib/staleness/index.js +1 -45
- package/dist/lib/staleness/layers.d.ts +0 -23
- package/dist/lib/staleness/layers.js +0 -34
- package/dist/lib/staleness/prune.d.ts +0 -71
- package/dist/lib/staleness/prune.js +2 -27
- package/dist/lib/staleness/registry.d.ts +0 -10
- package/dist/lib/staleness/registry.js +3 -33
- package/dist/lib/staleness/types.d.ts +0 -36
- package/dist/lib/staleness/types.js +0 -5
- package/dist/lib/staleness/writers/commands.js +1 -48
- package/dist/lib/staleness/writers/hooks.js +1 -18
- package/dist/lib/staleness/writers/kinds.d.ts +0 -12
- package/dist/lib/staleness/writers/kinds.js +0 -1
- package/dist/lib/staleness/writers/lazy-map.d.ts +0 -11
- package/dist/lib/staleness/writers/mcp.js +0 -13
- package/dist/lib/staleness/writers/plugins.js +0 -4
- package/dist/lib/staleness/writers/rules.d.ts +0 -1
- package/dist/lib/staleness/writers/rules.js +1 -19
- package/dist/lib/staleness/writers/skills.js +3 -14
- package/dist/lib/staleness/writers/sources.d.ts +0 -11
- package/dist/lib/staleness/writers/sources.js +0 -32
- package/dist/lib/staleness/writers/subagents.js +0 -16
- package/dist/lib/staleness/writers/types.d.ts +0 -58
- package/dist/lib/staleness/writers/workflows.js +1 -1
- package/dist/lib/standalone-tools.d.ts +24 -0
- package/dist/lib/standalone-tools.js +58 -0
- package/dist/lib/star-nudge.d.ts +0 -32
- package/dist/lib/star-nudge.js +2 -36
- package/dist/lib/startup/command-registry.d.ts +0 -45
- package/dist/lib/startup/command-registry.js +1 -46
- package/dist/lib/startup/dev-build.d.ts +0 -9
- package/dist/lib/startup/dev-build.js +1 -42
- package/dist/lib/startup/root-command.d.ts +0 -19
- package/dist/lib/startup/root-command.js +0 -19
- package/dist/lib/startup/spellcheck.d.ts +0 -13
- package/dist/lib/startup/spellcheck.js +0 -13
- package/dist/lib/state.d.ts +0 -376
- package/dist/lib/state.js +19 -737
- package/dist/lib/storage/selection.d.ts +0 -40
- package/dist/lib/storage/selection.js +0 -29
- package/dist/lib/subagents-registry.d.ts +0 -56
- package/dist/lib/subagents-registry.js +0 -99
- package/dist/lib/subagents.d.ts +0 -128
- package/dist/lib/subagents.js +1 -158
- package/dist/lib/summarizer/config.d.ts +0 -37
- package/dist/lib/summarizer/config.js +0 -37
- package/dist/lib/summarizer/pass.d.ts +0 -20
- package/dist/lib/summarizer/pass.js +1 -34
- package/dist/lib/summarizer/summarize.d.ts +1 -49
- package/dist/lib/summarizer/summarize.js +0 -35
- package/dist/lib/sync-passphrase.d.ts +0 -16
- package/dist/lib/sync-passphrase.js +1 -18
- package/dist/lib/sync-status.d.ts +0 -72
- package/dist/lib/sync-status.js +0 -55
- package/dist/lib/sync-umbrella.d.ts +0 -54
- package/dist/lib/sync-umbrella.js +0 -48
- package/dist/lib/system-run-sync.d.ts +0 -5
- package/dist/lib/system-run-sync.js +1 -31
- package/dist/lib/teams/agents.d.ts +1 -444
- package/dist/lib/teams/agents.js +11 -871
- package/dist/lib/teams/api.d.ts +2 -52
- package/dist/lib/teams/api.js +4 -63
- package/dist/lib/teams/debug.d.ts +0 -6
- package/dist/lib/teams/debug.js +0 -6
- package/dist/lib/teams/delivery.d.ts +0 -41
- package/dist/lib/teams/delivery.js +0 -32
- package/dist/lib/teams/file_ops.d.ts +0 -11
- package/dist/lib/teams/file_ops.js +0 -11
- package/dist/lib/teams/forEach.d.ts +0 -76
- package/dist/lib/teams/forEach.js +1 -77
- package/dist/lib/teams/index.d.ts +1 -7
- package/dist/lib/teams/index.js +1 -7
- package/dist/lib/teams/parsers.d.ts +0 -4
- package/dist/lib/teams/parsers.js +0 -81
- package/dist/lib/teams/persistence.d.ts +0 -2
- package/dist/lib/teams/persistence.js +0 -12
- package/dist/lib/teams/placement-probe.d.ts +0 -12
- package/dist/lib/teams/placement-probe.js +1 -51
- package/dist/lib/teams/pr-watch.d.ts +0 -107
- package/dist/lib/teams/pr-watch.js +1 -107
- package/dist/lib/teams/registry.d.ts +0 -36
- package/dist/lib/teams/registry.js +0 -47
- package/dist/lib/teams/remoteWorktree.d.ts +0 -50
- package/dist/lib/teams/remoteWorktree.js +1 -96
- package/dist/lib/teams/scheduler.d.ts +0 -111
- package/dist/lib/teams/scheduler.js +2 -125
- package/dist/lib/teams/summarizer.d.ts +0 -22
- package/dist/lib/teams/summarizer.js +6 -50
- package/dist/lib/teams/supervisor.d.ts +0 -38
- package/dist/lib/teams/supervisor.js +0 -21
- package/dist/lib/teams/worktree.d.ts +0 -95
- package/dist/lib/teams/worktree.js +3 -110
- package/dist/lib/template.d.ts +0 -21
- package/dist/lib/template.js +0 -23
- package/dist/lib/term-client.d.ts +0 -26
- package/dist/lib/term-client.js +0 -48
- package/dist/lib/term-driver.d.ts +0 -5
- package/dist/lib/term-driver.js +0 -8
- package/dist/lib/terminal/backends/ghostty.d.ts +0 -2
- package/dist/lib/terminal/backends/ghostty.js +0 -12
- package/dist/lib/terminal/backends/index.d.ts +0 -17
- package/dist/lib/terminal/backends/index.js +0 -15
- package/dist/lib/terminal/backends/iterm.d.ts +0 -2
- package/dist/lib/terminal/backends/iterm.js +0 -10
- package/dist/lib/terminal/backends/terminal-app.d.ts +0 -10
- package/dist/lib/terminal/backends/terminal-app.js +0 -30
- package/dist/lib/terminal/backends/tmux.d.ts +0 -10
- package/dist/lib/terminal/backends/tmux.js +0 -2
- package/dist/lib/terminal/backends/vscodium-agent.d.ts +0 -25
- package/dist/lib/terminal/backends/vscodium-agent.js +0 -36
- package/dist/lib/terminal/engine.d.ts +0 -17
- package/dist/lib/terminal/engine.js +0 -10
- package/dist/lib/terminal/index.d.ts +0 -8
- package/dist/lib/terminal/inject.d.ts +1 -173
- package/dist/lib/terminal/inject.js +0 -146
- package/dist/lib/terminal/policy.d.ts +0 -8
- package/dist/lib/terminal/policy.js +0 -1
- package/dist/lib/terminal/preferred.d.ts +0 -66
- package/dist/lib/terminal/preferred.js +0 -30
- package/dist/lib/terminal/quote.d.ts +0 -8
- package/dist/lib/terminal/quote.js +0 -8
- package/dist/lib/terminal/resolve.d.ts +0 -46
- package/dist/lib/terminal/resolve.js +0 -30
- package/dist/lib/terminal/run-surface.d.ts +0 -56
- package/dist/lib/terminal/run-surface.js +0 -46
- package/dist/lib/terminal/shell.d.ts +0 -3
- package/dist/lib/terminal/shell.js +0 -13
- package/dist/lib/terminal/transport.d.ts +0 -14
- package/dist/lib/terminal/transport.js +1 -30
- package/dist/lib/terminal/types.d.ts +0 -40
- package/dist/lib/terminal/types.js +0 -10
- package/dist/lib/text/relative-time.d.ts +0 -36
- package/dist/lib/text/relative-time.js +0 -43
- package/dist/lib/text/short-id.d.ts +0 -16
- package/dist/lib/text/short-id.js +0 -16
- package/dist/lib/text/width.d.ts +0 -24
- package/dist/lib/text/width.js +10 -52
- package/dist/lib/tmux/binary.d.ts +0 -36
- package/dist/lib/tmux/binary.js +0 -28
- package/dist/lib/tmux/index.d.ts +0 -5
- package/dist/lib/tmux/index.js +0 -5
- package/dist/lib/tmux/orphan-reap.d.ts +0 -253
- package/dist/lib/tmux/orphan-reap.js +3 -299
- package/dist/lib/tmux/paths.d.ts +0 -14
- package/dist/lib/tmux/paths.js +0 -14
- package/dist/lib/tmux/session.d.ts +0 -263
- package/dist/lib/tmux/session.js +6 -344
- package/dist/lib/traces/backend.d.ts +0 -20
- package/dist/lib/traces/backend.js +0 -23
- package/dist/lib/traces/classify.d.ts +0 -20
- package/dist/lib/traces/classify.js +0 -7
- package/dist/lib/traces/insights.d.ts +1 -84
- package/dist/lib/traces/insights.js +0 -126
- package/dist/lib/traces/phenotype.d.ts +0 -69
- package/dist/lib/traces/phenotype.js +0 -150
- package/dist/lib/traces/provision.d.ts +0 -1
- package/dist/lib/traces/provision.js +0 -5
- package/dist/lib/traces/schema2-build.d.ts +3 -60
- package/dist/lib/traces/schema2-build.js +8 -149
- package/dist/lib/traces/schema2-danger.d.ts +0 -30
- package/dist/lib/traces/schema2-danger.js +1 -63
- package/dist/lib/traces/schema2.d.ts +0 -11
- package/dist/lib/traces/segments.d.ts +0 -44
- package/dist/lib/traces/segments.js +0 -65
- package/dist/lib/traces/sync.d.ts +2 -239
- package/dist/lib/traces/sync.js +15 -237
- package/dist/lib/traces/worker-template.d.ts +0 -3
- package/dist/lib/traces/worker-template.js +0 -29
- package/dist/lib/triggers/handlers.d.ts +0 -82
- package/dist/lib/triggers/handlers.js +0 -75
- package/dist/lib/triggers/webhook.d.ts +0 -158
- package/dist/lib/triggers/webhook.js +0 -143
- package/dist/lib/types.d.ts +0 -736
- package/dist/lib/types.js +0 -50
- package/dist/lib/uninstall.d.ts +0 -17
- package/dist/lib/uninstall.js +0 -75
- package/dist/lib/usage-backoff.d.ts +0 -20
- package/dist/lib/usage-backoff.js +3 -60
- package/dist/lib/usage-refresh.d.ts +0 -154
- package/dist/lib/usage-refresh.js +8 -212
- package/dist/lib/verbs.d.ts +0 -12
- package/dist/lib/verbs.js +0 -12
- package/dist/lib/version-duplicates.d.ts +0 -6
- package/dist/lib/version-duplicates.js +0 -6
- package/dist/lib/version.d.ts +0 -55
- package/dist/lib/version.js +1 -58
- package/dist/lib/view-types.d.ts +0 -48
- package/dist/lib/warn-unpushed.d.ts +0 -27
- package/dist/lib/warn-unpushed.js +1 -45
- package/dist/lib/watchdog/history.d.ts +0 -1
- package/dist/lib/watchdog/history.js +0 -3
- package/dist/lib/watchdog/index.js +0 -2
- package/dist/lib/watchdog/log.d.ts +0 -19
- package/dist/lib/watchdog/log.js +0 -34
- package/dist/lib/watchdog/read.d.ts +0 -27
- package/dist/lib/watchdog/read.js +3 -58
- package/dist/lib/watchdog/rotate.d.ts +0 -139
- package/dist/lib/watchdog/rotate.js +2 -151
- package/dist/lib/watchdog/runner.d.ts +0 -125
- package/dist/lib/watchdog/runner.js +3 -223
- package/dist/lib/watchdog/service.d.ts +0 -1
- package/dist/lib/watchdog/service.js +0 -2
- package/dist/lib/watchdog/watchdog-agent.d.ts +0 -31
- package/dist/lib/watchdog/watchdog-agent.js +0 -27
- package/dist/lib/watchdog/watchdog.d.ts +0 -7
- package/dist/lib/watchdog/watchdog.js +0 -10
- package/dist/lib/watchdog/watchdogTail.js +0 -7
- package/dist/lib/whats-new.d.ts +0 -10
- package/dist/lib/whats-new.js +0 -21
- package/dist/lib/workflows-registry.d.ts +0 -45
- package/dist/lib/workflows-registry.js +0 -60
- package/dist/lib/workflows.d.ts +0 -282
- package/dist/lib/workflows.js +3 -213
- package/dist/lib/worktree/held.d.ts +0 -89
- package/dist/lib/worktree/held.js +1 -103
- package/dist/lib/wrap.d.ts +0 -32
- package/dist/lib/wrap.js +0 -32
- package/dist/lib/yaml-io.d.ts +0 -45
- package/dist/lib/yaml-io.js +0 -47
- package/dist/session-tracker/dist/adapters/claude.js +0 -2
- package/dist/session-tracker/dist/hook.sh +4 -37
- package/dist/session-tracker/dist/index.d.ts +0 -7
- package/dist/session-tracker/dist/index.js +0 -5
- package/dist/session-tracker/dist/install-hook.d.ts +0 -5
- package/dist/session-tracker/dist/install-hook.js +1 -15
- package/dist/session-tracker/dist/prune-state.js +0 -4
- package/dist/session-tracker/dist/reader.js +0 -4
- package/dist/session-tracker/dist/state-file.d.ts +0 -3
- package/dist/session-tracker/dist/state-file.js +3 -8
- package/package.json +3 -4
- package/scripts/postinstall.js +8 -116
- package/dist/lib/session/artifacts.d.ts +0 -14
- package/dist/lib/session/artifacts.js +0 -101
- package/dist/lib/session/bash-command.d.ts +0 -63
- package/dist/lib/session/bash-command.js +0 -490
- package/dist/lib/session/digest.d.ts +0 -66
- package/dist/lib/session/digest.js +0 -328
- package/dist/lib/session/highlights.d.ts +0 -151
- package/dist/lib/session/highlights.js +0 -391
- package/dist/lib/session/insights.d.ts +0 -165
- package/dist/lib/session/insights.js +0 -563
- package/dist/lib/session/linear.d.ts +0 -19
- package/dist/lib/session/linear.js +0 -99
- package/dist/lib/session/parse.d.ts +0 -224
- package/dist/lib/session/parse.js +0 -2408
- package/dist/lib/session/prompt.d.ts +0 -213
- package/dist/lib/session/prompt.js +0 -601
- package/dist/lib/session/render.d.ts +0 -133
- package/dist/lib/session/render.js +0 -1047
- package/dist/lib/session/share-html.d.ts +0 -35
- package/dist/lib/session/share-html.js +0 -319
- package/dist/lib/session/shell-programs.d.ts +0 -33
- package/dist/lib/session/shell-programs.js +0 -380
- package/dist/lib/session/state.d.ts +0 -269
- package/dist/lib/session/state.js +0 -777
- package/dist/lib/session/stream-render.d.ts +0 -4
- package/dist/lib/session/stream-render.js +0 -131
- package/dist/lib/session/tail.d.ts +0 -88
- package/dist/lib/session/tail.js +0 -294
- package/dist/lib/session/team-filter.d.ts +0 -129
- package/dist/lib/session/team-filter.js +0 -269
- package/dist/lib/session/timeline.d.ts +0 -172
- package/dist/lib/session/timeline.js +0 -636
- package/dist/lib/session/tool-calls.d.ts +0 -132
- package/dist/lib/session/tool-calls.js +0 -674
- package/dist/lib/session/trajectory-compare.d.ts +0 -48
- package/dist/lib/session/trajectory-compare.js +0 -116
- package/dist/lib/session/trajectory-html.d.ts +0 -19
- package/dist/lib/session/trajectory-html.js +0 -771
- package/dist/lib/session/trajectory-lineage.d.ts +0 -93
- package/dist/lib/session/trajectory-lineage.js +0 -195
- package/dist/lib/session/trajectory-text.d.ts +0 -38
- package/dist/lib/session/trajectory-text.js +0 -284
- package/dist/lib/session/trajectory.d.ts +0 -145
- package/dist/lib/session/trajectory.js +0 -394
- package/dist/lib/session/types.d.ts +0 -627
- package/dist/lib/session/types.js +0 -43
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/** One-shot idempotent migrations. Each is guarded by an existence check so re-running is safe. */
|
|
2
1
|
import * as fs from 'fs';
|
|
3
2
|
import * as path from 'path';
|
|
4
3
|
import * as os from 'os';
|
|
@@ -17,17 +16,11 @@ import { enabledRoutineNames, replaceEnabledRoutines } from '../routine-activati
|
|
|
17
16
|
import { evaluateActivationReadiness } from '../routine-readiness.js';
|
|
18
17
|
import { migrateDeviceConfigStores } from '../devices/config-migration.js';
|
|
19
18
|
import { detrackViaGitExclude } from '../project-resources.js';
|
|
20
|
-
// Migrations operate on raw YAML so they never take the meta lock or prime the
|
|
21
|
-
// meta cache mid-migration.
|
|
22
19
|
import { META_HEADER as DEVICE_META_HEADER } from '../state.js';
|
|
23
|
-
/** The pre-device-scope central browser profile name this one-shot migration
|
|
24
|
-
* folds into the device doc. Inlined (the in-repo browser engine that defined it
|
|
25
|
-
* was removed with PHNX-4101); the legacy on-disk name is unchanged. */
|
|
26
20
|
const LEGACY_DEFAULT_BROWSER_PROFILE_NAME = 'default';
|
|
27
21
|
import { COMPILED_HEADER_PROJECT } from '../rules/compile.js';
|
|
28
22
|
const HOME = process.env.HOME ?? os.homedir();
|
|
29
23
|
const USER_DIR = path.join(HOME, '.agents');
|
|
30
|
-
/** Canonical system-repo location (post-fold). */
|
|
31
24
|
const SYSTEM_DIR = path.join(USER_DIR, '.system');
|
|
32
25
|
const HISTORY_DIR = path.join(USER_DIR, '.history');
|
|
33
26
|
const CACHE_DIR = path.join(USER_DIR, '.cache');
|
|
@@ -37,25 +30,21 @@ function isTrackedInGitRepo(repoDir, relPath) {
|
|
|
37
30
|
return true;
|
|
38
31
|
}
|
|
39
32
|
catch {
|
|
40
|
-
// Not a git repo, or the file is untracked — either way, not tracked.
|
|
41
33
|
return false;
|
|
42
34
|
}
|
|
43
35
|
}
|
|
44
|
-
/** Migrate a legacy single-repo agents.yaml into ~/.agents/agents.yaml. Leaves the tracked system-mirror copy alone to avoid dirtying the npm-shipped defaults. */
|
|
45
36
|
export function migrateAgentsYaml(systemDir = SYSTEM_DIR, userDir = USER_DIR) {
|
|
46
37
|
const src = path.join(systemDir, 'agents.yaml');
|
|
47
38
|
const dest = path.join(userDir, 'agents.yaml');
|
|
48
39
|
if (!fs.existsSync(src))
|
|
49
40
|
return;
|
|
50
|
-
// Never move the tracked system-mirror copy; doing so would dirty the npm-shipped defaults.
|
|
51
41
|
if (isTrackedInGitRepo(systemDir, 'agents.yaml'))
|
|
52
42
|
return;
|
|
53
43
|
if (fs.existsSync(dest)) {
|
|
54
|
-
// User copy is authoritative — drop the untracked stale system leftover.
|
|
55
44
|
try {
|
|
56
45
|
fs.unlinkSync(src);
|
|
57
46
|
}
|
|
58
|
-
catch {
|
|
47
|
+
catch { }
|
|
59
48
|
return;
|
|
60
49
|
}
|
|
61
50
|
try {
|
|
@@ -63,7 +52,7 @@ export function migrateAgentsYaml(systemDir = SYSTEM_DIR, userDir = USER_DIR) {
|
|
|
63
52
|
fs.renameSync(src, dest);
|
|
64
53
|
console.error('Migrated agents.yaml to ~/.agents/');
|
|
65
54
|
}
|
|
66
|
-
catch {
|
|
55
|
+
catch { }
|
|
67
56
|
}
|
|
68
57
|
function deleteSystemPromptsJson() {
|
|
69
58
|
const f = path.join(SYSTEM_DIR, 'prompts.json');
|
|
@@ -72,25 +61,15 @@ function deleteSystemPromptsJson() {
|
|
|
72
61
|
try {
|
|
73
62
|
fs.unlinkSync(f);
|
|
74
63
|
}
|
|
75
|
-
catch {
|
|
64
|
+
catch { }
|
|
76
65
|
}
|
|
77
|
-
/**
|
|
78
|
-
* Stop tracking the user repo's CHANGELOG.md. It duplicates the npm-shipped
|
|
79
|
-
* `.system/CHANGELOG.md` (read the canonical copy from there), and as a tracked
|
|
80
|
-
* file that upstream never carries it can only ever show as `M`/`??`
|
|
81
|
-
* — dirtying the tree and, when a peer's publish commit arrives, tripping the
|
|
82
|
-
* dirty-tree pull guard. De-track it into `.git/info/exclude` (per-clone,
|
|
83
|
-
* uncommitted; never `.gitignore`, which would re-introduce the same failure).
|
|
84
|
-
* Idempotent: a no-op once the path is untracked and excluded.
|
|
85
|
-
*/
|
|
86
66
|
export function detrackUserChangelog(userDir = USER_DIR) {
|
|
87
67
|
if (!fs.existsSync(path.join(userDir, '.git')))
|
|
88
|
-
return;
|
|
68
|
+
return;
|
|
89
69
|
const untracked = detrackViaGitExclude(userDir, 'CHANGELOG.md');
|
|
90
70
|
if (untracked)
|
|
91
71
|
console.error('Stopped tracking ~/.agents/CHANGELOG.md (duplicates .system/CHANGELOG.md)');
|
|
92
72
|
}
|
|
93
|
-
/** Delete the legacy ~/.agents-system/config.json (dead teams agent registry). */
|
|
94
73
|
function migrateSystemConfigJson() {
|
|
95
74
|
const src = path.join(SYSTEM_DIR, 'config.json');
|
|
96
75
|
if (!fs.existsSync(src))
|
|
@@ -98,9 +77,8 @@ function migrateSystemConfigJson() {
|
|
|
98
77
|
try {
|
|
99
78
|
fs.unlinkSync(src);
|
|
100
79
|
}
|
|
101
|
-
catch {
|
|
80
|
+
catch { }
|
|
102
81
|
}
|
|
103
|
-
/** Move promptcuts.yaml from each repo root into hooks/. */
|
|
104
82
|
function migratePromptcutsIntoHooks() {
|
|
105
83
|
for (const root of [SYSTEM_DIR, USER_DIR]) {
|
|
106
84
|
const src = path.join(root, 'promptcuts.yaml');
|
|
@@ -111,10 +89,9 @@ function migratePromptcutsIntoHooks() {
|
|
|
111
89
|
fs.mkdirSync(path.dirname(dest), { recursive: true, mode: 0o700 });
|
|
112
90
|
fs.renameSync(src, dest);
|
|
113
91
|
}
|
|
114
|
-
catch {
|
|
92
|
+
catch { }
|
|
115
93
|
}
|
|
116
94
|
}
|
|
117
|
-
/** Move installed versions from the legacy ~/.agents-system/versions/ tree into ~/.agents/versions/. Leaves collisions in place for manual reconciliation. */
|
|
118
95
|
function migrateSystemVersionsToUser() {
|
|
119
96
|
const sysVersions = path.join(SYSTEM_DIR, 'versions');
|
|
120
97
|
const userVersions = path.join(USER_DIR, 'versions');
|
|
@@ -137,7 +114,7 @@ function migrateSystemVersionsToUser() {
|
|
|
137
114
|
try {
|
|
138
115
|
fs.mkdirSync(dstAgentDir, { recursive: true, mode: 0o700 });
|
|
139
116
|
}
|
|
140
|
-
catch {
|
|
117
|
+
catch { }
|
|
141
118
|
let verEntries;
|
|
142
119
|
try {
|
|
143
120
|
verEntries = fs.readdirSync(srcAgentDir, { withFileTypes: true });
|
|
@@ -158,19 +135,19 @@ function migrateSystemVersionsToUser() {
|
|
|
158
135
|
fs.renameSync(src, dst);
|
|
159
136
|
movedCount++;
|
|
160
137
|
}
|
|
161
|
-
catch {
|
|
138
|
+
catch { }
|
|
162
139
|
}
|
|
163
140
|
try {
|
|
164
141
|
if (fs.readdirSync(srcAgentDir).length === 0)
|
|
165
142
|
fs.rmdirSync(srcAgentDir);
|
|
166
143
|
}
|
|
167
|
-
catch {
|
|
144
|
+
catch { }
|
|
168
145
|
}
|
|
169
146
|
try {
|
|
170
147
|
if (fs.readdirSync(sysVersions).length === 0)
|
|
171
148
|
fs.rmdirSync(sysVersions);
|
|
172
149
|
}
|
|
173
|
-
catch {
|
|
150
|
+
catch { }
|
|
174
151
|
if (movedCount > 0) {
|
|
175
152
|
console.error(`Migrated ${movedCount} version dir${movedCount === 1 ? '' : 's'} from ~/.agents-system/versions/ to ~/.agents/versions/`);
|
|
176
153
|
}
|
|
@@ -178,7 +155,6 @@ function migrateSystemVersionsToUser() {
|
|
|
178
155
|
console.error(`Skipped ${skippedCount} version dir${skippedCount === 1 ? '' : 's'} already present in ~/.agents/versions/ (kept legacy copy at ~/.agents-system/versions/)`);
|
|
179
156
|
}
|
|
180
157
|
}
|
|
181
|
-
/** Move ~/.agents/runs/ into ~/.agents/routines/runs/. */
|
|
182
158
|
function migrateRunsIntoRoutines() {
|
|
183
159
|
const src = path.join(USER_DIR, 'runs');
|
|
184
160
|
const dest = path.join(USER_DIR, 'routines', 'runs');
|
|
@@ -188,9 +164,8 @@ function migrateRunsIntoRoutines() {
|
|
|
188
164
|
fs.mkdirSync(path.dirname(dest), { recursive: true, mode: 0o700 });
|
|
189
165
|
fs.renameSync(src, dest);
|
|
190
166
|
}
|
|
191
|
-
catch {
|
|
167
|
+
catch { }
|
|
192
168
|
}
|
|
193
|
-
/** Move ~/.agents/trash/ to ~/.agents/.trash/. */
|
|
194
169
|
function migrateTrashToHidden() {
|
|
195
170
|
const src = path.join(USER_DIR, 'trash');
|
|
196
171
|
const dest = path.join(USER_DIR, '.trash');
|
|
@@ -199,9 +174,8 @@ function migrateTrashToHidden() {
|
|
|
199
174
|
try {
|
|
200
175
|
fs.renameSync(src, dest);
|
|
201
176
|
}
|
|
202
|
-
catch {
|
|
177
|
+
catch { }
|
|
203
178
|
}
|
|
204
|
-
/** Move ~/.agents/backups/ to ~/.agents/.backups/. */
|
|
205
179
|
function migrateBackupsToHidden() {
|
|
206
180
|
const src = path.join(USER_DIR, 'backups');
|
|
207
181
|
const dest = path.join(USER_DIR, '.backups');
|
|
@@ -210,9 +184,8 @@ function migrateBackupsToHidden() {
|
|
|
210
184
|
try {
|
|
211
185
|
fs.renameSync(src, dest);
|
|
212
186
|
}
|
|
213
|
-
catch {
|
|
187
|
+
catch { }
|
|
214
188
|
}
|
|
215
|
-
/** Fold ~/.agents/hooks.yaml into ~/.agents/agents.yaml under `hooks:`, dropping the standalone file. agents.yaml wins on collision. */
|
|
216
189
|
function foldUserHooksYamlIntoAgentsYaml() {
|
|
217
190
|
const hooksFile = path.join(USER_DIR, 'hooks.yaml');
|
|
218
191
|
if (!fs.existsSync(hooksFile))
|
|
@@ -253,9 +226,8 @@ function foldUserHooksYamlIntoAgentsYaml() {
|
|
|
253
226
|
fs.unlinkSync(hooksFile);
|
|
254
227
|
console.error('Folded ~/.agents/hooks.yaml into ~/.agents/agents.yaml (hooks: section)');
|
|
255
228
|
}
|
|
256
|
-
catch {
|
|
229
|
+
catch { }
|
|
257
230
|
}
|
|
258
|
-
/** Fold the legacy global browser/sessions/<task>/ tree into the per-profile browser/<profile>/sessions/<task>/ layout. Unclaimed tasks move under `_legacy`. */
|
|
259
231
|
export function foldBrowserSessionsIntoProfiles(browserDir = path.join(CACHE_DIR, 'browser')) {
|
|
260
232
|
const legacySessionsDir = path.join(browserDir, 'sessions');
|
|
261
233
|
let taskDirs;
|
|
@@ -263,14 +235,14 @@ export function foldBrowserSessionsIntoProfiles(browserDir = path.join(CACHE_DIR
|
|
|
263
235
|
taskDirs = fs.readdirSync(legacySessionsDir, { withFileTypes: true });
|
|
264
236
|
}
|
|
265
237
|
catch {
|
|
266
|
-
return;
|
|
238
|
+
return;
|
|
267
239
|
}
|
|
268
240
|
const taskOwner = new Map();
|
|
269
241
|
let profileDirs = [];
|
|
270
242
|
try {
|
|
271
243
|
profileDirs = fs.readdirSync(browserDir, { withFileTypes: true });
|
|
272
244
|
}
|
|
273
|
-
catch {
|
|
245
|
+
catch { }
|
|
274
246
|
for (const p of profileDirs) {
|
|
275
247
|
if (!p.isDirectory() || p.name === 'sessions' || p.name === '_legacy')
|
|
276
248
|
continue;
|
|
@@ -281,20 +253,16 @@ export function foldBrowserSessionsIntoProfiles(browserDir = path.join(CACHE_DIR
|
|
|
281
253
|
taskOwner.set(taskName, p.name);
|
|
282
254
|
}
|
|
283
255
|
}
|
|
284
|
-
catch {
|
|
256
|
+
catch { }
|
|
285
257
|
}
|
|
286
258
|
for (const taskEntry of taskDirs) {
|
|
287
259
|
if (!taskEntry.isDirectory())
|
|
288
260
|
continue;
|
|
289
261
|
const owner = taskOwner.get(taskEntry.name) ?? '_legacy';
|
|
290
|
-
// A capture dir can hold a nested recordings/ subdir and may collide with a
|
|
291
|
-
// dest that already has newer captures — moveDirOnce merges (skip-existing),
|
|
292
|
-
// moveFileOnce would EISDIR on unlink and silently strand the captures.
|
|
293
262
|
moveDirOnce(path.join(legacySessionsDir, taskEntry.name), path.join(browserDir, owner, 'sessions', taskEntry.name));
|
|
294
263
|
}
|
|
295
264
|
rmEmptyDirTree(legacySessionsDir);
|
|
296
265
|
}
|
|
297
|
-
/** Fold ~/.agents/browser/profiles/*.yaml into ~/.agents/agents.yaml under `browser:`. agents.yaml wins on collision. */
|
|
298
266
|
function foldBrowserProfilesIntoAgentsYaml() {
|
|
299
267
|
const profilesDir = path.join(USER_DIR, 'browser', 'profiles');
|
|
300
268
|
if (!fs.existsSync(profilesDir))
|
|
@@ -319,7 +287,7 @@ function foldBrowserProfilesIntoAgentsYaml() {
|
|
|
319
287
|
const { name: _, ...config } = parsed;
|
|
320
288
|
profiles[name] = config;
|
|
321
289
|
}
|
|
322
|
-
catch {
|
|
290
|
+
catch { }
|
|
323
291
|
}
|
|
324
292
|
if (Object.keys(profiles).length === 0)
|
|
325
293
|
return;
|
|
@@ -351,24 +319,23 @@ function foldBrowserProfilesIntoAgentsYaml() {
|
|
|
351
319
|
try {
|
|
352
320
|
fs.unlinkSync(path.join(profilesDir, file));
|
|
353
321
|
}
|
|
354
|
-
catch {
|
|
322
|
+
catch { }
|
|
355
323
|
}
|
|
356
324
|
try {
|
|
357
325
|
fs.rmdirSync(profilesDir);
|
|
358
326
|
}
|
|
359
|
-
catch {
|
|
327
|
+
catch { }
|
|
360
328
|
try {
|
|
361
329
|
const browserDir = path.join(USER_DIR, 'browser');
|
|
362
330
|
if (fs.existsSync(browserDir) && fs.readdirSync(browserDir).length === 0) {
|
|
363
331
|
fs.rmdirSync(browserDir);
|
|
364
332
|
}
|
|
365
333
|
}
|
|
366
|
-
catch {
|
|
334
|
+
catch { }
|
|
367
335
|
console.error('Folded ~/.agents/browser/profiles/ into ~/.agents/agents.yaml (browser: section)');
|
|
368
336
|
}
|
|
369
|
-
catch {
|
|
337
|
+
catch { }
|
|
370
338
|
}
|
|
371
|
-
/** Delete the legacy ~/.agents/linear.json plaintext credential store. */
|
|
372
339
|
function deleteUserLinearJson() {
|
|
373
340
|
const f = path.join(USER_DIR, 'linear.json');
|
|
374
341
|
if (!fs.existsSync(f))
|
|
@@ -376,9 +343,8 @@ function deleteUserLinearJson() {
|
|
|
376
343
|
try {
|
|
377
344
|
fs.unlinkSync(f);
|
|
378
345
|
}
|
|
379
|
-
catch {
|
|
346
|
+
catch { }
|
|
380
347
|
}
|
|
381
|
-
/** Delete the dead ~/.agents/prompts.json file. */
|
|
382
348
|
function deleteUserPromptsJson() {
|
|
383
349
|
const f = path.join(USER_DIR, 'prompts.json');
|
|
384
350
|
if (!fs.existsSync(f))
|
|
@@ -386,9 +352,8 @@ function deleteUserPromptsJson() {
|
|
|
386
352
|
try {
|
|
387
353
|
fs.unlinkSync(f);
|
|
388
354
|
}
|
|
389
|
-
catch {
|
|
355
|
+
catch { }
|
|
390
356
|
}
|
|
391
|
-
/** Delete the dead ~/.agents/teams/config.json file. */
|
|
392
357
|
function deleteTeamsConfigJson() {
|
|
393
358
|
const f = path.join(USER_DIR, 'teams', 'config.json');
|
|
394
359
|
if (!fs.existsSync(f))
|
|
@@ -396,15 +361,13 @@ function deleteTeamsConfigJson() {
|
|
|
396
361
|
try {
|
|
397
362
|
fs.unlinkSync(f);
|
|
398
363
|
}
|
|
399
|
-
catch {
|
|
364
|
+
catch { }
|
|
400
365
|
}
|
|
401
|
-
/** Move ~/.agents/teams/registry.json (per-machine runtime state) into ~/.agents/.history/teams/. */
|
|
402
366
|
function moveTeamsRegistryToHistory() {
|
|
403
367
|
const src = path.join(USER_DIR, 'teams', 'registry.json');
|
|
404
368
|
const dest = path.join(HISTORY_DIR, 'teams', 'registry.json');
|
|
405
369
|
moveFileOnce(src, dest);
|
|
406
370
|
}
|
|
407
|
-
/** Delete the legacy ~/.agents/config.json teams config file. */
|
|
408
371
|
function cleanupUserConfigJson() {
|
|
409
372
|
const legacy = path.join(USER_DIR, 'config.json');
|
|
410
373
|
if (!fs.existsSync(legacy))
|
|
@@ -412,9 +375,8 @@ function cleanupUserConfigJson() {
|
|
|
412
375
|
try {
|
|
413
376
|
fs.unlinkSync(legacy);
|
|
414
377
|
}
|
|
415
|
-
catch {
|
|
378
|
+
catch { }
|
|
416
379
|
}
|
|
417
|
-
/** Remove an empty ~/.agents/runs/ directory left over after migrateRunsIntoRoutines(). */
|
|
418
380
|
function cleanupEmptyTopLevelRuns() {
|
|
419
381
|
const dir = path.join(USER_DIR, 'runs');
|
|
420
382
|
if (!fs.existsSync(dir))
|
|
@@ -423,9 +385,8 @@ function cleanupEmptyTopLevelRuns() {
|
|
|
423
385
|
if (fs.readdirSync(dir).length === 0)
|
|
424
386
|
fs.rmdirSync(dir);
|
|
425
387
|
}
|
|
426
|
-
catch {
|
|
388
|
+
catch { }
|
|
427
389
|
}
|
|
428
|
-
/** Move ~/.agents-system/aliases.json into ~/.agents/aliases.json. */
|
|
429
390
|
function migrateAliasesToUser() {
|
|
430
391
|
const src = path.join(SYSTEM_DIR, 'aliases.json');
|
|
431
392
|
const dest = path.join(USER_DIR, 'aliases.json');
|
|
@@ -435,27 +396,8 @@ function migrateAliasesToUser() {
|
|
|
435
396
|
fs.mkdirSync(USER_DIR, { recursive: true, mode: 0o700 });
|
|
436
397
|
fs.renameSync(src, dest);
|
|
437
398
|
}
|
|
438
|
-
catch {
|
|
399
|
+
catch { }
|
|
439
400
|
}
|
|
440
|
-
/**
|
|
441
|
-
* For overlapping versions that exist in BOTH ~/.agents-system/versions/ and
|
|
442
|
-
* ~/.agents/versions/, merge legacy operational state (history, sessions,
|
|
443
|
-
* settings) into the user copy without overwriting any files synced by
|
|
444
|
-
* agents-cli (skills, commands, hooks, memory). Then drop the legacy copy.
|
|
445
|
-
*
|
|
446
|
-
* Why: when both paths exist, the inverted-prior migrator left them split.
|
|
447
|
-
* Agent CLIs read from ~/.<agent> (a symlink that historically targeted
|
|
448
|
-
* the system path), while sync writes to the user path. Same skill ends up
|
|
449
|
-
* in both → duplicate entries in the skills picker, stale state, broken
|
|
450
|
-
* resource resolution.
|
|
451
|
-
*
|
|
452
|
-
* Strategy: copy legacy → user with "skip if exists". Sync-managed dirs
|
|
453
|
-
* (which live in user already, freshly written) stay untouched. Anything
|
|
454
|
-
* the agent CLI created on its own (history.jsonl, sessions/, settings.json,
|
|
455
|
-
* file-history/, paste-cache/, …) lands in user where it belongs. The
|
|
456
|
-
* legacy version-home is then renamed into ~/.agents/.trash/versions/ so
|
|
457
|
-
* it's recoverable.
|
|
458
|
-
*/
|
|
459
401
|
function mergeOverlappingVersionHomes() {
|
|
460
402
|
const sysVersions = path.join(SYSTEM_DIR, 'versions');
|
|
461
403
|
const userVersions = path.join(USER_DIR, 'versions');
|
|
@@ -496,24 +438,23 @@ function mergeOverlappingVersionHomes() {
|
|
|
496
438
|
fs.renameSync(path.join(sysAgentDir, ver.name), path.join(trashRoot, `legacy-${stamp}`));
|
|
497
439
|
mergedCount++;
|
|
498
440
|
}
|
|
499
|
-
catch {
|
|
441
|
+
catch { }
|
|
500
442
|
}
|
|
501
443
|
try {
|
|
502
444
|
if (fs.readdirSync(sysAgentDir).length === 0)
|
|
503
445
|
fs.rmdirSync(sysAgentDir);
|
|
504
446
|
}
|
|
505
|
-
catch {
|
|
447
|
+
catch { }
|
|
506
448
|
}
|
|
507
449
|
try {
|
|
508
450
|
if (fs.readdirSync(sysVersions).length === 0)
|
|
509
451
|
fs.rmdirSync(sysVersions);
|
|
510
452
|
}
|
|
511
|
-
catch {
|
|
453
|
+
catch { }
|
|
512
454
|
if (mergedCount > 0) {
|
|
513
455
|
console.error(`Merged ${mergedCount} overlapping version home${mergedCount === 1 ? '' : 's'} from legacy ~/.agents-system/versions/ into ~/.agents/versions/ (legacy moved to ~/.agents/.trash/versions/)`);
|
|
514
456
|
}
|
|
515
457
|
}
|
|
516
|
-
/** Rename permissions/sets/ to permissions/presets/ in both user and system repos. */
|
|
517
458
|
function migratePermissionSetsToPresets() {
|
|
518
459
|
for (const root of [USER_DIR, SYSTEM_DIR]) {
|
|
519
460
|
const src = path.join(root, 'permissions', 'sets');
|
|
@@ -525,15 +466,10 @@ function migratePermissionSetsToPresets() {
|
|
|
525
466
|
const label = root === USER_DIR ? '~/.agents' : '~/.agents-system';
|
|
526
467
|
console.error(`Migrated ${label}/permissions/sets/ to ${label}/permissions/presets/`);
|
|
527
468
|
}
|
|
528
|
-
catch {
|
|
469
|
+
catch { }
|
|
529
470
|
}
|
|
530
471
|
}
|
|
531
|
-
/** Rewrite per-agent config symlinks to point at the user-side version home after migration. Leaves real directories alone (switching is owned by `agents use`). */
|
|
532
472
|
function repairAgentConfigSymlinks() {
|
|
533
|
-
// Version pins live in the machine-local pins JSON (~/.agents/.history/
|
|
534
|
-
// devices/pins-<machine>.json); the tracked device doc and central
|
|
535
|
-
// agents.yaml may still carry them mid-transition. Read pins first
|
|
536
|
-
// (authoritative), then the legacy locations, first-seen-agent wins.
|
|
537
473
|
const defaults = [];
|
|
538
474
|
const seen = new Set();
|
|
539
475
|
const collectJsonPins = (file) => {
|
|
@@ -588,7 +524,7 @@ function repairAgentConfigSymlinks() {
|
|
|
588
524
|
try {
|
|
589
525
|
stat = fs.lstatSync(symlinkPath);
|
|
590
526
|
}
|
|
591
|
-
catch {
|
|
527
|
+
catch { }
|
|
592
528
|
if (stat && stat.isSymbolicLink()) {
|
|
593
529
|
let current;
|
|
594
530
|
try {
|
|
@@ -599,42 +535,39 @@ function repairAgentConfigSymlinks() {
|
|
|
599
535
|
}
|
|
600
536
|
const resolved = path.resolve(path.dirname(symlinkPath), current);
|
|
601
537
|
if (resolved === path.resolve(userTarget))
|
|
602
|
-
continue;
|
|
538
|
+
continue;
|
|
603
539
|
try {
|
|
604
540
|
fs.unlinkSync(symlinkPath);
|
|
605
541
|
createLink(userTarget, symlinkPath);
|
|
606
542
|
repaired++;
|
|
607
543
|
}
|
|
608
|
-
catch {
|
|
544
|
+
catch { }
|
|
609
545
|
}
|
|
610
546
|
else if (!stat) {
|
|
611
547
|
try {
|
|
612
548
|
createLink(userTarget, symlinkPath);
|
|
613
549
|
repaired++;
|
|
614
550
|
}
|
|
615
|
-
catch {
|
|
551
|
+
catch { }
|
|
616
552
|
}
|
|
617
553
|
}
|
|
618
554
|
if (repaired > 0) {
|
|
619
555
|
console.error(`Repaired ${repaired} agent config symlink${repaired === 1 ? '' : 's'} to point at ~/.agents/versions/`);
|
|
620
556
|
}
|
|
621
557
|
}
|
|
622
|
-
/** Repair node_modules/.bin/<cli> symlinks that resolve back into our own shims dir (infinite exec-loop fix). */
|
|
623
558
|
export function repairSelfReferentialBinShims(versionsRoot = path.join(HISTORY_DIR, 'versions'), shimsDir = path.resolve(CACHE_DIR, 'shims'), historyDir = path.dirname(versionsRoot)) {
|
|
624
|
-
// realpath the shims dir so the prefix check survives symlinked paths (e.g. macOS /tmp -> /private/tmp).
|
|
625
559
|
shimsDir = path.resolve(shimsDir);
|
|
626
560
|
try {
|
|
627
561
|
shimsDir = fs.realpathSync(shimsDir);
|
|
628
562
|
}
|
|
629
563
|
catch {
|
|
630
|
-
/* shims dir absent — leave the resolved path; nothing will match it */
|
|
631
564
|
}
|
|
632
565
|
let agents;
|
|
633
566
|
try {
|
|
634
567
|
agents = fs.readdirSync(versionsRoot);
|
|
635
568
|
}
|
|
636
569
|
catch {
|
|
637
|
-
return;
|
|
570
|
+
return;
|
|
638
571
|
}
|
|
639
572
|
let repaired = 0;
|
|
640
573
|
for (const agent of agents) {
|
|
@@ -653,7 +586,7 @@ export function repairSelfReferentialBinShims(versionsRoot = path.join(HISTORY_D
|
|
|
653
586
|
stat = fs.lstatSync(binLink);
|
|
654
587
|
}
|
|
655
588
|
catch {
|
|
656
|
-
continue;
|
|
589
|
+
continue;
|
|
657
590
|
}
|
|
658
591
|
if (!stat.isSymbolicLink())
|
|
659
592
|
continue;
|
|
@@ -662,38 +595,29 @@ export function repairSelfReferentialBinShims(versionsRoot = path.join(HISTORY_D
|
|
|
662
595
|
real = fs.realpathSync(binLink);
|
|
663
596
|
}
|
|
664
597
|
catch {
|
|
665
|
-
// Dangling symlink — if it was aimed at the shims dir it's the loop
|
|
666
|
-
// residue; drop it either way so getBinaryPath reports honestly.
|
|
667
598
|
try {
|
|
668
599
|
fs.unlinkSync(binLink);
|
|
669
600
|
repaired++;
|
|
670
601
|
}
|
|
671
|
-
catch {
|
|
602
|
+
catch { }
|
|
672
603
|
continue;
|
|
673
604
|
}
|
|
674
605
|
if (!path.resolve(real).startsWith(shimsDir + path.sep))
|
|
675
|
-
continue;
|
|
676
|
-
// Self-referential: the link resolves back into our own shims dir.
|
|
677
|
-
// findInPath does a pure-Node PATH scan (no subprocess) and already
|
|
678
|
-
// skips our shims dir, so it returns the genuine install if one exists.
|
|
606
|
+
continue;
|
|
679
607
|
const realBinary = findInPath(cli, { shimsDir, historyDir });
|
|
680
608
|
try {
|
|
681
609
|
fs.unlinkSync(binLink);
|
|
682
|
-
// createLink: a real symlink where the OS allows it (POSIX, and Windows
|
|
683
|
-
// with the symlink privilege), copy-fallback otherwise — so the repair
|
|
684
|
-
// lands a working binary on Windows runners without the symlink right.
|
|
685
610
|
if (realBinary)
|
|
686
611
|
createLink(realBinary, binLink);
|
|
687
612
|
repaired++;
|
|
688
613
|
}
|
|
689
|
-
catch {
|
|
614
|
+
catch { }
|
|
690
615
|
}
|
|
691
616
|
}
|
|
692
617
|
if (repaired > 0) {
|
|
693
618
|
console.error(`Repaired ${repaired} self-referential agent binary symlink${repaired === 1 ? '' : 's'} (infinite exec-loop fix).`);
|
|
694
619
|
}
|
|
695
620
|
}
|
|
696
|
-
/** Move `src` to `dest`; when `dest` exists, merge missing entries then remove `src`. Idempotent. */
|
|
697
621
|
function moveDirOnce(src, dest) {
|
|
698
622
|
if (!fs.existsSync(src))
|
|
699
623
|
return;
|
|
@@ -704,16 +628,14 @@ function moveDirOnce(src, dest) {
|
|
|
704
628
|
return;
|
|
705
629
|
}
|
|
706
630
|
catch {
|
|
707
|
-
/* fall through to copy + remove */
|
|
708
631
|
}
|
|
709
632
|
}
|
|
710
633
|
try {
|
|
711
634
|
copyDirSkipExisting(src, dest);
|
|
712
635
|
fs.rmSync(src, { recursive: true, force: true });
|
|
713
636
|
}
|
|
714
|
-
catch {
|
|
637
|
+
catch { }
|
|
715
638
|
}
|
|
716
|
-
/** Move `src` to `dest`; when `dest` exists, delete `src` (dest is canonical). Idempotent. */
|
|
717
639
|
function moveFileOnce(src, dest) {
|
|
718
640
|
if (!fs.existsSync(src))
|
|
719
641
|
return;
|
|
@@ -721,7 +643,7 @@ function moveFileOnce(src, dest) {
|
|
|
721
643
|
try {
|
|
722
644
|
fs.unlinkSync(src);
|
|
723
645
|
}
|
|
724
|
-
catch {
|
|
646
|
+
catch { }
|
|
725
647
|
return;
|
|
726
648
|
}
|
|
727
649
|
try {
|
|
@@ -733,7 +655,7 @@ function moveFileOnce(src, dest) {
|
|
|
733
655
|
fs.copyFileSync(src, dest);
|
|
734
656
|
fs.unlinkSync(src);
|
|
735
657
|
}
|
|
736
|
-
catch {
|
|
658
|
+
catch { }
|
|
737
659
|
}
|
|
738
660
|
}
|
|
739
661
|
function rmEmptyDirTree(dir) {
|
|
@@ -748,69 +670,35 @@ function rmEmptyDirTree(dir) {
|
|
|
748
670
|
if (stat.isDirectory())
|
|
749
671
|
rmEmptyDirTree(child);
|
|
750
672
|
}
|
|
751
|
-
catch {
|
|
673
|
+
catch { }
|
|
752
674
|
}
|
|
753
675
|
if (fs.readdirSync(dir).length === 0)
|
|
754
676
|
fs.rmdirSync(dir);
|
|
755
677
|
}
|
|
756
|
-
catch {
|
|
678
|
+
catch { }
|
|
757
679
|
}
|
|
758
|
-
/**
|
|
759
|
-
* Move durable runtime data into ~/.agents/.history/.
|
|
760
|
-
*
|
|
761
|
-
* Sources cleared:
|
|
762
|
-
* ~/.agents/sessions/ -> ~/.agents/.history/sessions/
|
|
763
|
-
* ~/.agents/versions/ -> ~/.agents/.history/versions/
|
|
764
|
-
* ~/.agents/.trash/ -> ~/.agents/.history/trash/
|
|
765
|
-
* ~/.agents/.backups/ -> ~/.agents/.history/backups/
|
|
766
|
-
* ~/.agents/routines/runs/ -> ~/.agents/.history/runs/
|
|
767
|
-
* ~/.agents/teams/agents/ -> ~/.agents/.history/teams/agents/
|
|
768
|
-
*
|
|
769
|
-
* Idempotent — skips entries whose destination already exists.
|
|
770
|
-
*/
|
|
771
680
|
function migrateRuntimeToHistory() {
|
|
772
681
|
moveDirOnce(path.join(USER_DIR, 'sessions'), path.join(HISTORY_DIR, 'sessions'));
|
|
773
682
|
moveDirOnce(path.join(USER_DIR, 'versions'), path.join(HISTORY_DIR, 'versions'));
|
|
774
|
-
// Some installs left both `.trash/` (current) and `trash/` (legacy lowercase).
|
|
775
|
-
// Move whichever exist into the history bucket.
|
|
776
683
|
moveDirOnce(path.join(USER_DIR, '.trash'), path.join(HISTORY_DIR, 'trash'));
|
|
777
684
|
moveDirOnce(path.join(USER_DIR, 'trash'), path.join(HISTORY_DIR, 'trash'));
|
|
778
685
|
moveDirOnce(path.join(USER_DIR, '.backups'), path.join(HISTORY_DIR, 'backups'));
|
|
779
686
|
moveDirOnce(path.join(USER_DIR, 'routines', 'runs'), path.join(HISTORY_DIR, 'runs'));
|
|
780
687
|
moveDirOnce(path.join(USER_DIR, 'teams', 'agents'), path.join(HISTORY_DIR, 'teams', 'agents'));
|
|
781
|
-
// Drop any empty leftover skeletons created mid-rename (e.g. `versions/<agent>/<v>/home/`
|
|
782
|
-
// recreated by a concurrent process). The real data is already under .history/.
|
|
783
688
|
rmEmptyDirTree(path.join(USER_DIR, 'versions'));
|
|
784
689
|
rmEmptyDirTree(path.join(USER_DIR, 'sessions'));
|
|
785
|
-
// Old empty zero-byte sessions.db at user root is obsolete once the new db lives at
|
|
786
|
-
// .history/sessions/sessions.db.
|
|
787
690
|
const oldSessionsDb = path.join(USER_DIR, 'sessions.db');
|
|
788
691
|
if (fs.existsSync(oldSessionsDb)) {
|
|
789
692
|
try {
|
|
790
693
|
if (fs.statSync(oldSessionsDb).size === 0)
|
|
791
694
|
fs.unlinkSync(oldSessionsDb);
|
|
792
695
|
}
|
|
793
|
-
catch {
|
|
696
|
+
catch { }
|
|
794
697
|
}
|
|
795
698
|
}
|
|
796
|
-
/** Rename the session marker store after the product vocabulary changed from
|
|
797
|
-
* favorite to bookmark. The destination wins if a newer CLI already wrote it. */
|
|
798
699
|
function migrateLegacySessionMarkersToBookmarks() {
|
|
799
700
|
moveFileOnce(path.join(HISTORY_DIR, 'favorites.json'), path.join(HISTORY_DIR, 'bookmarks.json'));
|
|
800
701
|
}
|
|
801
|
-
/**
|
|
802
|
-
* Restore plugins from the cache bucket back to the user-root.
|
|
803
|
-
*
|
|
804
|
-
* Earlier releases moved ~/.agents/plugins/ → ~/.agents/.cache/plugins/ as part
|
|
805
|
-
* of `migrateRuntimeToCache`. That was wrong: plugins are user-authored
|
|
806
|
-
* resources (alongside skills/, commands/, hooks/) and belong at the user-root
|
|
807
|
-
* so they're git-tracked. See issue #20.
|
|
808
|
-
*
|
|
809
|
-
* For each ~/.agents/.cache/plugins/<name>/ that the user already has at
|
|
810
|
-
* ~/.agents/plugins/<name>/, the cache copy is left alone — the user-root copy
|
|
811
|
-
* wins. For plugins only present in the cache, the directory is moved back to
|
|
812
|
-
* the user-root. Idempotent.
|
|
813
|
-
*/
|
|
814
702
|
function migratePluginsBackToUserRoot() {
|
|
815
703
|
const cachePlugins = path.join(CACHE_DIR, 'plugins');
|
|
816
704
|
const userPlugins = path.join(USER_DIR, 'plugins');
|
|
@@ -844,59 +732,25 @@ function migratePluginsBackToUserRoot() {
|
|
|
844
732
|
copyDirSkipExisting(src, dest);
|
|
845
733
|
fs.rmSync(src, { recursive: true, force: true });
|
|
846
734
|
}
|
|
847
|
-
catch {
|
|
735
|
+
catch { }
|
|
848
736
|
}
|
|
849
737
|
}
|
|
850
|
-
// Drop the cache plugins dir if we emptied it.
|
|
851
738
|
try {
|
|
852
739
|
if (fs.readdirSync(cachePlugins).length === 0)
|
|
853
740
|
fs.rmdirSync(cachePlugins);
|
|
854
741
|
}
|
|
855
|
-
catch {
|
|
742
|
+
catch { }
|
|
856
743
|
}
|
|
857
|
-
/**
|
|
858
|
-
* Move regenerable runtime data into ~/.agents/.cache/.
|
|
859
|
-
*
|
|
860
|
-
* Sources cleared:
|
|
861
|
-
* ~/.agents/shims/ -> ~/.agents/.cache/shims/
|
|
862
|
-
* ~/.agents/bin/ -> ~/.agents/.cache/bin/
|
|
863
|
-
* ~/.agents/packages/ -> ~/.agents/.cache/packages/
|
|
864
|
-
* ~/.agents/cloud/ -> ~/.agents/.cache/cloud/
|
|
865
|
-
* ~/.agents/drive/ -> ~/.agents/.cache/drive/
|
|
866
|
-
* ~/.agents/terminals/ -> ~/.agents/.cache/terminals/
|
|
867
|
-
* ~/.agents/logs/ -> ~/.agents/.cache/logs/
|
|
868
|
-
* ~/.agents/companion/ -> ~/.agents/.cache/companion/
|
|
869
|
-
* ~/.agents/runtime/ -> ~/.agents/.cache/state/
|
|
870
|
-
* ~/.agents/cache/ -> ~/.agents/.cache/ (flatten — already a cache subdir)
|
|
871
|
-
* ~/.agents/helpers/{daemon,pty,...} -> ~/.agents/.cache/helpers/...
|
|
872
|
-
* ~/.agents-system/helpers/{daemon,pty,...} -> ~/.agents/.cache/helpers/...
|
|
873
|
-
* ~/.agents/browser/<profile>/ -> ~/.agents/.cache/browser/<profile>/ (profiles/ dir stays)
|
|
874
|
-
* ~/.agents-system/.fetch/ -> ~/.agents/.cache/.fetch/
|
|
875
|
-
*
|
|
876
|
-
* Loose dot-files at user root that are runtime caches:
|
|
877
|
-
* ~/.agents/.cli-version-cache.json -> ~/.agents/.cache/.cli-version-cache.json
|
|
878
|
-
* ~/.agents/.update-check -> ~/.agents/.cache/.update-check
|
|
879
|
-
* ~/.agents/.migrated -> ~/.agents/.cache/.migrated
|
|
880
|
-
* ~/.agents/watchdog.log -> ~/.agents/.cache/logs/watchdog.log
|
|
881
|
-
*
|
|
882
|
-
* Idempotent.
|
|
883
|
-
*/
|
|
884
744
|
function migrateRuntimeToCache() {
|
|
885
745
|
moveDirOnce(path.join(USER_DIR, 'shims'), path.join(CACHE_DIR, 'shims'));
|
|
886
746
|
moveDirOnce(path.join(USER_DIR, 'bin'), path.join(CACHE_DIR, 'bin'));
|
|
887
747
|
moveDirOnce(path.join(USER_DIR, 'packages'), path.join(CACHE_DIR, 'packages'));
|
|
888
|
-
// ~/.agents/plugins/ is intentionally NOT migrated — it is user-authored
|
|
889
|
-
// content (git-tracked), alongside skills/, commands/, hooks/. The reverse
|
|
890
|
-
// migration `migratePluginsBackToUserRoot` reclaims any plugins/ that prior
|
|
891
|
-
// releases moved into ~/.agents/.cache/plugins/. See issue #20.
|
|
892
748
|
moveDirOnce(path.join(USER_DIR, 'cloud'), path.join(CACHE_DIR, 'cloud'));
|
|
893
749
|
moveDirOnce(path.join(USER_DIR, 'drive'), path.join(CACHE_DIR, 'drive'));
|
|
894
750
|
moveDirOnce(path.join(USER_DIR, 'terminals'), path.join(CACHE_DIR, 'terminals'));
|
|
895
751
|
moveDirOnce(path.join(USER_DIR, 'logs'), path.join(CACHE_DIR, 'logs'));
|
|
896
752
|
moveDirOnce(path.join(USER_DIR, 'companion'), path.join(CACHE_DIR, 'companion'));
|
|
897
753
|
moveDirOnce(path.join(USER_DIR, 'runtime'), path.join(CACHE_DIR, 'state'));
|
|
898
|
-
// Pre-existing user `cache/` dir (claude usage cache, cloud-runs, etc.) — flatten
|
|
899
|
-
// so it's not confused with the new bucket. Its contents merge into .cache/.
|
|
900
754
|
const oldCache = path.join(USER_DIR, 'cache');
|
|
901
755
|
if (fs.existsSync(oldCache) && fs.statSync(oldCache).isDirectory()) {
|
|
902
756
|
try {
|
|
@@ -904,9 +758,8 @@ function migrateRuntimeToCache() {
|
|
|
904
758
|
copyDirSkipExisting(oldCache, CACHE_DIR);
|
|
905
759
|
fs.rmSync(oldCache, { recursive: true, force: true });
|
|
906
760
|
}
|
|
907
|
-
catch {
|
|
761
|
+
catch { }
|
|
908
762
|
}
|
|
909
|
-
// helpers/ at user-root and system-root → .cache/helpers/
|
|
910
763
|
for (const root of [USER_DIR, SYSTEM_DIR]) {
|
|
911
764
|
const src = path.join(root, 'helpers');
|
|
912
765
|
if (!fs.existsSync(src))
|
|
@@ -917,17 +770,15 @@ function migrateRuntimeToCache() {
|
|
|
917
770
|
copyDirSkipExisting(src, destBase);
|
|
918
771
|
fs.rmSync(src, { recursive: true, force: true });
|
|
919
772
|
}
|
|
920
|
-
catch {
|
|
773
|
+
catch { }
|
|
921
774
|
}
|
|
922
|
-
// browser runtime — keep browser/profiles/ in place, move everything else under
|
|
923
|
-
// browser/ into .cache/browser/.
|
|
924
775
|
const browserSrc = path.join(USER_DIR, 'browser');
|
|
925
776
|
if (fs.existsSync(browserSrc) && fs.statSync(browserSrc).isDirectory()) {
|
|
926
777
|
let entries = [];
|
|
927
778
|
try {
|
|
928
779
|
entries = fs.readdirSync(browserSrc);
|
|
929
780
|
}
|
|
930
|
-
catch {
|
|
781
|
+
catch { }
|
|
931
782
|
for (const entry of entries) {
|
|
932
783
|
if (entry === 'profiles')
|
|
933
784
|
continue;
|
|
@@ -936,7 +787,6 @@ function migrateRuntimeToCache() {
|
|
|
936
787
|
moveDirOnce(src, dest);
|
|
937
788
|
}
|
|
938
789
|
}
|
|
939
|
-
// System-root operational state that should not live in the npm-shipped repo.
|
|
940
790
|
moveDirOnce(path.join(SYSTEM_DIR, '.fetch'), path.join(CACHE_DIR, '.fetch'));
|
|
941
791
|
moveDirOnce(path.join(SYSTEM_DIR, 'browser'), path.join(CACHE_DIR, 'browser'));
|
|
942
792
|
moveDirOnce(path.join(SYSTEM_DIR, 'state'), path.join(CACHE_DIR, 'state'));
|
|
@@ -945,43 +795,31 @@ function migrateRuntimeToCache() {
|
|
|
945
795
|
moveFileOnce(path.join(SYSTEM_DIR, '.update-check'), path.join(CACHE_DIR, '.update-check'));
|
|
946
796
|
moveFileOnce(path.join(SYSTEM_DIR, '.migrated'), path.join(CACHE_DIR, '.migrated'));
|
|
947
797
|
moveFileOnce(path.join(SYSTEM_DIR, '.models-cache.json'), path.join(CACHE_DIR, '.models-cache.json'));
|
|
948
|
-
// Loose dot-files at user root that belong in the cache bucket.
|
|
949
798
|
moveFileOnce(path.join(USER_DIR, '.cli-version-cache.json'), path.join(CACHE_DIR, '.cli-version-cache.json'));
|
|
950
799
|
moveFileOnce(path.join(USER_DIR, '.update-check'), path.join(CACHE_DIR, '.update-check'));
|
|
951
800
|
moveFileOnce(path.join(USER_DIR, '.migrated'), path.join(CACHE_DIR, '.migrated'));
|
|
952
801
|
moveFileOnce(path.join(USER_DIR, '.models-cache.json'), path.join(CACHE_DIR, '.models-cache.json'));
|
|
953
802
|
moveFileOnce(path.join(USER_DIR, 'watchdog.log'), path.join(CACHE_DIR, 'logs', 'watchdog.log'));
|
|
954
803
|
}
|
|
955
|
-
/**
|
|
956
|
-
* Merge a SQLite database file at `src` into the one at `dest`, then delete the
|
|
957
|
-
* source (including its WAL/SHM sidecars). User-side rows win on collision via
|
|
958
|
-
* INSERT OR IGNORE.
|
|
959
|
-
*
|
|
960
|
-
* If `dest` is missing, the source is simply moved into place (no merge). If
|
|
961
|
-
* the SQLite open fails (corrupt / zero-byte / locked), the source is dropped
|
|
962
|
-
* so the system repo returns to npm-shipped state — the data is stale-anyway
|
|
963
|
-
* runtime state, not user resources.
|
|
964
|
-
*/
|
|
965
804
|
async function mergeSqliteDb(src, dest) {
|
|
966
805
|
if (!fs.existsSync(src))
|
|
967
806
|
return;
|
|
968
807
|
try {
|
|
969
808
|
if (fs.statSync(src).size === 0) {
|
|
970
|
-
// Zero-byte legacy DB — drop sidecars too and leave dest alone.
|
|
971
809
|
try {
|
|
972
810
|
fs.unlinkSync(src);
|
|
973
811
|
}
|
|
974
|
-
catch {
|
|
812
|
+
catch { }
|
|
975
813
|
for (const ext of ['-shm', '-wal']) {
|
|
976
814
|
try {
|
|
977
815
|
fs.unlinkSync(src + ext);
|
|
978
816
|
}
|
|
979
|
-
catch {
|
|
817
|
+
catch { }
|
|
980
818
|
}
|
|
981
819
|
return;
|
|
982
820
|
}
|
|
983
821
|
}
|
|
984
|
-
catch {
|
|
822
|
+
catch { }
|
|
985
823
|
if (!fs.existsSync(dest)) {
|
|
986
824
|
try {
|
|
987
825
|
fs.mkdirSync(path.dirname(dest), { recursive: true, mode: 0o700 });
|
|
@@ -991,16 +829,13 @@ async function mergeSqliteDb(src, dest) {
|
|
|
991
829
|
try {
|
|
992
830
|
fs.renameSync(src + ext, dest + ext);
|
|
993
831
|
}
|
|
994
|
-
catch {
|
|
832
|
+
catch { }
|
|
995
833
|
}
|
|
996
834
|
}
|
|
997
835
|
return;
|
|
998
836
|
}
|
|
999
|
-
catch {
|
|
837
|
+
catch { }
|
|
1000
838
|
}
|
|
1001
|
-
// Both files exist — open the dest DB and ATTACH src, then INSERT OR IGNORE
|
|
1002
|
-
// every user table. Dynamic import keeps the sqlite shim off the hot path
|
|
1003
|
-
// for CLI starts that don't actually need a merge.
|
|
1004
839
|
try {
|
|
1005
840
|
const sqliteMod = (await import('../sqlite.js'));
|
|
1006
841
|
const Database = sqliteMod.default;
|
|
@@ -1008,10 +843,6 @@ async function mergeSqliteDb(src, dest) {
|
|
|
1008
843
|
try {
|
|
1009
844
|
db.exec(`ATTACH DATABASE '${src.replace(/'/g, "''")}' AS src`);
|
|
1010
845
|
const tables = db.prepare(`SELECT name FROM src.sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%'`).all();
|
|
1011
|
-
// FTS5 virtual tables maintain shadow tables (<name>_data, _idx, _content,
|
|
1012
|
-
// _docsize, _config) with internal segids/pgnos that MUST stay consistent.
|
|
1013
|
-
// Row-merging shadow tables across two DBs corrupts the index. Skip them
|
|
1014
|
-
// here — the indexer reconstructs FTS content on the next scan.
|
|
1015
846
|
const ftsVirtuals = new Set(db.prepare(`SELECT name FROM src.sqlite_master WHERE type='table' AND sql LIKE '%fts5%'`).all().map((r) => r.name));
|
|
1016
847
|
const ftsShadowSuffixes = ['_data', '_idx', '_content', '_docsize', '_config'];
|
|
1017
848
|
const isFtsShadow = (name) => {
|
|
@@ -1033,58 +864,48 @@ async function mergeSqliteDb(src, dest) {
|
|
|
1033
864
|
db.exec(ddl);
|
|
1034
865
|
}
|
|
1035
866
|
}
|
|
1036
|
-
catch {
|
|
867
|
+
catch { }
|
|
1037
868
|
const quoted = '"' + name.replace(/"/g, '""') + '"';
|
|
1038
869
|
try {
|
|
1039
870
|
db.exec(`INSERT OR IGNORE INTO main.${quoted} SELECT * FROM src.${quoted}`);
|
|
1040
871
|
}
|
|
1041
|
-
catch {
|
|
872
|
+
catch { }
|
|
1042
873
|
}
|
|
1043
874
|
try {
|
|
1044
875
|
db.exec('DETACH DATABASE src');
|
|
1045
876
|
}
|
|
1046
|
-
catch {
|
|
877
|
+
catch { }
|
|
1047
878
|
}
|
|
1048
879
|
finally {
|
|
1049
880
|
try {
|
|
1050
881
|
db.close();
|
|
1051
882
|
}
|
|
1052
|
-
catch {
|
|
883
|
+
catch { }
|
|
1053
884
|
}
|
|
1054
885
|
try {
|
|
1055
886
|
fs.unlinkSync(src);
|
|
1056
887
|
}
|
|
1057
|
-
catch {
|
|
888
|
+
catch { }
|
|
1058
889
|
for (const ext of ['-shm', '-wal']) {
|
|
1059
890
|
try {
|
|
1060
891
|
fs.unlinkSync(src + ext);
|
|
1061
892
|
}
|
|
1062
|
-
catch {
|
|
893
|
+
catch { }
|
|
1063
894
|
}
|
|
1064
895
|
}
|
|
1065
896
|
catch {
|
|
1066
|
-
// Merge failed — drop the source so the system repo returns to clean state.
|
|
1067
|
-
// The user-side DB is authoritative; system-side rows were duplicate state.
|
|
1068
897
|
try {
|
|
1069
898
|
fs.unlinkSync(src);
|
|
1070
899
|
}
|
|
1071
|
-
catch {
|
|
900
|
+
catch { }
|
|
1072
901
|
for (const ext of ['-shm', '-wal']) {
|
|
1073
902
|
try {
|
|
1074
903
|
fs.unlinkSync(src + ext);
|
|
1075
904
|
}
|
|
1076
|
-
catch {
|
|
905
|
+
catch { }
|
|
1077
906
|
}
|
|
1078
907
|
}
|
|
1079
908
|
}
|
|
1080
|
-
/**
|
|
1081
|
-
* Move ~/.agents-system/sessions/ into ~/.agents/.history/sessions/.
|
|
1082
|
-
*
|
|
1083
|
-
* Filesystem entries (claude/, index.jsonl, content_index.jsonl, etc.) merge
|
|
1084
|
-
* directory-by-directory with user-side winning on collision. The bundled
|
|
1085
|
-
* sessions.db (plus WAL/SHM) goes through mergeSqliteDb so historical rows
|
|
1086
|
-
* land in the user DB.
|
|
1087
|
-
*/
|
|
1088
909
|
async function migrateSystemSessionsToHistory() {
|
|
1089
910
|
const src = path.join(SYSTEM_DIR, 'sessions');
|
|
1090
911
|
if (!fs.existsSync(src))
|
|
@@ -1093,7 +914,7 @@ async function migrateSystemSessionsToHistory() {
|
|
|
1093
914
|
try {
|
|
1094
915
|
fs.mkdirSync(dest, { recursive: true, mode: 0o700 });
|
|
1095
916
|
}
|
|
1096
|
-
catch {
|
|
917
|
+
catch { }
|
|
1097
918
|
let entries;
|
|
1098
919
|
try {
|
|
1099
920
|
entries = fs.readdirSync(src, { withFileTypes: true });
|
|
@@ -1104,7 +925,6 @@ async function migrateSystemSessionsToHistory() {
|
|
|
1104
925
|
for (const entry of entries) {
|
|
1105
926
|
const s = path.join(src, entry.name);
|
|
1106
927
|
if (entry.name === 'sessions.db' || entry.name === 'sessions.db-shm' || entry.name === 'sessions.db-wal') {
|
|
1107
|
-
// Handled by mergeSqliteDb on the canonical .db name below.
|
|
1108
928
|
continue;
|
|
1109
929
|
}
|
|
1110
930
|
const d = path.join(dest, entry.name);
|
|
@@ -1120,17 +940,8 @@ async function migrateSystemSessionsToHistory() {
|
|
|
1120
940
|
if (fs.readdirSync(src).length === 0)
|
|
1121
941
|
fs.rmdirSync(src);
|
|
1122
942
|
}
|
|
1123
|
-
catch {
|
|
943
|
+
catch { }
|
|
1124
944
|
}
|
|
1125
|
-
/**
|
|
1126
|
-
* Move ~/.agents-system/teams/ contents to ~/.agents/teams/ (registry/config)
|
|
1127
|
-
* and ~/.agents/.history/teams/ (per-run dirs).
|
|
1128
|
-
*
|
|
1129
|
-
* Strategy:
|
|
1130
|
-
* config.json, registry.json -> ~/.agents/teams/ (live state)
|
|
1131
|
-
* agents/ -> ~/.agents/.history/teams/agents/
|
|
1132
|
-
* <anything else> -> ~/.agents/.history/teams/<name>/ (per-run dirs)
|
|
1133
|
-
*/
|
|
1134
945
|
function migrateSystemTeamsToUser() {
|
|
1135
946
|
const src = path.join(SYSTEM_DIR, 'teams');
|
|
1136
947
|
if (!fs.existsSync(src))
|
|
@@ -1165,30 +976,14 @@ function migrateSystemTeamsToUser() {
|
|
|
1165
976
|
if (fs.readdirSync(src).length === 0)
|
|
1166
977
|
fs.rmdirSync(src);
|
|
1167
978
|
}
|
|
1168
|
-
catch {
|
|
979
|
+
catch { }
|
|
1169
980
|
}
|
|
1170
|
-
/**
|
|
1171
|
-
* Move ~/.agents-system/trash/ -> ~/.agents/.history/trash/.
|
|
1172
|
-
*
|
|
1173
|
-
* The system trash was where the legacy `mergeOverlappingVersionHomes()` parked
|
|
1174
|
-
* orphan version homes. Folding it into the history bucket keeps "everything
|
|
1175
|
-
* recoverable" in one place.
|
|
1176
|
-
*/
|
|
1177
981
|
function migrateSystemTrashToHistory() {
|
|
1178
982
|
const src = path.join(SYSTEM_DIR, 'trash');
|
|
1179
983
|
if (!fs.existsSync(src))
|
|
1180
984
|
return;
|
|
1181
985
|
moveDirOnce(src, path.join(HISTORY_DIR, 'trash'));
|
|
1182
986
|
}
|
|
1183
|
-
/**
|
|
1184
|
-
* Move ~/.agents-system/cache/ contents into ~/.agents/.cache/.
|
|
1185
|
-
*
|
|
1186
|
-
* Special cases:
|
|
1187
|
-
* sessions.db -> mergeSqliteDb into HISTORY_DIR/sessions/sessions.db
|
|
1188
|
-
* cloud-runs/ -> .cache/cloud-runs/
|
|
1189
|
-
* claude-usage.json -> drop (regenerable per-version cache)
|
|
1190
|
-
* <anything else> -> .cache/<name> (merge-on-collision)
|
|
1191
|
-
*/
|
|
1192
987
|
async function migrateSystemCacheToUserCache() {
|
|
1193
988
|
const src = path.join(SYSTEM_DIR, 'cache');
|
|
1194
989
|
if (!fs.existsSync(src))
|
|
@@ -1203,23 +998,21 @@ async function migrateSystemCacheToUserCache() {
|
|
|
1203
998
|
for (const entry of entries) {
|
|
1204
999
|
const s = path.join(src, entry.name);
|
|
1205
1000
|
if (entry.name === 'sessions.db' || entry.name === 'sessions.db-shm' || entry.name === 'sessions.db-wal') {
|
|
1206
|
-
// Sessions DB belongs in HISTORY, not CACHE — merge into the durable one.
|
|
1207
1001
|
if (entry.name === 'sessions.db') {
|
|
1208
1002
|
await mergeSqliteDb(s, path.join(HISTORY_DIR, 'sessions', 'sessions.db'));
|
|
1209
1003
|
}
|
|
1210
|
-
// Sidecars get dropped if they outlived the merge or were orphaned.
|
|
1211
1004
|
try {
|
|
1212
1005
|
if (fs.existsSync(s))
|
|
1213
1006
|
fs.unlinkSync(s);
|
|
1214
1007
|
}
|
|
1215
|
-
catch {
|
|
1008
|
+
catch { }
|
|
1216
1009
|
continue;
|
|
1217
1010
|
}
|
|
1218
1011
|
if (entry.name === 'claude-usage.json') {
|
|
1219
1012
|
try {
|
|
1220
1013
|
fs.unlinkSync(s);
|
|
1221
1014
|
}
|
|
1222
|
-
catch {
|
|
1015
|
+
catch { }
|
|
1223
1016
|
continue;
|
|
1224
1017
|
}
|
|
1225
1018
|
const d = path.join(CACHE_DIR, entry.name);
|
|
@@ -1234,17 +1027,13 @@ async function migrateSystemCacheToUserCache() {
|
|
|
1234
1027
|
if (fs.readdirSync(src).length === 0)
|
|
1235
1028
|
fs.rmdirSync(src);
|
|
1236
1029
|
}
|
|
1237
|
-
catch {
|
|
1030
|
+
catch { }
|
|
1238
1031
|
}
|
|
1239
|
-
/**
|
|
1240
|
-
* Merge ~/.agents-system/cloud/tasks.db into ~/.agents/.cache/cloud/tasks.db.
|
|
1241
|
-
*/
|
|
1242
1032
|
async function migrateSystemCloudToCache() {
|
|
1243
1033
|
const srcDir = path.join(SYSTEM_DIR, 'cloud');
|
|
1244
1034
|
if (!fs.existsSync(srcDir))
|
|
1245
1035
|
return;
|
|
1246
1036
|
await mergeSqliteDb(path.join(srcDir, 'tasks.db'), path.join(CACHE_DIR, 'cloud', 'tasks.db'));
|
|
1247
|
-
// Any other files in cloud/ get moved into the user cache bucket.
|
|
1248
1037
|
let entries;
|
|
1249
1038
|
try {
|
|
1250
1039
|
entries = fs.readdirSync(srcDir, { withFileTypes: true });
|
|
@@ -1266,13 +1055,8 @@ async function migrateSystemCloudToCache() {
|
|
|
1266
1055
|
if (fs.readdirSync(srcDir).length === 0)
|
|
1267
1056
|
fs.rmdirSync(srcDir);
|
|
1268
1057
|
}
|
|
1269
|
-
catch {
|
|
1058
|
+
catch { }
|
|
1270
1059
|
}
|
|
1271
|
-
/**
|
|
1272
|
-
* Legacy ~/.agents-system/swarm/ predates the rename to teams/. Fold any
|
|
1273
|
-
* per-agent dirs into ~/.agents/.history/teams/agents/ and drop the bookkeeping
|
|
1274
|
-
* JSONs (cache.json, config.json, teams.json) — those are regenerable.
|
|
1275
|
-
*/
|
|
1276
1060
|
function migrateLegacySwarmToTeams() {
|
|
1277
1061
|
const src = path.join(SYSTEM_DIR, 'swarm');
|
|
1278
1062
|
if (!fs.existsSync(src))
|
|
@@ -1287,22 +1071,15 @@ function migrateLegacySwarmToTeams() {
|
|
|
1287
1071
|
try {
|
|
1288
1072
|
fs.unlinkSync(f);
|
|
1289
1073
|
}
|
|
1290
|
-
catch {
|
|
1074
|
+
catch { }
|
|
1291
1075
|
}
|
|
1292
1076
|
}
|
|
1293
1077
|
try {
|
|
1294
1078
|
if (fs.readdirSync(src).length === 0)
|
|
1295
1079
|
fs.rmdirSync(src);
|
|
1296
1080
|
}
|
|
1297
|
-
catch {
|
|
1081
|
+
catch { }
|
|
1298
1082
|
}
|
|
1299
|
-
/**
|
|
1300
|
-
* Move ~/.agents-system/repos/<alias>/ to ~/.agents-<alias>/ peer dirs.
|
|
1301
|
-
*
|
|
1302
|
-
* Extra DotAgents repos are user-defined config and belong as peer dirs to
|
|
1303
|
-
* ~/.agents/, not nested under the npm-shipped system repo. The dir name in
|
|
1304
|
-
* `repos/` becomes the alias.
|
|
1305
|
-
*/
|
|
1306
1083
|
function migrateSystemReposToPeerDirs() {
|
|
1307
1084
|
const src = path.join(SYSTEM_DIR, 'repos');
|
|
1308
1085
|
if (!fs.existsSync(src))
|
|
@@ -1322,34 +1099,27 @@ function migrateSystemReposToPeerDirs() {
|
|
|
1322
1099
|
const s = path.join(src, alias);
|
|
1323
1100
|
const d = path.join(HOME, `.agents-${alias}`);
|
|
1324
1101
|
if (fs.existsSync(d)) {
|
|
1325
|
-
// Peer dir already exists — drop the system-side copy to avoid drift.
|
|
1326
1102
|
try {
|
|
1327
1103
|
fs.rmSync(s, { recursive: true, force: true });
|
|
1328
1104
|
}
|
|
1329
|
-
catch {
|
|
1105
|
+
catch { }
|
|
1330
1106
|
continue;
|
|
1331
1107
|
}
|
|
1332
1108
|
try {
|
|
1333
1109
|
fs.renameSync(s, d);
|
|
1334
1110
|
moved++;
|
|
1335
1111
|
}
|
|
1336
|
-
catch {
|
|
1112
|
+
catch { }
|
|
1337
1113
|
}
|
|
1338
1114
|
try {
|
|
1339
1115
|
if (fs.readdirSync(src).length === 0)
|
|
1340
1116
|
fs.rmdirSync(src);
|
|
1341
1117
|
}
|
|
1342
|
-
catch {
|
|
1118
|
+
catch { }
|
|
1343
1119
|
if (moved > 0) {
|
|
1344
1120
|
console.error(`Moved ${moved} extra repo${moved === 1 ? '' : 's'} from ~/.agents-system/repos/ to ~/.agents-<alias>/ peer dirs`);
|
|
1345
1121
|
}
|
|
1346
1122
|
}
|
|
1347
|
-
/**
|
|
1348
|
-
* Drop known-dead artifacts from ~/.agents-system/ that are pure regenerable
|
|
1349
|
-
* runtime state and don't belong anywhere:
|
|
1350
|
-
* bin/agents-keychain-* — per-version keychain helper, rebuilt on demand
|
|
1351
|
-
* shims/ — moved long ago, only empty leftover remains
|
|
1352
|
-
*/
|
|
1353
1123
|
function dropDeadSystemArtifacts() {
|
|
1354
1124
|
const binDir = path.join(SYSTEM_DIR, 'bin');
|
|
1355
1125
|
if (fs.existsSync(binDir)) {
|
|
@@ -1359,13 +1129,13 @@ function dropDeadSystemArtifacts() {
|
|
|
1359
1129
|
try {
|
|
1360
1130
|
fs.unlinkSync(path.join(binDir, name));
|
|
1361
1131
|
}
|
|
1362
|
-
catch {
|
|
1132
|
+
catch { }
|
|
1363
1133
|
}
|
|
1364
1134
|
}
|
|
1365
1135
|
if (fs.readdirSync(binDir).length === 0)
|
|
1366
1136
|
fs.rmdirSync(binDir);
|
|
1367
1137
|
}
|
|
1368
|
-
catch {
|
|
1138
|
+
catch { }
|
|
1369
1139
|
}
|
|
1370
1140
|
const shimsDir = path.join(SYSTEM_DIR, 'shims');
|
|
1371
1141
|
if (fs.existsSync(shimsDir)) {
|
|
@@ -1373,11 +1143,8 @@ function dropDeadSystemArtifacts() {
|
|
|
1373
1143
|
if (fs.readdirSync(shimsDir).length === 0)
|
|
1374
1144
|
fs.rmdirSync(shimsDir);
|
|
1375
1145
|
}
|
|
1376
|
-
catch {
|
|
1146
|
+
catch { }
|
|
1377
1147
|
}
|
|
1378
|
-
// After migrateSystemVersionsToUser() moves real version dirs out, the system
|
|
1379
|
-
// may still hold an empty `versions/<agent>/` skeleton with a stray .DS_Store.
|
|
1380
|
-
// Sweep it: if every leaf file is .DS_Store, drop the tree entirely.
|
|
1381
1148
|
const versionsDir = path.join(SYSTEM_DIR, 'versions');
|
|
1382
1149
|
if (fs.existsSync(versionsDir)) {
|
|
1383
1150
|
try {
|
|
@@ -1385,7 +1152,7 @@ function dropDeadSystemArtifacts() {
|
|
|
1385
1152
|
fs.rmSync(versionsDir, { recursive: true, force: true });
|
|
1386
1153
|
}
|
|
1387
1154
|
}
|
|
1388
|
-
catch {
|
|
1155
|
+
catch { }
|
|
1389
1156
|
}
|
|
1390
1157
|
}
|
|
1391
1158
|
function containsOnlyDsStore(dir) {
|
|
@@ -1407,21 +1174,11 @@ function containsOnlyDsStore(dir) {
|
|
|
1407
1174
|
}
|
|
1408
1175
|
return true;
|
|
1409
1176
|
}
|
|
1410
|
-
/**
|
|
1411
|
-
* After the sweep runs, warn (once per invocation) about any unrecognized
|
|
1412
|
-
* subdirectory left in ~/.agents-system/. The system repo is the npm-shipped
|
|
1413
|
-
* defaults — anything outside the allowlist is drift that future maintainers
|
|
1414
|
-
* need to handle explicitly.
|
|
1415
|
-
*/
|
|
1416
1177
|
function warnSystemOrphans() {
|
|
1417
1178
|
const SHIPPED_ALLOWLIST = new Set([
|
|
1418
|
-
// resource directories shipped by the npm package
|
|
1419
1179
|
'commands', 'hooks', 'skills', 'rules', 'mcp', 'clis', 'permissions', 'subagents', 'profiles', 'agents', 'routines', 'webhooks',
|
|
1420
|
-
// top-level metadata files
|
|
1421
1180
|
'agents.yaml', 'hooks.yaml', 'README.md', 'CHANGELOG.md',
|
|
1422
|
-
// git + repo metadata
|
|
1423
1181
|
'.git', '.githooks', '.gitignore', '.assets', '.environment', '.plans',
|
|
1424
|
-
// benign noise that's safe to ignore
|
|
1425
1182
|
'.DS_Store', '.claude',
|
|
1426
1183
|
]);
|
|
1427
1184
|
let entries;
|
|
@@ -1431,25 +1188,12 @@ function warnSystemOrphans() {
|
|
|
1431
1188
|
catch {
|
|
1432
1189
|
return;
|
|
1433
1190
|
}
|
|
1434
|
-
// Transient runtime sockets (.sock) are bound by long-running helpers like the
|
|
1435
|
-
// VS Code extension; they're live state, not stale data, and a future fix in
|
|
1436
|
-
// those helpers will move them into ~/.agents/.cache/ — until then, suppress.
|
|
1437
1191
|
const orphans = entries.filter((name) => !SHIPPED_ALLOWLIST.has(name) && !name.endsWith('.sock'));
|
|
1438
1192
|
if (orphans.length === 0)
|
|
1439
1193
|
return;
|
|
1440
1194
|
console.error(`~/.agents-system/ has unexpected entries (not part of the npm-shipped defaults): ${orphans.join(', ')}`);
|
|
1441
1195
|
}
|
|
1442
1196
|
const VERSION_RESOURCE_FLAT_KEYS = ['commands', 'skills', 'hooks', 'memory', 'subagents', 'plugins', 'workflows', 'permissions', 'mcp'];
|
|
1443
|
-
/**
|
|
1444
|
-
* Convert agents.yaml versions: entries from the old flat name-list format to
|
|
1445
|
-
* the new pattern format. Flat entries are detected by checking whether all
|
|
1446
|
-
* items in the array lack a ':' separator (plain names have no source prefix).
|
|
1447
|
-
*
|
|
1448
|
-
* The rulesPreset field is preserved. Flat resource lists are dropped — the
|
|
1449
|
-
* next `agents sync` will write default patterns (system:* user:* project:*).
|
|
1450
|
-
*
|
|
1451
|
-
* Idempotent: entries already in pattern format are left untouched.
|
|
1452
|
-
*/
|
|
1453
1197
|
function migrateVersionResourcesToPatterns() {
|
|
1454
1198
|
const metaFile = path.join(USER_DIR, 'agents.yaml');
|
|
1455
1199
|
if (!fs.existsSync(metaFile))
|
|
@@ -1476,10 +1220,8 @@ function migrateVersionResourcesToPatterns() {
|
|
|
1476
1220
|
const val = vr[key];
|
|
1477
1221
|
if (!Array.isArray(val) || val.length === 0)
|
|
1478
1222
|
continue;
|
|
1479
|
-
// Detect legacy: all items are plain names (no ':' separator)
|
|
1480
1223
|
if (val.every(item => typeof item === 'string' && !item.includes(':'))) {
|
|
1481
1224
|
if (key === 'memory') {
|
|
1482
|
-
// memory was a single-element array holding the preset name — move to rulesPreset
|
|
1483
1225
|
if (val.length === 1 && !vr['rulesPreset']) {
|
|
1484
1226
|
vr['rulesPreset'] = val[0];
|
|
1485
1227
|
}
|
|
@@ -1496,14 +1238,6 @@ function migrateVersionResourcesToPatterns() {
|
|
|
1496
1238
|
console.error('Migrated agents.yaml versions: entries to pattern format');
|
|
1497
1239
|
}
|
|
1498
1240
|
}
|
|
1499
|
-
/**
|
|
1500
|
-
* Split the machine-local fields out of the committed central agents.yaml so it
|
|
1501
|
-
* becomes portable and syncs cleanly (no more skip-worktree band-aid):
|
|
1502
|
-
* agents: -> ~/.agents/.history/devices/pins-<machineId>.json (untracked, machine-local)
|
|
1503
|
-
* versions: -> ~/.agents/.history/version-resources.json (gitignored, machine-local)
|
|
1504
|
-
* Then clear any externally-set skip-worktree bit. Idempotent: no-op once central
|
|
1505
|
-
* carries neither field. Operates on raw YAML (never through state.ts).
|
|
1506
|
-
*/
|
|
1507
1241
|
function migrateSplitDeviceLocalMeta() {
|
|
1508
1242
|
const metaFile = path.join(USER_DIR, 'agents.yaml');
|
|
1509
1243
|
if (!fs.existsSync(metaFile))
|
|
@@ -1519,49 +1253,39 @@ function migrateSplitDeviceLocalMeta() {
|
|
|
1519
1253
|
const versions = meta.versions;
|
|
1520
1254
|
const hasLocal = (!!agents && Object.keys(agents).length > 0) || (!!versions && Object.keys(versions).length > 0);
|
|
1521
1255
|
const HEADER = '# agents-cli metadata\n# Auto-generated - do not edit manually\n# https://github.com/phnx-labs/agi-cli\n\n';
|
|
1522
|
-
// Only rewrite central when it actually carries machine-local fields — a
|
|
1523
|
-
// machine whose agents.yaml is already portable-only is left untouched.
|
|
1524
1256
|
if (hasLocal) {
|
|
1525
|
-
// agents: -> machine-local pins JSON (merge, existing pins win).
|
|
1526
1257
|
if (agents && Object.keys(agents).length > 0) {
|
|
1527
1258
|
const pinsPath = path.join(USER_DIR, '.history', 'devices', `pins-${machineId()}.json`);
|
|
1528
1259
|
let existing = {};
|
|
1529
1260
|
try {
|
|
1530
1261
|
existing = JSON.parse(fs.readFileSync(pinsPath, 'utf-8')) || {};
|
|
1531
1262
|
}
|
|
1532
|
-
catch {
|
|
1263
|
+
catch { }
|
|
1533
1264
|
fs.mkdirSync(path.dirname(pinsPath), { recursive: true });
|
|
1534
1265
|
atomicWriteFileSync(pinsPath, JSON.stringify({ ...existing, agents: { ...agents, ...existing.agents } }, null, 2) + '\n');
|
|
1535
1266
|
}
|
|
1536
|
-
// versions: -> machine-local history JSON (merge, existing wins).
|
|
1537
1267
|
if (versions && Object.keys(versions).length > 0) {
|
|
1538
1268
|
const vrPath = path.join(USER_DIR, '.history', 'version-resources.json');
|
|
1539
1269
|
let existing = {};
|
|
1540
1270
|
try {
|
|
1541
1271
|
existing = JSON.parse(fs.readFileSync(vrPath, 'utf-8')) || {};
|
|
1542
1272
|
}
|
|
1543
|
-
catch {
|
|
1273
|
+
catch { }
|
|
1544
1274
|
fs.mkdirSync(path.dirname(vrPath), { recursive: true });
|
|
1545
1275
|
atomicWriteFileSync(vrPath, JSON.stringify({ ...versions, ...existing }, null, 2) + '\n');
|
|
1546
1276
|
}
|
|
1547
|
-
// Strip machine-local fields from central and rewrite (portable only) — after
|
|
1548
|
-
// the pins/history writes above, so a crash never loses data.
|
|
1549
1277
|
delete meta.agents;
|
|
1550
1278
|
delete meta.versions;
|
|
1551
1279
|
atomicWriteFileSync(metaFile, HEADER + yaml.stringify(meta));
|
|
1552
1280
|
}
|
|
1553
|
-
// Always clear any skip-worktree bit (idempotent, best-effort) so agents.yaml
|
|
1554
|
-
// syncs cleanly on every machine — even one that had nothing to split. Runs
|
|
1555
|
-
// after any rewrite so the tracked content already matches the split shape.
|
|
1556
1281
|
try {
|
|
1557
1282
|
execSync('git update-index --no-skip-worktree agents.yaml', { cwd: USER_DIR, stdio: 'ignore' });
|
|
1558
1283
|
}
|
|
1559
|
-
catch {
|
|
1284
|
+
catch { }
|
|
1560
1285
|
if (hasLocal) {
|
|
1561
1286
|
console.error('Split agents.yaml: agents: -> .history/devices/pins-*.json, versions: -> .history/version-resources.json');
|
|
1562
1287
|
}
|
|
1563
1288
|
}
|
|
1564
|
-
/** Move the auto-detected `default` browser profile from committed agents.yaml into the per-device file. The device file is written first so a crash cannot lose the profile; central is edited via yaml.Document to preserve comments. */
|
|
1565
1289
|
export function migrateMachineLocalBrowserProfileOutOfCentral(userDir = USER_DIR, machine = machineId()) {
|
|
1566
1290
|
const metaFile = path.join(userDir, 'agents.yaml');
|
|
1567
1291
|
if (!fs.existsSync(metaFile))
|
|
@@ -1582,14 +1306,12 @@ export function migrateMachineLocalBrowserProfileOutOfCentral(userDir = USER_DIR
|
|
|
1582
1306
|
const entry = browser[LEGACY_DEFAULT_BROWSER_PROFILE_NAME];
|
|
1583
1307
|
if (entry === undefined)
|
|
1584
1308
|
return;
|
|
1585
|
-
// Device file first — a crash before central is rewritten leaves a harmless
|
|
1586
|
-
// duplicate, while the reverse order would drop the profile entirely.
|
|
1587
1309
|
const devicePath = path.join(userDir, 'devices', machine, 'agents.yaml');
|
|
1588
1310
|
let deviceDoc = {};
|
|
1589
1311
|
try {
|
|
1590
1312
|
deviceDoc = yaml.parse(fs.readFileSync(devicePath, 'utf-8')) || {};
|
|
1591
1313
|
}
|
|
1592
|
-
catch {
|
|
1314
|
+
catch { }
|
|
1593
1315
|
const deviceBrowser = (deviceDoc.browser && typeof deviceDoc.browser === 'object' && !Array.isArray(deviceDoc.browser))
|
|
1594
1316
|
? deviceDoc.browser
|
|
1595
1317
|
: {};
|
|
@@ -1599,8 +1321,6 @@ export function migrateMachineLocalBrowserProfileOutOfCentral(userDir = USER_DIR
|
|
|
1599
1321
|
fs.mkdirSync(path.dirname(devicePath), { recursive: true });
|
|
1600
1322
|
atomicWriteFileSync(devicePath, DEVICE_META_HEADER + yaml.stringify(deviceDoc));
|
|
1601
1323
|
}
|
|
1602
|
-
// Then strip it from the synced file, dropping `browser:` entirely when the
|
|
1603
|
-
// machine-local entry was its only member.
|
|
1604
1324
|
doc.deleteIn(['browser', LEGACY_DEFAULT_BROWSER_PROFILE_NAME]);
|
|
1605
1325
|
if (Object.keys(browser).length === 1) {
|
|
1606
1326
|
const itemsOf = () => (doc.contents?.items) ?? [];
|
|
@@ -1608,7 +1328,6 @@ export function migrateMachineLocalBrowserProfileOutOfCentral(userDir = USER_DIR
|
|
|
1608
1328
|
const orphaned = idx >= 0 ? itemsOf()[idx]?.key?.commentBefore ?? undefined : undefined;
|
|
1609
1329
|
doc.delete('browser');
|
|
1610
1330
|
if (orphaned) {
|
|
1611
|
-
// Deleting shifted the following pair down into `idx`.
|
|
1612
1331
|
const next = itemsOf()[idx]?.key;
|
|
1613
1332
|
if (next)
|
|
1614
1333
|
next.commentBefore = next.commentBefore ? `${orphaned}\n${next.commentBefore}` : orphaned;
|
|
@@ -1616,15 +1335,10 @@ export function migrateMachineLocalBrowserProfileOutOfCentral(userDir = USER_DIR
|
|
|
1616
1335
|
doc.commentBefore = orphaned;
|
|
1617
1336
|
}
|
|
1618
1337
|
}
|
|
1619
|
-
// Everything cleared -> header only, never a bare `{}`. stringifyDoc emits a
|
|
1620
|
-
// FLOW empty map for an empty root, and a later parseDocument inherits that
|
|
1621
|
-
// flow and renders the whole rewritten file inline. serializeCentral guards
|
|
1622
|
-
// the identical case (state.ts, `isEmpty ? META_HEADER : stringifyDoc(doc)`).
|
|
1623
1338
|
const remaining = Object.keys(doc.toJSON() ?? {}).length;
|
|
1624
1339
|
atomicWriteFileSync(metaFile, remaining === 0 ? DEVICE_META_HEADER : stringifyDoc(doc));
|
|
1625
1340
|
console.error(`Migrated agents.yaml: browser '${LEGACY_DEFAULT_BROWSER_PROFILE_NAME}' profile -> devices/${machine}/agents.yaml`);
|
|
1626
1341
|
}
|
|
1627
|
-
/** Rename the legacy `extras-extras/` plugin marketplace dir to `agents-extras/` in every installed version home, and rewrite cross-references in `known_marketplaces.json` and `settings.json`. */
|
|
1628
1342
|
export function migrateExtrasExtrasToAgentsExtras(historyDir = HISTORY_DIR) {
|
|
1629
1343
|
const versionsRoot = path.join(historyDir, 'versions');
|
|
1630
1344
|
if (!fs.existsSync(versionsRoot))
|
|
@@ -1670,16 +1384,14 @@ export function migrateExtrasExtrasToAgentsExtras(historyDir = HISTORY_DIR) {
|
|
|
1670
1384
|
fs.renameSync(oldDir, newDir);
|
|
1671
1385
|
renamedDirs++;
|
|
1672
1386
|
}
|
|
1673
|
-
catch {
|
|
1387
|
+
catch { }
|
|
1674
1388
|
}
|
|
1675
1389
|
else if (oldExists && newExists) {
|
|
1676
|
-
// Previous incomplete migration — drop the stale old dir.
|
|
1677
1390
|
try {
|
|
1678
1391
|
fs.rmSync(oldDir, { recursive: true, force: true });
|
|
1679
1392
|
}
|
|
1680
|
-
catch {
|
|
1393
|
+
catch { }
|
|
1681
1394
|
}
|
|
1682
|
-
// Rewrite marketplace.json name field inside the (now) agents-extras dir.
|
|
1683
1395
|
const marketplaceJson = path.join(newDir, '.claude-plugin', 'marketplace.json');
|
|
1684
1396
|
if (fs.existsSync(marketplaceJson)) {
|
|
1685
1397
|
try {
|
|
@@ -1690,9 +1402,8 @@ export function migrateExtrasExtrasToAgentsExtras(historyDir = HISTORY_DIR) {
|
|
|
1690
1402
|
fs.writeFileSync(marketplaceJson, JSON.stringify(parsed, null, 2) + '\n', 'utf-8');
|
|
1691
1403
|
}
|
|
1692
1404
|
}
|
|
1693
|
-
catch {
|
|
1405
|
+
catch { }
|
|
1694
1406
|
}
|
|
1695
|
-
// Rewrite known_marketplaces.json key + path fields.
|
|
1696
1407
|
const knownFile = path.join(pluginsDir, 'known_marketplaces.json');
|
|
1697
1408
|
if (fs.existsSync(knownFile)) {
|
|
1698
1409
|
try {
|
|
@@ -1712,9 +1423,8 @@ export function migrateExtrasExtrasToAgentsExtras(historyDir = HISTORY_DIR) {
|
|
|
1712
1423
|
rewroteKnown++;
|
|
1713
1424
|
}
|
|
1714
1425
|
}
|
|
1715
|
-
catch {
|
|
1426
|
+
catch { }
|
|
1716
1427
|
}
|
|
1717
|
-
// Rewrite settings.json enabledPlugins keys.
|
|
1718
1428
|
const settingsFile = path.join(configDir, 'settings.json');
|
|
1719
1429
|
if (fs.existsSync(settingsFile)) {
|
|
1720
1430
|
try {
|
|
@@ -1744,7 +1454,7 @@ export function migrateExtrasExtrasToAgentsExtras(historyDir = HISTORY_DIR) {
|
|
|
1744
1454
|
}
|
|
1745
1455
|
}
|
|
1746
1456
|
}
|
|
1747
|
-
catch {
|
|
1457
|
+
catch { }
|
|
1748
1458
|
}
|
|
1749
1459
|
}
|
|
1750
1460
|
}
|
|
@@ -1752,14 +1462,6 @@ export function migrateExtrasExtrasToAgentsExtras(historyDir = HISTORY_DIR) {
|
|
|
1752
1462
|
console.error(`Renamed extras-extras → agents-extras (dirs: ${renamedDirs}, known_marketplaces: ${rewroteKnown}, settings: ${rewroteSettings})`);
|
|
1753
1463
|
}
|
|
1754
1464
|
}
|
|
1755
|
-
/**
|
|
1756
|
-
* Rewrite every routine YAML that carries the legacy singular `device: <value>`
|
|
1757
|
-
* field to the new plural `devices: [<value>]` format. Preserves all other
|
|
1758
|
-
* fields. Idempotent: a routine that already has `devices:` (or neither field)
|
|
1759
|
-
* is left untouched.
|
|
1760
|
-
*
|
|
1761
|
-
* Params default to the real routines dir; injectable for tests.
|
|
1762
|
-
*/
|
|
1763
1465
|
export function migrateRoutineDeviceToDevices(routinesDir) {
|
|
1764
1466
|
const dir = routinesDir ?? path.join(USER_DIR, 'routines');
|
|
1765
1467
|
if (!fs.existsSync(dir))
|
|
@@ -1798,21 +1500,6 @@ export function migrateRoutineDeviceToDevices(routinesDir) {
|
|
|
1798
1500
|
console.error(`Migrated ${migrated} routine${migrated === 1 ? '' : 's'}: device → devices`);
|
|
1799
1501
|
}
|
|
1800
1502
|
}
|
|
1801
|
-
/**
|
|
1802
|
-
* Fold the legacy host-placement `remoteCwd` field into the canonical portable
|
|
1803
|
-
* `cwd` (RUSH-2290). Host dispatch used to read `remoteCwd` while a local run
|
|
1804
|
-
* inferred its cwd from `repo` — two path semantics for one concept. The runner
|
|
1805
|
-
* now resolves every placement from `cwd`, so this idempotently rewrites the
|
|
1806
|
-
* field:
|
|
1807
|
-
*
|
|
1808
|
-
* - `remoteCwd` present, no `cwd` → rename to `cwd`.
|
|
1809
|
-
* - both present and equal → drop the duplicate `remoteCwd`.
|
|
1810
|
-
* - both present and DIFFERENT → conflict: leave BOTH fields untouched so
|
|
1811
|
-
* the migration never silently chooses one; `validateJob`/`doctor` then flag the
|
|
1812
|
-
* pair and the routine stays paused rather than running against a guessed path.
|
|
1813
|
-
*
|
|
1814
|
-
* Idempotent: a file with only `cwd` (already migrated) is skipped.
|
|
1815
|
-
*/
|
|
1816
1503
|
export function migrateRoutineRemoteCwdToCwd(routinesDir) {
|
|
1817
1504
|
const dir = routinesDir ?? path.join(USER_DIR, 'routines');
|
|
1818
1505
|
if (!fs.existsSync(dir))
|
|
@@ -1836,19 +1523,18 @@ export function migrateRoutineRemoteCwdToCwd(routinesDir) {
|
|
|
1836
1523
|
continue;
|
|
1837
1524
|
const remote = doc.remoteCwd;
|
|
1838
1525
|
if (typeof remote !== 'string' || !remote.trim()) {
|
|
1839
|
-
// A malformed legacy value is not something to fold — drop it and move on.
|
|
1840
1526
|
delete doc.remoteCwd;
|
|
1841
1527
|
atomicWriteFileSync(filePath, yaml.stringify(doc));
|
|
1842
1528
|
continue;
|
|
1843
1529
|
}
|
|
1844
1530
|
if ('cwd' in doc) {
|
|
1845
1531
|
if (doc.cwd === remote) {
|
|
1846
|
-
delete doc.remoteCwd;
|
|
1532
|
+
delete doc.remoteCwd;
|
|
1847
1533
|
atomicWriteFileSync(filePath, yaml.stringify(doc));
|
|
1848
1534
|
migrated++;
|
|
1849
1535
|
}
|
|
1850
1536
|
else {
|
|
1851
|
-
conflicts++;
|
|
1537
|
+
conflicts++;
|
|
1852
1538
|
}
|
|
1853
1539
|
continue;
|
|
1854
1540
|
}
|
|
@@ -1864,20 +1550,10 @@ export function migrateRoutineRemoteCwdToCwd(routinesDir) {
|
|
|
1864
1550
|
console.error(`${conflicts} routine${conflicts === 1 ? '' : 's'} have conflicting remoteCwd/cwd — left paused for manual repair (migration_conflict)`);
|
|
1865
1551
|
}
|
|
1866
1552
|
}
|
|
1867
|
-
/**
|
|
1868
|
-
* Pause every currently-active routine whose execution context no longer
|
|
1869
|
-
* resolves ready (RUSH-2290). An agent/workflow routine with no project/cwd, a
|
|
1870
|
-
* missing directory, or a non-portable path used to fire and fail every tick —
|
|
1871
|
-
* the mass auth_failed / untrusted-home storm this ticket exists to stop. After
|
|
1872
|
-
* the fold, such a routine is deactivated on THIS device (only), preventing it
|
|
1873
|
-
* from being scheduled until `agents routines doctor --all --fix` (or a repair +
|
|
1874
|
-
* `resume`) makes it ready. Never materializes a device manifest that does not
|
|
1875
|
-
* yet exist, and never touches command routines (they run in the target home).
|
|
1876
|
-
*/
|
|
1877
1553
|
function pauseUnreadyEnabledRoutines() {
|
|
1878
1554
|
const enabled = enabledRoutineNames();
|
|
1879
1555
|
if (enabled === null)
|
|
1880
|
-
return;
|
|
1556
|
+
return;
|
|
1881
1557
|
const enabledSet = new Set(enabled);
|
|
1882
1558
|
const paused = [];
|
|
1883
1559
|
for (const job of listJobs()) {
|
|
@@ -1888,7 +1564,7 @@ function pauseUnreadyEnabledRoutines() {
|
|
|
1888
1564
|
ready = validateJob(job).length === 0 && evaluateActivationReadiness(job).ready;
|
|
1889
1565
|
}
|
|
1890
1566
|
catch {
|
|
1891
|
-
ready = true;
|
|
1567
|
+
ready = true;
|
|
1892
1568
|
}
|
|
1893
1569
|
if (!ready)
|
|
1894
1570
|
paused.push(job.name);
|
|
@@ -1900,23 +1576,6 @@ function pauseUnreadyEnabledRoutines() {
|
|
|
1900
1576
|
console.error(`Paused ${paused.length} routine${paused.length === 1 ? '' : 's'} with an unresolved execution context ` +
|
|
1901
1577
|
`(run 'agents routines doctor --all' to see why): ${paused.join(', ')}`);
|
|
1902
1578
|
}
|
|
1903
|
-
/**
|
|
1904
|
-
* Fold the legacy watchdog enable sentinel into the `watchdog.enabled` config.
|
|
1905
|
-
*
|
|
1906
|
-
* The always-on watchdog used to be gated by a presence sentinel at
|
|
1907
|
-
* `<runtime-state>/watchdog/enabled`; it is now a daemon-owned timer (RUSH-2495)
|
|
1908
|
-
* gated by the `watchdog.enabled` device-config flag — the same flag
|
|
1909
|
-
* `agents watchdog enable` writes. A user who had run `agents watchdog enable`
|
|
1910
|
-
* under the old build has that file on disk; without this, upgrading would
|
|
1911
|
-
* silently drop them back to OFF (the nudge just stops), the worst failure mode
|
|
1912
|
-
* for a "survives reboots" feature. If the sentinel exists, set
|
|
1913
|
-
* `watchdog.enabled: true`, then delete the sentinel so this runs exactly once.
|
|
1914
|
-
* If setting it fails, the sentinel is left in place so a later run retries
|
|
1915
|
-
* rather than silently losing the opt-in.
|
|
1916
|
-
*
|
|
1917
|
-
* The setter seam is injectable so the migration is unit-testable without
|
|
1918
|
-
* touching the real device config.
|
|
1919
|
-
*/
|
|
1920
1579
|
export function migrateWatchdogSentinelToConfig(sentinelPath = path.join(CACHE_DIR, 'state', 'watchdog', 'enabled'), enable = (value) => setConfigValue('watchdog.enabled', value)) {
|
|
1921
1580
|
if (!fs.existsSync(sentinelPath))
|
|
1922
1581
|
return;
|
|
@@ -1930,16 +1589,9 @@ export function migrateWatchdogSentinelToConfig(sentinelPath = path.join(CACHE_D
|
|
|
1930
1589
|
try {
|
|
1931
1590
|
fs.rmSync(sentinelPath);
|
|
1932
1591
|
}
|
|
1933
|
-
catch {
|
|
1592
|
+
catch { }
|
|
1934
1593
|
console.error('Migrated watchdog: legacy enable sentinel → watchdog.enabled config (kept enabled)');
|
|
1935
1594
|
}
|
|
1936
|
-
/**
|
|
1937
|
-
* Rename cli/ → clis/ in each of the given `.agents/` directories.
|
|
1938
|
-
*
|
|
1939
|
-
* One-way, idempotent: no-op when src is absent. Throws when both
|
|
1940
|
-
* `<dir>/cli` and `<dir>/clis` exist — the user must resolve the conflict
|
|
1941
|
-
* manually before proceeding. Exported for unit-testing with temp dirs.
|
|
1942
|
-
*/
|
|
1943
1595
|
export function migrateCliDirToClis(agentsDirs) {
|
|
1944
1596
|
for (const agentsDir of agentsDirs) {
|
|
1945
1597
|
const src = path.join(agentsDir, 'cli');
|
|
@@ -1953,17 +1605,6 @@ export function migrateCliDirToClis(agentsDirs) {
|
|
|
1953
1605
|
fs.renameSync(src, dest);
|
|
1954
1606
|
}
|
|
1955
1607
|
}
|
|
1956
|
-
/**
|
|
1957
|
-
* Migrate owner identity into humans.yaml.
|
|
1958
|
-
*
|
|
1959
|
-
* Sources (both are optional; migration is a no-op when neither exists):
|
|
1960
|
-
* 1. ~/.agents/agents.yaml notify.owner.{channel,to} — short-form notify config.
|
|
1961
|
-
* 2. ~/.agents/owner.md — YAML frontmatter with name/timezone/quiet_hours/channels/policy.
|
|
1962
|
-
*
|
|
1963
|
-
* Writes ~/.agents/humans.yaml (version: 1) when at least one source is
|
|
1964
|
-
* present, then removes the migrated keys. Idempotent: exits immediately when
|
|
1965
|
-
* humans.yaml already exists.
|
|
1966
|
-
*/
|
|
1967
1608
|
function migrateHumans() {
|
|
1968
1609
|
const humansFile = path.join(USER_DIR, 'humans.yaml');
|
|
1969
1610
|
if (fs.existsSync(humansFile))
|
|
@@ -1977,7 +1618,6 @@ function migrateHumans() {
|
|
|
1977
1618
|
let ownerDefaultSeverity;
|
|
1978
1619
|
let ownerChannels;
|
|
1979
1620
|
let ownerPolicy;
|
|
1980
|
-
// 1. Read notify.owner from agents.yaml.
|
|
1981
1621
|
if (fs.existsSync(agentsYamlPath)) {
|
|
1982
1622
|
try {
|
|
1983
1623
|
const raw = fs.readFileSync(agentsYamlPath, 'utf-8');
|
|
@@ -1990,9 +1630,8 @@ function migrateHumans() {
|
|
|
1990
1630
|
notifyOwner = { channel, to };
|
|
1991
1631
|
}
|
|
1992
1632
|
}
|
|
1993
|
-
catch {
|
|
1633
|
+
catch { }
|
|
1994
1634
|
}
|
|
1995
|
-
// 2. Read YAML frontmatter from owner.md.
|
|
1996
1635
|
if (fs.existsSync(ownerMdPath)) {
|
|
1997
1636
|
try {
|
|
1998
1637
|
const raw = fs.readFileSync(ownerMdPath, 'utf-8');
|
|
@@ -2015,9 +1654,8 @@ function migrateHumans() {
|
|
|
2015
1654
|
}
|
|
2016
1655
|
}
|
|
2017
1656
|
}
|
|
2018
|
-
catch {
|
|
1657
|
+
catch { }
|
|
2019
1658
|
}
|
|
2020
|
-
// Only write if we have at least one piece of owner data.
|
|
2021
1659
|
if (!notifyOwner && !ownerName && !ownerTimezone && !ownerQuietHours && !ownerDefaultSeverity && !ownerChannels && !ownerPolicy)
|
|
2022
1660
|
return;
|
|
2023
1661
|
const humansDoc = { version: 1 };
|
|
@@ -2046,7 +1684,6 @@ function migrateHumans() {
|
|
|
2046
1684
|
console.error(`humans.yaml migration: could not write (${err.message})`);
|
|
2047
1685
|
return;
|
|
2048
1686
|
}
|
|
2049
|
-
// Remove notify.owner from agents.yaml after successful migration.
|
|
2050
1687
|
if (notifyOwner && fs.existsSync(agentsYamlPath)) {
|
|
2051
1688
|
try {
|
|
2052
1689
|
const raw = fs.readFileSync(agentsYamlPath, 'utf-8');
|
|
@@ -2057,23 +1694,11 @@ function migrateHumans() {
|
|
|
2057
1694
|
if (notifyNode.items.length === 0)
|
|
2058
1695
|
doc.delete('notify');
|
|
2059
1696
|
}
|
|
2060
|
-
// `flowCollectionPadding: false` keeps committed flow sequences unpadded
|
|
2061
|
-
// (`[a, b]`, not `[ a, b ]`) so re-emitting agents.yaml here does not dirty
|
|
2062
|
-
// the synced ~/.agents tree and block pulls (RUSH-2505).
|
|
2063
1697
|
fs.writeFileSync(agentsYamlPath, stringifyDoc(doc), 'utf-8');
|
|
2064
1698
|
}
|
|
2065
|
-
catch {
|
|
1699
|
+
catch { }
|
|
2066
1700
|
}
|
|
2067
1701
|
}
|
|
2068
|
-
/**
|
|
2069
|
-
* An earlier agents-cli release put Cursor's file-backed OAuth token at
|
|
2070
|
-
* ~/.config/cursor/auth.json. Current Cursor actually writes the file store to
|
|
2071
|
-
* HOME-relative ~/.cursor/auth.json. Copy that legacy token into the active
|
|
2072
|
-
* account's version home. The active account
|
|
2073
|
-
* is the home the ~/.cursor symlink currently targets. Idempotent: skips when
|
|
2074
|
-
* the home already has its own token, and a no-op for unmanaged Cursor installs
|
|
2075
|
-
* (where ~/.cursor is a real dir, not a symlink into a version home).
|
|
2076
|
-
*/
|
|
2077
1702
|
export function seedActiveCursorLoginPerVersion() {
|
|
2078
1703
|
const realHome = process.env.AGENTS_REAL_HOME || os.homedir();
|
|
2079
1704
|
const globalAuth = path.join(realHome, '.config', 'cursor', 'auth.json');
|
|
@@ -2081,14 +1706,12 @@ export function seedActiveCursorLoginPerVersion() {
|
|
|
2081
1706
|
try {
|
|
2082
1707
|
if (!fs.existsSync(globalAuth))
|
|
2083
1708
|
return;
|
|
2084
|
-
// ~/.cursor -> .../versions/cursor/<version>/home/.cursor ; the version home
|
|
2085
|
-
// is that link's parent directory.
|
|
2086
1709
|
const link = fs.readlinkSync(path.join(realHome, '.cursor'));
|
|
2087
1710
|
const resolved = path.isAbsolute(link) ? link : path.resolve(realHome, link);
|
|
2088
1711
|
versionHome = path.dirname(resolved);
|
|
2089
1712
|
}
|
|
2090
1713
|
catch {
|
|
2091
|
-
return;
|
|
1714
|
+
return;
|
|
2092
1715
|
}
|
|
2093
1716
|
if (!versionHome.includes(path.join('versions', 'cursor')))
|
|
2094
1717
|
return;
|
|
@@ -2099,25 +1722,8 @@ export function seedActiveCursorLoginPerVersion() {
|
|
|
2099
1722
|
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
2100
1723
|
fs.copyFileSync(globalAuth, dest);
|
|
2101
1724
|
}
|
|
2102
|
-
catch {
|
|
1725
|
+
catch { }
|
|
2103
1726
|
}
|
|
2104
|
-
/**
|
|
2105
|
-
* Fold the pre-markdown Kimi subagent layout out of every kimi version home.
|
|
2106
|
-
*
|
|
2107
|
-
* agents-cli used to write each Kimi subagent as a `<name>.yaml` +
|
|
2108
|
-
* `<name>.system.md` pair plus a managed `_agents-cli.yaml` index, against the
|
|
2109
|
-
* agentspec of `kimi-cli` — a different product from the `kimi-code` harness we
|
|
2110
|
-
* install, which never read any of it. Those files are inert, but not harmless:
|
|
2111
|
-
* `<name>.system.md` ends in `.md`, so the subagent enumerator would surface it
|
|
2112
|
-
* as a phantom subagent named `<name>.system`, and kimi-code logs
|
|
2113
|
-
* `Missing frontmatter` for it once per session.
|
|
2114
|
-
*
|
|
2115
|
-
* This is the ONE place that knows about the old layout — the registry target
|
|
2116
|
-
* describes only the current `<name>.md` shape. A pair is identified by its
|
|
2117
|
-
* signature (a `<name>.yaml` with a sibling `<name>.system.md`), so a subagent a
|
|
2118
|
-
* user legitimately named e.g. `foo.system` is never touched: it has no
|
|
2119
|
-
* `foo.yaml` beside it. Idempotent; a no-op once the dirs are clean.
|
|
2120
|
-
*/
|
|
2121
1727
|
export function migrateKimiSubagentsToMarkdown(versionsDir) {
|
|
2122
1728
|
const kimiVersions = path.join(versionsDir ?? path.join(HISTORY_DIR, 'versions'), 'kimi');
|
|
2123
1729
|
let versions;
|
|
@@ -2125,7 +1731,7 @@ export function migrateKimiSubagentsToMarkdown(versionsDir) {
|
|
|
2125
1731
|
versions = fs.readdirSync(kimiVersions);
|
|
2126
1732
|
}
|
|
2127
1733
|
catch {
|
|
2128
|
-
return;
|
|
1734
|
+
return;
|
|
2129
1735
|
}
|
|
2130
1736
|
let removed = 0;
|
|
2131
1737
|
for (const version of versions) {
|
|
@@ -2141,14 +1747,12 @@ export function migrateKimiSubagentsToMarkdown(versionsDir) {
|
|
|
2141
1747
|
const doomed = [];
|
|
2142
1748
|
for (const entry of entries) {
|
|
2143
1749
|
if (entry === '_agents-cli.yaml') {
|
|
2144
|
-
doomed.push(entry);
|
|
1750
|
+
doomed.push(entry);
|
|
2145
1751
|
continue;
|
|
2146
1752
|
}
|
|
2147
1753
|
if (!entry.endsWith('.yaml'))
|
|
2148
1754
|
continue;
|
|
2149
1755
|
const base = entry.slice(0, -'.yaml'.length);
|
|
2150
|
-
// Only a genuine legacy pair — a bare .yaml with no sibling prompt is not
|
|
2151
|
-
// ours to delete.
|
|
2152
1756
|
if (!present.has(`${base}.system.md`))
|
|
2153
1757
|
continue;
|
|
2154
1758
|
doomed.push(entry, `${base}.system.md`);
|
|
@@ -2159,7 +1763,6 @@ export function migrateKimiSubagentsToMarkdown(versionsDir) {
|
|
|
2159
1763
|
removed++;
|
|
2160
1764
|
}
|
|
2161
1765
|
catch {
|
|
2162
|
-
// leave it; the next run retries
|
|
2163
1766
|
}
|
|
2164
1767
|
}
|
|
2165
1768
|
}
|
|
@@ -2167,17 +1770,6 @@ export function migrateKimiSubagentsToMarkdown(versionsDir) {
|
|
|
2167
1770
|
console.error(`Removed ${removed} pre-markdown Kimi subagent file(s); run 'agents sync kimi' to write the new format`);
|
|
2168
1771
|
}
|
|
2169
1772
|
}
|
|
2170
|
-
/**
|
|
2171
|
-
* Remove the compiled "project" ruleset the compiler used to write into $HOME
|
|
2172
|
-
* (RUSH-2725). `compileRulesForProject` treated any cwd with `.agents/rules`
|
|
2173
|
-
* as a project — and the user layer at ~/.agents satisfies that test — so it
|
|
2174
|
-
* wrote ~/AGENTS.md plus per-agent symlinks, and every session under $HOME
|
|
2175
|
-
* then loaded the entire ruleset twice (global memory + "project" memory).
|
|
2176
|
-
* The compiler now refuses reserved roots; this removes the artifact already
|
|
2177
|
-
* on disk. Only files we provably own are touched: an AGENTS.md carrying the
|
|
2178
|
-
* compiled-project header, symlinks pointing at it, and copy-fallback files
|
|
2179
|
-
* (symlink-less filesystems) carrying the same header.
|
|
2180
|
-
*/
|
|
2181
1773
|
export function removeHomeCompiledProjectRules(homeDir = HOME) {
|
|
2182
1774
|
const agentsPath = path.join(homeDir, 'AGENTS.md');
|
|
2183
1775
|
let agentsLstat;
|
|
@@ -2224,11 +1816,10 @@ export function removeHomeCompiledProjectRules(homeDir = HOME) {
|
|
|
2224
1816
|
try {
|
|
2225
1817
|
fs.unlinkSync(linkPath);
|
|
2226
1818
|
}
|
|
2227
|
-
catch {
|
|
1819
|
+
catch { }
|
|
2228
1820
|
}
|
|
2229
1821
|
}
|
|
2230
1822
|
else if (lstat.isFile()) {
|
|
2231
|
-
// Symlink-less filesystems got a copy of AGENTS.md instead — same header.
|
|
2232
1823
|
let copy = '';
|
|
2233
1824
|
try {
|
|
2234
1825
|
copy = fs.readFileSync(linkPath, 'utf8');
|
|
@@ -2240,18 +1831,16 @@ export function removeHomeCompiledProjectRules(homeDir = HOME) {
|
|
|
2240
1831
|
try {
|
|
2241
1832
|
fs.unlinkSync(linkPath);
|
|
2242
1833
|
}
|
|
2243
|
-
catch {
|
|
1834
|
+
catch { }
|
|
2244
1835
|
}
|
|
2245
1836
|
}
|
|
2246
1837
|
}
|
|
2247
1838
|
try {
|
|
2248
1839
|
fs.unlinkSync(agentsPath);
|
|
2249
1840
|
}
|
|
2250
|
-
catch {
|
|
1841
|
+
catch { }
|
|
2251
1842
|
}
|
|
2252
|
-
/** Run all idempotent migrations. Safe to call multiple times. */
|
|
2253
1843
|
export async function runMigration() {
|
|
2254
|
-
// MUST run first: every other migrator reads SYSTEM_DIR (the new path).
|
|
2255
1844
|
foldLegacySystemRepo();
|
|
2256
1845
|
const cliMigrateDirs = [USER_DIR, SYSTEM_DIR];
|
|
2257
1846
|
const projectDotAgents = path.join(process.cwd(), '.agents');
|
|
@@ -2266,10 +1855,7 @@ export async function runMigration() {
|
|
|
2266
1855
|
migratePromptcutsIntoHooks();
|
|
2267
1856
|
migrateSystemVersionsToUser();
|
|
2268
1857
|
mergeOverlappingVersionHomes();
|
|
2269
|
-
// Cursor runs now isolate the login per version home; preserve the current
|
|
2270
|
-
// login by seeding the active home's token from the legacy global copy.
|
|
2271
1858
|
seedActiveCursorLoginPerVersion();
|
|
2272
|
-
// Drop the pre-markdown Kimi subagent files; the registry now writes <name>.md.
|
|
2273
1859
|
migrateKimiSubagentsToMarkdown();
|
|
2274
1860
|
migrateRunsIntoRoutines();
|
|
2275
1861
|
migrateTrashToHidden();
|
|
@@ -2285,40 +1871,14 @@ export async function runMigration() {
|
|
|
2285
1871
|
foldUserHooksYamlIntoAgentsYaml();
|
|
2286
1872
|
foldBrowserProfilesIntoAgentsYaml();
|
|
2287
1873
|
migrateVersionResourcesToPatterns();
|
|
2288
|
-
// Split machine-local fields (agents:/versions:) out of the committed central
|
|
2289
|
-
// agents.yaml. After migrateVersionResourcesToPatterns so versions: is already
|
|
2290
|
-
// in pattern form when it moves to the history file.
|
|
2291
1874
|
migrateSplitDeviceLocalMeta();
|
|
2292
|
-
// Same split, one level deeper: `browser` stays central (named profiles are
|
|
2293
|
-
// fleet config) but its auto-detected `default` entry is machine-local and was
|
|
2294
|
-
// left behind in the synced file, keeping every box dirty. After
|
|
2295
|
-
// migrateSplitDeviceLocalMeta so the device file is already in its canonical
|
|
2296
|
-
// location before this merges an entry into it.
|
|
2297
1875
|
migrateMachineLocalBrowserProfileOutOfCentral();
|
|
2298
|
-
// Converge the device-config/pins stores: fold the central
|
|
2299
|
-
// fleet.devices.<name>.config block + legacy auto-launch.json into the
|
|
2300
|
-
// per-device docs' config:, and extract pins from tracked docs into the
|
|
2301
|
-
// untracked pins JSON. After migrateSplitDeviceLocalMeta so the pins file is
|
|
2302
|
-
// in its canonical location. Also invoked on daemon boot and on the first
|
|
2303
|
-
// device-config read/write in a process, so sentinel'd installs (which skip
|
|
2304
|
-
// this whole run) still converge.
|
|
2305
1876
|
migrateDeviceConfigStores();
|
|
2306
|
-
// Bucket moves: collapse runtime state into ~/.agents/.history and ~/.agents/.cache.
|
|
2307
1877
|
migrateRuntimeToHistory();
|
|
2308
1878
|
migrateLegacySessionMarkersToBookmarks();
|
|
2309
1879
|
migrateRuntimeToCache();
|
|
2310
|
-
// Restore plugins (user-authored) from cache back to user-root. Runs AFTER
|
|
2311
|
-
// migrateRuntimeToCache so any legacy plugins/ still at the user-root from
|
|
2312
|
-
// very-old layouts have already been handled.
|
|
2313
1880
|
migratePluginsBackToUserRoot();
|
|
2314
|
-
// Browser captures: fold the legacy global browser/sessions/<task> root into the
|
|
2315
|
-
// per-profile browser/<profile>/sessions/<task> layout. After the cache moves so
|
|
2316
|
-
// the browser dir is at its canonical .cache location.
|
|
2317
1881
|
foldBrowserSessionsIntoProfiles();
|
|
2318
|
-
// System-repo sweep: move every remaining operational dir into its canonical
|
|
2319
|
-
// user-bucket location, then drop known-dead artifacts and warn about
|
|
2320
|
-
// anything we don't recognize. Order: durable (sessions/teams/trash/repos/
|
|
2321
|
-
// legacy-swarm) -> caches (cache/, cloud/) -> drops -> orphan check.
|
|
2322
1882
|
await migrateSystemSessionsToHistory();
|
|
2323
1883
|
migrateSystemTeamsToUser();
|
|
2324
1884
|
migrateSystemTrashToHistory();
|
|
@@ -2328,38 +1888,15 @@ export async function runMigration() {
|
|
|
2328
1888
|
await migrateSystemCloudToCache();
|
|
2329
1889
|
dropDeadSystemArtifacts();
|
|
2330
1890
|
warnSystemOrphans();
|
|
2331
|
-
// Rename the legacy extras-extras marketplace dir to agents-extras across every
|
|
2332
|
-
// installed version-home. Runs after migrateRuntimeToHistory so the version
|
|
2333
|
-
// homes are at their canonical HISTORY_DIR location.
|
|
2334
1891
|
migrateExtrasExtrasToAgentsExtras();
|
|
2335
|
-
// Rewrite routine YAML files: singular `device:` -> plural `devices: []`.
|
|
2336
1892
|
migrateRoutineDeviceToDevices();
|
|
2337
|
-
// Fold legacy host-placement `remoteCwd` into the canonical portable `cwd`.
|
|
2338
1893
|
migrateRoutineRemoteCwdToCwd();
|
|
2339
1894
|
migrateLegacyRoutineActivation();
|
|
2340
|
-
// Fold the legacy watchdog enable sentinel into `watchdog.enabled` config so a
|
|
2341
|
-
// user who opted in under the old build stays opted in after upgrading.
|
|
2342
1895
|
migrateWatchdogSentinelToConfig();
|
|
2343
|
-
// Delete the compiled "project" ruleset older builds wrote into $HOME — the
|
|
2344
|
-
// duplicate-injection artifact of RUSH-2725. The compiler no longer writes
|
|
2345
|
-
// it; this cleans up what is already on every machine.
|
|
2346
1896
|
removeHomeCompiledProjectRules();
|
|
2347
|
-
// Deactivate any routine whose execution context no longer resolves ready, so
|
|
2348
|
-
// an anchor-less agent/workflow routine cannot keep firing-and-failing after the
|
|
2349
|
-
// fold (RUSH-2290). Runs AFTER the tick/watchdog routines are added so those
|
|
2350
|
-
// (command/home) routines are evaluated in their final shape.
|
|
2351
1897
|
pauseUnreadyEnabledRoutines();
|
|
2352
|
-
// Symlink repair runs LAST so it can find the post-move version homes.
|
|
2353
1898
|
repairAgentConfigSymlinks();
|
|
2354
|
-
// Repair self-referential node_modules/.bin/<cli> symlinks (the droid
|
|
2355
|
-
// infinite-exec-loop). Also runs after the bucket moves so it scans the
|
|
2356
|
-
// canonical HISTORY_DIR/versions tree.
|
|
2357
1899
|
repairSelfReferentialBinShims();
|
|
2358
|
-
// Version-skew one-shot (RUSH-2435): retrofit the current pane-died hook
|
|
2359
|
-
// onto any managed tmux session an older binary left with a stale one. Runs
|
|
2360
|
-
// at upgrade time in addition to the daemon-startup call (daemon.ts) so a
|
|
2361
|
-
// machine that upgrades without immediately restarting its daemon still
|
|
2362
|
-
// repairs on the next `agents` invocation. Idempotent/non-destructive.
|
|
2363
1900
|
try {
|
|
2364
1901
|
const { reconcileSessionHooks } = await import('../tmux/session.js');
|
|
2365
1902
|
const { isTmuxInstalled } = await import('../tmux/binary.js');
|
|
@@ -2367,15 +1904,11 @@ export async function runMigration() {
|
|
|
2367
1904
|
await reconcileSessionHooks();
|
|
2368
1905
|
}
|
|
2369
1906
|
catch {
|
|
2370
|
-
// best-effort — a migration must never fail because tmux wasn't reachable
|
|
2371
1907
|
}
|
|
2372
|
-
// PHNX-3940 T7: report leftover per-account installations. Dry-run only —
|
|
2373
|
-
// moving homes requires an explicit `agents accounts migrate --apply`.
|
|
2374
1908
|
try {
|
|
2375
1909
|
const { reportAccountSlotMigrationOnUpgrade } = await import('../accounts/migrate.js');
|
|
2376
1910
|
await reportAccountSlotMigrationOnUpgrade();
|
|
2377
1911
|
}
|
|
2378
1912
|
catch {
|
|
2379
|
-
// best-effort — a corrupt install must not block the rest of upgrade
|
|
2380
1913
|
}
|
|
2381
1914
|
}
|