@phnx-labs/agents-cli 1.22.35 → 1.22.37

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 (487) hide show
  1. package/CHANGELOG.md +666 -2
  2. package/README.md +75 -35
  3. package/dist/bin/agents +0 -0
  4. package/dist/bootstrap.d.ts +15 -0
  5. package/dist/bootstrap.js +1211 -0
  6. package/dist/commands/accounts.d.ts +4 -11
  7. package/dist/commands/accounts.js +159 -27
  8. package/dist/commands/attach.js +17 -4
  9. package/dist/commands/audit.d.ts +8 -8
  10. package/dist/commands/audit.js +57 -47
  11. package/dist/commands/browser.js +15 -11
  12. package/dist/commands/cloud.js +1 -1
  13. package/dist/commands/commands.js +0 -11
  14. package/dist/commands/computer-actions.js +33 -0
  15. package/dist/commands/computer-sessions-picker.d.ts +21 -0
  16. package/dist/commands/computer-sessions-picker.js +141 -0
  17. package/dist/commands/computer.d.ts +16 -0
  18. package/dist/commands/computer.js +37 -0
  19. package/dist/commands/config.d.ts +17 -0
  20. package/dist/commands/config.js +401 -0
  21. package/dist/commands/cp.d.ts +84 -0
  22. package/dist/commands/cp.js +231 -0
  23. package/dist/commands/daemon.js +243 -14
  24. package/dist/commands/detach-core.d.ts +1 -1
  25. package/dist/commands/detach-core.js +12 -2
  26. package/dist/commands/detach.js +1 -1
  27. package/dist/commands/doctor.js +64 -5
  28. package/dist/commands/events.d.ts +24 -12
  29. package/dist/commands/events.js +144 -28
  30. package/dist/commands/exec.js +85 -41
  31. package/dist/commands/feed.d.ts +1 -1
  32. package/dist/commands/feed.js +16 -8
  33. package/dist/commands/focus.d.ts +33 -1
  34. package/dist/commands/focus.js +177 -17
  35. package/dist/commands/funnel.d.ts +1 -1
  36. package/dist/commands/go.js +9 -8
  37. package/dist/commands/harness-wizard.d.ts +1 -0
  38. package/dist/commands/harness-wizard.js +18 -20
  39. package/dist/commands/harness.d.ts +2 -0
  40. package/dist/commands/harness.js +59 -26
  41. package/dist/commands/hooks.js +0 -11
  42. package/dist/commands/inspect.d.ts +94 -1
  43. package/dist/commands/inspect.js +866 -40
  44. package/dist/commands/lease.d.ts +4 -4
  45. package/dist/commands/lease.js +6 -6
  46. package/dist/commands/login.js +0 -13
  47. package/dist/commands/logs.d.ts +2 -2
  48. package/dist/commands/logs.js +2 -2
  49. package/dist/commands/mcp.js +7 -2
  50. package/dist/commands/memory.js +7 -2
  51. package/dist/commands/message.d.ts +1 -1
  52. package/dist/commands/message.js +37 -6
  53. package/dist/commands/models.js +4 -0
  54. package/dist/commands/monitors.d.ts +0 -1
  55. package/dist/commands/monitors.js +199 -16
  56. package/dist/commands/open.d.ts +18 -0
  57. package/dist/commands/open.js +57 -0
  58. package/dist/commands/packages.js +2 -107
  59. package/dist/commands/plugins.js +6 -3
  60. package/dist/commands/profiles.d.ts +1 -0
  61. package/dist/commands/profiles.js +16 -160
  62. package/dist/commands/projects.d.ts +28 -0
  63. package/dist/commands/projects.js +125 -5
  64. package/dist/commands/reconnect.js +9 -3
  65. package/dist/commands/repo.js +42 -1
  66. package/dist/commands/resource-view.d.ts +17 -0
  67. package/dist/commands/resource-view.js +36 -14
  68. package/dist/commands/resume.js +9 -2
  69. package/dist/commands/routines.d.ts +0 -2
  70. package/dist/commands/routines.js +473 -289
  71. package/dist/commands/secrets.js +52 -9
  72. package/dist/commands/sessions-export.d.ts +47 -0
  73. package/dist/commands/sessions-export.js +116 -6
  74. package/dist/commands/sessions-import.d.ts +17 -0
  75. package/dist/commands/sessions-import.js +114 -6
  76. package/dist/commands/sessions-migrate.d.ts +27 -0
  77. package/dist/commands/sessions-migrate.js +50 -9
  78. package/dist/commands/sessions-picker.js +23 -4
  79. package/dist/commands/sessions-resume.d.ts +5 -3
  80. package/dist/commands/sessions-resume.js +30 -8
  81. package/dist/commands/sessions-watch.d.ts +2 -0
  82. package/dist/commands/sessions-watch.js +53 -0
  83. package/dist/commands/sessions.d.ts +66 -3
  84. package/dist/commands/sessions.js +298 -47
  85. package/dist/commands/set.d.ts +1 -1
  86. package/dist/commands/set.js +2 -2
  87. package/dist/commands/setup-browser.js +2 -2
  88. package/dist/commands/setup-mine.js +0 -1
  89. package/dist/commands/setup-preferences.js +1 -1
  90. package/dist/commands/setup-share.js +34 -4
  91. package/dist/commands/setup.d.ts +5 -0
  92. package/dist/commands/setup.js +26 -0
  93. package/dist/commands/share.d.ts +67 -0
  94. package/dist/commands/share.js +275 -12
  95. package/dist/commands/skills.js +0 -11
  96. package/dist/commands/snapshot.js +1 -1
  97. package/dist/commands/ssh.d.ts +18 -0
  98. package/dist/commands/ssh.js +549 -210
  99. package/dist/commands/sync.d.ts +5 -0
  100. package/dist/commands/sync.js +212 -32
  101. package/dist/commands/teams.d.ts +13 -0
  102. package/dist/commands/teams.js +187 -30
  103. package/dist/commands/tickets.d.ts +2 -0
  104. package/dist/commands/tickets.js +43 -0
  105. package/dist/commands/update.js +2 -4
  106. package/dist/commands/usage.js +5 -3
  107. package/dist/commands/versions.js +11 -5
  108. package/dist/commands/view.js +15 -7
  109. package/dist/commands/webhook.d.ts +2 -2
  110. package/dist/commands/webhook.js +7 -7
  111. package/dist/index.d.ts +18 -2
  112. package/dist/index.js +53 -1264
  113. package/dist/lib/account-catalog.d.ts +18 -0
  114. package/dist/lib/account-catalog.js +38 -0
  115. package/dist/lib/account-provider-registry.d.ts +18 -0
  116. package/dist/lib/account-provider-registry.js +59 -0
  117. package/dist/lib/account-registry.d.ts +40 -0
  118. package/dist/lib/account-registry.js +239 -0
  119. package/dist/lib/account-schema.d.ts +44 -0
  120. package/dist/lib/account-schema.js +91 -0
  121. package/dist/lib/account-state-service.d.ts +21 -0
  122. package/dist/lib/account-state-service.js +60 -0
  123. package/dist/lib/activity.d.ts +1 -1
  124. package/dist/lib/activity.js +8 -1
  125. package/dist/lib/add-dir.d.ts +80 -0
  126. package/dist/lib/add-dir.js +241 -0
  127. package/dist/lib/agent-cli-commands.d.ts +11 -0
  128. package/dist/lib/agent-cli-commands.js +30 -0
  129. package/dist/lib/agents.js +44 -36
  130. package/dist/lib/answer-router.js +1 -1
  131. package/dist/lib/audit/log.d.ts +10 -27
  132. package/dist/lib/audit/log.js +20 -33
  133. package/dist/lib/auth-health.d.ts +9 -2
  134. package/dist/lib/auth-health.js +42 -9
  135. package/dist/lib/auto-pull-worker.js +7 -3
  136. package/dist/lib/auto-pull.d.ts +44 -3
  137. package/dist/lib/auto-pull.js +88 -5
  138. package/dist/lib/binary-shadow.d.ts +28 -0
  139. package/dist/lib/binary-shadow.js +121 -0
  140. package/dist/lib/brand.js +9 -3
  141. package/dist/lib/browser/ipc.d.ts +30 -0
  142. package/dist/lib/browser/ipc.js +81 -4
  143. package/dist/lib/browser/profiles.d.ts +3 -2
  144. package/dist/lib/browser/profiles.js +65 -22
  145. package/dist/lib/browser/service.d.ts +4 -0
  146. package/dist/lib/browser/service.js +30 -3
  147. package/dist/lib/browser/sessions-list.d.ts +22 -2
  148. package/dist/lib/browser/sessions-list.js +54 -6
  149. package/dist/lib/browser/stream.d.ts +2 -0
  150. package/dist/lib/browser/stream.js +1 -0
  151. package/dist/lib/browser/types.d.ts +19 -0
  152. package/dist/lib/byok-usage.d.ts +9 -2
  153. package/dist/lib/byok-usage.js +133 -31
  154. package/dist/lib/cli-entry.d.ts +11 -0
  155. package/dist/lib/cli-entry.js +46 -0
  156. package/dist/lib/cloud/host.d.ts +1 -1
  157. package/dist/lib/cloud/host.js +2 -2
  158. package/dist/lib/cloud/registry.js +1 -1
  159. package/dist/lib/cloud/types.d.ts +1 -1
  160. package/dist/lib/commands.d.ts +2 -0
  161. package/dist/lib/commands.js +2 -0
  162. package/dist/lib/computer/sessions-list.d.ts +150 -0
  163. package/dist/lib/computer/sessions-list.js +363 -0
  164. package/dist/lib/config-keys.d.ts +86 -0
  165. package/dist/lib/config-keys.js +193 -0
  166. package/dist/lib/config-machine-keys.d.ts +12 -0
  167. package/dist/lib/config-machine-keys.js +17 -0
  168. package/dist/lib/config-transfer.js +3 -4
  169. package/dist/lib/crabbox/cli.d.ts +2 -2
  170. package/dist/lib/crabbox/cli.js +3 -3
  171. package/dist/lib/daemon-health.d.ts +22 -0
  172. package/dist/lib/daemon-health.js +33 -3
  173. package/dist/lib/daemon-services.d.ts +50 -0
  174. package/dist/lib/daemon-services.js +147 -0
  175. package/dist/lib/daemon-ticks.d.ts +35 -66
  176. package/dist/lib/daemon-ticks.js +77 -159
  177. package/dist/lib/daemon.d.ts +72 -4
  178. package/dist/lib/daemon.js +792 -202
  179. package/dist/lib/deeplink/register.d.ts +49 -0
  180. package/dist/lib/deeplink/register.js +253 -0
  181. package/dist/lib/deeplink/url.d.ts +34 -0
  182. package/dist/lib/deeplink/url.js +78 -0
  183. package/dist/lib/device-config.d.ts +124 -29
  184. package/dist/lib/device-config.js +346 -141
  185. package/dist/lib/devices/config-migration.d.ts +42 -0
  186. package/dist/lib/devices/config-migration.js +203 -0
  187. package/dist/lib/devices/connect.js +14 -7
  188. package/dist/lib/devices/doctor-findings.d.ts +4 -1
  189. package/dist/lib/devices/doctor-findings.js +20 -1
  190. package/dist/lib/devices/harness-inventory.d.ts +11 -2
  191. package/dist/lib/devices/harness-inventory.js +0 -0
  192. package/dist/lib/devices/health.d.ts +1 -1
  193. package/dist/lib/devices/health.js +1 -1
  194. package/dist/lib/devices/pending.d.ts +22 -1
  195. package/dist/lib/devices/pending.js +67 -2
  196. package/dist/lib/devices/registry.d.ts +0 -25
  197. package/dist/lib/devices/registry.js +2 -83
  198. package/dist/lib/devices/resolve-profile.d.ts +20 -0
  199. package/dist/lib/devices/resolve-profile.js +44 -0
  200. package/dist/lib/devices/rollout-verify.d.ts +101 -0
  201. package/dist/lib/devices/rollout-verify.js +193 -0
  202. package/dist/lib/devices/ssh-config.js +10 -6
  203. package/dist/lib/event-families.d.ts +28 -0
  204. package/dist/lib/event-families.js +159 -0
  205. package/dist/lib/event-stream.d.ts +9 -1
  206. package/dist/lib/event-stream.js +26 -9
  207. package/dist/lib/events.d.ts +9 -1
  208. package/dist/lib/events.js +21 -6
  209. package/dist/lib/exec.d.ts +30 -0
  210. package/dist/lib/exec.js +219 -121
  211. package/dist/lib/feed-broadcast.d.ts +25 -0
  212. package/dist/lib/feed-broadcast.js +33 -0
  213. package/dist/lib/feed.d.ts +1 -1
  214. package/dist/lib/feed.js +12 -2
  215. package/dist/lib/fleet/capture.js +15 -0
  216. package/dist/lib/fleet/manifest.js +9 -0
  217. package/dist/lib/fleet/types.d.ts +9 -0
  218. package/dist/lib/fleet-status.js +10 -8
  219. package/dist/lib/git.d.ts +20 -6
  220. package/dist/lib/git.js +121 -17
  221. package/dist/lib/hosts/dispatch.d.ts +8 -3
  222. package/dist/lib/hosts/dispatch.js +29 -3
  223. package/dist/lib/hosts/logs.d.ts +2 -2
  224. package/dist/lib/hosts/logs.js +2 -2
  225. package/dist/lib/hosts/option.js +1 -1
  226. package/dist/lib/hosts/passthrough.d.ts +2 -3
  227. package/dist/lib/hosts/passthrough.js +10 -24
  228. package/dist/lib/hosts/progress.js +2 -2
  229. package/dist/lib/hosts/providers/devices.d.ts +3 -3
  230. package/dist/lib/hosts/providers/devices.js +18 -12
  231. package/dist/lib/hosts/ready.d.ts +5 -1
  232. package/dist/lib/hosts/ready.js +9 -3
  233. package/dist/lib/hosts/reconcile.d.ts +2 -2
  234. package/dist/lib/hosts/reconcile.js +2 -2
  235. package/dist/lib/hosts/registry.js +14 -9
  236. package/dist/lib/hosts/remote-cmd.js +1 -1
  237. package/dist/lib/hosts/remote-os.d.ts +9 -6
  238. package/dist/lib/hosts/remote-os.js +13 -6
  239. package/dist/lib/hosts/routing-flag.d.ts +23 -0
  240. package/dist/lib/hosts/routing-flag.js +41 -0
  241. package/dist/lib/hosts/run-target.js +1 -1
  242. package/dist/lib/hosts/session-index.js +1 -1
  243. package/dist/lib/hosts/tasks.d.ts +6 -6
  244. package/dist/lib/hosts/tasks.js +4 -4
  245. package/dist/lib/hosts/types.js +1 -2
  246. package/dist/lib/installations/resolve.js +2 -8
  247. package/dist/lib/isolation-boundary-report.js +0 -1
  248. package/dist/lib/linear-cache.d.ts +7 -0
  249. package/dist/lib/linear-cache.js +31 -4
  250. package/dist/lib/linear-project-counts.d.ts +1 -1
  251. package/dist/lib/linear-project-counts.js +2 -3
  252. package/dist/lib/linear-projects.js +1 -1
  253. package/dist/lib/loop.d.ts +2 -2
  254. package/dist/lib/loop.js +1 -1
  255. package/dist/lib/mailbox-target.d.ts +1 -1
  256. package/dist/lib/mailbox-target.js +1 -1
  257. package/dist/lib/manifest.js +7 -4
  258. package/dist/lib/menubar/MenubarHelper.app/Contents/CodeResources +0 -0
  259. package/dist/lib/menubar/MenubarHelper.app/Contents/MacOS/MenubarHelper +0 -0
  260. package/dist/lib/menubar/snapshot.d.ts +3 -2
  261. package/dist/lib/menubar/snapshot.js +6 -2
  262. package/dist/lib/migrate-fold.d.ts +33 -0
  263. package/dist/lib/migrate-fold.js +130 -0
  264. package/dist/lib/migrate.d.ts +34 -34
  265. package/dist/lib/migrate.js +106 -128
  266. package/dist/lib/model-tier-overrides.d.ts +1 -1
  267. package/dist/lib/model-tier-overrides.js +15 -2
  268. package/dist/lib/monitors/config.d.ts +17 -3
  269. package/dist/lib/monitors/config.js +52 -18
  270. package/dist/lib/monitors/engine.d.ts +32 -1
  271. package/dist/lib/monitors/engine.js +94 -11
  272. package/dist/lib/monitors/fingerprint.d.ts +46 -0
  273. package/dist/lib/monitors/fingerprint.js +100 -0
  274. package/dist/lib/monitors/remote.d.ts +47 -0
  275. package/dist/lib/monitors/remote.js +81 -0
  276. package/dist/lib/monitors/state.d.ts +39 -0
  277. package/dist/lib/monitors/state.js +56 -0
  278. package/dist/lib/onepassword.d.ts +17 -0
  279. package/dist/lib/onepassword.js +52 -22
  280. package/dist/lib/open-url.js +1 -1
  281. package/dist/lib/picker.d.ts +14 -2
  282. package/dist/lib/picker.js +35 -13
  283. package/dist/lib/placement.d.ts +1 -1
  284. package/dist/lib/placement.js +1 -1
  285. package/dist/lib/pr-land-detach.d.ts +32 -0
  286. package/dist/lib/pr-land-detach.js +79 -0
  287. package/dist/lib/profiles-presets.js +13 -0
  288. package/dist/lib/profiles.d.ts +2 -0
  289. package/dist/lib/profiles.js +44 -1
  290. package/dist/lib/project-focus.d.ts +1 -1
  291. package/dist/lib/project-focus.js +1 -1
  292. package/dist/lib/project-probe.d.ts +4 -1
  293. package/dist/lib/project-probe.js +5 -4
  294. package/dist/lib/project-resources.js +2 -18
  295. package/dist/lib/project-root.d.ts +16 -0
  296. package/dist/lib/project-root.js +20 -2
  297. package/dist/lib/projects.d.ts +20 -1
  298. package/dist/lib/projects.js +78 -1
  299. package/dist/lib/refresh-coordinator.d.ts +24 -0
  300. package/dist/lib/refresh-coordinator.js +52 -0
  301. package/dist/lib/registry.d.ts +2 -2
  302. package/dist/lib/registry.js +1 -1
  303. package/dist/lib/resource-aliases.d.ts +13 -0
  304. package/dist/lib/resource-aliases.js +26 -0
  305. package/dist/lib/resources/types.d.ts +1 -1
  306. package/dist/lib/resources.d.ts +16 -0
  307. package/dist/lib/resources.js +66 -10
  308. package/dist/lib/rotate.d.ts +3 -4
  309. package/dist/lib/rotate.js +4 -5
  310. package/dist/lib/routine-activation.d.ts +22 -2
  311. package/dist/lib/routine-activation.js +63 -16
  312. package/dist/lib/routine-context.d.ts +9 -2
  313. package/dist/lib/routine-context.js +21 -6
  314. package/dist/lib/routines-project.d.ts +58 -48
  315. package/dist/lib/routines-project.js +190 -159
  316. package/dist/lib/routines.d.ts +41 -6
  317. package/dist/lib/routines.js +92 -34
  318. package/dist/lib/run-defaults.d.ts +5 -0
  319. package/dist/lib/run-defaults.js +11 -1
  320. package/dist/lib/runner.d.ts +10 -8
  321. package/dist/lib/runner.js +122 -39
  322. package/dist/lib/secrets/Agents CLI.app/Contents/CodeResources +0 -0
  323. package/dist/lib/secrets/Agents CLI.app/Contents/MacOS/Agents CLI +0 -0
  324. package/dist/lib/secrets/agent.d.ts +10 -3
  325. package/dist/lib/secrets/agent.js +43 -8
  326. package/dist/lib/secrets/bundles.d.ts +1 -0
  327. package/dist/lib/secrets/bundles.js +92 -80
  328. package/dist/lib/secrets/index.js +32 -9
  329. package/dist/lib/secrets/install-helper.d.ts +4 -4
  330. package/dist/lib/secrets/install-helper.js +4 -4
  331. package/dist/lib/secrets/push.d.ts +40 -6
  332. package/dist/lib/secrets/push.js +58 -11
  333. package/dist/lib/secrets/read-backoff.d.ts +1 -1
  334. package/dist/lib/secrets/read-backoff.js +1 -1
  335. package/dist/lib/secrets/remote.d.ts +24 -0
  336. package/dist/lib/secrets/remote.js +54 -4
  337. package/dist/lib/self-update.d.ts +108 -0
  338. package/dist/lib/self-update.js +276 -1
  339. package/dist/lib/session/active.d.ts +89 -5
  340. package/dist/lib/session/active.js +165 -10
  341. package/dist/lib/session/actor-sidecar.d.ts +1 -1
  342. package/dist/lib/session/actor-sidecar.js +2 -1
  343. package/dist/lib/session/db.d.ts +176 -2
  344. package/dist/lib/session/db.js +484 -17
  345. package/dist/lib/session/discover.js +27 -4
  346. package/dist/lib/session/hook-sessions.js +2 -2
  347. package/dist/lib/session/host-link.d.ts +2 -2
  348. package/dist/lib/session/host-link.js +2 -2
  349. package/dist/lib/session/pid-registry.d.ts +21 -0
  350. package/dist/lib/session/pid-registry.js +57 -0
  351. package/dist/lib/session/remote-active.js +15 -1
  352. package/dist/lib/session/remote.js +2 -2
  353. package/dist/lib/session/session-cache.d.ts +14 -7
  354. package/dist/lib/session/session-cache.js +51 -9
  355. package/dist/lib/session/state.d.ts +2 -2
  356. package/dist/lib/session/state.js +1 -1
  357. package/dist/lib/session/sync/config.d.ts +10 -10
  358. package/dist/lib/session/sync/config.js +10 -10
  359. package/dist/lib/session/sync/r2.d.ts +34 -0
  360. package/dist/lib/session/sync/r2.js +123 -0
  361. package/dist/lib/session/throughput.d.ts +1 -1
  362. package/dist/lib/session/throughput.js +1 -1
  363. package/dist/lib/session/types.d.ts +23 -1
  364. package/dist/lib/session/types.js +15 -0
  365. package/dist/lib/session/viewing-in.d.ts +1 -1
  366. package/dist/lib/session/viewing-in.js +1 -1
  367. package/dist/lib/session/watch.d.ts +101 -0
  368. package/dist/lib/session/watch.js +242 -0
  369. package/dist/lib/share/config.d.ts +4 -0
  370. package/dist/lib/share/config.js +1 -0
  371. package/dist/lib/share/provision.d.ts +38 -0
  372. package/dist/lib/share/provision.js +50 -0
  373. package/dist/lib/share/publish.d.ts +40 -1
  374. package/dist/lib/share/publish.js +116 -3
  375. package/dist/lib/share/worker-template.js +71 -6
  376. package/dist/lib/shims.d.ts +17 -3
  377. package/dist/lib/shims.js +98 -26
  378. package/dist/lib/signin-badge.js +3 -2
  379. package/dist/lib/skills.js +2 -0
  380. package/dist/lib/smart-launch.d.ts +8 -8
  381. package/dist/lib/smart-launch.js +80 -59
  382. package/dist/lib/ssh-exec.d.ts +1 -1
  383. package/dist/lib/ssh-exec.js +1 -1
  384. package/dist/lib/staleness/prune.d.ts +88 -0
  385. package/dist/lib/staleness/prune.js +69 -0
  386. package/dist/lib/staleness/registry.d.ts +1 -1
  387. package/dist/lib/staleness/writers/commands.js +34 -2
  388. package/dist/lib/staleness/writers/hooks.js +16 -0
  389. package/dist/lib/staleness/writers/kinds.d.ts +6 -0
  390. package/dist/lib/staleness/writers/skills.js +19 -0
  391. package/dist/lib/staleness/writers/subagents.d.ts +2 -3
  392. package/dist/lib/staleness/writers/subagents.js +0 -4
  393. package/dist/lib/staleness/writers/types.d.ts +32 -0
  394. package/dist/lib/startup/command-registry.d.ts +6 -12
  395. package/dist/lib/startup/command-registry.js +11 -31
  396. package/dist/lib/startup/dev-build.d.ts +10 -0
  397. package/dist/lib/startup/dev-build.js +13 -1
  398. package/dist/lib/startup/spellcheck.d.ts +18 -0
  399. package/dist/lib/startup/spellcheck.js +45 -0
  400. package/dist/lib/state.d.ts +36 -9
  401. package/dist/lib/state.js +96 -46
  402. package/dist/lib/subagents-registry.d.ts +0 -7
  403. package/dist/lib/subagents-registry.js +38 -65
  404. package/dist/lib/subagents.d.ts +0 -33
  405. package/dist/lib/subagents.js +0 -75
  406. package/dist/lib/sync-umbrella.js +1 -1
  407. package/dist/lib/teams/agents.d.ts +41 -1
  408. package/dist/lib/teams/agents.js +187 -9
  409. package/dist/lib/teams/api.d.ts +11 -1
  410. package/dist/lib/teams/api.js +11 -2
  411. package/dist/lib/teams/delivery.d.ts +41 -0
  412. package/dist/lib/teams/delivery.js +60 -0
  413. package/dist/lib/teams/registry.d.ts +14 -0
  414. package/dist/lib/teams/registry.js +51 -1
  415. package/dist/lib/teams/remoteWorktree.d.ts +19 -0
  416. package/dist/lib/teams/remoteWorktree.js +29 -0
  417. package/dist/lib/teams/scheduler.d.ts +1 -1
  418. package/dist/lib/teams/scheduler.js +1 -1
  419. package/dist/lib/teams/worktree.d.ts +24 -0
  420. package/dist/lib/teams/worktree.js +42 -0
  421. package/dist/lib/terminal/backends/vscodium-agent.d.ts +10 -1
  422. package/dist/lib/terminal/backends/vscodium-agent.js +16 -5
  423. package/dist/lib/terminal/engine.d.ts +4 -0
  424. package/dist/lib/terminal/engine.js +8 -2
  425. package/dist/lib/terminal/types.d.ts +21 -2
  426. package/dist/lib/testdata/refresh-coordinator-worker.d.ts +1 -0
  427. package/dist/lib/testdata/refresh-coordinator-worker.js +23 -0
  428. package/dist/lib/tickets/list.d.ts +53 -0
  429. package/dist/lib/tickets/list.js +153 -0
  430. package/dist/lib/tmux/orphan-reap.d.ts +320 -0
  431. package/dist/lib/tmux/orphan-reap.js +644 -0
  432. package/dist/lib/tmux/session.d.ts +68 -3
  433. package/dist/lib/tmux/session.js +95 -5
  434. package/dist/lib/triggers/handlers.d.ts +20 -0
  435. package/dist/lib/triggers/handlers.js +6 -1
  436. package/dist/lib/types.d.ts +46 -34
  437. package/dist/lib/usage-fleet.d.ts +32 -0
  438. package/dist/lib/usage-fleet.js +125 -0
  439. package/dist/lib/usage-refresh.d.ts +3 -3
  440. package/dist/lib/usage-refresh.js +19 -16
  441. package/dist/lib/usage.d.ts +51 -47
  442. package/dist/lib/usage.js +145 -153
  443. package/dist/lib/version-duplicates.js +2 -2
  444. package/dist/lib/versions.d.ts +56 -13
  445. package/dist/lib/versions.js +195 -45
  446. package/dist/lib/watchdog/log.d.ts +1 -1
  447. package/dist/lib/watchdog/log.js +3 -3
  448. package/dist/lib/watchdog/rotate.d.ts +6 -6
  449. package/dist/lib/watchdog/rotate.js +6 -6
  450. package/dist/lib/workflows.d.ts +1 -1
  451. package/dist/lib/yaml-io.d.ts +47 -0
  452. package/dist/lib/yaml-io.js +55 -0
  453. package/package.json +2 -1
  454. package/scripts/install-helper.js +2 -2
  455. package/scripts/postinstall.js +23 -20
  456. package/dist/commands/defaults.d.ts +0 -7
  457. package/dist/commands/defaults.js +0 -107
  458. package/dist/commands/export.d.ts +0 -11
  459. package/dist/commands/export.js +0 -215
  460. package/dist/commands/helper.d.ts +0 -12
  461. package/dist/commands/helper.js +0 -87
  462. package/dist/commands/hosts.d.ts +0 -11
  463. package/dist/commands/hosts.js +0 -330
  464. package/dist/commands/lock.d.ts +0 -12
  465. package/dist/commands/lock.js +0 -70
  466. package/dist/commands/pull.d.ts +0 -17
  467. package/dist/commands/pull.js +0 -39
  468. package/dist/commands/push.d.ts +0 -14
  469. package/dist/commands/push.js +0 -30
  470. package/dist/commands/wallet.d.ts +0 -20
  471. package/dist/commands/wallet.js +0 -216
  472. package/dist/commands/worktree.d.ts +0 -19
  473. package/dist/commands/worktree.js +0 -272
  474. package/dist/lib/account-labels.d.ts +0 -24
  475. package/dist/lib/account-labels.js +0 -72
  476. package/dist/lib/auto-dispatch-linear.d.ts +0 -18
  477. package/dist/lib/auto-dispatch-linear.js +0 -107
  478. package/dist/lib/auto-dispatch-provider.d.ts +0 -10
  479. package/dist/lib/auto-dispatch-provider.js +0 -30
  480. package/dist/lib/auto-dispatch.d.ts +0 -93
  481. package/dist/lib/auto-dispatch.js +0 -128
  482. package/dist/lib/export.d.ts +0 -72
  483. package/dist/lib/export.js +0 -269
  484. package/dist/lib/lock.d.ts +0 -93
  485. package/dist/lib/lock.js +0 -207
  486. package/dist/lib/wallet/index.d.ts +0 -78
  487. package/dist/lib/wallet/index.js +0 -253
@@ -4,9 +4,9 @@
4
4
  * Bridges the devices registry (`agents devices`, ~/.agents/.history/devices/
5
5
  * registry.json) into the host pool behind the same `HostProvider` seam as
6
6
  * `local` — the "tailscale provider" fast-follow named in docs/hosts.md. With
7
- * it, a machine registered once via `agents devices sync` shows up in
8
- * `agents hosts list`, participates in capability routing, and is enumerable
9
- * by target pickers — not just resolvable by exact name.
7
+ * it, a machine registered once via `agents devices sync` becomes a resolvable
8
+ * `--host`/`--device` dispatch target, participates in capability routing, and
9
+ * is enumerable by target pickers — not just resolvable by exact name.
10
10
  *
11
11
  * Password-auth devices are listed (the pool stays honest about what exists)
12
12
  * but marked `dispatchable: false`; resolving one for dispatch throws the same
@@ -18,6 +18,7 @@
18
18
  * order, exactly like the old tier-2 devices fall-through in resolveHost.
19
19
  */
20
20
  import { loadDevices, getDevice, isControlDevice } from '../../devices/registry.js';
21
+ import { resolveDeviceProfile } from '../../devices/resolve-profile.js';
21
22
  import { DeviceOffloadUnsupportedError } from '../types.js';
22
23
  /** Tailscale's own presence bit, when the sync captured one. */
23
24
  function statusOf(device) {
@@ -28,17 +29,19 @@ function statusOf(device) {
28
29
  /**
29
30
  * Bridge a device profile into a `Host`. dnsName (stable across IP churn) is
30
31
  * preferred over ip; `source: 'inline'` makes `sshTargetFor` emit `user@address`.
31
- * Capability tags attach by enrolling the device (`agents hosts add <device>
32
- * --cap …` sources the target from this profile) the enrolled entry then
33
- * shadows this row by provider precedence, carrying the caps.
32
+ * Capability tags come from an enrolled overlay entry for the device in
33
+ * agents.yaml (`Meta.hosts`) that entry shadows this row by provider
34
+ * precedence, carrying the caps.
34
35
  */
35
- function deviceToPoolHost(device) {
36
+ function deviceToPoolHost(rawDevice) {
36
37
  // A control device (a cockpit, e.g. a paired iPhone) drives the fleet but
37
38
  // never runs agents — it must never enter the host pool or be resolvable as a
38
39
  // dispatch target, whatever platform it reports (an iPhone syncs as `unknown`,
39
40
  // which remoteShellFor would otherwise default to POSIX and try to SSH).
40
- if (isControlDevice(device))
41
+ if (isControlDevice(rawDevice))
41
42
  return null;
43
+ // Effective profile: central config (ssh.*/platform) overlays discovery.
44
+ const device = resolveDeviceProfile(rawDevice);
42
45
  const address = device.address.dnsName ?? device.address.ip;
43
46
  if (!address)
44
47
  return null; // unreachable profile — nothing to dispatch to
@@ -72,15 +75,18 @@ export class DevicesHostProvider {
72
75
  return out.sort((a, b) => a.name.localeCompare(b.name));
73
76
  }
74
77
  async resolve(name) {
75
- const device = await getDevice(name);
76
- if (!device)
78
+ const raw = await getDevice(name);
79
+ if (!raw)
77
80
  return null;
78
81
  // Resolving is asking to dispatch. A control device can't run agents — fail
79
82
  // loud with a clear message instead of attempting an SSH dispatch onto a
80
83
  // phone (which remoteShellFor would treat as a POSIX host).
81
- if (isControlDevice(device)) {
82
- throw new Error(`Device "${device.name}" is a control device (a cockpit), not an executor — it can't run agents. Dispatch to a worker device instead.`);
84
+ if (isControlDevice(raw)) {
85
+ throw new Error(`Device "${raw.name}" is a control device (a cockpit), not an executor — it can't run agents. Dispatch to a worker device instead.`);
83
86
  }
87
+ // Effective profile: central config (ssh.*/platform) overlays discovery —
88
+ // the password-auth refusal and the dial shape both follow the config.
89
+ const device = resolveDeviceProfile(raw);
84
90
  // Keep the long-standing typed refusal for password auth (BatchMode=yes
85
91
  // can't answer a prompt).
86
92
  if (device.auth.method === 'password') {
@@ -88,7 +88,11 @@ export declare function viewAgentVersions(view: string, agent: string): string[]
88
88
  export declare function viewHasAgentVersion(view: string, agent: string, version: string): boolean | undefined;
89
89
  /** Actionable fail-loud message for a missing remote pin (RUSH-2313). */
90
90
  export declare function missingPinnedVersionMessage(hostName: string, agent: string, version: string, installed?: string[]): string;
91
- /** Read the requested harness's sign-in verdict from `agents view --json`. */
91
+ /**
92
+ * Read whether the requested harness has at least one launch-eligible account
93
+ * from `agents view --json`. Signed-in accounts that are rate-limited or out of
94
+ * credits are deliberately false so automatic placement cannot select them.
95
+ */
92
96
  export declare function viewAgentSignedIn(view: string, agent: string): boolean | undefined;
93
97
  export interface EnsureReadyOptions {
94
98
  agent: string;
@@ -207,7 +207,11 @@ export function missingPinnedVersionMessage(hostName, agent, version, installed)
207
207
  return (`Pinned ${agent}@${version} is not installed on "${hostName}".${installedHint} ` +
208
208
  `Install it on that box: agents ssh ${hostName} -- agents add ${agent}@${version}`);
209
209
  }
210
- /** Read the requested harness's sign-in verdict from `agents view --json`. */
210
+ /**
211
+ * Read whether the requested harness has at least one launch-eligible account
212
+ * from `agents view --json`. Signed-in accounts that are rate-limited or out of
213
+ * credits are deliberately false so automatic placement cannot select them.
214
+ */
211
215
  export function viewAgentSignedIn(view, agent) {
212
216
  try {
213
217
  const rows = JSON.parse(view);
@@ -215,7 +219,9 @@ export function viewAgentSignedIn(view, agent) {
215
219
  if (!row)
216
220
  return undefined;
217
221
  const verdicts = (row.versions ?? [])
218
- .map((version) => version.signedIn)
222
+ .map((version) => typeof version.signedIn === 'boolean'
223
+ ? version.signedIn && version.usageStatus !== 'rate_limited' && version.usageStatus !== 'out_of_credits'
224
+ : undefined)
219
225
  .filter((value) => typeof value === 'boolean');
220
226
  return verdicts.length === 0 ? undefined : verdicts.some(Boolean);
221
227
  }
@@ -270,7 +276,7 @@ export function ensureHostReady(host, opts) {
270
276
  throw new Error(`Host "${host.name}" (${target}) is not reachable over SSH. Check it's online and key auth works.`);
271
277
  }
272
278
  if (!probe.version) {
273
- throw new Error(`agents-cli is not installed on "${host.name}". Enroll it first: agents hosts add ${host.name} (bootstraps agents-cli).`);
279
+ throw new Error(`agents-cli is not installed on "${host.name}". Install it there first — e.g. \`agents devices update\` to roll it out to registered devices.`);
274
280
  }
275
281
  return evaluateHostAgentInstall(probe.view, opts, host.name);
276
282
  }
@@ -6,7 +6,7 @@
6
6
  * the SSH connection drops mid-follow. When that happens the local record is
7
7
  * left at `status:'running'` forever, because the only path that finalizes it
8
8
  * (dispatch's post-follow `updateTask`) never runs. This module re-reads the
9
- * remote `.exit` on demand — from `agents hosts ps` / `logs` — and heals the
9
+ * remote `.exit` on demand — from `agents devices ps` / `agents logs` — and heals the
10
10
  * record. We only ever CONFIRM completion; an unreachable host or an absent
11
11
  * `.exit` leaves the record `running` (we never guess failure).
12
12
  */
@@ -43,7 +43,7 @@ export declare function readRemoteExit(target: string, remoteExit: string, timeo
43
43
  */
44
44
  export declare function reconcileTask(task: HostTask): HostTask;
45
45
  /**
46
- * Heal a list of records for a listing (`agents hosts ps`). Only `running` tasks
46
+ * Heal a list of records for a listing (`agents devices ps`). Only `running` tasks
47
47
  * are probed; each host is reachability-checked ONCE (deduped by target) so a
48
48
  * down host costs a single short timeout instead of one per task, and its tasks
49
49
  * are left `running` rather than falsely failed. Sequential by design — with the
@@ -6,7 +6,7 @@
6
6
  * the SSH connection drops mid-follow. When that happens the local record is
7
7
  * left at `status:'running'` forever, because the only path that finalizes it
8
8
  * (dispatch's post-follow `updateTask`) never runs. This module re-reads the
9
- * remote `.exit` on demand — from `agents hosts ps` / `logs` — and heals the
9
+ * remote `.exit` on demand — from `agents devices ps` / `agents logs` — and heals the
10
10
  * record. We only ever CONFIRM completion; an unreachable host or an absent
11
11
  * `.exit` leaves the record `running` (we never guess failure).
12
12
  */
@@ -60,7 +60,7 @@ export function reconcileTask(task) {
60
60
  return updateTask(task.id, terminalPatch(st.code)) ?? task;
61
61
  }
62
62
  /**
63
- * Heal a list of records for a listing (`agents hosts ps`). Only `running` tasks
63
+ * Heal a list of records for a listing (`agents devices ps`). Only `running` tasks
64
64
  * are probed; each host is reachability-checked ONCE (deduped by target) so a
65
65
  * down host costs a single short timeout instead of one per task, and its tasks
66
66
  * are left `running` rather than falsely failed. Sequential by design — with the
@@ -25,6 +25,7 @@ import { readMeta } from '../state.js';
25
25
  import { isSshConfigHost } from './ssh-config.js';
26
26
  import { resolveRemoteOsSync } from './remote-os.js';
27
27
  import { loadDevices, isControlDevice } from '../devices/registry.js';
28
+ import { resolveDeviceProfile } from '../devices/resolve-profile.js';
28
29
  import { isDeviceAuto, resolveDeviceAffinity } from '../smart-launch.js';
29
30
  import { localMachineId } from '../session/origin-machine.js';
30
31
  // Re-export so existing importers (tests, commands) keep their path; the class
@@ -87,20 +88,24 @@ function deviceStatus(device) {
87
88
  * device can never be made dispatchable by shadowing it with an inline entry.
88
89
  */
89
90
  function deviceHost(device, user, overlay) {
90
- const address = device.address.dnsName ?? device.address.ip;
91
+ // Effective profile: the central config's ssh.*/platform keys overlay the
92
+ // discovery record, so an operator edit via `agents devices config` is
93
+ // honored at dispatch time.
94
+ const resolved = resolveDeviceProfile(device);
95
+ const address = resolved.address.dnsName ?? resolved.address.ip;
91
96
  return {
92
- name: device.name,
97
+ name: resolved.name,
93
98
  provider: 'devices',
94
99
  source: 'inline',
95
100
  ...(address ? { address } : {}),
96
- user: user ?? device.user,
97
- identityFile: device.auth.identityFile,
98
- os: device.platform !== 'unknown' ? device.platform : overlay?.os,
101
+ user: user ?? resolved.user,
102
+ identityFile: resolved.auth.identityFile,
103
+ os: resolved.platform !== 'unknown' ? resolved.platform : overlay?.os,
99
104
  ...(overlay?.caps?.length ? { caps: overlay.caps } : {}),
100
105
  enrolled: true,
101
- status: deviceStatus(device),
102
- dispatchable: device.auth.method !== 'password',
103
- device,
106
+ status: deviceStatus(resolved),
107
+ dispatchable: resolved.auth.method !== 'password',
108
+ device: resolved,
104
109
  };
105
110
  }
106
111
  /** Build a Host from a bare overlay entry (inline or ssh-config), applying any
@@ -270,7 +275,7 @@ export async function resolveHostByCap(cap, any = false) {
270
275
  // must never be picked as a run target.
271
276
  const matches = (await listAllHosts()).filter((h) => h.caps?.includes(cap) && h.dispatchable !== false);
272
277
  if (matches.length === 0)
273
- throw new Error(`No host tagged "${cap}". Tag one with: agents hosts add <name> --cap ${cap}`);
278
+ throw new Error(`No host tagged "${cap}". See registered devices: agents devices list`);
274
279
  if (matches.length > 1 && !any) {
275
280
  throw new Error(`Multiple hosts tagged "${cap}": ${matches.map((h) => h.name).join(', ')}. Name one, or pass --any.`);
276
281
  }
@@ -140,7 +140,7 @@ export const RUN_OPTION_FORWARDING = {
140
140
  export const RUN_OPTION_REJECT_MESSAGES = {
141
141
  terminal: '--terminal opens a tab on THIS machine; it cannot be combined with --host. ' +
142
142
  'Drop --terminal to dispatch to the host, or drop --host to open the tab here. ' +
143
- 'To watch a remote run in a terminal, dispatch it and follow with `agents sessions focus <id>`.',
143
+ 'To watch a remote run in a terminal, dispatch it and follow with `agents sessions resume <id>`.',
144
144
  secrets: '--secrets cannot cross the SSH boundary — Keychain values are never sent to a host implicitly. ' +
145
145
  'Provision the bundle on the host first (agents secrets export --host <name>), then run without --secrets; ' +
146
146
  'workflow frontmatter secrets resolve from the HOST\'s own keychain.',
@@ -3,15 +3,18 @@
3
3
  * shell dialect (POSIX `bash -lc` vs Windows PowerShell). See `remoteShellFor`
4
4
  * in `remote-cmd.ts` for how the string is consumed.
5
5
  *
6
- * Two sources, in priority order:
7
- * 1. The device registry `platform` (`windows`/`linux`/`macos`), which is
6
+ * Three sources, in priority order:
7
+ * 1. The central config `platform` key (`fleet.devices.<name>.config.platform`
8
+ * in agents.yaml) — the operator's explicit override, set with
9
+ * `agents devices config <name> platform <os>`.
10
+ * 2. The device registry `platform` (`windows`/`linux`/`macos`), which is
8
11
  * populated fleet-wide by Tailscale sync — the reliable answer for a box
9
12
  * like `win-mini` that was discovered, not hand-enrolled.
10
- * 2. The enrolled `HostEntry.os` overlay in agents.yaml (the `uname` captured
11
- * at `agents hosts add` time), for hosts that live only in that overlay.
13
+ * 3. The enrolled `HostEntry.os` overlay in agents.yaml (the `uname` captured
14
+ * when the overlay entry was written), for hosts that live only in that overlay.
12
15
  *
13
- * Missing/unknown from both → `undefined`, which `remoteShellFor` maps to POSIX.
14
- * Kept synchronous so the sync `agents sessions --host` fan-out can use it.
16
+ * Missing/unknown from all three → `undefined`, which `remoteShellFor` maps to
17
+ * POSIX. Kept synchronous so the sync `agents sessions --host` fan-out can use it.
15
18
  */
16
19
  /** Resolve the OS/platform string for a host name, or undefined if unknown. */
17
20
  export declare function resolveRemoteOsSync(name: string): string | undefined;
@@ -3,21 +3,28 @@
3
3
  * shell dialect (POSIX `bash -lc` vs Windows PowerShell). See `remoteShellFor`
4
4
  * in `remote-cmd.ts` for how the string is consumed.
5
5
  *
6
- * Two sources, in priority order:
7
- * 1. The device registry `platform` (`windows`/`linux`/`macos`), which is
6
+ * Three sources, in priority order:
7
+ * 1. The central config `platform` key (`fleet.devices.<name>.config.platform`
8
+ * in agents.yaml) — the operator's explicit override, set with
9
+ * `agents devices config <name> platform <os>`.
10
+ * 2. The device registry `platform` (`windows`/`linux`/`macos`), which is
8
11
  * populated fleet-wide by Tailscale sync — the reliable answer for a box
9
12
  * like `win-mini` that was discovered, not hand-enrolled.
10
- * 2. The enrolled `HostEntry.os` overlay in agents.yaml (the `uname` captured
11
- * at `agents hosts add` time), for hosts that live only in that overlay.
13
+ * 3. The enrolled `HostEntry.os` overlay in agents.yaml (the `uname` captured
14
+ * when the overlay entry was written), for hosts that live only in that overlay.
12
15
  *
13
- * Missing/unknown from both → `undefined`, which `remoteShellFor` maps to POSIX.
14
- * Kept synchronous so the sync `agents sessions --host` fan-out can use it.
16
+ * Missing/unknown from all three → `undefined`, which `remoteShellFor` maps to
17
+ * POSIX. Kept synchronous so the sync `agents sessions --host` fan-out can use it.
15
18
  */
16
19
  import { loadDevicesSync } from '../devices/registry.js';
20
+ import { readDeviceConfigValues } from '../device-config.js';
17
21
  import { readMeta } from '../state.js';
18
22
  /** Resolve the OS/platform string for a host name, or undefined if unknown. */
19
23
  export function resolveRemoteOsSync(name) {
20
24
  try {
25
+ const configured = readDeviceConfigValues(name).platform;
26
+ if (typeof configured === 'string' && configured !== 'unknown')
27
+ return configured;
21
28
  const platform = loadDevicesSync()[name]?.platform;
22
29
  if (platform && platform !== 'unknown')
23
30
  return platform;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Leaf argv helpers for host/device routing flags.
3
+ *
4
+ * Zero imports on purpose. `bootstrap.ts` gates the dynamic
5
+ * `import('./lib/hosts/passthrough.js')` on {@link hasHostRoutingFlag} so the
6
+ * ~187 ms passthrough module graph is never loaded when no routing flag is
7
+ * present (the majority of CLI invocations). That gate must not itself drag
8
+ * in passthrough, remote-cmd, ssh-exec, or the device registry (RUSH-2374).
9
+ *
10
+ * `flagValue` lives here (not in passthrough.ts) for the same reason: the gate
11
+ * and the function body that later reads flag values share one implementation.
12
+ */
13
+ /** Pull the value of `--host`/`-H`/`--remote-cwd` (any form) out of an argv. */
14
+ export declare function flagValue(args: string[], long: string, short?: string): string | undefined;
15
+ /**
16
+ * True when argv carries any host/device routing flag that {@link maybeRunOnHost}
17
+ * inspects: `--host`/`-H`, `--device`, `--hosts`, `--devices` (space, `=`, or
18
+ * glued short form).
19
+ *
20
+ * Presence-only — does not validate values. Used by bootstrap before loading
21
+ * passthrough, and by `maybeRunStandaloneOnHost` before strip/route work.
22
+ */
23
+ export declare function hasHostRoutingFlag(args: string[]): boolean;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Leaf argv helpers for host/device routing flags.
3
+ *
4
+ * Zero imports on purpose. `bootstrap.ts` gates the dynamic
5
+ * `import('./lib/hosts/passthrough.js')` on {@link hasHostRoutingFlag} so the
6
+ * ~187 ms passthrough module graph is never loaded when no routing flag is
7
+ * present (the majority of CLI invocations). That gate must not itself drag
8
+ * in passthrough, remote-cmd, ssh-exec, or the device registry (RUSH-2374).
9
+ *
10
+ * `flagValue` lives here (not in passthrough.ts) for the same reason: the gate
11
+ * and the function body that later reads flag values share one implementation.
12
+ */
13
+ /** Pull the value of `--host`/`-H`/`--remote-cwd` (any form) out of an argv. */
14
+ export function flagValue(args, long, short) {
15
+ for (let i = 0; i < args.length; i++) {
16
+ const a = args[i];
17
+ if (a === `--${long}` || (short && a === `-${short}`))
18
+ return args[i + 1];
19
+ if (a.startsWith(`--${long}=`))
20
+ return a.slice(long.length + 3);
21
+ if (short && a.startsWith(`-${short}=`))
22
+ return a.slice(short.length + 2);
23
+ if (short && new RegExp(`^-${short}(.+)`).test(a))
24
+ return a.slice(2);
25
+ }
26
+ return undefined;
27
+ }
28
+ /**
29
+ * True when argv carries any host/device routing flag that {@link maybeRunOnHost}
30
+ * inspects: `--host`/`-H`, `--device`, `--hosts`, `--devices` (space, `=`, or
31
+ * glued short form).
32
+ *
33
+ * Presence-only — does not validate values. Used by bootstrap before loading
34
+ * passthrough, and by `maybeRunStandaloneOnHost` before strip/route work.
35
+ */
36
+ export function hasHostRoutingFlag(args) {
37
+ return (flagValue(args, 'host', 'H') !== undefined ||
38
+ flagValue(args, 'device') !== undefined ||
39
+ flagValue(args, 'hosts') !== undefined ||
40
+ flagValue(args, 'devices') !== undefined);
41
+ }
@@ -50,7 +50,7 @@ export async function resolveHostRunTarget(name, opts = {}) {
50
50
  }
51
51
  }
52
52
  if (!host)
53
- throw new HostResolutionError(`Unknown host "${name}". List hosts: agents hosts list`);
53
+ throw new HostResolutionError(`Unknown host "${name}". List devices: agents devices list`);
54
54
  return host;
55
55
  }
56
56
  /** Resolve the id the remote host will adopt for a fresh Claude session. */
@@ -46,7 +46,7 @@ export function hostSessionMeta(task, ctx) {
46
46
  machine: normalizeHost(task.host),
47
47
  topic: ctx.prompt.split('\n')[0]?.slice(0, 120) || undefined,
48
48
  // The run's `--name` seeds the label (resolves `agents sessions <name>` and
49
- // `agents hosts logs <name>`); an unnamed host run falls back to the
49
+ // `agents logs <name>`); an unnamed host run falls back to the
50
50
  // `[host/<name>]` indicator, mirroring the cloud path's `[cloud/<status>]`.
51
51
  label: task.name || `[host/${task.host}]`,
52
52
  };
@@ -2,7 +2,7 @@
2
2
  * Local record of dispatched host tasks.
3
3
  *
4
4
  * Each dispatch writes a `<id>.json` sidecar next to its `<id>.log` (and the
5
- * remote's `<id>.exit`) under ~/.agents/.cache/hosts/, so `agents hosts ps/logs`
5
+ * remote's `<id>.exit`) under ~/.agents/.cache/hosts/, so `agents devices ps` / `agents logs`
6
6
  * can list runs and follow output across CLI invocations. (Folding these into
7
7
  * the cloud SQLite store so `agents cloud ps` sees them is a fast-follow — it
8
8
  * needs care around the cloud status-refresh path.)
@@ -20,8 +20,8 @@ export interface HostTask {
20
20
  pid?: number;
21
21
  /**
22
22
  * The durable `agents run --name <slug>` handle for this dispatch, if given.
23
- * Chosen at launch and agent-agnostic (unlike sessionId), so `agents hosts
24
- * ps/logs <name>` and the dispatch tip can reference the run by a stable name
23
+ * Chosen at launch and agent-agnostic (unlike sessionId), so `agents devices
24
+ * ps` / `agents logs <name>` and the dispatch tip can reference the run by a stable name
25
25
  * even for agents that never expose a session id up front. Absent when the
26
26
  * run was launched without `--name`.
27
27
  */
@@ -68,14 +68,14 @@ export declare function listTasks(): HostTask[];
68
68
  */
69
69
  export declare function findTaskBySessionId(sessionId: string): HostTask | null;
70
70
  /**
71
- * Find the newest host task launched with `--name <name>`, so `agents hosts
72
- * logs/ps <name>` and resolve-by-handle can address a run by its durable name.
71
+ * Find the newest host task launched with `--name <name>`, so `agents logs
72
+ * <name>` / `agents devices ps` and resolve-by-handle can address a run by its durable name.
73
73
  * Case-insensitive; newest wins (listTasks is createdAt-desc) when a name was
74
74
  * reused across dispatches.
75
75
  */
76
76
  export declare function findTaskByName(name: string): HostTask | null;
77
77
  /**
78
- * Resolve a host-task reference the way `agents hosts ps/logs/stop` do: a raw
78
+ * Resolve a host-task reference the way `agents devices ps`, `agents logs`, and `agents devices stop` do: a raw
79
79
  * dispatch id first, then a `--name` handle, then the remote agent/session id.
80
80
  * Shared so any other caller resolving "does this ref name a detached --device
81
81
  * dispatch?" (e.g. `agents message`) uses the identical three-way lookup.
@@ -2,7 +2,7 @@
2
2
  * Local record of dispatched host tasks.
3
3
  *
4
4
  * Each dispatch writes a `<id>.json` sidecar next to its `<id>.log` (and the
5
- * remote's `<id>.exit`) under ~/.agents/.cache/hosts/, so `agents hosts ps/logs`
5
+ * remote's `<id>.exit`) under ~/.agents/.cache/hosts/, so `agents devices ps` / `agents logs`
6
6
  * can list runs and follow output across CLI invocations. (Folding these into
7
7
  * the cloud SQLite store so `agents cloud ps` sees them is a fast-follow — it
8
8
  * needs care around the cloud status-refresh path.)
@@ -86,8 +86,8 @@ export function findTaskBySessionId(sessionId) {
86
86
  return null;
87
87
  }
88
88
  /**
89
- * Find the newest host task launched with `--name <name>`, so `agents hosts
90
- * logs/ps <name>` and resolve-by-handle can address a run by its durable name.
89
+ * Find the newest host task launched with `--name <name>`, so `agents logs
90
+ * <name>` / `agents devices ps` and resolve-by-handle can address a run by its durable name.
91
91
  * Case-insensitive; newest wins (listTasks is createdAt-desc) when a name was
92
92
  * reused across dispatches.
93
93
  */
@@ -102,7 +102,7 @@ export function findTaskByName(name) {
102
102
  return null;
103
103
  }
104
104
  /**
105
- * Resolve a host-task reference the way `agents hosts ps/logs/stop` do: a raw
105
+ * Resolve a host-task reference the way `agents devices ps`, `agents logs`, and `agents devices stop` do: a raw
106
106
  * dispatch id first, then a `--name` handle, then the remote agent/session id.
107
107
  * Shared so any other caller resolving "does this ref name a detached --device
108
108
  * dispatch?" (e.g. `agents message`) uses the identical three-way lookup.
@@ -20,8 +20,7 @@ export class DeviceOffloadUnsupportedError extends Error {
20
20
  constructor(name) {
21
21
  super(`Device "${name}" uses password auth, which --host offload can't use yet ` +
22
22
  `(runs go over ssh with BatchMode=yes). Switch it to key auth with ` +
23
- `\`agents devices set ${name} --auth key\`, or enroll it as a host with ` +
24
- `\`agents hosts add ${name}\`.`);
23
+ `\`agents devices config ${name} ssh.auth key\`.`);
25
24
  this.name = 'DeviceOffloadUnsupportedError';
26
25
  }
27
26
  }
@@ -1,4 +1,3 @@
1
- import { resolveAccountLabel } from '../account-labels.js';
2
1
  import { AGENTS } from '../agents.js';
3
2
  import { getGlobalDefault } from '../versions.js';
4
3
  import { listInstallations } from './store.js';
@@ -37,7 +36,7 @@ export class InstallationAmbiguousError extends Error {
37
36
  constructor(agent, selector, candidates) {
38
37
  super(`'${selector ?? agent}' matches ${candidates.length} ${AGENTS[agent].name} installations `
39
38
  + `(${candidates.map((i) => describeInstallation(i)).join(', ')}). `
40
- + `Name one by its installation label, or disambiguate with --account <label>.`);
39
+ + `Select one by its installation label.`);
41
40
  this.agent = agent;
42
41
  this.selector = selector;
43
42
  this.candidates = candidates;
@@ -63,12 +62,7 @@ export async function resolveInstallation(agent, selector, options = {}) {
63
62
  throw new InstallationNotFoundError(agent, selector, all);
64
63
  let candidates = all;
65
64
  if (options.account) {
66
- // resolveAccountLabel answers with the version-dir label of the install that
67
- // is signed into that account — i.e. an installation label.
68
- const label = await resolveAccountLabel(agent, options.account);
69
- candidates = candidates.filter((i) => i.label === label);
70
- if (candidates.length === 0)
71
- throw new InstallationNotFoundError(agent, selector, all);
65
+ throw new Error("--account no longer selects an installation. Account names are durable credentials used by 'agents run --account'; select the installation by its label instead.");
72
66
  }
73
67
  if (selector) {
74
68
  const byLabel = candidates.filter((i) => i.label === selector);
@@ -14,7 +14,6 @@ export function explainIsolationBoundary(err) {
14
14
  console.error(chalk.gray('\n To keep the sandbox and act inside it:'));
15
15
  console.error(chalk.gray(` agents add ${err.agent}@<version> --isolated # another isolated copy`));
16
16
  console.error(chalk.gray(` agents use ${err.agent}@<version> # pick which one 'agents run ${err.agent}' uses`));
17
- console.error(chalk.gray(` agents export ${err.agent} # copy its config out to your real config dir`));
18
17
  console.error(chalk.gray('\n To manage this agent normally instead, remove the isolated copies first:'));
19
18
  for (const v of versions) {
20
19
  console.error(chalk.gray(` agents remove ${err.agent}@${v} --isolated`));
@@ -34,6 +34,13 @@
34
34
  */
35
35
  /** Matches `SKILL_INDEX_TTL_MS` (`lib/registry.ts`) — the repo's TTL convention. */
36
36
  export declare const LINEAR_CACHE_TTL_MS: number;
37
+ /**
38
+ * Resolve the Linear API key from the `LINEAR_API_KEY` env var, falling back to
39
+ * the macOS keychain generic-password `linear-api-key` (how the rest of the
40
+ * stack stores it). Null if none is resolvable. The shared resolver for every
41
+ * Linear-touching surface (project counts, session discovery).
42
+ */
43
+ export declare function resolveLinearApiKey(): string | null;
37
44
  /** What a lookup found, and how much to trust it. */
38
45
  export interface CacheHit<T> {
39
46
  value: T;
@@ -32,19 +32,46 @@
32
32
  * populated chip to empty — and it is the fix for the card silently losing its
33
33
  * Linear line mid-session when the request budget ran out.
34
34
  */
35
+ import { execFileSync } from 'child_process';
35
36
  import * as fs from 'fs';
36
37
  import * as path from 'path';
37
38
  import { getCacheDir } from './state.js';
38
39
  /** Matches `SKILL_INDEX_TTL_MS` (`lib/registry.ts`) — the repo's TTL convention. */
39
40
  export const LINEAR_CACHE_TTL_MS = 10 * 60_000;
41
+ /**
42
+ * Resolve the Linear API key from the `LINEAR_API_KEY` env var, falling back to
43
+ * the macOS keychain generic-password `linear-api-key` (how the rest of the
44
+ * stack stores it). Null if none is resolvable. The shared resolver for every
45
+ * Linear-touching surface (project counts, session discovery).
46
+ */
47
+ export function resolveLinearApiKey() {
48
+ const fromEnv = process.env.LINEAR_API_KEY?.trim();
49
+ if (fromEnv)
50
+ return fromEnv;
51
+ if (process.platform === 'darwin') {
52
+ try {
53
+ const out = execFileSync('security', ['find-generic-password', '-s', 'linear-api-key', '-w'], {
54
+ encoding: 'utf-8',
55
+ stdio: ['ignore', 'pipe', 'ignore'],
56
+ });
57
+ const key = out.trim();
58
+ if (key)
59
+ return key;
60
+ }
61
+ catch {
62
+ // not in keychain — fall through
63
+ }
64
+ }
65
+ return null;
66
+ }
40
67
  const CACHE_SUBDIR = 'linear-projects';
41
68
  /** Sits beside the per-project files; its own file, so it cannot be clobbered by them. */
42
69
  const RATE_LIMIT_FILE = 'rate-limit.json';
43
70
  /**
44
- * Where the snapshot lives. `AGENTS_LINEAR_CACHE_PATH` overrides the directory,
45
- * mirroring `AGENTS_FACTORY_PROJECTS_PATH` (`auto-dispatch.ts`) `getCacheDir()`
46
- * resolves `HOME` once at module load, so a test that swaps `process.env.HOME`
47
- * afterwards would otherwise read and WRITE the developer's real cache.
71
+ * Where the snapshot lives. `AGENTS_LINEAR_CACHE_PATH` overrides the directory.
72
+ * `getCacheDir()` resolves `HOME` once at module load, so a test that swaps
73
+ * `process.env.HOME` afterwards would otherwise read and WRITE the developer's
74
+ * real cache.
48
75
  */
49
76
  function cacheDir() {
50
77
  return process.env.AGENTS_LINEAR_CACHE_PATH ?? path.join(getCacheDir(), CACHE_SUBDIR);
@@ -5,7 +5,7 @@
5
5
  * `agents projects link <name> --linear`), the card shows one outcome line —
6
6
  * `12/30 done · 5 in progress` — counted from the Linear GraphQL API by state
7
7
  * TYPE (triage / backlog / unstarted / started / completed / canceled), never
8
- * hardcoded state names, same convention as `auto-dispatch-linear.ts`.
8
+ * hardcoded state names.
9
9
  *
10
10
  * The same fetch also yields the **next milestone** — the earliest-dated
11
11
  * milestone with unfinished issues — because each issue node carries its
@@ -5,7 +5,7 @@
5
5
  * `agents projects link <name> --linear`), the card shows one outcome line —
6
6
  * `12/30 done · 5 in progress` — counted from the Linear GraphQL API by state
7
7
  * TYPE (triage / backlog / unstarted / started / completed / canceled), never
8
- * hardcoded state names, same convention as `auto-dispatch-linear.ts`.
8
+ * hardcoded state names.
9
9
  *
10
10
  * The same fetch also yields the **next milestone** — the earliest-dated
11
11
  * milestone with unfinished issues — because each issue node carries its
@@ -27,8 +27,7 @@
27
27
  import * as fs from 'fs';
28
28
  import * as os from 'os';
29
29
  import * as path from 'path';
30
- import { resolveLinearApiKey } from './auto-dispatch-linear.js';
31
- import { isRateLimited, noteRateLimited, parseRateLimitReset, readCached, writeCached } from './linear-cache.js';
30
+ import { isRateLimited, noteRateLimited, parseRateLimitReset, readCached, writeCached, resolveLinearApiKey } from './linear-cache.js';
32
31
  const LINEAR_API = 'https://api.linear.app/graphql';
33
32
  /** Overall budget across all pages — the card must never hang on Linear. */
34
33
  const TIMEOUT_MS = 8_000;
@@ -6,7 +6,7 @@
6
6
  // key so they compare equal, and matchLinearProject() binds a repo/folder to the
7
7
  // Linear project the user most likely means.
8
8
  //
9
- // Ported from apps/factory/src/core/linearProjects.ts (no cross-package imports —
9
+ // Ported from apps/ext/src/core/linearProjects.ts (no cross-package imports —
10
10
  // repo rule); keep the two in sync. The matcher half is PURE so it unit-tests
11
11
  // without a live `linear` binary; the `linear projects --json` shell-out lives at
12
12
  // the bottom (listLinearProjects) and fails LOUD — it's behind an explicit user
@@ -6,7 +6,7 @@
6
6
  * can spawn subagents freely). Every guard — `max_iterations`, `budget`, the
7
7
  * `until: signal` condition, SIGINT/SIGTERM — lives OUTSIDE the agent, so the
8
8
  * agent cannot vote past a kill-switch (the standard answer to runaway-loop and
9
- * runaway-cost failure modes; see docs/07-entrypoints-and-loops.md).
9
+ * runaway-cost failure modes; see docs/entrypoints-and-loops.md).
10
10
  *
11
11
  * Structure mirrors the teams supervisor (`runSupervisor` in teams/supervisor.ts):
12
12
  * a bounded for-loop with a hard cap, a SIGINT/SIGTERM trap that flips a stop
@@ -21,7 +21,7 @@
21
21
  import type { AgentId } from './types.js';
22
22
  import type { ExecOptions } from './exec.js';
23
23
  import { type Checkpoint } from './checkpoint.js';
24
- /** Loop block config (docs/07-entrypoints-and-loops.md → "The loop block"). */
24
+ /** Loop block config (docs/entrypoints-and-loops.md → "The loop block"). */
25
25
  export interface LoopConfig {
26
26
  /** Stop condition. `signal` reads loop-signal.json; absence is fail-closed. */
27
27
  until?: 'signal';
package/dist/lib/loop.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * can spawn subagents freely). Every guard — `max_iterations`, `budget`, the
7
7
  * `until: signal` condition, SIGINT/SIGTERM — lives OUTSIDE the agent, so the
8
8
  * agent cannot vote past a kill-switch (the standard answer to runaway-loop and
9
- * runaway-cost failure modes; see docs/07-entrypoints-and-loops.md).
9
+ * runaway-cost failure modes; see docs/entrypoints-and-loops.md).
10
10
  *
11
11
  * Structure mirrors the teams supervisor (`runSupervisor` in teams/supervisor.ts):
12
12
  * a bounded for-loop with a hard cap, a SIGINT/SIGTERM trap that flips a stop
@@ -52,7 +52,7 @@ export type HostTaskRoute = {
52
52
  * local/cloud session (RUSH-2366 follow-up): `getActiveSessions()` has no
53
53
  * visibility into a detached `agents run --device <host> --no-follow`
54
54
  * dispatch, whose only local record is the `~/.agents/.cache/hosts/<id>.json`
55
- * sidecar `agents hosts ps` reads. Pure — the caller does the actual lookup
55
+ * sidecar `agents devices ps` reads. Pure — the caller does the actual lookup
56
56
  * (`resolveTaskRef`) and I/O (the ssh reroute).
57
57
  *
58
58
  * `remoteRef` prefers the remote agent's OWN identity (its captured session id