@phnx-labs/agents-cli 1.22.121 → 1.22.123

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 (247) hide show
  1. package/CHANGELOG.md +316 -0
  2. package/README.md +53 -53
  3. package/dist/bootstrap.js +22 -17
  4. package/dist/cli/command-registry.d.ts +0 -1
  5. package/dist/cli/command-registry.js +2 -12
  6. package/dist/commands/auth.js +13 -4
  7. package/dist/commands/browser.js +3 -4
  8. package/dist/commands/cloud-transcripts.d.ts +7 -0
  9. package/dist/commands/cloud-transcripts.js +100 -0
  10. package/dist/commands/cloud.js +5 -0
  11. package/dist/commands/computer.d.ts +0 -12
  12. package/dist/commands/computer.js +14 -124
  13. package/dist/commands/config.js +5 -4
  14. package/dist/commands/daemon-index.d.ts +2 -0
  15. package/dist/commands/daemon-index.js +44 -0
  16. package/dist/commands/daemon.js +13 -8
  17. package/dist/commands/doctor.js +3 -4
  18. package/dist/commands/exec.d.ts +5 -0
  19. package/dist/commands/exec.js +35 -7
  20. package/dist/commands/feed-watch.js +12 -0
  21. package/dist/commands/feed.d.ts +1 -1
  22. package/dist/commands/feed.js +7 -4
  23. package/dist/commands/insights.js +3 -1
  24. package/dist/commands/inspect.js +1 -1
  25. package/dist/commands/logs.js +2 -1
  26. package/dist/commands/mailboxes.js +1 -1
  27. package/dist/commands/models.js +1 -1
  28. package/dist/commands/projects.js +3 -3
  29. package/dist/commands/prune.js +6 -28
  30. package/dist/commands/ps-roster.d.ts +0 -1
  31. package/dist/commands/ps-roster.js +2 -21
  32. package/dist/commands/ps.js +13 -1
  33. package/dist/commands/recordings.d.ts +2 -0
  34. package/dist/commands/recordings.js +117 -0
  35. package/dist/commands/routines.js +1 -1
  36. package/dist/commands/secrets-passthrough.js +3 -3
  37. package/dist/commands/send.js +33 -20
  38. package/dist/commands/sessions-backfill.d.ts +1 -0
  39. package/dist/commands/sessions-backfill.js +48 -13
  40. package/dist/commands/sessions-migrate.d.ts +1 -1
  41. package/dist/commands/sessions-migrate.js +11 -10
  42. package/dist/commands/sessions-optimize.d.ts +1 -0
  43. package/dist/commands/sessions-optimize.js +7 -4
  44. package/dist/commands/sessions-resume.js +8 -1
  45. package/dist/commands/sessions-stats.d.ts +2 -0
  46. package/dist/commands/sessions-stats.js +24 -7
  47. package/dist/commands/sessions.d.ts +5 -11
  48. package/dist/commands/sessions.js +8 -236
  49. package/dist/commands/setup-computer.js +1 -2
  50. package/dist/commands/setup-mine.js +0 -1
  51. package/dist/commands/setup.js +1 -1
  52. package/dist/commands/sync.js +101 -1
  53. package/dist/commands/teams.js +2 -2
  54. package/dist/commands/testdata/feed-hub.js +11 -0
  55. package/dist/commands/trash.d.ts +0 -1
  56. package/dist/commands/trash.js +74 -10
  57. package/dist/lib/accounting/usage-sync.js +7 -0
  58. package/dist/lib/agent-modes.d.ts +1 -1
  59. package/dist/lib/agent-modes.js +11 -5
  60. package/dist/lib/auth-mint.d.ts +4 -0
  61. package/dist/lib/auth-mint.js +6 -4
  62. package/dist/lib/browser/native-history.test-fixture.d.ts +12 -0
  63. package/dist/lib/browser/native-history.test-fixture.js +43 -0
  64. package/dist/lib/browser/paths.d.ts +5 -0
  65. package/dist/lib/browser/paths.js +7 -1
  66. package/dist/lib/browser/sessions-list.d.ts +28 -1
  67. package/dist/lib/browser/sessions-list.js +137 -25
  68. package/dist/lib/channels/providers/rush.d.ts +2 -1
  69. package/dist/lib/channels/providers/rush.js +2 -2
  70. package/dist/lib/channels/providers/session.d.ts +1 -0
  71. package/dist/lib/channels/providers/session.js +23 -12
  72. package/dist/lib/channels/registry.d.ts +9 -2
  73. package/dist/lib/channels/send.d.ts +5 -10
  74. package/dist/lib/channels/send.js +88 -50
  75. package/dist/lib/cloud/rush.d.ts +6 -0
  76. package/dist/lib/cloud/rush.js +18 -3
  77. package/dist/lib/computer-client.d.ts +19 -0
  78. package/dist/lib/computer-client.js +104 -0
  79. package/dist/lib/config-keys.d.ts +5 -1
  80. package/dist/lib/config-keys.js +14 -11
  81. package/dist/lib/daemon/auth-sync-service.js +13 -0
  82. package/dist/lib/daemon/daemon.js +20 -23
  83. package/dist/lib/daemon/owner-device-delivery-service.d.ts +10 -0
  84. package/dist/lib/daemon/owner-device-delivery-service.js +28 -0
  85. package/dist/lib/daemon-services.d.ts +2 -1
  86. package/dist/lib/daemon-services.js +17 -10
  87. package/dist/lib/daemon-webhooks.d.ts +1 -1
  88. package/dist/lib/daemon-webhooks.js +1 -1
  89. package/dist/lib/device-config.d.ts +4 -1
  90. package/dist/lib/device-config.js +58 -8
  91. package/dist/lib/devices/doctor-findings.d.ts +2 -3
  92. package/dist/lib/devices/doctor-findings.js +10 -19
  93. package/dist/lib/event-provenance.d.ts +1 -0
  94. package/dist/lib/event-provenance.js +2 -0
  95. package/dist/lib/exec.d.ts +1 -0
  96. package/dist/lib/exec.js +20 -15
  97. package/dist/lib/feed/pr-status.d.ts +5 -1
  98. package/dist/lib/feed/pr-status.js +44 -3
  99. package/dist/lib/feed/tool-activity.js +9 -6
  100. package/dist/lib/feed/tools.d.ts +4 -1
  101. package/dist/lib/feed/tools.js +8 -11
  102. package/dist/lib/feed-broadcast.d.ts +5 -3
  103. package/dist/lib/feed-broadcast.js +47 -36
  104. package/dist/lib/fleet-shared-state.d.ts +5 -0
  105. package/dist/lib/fleet-shared-state.js +8 -0
  106. package/dist/lib/github/project-prs.d.ts +4 -1
  107. package/dist/lib/github/project-prs.js +20 -7
  108. package/dist/lib/help.d.ts +1 -0
  109. package/dist/lib/help.js +8 -0
  110. package/dist/lib/helper-versions.js +1 -1
  111. package/dist/lib/hosts/passthrough.js +5 -9
  112. package/dist/lib/hosts/remote-cmd.d.ts +2 -7
  113. package/dist/lib/hosts/remote-cmd.js +14 -22
  114. package/dist/lib/hosts/routing-flag.d.ts +22 -0
  115. package/dist/lib/hosts/routing-flag.js +127 -14
  116. package/dist/lib/identity/index.d.ts +22 -0
  117. package/dist/lib/identity/index.js +3 -0
  118. package/dist/lib/installations/migrate.d.ts +7 -0
  119. package/dist/lib/installations/migrate.js +99 -88
  120. package/dist/lib/installations/versions.js +2 -2
  121. package/dist/lib/launch-identity.d.ts +6 -1
  122. package/dist/lib/launch-identity.js +12 -2
  123. package/dist/lib/menubar/install-menubar.d.ts +1 -0
  124. package/dist/lib/menubar/install-menubar.js +8 -5
  125. package/dist/lib/menubar/snapshot.js +2 -3
  126. package/dist/lib/notify.d.ts +7 -14
  127. package/dist/lib/notify.js +29 -75
  128. package/dist/lib/owner-message.d.ts +4 -6
  129. package/dist/lib/owner-message.js +12 -11
  130. package/dist/lib/owner-notify-tokens.d.ts +49 -0
  131. package/dist/lib/owner-notify-tokens.js +214 -0
  132. package/dist/lib/owner-notify.d.ts +75 -0
  133. package/dist/lib/owner-notify.js +144 -0
  134. package/dist/lib/plugins/plugins.d.ts +7 -1
  135. package/dist/lib/plugins/plugins.js +26 -5
  136. package/dist/lib/pr-land-detach.js +2 -2
  137. package/dist/lib/recordings/config.d.ts +11 -0
  138. package/dist/lib/recordings/config.js +54 -0
  139. package/dist/lib/recordings/identity.d.ts +12 -0
  140. package/dist/lib/recordings/identity.js +57 -0
  141. package/dist/lib/recordings/ledger.d.ts +16 -0
  142. package/dist/lib/recordings/ledger.js +141 -0
  143. package/dist/lib/recordings/model.d.ts +29 -0
  144. package/dist/lib/recordings/model.js +28 -0
  145. package/dist/lib/recordings/pipeline.d.ts +44 -0
  146. package/dist/lib/recordings/pipeline.js +272 -0
  147. package/dist/lib/recordings/process.d.ts +17 -0
  148. package/dist/lib/recordings/process.js +94 -0
  149. package/dist/lib/recordings/service.d.ts +15 -0
  150. package/dist/lib/recordings/service.js +45 -0
  151. package/dist/lib/recordings/settle.d.ts +21 -0
  152. package/dist/lib/recordings/settle.js +92 -0
  153. package/dist/lib/recordings/transcode.d.ts +13 -0
  154. package/dist/lib/recordings/transcode.js +44 -0
  155. package/dist/lib/refresh.js +4 -1
  156. package/dist/lib/reminders.d.ts +0 -1
  157. package/dist/lib/reminders.js +1 -1
  158. package/dist/lib/reserved-stores.d.ts +3 -0
  159. package/dist/lib/reserved-stores.js +13 -0
  160. package/dist/lib/routine-notify-owner.d.ts +3 -23
  161. package/dist/lib/routine-notify-owner.js +26 -107
  162. package/dist/lib/rush-api.d.ts +1 -0
  163. package/dist/lib/rush-api.js +1 -0
  164. package/dist/lib/scheduling/routines.d.ts +1 -1
  165. package/dist/lib/scheduling/routines.js +1 -1
  166. package/dist/lib/session/active.d.ts +18 -2
  167. package/dist/lib/session/active.js +47 -37
  168. package/dist/lib/session/cloud.js +18 -45
  169. package/dist/lib/session/db.d.ts +3 -1
  170. package/dist/lib/session/db.js +64 -32
  171. package/dist/lib/session/glance-files.d.ts +4 -3
  172. package/dist/lib/session/glance-files.js +31 -0
  173. package/dist/lib/session/inject-target.js +12 -2
  174. package/dist/lib/session/pid-registry.d.ts +2 -0
  175. package/dist/lib/session/pid-registry.js +6 -2
  176. package/dist/lib/session/presentation.d.ts +21 -0
  177. package/dist/lib/session/presentation.js +198 -0
  178. package/dist/lib/session/projection.js +9 -2
  179. package/dist/lib/sqlite.d.ts +3 -1
  180. package/dist/lib/sqlite.js +7 -3
  181. package/dist/lib/staleness/index.js +12 -0
  182. package/dist/lib/staleness/types.d.ts +5 -0
  183. package/dist/lib/standalone-tools.js +1 -1
  184. package/dist/lib/startup/command-registry.js +10 -5
  185. package/dist/lib/state.d.ts +2 -5
  186. package/dist/lib/state.js +3 -11
  187. package/dist/lib/sync-delete.d.ts +21 -0
  188. package/dist/lib/sync-delete.js +113 -0
  189. package/dist/lib/terminal/inject.js +1 -1
  190. package/dist/lib/testdata/owner-notify-api.d.ts +36 -0
  191. package/dist/lib/testdata/owner-notify-api.js +102 -0
  192. package/dist/lib/trash.d.ts +14 -0
  193. package/dist/lib/trash.js +75 -0
  194. package/dist/lib/types.d.ts +0 -34
  195. package/package.json +1 -3
  196. package/dist/commands/feedback.d.ts +0 -2
  197. package/dist/commands/feedback.js +0 -68
  198. package/dist/commands/humans.d.ts +0 -2
  199. package/dist/commands/humans.js +0 -83
  200. package/dist/commands/modes.d.ts +0 -2
  201. package/dist/commands/modes.js +0 -134
  202. package/dist/commands/monitors.d.ts +0 -2
  203. package/dist/commands/monitors.js +0 -1070
  204. package/dist/commands/reminders.d.ts +0 -2
  205. package/dist/commands/reminders.js +0 -49
  206. package/dist/lib/channels/owner-forward.d.ts +0 -25
  207. package/dist/lib/channels/owner-forward.js +0 -78
  208. package/dist/lib/channels/owner-sink.d.ts +0 -10
  209. package/dist/lib/channels/owner-sink.js +0 -26
  210. package/dist/lib/daemon/monitor-engine-service.d.ts +0 -13
  211. package/dist/lib/daemon/monitor-engine-service.js +0 -25
  212. package/dist/lib/humans.d.ts +0 -12
  213. package/dist/lib/humans.js +0 -64
  214. package/dist/lib/monitors/config.d.ts +0 -77
  215. package/dist/lib/monitors/config.js +0 -405
  216. package/dist/lib/monitors/dispatch.d.ts +0 -10
  217. package/dist/lib/monitors/dispatch.js +0 -72
  218. package/dist/lib/monitors/engine.d.ts +0 -45
  219. package/dist/lib/monitors/engine.js +0 -243
  220. package/dist/lib/monitors/fingerprint.d.ts +0 -3
  221. package/dist/lib/monitors/fingerprint.js +0 -43
  222. package/dist/lib/monitors/pid-watch.d.ts +0 -4
  223. package/dist/lib/monitors/pid-watch.js +0 -14
  224. package/dist/lib/monitors/remote.d.ts +0 -31
  225. package/dist/lib/monitors/remote.js +0 -63
  226. package/dist/lib/monitors/sources/command.d.ts +0 -4
  227. package/dist/lib/monitors/sources/command.js +0 -20
  228. package/dist/lib/monitors/sources/device.d.ts +0 -3
  229. package/dist/lib/monitors/sources/device.js +0 -31
  230. package/dist/lib/monitors/sources/failure.d.ts +0 -5
  231. package/dist/lib/monitors/sources/failure.js +0 -25
  232. package/dist/lib/monitors/sources/file.d.ts +0 -4
  233. package/dist/lib/monitors/sources/file.js +0 -46
  234. package/dist/lib/monitors/sources/http.d.ts +0 -3
  235. package/dist/lib/monitors/sources/http.js +0 -25
  236. package/dist/lib/monitors/sources/index.d.ts +0 -5
  237. package/dist/lib/monitors/sources/index.js +0 -22
  238. package/dist/lib/monitors/sources/poll.d.ts +0 -1
  239. package/dist/lib/monitors/sources/poll.js +0 -1
  240. package/dist/lib/monitors/sources/types.d.ts +0 -9
  241. package/dist/lib/monitors/sources/webhook.d.ts +0 -3
  242. package/dist/lib/monitors/sources/webhook.js +0 -3
  243. package/dist/lib/monitors/sources/ws.d.ts +0 -4
  244. package/dist/lib/monitors/sources/ws.js +0 -35
  245. package/dist/lib/monitors/state.d.ts +0 -51
  246. package/dist/lib/monitors/state.js +0 -221
  247. /package/dist/{lib/monitors/sources/types.js → commands/testdata/feed-hub.d.ts} +0 -0
@@ -5,7 +5,6 @@ import { configureRootCommand } from '../lib/startup/root-command.js';
5
5
  export { KNOWN_TOP_LEVEL_COMMANDS, RETIRED_TOP_LEVEL_COMMANDS } from '../lib/startup/command-registry.js';
6
6
  const loadView = async () => (await import('../commands/view.js')).registerViewCommand;
7
7
  const loadInspect = async () => (await import('../commands/inspect.js')).registerInspectCommand;
8
- const loadFeedback = async () => (await import('../commands/feedback.js')).registerFeedbackCommand;
9
8
  const loadCommands = async () => (await import('../commands/commands.js')).registerCommandsCommands;
10
9
  const loadHooks = async () => (await import('../commands/hooks.js')).registerHooksCommands;
11
10
  const loadSkills = async () => (await import('../commands/skills.js')).registerSkillsCommands;
@@ -22,17 +21,14 @@ export const loadUpdate = async () => (await import('../commands/update.js')).re
22
21
  const loadImport = async () => (await import('../commands/import.js')).registerImportCommand;
23
22
  const loadPackages = async () => (await import('../commands/packages.js')).registerPackagesCommands;
24
23
  const loadRoutines = async () => (await import('../commands/routines.js')).registerRoutinesCommands;
25
- const loadMonitors = async () => (await import('../commands/monitors.js')).registerMonitorsCommands;
26
24
  const loadProjects = async () => (await import('../commands/projects.js')).registerProjectsCommands;
27
25
  export const loadRun = async () => (await import('../commands/exec.js')).registerRunCommand;
28
26
  const loadOpen = async () => (await import('../commands/open.js')).registerOpenCommand;
29
27
  const loadFork = async () => (await import('../commands/fork.js')).registerForkCommand;
30
28
  const loadConfig = async () => (await import('../commands/config.js')).registerConfigCommand;
31
29
  const loadModels = async () => (await import('../commands/models.js')).registerModelsCommand;
32
- const loadModes = async () => (await import('../commands/modes.js')).registerModesCommand;
33
30
  export const loadPrune = async () => (await import('../commands/prune.js')).registerPruneCommand;
34
31
  const loadTrash = async () => (await import('../commands/trash.js')).registerTrashCommands;
35
- const loadRestore = async () => (await import('../commands/trash.js')).registerRestoreCommand;
36
32
  export const loadDoctor = async () => (await import('../commands/doctor.js')).registerDoctorCommand;
37
33
  const loadRoute = async () => (await import('../commands/route.js')).registerRouteCommands;
38
34
  const loadHarness = async () => (await import('../commands/harness.js')).registerHarnessCommands;
@@ -63,12 +59,11 @@ const loadSend = async () => (await import('../commands/send.js')).registerSendC
63
59
  const loadFeed = async () => (await import('../commands/feed.js')).registerFeedCommand;
64
60
  const loadMailboxes = async () => (await import('../commands/mailboxes.js')).registerMailboxesCommand;
65
61
  const loadWebhooks = async () => (await import('../commands/webhook.js')).registerWebhooksCommand;
66
- const loadHumans = async () => (await import('../commands/humans.js')).registerHumansCommands;
67
62
  const loadAccounts = async () => (await import('../commands/accounts.js')).registerAccountsCommand;
68
63
  const loadDaemon = async () => (await import('../commands/daemon.js')).registerDaemonCommand;
69
64
  const loadAuth = async () => (await import('../commands/auth.js')).registerAuthCommand;
70
65
  const loadTraces = async () => (await import('../commands/traces.js')).registerTracesCommands;
71
- export const loadReminders = async () => (await import('../commands/reminders.js')).registerRemindersCommand;
66
+ const loadRecordings = async () => (await import('../commands/recordings.js')).registerRecordingsCommand;
72
67
  export const LAZY_COMMAND_NAMES = new Set([
73
68
  'sessions',
74
69
  'teams',
@@ -79,8 +74,6 @@ export const COMMAND_LOADERS = {
79
74
  accounts: [loadAccounts],
80
75
  view: [loadView],
81
76
  inspect: [loadInspect],
82
- feedback: [loadFeedback],
83
- reminders: [loadReminders],
84
77
  commands: [loadCommands],
85
78
  hooks: [loadHooks],
86
79
  skills: [loadSkills],
@@ -105,7 +98,6 @@ export const COMMAND_LOADERS = {
105
98
  install: [loadPackages],
106
99
  packages: [loadPackages],
107
100
  routines: [loadRoutines],
108
- monitors: [loadMonitors],
109
101
  projects: [loadProjects],
110
102
  run: [loadRun],
111
103
  _callback: [loadOpen],
@@ -113,9 +105,7 @@ export const COMMAND_LOADERS = {
113
105
  fork: [loadFork],
114
106
  config: [loadConfig],
115
107
  models: [loadModels],
116
- modes: [loadModes],
117
108
  trash: [loadTrash],
118
- restore: [loadRestore],
119
109
  doctor: [loadDoctor],
120
110
  route: [loadRoute],
121
111
  routes: [loadRoute],
@@ -152,10 +142,10 @@ export const COMMAND_LOADERS = {
152
142
  mailboxes: [loadMailboxes],
153
143
  mailbox: [loadMailboxes],
154
144
  webhooks: [loadWebhooks],
155
- humans: [loadHumans],
156
145
  daemon: [loadDaemon],
157
146
  auth: [loadAuth],
158
147
  traces: [loadTraces],
148
+ recordings: [loadRecordings],
159
149
  };
160
150
  export async function buildFullCommandTree() {
161
151
  const packageJson = JSON.parse(readFileSync(fileURLToPath(new URL('../../package.json', import.meta.url)), 'utf8'));
@@ -98,10 +98,10 @@ export function registerAuthCommand(program) {
98
98
  agents auth whoami # who this machine is signed in as
99
99
  agents auth space create "Design Team" # start a space
100
100
  agents auth space invite ada@example.com # add a teammate
101
- agents auth logout # clear this machine only`,
101
+ agents auth logout # sign this machine out; revokes the worker tokens it minted`,
102
102
  notes: `Signing in is optional — every local feature works with no account; team spaces are what it unlocks.
103
103
  Sign-in is Google-only and opens a Phoenix-branded page; the CLI never sees a password.
104
- The session lives in this machine's agents state dir, so logging out here signs out nothing else.
104
+ The session lives in this machine's agents state dir, so logging out here signs out no other device. It does revoke the owner-notify device tokens this machine minted for workers; the next signed-in personal device mints replacements.
105
105
  Point at a different backend with PHOENIX_ID_BASE (defaults to the production service).
106
106
  Harness worker credentials are minted by \`agents accounts add <harness> [name]\` / \`agents accounts login <harness>#<name>\`, not by this command.`,
107
107
  });
@@ -119,9 +119,18 @@ Harness worker credentials are minted by \`agents accounts add <harness> [name]\
119
119
  });
120
120
  auth
121
121
  .command('logout')
122
- .description("Clear this machine's session (no other device is affected)")
123
- .action(() => runOrDie(() => {
122
+ .description("Clear this machine's session and revoke the worker owner-notify tokens it minted")
123
+ .action(() => runOrDie(async () => {
124
124
  const session = readSession();
125
+ if (session) {
126
+ const { revokeMintedOwnerNotifyTokens } = await import('../lib/owner-notify-tokens.js');
127
+ const tokens = await revokeMintedOwnerNotifyTokens();
128
+ if (tokens.revoked.length > 0)
129
+ console.log(chalk.gray(`Revoked the owner-notify device tokens this machine minted for ${tokens.revoked.join(', ')}.`));
130
+ for (const err of tokens.errors) {
131
+ console.error(chalk.yellow(`Could not revoke the owner-notify token for ${err.device}: ${err.message}. Revoke it in the account's API tokens.`));
132
+ }
133
+ }
125
134
  clearSession();
126
135
  console.log(session ? chalk.green(`Signed out ${session.email ?? 'this machine'}.`) : chalk.gray('Already signed out.'));
127
136
  }));
@@ -1,4 +1,4 @@
1
- import { registerCommandGroups, setHelpSections } from '../lib/help.js';
1
+ import { forwardsHelp, registerCommandGroups, setHelpSections } from '../lib/help.js';
2
2
  import { buildBrowserContext } from '../lib/browser/context.js';
3
3
  import { recordBrowserAction } from '../lib/browser/record.js';
4
4
  import { isBrowserClientError, resolveBrowserBin, runBrowser, } from '../lib/browser-client.js';
@@ -86,17 +86,16 @@ async function forwardAndExit(opts) {
86
86
  }
87
87
  function registerPassthroughVerbs(program) {
88
88
  for (const verb of BROWSER_PASSTHROUGH_VERBS) {
89
- program
89
+ forwardsHelp(program
90
90
  .command(verb.name)
91
91
  .description(verb.description)
92
92
  .allowUnknownOption(true)
93
93
  .allowExcessArguments(true)
94
- .helpOption(false)
95
94
  .action(async (_opts, cmd) => {
96
95
  const argv = [verb.name, ...cmd.args];
97
96
  const device = verb.name === 'start' ? peekDevice(cmd.args) : undefined;
98
97
  await forwardAndExit({ argv, device });
99
- });
98
+ }));
100
99
  }
101
100
  }
102
101
  function registerSessionsCommand(program) {
@@ -0,0 +1,7 @@
1
+ import type { Command } from 'commander';
2
+ import type { TranscriptRenderOptions } from '../lib/session/presentation.js';
3
+ export interface CloudTranscriptsOptions extends TranscriptRenderOptions {
4
+ limit?: string;
5
+ }
6
+ export declare function runCloudTranscripts(query: string | undefined, options: CloudTranscriptsOptions): Promise<void>;
7
+ export declare function registerCloudTranscriptsCommand(cloud: Command): void;
@@ -0,0 +1,100 @@
1
+ import chalk from 'chalk';
2
+ import { setHelpSections } from '../lib/help.js';
3
+ import { interruptibleSpinner } from '../lib/spinner.js';
4
+ const DEFAULT_LIMIT = '50';
5
+ export async function runCloudTranscripts(query, options) {
6
+ const { discoverCloudSessions, ensureCloudSessionCached } = await import('../lib/session/cloud.js');
7
+ const { buildFilterOptions, resolveViewMode, renderSession } = await import('../lib/session/presentation.js');
8
+ const { printSessionTable } = await import('./sessions.js');
9
+ let filterOpts;
10
+ try {
11
+ filterOpts = buildFilterOptions(options);
12
+ }
13
+ catch (err) {
14
+ console.error(chalk.red(err.message));
15
+ process.exit(1);
16
+ }
17
+ const mode = resolveViewMode(options, filterOpts);
18
+ const spinner = options.json ? null : interruptibleSpinner('Loading cloud sessions...').start();
19
+ let sessions;
20
+ try {
21
+ sessions = await discoverCloudSessions({ limit: parseInt(options.limit || DEFAULT_LIMIT, 10) });
22
+ }
23
+ catch (err) {
24
+ spinner?.stop();
25
+ console.error(chalk.red(`Failed to list cloud sessions: ${err?.message || err}`));
26
+ process.exit(1);
27
+ }
28
+ spinner?.stop();
29
+ if (!query) {
30
+ if (options.json) {
31
+ process.stdout.write(JSON.stringify(sessions, null, 2) + '\n');
32
+ return;
33
+ }
34
+ if (sessions.length === 0) {
35
+ console.log(chalk.gray('No cloud sessions captured yet.'));
36
+ return;
37
+ }
38
+ printSessionTable(sessions);
39
+ return;
40
+ }
41
+ const matches = sessions.filter((s) => s.id === query || s.shortId === query || s.id.startsWith(query));
42
+ if (matches.length === 0) {
43
+ console.error(chalk.red(`No cloud session matching: ${query}`));
44
+ process.exit(1);
45
+ }
46
+ if (matches.length > 1) {
47
+ console.error(chalk.red(`Multiple cloud sessions match "${query}":`));
48
+ for (const m of matches.slice(0, 10)) {
49
+ console.error(chalk.cyan(` ${m.shortId} ${m.id}`));
50
+ }
51
+ process.exit(1);
52
+ }
53
+ const meta = matches[0];
54
+ const cachedSpinner = options.json ? null : interruptibleSpinner('Fetching session...').start();
55
+ let cachedPath;
56
+ try {
57
+ cachedPath = await ensureCloudSessionCached(meta.id);
58
+ }
59
+ catch (err) {
60
+ cachedSpinner?.stop();
61
+ console.error(chalk.red(`Failed to fetch session: ${err?.message || err}`));
62
+ process.exit(1);
63
+ }
64
+ cachedSpinner?.stop();
65
+ await renderSession({ ...meta, filePath: cachedPath }, mode, filterOpts, options);
66
+ }
67
+ export function registerCloudTranscriptsCommand(cloud) {
68
+ const cmd = cloud
69
+ .command('transcripts [selector]')
70
+ .description('List captured Rush Cloud run transcripts, or render one by id, short id, or id prefix.')
71
+ .option('-n, --limit <n>', 'Maximum number of runs to list', DEFAULT_LIMIT)
72
+ .option('--json', 'Output JSON (run list without a selector, event array for one run)')
73
+ .option('--markdown', 'Render the transcript as markdown (user, assistant, thinking, tool calls)')
74
+ .option('--no-redact', 'Disable default secret redaction in rendered output (--markdown and --json)')
75
+ .option('--include <roles>', 'Only include these roles (comma-separated): user, assistant, thinking, tools')
76
+ .option('--exclude <roles>', 'Exclude these roles (comma-separated): user, assistant, thinking, tools')
77
+ .option('--first <n>', 'Keep only the first N turns (a turn starts at each genuine user message)')
78
+ .option('--last <n>', 'Keep only the last N turns (a turn starts at each genuine user message)')
79
+ .action(async (selector, options) => {
80
+ await runCloudTranscripts(selector, options);
81
+ });
82
+ setHelpSections(cmd, {
83
+ examples: `
84
+ # Captured runs, newest first
85
+ agents cloud transcripts
86
+
87
+ # One run's transcript as a summary, then as markdown
88
+ agents cloud transcripts 3f2a9c1e
89
+ agents cloud transcripts 3f2a9c1e --markdown
90
+
91
+ # The last two turns of a run, tools only, as JSON
92
+ agents cloud transcripts 3f2a9c1e --include tools --last 2 --json
93
+ `,
94
+ notes: `
95
+ - Reads Rush Cloud runs through your \`rush login\` session (~/.rush/user.yaml). A failed login or an unmatched or ambiguous selector exits 1; it never falls back to local sessions.
96
+ - Every render fetches the run's transcript again and rewrites its copy under the agents cache.
97
+ - Same output as \`agents sessions --cloud\`. \`agents cloud list/status/logs\` cover the run jobs, not their transcripts.
98
+ `,
99
+ });
100
+ }
@@ -7,6 +7,7 @@ import { MAX_IMAGES_PER_DISPATCH } from '../lib/cloud/types.js';
7
7
  import { resolveCloudPrompt, executeCloudDispatch } from '../lib/cloud/dispatch.js';
8
8
  import { normalizeTriggerEvent, validateTrigger, writeJob, setJobEnabled, jobExists, GITHUB_TRIGGER_EVENTS } from '../lib/scheduling/routines.js';
9
9
  import { emit } from '../lib/feed/events.js';
10
+ import { registerCloudTranscriptsCommand } from './cloud-transcripts.js';
10
11
  export function statusColor(status) {
11
12
  switch (status) {
12
13
  case 'queued':
@@ -63,6 +64,9 @@ Examples:
63
64
  # Live-tail logs for a running task
64
65
  agents cloud logs tsk_4f2a91
65
66
 
67
+ # Read a captured Rush Cloud run's transcript (list without an id)
68
+ agents cloud transcripts 3f2a9c1e --markdown
69
+
66
70
  # Send a follow-up while the task is in needs-review
67
71
  agents cloud message tsk_4f2a91 "Looks good — also update the OpenAPI spec"
68
72
 
@@ -495,4 +499,5 @@ Examples:
495
499
  }
496
500
  }
497
501
  });
502
+ registerCloudTranscriptsCommand(cloud);
498
503
  }
@@ -39,7 +39,6 @@
39
39
  * own event ledger.
40
40
  */
41
41
  import { Command } from 'commander';
42
- import { type ComputerTargetContext } from '../lib/computer/context.js';
43
42
  export declare const COMPUTER_PASSTHROUGH_VERBS: ReadonlyArray<{
44
43
  name: string;
45
44
  description: string;
@@ -50,15 +49,4 @@ export declare function shouldBlockOffPlatform(opts: {
50
49
  vncConfigured?: boolean;
51
50
  device?: string;
52
51
  }): boolean;
53
- export declare function withHostFlag(argv: string[], host?: string): string[];
54
- export declare function resolveDeviceHost(device: string): Promise<{
55
- host: string;
56
- target: ComputerTargetContext;
57
- }>;
58
52
  export declare function registerComputerCommand(program: Command): void;
59
- export declare function installComputerHelperMacLocal(): Promise<void>;
60
- export declare function activateComputerHelperMacLocal(): Promise<{
61
- trusted: boolean;
62
- }>;
63
- export declare function parseTrustFromStatusJson(stdout: string): boolean;
64
- export declare function probeComputerTrust(): Promise<boolean>;
@@ -38,14 +38,9 @@
38
38
  * `sessions` is the one verb that never reaches the engine: it reads agents-cli's
39
39
  * own event ledger.
40
40
  */
41
- import { registerCommandGroups, setHelpSections } from '../lib/help.js';
41
+ import { forwardsHelp, registerCommandGroups, setHelpSections } from '../lib/help.js';
42
42
  import { loadComputerAllowList, loadDefaultPeers, resolveTcpEndpoint, resolveVncEndpoint, } from '../lib/computer/policy.js';
43
- import { buildComputerContext } from '../lib/computer/context.js';
44
- import { recordComputerAction } from '../lib/computer/record.js';
45
- import { resolveRemoteDevice } from '../lib/ssh-tunnel.js';
46
- import { getConfigValue } from '../lib/device-config.js';
47
- import { parseAddress, sshTarget } from '../lib/address.js';
48
- import { isComputerClientError, resolveComputerBin, runComputer, } from '../lib/computer-client.js';
43
+ import { forwardToComputer } from '../lib/computer-client.js';
49
44
  import { runComputerSessionsCommand } from './computer-sessions-picker.js';
50
45
  const COMPUTER_HELP_GROUPS = [
51
46
  { title: 'Installation', names: ['setup'] },
@@ -85,67 +80,6 @@ export function shouldBlockOffPlatform(opts) {
85
80
  return false;
86
81
  return true;
87
82
  }
88
- export function withHostFlag(argv, host) {
89
- if (!host)
90
- return argv;
91
- if (argv.some((arg) => arg === '--host' || arg.startsWith('--host=')))
92
- return argv;
93
- const [verb, ...rest] = argv;
94
- return [verb, '--host', host, ...rest];
95
- }
96
- export async function resolveDeviceHost(device) {
97
- const configured = getConfigValue('computer.host', { device }).value;
98
- if (configured) {
99
- const addr = parseAddress(configured);
100
- if (addr.scheme === 'vnc' || addr.scheme === 'tcp') {
101
- return { host: configured, target: { alias: device, host: addr.host, user: addr.user ?? '', hostname: addr.host, platform: addr.scheme, sshArgs: [] } };
102
- }
103
- const resolved = await resolveRemoteDevice(device, {});
104
- const target = sshTarget(addr);
105
- return {
106
- host: configured,
107
- target: { alias: device, host: target, user: addr.user ?? resolved.user, hostname: addr.host, platform: resolved.device.platform, sshArgs: resolved.identityArgs },
108
- };
109
- }
110
- const resolved = await resolveRemoteDevice(device, {
111
- expectPlatform: 'windows',
112
- forWhat: '`agents computer --device` drives the Windows computer-helper daemon, so it',
113
- });
114
- return {
115
- host: `ssh://${resolved.target}`,
116
- target: { alias: device, host: resolved.target, user: resolved.user, hostname: resolved.host, platform: resolved.device.platform, sshArgs: resolved.identityArgs },
117
- };
118
- }
119
- async function forwardToComputer(opts) {
120
- let bin;
121
- try {
122
- bin = resolveComputerBin();
123
- }
124
- catch (err) {
125
- if (isComputerClientError(err)) {
126
- console.error(err.message);
127
- return { exitCode: 1, stdout: '' };
128
- }
129
- throw err;
130
- }
131
- const hostFlag = opts.argv.findIndex(arg => arg === '--host' || arg.startsWith('--host='));
132
- let host = hostFlag < 0 ? undefined : (opts.argv[hostFlag].includes('=') ? opts.argv[hostFlag].slice(7) : opts.argv[hostFlag + 1]);
133
- let target;
134
- if (!host && opts.device) {
135
- const resolved = await resolveDeviceHost(opts.device);
136
- host = resolved.host;
137
- target = resolved.target;
138
- }
139
- const context = await buildComputerContext({ device: opts.device, host, target, computerBin: bin });
140
- return runComputer({
141
- argv: withHostFlag(opts.argv, host),
142
- context,
143
- capture: opts.capture,
144
- onEvent: opts.record === false
145
- ? undefined
146
- : (event) => recordComputerAction(event, { device: opts.device }),
147
- });
148
- }
149
83
  async function forwardAndExit(opts) {
150
84
  const { exitCode } = await forwardToComputer(opts);
151
85
  if (exitCode !== 0)
@@ -227,75 +161,69 @@ function registerComputerSubcommands(program) {
227
161
  }
228
162
  function registerPassthroughVerbs(program) {
229
163
  for (const verb of COMPUTER_PASSTHROUGH_VERBS) {
230
- program
164
+ forwardsHelp(program
231
165
  .command(verb.name)
232
166
  .description(verb.description)
233
167
  .option('--device <name>', 'Drive a remote Windows device registered with `agents devices` (the engine connects or provisions it on demand)')
234
168
  .allowUnknownOption(true)
235
169
  .allowExcessArguments(true)
236
- .helpOption(false)
237
170
  .action(async (opts, cmd) => {
238
171
  await forwardAndExit({ argv: [verb.name, ...cmd.args], device: opts.device });
239
- });
172
+ }));
240
173
  }
241
174
  }
242
175
  function registerSetupCommand(program) {
243
- program
176
+ forwardsHelp(program
244
177
  .command('setup')
245
178
  .alias('install-helper')
246
179
  .description('Install the helper — locally to /Applications/ (macOS), or to a remote Windows device with --device')
247
180
  .option('--device <name>', 'Provision a remote Windows device (push the exe + register a LOGON task) instead of installing locally')
248
181
  .allowUnknownOption(true)
249
182
  .allowExcessArguments(true)
250
- .helpOption(false)
251
183
  .action(async (opts, cmd) => {
252
184
  await forwardAndExit({ argv: ['setup', ...cmd.args], device: opts.device, record: false });
253
- });
185
+ }));
254
186
  }
255
187
  function registerStartCommand(program) {
256
- program
188
+ forwardsHelp(program
257
189
  .command('start')
258
190
  .description('Activate the helper daemon — local launchd (macOS) or a remote Windows tunnel with --device')
259
191
  .option('--device <name>', 'Start the remote Windows daemon and its tunnel instead of the local launchd service')
260
192
  .allowUnknownOption(true)
261
193
  .allowExcessArguments(true)
262
- .helpOption(false)
263
194
  .action(async (opts, cmd) => {
264
195
  await forwardAndExit({ argv: ['start', ...cmd.args], device: opts.device, record: false });
265
- });
196
+ }));
266
197
  }
267
198
  function registerStopCommand(program) {
268
- program
199
+ forwardsHelp(program
269
200
  .command('stop')
270
201
  .description('Deactivate the helper daemon — local launchd (macOS) or a remote Windows tunnel with --device')
271
202
  .option('--device <name>', 'Tear down the remote tunnel and unregister the scheduled task')
272
203
  .allowUnknownOption(true)
273
204
  .allowExcessArguments(true)
274
- .helpOption(false)
275
205
  .action(async (opts, cmd) => {
276
206
  await forwardAndExit({ argv: ['stop', ...cmd.args], device: opts.device, record: false });
277
- });
207
+ }));
278
208
  }
279
209
  function registerReloadCommand(program) {
280
- program
210
+ forwardsHelp(program
281
211
  .command('reload')
282
212
  .description('Reload the allow-list policy (SIGHUP the local daemon) — or restart a remote Windows daemon with --device')
283
213
  .option('--device <name>', 'Restart the remote Windows daemon (its scheduled task) instead of SIGHUPing the local one')
284
214
  .allowUnknownOption(true)
285
215
  .allowExcessArguments(true)
286
- .helpOption(false)
287
216
  .action(async (opts, cmd) => {
288
217
  await forwardAndExit({ argv: ['reload', ...cmd.args], device: opts.device, record: false });
289
- });
218
+ }));
290
219
  }
291
220
  function registerStatusCommand(program) {
292
- program
221
+ forwardsHelp(program
293
222
  .command('status')
294
223
  .description('Report install state, daemon state, and Accessibility trust — or a remote Windows daemon with --device')
295
224
  .option('--device <name>', 'Report the remote Windows daemon (tunnel + liveness) instead of the local helper')
296
225
  .allowUnknownOption(true)
297
226
  .allowExcessArguments(true)
298
- .helpOption(false)
299
227
  .action(async (opts, cmd) => {
300
228
  const json = cmd.args.includes('--json');
301
229
  if (!json && !opts.device) {
@@ -306,7 +234,7 @@ function registerStatusCommand(program) {
306
234
  console.log(`peers: ${loadDefaultPeers().length} caller(s) (peer-auth on socket)`);
307
235
  }
308
236
  await forwardAndExit({ argv: ['status', ...cmd.args], device: opts.device, record: false });
309
- });
237
+ }));
310
238
  }
311
239
  function registerSessionsCommand(program) {
312
240
  program
@@ -320,41 +248,3 @@ function registerSessionsCommand(program) {
320
248
  await runComputerSessionsCommand({ machine: opts.machine, limit: opts.limit, json: opts.json, interactive: opts.interactive });
321
249
  });
322
250
  }
323
- export async function installComputerHelperMacLocal() {
324
- const { exitCode } = await forwardToComputer({ argv: ['setup'], record: false });
325
- if (exitCode !== 0)
326
- throw new Error(`\`computer setup\` failed (exit ${exitCode})`);
327
- }
328
- export async function activateComputerHelperMacLocal() {
329
- const { exitCode } = await forwardToComputer({ argv: ['start'], record: false });
330
- if (exitCode !== 0)
331
- throw new Error(`\`computer start\` failed (exit ${exitCode})`);
332
- return { trusted: await probeComputerTrust() };
333
- }
334
- export function parseTrustFromStatusJson(stdout) {
335
- const start = stdout.indexOf('{');
336
- if (start < 0)
337
- return false;
338
- try {
339
- const parsed = JSON.parse(stdout.slice(start));
340
- return parsed.trusted === true;
341
- }
342
- catch {
343
- return false;
344
- }
345
- }
346
- export async function probeComputerTrust() {
347
- try {
348
- const { exitCode, stdout } = await forwardToComputer({
349
- argv: ['status', '--json'],
350
- record: false,
351
- capture: true,
352
- });
353
- if (exitCode !== 0)
354
- return false;
355
- return parseTrustFromStatusJson(stdout);
356
- }
357
- catch {
358
- return false;
359
- }
360
- }
@@ -1,7 +1,7 @@
1
1
  import chalk from 'chalk';
2
2
  import { AGENTS } from '../lib/agents.js';
3
3
  import { setHelpSections } from '../lib/help.js';
4
- import { parseConfigKey, formatConfigKey, formatAgentVersion, devicePropertyToConfigName, configKeyStorageHint, MENUBAR_MENU_PROPERTIES, } from '../lib/config-keys.js';
4
+ import { parseConfigKey, formatConfigKey, formatAgentVersion, devicePropertyToConfigName, configKeyStorageHint, MENUBAR_CONFIG_KEYS, } from '../lib/config-keys.js';
5
5
  import { registerBudgetCommand } from './budget.js';
6
6
  import { resolveRunDefaults, setRunDefaultModel, setRunDefaultMode, setRunDefaultEffort, unsetRunDefault, } from '../lib/run-defaults.js';
7
7
  import { resolveTierOverride, setTierOverride, clearTierOverride } from '../lib/model-tier-overrides.js';
@@ -344,8 +344,7 @@ function* listCentralConfigEntries() {
344
344
  yield { key, value, hint: configKeyStorageHint(parseConfigKey(key)) };
345
345
  }
346
346
  }
347
- for (const prop of MENUBAR_MENU_PROPERTIES) {
348
- const key = `menubar.menu.${prop}`;
347
+ for (const key of MENUBAR_CONFIG_KEYS) {
349
348
  const value = getConfigValue(key).value;
350
349
  if (value !== undefined) {
351
350
  yield { key, value, hint: configKeyStorageHint(parseConfigKey(key)) };
@@ -421,8 +420,10 @@ export function registerConfigCommand(program) {
421
420
  agents config set devices.mac-mini.max-agents 4
422
421
  agents config set updates.auto off
423
422
  agents config set updates.claude.auto off
424
- agents config set menubar.menu.tabOrder home,projects,sessions,inbox
423
+ agents config set menubar.menu.tabOrder home,goals,sessions,projects,inbox
425
424
  agents config set menubar.menu.pinnedProjects '["Rush","AGI Menu"]'
425
+ agents config set menubar.menu.homeGoals company,myDay
426
+ agents config set menubar.statusbar.goalCountdown on
426
427
  agents config get run.claude@*.model
427
428
  agents config unset run.claude@*.tier.best
428
429
  agents config list
@@ -0,0 +1,2 @@
1
+ import type { Command } from 'commander';
2
+ export declare function registerDaemonIndexCommand(daemonCmd: Command): void;
@@ -0,0 +1,44 @@
1
+ import { setHelpSections } from '../lib/help.js';
2
+ import { getSessionRoots } from '../lib/session/discover.js';
3
+ import { registerBackfillCommand } from './sessions-backfill.js';
4
+ import { registerOptimizeCommand } from './sessions-optimize.js';
5
+ export function registerDaemonIndexCommand(daemonCmd) {
6
+ const index = daemonCmd
7
+ .command('index')
8
+ .description('Maintain the session index the daemon keeps: transcript roots, FTS compaction, historical backfills. Runs in the foreground; never starts or restarts the daemon.');
9
+ setHelpSections(index, {
10
+ examples: `
11
+ # Directories the indexer scans, per agent (JSON)
12
+ agents daemon index roots
13
+
14
+ # Compact the full-text search index
15
+ agents daemon index optimize
16
+
17
+ # One-shot historical catch-up
18
+ agents daemon index backfill tools --fleet
19
+ agents daemon index backfill resources --since 30d
20
+ agents daemon index backfill titles --limit 20
21
+ `,
22
+ notes: `
23
+ - The daemon's session-index service keeps new and changed sessions current on its own; these verbs are explicit maintenance on top of it.
24
+ - Each verb is the same engine as its \`agents sessions\` spelling (\`--roots\`, \`optimize\`, \`backfill\`).
25
+ `,
26
+ });
27
+ const roots = index
28
+ .command('roots')
29
+ .description('Print the on-disk directories scanned for session transcripts, per agent, as JSON (for external watchers)');
30
+ roots.action(() => {
31
+ process.stdout.write(JSON.stringify(getSessionRoots(), null, 2) + '\n');
32
+ });
33
+ setHelpSections(roots, {
34
+ examples: `
35
+ # Every existing transcript directory, including routine run archives
36
+ agents daemon index roots
37
+ `,
38
+ notes: `
39
+ - Output is always a JSON array of { agent, dirs }; an agent with no existing directory is omitted.
40
+ `,
41
+ });
42
+ registerOptimizeCommand(index, 'agents daemon index optimize');
43
+ registerBackfillCommand(index, 'agents daemon index backfill');
44
+ }