@phnx-labs/agents-cli 1.22.42 → 1.22.43

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.
Files changed (122) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/README.md +1 -1
  3. package/dist/bin/agents +0 -0
  4. package/dist/bootstrap.js +25 -7
  5. package/dist/cli/command-registry.d.ts +0 -3
  6. package/dist/cli/command-registry.js +0 -8
  7. package/dist/commands/alias.d.ts +7 -4
  8. package/dist/commands/alias.js +33 -8
  9. package/dist/commands/auth.js +7 -3
  10. package/dist/commands/computer.js +20 -6
  11. package/dist/commands/daemon.js +1 -1
  12. package/dist/commands/doctor.d.ts +4 -2
  13. package/dist/commands/doctor.js +20 -5
  14. package/dist/commands/exec.js +3 -2
  15. package/dist/commands/feed.js +1 -30
  16. package/dist/commands/harness.js +3 -3
  17. package/dist/commands/monitors.js +1 -1
  18. package/dist/commands/org.js +9 -8
  19. package/dist/commands/profiles.js +2 -2
  20. package/dist/commands/routines.js +43 -25
  21. package/dist/commands/sessions-picker.js +124 -122
  22. package/dist/commands/setup.js +5 -1
  23. package/dist/commands/snapshot.d.ts +1 -1
  24. package/dist/commands/snapshot.js +4 -4
  25. package/dist/commands/status.d.ts +4 -2
  26. package/dist/commands/status.js +10 -7
  27. package/dist/commands/sync.d.ts +1 -0
  28. package/dist/commands/sync.js +29 -2
  29. package/dist/commands/view.js +6 -0
  30. package/dist/commands/webhook.js +1 -1
  31. package/dist/lib/accounting/rotate.d.ts +5 -3
  32. package/dist/lib/accounting/rotate.js +36 -7
  33. package/dist/lib/accounting/usage.d.ts +18 -4
  34. package/dist/lib/accounting/usage.js +138 -27
  35. package/dist/lib/agent-spec/agents.d.ts +7 -7
  36. package/dist/lib/agent-spec/agents.js +15 -15
  37. package/dist/lib/cloud/rush.d.ts +0 -15
  38. package/dist/lib/cloud/rush.js +0 -35
  39. package/dist/lib/crabbox/runtimes.d.ts +6 -2
  40. package/dist/lib/crabbox/runtimes.js +21 -5
  41. package/dist/lib/daemon/daemon.js +86 -58
  42. package/dist/lib/daemon/runner.d.ts +18 -1
  43. package/dist/lib/daemon/runner.js +105 -11
  44. package/dist/lib/devices/doctor-findings.js +1 -1
  45. package/dist/lib/devices/health-report.js +1 -1
  46. package/dist/lib/drift-sync.d.ts +1 -1
  47. package/dist/lib/drift-sync.js +2 -2
  48. package/dist/lib/drift.d.ts +1 -1
  49. package/dist/lib/exec.js +13 -3
  50. package/dist/lib/format.d.ts +9 -0
  51. package/dist/lib/format.js +16 -0
  52. package/dist/lib/github/pr-mergeable.d.ts +49 -0
  53. package/dist/lib/github/pr-mergeable.js +157 -0
  54. package/dist/lib/github/pr-verdict.d.ts +67 -0
  55. package/dist/lib/github/pr-verdict.js +72 -0
  56. package/dist/lib/harness/adapter.d.ts +6 -5
  57. package/dist/lib/hosts/passthrough.d.ts +10 -0
  58. package/dist/lib/hosts/passthrough.js +28 -6
  59. package/dist/lib/hosts/session-index.js +1 -1
  60. package/dist/lib/installations/shims.js +1 -1
  61. package/dist/lib/installations/versions.d.ts +40 -0
  62. package/dist/lib/installations/versions.js +57 -2
  63. package/dist/lib/menubar/MenubarHelper.app/Contents/CodeResources +0 -0
  64. package/dist/lib/menubar/MenubarHelper.app/Contents/MacOS/MenubarHelper +0 -0
  65. package/dist/lib/menubar/install-menubar.js +19 -8
  66. package/dist/lib/monitors/config.d.ts +2 -2
  67. package/dist/lib/monitors/config.js +3 -2
  68. package/dist/lib/origin-machine.d.ts +18 -0
  69. package/dist/lib/origin-machine.js +34 -0
  70. package/dist/lib/perf/db.js +1 -1
  71. package/dist/lib/perf/spool.js +1 -1
  72. package/dist/lib/profiles.d.ts +7 -0
  73. package/dist/lib/profiles.js +26 -1
  74. package/dist/lib/sandbox.d.ts +24 -0
  75. package/dist/lib/sandbox.js +101 -0
  76. package/dist/lib/scheduling/routines.d.ts +18 -9
  77. package/dist/lib/scheduling/routines.js +16 -8
  78. package/dist/lib/secrets/Agents CLI.app/Contents/CodeResources +0 -0
  79. package/dist/lib/secrets/Agents CLI.app/Contents/MacOS/Agents CLI +0 -0
  80. package/dist/lib/secrets/agent.js +9 -1
  81. package/dist/lib/secrets/index.js +1 -1
  82. package/dist/lib/secrets/list-filter.js +1 -1
  83. package/dist/lib/service-manifest.d.ts +20 -0
  84. package/dist/lib/service-manifest.js +34 -0
  85. package/dist/lib/session/cloud.js +1 -1
  86. package/dist/lib/session/db.js +1 -1
  87. package/dist/lib/session/fork.js +1 -1
  88. package/dist/lib/session/live-metadata.js +1 -1
  89. package/dist/lib/session/origin-machine.d.ts +1 -18
  90. package/dist/lib/session/origin-machine.js +4 -34
  91. package/dist/lib/session/relative-time.d.ts +1 -44
  92. package/dist/lib/session/relative-time.js +4 -120
  93. package/dist/lib/session/remote-list.js +1 -1
  94. package/dist/lib/session/remote.js +2 -2
  95. package/dist/lib/session/short-id.d.ts +1 -17
  96. package/dist/lib/session/short-id.js +4 -20
  97. package/dist/lib/session/width.d.ts +1 -29
  98. package/dist/lib/session/width.js +4 -101
  99. package/dist/lib/snapshot.d.ts +2 -2
  100. package/dist/lib/snapshot.js +1 -1
  101. package/dist/lib/startup/command-registry.d.ts +4 -1
  102. package/dist/lib/startup/command-registry.js +11 -4
  103. package/dist/lib/teams/placement-probe.js +1 -1
  104. package/dist/lib/teams/scheduler.js +1 -1
  105. package/dist/lib/text/relative-time.d.ts +44 -0
  106. package/dist/lib/text/relative-time.js +120 -0
  107. package/dist/lib/text/short-id.d.ts +17 -0
  108. package/dist/lib/text/short-id.js +20 -0
  109. package/dist/lib/text/width.d.ts +29 -0
  110. package/dist/lib/text/width.js +101 -0
  111. package/dist/lib/triggers/handlers.d.ts +7 -0
  112. package/dist/lib/triggers/handlers.js +8 -0
  113. package/dist/lib/triggers/webhook.d.ts +1 -0
  114. package/dist/lib/triggers/webhook.js +2 -1
  115. package/dist/lib/view-types.d.ts +4 -0
  116. package/package.json +1 -1
  117. package/dist/commands/tickets.d.ts +0 -2
  118. package/dist/commands/tickets.js +0 -43
  119. package/dist/lib/observe-aliases.d.ts +0 -30
  120. package/dist/lib/observe-aliases.js +0 -38
  121. package/dist/lib/tickets/list.d.ts +0 -53
  122. package/dist/lib/tickets/list.js +0 -153
@@ -1,5 +1,6 @@
1
1
  import chalk from 'chalk';
2
2
  import { setHelpSections } from '../lib/help.js';
3
+ import { runOrDie } from '../lib/format.js';
3
4
  import { createSpace, createSpaceInvite, fetchWhoAmI, listSpaceMembers, listSpaces, removeSpaceMember, resolveMemberFromList, resolvePrixToken, resolveSpaceFromList, slugify, updateSpaceMemberRole, } from '../lib/prix-account.js';
4
5
  /** Every `agents org` subcommand needs a token up front — one place to say so. */
5
6
  function requireToken() {
@@ -138,28 +139,28 @@ export function registerOrgCommand(program) {
138
139
  .option('--slug <slug>', 'Override the derived slug')
139
140
  .option('--description <text>', 'Optional description')
140
141
  .option('--json', 'Machine-readable output')
141
- .action((name, o, command) => runCreate(name, { ...o, json: !!(o.json || command.optsWithGlobals().json) }));
142
+ .action((name, o, command) => { const json = !!(o.json || command.optsWithGlobals().json); return runOrDie(() => runCreate(name, { ...o, json }), { json }); });
142
143
  org.command('list').description('List spaces you own or belong to').option('--json', 'Machine-readable output')
143
- .action((o, command) => runList({ json: !!(o.json || command.optsWithGlobals().json) }));
144
+ .action((o, command) => { const json = !!(o.json || command.optsWithGlobals().json); return runOrDie(() => runList({ json }), { json }); });
144
145
  org.command('view [space]').description('Show one space (defaults to your only space)').option('--json', 'Machine-readable output')
145
- .action((space, o, command) => runView(space, { json: !!(o.json || command.optsWithGlobals().json) }));
146
+ .action((space, o, command) => { const json = !!(o.json || command.optsWithGlobals().json); return runOrDie(() => runView(space, { json }), { json }); });
146
147
  org.command('invite <email>').description('Invite (or directly add) a member')
147
148
  .option('--role <role>', 'admin | member', 'member')
148
149
  .option('--space <id-or-slug>', 'Space to invite into (defaults to your only space)')
149
150
  .option('--json', 'Machine-readable output')
150
- .action((email, o, command) => runInvite(email, { ...o, json: !!(o.json || command.optsWithGlobals().json) }));
151
+ .action((email, o, command) => { const json = !!(o.json || command.optsWithGlobals().json); return runOrDie(() => runInvite(email, { ...o, json }), { json }); });
151
152
  org.command('members [space]').description('List a space\'s members').option('--json', 'Machine-readable output')
152
- .action((space, o, command) => runMembers(space, { json: !!(o.json || command.optsWithGlobals().json) }));
153
+ .action((space, o, command) => { const json = !!(o.json || command.optsWithGlobals().json); return runOrDie(() => runMembers(space, { json }), { json }); });
153
154
  org.command('role <email> <role>').description('Change a member\'s role (owner-only for admin)')
154
155
  .option('--space <id-or-slug>', 'Space to change (defaults to your only space)')
155
156
  .option('--json', 'Machine-readable output')
156
- .action((email, role, o, command) => runRole(email, role, { ...o, json: !!(o.json || command.optsWithGlobals().json) }));
157
+ .action((email, role, o, command) => { const json = !!(o.json || command.optsWithGlobals().json); return runOrDie(() => runRole(email, role, { ...o, json }), { json }); });
157
158
  org.command('remove <email>').description('Remove a member from a space')
158
159
  .option('--space <id-or-slug>', 'Space to remove from (defaults to your only space)')
159
160
  .option('--json', 'Machine-readable output')
160
- .action((email, o, command) => runRemove(email, { ...o, json: !!(o.json || command.optsWithGlobals().json) }));
161
+ .action((email, o, command) => { const json = !!(o.json || command.optsWithGlobals().json); return runOrDie(() => runRemove(email, { ...o, json }), { json }); });
161
162
  org.command('leave [space]').description('Leave a space you do not own').option('--json', 'Machine-readable output')
162
- .action((space, o, command) => runLeave(space, { json: !!(o.json || command.optsWithGlobals().json) }));
163
+ .action((space, o, command) => { const json = !!(o.json || command.optsWithGlobals().json); return runOrDie(() => runLeave(space, { json }), { json }); });
163
164
  setHelpSections(org, {
164
165
  examples: `agents org create acme-team
165
166
  agents org list
@@ -191,7 +191,7 @@ export async function addProfile(name, opts, label = 'Profile') {
191
191
  authEnvVar,
192
192
  });
193
193
  if (account) {
194
- profile.account = account.id;
194
+ profile.account = account.name;
195
195
  profile.provider = account.provider;
196
196
  }
197
197
  if (opts.fromSecrets)
@@ -213,7 +213,7 @@ export async function addProfile(name, opts, label = 'Profile') {
213
213
  }
214
214
  const profile = profileFromPreset(name, preset, opts.version);
215
215
  if (account) {
216
- profile.account = account.id;
216
+ profile.account = account.name;
217
217
  profile.provider = account.provider;
218
218
  }
219
219
  if (opts.fromSecrets)
@@ -13,6 +13,7 @@ import * as yaml from 'yaml';
13
13
  import { isDaemonRunning, signalDaemonReload, startDaemon, stopDaemon, readDaemonLog, getDaemonStatus, getDaemonLogPath, } from '../lib/daemon/daemon.js';
14
14
  import { assertSchedulerEnabled, assertDaemonEnabled, isDaemonEnabled } from '../lib/device-config.js';
15
15
  import { parseAgentVersionSpec, isAgentHardDeprecated, hardDeprecationError, ROUTINE_AGENT_IDS } from '../lib/agents.js';
16
+ import { isCustomHarnessName } from '../lib/profiles.js';
16
17
  import { RUN_STRATEGIES, normalizeRunStrategy } from '../lib/accounting/rotate.js';
17
18
  import { formatRepoLink, REPO_DISPLAY_MAX } from '../lib/routines-format.js';
18
19
  import { listJobs as listAllJobs, deleteJob, readJob, validateJob, writeJob, setJobEnabled, listRuns, routineStats, getLatestRun, getRunDir, getJobPath, isCanonicalRoutineSource, parseAtTime, hasCompletedOneShotRun, isOneShotLikeSchedule, isOneShotRoutine, jobRunsOnThisDevice, checkJobDeviceEligibility, normalizeTriggerEvent, parseHostStrategy, resolveHostStrategy, HOST_STRATEGIES, computeProjectGroupKind, projectGroupKey, projectGroupTitle, projectGroupOrder, normalizeProjects, buildRoutineListJson, fireConditionLabel, nextRunForDisplay, nextRunLabel, localLatestRun, listJobsForDisplay, } from '../lib/scheduling/routines.js';
@@ -897,7 +898,7 @@ export function registerRoutinesCommands(program) {
897
898
  .command('add [nameOrPath]')
898
899
  .description('Create a new routine from a YAML file or inline flags. Starts the scheduler automatically if it is not already running.')
899
900
  .option('-s, --schedule <cron>', 'Cron schedule in standard format (5 fields: minute hour day month weekday)')
900
- .option('-a, --agent <agent[@version]>', `Which agent runs this routine: ${ROUTINE_AGENT_IDS.join(', ')}. An @version pins that exact installed version (same syntax as agents run), persisted as separate agent + version fields.`)
901
+ .option('-a, --agent <agent[@version]>', `Which agent runs this routine: ${ROUTINE_AGENT_IDS.join(', ')}, or a custom harness name (agents harness list). An @version pins that exact installed version (same syntax as agents run), persisted as separate agent + version fields; a custom harness pins its own host version.`)
901
902
  .option('--strategy <strategy>', `Version/account selection strategy for this routine: ${RUN_STRATEGIES.join(' | ')}. Overrides run.<agent>.strategy from the firing device's config. Conflicts with an @version pin.`)
902
903
  .option('--balanced', 'Shortcut for --strategy balanced.')
903
904
  .option('--workflow <name>', 'Run an installed workflow (~/.agents/workflows/<name>) via `agents run`. Mutually exclusive with --agent.')
@@ -984,17 +985,26 @@ export function registerRoutinesCommands(program) {
984
985
  // silently missed a hard-deprecated harness pinned with @version.
985
986
  let parsedAgent;
986
987
  if (options.agent) {
987
- const parsed = parseAgentVersionSpec(options.agent);
988
- if ('error' in parsed) {
989
- console.error(chalk.red(parsed.error));
990
- process.exit(1);
988
+ // A custom harness (agents harness list) is a valid routine agent:
989
+ // the runner delegates it to `agents run <name>`. It pins its own
990
+ // host version, so no @version suffix applies (a suffixed name falls
991
+ // through to the parse error below).
992
+ if (isCustomHarnessName(options.agent)) {
993
+ parsedAgent = { agent: options.agent };
991
994
  }
992
- parsedAgent = parsed;
993
- // Hard-deprecated harnesses cannot be scheduled — refuse at create time
994
- // so no new recurring job silently fails against a retired backend.
995
- if (isAgentHardDeprecated(parsed.agent)) {
996
- console.error(chalk.red(hardDeprecationError(parsed.agent)));
997
- process.exit(1);
995
+ else {
996
+ const parsed = parseAgentVersionSpec(options.agent);
997
+ if ('error' in parsed) {
998
+ console.error(chalk.red(parsed.error));
999
+ process.exit(1);
1000
+ }
1001
+ parsedAgent = parsed;
1002
+ // Hard-deprecated harnesses cannot be scheduled — refuse at create time
1003
+ // so no new recurring job silently fails against a retired backend.
1004
+ if (isAgentHardDeprecated(parsed.agent)) {
1005
+ console.error(chalk.red(hardDeprecationError(parsed.agent)));
1006
+ process.exit(1);
1007
+ }
998
1008
  }
999
1009
  }
1000
1010
  // --strategy / --balanced: per-routine selection policy, same vocabulary
@@ -1377,22 +1387,30 @@ export function registerRoutinesCommands(program) {
1377
1387
  if (options.projectAnchor !== undefined)
1378
1388
  existing.project = options.projectAnchor;
1379
1389
  if (options.agent !== undefined) {
1380
- const parsed = parseAgentVersionSpec(options.agent);
1381
- if ('error' in parsed) {
1382
- console.error(chalk.red(parsed.error));
1383
- process.exit(1);
1390
+ if (isCustomHarnessName(options.agent)) {
1391
+ // Custom harness: delegated to `agents run <name>`; the profile
1392
+ // pins its own host version, so any prior pin is cleared.
1393
+ existing.agent = options.agent;
1394
+ delete existing.version;
1384
1395
  }
1385
- if (isAgentHardDeprecated(parsed.agent)) {
1386
- console.error(chalk.red(hardDeprecationError(parsed.agent)));
1387
- process.exit(1);
1396
+ else {
1397
+ const parsed = parseAgentVersionSpec(options.agent);
1398
+ if ('error' in parsed) {
1399
+ console.error(chalk.red(parsed.error));
1400
+ process.exit(1);
1401
+ }
1402
+ if (isAgentHardDeprecated(parsed.agent)) {
1403
+ console.error(chalk.red(hardDeprecationError(parsed.agent)));
1404
+ process.exit(1);
1405
+ }
1406
+ existing.agent = parsed.agent;
1407
+ // An @version pin replaces any previous pin; a bare agent clears it so
1408
+ // the routine returns to strategy/balanced selection.
1409
+ if (parsed.version)
1410
+ existing.version = parsed.version;
1411
+ else
1412
+ delete existing.version;
1388
1413
  }
1389
- existing.agent = parsed.agent;
1390
- // An @version pin replaces any previous pin; a bare agent clears it so
1391
- // the routine returns to strategy/balanced selection.
1392
- if (parsed.version)
1393
- existing.version = parsed.version;
1394
- else
1395
- delete existing.version;
1396
1414
  }
1397
1415
  if (options.strategy !== undefined) {
1398
1416
  const normalized = normalizeRunStrategy(options.strategy);
@@ -386,7 +386,7 @@ export function buildPreview(session) {
386
386
  const header = formatHeader(safe, events);
387
387
  const body = parseError
388
388
  ? ' ' + chalk.red(`Failed to parse session: ${parseError}`)
389
- : formatCompactPreview(digest, safe);
389
+ : formatCompactPreview(digest, safe, events);
390
390
  const output = [header, '', body].filter(Boolean).join('\n');
391
391
  previewCache.set(cacheKey, output);
392
392
  return output;
@@ -398,8 +398,6 @@ const DOT = chalk.gray(' · ');
398
398
  function formatHeader(session, events) {
399
399
  const model = extractModel(events) || session.model;
400
400
  const { createdAgo, lastActiveAgo, duration } = extractTiming(session, events);
401
- const totalMessages = session.messageCount ?? countMessages(events);
402
- const totalTokens = session.tokenCount;
403
401
  // Line 1: Agent v version · shortId · model · account
404
402
  const line1 = [];
405
403
  line1.push(chalk.gray(`${displayAgent(session.agent)}${session.version ? ` v${session.version}` : ''}`));
@@ -429,18 +427,6 @@ function formatHeader(session, events) {
429
427
  line2.push(chalk.gray('last active ') + chalk.white(lastActiveAgo + ' ago'));
430
428
  if (duration)
431
429
  line2.push(chalk.gray('lasted ') + chalk.white(duration));
432
- // Line 3: N msgs · T tokens · [label ·] uuid
433
- const line3 = [];
434
- if (totalMessages !== undefined) {
435
- line3.push(chalk.bold.white(String(totalMessages)) + chalk.gray(` msg${totalMessages === 1 ? '' : 's'}`));
436
- }
437
- if (totalTokens !== undefined) {
438
- line3.push(chalk.bold.white(formatTokens(totalTokens)) + chalk.gray(' tokens'));
439
- }
440
- if (session.filePath)
441
- line3.push(chalk.gray(linkPath(session.filePath, session.id)));
442
- else
443
- line3.push(chalk.gray(session.id));
444
430
  // Line 4: ticket + PR — clickable when a URL is resolvable (OSC 8 hyperlink),
445
431
  // plain text otherwise. Only rendered when the session carries either.
446
432
  const line4 = [];
@@ -467,7 +453,6 @@ function formatHeader(session, events) {
467
453
  ...titleLines,
468
454
  line1.join(DOT),
469
455
  line2.join(DOT),
470
- line3.join(DOT),
471
456
  ...(line4.length ? [line4.join(DOT)] : []),
472
457
  ].join('\n');
473
458
  }
@@ -512,24 +497,20 @@ export function formatTeamLineage(session) {
512
497
  }
513
498
  function formatMetaOnlyBody(session) {
514
499
  const lines = [];
500
+ const termWidth = process.stdout.columns || 80;
501
+ const valueWidth = termWidth - VERB_GUTTER - 5;
502
+ // Same verb-led rows as the digest body (RUSH-2757), from SessionMeta alone.
515
503
  if (session.topic) {
516
- lines.push(chalk.cyan('Prompt: ') + chalk.white(truncate(session.topic.trim(), (process.stdout.columns || 80) - 12)));
517
- }
518
- const teamLine = formatTeamLineage(session);
519
- if (teamLine) {
520
- lines.push(chalk.cyan('Team: ') + teamLine);
504
+ lines.push(verbLabel('Asked') + chalk.white(`"${truncate(session.topic.trim(), valueWidth)}"`));
521
505
  }
522
506
  const compact = formatTodoCompact(session.todos);
523
- if (compact) {
524
- lines.push(chalk.cyan('Todos: ') + chalk.white(compact));
507
+ const teamLine = formatTeamLineage(session);
508
+ const doing = [compact ? chalk.white(compact) : '', teamLine].filter(Boolean);
509
+ if (doing.length) {
510
+ lines.push(verbLabel('Doing') + doing.join(DOT));
525
511
  }
526
- const termWidth = process.stdout.columns || 80;
527
512
  for (const l of session.todos?.items?.length ? renderTodos(session.todos.items, termWidth) : []) {
528
- lines.push(l);
529
- }
530
- const dirs = session.recentDirectoriesTouched?.slice(0, DIRS_TOUCHED_MAX) ?? [];
531
- if (dirs.length) {
532
- lines.push(chalk.cyan('Dirs: ') + chalk.white(dirs.join(chalk.gray(' · '))));
513
+ lines.push(' ' + l);
533
514
  }
534
515
  // `plan` is the whole ExitPlanMode markdown, not a path — summarize it. The
535
516
  // pane is height-clamped anyway, so pasting the blob would just push every
@@ -537,10 +518,24 @@ function formatMetaOnlyBody(session) {
537
518
  const planLines = session.plan?.trim() ? session.plan.trim().split('\n') : [];
538
519
  if (planLines.length) {
539
520
  const head = truncate(planLines[0].replace(/^#+\s*/, ''), termWidth - 20);
540
- lines.push(chalk.cyan('Plan: ') + chalk.white(head) + chalk.gray(` · ${planLines.length} lines`));
521
+ lines.push(verbLabel('Made') + chalk.white(head) + chalk.gray(` · plan, ${planLines.length} lines`));
541
522
  }
542
- if (lines.length === 0)
543
- return '';
523
+ const cost = [];
524
+ if (session.messageCount !== undefined) {
525
+ cost.push(chalk.white(String(session.messageCount)) + chalk.gray(` msg${session.messageCount === 1 ? '' : 's'}`));
526
+ }
527
+ if (session.tokenCount !== undefined) {
528
+ cost.push(chalk.white(formatTokens(session.tokenCount)) + chalk.gray(' tokens'));
529
+ }
530
+ if (cost.length) {
531
+ lines.push(verbLabel('Cost') + cost.join(DOT));
532
+ }
533
+ const dirs = session.recentDirectoriesTouched?.slice(0, DIRS_TOUCHED_MAX) ?? [];
534
+ const details = [
535
+ session.filePath ? chalk.gray(linkPath(session.filePath, session.id.slice(0, 8))) : chalk.gray(session.id.slice(0, 8)),
536
+ ...dirs.map(d => chalk.gray(d)),
537
+ ];
538
+ lines.push(verbLabel('Details ▸') + joinWidthCapped(details, valueWidth));
544
539
  return lines.map(l => ' ' + l).join('\n');
545
540
  }
546
541
  function extractModel(events) {
@@ -720,45 +715,42 @@ export function buildSessionPreviewDigest(events, session) {
720
715
  test: detectTestResult(events),
721
716
  };
722
717
  }
723
- function formatCompactPreview(digest, session) {
718
+ // Verb-led row gutter (RUSH-2757): every row label pads to this width so the
719
+ // values align into one scannable column. 'Details ▸' is the widest label.
720
+ const VERB_GUTTER = 9;
721
+ function verbLabel(v) {
722
+ return chalk.cyan(v.padEnd(VERB_GUTTER)) + ' ';
723
+ }
724
+ function formatCompactPreview(digest, session, events) {
724
725
  const { firstUser, lastAssistant, filesRead, toolCalls, planFile, todos, subAgentCount, toolTags, changes: chg, dirs, repos, artifacts, skills, plugins, hooks, links, errorCount, firstError, toolHistogram: hist, test, } = digest;
725
726
  const lines = [];
726
727
  const termWidth = process.stdout.columns || 80;
727
- // Originating user prompt (first non-system user turn).
728
- if (firstUser) {
729
- const first = extractSessionTopic(firstUser) || cleanSessionPrompt(firstUser).split('\n').find(l => l.trim()) || '';
730
- if (first) {
731
- lines.push(chalk.cyan('Prompt: ') + chalk.white(truncate(first.trim(), termWidth - 12)));
732
- }
728
+ const valueWidth = termWidth - VERB_GUTTER - 5;
729
+ // Asked — the originating user prompt (first non-system user turn), quoted.
730
+ const asked = firstUser
731
+ ? (extractSessionTopic(firstUser) || cleanSessionPrompt(firstUser).split('\n').find(l => l.trim()) || '')
732
+ : (session.topic && !isSyntheticUserMessage(session.topic) ? session.topic : '');
733
+ if (asked.trim()) {
734
+ lines.push(verbLabel('Asked') + chalk.white(`"${truncate(asked.trim(), valueWidth)}"`));
733
735
  }
734
- else if (session.topic && !isSyntheticUserMessage(session.topic)) {
735
- lines.push(chalk.cyan('Prompt: ') + chalk.white(truncate(session.topic.trim(), termWidth - 12)));
736
- }
737
- // Compact checklist: ✓done/total · current step (RUSH-2045).
736
+ // Doing the work in motion: checklist progress (RUSH-2045), team lineage,
737
+ // sub-agent fan-out. The full checklist renders indented beneath.
738
738
  const compact = formatTodoCompact(todos);
739
- if (compact) {
740
- lines.push(chalk.cyan('Todos: ') + chalk.white(compact));
741
- }
742
- const todosRendered = todos?.items?.length ? renderTodos(todos.items, termWidth) : [];
743
- if (todosRendered.length > 0) {
744
- for (const l of todosRendered)
745
- lines.push(' ' + l);
746
- }
747
- // Recent activity = directories touched (not raw tool calls). Prefer a
748
- // parser-supplied dirsTouched when present; else derive from event paths.
749
- // Width-capped: a long Dirs line used to wrap and swamp the whole pane.
750
- if (dirs.length) {
751
- lines.push(chalk.cyan('Dirs: ') + joinWidthCapped(dirs, termWidth - 12));
752
- }
753
- // Repos worked in (basename of each `.git` root under the touched paths).
754
- if (repos.length) {
755
- lines.push(chalk.cyan('Repos: ') + chalk.white(repos.slice(0, 4).join(chalk.gray(' · '))));
756
- }
757
739
  const teamLine = formatTeamLineage(session);
758
- if (teamLine) {
759
- lines.push(chalk.cyan('Team: ') + teamLine);
740
+ const doing = [
741
+ compact ? chalk.white(compact) : '',
742
+ teamLine,
743
+ subAgentCount ? chalk.gray(`${subAgentCount} sub-agent${subAgentCount === 1 ? '' : 's'}`) : '',
744
+ ].filter(Boolean);
745
+ if (doing.length) {
746
+ lines.push(verbLabel('Doing') + doing.join(DOT));
760
747
  }
761
- const activity = [];
748
+ const todosRendered = todos?.items?.length ? renderTodos(todos.items, termWidth) : [];
749
+ for (const l of todosRendered)
750
+ lines.push(' ' + l);
751
+ // Made — what the session produced: file deltas, reads, artifacts (named +
752
+ // clickable), the plan file, and the PR when the session carries one.
753
+ const made = [];
762
754
  const changed = chg.created + chg.modified + chg.deleted;
763
755
  if (changed) {
764
756
  const parts = [
@@ -766,71 +758,61 @@ function formatCompactPreview(digest, session) {
766
758
  chg.modified ? chalk.yellow(`~${chg.modified}`) : '',
767
759
  chg.deleted ? chalk.red(`−${chg.deleted}`) : '',
768
760
  ].filter(Boolean).join(' ');
769
- activity.push(`${parts} ${chalk.gray('changed')}`);
761
+ made.push(`${parts} ${chalk.gray('changed')}`);
770
762
  }
771
763
  if (filesRead)
772
- activity.push(chalk.gray(`${filesRead} read`));
773
- if (toolCalls)
774
- activity.push(chalk.gray(`${toolCalls} tool${toolCalls === 1 ? '' : 's'}`));
775
- if (activity.length) {
776
- lines.push(chalk.cyan('Changes: ') + activity.join(chalk.gray(' · ')));
777
- }
778
- // Documents the session produced (`.agents/artifacts|plans|reports`, other
779
- // *.md/*.html creations) — the files a human browses later, named + clickable.
764
+ made.push(chalk.gray(`${filesRead} read`));
780
765
  if (artifacts.length) {
781
- const shown = artifacts.slice(0, 5).map(a => linkPath(a.path, a.basename));
782
- const more = artifacts.length > 5 ? chalk.gray(` · +${artifacts.length - 5} more`) : '';
783
- lines.push(chalk.cyan('Artifacts: ') + shown.join(chalk.gray(' · ')) + more);
784
- }
785
- // Skills invoked (plugin skills included — they ride the same Skill tool).
786
- if (skills.length) {
787
- const shown = skills.slice(0, 5).map(s => chalk.white(s.name) + (s.count > 1 ? chalk.gray(` ×${s.count}`) : ''));
788
- const more = skills.length > 5 ? chalk.gray(` · +${skills.length - 5} more`) : '';
789
- lines.push(chalk.cyan('Skills: ') + shown.join(chalk.gray(' · ')) + more);
766
+ const shown = artifacts.slice(0, 2).map(a => linkPath(a.path, a.basename));
767
+ const more = artifacts.length > 2 ? chalk.gray(` +${artifacts.length - 2}`) : '';
768
+ made.push(shown.join(chalk.gray(' · ')) + more);
790
769
  }
791
- if (plugins.length) {
792
- lines.push(chalk.cyan('Plugins: ') + chalk.white(plugins.slice(0, 5).join(chalk.gray(' · '))));
770
+ if (planFile) {
771
+ made.push(chalk.white(linkPath(planFile, planFile.split('/').pop() || planFile)));
793
772
  }
794
- // Hooks fired (Claude transcripts record firings; other harnesses don't).
795
- if (hooks.length) {
796
- const shown = hooks.slice(0, 4).map(h => chalk.white(h.name) + (h.count > 1 ? chalk.gray(` ×${h.count}`) : '') + (h.failed ? chalk.red(` (${h.failed} failed)`) : ''));
797
- const more = hooks.length > 4 ? chalk.gray(` · +${hooks.length - 4} more`) : '';
798
- lines.push(chalk.cyan('Hooks: ') + shown.join(chalk.gray(' · ')) + more);
773
+ if (session.prUrl) {
774
+ made.push(chalk.blue(linkUrl(session.prUrl, session.prNumber ? `PR#${session.prNumber}` : 'PR')));
799
775
  }
800
- // Links mentioned in the conversation — clickable (OSC 8), tracker-classified.
801
- if (links.length) {
802
- const shown = links.slice(0, 5).map(l => chalk.blue(linkUrl(l.url, l.label)));
803
- const more = links.length > 5 ? chalk.gray(` · +${links.length - 5} more`) : '';
804
- lines.push(chalk.cyan('Links: ') + shown.join(chalk.gray(' · ')) + more);
776
+ if (made.length) {
777
+ lines.push(verbLabel('Made') + made.join(DOT));
805
778
  }
806
- // Error tally, mirroring the full summary's Errors section in one line.
779
+ // Health — error tally + the last test/build verdict; absent when both clean.
780
+ const health = [];
807
781
  if (errorCount) {
808
- lines.push(chalk.cyan('Errors: ') + chalk.red(`${errorCount} failure${errorCount === 1 ? '' : 's'}`) + chalk.gray(` — first: ${firstError || 'unknown'}`));
809
- }
810
- const metadata = [
811
- ...toolTags,
812
- subAgentCount ? `${subAgentCount} sub-agent${subAgentCount === 1 ? '' : 's'}` : '',
813
- ].filter(Boolean);
814
- if (metadata.length) {
815
- lines.push(chalk.cyan('Meta: ') + chalk.gray(metadata.join(' · ')));
816
- }
817
- // Tool mix (top 4) — what kind of work this was.
818
- if (hist.length) {
819
- lines.push(chalk.cyan('Tools: ') + chalk.gray(hist.map(h => `${h.tool} ${h.count}`).join(' · ')));
782
+ health.push(chalk.red(`${errorCount} failure${errorCount === 1 ? '' : 's'}`) + chalk.gray(` — first: ${firstError || 'unknown'}`));
820
783
  }
821
- // Last test/build verdict.
822
784
  if (test?.ok) {
823
785
  const bits = [
824
786
  test.passed !== undefined ? chalk.green(`${test.passed} pass`) : '',
825
787
  test.failed ? chalk.red(`${test.failed} fail`) : '',
826
788
  ].filter(Boolean).join(chalk.gray(' · '));
827
789
  const mark = test.failed ? chalk.red('✗') : chalk.green('✓');
828
- lines.push(chalk.cyan('Tests: ') + `${mark} ${test.runner}${bits ? ' ' + bits : ''}`);
790
+ health.push(`${mark} ${test.runner}${bits ? ' ' + bits : ''}`);
829
791
  }
830
- if (planFile) {
831
- const basename = planFile.split('/').pop() || planFile;
832
- lines.push(chalk.cyan('Plan: ') + chalk.white(linkPath(planFile, basename)));
792
+ if (health.length) {
793
+ lines.push(verbLabel('Health') + health.join(DOT));
794
+ }
795
+ // Cost — volume: messages, tokens (moved here from the header's old line 3),
796
+ // and the top of the tool mix.
797
+ const totalMessages = session.messageCount ?? (events ? countMessages(events) : undefined);
798
+ const cost = [];
799
+ if (totalMessages !== undefined) {
800
+ cost.push(chalk.white(String(totalMessages)) + chalk.gray(` msg${totalMessages === 1 ? '' : 's'}`));
801
+ }
802
+ if (session.tokenCount !== undefined) {
803
+ cost.push(chalk.white(formatTokens(session.tokenCount)) + chalk.gray(' tokens'));
804
+ }
805
+ if (hist.length) {
806
+ cost.push(chalk.gray(hist.map(h => `${h.tool} ${h.count}`).join(' · ')));
833
807
  }
808
+ else if (toolCalls) {
809
+ cost.push(chalk.gray(`${toolCalls} tool${toolCalls === 1 ? '' : 's'}`));
810
+ }
811
+ if (cost.length) {
812
+ lines.push(verbLabel('Cost') + cost.join(DOT));
813
+ }
814
+ // Latest — the agent's last message, full and wrapped to the pane (the densest
815
+ // line in the preview; parts 1-2 of RUSH-2757 made it wrap instead of clip).
834
816
  if (lastAssistant) {
835
817
  const maxLines = todosRendered.length > 0 || compact ? LAST_RESPONSE_MAX_LINES_WITH_TODOS : LAST_RESPONSE_MAX_LINES;
836
818
  // Content sits at column 4 (outer body indent + the ' ' prefix below), so
@@ -838,14 +820,28 @@ function formatCompactPreview(digest, session) {
838
820
  const rendered = renderLastResponse(lastAssistant, maxLines, terminalWidth() - 4);
839
821
  if (rendered.length > 0) {
840
822
  lines.push('');
841
- lines.push(chalk.cyan('Last response:'));
823
+ lines.push(chalk.cyan('Latest'));
842
824
  for (const l of rendered)
843
825
  lines.push(' ' + l);
844
826
  }
845
827
  }
846
- if (lines.length === 0) {
847
- lines.push(chalk.gray('No activity recorded in this session.'));
848
- }
828
+ // Details the folded long tail: session id, skills, plugins, hooks, links,
829
+ // dirs, repos, capability tags. One width-capped line instead of seven labeled
830
+ // rows (a long tail used to wrap and swamp the whole pane); links stay
831
+ // clickable (OSC 8), hook failures stay red. Full lists go to the cap — it is
832
+ // the ONLY bounding, so its `… +N more` tail accounts for every hidden item
833
+ // (pre-slicing here made overflow vanish with no trace).
834
+ const details = [
835
+ session.filePath ? chalk.gray(linkPath(session.filePath, session.id.slice(0, 8))) : chalk.gray(session.id.slice(0, 8)),
836
+ ...skills.map(s => chalk.white(s.name) + (s.count > 1 ? chalk.gray(` ×${s.count}`) : '')),
837
+ ...plugins.map(p => chalk.white(p)),
838
+ ...hooks.map(h => chalk.white(h.name) + (h.failed ? chalk.red(` (${h.failed} failed)`) : '')),
839
+ ...links.map(l => chalk.blue(linkUrl(l.url, l.label))),
840
+ ...dirs.map(d => chalk.gray(d)),
841
+ ...repos.map(r => chalk.gray(r)),
842
+ ...toolTags.map(t => chalk.gray(t)),
843
+ ];
844
+ lines.push(verbLabel('Details ▸') + joinWidthCapped(details, valueWidth));
849
845
  return lines.map(l => ' ' + l).join('\n');
850
846
  }
851
847
  function classifySessionTool(tool, command) {
@@ -928,20 +924,26 @@ const SLUG_WORKTREE_RE = /--agents-worktrees-(.+)$/;
928
924
  * Join display tokens with ` · `, stopping before the line exceeds `maxWidth`
929
925
  * and appending `… +N more` for the rest. Keeps the Dirs line on one row.
930
926
  */
927
+ /**
928
+ * Join pre-styled items with ` · ` up to a visible width, then `… +N more`.
929
+ * Width is measured ANSI-aware (stringWidth), so colored / OSC 8-linked items
930
+ * are not miscounted; items arrive already styled and are not recolored.
931
+ */
931
932
  function joinWidthCapped(items, maxWidth) {
932
- const sep = ' · ';
933
933
  let out = '';
934
+ let width = 0;
934
935
  let shown = 0;
935
936
  for (const item of items) {
936
- const next = shown === 0 ? item : out + sep + item;
937
- if (shown > 0 && next.length > maxWidth)
937
+ const itemWidth = stringWidth(item);
938
+ const nextWidth = shown === 0 ? itemWidth : width + 3 + itemWidth;
939
+ if (shown > 0 && nextWidth > maxWidth)
938
940
  break;
939
- out = next;
941
+ out = shown === 0 ? item : out + DOT + item;
942
+ width = nextWidth;
940
943
  shown++;
941
944
  }
942
945
  const remaining = items.length - shown;
943
- const suffix = remaining > 0 ? ` … +${remaining} more` : '';
944
- return chalk.white(out) + (suffix ? chalk.gray(suffix) : '');
946
+ return out + (remaining > 0 ? chalk.gray(` … +${remaining} more`) : '');
945
947
  }
946
948
  /** Relativize a file path to its parent dir, short enough for one preview line. */
947
949
  export function relativizeDir(filePath, cwd) {
@@ -25,6 +25,7 @@ import { registerSetupMineCommand } from './setup-mine.js';
25
25
  import { registerSetupSecretsCommand } from './setup-secrets.js';
26
26
  import { registerSetupFleetCommand } from './setup-fleet.js';
27
27
  import { registerSetupWatchdogCommand, runWatchdogSetupWizard } from './setup-watchdog.js';
28
+ import { registerAliasCommand } from './alias.js';
28
29
  import { runPreferencesStep } from './setup-preferences.js';
29
30
  import { getConfiguredDefaultProfileName, getProfile, getAutoDetectedProfile, isProfileLaunchableHere } from '../lib/browser/profiles.js';
30
31
  import { listInstalledBrowsers } from '../lib/browser/chrome.js';
@@ -362,7 +363,7 @@ export function registerSetupCommand(program) {
362
363
  .description('Set up agents-cli, or re-open the capability onboarding hub.')
363
364
  .option('-f, --force', 'Re-run setup even if ~/.agents/.system/ already exists (use with caution)')
364
365
  .option('--no-system-repo', 'Skip cloning the system repo (you must populate ~/.agents/.system/ yourself)');
365
- // Capability subcommands: `agents setup browser|computer|mine|secrets|fleet`.
366
+ // Capability subcommands: `agents setup browser|computer|mine|secrets|fleet|alias`.
366
367
  // Share/artifact publishing is set up by `agents artifacts setup` (RUSH-2580);
367
368
  // the hub below still offers it as a phase via runShareWizard.
368
369
  registerSetupBrowserCommand(setupCmd);
@@ -371,6 +372,7 @@ export function registerSetupCommand(program) {
371
372
  registerSetupSecretsCommand(setupCmd);
372
373
  registerSetupFleetCommand(setupCmd);
373
374
  registerSetupWatchdogCommand(setupCmd);
375
+ registerAliasCommand(setupCmd);
374
376
  setupCmd.command('status')
375
377
  .description('Show setup readiness for core, browser, computer, secrets, fleet, share, watchdog, and preferences.')
376
378
  .option('--json', 'print machine-readable JSON')
@@ -397,6 +399,7 @@ export function registerSetupCommand(program) {
397
399
  agents setup secrets
398
400
  agents setup fleet
399
401
  agents setup watchdog
402
+ agents setup alias add teams
400
403
  `,
401
404
  notes: `
402
405
  What it does:
@@ -412,6 +415,7 @@ export function registerSetupCommand(program) {
412
415
  agents setup secrets # choose secrets backend/policy defaults + import
413
416
  agents setup fleet # discover Tailscale devices + configure SSH access
414
417
  agents setup watchdog # choose which devices run the daemon watchdog pass
418
+ agents setup alias add teams # PATH shorthand: teams runs agents teams
415
419
 
416
420
  To install CLIs from agents.yaml and sync resources into version homes:
417
421
  agents sync --local -y
@@ -2,7 +2,7 @@
2
2
  * `agents devices snapshot` — one-process consumer snapshot for pollers.
3
3
  *
4
4
  * Replaces the N× `view --json` + `sessions --active --json` (+ optional feed)
5
- * fork storm with a single command. Does NOT replace `agents status`, which
5
+ * fork storm with a single command. Does NOT replace `agents sync status`, which
6
6
  * remains the UnifiedSyncStatus sync contract for menubar / Agency drift.
7
7
  *
8
8
  * JSON shape: {@link FleetSnapshot} in `lib/snapshot.ts` (version: 1).
@@ -2,7 +2,7 @@
2
2
  * `agents devices snapshot` — one-process consumer snapshot for pollers.
3
3
  *
4
4
  * Replaces the N× `view --json` + `sessions --active --json` (+ optional feed)
5
- * fork storm with a single command. Does NOT replace `agents status`, which
5
+ * fork storm with a single command. Does NOT replace `agents sync status`, which
6
6
  * remains the UnifiedSyncStatus sync contract for menubar / Agency drift.
7
7
  *
8
8
  * JSON shape: {@link FleetSnapshot} in `lib/snapshot.ts` (version: 1).
@@ -60,16 +60,16 @@ function renderHuman(snap) {
60
60
  console.log(` ${'Sync'.padEnd(12)} ${sys} · ${need} version${need === 1 ? '' : 's'} need sync`);
61
61
  }
62
62
  console.log(chalk.gray('\n Machine-readable: agents devices snapshot --json\n' +
63
- ' Sync-only (unchanged): agents status --json'));
63
+ ' Sync-only (unchanged): agents sync status --json'));
64
64
  }
65
65
  export function registerSnapshotCommand(devicesCmd) {
66
66
  const cmd = addHostOption(devicesCmd
67
67
  .command('snapshot')
68
- .description('One-process poll snapshot: install inventory + active sessions (optional feed/sync). Not the sync-status command — use `agents status` for drift.'))
68
+ .description('One-process poll snapshot: install inventory + active sessions (optional feed/sync). Not the sync-status command — use `agents sync status` for drift.'))
69
69
  .option('--json', 'Emit the machine-readable FleetSnapshot contract (version 1)')
70
70
  .option('--all-hosts', 'Include remote devices in the sessions gather (same fan-out as `sessions --active`; default is this machine only)')
71
71
  .option('--with-feed', 'Include open feed-block summary (needs-you count + compact rows)')
72
- .option('--with-sync', 'Include UnifiedSyncStatus (same engine as `agents status`; opt-in)')
72
+ .option('--with-sync', 'Include UnifiedSyncStatus (same engine as `agents sync status`; opt-in)')
73
73
  .option('--agent <name>', 'Restrict inventory to one agent (e.g. claude)');
74
74
  setHelpSections(cmd, {
75
75
  examples: `
@@ -1,6 +1,7 @@
1
1
  /**
2
- * `agents status` — the unified sync-status surface.
2
+ * `agents sync status` — the unified sync-status surface.
3
3
  *
4
+ * Nested under `sync` because this is sync drift, not a separate noun (RUSH-2864).
4
5
  * One command that answers "is my fleet in sync?" the same way every other
5
6
  * surface does, because it reads the same engine (computeSyncStatus). Human mode
6
7
  * renders the summary and, when a TTY finds drift, offers the interactive
@@ -9,4 +10,5 @@
9
10
  * prompts (the "kick it" path, safe in scripts).
10
11
  */
11
12
  import { Command } from 'commander';
12
- export declare function registerStatusCommand(program: Command): void;
13
+ /** Attach `status` under the `sync` group. The former top-level `agents status` is retired. */
14
+ export declare function registerStatusCommand(syncCmd: Command): void;