@phnx-labs/agents-cli 1.23.28 → 1.23.30

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 (171) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +33 -82
  3. package/dist/bootstrap.js +0 -17
  4. package/dist/cli/command-registry.js +0 -2
  5. package/dist/commands/cloud.js +0 -58
  6. package/dist/commands/config.js +0 -4
  7. package/dist/commands/daemon-index.js +1 -1
  8. package/dist/commands/daemon.js +14 -63
  9. package/dist/commands/doctor.js +0 -12
  10. package/dist/commands/events.js +1 -1
  11. package/dist/commands/feed.d.ts +1 -3
  12. package/dist/commands/feed.js +1 -6
  13. package/dist/commands/fleet-capture.js +2 -4
  14. package/dist/commands/focus.d.ts +0 -1
  15. package/dist/commands/focus.js +2 -4
  16. package/dist/commands/inspect.d.ts +1 -19
  17. package/dist/commands/inspect.js +8 -474
  18. package/dist/commands/mine.js +1 -1
  19. package/dist/commands/prune.js +2 -64
  20. package/dist/commands/ps-roster.d.ts +0 -4
  21. package/dist/commands/ps-roster.js +2 -30
  22. package/dist/commands/ps.js +1 -4
  23. package/dist/commands/repo.d.ts +1 -1
  24. package/dist/commands/repo.js +4 -4
  25. package/dist/commands/sessions-browser.d.ts +0 -2
  26. package/dist/commands/sessions-browser.js +2 -32
  27. package/dist/commands/sessions-optimize.js +3 -4
  28. package/dist/commands/setup-mine.js +0 -1
  29. package/dist/commands/ssh.js +8 -9
  30. package/dist/commands/sync.js +1 -1
  31. package/dist/commands/update.js +2 -2
  32. package/dist/commands/watchdog.js +3 -4
  33. package/dist/lib/accounting/rotate.d.ts +0 -2
  34. package/dist/lib/accounting/rotate.js +1 -4
  35. package/dist/lib/agent-spec/agents.d.ts +0 -1
  36. package/dist/lib/agent-spec/agents.js +0 -8
  37. package/dist/lib/answer-router.d.ts +1 -1
  38. package/dist/lib/answer-router.js +9 -10
  39. package/dist/lib/auth-health.d.ts +0 -1
  40. package/dist/lib/auth-health.js +0 -3
  41. package/dist/lib/cli-entry.d.ts +0 -1
  42. package/dist/lib/cli-entry.js +0 -36
  43. package/dist/lib/cloud/types.d.ts +0 -2
  44. package/dist/lib/config-keys.d.ts +1 -1
  45. package/dist/lib/config-keys.js +1 -4
  46. package/dist/lib/daemon/daemon.d.ts +0 -4
  47. package/dist/lib/daemon/daemon.js +6 -202
  48. package/dist/lib/daemon/heartbeat-service.d.ts +1 -1
  49. package/dist/lib/daemon/heartbeat-service.js +1 -8
  50. package/dist/lib/daemon-services.d.ts +1 -1
  51. package/dist/lib/daemon-services.js +1 -11
  52. package/dist/lib/device-config.d.ts +0 -2
  53. package/dist/lib/device-config.js +4 -22
  54. package/dist/lib/devices/config-migration.js +1 -3
  55. package/dist/lib/exec.d.ts +2 -5
  56. package/dist/lib/exec.js +18 -18
  57. package/dist/lib/factory/snapshot.d.ts +0 -5
  58. package/dist/lib/factory/snapshot.js +1 -28
  59. package/dist/lib/feed/events.d.ts +1 -11
  60. package/dist/lib/feed/events.js +0 -20
  61. package/dist/lib/feed/feed.d.ts +1 -3
  62. package/dist/lib/feed/feed.js +18 -1
  63. package/dist/lib/feed-outcome.d.ts +0 -2
  64. package/dist/lib/feed-outcome.js +0 -5
  65. package/dist/lib/fleet/capture.d.ts +0 -1
  66. package/dist/lib/fleet/capture.js +0 -3
  67. package/dist/lib/fleet/manifest.js +0 -6
  68. package/dist/lib/fleet/types.d.ts +0 -1
  69. package/dist/lib/harness/adapter.d.ts +0 -7
  70. package/dist/lib/harness/adapters/claude.js +0 -18
  71. package/dist/lib/harness/adapters/codex.js +0 -10
  72. package/dist/lib/harness/adapters/cursor.js +0 -11
  73. package/dist/lib/harness/adapters/kimi.js +0 -3
  74. package/dist/lib/harness/adapters/muse.js +0 -11
  75. package/dist/lib/harness/index.d.ts +1 -1
  76. package/dist/lib/harness/index.js +0 -2
  77. package/dist/lib/hosts/passthrough.js +2 -10
  78. package/dist/lib/hosts/ready.d.ts +0 -4
  79. package/dist/lib/hosts/ready.js +0 -9
  80. package/dist/lib/hosts/reconcile.d.ts +0 -1
  81. package/dist/lib/hosts/reconcile.js +0 -8
  82. package/dist/lib/installations/migrate.d.ts +0 -2
  83. package/dist/lib/installations/migrate.js +0 -145
  84. package/dist/lib/loop.js +1 -2
  85. package/dist/lib/menubar/snapshot.d.ts +0 -1
  86. package/dist/lib/menubar/snapshot.js +1 -4
  87. package/dist/lib/placement.d.ts +1 -2
  88. package/dist/lib/placement.js +4 -24
  89. package/dist/lib/profiles.d.ts +0 -1
  90. package/dist/lib/profiles.js +0 -6
  91. package/dist/lib/session/active.d.ts +4 -3
  92. package/dist/lib/session/active.js +3 -4
  93. package/dist/lib/session/db.d.ts +7 -5
  94. package/dist/lib/session/db.js +11 -14
  95. package/dist/lib/session/discover.d.ts +3 -2
  96. package/dist/lib/session/discover.js +12 -129
  97. package/dist/lib/session/live-metadata.js +0 -2
  98. package/dist/lib/session/presentation.d.ts +0 -1
  99. package/dist/lib/session/presentation.js +3 -8
  100. package/dist/lib/session/selection.d.ts +0 -2
  101. package/dist/lib/session/selection.js +2 -12
  102. package/dist/lib/session/session-cache.d.ts +2 -1
  103. package/dist/lib/session/session-cache.js +1 -0
  104. package/dist/lib/session/title.d.ts +10 -0
  105. package/dist/lib/session/title.js +9 -0
  106. package/dist/lib/staleness/detectors/commands.d.ts +1 -1
  107. package/dist/lib/staleness/detectors/hooks.d.ts +1 -1
  108. package/dist/lib/staleness/detectors/mcp.d.ts +1 -1
  109. package/dist/lib/staleness/detectors/permissions.d.ts +1 -1
  110. package/dist/lib/staleness/detectors/plugins.d.ts +1 -1
  111. package/dist/lib/staleness/detectors/rules.d.ts +1 -1
  112. package/dist/lib/staleness/detectors/skills.d.ts +1 -1
  113. package/dist/lib/staleness/detectors/subagents.d.ts +1 -1
  114. package/dist/lib/staleness/detectors/workflows.d.ts +1 -1
  115. package/dist/lib/staleness/writers/commands.d.ts +1 -1
  116. package/dist/lib/staleness/writers/hooks.d.ts +1 -1
  117. package/dist/lib/staleness/writers/mcp.d.ts +1 -1
  118. package/dist/lib/staleness/writers/permissions.d.ts +1 -1
  119. package/dist/lib/staleness/writers/plugins.d.ts +1 -1
  120. package/dist/lib/staleness/writers/rules.d.ts +1 -1
  121. package/dist/lib/staleness/writers/skills.d.ts +1 -1
  122. package/dist/lib/staleness/writers/subagents.d.ts +1 -1
  123. package/dist/lib/staleness/writers/workflows.d.ts +1 -1
  124. package/dist/lib/startup/command-registry.js +5 -2
  125. package/dist/lib/state.d.ts +0 -3
  126. package/dist/lib/state.js +2 -25
  127. package/dist/lib/types.d.ts +0 -1
  128. package/dist/lib/watchdog/runner.d.ts +0 -2
  129. package/dist/lib/watchdog/runner.js +0 -2
  130. package/package.json +2 -2
  131. package/scripts/postinstall.js +2 -2
  132. package/dist/commands/routines.d.ts +0 -14
  133. package/dist/commands/routines.js +0 -2149
  134. package/dist/commands/routines.test-fixture.d.ts +0 -52
  135. package/dist/commands/routines.test-fixture.js +0 -254
  136. package/dist/lib/catchup.d.ts +0 -19
  137. package/dist/lib/catchup.js +0 -83
  138. package/dist/lib/daemon/catchup-service.d.ts +0 -18
  139. package/dist/lib/daemon/catchup-service.js +0 -21
  140. package/dist/lib/daemon/runner.d.ts +0 -91
  141. package/dist/lib/daemon/runner.js +0 -1927
  142. package/dist/lib/harness/adapters/droid.d.ts +0 -2
  143. package/dist/lib/harness/adapters/droid.js +0 -14
  144. package/dist/lib/overdue.d.ts +0 -9
  145. package/dist/lib/overdue.js +0 -74
  146. package/dist/lib/routine-activation.d.ts +0 -13
  147. package/dist/lib/routine-activation.js +0 -117
  148. package/dist/lib/routine-context.d.ts +0 -59
  149. package/dist/lib/routine-context.js +0 -181
  150. package/dist/lib/routine-notify-owner.d.ts +0 -4
  151. package/dist/lib/routine-notify-owner.js +0 -49
  152. package/dist/lib/routine-notify.d.ts +0 -17
  153. package/dist/lib/routine-notify.js +0 -138
  154. package/dist/lib/routine-process-cleanup.d.ts +0 -9
  155. package/dist/lib/routine-process-cleanup.js +0 -81
  156. package/dist/lib/routine-readiness.d.ts +0 -31
  157. package/dist/lib/routine-readiness.js +0 -256
  158. package/dist/lib/routines-format.d.ts +0 -7
  159. package/dist/lib/routines-format.js +0 -127
  160. package/dist/lib/routines-placement.d.ts +0 -16
  161. package/dist/lib/routines-placement.js +0 -60
  162. package/dist/lib/routines-project.d.ts +0 -49
  163. package/dist/lib/routines-project.js +0 -306
  164. package/dist/lib/sandbox.d.ts +0 -15
  165. package/dist/lib/sandbox.js +0 -309
  166. package/dist/lib/scheduler.d.ts +0 -23
  167. package/dist/lib/scheduler.js +0 -106
  168. package/dist/lib/scheduling/routines.d.ts +0 -264
  169. package/dist/lib/scheduling/routines.js +0 -1292
  170. package/dist/lib/triggers/webhook.d.ts +0 -26
  171. package/dist/lib/triggers/webhook.js +0 -181
@@ -11,7 +11,6 @@ type RemoteExitState = {
11
11
  export declare function classifyExit(res: Pick<SshExecResult, 'code' | 'stdout' | 'timedOut'>): RemoteExitState;
12
12
  export declare function readRemoteExit(target: string, remoteExit: string, timeoutMs?: number, identityFile?: string, remoteShell?: 'posix' | 'powershell'): RemoteExitState;
13
13
  export declare function reconcileTask(task: HostTask): HostTask;
14
- export declare function reconcileTaskAsync(task: HostTask): Promise<HostTask>;
15
14
  export declare function reconcileRunningTasks(tasks: HostTask[]): HostTask[];
16
15
  export declare function reachabilityProbeCommand(remoteShell?: 'posix' | 'powershell'): string;
17
16
  export {};
@@ -36,14 +36,6 @@ export function reconcileTask(task) {
36
36
  return task;
37
37
  return updateTask(task.id, terminalPatch(st.code)) ?? task;
38
38
  }
39
- export async function reconcileTaskAsync(task) {
40
- if (task.status !== 'running')
41
- return task;
42
- const st = await readRemoteExitAsync(task.target, task.remoteExit, 6000, task.identityFile, task.remoteShell);
43
- if (st.state !== 'done')
44
- return task;
45
- return updateTask(task.id, terminalPatch(st.code)) ?? task;
46
- }
47
39
  export function reconcileRunningTasks(tasks) {
48
40
  const running = tasks.filter((t) => t.status === 'running');
49
41
  if (running.length === 0)
@@ -6,8 +6,6 @@ export declare function foldBrowserSessionsIntoProfiles(browserDir?: string): vo
6
6
  export declare function repairSelfReferentialBinShims(versionsRoot?: string, shimsDir?: string, historyDir?: string): void;
7
7
  export declare function migrateMachineLocalBrowserProfileOutOfCentral(userDir?: string, machine?: string): void;
8
8
  export declare function migrateExtrasExtrasToAgentsExtras(historyDir?: string): void;
9
- export declare function migrateRoutineDeviceToDevices(routinesDir?: string): void;
10
- export declare function migrateRoutineRemoteCwdToCwd(routinesDir?: string): void;
11
9
  export declare function migrateWatchdogSentinelToConfig(sentinelPath?: string, enable?: (value: boolean) => void): void;
12
10
  export declare function migrateMenubarSentinelToConfig(sentinelPath?: string, disable?: () => void): void;
13
11
  export declare function migrateCliDirToClis(agentsDirs: string[]): void;
@@ -10,10 +10,7 @@ import { AGENTS, agentConfigDirName, findInPath } from '../agents.js';
10
10
  import { createLink } from '../platform/index.js';
11
11
  import { foldLegacySystemRepo, copyDirSkipExisting } from '../migrate-fold.js';
12
12
  export { foldLegacySystemRepo } from '../migrate-fold.js';
13
- import { migrateLegacyRoutineActivation, listJobs, validateJob } from '../scheduling/routines.js';
14
13
  import { setConfigValue } from '../device-config.js';
15
- import { enabledRoutineNames, replaceEnabledRoutines } from '../routine-activation.js';
16
- import { evaluateActivationReadiness } from '../routine-readiness.js';
17
14
  import { migrateDeviceConfigStores } from '../devices/config-migration.js';
18
15
  import { detrackViaGitExclude } from '../project-resources.js';
19
16
  import { META_HEADER as DEVICE_META_HEADER, commitCentralConfig } from '../state.js';
@@ -157,17 +154,6 @@ function migrateSystemVersionsToUser() {
157
154
  console.error(`Skipped ${skippedCount} version dir${skippedCount === 1 ? '' : 's'} already present in ~/.agents/versions/ (kept legacy copy at ~/.agents-system/versions/)`);
158
155
  }
159
156
  }
160
- function migrateRunsIntoRoutines() {
161
- const src = path.join(USER_DIR, 'runs');
162
- const dest = path.join(USER_DIR, 'routines', 'runs');
163
- if (!fs.existsSync(src) || fs.existsSync(dest))
164
- return;
165
- try {
166
- fs.mkdirSync(path.dirname(dest), { recursive: true, mode: 0o700 });
167
- fs.renameSync(src, dest);
168
- }
169
- catch { }
170
- }
171
157
  function migrateTrashToHidden() {
172
158
  const src = path.join(USER_DIR, 'trash');
173
159
  const dest = path.join(USER_DIR, '.trash');
@@ -379,16 +365,6 @@ function cleanupUserConfigJson() {
379
365
  }
380
366
  catch { }
381
367
  }
382
- function cleanupEmptyTopLevelRuns() {
383
- const dir = path.join(USER_DIR, 'runs');
384
- if (!fs.existsSync(dir))
385
- return;
386
- try {
387
- if (fs.readdirSync(dir).length === 0)
388
- fs.rmdirSync(dir);
389
- }
390
- catch { }
391
- }
392
368
  function migrateAliasesToUser() {
393
369
  const src = path.join(SYSTEM_DIR, 'aliases.json');
394
370
  const dest = path.join(USER_DIR, 'aliases.json');
@@ -685,7 +661,6 @@ function migrateRuntimeToHistory() {
685
661
  moveDirOnce(path.join(USER_DIR, '.trash'), path.join(HISTORY_DIR, 'trash'));
686
662
  moveDirOnce(path.join(USER_DIR, 'trash'), path.join(HISTORY_DIR, 'trash'));
687
663
  moveDirOnce(path.join(USER_DIR, '.backups'), path.join(HISTORY_DIR, 'backups'));
688
- moveDirOnce(path.join(USER_DIR, 'routines', 'runs'), path.join(HISTORY_DIR, 'runs'));
689
664
  moveDirOnce(path.join(USER_DIR, 'teams', 'agents'), path.join(HISTORY_DIR, 'teams', 'agents'));
690
665
  rmEmptyDirTree(path.join(USER_DIR, 'versions'));
691
666
  rmEmptyDirTree(path.join(USER_DIR, 'sessions'));
@@ -1464,120 +1439,6 @@ export function migrateExtrasExtrasToAgentsExtras(historyDir = HISTORY_DIR) {
1464
1439
  console.error(`Renamed extras-extras → agents-extras (dirs: ${renamedDirs}, known_marketplaces: ${rewroteKnown}, settings: ${rewroteSettings})`);
1465
1440
  }
1466
1441
  }
1467
- export function migrateRoutineDeviceToDevices(routinesDir) {
1468
- const dir = routinesDir ?? path.join(USER_DIR, 'routines');
1469
- if (!fs.existsSync(dir))
1470
- return;
1471
- const files = fs.readdirSync(dir).filter((f) => f.endsWith('.yml') || f.endsWith('.yaml'));
1472
- let migrated = 0;
1473
- for (const file of files) {
1474
- const filePath = path.join(dir, file);
1475
- const raw = fs.readFileSync(filePath, 'utf-8');
1476
- let doc;
1477
- try {
1478
- doc = yaml.parse(raw);
1479
- if (!doc || typeof doc !== 'object')
1480
- continue;
1481
- }
1482
- catch {
1483
- continue;
1484
- }
1485
- if (!('device' in doc))
1486
- continue;
1487
- if ('devices' in doc) {
1488
- delete doc.device;
1489
- atomicWriteFileSync(filePath, yaml.stringify(doc));
1490
- continue;
1491
- }
1492
- const val = doc.device;
1493
- if (typeof val !== 'string' || !val.trim()) {
1494
- throw new Error(`${file}: legacy 'device' field is not a valid device name — repair the file and retry`);
1495
- }
1496
- delete doc.device;
1497
- doc.devices = [val.trim()];
1498
- atomicWriteFileSync(filePath, yaml.stringify(doc));
1499
- migrated++;
1500
- }
1501
- if (migrated > 0) {
1502
- console.error(`Migrated ${migrated} routine${migrated === 1 ? '' : 's'}: device → devices`);
1503
- }
1504
- }
1505
- export function migrateRoutineRemoteCwdToCwd(routinesDir) {
1506
- const dir = routinesDir ?? path.join(USER_DIR, 'routines');
1507
- if (!fs.existsSync(dir))
1508
- return;
1509
- const files = fs.readdirSync(dir).filter((f) => f.endsWith('.yml') || f.endsWith('.yaml'));
1510
- let migrated = 0;
1511
- let conflicts = 0;
1512
- for (const file of files) {
1513
- const filePath = path.join(dir, file);
1514
- const raw = fs.readFileSync(filePath, 'utf-8');
1515
- let doc;
1516
- try {
1517
- doc = yaml.parse(raw);
1518
- if (!doc || typeof doc !== 'object')
1519
- continue;
1520
- }
1521
- catch {
1522
- continue;
1523
- }
1524
- if (!('remoteCwd' in doc))
1525
- continue;
1526
- const remote = doc.remoteCwd;
1527
- if (typeof remote !== 'string' || !remote.trim()) {
1528
- delete doc.remoteCwd;
1529
- atomicWriteFileSync(filePath, yaml.stringify(doc));
1530
- continue;
1531
- }
1532
- if ('cwd' in doc) {
1533
- if (doc.cwd === remote) {
1534
- delete doc.remoteCwd;
1535
- atomicWriteFileSync(filePath, yaml.stringify(doc));
1536
- migrated++;
1537
- }
1538
- else {
1539
- conflicts++;
1540
- }
1541
- continue;
1542
- }
1543
- delete doc.remoteCwd;
1544
- doc.cwd = remote;
1545
- atomicWriteFileSync(filePath, yaml.stringify(doc));
1546
- migrated++;
1547
- }
1548
- if (migrated > 0) {
1549
- console.error(`Migrated ${migrated} routine${migrated === 1 ? '' : 's'}: remoteCwd → cwd`);
1550
- }
1551
- if (conflicts > 0) {
1552
- console.error(`${conflicts} routine${conflicts === 1 ? '' : 's'} have conflicting remoteCwd/cwd — left paused for manual repair (migration_conflict)`);
1553
- }
1554
- }
1555
- function pauseUnreadyEnabledRoutines() {
1556
- const enabled = enabledRoutineNames();
1557
- if (enabled === null)
1558
- return;
1559
- const enabledSet = new Set(enabled);
1560
- const paused = [];
1561
- for (const job of listJobs()) {
1562
- if (!enabledSet.has(job.name))
1563
- continue;
1564
- let ready = true;
1565
- try {
1566
- ready = validateJob(job).length === 0 && evaluateActivationReadiness(job).ready;
1567
- }
1568
- catch {
1569
- ready = true;
1570
- }
1571
- if (!ready)
1572
- paused.push(job.name);
1573
- }
1574
- if (paused.length === 0)
1575
- return;
1576
- const pausedSet = new Set(paused);
1577
- replaceEnabledRoutines(enabled.filter((name) => !pausedSet.has(name)));
1578
- console.error(`Paused ${paused.length} routine${paused.length === 1 ? '' : 's'} with an unresolved execution context ` +
1579
- `(run 'agents routines doctor --all' to see why): ${paused.join(', ')}`);
1580
- }
1581
1442
  export function migrateWatchdogSentinelToConfig(sentinelPath = path.join(CACHE_DIR, 'state', 'watchdog', 'enabled'), enable = (value) => setConfigValue('watchdog.enabled', value)) {
1582
1443
  if (!fs.existsSync(sentinelPath))
1583
1444
  return;
@@ -1875,7 +1736,6 @@ export async function runMigration() {
1875
1736
  mergeOverlappingVersionHomes();
1876
1737
  seedActiveCursorLoginPerVersion();
1877
1738
  migrateKimiSubagentsToMarkdown();
1878
- migrateRunsIntoRoutines();
1879
1739
  migrateTrashToHidden();
1880
1740
  migrateBackupsToHidden();
1881
1741
  migrateAliasesToUser();
@@ -1885,7 +1745,6 @@ export async function runMigration() {
1885
1745
  deleteTeamsConfigJson();
1886
1746
  moveTeamsRegistryToHistory();
1887
1747
  cleanupUserConfigJson();
1888
- cleanupEmptyTopLevelRuns();
1889
1748
  foldUserHooksYamlIntoAgentsYaml();
1890
1749
  foldBrowserProfilesIntoAgentsYaml();
1891
1750
  migrateVersionResourcesToPatterns();
@@ -1907,13 +1766,9 @@ export async function runMigration() {
1907
1766
  dropDeadSystemArtifacts();
1908
1767
  warnSystemOrphans();
1909
1768
  migrateExtrasExtrasToAgentsExtras();
1910
- migrateRoutineDeviceToDevices();
1911
- migrateRoutineRemoteCwdToCwd();
1912
- migrateLegacyRoutineActivation();
1913
1769
  migrateWatchdogSentinelToConfig();
1914
1770
  migrateMenubarSentinelToConfig();
1915
1771
  removeHomeCompiledProjectRules();
1916
- pauseUnreadyEnabledRoutines();
1917
1772
  repairAgentConfigSymlinks();
1918
1773
  repairSelfReferentialBinShims();
1919
1774
  try {
package/dist/lib/loop.js CHANGED
@@ -2,9 +2,8 @@ import { spawn } from 'child_process';
2
2
  import { randomUUID } from 'crypto';
3
3
  import * as fs from 'fs';
4
4
  import * as path from 'path';
5
- import { buildExecCommand, buildExecEnv } from './exec.js';
5
+ import { buildExecCommand, buildExecEnv, parseTimeout } from './exec.js';
6
6
  import { extractUsageEvents } from './budget/enforce.js';
7
- import { parseTimeout } from './scheduling/routines.js';
8
7
  import { writeCheckpoint } from './checkpoint.js';
9
8
  import { mailboxDir } from './mailbox.js';
10
9
  import { composeWin32CommandLine } from './platform/index.js';
@@ -41,7 +41,6 @@ interface MenubarSnapshot {
41
41
  capturedAt: string;
42
42
  cliVersion: string;
43
43
  menubarUpdate: MenubarUpdateResult;
44
- routines: Record<string, unknown>[];
45
44
  recentSessions: Record<string, unknown>[];
46
45
  activeSessions: Record<string, unknown>[];
47
46
  devices: MenubarDevice[];
@@ -4,7 +4,6 @@ import * as path from 'path';
4
4
  import { httpsUrl } from '../actor.js';
5
5
  import { cachedViewer, emailDigest } from '../github/viewer.js';
6
6
  import { readSession } from '../identity/client.js';
7
- import { buildRoutineListJson } from '../scheduling/routines.js';
8
7
  import { backfillActiveRowsFromIndex, isRunningLiveSession, serializeActiveSessionsForJson, serializeSessionsJson } from '../session/active.js';
9
8
  import { getConfigValue, listConfiguredDeviceRoles, loadAutoLaunchPreferences } from '../device-config.js';
10
9
  import { filterAutoPool } from '../devices/pool.js';
@@ -119,8 +118,7 @@ export function readLastWatchdogTick(stateDir = path.join(getRuntimeStateDir(),
119
118
  export async function computeMenubarSnapshot() {
120
119
  migrateMenubarPreferencesFromUserDefaults();
121
120
  const viewerRead = cachedViewer();
122
- const [routines, recent, devices, viewer] = await Promise.all([
123
- Promise.resolve(buildRoutineListJson()),
121
+ const [recent, devices, viewer] = await Promise.all([
124
122
  Promise.resolve(querySessions({ limit: 40, skipExistenceCheck: true })),
125
123
  buildMenubarDevices(),
126
124
  viewerRead,
@@ -138,7 +136,6 @@ export async function computeMenubarSnapshot() {
138
136
  capturedAt: new Date().toISOString(),
139
137
  cliVersion: getCliVersion(),
140
138
  menubarUpdate: getMenubarUpdateStatus(),
141
- routines,
142
139
  recentSessions: JSON.parse(serializeSessionsJson(recent)),
143
140
  activeSessions: serializeActiveSessionsForJson(activeSessions),
144
141
  devices,
@@ -1,4 +1,4 @@
1
- type PlacementKind = 'local' | 'device' | 'fleet' | 'cloud' | 'lease';
1
+ type PlacementKind = 'local' | 'device' | 'cloud' | 'lease';
2
2
  export interface Placement {
3
3
  kind: PlacementKind;
4
4
  target?: string;
@@ -23,6 +23,5 @@ export declare function parseWhereSpec(raw: string, source?: string): Placement;
23
23
  export declare function hostFamilyTarget(flags: RunPlacementFlags): string | undefined;
24
24
  export declare function placementFromRunFlags(flags: RunPlacementFlags): Placement;
25
25
  export declare function expandPlacementToRunFlags(placement: Placement): Pick<RunPlacementFlags, 'host' | 'device' | 'lease' | 'box' | 'cloud' | 'provider'>;
26
- export declare function placementFromHostStrategy(strategy: 'local' | 'host' | 'fleet' | 'cloud', host?: string): Placement;
27
26
  export declare function formatPlacement(p: Placement): string;
28
27
  export {};
@@ -4,19 +4,17 @@ export class PlacementError extends Error {
4
4
  this.name = 'PlacementError';
5
5
  }
6
6
  }
7
- const KINDS = new Set(['local', 'device', 'fleet', 'cloud', 'lease', 'host']);
7
+ const KINDS = new Set(['local', 'device', 'cloud', 'lease', 'host']);
8
8
  export function parseWhereSpec(raw, source = '--where') {
9
9
  const spec = raw.trim();
10
10
  if (!spec) {
11
- throw new PlacementError(`${source} requires a value (local | device:<name> | auto | lease | cloud | fleet)`);
11
+ throw new PlacementError(`${source} requires a value (local | device:<name> | auto | lease | cloud)`);
12
12
  }
13
13
  const lower = spec.toLowerCase();
14
14
  if (lower === 'local')
15
15
  return { kind: 'local', source };
16
16
  if (lower === 'auto')
17
17
  return { kind: 'device', target: 'auto', source };
18
- if (lower === 'fleet')
19
- return { kind: 'fleet', source };
20
18
  if (lower === 'cloud')
21
19
  return { kind: 'cloud', source };
22
20
  if (lower === 'lease')
@@ -24,7 +22,7 @@ export function parseWhereSpec(raw, source = '--where') {
24
22
  const colon = spec.indexOf(':');
25
23
  if (colon === -1) {
26
24
  if (KINDS.has(lower)) {
27
- throw new PlacementError(`${source} ${spec}: name a target (device:<name>, device:auto) or use local|lease|cloud|fleet`);
25
+ throw new PlacementError(`${source} ${spec}: name a target (device:<name>, device:auto) or use local|lease|cloud`);
28
26
  }
29
27
  return { kind: 'device', target: spec, source };
30
28
  }
@@ -42,10 +40,7 @@ export function parseWhereSpec(raw, source = '--where') {
42
40
  if (head === 'cloud') {
43
41
  return { kind: 'cloud', target: tail, source };
44
42
  }
45
- if (head === 'fleet') {
46
- return { kind: 'fleet', target: tail, source };
47
- }
48
- throw new PlacementError(`${source} ${spec}: unknown kind '${head}' (use local | device:<name> | auto | lease[:backend] | cloud | fleet)`);
43
+ throw new PlacementError(`${source} ${spec}: unknown kind '${head}' (use local | device:<name> | auto | lease[:backend] | cloud)`);
49
44
  }
50
45
  export function hostFamilyTarget(flags) {
51
46
  for (const v of [flags.host, flags.device, flags.on, flags.computer]) {
@@ -109,21 +104,6 @@ export function expandPlacementToRunFlags(placement) {
109
104
  return placement.target ? { lease: placement.target } : { lease: true };
110
105
  case 'cloud':
111
106
  return placement.target ? { cloud: true, provider: placement.target } : { cloud: true };
112
- case 'fleet':
113
- throw new PlacementError(`fleet placement is for routines (agents routines add … --placement fleet), not agents run. ` +
114
- `Use --where device:auto for an affinity pick, or --where device:<name>.`);
115
- }
116
- }
117
- export function placementFromHostStrategy(strategy, host) {
118
- switch (strategy) {
119
- case 'local':
120
- return { kind: 'local', source: 'hostStrategy:local' };
121
- case 'host':
122
- return { kind: 'device', target: host, source: 'hostStrategy:host' };
123
- case 'fleet':
124
- return { kind: 'fleet', source: 'hostStrategy:fleet' };
125
- case 'cloud':
126
- return { kind: 'cloud', source: 'hostStrategy:cloud' };
127
107
  }
128
108
  }
129
109
  export function formatPlacement(p) {
@@ -38,7 +38,6 @@ export interface ProfileSummary {
38
38
  export declare function getProfilePath(name: string): string;
39
39
  export declare function validateProfileName(name: string): void;
40
40
  export declare function profileExists(name: string): boolean;
41
- export declare function isCustomHarnessName(name: string): boolean;
42
41
  export declare function readProfile(name: string): Profile;
43
42
  export declare function writeProfile(profile: Profile): void;
44
43
  export declare function deleteProfile(name: string): boolean;
@@ -2,7 +2,6 @@ import * as fs from 'fs';
2
2
  import * as path from 'path';
3
3
  import * as crypto from 'node:crypto';
4
4
  import * as yaml from 'yaml';
5
- import { ALL_AGENT_IDS } from './agents.js';
6
5
  import { getUserAgentsDir } from './state.js';
7
6
  import { deleteKeychainTokenSync, getKeychainTokenSync, hasKeychainTokenSync, isSecretsClientError, isSecretsTransportError, profileKeychainItem, } from './secrets-client.js';
8
7
  import { MODEL_TIERS, isTierToken } from './model-tiers.js';
@@ -28,11 +27,6 @@ export function validateProfileName(name) {
28
27
  export function profileExists(name) {
29
28
  return fs.existsSync(profilePath(name));
30
29
  }
31
- export function isCustomHarnessName(name) {
32
- if (!PROFILE_NAME_PATTERN.test(name))
33
- return false;
34
- return !ALL_AGENT_IDS.includes(name) && profileExists(name);
35
- }
36
30
  export function readProfile(name) {
37
31
  validateProfileName(name);
38
32
  const file = profilePath(name);
@@ -1,6 +1,7 @@
1
1
  import type { CloudTaskStatus } from '../cloud/types.js';
2
2
  import { type PidSessionEntry } from './pid-registry.js';
3
3
  import { type HookSessionIndex } from './hook-sessions.js';
4
+ import { type SessionRecap } from './title.js';
4
5
  import { type UserPromptKind } from '@phnx-labs/sessions-cli/reader';
5
6
  import { type SessionState, type SessionActivity, type AwaitingReason, type StructuredQuestion, type TodoProgress, type DetectedPr, type DetectedWorktree, type DetectedTicket } from '@phnx-labs/sessions-cli/reader';
6
7
  import { type SessionAgentId, type SessionAttachment, type SessionFiles, type SessionMeta, type SessionRequest, type SessionTimeline } from '@phnx-labs/sessions-cli/reader';
@@ -20,7 +21,7 @@ export declare function unattributedFullRescanCountForTest(): number;
20
21
  export declare function attributedSetLostPids(prev: Set<number>, next: Set<number>): boolean;
21
22
  export declare function filterCachedUnattributed(sessions: ActiveSession[], attributed: Set<number>, alive: (pid: number, processStartedAtMs?: number) => boolean, ppidMap?: Map<number, number>): ActiveSession[];
22
23
  export type ActiveContext = 'terminal' | 'teams' | 'cloud' | 'headless';
23
- type BackfillMeta = Pick<SessionMeta, 'version' | 'account' | 'accountId' | 'accountKey' | 'timestamp' | 'label' | 'firstUserMessage' | 'lastUserMessage' | 'generatedTitle' | 'ticketId' | 'prUrl' | 'prNumber' | 'origin' | 'routineName' | 'harness' | 'tokenCount' | 'durationMs' | 'subAgentCount' | 'lastActivity'>;
24
+ type BackfillMeta = Pick<SessionMeta, 'version' | 'account' | 'accountId' | 'accountKey' | 'timestamp' | 'label' | 'firstUserMessage' | 'lastUserMessage' | 'generatedTitle' | 'ticketId' | 'prUrl' | 'prNumber' | 'harness' | 'tokenCount' | 'durationMs' | 'subAgentCount' | 'lastActivity'>;
24
25
  export declare function backfillActiveRowsFromMeta(sessions: ActiveSession[], metaById: Map<string, BackfillMeta>): void;
25
26
  export declare function applySessionNames(sessions: ActiveSession[]): void;
26
27
  export declare function sessionAccountLabel(kind: string, session: Pick<SessionMeta, 'accountId' | 'accountKey' | 'account'>, accounts?: import("../account-registry.js").NativeAccount[]): string | undefined;
@@ -80,6 +81,7 @@ export interface ActiveSession {
80
81
  generatedTitle?: string;
81
82
  title?: string;
82
83
  startedAs?: string;
84
+ recap?: SessionRecap;
83
85
  recapSource?: RecapSource;
84
86
  userPromptClean?: string;
85
87
  userPromptKind?: UserPromptKind;
@@ -99,6 +101,7 @@ export interface ActiveSession {
99
101
  todos?: TodoProgress;
100
102
  tail?: string[];
101
103
  pr?: SessionPr;
104
+ prs?: DetectedPr[];
102
105
  worktree?: DetectedWorktree;
103
106
  ticket?: DetectedTicket;
104
107
  rateLimited?: boolean;
@@ -127,8 +130,6 @@ export interface ActiveSession {
127
130
  quietSinceMs?: number;
128
131
  status: ActiveStatus;
129
132
  phase?: SessionPhase;
130
- origin?: 'cli' | 'routine';
131
- routineName?: string;
132
133
  presence?: Presence;
133
134
  hostLink?: HostLink;
134
135
  pidAlive?: boolean;
@@ -114,10 +114,6 @@ export function backfillActiveRowsFromMeta(sessions, metaById) {
114
114
  if (!Number.isNaN(ts))
115
115
  s.startedAtMs = ts;
116
116
  }
117
- if (!s.origin && m.origin)
118
- s.origin = m.origin;
119
- if (!s.routineName && m.routineName)
120
- s.routineName = m.routineName;
121
117
  if (!s.harness && m.harness)
122
118
  s.harness = m.harness;
123
119
  if (s.tokenCount == null && m.tokenCount != null)
@@ -154,6 +150,8 @@ export function applySessionNames(sessions) {
154
150
  indexed: stored?.label,
155
151
  launchName: s.name,
156
152
  }) ?? s.label;
153
+ if (stored?.recap)
154
+ s.recap = stored.recap;
157
155
  }
158
156
  }
159
157
  export function sessionAccountLabel(kind, session, accounts = listNativeAccounts(readMeta())) {
@@ -624,6 +622,7 @@ function applyState(base, state, fallbackFile, pidAlive) {
624
622
  tail: state.tail,
625
623
  preview: state.preview ?? base.preview,
626
624
  pr: state.pr,
625
+ prs: state.prs,
627
626
  worktree: state.worktree,
628
627
  ticket: state.ticket,
629
628
  createdTickets: state.createdTickets,
@@ -1,5 +1,6 @@
1
1
  import Database from '../sqlite.js';
2
2
  import type { SessionAgentId, SessionCheckpoint, SessionChecklistItem, SessionEvent, SessionFiles, SessionGlance, SessionMeta, SessionRequest, SessionSubagent, SessionTimeline, SummaryState } from '@phnx-labs/sessions-cli/reader';
3
+ import type { SessionRecap } from './title.js';
3
4
  import { type IndexedToolCall } from '@phnx-labs/sessions-cli/reader';
4
5
  import { type ToolScanResumePoint } from './tool-store.js';
5
6
  import { type TimelineState } from '@phnx-labs/sessions-cli/reader';
@@ -16,7 +17,6 @@ export interface ScanStamp {
16
17
  export interface QueryOptions {
17
18
  agent?: SessionAgentId;
18
19
  agents?: SessionAgentId[];
19
- origin?: 'cli' | 'routine';
20
20
  version?: string;
21
21
  cwd?: string;
22
22
  cwdPrefix?: string;
@@ -90,13 +90,15 @@ export declare function upsertSessionsBatch(entries: Array<{
90
90
  toolIndexMode?: 'replace' | 'append';
91
91
  toolResume?: ToolScanResumePoint | null;
92
92
  }>): void;
93
+ export interface IndexedSessionNames {
94
+ label?: string;
95
+ customTitle?: string;
96
+ recap?: SessionRecap;
97
+ }
93
98
  export declare function getIndexedSessionNames(rows: Array<{
94
99
  id: string;
95
100
  filePath?: string;
96
- }>): Map<string, {
97
- label?: string;
98
- customTitle?: string;
99
- }>;
101
+ }>): Map<string, IndexedSessionNames>;
100
102
  export declare function seedLabelsFromNames(nameMap: Map<string, string | null>): number;
101
103
  export declare function syncTopics(topicMap: Map<string, string>): number;
102
104
  export declare function isSessionActivityFresh(row: {
@@ -1996,14 +1996,15 @@ export function getIndexedSessionNames(rows) {
1996
1996
  const keys = [...idByLedgerKey.keys()];
1997
1997
  for (let i = 0; i < keys.length; i += CHUNK) {
1998
1998
  const chunk = keys.slice(i, i + CHUNK);
1999
- const titled = db
2000
- .prepare(`SELECT file_path, json_extract(parser_state, '$.customTitle') AS custom_title FROM scan_ledger WHERE file_path IN (${chunk.map(() => '?').join(',')}) AND json_valid(parser_state)`)
1999
+ const fromState = db
2000
+ .prepare(`SELECT file_path, json_extract(parser_state, '$.customTitle') AS custom_title, json_extract(parser_state, '$.recap') AS recap FROM scan_ledger WHERE file_path IN (${chunk.map(() => '?').join(',')}) AND json_valid(parser_state)`)
2001
2001
  .all(...chunk);
2002
- for (const row of titled) {
2003
- if (typeof row.custom_title !== 'string' || !row.custom_title)
2004
- continue;
2002
+ for (const row of fromState) {
2005
2003
  const id = idByLedgerKey.get(row.file_path);
2006
- out.set(id, { ...out.get(id), customTitle: row.custom_title });
2004
+ const customTitle = typeof row.custom_title === 'string' && row.custom_title ? row.custom_title : undefined;
2005
+ const recap = row.recap ? JSON.parse(row.recap) : undefined;
2006
+ if (customTitle || recap)
2007
+ out.set(id, { ...out.get(id), customTitle, recap });
2007
2008
  }
2008
2009
  }
2009
2010
  return out;
@@ -2222,10 +2223,6 @@ function buildSessionWhere(options) {
2222
2223
  where.push('version = ?');
2223
2224
  params.push(options.version);
2224
2225
  }
2225
- if (options.origin) {
2226
- where.push("IFNULL(origin, 'cli') = ?");
2227
- params.push(options.origin);
2228
- }
2229
2226
  if (options.cwd) {
2230
2227
  where.push('cwd = ?');
2231
2228
  params.push(options.cwd);
@@ -2243,12 +2240,12 @@ function buildSessionWhere(options) {
2243
2240
  params.push(options.machine);
2244
2241
  }
2245
2242
  if (options.idExact) {
2246
- where.push('(id = ? COLLATE NOCASE OR short_id = ? COLLATE NOCASE OR routine_run_id = ? COLLATE NOCASE)');
2247
- params.push(options.idExact, options.idExact, options.idExact);
2243
+ where.push('(id = ? COLLATE NOCASE OR short_id = ? COLLATE NOCASE)');
2244
+ params.push(options.idExact, options.idExact);
2248
2245
  }
2249
2246
  if (options.idPrefix) {
2250
- where.push('(id LIKE ? OR short_id LIKE ? OR routine_run_id LIKE ?)');
2251
- params.push(`${options.idPrefix}%`, `${options.idPrefix}%`, `${options.idPrefix}%`);
2247
+ where.push('(id LIKE ? OR short_id LIKE ?)');
2248
+ params.push(`${options.idPrefix}%`, `${options.idPrefix}%`);
2252
2249
  }
2253
2250
  if (typeof options.sinceMs === 'number') {
2254
2251
  where.push('timestamp >= ?');
@@ -1,7 +1,7 @@
1
1
  import type { SessionAgentId, SessionEvent, SessionMeta, TodoProgress } from '@phnx-labs/sessions-cli/reader';
2
2
  export { machineForSessionFile } from './origin-machine.js';
3
3
  import { type ScanStamp } from './db.js';
4
- import { type LiveSessionName } from './title.js';
4
+ import { type LiveSessionName, type SessionRecap } from './title.js';
5
5
  import { ToolCallCollector, type IndexedToolCall, type ToolCallCollectorSnapshot } from '@phnx-labs/sessions-cli/reader';
6
6
  interface DiscoverOptions {
7
7
  agent?: SessionAgentId;
@@ -18,7 +18,6 @@ interface DiscoverOptions {
18
18
  until?: string;
19
19
  excludeTeamOrigin?: boolean;
20
20
  onlyTeamOrigin?: boolean;
21
- origin?: 'cli' | 'routine';
22
21
  sortBy?: 'timestamp' | 'cost' | 'duration';
23
22
  skipExistenceCheck?: boolean;
24
23
  onProgress?: (progress: ScanProgress) => void;
@@ -184,6 +183,7 @@ interface ClaudeParseState {
184
183
  firstUserMessage?: string;
185
184
  customTitle?: string;
186
185
  aiTitle?: string;
186
+ recap?: SessionRecap;
187
187
  entrypoint?: string;
188
188
  messageCount: number;
189
189
  toolCallCount: number;
@@ -237,6 +237,7 @@ export interface ClaudeParserState {
237
237
  firstUserMessage?: string;
238
238
  customTitle?: string;
239
239
  aiTitle?: string;
240
+ recap?: SessionRecap;
240
241
  plan?: string;
241
242
  lastTsMs?: number;
242
243
  messageCount: number;