@phnx-labs/agents-cli 1.12.0 → 1.14.2

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 (496) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/README.md +308 -297
  3. package/dist/commands/alias.d.ts +11 -0
  4. package/dist/commands/alias.js +117 -0
  5. package/dist/commands/beta.d.ts +2 -0
  6. package/dist/commands/beta.js +53 -0
  7. package/dist/commands/cloud.d.ts +10 -0
  8. package/dist/commands/cloud.js +408 -0
  9. package/dist/commands/commands.d.ts +9 -1
  10. package/dist/commands/commands.js +24 -172
  11. package/dist/commands/daemon.d.ts +8 -1
  12. package/dist/commands/daemon.js +13 -5
  13. package/dist/commands/doctor.d.ts +15 -0
  14. package/dist/commands/doctor.js +132 -0
  15. package/dist/commands/drive.d.ts +8 -1
  16. package/dist/commands/drive.js +20 -3
  17. package/dist/commands/exec.d.ts +8 -1
  18. package/dist/commands/exec.js +207 -20
  19. package/dist/commands/factory.d.ts +19 -0
  20. package/dist/commands/factory.js +71 -0
  21. package/dist/commands/fork.d.ts +8 -1
  22. package/dist/commands/fork.js +11 -4
  23. package/dist/commands/hooks.d.ts +9 -1
  24. package/dist/commands/hooks.js +30 -182
  25. package/dist/commands/init.d.ts +15 -1
  26. package/dist/commands/init.js +168 -74
  27. package/dist/commands/mcp.d.ts +9 -1
  28. package/dist/commands/mcp.js +11 -7
  29. package/dist/commands/models.d.ts +8 -1
  30. package/dist/commands/models.js +45 -6
  31. package/dist/commands/packages.d.ts +8 -1
  32. package/dist/commands/packages.js +13 -7
  33. package/dist/commands/permissions.d.ts +9 -1
  34. package/dist/commands/permissions.js +3 -3
  35. package/dist/commands/plugins.d.ts +8 -1
  36. package/dist/commands/plugins.js +13 -2
  37. package/dist/commands/profiles.d.ts +11 -0
  38. package/dist/commands/profiles.js +291 -0
  39. package/dist/commands/prune.d.ts +22 -0
  40. package/dist/commands/prune.js +191 -0
  41. package/dist/commands/pty.d.ts +1 -1
  42. package/dist/commands/pty.js +2 -1
  43. package/dist/commands/pull.d.ts +8 -1
  44. package/dist/commands/pull.js +93 -129
  45. package/dist/commands/refresh-memory.d.ts +7 -1
  46. package/dist/commands/refresh-memory.js +7 -1
  47. package/dist/commands/repo.d.ts +15 -0
  48. package/dist/commands/repo.js +570 -0
  49. package/dist/commands/resource-view.d.ts +10 -3
  50. package/dist/commands/resource-view.js +18 -5
  51. package/dist/commands/routines.d.ts +8 -1
  52. package/dist/commands/routines.js +17 -4
  53. package/dist/commands/rules.d.ts +9 -1
  54. package/dist/commands/rules.js +16 -11
  55. package/dist/commands/secrets.d.ts +10 -0
  56. package/dist/commands/secrets.js +518 -0
  57. package/dist/commands/sessions-picker.d.ts +2 -1
  58. package/dist/commands/sessions-picker.js +88 -11
  59. package/dist/commands/sessions-tail.d.ts +19 -0
  60. package/dist/commands/sessions-tail.js +235 -0
  61. package/dist/commands/sessions.d.ts +2 -1
  62. package/dist/commands/sessions.js +288 -7
  63. package/dist/commands/skills.d.ts +9 -1
  64. package/dist/commands/skills.js +28 -178
  65. package/dist/commands/status.d.ts +7 -1
  66. package/dist/commands/status.js +7 -1
  67. package/dist/commands/subagents.d.ts +8 -1
  68. package/dist/commands/subagents.js +11 -1
  69. package/dist/commands/sync.d.ts +8 -1
  70. package/dist/commands/sync.js +8 -1
  71. package/dist/commands/teams-picker.d.ts +4 -1
  72. package/dist/commands/teams-picker.js +55 -3
  73. package/dist/commands/teams.d.ts +15 -1
  74. package/dist/commands/teams.js +323 -69
  75. package/dist/commands/usage.d.ts +11 -0
  76. package/dist/commands/usage.js +60 -0
  77. package/dist/commands/utils.d.ts +6 -1
  78. package/dist/commands/utils.js +6 -1
  79. package/dist/commands/versions.d.ts +8 -1
  80. package/dist/commands/versions.js +4 -3
  81. package/dist/commands/view.d.ts +47 -2
  82. package/dist/commands/view.js +353 -20
  83. package/dist/index.d.ts +7 -2
  84. package/dist/index.js +205 -38
  85. package/dist/lib/acp/client.d.ts +31 -0
  86. package/dist/lib/acp/client.js +117 -0
  87. package/dist/lib/acp/harnesses.d.ts +26 -0
  88. package/dist/lib/acp/harnesses.js +65 -0
  89. package/dist/lib/acp/run.d.ts +18 -0
  90. package/dist/lib/acp/run.js +39 -0
  91. package/dist/lib/agents.d.ts +74 -2
  92. package/dist/lib/agents.js +207 -23
  93. package/dist/lib/artifact-actions.d.ts +8 -4
  94. package/dist/lib/artifact-actions.js +8 -6
  95. package/dist/lib/auto-pull-worker.d.ts +11 -0
  96. package/dist/lib/auto-pull-worker.js +121 -0
  97. package/dist/lib/auto-pull.d.ts +31 -0
  98. package/dist/lib/auto-pull.js +97 -0
  99. package/dist/lib/beta.d.ts +23 -0
  100. package/dist/lib/beta.js +90 -0
  101. package/dist/lib/capabilities.d.ts +29 -0
  102. package/dist/lib/capabilities.js +74 -0
  103. package/dist/lib/cloud/codex.d.ts +25 -0
  104. package/dist/lib/cloud/codex.js +250 -0
  105. package/dist/lib/cloud/factory.d.ts +31 -0
  106. package/dist/lib/cloud/factory.js +53 -0
  107. package/dist/lib/cloud/registry.d.ts +15 -0
  108. package/dist/lib/cloud/registry.js +67 -0
  109. package/dist/lib/cloud/rush.d.ts +75 -0
  110. package/dist/lib/cloud/rush.js +438 -0
  111. package/dist/lib/cloud/store.d.ts +22 -0
  112. package/dist/lib/cloud/store.js +115 -0
  113. package/dist/lib/cloud/stream.d.ts +23 -0
  114. package/dist/lib/cloud/stream.js +194 -0
  115. package/dist/lib/cloud/types.d.ts +205 -0
  116. package/dist/lib/cloud/types.js +34 -0
  117. package/dist/lib/command-skills.d.ts +20 -0
  118. package/dist/lib/command-skills.js +142 -0
  119. package/dist/lib/commands.d.ts +22 -2
  120. package/dist/lib/commands.js +51 -11
  121. package/dist/lib/convert.d.ts +10 -1
  122. package/dist/lib/convert.js +9 -1
  123. package/dist/lib/daemon.d.ts +21 -1
  124. package/dist/lib/daemon.js +97 -4
  125. package/dist/lib/drive-sync.d.ts +18 -1
  126. package/dist/lib/drive-sync.js +57 -15
  127. package/dist/lib/exec.d.ts +25 -5
  128. package/dist/lib/exec.js +72 -27
  129. package/dist/lib/fs-walk.d.ts +2 -0
  130. package/dist/lib/fs-walk.js +40 -0
  131. package/dist/lib/fuzzy.d.ts +53 -0
  132. package/dist/lib/fuzzy.js +72 -0
  133. package/dist/lib/gemini-settings.d.ts +4 -0
  134. package/dist/lib/gemini-settings.js +33 -0
  135. package/dist/lib/git.d.ts +12 -2
  136. package/dist/lib/git.js +17 -6
  137. package/dist/lib/help.d.ts +20 -1
  138. package/dist/lib/help.js +45 -6
  139. package/dist/lib/hooks/match.d.ts +32 -0
  140. package/dist/lib/hooks/match.js +120 -0
  141. package/dist/lib/hooks.d.ts +17 -4
  142. package/dist/lib/hooks.js +191 -21
  143. package/dist/lib/manifest.d.ts +6 -1
  144. package/dist/lib/manifest.js +15 -4
  145. package/dist/lib/markdown.d.ts +0 -1
  146. package/dist/lib/markdown.js +6 -1
  147. package/dist/lib/mcp.d.ts +0 -1
  148. package/dist/lib/mcp.js +29 -33
  149. package/dist/lib/memory-compile.d.ts +13 -3
  150. package/dist/lib/memory-compile.js +31 -9
  151. package/dist/lib/memory.d.ts +14 -7
  152. package/dist/lib/memory.js +67 -38
  153. package/dist/lib/migrate.d.ts +8 -0
  154. package/dist/lib/migrate.js +85 -0
  155. package/dist/lib/models.d.ts +25 -11
  156. package/dist/lib/models.js +405 -16
  157. package/dist/lib/onepassword.d.ts +63 -0
  158. package/dist/lib/onepassword.js +186 -0
  159. package/dist/lib/paths.d.ts +8 -0
  160. package/dist/lib/paths.js +20 -0
  161. package/dist/lib/permissions.d.ts +24 -2
  162. package/dist/lib/permissions.js +117 -48
  163. package/dist/lib/picker.d.ts +10 -1
  164. package/dist/lib/picker.js +15 -1
  165. package/dist/lib/plugins.d.ts +7 -1
  166. package/dist/lib/plugins.js +10 -1
  167. package/dist/lib/profiles-presets.d.ts +24 -0
  168. package/dist/lib/profiles-presets.js +103 -0
  169. package/dist/lib/profiles.d.ts +69 -0
  170. package/dist/lib/profiles.js +144 -0
  171. package/dist/lib/pty-client.d.ts +1 -1
  172. package/dist/lib/pty-client.js +0 -1
  173. package/dist/lib/pty-server.d.ts +16 -2
  174. package/dist/lib/pty-server.js +92 -3
  175. package/dist/lib/registry.d.ts +23 -3
  176. package/dist/lib/registry.js +153 -8
  177. package/dist/lib/resources.d.ts +28 -1
  178. package/dist/lib/resources.js +79 -1
  179. package/dist/lib/rotate.d.ts +89 -0
  180. package/dist/lib/rotate.js +327 -0
  181. package/dist/lib/routines.d.ts +29 -1
  182. package/dist/lib/routines.js +32 -5
  183. package/dist/lib/runner.d.ts +14 -1
  184. package/dist/lib/runner.js +22 -3
  185. package/dist/lib/sandbox.d.ts +16 -1
  186. package/dist/lib/sandbox.js +39 -16
  187. package/dist/lib/scheduler.d.ts +8 -1
  188. package/dist/lib/scheduler.js +8 -1
  189. package/dist/lib/secrets/AgentsKeychain.app/Contents/CodeResources +0 -0
  190. package/dist/lib/secrets/AgentsKeychain.app/Contents/Info.plist +22 -0
  191. package/dist/lib/secrets/AgentsKeychain.app/Contents/MacOS/AgentsKeychain +0 -0
  192. package/dist/lib/secrets/AgentsKeychain.app/Contents/_CodeSignature/CodeResources +123 -0
  193. package/dist/lib/secrets/AgentsKeychain.app/Contents/embedded.provisionprofile +0 -0
  194. package/dist/lib/secrets/bundles.d.ts +39 -0
  195. package/dist/lib/secrets/bundles.js +189 -0
  196. package/dist/lib/secrets/index.d.ts +55 -0
  197. package/dist/lib/secrets/index.js +211 -0
  198. package/dist/lib/secrets/profiles.d.ts +10 -0
  199. package/dist/lib/secrets/profiles.js +13 -0
  200. package/dist/lib/session/active.d.ts +43 -0
  201. package/dist/lib/session/active.js +392 -0
  202. package/dist/lib/session/artifacts.d.ts +16 -0
  203. package/dist/lib/session/artifacts.js +95 -0
  204. package/dist/lib/session/cloud.d.ts +30 -0
  205. package/dist/lib/session/cloud.js +121 -0
  206. package/dist/lib/session/db.d.ts +23 -2
  207. package/dist/lib/session/db.js +76 -12
  208. package/dist/lib/session/discover.d.ts +19 -4
  209. package/dist/lib/session/discover.js +344 -48
  210. package/dist/lib/session/parse.d.ts +28 -1
  211. package/dist/lib/session/parse.js +267 -9
  212. package/dist/lib/session/prompt.d.ts +9 -1
  213. package/dist/lib/session/prompt.js +17 -3
  214. package/dist/lib/session/render.d.ts +13 -1
  215. package/dist/lib/session/render.js +20 -1
  216. package/dist/lib/session/team-filter.d.ts +9 -1
  217. package/dist/lib/session/team-filter.js +11 -2
  218. package/dist/lib/session/types.d.ts +24 -2
  219. package/dist/lib/session/types.js +10 -2
  220. package/dist/lib/shims.d.ts +93 -5
  221. package/dist/lib/shims.js +380 -67
  222. package/dist/lib/skills.d.ts +27 -2
  223. package/dist/lib/skills.js +127 -65
  224. package/dist/lib/sqlite.d.ts +43 -0
  225. package/dist/lib/sqlite.js +94 -0
  226. package/dist/lib/state.d.ts +114 -22
  227. package/dist/lib/state.js +323 -138
  228. package/dist/lib/subagents.d.ts +9 -1
  229. package/dist/lib/subagents.js +70 -63
  230. package/dist/lib/sync-manifest.d.ts +81 -0
  231. package/dist/lib/sync-manifest.js +450 -0
  232. package/dist/lib/teams/agents.d.ts +103 -5
  233. package/dist/lib/teams/agents.js +414 -91
  234. package/dist/lib/teams/api.d.ts +26 -3
  235. package/dist/lib/teams/api.js +63 -3
  236. package/dist/lib/teams/debug.d.ts +6 -1
  237. package/dist/lib/teams/debug.js +6 -1
  238. package/dist/lib/teams/file_ops.d.ts +7 -1
  239. package/dist/lib/teams/file_ops.js +7 -1
  240. package/dist/lib/teams/index.d.ts +15 -0
  241. package/dist/lib/teams/index.js +14 -0
  242. package/dist/lib/teams/parsers.d.ts +4 -1
  243. package/dist/lib/teams/parsers.js +11 -1
  244. package/dist/lib/teams/persistence.d.ts +15 -1
  245. package/dist/lib/teams/persistence.js +102 -20
  246. package/dist/lib/teams/registry.d.ts +12 -1
  247. package/dist/lib/teams/registry.js +116 -33
  248. package/dist/lib/teams/summarizer.d.ts +15 -1
  249. package/dist/lib/teams/summarizer.js +14 -1
  250. package/dist/lib/teams/supervisor.d.ts +48 -0
  251. package/dist/lib/teams/supervisor.js +73 -0
  252. package/dist/lib/template.d.ts +8 -6
  253. package/dist/lib/template.js +8 -6
  254. package/dist/lib/types.d.ts +147 -8
  255. package/dist/lib/types.js +26 -3
  256. package/dist/lib/usage.d.ts +48 -1
  257. package/dist/lib/usage.js +97 -16
  258. package/dist/lib/version-duplicates.d.ts +21 -0
  259. package/dist/lib/version-duplicates.js +90 -0
  260. package/dist/lib/versions.d.ts +39 -4
  261. package/dist/lib/versions.js +401 -111
  262. package/package.json +33 -18
  263. package/scripts/postinstall.js +126 -30
  264. package/dist/commands/__tests__/sessions.test.d.ts +0 -2
  265. package/dist/commands/__tests__/sessions.test.d.ts.map +0 -1
  266. package/dist/commands/__tests__/sessions.test.js +0 -636
  267. package/dist/commands/__tests__/sessions.test.js.map +0 -1
  268. package/dist/commands/commands.d.ts.map +0 -1
  269. package/dist/commands/commands.js.map +0 -1
  270. package/dist/commands/daemon.d.ts.map +0 -1
  271. package/dist/commands/daemon.js.map +0 -1
  272. package/dist/commands/drive.d.ts.map +0 -1
  273. package/dist/commands/drive.js.map +0 -1
  274. package/dist/commands/exec.d.ts.map +0 -1
  275. package/dist/commands/exec.js.map +0 -1
  276. package/dist/commands/fork.d.ts.map +0 -1
  277. package/dist/commands/fork.js.map +0 -1
  278. package/dist/commands/hooks.d.ts.map +0 -1
  279. package/dist/commands/hooks.js.map +0 -1
  280. package/dist/commands/init.d.ts.map +0 -1
  281. package/dist/commands/init.js.map +0 -1
  282. package/dist/commands/mcp.d.ts.map +0 -1
  283. package/dist/commands/mcp.js.map +0 -1
  284. package/dist/commands/models.d.ts.map +0 -1
  285. package/dist/commands/models.js.map +0 -1
  286. package/dist/commands/packages.d.ts.map +0 -1
  287. package/dist/commands/packages.js.map +0 -1
  288. package/dist/commands/permissions.d.ts.map +0 -1
  289. package/dist/commands/permissions.js.map +0 -1
  290. package/dist/commands/plugins.d.ts.map +0 -1
  291. package/dist/commands/plugins.js.map +0 -1
  292. package/dist/commands/pty.d.ts.map +0 -1
  293. package/dist/commands/pty.js.map +0 -1
  294. package/dist/commands/pull.d.ts.map +0 -1
  295. package/dist/commands/pull.js.map +0 -1
  296. package/dist/commands/push.d.ts +0 -3
  297. package/dist/commands/push.d.ts.map +0 -1
  298. package/dist/commands/push.js +0 -180
  299. package/dist/commands/push.js.map +0 -1
  300. package/dist/commands/refresh-memory.d.ts.map +0 -1
  301. package/dist/commands/refresh-memory.js.map +0 -1
  302. package/dist/commands/resource-view.d.ts.map +0 -1
  303. package/dist/commands/resource-view.js.map +0 -1
  304. package/dist/commands/routines.d.ts.map +0 -1
  305. package/dist/commands/routines.js.map +0 -1
  306. package/dist/commands/rules.d.ts.map +0 -1
  307. package/dist/commands/rules.js.map +0 -1
  308. package/dist/commands/sessions-picker.d.ts.map +0 -1
  309. package/dist/commands/sessions-picker.js.map +0 -1
  310. package/dist/commands/sessions.d.ts.map +0 -1
  311. package/dist/commands/sessions.js.map +0 -1
  312. package/dist/commands/skills.d.ts.map +0 -1
  313. package/dist/commands/skills.js.map +0 -1
  314. package/dist/commands/status.d.ts.map +0 -1
  315. package/dist/commands/status.js.map +0 -1
  316. package/dist/commands/subagents.d.ts.map +0 -1
  317. package/dist/commands/subagents.js.map +0 -1
  318. package/dist/commands/sync.d.ts.map +0 -1
  319. package/dist/commands/sync.js.map +0 -1
  320. package/dist/commands/teams-picker.d.ts.map +0 -1
  321. package/dist/commands/teams-picker.js.map +0 -1
  322. package/dist/commands/teams.d.ts.map +0 -1
  323. package/dist/commands/teams.js.map +0 -1
  324. package/dist/commands/utils.d.ts.map +0 -1
  325. package/dist/commands/utils.js.map +0 -1
  326. package/dist/commands/versions.d.ts.map +0 -1
  327. package/dist/commands/versions.js.map +0 -1
  328. package/dist/commands/view.d.ts.map +0 -1
  329. package/dist/commands/view.js.map +0 -1
  330. package/dist/index.d.ts.map +0 -1
  331. package/dist/index.js.map +0 -1
  332. package/dist/lib/__tests__/bugfixes.test.d.ts +0 -2
  333. package/dist/lib/__tests__/bugfixes.test.d.ts.map +0 -1
  334. package/dist/lib/__tests__/bugfixes.test.js +0 -192
  335. package/dist/lib/__tests__/bugfixes.test.js.map +0 -1
  336. package/dist/lib/__tests__/exec.test.d.ts +0 -2
  337. package/dist/lib/__tests__/exec.test.d.ts.map +0 -1
  338. package/dist/lib/__tests__/exec.test.js +0 -446
  339. package/dist/lib/__tests__/exec.test.js.map +0 -1
  340. package/dist/lib/__tests__/git-sync.test.d.ts +0 -2
  341. package/dist/lib/__tests__/git-sync.test.d.ts.map +0 -1
  342. package/dist/lib/__tests__/git-sync.test.js +0 -138
  343. package/dist/lib/__tests__/git-sync.test.js.map +0 -1
  344. package/dist/lib/__tests__/hooks.test.d.ts +0 -2
  345. package/dist/lib/__tests__/hooks.test.d.ts.map +0 -1
  346. package/dist/lib/__tests__/hooks.test.js +0 -203
  347. package/dist/lib/__tests__/hooks.test.js.map +0 -1
  348. package/dist/lib/__tests__/memory-compile.test.d.ts +0 -2
  349. package/dist/lib/__tests__/memory-compile.test.d.ts.map +0 -1
  350. package/dist/lib/__tests__/memory-compile.test.js +0 -95
  351. package/dist/lib/__tests__/memory-compile.test.js.map +0 -1
  352. package/dist/lib/__tests__/models.test.d.ts +0 -2
  353. package/dist/lib/__tests__/models.test.d.ts.map +0 -1
  354. package/dist/lib/__tests__/models.test.js +0 -184
  355. package/dist/lib/__tests__/models.test.js.map +0 -1
  356. package/dist/lib/__tests__/usage.test.d.ts +0 -2
  357. package/dist/lib/__tests__/usage.test.d.ts.map +0 -1
  358. package/dist/lib/__tests__/usage.test.js +0 -218
  359. package/dist/lib/__tests__/usage.test.js.map +0 -1
  360. package/dist/lib/agents.d.ts.map +0 -1
  361. package/dist/lib/agents.js.map +0 -1
  362. package/dist/lib/artifact-actions.d.ts.map +0 -1
  363. package/dist/lib/artifact-actions.js.map +0 -1
  364. package/dist/lib/commands.d.ts.map +0 -1
  365. package/dist/lib/commands.js.map +0 -1
  366. package/dist/lib/convert.d.ts.map +0 -1
  367. package/dist/lib/convert.js.map +0 -1
  368. package/dist/lib/daemon.d.ts.map +0 -1
  369. package/dist/lib/daemon.js.map +0 -1
  370. package/dist/lib/drive-sync.d.ts.map +0 -1
  371. package/dist/lib/drive-sync.js.map +0 -1
  372. package/dist/lib/exec.d.ts.map +0 -1
  373. package/dist/lib/exec.js.map +0 -1
  374. package/dist/lib/factory.d.ts +0 -57
  375. package/dist/lib/factory.d.ts.map +0 -1
  376. package/dist/lib/factory.js +0 -110
  377. package/dist/lib/factory.js.map +0 -1
  378. package/dist/lib/git.d.ts.map +0 -1
  379. package/dist/lib/git.js.map +0 -1
  380. package/dist/lib/help.d.ts.map +0 -1
  381. package/dist/lib/help.js.map +0 -1
  382. package/dist/lib/hooks.d.ts.map +0 -1
  383. package/dist/lib/hooks.js.map +0 -1
  384. package/dist/lib/manifest.d.ts.map +0 -1
  385. package/dist/lib/manifest.js.map +0 -1
  386. package/dist/lib/markdown.d.ts.map +0 -1
  387. package/dist/lib/markdown.js.map +0 -1
  388. package/dist/lib/mcp.d.ts.map +0 -1
  389. package/dist/lib/mcp.js.map +0 -1
  390. package/dist/lib/memory-compile.d.ts.map +0 -1
  391. package/dist/lib/memory-compile.js.map +0 -1
  392. package/dist/lib/memory.d.ts.map +0 -1
  393. package/dist/lib/memory.js.map +0 -1
  394. package/dist/lib/models.d.ts.map +0 -1
  395. package/dist/lib/models.js.map +0 -1
  396. package/dist/lib/permissions.d.ts.map +0 -1
  397. package/dist/lib/permissions.js.map +0 -1
  398. package/dist/lib/picker.d.ts.map +0 -1
  399. package/dist/lib/picker.js.map +0 -1
  400. package/dist/lib/plugins.d.ts.map +0 -1
  401. package/dist/lib/plugins.js.map +0 -1
  402. package/dist/lib/pty-client.d.ts.map +0 -1
  403. package/dist/lib/pty-client.js.map +0 -1
  404. package/dist/lib/pty-server.d.ts.map +0 -1
  405. package/dist/lib/pty-server.js.map +0 -1
  406. package/dist/lib/registry.d.ts.map +0 -1
  407. package/dist/lib/registry.js.map +0 -1
  408. package/dist/lib/resources.d.ts.map +0 -1
  409. package/dist/lib/resources.js.map +0 -1
  410. package/dist/lib/routines.d.ts.map +0 -1
  411. package/dist/lib/routines.js.map +0 -1
  412. package/dist/lib/runner.d.ts.map +0 -1
  413. package/dist/lib/runner.js.map +0 -1
  414. package/dist/lib/sandbox.d.ts.map +0 -1
  415. package/dist/lib/sandbox.js.map +0 -1
  416. package/dist/lib/scheduler.d.ts.map +0 -1
  417. package/dist/lib/scheduler.js.map +0 -1
  418. package/dist/lib/session/__tests__/db.test.d.ts +0 -2
  419. package/dist/lib/session/__tests__/db.test.d.ts.map +0 -1
  420. package/dist/lib/session/__tests__/db.test.js +0 -54
  421. package/dist/lib/session/__tests__/db.test.js.map +0 -1
  422. package/dist/lib/session/__tests__/discover.test.d.ts +0 -2
  423. package/dist/lib/session/__tests__/discover.test.d.ts.map +0 -1
  424. package/dist/lib/session/__tests__/discover.test.js +0 -63
  425. package/dist/lib/session/__tests__/discover.test.js.map +0 -1
  426. package/dist/lib/session/__tests__/prompt.test.d.ts +0 -2
  427. package/dist/lib/session/__tests__/prompt.test.d.ts.map +0 -1
  428. package/dist/lib/session/__tests__/prompt.test.js +0 -44
  429. package/dist/lib/session/__tests__/prompt.test.js.map +0 -1
  430. package/dist/lib/session/__tests__/render.test.d.ts +0 -2
  431. package/dist/lib/session/__tests__/render.test.d.ts.map +0 -1
  432. package/dist/lib/session/__tests__/render.test.js +0 -602
  433. package/dist/lib/session/__tests__/render.test.js.map +0 -1
  434. package/dist/lib/session/db.d.ts.map +0 -1
  435. package/dist/lib/session/db.js.map +0 -1
  436. package/dist/lib/session/discover.d.ts.map +0 -1
  437. package/dist/lib/session/discover.js.map +0 -1
  438. package/dist/lib/session/parse.d.ts.map +0 -1
  439. package/dist/lib/session/parse.js.map +0 -1
  440. package/dist/lib/session/prompt.d.ts.map +0 -1
  441. package/dist/lib/session/prompt.js.map +0 -1
  442. package/dist/lib/session/prompt.test.d.ts +0 -2
  443. package/dist/lib/session/prompt.test.d.ts.map +0 -1
  444. package/dist/lib/session/prompt.test.js +0 -57
  445. package/dist/lib/session/prompt.test.js.map +0 -1
  446. package/dist/lib/session/render.d.ts.map +0 -1
  447. package/dist/lib/session/render.js.map +0 -1
  448. package/dist/lib/session/team-filter.d.ts.map +0 -1
  449. package/dist/lib/session/team-filter.js.map +0 -1
  450. package/dist/lib/session/team-filter.test.d.ts +0 -2
  451. package/dist/lib/session/team-filter.test.d.ts.map +0 -1
  452. package/dist/lib/session/team-filter.test.js +0 -157
  453. package/dist/lib/session/team-filter.test.js.map +0 -1
  454. package/dist/lib/session/types.d.ts.map +0 -1
  455. package/dist/lib/session/types.js.map +0 -1
  456. package/dist/lib/shims.d.ts.map +0 -1
  457. package/dist/lib/shims.js.map +0 -1
  458. package/dist/lib/skills.d.ts.map +0 -1
  459. package/dist/lib/skills.js.map +0 -1
  460. package/dist/lib/state.d.ts.map +0 -1
  461. package/dist/lib/state.js.map +0 -1
  462. package/dist/lib/subagents.d.ts.map +0 -1
  463. package/dist/lib/subagents.js.map +0 -1
  464. package/dist/lib/teams/agents.d.ts.map +0 -1
  465. package/dist/lib/teams/agents.js.map +0 -1
  466. package/dist/lib/teams/api.d.ts.map +0 -1
  467. package/dist/lib/teams/api.js.map +0 -1
  468. package/dist/lib/teams/cloud.d.ts +0 -11
  469. package/dist/lib/teams/cloud.d.ts.map +0 -1
  470. package/dist/lib/teams/cloud.js +0 -169
  471. package/dist/lib/teams/cloud.js.map +0 -1
  472. package/dist/lib/teams/debug.d.ts.map +0 -1
  473. package/dist/lib/teams/debug.js.map +0 -1
  474. package/dist/lib/teams/file_ops.d.ts.map +0 -1
  475. package/dist/lib/teams/file_ops.js.map +0 -1
  476. package/dist/lib/teams/parsers.d.ts.map +0 -1
  477. package/dist/lib/teams/parsers.js.map +0 -1
  478. package/dist/lib/teams/persistence.d.ts.map +0 -1
  479. package/dist/lib/teams/persistence.js.map +0 -1
  480. package/dist/lib/teams/ralph.d.ts +0 -8
  481. package/dist/lib/teams/ralph.d.ts.map +0 -1
  482. package/dist/lib/teams/ralph.js +0 -59
  483. package/dist/lib/teams/ralph.js.map +0 -1
  484. package/dist/lib/teams/registry.d.ts.map +0 -1
  485. package/dist/lib/teams/registry.js.map +0 -1
  486. package/dist/lib/teams/summarizer.d.ts.map +0 -1
  487. package/dist/lib/teams/summarizer.js.map +0 -1
  488. package/dist/lib/template.d.ts.map +0 -1
  489. package/dist/lib/template.js.map +0 -1
  490. package/dist/lib/types.d.ts.map +0 -1
  491. package/dist/lib/types.js.map +0 -1
  492. package/dist/lib/usage.d.ts.map +0 -1
  493. package/dist/lib/usage.js.map +0 -1
  494. package/dist/lib/versions.d.ts.map +0 -1
  495. package/dist/lib/versions.js.map +0 -1
  496. package/scripts/rebuild-sqlite.sh +0 -46
@@ -1,10 +1,12 @@
1
1
  import chalk from 'chalk';
2
2
  import * as fs from 'fs/promises';
3
3
  import * as path from 'path';
4
- import { AgentManager, checkAllClis, getAgentsDir, } from '../lib/teams/agents.js';
4
+ import { AgentManager, checkAllClis, getAgentsDir, VALID_TASK_TYPES, } from '../lib/teams/agents.js';
5
+ import { resolveProvider } from '../lib/cloud/registry.js';
6
+ import { runSupervisor } from '../lib/teams/supervisor.js';
5
7
  import { handleSpawn, handleStatus, handleStop, handleTasks, } from '../lib/teams/api.js';
6
8
  import { createTeam, ensureTeam, loadTeams, removeTeam, teamExists, } from '../lib/teams/registry.js';
7
- import { isVersionInstalled } from '../lib/versions.js';
9
+ import { isVersionInstalled, resolveVersionAlias, resolveVersionAliasLoose } from '../lib/versions.js';
8
10
  import { discoverSessions, parseTimeFilter, resolveSessionById } from '../lib/session/discover.js';
9
11
  import { buildPreview as buildSessionPreview } from './sessions-picker.js';
10
12
  import { parseExecEnv } from '../lib/exec.js';
@@ -21,6 +23,7 @@ const AGENT_NAMES = {
21
23
  const VALID_AGENTS = Object.keys(AGENT_NAMES);
22
24
  const VALID_MODES = ['plan', 'edit', 'full'];
23
25
  const VALID_EFFORTS = ['low', 'medium', 'high', 'xhigh', 'max', 'auto'];
26
+ const VALID_CLOUD_PROVIDERS = ['rush', 'codex', 'factory'];
24
27
  // Auto-enable JSON mode when piped / not a TTY so AI agent consumers get
25
28
  // parseable output by default.
26
29
  function isJsonMode(opts) {
@@ -57,6 +60,25 @@ function truncate(s, n) {
57
60
  return s;
58
61
  return s.slice(0, n - 1) + '…';
59
62
  }
63
+ function compactPrompt(s, n = 160) {
64
+ return truncate(s.replace(/\s+/g, ' ').trim(), n);
65
+ }
66
+ function formatTimestamp(iso) {
67
+ if (!iso)
68
+ return null;
69
+ const d = new Date(iso);
70
+ if (Number.isNaN(d.getTime()))
71
+ return null;
72
+ return d.toLocaleString(undefined, {
73
+ month: 'short',
74
+ day: 'numeric',
75
+ hour: 'numeric',
76
+ minute: '2-digit',
77
+ });
78
+ }
79
+ function padRight(s, width) {
80
+ return s.length >= width ? s : s + ' '.repeat(width - s.length);
81
+ }
60
82
  function fullName(type, version) {
61
83
  const name = AGENT_NAMES[type];
62
84
  return version ? `${name} ${version}` : name;
@@ -67,15 +89,101 @@ function parseTeammate(spec) {
67
89
  die(`Unknown teammate '${name}'. Available: ${VALID_AGENTS.join(', ')}.\n` +
68
90
  ` Use the form 'claude' or 'claude@2.1.112' (see 'agents view' for installed versions).`);
69
91
  }
70
- return { agent: name, version: version || null };
92
+ const agent = name;
93
+ return { agent, version: resolveVersionAlias(agent, version) ?? null };
71
94
  }
72
95
  function shortId(id) {
73
96
  return id.slice(0, 8);
74
97
  }
75
- // Pick the display handle for a teammate: their given name if they have one,
76
- // otherwise the 8-char UUID prefix.
98
+ /**
99
+ * Preamble injected into every factory worker's prompt. Tells the worker
100
+ * which team + teammate name + task-type it is, and how to file new tasks.
101
+ * The actual how-to lives in the /factory-worker skill.
102
+ */
103
+ function factoryWorkerPreamble(team, name, taskType, after) {
104
+ const n = name ?? '<anonymous>';
105
+ const deps = after.length > 0 ? after.join(', ') : '(none)';
106
+ return [
107
+ `FACTORY WORKER — team="${team}", name="${n}", task_type="${taskType}", after=${deps}`,
108
+ `You are a teammate in a Software Factory. Read the /factory-worker skill for the full pattern.`,
109
+ `Key rules:`,
110
+ ` - Other teammates may be running now. Coordinate via git and tests only — no direct peer communication.`,
111
+ ` - If you discover work beyond your task, file a new teammate via Bash:`,
112
+ ` agents teams add "${team}" claude "<ask>" --name <slug> --task-type <implement|test|review|bugfix|docs> [--after <dep>]`,
113
+ ` A background supervisor picks up new tasks every wave.`,
114
+ ``,
115
+ `YOUR TASK:`,
116
+ ].join('\n');
117
+ }
118
+ function mkManager() {
119
+ return new AgentManager();
120
+ }
121
+ /**
122
+ * Register the generic cloud dispatcher — staged cloud teammates get
123
+ * dispatched when their --after deps resolve, using repo/branch stored on
124
+ * the teammate itself so we don't need the original --cloud CLI args.
125
+ */
126
+ export function wireCloudDispatcher(mgr) {
127
+ mgr.setCloudDispatcher(async (a) => {
128
+ if (!a.cloudProvider) {
129
+ throw new Error(`Teammate ${a.agentId} has no cloud provider set`);
130
+ }
131
+ const prov = resolveProvider(a.cloudProvider);
132
+ const dispatchOpts = {
133
+ prompt: a.prompt,
134
+ agent: a.agentType,
135
+ repo: a.cloudRepo ?? undefined,
136
+ branch: a.cloudBranch ?? undefined,
137
+ model: a.model ?? undefined,
138
+ };
139
+ const cloudTask = await prov.dispatch(dispatchOpts);
140
+ return { cloudSessionId: cloudTask.id };
141
+ });
142
+ }
143
+ /** Single-wave start used by `teams start` without --watch. */
144
+ async function runOneWave(mgr, team, json) {
145
+ const launched = await mgr.startReady(team);
146
+ const all = await mgr.listByTask(team);
147
+ const stillPending = all.filter((a) => a.status === 'pending');
148
+ if (json) {
149
+ console.log(JSON.stringify({
150
+ team,
151
+ launched: launched.map((a) => ({ agent_id: a.agentId, name: a.name, after: a.after })),
152
+ still_pending: stillPending.map((a) => ({ agent_id: a.agentId, name: a.name, after: a.after })),
153
+ }, null, 2));
154
+ return;
155
+ }
156
+ if (launched.length === 0 && stillPending.length === 0) {
157
+ console.log(chalk.gray(`No pending teammates in team ${team}.`));
158
+ return;
159
+ }
160
+ if (launched.length > 0) {
161
+ console.log(chalk.green(`Launched ${launched.length} teammate(s) in team ${chalk.cyan(team)}:`));
162
+ for (const a of launched) {
163
+ const who = fullName(a.agentType, a.version);
164
+ const h = a.name || shortId(a.agentId);
165
+ console.log(` ${chalk.cyan(h)} ${who}`);
166
+ }
167
+ }
168
+ if (stillPending.length > 0) {
169
+ console.log();
170
+ console.log(chalk.gray(`Still pending (${stillPending.length}):`));
171
+ for (const a of stillPending) {
172
+ const h = a.name || shortId(a.agentId);
173
+ console.log(` ${chalk.blue(h)} ${chalk.gray('after')} ${a.after.join(', ')}`);
174
+ }
175
+ }
176
+ }
177
+ // Pick the display handle for a teammate: explicit teammate name, Claude
178
+ // session label, then the 8-char UUID prefix.
77
179
  function handle(a) {
78
- return a.name || shortId(a.agent_id);
180
+ return a.name || a.session_label || shortId(a.agent_id);
181
+ }
182
+ function displayHandle(a) {
183
+ if (a.name && a.session_label && a.name !== a.session_label) {
184
+ return `${a.name} / ${a.session_label}`;
185
+ }
186
+ return handle(a);
79
187
  }
80
188
  // Resolve a teammate reference (name / UUID / UUID prefix) by scanning every
81
189
  // meta.json under the agents dir. Team hint narrows the search.
@@ -138,10 +246,26 @@ async function resolveTeammateAcrossTeams(base, ref, teamHint) {
138
246
  function printAgentDetail(a, session) {
139
247
  const label = statusColor(a.status)(a.status.toUpperCase());
140
248
  const who = fullName(a.agent_type, a.version);
141
- const h = handle(a);
249
+ const h = displayHandle(a);
142
250
  const secondary = a.name ? chalk.gray(`(${shortId(a.agent_id)})`) : '';
143
251
  const duration = a.duration ? `${chalk.gray(' · ')}${chalk.white(a.duration)}` : '';
144
252
  console.log(` ${chalk.cyan(h.padEnd(10))} ${secondary.padEnd(11)} ${who.padEnd(18)} ${label}${duration}`);
253
+ if (a.task_type) {
254
+ console.log(` ${chalk.gray('type ')} ${chalk.magenta(a.task_type)}`);
255
+ }
256
+ if (a.prompt) {
257
+ console.log(` ${chalk.gray('task ')} ${chalk.white(compactPrompt(a.prompt))}`);
258
+ }
259
+ const started = formatTimestamp(a.started_at);
260
+ const completed = formatTimestamp(a.completed_at);
261
+ if (started || completed) {
262
+ const parts = [];
263
+ if (started)
264
+ parts.push(`started ${started}`);
265
+ if (completed)
266
+ parts.push(`ended ${completed}`);
267
+ console.log(` ${chalk.gray('time ')} ${parts.join(chalk.gray(' · '))}`);
268
+ }
145
269
  if (a.after && a.after.length) {
146
270
  console.log(` ${chalk.gray('after ')} ${a.after.join(', ')}`);
147
271
  }
@@ -181,6 +305,13 @@ function printAgentDetail(a, session) {
181
305
  console.log(` ${chalk.gray('> ' + truncate(firstLine, 96))}`);
182
306
  }
183
307
  }
308
+ if (a.recent_tool_calls.length) {
309
+ console.log(` ${chalk.gray('tools ')}`);
310
+ for (const call of a.recent_tool_calls.slice(-5)) {
311
+ const when = call.timestamp ? `${relTime(call.timestamp)} ` : '';
312
+ console.log(` ${chalk.gray(when)}${chalk.bold(call.tool)} ${chalk.gray(truncate(call.summary, 96))}`);
313
+ }
314
+ }
184
315
  if (a.has_errors)
185
316
  console.log(` ${chalk.red('! reported an error')}`);
186
317
  if (a.pr_url)
@@ -377,6 +508,7 @@ async function pickTeamOr(mgr, command) {
377
508
  throw err;
378
509
  }
379
510
  }
511
+ /** Register the `agents teams` command tree (list, create, add, status, start, remove, disband, logs, doctor). */
380
512
  export function registerTeamsCommands(program) {
381
513
  const teams = program
382
514
  .command('teams')
@@ -389,27 +521,32 @@ create DAG-style dependencies (one teammate waits for another to finish first).
389
521
  Teammate sessions appear in 'agents sessions --teams' with a [team/name · mode] tag.
390
522
 
391
523
  Examples:
392
- # Start a new team for a feature
393
- agents teams create auth-feature
524
+ # Spin up a team to ship the new pricing page end-to-end
525
+ agents teams create pricing-page
526
+
527
+ # Backend first: Claude rewrites the billing endpoint
528
+ agents teams add pricing-page claude "Rewrite /v2/pricing to return tiered plans from billing.plans table" --name backend
394
529
 
395
- # Add Alice (Claude) to work on the backend
396
- agents teams add auth-feature claude "Add JWT auth middleware" --name alice
530
+ # Frontend can start in parallel it stubs the API while backend lands
531
+ agents teams add pricing-page codex "Build the new /pricing route in apps/web with the three-tier layout" --name frontend
397
532
 
398
- # Add Bob (Codex 0.116.0) to write tests, but wait for Alice to finish first
399
- agents teams add auth-feature codex@0.116.0 "Write integration tests" --name bob --after alice
533
+ # QA waits for both to finish before running e2e
534
+ agents teams add pricing-page claude "Run the full Playwright suite, fix any flakes, paste failing screenshots" --name qa --after backend,frontend
400
535
 
401
- # Kick off any staged teammates whose dependencies are satisfied
402
- agents teams start auth-feature
536
+ # Drain the DAG: backend + frontend launch now, qa picks up when they're done
537
+ agents teams start pricing-page --watch
403
538
 
404
- # Check in on progress (delta polling with --since for efficiency)
405
- agents teams status auth-feature
406
- agents teams status auth-feature --since 2026-04-19T10:30:00Z
539
+ # Check in without re-reading everything (delta poll)
540
+ agents teams status pricing-page --since 2026-04-24T09:00:00-07:00
407
541
 
408
- # Let Alice go when she's done
409
- agents teams remove auth-feature alice
542
+ # Pull the live log of one teammate
543
+ agents teams logs frontend
410
544
 
411
- # Wind down the whole team when work is complete
412
- agents teams disband auth-feature
545
+ # A teammate is stuck pull them out, the rest keeps going
546
+ agents teams remove pricing-page frontend
547
+
548
+ # Ship done — wind everyone down
549
+ agents teams disband pricing-page
413
550
 
414
551
  Short aliases:
415
552
  teams c = create teams a = add teams s = status
@@ -433,7 +570,7 @@ Name teammates with --name alice to refer to them as 'alice' instead of a UUID.
433
570
  .option('-n, --limit <n>', 'Show at most this many teams (default: 20)', '20')
434
571
  .option('--json', 'Output machine-readable JSON instead of formatted table')
435
572
  .action(async (query, opts) => {
436
- const mgr = new AgentManager();
573
+ const mgr = mkManager();
437
574
  const limit = Math.max(1, parseInt(opts.limit, 10) || 20);
438
575
  const [tasks, registry, everyAgent] = await Promise.all([
439
576
  handleTasks(mgr, 1000),
@@ -455,7 +592,10 @@ Name teammates with --name alice to refer to them as 'alice' instead of a UUID.
455
592
  }
456
593
  // --- --agent: filter teams containing a matching teammate ---
457
594
  if (opts.agent) {
458
- const [wantType, wantVersion] = opts.agent.split('@');
595
+ const [wantType, rawVersion] = opts.agent.split('@');
596
+ const wantVersion = VALID_AGENTS.includes(wantType)
597
+ ? resolveVersionAliasLoose(wantType, rawVersion)
598
+ : rawVersion;
459
599
  merged = merged.filter((t) => {
460
600
  const teammates = byTeam.get(t.task_name) || [];
461
601
  return teammates.some((m) => m.agent_type === wantType && (!wantVersion || m.version === wantVersion));
@@ -567,6 +707,10 @@ Name teammates with --name alice to refer to them as 'alice' instead of a UUID.
567
707
  .option('--env <key=value>', 'Set an environment variable for this teammate (repeatable for multiple vars)', (val, prev) => [...prev, val], [])
568
708
  .option('--cwd <dir>', 'Working directory for this teammate (default: current directory)')
569
709
  .option('--after <names>', "DAG dependencies: comma-separated teammate names to wait for. Stages as PENDING; run 'teams start' to launch when ready.")
710
+ .option('--task-type <type>', `Factory label: ${VALID_TASK_TYPES.join('|')}. Drives planner fan-out + test-oracle bugfix loop.`)
711
+ .option('--cloud <provider>', `Dispatch to cloud backend instead of local CLI: ${VALID_CLOUD_PROVIDERS.join('|')}`)
712
+ .option('--repo <owner/repo>', 'GitHub repository (required for --cloud rush)')
713
+ .option('--branch <name>', 'Target git branch for cloud dispatch')
570
714
  .option('--json', 'Output machine-readable JSON')
571
715
  .action(async (team, teammate, task, opts) => {
572
716
  if (!VALID_MODES.includes(opts.mode)) {
@@ -575,6 +719,23 @@ Name teammates with --name alice to refer to them as 'alice' instead of a UUID.
575
719
  if (!VALID_EFFORTS.includes(opts.effort)) {
576
720
  die(`Invalid effort '${opts.effort}'. Use one of: ${VALID_EFFORTS.join(', ')}`);
577
721
  }
722
+ let taskType = null;
723
+ if (opts.taskType) {
724
+ if (!VALID_TASK_TYPES.includes(opts.taskType)) {
725
+ die(`Invalid task-type '${opts.taskType}'. Use one of: ${VALID_TASK_TYPES.join(', ')}`);
726
+ }
727
+ taskType = opts.taskType;
728
+ }
729
+ let cloudProviderId = null;
730
+ if (opts.cloud) {
731
+ if (!VALID_CLOUD_PROVIDERS.includes(opts.cloud)) {
732
+ die(`Invalid cloud provider '${opts.cloud}'. Use one of: ${VALID_CLOUD_PROVIDERS.join(', ')}`);
733
+ }
734
+ cloudProviderId = opts.cloud;
735
+ if (cloudProviderId === 'rush' && !opts.repo) {
736
+ die(`--cloud rush requires --repo <owner/repo>`);
737
+ }
738
+ }
578
739
  const { agent, version } = parseTeammate(teammate);
579
740
  if (version && !isVersionInstalled(agent, version)) {
580
741
  die(`${AGENT_NAMES[agent]} ${version} isn't installed.\n` +
@@ -602,9 +763,55 @@ Name teammates with --name alice to refer to them as 'alice' instead of a UUID.
602
763
  // Auto-create the team if it doesn't exist yet (friendlier UX than erroring).
603
764
  await ensureTeam(team);
604
765
  const cwd = opts.cwd ?? process.cwd();
605
- const mgr = new AgentManager();
766
+ const mgr = mkManager();
767
+ // Factory teammates: prepend the worker-skill preamble to every task
768
+ // prompt so implementers/testers/reviewers know about the Ledger, the
769
+ // dynamic DAG, and the pattern for filing new tasks mid-flight. No
770
+ // preamble when --task-type isn't set (plain teammates work as before).
771
+ let effectiveTask = task;
772
+ if (taskType) {
773
+ effectiveTask = factoryWorkerPreamble(team, opts.name ?? null, taskType, after) + '\n\n' + task;
774
+ }
775
+ // Dispatcher callback: when a staged cloud teammate's deps resolve,
776
+ // AgentManager.startReady() invokes this to kick off the remote task.
777
+ if (cloudProviderId) {
778
+ const providerId = cloudProviderId;
779
+ mgr.setCloudDispatcher(async (a) => {
780
+ const prov = resolveProvider(providerId);
781
+ const dispatchOpts = {
782
+ prompt: a.prompt,
783
+ agent: a.agentType,
784
+ repo: opts.repo,
785
+ branch: opts.branch,
786
+ model: a.model ?? undefined,
787
+ };
788
+ const cloudTask = await prov.dispatch(dispatchOpts);
789
+ return { cloudSessionId: cloudTask.id };
790
+ });
791
+ }
792
+ let cloudSessionId = null;
793
+ const isStaged = after.length > 0;
794
+ if (cloudProviderId && !isStaged) {
795
+ // Ready to run now: dispatch to the cloud provider before registering
796
+ // the teammate so we have the remote session id up front.
797
+ const prov = resolveProvider(cloudProviderId);
798
+ const dispatchOpts = {
799
+ prompt: effectiveTask,
800
+ agent,
801
+ repo: opts.repo,
802
+ branch: opts.branch,
803
+ model: opts.model,
804
+ };
805
+ try {
806
+ const cloudTask = await prov.dispatch(dispatchOpts);
807
+ cloudSessionId = cloudTask.id;
808
+ }
809
+ catch (err) {
810
+ die(`Cloud dispatch failed: ${err.message}`);
811
+ }
812
+ }
606
813
  try {
607
- const result = await handleSpawn(mgr, team, agent, task, cwd, opts.mode, opts.effort, null, cwd, version, opts.name ?? null, after, opts.model ?? null, envOverrides ?? null);
814
+ const result = await handleSpawn(mgr, team, agent, effectiveTask, cwd, opts.mode, opts.effort, null, cwd, version, opts.name ?? null, after, opts.model ?? null, envOverrides ?? null, taskType, cloudProviderId, cloudSessionId, opts.repo ?? null, opts.branch ?? null);
608
815
  if (isJsonMode(opts)) {
609
816
  console.log(JSON.stringify(result, null, 2));
610
817
  return;
@@ -623,6 +830,12 @@ Name teammates with --name alice to refer to them as 'alice' instead of a UUID.
623
830
  console.log(` ${chalk.gray('status ')} ${statusColor(result.status)(result.status)}`);
624
831
  console.log(` ${chalk.gray('mode ')} ${opts.mode}`);
625
832
  console.log(` ${chalk.gray('working ')} ${cwd}`);
833
+ if (result.task_type) {
834
+ console.log(` ${chalk.gray('task ')} ${chalk.cyan(result.task_type)}`);
835
+ }
836
+ if (result.cloud_provider) {
837
+ console.log(` ${chalk.gray('cloud ')} ${chalk.magenta(result.cloud_provider)}${result.cloud_session_id ? chalk.gray(' — ' + result.cloud_session_id.slice(0, 12)) : ''}`);
838
+ }
626
839
  if (result.after && result.after.length) {
627
840
  console.log(` ${chalk.gray('after ')} ${result.after.join(', ')}`);
628
841
  }
@@ -650,7 +863,7 @@ Name teammates with --name alice to refer to them as 'alice' instead of a UUID.
650
863
  .action(async (team, opts) => {
651
864
  // Map friendly 'working' → internal 'running' for filter.
652
865
  const filter = opts.filter === 'working' ? 'running' : opts.filter;
653
- const mgr = new AgentManager();
866
+ const mgr = mkManager();
654
867
  // No team given → drop into the picker (TTY) or fail clearly (script).
655
868
  if (!team) {
656
869
  const picked = await pickTeamOr(mgr, 'agents teams status');
@@ -678,59 +891,101 @@ Name teammates with --name alice to refer to them as 'alice' instead of a UUID.
678
891
  die(`Could not check on team ${team}: ${err.message}`);
679
892
  }
680
893
  });
894
+ // active — list every live teammate across every team, grouped by team.
895
+ teams
896
+ .command('active')
897
+ .description('List every teammate running right now, across all teams (PID-alive check).')
898
+ .option('--json', 'Output machine-readable JSON')
899
+ .action(async (opts) => {
900
+ const mgr = mkManager();
901
+ const running = await mgr.listRunning();
902
+ if (isJsonMode(opts)) {
903
+ console.log(JSON.stringify({ agents: running.map((a) => ({
904
+ agent_id: a.agentId,
905
+ team: a.taskName,
906
+ name: a.name,
907
+ agent_type: a.agentType,
908
+ pid: a.pid,
909
+ started_at: a.startedAt.toISOString(),
910
+ cwd: a.cwd,
911
+ version: a.version,
912
+ })) }, null, 2));
913
+ return;
914
+ }
915
+ if (running.length === 0) {
916
+ console.log(chalk.gray('No teammates are running right now.'));
917
+ return;
918
+ }
919
+ const byTeam = new Map();
920
+ for (const a of running) {
921
+ const arr = byTeam.get(a.taskName) || [];
922
+ arr.push(a);
923
+ byTeam.set(a.taskName, arr);
924
+ }
925
+ for (const [team, agents] of byTeam) {
926
+ console.log(chalk.bold(`Team ${chalk.cyan(team)} ${chalk.gray(`(${agents.length} working)`)}`));
927
+ for (const a of agents) {
928
+ const ident = a.name || shortId(a.agentId);
929
+ const pidStr = a.pid ? chalk.yellow(`pid ${a.pid}`) : chalk.gray('pid ?');
930
+ const started = chalk.gray(relTime(a.startedAt.toISOString()));
931
+ console.log(` ${chalk.magenta(padRight(fullName(a.agentType, a.version), 18))} ${chalk.white(padRight(ident, 20))} ${pidStr} ${started}`);
932
+ }
933
+ console.log();
934
+ }
935
+ console.log(chalk.gray(`${running.length} teammate${running.length === 1 ? '' : 's'} running. See 'agents sessions --active' for the full cross-context view.`));
936
+ });
681
937
  // start — fire any staged teammates whose --after deps have all completed
682
938
  teams
683
939
  .command('start [team]')
684
- .description('Launch any pending teammates whose --after dependencies are satisfied. Re-run to advance the DAG as teammates finish.')
940
+ .description('Launch any pending teammates whose --after dependencies are satisfied. Use --watch to keep draining the DAG as teammates finish and as new tasks are added mid-flight.')
685
941
  .option('--json', 'Output machine-readable JSON')
942
+ .option('--watch', 'Keep running: poll every --interval seconds, fire new waves, exit when the DAG drains.')
943
+ .option('--interval <seconds>', 'Seconds between waves in --watch mode (default 8)', '8')
944
+ .option('--max-waves <n>', 'Safety cap on waves in --watch mode (default 1000)', '1000')
686
945
  .action(async (team, opts) => {
687
- const mgr = new AgentManager();
946
+ const mgr = mkManager();
947
+ wireCloudDispatcher(mgr);
688
948
  if (!team) {
689
949
  const picked = await pickTeamOr(mgr, 'agents teams start');
690
950
  if (!picked)
691
951
  return;
692
952
  team = picked;
693
953
  }
694
- const launched = await mgr.startReady(team);
695
- // Also compute which teammates are still pending + why, so the user
696
- // knows what's being waited on.
697
- const all = await mgr.listByTask(team);
698
- const stillPending = all.filter((a) => a.status === 'pending');
699
- if (isJsonMode(opts)) {
700
- console.log(JSON.stringify({
701
- team,
702
- launched: launched.map((a) => ({
703
- agent_id: a.agentId,
704
- name: a.name,
705
- after: a.after,
706
- })),
707
- still_pending: stillPending.map((a) => ({
708
- agent_id: a.agentId,
709
- name: a.name,
710
- after: a.after,
711
- })),
712
- }, null, 2));
954
+ if (!opts.watch) {
955
+ await runOneWave(mgr, team, Boolean(opts.json));
713
956
  return;
714
957
  }
715
- if (launched.length === 0 && stillPending.length === 0) {
716
- console.log(chalk.gray(`No pending teammates in team ${team}.`));
717
- return;
958
+ const intervalMs = Math.max(1000, Number.parseInt(opts.interval, 10) * 1000 || 8000);
959
+ const maxWaves = Math.max(1, Number.parseInt(opts.maxWaves, 10) || 1000);
960
+ const json = isJsonMode(opts);
961
+ const result = await runSupervisor(mgr, {
962
+ team,
963
+ intervalMs,
964
+ maxWaves,
965
+ onWave: (s) => {
966
+ const ts = s.timestamp.slice(11, 19);
967
+ if (json) {
968
+ console.log(JSON.stringify({
969
+ wave: s.wave, ts, team: s.team, launched: s.launched.length,
970
+ pending: s.pending, running: s.running, completed: s.completed, failed: s.failed,
971
+ }));
972
+ return;
973
+ }
974
+ console.log(`[${ts}] wave ${s.wave} team ${chalk.cyan(s.team)} ` +
975
+ `launched=${chalk.green(s.launched.length)} running=${chalk.yellow(s.running)} ` +
976
+ `pending=${chalk.blue(s.pending)} done=${chalk.green(s.completed)} ` +
977
+ `failed=${s.failed > 0 ? chalk.red(s.failed) : '0'}`);
978
+ },
979
+ });
980
+ const elapsed = Math.floor(result.elapsed_ms / 1000);
981
+ if (result.stoppedBy === 'drained') {
982
+ console.log(chalk.green(`Factory drained in ${elapsed}s (${result.waves} waves).`));
718
983
  }
719
- if (launched.length > 0) {
720
- console.log(chalk.green(`Launched ${launched.length} teammate(s) in team ${chalk.cyan(team)}:`));
721
- for (const a of launched) {
722
- const who = fullName(a.agentType, a.version);
723
- const h = a.name || shortId(a.agentId);
724
- console.log(` ${chalk.cyan(h)} ${who}`);
725
- }
984
+ else if (result.stoppedBy === 'max-waves') {
985
+ console.error(chalk.yellow(`Hit --max-waves=${maxWaves}; stopping. Re-run to continue.`));
726
986
  }
727
- if (stillPending.length > 0) {
728
- console.log();
729
- console.log(chalk.gray(`Still pending (${stillPending.length}):`));
730
- for (const a of stillPending) {
731
- const h = a.name || shortId(a.agentId);
732
- console.log(` ${chalk.blue(h)} ${chalk.gray('after')} ${a.after.join(', ')}`);
733
- }
987
+ else if (result.stoppedBy === 'signal') {
988
+ console.error(chalk.yellow(`Stopped by signal after ${result.waves} waves.`));
734
989
  }
735
990
  });
736
991
  // remove
@@ -741,7 +996,7 @@ Name teammates with --name alice to refer to them as 'alice' instead of a UUID.
741
996
  .option('--keep-logs', 'Keep their log files on disk (default: delete them)')
742
997
  .option('--json', 'Output machine-readable JSON')
743
998
  .action(async (team, ref, opts) => {
744
- const mgr = new AgentManager();
999
+ const mgr = mkManager();
745
1000
  if (!team) {
746
1001
  const { names } = await loadTeamRows(mgr);
747
1002
  requireDestructiveArg({
@@ -805,7 +1060,7 @@ Name teammates with --name alice to refer to them as 'alice' instead of a UUID.
805
1060
  .option('--keep-logs', 'Keep all teammate logs on disk (default: delete them)')
806
1061
  .option('--json', 'Output machine-readable JSON')
807
1062
  .action(async (team, opts) => {
808
- const mgr = new AgentManager();
1063
+ const mgr = mkManager();
809
1064
  if (!team) {
810
1065
  const { names } = await loadTeamRows(mgr);
811
1066
  requireDestructiveArg({
@@ -857,7 +1112,7 @@ Name teammates with --name alice to refer to them as 'alice' instead of a UUID.
857
1112
  // No teammate → picker in TTY, hard fail outside.
858
1113
  let agentId;
859
1114
  if (!ref) {
860
- const mgr = new AgentManager();
1115
+ const mgr = mkManager();
861
1116
  const picked = await pickTeammateOr(mgr, 'agents teams logs');
862
1117
  if (!picked)
863
1118
  return;
@@ -914,4 +1169,3 @@ Name teammates with --name alice to refer to them as 'alice' instead of a UUID.
914
1169
  }
915
1170
  });
916
1171
  }
917
- //# sourceMappingURL=teams.js.map
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Usage command -- show rate-limit / quota status for each installed agent.
3
+ *
4
+ * Lists every installed agent with the best available usage snapshot:
5
+ * - claude: live OAuth API call (cached for 2 minutes)
6
+ * - codex: parsed from latest session log's rate_limits event
7
+ * - others: marked as "not exposed by CLI" (Gemini, OpenCode, Cursor, etc.
8
+ * don't publish per-account usage today)
9
+ */
10
+ import type { Command } from 'commander';
11
+ export declare function registerUsageCommand(program: Command): void;
@@ -0,0 +1,60 @@
1
+ import chalk from 'chalk';
2
+ import { ALL_AGENT_IDS, AGENTS, getAccountInfo, agentLabel, } from '../lib/agents.js';
3
+ import { listInstalledVersions, getGlobalDefault, getVersionHomePath } from '../lib/versions.js';
4
+ import { formatUsageSection, getUsageInfoForIdentity } from '../lib/usage.js';
5
+ /** Agents whose CLI surfaces usage data we can read today. */
6
+ const USAGE_SUPPORTED = new Set(['claude', 'codex']);
7
+ export function registerUsageCommand(program) {
8
+ program
9
+ .command('usage [agent]')
10
+ .description('Show rate-limit / quota usage per agent')
11
+ .action(async (agentFilter) => {
12
+ const filter = agentFilter;
13
+ const targets = filter
14
+ ? [filter].filter((id) => ALL_AGENT_IDS.includes(id))
15
+ : ALL_AGENT_IDS.filter((id) => listInstalledVersions(id).length > 0);
16
+ if (targets.length === 0) {
17
+ console.log(chalk.gray('No agents installed. Run `agents add <agent>` first.'));
18
+ return;
19
+ }
20
+ const sections = await Promise.all(targets.map(async (agentId) => renderAgentUsage(agentId)));
21
+ console.log(sections.filter(Boolean).join('\n\n'));
22
+ });
23
+ }
24
+ async function renderAgentUsage(agentId) {
25
+ const cfg = AGENTS[agentId];
26
+ const heading = agentLabel(agentId);
27
+ if (!USAGE_SUPPORTED.has(agentId)) {
28
+ return [
29
+ `${heading}`,
30
+ ` ${chalk.dim(`${cfg.name} CLI does not publish usage data.`)}`,
31
+ ].join('\n');
32
+ }
33
+ const versions = listInstalledVersions(agentId);
34
+ const version = getGlobalDefault(agentId) || versions[0];
35
+ if (!version) {
36
+ return [`${heading}`, ` ${chalk.dim('No version installed.')}`].join('\n');
37
+ }
38
+ const home = getVersionHomePath(agentId, version);
39
+ const info = await getAccountInfo(agentId, home);
40
+ if (!info.usageKey && !info.accountKey) {
41
+ return [`${heading}`, ` ${chalk.dim('Not signed in.')}`].join('\n');
42
+ }
43
+ const usage = await getUsageInfoForIdentity({
44
+ agentId,
45
+ home,
46
+ info,
47
+ cliVersion: null,
48
+ });
49
+ const lines = [heading];
50
+ if (info.email)
51
+ lines.push(` ${chalk.dim(info.email)}`);
52
+ const section = formatUsageSection(usage);
53
+ if (section.length === 0) {
54
+ lines.push(` ${chalk.dim('No usage data available right now.')}`);
55
+ }
56
+ else {
57
+ lines.push(...section);
58
+ }
59
+ return lines.join('\n');
60
+ }
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Shared utilities for command implementations.
3
+ *
4
+ * Small helpers used across multiple commands: prompt cancellation detection,
5
+ * table formatting, spinner management, and platform-specific workarounds.
6
+ */
1
7
  /**
2
8
  * Check if an error is from user cancelling a prompt (Ctrl+C)
3
9
  */
@@ -36,4 +42,3 @@ export declare function parseCommaSeparatedList(value: string | undefined): stri
36
42
  * Format a path for display, using ~ for home directory
37
43
  */
38
44
  export declare function formatPath(fullPath: string, cwd?: string): string;
39
- //# sourceMappingURL=utils.d.ts.map
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Shared utilities for command implementations.
3
+ *
4
+ * Small helpers used across multiple commands: prompt cancellation detection,
5
+ * table formatting, spinner management, and platform-specific workarounds.
6
+ */
1
7
  import * as os from 'os';
2
8
  import { spawnSync } from 'child_process';
3
9
  import chalk from 'chalk';
@@ -97,4 +103,3 @@ export function formatPath(fullPath, cwd) {
97
103
  }
98
104
  return fullPath;
99
105
  }
100
- //# sourceMappingURL=utils.js.map