@phnx-labs/agents-cli 1.23.17 → 1.23.18
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 +66 -0
- package/README.md +140 -165
- package/dist/bootstrap.js +10 -16
- 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 +1 -1
- package/dist/commands/config.js +0 -4
- 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 +5 -5
- package/dist/commands/exec.js +10 -22
- package/dist/commands/feed.d.ts +1 -1
- package/dist/commands/feed.js +3 -3
- package/dist/commands/focus.d.ts +1 -4
- package/dist/commands/focus.js +12 -13
- 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.js +1 -1
- package/dist/commands/prune.js +1 -1
- package/dist/commands/ps.d.ts +0 -1
- package/dist/commands/ps.js +63 -18
- 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.js +11 -11
- 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 +6 -6
- 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/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/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 +1 -1
- package/dist/lib/config-keys.js +0 -3
- package/dist/lib/crabbox/cli.js +1 -1
- package/dist/lib/device-config.js +5 -28
- 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/exec.js +1 -1
- package/dist/lib/feed/activity.js +1 -1
- package/dist/lib/fleet/apply.js +1 -1
- package/dist/lib/help.d.ts +0 -1
- package/dist/lib/help.js +2 -10
- 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 +1 -1
- 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/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 +8 -6
- 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/session/active.d.ts +1 -1
- package/dist/lib/session/db.js +3 -3
- 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/presentation.d.ts +0 -7
- package/dist/lib/session/presentation.js +4 -4
- package/dist/lib/session/projection.js +1 -1
- package/dist/lib/session/remote/remote-list.d.ts +2 -0
- package/dist/lib/session/remote/remote-list.js +3 -2
- package/dist/lib/session/remote/watch.js +4 -5
- 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/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/terminal/resolve.js +1 -1
- 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/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
package/dist/commands/harness.js
CHANGED
|
@@ -391,7 +391,7 @@ Examples:
|
|
|
391
391
|
# Copy an existing harness and swap only the model
|
|
392
392
|
agents harness fork deepseek deepseek-chat --model deepseek/deepseek-chat-v3
|
|
393
393
|
|
|
394
|
-
# Attach an account whose credential came from
|
|
394
|
+
# Attach an account whose credential came from a secrets bundle
|
|
395
395
|
agents harness fork claude corp --model gpt-x --account corp
|
|
396
396
|
|
|
397
397
|
# No args, in an interactive terminal: walks through source, preset/model, name, key
|
|
@@ -159,7 +159,7 @@ function renderReport(groups, dim, meta, actions, harnesses) {
|
|
|
159
159
|
out.push(chalk.bold('Insights') + chalk.gray(` ${scope} · ${meta.analyzed} of ${meta.scanned} sessions`));
|
|
160
160
|
if (groups.length === 0) {
|
|
161
161
|
out.push('');
|
|
162
|
-
out.push(chalk.gray(' No sessions in scope. Try a wider --since, or run `
|
|
162
|
+
out.push(chalk.gray(' No sessions in scope. Try a wider --since, or run `sessions --all` to index.'));
|
|
163
163
|
console.log(out.join('\n'));
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
@@ -236,7 +236,7 @@ function renderReport(groups, dim, meta, actions, harnesses) {
|
|
|
236
236
|
out.push(` ${padToWidth(action.priority, 7)} ${padToWidth(action.category, 11)} ` +
|
|
237
237
|
`${String(action.evidenceCount).padStart(8)} ${padToWidth(action.sampleSessionIds.join(', '), 25)} ${action.action}`);
|
|
238
238
|
}
|
|
239
|
-
out.push(chalk.gray(' drill into a sample session: agents
|
|
239
|
+
out.push(chalk.gray(' drill into a sample session: agents trace <id>'));
|
|
240
240
|
}
|
|
241
241
|
out.push('');
|
|
242
242
|
out.push(chalk.bold('What you changed'));
|
|
@@ -472,7 +472,7 @@ function configureInsightsCommand(cmd) {
|
|
|
472
472
|
agents insights --account "Turing Labs" --all
|
|
473
473
|
|
|
474
474
|
# Machine-readable, for a dashboard or a slash command
|
|
475
|
-
agents
|
|
475
|
+
agents insights --agent claude --agent codex --json
|
|
476
476
|
|
|
477
477
|
# Add a written read on what to change
|
|
478
478
|
agents insights --narrative
|
|
@@ -489,7 +489,6 @@ function configureInsightsCommand(cmd) {
|
|
|
489
489
|
The behavioural report parses in-scope transcripts once and caches facets; later runs
|
|
490
490
|
re-read only files that changed. \`--refresh\` forces a full re-read.
|
|
491
491
|
|
|
492
|
-
\`agents insights\` is the top-level alias of \`agents sessions insights\`.
|
|
493
492
|
Repeat \`--agent\` to compare several harnesses in one report.
|
|
494
493
|
|
|
495
494
|
Everything except \`--narrative\` is local and makes no network calls.
|
|
@@ -504,6 +503,3 @@ export function registerInsightsCommand(program) {
|
|
|
504
503
|
registerPerfSubcommand(cmd);
|
|
505
504
|
registerInsightsResourcesCommand(cmd);
|
|
506
505
|
}
|
|
507
|
-
export function registerSessionsInsightsCommand(sessions) {
|
|
508
|
-
configureInsightsCommand(sessions.command('insights'));
|
|
509
|
-
}
|
package/dist/commands/open.js
CHANGED
|
@@ -5,7 +5,7 @@ export function registerOpenCommand(program) {
|
|
|
5
5
|
const callback = program
|
|
6
6
|
.command('_callback [url]', { hidden: true })
|
|
7
7
|
.alias('open')
|
|
8
|
-
.description('OS callback that resumes a session from an agents:// deep link (machine-only; humans use `agents
|
|
8
|
+
.description('OS callback that resumes a session from an agents:// deep link (machine-only; humans use `agents run auto --resume <id>`).')
|
|
9
9
|
.action(async (url) => {
|
|
10
10
|
if (!url) {
|
|
11
11
|
callback.help();
|
package/dist/commands/output.js
CHANGED
|
@@ -330,7 +330,7 @@ function renderSingle(payload, scenario) {
|
|
|
330
330
|
out.push(...headerLines(payload, scenario));
|
|
331
331
|
out.push('');
|
|
332
332
|
if (payload.burn.sessionCount === 0) {
|
|
333
|
-
out.push(chalk.gray('No sessions with cost data found. Run `
|
|
333
|
+
out.push(chalk.gray('No sessions with cost data found. Run `sessions --all` to index, then retry.'));
|
|
334
334
|
console.log(out.join('\n'));
|
|
335
335
|
return;
|
|
336
336
|
}
|
|
@@ -15,7 +15,7 @@ export interface AddProfileOptions {
|
|
|
15
15
|
fromSecrets?: string;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* Copy a value from an `
|
|
18
|
+
* Copy a value from an `secrets` bundle into a profile's own keychain
|
|
19
19
|
* item — a one-time copy, not a live link. `spec` is `<bundle>` or
|
|
20
20
|
* `<bundle>:<key>`; the key is required only when the bundle has more than one.
|
|
21
21
|
*
|
|
@@ -48,7 +48,7 @@ export async function ensureProviderToken(provider, signupUrl, fromStdin) {
|
|
|
48
48
|
console.log(chalk.green(`Stored in keychain: ${item}`));
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
|
-
* Copy a value from an `
|
|
51
|
+
* Copy a value from an `secrets` bundle into a profile's own keychain
|
|
52
52
|
* item — a one-time copy, not a live link. `spec` is `<bundle>` or
|
|
53
53
|
* `<bundle>:<key>`; the key is required only when the bundle has more than one.
|
|
54
54
|
*
|
|
@@ -95,7 +95,7 @@ export async function applyFromSecrets(profile, spec, explicitAuthProvider, opts
|
|
|
95
95
|
catch (err) {
|
|
96
96
|
if (!isSecretsClientError(err, 'NOT_FOUND'))
|
|
97
97
|
throw err;
|
|
98
|
-
throw new Error(`Secrets bundle '${bundleName}' not found. List bundles with '
|
|
98
|
+
throw new Error(`Secrets bundle '${bundleName}' not found. List bundles with 'secrets list'.`);
|
|
99
99
|
}
|
|
100
100
|
const keys = Object.keys(bundle.vars);
|
|
101
101
|
const key = requestedKey ?? (keys.length === 1 ? keys[0] : undefined);
|
|
@@ -324,7 +324,7 @@ function renderCard(def, r, remote, fleet, linear, nowMs = Date.now(), milestone
|
|
|
324
324
|
warnings.push({
|
|
325
325
|
severity: crashed >= 10 ? 'critical' : 'continue',
|
|
326
326
|
text: `${crashed} crashed session${crashed === 1 ? '' : 's'} on this project`,
|
|
327
|
-
remediation: 'inspect with agents
|
|
327
|
+
remediation: 'inspect with agents ps --status crashed / clean up stuck worktrees',
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
330
|
for (const line of formatProjectWarnings(warnings))
|
package/dist/commands/prune.js
CHANGED
|
@@ -106,7 +106,7 @@ async function runSessionsPrune(options) {
|
|
|
106
106
|
console.log(chalk.gray('Session prune flags are accepted for compatibility but do not delete data.'));
|
|
107
107
|
}
|
|
108
108
|
console.log(chalk.yellow('Session history is durable. agents-cli does not hard-delete session records.'));
|
|
109
|
-
console.log(chalk.gray('Browse sessions with:
|
|
109
|
+
console.log(chalk.gray('Browse sessions with: sessions'));
|
|
110
110
|
}
|
|
111
111
|
async function runRunsPrune(options) {
|
|
112
112
|
const keep = options.keep ? parseInt(options.keep, 10) : 10;
|
package/dist/commands/ps.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export declare const PS_STATUSES: readonly LiveStatusFilter[];
|
|
|
4
4
|
export declare function statusFlags(values: string[] | undefined): LiveStatusFlags;
|
|
5
5
|
export declare function deviceScope(devices: string[] | undefined): string[] | undefined;
|
|
6
6
|
export declare function registerPsCommand(program: Command): void;
|
|
7
|
-
export declare function registerSessionPreviewCommand(parent: Command, group: 'ps' | 'sessions'): void;
|
|
8
7
|
export declare function renderSessionPreview(query: string, scope: {
|
|
9
8
|
agent?: string;
|
|
10
9
|
project?: string;
|
package/dist/commands/ps.js
CHANGED
|
@@ -6,13 +6,15 @@ import { isBookmarked } from '../lib/session/bookmarks.js';
|
|
|
6
6
|
import { discoverSessions, isCompleteSessionId } from '../lib/session/discover.js';
|
|
7
7
|
import { buildSessionDetailBlock, formatLiveStatusHeadline, notFoundByIdMessage, sessionTranscriptStamp } from '../lib/session/presentation.js';
|
|
8
8
|
import { runOnPeer, shouldIncludeLocal } from '../lib/session/remote-list.js';
|
|
9
|
-
import { applyScopeFilters, metadataResolveOutcome, resolveSessionMetadataValue, resolveSessionQuery, selectorAllowsEarlyExit } from '../lib/session/selection.js';
|
|
9
|
+
import { applyScopeFilters, computeLocalMetadataMatches, metadataResolveOutcome, resolveSessionMetadataValue, resolveSessionQuery, selectorAllowsEarlyExit, serializeResolvedSessionsJson } from '../lib/session/selection.js';
|
|
10
|
+
import { NO_FANOUT_ENV } from '../lib/session/remote-active.js';
|
|
10
11
|
import { loadLocalActiveSessions } from '../lib/session/session-cache.js';
|
|
11
12
|
import { machineId } from '../lib/session/sync/config.js';
|
|
12
13
|
import { registerSessionsStopCommand } from './sessions-stop.js';
|
|
13
14
|
import { registerFocusCommand } from './focus.js';
|
|
14
15
|
import { registerDetachCommand } from './detach.js';
|
|
15
16
|
import { registerSessionsMigrateCommand, registerSessionsMigrationsCommand } from './sessions-migrate.js';
|
|
17
|
+
import { registerSessionsWatchCommand } from './sessions-watch.js';
|
|
16
18
|
export const PS_STATUSES = [
|
|
17
19
|
'working',
|
|
18
20
|
'idle',
|
|
@@ -50,7 +52,7 @@ export function registerPsCommand(program) {
|
|
|
50
52
|
.option('--local', 'Only this machine; skip the fleet fan-out')
|
|
51
53
|
.option('-D, --device <target...>', 'Only these devices (alias from `agents devices`, user@host, or `all`; repeatable)')
|
|
52
54
|
.option('--status <state...>', `Only these live states: ${PS_STATUSES.join(', ')} (repeatable or comma-separated)`)
|
|
53
|
-
.option('--bookmarks', 'Only bookmarked sessions (bookmark one with `
|
|
55
|
+
.option('--bookmarks', 'Only bookmarked sessions (bookmark one with `sessions bookmark <id>`)')
|
|
54
56
|
.option('--routines, --routine [name]', 'Only routine-run sessions; pass a name to narrow to one routine (fuzzy name matching)')
|
|
55
57
|
.option('--no-interactive', 'Print the roster instead of opening the picker on a TTY');
|
|
56
58
|
setHelpSections(ps, {
|
|
@@ -79,12 +81,15 @@ export function registerPsCommand(program) {
|
|
|
79
81
|
|
|
80
82
|
# Where migrated sessions went
|
|
81
83
|
agents ps migrations
|
|
84
|
+
|
|
85
|
+
# Stream live and recoverable session rows for a long-lived UI
|
|
86
|
+
agents ps watch --json
|
|
82
87
|
`,
|
|
83
88
|
notes: `
|
|
84
89
|
- On a TTY with no --status, ps opens the session picker filtered to running
|
|
85
90
|
sessions: r toggles that filter, f focuses, enter resumes, y copies the command.
|
|
86
91
|
- Type into a running agent with: agents send --channel session --to <id> --text "continue"
|
|
87
|
-
- Resume an ended session with: agents run --resume <id>
|
|
92
|
+
- Resume an ended session with: agents run auto --resume <id>
|
|
88
93
|
- A session on another device is stopped, detached, or focused there over SSH.
|
|
89
94
|
- Put -D and --status after the verb or after the roster flags, never before a
|
|
90
95
|
verb: they take several values, so 'ps -D box stop <id>' reads 'stop' as a device.
|
|
@@ -110,14 +115,53 @@ export function registerPsCommand(program) {
|
|
|
110
115
|
routine: opts.routine,
|
|
111
116
|
});
|
|
112
117
|
});
|
|
113
|
-
registerSessionsStopCommand(ps
|
|
114
|
-
registerFocusCommand(ps
|
|
115
|
-
registerDetachCommand(ps
|
|
116
|
-
registerSessionsMigrateCommand(ps
|
|
117
|
-
registerSessionsMigrationsCommand(ps
|
|
118
|
-
registerSessionPreviewCommand(ps
|
|
118
|
+
registerSessionsStopCommand(ps);
|
|
119
|
+
registerFocusCommand(ps);
|
|
120
|
+
registerDetachCommand(ps);
|
|
121
|
+
registerSessionsMigrateCommand(ps);
|
|
122
|
+
registerSessionsMigrationsCommand(ps);
|
|
123
|
+
registerSessionPreviewCommand(ps);
|
|
124
|
+
registerSessionsWatchCommand(ps);
|
|
125
|
+
registerPeerResolveCommand(ps);
|
|
126
|
+
}
|
|
127
|
+
// Fleet protocol: a peer answers another box's selector or launch-id lookup from its own index.
|
|
128
|
+
function registerPeerResolveCommand(ps) {
|
|
129
|
+
ps.command('resolve', { hidden: true })
|
|
130
|
+
.argument('[selector]')
|
|
131
|
+
.option('--launch-id <id>')
|
|
132
|
+
.option('-a, --agent <agent>')
|
|
133
|
+
.option('-p, --project <name>')
|
|
134
|
+
.option('--json')
|
|
135
|
+
.option('--local')
|
|
136
|
+
.action(async (selector, _options, invoked) => {
|
|
137
|
+
const opts = invoked.optsWithGlobals();
|
|
138
|
+
if (!opts.json) {
|
|
139
|
+
console.error(chalk.red('ps resolve requires --json.'));
|
|
140
|
+
process.exit(1);
|
|
141
|
+
}
|
|
142
|
+
if (opts.launchId !== undefined) {
|
|
143
|
+
const launchId = opts.launchId.trim();
|
|
144
|
+
if (!launchId)
|
|
145
|
+
throw new Error('--launch-id requires a non-empty launch id.');
|
|
146
|
+
const { loadHookSessionIndex } = await import('../lib/session/hook-sessions.js');
|
|
147
|
+
const record = loadHookSessionIndex().byLaunchId.get(launchId);
|
|
148
|
+
process.stdout.write(JSON.stringify({ launchId, sessionId: record?.session_id ?? null }) + '\n');
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
if (process.env[NO_FANOUT_ENV] !== '1') {
|
|
152
|
+
console.error(chalk.red('ps resolve is an internal fleet protocol.'));
|
|
153
|
+
process.exit(1);
|
|
154
|
+
}
|
|
155
|
+
const trimmed = selector?.trim();
|
|
156
|
+
if (!trimmed) {
|
|
157
|
+
console.error(chalk.red('ps resolve requires a non-empty selector.'));
|
|
158
|
+
process.exit(1);
|
|
159
|
+
}
|
|
160
|
+
const matches = await computeLocalMetadataMatches(trimmed, { agent: opts.agent, project: opts.project, local: true });
|
|
161
|
+
process.stdout.write(serializeResolvedSessionsJson(matches));
|
|
162
|
+
});
|
|
119
163
|
}
|
|
120
|
-
|
|
164
|
+
function registerSessionPreviewCommand(parent) {
|
|
121
165
|
const previewCmd = parent
|
|
122
166
|
.command('preview')
|
|
123
167
|
.argument('<id>', 'Full session ID or displayed 8-character short ID')
|
|
@@ -131,24 +175,25 @@ export function registerSessionPreviewCommand(parent, group) {
|
|
|
131
175
|
.option('--revision <cursor>', 'Opaque caller-owned activity cursor (any stable value YOU track, e.g. your own feed\'s lastActivityMs) -- passing the SAME value as your last call confirms nothing changed and serves the cache with zero SSH indefinitely; a different value fetches once, still subject to backoff unless --refresh is also set (full ID + single --device only)');
|
|
132
176
|
setHelpSections(previewCmd, {
|
|
133
177
|
examples: `
|
|
134
|
-
# Preview by the 8-character ID shown in agents
|
|
135
|
-
agents
|
|
178
|
+
# Preview by the 8-character ID shown in agents ps
|
|
179
|
+
agents ps preview 407b8dd5
|
|
136
180
|
|
|
137
181
|
# A full UUID resolves on the first device that owns it
|
|
138
|
-
agents
|
|
182
|
+
agents ps preview c70ecdea-6210-4039-9845-246a3a7a9942
|
|
139
183
|
|
|
140
184
|
# Stay on this machine or restrict the authoritative lookup to one peer
|
|
141
|
-
agents
|
|
142
|
-
agents
|
|
185
|
+
agents ps preview 407b8dd5 --local
|
|
186
|
+
agents ps preview 407b8dd5 --device zion
|
|
143
187
|
|
|
144
188
|
# Full ID + one --device: durable-cached fast path (PHNX-3999); force a fresh fetch
|
|
145
|
-
agents
|
|
189
|
+
agents ps preview c70ecdea-6210-4039-9845-246a3a7a9942 --device zion --json --refresh
|
|
146
190
|
`,
|
|
147
191
|
notes: `
|
|
148
192
|
- Full UUIDs are globally unique and may stop the fleet lookup at the first exact hit.
|
|
149
193
|
- Short IDs wait for every selected device so ambiguity is never hidden.
|
|
150
194
|
- Active status is refreshed through the bounded live-state TTL; transcript-derived details use the durable session index.
|
|
151
|
-
- A full UUID with exactly one --device and --json is served from a local durable cache (~45s fresh window); the JSON envelope's "cache" field reports fresh/stale/offline state. --refresh forces one bounded re-fetch
|
|
195
|
+
- A full UUID with exactly one --device and --json is served from a local durable cache (~45s fresh window); the JSON envelope's "cache" field reports fresh/stale/offline state. --refresh forces one bounded re-fetch.
|
|
196
|
+
- Put -D after the verb: 'ps -D box preview <id>' reads 'preview' as a device.
|
|
152
197
|
`,
|
|
153
198
|
});
|
|
154
199
|
previewCmd.action(async (id) => {
|
|
@@ -226,7 +271,7 @@ export async function renderSessionPreview(query, scope) {
|
|
|
226
271
|
const session = outcome.session;
|
|
227
272
|
const transcriptPeer = transcriptOnPeerOf(session);
|
|
228
273
|
if (transcriptPeer) {
|
|
229
|
-
const args = ['
|
|
274
|
+
const args = ['ps', 'preview', session.id, '--local'];
|
|
230
275
|
if (scope.json)
|
|
231
276
|
args.push('--json');
|
|
232
277
|
const rendered = await runOnPeer(args, transcriptPeer);
|
|
@@ -1997,7 +1997,7 @@ export function registerRoutinesCommands(program) {
|
|
|
1997
1997
|
});
|
|
1998
1998
|
routinesCmd
|
|
1999
1999
|
.command('stop')
|
|
2000
|
-
.description('Stop only the scheduler service. The shared daemon and its
|
|
2000
|
+
.description('Stop only the scheduler service. The shared daemon and its other services (usage sync, session index, watchdog, and the rest) stay running.')
|
|
2001
2001
|
.action(() => {
|
|
2002
2002
|
const daemonRunning = isDaemonRunning();
|
|
2003
2003
|
setDaemonServiceEnabled('scheduler', false);
|
package/dist/commands/send.js
CHANGED
|
@@ -64,7 +64,7 @@ const SHARED_NOTES = `
|
|
|
64
64
|
|
|
65
65
|
--to owner posts one notification to your account (agents auth login). The
|
|
66
66
|
account's preferences, edited in the console Settings page, decide which of
|
|
67
|
-
email, Slack and iMessage it reaches;
|
|
67
|
+
email, Slack and iMessage it reaches; dedup applies there. A box
|
|
68
68
|
with no Phoenix session or worker device token fails loud instead. --to owner
|
|
69
69
|
takes no --channel, --thread or --attach.
|
|
70
70
|
|
|
@@ -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')
|
|
@@ -3,7 +3,7 @@ import path from 'node:path';
|
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import { truncate, humanDuration, formatBytes } from '../lib/format.js';
|
|
5
5
|
import { sessionDisplayAgent } from '@phnx-labs/sessions-cli/reader';
|
|
6
|
-
import { fetchPeerPreviewDigest } from '../lib/session/remote-list.js';
|
|
6
|
+
import { fetchPeerPreviewDigest, resolvePeerTarget, runOnPeer } from '../lib/session/remote-list.js';
|
|
7
7
|
import { parseSession, sanitizeForTerminal, SNAPSHOT_TODO_TOOLS } from '@phnx-labs/sessions-cli/reader';
|
|
8
8
|
import { readSessionTail, readSessionHead } from '@phnx-labs/sessions-cli/reader';
|
|
9
9
|
import { safeTeamText } from '@phnx-labs/sessions-cli/reader';
|
|
@@ -21,8 +21,8 @@ import { extractArtifacts, extractHooks, extractLinks, extractRepos, extractSkil
|
|
|
21
21
|
import { getSessionPlugins, readSessionPreviewCache, writeSessionPreviewCache, readSessionContent, readArchivedSessionPreview } from '../lib/session/db.js';
|
|
22
22
|
import { machineId } from '../lib/session/sync/config.js';
|
|
23
23
|
import { isPromptCancelled } from '../lib/format.js';
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
24
|
+
import { sessionOwnerDevice } from '../lib/session/resume-owner.js';
|
|
25
|
+
import { sessionRecoveryRunArgs } from '../lib/session/recovery.js';
|
|
26
26
|
import { resumeSessionInPlace } from '../lib/session/resume-command.js';
|
|
27
27
|
import { filterSessionsByQuery } from '../lib/session/selection.js';
|
|
28
28
|
import { formatPickerLabel, formatPickerTip, formatTeamHiddenFooter, formatTodoCompact, pickerColumnsFor, renderSession, } from '../lib/session/presentation.js';
|
|
@@ -987,15 +987,19 @@ export async function handlePickedSession(picked) {
|
|
|
987
987
|
if (isIdlessLiveRow(picked.session)) {
|
|
988
988
|
const where = picked.session.machine ? ` on ${picked.session.machine}` : '';
|
|
989
989
|
console.log(chalk.yellow(`This session hasn't reported a session id yet — nothing to open${where}.`));
|
|
990
|
-
console.log(chalk.gray(`Watch for it with: agents
|
|
990
|
+
console.log(chalk.gray(`Watch for it with: agents ps${picked.session.machine ? ` --device ${picked.session.machine}` : ''}`));
|
|
991
991
|
return;
|
|
992
992
|
}
|
|
993
993
|
if (picked.action === 'view') {
|
|
994
994
|
const readFrom = transcriptOnPeerOf(picked.session);
|
|
995
995
|
if (readFrom) {
|
|
996
|
-
const
|
|
997
|
-
if (
|
|
996
|
+
const peer = await resolvePeerTarget(readFrom);
|
|
997
|
+
if (!peer) {
|
|
998
998
|
warnNoPeerTarget(readFrom, picked.session);
|
|
999
|
+
return;
|
|
1000
|
+
}
|
|
1001
|
+
const { runSessions } = await import('../lib/sessions-client.js');
|
|
1002
|
+
process.exitCode = await runSessions([picked.session.id, '--markdown', '--host', `ssh://${peer.target}`]);
|
|
999
1003
|
return;
|
|
1000
1004
|
}
|
|
1001
1005
|
await renderSession(picked.session, 'summary', {});
|
|
@@ -1010,11 +1014,7 @@ async function resumeOnOwnerIfRemote(session) {
|
|
|
1010
1014
|
if (!owner)
|
|
1011
1015
|
return false;
|
|
1012
1016
|
console.log(chalk.gray(`Resuming ${session.shortId} on ${owner} over SSH...`));
|
|
1013
|
-
const rc = await runOnPeer(
|
|
1014
|
-
tty: true,
|
|
1015
|
-
env: { [RESUME_PINNED_ENV]: '1' },
|
|
1016
|
-
sessionId: session.id,
|
|
1017
|
-
});
|
|
1017
|
+
const rc = await runOnPeer(sessionRecoveryRunArgs(session), owner, { tty: true, sessionId: session.id });
|
|
1018
1018
|
if (rc === 'no-target')
|
|
1019
1019
|
warnNoPeerTarget(owner, session);
|
|
1020
1020
|
return true;
|