@phnx-labs/agents-cli 1.22.39 → 1.22.40

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 (554) hide show
  1. package/CHANGELOG.md +294 -0
  2. package/README.md +111 -70
  3. package/dist/bin/agents +0 -0
  4. package/dist/bootstrap.js +45 -26
  5. package/dist/browser.js +2 -2
  6. package/dist/cli/command-registry.d.ts +135 -0
  7. package/dist/cli/command-registry.js +260 -0
  8. package/dist/commands/accounts.d.ts +20 -0
  9. package/dist/commands/accounts.js +186 -25
  10. package/dist/commands/apply.d.ts +3 -3
  11. package/dist/commands/apply.js +20 -63
  12. package/dist/commands/browser.js +206 -94
  13. package/dist/commands/budget.d.ts +7 -6
  14. package/dist/commands/budget.js +8 -7
  15. package/dist/commands/cloud.js +17 -20
  16. package/dist/commands/commands.js +1 -1
  17. package/dist/commands/computer-actions.d.ts +1 -35
  18. package/dist/commands/computer-actions.js +13 -181
  19. package/dist/commands/computer.d.ts +28 -3
  20. package/dist/commands/computer.js +93 -65
  21. package/dist/commands/config.js +16 -3
  22. package/dist/commands/cost.d.ts +2 -1
  23. package/dist/commands/cost.js +7 -6
  24. package/dist/commands/daemon.js +151 -4
  25. package/dist/commands/detach.js +1 -1
  26. package/dist/commands/doctor.js +19 -11
  27. package/dist/commands/events.js +1 -1
  28. package/dist/commands/exec.d.ts +2 -50
  29. package/dist/commands/exec.js +160 -215
  30. package/dist/commands/factory.js +1 -1
  31. package/dist/commands/feed.d.ts +2 -2
  32. package/dist/commands/feed.js +9 -12
  33. package/dist/commands/fleet-capture.js +25 -27
  34. package/dist/commands/focus.d.ts +2 -3
  35. package/dist/commands/focus.js +34 -9
  36. package/dist/commands/go.js +15 -5
  37. package/dist/commands/harness.d.ts +3 -3
  38. package/dist/commands/harness.js +53 -5
  39. package/dist/commands/hooks.js +1 -1
  40. package/dist/commands/import.js +2 -2
  41. package/dist/commands/insights.d.ts +5 -5
  42. package/dist/commands/insights.js +15 -9
  43. package/dist/commands/inspect.d.ts +2 -3
  44. package/dist/commands/inspect.js +4 -16
  45. package/dist/commands/logs.d.ts +2 -2
  46. package/dist/commands/logs.js +9 -9
  47. package/dist/commands/mcp.js +2 -2
  48. package/dist/commands/memory.js +1 -1
  49. package/dist/commands/message.d.ts +1 -1
  50. package/dist/commands/message.js +7 -7
  51. package/dist/commands/mine.d.ts +11 -8
  52. package/dist/commands/mine.js +11 -10
  53. package/dist/commands/models.js +1 -1
  54. package/dist/commands/modes.js +1 -1
  55. package/dist/commands/monitors.js +23 -6
  56. package/dist/commands/output.d.ts +7 -6
  57. package/dist/commands/output.js +11 -10
  58. package/dist/commands/packages.js +4 -4
  59. package/dist/commands/perf.js +1 -1
  60. package/dist/commands/permissions.js +49 -32
  61. package/dist/commands/plugins.d.ts +1 -1
  62. package/dist/commands/plugins.js +3 -3
  63. package/dist/commands/profiles.d.ts +6 -9
  64. package/dist/commands/profiles.js +8 -321
  65. package/dist/commands/projects.d.ts +9 -0
  66. package/dist/commands/projects.js +140 -8
  67. package/dist/commands/prune.js +5 -13
  68. package/dist/commands/refresh-rules.js +1 -1
  69. package/dist/commands/repo.d.ts +5 -7
  70. package/dist/commands/repo.js +34 -18
  71. package/dist/commands/resource-view.js +4 -0
  72. package/dist/commands/resume.d.ts +11 -7
  73. package/dist/commands/resume.js +82 -98
  74. package/dist/commands/route.d.ts +12 -0
  75. package/dist/commands/route.js +261 -0
  76. package/dist/commands/routines.d.ts +2 -3
  77. package/dist/commands/routines.js +120 -145
  78. package/dist/commands/rules.js +1 -1
  79. package/dist/commands/run-account-picker.d.ts +1 -1
  80. package/dist/commands/run-account-picker.js +2 -2
  81. package/dist/commands/run-broadcast.d.ts +21 -0
  82. package/dist/commands/run-broadcast.js +89 -0
  83. package/dist/commands/run-cloud.js +1 -1
  84. package/dist/commands/secrets-vault.d.ts +10 -0
  85. package/dist/commands/{login.js → secrets-vault.js} +34 -14
  86. package/dist/commands/secrets.d.ts +4 -4
  87. package/dist/commands/secrets.js +72 -63
  88. package/dist/commands/sessions-backfill.js +1 -1
  89. package/dist/commands/sessions-browser.d.ts +1 -1
  90. package/dist/commands/sessions-browser.js +9 -5
  91. package/dist/commands/sessions-export.js +2 -2
  92. package/dist/commands/sessions-inject.js +4 -5
  93. package/dist/commands/sessions-migrate.js +16 -27
  94. package/dist/commands/sessions-picker.d.ts +13 -0
  95. package/dist/commands/sessions-picker.js +182 -8
  96. package/dist/commands/sessions-resume.d.ts +7 -3
  97. package/dist/commands/sessions-resume.js +81 -33
  98. package/dist/commands/sessions-stats.js +2 -2
  99. package/dist/commands/sessions.d.ts +75 -68
  100. package/dist/commands/sessions.js +142 -180
  101. package/dist/commands/setup-computer.js +1 -1
  102. package/dist/commands/setup-fleet.js +3 -0
  103. package/dist/commands/setup-mine.d.ts +7 -3
  104. package/dist/commands/setup-mine.js +13 -8
  105. package/dist/commands/setup-secrets.js +2 -2
  106. package/dist/commands/setup-watchdog.js +2 -2
  107. package/dist/commands/setup.js +7 -2
  108. package/dist/commands/share.d.ts +65 -0
  109. package/dist/commands/share.js +253 -20
  110. package/dist/commands/skills.js +3 -3
  111. package/dist/commands/snapshot.d.ts +2 -2
  112. package/dist/commands/snapshot.js +9 -9
  113. package/dist/commands/ssh.d.ts +1 -1
  114. package/dist/commands/ssh.js +186 -64
  115. package/dist/commands/subagents.js +1 -1
  116. package/dist/commands/sync.js +24 -9
  117. package/dist/commands/teams.d.ts +2 -2
  118. package/dist/commands/teams.js +9 -18
  119. package/dist/commands/tmux.js +5 -1
  120. package/dist/commands/trash.js +1 -1
  121. package/dist/commands/usage.d.ts +1 -1
  122. package/dist/commands/usage.js +2 -2
  123. package/dist/commands/utils.d.ts +4 -14
  124. package/dist/commands/utils.js +6 -27
  125. package/dist/commands/versions.js +2 -2
  126. package/dist/commands/view.d.ts +9 -77
  127. package/dist/commands/view.js +23 -8
  128. package/dist/commands/watchdog.js +1 -1
  129. package/dist/commands/webhook.js +11 -25
  130. package/dist/commands/workflows.js +1 -1
  131. package/dist/index.js +1 -1
  132. package/dist/lib/account-capabilities.d.ts +39 -0
  133. package/dist/lib/account-capabilities.js +59 -0
  134. package/dist/lib/account-catalog.js +1 -1
  135. package/dist/lib/account-registry.d.ts +66 -0
  136. package/dist/lib/account-registry.js +151 -5
  137. package/dist/lib/{rotate.d.ts → accounting/rotate.d.ts} +4 -4
  138. package/dist/lib/{rotate.js → accounting/rotate.js} +8 -8
  139. package/dist/lib/{usage.d.ts → accounting/usage.d.ts} +4 -4
  140. package/dist/lib/{usage.js → accounting/usage.js} +11 -11
  141. package/dist/lib/agent-spec/provider.js +1 -1
  142. package/dist/lib/agents.d.ts +72 -4
  143. package/dist/lib/agents.js +231 -199
  144. package/dist/lib/answer-router.d.ts +2 -2
  145. package/dist/lib/ask-classifier.d.ts +1 -1
  146. package/dist/lib/ask-classifier.js +1 -1
  147. package/dist/lib/audit/log.js +1 -1
  148. package/dist/lib/auth-health.d.ts +1 -1
  149. package/dist/lib/auth-health.js +2 -2
  150. package/dist/lib/brand.js +1 -1
  151. package/dist/lib/browser/caller-identity.d.ts +28 -0
  152. package/dist/lib/browser/caller-identity.js +156 -0
  153. package/dist/lib/browser/cdp.js +1 -1
  154. package/dist/lib/browser/drivers/ssh.d.ts +1 -1
  155. package/dist/lib/browser/drivers/ssh.js +2 -2
  156. package/dist/lib/browser/hygiene.d.ts +10 -2
  157. package/dist/lib/browser/hygiene.js +7 -4
  158. package/dist/lib/browser/ipc.d.ts +22 -2
  159. package/dist/lib/browser/ipc.js +185 -21
  160. package/dist/lib/browser/profiles.d.ts +67 -3
  161. package/dist/lib/browser/profiles.js +129 -7
  162. package/dist/lib/browser/remote-control.d.ts +2 -2
  163. package/dist/lib/browser/remote-control.js +3 -3
  164. package/dist/lib/browser/runtime-state.d.ts +79 -0
  165. package/dist/lib/browser/runtime-state.js +119 -1
  166. package/dist/lib/browser/service.d.ts +113 -1
  167. package/dist/lib/browser/service.js +454 -40
  168. package/dist/lib/browser/sessions-list.d.ts +2 -1
  169. package/dist/lib/browser/sessions-list.js +4 -13
  170. package/dist/lib/browser/types.d.ts +18 -0
  171. package/dist/lib/budget/config.js +1 -1
  172. package/dist/lib/budget/ledger.js +1 -1
  173. package/dist/lib/byok-usage.js +1 -1
  174. package/dist/lib/capabilities.js +3 -15
  175. package/dist/lib/catchup.d.ts +1 -1
  176. package/dist/lib/catchup.js +1 -1
  177. package/dist/lib/cloud/dispatch.js +1 -1
  178. package/dist/lib/cloud/host.d.ts +3 -3
  179. package/dist/lib/cloud/host.js +5 -5
  180. package/dist/lib/cloud/rush.d.ts +9 -21
  181. package/dist/lib/cloud/rush.js +33 -120
  182. package/dist/lib/cloud/types.d.ts +2 -2
  183. package/dist/lib/commands.js +3 -13
  184. package/dist/lib/computer/actions.d.ts +36 -0
  185. package/dist/lib/computer/actions.js +162 -0
  186. package/dist/lib/computer/dispatch.d.ts +2 -2
  187. package/dist/lib/computer/dispatch.js +2 -2
  188. package/dist/lib/computer/sessions-list.d.ts +3 -3
  189. package/dist/lib/computer/sessions-list.js +2 -2
  190. package/dist/lib/config-keys.d.ts +2 -1
  191. package/dist/lib/config-keys.js +8 -4
  192. package/dist/lib/config-machine-keys.d.ts +4 -2
  193. package/dist/lib/config-machine-keys.js +5 -2
  194. package/dist/lib/crabbox/lease.js +9 -1
  195. package/dist/lib/crabbox/runtimes.d.ts +32 -7
  196. package/dist/lib/crabbox/runtimes.js +72 -30
  197. package/dist/lib/{daemon.d.ts → daemon/daemon.d.ts} +59 -1
  198. package/dist/lib/{daemon.js → daemon/daemon.js} +237 -49
  199. package/dist/lib/daemon-services.d.ts +1 -1
  200. package/dist/lib/daemon-services.js +5 -0
  201. package/dist/lib/daemon-ticks.d.ts +25 -0
  202. package/dist/lib/daemon-ticks.js +31 -1
  203. package/dist/lib/daemon-webhooks.d.ts +102 -0
  204. package/dist/lib/daemon-webhooks.js +210 -0
  205. package/dist/lib/device-config.d.ts +85 -75
  206. package/dist/lib/device-config.js +279 -141
  207. package/dist/lib/devices/config-migration.d.ts +29 -34
  208. package/dist/lib/devices/config-migration.js +209 -130
  209. package/dist/lib/devices/connect.d.ts +2 -2
  210. package/dist/lib/devices/connect.js +2 -2
  211. package/dist/lib/devices/discovery-policy.d.ts +30 -0
  212. package/dist/lib/devices/discovery-policy.js +101 -0
  213. package/dist/lib/devices/fleet-inventory.js +8 -3
  214. package/dist/lib/devices/harness-inventory.d.ts +1 -1
  215. package/dist/lib/devices/harness-inventory.js +12 -3
  216. package/dist/lib/devices/known-hosts.js +1 -1
  217. package/dist/lib/devices/pool.d.ts +10 -5
  218. package/dist/lib/devices/pool.js +5 -7
  219. package/dist/lib/devices/registry.d.ts +1 -1
  220. package/dist/lib/devices/registry.js +1 -1
  221. package/dist/lib/devices/resolve-profile.d.ts +2 -2
  222. package/dist/lib/devices/resolve-profile.js +2 -2
  223. package/dist/lib/devices/resolve-target.d.ts +1 -1
  224. package/dist/lib/devices/resolve-target.js +4 -4
  225. package/dist/lib/devices/self-host.d.ts +1 -1
  226. package/dist/lib/devices/self-host.js +3 -3
  227. package/dist/lib/devices/ssh-config.d.ts +1 -1
  228. package/dist/lib/devices/stats-cache.js +1 -1
  229. package/dist/lib/devices/sync.d.ts +3 -1
  230. package/dist/lib/devices/sync.js +3 -3
  231. package/dist/lib/doctor-diff.js +4 -4
  232. package/dist/lib/drift-sync.js +2 -2
  233. package/dist/lib/drift.js +2 -2
  234. package/dist/lib/event-families.d.ts +1 -1
  235. package/dist/lib/event-stream.d.ts +1 -1
  236. package/dist/lib/event-stream.js +2 -2
  237. package/dist/lib/events-ingest.js +2 -2
  238. package/dist/lib/exec.d.ts +4 -4
  239. package/dist/lib/exec.js +11 -11
  240. package/dist/lib/factory/snapshot.d.ts +1 -1
  241. package/dist/lib/factory/snapshot.js +1 -1
  242. package/dist/lib/{activity.d.ts → feed/activity.d.ts} +1 -1
  243. package/dist/lib/{activity.js → feed/activity.js} +7 -7
  244. package/dist/lib/{events.d.ts → feed/events.d.ts} +2 -2
  245. package/dist/lib/{events.js → feed/events.js} +5 -5
  246. package/dist/lib/{feed.js → feed/feed.js} +4 -4
  247. package/dist/lib/feed-outcome.d.ts +1 -1
  248. package/dist/lib/feed-policy.d.ts +1 -1
  249. package/dist/lib/feed-policy.js +1 -1
  250. package/dist/lib/feed-post.d.ts +1 -1
  251. package/dist/lib/feed-post.js +1 -1
  252. package/dist/lib/feed-ranking.d.ts +1 -1
  253. package/dist/lib/fleet/apply.d.ts +0 -6
  254. package/dist/lib/fleet/apply.js +18 -45
  255. package/dist/lib/fleet/auth-sync.d.ts +16 -35
  256. package/dist/lib/fleet/auth-sync.js +16 -75
  257. package/dist/lib/fleet/capture.js +8 -6
  258. package/dist/lib/fleet/manifest.js +23 -11
  259. package/dist/lib/fleet/types.d.ts +19 -7
  260. package/dist/lib/fleet-cache.d.ts +1 -1
  261. package/dist/lib/fleet-cache.js +1 -1
  262. package/dist/lib/format.d.ts +19 -0
  263. package/dist/lib/format.js +44 -1
  264. package/dist/lib/friction-heuristics.d.ts +1 -1
  265. package/dist/lib/git.d.ts +24 -1
  266. package/dist/lib/git.js +82 -38
  267. package/dist/lib/heal.js +3 -3
  268. package/dist/lib/hooks.d.ts +18 -0
  269. package/dist/lib/hooks.js +113 -1
  270. package/dist/lib/hosts/credentials.d.ts +30 -10
  271. package/dist/lib/hosts/credentials.js +38 -26
  272. package/dist/lib/hosts/dispatch.d.ts +3 -3
  273. package/dist/lib/hosts/dispatch.js +3 -3
  274. package/dist/lib/hosts/option.d.ts +3 -3
  275. package/dist/lib/hosts/option.js +7 -8
  276. package/dist/lib/hosts/passthrough.d.ts +17 -17
  277. package/dist/lib/hosts/passthrough.js +67 -50
  278. package/dist/lib/hosts/providers/devices.d.ts +1 -1
  279. package/dist/lib/hosts/providers/devices.js +1 -1
  280. package/dist/lib/hosts/reconcile.d.ts +1 -1
  281. package/dist/lib/hosts/reconcile.js +1 -1
  282. package/dist/lib/hosts/reconnect.d.ts +1 -1
  283. package/dist/lib/hosts/reconnect.js +2 -2
  284. package/dist/lib/hosts/registry.d.ts +5 -5
  285. package/dist/lib/hosts/registry.js +5 -5
  286. package/dist/lib/hosts/remote-cmd.d.ts +10 -10
  287. package/dist/lib/hosts/remote-cmd.js +25 -18
  288. package/dist/lib/hosts/remote-os.d.ts +4 -4
  289. package/dist/lib/hosts/remote-os.js +4 -4
  290. package/dist/lib/hosts/remote-session-id.d.ts +2 -2
  291. package/dist/lib/hosts/remote-session-id.js +2 -2
  292. package/dist/lib/hosts/routing-flag.d.ts +3 -3
  293. package/dist/lib/hosts/routing-flag.js +4 -5
  294. package/dist/lib/hosts/run-target.d.ts +4 -4
  295. package/dist/lib/hosts/run-target.js +4 -4
  296. package/dist/lib/hosts/session-index.d.ts +2 -2
  297. package/dist/lib/hosts/session-index.js +1 -1
  298. package/dist/lib/hosts/session-marker.d.ts +1 -1
  299. package/dist/lib/hosts/session-marker.js +1 -1
  300. package/dist/lib/hosts/types.d.ts +2 -2
  301. package/dist/lib/hosts/types.js +2 -2
  302. package/dist/lib/import.js +1 -1
  303. package/dist/lib/{migrate.d.ts → installations/migrate.d.ts} +13 -1
  304. package/dist/lib/{migrate.js → installations/migrate.js} +160 -40
  305. package/dist/lib/installations/resolve.js +1 -1
  306. package/dist/lib/installations/strategies.js +1 -1
  307. package/dist/lib/installations/update.js +2 -2
  308. package/dist/lib/{versions.d.ts → installations/versions.d.ts} +12 -3
  309. package/dist/lib/{versions.js → installations/versions.js} +51 -31
  310. package/dist/lib/isolation-boundary-report.js +1 -1
  311. package/dist/lib/linear-projects.d.ts +28 -0
  312. package/dist/lib/linear-projects.js +30 -0
  313. package/dist/lib/loop.js +1 -1
  314. package/dist/lib/mailbox-gc.js +1 -1
  315. package/dist/lib/mailbox.js +1 -1
  316. package/dist/lib/mcp-registry.d.ts +62 -0
  317. package/dist/lib/mcp-registry.js +177 -0
  318. package/dist/lib/mcp.d.ts +5 -0
  319. package/dist/lib/mcp.js +124 -307
  320. package/dist/lib/menubar/MenubarHelper.app/Contents/CodeResources +0 -0
  321. package/dist/lib/menubar/MenubarHelper.app/Contents/MacOS/MenubarHelper +0 -0
  322. package/dist/lib/menubar/install-menubar.d.ts +7 -0
  323. package/dist/lib/menubar/install-menubar.js +24 -6
  324. package/dist/lib/menubar/snapshot.d.ts +7 -0
  325. package/dist/lib/menubar/snapshot.js +8 -6
  326. package/dist/lib/models.js +1 -1
  327. package/dist/lib/monitors/config.d.ts +12 -0
  328. package/dist/lib/monitors/config.js +3 -0
  329. package/dist/lib/monitors/dispatch.js +26 -5
  330. package/dist/lib/monitors/engine.js +10 -0
  331. package/dist/lib/monitors/sources/webhook.d.ts +1 -1
  332. package/dist/lib/monitors/state.d.ts +42 -0
  333. package/dist/lib/monitors/state.js +30 -0
  334. package/dist/lib/notify.d.ts +1 -1
  335. package/dist/lib/observe-aliases.d.ts +2 -2
  336. package/dist/lib/observe-aliases.js +2 -11
  337. package/dist/lib/output/git-output.js +2 -2
  338. package/dist/lib/overdue.d.ts +1 -1
  339. package/dist/lib/overdue.js +1 -1
  340. package/dist/lib/permissions-registry.d.ts +65 -0
  341. package/dist/lib/permissions-registry.js +599 -0
  342. package/dist/lib/permissions.d.ts +24 -13
  343. package/dist/lib/permissions.js +52 -271
  344. package/dist/lib/picker.d.ts +16 -0
  345. package/dist/lib/picker.js +33 -3
  346. package/dist/lib/placement.d.ts +1 -1
  347. package/dist/lib/placement.js +4 -4
  348. package/dist/lib/platform/paths.d.ts +8 -0
  349. package/dist/lib/platform/paths.js +11 -0
  350. package/dist/lib/platform/posixpath.js +3 -3
  351. package/dist/lib/{plugin-marketplace.d.ts → plugins/plugin-marketplace.d.ts} +1 -1
  352. package/dist/lib/{plugin-marketplace.js → plugins/plugin-marketplace.js} +2 -2
  353. package/dist/lib/{plugins.d.ts → plugins/plugins.d.ts} +1 -1
  354. package/dist/lib/{plugins.js → plugins/plugins.js} +7 -7
  355. package/dist/lib/{skills.d.ts → plugins/skills.d.ts} +1 -1
  356. package/dist/lib/{skills.js → plugins/skills.js} +7 -7
  357. package/dist/lib/pricing/cost.d.ts +1 -1
  358. package/dist/lib/pricing/cost.js +1 -1
  359. package/dist/lib/profiles-presets.d.ts +1 -1
  360. package/dist/lib/profiles-presets.js +1 -1
  361. package/dist/lib/profiles.js +2 -2
  362. package/dist/lib/project-import.js +4 -1
  363. package/dist/lib/project-launch.d.ts +1 -1
  364. package/dist/lib/project-launch.js +3 -3
  365. package/dist/lib/project-pull.d.ts +128 -0
  366. package/dist/lib/project-pull.js +384 -0
  367. package/dist/lib/project-root.d.ts +2 -2
  368. package/dist/lib/project-root.js +2 -2
  369. package/dist/lib/project-status.js +1 -1
  370. package/dist/lib/projects.d.ts +23 -0
  371. package/dist/lib/projects.js +29 -6
  372. package/dist/lib/refresh.d.ts +12 -1
  373. package/dist/lib/refresh.js +16 -9
  374. package/dist/lib/registry.d.ts +9 -2
  375. package/dist/lib/registry.js +11 -4
  376. package/dist/lib/resources.d.ts +2 -2
  377. package/dist/lib/resources.js +2 -2
  378. package/dist/lib/routers.d.ts +81 -0
  379. package/dist/lib/routers.js +153 -0
  380. package/dist/lib/routine-context.d.ts +1 -0
  381. package/dist/lib/routine-context.js +7 -2
  382. package/dist/lib/routine-notify-owner.d.ts +1 -1
  383. package/dist/lib/routine-notify.d.ts +1 -1
  384. package/dist/lib/routine-notify.js +1 -1
  385. package/dist/lib/routine-process-cleanup.d.ts +1 -1
  386. package/dist/lib/routine-readiness.d.ts +1 -1
  387. package/dist/lib/routine-readiness.js +11 -4
  388. package/dist/lib/routines-placement.d.ts +12 -2
  389. package/dist/lib/routines-placement.js +20 -3
  390. package/dist/lib/routines-project.d.ts +1 -1
  391. package/dist/lib/routines-project.js +1 -1
  392. package/dist/lib/rules/compile.d.ts +1 -0
  393. package/dist/lib/rules/compile.js +10 -2
  394. package/dist/lib/rules/rules.js +1 -1
  395. package/dist/lib/run-notify.js +1 -1
  396. package/dist/lib/runner.d.ts +80 -2
  397. package/dist/lib/runner.js +241 -62
  398. package/dist/lib/sandbox.d.ts +1 -1
  399. package/dist/lib/scheduler.d.ts +1 -1
  400. package/dist/lib/scheduler.js +1 -1
  401. package/dist/lib/{routines.d.ts → scheduling/routines.d.ts} +54 -9
  402. package/dist/lib/{routines.js → scheduling/routines.js} +173 -14
  403. package/dist/lib/secrets/Agents CLI.app/Contents/CodeResources +0 -0
  404. package/dist/lib/secrets/Agents CLI.app/Contents/MacOS/Agents CLI +0 -0
  405. package/dist/lib/secrets/agent.js +2 -2
  406. package/dist/lib/secrets/audit.js +1 -1
  407. package/dist/lib/secrets/bundles.d.ts +3 -3
  408. package/dist/lib/secrets/bundles.js +7 -7
  409. package/dist/lib/secrets/index.js +1 -1
  410. package/dist/lib/secrets/list-filter.d.ts +1 -1
  411. package/dist/lib/secrets/list-filter.js +2 -2
  412. package/dist/lib/secrets/push.d.ts +1 -1
  413. package/dist/lib/secrets/push.js +10 -12
  414. package/dist/lib/secrets/remote.d.ts +12 -10
  415. package/dist/lib/secrets/remote.js +21 -14
  416. package/dist/lib/secrets/vault.js +2 -2
  417. package/dist/lib/self-heal/checks/shadowing.js +1 -1
  418. package/dist/lib/self-heal/checks/shims.js +1 -1
  419. package/dist/lib/self-update.d.ts +39 -4
  420. package/dist/lib/self-update.js +78 -25
  421. package/dist/lib/serve/control.d.ts +1 -1
  422. package/dist/lib/serve/control.js +4 -4
  423. package/dist/lib/serve/data.d.ts +1 -1
  424. package/dist/lib/serve/data.js +1 -1
  425. package/dist/lib/serve/stream.js +1 -1
  426. package/dist/lib/service-manifest.d.ts +29 -0
  427. package/dist/lib/service-manifest.js +80 -0
  428. package/dist/lib/session/active.d.ts +59 -7
  429. package/dist/lib/session/active.js +158 -17
  430. package/dist/lib/session/bash-command.js +1 -1
  431. package/dist/lib/session/claude-accounts.d.ts +1 -1
  432. package/dist/lib/session/claude-accounts.js +1 -1
  433. package/dist/lib/session/db.d.ts +10 -2
  434. package/dist/lib/session/db.js +25 -6
  435. package/dist/lib/session/discover.d.ts +77 -0
  436. package/dist/lib/session/discover.js +130 -25
  437. package/dist/lib/session/fork.js +1 -1
  438. package/dist/lib/session/inject.d.ts +1 -1
  439. package/dist/lib/session/insights.d.ts +1 -1
  440. package/dist/lib/session/insights.js +1 -1
  441. package/dist/lib/session/live-metadata.d.ts +15 -0
  442. package/dist/lib/session/live-metadata.js +76 -0
  443. package/dist/lib/session/migrate-targets.d.ts +1 -1
  444. package/dist/lib/session/recovery.d.ts +1 -1
  445. package/dist/lib/session/recovery.js +2 -2
  446. package/dist/lib/session/remote-active.d.ts +10 -1
  447. package/dist/lib/session/remote-active.js +8 -3
  448. package/dist/lib/session/remote-bundle.d.ts +1 -1
  449. package/dist/lib/session/remote-bundle.js +2 -2
  450. package/dist/lib/session/remote-list.d.ts +15 -4
  451. package/dist/lib/session/remote-list.js +40 -3
  452. package/dist/lib/session/remote.d.ts +5 -5
  453. package/dist/lib/session/remote.js +13 -17
  454. package/dist/lib/session/resume-command.d.ts +3 -2
  455. package/dist/lib/session/resume-command.js +4 -3
  456. package/dist/lib/session/resume-owner.d.ts +3 -3
  457. package/dist/lib/session/resume-owner.js +3 -3
  458. package/dist/lib/session/session-cache.d.ts +12 -0
  459. package/dist/lib/session/session-cache.js +2 -0
  460. package/dist/lib/session/shell-programs.js +1 -1
  461. package/dist/lib/session/state.js +5 -5
  462. package/dist/lib/session/team-filter.d.ts +1 -1
  463. package/dist/lib/session/team-filter.js +1 -1
  464. package/dist/lib/session/types.d.ts +3 -3
  465. package/dist/lib/session/width.d.ts +2 -2
  466. package/dist/lib/session/width.js +2 -2
  467. package/dist/lib/share/delete.d.ts +21 -0
  468. package/dist/lib/share/delete.js +42 -0
  469. package/dist/lib/share/publish.d.ts +82 -0
  470. package/dist/lib/share/publish.js +170 -18
  471. package/dist/lib/share/worker-template.js +172 -9
  472. package/dist/lib/shims.js +35 -7
  473. package/dist/lib/smart-launch.d.ts +4 -4
  474. package/dist/lib/smart-launch.js +6 -4
  475. package/dist/lib/snapshot.d.ts +4 -4
  476. package/dist/lib/snapshot.js +2 -2
  477. package/dist/lib/ssh-exec.d.ts +1 -1
  478. package/dist/lib/ssh-exec.js +2 -2
  479. package/dist/lib/ssh-tunnel.d.ts +10 -10
  480. package/dist/lib/ssh-tunnel.js +12 -12
  481. package/dist/lib/staleness/checkers/hooks.d.ts +1 -1
  482. package/dist/lib/staleness/checkers/hooks.js +1 -1
  483. package/dist/lib/staleness/detectors/permissions.js +0 -23
  484. package/dist/lib/staleness/detectors/plugins.js +1 -1
  485. package/dist/lib/staleness/fingerprint.js +1 -1
  486. package/dist/lib/staleness/layers.d.ts +1 -1
  487. package/dist/lib/staleness/layers.js +1 -1
  488. package/dist/lib/staleness/writers/mcp.js +3 -1
  489. package/dist/lib/staleness/writers/plugins.js +1 -1
  490. package/dist/lib/staleness/writers/types.d.ts +8 -0
  491. package/dist/lib/startup/command-registry.d.ts +5 -147
  492. package/dist/lib/startup/command-registry.js +38 -303
  493. package/dist/lib/startup/dev-build.d.ts +0 -21
  494. package/dist/lib/startup/dev-build.js +29 -8
  495. package/dist/lib/state.d.ts +19 -1
  496. package/dist/lib/state.js +120 -51
  497. package/dist/lib/subagents.js +1 -1
  498. package/dist/lib/sync-status.js +1 -1
  499. package/dist/lib/sync-umbrella.d.ts +6 -1
  500. package/dist/lib/sync-umbrella.js +9 -4
  501. package/dist/lib/teams/agents.js +2 -2
  502. package/dist/lib/teams/registry.js +1 -1
  503. package/dist/lib/terminal/backends/vscodium-agent.js +1 -1
  504. package/dist/lib/terminal/engine.js +1 -1
  505. package/dist/lib/terminal/index.d.ts +4 -0
  506. package/dist/lib/terminal/index.js +3 -0
  507. package/dist/lib/terminal/inject.d.ts +2 -2
  508. package/dist/lib/terminal/inject.js +2 -2
  509. package/dist/lib/terminal/transport.js +1 -1
  510. package/dist/lib/tmux/index.d.ts +1 -1
  511. package/dist/lib/tmux/index.js +1 -1
  512. package/dist/lib/tmux/session.d.ts +21 -5
  513. package/dist/lib/tmux/session.js +76 -22
  514. package/dist/lib/triggers/handlers.d.ts +1 -1
  515. package/dist/lib/triggers/handlers.js +2 -2
  516. package/dist/lib/triggers/webhook.d.ts +36 -2
  517. package/dist/lib/triggers/webhook.js +97 -42
  518. package/dist/lib/types.d.ts +18 -6
  519. package/dist/lib/usage-fleet.d.ts +1 -1
  520. package/dist/lib/usage-fleet.js +1 -1
  521. package/dist/lib/usage-refresh.d.ts +1 -1
  522. package/dist/lib/usage-refresh.js +3 -3
  523. package/dist/lib/version-duplicates.js +2 -2
  524. package/dist/lib/view-types.d.ts +56 -0
  525. package/dist/lib/view-types.js +1 -0
  526. package/dist/lib/watchdog/rotate.d.ts +2 -2
  527. package/dist/lib/watchdog/rotate.js +3 -3
  528. package/dist/lib/watchdog/runner.d.ts +2 -3
  529. package/dist/lib/watchdog/runner.js +3 -4
  530. package/dist/lib/workflows.js +1 -1
  531. package/package.json +2 -1
  532. package/scripts/postinstall.js +2 -2
  533. package/dist/commands/bench.d.ts +0 -2
  534. package/dist/commands/bench.js +0 -101
  535. package/dist/commands/cp.d.ts +0 -84
  536. package/dist/commands/cp.js +0 -231
  537. package/dist/commands/login.d.ts +0 -2
  538. package/dist/lib/resources/commands.d.ts +0 -46
  539. package/dist/lib/resources/commands.js +0 -211
  540. package/dist/lib/resources/hooks.d.ts +0 -16
  541. package/dist/lib/resources/hooks.js +0 -153
  542. package/dist/lib/resources/mcp.d.ts +0 -34
  543. package/dist/lib/resources/mcp.js +0 -250
  544. package/dist/lib/resources/memory.d.ts +0 -15
  545. package/dist/lib/resources/memory.js +0 -46
  546. package/dist/lib/resources/permissions.d.ts +0 -13
  547. package/dist/lib/resources/permissions.js +0 -202
  548. package/dist/lib/resources/rules.d.ts +0 -46
  549. package/dist/lib/resources/rules.js +0 -179
  550. package/dist/lib/resources/skills.d.ts +0 -37
  551. package/dist/lib/resources/skills.js +0 -247
  552. package/dist/lib/resources/subagents.d.ts +0 -46
  553. package/dist/lib/resources/subagents.js +0 -202
  554. /package/dist/lib/{feed.d.ts → feed/feed.d.ts} +0 -0
@@ -5,7 +5,7 @@ import * as path from 'path';
5
5
  import { homedir } from 'os';
6
6
  import { betaEnableHint, isBetaEnabled } from '../lib/beta.js';
7
7
  import { insertTask } from '../lib/cloud/store.js';
8
- import { emit } from '../lib/events.js';
8
+ import { emit } from '../lib/feed/events.js';
9
9
  import { buildFactorySnapshot } from '../lib/factory/snapshot.js';
10
10
  function requireFactoryUrl() {
11
11
  const url = process.env.FACTORY_FLOOR_URL;
@@ -2,7 +2,7 @@
2
2
  * `agents feed` -- operator inbox + agent status posts.
3
3
  *
4
4
  * Default (`agents feed`): list open blocks (decisions agents are waiting on).
5
- * Aggregates block records from the local feed store and, with --host, from
5
+ * Aggregates block records from the local feed store and, with --device, from
6
6
  * reachable remote hosts via SSH passthrough. Each block carries enough
7
7
  * identity for `agents message` to route a reply back to the right agent.
8
8
  *
@@ -16,7 +16,7 @@
16
16
  * Humans watch via the feed activity lane.
17
17
  */
18
18
  import type { Command } from 'commander';
19
- import { type OpenBlock } from '../lib/feed.js';
19
+ import { type OpenBlock } from '../lib/feed/feed.js';
20
20
  import { type OutcomeGroup, type SessionOutcomeHint } from '../lib/feed-outcome.js';
21
21
  import { filterBlocksForFeed } from '../lib/ask-classifier.js';
22
22
  import { type FeedSessionSignal } from '../lib/feed-ranking.js';
@@ -1,6 +1,6 @@
1
1
  import chalk from 'chalk';
2
- import { ensureFeedPublishHook, listAskStats, listBlocks, recordNotified, buildDeclaredBlock, publishBlock, } from '../lib/feed.js';
3
- import { ensureActivityLogHook, readRecentActivity, formatActivityLine, formatProgressUpdate, mergeActivityEvents, parseActivityPayload, } from '../lib/activity.js';
2
+ import { ensureFeedPublishHook, listAskStats, listBlocks, recordNotified, buildDeclaredBlock, publishBlock, } from '../lib/feed/feed.js';
3
+ import { ensureActivityLogHook, readRecentActivity, formatActivityLine, formatProgressUpdate, mergeActivityEvents, parseActivityPayload, } from '../lib/feed/activity.js';
4
4
  import { projectKeyFromCwd } from '../lib/project-key.js';
5
5
  import { postFeedStatus } from '../lib/feed-post.js';
6
6
  import { parseFeedPostLevel, planFeedBroadcast, runFeedBroadcast, effectiveBroadcastConfig, withDesktopNotify, blockBroadcastContext, blockDeliveryFailure, } from '../lib/feed-broadcast.js';
@@ -318,8 +318,7 @@ export function registerFeedCommand(program) {
318
318
  .option('--flat', 'List one block per agent instead of grouping by outcome')
319
319
  .option('--all', 'Include stalls/FYIs that policy would suppress (default: hide them)')
320
320
  .option('--local', 'Only this machine -- skip the cross-machine SSH fan-out')
321
- .option('-H, --host <target...>', 'Scope to remote machine(s) over SSH; repeatable')
322
- .option('--device <target...>', 'Alias for --host; repeatable')
321
+ .option('-D, --device <target...>', 'Scope to remote machine(s) over SSH; repeatable')
323
322
  .option('--project <name>', 'Scope the feed to one project/repo (matches cwd basename, case-insensitive)')
324
323
  .option('--dispatch', 'Run stall suppression + default-on-no-answer policy and urgent notifications')
325
324
  .option('--pause <id>', 'Pause a runaway/needy local process (SIGSTOP) or cancel a cloud task')
@@ -434,11 +433,9 @@ export function registerFeedCommand(program) {
434
433
  }
435
434
  });
436
435
  feed.action(async (opts) => {
437
- if (opts.device?.length)
438
- opts.host = [...(opts.host ?? []), ...opts.device];
439
436
  const self = machineId();
440
437
  const filter = resolveFeedFilter(opts.filter);
441
- const includeLocal = shouldIncludeLocalFeed(opts.host, self);
438
+ const includeLocal = shouldIncludeLocalFeed(opts.device, self);
442
439
  const setupWarnings = [];
443
440
  if (includeLocal) {
444
441
  // Feed and activity hooks are independent -- install both, and register
@@ -453,7 +450,7 @@ export function registerFeedCommand(program) {
453
450
  if (!hookInstall.error || !activityInstall.error) {
454
451
  const [{ iterHooksCapableVersions, parseHookManifest, registerHooksToSettings }, { getVersionHomePath }] = await Promise.all([
455
452
  import('../lib/hooks.js'),
456
- import('../lib/versions.js'),
453
+ import('../lib/installations/versions.js'),
457
454
  ]);
458
455
  const manifest = parseHookManifest({ warn: false });
459
456
  for (const { agent, version } of iterHooksCapableVersions({ agent: 'claude' })) {
@@ -470,7 +467,7 @@ export function registerFeedCommand(program) {
470
467
  if (filter === 'all') {
471
468
  console.log();
472
469
  renderUpdatesView(await gatherStatusPosts({
473
- limit: UPDATES_VIEW_LIMIT, hosts: opts.host, local: opts.local, includeLocal, self, project: opts.project,
470
+ limit: UPDATES_VIEW_LIMIT, hosts: opts.device, local: opts.local, includeLocal, self, project: opts.project,
474
471
  }), opts.project);
475
472
  return;
476
473
  }
@@ -487,7 +484,7 @@ export function registerFeedCommand(program) {
487
484
  }
488
485
  const updates = await gatherStatusPosts({
489
486
  limit: opts.json ? UPDATES_JSON_LIMIT : UPDATES_VIEW_LIMIT,
490
- hosts: opts.host,
487
+ hosts: opts.device,
491
488
  local: opts.local,
492
489
  includeLocal,
493
490
  self,
@@ -557,8 +554,8 @@ export function registerFeedCommand(program) {
557
554
  let blocks = visibleLocalBlocks;
558
555
  const forceLocal = opts.local === true || process.env[FEED_NO_FANOUT_ENV] === '1';
559
556
  if (!forceLocal) {
560
- const remoteHosts = remoteFeedHostsToDial(opts.host, self);
561
- if (!opts.host?.length || (remoteHosts && remoteHosts.length > 0)) {
557
+ const remoteHosts = remoteFeedHostsToDial(opts.device, self);
558
+ if (!opts.device?.length || (remoteHosts && remoteHosts.length > 0)) {
562
559
  const remote = await gatherRemoteAgentsJson({
563
560
  // Bare --json stays a block array so older peers and scripts keep working.
564
561
  args: ['feed', '--json'],
@@ -10,39 +10,32 @@
10
10
  * command just gathers inputs and persists via `updateMeta`.
11
11
  */
12
12
  import * as fs from 'fs';
13
- import * as path from 'path';
14
13
  import chalk from 'chalk';
15
14
  import * as yaml from 'yaml';
16
15
  import { loadDevices, isControlDevice } from '../lib/devices/registry.js';
17
- import { readMeta, updateMeta, getDeviceMetaPath } from '../lib/state.js';
16
+ import { readMeta, updateMeta, getDevicePinsPath } from '../lib/state.js';
17
+ import { machineId } from '../lib/machine-id.js';
18
18
  import { listBundles } from '../lib/secrets/bundles.js';
19
- import { listJobs } from '../lib/routines.js';
19
+ import { listJobs } from '../lib/scheduling/routines.js';
20
20
  import { captureFleet } from '../lib/fleet/capture.js';
21
- /** The committed per-device pin dir: `~/.agents/devices/`. Derived from the
22
- * device-meta path so it honors any AGENTS_HOME override the same way. */
23
- function devicesPinDir() {
24
- return path.dirname(path.dirname(getDeviceMetaPath()));
25
- }
26
- /** Read `devices/<name>/agents.yaml` pin files into `name -> [id@latest]`. Only
27
- * used with `--from-pins`; keeps capture zero-SSH by reading committed state. */
21
+ /** Read THIS machine's pins file into `name -> [id@latest]`. Only used with
22
+ * `--from-pins`; keeps capture zero-SSH by reading local state. Pins are
23
+ * machine-local runtime state (`.history/devices/pins-<host>.json`, untracked)
24
+ * — peer pins never sync, so only this machine contributes; peers inherit the
25
+ * captured fleet defaults. */
28
26
  function agentsFromPins(names) {
29
- const dir = devicesPinDir();
30
- const out = {};
31
- for (const name of names) {
32
- const p = path.join(dir, name, 'agents.yaml');
33
- if (!fs.existsSync(p))
34
- continue;
35
- try {
36
- const doc = yaml.parse(fs.readFileSync(p, 'utf-8'));
37
- const ids = doc?.agents ? Object.keys(doc.agents) : [];
38
- if (ids.length > 0)
39
- out[name] = ids.map((id) => `${id}@latest`);
40
- }
41
- catch {
42
- /* skip an unparsable pin file — capture is best-effort per device */
43
- }
27
+ const self = machineId();
28
+ if (!names.includes(self))
29
+ return {};
30
+ let pins;
31
+ try {
32
+ pins = JSON.parse(fs.readFileSync(getDevicePinsPath(), 'utf-8'));
33
+ }
34
+ catch {
35
+ return {}; // no pins file (or unparsable) capture is best-effort
44
36
  }
45
- return out;
37
+ const ids = pins?.agents ? Object.keys(pins.agents) : [];
38
+ return ids.length > 0 ? { [self]: ids.map((id) => `${id}@latest`) } : {};
46
39
  }
47
40
  async function runCapture(opts) {
48
41
  const meta = readMeta();
@@ -56,6 +49,11 @@ async function runCapture(opts) {
56
49
  names = names.filter((n) => n === opts.device);
57
50
  if (names.length === 0)
58
51
  throw new Error(`Device '${opts.device}' is not a registered device.`);
52
+ // --from-pins reads the LOCAL pins file only (peer pins are machine-local
53
+ // runtime state and never sync), so targeting a peer would record nothing.
54
+ if (opts.fromPins && opts.device !== machineId()) {
55
+ throw new Error(`--from-pins can only read THIS machine's pins ('${machineId()}') — peer pins are machine-local and never sync. Run it on '${opts.device}' itself, or drop --device.`);
56
+ }
59
57
  }
60
58
  // Defaults seeded from the source machine's own installed agents.
61
59
  const sourceAgents = Object.keys(meta.agents ?? {}).sort();
@@ -93,7 +91,7 @@ export function registerFleetCaptureCommand(devicesCmd) {
93
91
  .command('capture')
94
92
  .description('Snapshot the live environment (roster names, agents, browser, secret-bundle names, routines) into agents.yaml fleet:.')
95
93
  .option('--dry-run', 'print the fleet: block that would be written, and exit')
96
- .option('--from-pins', 'record per-device agents from committed devices/<name>/agents.yaml')
94
+ .option('--from-pins', "record THIS machine's pinned agents (peer pins are machine-local and never sync)")
97
95
  .option('--device <name>', 'capture a single device')
98
96
  .action(async (opts) => {
99
97
  try {
@@ -18,11 +18,10 @@ import { type ActiveSession } from '../lib/session/active.js';
18
18
  import { type SessionMeta } from '../lib/session/types.js';
19
19
  import { type LiveStatusFilter } from './sessions.js';
20
20
  import { openSurfaces, type Backend } from '../lib/terminal/index.js';
21
- /** Options for `sessions focus` — device/host scope + the `--active` live-state filters. */
21
+ /** Options for `sessions focus` — device scope + the `--active` live-state filters. */
22
22
  export interface FocusOptions {
23
23
  local?: boolean;
24
24
  attachOnly?: boolean;
25
- host?: string[];
26
25
  device?: string[];
27
26
  active?: boolean;
28
27
  agent?: string;
@@ -60,7 +59,7 @@ export interface FocusOptions {
60
59
  * when they appear after `focus`. Fold only values explicitly provided there
61
60
  * into the child options; child defaults (limit/sort) otherwise stay intact. */
62
61
  export declare function inheritFocusOptions(child: FocusOptions, parent?: Command): FocusOptions;
63
- /** `--device` is an alias of `--host`; both are repeatable. Merge into one host list. */
62
+ /** Collect device targets from `--device`; repeatable. Returns a host list. */
64
63
  export declare function mergeFocusHosts(opts: FocusOptions): string[];
65
64
  /** Picker header that reflects the active filter + device, e.g. "Focus orphaned sessions on yosemite-s0:". */
66
65
  export declare function focusHeader(statuses: LiveStatusFilter[], hosts: string[]): string;
@@ -17,12 +17,13 @@ import chalk from 'chalk';
17
17
  import { confirm } from '@inquirer/prompts';
18
18
  import { gatherLiveTargets, pickLiveTarget, pickLiveTargets, jumpTo, probeAttachRail, refuseFallback } from './go.js';
19
19
  import { sessionProcessIsLocal, sessionProcessHost, shortIdFromName } from '../lib/session/active.js';
20
- import { attachTmux, getDefaultSocketPath, hasSession, runTmux } from '../lib/tmux/index.js';
20
+ import { attachTmux, ensureSessionHookRepaired, getDefaultSocketPath, hasSession, runTmux } from '../lib/tmux/index.js';
21
21
  import { isAgentTmuxAlias } from '../lib/session/types.js';
22
22
  import { buildSessionRecoveryCommand, filterSessionsByQuery, formatLiveStatusHeadline, formatPickerLabel, isRunningLiveSession, pickerColumnsFor, resumeSessionInPlace, resolveSessionMetadataValue, resolveSessionAgentName, requestedLiveStatuses, } from './sessions.js';
23
23
  import { resolveBackend, CONFIRM_THRESHOLD } from './sessions-resume.js';
24
24
  import { runOnPeer } from '../lib/session/remote-list.js';
25
- import { discoverSessions } from '../lib/session/discover.js';
25
+ import { discoverSessions, resolveIndexedSessionById } from '../lib/session/discover.js';
26
+ import { machineId } from '../lib/session/sync/config.js';
26
27
  import { collectSessionCandidates, normalizeDeviceSeed } from './sessions-browser.js';
27
28
  import { buildPreview } from './sessions-picker.js';
28
29
  import { multiItemPicker } from '../lib/picker.js';
@@ -32,7 +33,7 @@ import { openSurfaces, currentContext, availableBackends, detectCurrentBackend,
32
33
  import { isInteractiveTerminal, isPromptCancelled } from './utils.js';
33
34
  import { setHelpSections } from '../lib/help.js';
34
35
  const INHERITED_FOCUS_OPTIONS = [
35
- 'local', 'host', 'device', 'active', 'agent',
36
+ 'local', 'device', 'active', 'agent',
36
37
  'claude', 'codex', 'kimi', 'antigravity', 'grok', 'opencode',
37
38
  'all', 'teams', 'inTeam', 'routine', 'project', 'skill', 'plugin',
38
39
  'since', 'until', 'limit', 'bookmarks', 'unmanaged', 'sort',
@@ -54,9 +55,9 @@ export function inheritFocusOptions(child, parent) {
54
55
  }
55
56
  return merged;
56
57
  }
57
- /** `--device` is an alias of `--host`; both are repeatable. Merge into one host list. */
58
+ /** Collect device targets from `--device`; repeatable. Returns a host list. */
58
59
  export function mergeFocusHosts(opts) {
59
- return [...(opts.host ?? []), ...(opts.device ?? [])];
60
+ return [...(opts.device ?? [])];
60
61
  }
61
62
  /** Picker header that reflects the active filter + device, e.g. "Focus orphaned sessions on yosemite-s0:". */
62
63
  export function focusHeader(statuses, hosts) {
@@ -81,8 +82,7 @@ export function registerFocusCommand(program) {
81
82
  .argument('[selector]', 'Session id/prefix, agent@version, or topic/path search')
82
83
  .option('--local', 'Only this machine (skip the cross-host sweep)')
83
84
  .option('--attach-only', 'Attach only — never open a new tab / resume a copy (the old `go` behavior)')
84
- .option('-H, --host <target...>', 'Scope the picker to live sessions on these devices (host alias or user@host; repeatable)')
85
- .option('--device <target...>', 'Alias for --host (device alias from `agents devices`; repeatable)')
85
+ .option('-D, --device <target...>', 'Scope the picker to live sessions on these devices (device alias from `agents devices`, user@host; repeatable)')
86
86
  .option('--active', 'Only sessions present in the live roster')
87
87
  .option('-a, --agent <agent>', 'Filter by harness and recorded version (for example claude@latest)')
88
88
  .option('--claude', 'Shorthand for --agent claude')
@@ -143,7 +143,7 @@ export function registerFocusCommand(program) {
143
143
  - With no selector/filter, the picker shows the live fleet. An id focuses directly; agent@version and text selectors always show the preview picker.
144
144
  - A living tmux pane is JOINED (a second client, no fork). Dead/missing panes recover on the origin device: exact healthy origin uses native resume; otherwise a healthy version of the same harness receives /continue <id>.
145
145
  - An id/identity selector resolves across the whole reachable fleet on its own — you do NOT need --device to focus a session that lives on another box (same as resume/preview). --device only narrows the browsable picker and the agent/version resolution.
146
- - --host/--device and the sessions-browser filters compose. latest/oldest resolve against each selected device's installed versions.
146
+ - --device and the sessions-browser filters compose. latest/oldest resolve against each selected device's installed versions.
147
147
  Lifecycle siblings (not synonyms):
148
148
  focus attach if alive, otherwise recover (default "take me there")
149
149
  focus --attach-only attach only; never fork (replaces go)
@@ -187,6 +187,27 @@ export async function focusAction(id, opts) {
187
187
  process.exitCode = 1;
188
188
  return;
189
189
  }
190
+ // RUSH-2477: an id selector for a LOCAL indexed session resolves against the
191
+ // WAL index alone — a plain read, no write-heavy discovery scan (none of
192
+ // `tryClaimScan`/`releaseScan`'s `BEGIN IMMEDIATE` writer lock) and no
193
+ // boot-time fleet SSH fan-out. This is the crash-restart storm path: dozens
194
+ // of `sessions resume <id>` at once must not each take the writer lock or
195
+ // dial the not-yet-up tailnet. A genuine miss, an ambiguous prefix, or a
196
+ // peer-owned row falls through to the fleet resolver below unchanged — the
197
+ // narrow win is the exact case the storm hits, with no behaviour change for
198
+ // a session that lives on another box.
199
+ if (idLookup && hosts.length === 0 && looksLikeIdSelector(textSelector)) {
200
+ const self = machineId();
201
+ const localMatch = dedupeSessionsByLogicalId(await resolveIndexedSessionById(textSelector), self);
202
+ if (localMatch.length === 1 && !sessionProcessHost(localMatch[0], self)) {
203
+ // Local live index only (ps/tmux, no fleet sweep) so a still-live pane is
204
+ // still joined instead of resumed as a copy; a crashed session has no live
205
+ // row and recovers in place.
206
+ const { activeById } = await gatherLiveTargets(true, { statuses: [] });
207
+ await focusResolvedSession(localMatch[0], activeById, self, fallback, opts.attachOnly === true);
208
+ return;
209
+ }
210
+ }
190
211
  const { sessions, liveById, self, unreachable } = await collectSessionCandidates({
191
212
  running: opts.active === true || statuses.length > 0,
192
213
  statuses,
@@ -437,12 +458,16 @@ async function attachLiveTmuxAlias(selector) {
437
458
  return true;
438
459
  }
439
460
  console.log(chalk.gray(`Attaching ${selector} — Ctrl-b d to detach.`));
461
+ // Repair a legacy/stale pane-died hook before handing the session to an
462
+ // attach client — the 5-min daemon reconcile that used to cover this was
463
+ // deleted; attach-time repair is what closes the gap now (RUSH-2435).
464
+ await ensureSessionHookRepaired(selector, socket);
440
465
  const code = await attachTmux({ socket, args: ['attach-session', '-t', `=${selector}`] });
441
466
  process.exitCode = code;
442
467
  return true;
443
468
  }
444
469
  function hasFocusFilters(opts, statuses) {
445
- return statuses.length > 0 || !!(opts.active || opts.local || opts.host?.length || opts.device?.length || focusOptionAgent(opts) ||
470
+ return statuses.length > 0 || !!(opts.active || opts.local || opts.device?.length || focusOptionAgent(opts) ||
446
471
  opts.all || opts.teams || opts.inTeam || opts.routine || opts.project || opts.skill || opts.plugin ||
447
472
  opts.since || opts.until || opts.bookmarks || opts.unmanaged || (opts.sort && opts.sort !== 'recent'));
448
473
  }
@@ -28,7 +28,7 @@ import { isPromptCancelled } from './utils.js';
28
28
  import { focusAction } from './focus.js';
29
29
  import { machineId } from '../lib/session/sync/config.js';
30
30
  import { attachTmux, runTmux } from '../lib/tmux/binary.js';
31
- import { paneExitStatus } from '../lib/tmux/session.js';
31
+ import { ensureSessionHookRepaired, paneExitStatus } from '../lib/tmux/session.js';
32
32
  import { getDefaultSocketPath } from '../lib/tmux/paths.js';
33
33
  import { sshExec, sshStream, assertValidSshTarget, shellQuote } from '../lib/ssh-exec.js';
34
34
  import { enumerateGhosttyTabs, assignGhosttyTabs } from '../lib/session/ghostty-tabs.js';
@@ -165,10 +165,15 @@ export async function buildLivePool(activeById, self) {
165
165
  }
166
166
  function synthMeta(s, self) {
167
167
  const remote = !sessionProcessIsLocal(s, self);
168
- // For a local session, locate the real transcript on disk so the picker's
169
- // buildPreview parses it directly (rich Prompt/Changes/Tools/Last response)
170
- // independent of the sessions DB. Remote transcripts live on the peer, so leave
171
- // filePath empty and the preview shows a clean "not indexed here" note.
168
+ // For a local session, locate the real transcript so the picker's buildPreview
169
+ // parses it directly (rich Prompt/Changes/Tools/Last response) rather than
170
+ // rendering from the indexed digest. For Claude that resolves off disk; every
171
+ // other harness resolves the id THROUGH the session index (RUSH-2691), so a
172
+ // local non-Claude session the index has not reached yet yields '' here and
173
+ // gets the same clean "not indexed here" note as a remote one — which is the
174
+ // honest answer, since the pre-RUSH-2691 alternative was a co-located
175
+ // stranger's transcript. Remote transcripts live on the peer, so leave
176
+ // filePath empty there too.
172
177
  const filePath = remote ? '' : (findSessionFileForKind(s.kind, s.cwd, s.sessionId) ?? '');
173
178
  return {
174
179
  id: s.sessionId,
@@ -297,6 +302,11 @@ export async function jumpTo(s, self, fallback = refuseFallback) {
297
302
  return;
298
303
  }
299
304
  console.log(chalk.gray(`Attaching ${shortId(s)} (tmux ${tgt}) — Ctrl-b d to detach.`));
305
+ // Repair a legacy/stale pane-died hook before the attach client takes over
306
+ // — the 5-min daemon reconcile that used to cover this was deleted;
307
+ // attach-time repair is what closes the gap now (RUSH-2435).
308
+ if (session)
309
+ await ensureSessionHookRepaired(session, socket);
300
310
  process.exit(await attachTmux({ socket, args: ['attach-session', '-t', tgt] }));
301
311
  }
302
312
  // Path A: local Ghostty — focus its tab (Cmd+N via System Events).
@@ -6,9 +6,9 @@
6
6
  * (`agents run spark`) and syncs across devices via `agents repo push user`.
7
7
  *
8
8
  * Mechanism: harnesses ARE profiles (same ~/.agents/profiles/*.yml, same run
9
- * resolution). This command group is the harness-flavored surface over that
10
- * layer + a discovery `list` spanning custom harnesses, addable presets, and the
11
- * native harness registry. The `agents profiles` tree stays unchanged.
9
+ * resolution). This command group is the surface over that layer + a discovery
10
+ * `list` spanning custom harnesses, addable presets, and the native harness
11
+ * registry. The former top-level `agents profiles` tree was removed — use harness.
12
12
  */
13
13
  import type { Command } from 'commander';
14
14
  import { type AddProfileOptions } from './profiles.js';
@@ -6,9 +6,9 @@
6
6
  * (`agents run spark`) and syncs across devices via `agents repo push user`.
7
7
  *
8
8
  * Mechanism: harnesses ARE profiles (same ~/.agents/profiles/*.yml, same run
9
- * resolution). This command group is the harness-flavored surface over that
10
- * layer + a discovery `list` spanning custom harnesses, addable presets, and the
11
- * native harness registry. The `agents profiles` tree stays unchanged.
9
+ * resolution). This command group is the surface over that layer + a discovery
10
+ * `list` spanning custom harnesses, addable presets, and the native harness
11
+ * registry. The former top-level `agents profiles` tree was removed — use harness.
12
12
  */
13
13
  import chalk from 'chalk';
14
14
  import { addProfile, ensureProviderToken, applyFromSecrets } from './profiles.js';
@@ -17,6 +17,8 @@ import { listProfiles, readProfile, writeProfile, deleteProfile, profileExists,
17
17
  import { listPresets, getPreset } from '../lib/profiles-presets.js';
18
18
  import { AGENTS, ALL_AGENT_IDS, resolveAgentName } from '../lib/agents.js';
19
19
  import { findAccount } from '../lib/account-registry.js';
20
+ import { keychainItemName, setKeychainToken, deleteKeychainToken } from '../lib/secrets/profiles.js';
21
+ import { readStdinSync } from '../lib/format.js';
20
22
  import { runWizardSteps, createSteps, editSteps, defaultWizardIO, } from './harness-wizard.js';
21
23
  /** Short capability summary for a native harness — its supported run modes. */
22
24
  function nativeModes(id) {
@@ -347,7 +349,7 @@ Examples:
347
349
  # Private OpenAI/Anthropic-compatible endpoint using an existing account
348
350
  agents harness add corp --host claude --model gpt-x --base-url https://gw.corp/v1 --account corp
349
351
 
350
- # Custom harnesses are just profilesthis also works via 'agents profiles'
352
+ # Custom harnesses are named host+model pins manage them with agents harness
351
353
  `);
352
354
  cmd
353
355
  .command('add [name]')
@@ -565,7 +567,7 @@ Examples:
565
567
  cmd
566
568
  .command('remove <name>')
567
569
  .alias('rm')
568
- .description('Delete a custom harness (keychain token is kept).')
570
+ .description('Delete a custom harness (keychain token is kept — use `harness logout <provider>` to remove).')
569
571
  .action((name) => {
570
572
  const existed = deleteProfile(name);
571
573
  if (!existed) {
@@ -574,4 +576,50 @@ Examples:
574
576
  }
575
577
  console.log(chalk.green(`Harness '${name}' removed.`));
576
578
  });
579
+ cmd
580
+ .command('login <provider>')
581
+ .description('Store or rotate the API key for a provider (e.g., openrouter). Shared across harnesses using that provider.')
582
+ .option('--key-stdin', 'Read API key from stdin')
583
+ .action(async (provider, opts) => {
584
+ try {
585
+ const item = keychainItemName(provider);
586
+ let token;
587
+ if (opts.keyStdin) {
588
+ token = readStdinSync();
589
+ if (!token)
590
+ throw new Error('No key received on stdin.');
591
+ }
592
+ else {
593
+ if (!isInteractiveTerminal()) {
594
+ throw new Error('A secret is required but the shell is not interactive. Pipe the key via stdin (--key-stdin).');
595
+ }
596
+ const { password } = await import('@inquirer/prompts');
597
+ token = await password({ message: `Enter API key for ${provider}`, mask: true });
598
+ }
599
+ setKeychainToken(item, token);
600
+ console.log(chalk.green(`Stored in keychain: ${item}`));
601
+ }
602
+ catch (err) {
603
+ console.error(chalk.red(err.message));
604
+ process.exit(1);
605
+ }
606
+ });
607
+ cmd
608
+ .command('logout <provider>')
609
+ .description('Remove a stored provider key from keychain')
610
+ .action((provider) => {
611
+ try {
612
+ const item = keychainItemName(provider);
613
+ const existed = deleteKeychainToken(item);
614
+ if (!existed) {
615
+ console.error(chalk.yellow(`No keychain item '${item}' to remove.`));
616
+ process.exit(1);
617
+ }
618
+ console.log(chalk.green(`Removed keychain item: ${item}`));
619
+ }
620
+ catch (err) {
621
+ console.error(chalk.red(err.message));
622
+ process.exit(1);
623
+ }
624
+ });
577
625
  }
@@ -8,7 +8,7 @@ import { AGENTS, resolveAgentName, formatAgentError, agentLabel, } from '../lib/
8
8
  import { supports, capableAgents } from '../lib/capabilities.js';
9
9
  import { cloneRepo } from '../lib/git.js';
10
10
  import { discoverHooksFromRepo, installHooksCentrally, listCentralHooks, listInstalledHooksWithScope, getHookInfo, parseHookManifest, iterHooksCapableVersions, removeHookFromVersion, } from '../lib/hooks.js';
11
- import { listInstalledVersions, getGlobalDefault, syncResourcesToVersion, promptAgentVersionSelection, getVersionHomePath, resolveInstalledAgentTargets, } from '../lib/versions.js';
11
+ import { listInstalledVersions, getGlobalDefault, syncResourcesToVersion, promptAgentVersionSelection, getVersionHomePath, resolveInstalledAgentTargets, } from '../lib/installations/versions.js';
12
12
  import { recordVersionResources } from '../lib/state.js';
13
13
  import { isPromptCancelled, isInteractiveTerminal, parseCommaSeparatedList, printWithPager, requireInteractiveSelection, promptRemovalTargets, resolveAgentTargetsAutoInstalling, resolveListFilterOrExit, } from './utils.js';
14
14
  /** Register the `agents hooks` command tree (list, add, remove, sync, prune, view). */
@@ -22,7 +22,7 @@
22
22
  */
23
23
  import { withIsolationBoundary } from '../lib/isolation-boundary-report.js';
24
24
  import { assertIsolationBoundary, createVersionedAlias } from '../lib/shims.js';
25
- import { markVersionIsolated } from '../lib/versions.js';
25
+ import { markVersionIsolated } from '../lib/installations/versions.js';
26
26
  import chalk from 'chalk';
27
27
  import ora from 'ora';
28
28
  import * as fs from 'fs';
@@ -31,7 +31,7 @@ import * as path from 'path';
31
31
  import { confirm } from '@inquirer/prompts';
32
32
  import { MANAGED_AGENT_IDS } from '../lib/agents.js';
33
33
  import { AGENTS, getCliPath, getCliVersion, agentLabel, resolveAgentName, isAgentHardDeprecated, hardDeprecationError } from '../lib/agents.js';
34
- import { getVersionDir } from '../lib/versions.js';
34
+ import { getVersionDir } from '../lib/installations/versions.js';
35
35
  import { finalizeImport, importAgentBinary, importAgentConfig, importInstallScriptBinary, seedIsolatedConfigFromLocal, isValidImportVersion, resolvePackageDirFromBinary, } from '../lib/import.js';
36
36
  import { isPromptCancelled, isInteractiveTerminal } from './utils.js';
37
37
  async function runImport(agentArg, opts) {
@@ -12,11 +12,11 @@
12
12
  *
13
13
  * Sibling observe verbs (stay separate — different questions):
14
14
  *
15
- * agents cost what you spent ($ and duration)
16
- * agents output what shipped (burn vs PRs and commits)
17
- * agents usage live quota headroom
18
- * agents perf latency (hooks, CLI commands, agent.run) — not popularity
19
- * agents sessions stats which skills/slash-commands were explicitly invoked
15
+ * agents insights cost what you spent ($ and duration)
16
+ * agents insights output what shipped (burn vs PRs and commits)
17
+ * agents usage live quota headroom
18
+ * agents perf latency (hooks, CLI commands, agent.run) — not popularity
19
+ * agents sessions stats which skills/slash-commands were explicitly invoked
20
20
  *
21
21
  * Why mix lives here (not a second top-level `trends`): two abstract "analytics"
22
22
  * nouns taught agents and humans to guess. One verb, two engines — cheap SQL mix
@@ -12,11 +12,11 @@
12
12
  *
13
13
  * Sibling observe verbs (stay separate — different questions):
14
14
  *
15
- * agents cost what you spent ($ and duration)
16
- * agents output what shipped (burn vs PRs and commits)
17
- * agents usage live quota headroom
18
- * agents perf latency (hooks, CLI commands, agent.run) — not popularity
19
- * agents sessions stats which skills/slash-commands were explicitly invoked
15
+ * agents insights cost what you spent ($ and duration)
16
+ * agents insights output what shipped (burn vs PRs and commits)
17
+ * agents usage live quota headroom
18
+ * agents perf latency (hooks, CLI commands, agent.run) — not popularity
19
+ * agents sessions stats which skills/slash-commands were explicitly invoked
20
20
  *
21
21
  * Why mix lives here (not a second top-level `trends`): two abstract "analytics"
22
22
  * nouns taught agents and humans to guess. One verb, two engines — cheap SQL mix
@@ -47,6 +47,8 @@ import { formatUsd } from '../lib/pricing/index.js';
47
47
  import { formatDuration } from '../lib/session/render.js';
48
48
  import { terminalWidth, truncateToWidth, stringWidth, padToWidth } from '../lib/session/width.js';
49
49
  import { registerMixCommands } from '../lib/analytics/mix-commands.js';
50
+ import { registerCostCommand } from './cost.js';
51
+ import { registerOutputCommand } from './output.js';
50
52
  const execFileAsync = promisify(execFile);
51
53
  function collectAgent(value, previous) {
52
54
  return [...previous, value];
@@ -317,7 +319,7 @@ function renderReport(groups, dim, meta, actions, harnesses) {
317
319
  // shell command TEXT, and not every harness exposes it — the codex parser populates
318
320
  // `command` for `exec_command` but not plain `exec`, its dominant tool — so gate on
319
321
  // whether we had anything to search rather than on seeing a shell-shaped tool call.
320
- // When we did, the count is real, and still disagrees with `agents output`, which
322
+ // When we did, the count is real, and still disagrees with `agents insights output`, which
321
323
  // counts deduped SHAs from git log.
322
324
  if (all.shellCommandsSeen > 0) {
323
325
  out.push(` ${chalk.gray(`${all.gitCommits} commits · ${all.gitPushes} pushes (seen in shell commands)`)}`);
@@ -414,7 +416,7 @@ async function insightsAction(options) {
414
416
  // --since win so `--all --since 7d` is not silently contradictory.
415
417
  const since = options.since ?? (options.all ? 'all' : '30d');
416
418
  const sinceMs = since === 'all' ? undefined : parseTimeFilter(since);
417
- // Refresh the index first, exactly as `agents cost` does, so a report never silently
419
+ // Refresh the index first, exactly as `agents insights cost` does, so a report never silently
418
420
  // describes a stale picture of disk.
419
421
  await discoverSessions({ all: true, since: since === 'all' ? undefined : since, limit: 1 });
420
422
  if (options.refresh)
@@ -569,7 +571,8 @@ function configureInsightsCommand(cmd) {
569
571
  Two paths under one verb:
570
572
  bare \`agents insights\` — transcript behaviour (tools, friction, rhythm, by account)
571
573
  \`agents insights mix\` — cheap counters from sessions.db + usage.db
572
- Latency is \`agents perf\` (not mix). Quota is \`agents usage\`. Skill/slash popularity
574
+ Latency is \`agents perf\` (not mix). Quota is \`agents usage\`. Spend is
575
+ \`agents insights cost\`; shipped output is \`agents insights output\`. Skill/slash popularity
573
576
  is \`agents sessions stats\`. \`agents trends\` is a deprecated alias of the mix tree.
574
577
 
575
578
  The behavioural report parses in-scope transcripts once and caches facets; later runs
@@ -583,7 +586,10 @@ function configureInsightsCommand(cmd) {
583
586
  });
584
587
  }
585
588
  export function registerInsightsCommand(program) {
586
- configureInsightsCommand(program.command('insights'));
589
+ const cmd = program.command('insights');
590
+ configureInsightsCommand(cmd);
591
+ registerCostCommand(cmd);
592
+ registerOutputCommand(cmd);
587
593
  }
588
594
  export function registerSessionsInsightsCommand(sessions) {
589
595
  configureInsightsCommand(sessions.command('insights'));
@@ -14,8 +14,8 @@
14
14
  import { Command } from 'commander';
15
15
  import type { ManifestHook } from '../lib/types.js';
16
16
  import { type McpYamlConfig } from '../lib/mcp.js';
17
- import { type PluginResourceGroup } from '../lib/plugins.js';
18
- import { type JobConfig, type RunMeta } from '../lib/routines.js';
17
+ import { type PluginResourceGroup } from '../lib/plugins/plugins.js';
18
+ import { type JobConfig, type RunMeta } from '../lib/scheduling/routines.js';
19
19
  /** Resource kinds the inspect command can drill into. */
20
20
  declare const DRILLABLE_KINDS: readonly ["commands", "skills", "hooks", "mcp", "rules", "plugins", "workflows", "subagents", "routines"];
21
21
  type DrillableKind = typeof DRILLABLE_KINDS[number];
@@ -134,7 +134,6 @@ export declare function pathSize(p: string): {
134
134
  files: number;
135
135
  };
136
136
  /** Human byte size: "84 KB", "3.1 MB". */
137
- export declare function formatBytes(n: number): string;
138
137
  export interface ManifestSummary {
139
138
  /** `run.<agent>.strategy` pairs from agents.yaml. */
140
139
  strategies: Array<{