bazilion 0.57.1 → 0.58.1

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 (135) hide show
  1. package/dist/cli.js +392 -92
  2. package/dist/cli.js.map +1 -1
  3. package/dist/daemon.js +674 -259
  4. package/dist/daemon.js.map +1 -1
  5. package/dist/web/client/assets/AddProviderDialog-DIxB5CRz.js +1 -0
  6. package/dist/web/client/assets/AgentTemplateParts-B9JD9mno.js +1 -0
  7. package/dist/web/client/assets/ConfirmDialog-D-Qk9p6V.js +1 -0
  8. package/dist/web/client/assets/ConnectionsView-Dfbn7vfB.js +1 -0
  9. package/dist/web/client/assets/SkillsParts-DN_JvpRU.js +1 -0
  10. package/dist/web/client/assets/SpawnTeamModal-Btj3My2v.js +1 -0
  11. package/dist/web/client/assets/TeamForm-BX_68QZQ.js +1 -0
  12. package/dist/web/client/assets/TeamThread-CJXudrt6.js +1 -0
  13. package/dist/web/client/assets/{UnsavedChangesGuard-CYz0AopL.js → UnsavedChangesGuard-B_e5_ck_.js} +1 -1
  14. package/dist/web/client/assets/_id-BJt13p-G.js +1 -0
  15. package/dist/web/client/assets/_id-DoP6Mlct.js +1 -0
  16. package/dist/web/client/assets/{access-BGtASxet.js → access-DnkUj0iM.js} +1 -1
  17. package/dist/web/client/assets/{agents-BAODfMcm.js → agents-CrfF2ZOS.js} +1 -1
  18. package/dist/web/client/assets/agents-Cv07gKT0.js +1 -0
  19. package/dist/web/client/assets/{attention-BIC0TL8d.js → attention-TQpP915m.js} +1 -1
  20. package/dist/web/client/assets/config-CKPln0Ng.js +1 -0
  21. package/dist/web/client/assets/index-Bwz8tnmS.js +14 -0
  22. package/dist/web/client/assets/{login-q9O7dqRe.js → login-C-FCzcQU.js} +1 -1
  23. package/dist/web/client/assets/manage-BSGsiEPw.js +1 -0
  24. package/dist/web/client/assets/mcp-DDw8SGMV.js +1 -0
  25. package/dist/web/client/assets/routes-C5KzZ73E.js +85 -0
  26. package/dist/web/client/assets/shield-alert-CO7P-cbq.js +1 -0
  27. package/dist/web/client/assets/{skills-VEtq-MQJ.js → skills-H_AVE6G7.js} +1 -1
  28. package/dist/web/client/assets/style-HG30duye.js +7 -0
  29. package/dist/web/client/assets/styles-DyFDuWBI.css +2 -0
  30. package/dist/web/client/assets/system-C7vZKVdU.js +1 -0
  31. package/dist/web/client/assets/teams-DcxoMrsV.js +1 -0
  32. package/dist/web/client/assets/teams-Dcy3Wb4u.js +1 -0
  33. package/dist/web/client/assets/telegram-CUw1r_J5.js +1 -0
  34. package/dist/web/client/assets/{tools-C0FIeAL1.js → tools-BNZxmJJk.js} +1 -1
  35. package/dist/web/client/assets/usage-BhqvXWtk.js +1 -0
  36. package/dist/web/client/assets/welcome-4H9Gvu-u.js +1 -0
  37. package/dist/web/server/assets/{AddProviderDialog-CpLDHOcA.js → AddProviderDialog-Bqsz5NaL.js} +1 -1
  38. package/dist/web/server/assets/{AgentTemplateParts-Dh9F_-T_.js → AgentTemplateParts-D97gKNdN.js} +2 -2
  39. package/dist/web/server/assets/{ConfirmDialog-C89B8qKM.js → ConfirmDialog-CuD5HXTw.js} +1 -1
  40. package/dist/web/server/assets/{ConnectionsView-DslcKQmA.js → ConnectionsView-CSf83J-v.js} +32 -10
  41. package/dist/web/server/assets/{Dialog-_Gt_Nt86.js → Dialog-CwAfaXpM.js} +5 -0
  42. package/dist/web/server/assets/{SkillsParts-CqS2B45v.js → SkillsParts-hjS9a_Ht.js} +2 -2
  43. package/dist/web/server/assets/{SpawnDialog-BNKj2Lup.js → SpawnDialog-BjVZl7xK.js} +19 -6
  44. package/dist/web/server/assets/{SpawnTeamModal-zcLxtFOO.js → SpawnTeamModal-BmBXqfFi.js} +7 -7
  45. package/dist/web/server/assets/{TeamForm-XFP0l2TB.js → TeamForm-B4702hBg.js} +2 -2
  46. package/dist/web/server/assets/{TeamThread-gYV_ToRM.js → TeamThread-BGl5z8_I.js} +40 -2
  47. package/dist/web/server/assets/{UnsavedChangesGuard-CB_TugFF.js → UnsavedChangesGuard-Be8EqfV_.js} +1 -1
  48. package/dist/web/server/assets/{_id-D4RFNqaJ.js → _id-BWtcQovD.js} +1 -1
  49. package/dist/web/server/assets/{_id-josYXBx3.js → _id-CKBQM7LH.js} +1 -1
  50. package/dist/web/server/assets/{_id-BTyd2i5U.js → _id-Cf1461pN.js} +1 -1
  51. package/dist/web/server/assets/{_id-517adSuB.js → _id-DBhvSxVl.js} +1 -1
  52. package/dist/web/server/assets/{_id-CyinHJam.js → _id-TT_ZsaSc.js} +6 -6
  53. package/dist/web/server/assets/{_id-BsQnL9LV.js → _id-VqiN2zRR.js} +35 -12
  54. package/dist/web/server/assets/{_tanstack-start-manifest_v-DIMayzEa.js → _tanstack-start-manifest_v-Df5LTm5g.js} +60 -58
  55. package/dist/web/server/assets/{access-BdQmjMJV.js → access-Bog7dbtP.js} +1 -1
  56. package/dist/web/server/assets/{access-Cc7fMMod.js → access-C5lXP5JS.js} +2 -2
  57. package/dist/web/server/assets/{access-B97-94Wt.js → access-bTlESGXh.js} +1 -1
  58. package/dist/web/server/assets/{agents-CjrkaEz8.js → agents-8XZAjHh0.js} +5 -5
  59. package/dist/web/server/assets/{agents-Tg3zkmQv.js → agents-BepbikC0.js} +1 -1
  60. package/dist/web/server/assets/{agents-BL918wVc.js → agents-CKkMouJX.js} +1 -1
  61. package/dist/web/server/assets/{agents-BzJFjA2i.js → agents-Co6S2Ml9.js} +1 -1
  62. package/dist/web/server/assets/{agents-BlUZqqJn.js → agents-DDUHE3eY.js} +17 -9
  63. package/dist/web/server/assets/{agents-uw32jPWx.js → agents-DnUK-7qJ.js} +1 -1
  64. package/dist/web/server/assets/{attention-C94WWwQe.js → attention--1dBWt0c.js} +1 -1
  65. package/dist/web/server/assets/{attention-2unmuO-q.js → attention-ColV2zMz.js} +1 -1
  66. package/dist/web/server/assets/{attention-a_OmC6L3.js → attention-n8edCJBL.js} +2 -2
  67. package/dist/web/server/assets/{auth-DuIqEAed.js → auth-Q5eVKoKR.js} +1 -1
  68. package/dist/web/server/assets/{config-BG1KOtwA.js → config-BpwsF11b.js} +1 -1
  69. package/dist/web/server/assets/{config-D1Li_7Yt2.js → config-Cfn1TU8w.js} +1 -1
  70. package/dist/web/server/assets/{config-Bhem9XER.js → config-UHRqSrh4.js} +4 -4
  71. package/dist/web/server/assets/{daemon-client-D-NWKQto.js → daemon-client-Dw3ut4pU.js} +1 -1
  72. package/dist/web/server/assets/{manage-C7ReF2ZZ.js → manage-C7ss0xG5.js} +147 -1
  73. package/dist/web/server/assets/{mcp-BFixpBQk.js → mcp-COn047tO.js} +1 -1
  74. package/dist/web/server/assets/mcp-CUoF4jIO.js +753 -0
  75. package/dist/web/server/assets/{mcp-Ceg9gzKE.js → mcp-DVjTaRq3.js} +1 -1
  76. package/dist/web/server/assets/{open-groups-C89TEK85.js → open-groups-lUX_YX9X.js} +1 -1
  77. package/dist/web/server/assets/{router-DizFxqh-.js → router-q3PwQgDH.js} +22 -22
  78. package/dist/web/server/assets/{routes-DsuaDPTO.js → routes-BgjikzXy.js} +2 -2
  79. package/dist/web/server/assets/{routes-CVrH9qgo.js → routes-DRtxA9c1.js} +1 -1
  80. package/dist/web/server/assets/{routes-D9Mw1_VV.js → routes-Do8a2liK.js} +261 -71
  81. package/dist/web/server/assets/{skills-BNbZ75am.js → skills-B--hjk-0.js} +1 -1
  82. package/dist/web/server/assets/{skills-D5rnOmKJ.js → skills-D5oN5ehC.js} +4 -4
  83. package/dist/web/server/assets/{skills-BWwEFc4a.js → skills-DouMCq_2.js} +1 -1
  84. package/dist/web/server/assets/src-ErO6nYmi.js +226 -0
  85. package/dist/web/server/assets/{start-2MvkBRdC.js → start-D4sx5Ovq.js} +1 -1
  86. package/dist/web/server/assets/style-BgFXDhAR.js +64 -0
  87. package/dist/web/server/assets/{system-Cr4C-YRw.js → system-4WV2pOS4.js} +1 -1
  88. package/dist/web/server/assets/{system-DsmXkgqn.js → system-A2Aib6JE.js} +2 -1
  89. package/dist/web/server/assets/{system-DT7AU0e6.js → system-DtGHi7X7.js} +31 -11
  90. package/dist/web/server/assets/{teams-u6m6JzuU.js → teams-BJNZ7ZsS.js} +1 -1
  91. package/dist/web/server/assets/{teams-Dix5XVIx.js → teams-Blfyu8ej.js} +1 -1
  92. package/dist/web/server/assets/{teams-DjE0swAZ.js → teams-BnsbH4YW.js} +9 -9
  93. package/dist/web/server/assets/{teams-Rk_RED7X.js → teams-GDzT7Tv0.js} +1 -1
  94. package/dist/web/server/assets/{teams-BeStcDvQ.js → teams-QVxXJfo7.js} +1 -1
  95. package/dist/web/server/assets/{teams-CsEBLW8-.js → teams-gzY3tOtu.js} +7 -7
  96. package/dist/web/server/assets/{telegram-CQpF3EHA.js → telegram-BSp9aCz6.js} +1 -1
  97. package/dist/web/server/assets/{telegram-DhzHgDfg.js → telegram-CIbuQ5-U.js} +1 -1
  98. package/dist/web/server/assets/{telegram-BjqABrl-.js → telegram-Ctj5dqvs.js} +2 -2
  99. package/dist/web/server/assets/{tools-DC69leH7.js → tools-BPhol5jb.js} +1 -1
  100. package/dist/web/server/assets/{usage-mvQegG4l.js → usage-CeiyPffw.js} +1 -1
  101. package/dist/web/server/assets/{usage-4zMG0sab.js → usage-Dsi2V9Wh.js} +2 -2
  102. package/dist/web/server/assets/{welcome-DrYbWGd_.js → welcome-A2Koo4HI.js} +3 -3
  103. package/dist/web/server/assets/{welcome-BuE9FRf4.js → welcome-C71pZOQ9.js} +1 -1
  104. package/dist/web/server/assets/{welcome-DYw35wl5.js → welcome-PxSZeoU6.js} +1 -1
  105. package/dist/web/server/server.js +20 -20
  106. package/dist/worker.js +15 -5
  107. package/dist/worker.js.map +1 -1
  108. package/package.json +1 -1
  109. package/dist/web/client/assets/AddProviderDialog-D8VvDmbM.js +0 -1
  110. package/dist/web/client/assets/AgentTemplateParts-BWorU6-F.js +0 -1
  111. package/dist/web/client/assets/ConfirmDialog-DrN26lN_.js +0 -1
  112. package/dist/web/client/assets/ConnectionsView-DcO7RJZ7.js +0 -1
  113. package/dist/web/client/assets/SkillsParts-BueR3HoP.js +0 -1
  114. package/dist/web/client/assets/SpawnTeamModal-B65eQyzu.js +0 -1
  115. package/dist/web/client/assets/TeamForm-BhI9FbjV.js +0 -1
  116. package/dist/web/client/assets/TeamThread-FPpHlVFc.js +0 -1
  117. package/dist/web/client/assets/_id-5mTcKU2j.js +0 -1
  118. package/dist/web/client/assets/_id-DKgyyyeX.js +0 -1
  119. package/dist/web/client/assets/agents-Bfwz3dl5.js +0 -1
  120. package/dist/web/client/assets/config-kMzM8kdp.js +0 -1
  121. package/dist/web/client/assets/index-DuLpyCSP.js +0 -14
  122. package/dist/web/client/assets/manage-DdCiSgG9.js +0 -1
  123. package/dist/web/client/assets/mcp-B3LzNtrr.js +0 -1
  124. package/dist/web/client/assets/routes-BDdLZEGO.js +0 -85
  125. package/dist/web/client/assets/style-J8ypSsCb.js +0 -7
  126. package/dist/web/client/assets/styles-C7NsCHeU.css +0 -2
  127. package/dist/web/client/assets/system-DtBBeAjO.js +0 -1
  128. package/dist/web/client/assets/teams-D4X9oNx8.js +0 -1
  129. package/dist/web/client/assets/teams-QlaY2Sxd.js +0 -1
  130. package/dist/web/client/assets/telegram-B7vlTQbt.js +0 -1
  131. package/dist/web/client/assets/usage-3mYfS5C-.js +0 -1
  132. package/dist/web/client/assets/welcome-CkmanVa_.js +0 -1
  133. package/dist/web/server/assets/mcp-BTZkDvdc.js +0 -379
  134. package/dist/web/server/assets/src-BeMh8Fze.js +0 -113
  135. package/dist/web/server/assets/style-B3l0Wtlf.js +0 -178
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 defineCommand41, runCommand, showUsage } from "citty";
4
+ import { defineCommand as defineCommand42, runCommand, showUsage } from "citty";
5
5
 
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "bazilion",
9
- version: "0.57.1",
9
+ version: "0.58.1",
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: {
@@ -648,15 +648,19 @@ function buildChatRequest(message, attachments, bashApprovalMode) {
648
648
  };
649
649
  }
650
650
  async function promptForCommandApproval(approval, prompt) {
651
- prompt.write(" [shell command approval required]");
652
- prompt.write(" command:");
651
+ const tool = approval.tool;
652
+ prompt.write(tool ? " [tool approval required]" : " [shell command approval required]");
653
+ if (tool) prompt.write(` tool: ${terminalSafe(tool)}`);
654
+ prompt.write(tool ? " call:" : " command:");
653
655
  for (const line of approval.command.split("\n")) prompt.write(` ${terminalSafe(line)}`);
654
656
  prompt.write(" risks:");
655
657
  for (const risk of approval.risks) {
656
658
  prompt.write(` - ${terminalSafe(risk.code)}: ${terminalSafe(risk.message)}`);
657
659
  }
658
660
  try {
659
- const answer = (await prompt.question(" Allow this command once? [y/N] ")).trim().toLowerCase();
661
+ const answer = (await prompt.question(
662
+ tool ? " Allow this call once? [y/N] " : " Allow this command once? [y/N] "
663
+ )).trim().toLowerCase();
660
664
  return answer === "y" || answer === "yes" ? "allow" : "deny";
661
665
  } catch {
662
666
  prompt.write(" [approval input unavailable; denying]");
@@ -669,17 +673,21 @@ async function respondToCommandApproval(client, approval, prompt) {
669
673
  await client.post(apiPath("shell-approvals", approval.id), { decision });
670
674
  } catch (error) {
671
675
  if (error.status !== 404) throw error;
672
- console.log(" [this command was already decided elsewhere]");
676
+ console.log(` [this ${approval.tool ? "call" : "command"} was already decided elsewhere]`);
673
677
  }
674
678
  return decision;
675
679
  }
676
680
  var APPROVAL_OUTCOMES = {
677
- allowed: "shell command allowed",
678
- denied: "shell command denied",
679
- auto_denied: "shell command auto-denied: non-interactive turn",
680
- expired: "shell command approval expired",
681
- cancelled: "shell command approval cancelled"
681
+ allowed: "allowed",
682
+ denied: "denied",
683
+ auto_denied: "auto-denied: non-interactive turn",
684
+ expired: "approval expired",
685
+ cancelled: "approval cancelled"
682
686
  };
687
+ function approvalOutcome(approval) {
688
+ const outcome = APPROVAL_OUTCOMES[approval.status];
689
+ return outcome && `${approval.tool ? "tool call" : "shell command"} ${outcome}`;
690
+ }
683
691
  function closeDeltaLine(state) {
684
692
  if (!state.inDeltaStream) return;
685
693
  process.stdout.write("\n");
@@ -762,7 +770,7 @@ async function streamTurn(client, agentId, request, prompts = {}) {
762
770
  closeDeltaLine(state);
763
771
  const approval = event.approval;
764
772
  if (approval.status !== "pending") {
765
- const outcome = APPROVAL_OUTCOMES[approval.status];
773
+ const outcome = approvalOutcome(approval);
766
774
  if (outcome) console.log(` [${outcome}]`);
767
775
  } else if (!answeredApprovals.has(approval.id)) {
768
776
  answeredApprovals.add(approval.id);
@@ -1202,6 +1210,10 @@ var spawnCmd = defineCommand7({
1202
1210
  reasoning: {
1203
1211
  type: "string",
1204
1212
  description: "Reasoning level: off|minimal|low|medium|high|xhigh (default: medium)"
1213
+ },
1214
+ role: {
1215
+ type: "string",
1216
+ description: "What it is for: it starts knowing its job, without the get-to-know questions of a first conversation"
1205
1217
  }
1206
1218
  },
1207
1219
  async run({ args }) {
@@ -1210,7 +1222,8 @@ var spawnCmd = defineCommand7({
1210
1222
  name: args.name,
1211
1223
  model: args.model,
1212
1224
  reasoningLevel: args.reasoning,
1213
- teamId: args.team ?? "default"
1225
+ teamId: args.team ?? "default",
1226
+ ...args.role ? { role: args.role } : {}
1214
1227
  };
1215
1228
  const { agent } = await createClient2().post("/api/agents", body);
1216
1229
  console.log(`spawned agent ${agent.id} (${agent.name})`);
@@ -2239,6 +2252,111 @@ var REVIEW_LIMITS = {
2239
2252
  patchBytes: 256 * 1024
2240
2253
  };
2241
2254
 
2255
+ // ../../packages/api-types/src/mcp-presets.ts
2256
+ var MCP_PRESETS = [
2257
+ {
2258
+ id: "microsoft365",
2259
+ title: "Microsoft 365",
2260
+ does: "Outlook mail and calendar, OneDrive and Excel; with a work or school account also Teams and SharePoint.",
2261
+ command: "npx",
2262
+ args: ["-y", "@softeria/ms-365-mcp-server"],
2263
+ fields: [],
2264
+ options: [
2265
+ {
2266
+ id: "org",
2267
+ label: "A work or school account",
2268
+ hint: "Adds Teams, SharePoint and shared mailboxes.",
2269
+ args: ["--org-mode"]
2270
+ }
2271
+ ],
2272
+ signIn: "No key to paste: once it is added, ask any Agent to sign in to Microsoft 365. Its login tool gives a link and a code to enter there, and the Agent then checks the sign-in.",
2273
+ guide: "https://github.com/Softeria/ms-365-mcp-server"
2274
+ },
2275
+ {
2276
+ id: "google_workspace",
2277
+ title: "Google Workspace",
2278
+ does: "Gmail, Calendar, Drive, Docs and Sheets.",
2279
+ command: "uvx",
2280
+ args: ["workspace-mcp", "--tool-tier", "core"],
2281
+ fields: [
2282
+ {
2283
+ name: "GOOGLE_OAUTH_CLIENT_ID",
2284
+ label: "OAuth client ID",
2285
+ hint: "From a Google Cloud OAuth client of your own, with the Gmail, Calendar and Drive APIs turned on.",
2286
+ secret: false
2287
+ },
2288
+ {
2289
+ name: "GOOGLE_OAUTH_CLIENT_SECRET",
2290
+ label: "OAuth client secret",
2291
+ hint: "The same client\u2019s secret.",
2292
+ secret: true
2293
+ }
2294
+ ],
2295
+ options: [],
2296
+ needs: "uv, which provides the uvx command.",
2297
+ signIn: "You sign in to Google in the browser; its guide shows how to make the OAuth client.",
2298
+ guide: "https://github.com/taylorwilsdon/google_workspace_mcp"
2299
+ },
2300
+ {
2301
+ id: "slack",
2302
+ title: "Slack",
2303
+ does: "Read channels, threads and messages, and search them; post messages when you allow it.",
2304
+ command: "npx",
2305
+ args: ["-y", "slack-mcp-server@latest", "--transport", "stdio"],
2306
+ fields: [
2307
+ {
2308
+ name: "SLACK_MCP_XOXP_TOKEN",
2309
+ label: "User token",
2310
+ hint: "Starts with xoxp-: a Slack app\u2019s user token, with the scopes its guide lists.",
2311
+ secret: true
2312
+ }
2313
+ ],
2314
+ options: [
2315
+ {
2316
+ id: "post",
2317
+ label: "Let Agents post messages",
2318
+ hint: "Off in this server unless turned on. Each post still asks you first.",
2319
+ env: { SLACK_MCP_ADD_MESSAGE_TOOL: "true" }
2320
+ }
2321
+ ],
2322
+ signIn: "The token is the sign-in: Agents act as the user who made it.",
2323
+ guide: "https://github.com/korotovsky/slack-mcp-server"
2324
+ },
2325
+ {
2326
+ id: "notion",
2327
+ title: "Notion",
2328
+ does: "Search, read and write pages and databases you share with it.",
2329
+ command: "npx",
2330
+ args: ["-y", "@notionhq/notion-mcp-server"],
2331
+ fields: [
2332
+ {
2333
+ name: "NOTION_TOKEN",
2334
+ label: "Integration secret",
2335
+ hint: "Starts with ntn_: an internal integration\u2019s secret. Share the pages it may use with that integration.",
2336
+ secret: true
2337
+ }
2338
+ ],
2339
+ options: [],
2340
+ signIn: "The integration secret is the sign-in; it sees only what you share with it.",
2341
+ caveat: "Notion no longer maintains this server and recommends its remote one, which needs a browser sign-in Bazilion cannot do yet. It still works with an integration secret.",
2342
+ guide: "https://github.com/makenotion/notion-mcp-server"
2343
+ }
2344
+ ];
2345
+ function presetServer(preset, options) {
2346
+ const chosen = preset.options.filter((option) => options.chosen?.includes(option.id));
2347
+ return {
2348
+ name: options.name?.trim() || preset.id,
2349
+ command: preset.command,
2350
+ args: [...preset.args, ...chosen.flatMap((option) => option.args ?? [])],
2351
+ env: {
2352
+ ...Object.fromEntries(
2353
+ preset.fields.map((field) => [field.name, options.values?.[field.name]?.trim() ?? ""]).filter(([, value]) => value !== "")
2354
+ ),
2355
+ ...Object.assign({}, ...chosen.map((option) => option.env ?? {}))
2356
+ }
2357
+ };
2358
+ }
2359
+
2242
2360
  // ../../packages/api-types/src/profiles.ts
2243
2361
  var PROFILE_FILES = [
2244
2362
  "SOUL.md",
@@ -2698,6 +2816,7 @@ var doctorCommand = defineCommand16({
2698
2816
  console.log(` ${r.skills.installed} skill(s) installed`);
2699
2817
  if (r.skills.parseErrors > 0) {
2700
2818
  check("all skills parse", false, `${r.skills.parseErrors} skill(s) have errors`);
2819
+ for (const skill of r.skills.broken ?? []) console.log(` ${skill.name}: ${skill.error}`);
2701
2820
  }
2702
2821
  console.log();
2703
2822
  console.log("providers (enable one and save at least one model for chat)");
@@ -2988,31 +3107,172 @@ function serverRow(s) {
2988
3107
  where
2989
3108
  ];
2990
3109
  }
3110
+ function envFlags(raw, name, unset = false) {
3111
+ const env = {};
3112
+ for (const value of collectFlagValues(raw, name)) {
3113
+ if (unset) {
3114
+ env[value] = null;
3115
+ continue;
3116
+ }
3117
+ const at = value.indexOf("=");
3118
+ if (at <= 0) throw new Error(`--${name} takes NAME=value, not ${value}`);
3119
+ env[value.slice(0, at)] = value.slice(at + 1);
3120
+ }
3121
+ return env;
3122
+ }
3123
+ var toolList = (value) => value.split(",").map((tool) => tool.trim()).filter(Boolean);
3124
+ function askFlags(args) {
3125
+ if (args.ask === void 0 && args.skip === void 0) return void 0;
3126
+ if (args.ask === "default") {
3127
+ if (args.skip !== void 0) throw new Error("--ask default cannot go with --skip");
3128
+ return null;
3129
+ }
3130
+ const choices = {};
3131
+ for (const tool of toolList(args.ask ?? "")) choices[tool] = true;
3132
+ for (const tool of toolList(args.skip ?? "")) {
3133
+ if (choices[tool]) throw new Error(`${tool} is in both --ask and --skip`);
3134
+ choices[tool] = false;
3135
+ }
3136
+ return choices;
3137
+ }
3138
+ var ASK_ARGS = {
3139
+ ask: {
3140
+ type: "string",
3141
+ description: 'Tools that ask you before each call, comma-separated (by default: those whose names send, post, change or delete); "default" clears your choices'
3142
+ },
3143
+ skip: {
3144
+ type: "string",
3145
+ description: "Tools that never ask, comma-separated"
3146
+ }
3147
+ };
3148
+ function asksLine(server) {
3149
+ const choices = Object.entries(server.ask ?? {});
3150
+ if (choices.length === 0) return "by default";
3151
+ return `by default, except ${choices.map(([tool, asks]) => `${tool} (${asks ? "asks" : "never asks"})`).join(", ")}`;
3152
+ }
2991
3153
  var addCmd2 = defineCommand19({
2992
- meta: { name: "add", description: "Register an MCP server" },
3154
+ meta: { name: "add", description: "Register an MCP server, or one of the common connections" },
2993
3155
  args: {
2994
3156
  name: { type: "positional", required: true, description: "Unique name ([a-zA-Z0-9_])" },
3157
+ preset: {
3158
+ type: "string",
3159
+ description: `A common connection: ${MCP_PRESETS.map((preset) => preset.id).join(", ")} (see mcp presets)`
3160
+ },
3161
+ option: { type: "string", description: "A preset's option, e.g. org or post (repeatable)" },
2995
3162
  transport: { type: "string", description: "stdio | http (default stdio)" },
2996
3163
  command: { type: "string", description: "stdio: executable to run (e.g. npx)" },
2997
3164
  args: { type: "string", description: "stdio: space-separated args (quote the whole string)" },
2998
3165
  url: { type: "string", description: "http: Streamable HTTP endpoint URL" },
2999
3166
  token: { type: "string", description: "http: bearer token (stored encrypted)" },
3167
+ env: {
3168
+ type: "string",
3169
+ description: "stdio: a variable of its own as NAME=value, stored encrypted (repeatable)"
3170
+ },
3171
+ ...ASK_ARGS,
3000
3172
  disabled: { type: "boolean", description: "Create disabled" }
3001
3173
  },
3002
- async run({ args }) {
3003
- const body = {
3004
- name: args.name,
3005
- transport: args.transport ?? "stdio",
3006
- command: args.command ?? null,
3007
- args: args.args ? args.args.split(" ").filter(Boolean) : [],
3008
- url: args.url ?? null,
3009
- authToken: args.token ?? void 0,
3010
- enabled: !args.disabled
3011
- };
3174
+ async run({ args, rawArgs }) {
3175
+ const env = envFlags(rawArgs, "env");
3176
+ let body;
3177
+ if (args.preset) {
3178
+ const preset = MCP_PRESETS.find((entry2) => entry2.id === args.preset);
3179
+ if (!preset)
3180
+ throw new Error(`no common connection "${args.preset}"; see bazilion mcp presets`);
3181
+ const given = ["transport", "command", "args", "url", "token"].filter(
3182
+ (flag) => args[flag] !== void 0
3183
+ );
3184
+ if (given.length > 0)
3185
+ throw new Error(
3186
+ `--preset sets how it runs: leave out ${given.map((f) => `--${f}`).join(", ")}`
3187
+ );
3188
+ const chosen = collectFlagValues(rawArgs, "option");
3189
+ const unknown = chosen.filter((id) => !preset.options.some((option) => option.id === id));
3190
+ if (unknown.length > 0) {
3191
+ const known = preset.options.map((option) => option.id).join(", ");
3192
+ throw new Error(
3193
+ `${preset.title} has no option ${unknown.join(", ")}${known ? `; its options: ${known}` : ""}`
3194
+ );
3195
+ }
3196
+ const values = Object.fromEntries(
3197
+ Object.entries(env).filter((pair) => pair[1] !== null)
3198
+ );
3199
+ const missing = preset.fields.filter((field) => !values[field.name]);
3200
+ if (missing.length > 0) {
3201
+ throw new Error(
3202
+ `${preset.title} needs ${missing.map((field) => `--env ${field.name}=\u2026`).join(" ")}`
3203
+ );
3204
+ }
3205
+ const made = presetServer(preset, {
3206
+ name: args.name,
3207
+ chosen,
3208
+ values
3209
+ });
3210
+ body = {
3211
+ name: made.name,
3212
+ transport: "stdio",
3213
+ command: made.command,
3214
+ args: made.args,
3215
+ env: { ...made.env, ...env },
3216
+ enabled: !args.disabled
3217
+ };
3218
+ } else {
3219
+ body = {
3220
+ name: args.name,
3221
+ transport: args.transport ?? "stdio",
3222
+ command: args.command ?? null,
3223
+ args: args.args ? args.args.split(" ").filter(Boolean) : [],
3224
+ url: args.url ?? null,
3225
+ authToken: args.token ?? void 0,
3226
+ ...Object.keys(env).length > 0 ? { env } : {},
3227
+ enabled: !args.disabled
3228
+ };
3229
+ }
3230
+ const ask2 = askFlags(args);
3231
+ if (ask2 !== void 0) body.ask = ask2;
3012
3232
  const { server } = await createClient2().post("/api/mcp-servers", body);
3013
3233
  console.log(`${server.id} ${server.name} ${server.transport}`);
3014
3234
  }
3015
3235
  });
3236
+ var presetsCmd = defineCommand19({
3237
+ meta: { name: "presets", description: "List the common connections mcp add --preset knows" },
3238
+ run() {
3239
+ for (const preset of MCP_PRESETS) {
3240
+ console.log(`${preset.id} ${preset.title}: ${preset.does}`);
3241
+ console.log(` runs: ${[preset.command, ...preset.args].join(" ")}`);
3242
+ for (const field of preset.fields) console.log(` --env ${field.name}=\u2026 ${field.hint}`);
3243
+ for (const option of preset.options) console.log(` --option ${option.id} ${option.hint}`);
3244
+ if (preset.needs) console.log(` needs: ${preset.needs}`);
3245
+ console.log(` sign-in: ${preset.signIn}`);
3246
+ if (preset.caveat) console.log(` note: ${preset.caveat}`);
3247
+ console.log(` guide: ${preset.guide}`);
3248
+ }
3249
+ }
3250
+ });
3251
+ var setCmd2 = defineCommand19({
3252
+ meta: { name: "set", description: "Change a server's own variables or which tools ask first" },
3253
+ args: {
3254
+ id: serverArg,
3255
+ env: { type: "string", description: "Set a variable as NAME=value (repeatable)" },
3256
+ "unset-env": { type: "string", description: "Remove a variable by name (repeatable)" },
3257
+ ...ASK_ARGS
3258
+ },
3259
+ async run({ args, rawArgs }) {
3260
+ const env = { ...envFlags(rawArgs, "env"), ...envFlags(rawArgs, "unset-env", true) };
3261
+ const body = {};
3262
+ if (Object.keys(env).length > 0) body.env = env;
3263
+ const ask2 = askFlags(args);
3264
+ if (ask2 !== void 0) body.ask = ask2;
3265
+ if (Object.keys(body).length === 0)
3266
+ throw new Error("nothing to change: give --env, --unset-env, --ask or --skip");
3267
+ const { server } = await createClient2().patch(
3268
+ apiPath("mcp-servers", args.id),
3269
+ body
3270
+ );
3271
+ console.log(
3272
+ `${server.name}: variables ${server.envNames?.join(", ") || "(none)"}; asks first: ${asksLine(server)}`
3273
+ );
3274
+ }
3275
+ });
3016
3276
  var listCmd4 = defineCommand19({
3017
3277
  meta: { name: "list", description: "List MCP servers" },
3018
3278
  async run() {
@@ -3064,7 +3324,8 @@ var testCmd = defineCommand19({
3064
3324
  if (!res.ok) throw new Error(`connection failed: ${res.error}`);
3065
3325
  const tools = res.tools ?? [];
3066
3326
  console.log(`connected \u2014 ${tools.length} tool(s):`);
3067
- for (const t of tools) console.log(` ${t.name} ${t.description}`);
3327
+ for (const t of tools)
3328
+ console.log(` ${t.asks ? "(asks first) " : ""}${t.name} ${t.description}`);
3068
3329
  }
3069
3330
  });
3070
3331
  var mcpCommand = defineCommand19({
@@ -3076,7 +3337,9 @@ var mcpCommand = defineCommand19({
3076
3337
  rm: rmCmd3,
3077
3338
  enable: enableCmd,
3078
3339
  disable: disableCmd,
3079
- test: testCmd
3340
+ test: testCmd,
3341
+ set: setCmd2,
3342
+ presets: presetsCmd
3080
3343
  }
3081
3344
  });
3082
3345
 
@@ -4101,7 +4364,7 @@ var skillCommand = defineCommand29({
4101
4364
  // src/commands/team.ts
4102
4365
  import { readFileSync as readFileSync9 } from "node:fs";
4103
4366
  import { stdin as stdin2 } from "node:process";
4104
- import { defineCommand as defineCommand34 } from "citty";
4367
+ import { defineCommand as defineCommand35 } from "citty";
4105
4368
 
4106
4369
  // src/commands/team-environment.ts
4107
4370
  import { defineCommand as defineCommand30 } from "citty";
@@ -4229,7 +4492,7 @@ var show3 = defineCommand32({
4229
4492
  if (args.json) return printJson(policy);
4230
4493
  console.log(`# Team ${policy.teamId} policy`);
4231
4494
  console.log(
4232
- `mode: ${policy.mode}${policy.mode === "open" ? " (members message each other freely)" : " (members need an allow edge)"}`
4495
+ `mode: ${policy.mode}${policy.mode === "open" ? " (everyone can message everyone)" : " (only along connections)"}`
4233
4496
  );
4234
4497
  console.log(`members: ${policy.members.map((agent) => agent.name).join(", ") || "(none)"}`);
4235
4498
  if (!policy.edges.length) return console.log("edges: (none)");
@@ -4414,8 +4677,44 @@ var teamReviewCommand = defineCommand33({
4414
4677
  }
4415
4678
  });
4416
4679
 
4680
+ // src/commands/team-today.ts
4681
+ import { defineCommand as defineCommand34 } from "citty";
4682
+ var KIND = {
4683
+ handoff: "handed off",
4684
+ reply: "replied",
4685
+ file: "delivered",
4686
+ worked: "worked in",
4687
+ question: "asks you",
4688
+ approval: "waits on you"
4689
+ };
4690
+ var teamTodayCommand = defineCommand34({
4691
+ meta: {
4692
+ name: "today",
4693
+ description: "What a Team's Agents handed off, delivered, worked on and wait on you for today"
4694
+ },
4695
+ args: { id: teamArg, json: jsonFlag },
4696
+ async run({ args }) {
4697
+ const start = /* @__PURE__ */ new Date();
4698
+ start.setHours(0, 0, 0, 0);
4699
+ const day = await createClient2().get(
4700
+ `${apiPath("teams", args.id, "today")}?since=${start.getTime()}`
4701
+ );
4702
+ if (args.json) return printJson(day);
4703
+ printRows(
4704
+ day.events.map((event) => [
4705
+ new Date(event.at).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }),
4706
+ event.otherAgentName ? `${event.agentName} -> ${event.otherAgentName}` : event.agentName,
4707
+ KIND[event.kind],
4708
+ terminalSafe(event.text)
4709
+ ]),
4710
+ "(nothing yet today)"
4711
+ );
4712
+ if (day.truncated) console.log("note: only the latest events are listed");
4713
+ }
4714
+ });
4715
+
4417
4716
  // src/commands/team.ts
4418
- var addCmd3 = defineCommand34({
4717
+ var addCmd3 = defineCommand35({
4419
4718
  meta: {
4420
4719
  name: "add",
4421
4720
  description: "Register a team at ~/.bazilion/teams/<slug>/ (use --link to point at an existing tree)"
@@ -4438,7 +4737,7 @@ var addCmd3 = defineCommand34({
4438
4737
  console.log(`registered team ${team.id} at ${team.path}`);
4439
4738
  }
4440
4739
  });
4441
- var listCmd10 = defineCommand34({
4740
+ var listCmd10 = defineCommand35({
4442
4741
  meta: { name: "list", description: "List teams" },
4443
4742
  async run() {
4444
4743
  const list7 = await createClient2().get("/api/teams");
@@ -4448,7 +4747,7 @@ var listCmd10 = defineCommand34({
4448
4747
  );
4449
4748
  }
4450
4749
  });
4451
- var rmCmd6 = defineCommand34({
4750
+ var rmCmd6 = defineCommand35({
4452
4751
  meta: {
4453
4752
  name: "rm",
4454
4753
  description: "Delete an empty team and its workspace directory (a --link target is kept)"
@@ -4464,7 +4763,7 @@ async function readStdin() {
4464
4763
  for await (const chunk of stdin2) chunks.push(chunk);
4465
4764
  return Buffer.concat(chunks).toString("utf8");
4466
4765
  }
4467
- var userMdShowCmd = defineCommand34({
4766
+ var userMdShowCmd = defineCommand35({
4468
4767
  meta: { name: "show", description: "Print the team's USER.md" },
4469
4768
  args: { id: teamArg },
4470
4769
  async run({ args }) {
@@ -4473,7 +4772,7 @@ var userMdShowCmd = defineCommand34({
4473
4772
  if (team.userMd && !team.userMd.endsWith("\n")) process.stdout.write("\n");
4474
4773
  }
4475
4774
  });
4476
- var userMdSetCmd = defineCommand34({
4775
+ var userMdSetCmd = defineCommand35({
4477
4776
  meta: {
4478
4777
  name: "set",
4479
4778
  description: "Replace the team's USER.md (from --file, --from-stdin, or inline text)"
@@ -4495,7 +4794,7 @@ var userMdSetCmd = defineCommand34({
4495
4794
  console.log(`updated USER.md for team ${args.id} (${content.length} bytes)`);
4496
4795
  }
4497
4796
  });
4498
- var userMdClearCmd = defineCommand34({
4797
+ var userMdClearCmd = defineCommand35({
4499
4798
  meta: { name: "clear", description: "Clear the team's USER.md to empty" },
4500
4799
  args: { id: teamArg },
4501
4800
  async run({ args }) {
@@ -4504,7 +4803,7 @@ var userMdClearCmd = defineCommand34({
4504
4803
  console.log(`cleared USER.md for team ${args.id}`);
4505
4804
  }
4506
4805
  });
4507
- var userMdCmd = defineCommand34({
4806
+ var userMdCmd = defineCommand35({
4508
4807
  meta: { name: "user-md", description: "View or edit a team's USER.md" },
4509
4808
  subCommands: {
4510
4809
  show: userMdShowCmd,
@@ -4512,7 +4811,7 @@ var userMdCmd = defineCommand34({
4512
4811
  clear: userMdClearCmd
4513
4812
  }
4514
4813
  });
4515
- var topicFormatShowCmd = defineCommand34({
4814
+ var topicFormatShowCmd = defineCommand35({
4516
4815
  meta: { name: "show", description: "Print the team's Telegram topic-name template" },
4517
4816
  args: { id: teamArg },
4518
4817
  async run({ args }) {
@@ -4520,7 +4819,7 @@ var topicFormatShowCmd = defineCommand34({
4520
4819
  console.log(team.telegramTopicNameFormat ?? "(default naming)");
4521
4820
  }
4522
4821
  });
4523
- var topicFormatSetCmd = defineCommand34({
4822
+ var topicFormatSetCmd = defineCommand35({
4524
4823
  meta: {
4525
4824
  name: "set",
4526
4825
  description: "Set the topic-name template. Tokens: {agent.name} {team.name} {team.slug} (must include {agent.name})"
@@ -4539,7 +4838,7 @@ var topicFormatSetCmd = defineCommand34({
4539
4838
  console.log(`set topic-name template for team ${args.id}: ${team.telegramTopicNameFormat}`);
4540
4839
  }
4541
4840
  });
4542
- var topicFormatClearCmd = defineCommand34({
4841
+ var topicFormatClearCmd = defineCommand35({
4543
4842
  meta: { name: "clear", description: "Clear the template (revert to built-in naming)" },
4544
4843
  args: { id: teamArg },
4545
4844
  async run({ args }) {
@@ -4548,7 +4847,7 @@ var topicFormatClearCmd = defineCommand34({
4548
4847
  console.log(`cleared topic-name template for team ${args.id}`);
4549
4848
  }
4550
4849
  });
4551
- var topicFormatCmd = defineCommand34({
4850
+ var topicFormatCmd = defineCommand35({
4552
4851
  meta: {
4553
4852
  name: "topic-format",
4554
4853
  description: "View or edit a team's Telegram forum-topic name template"
@@ -4559,12 +4858,13 @@ var topicFormatCmd = defineCommand34({
4559
4858
  clear: topicFormatClearCmd
4560
4859
  }
4561
4860
  });
4562
- var teamCommand = defineCommand34({
4861
+ var teamCommand = defineCommand35({
4563
4862
  meta: { name: "team", description: "Manage teams (collaboration contexts)" },
4564
4863
  subCommands: {
4565
4864
  environment: teamEnvironmentCommand,
4566
4865
  review: teamReviewCommand,
4567
4866
  messages: teamMessagesCommand,
4867
+ today: teamTodayCommand,
4568
4868
  add: addCmd3,
4569
4869
  list: listCmd10,
4570
4870
  rm: rmCmd6,
@@ -4576,7 +4876,7 @@ var teamCommand = defineCommand34({
4576
4876
 
4577
4877
  // src/commands/team-template.ts
4578
4878
  import { readFileSync as readFileSync10 } from "node:fs";
4579
- import { defineCommand as defineCommand35 } from "citty";
4879
+ import { defineCommand as defineCommand36 } from "citty";
4580
4880
  var templateArg = positional("Template id");
4581
4881
  function endpointLabel(template, end) {
4582
4882
  return end === "outside" ? "outside" : `${end}:${template.slots[end]?.agentName ?? "?"}`;
@@ -4620,7 +4920,7 @@ function document(template) {
4620
4920
  edges: template.edges
4621
4921
  };
4622
4922
  }
4623
- var list6 = defineCommand35({
4923
+ var list6 = defineCommand36({
4624
4924
  meta: { name: "list", description: "List Team templates" },
4625
4925
  args: { json: jsonFlag },
4626
4926
  async run({ args }) {
@@ -4634,7 +4934,7 @@ var list6 = defineCommand35({
4634
4934
  console.log(line);
4635
4935
  }
4636
4936
  });
4637
- var show4 = defineCommand35({
4937
+ var show4 = defineCommand36({
4638
4938
  meta: { name: "show", description: "Show a Team template" },
4639
4939
  args: { id: templateArg, json: jsonFlag },
4640
4940
  async run({ args }) {
@@ -4643,7 +4943,7 @@ var show4 = defineCommand35({
4643
4943
  else printTemplate(template);
4644
4944
  }
4645
4945
  });
4646
- var create = defineCommand35({
4946
+ var create = defineCommand36({
4647
4947
  meta: { name: "create", description: "Create an empty Team template" },
4648
4948
  args: {
4649
4949
  id: positional("Template slug"),
@@ -4655,7 +4955,7 @@ var create = defineCommand35({
4655
4955
  console.log(`created Team template ${created.id}`);
4656
4956
  }
4657
4957
  });
4658
- var exportCommand = defineCommand35({
4958
+ var exportCommand = defineCommand36({
4659
4959
  meta: { name: "export", description: "Print a Team template as JSON for editing or import" },
4660
4960
  args: { id: templateArg },
4661
4961
  async run({ args }) {
@@ -4663,7 +4963,7 @@ var exportCommand = defineCommand35({
4663
4963
  printJson(document(template));
4664
4964
  }
4665
4965
  });
4666
- var importCommand = defineCommand35({
4966
+ var importCommand = defineCommand36({
4667
4967
  meta: {
4668
4968
  name: "import",
4669
4969
  description: "Create a Team template from JSON, or replace the one with the same id"
@@ -4686,7 +4986,7 @@ var importCommand = defineCommand35({
4686
4986
  );
4687
4987
  }
4688
4988
  });
4689
- var rm2 = defineCommand35({
4989
+ var rm2 = defineCommand36({
4690
4990
  meta: { name: "rm", description: "Delete a Team template (spawned Teams are unaffected)" },
4691
4991
  args: { id: templateArg },
4692
4992
  async run({ args }) {
@@ -4694,7 +4994,7 @@ var rm2 = defineCommand35({
4694
4994
  console.log(`deleted Team template ${args.id}`);
4695
4995
  }
4696
4996
  });
4697
- var spawn4 = defineCommand35({
4997
+ var spawn4 = defineCommand36({
4698
4998
  meta: {
4699
4999
  name: "spawn",
4700
5000
  description: "Spawn one Agent per slot into a Team; an unknown Team slug creates the Team"
@@ -4718,7 +5018,7 @@ var spawn4 = defineCommand35({
4718
5018
  );
4719
5019
  }
4720
5020
  });
4721
- var save = defineCommand35({
5021
+ var save = defineCommand36({
4722
5022
  meta: {
4723
5023
  name: "save",
4724
5024
  description: "Save a live Team's members, edges, mode and USER.md as a new template"
@@ -4737,7 +5037,7 @@ var save = defineCommand35({
4737
5037
  console.log(`saved Team ${args.team} as template ${saved.id} (${saved.slots.length} slots)`);
4738
5038
  }
4739
5039
  });
4740
- var teamTemplateCommand = defineCommand35({
5040
+ var teamTemplateCommand = defineCommand36({
4741
5041
  meta: { name: "team-template", description: "Reusable Team rosters with their allow edges" },
4742
5042
  subCommands: {
4743
5043
  list: list6,
@@ -4752,9 +5052,9 @@ var teamTemplateCommand = defineCommand35({
4752
5052
  });
4753
5053
 
4754
5054
  // src/commands/telegram.ts
4755
- import { defineCommand as defineCommand36 } from "citty";
5055
+ import { defineCommand as defineCommand37 } from "citty";
4756
5056
  var telegramUserArg = positional("Numeric Telegram user id");
4757
- var setCmd2 = defineCommand36({
5057
+ var setCmd3 = defineCommand37({
4758
5058
  meta: {
4759
5059
  name: "set",
4760
5060
  description: "Save bot token + supergroup chat ID (paired write)"
@@ -4772,7 +5072,7 @@ var setCmd2 = defineCommand36({
4772
5072
  console.log(`saved \xB7 token ${state.botTokenPreview} \xB7 chat ${state.chatId}`);
4773
5073
  }
4774
5074
  });
4775
- var clearCmd = defineCommand36({
5075
+ var clearCmd = defineCommand37({
4776
5076
  meta: {
4777
5077
  name: "clear",
4778
5078
  description: "Remove stored bot token + chat ID"
@@ -4783,7 +5083,7 @@ var clearCmd = defineCommand36({
4783
5083
  console.log("cleared");
4784
5084
  }
4785
5085
  });
4786
- var showCmd6 = defineCommand36({
5086
+ var showCmd6 = defineCommand37({
4787
5087
  meta: {
4788
5088
  name: "show",
4789
5089
  description: "Show what credentials are stored (token is masked)"
@@ -4804,7 +5104,7 @@ var showCmd6 = defineCommand36({
4804
5104
  }
4805
5105
  }
4806
5106
  });
4807
- var reconnectCmd = defineCommand36({
5107
+ var reconnectCmd = defineCommand37({
4808
5108
  meta: {
4809
5109
  name: "reconnect",
4810
5110
  description: "Apply a pending supergroup chat-id migration + re-activate the bot"
@@ -4815,18 +5115,18 @@ var reconnectCmd = defineCommand36({
4815
5115
  console.log(`reconnected \xB7 chat ${state.chatId}`);
4816
5116
  }
4817
5117
  });
4818
- var configCmd = defineCommand36({
5118
+ var configCmd = defineCommand37({
4819
5119
  meta: {
4820
5120
  name: "config",
4821
5121
  description: "Manage Telegram credentials (bot token + chat ID)"
4822
5122
  },
4823
5123
  subCommands: {
4824
- set: setCmd2,
5124
+ set: setCmd3,
4825
5125
  clear: clearCmd,
4826
5126
  show: showCmd6
4827
5127
  }
4828
5128
  });
4829
- var healthCmd = defineCommand36({
5129
+ var healthCmd = defineCommand37({
4830
5130
  meta: {
4831
5131
  name: "health",
4832
5132
  description: "Run the four-step preflight against the Telegram Bot API"
@@ -4856,7 +5156,7 @@ var healthCmd = defineCommand36({
4856
5156
  if (!allOk) process.exitCode = 1;
4857
5157
  }
4858
5158
  });
4859
- var botStatusCmd = defineCommand36({
5159
+ var botStatusCmd = defineCommand37({
4860
5160
  meta: {
4861
5161
  name: "status",
4862
5162
  description: "Show polling state of the live bot"
@@ -4881,7 +5181,7 @@ var botStatusCmd = defineCommand36({
4881
5181
  if (!p.running) process.exitCode = 1;
4882
5182
  }
4883
5183
  });
4884
- var botRestartCmd = defineCommand36({
5184
+ var botRestartCmd = defineCommand37({
4885
5185
  meta: {
4886
5186
  name: "restart",
4887
5187
  description: "Force-restart the bot (tears down + brings up from current creds)"
@@ -4892,7 +5192,7 @@ var botRestartCmd = defineCommand36({
4892
5192
  console.log("restart requested");
4893
5193
  }
4894
5194
  });
4895
- var botCmd = defineCommand36({
5195
+ var botCmd = defineCommand37({
4896
5196
  meta: {
4897
5197
  name: "bot",
4898
5198
  description: "Inspect / control the live polling bot"
@@ -4902,7 +5202,7 @@ var botCmd = defineCommand36({
4902
5202
  restart: botRestartCmd
4903
5203
  }
4904
5204
  });
4905
- var bindCmd = defineCommand36({
5205
+ var bindCmd = defineCommand37({
4906
5206
  meta: {
4907
5207
  name: "bind",
4908
5208
  description: "Create a Telegram topic for an agent (manual fallback for /talk)"
@@ -4917,7 +5217,7 @@ var bindCmd = defineCommand36({
4917
5217
  console.log(` ${result.deepLink}`);
4918
5218
  }
4919
5219
  });
4920
- var unbindCmd = defineCommand36({
5220
+ var unbindCmd = defineCommand37({
4921
5221
  meta: {
4922
5222
  name: "unbind",
4923
5223
  description: "Clear an agent's Telegram topic binding (topic stays in Telegram as orphan)"
@@ -4928,7 +5228,7 @@ var unbindCmd = defineCommand36({
4928
5228
  console.log(`unbound agent ${args.agent}`);
4929
5229
  }
4930
5230
  });
4931
- var listBindingsCmd = defineCommand36({
5231
+ var listBindingsCmd = defineCommand37({
4932
5232
  meta: {
4933
5233
  name: "list",
4934
5234
  description: "List agents and their Telegram topic bindings"
@@ -4956,7 +5256,7 @@ var listBindingsCmd = defineCommand36({
4956
5256
  }
4957
5257
  }
4958
5258
  });
4959
- var allowCmd = defineCommand36({
5259
+ var allowCmd = defineCommand37({
4960
5260
  meta: { name: "allow", description: "Add a Telegram user id to the allowlist" },
4961
5261
  args: {
4962
5262
  userId: telegramUserArg,
@@ -4972,7 +5272,7 @@ var allowCmd = defineCommand36({
4972
5272
  console.log(`allowed ${u.userId} (${u.role})`);
4973
5273
  }
4974
5274
  });
4975
- var denyCmd = defineCommand36({
5275
+ var denyCmd = defineCommand37({
4976
5276
  meta: { name: "deny", description: "Remove a Telegram user id from the allowlist" },
4977
5277
  args: { userId: telegramUserArg },
4978
5278
  async run({ args }) {
@@ -4981,7 +5281,7 @@ var denyCmd = defineCommand36({
4981
5281
  console.log(`removed ${args.userId}`);
4982
5282
  }
4983
5283
  });
4984
- var allowedCmd = defineCommand36({
5284
+ var allowedCmd = defineCommand37({
4985
5285
  meta: { name: "allowed", description: "List allowlisted Telegram users" },
4986
5286
  async run() {
4987
5287
  const client = createClient2();
@@ -4996,7 +5296,7 @@ var allowedCmd = defineCommand36({
4996
5296
  }
4997
5297
  }
4998
5298
  });
4999
- var pairingCreateCmd = defineCommand36({
5299
+ var pairingCreateCmd = defineCommand37({
5000
5300
  meta: { name: "create", description: "Generate a one-time Telegram owner pairing code" },
5001
5301
  async run() {
5002
5302
  const result = await createClient2().post(
@@ -5007,7 +5307,7 @@ var pairingCreateCmd = defineCommand36({
5007
5307
  console.log("send `/pair <code>` in the configured \u2699 bazilion service topic");
5008
5308
  }
5009
5309
  });
5010
- var pairingStatusCmd = defineCommand36({
5310
+ var pairingStatusCmd = defineCommand37({
5011
5311
  meta: { name: "status", description: "Show Telegram owner pairing status" },
5012
5312
  async run() {
5013
5313
  const result = await createClient2().get("/api/config/telegram/pairing");
@@ -5018,14 +5318,14 @@ var pairingStatusCmd = defineCommand36({
5018
5318
  console.log(`expires: ${new Date(result.challengeExpiresAt).toISOString()}`);
5019
5319
  }
5020
5320
  });
5021
- var pairingCancelCmd = defineCommand36({
5321
+ var pairingCancelCmd = defineCommand37({
5022
5322
  meta: { name: "cancel", description: "Cancel the active Telegram pairing code" },
5023
5323
  async run() {
5024
5324
  await createClient2().del("/api/config/telegram/pairing/challenge");
5025
5325
  console.log("pairing challenge cancelled");
5026
5326
  }
5027
5327
  });
5028
- var pairingResetCmd = defineCommand36({
5328
+ var pairingResetCmd = defineCommand37({
5029
5329
  meta: { name: "reset", description: "Revoke the Telegram owner and require re-pairing" },
5030
5330
  args: {
5031
5331
  yes: { type: "boolean", description: "Confirm destructive owner reset", required: true }
@@ -5036,7 +5336,7 @@ var pairingResetCmd = defineCommand36({
5036
5336
  console.log("Telegram owner reset; ingress is closed until re-paired");
5037
5337
  }
5038
5338
  });
5039
- var pairingCmd = defineCommand36({
5339
+ var pairingCmd = defineCommand37({
5040
5340
  meta: { name: "pairing", description: "Manage single-owner Telegram pairing" },
5041
5341
  subCommands: {
5042
5342
  create: pairingCreateCmd,
@@ -5045,7 +5345,7 @@ var pairingCmd = defineCommand36({
5045
5345
  reset: pairingResetCmd
5046
5346
  }
5047
5347
  });
5048
- var telegramCommand = defineCommand36({
5348
+ var telegramCommand = defineCommand37({
5049
5349
  meta: {
5050
5350
  name: "telegram",
5051
5351
  description: "Telegram integration: credentials, health, bot lifecycle, bindings, access"
@@ -5066,7 +5366,7 @@ var telegramCommand = defineCommand36({
5066
5366
  });
5067
5367
 
5068
5368
  // src/commands/token.ts
5069
- import { defineCommand as defineCommand37 } from "citty";
5369
+ import { defineCommand as defineCommand38 } from "citty";
5070
5370
  function tokenRow(t) {
5071
5371
  const last = t.lastUsedAt ? new Date(t.lastUsedAt).toISOString() : "(never)";
5072
5372
  const expired = t.expiresAt !== null && t.expiresAt <= Date.now();
@@ -5074,7 +5374,7 @@ function tokenRow(t) {
5074
5374
  const expires = t.expiresAt ? new Date(t.expiresAt).toISOString() : "(never)";
5075
5375
  return [t.id, t.kind, state, t.label, `expires: ${expires}`, `last: ${last}`];
5076
5376
  }
5077
- var createCmd3 = defineCommand37({
5377
+ var createCmd3 = defineCommand38({
5078
5378
  meta: { name: "create", description: "Mint a new device token with full access (shown once)" },
5079
5379
  args: {
5080
5380
  label: positional("Human-readable label"),
@@ -5102,7 +5402,7 @@ var createCmd3 = defineCommand37({
5102
5402
  console.log("store the token now \u2014 it is not recoverable later.");
5103
5403
  }
5104
5404
  });
5105
- var listCmd11 = defineCommand37({
5405
+ var listCmd11 = defineCommand38({
5106
5406
  meta: { name: "list", description: "List web tokens" },
5107
5407
  args: {
5108
5408
  all: { type: "boolean", description: "Include revoked tokens" }
@@ -5114,7 +5414,7 @@ var listCmd11 = defineCommand37({
5114
5414
  printRows(tokens.map(tokenRow), "(no tokens)");
5115
5415
  }
5116
5416
  });
5117
- var showLocalCmd = defineCommand37({
5417
+ var showLocalCmd = defineCommand38({
5118
5418
  meta: {
5119
5419
  name: "show-local",
5120
5420
  description: "Print the bootstrap web token stored in ~/.bazilion/auth.json"
@@ -5124,7 +5424,7 @@ var showLocalCmd = defineCommand37({
5124
5424
  console.log(readAuthFile(paths.authFile).token);
5125
5425
  }
5126
5426
  });
5127
- var revokeCmd2 = defineCommand37({
5427
+ var revokeCmd2 = defineCommand38({
5128
5428
  meta: { name: "revoke", description: "Revoke a web token and its browser sessions" },
5129
5429
  args: { id: positional("Token id") },
5130
5430
  async run({ args }) {
@@ -5132,7 +5432,7 @@ var revokeCmd2 = defineCommand37({
5132
5432
  console.log(`revoked token ${args.id}`);
5133
5433
  }
5134
5434
  });
5135
- var tokenCommand = defineCommand37({
5435
+ var tokenCommand = defineCommand38({
5136
5436
  meta: { name: "token", description: "Manage web tokens for API/CLI clients" },
5137
5437
  subCommands: {
5138
5438
  create: createCmd3,
@@ -5143,12 +5443,12 @@ var tokenCommand = defineCommand37({
5143
5443
  });
5144
5444
 
5145
5445
  // src/commands/trigger.ts
5146
- import { defineCommand as defineCommand38 } from "citty";
5446
+ import { defineCommand as defineCommand39 } from "citty";
5147
5447
  var triggerArg = positional("Trigger id");
5148
5448
  function spec(t) {
5149
5449
  return t.kind === "interval" ? `every ${t.intervalSec}s` : `cron "${t.cronExpr}"`;
5150
5450
  }
5151
- var addCmd4 = defineCommand38({
5451
+ var addCmd4 = defineCommand39({
5152
5452
  meta: { name: "add", description: "Add an interval / cron trigger to an agent" },
5153
5453
  args: {
5154
5454
  agent: agentArg,
@@ -5196,7 +5496,7 @@ function triggerRow(t, next) {
5196
5496
  const upcoming = typeof next === "number" ? new Date(next).toISOString() : "-";
5197
5497
  return [t.id, state, spec(t), `next: ${upcoming}`, `last: ${last}`, `"${msgPreview}"`];
5198
5498
  }
5199
- var listCmd12 = defineCommand38({
5499
+ var listCmd12 = defineCommand39({
5200
5500
  meta: { name: "list", description: "List triggers for an agent" },
5201
5501
  args: { agent: agentArg },
5202
5502
  async run({ args }) {
@@ -5211,7 +5511,7 @@ var listCmd12 = defineCommand38({
5211
5511
  console.log("The daemon runs no schedules: it was started with BAZILION_SCHEDULER=off.");
5212
5512
  }
5213
5513
  });
5214
- var rmCmd7 = defineCommand38({
5514
+ var rmCmd7 = defineCommand39({
5215
5515
  meta: { name: "rm", description: "Delete a trigger" },
5216
5516
  args: { id: triggerArg },
5217
5517
  async run({ args }) {
@@ -5219,7 +5519,7 @@ var rmCmd7 = defineCommand38({
5219
5519
  console.log(`removed trigger ${args.id}`);
5220
5520
  }
5221
5521
  });
5222
- var enableCmd3 = defineCommand38({
5522
+ var enableCmd3 = defineCommand39({
5223
5523
  meta: { name: "enable", description: "Enable a trigger" },
5224
5524
  args: { id: triggerArg },
5225
5525
  async run({ args }) {
@@ -5228,7 +5528,7 @@ var enableCmd3 = defineCommand38({
5228
5528
  console.log(`enabled trigger ${args.id}`);
5229
5529
  }
5230
5530
  });
5231
- var disableCmd3 = defineCommand38({
5531
+ var disableCmd3 = defineCommand39({
5232
5532
  meta: { name: "disable", description: "Disable a trigger" },
5233
5533
  args: { id: triggerArg },
5234
5534
  async run({ args }) {
@@ -5237,7 +5537,7 @@ var disableCmd3 = defineCommand38({
5237
5537
  console.log(`disabled trigger ${args.id}`);
5238
5538
  }
5239
5539
  });
5240
- var historyCmd = defineCommand38({
5540
+ var historyCmd = defineCommand39({
5241
5541
  meta: { name: "history", description: "Show recent runs of a trigger" },
5242
5542
  args: {
5243
5543
  id: triggerArg,
@@ -5261,7 +5561,7 @@ var historyCmd = defineCommand38({
5261
5561
  );
5262
5562
  }
5263
5563
  });
5264
- var triggerCommand = defineCommand38({
5564
+ var triggerCommand = defineCommand39({
5265
5565
  meta: { name: "trigger", description: "Manage scheduled agent triggers" },
5266
5566
  subCommands: {
5267
5567
  add: addCmd4,
@@ -5277,7 +5577,7 @@ var triggerCommand = defineCommand38({
5277
5577
  import { existsSync as existsSync7, lstatSync, readdirSync as readdirSync2, rmdirSync, rmSync as rmSync4 } from "node:fs";
5278
5578
  import { homedir as homedir2 } from "node:os";
5279
5579
  import { join as join7 } from "node:path";
5280
- import { defineCommand as defineCommand39 } from "citty";
5580
+ import { defineCommand as defineCommand40 } from "citty";
5281
5581
  var RESET_ENTRIES = [
5282
5582
  "profiles",
5283
5583
  "agents",
@@ -5291,7 +5591,7 @@ var RESET_ENTRIES = [
5291
5591
  "auth.json"
5292
5592
  ];
5293
5593
  var ALL_ENTRIES = [...RESET_ENTRIES, "skills"];
5294
- var uninstallCommand = defineCommand39({
5594
+ var uninstallCommand = defineCommand40({
5295
5595
  meta: {
5296
5596
  name: "uninstall",
5297
5597
  description: "Delete the Bazilion data in ~/.bazilion (or BAZILION_HOME)"
@@ -5347,7 +5647,7 @@ var uninstallCommand = defineCommand39({
5347
5647
  });
5348
5648
 
5349
5649
  // src/commands/usage.ts
5350
- import { defineCommand as defineCommand40 } from "citty";
5650
+ import { defineCommand as defineCommand41 } from "citty";
5351
5651
  function usageHeadline(report) {
5352
5652
  const period = report.days === null ? "everything saved" : report.days === 1 ? `today (${report.to})` : `the last ${report.days} days (${report.from} to ${report.to})`;
5353
5653
  return `Usage over ${period}, ${report.timeZone}`;
@@ -5365,7 +5665,7 @@ function totalsLines(totals) {
5365
5665
  );
5366
5666
  return lines;
5367
5667
  }
5368
- var usageCommand = defineCommand40({
5668
+ var usageCommand = defineCommand41({
5369
5669
  meta: {
5370
5670
  name: "usage",
5371
5671
  description: "Show tokens and cost per Team, Agent, model and day"
@@ -5429,7 +5729,7 @@ var usageCommand = defineCommand40({
5429
5729
 
5430
5730
  // src/index.ts
5431
5731
  var VERSION = package_default.version;
5432
- var main = defineCommand41({
5732
+ var main = defineCommand42({
5433
5733
  meta: {
5434
5734
  name: "bazilion",
5435
5735
  version: VERSION,