bazilion 0.27.0 → 0.51.0

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 (234) hide show
  1. package/dist/cli.js +651 -309
  2. package/dist/cli.js.map +1 -1
  3. package/dist/daemon.js +2105 -997
  4. package/dist/daemon.js.map +1 -1
  5. package/dist/web/client/assets/AddProviderDialog-Diic36c_.js +1 -0
  6. package/dist/web/client/assets/ConfigPage-pupvtSCX.js +1 -0
  7. package/dist/web/client/assets/ConfirmDialog-GFDcHI1L.js +1 -0
  8. package/dist/web/client/assets/ConnectionsView-y1CeY-6U.js +1 -0
  9. package/dist/web/client/assets/Dialog-bg86_x4v.js +1 -0
  10. package/dist/web/client/assets/FieldRow-B8eIni5r.js +1 -0
  11. package/dist/web/client/assets/ModelSelect-DvCLUmkW.js +1 -0
  12. package/dist/web/client/assets/SectionTabs-D4ezA6U4.js +1 -0
  13. package/dist/web/client/assets/Segmented-Dh77vmpp.js +1 -0
  14. package/dist/web/client/assets/SkillFindings-BzLO1lNA.js +1 -0
  15. package/dist/web/client/assets/SkillsPicker-hI3YXvib.js +1 -0
  16. package/dist/web/client/assets/SpawnDialog-YJX6UMBC.js +1 -0
  17. package/dist/web/client/assets/Tabs-f6bHvCGn.js +1 -0
  18. package/dist/web/client/assets/TeamForm-kda1HYZG.js +1 -0
  19. package/dist/web/client/assets/TeamThread-DFvbakHo.js +1 -0
  20. package/dist/web/client/assets/UnsavedChangesGuard-DBJikVgc.js +1 -0
  21. package/dist/web/client/assets/_id-BjNtLwak.js +1 -0
  22. package/dist/web/client/assets/_id-BklaQf3z.js +1 -0
  23. package/dist/web/client/assets/agents-D9cUF2d9.js +1 -0
  24. package/dist/web/client/assets/agents-wuBlzx4e.js +1 -0
  25. package/dist/web/client/assets/api-HC_YzjBy.js +1 -0
  26. package/dist/web/client/assets/arrow-right-Gm_FDWJ_.js +1 -0
  27. package/dist/web/client/assets/attention-8ZkSLl2e.js +1 -0
  28. package/dist/web/client/assets/check-BjgKoGvU.js +1 -0
  29. package/dist/web/client/assets/config-Con_BbSh.js +1 -0
  30. package/dist/web/client/assets/createLucideIcon-C6gOo8sD.js +1 -0
  31. package/dist/web/client/assets/index-Br9qkGM-.js +54 -0
  32. package/dist/web/client/assets/link-Cbztlp_R.js +1 -0
  33. package/dist/web/client/assets/login-llnOKSJc.js +1 -0
  34. package/dist/web/client/assets/mcp-zIUguMSI.js +1 -0
  35. package/dist/web/client/assets/plus-CWrKMtvA.js +1 -0
  36. package/dist/web/client/assets/routes-BY5uqJ2n.js +76 -0
  37. package/dist/web/client/assets/save-f9O-CQia.js +1 -0
  38. package/dist/web/client/assets/services-esLrcTwe.js +1 -0
  39. package/dist/web/client/assets/skills-DzYXksM0.js +1 -0
  40. package/dist/web/client/assets/style-Cdzqt_TJ.js +7 -0
  41. package/dist/web/client/assets/styles-BRSS6yrm.css +2 -0
  42. package/dist/web/client/assets/system-CsI66nyZ.js +1 -0
  43. package/dist/web/client/assets/teams-CHE_zpxS.js +1 -0
  44. package/dist/web/client/assets/teams-dxG9OESG.js +1 -0
  45. package/dist/web/client/assets/telegram-C3dGndJV.js +1 -0
  46. package/dist/web/client/assets/tokens-CNNH-Wr9.js +1 -0
  47. package/dist/web/client/assets/use-resource-BjnxgGvh.js +1 -0
  48. package/dist/web/client/assets/welcome-C8EOtc8P.js +1 -0
  49. package/dist/web/server/assets/AddProviderDialog-CR6TRYdZ.js +910 -0
  50. package/dist/web/server/assets/{ConfigPage-CGld_wCK.js → ConfigPage-CIh3ohea.js} +4 -4
  51. package/dist/web/server/assets/ConfirmDialog-B79K2KEW.js +52 -0
  52. package/dist/web/server/assets/ConnectionsView-BIMYdp9C.js +710 -0
  53. package/dist/web/server/assets/{ConfirmDialog-LdVlEanK.js → Dialog-CVqpXxuN.js} +3 -50
  54. package/dist/web/server/assets/{FieldRow-Dah2KKqo.js → FieldRow-CHVhX2rS.js} +4 -4
  55. package/dist/web/server/assets/{ModelSelect-Vwro6OkL.js → ModelSelect-DrZrdndo.js} +7 -7
  56. package/dist/web/server/assets/Rail-Cg-efcpA.js +698 -0
  57. package/dist/web/server/assets/{SectionTabs-CqFg9Vwx.js → SectionTabs-DrcgVeZd.js} +4 -18
  58. package/dist/web/server/assets/Segmented-3ZLdqa5U.js +18 -0
  59. package/dist/web/server/assets/{SkillFindings-Bd6e81Wu.js → SkillFindings-DSDiL6hn.js} +1 -1
  60. package/dist/web/server/assets/{SpawnDialog-BGNaMfFb.js → SpawnDialog-BUUlLxE9.js} +25 -7
  61. package/dist/web/server/assets/{TeamForm-C93tpn9r.js → TeamForm-CvQAs2FA.js} +1 -1
  62. package/dist/web/server/assets/TeamThread-5CjVPcDr.js +190 -0
  63. package/dist/web/server/assets/{UnsavedChangesGuard-Dm4a27_5.js → UnsavedChangesGuard-CyF2Z9p1.js} +8 -4
  64. package/dist/web/server/assets/{TeamPolicyEditor-BHS3J0R9.js → _id-0fEWiVZX.js} +114 -263
  65. package/dist/web/server/assets/{_id-B0x1ffz3.js → _id-8bsYEcGg.js} +2 -2
  66. package/dist/web/server/assets/{_id-sW6zXrTP.js → _id-BvAaRSUW.js} +2 -2
  67. package/dist/web/server/assets/{_id-lOVnT5sS.js → _id-Dg6M_qfr.js} +6 -6
  68. package/dist/web/server/assets/{_id-ByiXeIPS.js → _id-Dji7xr9C.js} +2 -2
  69. package/dist/web/server/assets/{_id-Bdf_Rg62.js → _id-TVruGcOd.js} +1 -1
  70. package/dist/web/server/assets/_tanstack-start-manifest_v-sxiIH4M7.js +214 -0
  71. package/dist/web/server/assets/{agents-D4tqK1kH.js → agents-BDA5yYZ2.js} +14 -15
  72. package/dist/web/server/assets/{agents-Cn9GkXFX.js → agents-BTDxmp-F.js} +2 -2
  73. package/dist/web/server/assets/{agents-BNPkidbH.js → agents-BnWgFo6o.js} +1 -1
  74. package/dist/web/server/assets/{agents-lOqc6VGd.js → agents-DM7guWF2.js} +2 -2
  75. package/dist/web/server/assets/{agents-DycxHDt8.js → agents-DktqUffG.js} +10 -10
  76. package/dist/web/server/assets/{agents-BK8OmB8g.js → agents-xgZ9rsac.js} +2 -2
  77. package/dist/web/server/assets/{attention-DULVjdmF.js → attention-CHQEQiZl.js} +2 -2
  78. package/dist/web/server/assets/{attention-YWnLKA2E.js → attention-Cr7puThv.js} +1 -1
  79. package/dist/web/server/assets/{attention-BIm455bC.js → attention-De3-ehuf.js} +6 -6
  80. package/dist/web/server/assets/{auth-DiN92ydD.js → auth-dJnrFW6y.js} +1 -1
  81. package/dist/web/server/assets/config-DOp28gcy.js +1067 -0
  82. package/dist/web/server/assets/config-DzgkbBoD.js +17 -0
  83. package/dist/web/server/assets/config-X7qWbbpH.js +20 -0
  84. package/dist/web/server/assets/{Page-CMSYKXWJ.js → createSsrRpc-CcLbajrF.js} +17 -2
  85. package/dist/web/server/assets/{daemon-client-DL2ik2Em.js → daemon-client-B_ZRIIrT.js} +2 -1
  86. package/dist/web/server/assets/{mcp-BwmpNQPN.js → mcp-C97uAZe1.js} +1 -1
  87. package/dist/web/server/assets/{mcp-B09_O05r.js → mcp-CO_tycXU.js} +9 -9
  88. package/dist/web/server/assets/{mcp-CqdTfXcn.js → mcp-D3OCoHtO.js} +2 -2
  89. package/dist/web/server/assets/router-Cs2Ak4II.js +892 -0
  90. package/dist/web/server/assets/routes-BSNOKE-C.js +7647 -0
  91. package/dist/web/server/assets/routes-BVwqgZGI.js +16 -0
  92. package/dist/web/server/assets/routes-CO4l-GJ0.js +57 -0
  93. package/dist/web/server/assets/{services-Q9HYQXXB.js → services-DZLxUSG8.js} +2 -2
  94. package/dist/web/server/assets/{services-BLvAvb8g.js → services-DsHRLL8q.js} +1 -1
  95. package/dist/web/server/assets/{services-tCfB1B83.js → services-DsvpaF3L.js} +4 -4
  96. package/dist/web/server/assets/{skills-BZg_txbf.js → skills-CggQJk6a.js} +2 -2
  97. package/dist/web/server/assets/{skills-C7fqRPna.js → skills-DKYV7PTk.js} +11 -11
  98. package/dist/web/server/assets/{skills-C_g8IKag.js → skills-h5aHa7Q8.js} +1 -1
  99. package/dist/web/server/assets/style-GYDODk2F.js +178 -0
  100. package/dist/web/server/assets/system-CZ2qzBz3.js +138 -0
  101. package/dist/web/server/assets/system-DsJfpBPl.js +12 -0
  102. package/dist/web/server/assets/system-DtswhLW62.js +18 -0
  103. package/dist/web/server/assets/{teams-BS-oweRl.js → teams-B6PzNcoy.js} +23 -15
  104. package/dist/web/server/assets/{teams-D4CaU76n.js → teams-B6lBhvdL.js} +2 -2
  105. package/dist/web/server/assets/{teams-BHkhnt6b.js → teams-Bp2tERZe.js} +2 -2
  106. package/dist/web/server/assets/{teams-DX2HmKqi.js → teams-BxnvFTyn.js} +1 -1
  107. package/dist/web/server/assets/{teams-BSflKBP8.js → teams-C-8iz-uV.js} +6 -6
  108. package/dist/web/server/assets/{teams-CNyB5nM9.js → teams-YrmyutM4.js} +1 -1
  109. package/dist/web/server/assets/{telegram-CrJiygCX.js → telegram-CXrP3hMp.js} +6 -6
  110. package/dist/web/server/assets/{telegram-BUdnc8oF.js → telegram-D2RZriz_.js} +2 -2
  111. package/dist/web/server/assets/{telegram-C4v1HhyJ.js → telegram-Gy7_9yih.js} +1 -1
  112. package/dist/web/server/assets/{tokens-DqldzPUq.js → tokens-C-oDTqnp.js} +2 -2
  113. package/dist/web/server/assets/{tokens-B1twAJdd.js → tokens-CEdl8puR.js} +1 -1
  114. package/dist/web/server/assets/{tokens-DdjEyALj.js → tokens-DSLwQ1Pw.js} +10 -10
  115. package/dist/web/server/assets/use-resource-ChQozXVI.js +63 -0
  116. package/dist/web/server/assets/welcome-BLw1G6SS.js +318 -0
  117. package/dist/web/server/assets/welcome-ByAkvHSP.js +26 -0
  118. package/dist/web/server/assets/welcome-CxXMI4HI.js +15 -0
  119. package/dist/web/server/assets/workspace-DeEYMPDX.js +658 -0
  120. package/dist/web/server/server.js +30 -74
  121. package/dist/worker.js +78 -36
  122. package/dist/worker.js.map +1 -1
  123. package/package.json +1 -1
  124. package/dist/web/client/assets/AgentAvatar-DWx-bM6n.js +0 -1
  125. package/dist/web/client/assets/ChatPane-DOV_HJg-.js +0 -72
  126. package/dist/web/client/assets/ConfigPage-Dfu9DzFX.js +0 -1
  127. package/dist/web/client/assets/ConfirmDialog-536ziJ5P.js +0 -1
  128. package/dist/web/client/assets/FieldRow-z1JqCdqn.js +0 -1
  129. package/dist/web/client/assets/ModelSelect-CvOHjUyB.js +0 -1
  130. package/dist/web/client/assets/ResultCard-X4nTbjYY.js +0 -1
  131. package/dist/web/client/assets/SectionTabs-DXHzXmmb.js +0 -1
  132. package/dist/web/client/assets/SkillFindings-8LX6bYf_.js +0 -1
  133. package/dist/web/client/assets/SkillsPicker-Cr87y_W-.js +0 -1
  134. package/dist/web/client/assets/SpawnDialog-DoZl-yes.js +0 -1
  135. package/dist/web/client/assets/SpawnTeamModal-C638hEoN.js +0 -1
  136. package/dist/web/client/assets/Tabs-D0LgBNIk.js +0 -1
  137. package/dist/web/client/assets/TeamForm-C-WzvOl4.js +0 -1
  138. package/dist/web/client/assets/TeamPolicyEditor-CSKBx0oK.js +0 -7
  139. package/dist/web/client/assets/UnsavedChangesGuard-GC-vzw7h.js +0 -1
  140. package/dist/web/client/assets/_id-BKLynswT.js +0 -1
  141. package/dist/web/client/assets/_id-BYM_NORr.js +0 -1
  142. package/dist/web/client/assets/_id-Cxa98a9m.js +0 -1
  143. package/dist/web/client/assets/_id-D4hV1U1t.js +0 -1
  144. package/dist/web/client/assets/agent-actions-CXQCoxKO.js +0 -1
  145. package/dist/web/client/assets/agents-BxPS1_Bp.js +0 -1
  146. package/dist/web/client/assets/agents-GozAWW-l.js +0 -1
  147. package/dist/web/client/assets/attention-Cz9rZcrr.js +0 -1
  148. package/dist/web/client/assets/chevron-right-CPAb1zac.js +0 -1
  149. package/dist/web/client/assets/config-9vv9Lipb.js +0 -3
  150. package/dist/web/client/assets/inbox-DHLArXxl.js +0 -1
  151. package/dist/web/client/assets/index-1YXquAq8.js +0 -52
  152. package/dist/web/client/assets/jsx-runtime-bzQ4Vb5N.js +0 -1
  153. package/dist/web/client/assets/learning-PvtXm8Ne.js +0 -1
  154. package/dist/web/client/assets/login-DIJpNQFo.js +0 -1
  155. package/dist/web/client/assets/mcp-pKBL0xIf.js +0 -1
  156. package/dist/web/client/assets/members-DHWsgsEs.js +0 -1
  157. package/dist/web/client/assets/memory-CEVppPyU.js +0 -1
  158. package/dist/web/client/assets/plus-BaIRdB10.js +0 -1
  159. package/dist/web/client/assets/policy-DEh4BLSw.js +0 -1
  160. package/dist/web/client/assets/preload-helper-eUUcpe2S.js +0 -1
  161. package/dist/web/client/assets/results-DgJPjEZF.js +0 -1
  162. package/dist/web/client/assets/review-BbshafTQ.js +0 -1
  163. package/dist/web/client/assets/route-Ccb8v41z.js +0 -1
  164. package/dist/web/client/assets/route-D1d6kCEV.js +0 -1
  165. package/dist/web/client/assets/routes-g7V4ru7T.js +0 -1
  166. package/dist/web/client/assets/services-B2f7e5jV.js +0 -1
  167. package/dist/web/client/assets/settings-B6elpcYm.js +0 -1
  168. package/dist/web/client/assets/skills-CngE7TF8.js +0 -1
  169. package/dist/web/client/assets/styles-xUnZ-ep_.css +0 -2
  170. package/dist/web/client/assets/teams-BdJZXOan.js +0 -1
  171. package/dist/web/client/assets/teams-c496ISsT.js +0 -1
  172. package/dist/web/client/assets/telegram-B_-hK6EC.js +0 -1
  173. package/dist/web/client/assets/tokens-CKz8gx4-.js +0 -1
  174. package/dist/web/client/assets/triggers-DCEPciGW.js +0 -1
  175. package/dist/web/client/assets/welcome-D-zVOLGA.js +0 -1
  176. package/dist/web/server/assets/AgentAvatar-8gTAy_tP.js +0 -37
  177. package/dist/web/server/assets/ChatPane-De_FPEoD.js +0 -1887
  178. package/dist/web/server/assets/ResultCard-CZn1w4KA.js +0 -97
  179. package/dist/web/server/assets/Sidebar-puq47KyR.js +0 -430
  180. package/dist/web/server/assets/SpawnTeamModal-C6GbfScI.js +0 -97
  181. package/dist/web/server/assets/_id-BR6tnR6I.js +0 -23
  182. package/dist/web/server/assets/_id-Bm611NQz.js +0 -13
  183. package/dist/web/server/assets/_id-D5UCoyES.js +0 -359
  184. package/dist/web/server/assets/_id-DHx5UmmL.js +0 -12
  185. package/dist/web/server/assets/_id-DLpGmOVm.js +0 -19
  186. package/dist/web/server/assets/_id-Y5ctILG2.js +0 -13
  187. package/dist/web/server/assets/_id-dDA0pdVo.js +0 -54
  188. package/dist/web/server/assets/_tanstack-start-manifest_v-B8u80HjK.js +0 -292
  189. package/dist/web/server/assets/agent-actions-BBdFVdoa.js +0 -20
  190. package/dist/web/server/assets/api-WWxPqx67.js +0 -85
  191. package/dist/web/server/assets/config-BNEgu7WG.js +0 -798
  192. package/dist/web/server/assets/config-C1VB28se.js +0 -12
  193. package/dist/web/server/assets/config-TdVqnqNL.js +0 -25
  194. package/dist/web/server/assets/createSsrRpc-6LHNEsSK.js +0 -16
  195. package/dist/web/server/assets/inbox-4Vj5jTT8.js +0 -245
  196. package/dist/web/server/assets/inbox-D4IqUv3l.js +0 -38
  197. package/dist/web/server/assets/inbox-Dle24AfV.js +0 -23
  198. package/dist/web/server/assets/learning-BScq7VbO.js +0 -12
  199. package/dist/web/server/assets/learning-CBWFEnhg.js +0 -263
  200. package/dist/web/server/assets/learning-DWAKevhF.js +0 -25
  201. package/dist/web/server/assets/members-B8QBF6TF.js +0 -12
  202. package/dist/web/server/assets/members-DsF02Wp7.js +0 -12
  203. package/dist/web/server/assets/members-tWZA9b15.js +0 -36
  204. package/dist/web/server/assets/memory-BNN0b-0x.js +0 -12
  205. package/dist/web/server/assets/memory-CTl1E1Rm.js +0 -267
  206. package/dist/web/server/assets/memory-CV5uCBb2.js +0 -12
  207. package/dist/web/server/assets/policy-C9M6zV6w.js +0 -79
  208. package/dist/web/server/assets/policy-h-6NpU3m.js +0 -19
  209. package/dist/web/server/assets/policy-xEw9X0DK.js +0 -12
  210. package/dist/web/server/assets/results-D3A3UA4d.js +0 -182
  211. package/dist/web/server/assets/results-D6Ui5S8D.js +0 -12
  212. package/dist/web/server/assets/results-DWmxvfyn.js +0 -15
  213. package/dist/web/server/assets/review-CyQky-WQ.js +0 -40
  214. package/dist/web/server/assets/review-Sq0GGcPV.js +0 -322
  215. package/dist/web/server/assets/review-XWbSF8cF.js +0 -12
  216. package/dist/web/server/assets/route-BErtkz6t.js +0 -19
  217. package/dist/web/server/assets/route-CLoV-An_.js +0 -48
  218. package/dist/web/server/assets/route-WQ19JkBa.js +0 -19
  219. package/dist/web/server/assets/route-dEK_2GLj.js +0 -203
  220. package/dist/web/server/assets/route-iHTkhO81.js +0 -16
  221. package/dist/web/server/assets/route-zs8uUQtB.js +0 -16
  222. package/dist/web/server/assets/router-BI9gmY3S.js +0 -751
  223. package/dist/web/server/assets/routes-081s4n24.js +0 -45
  224. package/dist/web/server/assets/routes-CWo5WPsr.js +0 -15
  225. package/dist/web/server/assets/routes-Cqp1ufHm.js +0 -56
  226. package/dist/web/server/assets/settings-CVaGv-xF.js +0 -12
  227. package/dist/web/server/assets/settings-D9viV-86.js +0 -561
  228. package/dist/web/server/assets/settings-DaZNZ_CC.js +0 -27
  229. package/dist/web/server/assets/triggers-B7LW784F.js +0 -214
  230. package/dist/web/server/assets/triggers-C5sMCZXv2.js +0 -12
  231. package/dist/web/server/assets/triggers-DMfVdImD.js +0 -12
  232. package/dist/web/server/assets/welcome-D0d38Pzx.js +0 -93
  233. package/dist/web/client/assets/{TeamPolicyEditor-DLioOiRN.css → style-DLioOiRN.css} +0 -0
  234. package/dist/web/server/assets/{start-DTX6aKCi.js → start-DhW7sy23.js} +1 -1
package/dist/cli.js CHANGED
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/index.ts
4
- import { defineCommand as defineCommand38, runCommand, showUsage } from "citty";
4
+ import { defineCommand as defineCommand40, runCommand, showUsage } from "citty";
5
5
 
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "bazilion",
9
- version: "0.27.0",
9
+ version: "0.51.0",
10
10
  description: "Multi-agent runtime CLI \u2014 spawn LLM agents, manage profiles/teams/skills, and run the local daemon.",
11
11
  license: "MIT",
12
12
  repository: {
@@ -80,8 +80,8 @@ var package_default = {
80
80
  }
81
81
  };
82
82
 
83
- // src/commands/agent.ts
84
- import { defineCommand as defineCommand6 } from "citty";
83
+ // src/commands/activity.ts
84
+ import { defineCommand } from "citty";
85
85
 
86
86
  // ../../packages/client/src/index.ts
87
87
  var ApiClientError = class extends Error {
@@ -157,7 +157,7 @@ function createClient(cfg) {
157
157
  input
158
158
  )
159
159
  },
160
- /** Git change review: changes since a base, diffs, and file feedback. */
160
+ /** Git change review: changes since a base, diffs, who wrote them, and review feedback. */
161
161
  repositoryReview: (teamId) => {
162
162
  const base2 = `/api/teams/${encodeURIComponent(teamId)}/review`;
163
163
  return {
@@ -166,6 +166,7 @@ function createClient(cfg) {
166
166
  if (options.base !== void 0) params.set("base", options.base);
167
167
  if (options.patches) params.set("patches", "1");
168
168
  if (options.path !== void 0) params.set("path", options.path);
169
+ if (options.authors) params.set("authors", "1");
169
170
  const suffix = params.size ? `?${params}` : "";
170
171
  return request("GET", `${base2}${suffix}`);
171
172
  },
@@ -355,6 +356,33 @@ function ask(question) {
355
356
  input.once("close", () => resolve4(answer.trim()));
356
357
  });
357
358
  }
359
+ function askSecret(question) {
360
+ const { stdin: stdin3, stdout: stdout2 } = process;
361
+ if (!stdin3.isTTY) return ask(question);
362
+ stdout2.write(question);
363
+ return new Promise((resolve4, reject) => {
364
+ let value = "";
365
+ const finish = (error) => {
366
+ stdin3.off("data", onData);
367
+ stdin3.setRawMode(false);
368
+ stdin3.pause();
369
+ stdout2.write("\n");
370
+ if (error) reject(error);
371
+ else resolve4(value.trim());
372
+ };
373
+ const onData = (chunk) => {
374
+ for (const character of String(chunk)) {
375
+ if (character === "\r" || character === "\n") return finish();
376
+ if (character === "" || character === "") return finish(new Error("cancelled"));
377
+ if (character === "\x7F" || character === "\b") value = value.slice(0, -1);
378
+ else if (character >= " ") value += character;
379
+ }
380
+ };
381
+ stdin3.setRawMode(true);
382
+ stdin3.resume();
383
+ stdin3.on("data", onData);
384
+ });
385
+ }
358
386
  async function confirm(question) {
359
387
  return /^y(es)?$/i.test(await ask(`${question} [y/N] `));
360
388
  }
@@ -403,6 +431,55 @@ function findingLines(findings) {
403
431
  );
404
432
  }
405
433
 
434
+ // src/commands/activity.ts
435
+ function activityState(activity) {
436
+ if (activity.questions > 0) {
437
+ return `needs you: ${activity.questions} question${activity.questions === 1 ? "" : "s"}`;
438
+ }
439
+ if (activity.approvals > 0) {
440
+ return `needs you: ${activity.approvals} command${activity.approvals === 1 ? "" : "s"} to approve`;
441
+ }
442
+ if (activity.working) {
443
+ if (!activity.step) return "working";
444
+ return activity.step.target ? `working: ${activity.step.tool} ${activity.step.target}` : `working: ${activity.step.tool}`;
445
+ }
446
+ if (activity.queuePaused) return "follow-ups paused";
447
+ return "idle";
448
+ }
449
+ var activityCommand = defineCommand({
450
+ meta: {
451
+ name: "activity",
452
+ description: "Show what every Agent is doing and what waits for you"
453
+ },
454
+ args: {
455
+ team: { type: "string", description: "Only Agents of this Team" },
456
+ json: jsonFlag
457
+ },
458
+ async run({ args }) {
459
+ const client = createClient2();
460
+ const [activity, agents] = await Promise.all([
461
+ client.get("/api/activity"),
462
+ client.get("/api/agents")
463
+ ]);
464
+ const shown = activity.agents.filter((entry2) => !args.team || entry2.teamId === args.team);
465
+ if (args.json) return printJson({ agents: shown });
466
+ const names = new Map(agents.map((agent) => [agent.id, agent.name]));
467
+ printRows(
468
+ shown.map((entry2) => [
469
+ names.get(entry2.agentId) ?? entry2.agentId.slice(0, 8),
470
+ entry2.teamId,
471
+ terminalSafe(activityState(entry2)),
472
+ entry2.lastActivityAt ? new Date(entry2.lastActivityAt).toISOString() : "",
473
+ entry2.results ? `${entry2.results} file${entry2.results === 1 ? "" : "s"}` : ""
474
+ ]),
475
+ "(no agents)"
476
+ );
477
+ }
478
+ });
479
+
480
+ // src/commands/agent.ts
481
+ import { defineCommand as defineCommand7 } from "citty";
482
+
406
483
  // src/errors.ts
407
484
  var UsageError = class extends Error {
408
485
  };
@@ -450,15 +527,15 @@ function exitCodeForError(err) {
450
527
  }
451
528
 
452
529
  // src/commands/agent-browser.ts
453
- import { defineCommand } from "citty";
454
- var statusCmd = defineCommand({
530
+ import { defineCommand as defineCommand2 } from "citty";
531
+ var statusCmd = defineCommand2({
455
532
  meta: { name: "status", description: "Show the agent's browser status (never starts it)" },
456
533
  args: { id: agentArg },
457
534
  async run({ args }) {
458
535
  printJson(await createClient2().getAgentBrowser(args.id));
459
536
  }
460
537
  });
461
- var stopCmd = defineCommand({
538
+ var stopCmd = defineCommand2({
462
539
  meta: { name: "stop", description: "Stop the agent's browser (the profile is kept)" },
463
540
  args: { id: agentArg },
464
541
  async run({ args }) {
@@ -466,7 +543,7 @@ var stopCmd = defineCommand({
466
543
  console.log(`stopped the browser of agent ${args.id} (profile kept)`);
467
544
  }
468
545
  });
469
- var resetCmd = defineCommand({
546
+ var resetCmd = defineCommand2({
470
547
  meta: {
471
548
  name: "reset",
472
549
  description: "Stop the agent's browser and DELETE its profile (cookies, logins)"
@@ -489,7 +566,7 @@ var resetCmd = defineCommand({
489
566
  console.log(`reset the browser of agent ${args.id}: stopped, profile removed`);
490
567
  }
491
568
  });
492
- var browserCommand = defineCommand({
569
+ var browserCommand = defineCommand2({
493
570
  meta: { name: "browser", description: "The agent's managed browser: status, stop, reset" },
494
571
  subCommands: { status: statusCmd, stop: stopCmd, reset: resetCmd }
495
572
  });
@@ -499,7 +576,7 @@ import { writeFileSync } from "node:fs";
499
576
  import { basename as basename3 } from "node:path";
500
577
  import { stdin, stdout } from "node:process";
501
578
  import { createInterface as createInterface2 } from "node:readline/promises";
502
- import { defineCommand as defineCommand2 } from "citty";
579
+ import { defineCommand as defineCommand3 } from "citty";
503
580
 
504
581
  // src/question-prompt.ts
505
582
  function hasAnswerControl(text) {
@@ -707,7 +784,7 @@ async function streamTurn(client, agentId, request, prompts = {}) {
707
784
  }
708
785
  }
709
786
  }
710
- var chatCommand = defineCommand2({
787
+ var chatCommand = defineCommand3({
711
788
  meta: {
712
789
  name: "chat",
713
790
  description: "Send one message to an agent, or one per line of piped input"
@@ -777,7 +854,7 @@ var chatCommand = defineCommand2({
777
854
  });
778
855
 
779
856
  // src/commands/agent-context.ts
780
- import { defineCommand as defineCommand3 } from "citty";
857
+ import { defineCommand as defineCommand4 } from "citty";
781
858
  function formatBytes(n) {
782
859
  if (n < 1024) return `${n} B`;
783
860
  if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KiB`;
@@ -786,7 +863,7 @@ function formatBytes(n) {
786
863
  function estimateTokens(chars) {
787
864
  return Math.ceil(Math.max(0, chars) / 4);
788
865
  }
789
- var chatTrimCmd = defineCommand3({
866
+ var chatTrimCmd = defineCommand4({
790
867
  meta: {
791
868
  name: "chat-trim",
792
869
  description: "Keep the first N messages of an agent's chat history; drop the rest"
@@ -810,7 +887,7 @@ var chatTrimCmd = defineCommand3({
810
887
  );
811
888
  }
812
889
  });
813
- var chatContextCmd = defineCommand3({
890
+ var chatContextCmd = defineCommand4({
814
891
  meta: {
815
892
  name: "chat-context",
816
893
  description: "Break down what consumes the agent's context window"
@@ -886,7 +963,7 @@ var chatContextCmd = defineCommand3({
886
963
  console.log(`TOTAL: ${fmt(ctx.totals.chars, ctx.totals.tokens)}`);
887
964
  }
888
965
  });
889
- var chatCompactCmd = defineCommand3({
966
+ var chatCompactCmd = defineCommand4({
890
967
  meta: {
891
968
  name: "chat-compact",
892
969
  description: "Summarize the head of an agent's chat log, preserving the tail verbatim"
@@ -925,9 +1002,9 @@ var contextCommands = {
925
1002
  };
926
1003
 
927
1004
  // src/commands/agent-learning.ts
928
- import { defineCommand as defineCommand4 } from "citty";
1005
+ import { defineCommand as defineCommand5 } from "citty";
929
1006
  var proposalArg = positional("Proposal id or prefix");
930
- var reviewConfigCmd = defineCommand4({
1007
+ var reviewConfigCmd = defineCommand5({
931
1008
  meta: { name: "review-config", description: "Inspect or configure reviewed learning" },
932
1009
  args: {
933
1010
  id: agentArg,
@@ -962,7 +1039,7 @@ var reviewConfigCmd = defineCommand4({
962
1039
  console.log(`turns since last review: ${config.turnsSinceLast}`);
963
1040
  }
964
1041
  });
965
- var reviewCmd = defineCommand4({
1042
+ var reviewCmd = defineCommand5({
966
1043
  meta: { name: "review", description: "Enqueue a reviewed-learning pass" },
967
1044
  args: { id: agentArg },
968
1045
  async run({ args }) {
@@ -972,7 +1049,7 @@ var reviewCmd = defineCommand4({
972
1049
  console.log(`review ${response.review.id} ${response.review.status}`);
973
1050
  }
974
1051
  });
975
- var reviewsCmd = defineCommand4({
1052
+ var reviewsCmd = defineCommand5({
976
1053
  meta: { name: "reviews", description: "List reviewed-learning history" },
977
1054
  args: {
978
1055
  id: agentArg,
@@ -994,7 +1071,7 @@ var reviewsCmd = defineCommand4({
994
1071
  );
995
1072
  }
996
1073
  });
997
- var lessonsCmd = defineCommand4({
1074
+ var lessonsCmd = defineCommand5({
998
1075
  meta: { name: "lessons", description: "List reviewed lesson proposals" },
999
1076
  args: {
1000
1077
  id: agentArg,
@@ -1024,7 +1101,7 @@ async function locateProposal(id) {
1024
1101
  throw new Error(`lesson proposal not found: ${id}`);
1025
1102
  }
1026
1103
  function lessonDecisionCmd(decision) {
1027
- return defineCommand4({
1104
+ return defineCommand5({
1028
1105
  meta: { name: decision, description: `${decision} a reviewed lesson proposal` },
1029
1106
  args: {
1030
1107
  id: proposalArg,
@@ -1041,7 +1118,7 @@ function lessonDecisionCmd(decision) {
1041
1118
  }
1042
1119
  });
1043
1120
  }
1044
- var lessonEditCmd = defineCommand4({
1121
+ var lessonEditCmd = defineCommand5({
1045
1122
  meta: { name: "edit", description: "Edit a pending reviewed lesson proposal" },
1046
1123
  args: {
1047
1124
  id: proposalArg,
@@ -1060,7 +1137,7 @@ var lessonEditCmd = defineCommand4({
1060
1137
  console.log(`updated ${response.proposal.id} v${response.proposal.version}`);
1061
1138
  }
1062
1139
  });
1063
- var lessonCmd = defineCommand4({
1140
+ var lessonCmd = defineCommand5({
1064
1141
  meta: { name: "lesson", description: "Edit or decide a reviewed lesson proposal" },
1065
1142
  subCommands: {
1066
1143
  edit: lessonEditCmd,
@@ -1078,9 +1155,9 @@ var learningCommands = {
1078
1155
  };
1079
1156
 
1080
1157
  // src/commands/agent-skills.ts
1081
- import { defineCommand as defineCommand5 } from "citty";
1158
+ import { defineCommand as defineCommand6 } from "citty";
1082
1159
  var skillArg = positional("Skill name");
1083
- var addCmd = defineCommand5({
1160
+ var addCmd = defineCommand6({
1084
1161
  meta: { name: "add", description: "Attach a skill to an agent" },
1085
1162
  args: {
1086
1163
  agent: agentArg,
@@ -1096,7 +1173,7 @@ var addCmd = defineCommand5({
1096
1173
  console.log(`attached skill ${args.skill} to ${args.agent}`);
1097
1174
  }
1098
1175
  });
1099
- var rmCmd = defineCommand5({
1176
+ var rmCmd = defineCommand6({
1100
1177
  meta: { name: "rm", description: "Detach a skill from an agent" },
1101
1178
  args: { agent: agentArg, skill: skillArg },
1102
1179
  async run({ args }) {
@@ -1104,13 +1181,13 @@ var rmCmd = defineCommand5({
1104
1181
  console.log(`detached skill ${args.skill} from ${args.agent}`);
1105
1182
  }
1106
1183
  });
1107
- var agentSkillCommand = defineCommand5({
1184
+ var agentSkillCommand = defineCommand6({
1108
1185
  meta: { name: "skill", description: "Attach/detach skills on an agent" },
1109
1186
  subCommands: { add: addCmd, rm: rmCmd }
1110
1187
  });
1111
1188
 
1112
1189
  // src/commands/agent.ts
1113
- var spawnCmd = defineCommand6({
1190
+ var spawnCmd = defineCommand7({
1114
1191
  meta: { name: "spawn", description: "Spawn an agent from a profile into a team" },
1115
1192
  args: {
1116
1193
  profile: { type: "string", required: true, description: "Profile id" },
@@ -1135,7 +1212,7 @@ var spawnCmd = defineCommand6({
1135
1212
  console.log(`dir: ${agent.dir}`);
1136
1213
  }
1137
1214
  });
1138
- var editCmd = defineCommand6({
1215
+ var editCmd = defineCommand7({
1139
1216
  meta: {
1140
1217
  name: "edit",
1141
1218
  description: "Edit agent settings (name, model override, reasoning level, telegram mirror)"
@@ -1177,7 +1254,7 @@ var editCmd = defineCommand6({
1177
1254
  console.log(`updated agent ${agent.id} (${agent.name})`);
1178
1255
  }
1179
1256
  });
1180
- var listCmd = defineCommand6({
1257
+ var listCmd = defineCommand7({
1181
1258
  meta: { name: "list", description: "List agents" },
1182
1259
  args: {
1183
1260
  all: { type: "boolean", description: "Include archived agents" },
@@ -1198,7 +1275,7 @@ var listCmd = defineCommand6({
1198
1275
  );
1199
1276
  }
1200
1277
  });
1201
- var showCmd = defineCommand6({
1278
+ var showCmd = defineCommand7({
1202
1279
  meta: { name: "show", description: "Show agent details" },
1203
1280
  args: { id: agentArg },
1204
1281
  async run({ args }) {
@@ -1215,7 +1292,7 @@ var showCmd = defineCommand6({
1215
1292
  for (const s of r.skills) console.log(` ${s}`);
1216
1293
  }
1217
1294
  });
1218
- var archiveCmd = defineCommand6({
1295
+ var archiveCmd = defineCommand7({
1219
1296
  meta: { name: "archive", description: "Archive an agent" },
1220
1297
  args: { id: agentArg },
1221
1298
  async run({ args }) {
@@ -1223,7 +1300,7 @@ var archiveCmd = defineCommand6({
1223
1300
  console.log(`archived agent ${args.id}`);
1224
1301
  }
1225
1302
  });
1226
- var unarchiveCmd = defineCommand6({
1303
+ var unarchiveCmd = defineCommand7({
1227
1304
  meta: { name: "unarchive", description: "Restore an archived agent to idle" },
1228
1305
  args: { id: agentArg },
1229
1306
  async run({ args }) {
@@ -1231,7 +1308,7 @@ var unarchiveCmd = defineCommand6({
1231
1308
  console.log(`unarchived agent ${args.id}`);
1232
1309
  }
1233
1310
  });
1234
- var deleteCmd = defineCommand6({
1311
+ var deleteCmd = defineCommand7({
1235
1312
  meta: { name: "delete", description: "Permanently delete an agent and its data" },
1236
1313
  args: { id: agentArg },
1237
1314
  async run({ args }) {
@@ -1239,7 +1316,7 @@ var deleteCmd = defineCommand6({
1239
1316
  console.log(`deleted agent ${args.id}`);
1240
1317
  }
1241
1318
  });
1242
- var cancelCmd = defineCommand6({
1319
+ var cancelCmd = defineCommand7({
1243
1320
  meta: {
1244
1321
  name: "cancel",
1245
1322
  description: "Abort the agent's running turn; waiting follow-ups are paused"
@@ -1253,7 +1330,7 @@ var cancelCmd = defineCommand6({
1253
1330
  }
1254
1331
  }
1255
1332
  });
1256
- var moveCmd = defineCommand6({
1333
+ var moveCmd = defineCommand7({
1257
1334
  meta: { name: "move", description: "Move an agent to a different team" },
1258
1335
  args: { agent: agentArg, team: teamArg },
1259
1336
  async run({ args }) {
@@ -1262,7 +1339,7 @@ var moveCmd = defineCommand6({
1262
1339
  console.log(`moved ${args.agent} to team ${args.team}`);
1263
1340
  }
1264
1341
  });
1265
- var agentCommand = defineCommand6({
1342
+ var agentCommand = defineCommand7({
1266
1343
  meta: { name: "agent", description: "Manage agent instances" },
1267
1344
  subCommands: {
1268
1345
  spawn: spawnCmd,
@@ -1283,8 +1360,8 @@ var agentCommand = defineCommand6({
1283
1360
  });
1284
1361
 
1285
1362
  // src/commands/attention.ts
1286
- import { defineCommand as defineCommand7 } from "citty";
1287
- var list = defineCommand7({
1363
+ import { defineCommand as defineCommand8 } from "citty";
1364
+ var list = defineCommand8({
1288
1365
  meta: { name: "list", description: "List operator attention items" },
1289
1366
  args: {
1290
1367
  state: { type: "string", default: "open", description: "open, acknowledged or all" },
@@ -1313,7 +1390,7 @@ var list = defineCommand7({
1313
1390
  console.error(`warning: ${source.kind} unavailable: ${source.error}`);
1314
1391
  }
1315
1392
  });
1316
- var summary = defineCommand7({
1393
+ var summary = defineCommand8({
1317
1394
  meta: { name: "summary", description: "Summarize open attention items" },
1318
1395
  args: { json: jsonFlag },
1319
1396
  async run({ args }) {
@@ -1326,7 +1403,7 @@ var summary = defineCommand7({
1326
1403
  }
1327
1404
  });
1328
1405
  function mutation(name) {
1329
- return defineCommand7({
1406
+ return defineCommand8({
1330
1407
  meta: { name, description: `${name} one informational attention item` },
1331
1408
  args: {
1332
1409
  key: positional("Attention item key"),
@@ -1346,7 +1423,7 @@ function mutation(name) {
1346
1423
  }
1347
1424
  });
1348
1425
  }
1349
- var acknowledgeAll = defineCommand7({
1426
+ var acknowledgeAll = defineCommand8({
1350
1427
  meta: { name: "acknowledge-all", description: "Acknowledge all open informational items" },
1351
1428
  args: { yes: { type: "boolean", description: "Required confirmation" }, json: jsonFlag },
1352
1429
  async run({ args }) {
@@ -1361,7 +1438,7 @@ var acknowledgeAll = defineCommand7({
1361
1438
  function context(item) {
1362
1439
  return [item.agentName, item.teamName].filter(Boolean).join(" / ") || "system";
1363
1440
  }
1364
- var attentionCommand = defineCommand7({
1441
+ var attentionCommand = defineCommand8({
1365
1442
  meta: { name: "attention", description: "Inspect the operator attention center" },
1366
1443
  subCommands: {
1367
1444
  list,
@@ -1374,7 +1451,7 @@ var attentionCommand = defineCommand7({
1374
1451
 
1375
1452
  // src/commands/auth.ts
1376
1453
  import { openaiCodexProvider } from "@earendil-works/pi-ai/providers/openai-codex";
1377
- import { defineCommand as defineCommand8 } from "citty";
1454
+ import { defineCommand as defineCommand9 } from "citty";
1378
1455
  var CLI_OPENAI_LOGIN_TIMEOUT_MS = 10 * 6e4;
1379
1456
  function answerCliOpenAIPrompt(prompt, loginMethod, login, input = process.stdin, output = process.stdout) {
1380
1457
  if (prompt.type === "select") {
@@ -1412,7 +1489,7 @@ function formatExpiry(ms) {
1412
1489
  const d = new Date(ms);
1413
1490
  return d.toISOString().replace(/\.\d+Z$/, "Z");
1414
1491
  }
1415
- var openaiLoginCmd = defineCommand8({
1492
+ var openaiLoginCmd = defineCommand9({
1416
1493
  meta: {
1417
1494
  name: "login",
1418
1495
  description: "Connect your ChatGPT account via OAuth"
@@ -1465,14 +1542,12 @@ var openaiLoginCmd = defineCommand8({
1465
1542
  if (status.accountId) console.log(`account: ${status.accountId}`);
1466
1543
  console.log(`access token expires: ${formatExpiry(status.expiresAt)}`);
1467
1544
  console.log("");
1468
- console.log(`enable the 'openai-codex' provider on /config and save at least one model`);
1469
- console.log("to start using it. CLI equivalent:");
1470
- console.log(" bazilion provider enable openai-codex");
1471
- console.log(" bazilion provider models openai-codex # lists the catalog");
1472
- console.log(" bazilion provider models-set openai-codex <model>");
1545
+ console.log("choose its models and switch it on in one step:");
1546
+ console.log(" bazilion provider connect openai-codex");
1547
+ console.log("or under Setup, Models in the web UI.");
1473
1548
  }
1474
1549
  });
1475
- var openaiLogoutCmd = defineCommand8({
1550
+ var openaiLogoutCmd = defineCommand9({
1476
1551
  meta: {
1477
1552
  name: "logout",
1478
1553
  description: "Forget the stored ChatGPT OAuth credentials"
@@ -1483,7 +1558,7 @@ var openaiLogoutCmd = defineCommand8({
1483
1558
  console.log("disconnected ChatGPT OAuth credentials");
1484
1559
  }
1485
1560
  });
1486
- var openaiStatusCmd = defineCommand8({
1561
+ var openaiStatusCmd = defineCommand9({
1487
1562
  meta: {
1488
1563
  name: "status",
1489
1564
  description: "Show ChatGPT OAuth connection status"
@@ -1500,7 +1575,7 @@ var openaiStatusCmd = defineCommand8({
1500
1575
  console.log(`access token expires: ${formatExpiry(status.expiresAt)}`);
1501
1576
  }
1502
1577
  });
1503
- var openaiCmd = defineCommand8({
1578
+ var openaiCmd = defineCommand9({
1504
1579
  meta: {
1505
1580
  name: "openai",
1506
1581
  description: "Manage ChatGPT (OAuth) authentication"
@@ -1511,7 +1586,7 @@ var openaiCmd = defineCommand8({
1511
1586
  status: openaiStatusCmd
1512
1587
  }
1513
1588
  });
1514
- var authCommand = defineCommand8({
1589
+ var authCommand = defineCommand9({
1515
1590
  meta: {
1516
1591
  name: "auth",
1517
1592
  description: "OAuth-based provider authentication (ChatGPT account, etc.)"
@@ -1544,7 +1619,7 @@ import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
1544
1619
  import { Readable } from "node:stream";
1545
1620
  import { pipeline } from "node:stream/promises";
1546
1621
  import { Decrypter, Encrypter } from "age-encryption";
1547
- import { defineCommand as defineCommand9 } from "citty";
1622
+ import { defineCommand as defineCommand10 } from "citty";
1548
1623
  import { extract, list as list2 } from "tar";
1549
1624
 
1550
1625
  // ../daemon/src/core/db/schema.ts
@@ -1695,7 +1770,7 @@ function assertDaemonStopped(home) {
1695
1770
  }
1696
1771
 
1697
1772
  // src/commands/backup.ts
1698
- var createCmd = defineCommand9({
1773
+ var createCmd = defineCommand10({
1699
1774
  meta: { name: "create", description: "Download a backup of the Bazilion home" },
1700
1775
  args: {
1701
1776
  output: {
@@ -1729,8 +1804,8 @@ var createCmd = defineCommand9({
1729
1804
  const partial = `${output}.partial`;
1730
1805
  const fd = openSync(partial, "wx", 384);
1731
1806
  try {
1732
- const [archive, check] = res.body.tee();
1733
- const written = args.recipient ? await encrypter.encrypt(archive) : archive;
1807
+ const [archive2, check] = res.body.tee();
1808
+ const written = args.recipient ? await encrypter.encrypt(archive2) : archive2;
1734
1809
  await Promise.all([
1735
1810
  pipeline(Readable.fromWeb(written), createWriteStream(partial, { fd })),
1736
1811
  // A response cut short can still end cleanly: read the archive through to its end.
@@ -1847,7 +1922,7 @@ function installRestoredHome(staged, home) {
1847
1922
  console.warn(`warning: could not delete the previous home at ${previous}; remove it by hand`);
1848
1923
  }
1849
1924
  }
1850
- var restoreCmd = defineCommand9({
1925
+ var restoreCmd = defineCommand10({
1851
1926
  meta: {
1852
1927
  name: "restore",
1853
1928
  description: "Restore a backup into the Bazilion home (stop the daemon first)"
@@ -1870,17 +1945,17 @@ var restoreCmd = defineCommand9({
1870
1945
  mkdirSync2(dirname2(home), { recursive: true });
1871
1946
  const staging = mkdtempSync(join3(dirname2(home), ".bazilion-restore-"));
1872
1947
  try {
1873
- const archive = join3(staging, "backup.tar.gz");
1948
+ const archive2 = join3(staging, "backup.tar.gz");
1874
1949
  if (isAgeEncrypted(file)) {
1875
1950
  if (!args.identity) throw new Error("this backup is encrypted; pass --identity <file>");
1876
- await decrypt(file, archive, args.identity);
1951
+ await decrypt(file, archive2, args.identity);
1877
1952
  } else {
1878
- copyFileSync(file, archive);
1953
+ copyFileSync(file, archive2);
1879
1954
  }
1880
- await checkArchive(archive);
1955
+ await checkArchive(archive2);
1881
1956
  const staged = join3(staging, "home");
1882
1957
  mkdirSync2(staged, { mode: 448 });
1883
- await extract({ file: archive, cwd: staged, strict: true, preservePaths: true });
1958
+ await extract({ file: archive2, cwd: staged, strict: true, preservePaths: true });
1884
1959
  chmodSync(staged, 448);
1885
1960
  for (const name of ["auth.json", "bazilion.db"]) chmodSync(join3(staged, name), 384);
1886
1961
  checkDatabase(staged);
@@ -1893,13 +1968,13 @@ var restoreCmd = defineCommand9({
1893
1968
  console.log("start the daemon with: bazilion serve");
1894
1969
  }
1895
1970
  });
1896
- var backupCommand = defineCommand9({
1971
+ var backupCommand = defineCommand10({
1897
1972
  meta: { name: "backup", description: "Back up and restore the Bazilion home" },
1898
1973
  subCommands: { create: createCmd, restore: restoreCmd }
1899
1974
  });
1900
1975
 
1901
1976
  // src/commands/completion.ts
1902
- import { defineCommand as defineCommand10 } from "citty";
1977
+ import { defineCommand as defineCommand11 } from "citty";
1903
1978
  async function walk(cmd, path, out) {
1904
1979
  const subsRaw = cmd.subCommands ?? {};
1905
1980
  const subNames = Object.keys(subsRaw);
@@ -2004,7 +2079,7 @@ function fishScript(flat) {
2004
2079
  `;
2005
2080
  }
2006
2081
  function completionCommand(main2) {
2007
- return defineCommand10({
2082
+ return defineCommand11({
2008
2083
  meta: {
2009
2084
  name: "completion",
2010
2085
  description: "Print a shell completion script (bash, zsh, or fish)"
@@ -2029,13 +2104,13 @@ function completionCommand(main2) {
2029
2104
  }
2030
2105
 
2031
2106
  // src/commands/config.ts
2032
- import { defineCommand as defineCommand11 } from "citty";
2107
+ import { defineCommand as defineCommand12 } from "citty";
2033
2108
  function displayValue(f) {
2034
2109
  if (!f.set) return "(unset)";
2035
2110
  if (f.kind === "secret") return f.preview ?? "(set)";
2036
2111
  return f.value ?? "(set)";
2037
2112
  }
2038
- var listCmd2 = defineCommand11({
2113
+ var listCmd2 = defineCommand12({
2039
2114
  meta: {
2040
2115
  name: "list",
2041
2116
  description: "List every configurable field (credentials + URLs) across all services"
@@ -2043,7 +2118,8 @@ var listCmd2 = defineCommand11({
2043
2118
  async run() {
2044
2119
  const client = createClient2();
2045
2120
  const { providers } = await client.get("/api/config/providers");
2046
- const { services } = await client.get("/api/config/services");
2121
+ const { services: cards, functions } = await client.get("/api/config/services");
2122
+ const services = [...functions, ...cards];
2047
2123
  const all = [...providers, ...services];
2048
2124
  printRows(
2049
2125
  all.flatMap((svc) => svc.fields.map((f) => [svc.id, f.envVar, f.kind, displayValue(f)])),
@@ -2061,7 +2137,7 @@ ${svc.displayName}: ${svc.status}`);
2061
2137
  }
2062
2138
  }
2063
2139
  });
2064
- var setCmd = defineCommand11({
2140
+ var setCmd = defineCommand12({
2065
2141
  meta: {
2066
2142
  name: "set",
2067
2143
  description: "Set a configurable field (auto-routes to secrets or plaintext store)"
@@ -2079,7 +2155,7 @@ var setCmd = defineCommand11({
2079
2155
  console.log(`${state.envVar} (${state.kind}): ${displayValue(state)}`);
2080
2156
  }
2081
2157
  });
2082
- var rmCmd2 = defineCommand11({
2158
+ var rmCmd2 = defineCommand12({
2083
2159
  meta: { name: "rm", description: "Remove a configurable field value" },
2084
2160
  args: {
2085
2161
  envVar: positional("Env var name to clear")
@@ -2089,7 +2165,7 @@ var rmCmd2 = defineCommand11({
2089
2165
  console.log(`removed ${args.envVar}`);
2090
2166
  }
2091
2167
  });
2092
- var configCommand = defineCommand11({
2168
+ var configCommand = defineCommand12({
2093
2169
  meta: {
2094
2170
  name: "config",
2095
2171
  description: "Service settings: credentials (stored encrypted) and URLs/IDs (plaintext)"
@@ -2102,9 +2178,9 @@ var configCommand = defineCommand11({
2102
2178
  });
2103
2179
 
2104
2180
  // src/commands/conversation.ts
2105
- import { defineCommand as defineCommand12 } from "citty";
2181
+ import { defineCommand as defineCommand13 } from "citty";
2106
2182
  var conversationArg = positional("Conversation id");
2107
- var list3 = defineCommand12({
2183
+ var list3 = defineCommand13({
2108
2184
  meta: { name: "list", description: "List conversations; the active one receives new messages" },
2109
2185
  args: {
2110
2186
  agent: agentArg,
@@ -2130,7 +2206,7 @@ var list3 = defineCommand12({
2130
2206
  console.log(line);
2131
2207
  }
2132
2208
  });
2133
- var show = defineCommand12({
2209
+ var show = defineCommand13({
2134
2210
  meta: { name: "show", description: "Read a conversation without making it active" },
2135
2211
  args: { agent: agentArg, id: conversationArg, json: jsonFlag },
2136
2212
  async run({ args }) {
@@ -2140,7 +2216,7 @@ var show = defineCommand12({
2140
2216
  for (const message of body.messages) console.log(`[${message.role}] ${message.content}`);
2141
2217
  }
2142
2218
  });
2143
- var newConversation = defineCommand12({
2219
+ var newConversation = defineCommand13({
2144
2220
  meta: {
2145
2221
  name: "new",
2146
2222
  description: "Start a new conversation and make it active; earlier ones stay readable"
@@ -2159,7 +2235,7 @@ var newConversation = defineCommand12({
2159
2235
  console.log(`Conversation ${conversation.id}: ${conversation.title} (active)`);
2160
2236
  }
2161
2237
  });
2162
- var rename = defineCommand12({
2238
+ var rename = defineCommand13({
2163
2239
  meta: { name: "rename", description: "Rename a conversation" },
2164
2240
  args: {
2165
2241
  agent: agentArg,
@@ -2176,9 +2252,26 @@ var rename = defineCommand12({
2176
2252
  console.log(body.conversation.title);
2177
2253
  }
2178
2254
  });
2179
- var conversationCommand = defineCommand12({
2180
- meta: { name: "conversation", description: "List, read, start and rename Agent conversations" },
2181
- subCommands: { list: list3, show, new: newConversation, rename }
2255
+ var select = defineCommand13({
2256
+ meta: {
2257
+ name: "select",
2258
+ description: "Switch to an earlier conversation: new messages continue it"
2259
+ },
2260
+ args: { agent: agentArg, id: conversationArg, json: jsonFlag },
2261
+ async run({ args }) {
2262
+ const body = await createClient2().post(
2263
+ apiPath("agents", args.agent, "conversations", args.id, "select")
2264
+ );
2265
+ if (args.json) return printJson(body);
2266
+ console.log(`Conversation ${body.conversation.id}: ${body.conversation.title} (active)`);
2267
+ }
2268
+ });
2269
+ var conversationCommand = defineCommand13({
2270
+ meta: {
2271
+ name: "conversation",
2272
+ description: "List, read, start, rename and switch Agent conversations"
2273
+ },
2274
+ subCommands: { list: list3, show, new: newConversation, rename, select }
2182
2275
  });
2183
2276
 
2184
2277
  // src/commands/dashboard.ts
@@ -2186,19 +2279,19 @@ import { spawn as spawn2 } from "node:child_process";
2186
2279
  import { existsSync as existsSync4 } from "node:fs";
2187
2280
  import { connect } from "node:net";
2188
2281
  import { join as join5 } from "node:path";
2189
- import { defineCommand as defineCommand14 } from "citty";
2282
+ import { defineCommand as defineCommand15 } from "citty";
2190
2283
 
2191
2284
  // src/commands/serve.ts
2192
2285
  import { spawn } from "node:child_process";
2193
2286
  import { existsSync as existsSync3 } from "node:fs";
2194
2287
  import { join as join4 } from "node:path";
2195
- import { defineCommand as defineCommand13 } from "citty";
2288
+ import { defineCommand as defineCommand14 } from "citty";
2196
2289
  var bundledDaemonEntry = join4(import.meta.dirname, "daemon.js");
2197
2290
  var daemonEntry = existsSync3(bundledDaemonEntry) ? bundledDaemonEntry : join4(import.meta.dirname, "..", "..", "..", "daemon", "src", "index.ts");
2198
2291
  function nodeArgs(entry2) {
2199
2292
  return entry2.endsWith(".ts") ? ["--import", import.meta.resolve("tsx/esm"), entry2] : [entry2];
2200
2293
  }
2201
- var serveCommand = defineCommand13({
2294
+ var serveCommand = defineCommand14({
2202
2295
  meta: {
2203
2296
  name: "serve",
2204
2297
  description: "Start the bazilion daemon (HTTP API)"
@@ -2320,7 +2413,7 @@ function spawnProcess(label2, entry2, env) {
2320
2413
  stdio: "inherit"
2321
2414
  });
2322
2415
  }
2323
- var dashboardCommand = defineCommand14({
2416
+ var dashboardCommand = defineCommand15({
2324
2417
  meta: {
2325
2418
  name: "dashboard",
2326
2419
  description: "Start the bazilion daemon and bundled web UI"
@@ -2433,8 +2526,8 @@ var dashboardCommand = defineCommand14({
2433
2526
  });
2434
2527
 
2435
2528
  // src/commands/doctor.ts
2436
- import { defineCommand as defineCommand15 } from "citty";
2437
- var doctorCommand = defineCommand15({
2529
+ import { defineCommand as defineCommand16 } from "citty";
2530
+ var doctorCommand = defineCommand16({
2438
2531
  meta: { name: "doctor", description: "Diagnose your bazilion install" },
2439
2532
  async run() {
2440
2533
  const r = await createClient2().get("/api/health/details");
@@ -2518,7 +2611,6 @@ var doctorCommand = defineCommand15({
2518
2611
  console.log("operational counts");
2519
2612
  console.log(` ${r.triggers.active} active trigger(s), ${r.triggers.disabled} disabled`);
2520
2613
  console.log(` ${r.tokens.active} active web token(s)`);
2521
- const anyCloudProvider = r.providers.configured.length > 0;
2522
2614
  const hasProfiles = (r.database?.ok ? r.database.profiles : 0) > 0;
2523
2615
  const hasAgents = (r.database?.ok ? r.database.totalAgents : 0) > 0;
2524
2616
  console.log();
@@ -2531,13 +2623,12 @@ var doctorCommand = defineCommand15({
2531
2623
  if (!hasProfiles || !hasAgents) {
2532
2624
  console.log("next steps");
2533
2625
  const todo = [];
2534
- if (!anyCloudProvider) {
2535
- todo.push(" - set a cloud api key (ANTHROPIC_API_KEY / OPENAI_API_KEY / GEMINI_API_KEY)");
2536
- todo.push(" or make sure LMStudio / Ollama is running locally");
2537
- }
2538
2626
  if (!hasProfiles) {
2539
- todo.push(" - enable a provider: bazilion provider enable <provider>");
2540
- todo.push(" - save a model: bazilion provider models-set <provider> <model-id>");
2627
+ todo.push(" - connect a provider: bazilion provider connect <provider>");
2628
+ todo.push(
2629
+ " (anthropic, openai, google, openai-codex after `bazilion auth openai login`,"
2630
+ );
2631
+ todo.push(" or a local lmstudio / ollama; `bazilion provider list --all` has the rest)");
2541
2632
  }
2542
2633
  if (!hasAgents) todo.push(" - spawn an agent: bazilion agent spawn --profile <id>");
2543
2634
  for (const line of todo) console.log(line);
@@ -2583,7 +2674,7 @@ function checkLine(label2, condition, hint) {
2583
2674
  }
2584
2675
 
2585
2676
  // src/commands/inbox.ts
2586
- import { defineCommand as defineCommand16 } from "citty";
2677
+ import { defineCommand as defineCommand17 } from "citty";
2587
2678
  var messageArg = positional("Message id");
2588
2679
  function decodeText(payload) {
2589
2680
  try {
@@ -2600,7 +2691,7 @@ function messageRow(m) {
2600
2691
  const preview = text.length > 60 ? `${text.slice(0, 60)}\u2026` : text;
2601
2692
  return [m.id, state, when, `from:${m.fromAgentId.slice(0, 8)}`, `"${preview}"`];
2602
2693
  }
2603
- var listCmd3 = defineCommand16({
2694
+ var listCmd3 = defineCommand17({
2604
2695
  meta: { name: "list", description: "List messages in an agent inbox" },
2605
2696
  args: {
2606
2697
  agent: positional("Recipient agent id or prefix"),
@@ -2613,7 +2704,7 @@ var listCmd3 = defineCommand16({
2613
2704
  printRows(messages.map(messageRow), args.unread ? "(no unread messages)" : "(inbox empty)");
2614
2705
  }
2615
2706
  });
2616
- var showCmd2 = defineCommand16({
2707
+ var showCmd2 = defineCommand17({
2617
2708
  meta: { name: "show", description: "Show a single message in full" },
2618
2709
  args: { id: messageArg },
2619
2710
  async run({ args }) {
@@ -2630,7 +2721,7 @@ var showCmd2 = defineCommand16({
2630
2721
  console.log(decodeText(m.payload));
2631
2722
  }
2632
2723
  });
2633
- var readCmd = defineCommand16({
2724
+ var readCmd = defineCommand17({
2634
2725
  meta: { name: "read", description: "Mark a message as read" },
2635
2726
  args: { id: messageArg },
2636
2727
  async run({ args }) {
@@ -2638,7 +2729,7 @@ var readCmd = defineCommand16({
2638
2729
  console.log(`marked read: ${args.id}`);
2639
2730
  }
2640
2731
  });
2641
- var loopBreaksCmd = defineCommand16({
2732
+ var loopBreaksCmd = defineCommand17({
2642
2733
  meta: { name: "loop-breaks", description: "List stopped agent-message chains" },
2643
2734
  args: {
2644
2735
  agent: agentArg,
@@ -2661,7 +2752,7 @@ var loopBreaksCmd = defineCommand16({
2661
2752
  );
2662
2753
  }
2663
2754
  });
2664
- var inboxCommand = defineCommand16({
2755
+ var inboxCommand = defineCommand17({
2665
2756
  meta: { name: "inbox", description: "Inspect agent inboxes" },
2666
2757
  subCommands: {
2667
2758
  list: listCmd3,
@@ -2673,7 +2764,7 @@ var inboxCommand = defineCommand16({
2673
2764
 
2674
2765
  // src/commands/login.ts
2675
2766
  import { existsSync as existsSync5, readFileSync as readFileSync6, writeFileSync as writeFileSync3 } from "node:fs";
2676
- import { defineCommand as defineCommand17 } from "citty";
2767
+ import { defineCommand as defineCommand18 } from "citty";
2677
2768
  function normalizeServer(raw) {
2678
2769
  let url;
2679
2770
  try {
@@ -2697,7 +2788,7 @@ async function verifyToken(server, token) {
2697
2788
  throw new Error("server canonical private origin does not match --server");
2698
2789
  }
2699
2790
  }
2700
- var loginCommand = defineCommand17({
2791
+ var loginCommand = defineCommand18({
2701
2792
  meta: {
2702
2793
  name: "login",
2703
2794
  description: "Save a remote bazilion server + token pair to auth.json"
@@ -2745,7 +2836,7 @@ var loginCommand = defineCommand17({
2745
2836
  });
2746
2837
 
2747
2838
  // src/commands/mcp.ts
2748
- import { defineCommand as defineCommand18 } from "citty";
2839
+ import { defineCommand as defineCommand19 } from "citty";
2749
2840
  var serverArg = positional("MCP server id");
2750
2841
  function serverRow(s) {
2751
2842
  const where = s.transport === "stdio" ? `${s.command} ${s.args.join(" ")}`.trim() : s.url ?? "";
@@ -2758,7 +2849,7 @@ function serverRow(s) {
2758
2849
  where
2759
2850
  ];
2760
2851
  }
2761
- var addCmd2 = defineCommand18({
2852
+ var addCmd2 = defineCommand19({
2762
2853
  meta: { name: "add", description: "Register an MCP server" },
2763
2854
  args: {
2764
2855
  name: { type: "positional", required: true, description: "Unique name ([a-zA-Z0-9_])" },
@@ -2783,14 +2874,14 @@ var addCmd2 = defineCommand18({
2783
2874
  console.log(`${server.id} ${server.name} ${server.transport}`);
2784
2875
  }
2785
2876
  });
2786
- var listCmd4 = defineCommand18({
2877
+ var listCmd4 = defineCommand19({
2787
2878
  meta: { name: "list", description: "List MCP servers" },
2788
2879
  async run() {
2789
2880
  const { servers } = await createClient2().get("/api/mcp-servers");
2790
2881
  printRows(servers.map(serverRow), "(no MCP servers)");
2791
2882
  }
2792
2883
  });
2793
- var showCmd3 = defineCommand18({
2884
+ var showCmd3 = defineCommand19({
2794
2885
  meta: { name: "show", description: "Show one MCP server" },
2795
2886
  args: { id: serverArg },
2796
2887
  async run({ args }) {
@@ -2800,7 +2891,7 @@ var showCmd3 = defineCommand18({
2800
2891
  printJson(server);
2801
2892
  }
2802
2893
  });
2803
- var rmCmd3 = defineCommand18({
2894
+ var rmCmd3 = defineCommand19({
2804
2895
  meta: { name: "rm", description: "Delete an MCP server" },
2805
2896
  args: { id: serverArg },
2806
2897
  async run({ args }) {
@@ -2808,7 +2899,7 @@ var rmCmd3 = defineCommand18({
2808
2899
  console.log(`removed MCP server ${args.id}`);
2809
2900
  }
2810
2901
  });
2811
- var enableCmd = defineCommand18({
2902
+ var enableCmd = defineCommand19({
2812
2903
  meta: { name: "enable", description: "Enable an MCP server" },
2813
2904
  args: { id: serverArg },
2814
2905
  async run({ args }) {
@@ -2816,7 +2907,7 @@ var enableCmd = defineCommand18({
2816
2907
  console.log(`enabled MCP server ${args.id}`);
2817
2908
  }
2818
2909
  });
2819
- var disableCmd = defineCommand18({
2910
+ var disableCmd = defineCommand19({
2820
2911
  meta: { name: "disable", description: "Disable an MCP server" },
2821
2912
  args: { id: serverArg },
2822
2913
  async run({ args }) {
@@ -2824,7 +2915,7 @@ var disableCmd = defineCommand18({
2824
2915
  console.log(`disabled MCP server ${args.id}`);
2825
2916
  }
2826
2917
  });
2827
- var testCmd = defineCommand18({
2918
+ var testCmd = defineCommand19({
2828
2919
  meta: { name: "test", description: "Connect to a server and list its tools" },
2829
2920
  args: { id: serverArg },
2830
2921
  async run({ args }) {
@@ -2837,7 +2928,7 @@ var testCmd = defineCommand18({
2837
2928
  for (const t of tools) console.log(` ${t.name} ${t.description}`);
2838
2929
  }
2839
2930
  });
2840
- var mcpCommand = defineCommand18({
2931
+ var mcpCommand = defineCommand19({
2841
2932
  meta: { name: "mcp", description: "Manage MCP servers" },
2842
2933
  subCommands: {
2843
2934
  add: addCmd2,
@@ -2851,10 +2942,10 @@ var mcpCommand = defineCommand18({
2851
2942
  });
2852
2943
 
2853
2944
  // src/commands/memory.ts
2854
- import { defineCommand as defineCommand19 } from "citty";
2945
+ import { defineCommand as defineCommand20 } from "citty";
2855
2946
  var keyArg = positional("Memory key (path under memory/, ending in .md)");
2856
2947
  var entryPath = (team, key) => apiPath("teams", team, "memory", ...key.split("/"));
2857
- var writeCmd = defineCommand19({
2948
+ var writeCmd = defineCommand20({
2858
2949
  meta: { name: "write", description: "Write an entry into a team's shared memory" },
2859
2950
  args: { team: teamArg, key: keyArg, content: positional("Content to write") },
2860
2951
  async run({ args }) {
@@ -2864,7 +2955,7 @@ var writeCmd = defineCommand19({
2864
2955
  console.log(`wrote ${entry2.key} (${entry2.content.length} bytes)`);
2865
2956
  }
2866
2957
  });
2867
- var readCmd2 = defineCommand19({
2958
+ var readCmd2 = defineCommand20({
2868
2959
  meta: { name: "read", description: "Read an entry from a team's shared memory" },
2869
2960
  args: { team: teamArg, key: keyArg },
2870
2961
  async run({ args }) {
@@ -2872,7 +2963,7 @@ var readCmd2 = defineCommand19({
2872
2963
  console.log(entry2.content);
2873
2964
  }
2874
2965
  });
2875
- var searchCmd = defineCommand19({
2966
+ var searchCmd = defineCommand20({
2876
2967
  meta: { name: "search", description: "Search a team's shared memory" },
2877
2968
  args: {
2878
2969
  team: teamArg,
@@ -2894,7 +2985,7 @@ var searchCmd = defineCommand19({
2894
2985
  }
2895
2986
  }
2896
2987
  });
2897
- var listCmd5 = defineCommand19({
2988
+ var listCmd5 = defineCommand20({
2898
2989
  meta: { name: "list", description: "List all entries in a team's shared memory" },
2899
2990
  args: { team: teamArg },
2900
2991
  async run({ args }) {
@@ -2908,7 +2999,7 @@ var listCmd5 = defineCommand19({
2908
2999
  }
2909
3000
  }
2910
3001
  });
2911
- var rmCmd4 = defineCommand19({
3002
+ var rmCmd4 = defineCommand20({
2912
3003
  meta: { name: "rm", description: "Remove an entry from a team's shared memory" },
2913
3004
  args: { team: teamArg, key: keyArg },
2914
3005
  async run({ args }) {
@@ -2916,7 +3007,7 @@ var rmCmd4 = defineCommand19({
2916
3007
  console.log(`removed ${args.key}`);
2917
3008
  }
2918
3009
  });
2919
- var memoryCommand = defineCommand19({
3010
+ var memoryCommand = defineCommand20({
2920
3011
  meta: {
2921
3012
  name: "memory",
2922
3013
  description: "Manage a team's shared memory (BM25-indexed markdown notes)"
@@ -2931,7 +3022,7 @@ var memoryCommand = defineCommand19({
2931
3022
  });
2932
3023
 
2933
3024
  // src/commands/notification.ts
2934
- import { defineCommand as defineCommand20 } from "citty";
3025
+ import { defineCommand as defineCommand21 } from "citty";
2935
3026
  function print(settings2, json) {
2936
3027
  if (json) {
2937
3028
  printJson(settings2);
@@ -2944,14 +3035,14 @@ function print(settings2, json) {
2944
3035
  if (!settings2.telegramReady)
2945
3036
  console.log("telegram: not connected \u2014 notices go out once the bot runs");
2946
3037
  }
2947
- var settings = defineCommand20({
3038
+ var settings = defineCommand21({
2948
3039
  meta: { name: "settings", description: "Show the Telegram attention notification settings" },
2949
3040
  args: { json: jsonFlag },
2950
3041
  async run({ args }) {
2951
3042
  print(await createClient2().notifications.settings(), args.json);
2952
3043
  }
2953
3044
  });
2954
- var configure = defineCommand20({
3045
+ var configure = defineCommand21({
2955
3046
  meta: {
2956
3047
  name: "configure",
2957
3048
  description: "Change the settings; options left out keep their current value"
@@ -2983,7 +3074,7 @@ var configure = defineCommand20({
2983
3074
  print(updated, args.json);
2984
3075
  }
2985
3076
  });
2986
- var notificationCommand = defineCommand20({
3077
+ var notificationCommand = defineCommand21({
2987
3078
  meta: {
2988
3079
  name: "notification",
2989
3080
  description: "Send new Attention items to the Telegram service topic"
@@ -3019,7 +3110,7 @@ var PROFILE_FILES = [
3019
3110
  ];
3020
3111
 
3021
3112
  // src/commands/profile.ts
3022
- import { defineCommand as defineCommand21 } from "citty";
3113
+ import { defineCommand as defineCommand22 } from "citty";
3023
3114
  var profileArg = positional("Profile id");
3024
3115
  function splitCsv(v) {
3025
3116
  if (!v) return void 0;
@@ -3031,7 +3122,7 @@ function parseSkillsMode(v) {
3031
3122
  if (v === "all" || v === "selected") return v;
3032
3123
  throw new Error(`--skills-mode must be 'all' or 'selected', got '${v}'`);
3033
3124
  }
3034
- var createCmd2 = defineCommand21({
3125
+ var createCmd2 = defineCommand22({
3035
3126
  meta: { name: "create", description: "Create a new profile" },
3036
3127
  args: {
3037
3128
  id: positional("Profile slug"),
@@ -3095,7 +3186,7 @@ var createCmd2 = defineCommand21({
3095
3186
  console.log(`created profile ${profile.id} at ${profile.dir}`);
3096
3187
  }
3097
3188
  });
3098
- var listCmd6 = defineCommand21({
3189
+ var listCmd6 = defineCommand22({
3099
3190
  meta: { name: "list", description: "List profiles" },
3100
3191
  async run() {
3101
3192
  const list7 = await createClient2().get("/api/profiles");
@@ -3105,7 +3196,7 @@ var listCmd6 = defineCommand21({
3105
3196
  );
3106
3197
  }
3107
3198
  });
3108
- var showCmd4 = defineCommand21({
3199
+ var showCmd4 = defineCommand22({
3109
3200
  meta: { name: "show", description: "Show profile details" },
3110
3201
  args: { id: profileArg },
3111
3202
  async run({ args }) {
@@ -3127,7 +3218,7 @@ var showCmd4 = defineCommand21({
3127
3218
  }
3128
3219
  }
3129
3220
  });
3130
- var editCmd2 = defineCommand21({
3221
+ var editCmd2 = defineCommand22({
3131
3222
  meta: { name: "edit", description: "Open a profile file in $EDITOR" },
3132
3223
  args: {
3133
3224
  id: profileArg,
@@ -3168,7 +3259,7 @@ var editCmd2 = defineCommand21({
3168
3259
  }
3169
3260
  }
3170
3261
  });
3171
- var updateCmd = defineCommand21({
3262
+ var updateCmd = defineCommand22({
3172
3263
  meta: {
3173
3264
  name: "update",
3174
3265
  description: "Update profile settings (name, model, skills-mode, skills)"
@@ -3199,7 +3290,7 @@ var updateCmd = defineCommand21({
3199
3290
  console.log(`updated profile ${profile.id}`);
3200
3291
  }
3201
3292
  });
3202
- var deleteCmd2 = defineCommand21({
3293
+ var deleteCmd2 = defineCommand22({
3203
3294
  meta: { name: "delete", description: "Permanently delete a profile and its files" },
3204
3295
  args: { id: profileArg },
3205
3296
  async run({ args }) {
@@ -3207,7 +3298,7 @@ var deleteCmd2 = defineCommand21({
3207
3298
  console.log(`deleted profile ${args.id}`);
3208
3299
  }
3209
3300
  });
3210
- var profileCommand = defineCommand21({
3301
+ var profileCommand = defineCommand22({
3211
3302
  meta: { name: "profile", description: "Manage profiles" },
3212
3303
  subCommands: {
3213
3304
  create: createCmd2,
@@ -3220,61 +3311,204 @@ var profileCommand = defineCommand21({
3220
3311
  });
3221
3312
 
3222
3313
  // src/commands/provider.ts
3223
- import { defineCommand as defineCommand22 } from "citty";
3314
+ import { defineCommand as defineCommand23 } from "citty";
3224
3315
  var providerArg = positional("Provider id (e.g. anthropic)");
3225
- var listCmd7 = defineCommand22({
3316
+ var STATE = {
3317
+ working: "working",
3318
+ failing: "failing",
3319
+ untested: "not tested",
3320
+ incomplete: "needs credentials",
3321
+ off: "off"
3322
+ };
3323
+ async function loadProvider(client, id) {
3324
+ const { providers } = await client.get("/api/config/providers");
3325
+ const provider = providers.find((entry2) => entry2.id === id);
3326
+ if (!provider) throw new Error(`unknown provider: ${id} (see: bazilion provider list --all)`);
3327
+ return provider;
3328
+ }
3329
+ function checkLine2(check) {
3330
+ const when = new Date(check.at).toISOString().replace(/\.\d+Z$/, "Z");
3331
+ return check.ok ? `${check.model} answered in ${((check.ms ?? 0) / 1e3).toFixed(1)} s (${when})` : `${check.failure?.title ?? "failed"} (${when})`;
3332
+ }
3333
+ function printFailure(failure2) {
3334
+ console.error(failure2.title);
3335
+ console.error(failure2.hint);
3336
+ if (failure2.detail) console.error(`details: ${failure2.detail}`);
3337
+ }
3338
+ var listCmd7 = defineCommand23({
3226
3339
  meta: {
3227
3340
  name: "list",
3228
- description: "List all providers with enabled/disabled state and curated model counts"
3341
+ description: "List the providers in use with their state; --all lists every provider"
3229
3342
  },
3230
3343
  args: {
3231
- enabled: { type: "boolean", description: "Show only enabled providers" }
3344
+ all: { type: "boolean", description: "Also list providers that are not set up" },
3345
+ enabled: { type: "boolean", description: "Show only providers that are switched on" }
3232
3346
  },
3233
3347
  async run({ args }) {
3234
3348
  const { providers } = await createClient2().get("/api/config/providers");
3235
3349
  printRows(
3236
- providers.filter((p) => !args.enabled || p.enabled).map((p) => [
3350
+ providers.filter((p) => args.enabled ? p.enabled : args.all || p.listed).map((p) => [
3237
3351
  p.id,
3238
- p.enabled ? "enabled" : "disabled",
3239
- `${p.curated.length} curated`,
3240
- `${p.catalog.length} catalog`
3352
+ p.listed ? STATE[p.state] : "not set up",
3353
+ p.models.length === 1 ? "1 model" : `${p.models.length} models`,
3354
+ p.check ? checkLine2(p.check) : ""
3241
3355
  ]),
3242
- "(no providers to show)"
3356
+ args.all ? "(no providers to show)" : "(no provider is set up: bazilion provider connect <id>, or list them all with --all)"
3357
+ );
3358
+ }
3359
+ });
3360
+ var connectCmd = defineCommand23({
3361
+ meta: {
3362
+ name: "connect",
3363
+ description: "Connect a provider in one step: save its key or address, choose models, test, switch on"
3364
+ },
3365
+ args: {
3366
+ name: providerArg,
3367
+ key: {
3368
+ type: "string",
3369
+ description: "API key or access token (asked for, without echo, when left out)"
3370
+ },
3371
+ url: { type: "string", description: "Address of a local model server" },
3372
+ set: {
3373
+ type: "string",
3374
+ description: "Another setting of the provider as NAME=value (repeatable)"
3375
+ },
3376
+ models: {
3377
+ type: "string",
3378
+ description: "Comma-separated chat models (default: the suggested ones)"
3379
+ },
3380
+ test: {
3381
+ type: "boolean",
3382
+ default: true,
3383
+ description: "Ask a model for a short reply before saving anything (--no-test skips it)"
3384
+ }
3385
+ },
3386
+ async run({ args, rawArgs }) {
3387
+ const client = createClient2();
3388
+ const provider = await loadProvider(client, args.name);
3389
+ const fields = {};
3390
+ for (const pair of collectFlagValues(rawArgs, "set")) {
3391
+ const at = pair.indexOf("=");
3392
+ if (at <= 0) throw new Error(`--set takes NAME=value, got "${pair}"`);
3393
+ fields[pair.slice(0, at)] = pair.slice(at + 1);
3394
+ }
3395
+ const main2 = provider.fields.filter((field) => !field.advanced);
3396
+ const secret = main2.find((field) => field.kind === "secret");
3397
+ const address = main2.find((field) => field.kind === "config");
3398
+ if (args.url) {
3399
+ if (provider.connect !== "local" || !address) {
3400
+ throw new Error(`--url is for local model servers; ${provider.id} takes --key or --set`);
3401
+ }
3402
+ fields[address.envVar] = args.url;
3403
+ }
3404
+ if (args.key) {
3405
+ const target = secret ?? provider.fields.find((field) => field.kind === "secret");
3406
+ if (!target) throw new Error(`${provider.id} takes no key`);
3407
+ fields[target.envVar] = args.key;
3408
+ } else if (secret && !provider.configured && !(secret.envVar in fields)) {
3409
+ const typed = await askSecret(`${provider.displayName} ${secret.label}: `);
3410
+ if (!typed) throw new Error("no key given");
3411
+ fields[secret.envVar] = typed;
3412
+ }
3413
+ const models = args.models?.split(",").map((model) => model.trim()).filter(Boolean);
3414
+ if (!models && provider.models.length === 0 && provider.suggested.length === 0) {
3415
+ if (provider.connect !== "local") {
3416
+ throw new Error(
3417
+ `choose chat models with --models (see: bazilion provider models ${provider.id})`
3418
+ );
3419
+ }
3420
+ }
3421
+ let chosen = models;
3422
+ if (!chosen && provider.connect === "local" && provider.models.length === 0) {
3423
+ const catalog = await client.post(
3424
+ apiPath("config", "providers", provider.id, "catalog"),
3425
+ { fields }
3426
+ );
3427
+ chosen = catalog.models.filter((model) => model.suggested).map((model) => model.id);
3428
+ }
3429
+ const body = {
3430
+ ...Object.keys(fields).length > 0 ? { fields } : {},
3431
+ ...chosen ? { models: chosen } : {},
3432
+ ...args.test ? {} : { test: false }
3433
+ };
3434
+ const result = await client.post(
3435
+ apiPath("config", "providers", provider.id, "connect"),
3436
+ body
3437
+ );
3438
+ if (!result.connected) {
3439
+ printFailure(result.failure);
3440
+ console.error("Nothing was saved.");
3441
+ process.exitCode = 1;
3442
+ return;
3443
+ }
3444
+ console.log(`${result.provider.id}: connected`);
3445
+ if (result.check) console.log(` ${checkLine2(result.check)}`);
3446
+ else console.log(" not tested");
3447
+ console.log(` models: ${result.provider.models.join(", ") || "(none)"}`);
3448
+ for (const dropped of result.dropped) console.log(` left out: ${dropped.model}`);
3449
+ for (const t of result.movedTemplates) console.log(` template ${t.id} now uses ${t.model}`);
3450
+ }
3451
+ });
3452
+ var disconnectCmd = defineCommand23({
3453
+ meta: {
3454
+ name: "disconnect",
3455
+ description: "Forget a provider: its stored key or sign-in, its chat models and its test"
3456
+ },
3457
+ args: {
3458
+ name: providerArg,
3459
+ yes: { type: "boolean", description: "Do not ask for confirmation" }
3460
+ },
3461
+ async run({ args }) {
3462
+ const client = createClient2();
3463
+ const provider = await loadProvider(client, args.name);
3464
+ if (!args.yes && !await confirm(`Disconnect ${provider.displayName} and remove its stored credentials?`)) {
3465
+ console.log("cancelled");
3466
+ return;
3467
+ }
3468
+ const result = await client.del(
3469
+ apiPath("config", "providers", provider.id)
3243
3470
  );
3471
+ console.log(`${provider.id}: disconnected`);
3472
+ for (const t of result.movedTemplates) console.log(`template ${t.id} now uses ${t.model}`);
3244
3473
  }
3245
3474
  });
3246
- var modelsCmd = defineCommand22({
3475
+ var modelsCmd = defineCommand23({
3247
3476
  meta: {
3248
3477
  name: "models",
3249
- description: "Show curated + catalog + live models for one provider"
3478
+ description: "Show a provider\u2019s chat models: the ones Agents may use, and what it offers"
3250
3479
  },
3251
3480
  args: { name: providerArg },
3252
3481
  async run({ args }) {
3253
- const { providers } = await createClient2().get("/api/config/providers");
3254
- const p = providers.find((x) => x.id === args.name);
3255
- if (!p) throw new Error(`unknown provider: ${args.name}`);
3256
- console.log(`# ${p.id} (${p.enabled ? "enabled" : "disabled"})`);
3482
+ const client = createClient2();
3483
+ const p = await loadProvider(client, args.name);
3484
+ const catalog = await client.get(
3485
+ apiPath("config", "providers", p.id, "catalog")
3486
+ );
3487
+ console.log(`# ${p.id} (${p.listed ? STATE[p.state] : "not set up"})`);
3257
3488
  if (p.hint) console.log(` ${p.hint}`);
3258
3489
  for (const field of p.fields) console.log(` ${field.envVar}: ${field.set ? "set" : "unset"}`);
3259
- if (!p.enabled) console.log(` (enable with \`bazilion provider enable ${p.id}\`)`);
3260
- console.log("\n## curated");
3261
- if (p.curated.length === 0) console.log(" (none \u2014 use `provider models-set` to pin some)");
3262
- else for (const m of p.curated) console.log(` ${m}`);
3263
- console.log("\n## catalog (from pi-ai)");
3264
- if (p.catalog.length === 0) console.log(" (empty)");
3265
- else for (const m of p.catalog) console.log(` ${m}`);
3266
- if (p.live) {
3267
- console.log("\n## live (from upstream /v1/models)");
3268
- if (p.live.error) console.log(` (error: ${p.live.error})`);
3269
- else if (p.live.models.length === 0) console.log(" (empty)");
3270
- else for (const m of p.live.models) console.log(` ${m}`);
3271
- }
3272
- }
3273
- });
3274
- var modelsSetCmd = defineCommand22({
3490
+ if (!p.enabled) console.log(` (connect with \`bazilion provider connect ${p.id}\`)`);
3491
+ console.log("\n## in use");
3492
+ if (p.models.length === 0) console.log(" (none: `provider connect` or `provider models-set`)");
3493
+ else for (const m of p.models) console.log(` ${m}`);
3494
+ console.log("\n## offered");
3495
+ if (catalog.listError) console.log(` (the provider's own list failed: ${catalog.listError})`);
3496
+ printRows(
3497
+ catalog.models.map((model) => [
3498
+ ` ${model.id}`,
3499
+ model.name ?? "",
3500
+ model.contextWindow ? `${Math.round(model.contextWindow / 1e3)}K` : "",
3501
+ model.price ? `$${model.price.input} in, $${model.price.output} out per 1M` : "",
3502
+ model.suggested ? "suggested" : ""
3503
+ ]),
3504
+ " (nothing listed)"
3505
+ );
3506
+ }
3507
+ });
3508
+ var modelsSetCmd = defineCommand23({
3275
3509
  meta: {
3276
3510
  name: "models-set",
3277
- description: "Replace the curated model list for a provider (comma-separated)"
3511
+ description: "Replace the chat models Agents may use from a provider (comma-separated)"
3278
3512
  },
3279
3513
  args: {
3280
3514
  name: providerArg,
@@ -3287,66 +3521,79 @@ var modelsSetCmd = defineCommand22({
3287
3521
  apiPath("config", "providers", args.name, "models"),
3288
3522
  body
3289
3523
  );
3290
- console.log(`saved ${saved.models.length} curated model(s) for ${args.name}`);
3524
+ console.log(`saved ${saved.models.length} model(s) for ${args.name}`);
3291
3525
  for (const m of saved.models) console.log(` ${m}`);
3292
3526
  for (const t of saved.movedTemplates) console.log(`template ${t.id} now uses ${t.model}`);
3293
3527
  }
3294
3528
  });
3295
- var enableCmd2 = defineCommand22({
3296
- meta: { name: "enable", description: "Toggle a provider on so agents can use it" },
3529
+ async function setEnabled(name, enabled) {
3530
+ const res = await createClient2().put(
3531
+ apiPath("config", "providers", name, "enabled"),
3532
+ { enabled }
3533
+ );
3534
+ console.log(`${res.name}: ${res.enabled ? "enabled" : "disabled"}`);
3535
+ }
3536
+ var enableCmd2 = defineCommand23({
3537
+ meta: { name: "enable", description: "Switch a connected provider back on" },
3297
3538
  args: { name: providerArg },
3298
- async run({ args }) {
3299
- const res = await createClient2().put(
3300
- apiPath("config", "providers", args.name, "enabled"),
3301
- { enabled: true }
3302
- );
3303
- console.log(`${res.name}: enabled`);
3304
- }
3539
+ run: ({ args }) => setEnabled(args.name, true)
3305
3540
  });
3306
- var disableCmd2 = defineCommand22({
3541
+ var disableCmd2 = defineCommand23({
3307
3542
  meta: {
3308
3543
  name: "disable",
3309
- description: "Toggle a provider off \u2014 agents will refuse its model strings"
3544
+ description: "Pause a provider without removing its key; Agents on its models are refused"
3310
3545
  },
3311
3546
  args: { name: providerArg },
3312
- async run({ args }) {
3313
- const res = await createClient2().put(
3314
- apiPath("config", "providers", args.name, "enabled"),
3315
- { enabled: false }
3316
- );
3317
- console.log(`${res.name}: disabled`);
3318
- }
3547
+ run: ({ args }) => setEnabled(args.name, false)
3319
3548
  });
3320
- var testCmd2 = defineCommand22({
3321
- meta: { name: "test", description: "Send a single chat to a model and print the reply" },
3549
+ var testCmd2 = defineCommand23({
3550
+ meta: {
3551
+ name: "test",
3552
+ description: "Test a provider (its cheapest model in use) or send one chat to a provider:model"
3553
+ },
3322
3554
  args: {
3323
- model: positional("Model string, e.g. anthropic:claude-opus-4-8"),
3324
- message: { type: "string", description: 'Message text (default "say hi briefly")' }
3555
+ model: positional("Provider id, or a model string such as anthropic:claude-haiku-5-5"),
3556
+ message: { type: "string", description: "Message text for a model string" }
3325
3557
  },
3326
3558
  async run({ args }) {
3559
+ const client = createClient2();
3560
+ if (!args.model.includes(":")) {
3561
+ const { check } = await client.post(
3562
+ apiPath("config", "providers", args.model, "test")
3563
+ );
3564
+ if (check.ok) {
3565
+ console.log(`${args.model}: ${checkLine2(check)}`);
3566
+ return;
3567
+ }
3568
+ if (check.failure) printFailure(check.failure);
3569
+ process.exitCode = 1;
3570
+ return;
3571
+ }
3327
3572
  const body = { model: args.model, message: args.message };
3328
3573
  console.log(`-> ${args.model}: ${args.message ?? "say hi briefly"}`);
3329
- const res = await createClient2().post("/api/providers/test", body);
3574
+ const res = await client.post("/api/providers/test", body);
3330
3575
  console.log(`<- ${res.content}`);
3331
3576
  if (res.usage) {
3332
3577
  console.log(`(${res.usage.promptTokens} in, ${res.usage.completionTokens} out)`);
3333
3578
  }
3334
3579
  }
3335
3580
  });
3336
- var providerCommand = defineCommand22({
3337
- meta: { name: "provider", description: "Manage and test LLM providers" },
3581
+ var providerCommand = defineCommand23({
3582
+ meta: { name: "provider", description: "Connect, test and manage LLM providers" },
3338
3583
  subCommands: {
3339
3584
  list: listCmd7,
3340
- enable: enableCmd2,
3341
- disable: disableCmd2,
3585
+ connect: connectCmd,
3586
+ disconnect: disconnectCmd,
3587
+ test: testCmd2,
3342
3588
  models: modelsCmd,
3343
3589
  "models-set": modelsSetCmd,
3344
- test: testCmd2
3590
+ enable: enableCmd2,
3591
+ disable: disableCmd2
3345
3592
  }
3346
3593
  });
3347
3594
 
3348
3595
  // src/commands/question.ts
3349
- import { defineCommand as defineCommand23 } from "citty";
3596
+ import { defineCommand as defineCommand24 } from "citty";
3350
3597
  function questionAnswer(args) {
3351
3598
  const count = Number(args.choice !== void 0) + Number(args.text !== void 0) + Number(args.skip === true);
3352
3599
  if (count !== 1) throw new Error("Specify exactly one of --choice, --text, or --skip");
@@ -3359,10 +3606,10 @@ function questionAnswer(args) {
3359
3606
  if (!/^[1-4]$/.test(args.choice ?? "")) throw new Error("--choice must be a number from 1 to 4");
3360
3607
  return { kind: "choice", index: Number(args.choice) - 1 };
3361
3608
  }
3362
- var questionCommand = defineCommand23({
3609
+ var questionCommand = defineCommand24({
3363
3610
  meta: { name: "question", description: "List and answer an Agent's waiting questions" },
3364
3611
  subCommands: {
3365
- list: defineCommand23({
3612
+ list: defineCommand24({
3366
3613
  meta: { name: "list", description: "Questions the Agent is waiting on" },
3367
3614
  args: { agent: agentArg, json: jsonFlag },
3368
3615
  async run({ args }) {
@@ -3375,7 +3622,7 @@ var questionCommand = defineCommand23({
3375
3622
  }
3376
3623
  }
3377
3624
  }),
3378
- answer: defineCommand23({
3625
+ answer: defineCommand24({
3379
3626
  meta: { name: "answer", description: "Answer a waiting question" },
3380
3627
  args: {
3381
3628
  agent: agentArg,
@@ -3393,9 +3640,9 @@ var questionCommand = defineCommand23({
3393
3640
  });
3394
3641
 
3395
3642
  // src/commands/queue.ts
3396
- import { defineCommand as defineCommand24 } from "citty";
3643
+ import { defineCommand as defineCommand25 } from "citty";
3397
3644
  var itemArg = positional("Follow-up id");
3398
- var list4 = defineCommand24({
3645
+ var list4 = defineCommand25({
3399
3646
  meta: {
3400
3647
  name: "list",
3401
3648
  description: "Show waiting, running and failed follow-ups, and whether a turn is running"
@@ -3405,7 +3652,7 @@ var list4 = defineCommand24({
3405
3652
  printJson(await createClient2().queue(args.agent).list());
3406
3653
  }
3407
3654
  });
3408
- var add = defineCommand24({
3655
+ var add = defineCommand25({
3409
3656
  meta: { name: "add", description: "Queue a follow-up; it runs after the current turn" },
3410
3657
  args: {
3411
3658
  agent: agentArg,
@@ -3419,7 +3666,7 @@ var add = defineCommand24({
3419
3666
  );
3420
3667
  }
3421
3668
  });
3422
- var edit = defineCommand24({
3669
+ var edit = defineCommand25({
3423
3670
  meta: { name: "edit", description: "Replace the text of a waiting follow-up" },
3424
3671
  args: {
3425
3672
  agent: agentArg,
@@ -3430,7 +3677,7 @@ var edit = defineCommand24({
3430
3677
  printJson(await createClient2().queue(args.agent).edit(args.id, args.message));
3431
3678
  }
3432
3679
  });
3433
- var remove = defineCommand24({
3680
+ var remove = defineCommand25({
3434
3681
  meta: { name: "remove", description: "Remove a follow-up that is not running" },
3435
3682
  args: { agent: agentArg, id: itemArg },
3436
3683
  async run({ args }) {
@@ -3438,7 +3685,7 @@ var remove = defineCommand24({
3438
3685
  }
3439
3686
  });
3440
3687
  function control(paused) {
3441
- return defineCommand24({
3688
+ return defineCommand25({
3442
3689
  meta: {
3443
3690
  name: paused ? "pause" : "resume",
3444
3691
  description: paused ? "Start no further follow-ups" : "Start waiting follow-ups again"
@@ -3449,20 +3696,21 @@ function control(paused) {
3449
3696
  }
3450
3697
  });
3451
3698
  }
3452
- var queueCommand = defineCommand24({
3699
+ var queueCommand = defineCommand25({
3453
3700
  meta: { name: "queue", description: "Follow-ups: input that waits for the Agent\u2019s current turn" },
3454
3701
  subCommands: { list: list4, add, edit, remove, pause: control(true), resume: control(false) }
3455
3702
  });
3456
3703
 
3457
3704
  // src/commands/result.ts
3458
3705
  import { closeSync as closeSync2, fsyncSync, openSync as openSync2, unlinkSync, writeFileSync as writeFileSync5 } from "node:fs";
3459
- import { defineCommand as defineCommand25 } from "citty";
3706
+ import { defineCommand as defineCommand26 } from "citty";
3460
3707
  var idArg = positional("Result id");
3461
- var list5 = defineCommand25({
3708
+ var list5 = defineCommand26({
3462
3709
  meta: { name: "list", description: "List saved results" },
3463
3710
  args: {
3464
3711
  team: { type: "string", description: "Only results of this Team" },
3465
3712
  agent: { type: "string", description: "Only results of this Agent" },
3713
+ conversation: { type: "string", description: "Only results delivered in this conversation" },
3466
3714
  limit: { type: "string", default: "50", description: "Page size" },
3467
3715
  offset: { type: "string", default: "0", description: "Results to skip" },
3468
3716
  json: jsonFlag
@@ -3471,6 +3719,7 @@ var list5 = defineCommand25({
3471
3719
  const query = new URLSearchParams({ limit: args.limit, offset: args.offset });
3472
3720
  if (args.team) query.set("teamId", args.team);
3473
3721
  if (args.agent) query.set("agentId", args.agent);
3722
+ if (args.conversation) query.set("sessionId", args.conversation);
3474
3723
  const body = await createClient2().get(`/api/results?${query}`);
3475
3724
  if (args.json) return printJson(body);
3476
3725
  if (!body.results.length) return console.log("(no saved results)");
@@ -3489,7 +3738,7 @@ var list5 = defineCommand25({
3489
3738
  console.log(`${body.offset + 1}\u2013${body.offset + body.results.length} of ${body.total}`);
3490
3739
  }
3491
3740
  });
3492
- var show2 = defineCommand25({
3741
+ var show2 = defineCommand26({
3493
3742
  meta: { name: "show", description: "Show a saved result: who saved it, where and when" },
3494
3743
  args: { id: idArg },
3495
3744
  async run({ args }) {
@@ -3499,7 +3748,7 @@ var show2 = defineCommand25({
3499
3748
  printJson(result);
3500
3749
  }
3501
3750
  });
3502
- var download = defineCommand25({
3751
+ var download = defineCommand26({
3503
3752
  meta: { name: "download", description: "Download a saved result to an explicit new file" },
3504
3753
  args: {
3505
3754
  id: idArg,
@@ -3511,20 +3760,49 @@ var download = defineCommand25({
3511
3760
  },
3512
3761
  async run({ args }) {
3513
3762
  const bytes = await createClient2().binary(apiPath("results", args.id, "download"));
3514
- const fd = openSync2(args.output, "wx", 384);
3515
- try {
3516
- writeFileSync5(fd, bytes);
3517
- fsyncSync(fd);
3518
- } catch (error) {
3519
- closeSync2(fd);
3520
- unlinkSync(args.output);
3521
- throw error;
3522
- }
3763
+ saveNew(args.output, bytes);
3764
+ console.log(`Saved ${bytes.byteLength} bytes to ${args.output}`);
3765
+ }
3766
+ });
3767
+ function saveNew(path, bytes) {
3768
+ const fd = openSync2(path, "wx", 384);
3769
+ try {
3770
+ writeFileSync5(fd, bytes);
3771
+ fsyncSync(fd);
3772
+ } catch (error) {
3523
3773
  closeSync2(fd);
3774
+ unlinkSync(path);
3775
+ throw error;
3776
+ }
3777
+ closeSync2(fd);
3778
+ }
3779
+ var archive = defineCommand26({
3780
+ meta: {
3781
+ name: "archive",
3782
+ description: "Download every saved result of a Team, an Agent or a conversation as one zip"
3783
+ },
3784
+ args: {
3785
+ team: { type: "string", description: "Results of this Team" },
3786
+ agent: { type: "string", description: "Results of this Agent" },
3787
+ conversation: { type: "string", description: "Results delivered in this conversation" },
3788
+ output: {
3789
+ type: "string",
3790
+ required: true,
3791
+ description: "Destination .zip path; existing files are never overwritten"
3792
+ }
3793
+ },
3794
+ async run({ args }) {
3795
+ const query = new URLSearchParams();
3796
+ if (args.team) query.set("teamId", args.team);
3797
+ if (args.agent) query.set("agentId", args.agent);
3798
+ if (args.conversation) query.set("sessionId", args.conversation);
3799
+ if (query.size === 0) throw new Error("Pass --team, --agent or --conversation");
3800
+ const bytes = await createClient2().binary(`/api/results/archive?${query}`);
3801
+ saveNew(args.output, bytes);
3524
3802
  console.log(`Saved ${bytes.byteLength} bytes to ${args.output}`);
3525
3803
  }
3526
3804
  });
3527
- var rm = defineCommand25({
3805
+ var rm = defineCommand26({
3528
3806
  meta: { name: "rm", description: "Delete a saved result" },
3529
3807
  args: { id: idArg, yes: { type: "boolean", description: "Required confirmation" } },
3530
3808
  async run({ args }) {
@@ -3533,19 +3811,20 @@ var rm = defineCommand25({
3533
3811
  console.log("Saved file deleted.");
3534
3812
  }
3535
3813
  });
3536
- var resultCommand = defineCommand25({
3814
+ var resultCommand = defineCommand26({
3537
3815
  meta: { name: "result", description: "Find, download and delete saved Agent results" },
3538
3816
  subCommands: {
3539
3817
  list: list5,
3540
3818
  show: show2,
3541
3819
  download,
3820
+ archive,
3542
3821
  rm
3543
3822
  }
3544
3823
  });
3545
3824
 
3546
3825
  // src/commands/send.ts
3547
- import { defineCommand as defineCommand26 } from "citty";
3548
- var sendCommand = defineCommand26({
3826
+ import { defineCommand as defineCommand27 } from "citty";
3827
+ var sendCommand = defineCommand27({
3549
3828
  meta: {
3550
3829
  name: "send",
3551
3830
  description: "Send a message from one agent to another"
@@ -3568,7 +3847,7 @@ var sendCommand = defineCommand26({
3568
3847
  });
3569
3848
 
3570
3849
  // src/commands/session.ts
3571
- import { defineCommand as defineCommand27 } from "citty";
3850
+ import { defineCommand as defineCommand28 } from "citty";
3572
3851
  function row(session) {
3573
3852
  return [
3574
3853
  session.id,
@@ -3578,14 +3857,14 @@ function row(session) {
3578
3857
  `expires: ${new Date(session.expiresAt).toISOString()}`
3579
3858
  ];
3580
3859
  }
3581
- var listCmd8 = defineCommand27({
3860
+ var listCmd8 = defineCommand28({
3582
3861
  meta: { name: "list", description: "List browser sessions" },
3583
3862
  async run() {
3584
3863
  const { sessions } = await createClient2().get("/api/sessions");
3585
3864
  printRows(sessions.map(row), "(no active browser sessions)");
3586
3865
  }
3587
3866
  });
3588
- var revokeCmd = defineCommand27({
3867
+ var revokeCmd = defineCommand28({
3589
3868
  meta: { name: "revoke", description: "Revoke (delete) one browser session" },
3590
3869
  args: { id: positional("Session id") },
3591
3870
  async run({ args }) {
@@ -3593,7 +3872,7 @@ var revokeCmd = defineCommand27({
3593
3872
  console.log(`revoked browser session ${args.id}`);
3594
3873
  }
3595
3874
  });
3596
- var sessionCommand = defineCommand27({
3875
+ var sessionCommand = defineCommand28({
3597
3876
  meta: { name: "session", description: "Manage browser sessions" },
3598
3877
  subCommands: { list: listCmd8, revoke: revokeCmd }
3599
3878
  });
@@ -3601,7 +3880,7 @@ var sessionCommand = defineCommand27({
3601
3880
  // src/commands/skill.ts
3602
3881
  import { existsSync as existsSync6, readFileSync as readFileSync8, statSync } from "node:fs";
3603
3882
  import { basename as basename4, resolve as resolve3 } from "node:path";
3604
- import { defineCommand as defineCommand28 } from "citty";
3883
+ import { defineCommand as defineCommand29 } from "citty";
3605
3884
  function printFindings(title, findings) {
3606
3885
  const flagged = Object.entries(findings).filter(([, list7]) => list7.length > 0);
3607
3886
  if (flagged.length === 0) return;
@@ -3612,7 +3891,7 @@ function printFindings(title, findings) {
3612
3891
  for (const line of findingLines(list7)) console.log(` ${line}`);
3613
3892
  }
3614
3893
  }
3615
- var listCmd9 = defineCommand28({
3894
+ var listCmd9 = defineCommand29({
3616
3895
  meta: { name: "list", description: "List installed skills (or those attached to an agent)" },
3617
3896
  args: {
3618
3897
  agent: { type: "string", description: "Filter to skills attached to this agent" }
@@ -3642,7 +3921,7 @@ var listCmd9 = defineCommand28({
3642
3921
  );
3643
3922
  }
3644
3923
  });
3645
- var importCmd = defineCommand28({
3924
+ var importCmd = defineCommand29({
3646
3925
  meta: {
3647
3926
  name: "import",
3648
3927
  description: "Import skills from openclaw, a directory, or a local .zip archive"
@@ -3685,7 +3964,7 @@ var importCmd = defineCommand28({
3685
3964
  printFindings("confirmed scan findings:", result.findings ?? {});
3686
3965
  }
3687
3966
  });
3688
- var rmCmd5 = defineCommand28({
3967
+ var rmCmd5 = defineCommand29({
3689
3968
  meta: { name: "rm", description: "Remove an installed skill" },
3690
3969
  args: { name: positional("Skill name") },
3691
3970
  async run({ args }) {
@@ -3693,7 +3972,7 @@ var rmCmd5 = defineCommand28({
3693
3972
  console.log(`removed skill ${args.name}`);
3694
3973
  }
3695
3974
  });
3696
- var skillCommand = defineCommand28({
3975
+ var skillCommand = defineCommand29({
3697
3976
  meta: { name: "skill", description: "Manage the skill library" },
3698
3977
  subCommands: {
3699
3978
  list: listCmd9,
@@ -3705,10 +3984,10 @@ var skillCommand = defineCommand28({
3705
3984
  // src/commands/team.ts
3706
3985
  import { readFileSync as readFileSync9 } from "node:fs";
3707
3986
  import { stdin as stdin2 } from "node:process";
3708
- import { defineCommand as defineCommand32 } from "citty";
3987
+ import { defineCommand as defineCommand34 } from "citty";
3709
3988
 
3710
3989
  // src/commands/team-environment.ts
3711
- import { defineCommand as defineCommand29 } from "citty";
3990
+ import { defineCommand as defineCommand30 } from "citty";
3712
3991
  function print2(status) {
3713
3992
  console.log(
3714
3993
  `sandbox: ${status.sandboxMode}${status.sandboxMode === "off" ? " (defaults unused)" : ""}`
@@ -3716,13 +3995,13 @@ function print2(status) {
3716
3995
  console.log(`image: ${status.image ?? `${status.defaultImage} (installation default)`}`);
3717
3996
  console.log(`cwd: ${status.cwd}`);
3718
3997
  }
3719
- var teamEnvironmentCommand = defineCommand29({
3998
+ var teamEnvironmentCommand = defineCommand30({
3720
3999
  meta: {
3721
4000
  name: "environment",
3722
4001
  description: "A Team's Docker sandbox defaults: local image and working directory"
3723
4002
  },
3724
4003
  subCommands: {
3725
- show: defineCommand29({
4004
+ show: defineCommand30({
3726
4005
  meta: { name: "show", description: "Show a Team's Docker sandbox defaults" },
3727
4006
  args: { team: teamArg, json: jsonFlag },
3728
4007
  async run({ args }) {
@@ -3731,7 +4010,7 @@ var teamEnvironmentCommand = defineCommand29({
3731
4010
  else print2(status);
3732
4011
  }
3733
4012
  }),
3734
- set: defineCommand29({
4013
+ set: defineCommand30({
3735
4014
  meta: { name: "set", description: "Set a Team's Docker sandbox defaults" },
3736
4015
  args: {
3737
4016
  team: teamArg,
@@ -3760,8 +4039,54 @@ var teamEnvironmentCommand = defineCommand29({
3760
4039
  }
3761
4040
  });
3762
4041
 
4042
+ // src/commands/team-messages.ts
4043
+ import { defineCommand as defineCommand31 } from "citty";
4044
+ function decodeText2(payload) {
4045
+ try {
4046
+ const parsed = JSON.parse(payload);
4047
+ if (typeof parsed.text === "string") return parsed.text;
4048
+ } catch {
4049
+ }
4050
+ return payload;
4051
+ }
4052
+ var teamMessagesCommand = defineCommand31({
4053
+ meta: {
4054
+ name: "messages",
4055
+ description: "List the messages the Agents of a Team sent and received, newest first"
4056
+ },
4057
+ args: {
4058
+ id: teamArg,
4059
+ limit: { type: "string", default: "50", description: "Messages to show (at most 500)" },
4060
+ json: jsonFlag
4061
+ },
4062
+ async run({ args }) {
4063
+ const client = createClient2();
4064
+ const [thread, agents] = await Promise.all([
4065
+ client.get(
4066
+ `${apiPath("teams", args.id, "messages")}?limit=${encodeURIComponent(args.limit)}`
4067
+ ),
4068
+ client.get("/api/agents?includeArchived=true")
4069
+ ]);
4070
+ if (args.json) return printJson(thread);
4071
+ const names = new Map(agents.map((agent) => [agent.id, agent.name]));
4072
+ const name = (id) => names.get(id) ?? id.slice(0, 8);
4073
+ printRows(
4074
+ thread.messages.map((message) => {
4075
+ const text = decodeText2(message.payload).replace(/\s+/g, " ").trim();
4076
+ return [
4077
+ new Date(message.createdAt).toISOString(),
4078
+ `${name(message.fromAgentId)} -> ${name(message.toAgentId)}`,
4079
+ message.readAt ? "read" : "NEW",
4080
+ terminalSafe(text.length > 80 ? `${text.slice(0, 80)}\u2026` : text)
4081
+ ];
4082
+ }),
4083
+ "(no messages between Agents yet)"
4084
+ );
4085
+ }
4086
+ });
4087
+
3763
4088
  // src/commands/team-policy.ts
3764
- import { defineCommand as defineCommand30 } from "citty";
4089
+ import { defineCommand as defineCommand32 } from "citty";
3765
4090
  function label(policy, endpoint) {
3766
4091
  if (endpoint === OUTSIDE_TEAM) return "outside";
3767
4092
  return policy.members.find((agent) => agent.id === endpoint)?.name ?? endpoint;
@@ -3779,7 +4104,7 @@ function resolveEndpoint(policy, value) {
3779
4104
  }
3780
4105
  throw new Error(`${value} is not a member of Team ${policy.teamId} (or outside)`);
3781
4106
  }
3782
- var show3 = defineCommand30({
4107
+ var show3 = defineCommand32({
3783
4108
  meta: { name: "show", description: "Show a Team's policy mode, members and allow edges" },
3784
4109
  args: { team: teamArg, json: jsonFlag },
3785
4110
  async run({ args }) {
@@ -3799,7 +4124,7 @@ var show3 = defineCommand30({
3799
4124
  console.log(line);
3800
4125
  }
3801
4126
  });
3802
- var mode = defineCommand30({
4127
+ var mode = defineCommand32({
3803
4128
  meta: {
3804
4129
  name: "mode",
3805
4130
  description: "Set a Team to open (members talk freely) or restricted (allow edges only)"
@@ -3815,7 +4140,7 @@ var mode = defineCommand30({
3815
4140
  }
3816
4141
  });
3817
4142
  function edgeCommand(name) {
3818
- return defineCommand30({
4143
+ return defineCommand32({
3819
4144
  meta: {
3820
4145
  name,
3821
4146
  description: name === "allow" ? "Let one endpoint message another (a member name or id, or outside)" : "Remove an allow edge"
@@ -3845,7 +4170,7 @@ function edgeCommand(name) {
3845
4170
  }
3846
4171
  });
3847
4172
  }
3848
- var teamPolicyCommand = defineCommand30({
4173
+ var teamPolicyCommand = defineCommand32({
3849
4174
  meta: { name: "policy", description: "Who may message whom inside and across a Team" },
3850
4175
  subCommands: {
3851
4176
  show: show3,
@@ -3856,7 +4181,7 @@ var teamPolicyCommand = defineCommand30({
3856
4181
  });
3857
4182
 
3858
4183
  // src/commands/team-review.ts
3859
- import { defineCommand as defineCommand31 } from "citty";
4184
+ import { defineCommand as defineCommand33 } from "citty";
3860
4185
  var base = {
3861
4186
  type: "string",
3862
4187
  description: "Comparison base: branch, tag, commit id or revision such as HEAD~1 (default HEAD)"
@@ -3864,7 +4189,7 @@ var base = {
3864
4189
  function printIssues(changes) {
3865
4190
  for (const issue of changes.issues) console.log(`note: ${issue.code}: ${issue.message}`);
3866
4191
  }
3867
- var showCmd5 = defineCommand31({
4192
+ var showCmd5 = defineCommand33({
3868
4193
  meta: {
3869
4194
  name: "show",
3870
4195
  description: "List changes since a baseline, or print one file diff (read-only)"
@@ -3882,7 +4207,8 @@ var showCmd5 = defineCommand31({
3882
4207
  const client = createClient2();
3883
4208
  const review = await client.repositoryReview(args.id).changes({
3884
4209
  ...args.base ? { base: args.base } : {},
3885
- ...args.patch ? { patches: true, path: args.patch } : args.json ? { patches: true } : {}
4210
+ ...args.patch ? { patches: true, path: args.patch } : args.json ? { patches: true } : {},
4211
+ authors: !args.patch
3886
4212
  });
3887
4213
  if (args.json) return printJson(review);
3888
4214
  const changes = review.changes;
@@ -3907,7 +4233,8 @@ var showCmd5 = defineCommand31({
3907
4233
  change.status,
3908
4234
  change.previousPath ? `${change.previousPath} -> ${change.path}` : change.path,
3909
4235
  change.binary ? "binary" : change.addedLines === null ? "" : `${change.addedLines}+ ${change.deletedLines ?? 0}-`,
3910
- change.contentOmitted ?? ""
4236
+ change.contentOmitted ?? "",
4237
+ review.authors?.[change.path] ? `by ${review.authors[change.path]?.agentName}` : ""
3911
4238
  ]),
3912
4239
  "(no changes since baseline)"
3913
4240
  );
@@ -3921,31 +4248,44 @@ var showCmd5 = defineCommand31({
3921
4248
  printIssues(changes);
3922
4249
  }
3923
4250
  });
3924
- var feedbackCmd = defineCommand31({
4251
+ var feedbackCmd = defineCommand33({
3925
4252
  meta: {
3926
4253
  name: "feedback",
3927
- description: "Queue feedback about one changed file for an Agent (file, diff excerpt, note)"
4254
+ description: "Queue a comment about a changed file, or one of its lines, for an Agent (diff excerpt, note)"
3928
4255
  },
3929
4256
  args: {
3930
4257
  id: teamArg,
3931
4258
  path: { type: "string", required: true, description: "Changed path the feedback is about" },
3932
4259
  agent: { type: "string", required: true, description: "Team member to send it to" },
3933
4260
  note: { type: "string", description: "Your comment" },
4261
+ line: {
4262
+ type: "string",
4263
+ description: "Line of the file as it is now; the diff around it is sent instead of the top"
4264
+ },
3934
4265
  base
3935
4266
  },
3936
4267
  async run({ args }) {
3937
4268
  const client = createClient2();
4269
+ const line = args.line === void 0 ? void 0 : Number(args.line);
4270
+ if (line !== void 0 && (!Number.isSafeInteger(line) || line < 1)) {
4271
+ throw new Error("--line must be a line number starting at 1");
4272
+ }
3938
4273
  const queued = await client.repositoryReview(args.id).feedback({
3939
- path: args.path,
3940
4274
  agentId: args.agent,
3941
- ...args.note ? { note: args.note } : {},
4275
+ comments: [
4276
+ {
4277
+ path: args.path,
4278
+ ...line === void 0 ? {} : { line },
4279
+ ...args.note ? { note: args.note } : {}
4280
+ }
4281
+ ],
3942
4282
  ...args.base ? { base: args.base } : {}
3943
4283
  });
3944
4284
  console.log(`queued ${queued.item.id} for ${args.agent} (${queued.item.status})`);
3945
4285
  console.log(queued.message);
3946
4286
  }
3947
4287
  });
3948
- var teamReviewCommand = defineCommand31({
4288
+ var teamReviewCommand = defineCommand33({
3949
4289
  meta: {
3950
4290
  name: "review",
3951
4291
  description: "Git change review: changes since a base, diffs, and file feedback"
@@ -3957,7 +4297,7 @@ var teamReviewCommand = defineCommand31({
3957
4297
  });
3958
4298
 
3959
4299
  // src/commands/team.ts
3960
- var addCmd3 = defineCommand32({
4300
+ var addCmd3 = defineCommand34({
3961
4301
  meta: {
3962
4302
  name: "add",
3963
4303
  description: "Register a team at ~/.bazilion/teams/<slug>/ (use --link to point at an existing tree)"
@@ -3980,7 +4320,7 @@ var addCmd3 = defineCommand32({
3980
4320
  console.log(`registered team ${team.id} at ${team.path}`);
3981
4321
  }
3982
4322
  });
3983
- var listCmd10 = defineCommand32({
4323
+ var listCmd10 = defineCommand34({
3984
4324
  meta: { name: "list", description: "List teams" },
3985
4325
  async run() {
3986
4326
  const list7 = await createClient2().get("/api/teams");
@@ -3990,7 +4330,7 @@ var listCmd10 = defineCommand32({
3990
4330
  );
3991
4331
  }
3992
4332
  });
3993
- var rmCmd6 = defineCommand32({
4333
+ var rmCmd6 = defineCommand34({
3994
4334
  meta: {
3995
4335
  name: "rm",
3996
4336
  description: "Delete an empty team and its workspace directory (a --link target is kept)"
@@ -4006,7 +4346,7 @@ async function readStdin() {
4006
4346
  for await (const chunk of stdin2) chunks.push(chunk);
4007
4347
  return Buffer.concat(chunks).toString("utf8");
4008
4348
  }
4009
- var userMdShowCmd = defineCommand32({
4349
+ var userMdShowCmd = defineCommand34({
4010
4350
  meta: { name: "show", description: "Print the team's USER.md" },
4011
4351
  args: { id: teamArg },
4012
4352
  async run({ args }) {
@@ -4015,7 +4355,7 @@ var userMdShowCmd = defineCommand32({
4015
4355
  if (team.userMd && !team.userMd.endsWith("\n")) process.stdout.write("\n");
4016
4356
  }
4017
4357
  });
4018
- var userMdSetCmd = defineCommand32({
4358
+ var userMdSetCmd = defineCommand34({
4019
4359
  meta: {
4020
4360
  name: "set",
4021
4361
  description: "Replace the team's USER.md (from --file, --from-stdin, or inline text)"
@@ -4037,7 +4377,7 @@ var userMdSetCmd = defineCommand32({
4037
4377
  console.log(`updated USER.md for team ${args.id} (${content.length} bytes)`);
4038
4378
  }
4039
4379
  });
4040
- var userMdClearCmd = defineCommand32({
4380
+ var userMdClearCmd = defineCommand34({
4041
4381
  meta: { name: "clear", description: "Clear the team's USER.md to empty" },
4042
4382
  args: { id: teamArg },
4043
4383
  async run({ args }) {
@@ -4046,7 +4386,7 @@ var userMdClearCmd = defineCommand32({
4046
4386
  console.log(`cleared USER.md for team ${args.id}`);
4047
4387
  }
4048
4388
  });
4049
- var userMdCmd = defineCommand32({
4389
+ var userMdCmd = defineCommand34({
4050
4390
  meta: { name: "user-md", description: "View or edit a team's USER.md" },
4051
4391
  subCommands: {
4052
4392
  show: userMdShowCmd,
@@ -4054,7 +4394,7 @@ var userMdCmd = defineCommand32({
4054
4394
  clear: userMdClearCmd
4055
4395
  }
4056
4396
  });
4057
- var topicFormatShowCmd = defineCommand32({
4397
+ var topicFormatShowCmd = defineCommand34({
4058
4398
  meta: { name: "show", description: "Print the team's Telegram topic-name template" },
4059
4399
  args: { id: teamArg },
4060
4400
  async run({ args }) {
@@ -4062,7 +4402,7 @@ var topicFormatShowCmd = defineCommand32({
4062
4402
  console.log(team.telegramTopicNameFormat ?? "(default naming)");
4063
4403
  }
4064
4404
  });
4065
- var topicFormatSetCmd = defineCommand32({
4405
+ var topicFormatSetCmd = defineCommand34({
4066
4406
  meta: {
4067
4407
  name: "set",
4068
4408
  description: "Set the topic-name template. Tokens: {agent.name} {team.name} {team.slug} (must include {agent.name})"
@@ -4081,7 +4421,7 @@ var topicFormatSetCmd = defineCommand32({
4081
4421
  console.log(`set topic-name template for team ${args.id}: ${team.telegramTopicNameFormat}`);
4082
4422
  }
4083
4423
  });
4084
- var topicFormatClearCmd = defineCommand32({
4424
+ var topicFormatClearCmd = defineCommand34({
4085
4425
  meta: { name: "clear", description: "Clear the template (revert to built-in naming)" },
4086
4426
  args: { id: teamArg },
4087
4427
  async run({ args }) {
@@ -4090,7 +4430,7 @@ var topicFormatClearCmd = defineCommand32({
4090
4430
  console.log(`cleared topic-name template for team ${args.id}`);
4091
4431
  }
4092
4432
  });
4093
- var topicFormatCmd = defineCommand32({
4433
+ var topicFormatCmd = defineCommand34({
4094
4434
  meta: {
4095
4435
  name: "topic-format",
4096
4436
  description: "View or edit a team's Telegram forum-topic name template"
@@ -4101,11 +4441,12 @@ var topicFormatCmd = defineCommand32({
4101
4441
  clear: topicFormatClearCmd
4102
4442
  }
4103
4443
  });
4104
- var teamCommand = defineCommand32({
4444
+ var teamCommand = defineCommand34({
4105
4445
  meta: { name: "team", description: "Manage teams (collaboration contexts)" },
4106
4446
  subCommands: {
4107
4447
  environment: teamEnvironmentCommand,
4108
4448
  review: teamReviewCommand,
4449
+ messages: teamMessagesCommand,
4109
4450
  add: addCmd3,
4110
4451
  list: listCmd10,
4111
4452
  rm: rmCmd6,
@@ -4117,7 +4458,7 @@ var teamCommand = defineCommand32({
4117
4458
 
4118
4459
  // src/commands/team-template.ts
4119
4460
  import { readFileSync as readFileSync10 } from "node:fs";
4120
- import { defineCommand as defineCommand33 } from "citty";
4461
+ import { defineCommand as defineCommand35 } from "citty";
4121
4462
  var templateArg = positional("Template id");
4122
4463
  function endpointLabel(template, end) {
4123
4464
  return end === "outside" ? "outside" : `${end}:${template.slots[end]?.agentName ?? "?"}`;
@@ -4161,7 +4502,7 @@ function document(template) {
4161
4502
  edges: template.edges
4162
4503
  };
4163
4504
  }
4164
- var list6 = defineCommand33({
4505
+ var list6 = defineCommand35({
4165
4506
  meta: { name: "list", description: "List Team templates" },
4166
4507
  args: { json: jsonFlag },
4167
4508
  async run({ args }) {
@@ -4175,7 +4516,7 @@ var list6 = defineCommand33({
4175
4516
  console.log(line);
4176
4517
  }
4177
4518
  });
4178
- var show4 = defineCommand33({
4519
+ var show4 = defineCommand35({
4179
4520
  meta: { name: "show", description: "Show a Team template" },
4180
4521
  args: { id: templateArg, json: jsonFlag },
4181
4522
  async run({ args }) {
@@ -4184,7 +4525,7 @@ var show4 = defineCommand33({
4184
4525
  else printTemplate(template);
4185
4526
  }
4186
4527
  });
4187
- var create = defineCommand33({
4528
+ var create = defineCommand35({
4188
4529
  meta: { name: "create", description: "Create an empty Team template" },
4189
4530
  args: {
4190
4531
  id: positional("Template slug"),
@@ -4196,7 +4537,7 @@ var create = defineCommand33({
4196
4537
  console.log(`created Team template ${created.id}`);
4197
4538
  }
4198
4539
  });
4199
- var exportCommand = defineCommand33({
4540
+ var exportCommand = defineCommand35({
4200
4541
  meta: { name: "export", description: "Print a Team template as JSON for editing or import" },
4201
4542
  args: { id: templateArg },
4202
4543
  async run({ args }) {
@@ -4204,7 +4545,7 @@ var exportCommand = defineCommand33({
4204
4545
  printJson(document(template));
4205
4546
  }
4206
4547
  });
4207
- var importCommand = defineCommand33({
4548
+ var importCommand = defineCommand35({
4208
4549
  meta: {
4209
4550
  name: "import",
4210
4551
  description: "Create a Team template from JSON, or replace the one with the same id"
@@ -4227,7 +4568,7 @@ var importCommand = defineCommand33({
4227
4568
  );
4228
4569
  }
4229
4570
  });
4230
- var rm2 = defineCommand33({
4571
+ var rm2 = defineCommand35({
4231
4572
  meta: { name: "rm", description: "Delete a Team template (spawned Teams are unaffected)" },
4232
4573
  args: { id: templateArg },
4233
4574
  async run({ args }) {
@@ -4235,7 +4576,7 @@ var rm2 = defineCommand33({
4235
4576
  console.log(`deleted Team template ${args.id}`);
4236
4577
  }
4237
4578
  });
4238
- var spawn4 = defineCommand33({
4579
+ var spawn4 = defineCommand35({
4239
4580
  meta: {
4240
4581
  name: "spawn",
4241
4582
  description: "Spawn one Agent per slot into a Team; an unknown Team slug creates the Team"
@@ -4259,7 +4600,7 @@ var spawn4 = defineCommand33({
4259
4600
  );
4260
4601
  }
4261
4602
  });
4262
- var save = defineCommand33({
4603
+ var save = defineCommand35({
4263
4604
  meta: {
4264
4605
  name: "save",
4265
4606
  description: "Save a live Team's members, edges, mode and USER.md as a new template"
@@ -4278,7 +4619,7 @@ var save = defineCommand33({
4278
4619
  console.log(`saved Team ${args.team} as template ${saved.id} (${saved.slots.length} slots)`);
4279
4620
  }
4280
4621
  });
4281
- var teamTemplateCommand = defineCommand33({
4622
+ var teamTemplateCommand = defineCommand35({
4282
4623
  meta: { name: "team-template", description: "Reusable Team rosters with their allow edges" },
4283
4624
  subCommands: {
4284
4625
  list: list6,
@@ -4293,9 +4634,9 @@ var teamTemplateCommand = defineCommand33({
4293
4634
  });
4294
4635
 
4295
4636
  // src/commands/telegram.ts
4296
- import { defineCommand as defineCommand34 } from "citty";
4637
+ import { defineCommand as defineCommand36 } from "citty";
4297
4638
  var telegramUserArg = positional("Numeric Telegram user id");
4298
- var setCmd2 = defineCommand34({
4639
+ var setCmd2 = defineCommand36({
4299
4640
  meta: {
4300
4641
  name: "set",
4301
4642
  description: "Save bot token + supergroup chat ID (paired write)"
@@ -4313,7 +4654,7 @@ var setCmd2 = defineCommand34({
4313
4654
  console.log(`saved \xB7 token ${state.botTokenPreview} \xB7 chat ${state.chatId}`);
4314
4655
  }
4315
4656
  });
4316
- var clearCmd = defineCommand34({
4657
+ var clearCmd = defineCommand36({
4317
4658
  meta: {
4318
4659
  name: "clear",
4319
4660
  description: "Remove stored bot token + chat ID"
@@ -4324,7 +4665,7 @@ var clearCmd = defineCommand34({
4324
4665
  console.log("cleared");
4325
4666
  }
4326
4667
  });
4327
- var showCmd6 = defineCommand34({
4668
+ var showCmd6 = defineCommand36({
4328
4669
  meta: {
4329
4670
  name: "show",
4330
4671
  description: "Show what credentials are stored (token is masked)"
@@ -4345,7 +4686,7 @@ var showCmd6 = defineCommand34({
4345
4686
  }
4346
4687
  }
4347
4688
  });
4348
- var reconnectCmd = defineCommand34({
4689
+ var reconnectCmd = defineCommand36({
4349
4690
  meta: {
4350
4691
  name: "reconnect",
4351
4692
  description: "Apply a pending supergroup chat-id migration + re-activate the bot"
@@ -4356,7 +4697,7 @@ var reconnectCmd = defineCommand34({
4356
4697
  console.log(`reconnected \xB7 chat ${state.chatId}`);
4357
4698
  }
4358
4699
  });
4359
- var configCmd = defineCommand34({
4700
+ var configCmd = defineCommand36({
4360
4701
  meta: {
4361
4702
  name: "config",
4362
4703
  description: "Manage Telegram credentials (bot token + chat ID)"
@@ -4367,7 +4708,7 @@ var configCmd = defineCommand34({
4367
4708
  show: showCmd6
4368
4709
  }
4369
4710
  });
4370
- var healthCmd = defineCommand34({
4711
+ var healthCmd = defineCommand36({
4371
4712
  meta: {
4372
4713
  name: "health",
4373
4714
  description: "Run the four-step preflight against the Telegram Bot API"
@@ -4397,7 +4738,7 @@ var healthCmd = defineCommand34({
4397
4738
  if (!allOk) process.exitCode = 1;
4398
4739
  }
4399
4740
  });
4400
- var botStatusCmd = defineCommand34({
4741
+ var botStatusCmd = defineCommand36({
4401
4742
  meta: {
4402
4743
  name: "status",
4403
4744
  description: "Show polling state of the live bot"
@@ -4422,7 +4763,7 @@ var botStatusCmd = defineCommand34({
4422
4763
  if (!p.running) process.exitCode = 1;
4423
4764
  }
4424
4765
  });
4425
- var botRestartCmd = defineCommand34({
4766
+ var botRestartCmd = defineCommand36({
4426
4767
  meta: {
4427
4768
  name: "restart",
4428
4769
  description: "Force-restart the bot (tears down + brings up from current creds)"
@@ -4433,7 +4774,7 @@ var botRestartCmd = defineCommand34({
4433
4774
  console.log("restart requested");
4434
4775
  }
4435
4776
  });
4436
- var botCmd = defineCommand34({
4777
+ var botCmd = defineCommand36({
4437
4778
  meta: {
4438
4779
  name: "bot",
4439
4780
  description: "Inspect / control the live polling bot"
@@ -4443,7 +4784,7 @@ var botCmd = defineCommand34({
4443
4784
  restart: botRestartCmd
4444
4785
  }
4445
4786
  });
4446
- var bindCmd = defineCommand34({
4787
+ var bindCmd = defineCommand36({
4447
4788
  meta: {
4448
4789
  name: "bind",
4449
4790
  description: "Create a Telegram topic for an agent (manual fallback for /talk)"
@@ -4458,7 +4799,7 @@ var bindCmd = defineCommand34({
4458
4799
  console.log(` ${result.deepLink}`);
4459
4800
  }
4460
4801
  });
4461
- var unbindCmd = defineCommand34({
4802
+ var unbindCmd = defineCommand36({
4462
4803
  meta: {
4463
4804
  name: "unbind",
4464
4805
  description: "Clear an agent's Telegram topic binding (topic stays in Telegram as orphan)"
@@ -4469,7 +4810,7 @@ var unbindCmd = defineCommand34({
4469
4810
  console.log(`unbound agent ${args.agent}`);
4470
4811
  }
4471
4812
  });
4472
- var listBindingsCmd = defineCommand34({
4813
+ var listBindingsCmd = defineCommand36({
4473
4814
  meta: {
4474
4815
  name: "list",
4475
4816
  description: "List agents and their Telegram topic bindings"
@@ -4497,7 +4838,7 @@ var listBindingsCmd = defineCommand34({
4497
4838
  }
4498
4839
  }
4499
4840
  });
4500
- var allowCmd = defineCommand34({
4841
+ var allowCmd = defineCommand36({
4501
4842
  meta: { name: "allow", description: "Add a Telegram user id to the allowlist" },
4502
4843
  args: {
4503
4844
  userId: telegramUserArg,
@@ -4513,7 +4854,7 @@ var allowCmd = defineCommand34({
4513
4854
  console.log(`allowed ${u.userId} (${u.role})`);
4514
4855
  }
4515
4856
  });
4516
- var denyCmd = defineCommand34({
4857
+ var denyCmd = defineCommand36({
4517
4858
  meta: { name: "deny", description: "Remove a Telegram user id from the allowlist" },
4518
4859
  args: { userId: telegramUserArg },
4519
4860
  async run({ args }) {
@@ -4522,7 +4863,7 @@ var denyCmd = defineCommand34({
4522
4863
  console.log(`removed ${args.userId}`);
4523
4864
  }
4524
4865
  });
4525
- var allowedCmd = defineCommand34({
4866
+ var allowedCmd = defineCommand36({
4526
4867
  meta: { name: "allowed", description: "List allowlisted Telegram users" },
4527
4868
  async run() {
4528
4869
  const client = createClient2();
@@ -4537,7 +4878,7 @@ var allowedCmd = defineCommand34({
4537
4878
  }
4538
4879
  }
4539
4880
  });
4540
- var pairingCreateCmd = defineCommand34({
4881
+ var pairingCreateCmd = defineCommand36({
4541
4882
  meta: { name: "create", description: "Generate a one-time Telegram owner pairing code" },
4542
4883
  async run() {
4543
4884
  const result = await createClient2().post(
@@ -4548,7 +4889,7 @@ var pairingCreateCmd = defineCommand34({
4548
4889
  console.log("send `/pair <code>` in the configured \u2699 bazilion service topic");
4549
4890
  }
4550
4891
  });
4551
- var pairingStatusCmd = defineCommand34({
4892
+ var pairingStatusCmd = defineCommand36({
4552
4893
  meta: { name: "status", description: "Show Telegram owner pairing status" },
4553
4894
  async run() {
4554
4895
  const result = await createClient2().get("/api/config/telegram/pairing");
@@ -4559,14 +4900,14 @@ var pairingStatusCmd = defineCommand34({
4559
4900
  console.log(`expires: ${new Date(result.challengeExpiresAt).toISOString()}`);
4560
4901
  }
4561
4902
  });
4562
- var pairingCancelCmd = defineCommand34({
4903
+ var pairingCancelCmd = defineCommand36({
4563
4904
  meta: { name: "cancel", description: "Cancel the active Telegram pairing code" },
4564
4905
  async run() {
4565
4906
  await createClient2().del("/api/config/telegram/pairing/challenge");
4566
4907
  console.log("pairing challenge cancelled");
4567
4908
  }
4568
4909
  });
4569
- var pairingResetCmd = defineCommand34({
4910
+ var pairingResetCmd = defineCommand36({
4570
4911
  meta: { name: "reset", description: "Revoke the Telegram owner and require re-pairing" },
4571
4912
  args: {
4572
4913
  yes: { type: "boolean", description: "Confirm destructive owner reset", required: true }
@@ -4577,7 +4918,7 @@ var pairingResetCmd = defineCommand34({
4577
4918
  console.log("Telegram owner reset; ingress is closed until re-paired");
4578
4919
  }
4579
4920
  });
4580
- var pairingCmd = defineCommand34({
4921
+ var pairingCmd = defineCommand36({
4581
4922
  meta: { name: "pairing", description: "Manage single-owner Telegram pairing" },
4582
4923
  subCommands: {
4583
4924
  create: pairingCreateCmd,
@@ -4586,7 +4927,7 @@ var pairingCmd = defineCommand34({
4586
4927
  reset: pairingResetCmd
4587
4928
  }
4588
4929
  });
4589
- var telegramCommand = defineCommand34({
4930
+ var telegramCommand = defineCommand36({
4590
4931
  meta: {
4591
4932
  name: "telegram",
4592
4933
  description: "Telegram integration: credentials, health, bot lifecycle, bindings, access"
@@ -4607,7 +4948,7 @@ var telegramCommand = defineCommand34({
4607
4948
  });
4608
4949
 
4609
4950
  // src/commands/token.ts
4610
- import { defineCommand as defineCommand35 } from "citty";
4951
+ import { defineCommand as defineCommand37 } from "citty";
4611
4952
  function tokenRow(t) {
4612
4953
  const last = t.lastUsedAt ? new Date(t.lastUsedAt).toISOString() : "(never)";
4613
4954
  const expired = t.expiresAt !== null && t.expiresAt <= Date.now();
@@ -4615,7 +4956,7 @@ function tokenRow(t) {
4615
4956
  const expires = t.expiresAt ? new Date(t.expiresAt).toISOString() : "(never)";
4616
4957
  return [t.id, t.kind, state, t.label, `expires: ${expires}`, `last: ${last}`];
4617
4958
  }
4618
- var createCmd3 = defineCommand35({
4959
+ var createCmd3 = defineCommand37({
4619
4960
  meta: { name: "create", description: "Mint a new device token with full access (shown once)" },
4620
4961
  args: {
4621
4962
  label: positional("Human-readable label"),
@@ -4643,7 +4984,7 @@ var createCmd3 = defineCommand35({
4643
4984
  console.log("store the token now \u2014 it is not recoverable later.");
4644
4985
  }
4645
4986
  });
4646
- var listCmd11 = defineCommand35({
4987
+ var listCmd11 = defineCommand37({
4647
4988
  meta: { name: "list", description: "List web tokens" },
4648
4989
  args: {
4649
4990
  all: { type: "boolean", description: "Include revoked tokens" }
@@ -4655,7 +4996,7 @@ var listCmd11 = defineCommand35({
4655
4996
  printRows(tokens.map(tokenRow), "(no tokens)");
4656
4997
  }
4657
4998
  });
4658
- var showLocalCmd = defineCommand35({
4999
+ var showLocalCmd = defineCommand37({
4659
5000
  meta: {
4660
5001
  name: "show-local",
4661
5002
  description: "Print the bootstrap web token stored in ~/.bazilion/auth.json"
@@ -4665,7 +5006,7 @@ var showLocalCmd = defineCommand35({
4665
5006
  console.log(readAuthFile(paths.authFile).token);
4666
5007
  }
4667
5008
  });
4668
- var revokeCmd2 = defineCommand35({
5009
+ var revokeCmd2 = defineCommand37({
4669
5010
  meta: { name: "revoke", description: "Revoke a web token and its browser sessions" },
4670
5011
  args: { id: positional("Token id") },
4671
5012
  async run({ args }) {
@@ -4673,7 +5014,7 @@ var revokeCmd2 = defineCommand35({
4673
5014
  console.log(`revoked token ${args.id}`);
4674
5015
  }
4675
5016
  });
4676
- var tokenCommand = defineCommand35({
5017
+ var tokenCommand = defineCommand37({
4677
5018
  meta: { name: "token", description: "Manage web tokens for API/CLI clients" },
4678
5019
  subCommands: {
4679
5020
  create: createCmd3,
@@ -4684,12 +5025,12 @@ var tokenCommand = defineCommand35({
4684
5025
  });
4685
5026
 
4686
5027
  // src/commands/trigger.ts
4687
- import { defineCommand as defineCommand36 } from "citty";
5028
+ import { defineCommand as defineCommand38 } from "citty";
4688
5029
  var triggerArg = positional("Trigger id");
4689
5030
  function spec(t) {
4690
5031
  return t.kind === "interval" ? `every ${t.intervalSec}s` : `cron "${t.cronExpr}"`;
4691
5032
  }
4692
- var addCmd4 = defineCommand36({
5033
+ var addCmd4 = defineCommand38({
4693
5034
  meta: { name: "add", description: "Add an interval / cron trigger to an agent" },
4694
5035
  args: {
4695
5036
  agent: agentArg,
@@ -4736,7 +5077,7 @@ function triggerRow(t) {
4736
5077
  const msgPreview = t.message.length > 60 ? `${t.message.slice(0, 60)}\u2026` : t.message;
4737
5078
  return [t.id, state, spec(t), `last: ${last}`, `"${msgPreview}"`];
4738
5079
  }
4739
- var listCmd12 = defineCommand36({
5080
+ var listCmd12 = defineCommand38({
4740
5081
  meta: { name: "list", description: "List triggers for an agent" },
4741
5082
  args: { agent: agentArg },
4742
5083
  async run({ args }) {
@@ -4746,7 +5087,7 @@ var listCmd12 = defineCommand36({
4746
5087
  printRows(triggers.map(triggerRow), "(no triggers)");
4747
5088
  }
4748
5089
  });
4749
- var rmCmd7 = defineCommand36({
5090
+ var rmCmd7 = defineCommand38({
4750
5091
  meta: { name: "rm", description: "Delete a trigger" },
4751
5092
  args: { id: triggerArg },
4752
5093
  async run({ args }) {
@@ -4754,7 +5095,7 @@ var rmCmd7 = defineCommand36({
4754
5095
  console.log(`removed trigger ${args.id}`);
4755
5096
  }
4756
5097
  });
4757
- var enableCmd3 = defineCommand36({
5098
+ var enableCmd3 = defineCommand38({
4758
5099
  meta: { name: "enable", description: "Enable a trigger" },
4759
5100
  args: { id: triggerArg },
4760
5101
  async run({ args }) {
@@ -4763,7 +5104,7 @@ var enableCmd3 = defineCommand36({
4763
5104
  console.log(`enabled trigger ${args.id}`);
4764
5105
  }
4765
5106
  });
4766
- var disableCmd3 = defineCommand36({
5107
+ var disableCmd3 = defineCommand38({
4767
5108
  meta: { name: "disable", description: "Disable a trigger" },
4768
5109
  args: { id: triggerArg },
4769
5110
  async run({ args }) {
@@ -4772,7 +5113,7 @@ var disableCmd3 = defineCommand36({
4772
5113
  console.log(`disabled trigger ${args.id}`);
4773
5114
  }
4774
5115
  });
4775
- var historyCmd = defineCommand36({
5116
+ var historyCmd = defineCommand38({
4776
5117
  meta: { name: "history", description: "Show recent runs of a trigger" },
4777
5118
  args: {
4778
5119
  id: triggerArg,
@@ -4796,7 +5137,7 @@ var historyCmd = defineCommand36({
4796
5137
  );
4797
5138
  }
4798
5139
  });
4799
- var triggerCommand = defineCommand36({
5140
+ var triggerCommand = defineCommand38({
4800
5141
  meta: { name: "trigger", description: "Manage scheduled agent triggers" },
4801
5142
  subCommands: {
4802
5143
  add: addCmd4,
@@ -4812,7 +5153,7 @@ var triggerCommand = defineCommand36({
4812
5153
  import { existsSync as existsSync7, lstatSync, readdirSync as readdirSync2, rmdirSync, rmSync as rmSync4 } from "node:fs";
4813
5154
  import { homedir as homedir2 } from "node:os";
4814
5155
  import { join as join7 } from "node:path";
4815
- import { defineCommand as defineCommand37 } from "citty";
5156
+ import { defineCommand as defineCommand39 } from "citty";
4816
5157
  var RESET_ENTRIES = [
4817
5158
  "profiles",
4818
5159
  "agents",
@@ -4826,7 +5167,7 @@ var RESET_ENTRIES = [
4826
5167
  "auth.json"
4827
5168
  ];
4828
5169
  var ALL_ENTRIES = [...RESET_ENTRIES, "skills"];
4829
- var uninstallCommand = defineCommand37({
5170
+ var uninstallCommand = defineCommand39({
4830
5171
  meta: {
4831
5172
  name: "uninstall",
4832
5173
  description: "Delete the Bazilion data in ~/.bazilion (or BAZILION_HOME)"
@@ -4883,7 +5224,7 @@ var uninstallCommand = defineCommand37({
4883
5224
 
4884
5225
  // src/index.ts
4885
5226
  var VERSION = package_default.version;
4886
- var main = defineCommand38({
5227
+ var main = defineCommand40({
4887
5228
  meta: {
4888
5229
  name: "bazilion",
4889
5230
  version: VERSION,
@@ -4895,6 +5236,7 @@ var main = defineCommand38({
4895
5236
  team: teamCommand,
4896
5237
  "team-template": teamTemplateCommand,
4897
5238
  agent: agentCommand,
5239
+ activity: activityCommand,
4898
5240
  attention: attentionCommand,
4899
5241
  result: resultCommand,
4900
5242
  conversation: conversationCommand,