@phnx-labs/agents-cli 1.23.17 → 1.23.19
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 +239 -0
- package/README.md +140 -165
- package/dist/bootstrap.js +11 -17
- package/dist/cli/command-registry.d.ts +1 -2
- package/dist/cli/command-registry.js +1 -10
- package/dist/commands/accounts.js +7 -7
- package/dist/commands/cloud-transcripts.d.ts +0 -1
- package/dist/commands/cloud-transcripts.js +2 -2
- package/dist/commands/cloud.js +2 -2
- package/dist/commands/config.js +1 -5
- package/dist/commands/cost.js +1 -1
- package/dist/commands/daemon-index.js +0 -1
- package/dist/commands/detach.d.ts +1 -1
- package/dist/commands/detach.js +10 -6
- package/dist/commands/doctor.js +11 -7
- package/dist/commands/exec.d.ts +0 -17
- package/dist/commands/exec.js +26 -72
- package/dist/commands/feed.d.ts +1 -1
- package/dist/commands/feed.js +3 -3
- package/dist/commands/focus.d.ts +11 -6
- package/dist/commands/focus.js +91 -31
- package/dist/commands/fork.d.ts +0 -1
- package/dist/commands/fork.js +7 -16
- package/dist/commands/harness-wizard.js +1 -1
- package/dist/commands/harness.js +1 -1
- package/dist/commands/insights.d.ts +0 -1
- package/dist/commands/insights.js +3 -7
- package/dist/commands/open.js +1 -1
- package/dist/commands/output.js +1 -1
- package/dist/commands/profiles.d.ts +1 -1
- package/dist/commands/profiles.js +2 -2
- package/dist/commands/projects-todo.js +10 -5
- package/dist/commands/projects.js +1 -1
- package/dist/commands/prune.js +1 -1
- package/dist/commands/ps.d.ts +8 -3
- package/dist/commands/ps.js +238 -110
- package/dist/commands/routines.js +1 -1
- package/dist/commands/send.js +1 -1
- package/dist/commands/sessions-backfill.d.ts +0 -1
- package/dist/commands/sessions-backfill.js +3 -6
- package/dist/commands/sessions-browser.d.ts +0 -10
- package/dist/commands/sessions-browser.js +19 -25
- package/dist/commands/sessions-migrate.d.ts +2 -2
- package/dist/commands/sessions-migrate.js +13 -13
- package/dist/commands/sessions-optimize.d.ts +0 -1
- package/dist/commands/sessions-optimize.js +0 -3
- package/dist/commands/sessions-picker.d.ts +0 -7
- package/dist/commands/sessions-picker.js +16 -310
- package/dist/commands/sessions-resume.d.ts +16 -15
- package/dist/commands/sessions-resume.js +101 -269
- package/dist/commands/sessions-stats.d.ts +0 -1
- package/dist/commands/sessions-stats.js +5 -8
- package/dist/commands/sessions-stop.d.ts +1 -1
- package/dist/commands/sessions-stop.js +8 -8
- package/dist/commands/sessions-trace.d.ts +1 -1
- package/dist/commands/sessions-trace.js +40 -17
- package/dist/commands/sessions-watch.js +2 -2
- package/dist/commands/sessions.test-fixture.d.ts +1 -0
- package/dist/commands/sessions.test-fixture.js +14 -0
- package/dist/commands/setup-browser.js +4 -4
- package/dist/commands/setup-computer.js +4 -4
- package/dist/commands/setup-fleet.js +1 -1
- package/dist/commands/setup-preferences.js +1 -1
- package/dist/commands/{sessions-backup-setup.d.ts → setup-session-backup.d.ts} +2 -2
- package/dist/commands/{sessions-backup-setup.js → setup-session-backup.js} +8 -8
- package/dist/commands/setup.js +3 -1
- package/dist/commands/ssh.js +4 -5
- package/dist/commands/sync.js +1 -1
- package/dist/commands/teams.js +2 -2
- package/dist/commands/utils.d.ts +0 -1
- package/dist/commands/utils.js +0 -10
- package/dist/index.js +0 -71
- package/dist/lib/account-registry.d.ts +3 -0
- package/dist/lib/account-registry.js +40 -0
- package/dist/lib/accounting/usage-sync.d.ts +1 -0
- package/dist/lib/accounting/usage-sync.js +20 -3
- package/dist/lib/accounting/usage.d.ts +4 -1
- package/dist/lib/accounting/usage.js +38 -6
- package/dist/lib/agent-spec/agents.js +12 -11
- package/dist/lib/analytics/mix-commands.js +1 -1
- package/dist/lib/auth-mint.js +2 -2
- package/dist/lib/browser-client.d.ts +0 -1
- package/dist/lib/browser-client.js +0 -3
- package/dist/lib/cloud/antigravity.js +1 -1
- package/dist/lib/cloud/cursor.js +3 -3
- package/dist/lib/cloud/store.d.ts +5 -1
- package/dist/lib/cloud/store.js +10 -3
- package/dist/lib/cloudflare/creds.js +2 -2
- package/dist/lib/computer/context.d.ts +4 -21
- package/dist/lib/computer/context.js +3 -24
- package/dist/lib/computer/policy.d.ts +0 -10
- package/dist/lib/computer/policy.js +0 -28
- package/dist/lib/computer-client.d.ts +0 -44
- package/dist/lib/computer-client.js +17 -121
- package/dist/lib/config-keys.d.ts +2 -2
- package/dist/lib/config-keys.js +1 -3
- package/dist/lib/crabbox/cli.js +1 -1
- package/dist/lib/daemon/account-state-daemon-service.js +9 -2
- package/dist/lib/daemon/self-update-service.js +1 -1
- package/dist/lib/device-config.d.ts +2 -1
- package/dist/lib/device-config.js +26 -39
- package/dist/lib/devices/connect.d.ts +1 -1
- package/dist/lib/devices/connect.js +3 -6
- package/dist/lib/devices/doctor-findings.d.ts +2 -1
- package/dist/lib/devices/doctor-findings.js +4 -4
- package/dist/lib/devices/health.d.ts +6 -0
- package/dist/lib/devices/health.js +11 -4
- package/dist/lib/exec.js +1 -1
- package/dist/lib/feed/activity.js +1 -1
- package/dist/lib/feed/watch.js +2 -1
- package/dist/lib/fleet/apply.d.ts +1 -1
- package/dist/lib/fleet/apply.js +6 -3
- package/dist/lib/fleet-shared-state.d.ts +2 -0
- package/dist/lib/fleet-shared-state.js +3 -1
- package/dist/lib/github/project-prs.js +14 -1
- package/dist/lib/help.d.ts +0 -1
- package/dist/lib/help.js +2 -10
- package/dist/lib/helper-versions.js +1 -1
- package/dist/lib/hosts/option.js +1 -1
- package/dist/lib/hosts/passthrough.d.ts +0 -1
- package/dist/lib/hosts/passthrough.js +2 -26
- package/dist/lib/hosts/reconnect.js +5 -5
- package/dist/lib/hosts/remote-cmd.d.ts +3 -5
- package/dist/lib/hosts/remote-cmd.js +15 -20
- package/dist/lib/hosts/remote-session-id.js +1 -1
- package/dist/lib/installations/active-check.js +1 -1
- package/dist/lib/installations/migrate.js +4 -15
- package/dist/lib/installations/versions.js +5 -4
- package/dist/lib/launch-log.js +3 -6
- package/dist/lib/owner-notify.d.ts +1 -6
- package/dist/lib/owner-notify.js +0 -2
- package/dist/lib/paths.d.ts +0 -1
- package/dist/lib/paths.js +0 -8
- package/dist/lib/permissions.js +1 -1
- package/dist/lib/project-root.d.ts +1 -0
- package/dist/lib/project-root.js +11 -3
- package/dist/lib/projects.js +2 -2
- package/dist/lib/quick-todo.d.ts +5 -1
- package/dist/lib/quick-todo.js +14 -1
- package/dist/lib/redact.d.ts +0 -1
- package/dist/lib/redact.js +0 -4
- package/dist/lib/remote-agents-json.d.ts +3 -1
- package/dist/lib/remote-agents-json.js +12 -8
- package/dist/lib/reserved-stores.js +1 -1
- package/dist/lib/scheduling/routines.d.ts +0 -1
- package/dist/lib/scheduling/routines.js +1 -1
- package/dist/lib/self-update.d.ts +1 -1
- package/dist/lib/self-update.js +59 -2
- package/dist/lib/session/active.d.ts +1 -1
- package/dist/lib/session/db.js +4 -4
- package/dist/lib/session/detached.d.ts +0 -1
- package/dist/lib/session/detached.js +0 -23
- package/dist/lib/session/discover.d.ts +2 -2
- package/dist/lib/session/glance-files.d.ts +21 -0
- package/dist/lib/session/glance-files.js +123 -0
- package/dist/lib/session/presentation.d.ts +3 -7
- package/dist/lib/session/presentation.js +4 -4
- package/dist/lib/session/preview-digest.d.ts +13 -0
- package/dist/lib/session/preview-digest.js +328 -0
- package/dist/lib/session/projection.js +1 -1
- package/dist/lib/session/remote/remote-list.d.ts +5 -2
- package/dist/lib/session/remote/remote-list.js +15 -8
- package/dist/lib/session/remote/watch.d.ts +2 -0
- package/dist/lib/session/remote/watch.js +90 -10
- package/dist/lib/session/remote-active.js +1 -1
- package/dist/lib/session/resume-command.d.ts +0 -1
- package/dist/lib/session/resume-command.js +1 -4
- package/dist/lib/session/resume-owner.d.ts +0 -2
- package/dist/lib/session/resume-owner.js +0 -6
- package/dist/lib/session/selection.d.ts +4 -5
- package/dist/lib/session/selection.js +2 -2
- package/dist/lib/session/sync/config.d.ts +0 -25
- package/dist/lib/session/sync/config.js +0 -62
- package/dist/lib/session/sync/managed-config.d.ts +0 -1
- package/dist/lib/session/sync/managed-config.js +0 -3
- package/dist/lib/session/sync/worker-template.js +1 -1
- package/dist/lib/sessions-client.d.ts +0 -16
- package/dist/lib/sessions-client.js +1 -187
- package/dist/lib/smart-launch.js +6 -1
- package/dist/lib/startup/command-registry.d.ts +2 -0
- package/dist/lib/startup/command-registry.js +36 -3
- package/dist/lib/startup/root-command.d.ts +0 -1
- package/dist/lib/startup/root-command.js +0 -21
- package/dist/lib/sync-umbrella.js +1 -1
- package/dist/lib/teams/placement-probe.d.ts +2 -0
- package/dist/lib/teams/placement-probe.js +8 -3
- package/dist/lib/terminal/engine.d.ts +2 -0
- package/dist/lib/terminal/engine.js +5 -3
- package/dist/lib/terminal/index.d.ts +1 -1
- package/dist/lib/terminal/index.js +1 -1
- package/dist/lib/terminal/resolve.js +1 -1
- package/dist/lib/terminal/run-surface.d.ts +1 -0
- package/dist/lib/terminal/run-surface.js +9 -0
- package/dist/lib/watchdog/rotate.js +1 -1
- package/dist/lib/watchdog/watchdog.d.ts +1 -1
- package/dist/lib/watchdog/watchdog.js +2 -2
- package/package.json +1 -1
- package/dist/commands/browser.d.ts +0 -7
- package/dist/commands/browser.js +0 -139
- package/dist/commands/computer.d.ts +0 -48
- package/dist/commands/computer.js +0 -244
- package/dist/commands/resume.d.ts +0 -23
- package/dist/commands/resume.js +0 -158
- package/dist/commands/secrets-passthrough.d.ts +0 -3
- package/dist/commands/secrets-passthrough.js +0 -52
- package/dist/commands/sessions-bookmark.d.ts +0 -2
- package/dist/commands/sessions-bookmark.js +0 -92
- package/dist/commands/sessions-export.d.ts +0 -31
- package/dist/commands/sessions-export.js +0 -409
- package/dist/commands/sessions-import.d.ts +0 -6
- package/dist/commands/sessions-import.js +0 -343
- package/dist/commands/sessions-inject.d.ts +0 -14
- package/dist/commands/sessions-inject.js +0 -143
- package/dist/commands/sessions-picker-factory.d.ts +0 -24
- package/dist/commands/sessions-picker-factory.js +0 -59
- package/dist/commands/sessions-render.d.ts +0 -11
- package/dist/commands/sessions-render.js +0 -119
- package/dist/commands/sessions-share.d.ts +0 -15
- package/dist/commands/sessions-share.js +0 -171
- package/dist/commands/sessions.d.ts +0 -122
- package/dist/commands/sessions.js +0 -1760
- package/dist/lib/address.d.ts +0 -39
- package/dist/lib/address.js +0 -128
- package/dist/lib/computer/record.d.ts +0 -6
- package/dist/lib/computer/record.js +0 -25
- package/dist/lib/onepassword.d.ts +0 -57
- package/dist/lib/onepassword.js +0 -140
- package/dist/lib/openclaw-keychain.d.ts +0 -43
- package/dist/lib/openclaw-keychain.js +0 -227
- package/dist/lib/session/bundle.d.ts +0 -76
- package/dist/lib/session/bundle.js +0 -146
- package/dist/lib/session/remote/remote-bundle.d.ts +0 -7
- package/dist/lib/session/remote/remote-bundle.js +0 -40
- package/dist/lib/session/remote/remote.d.ts +0 -35
- package/dist/lib/session/remote/remote.js +0 -198
- package/dist/lib/session/remote-bundle.d.ts +0 -1
- package/dist/lib/session/remote-bundle.js +0 -1
- package/dist/lib/session/remote.d.ts +0 -1
- package/dist/lib/session/remote.js +0 -1
- package/dist/lib/session/sync/agents.d.ts +0 -24
- package/dist/lib/session/sync/agents.js +0 -0
- package/dist/lib/session/sync/backend.d.ts +0 -22
- package/dist/lib/session/sync/backend.js +0 -44
- package/dist/lib/session/sync/managed-key.d.ts +0 -5
- package/dist/lib/session/sync/managed-key.js +0 -87
- package/dist/lib/session/sync/net-client.d.ts +0 -29
- package/dist/lib/session/sync/net-client.js +0 -87
- package/dist/lib/session/sync/r2.d.ts +0 -20
- package/dist/lib/session/sync/r2.js +0 -103
- package/dist/lib/session/sync/transcript-crypto.d.ts +0 -41
- package/dist/lib/session/sync/transcript-crypto.js +0 -115
|
@@ -51,6 +51,5 @@ export interface TitleBackfillEnvelope {
|
|
|
51
51
|
}>;
|
|
52
52
|
}
|
|
53
53
|
export declare function runTitlesBackfill(options: TitleBackfillOptions): Promise<TitleBackfillEnvelope>;
|
|
54
|
-
export declare function registerSessionsBackfillCommand(sessionsCmd: Command): void;
|
|
55
54
|
export declare function registerBackfillCommand(parent: Command, invocation: string): void;
|
|
56
55
|
export {};
|
|
@@ -83,7 +83,7 @@ function parseRemoteBackfill(stdout, machine) {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
function peerArgs(options) {
|
|
86
|
-
const args = ['
|
|
86
|
+
const args = ['daemon', 'index', 'backfill', 'tools', '--json', '--local'];
|
|
87
87
|
if (options.agent)
|
|
88
88
|
args.push('--agent', options.agent);
|
|
89
89
|
if (options.project)
|
|
@@ -203,9 +203,6 @@ export async function runTitlesBackfill(options) {
|
|
|
203
203
|
...result,
|
|
204
204
|
};
|
|
205
205
|
}
|
|
206
|
-
export function registerSessionsBackfillCommand(sessionsCmd) {
|
|
207
|
-
registerBackfillCommand(sessionsCmd, 'agents sessions backfill');
|
|
208
|
-
}
|
|
209
206
|
export function registerBackfillCommand(parent, invocation) {
|
|
210
207
|
const backfill = parent.command('backfill').description('Populate derived session data explicitly.');
|
|
211
208
|
const tools = backfill
|
|
@@ -236,7 +233,7 @@ export function registerBackfillCommand(parent, invocation) {
|
|
|
236
233
|
- This command is the only historical transcript parse for tool indexing. Tool queries never trigger it.
|
|
237
234
|
- New and changed sessions are indexed during their normal incremental scan.
|
|
238
235
|
- No embeddings, vector database, network model, or semantic processing is used.
|
|
239
|
-
- Peers are driven with \`agents
|
|
236
|
+
- Peers are driven with \`agents daemon index backfill tools --local\`, so each peer needs agents 1.22.123 or newer.
|
|
240
237
|
`,
|
|
241
238
|
});
|
|
242
239
|
tools.action(async (_options, command) => {
|
|
@@ -285,7 +282,7 @@ export function registerBackfillCommand(parent, invocation) {
|
|
|
285
282
|
${invocation} resources --json
|
|
286
283
|
`,
|
|
287
284
|
notes: `
|
|
288
|
-
- Populates session_resource_usage for sessions indexed before the usage signal shipped. New/changed sessions are recorded on their normal scan; this is the one-shot catch-up read by \`agents
|
|
285
|
+
- Populates session_resource_usage for sessions indexed before the usage signal shipped. New/changed sessions are recorded on their normal scan; this is the one-shot catch-up read by \`agents insights resources\`.
|
|
289
286
|
- Local-only: the signal is derived per machine from its own transcripts. Run it on each box (or over \`agents ssh <host> ${invocation} resources\`).
|
|
290
287
|
- Reruns skip transcripts already current (resource_scan_ledger); bump the extractor version to force a full re-derive.
|
|
291
288
|
- Only slash commands and \`Skill\` tool calls are recorded — auto-triggered skills emit no signal.
|
|
@@ -34,16 +34,6 @@ export declare function activeBrowserSeed(opts: {
|
|
|
34
34
|
bookmarks?: boolean;
|
|
35
35
|
routine?: boolean | string;
|
|
36
36
|
}): Partial<BrowserFilter>;
|
|
37
|
-
export declare function bareBrowserSeed(opts: {
|
|
38
|
-
teams?: boolean;
|
|
39
|
-
agent?: string;
|
|
40
|
-
all?: boolean;
|
|
41
|
-
since?: string;
|
|
42
|
-
host?: string[];
|
|
43
|
-
inTeam?: string;
|
|
44
|
-
bookmarks?: boolean;
|
|
45
|
-
routine?: boolean | string;
|
|
46
|
-
}): Partial<BrowserFilter>;
|
|
47
37
|
export declare function remotePoolArgs(f: BrowserFilter, fixedFilters: boolean): string[];
|
|
48
38
|
export declare function liveRowKey(a: ActiveSession, self: string): string;
|
|
49
39
|
export declare function indexLiveRows(rows: ActiveSession[], self: string): Map<string, ActiveSession>;
|
|
@@ -58,12 +58,24 @@ export function cycleWindow(current) {
|
|
|
58
58
|
function distinct(values) {
|
|
59
59
|
return [...new Set(values.filter((v) => !!v))].sort();
|
|
60
60
|
}
|
|
61
|
+
// A live view is reproduced by `agents ps`, a history view by the standalone `sessions` CLI.
|
|
61
62
|
export function browserFilterToArgv(f, query = '') {
|
|
63
|
+
if (f.running || f.statuses.length > 0) {
|
|
64
|
+
const live = ['agents', 'ps'];
|
|
65
|
+
if (f.statuses.length > 0)
|
|
66
|
+
live.push('--status', f.statuses.join(','));
|
|
67
|
+
if (f.device)
|
|
68
|
+
live.push('-D', f.device);
|
|
69
|
+
if (f.bookmarks)
|
|
70
|
+
live.push('--bookmarks');
|
|
71
|
+
if (f.routine) {
|
|
72
|
+
live.push('--routine');
|
|
73
|
+
if (typeof f.routine === 'string')
|
|
74
|
+
live.push(f.routine);
|
|
75
|
+
}
|
|
76
|
+
return live;
|
|
77
|
+
}
|
|
62
78
|
const a = ['sessions'];
|
|
63
|
-
if (f.statuses.length === 0 && f.running)
|
|
64
|
-
a.push('--active');
|
|
65
|
-
for (const status of f.statuses)
|
|
66
|
-
a.push(`--${status === 'orphaned' ? 'orphan' : status}`);
|
|
67
79
|
if (f.teams)
|
|
68
80
|
a.push('--teams');
|
|
69
81
|
if (f.bookmarks)
|
|
@@ -91,8 +103,6 @@ export function browserFilterToArgv(f, query = '') {
|
|
|
91
103
|
a.push('--skill', f.skill);
|
|
92
104
|
if (f.plugin)
|
|
93
105
|
a.push('--plugin', f.plugin);
|
|
94
|
-
if (f.unmanaged)
|
|
95
|
-
a.push('--unmanaged');
|
|
96
106
|
if (f.sort !== 'timestamp')
|
|
97
107
|
a.push('--sort', f.sort === 'cost' ? 'cost' : 'duration');
|
|
98
108
|
if (f.limit !== 500)
|
|
@@ -120,21 +130,6 @@ export function activeBrowserSeed(opts) {
|
|
|
120
130
|
statuses: [],
|
|
121
131
|
};
|
|
122
132
|
}
|
|
123
|
-
export function bareBrowserSeed(opts) {
|
|
124
|
-
const scoped = (opts.host?.length ?? 0) > 0;
|
|
125
|
-
const wholeTeam = !!opts.inTeam;
|
|
126
|
-
return {
|
|
127
|
-
teams: !!opts.teams,
|
|
128
|
-
bookmarks: !!opts.bookmarks,
|
|
129
|
-
routine: opts.routine ?? false,
|
|
130
|
-
agent: opts.agent,
|
|
131
|
-
device: opts.host?.length === 1 ? normalizeDeviceSeed(opts.host[0]) : undefined,
|
|
132
|
-
team: opts.inTeam,
|
|
133
|
-
projectScope: opts.all || scoped || wholeTeam ? 'all' : 'repo',
|
|
134
|
-
window: opts.since ?? (opts.all || wholeTeam ? undefined : '30d'),
|
|
135
|
-
statuses: [],
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
133
|
function copyToClipboard(text) {
|
|
139
134
|
const candidates = process.platform === 'darwin'
|
|
140
135
|
? [['pbcopy', []]]
|
|
@@ -190,6 +185,7 @@ async function fetchRawPool(f, self, local, hosts, fixedFilters = false) {
|
|
|
190
185
|
const forwarded = remotePoolArgs(f, fixedFilters);
|
|
191
186
|
const remoteResult = await gatherRemoteList(forwarded, remoteHosts, {
|
|
192
187
|
timeoutMs: BROWSER_PEER_TIMEOUT_MS,
|
|
188
|
+
bin: 'sessions',
|
|
193
189
|
});
|
|
194
190
|
unreachable = remoteResult.unreachable;
|
|
195
191
|
if (remoteResult.sessions.length > 0)
|
|
@@ -203,7 +199,7 @@ async function fetchRawPool(f, self, local, hosts, fixedFilters = false) {
|
|
|
203
199
|
return { key: poolCacheKey(f), rows, unreachable };
|
|
204
200
|
}
|
|
205
201
|
export function remotePoolArgs(f, fixedFilters) {
|
|
206
|
-
const forwarded = ['
|
|
202
|
+
const forwarded = ['--all', '--json', '--local', '--limit', String(f.team ? WHOLE_TEAM_POOL_LIMIT : f.limit)];
|
|
207
203
|
if (f.window)
|
|
208
204
|
forwarded.push('--since', f.window);
|
|
209
205
|
if (f.until)
|
|
@@ -219,8 +215,6 @@ export function remotePoolArgs(f, fixedFilters) {
|
|
|
219
215
|
forwarded.push('--skill', f.skill);
|
|
220
216
|
if (f.plugin)
|
|
221
217
|
forwarded.push('--plugin', f.plugin);
|
|
222
|
-
if (f.unmanaged)
|
|
223
|
-
forwarded.push('--unmanaged');
|
|
224
218
|
if (f.sort !== 'timestamp')
|
|
225
219
|
forwarded.push('--sort', f.sort === 'cost' ? 'cost' : 'duration');
|
|
226
220
|
if (f.agent && (fixedFilters || f.agent.includes('@')))
|
|
@@ -486,7 +480,7 @@ export async function runSessionBrowser(initial = {}, opts = {}) {
|
|
|
486
480
|
return { flash: on ? `★ bookmarked ${active.shortId}` : `☆ unbookmarked ${active.shortId}`, reload: true };
|
|
487
481
|
}
|
|
488
482
|
if (name === 'y' || name === 'Y') {
|
|
489
|
-
const cmd =
|
|
483
|
+
const cmd = browserFilterToArgv(f, query).join(' ');
|
|
490
484
|
const ok = copyToClipboard(cmd);
|
|
491
485
|
return ok ? `copied: ${cmd}` : cmd;
|
|
492
486
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Command } from 'commander';
|
|
2
2
|
import type { SessionMeta } from '@phnx-labs/sessions-cli/reader';
|
|
3
3
|
type MigrateMode = 'resume' | 'rehydrate';
|
|
4
|
-
export declare function registerSessionsMigrateCommand(sessionsCmd: Command
|
|
4
|
+
export declare function registerSessionsMigrateCommand(sessionsCmd: Command): void;
|
|
5
5
|
export declare function effectiveMode(source: SessionMeta, requested: MigrateMode): {
|
|
6
6
|
mode: MigrateMode;
|
|
7
7
|
downgraded: boolean;
|
|
@@ -17,5 +17,5 @@ export declare function buildMigrateResumeCommands(opts: {
|
|
|
17
17
|
socketFlag: string;
|
|
18
18
|
};
|
|
19
19
|
export declare function rehydrateCommand(source: SessionMeta): string[];
|
|
20
|
-
export declare function registerSessionsMigrationsCommand(sessionsCmd: Command
|
|
20
|
+
export declare function registerSessionsMigrationsCommand(sessionsCmd: Command): void;
|
|
21
21
|
export {};
|
|
@@ -25,7 +25,7 @@ import { itemPicker } from '../lib/picker.js';
|
|
|
25
25
|
import { isInteractiveTerminal, isPromptCancelled } from './utils.js';
|
|
26
26
|
import { setHelpSections } from '../lib/help.js';
|
|
27
27
|
import { recordMigration, readMigrations } from '../lib/session/migrations.js';
|
|
28
|
-
export function registerSessionsMigrateCommand(sessionsCmd
|
|
28
|
+
export function registerSessionsMigrateCommand(sessionsCmd) {
|
|
29
29
|
const cmd = sessionsCmd
|
|
30
30
|
.command('migrate [session-id]')
|
|
31
31
|
.alias('relocate')
|
|
@@ -39,30 +39,30 @@ export function registerSessionsMigrateCommand(sessionsCmd, group = 'sessions')
|
|
|
39
39
|
setHelpSections(cmd, {
|
|
40
40
|
examples: `
|
|
41
41
|
# Move the session in THIS pane onto the least-busy fleet worker
|
|
42
|
-
agents
|
|
42
|
+
agents ps migrate --auto
|
|
43
43
|
|
|
44
44
|
# Move a specific session onto a named host
|
|
45
|
-
agents
|
|
45
|
+
agents ps migrate a1b2c3d4 --device yosemite-s1
|
|
46
46
|
|
|
47
47
|
# Spin up a fresh ephemeral box and move onto it
|
|
48
|
-
agents
|
|
48
|
+
agents ps migrate --lease
|
|
49
49
|
|
|
50
50
|
# Copy (don't stop the source), letting the agent wrap up its own dirty tree
|
|
51
|
-
agents
|
|
51
|
+
agents ps migrate --device box-a --keep --agent-wrapup
|
|
52
52
|
`,
|
|
53
53
|
notes: `
|
|
54
54
|
- Without a [session-id], migrate resolves the session running in THIS tmux pane ($TMUX_PANE).
|
|
55
55
|
- Default --mode rehydrate: the transcript is shipped to the target and the agent reads it there
|
|
56
|
-
with '
|
|
56
|
+
with 'sessions <id>' (its own judgment on --last/--include so long tool output can't
|
|
57
57
|
blow context), then continues. Robust across every harness.
|
|
58
58
|
- --mode resume attempts a native '<agent> --resume' on the target — faithful, but best-effort:
|
|
59
59
|
the target agent must have the session registered, so migrate falls back to rehydrate when it can't.
|
|
60
60
|
- The source is stopped only AFTER the target's session is confirmed live; --keep skips the stop (copy).
|
|
61
|
-
- Every migrate appends to the ledger — see 'agents
|
|
61
|
+
- Every migrate appends to the ledger — see 'agents ps migrations' for where each session went.
|
|
62
62
|
`,
|
|
63
63
|
});
|
|
64
64
|
cmd.action(async (sessionId, options) => {
|
|
65
|
-
await sessionsMigrateAction(sessionId, options
|
|
65
|
+
await sessionsMigrateAction(sessionId, options);
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
function fail(message) {
|
|
@@ -368,14 +368,14 @@ export function rehydrateCommand(source) {
|
|
|
368
368
|
const origin = source.machine ? ` from ${source.machine}` : '';
|
|
369
369
|
const prompt = [
|
|
370
370
|
`You are continuing session ${source.shortId}, migrated to this machine${origin}.`,
|
|
371
|
-
`Its full transcript is here — read it with \`
|
|
371
|
+
`Its full transcript is here — read it with \`sessions ${source.shortId}\`.`,
|
|
372
372
|
`It supports --markdown, role filters (e.g. --include user,assistant), and --last N;`,
|
|
373
373
|
`use them so large tool outputs don't blow your context — skim the recent turns first,`,
|
|
374
374
|
`widen only if you need to, then continue the work where it left off.`,
|
|
375
375
|
].join(' ');
|
|
376
376
|
return [cli, prompt];
|
|
377
377
|
}
|
|
378
|
-
async function sessionsMigrateAction(sessionId, options
|
|
378
|
+
async function sessionsMigrateAction(sessionId, options) {
|
|
379
379
|
if (options.mode && options.mode !== 'resume' && options.mode !== 'rehydrate') {
|
|
380
380
|
fail(`--mode must be 'resume' or 'rehydrate' (got "${options.mode}").`);
|
|
381
381
|
}
|
|
@@ -411,7 +411,7 @@ async function sessionsMigrateAction(sessionId, options, group) {
|
|
|
411
411
|
}
|
|
412
412
|
recordMigration({ ...base, status: 'completed' });
|
|
413
413
|
console.log(chalk.green(`\nMigrated ${source.shortId} to ${target.name}${options.keep ? ' (copy)' : ''}.`) +
|
|
414
|
-
chalk.gray(` Tracked in 'agents
|
|
414
|
+
chalk.gray(` Tracked in 'agents ps migrations'.`));
|
|
415
415
|
}
|
|
416
416
|
async function stopSource(source, active) {
|
|
417
417
|
const mux = active?.provenance?.mux;
|
|
@@ -432,7 +432,7 @@ async function stopSource(source, active) {
|
|
|
432
432
|
else
|
|
433
433
|
console.log(chalk.yellow(` Source tmux session ${name} was already gone.`));
|
|
434
434
|
}
|
|
435
|
-
export function registerSessionsMigrationsCommand(sessionsCmd
|
|
435
|
+
export function registerSessionsMigrationsCommand(sessionsCmd) {
|
|
436
436
|
const cmd = sessionsCmd
|
|
437
437
|
.command('migrations')
|
|
438
438
|
.description('Show the migration ledger — sessions handed off to/from other machines.')
|
|
@@ -448,7 +448,7 @@ export function registerSessionsMigrationsCommand(sessionsCmd, group = 'sessions
|
|
|
448
448
|
return;
|
|
449
449
|
}
|
|
450
450
|
if (recs.length === 0) {
|
|
451
|
-
console.log(chalk.gray(`No migrations recorded yet. Move one: agents
|
|
451
|
+
console.log(chalk.gray(`No migrations recorded yet. Move one: agents ps migrate --auto`));
|
|
452
452
|
return;
|
|
453
453
|
}
|
|
454
454
|
recs.reverse();
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import { optimizeSessionSearchIndex } from '../lib/session/db.js';
|
|
3
3
|
import { setHelpSections } from '../lib/help.js';
|
|
4
|
-
export function registerSessionsOptimizeCommand(sessionsCmd) {
|
|
5
|
-
registerOptimizeCommand(sessionsCmd, 'agents sessions optimize');
|
|
6
|
-
}
|
|
7
4
|
export function registerOptimizeCommand(parent, invocation) {
|
|
8
5
|
const cmd = parent
|
|
9
6
|
.command('optimize')
|
|
@@ -24,11 +24,6 @@ export declare function setPeerDigestFetcherForTest(fetcher?: typeof fetchPeerPr
|
|
|
24
24
|
export declare function clearRemoteDigestCacheForTest(): void;
|
|
25
25
|
export declare function sanitizeRemoteDigest(raw: unknown): SessionPreviewDigest | undefined;
|
|
26
26
|
export declare function clearPreviewMemoryCacheForTest(): void;
|
|
27
|
-
export declare function loadSessionPreviewDigest(session: SessionMeta): {
|
|
28
|
-
digest?: SessionPreviewDigest;
|
|
29
|
-
events: SessionEvent[];
|
|
30
|
-
error?: string;
|
|
31
|
-
};
|
|
32
27
|
export declare function buildPreview(session: SessionMeta): string;
|
|
33
28
|
export declare function formatFanOut(session: SessionMeta, derived?: {
|
|
34
29
|
subAgentCount?: number;
|
|
@@ -40,8 +35,6 @@ export declare function extractTiming(session: Pick<SessionMeta, 'timestamp' | '
|
|
|
40
35
|
lastActiveAgo?: string;
|
|
41
36
|
duration?: string;
|
|
42
37
|
};
|
|
43
|
-
export declare function buildSessionPreviewDigest(events: SessionEvent[], session: SessionMeta): SessionPreviewDigest;
|
|
44
|
-
export declare function relativizeDir(filePath: string, cwd?: string): string | undefined;
|
|
45
38
|
export declare function renderLastResponse(content: string, maxLines?: number, width?: number): string[];
|
|
46
39
|
export declare function sessionPicker(config: SessionPickerConfig): Promise<PickedSession | null>;
|
|
47
40
|
export declare function pickSessionInteractive(sessions: SessionMeta[], message?: string, initialSearch?: string, hiddenCount?: number, enterHint?: string, scope?: SessionSearchScope): Promise<PickedSession | null>;
|