bazilion 0.16.0 → 0.17.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 (123) hide show
  1. package/dist/cli.js +399 -83
  2. package/dist/cli.js.map +1 -1
  3. package/dist/daemon.js +1840 -132
  4. package/dist/daemon.js.map +1 -1
  5. package/dist/migrations/0001_init.sql +62 -0
  6. package/dist/web/client/assets/ChatPane-BI3QVX2A.js +76 -0
  7. package/dist/web/client/assets/{ConfirmDialog-MicTTwdy.js → ConfirmDialog-Qam6Ut08.js} +1 -1
  8. package/dist/web/client/assets/{FieldRow-DJ2Gx4Du.js → FieldRow-swJ5qn2h.js} +1 -1
  9. package/dist/web/client/assets/ProductionTeamPolicyEditor-LGw1UuF-.js +7 -0
  10. package/dist/web/client/assets/ProfileCommunicationEditor-raoau_YB.js +1 -0
  11. package/dist/web/client/assets/{ResultSourceConversation-CtzJ8QA-.js → ResultSourceConversation-BEwkhFog.js} +1 -1
  12. package/dist/web/client/assets/TeamTabs-BDdTLGIf.js +1 -0
  13. package/dist/web/client/assets/TemplatesTabs-BX5hhEJ7.js +1 -0
  14. package/dist/web/client/assets/{UnsavedChangesGuard-BCsLw-mU.js → UnsavedChangesGuard-CVJtmR1D.js} +1 -1
  15. package/dist/web/client/assets/{_id-BEDmIXVf.js → _id-BQPOE3gj.js} +1 -1
  16. package/dist/web/client/assets/{_id-BFM_tn_s.js → _id-BkYrUP0R.js} +1 -1
  17. package/dist/web/client/assets/{_id-B5Ov7cdO.js → _id-CriixlZD.js} +1 -1
  18. package/dist/web/client/assets/_id-DHqq2W34.js +1 -0
  19. package/dist/web/client/assets/{_id-DxopIW-y.js → _id-DmEVZIlx.js} +1 -1
  20. package/dist/web/client/assets/activity-Bzr8R18n.js +1 -0
  21. package/dist/web/client/assets/{agents-CMPOFcs-.js → agents-13oafeOA.js} +1 -1
  22. package/dist/web/client/assets/{agents-O4soKZND.js → agents-DF4NALmJ.js} +1 -1
  23. package/dist/web/client/assets/{approvals-CwDu_lrA.js → approvals-DsG0Ijls.js} +1 -1
  24. package/dist/web/client/assets/{attention-BY8MMuM_.js → attention-DG7K25mz.js} +1 -1
  25. package/dist/web/client/assets/chevron-right-DFqFHtLy.js +1 -0
  26. package/dist/web/client/assets/config-DAaDbFhS.js +3 -0
  27. package/dist/web/client/assets/createServerFn-Dzfjt7mA.js +3 -0
  28. package/dist/web/client/assets/git-review-presentation-CzHQulDk.js +1 -0
  29. package/dist/web/client/assets/{inbox-CWXql0K3.js → inbox-C9e7QjsX.js} +1 -1
  30. package/dist/web/client/assets/index-Dsstm2hf.js +50 -0
  31. package/dist/web/client/assets/{learning-DAm4dyyc.js → learning-23arTd21.js} +1 -1
  32. package/dist/web/client/assets/login-BIXnBsuj.js +1 -0
  33. package/dist/web/client/assets/{mcp-loLB0wuh.js → mcp-Cdx9qAl8.js} +1 -1
  34. package/dist/web/client/assets/{members-BJ0ikkTl.js → members-fotOz4rR.js} +1 -1
  35. package/dist/web/client/assets/{memory-Drn9Gv53.js → memory-C7UznVot.js} +1 -1
  36. package/dist/web/client/assets/policy-CactLW1X.js +1 -0
  37. package/dist/web/client/assets/{results-9exU6f7m.js → results-DqEuYnQH.js} +1 -1
  38. package/dist/web/client/assets/review-CnBSYclb.js +1 -0
  39. package/dist/web/client/assets/routes-COxMuwVz.js +1 -0
  40. package/dist/web/client/assets/{services-BLso1BhA.js → services-xEANwZAu.js} +1 -1
  41. package/dist/web/client/assets/{skills-BodqX3OI.js → skills-CamV6wYM.js} +1 -1
  42. package/dist/web/client/assets/{styles-d1yjBpud.css → styles-C6br2xxl.css} +1 -1
  43. package/dist/web/client/assets/{teams-ByQedXZi.js → teams-B12dMSjW.js} +1 -1
  44. package/dist/web/client/assets/{teams-SYsF1bOR.js → teams-CbH43zSG.js} +1 -1
  45. package/dist/web/client/assets/{telegram-DC9PLFbB.js → telegram-muIql4u-.js} +1 -1
  46. package/dist/web/client/assets/{tokens-DGy8Ijpo.js → tokens-DGFmApdF.js} +1 -1
  47. package/dist/web/client/assets/{triggers-BXpVmHDG.js → triggers-D8n3sCBW.js} +1 -1
  48. package/dist/web/client/assets/welcome-CMHWRZhs.js +1 -0
  49. package/dist/web/client/assets/x-BGCHwZOH.js +1 -0
  50. package/dist/web/server/assets/{ChatPane-CS5oI7ef.js → ChatPane-DybH39WK.js} +301 -14
  51. package/dist/web/server/assets/{ResultSourceConversation-BpVWBRYq.js → ResultSourceConversation-BmXTcEOA.js} +1 -1
  52. package/dist/web/server/assets/{TeamTabs-TCKjCvMA.js → TeamTabs-DQXh-3ij.js} +4 -0
  53. package/dist/web/server/assets/{_id-5pgKoid8.js → _id-BN1BPEDI.js} +1 -1
  54. package/dist/web/server/assets/{_id-DFHB9JFQ.js → _id-BYKpT2Tu.js} +1 -1
  55. package/dist/web/server/assets/{_id-B_-CDHOi2.js → _id-BqWTB8Wl.js} +1 -1
  56. package/dist/web/server/assets/{_id-BG2nkGxa.js → _id-CPfILjMa.js} +1 -1
  57. package/dist/web/server/assets/{_id-BnqodC1c2.js → _id-C_2er0_G.js} +3 -3
  58. package/dist/web/server/assets/{_id-DtIYuJJX.js → _id-DDyA9CGX.js} +1 -1
  59. package/dist/web/server/assets/{_id-DrB9uR1b.js → _id-DSPFJMzf.js} +1 -1
  60. package/dist/web/server/assets/{_id-DwZXhLlL.js → _id-DtJn-yzu.js} +2 -2
  61. package/dist/web/server/assets/{_id-CeyHEsCZ.js → _id-Dw3gKOGv.js} +1 -1
  62. package/dist/web/server/assets/{_id-DOnInzLb.js → _id-XkxlX036.js} +1 -1
  63. package/dist/web/server/assets/{_tanstack-start-manifest_v-D7gKv6m6.js → _tanstack-start-manifest_v-vOXRfKJD.js} +91 -78
  64. package/dist/web/server/assets/{activity-C88qrNqv.js → activity-BX1jZBPQ.js} +1 -1
  65. package/dist/web/server/assets/{activity-5fWKPDxj.js → activity-bozPMU2v.js} +2 -2
  66. package/dist/web/server/assets/{activity-0VUkStOu.js → activity-pYQPT3QT.js} +1 -1
  67. package/dist/web/server/assets/{agents-CSXLaM2W.js → agents-BKBfW700.js} +1 -1
  68. package/dist/web/server/assets/{agents-C86K6HvS.js → agents-CVCfxnE2.js} +1 -1
  69. package/dist/web/server/assets/{approvals-C3MysI6l.js → approvals-C3ya6B6U.js} +1 -1
  70. package/dist/web/server/assets/{attention-DLeLCKah.js → attention-l28hGCHS.js} +1 -1
  71. package/dist/web/server/assets/{auth-CDZp9aEk.js → auth-AvDFNeOv.js} +1 -1
  72. package/dist/web/server/assets/{config-BVTHvljR.js → config-BWKn4XII.js} +1 -1
  73. package/dist/web/server/assets/{daemon-client-xWyYKAcx.js → daemon-client-Cgx-YW4l.js} +30 -0
  74. package/dist/web/server/assets/git-review-BB3M9nYg.js +26 -0
  75. package/dist/web/server/assets/git-review-f_uta4Mx.js +179 -0
  76. package/dist/web/server/assets/git-review-presentation-TJiHJhen.js +81 -0
  77. package/dist/web/server/assets/{inbox-PQTrjtOw.js → inbox-BBZiOOQs.js} +1 -1
  78. package/dist/web/server/assets/{learning-K0cmDsZR.js → learning-CheVay1i.js} +1 -1
  79. package/dist/web/server/assets/{mcp-Rtraochg.js → mcp-DCBDmNtQ.js} +1 -1
  80. package/dist/web/server/assets/{members-grAKFWgv.js → members-C2He8mrU.js} +1 -1
  81. package/dist/web/server/assets/{members-CD3GiTfF.js → members-C5FQruRZ.js} +1 -1
  82. package/dist/web/server/assets/{members-cc5SeEaW.js → members-C_2xB9pr.js} +2 -2
  83. package/dist/web/server/assets/{memory-CVqnyUaM.js → memory-4tI-UbOf.js} +1 -1
  84. package/dist/web/server/assets/{memory-C5i_GxlY.js → memory-BTcmf0sD.js} +2 -2
  85. package/dist/web/server/assets/{memory-egFpBD1g.js → memory-rmiFNj7T.js} +1 -1
  86. package/dist/web/server/assets/{policy-Dgjb0_gK.js → policy-BGILKGHz.js} +2 -2
  87. package/dist/web/server/assets/{policy-bLKwvnja.js → policy-C3D2Q1EA.js} +1 -1
  88. package/dist/web/server/assets/{policy-ooSBgiDS.js → policy-DS7LGe--.js} +1 -1
  89. package/dist/web/server/assets/{results-DXdYtHaq.js → results-C6H42tjq.js} +1 -1
  90. package/dist/web/server/assets/{results-CfNsFncJ.js → results-Cgx7SrFt.js} +3 -3
  91. package/dist/web/server/assets/{results-N-kP4iFT.js → results-_6K_zXQS.js} +1 -1
  92. package/dist/web/server/assets/review-DHhiL-JQ.js +393 -0
  93. package/dist/web/server/assets/review-DSTMCwP4.js +14 -0
  94. package/dist/web/server/assets/{router-B6g_s7W3.js → router-ElARvZzI.js} +34 -27
  95. package/dist/web/server/assets/{routes-pcRy_Sf8.js → routes-B6x3pEW8.js} +1 -1
  96. package/dist/web/server/assets/{routes-BqSaZvlu.js → routes-BgMvLvS-.js} +1 -1
  97. package/dist/web/server/assets/{routes-Dsh8F_7i.js → routes-DsUzzxk4.js} +2 -2
  98. package/dist/web/server/assets/{services-DlZA8fRL.js → services-yHZroxsi.js} +1 -1
  99. package/dist/web/server/assets/{skills-i2duvgW-.js → skills--bIKID1Q.js} +1 -1
  100. package/dist/web/server/assets/{teams-B1AI3NfN.js → teams--a956vWL.js} +1 -1
  101. package/dist/web/server/assets/{teams-6RYIj1Xm.js → teams-BbRfuVXY.js} +1 -1
  102. package/dist/web/server/assets/{telegram-C4q0YTVn.js → telegram-4kMxRtVZ.js} +1 -1
  103. package/dist/web/server/assets/{tokens-RFquA2Bx.js → tokens-BYwTN9JZ.js} +1 -1
  104. package/dist/web/server/assets/{triggers-DVD-iE-N.js → triggers-BM6mzLuH.js} +1 -1
  105. package/dist/web/server/server.js +56 -28
  106. package/dist/worker.js +292 -75
  107. package/dist/worker.js.map +1 -1
  108. package/package.json +3 -3
  109. package/dist/web/client/assets/ChatPane-CQZzxOir.js +0 -76
  110. package/dist/web/client/assets/ProductionTeamPolicyEditor-DqUnN_ce.js +0 -7
  111. package/dist/web/client/assets/ProfileCommunicationEditor-DArXub0b.js +0 -1
  112. package/dist/web/client/assets/TeamTabs-DbIk5vvT.js +0 -1
  113. package/dist/web/client/assets/TemplatesTabs-CatJIjGi.js +0 -1
  114. package/dist/web/client/assets/_id-CrnEVcw8.js +0 -1
  115. package/dist/web/client/assets/activity-CrG8Bg60.js +0 -1
  116. package/dist/web/client/assets/chevron-right-Cf6vKeLq.js +0 -1
  117. package/dist/web/client/assets/config-Cn4iBJFz.js +0 -3
  118. package/dist/web/client/assets/index-Bq2zrG2_.js +0 -52
  119. package/dist/web/client/assets/login-BsABI8Ux.js +0 -1
  120. package/dist/web/client/assets/policy-pQadZyk0.js +0 -1
  121. package/dist/web/client/assets/routes-jw1PuqiR.js +0 -1
  122. package/dist/web/client/assets/welcome-BKsnsCxJ.js +0 -1
  123. package/dist/web/client/assets/x-BK4xNCzS.js +0 -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 defineCommand34, runCommand, showUsage } from "citty";
4
+ import { defineCommand as defineCommand36, runCommand, showUsage } from "citty";
5
5
 
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "bazilion",
9
- version: "0.16.0",
9
+ version: "0.17.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: {
@@ -188,6 +188,43 @@ function createClient(cfg) {
188
188
  input
189
189
  )
190
190
  },
191
+ /** Read-only Git change review and bounded source snapshots (BAZ-042). */
192
+ repositoryReview: (teamId) => {
193
+ const base = `/api/teams/${encodeURIComponent(teamId)}/review`;
194
+ return {
195
+ changes: (options = {}) => {
196
+ const params = new URLSearchParams();
197
+ if (options.base !== void 0) params.set("base", options.base);
198
+ if (options.patches) params.set("patches", "1");
199
+ const suffix = params.size ? `?${params}` : "";
200
+ return request("GET", `${base}${suffix}`);
201
+ },
202
+ snapshots: () => request("GET", `${base}/snapshots`),
203
+ snapshot: (snapshotId) => request("GET", `${base}/snapshots/${encodeURIComponent(snapshotId)}`),
204
+ capture: (input) => request("POST", `${base}/snapshots`, input)
205
+ };
206
+ },
207
+ /** Operator retained-diagnostic access for BAZ-041 receipts. */
208
+ codingLogs: (teamId) => {
209
+ const base = `/api/teams/${encodeURIComponent(teamId)}/coding-commands`;
210
+ const item = (commandId) => `${base}/${encodeURIComponent(commandId)}/log`;
211
+ return {
212
+ page: (commandId, options = {}) => {
213
+ const params = new URLSearchParams();
214
+ if (options.offset !== void 0) params.set("offset", String(options.offset));
215
+ if (options.limit !== void 0) params.set("limit", String(options.limit));
216
+ const suffix = params.size ? `?${params}` : "";
217
+ return request(
218
+ "GET",
219
+ `${item(commandId)}${suffix}`
220
+ );
221
+ },
222
+ search: (commandId, query) => request(
223
+ "GET",
224
+ `${item(commandId)}/search?q=${encodeURIComponent(query)}`
225
+ )
226
+ };
227
+ },
191
228
  repositoryContext: (teamId, options = {}) => request(
192
229
  "GET",
193
230
  `/api/teams/${encodeURIComponent(teamId)}/repository-context${options.target !== void 0 ? `?target=${encodeURIComponent(options.target)}` : ""}`
@@ -836,6 +873,30 @@ async function promptForQuestion(item, prompt) {
836
873
  }
837
874
  }
838
875
 
876
+ // src/repeatable-args.ts
877
+ function collectFlagValues(rawArgs, name) {
878
+ const values = [];
879
+ const long = `--${name}`;
880
+ for (let i = 0; i < rawArgs.length; i++) {
881
+ const arg = rawArgs[i];
882
+ if (arg === void 0) continue;
883
+ if (arg === "--") break;
884
+ if (arg === long) {
885
+ const next = rawArgs[i + 1];
886
+ if (next !== void 0 && next !== "--") {
887
+ values.push(next);
888
+ i++;
889
+ }
890
+ continue;
891
+ }
892
+ if (arg.startsWith(`${long}=`)) {
893
+ const value = arg.slice(long.length + 1);
894
+ if (value.length > 0) values.push(value);
895
+ }
896
+ }
897
+ return values;
898
+ }
899
+
839
900
  // src/commands/agent.ts
840
901
  var IMAGE_MIME = {
841
902
  ".png": "image/png",
@@ -867,9 +928,6 @@ function loadFiles(paths) {
867
928
  data: readFileSync3(p).toString("base64")
868
929
  }));
869
930
  }
870
- function asPaths(v) {
871
- return v ? Array.isArray(v) ? v : [v] : [];
872
- }
873
931
  var spawnCmd = defineCommand5({
874
932
  meta: { name: "spawn", description: "Spawn an agent from a profile into a team" },
875
933
  args: {
@@ -1224,20 +1282,20 @@ var chatCmd = defineCommand5({
1224
1282
  },
1225
1283
  image: {
1226
1284
  type: "string",
1227
- description: "Attach an image file (png/jpg/gif/webp; repeatable). One-shot mode."
1285
+ description: "Attach an image file (png/jpg/gif/webp; repeat the flag for more). One-shot mode."
1228
1286
  },
1229
1287
  file: {
1230
1288
  type: "string",
1231
- description: "Attach any file \u2014 the agent gets a path reference (repeatable). One-shot mode."
1289
+ description: "Attach any file \u2014 the agent gets a path reference (repeat the flag for more). One-shot mode."
1232
1290
  }
1233
1291
  },
1234
- async run({ args: args2 }) {
1292
+ async run({ args: args2, rawArgs }) {
1235
1293
  const client = createClient2();
1236
1294
  const resolved = await client.get(`/api/agents/${args2.id}`);
1237
1295
  const bashApprovalMode = bashApprovalModeForTty(stdin.isTTY, stdout.isTTY);
1238
1296
  const attachments = [
1239
- ...loadImages(asPaths(args2.image)),
1240
- ...loadFiles(asPaths(args2.file))
1297
+ ...loadImages(collectFlagValues(rawArgs, "image")),
1298
+ ...loadFiles(collectFlagValues(rawArgs, "file"))
1241
1299
  ];
1242
1300
  if (args2.message || attachments.length > 0) {
1243
1301
  const rl2 = bashApprovalMode === "interactive" ? createInterface({ input: stdin, output: stdout }) : null;
@@ -2226,6 +2284,12 @@ function invalidateRestoredCodingEvidence(db, payload, targetHome) {
2226
2284
  row2.id
2227
2285
  );
2228
2286
  }
2287
+ const restoredAt = Date.now();
2288
+ db.prepare(
2289
+ `UPDATE coding_command_logs SET state = 'expired', text = NULL, byte_length = 0, retired_at = ?
2290
+ WHERE state = 'retained' AND expires_at <= ?`
2291
+ ).run(restoredAt, restoredAt);
2292
+ db.prepare("DELETE FROM source_snapshots WHERE expires_at <= ?").run(restoredAt);
2229
2293
  db.prepare("UPDATE workspace_writers SET state = 'recovery', recovery_mode = 'restored'").run();
2230
2294
  const teams = db.prepare("SELECT id FROM teams").all();
2231
2295
  const rebase = db.prepare("UPDATE workspace_writers SET root_path = ? WHERE team_id = ?");
@@ -2307,13 +2371,19 @@ function pauseRestoredUserQueue(database) {
2307
2371
  // src/backup-schema.ts
2308
2372
  import { createHash } from "crypto";
2309
2373
  var CANONICAL_MIGRATION = "0001_init";
2310
- var CANONICAL_SCHEMA_HASH = "50e8e9fcbf9bc995ec343f4b1a81000e05f5a62e514dc20fca91d275ef0e3cf1";
2374
+ var CANONICAL_SCHEMA_HASH = "8454a37b1985d248bb25c6588d81b5f00506e13387600c4441ba01727d10bcaf";
2311
2375
  var CANONICAL_OBJECTS = [
2312
2376
  ["table", "team_coding_environments"],
2313
2377
  ["table", "workspace_writers"],
2314
2378
  ["table", "workspace_resources"],
2315
2379
  ["table", "coding_commands"],
2316
2380
  ["index", "coding_command_history"],
2381
+ ["table", "coding_command_logs"],
2382
+ ["index", "coding_command_logs_retention"],
2383
+ ["index", "coding_command_logs_team_time"],
2384
+ ["table", "source_snapshots"],
2385
+ ["index", "source_snapshots_retention"],
2386
+ ["index", "source_snapshots_team_time"],
2317
2387
  ["table", "notification_settings"],
2318
2388
  ["table", "notification_receipts"],
2319
2389
  ["index", "notification_receipts_state"],
@@ -4792,6 +4862,14 @@ import { readFileSync as readFileSync7, rmSync as rmSync3, writeFileSync as writ
4792
4862
  import { tmpdir as tmpdir2 } from "os";
4793
4863
  import { join as join4 } from "path";
4794
4864
 
4865
+ // ../../packages/api-types/src/git-review.ts
4866
+ var REVIEW_LIMITS = {
4867
+ files: 1e3,
4868
+ fileBytes: 1024 * 1024,
4869
+ totalBytes: 16 * 1024 * 1024,
4870
+ patchBytes: 256 * 1024
4871
+ };
4872
+
4795
4873
  // ../../packages/api-types/src/index.ts
4796
4874
  var PROFILE_FILES = [
4797
4875
  "profile.json",
@@ -5541,25 +5619,82 @@ var skillCommand = defineCommand25({
5541
5619
  // src/commands/team.ts
5542
5620
  import { readFileSync as readFileSync11 } from "fs";
5543
5621
  import { stdin as stdin2 } from "process";
5544
- import { defineCommand as defineCommand28 } from "citty";
5622
+ import { defineCommand as defineCommand30 } from "citty";
5623
+
5624
+ // src/commands/team-coding-log.ts
5625
+ import { defineCommand as defineCommand26 } from "citty";
5626
+ var teamCodingLogCommand = defineCommand26({
5627
+ meta: {
5628
+ name: "log",
5629
+ description: "Read retained diagnostics for a shared coding command receipt"
5630
+ },
5631
+ args: {
5632
+ team: { type: "positional", required: true, description: "Team slug" },
5633
+ commandId: { type: "positional", required: true, description: "Coding command id" },
5634
+ offset: { type: "string", description: "UTF-8 byte offset into the retained tail" },
5635
+ limit: { type: "string", description: "Maximum bytes to read (default 64 KiB)" },
5636
+ search: { type: "string", description: "Literal search instead of a page read" }
5637
+ },
5638
+ async run({ args: args2 }) {
5639
+ const client = createClient2().codingLogs(args2.team);
5640
+ if (args2.search !== void 0) {
5641
+ const { view: view2, result } = await client.search(args2.commandId, args2.search);
5642
+ if (!result) {
5643
+ console.log(`Coding log withheld (${view2.availability}); not shared for disclosure.`);
5644
+ return;
5645
+ }
5646
+ console.log(
5647
+ `${view2.availability}${result.bounded ? " \xB7 bounded scan" : ""} \xB7 ${result.matches.length} match(es)`
5648
+ );
5649
+ for (const match of result.matches) {
5650
+ console.log(`${match.line}:${match.offset} ${match.excerpt.replace(/\n/g, "\\n")}`);
5651
+ }
5652
+ return;
5653
+ }
5654
+ const offset = args2.offset === void 0 ? void 0 : Number(args2.offset);
5655
+ const limit = args2.limit === void 0 ? void 0 : Number(args2.limit);
5656
+ if (offset !== void 0 && (!Number.isSafeInteger(offset) || offset < 0) || limit !== void 0 && !Number.isSafeInteger(limit)) {
5657
+ console.error("offset and limit must be non-negative integers");
5658
+ process.exitCode = 1;
5659
+ return;
5660
+ }
5661
+ const { view, page } = await client.page(args2.commandId, {
5662
+ ...offset !== void 0 ? { offset } : {},
5663
+ ...limit !== void 0 ? { limit } : {}
5664
+ });
5665
+ if (!page) {
5666
+ console.log(`Coding log withheld (${view.availability}); not shared for disclosure.`);
5667
+ return;
5668
+ }
5669
+ console.log(
5670
+ `${view.availability} \xB7 ${view.byteLength} retained byte(s) of ${view.observedBytes} observed` + (view.redacted ? " \xB7 redacted" : "") + ` \xB7 expires ${new Date(view.expiresAt).toISOString()}`
5671
+ );
5672
+ process.stdout.write(page.text);
5673
+ if (page.hasMore)
5674
+ console.log(
5675
+ `
5676
+ \u2026 truncated; continue with --offset ${page.offset + Buffer.byteLength(page.text)}`
5677
+ );
5678
+ }
5679
+ });
5545
5680
 
5546
5681
  // src/commands/team-environment.ts
5547
5682
  import { readFileSync as readFileSync9 } from "fs";
5548
- import { defineCommand as defineCommand26 } from "citty";
5683
+ import { defineCommand as defineCommand27 } from "citty";
5549
5684
  var args = { id: { type: "positional", required: true, description: "Team slug" } };
5550
- var teamEnvironmentCommand = defineCommand26({
5685
+ var teamEnvironmentCommand = defineCommand27({
5551
5686
  meta: {
5552
5687
  name: "environment",
5553
5688
  description: "Optional Team runtime defaults; Agents discover and run commands during tasks"
5554
5689
  },
5555
5690
  subCommands: {
5556
- show: defineCommand26({
5691
+ show: defineCommand27({
5557
5692
  args,
5558
5693
  async run({ args: args2 }) {
5559
5694
  console.log(JSON.stringify(await createClient2().codingEnvironment.show(args2.id), null, 2));
5560
5695
  }
5561
5696
  }),
5562
- configure: defineCommand26({
5697
+ configure: defineCommand27({
5563
5698
  args: {
5564
5699
  ...args,
5565
5700
  file: {
@@ -5582,7 +5717,7 @@ var teamEnvironmentCommand = defineCommand26({
5582
5717
 
5583
5718
  // src/commands/team-policy.ts
5584
5719
  import { readFileSync as readFileSync10 } from "fs";
5585
- import { defineCommand as defineCommand27 } from "citty";
5720
+ import { defineCommand as defineCommand28 } from "citty";
5586
5721
 
5587
5722
  // src/team-interchange.ts
5588
5723
  var TEAM_POLICY_INTERCHANGE_VERSION = 1;
@@ -5830,7 +5965,7 @@ function printPolicy(detail) {
5830
5965
  console.log(line);
5831
5966
  }
5832
5967
  }
5833
- var show5 = defineCommand27({
5968
+ var show5 = defineCommand28({
5834
5969
  meta: { name: "show", description: "Show the one effective live policy for a Team" },
5835
5970
  args: {
5836
5971
  team: { type: "positional", required: true },
@@ -5844,7 +5979,7 @@ var show5 = defineCommand27({
5844
5979
  else printPolicy(detail);
5845
5980
  }
5846
5981
  });
5847
- var exportCommand = defineCommand27({
5982
+ var exportCommand = defineCommand28({
5848
5983
  meta: { name: "export", description: "Export a revisioned Team policy document" },
5849
5984
  args: { team: { type: "positional", required: true } },
5850
5985
  async run({ args: args2 }) {
@@ -5868,7 +6003,7 @@ function printEdgeDiff(current, edges) {
5868
6003
  for (const value of diff2.added) console.log(` + ${value}`);
5869
6004
  for (const value of diff2.removed) console.log(` - ${value}`);
5870
6005
  }
5871
- var importCommand = defineCommand27({
6006
+ var importCommand = defineCommand28({
5872
6007
  meta: {
5873
6008
  name: "import",
5874
6009
  description: "Validate, diff, and explicitly replace a Team policy"
@@ -5923,7 +6058,7 @@ var importCommand = defineCommand27({
5923
6058
  console.log(`updated Team ${args2.team} policy to revision ${updated.teamPolicy.revision}`);
5924
6059
  }
5925
6060
  });
5926
- var diff = defineCommand27({
6061
+ var diff = defineCommand28({
5927
6062
  meta: { name: "diff", description: "Compare live policy with its retained baseline source" },
5928
6063
  args: {
5929
6064
  team: { type: "positional", required: true },
@@ -5947,7 +6082,7 @@ var diff = defineCommand27({
5947
6082
  );
5948
6083
  }
5949
6084
  });
5950
- var evaluate = defineCommand27({
6085
+ var evaluate = defineCommand28({
5951
6086
  meta: {
5952
6087
  name: "evaluate",
5953
6088
  description: "Evaluate a communication path without sending or recording a block"
@@ -5978,7 +6113,7 @@ var evaluate = defineCommand27({
5978
6113
  );
5979
6114
  }
5980
6115
  });
5981
- var blocks = defineCommand27({
6116
+ var blocks = defineCommand28({
5982
6117
  meta: { name: "blocks", description: "List paginated durable communication denials" },
5983
6118
  args: {
5984
6119
  team: { type: "positional", required: true },
@@ -6027,7 +6162,7 @@ var blocks = defineCommand27({
6027
6162
  if (page.nextCursor) console.log(`next cursor: ${page.nextCursor}`);
6028
6163
  }
6029
6164
  });
6030
- var teamPolicyCommand = defineCommand27({
6165
+ var teamPolicyCommand = defineCommand28({
6031
6166
  meta: { name: "policy", description: "Inspect and manage the Team-owned live policy" },
6032
6167
  subCommands: {
6033
6168
  show: show5,
@@ -6039,8 +6174,187 @@ var teamPolicyCommand = defineCommand27({
6039
6174
  }
6040
6175
  });
6041
6176
 
6177
+ // src/commands/team-review.ts
6178
+ import { defineCommand as defineCommand29 } from "citty";
6179
+ var slug = {
6180
+ id: { type: "positional", required: true, description: "Team slug" }
6181
+ };
6182
+ function printIssues(changes) {
6183
+ for (const issue of changes.issues) console.log(`note: ${issue.code}: ${issue.message}`);
6184
+ }
6185
+ var showCmd5 = defineCommand29({
6186
+ meta: {
6187
+ name: "show",
6188
+ description: "List changes since a baseline (read-only)"
6189
+ },
6190
+ args: {
6191
+ ...slug,
6192
+ base: {
6193
+ type: "string",
6194
+ description: "Comparison base: branch, tag or commit id (default HEAD)"
6195
+ },
6196
+ patch: {
6197
+ type: "string",
6198
+ description: "Print the unified diff for one changed path instead of the list"
6199
+ },
6200
+ json: { type: "boolean", description: "Emit the complete review as JSON" }
6201
+ },
6202
+ async run({ args: args2 }) {
6203
+ const client = createClient2();
6204
+ const review = await client.repositoryReview(args2.id).changes({
6205
+ ...args2.base ? { base: args2.base } : {},
6206
+ patches: true
6207
+ });
6208
+ if (args2.json) {
6209
+ console.log(JSON.stringify(review, null, 2));
6210
+ return;
6211
+ }
6212
+ const changes = review.changes;
6213
+ if (args2.patch) {
6214
+ const entry3 = changes.changes.find((change) => change.path === args2.patch);
6215
+ if (!entry3) {
6216
+ console.error(`no change for path: ${args2.patch}`);
6217
+ process.exit(1);
6218
+ }
6219
+ if (!entry3.patch) {
6220
+ console.log(
6221
+ `${entry3.path}: ${entry3.status}${entry3.contentOmitted ? ` (${entry3.contentOmitted})` : " (no content)"}`
6222
+ );
6223
+ return;
6224
+ }
6225
+ console.log(entry3.patch);
6226
+ if (entry3.patchTruncated) console.log("(diff truncated at the configured patch cap)");
6227
+ return;
6228
+ }
6229
+ console.log(
6230
+ `# ${changes.identity.branch ?? `detached ${changes.identity.head ?? "unborn"}`} \xB7 base ${changes.base.requestedRef} (${changes.base.resolvedOid.slice(0, 12)})`
6231
+ );
6232
+ if (changes.changes.length === 0) console.log("(no changes since baseline)");
6233
+ const rows = changes.changes.map((change) => [
6234
+ change.status,
6235
+ change.previousPath ? `${change.previousPath} -> ${change.path}` : change.path,
6236
+ change.binary ? "binary" : `${change.addedLines ?? 0}+ ${change.deletedLines ?? 0}-`,
6237
+ change.contentOmitted ?? ""
6238
+ ]);
6239
+ for (const line of columnize(rows)) console.log(line);
6240
+ if (changes.truncated) console.log("note: the change list is incomplete (file limit)");
6241
+ const withheld = changes.withheld;
6242
+ if (withheld.excluded + withheld.untracked > 0) {
6243
+ console.log(
6244
+ `note: ${withheld.excluded} excluded and ${withheld.untracked} untracked path(s) withheld`
6245
+ );
6246
+ }
6247
+ printIssues(changes);
6248
+ }
6249
+ });
6250
+ var captureCmd = defineCommand29({
6251
+ meta: {
6252
+ name: "capture",
6253
+ description: "Capture a bounded source snapshot for a Team (read-only)"
6254
+ },
6255
+ args: {
6256
+ ...slug,
6257
+ base: { type: "string", description: "Comparison base (default HEAD)" },
6258
+ include: {
6259
+ type: "string",
6260
+ // Read from raw arguments: citty keeps only the last value of a repeated flag.
6261
+ description: "Untracked path to include by content (repeat the flag for more)"
6262
+ },
6263
+ json: { type: "boolean", description: "Emit the complete snapshot as JSON" }
6264
+ },
6265
+ async run({ args: args2, rawArgs }) {
6266
+ const client = createClient2();
6267
+ const includeUntracked = collectFlagValues(rawArgs, "include");
6268
+ if (includeUntracked.length > 1e3) {
6269
+ console.error("team review capture: too many paths to include");
6270
+ process.exit(1);
6271
+ }
6272
+ const captured = await client.repositoryReview(args2.id).capture({
6273
+ ...args2.base ? { base: args2.base } : {},
6274
+ ...includeUntracked.length > 0 ? { includeUntracked } : {}
6275
+ });
6276
+ if (args2.json) {
6277
+ console.log(JSON.stringify(captured, null, 2));
6278
+ return;
6279
+ }
6280
+ const { snapshot, reference } = captured;
6281
+ console.log(`snapshot ${reference.id}`);
6282
+ console.log(` complete: ${reference.complete ? "yes" : "no (applicability is unknown)"}`);
6283
+ console.log(` head: ${snapshot.head ?? "(unborn)"}`);
6284
+ console.log(
6285
+ ` entries: ${snapshot.entries.length} \xB7 included untracked: ${snapshot.untrackedIncluded.length}`
6286
+ );
6287
+ if (snapshot.exclusions.length > 0) {
6288
+ console.log(` excluded: ${snapshot.exclusions.map((item) => item.path).join(", ")}`);
6289
+ }
6290
+ for (const issue of snapshot.issues) console.log(` note: ${issue.code}: ${issue.message}`);
6291
+ }
6292
+ });
6293
+ var snapshotsCmd = defineCommand29({
6294
+ meta: { name: "snapshots", description: "List retained source snapshots for a Team" },
6295
+ args: { ...slug, json: { type: "boolean", description: "Emit JSON" } },
6296
+ async run({ args: args2 }) {
6297
+ const client = createClient2();
6298
+ const list8 = await client.repositoryReview(args2.id).snapshots();
6299
+ if (args2.json) {
6300
+ console.log(JSON.stringify(list8, null, 2));
6301
+ return;
6302
+ }
6303
+ if (list8.snapshots.length === 0) {
6304
+ console.log("(no retained snapshots)");
6305
+ return;
6306
+ }
6307
+ const rows = list8.snapshots.map((snapshot) => [
6308
+ snapshot.snapshotId.slice(0, 12),
6309
+ snapshot.complete ? "complete" : "incomplete",
6310
+ snapshot.capturedBy,
6311
+ new Date(snapshot.createdAt).toISOString(),
6312
+ `${snapshot.entryCount} entries`
6313
+ ]);
6314
+ for (const line of columnize(rows)) console.log(line);
6315
+ }
6316
+ });
6317
+ var snapshotCmd = defineCommand29({
6318
+ meta: { name: "snapshot", description: "Show one retained source snapshot" },
6319
+ args: {
6320
+ ...slug,
6321
+ snapshot: { type: "positional", required: true, description: "Snapshot id" },
6322
+ json: { type: "boolean", description: "Emit JSON" }
6323
+ },
6324
+ async run({ args: args2 }) {
6325
+ const client = createClient2();
6326
+ const { snapshot } = await client.repositoryReview(args2.id).snapshot(args2.snapshot);
6327
+ if (args2.json) {
6328
+ console.log(JSON.stringify(snapshot, null, 2));
6329
+ return;
6330
+ }
6331
+ console.log(`snapshot ${snapshot.id} \xB7 ${snapshot.complete ? "complete" : "incomplete"}`);
6332
+ console.log(` head: ${snapshot.head ?? "(unborn)"} \xB7 base: ${snapshot.base.resolvedOid}`);
6333
+ const rows = snapshot.entries.map((entry3) => [
6334
+ entry3.layer,
6335
+ entry3.kind,
6336
+ entry3.path,
6337
+ entry3.bytes === null ? "-" : `${entry3.bytes}B`,
6338
+ entry3.digest === null ? "" : entry3.digest.slice(0, 12)
6339
+ ]);
6340
+ for (const line of columnize(rows)) console.log(line);
6341
+ }
6342
+ });
6343
+ var teamReviewCommand = defineCommand29({
6344
+ meta: {
6345
+ name: "review",
6346
+ description: "Read-only Git change review and bounded source snapshots"
6347
+ },
6348
+ subCommands: {
6349
+ show: showCmd5,
6350
+ capture: captureCmd,
6351
+ snapshots: snapshotsCmd,
6352
+ snapshot: snapshotCmd
6353
+ }
6354
+ });
6355
+
6042
6356
  // src/commands/team.ts
6043
- var addCmd2 = defineCommand28({
6357
+ var addCmd2 = defineCommand30({
6044
6358
  meta: {
6045
6359
  name: "add",
6046
6360
  description: "Register a team at ~/.bazilion/teams/<slug>/ (use --link to point at an existing tree)"
@@ -6064,7 +6378,7 @@ var addCmd2 = defineCommand28({
6064
6378
  console.log(`registered team ${g.id} at ${g.path}`);
6065
6379
  }
6066
6380
  });
6067
- var listCmd10 = defineCommand28({
6381
+ var listCmd10 = defineCommand30({
6068
6382
  meta: { name: "list", description: "List teams" },
6069
6383
  async run() {
6070
6384
  const client = createClient2();
@@ -6077,7 +6391,7 @@ var listCmd10 = defineCommand28({
6077
6391
  for (const line of columnize(rows)) console.log(line);
6078
6392
  }
6079
6393
  });
6080
- var rmCmd5 = defineCommand28({
6394
+ var rmCmd5 = defineCommand30({
6081
6395
  meta: { name: "rm", description: "Remove a team registration" },
6082
6396
  args: {
6083
6397
  id: { type: "positional", required: true }
@@ -6098,7 +6412,7 @@ async function readStdin() {
6098
6412
  for await (const chunk of stdin2) chunks.push(chunk);
6099
6413
  return Buffer.concat(chunks).toString("utf8");
6100
6414
  }
6101
- var userMdShowCmd = defineCommand28({
6415
+ var userMdShowCmd = defineCommand30({
6102
6416
  meta: { name: "show", description: "Print the team's USER.md" },
6103
6417
  args: { id: { type: "positional", required: true } },
6104
6418
  async run({ args: args2 }) {
@@ -6108,7 +6422,7 @@ var userMdShowCmd = defineCommand28({
6108
6422
  if (g.userMd && !g.userMd.endsWith("\n")) process.stdout.write("\n");
6109
6423
  }
6110
6424
  });
6111
- var userMdSetCmd = defineCommand28({
6425
+ var userMdSetCmd = defineCommand30({
6112
6426
  meta: {
6113
6427
  name: "set",
6114
6428
  description: "Replace the team's USER.md (from --file, --from-stdin, or inline text)"
@@ -6134,7 +6448,7 @@ var userMdSetCmd = defineCommand28({
6134
6448
  console.log(`updated USER.md for team ${args2.id} (${content.length} bytes)`);
6135
6449
  }
6136
6450
  });
6137
- var userMdClearCmd = defineCommand28({
6451
+ var userMdClearCmd = defineCommand30({
6138
6452
  meta: { name: "clear", description: "Clear the team's USER.md to empty" },
6139
6453
  args: { id: { type: "positional", required: true } },
6140
6454
  async run({ args: args2 }) {
@@ -6144,7 +6458,7 @@ var userMdClearCmd = defineCommand28({
6144
6458
  console.log(`cleared USER.md for team ${args2.id}`);
6145
6459
  }
6146
6460
  });
6147
- var userMdCmd = defineCommand28({
6461
+ var userMdCmd = defineCommand30({
6148
6462
  meta: { name: "user-md", description: "View or edit a team's USER.md" },
6149
6463
  subCommands: {
6150
6464
  show: userMdShowCmd,
@@ -6152,7 +6466,7 @@ var userMdCmd = defineCommand28({
6152
6466
  clear: userMdClearCmd
6153
6467
  }
6154
6468
  });
6155
- var topicFormatShowCmd = defineCommand28({
6469
+ var topicFormatShowCmd = defineCommand30({
6156
6470
  meta: { name: "show", description: "Print the team's Telegram topic-name template" },
6157
6471
  args: { id: { type: "positional", required: true } },
6158
6472
  async run({ args: args2 }) {
@@ -6161,7 +6475,7 @@ var topicFormatShowCmd = defineCommand28({
6161
6475
  console.log(g.telegramTopicNameFormat ?? "(default naming)");
6162
6476
  }
6163
6477
  });
6164
- var topicFormatSetCmd = defineCommand28({
6478
+ var topicFormatSetCmd = defineCommand30({
6165
6479
  meta: {
6166
6480
  name: "set",
6167
6481
  description: "Set the topic-name template. Tokens: {agent.name} {team.name} {team.slug} (must include {agent.name})"
@@ -6181,7 +6495,7 @@ var topicFormatSetCmd = defineCommand28({
6181
6495
  console.log(`set topic-name template for team ${args2.id}: ${g.telegramTopicNameFormat}`);
6182
6496
  }
6183
6497
  });
6184
- var topicFormatClearCmd = defineCommand28({
6498
+ var topicFormatClearCmd = defineCommand30({
6185
6499
  meta: { name: "clear", description: "Clear the template (revert to built-in naming)" },
6186
6500
  args: { id: { type: "positional", required: true } },
6187
6501
  async run({ args: args2 }) {
@@ -6191,7 +6505,7 @@ var topicFormatClearCmd = defineCommand28({
6191
6505
  console.log(`cleared topic-name template for team ${args2.id}`);
6192
6506
  }
6193
6507
  });
6194
- var topicFormatCmd = defineCommand28({
6508
+ var topicFormatCmd = defineCommand30({
6195
6509
  meta: {
6196
6510
  name: "topic-format",
6197
6511
  description: "View or edit a team's Telegram forum-topic name template"
@@ -6202,7 +6516,7 @@ var topicFormatCmd = defineCommand28({
6202
6516
  clear: topicFormatClearCmd
6203
6517
  }
6204
6518
  });
6205
- var contextCmd = defineCommand28({
6519
+ var contextCmd = defineCommand30({
6206
6520
  meta: {
6207
6521
  name: "context",
6208
6522
  description: "Inspect repository instructions, Git state and command suggestions"
@@ -6249,10 +6563,12 @@ var contextCmd = defineCommand28({
6249
6563
  console.log(` ${issue.code}${issue.path ? `: ${safe2(issue.path)}` : ""} \u2014 ${issue.message}`);
6250
6564
  }
6251
6565
  });
6252
- var teamCommand = defineCommand28({
6566
+ var teamCommand = defineCommand30({
6253
6567
  meta: { name: "team", description: "Manage teams (collaboration contexts)" },
6254
6568
  subCommands: {
6255
6569
  environment: teamEnvironmentCommand,
6570
+ log: teamCodingLogCommand,
6571
+ review: teamReviewCommand,
6256
6572
  context: contextCmd,
6257
6573
  add: addCmd2,
6258
6574
  list: listCmd10,
@@ -6265,7 +6581,7 @@ var teamCommand = defineCommand28({
6265
6581
 
6266
6582
  // src/commands/team-template.ts
6267
6583
  import { readFileSync as readFileSync12 } from "fs";
6268
- import { defineCommand as defineCommand29 } from "citty";
6584
+ import { defineCommand as defineCommand31 } from "citty";
6269
6585
  function jsonFile(path) {
6270
6586
  try {
6271
6587
  return JSON.parse(readFileSync12(path, "utf8"));
@@ -6293,7 +6609,7 @@ function printTeam(detail) {
6293
6609
  console.log(line);
6294
6610
  }
6295
6611
  }
6296
- var list7 = defineCommand29({
6612
+ var list7 = defineCommand31({
6297
6613
  meta: { name: "list", description: "List canonical Team templates" },
6298
6614
  args: { json: { type: "boolean", description: "Emit stable JSON" } },
6299
6615
  async run({ args: args2 }) {
@@ -6307,7 +6623,7 @@ var list7 = defineCommand29({
6307
6623
  console.log(line);
6308
6624
  }
6309
6625
  });
6310
- var show6 = defineCommand29({
6626
+ var show6 = defineCommand31({
6311
6627
  meta: { name: "show", description: "Show a canonical Team template" },
6312
6628
  args: {
6313
6629
  id: { type: "positional", required: true },
@@ -6321,7 +6637,7 @@ var show6 = defineCommand29({
6321
6637
  else printTeam(detail);
6322
6638
  }
6323
6639
  });
6324
- var exportCommand2 = defineCommand29({
6640
+ var exportCommand2 = defineCommand31({
6325
6641
  meta: {
6326
6642
  name: "export",
6327
6643
  description: "Export a portable versioned Team-template document to stdout"
@@ -6361,7 +6677,7 @@ function printImportDiff(current, document) {
6361
6677
  for (const value of diff2.added) console.log(` + ${value}`);
6362
6678
  for (const value of diff2.removed) console.log(` - ${value}`);
6363
6679
  }
6364
- var importCommand2 = defineCommand29({
6680
+ var importCommand2 = defineCommand31({
6365
6681
  meta: {
6366
6682
  name: "import",
6367
6683
  description: "Validate, diff, and explicitly apply a portable Team-template document"
@@ -6442,7 +6758,7 @@ var importCommand2 = defineCommand29({
6442
6758
  );
6443
6759
  }
6444
6760
  });
6445
- var teamTemplateCommand = defineCommand29({
6761
+ var teamTemplateCommand = defineCommand31({
6446
6762
  meta: {
6447
6763
  name: "team-template",
6448
6764
  description: "Inspect and exchange canonical Team templates"
@@ -6451,8 +6767,8 @@ var teamTemplateCommand = defineCommand29({
6451
6767
  });
6452
6768
 
6453
6769
  // src/commands/telegram.ts
6454
- import { defineCommand as defineCommand30 } from "citty";
6455
- var setCmd2 = defineCommand30({
6770
+ import { defineCommand as defineCommand32 } from "citty";
6771
+ var setCmd2 = defineCommand32({
6456
6772
  meta: {
6457
6773
  name: "set",
6458
6774
  description: "Save bot token + supergroup chat ID (paired write)"
@@ -6470,7 +6786,7 @@ var setCmd2 = defineCommand30({
6470
6786
  console.log(`saved \xB7 token ${state.botTokenPreview} \xB7 chat ${state.chatId}`);
6471
6787
  }
6472
6788
  });
6473
- var clearCmd = defineCommand30({
6789
+ var clearCmd = defineCommand32({
6474
6790
  meta: {
6475
6791
  name: "clear",
6476
6792
  description: "Remove stored bot token + chat ID"
@@ -6481,7 +6797,7 @@ var clearCmd = defineCommand30({
6481
6797
  console.log("cleared");
6482
6798
  }
6483
6799
  });
6484
- var showCmd5 = defineCommand30({
6800
+ var showCmd6 = defineCommand32({
6485
6801
  meta: {
6486
6802
  name: "show",
6487
6803
  description: "Show what credentials are stored (token is masked)"
@@ -6502,7 +6818,7 @@ var showCmd5 = defineCommand30({
6502
6818
  }
6503
6819
  }
6504
6820
  });
6505
- var reconnectCmd = defineCommand30({
6821
+ var reconnectCmd = defineCommand32({
6506
6822
  meta: {
6507
6823
  name: "reconnect",
6508
6824
  description: "Apply a pending supergroup chat-id migration + re-activate the bot"
@@ -6513,7 +6829,7 @@ var reconnectCmd = defineCommand30({
6513
6829
  console.log(`reconnected \xB7 chat ${state.chatId}`);
6514
6830
  }
6515
6831
  });
6516
- var configCmd = defineCommand30({
6832
+ var configCmd = defineCommand32({
6517
6833
  meta: {
6518
6834
  name: "config",
6519
6835
  description: "Manage Telegram credentials (bot token + chat ID)"
@@ -6521,10 +6837,10 @@ var configCmd = defineCommand30({
6521
6837
  subCommands: {
6522
6838
  set: setCmd2,
6523
6839
  clear: clearCmd,
6524
- show: showCmd5
6840
+ show: showCmd6
6525
6841
  }
6526
6842
  });
6527
- var healthCmd = defineCommand30({
6843
+ var healthCmd = defineCommand32({
6528
6844
  meta: {
6529
6845
  name: "health",
6530
6846
  description: "Run the four-step preflight against the Telegram Bot API"
@@ -6563,7 +6879,7 @@ var healthCmd = defineCommand30({
6563
6879
  if (!allOk) process.exitCode = 1;
6564
6880
  }
6565
6881
  });
6566
- var botStatusCmd = defineCommand30({
6882
+ var botStatusCmd = defineCommand32({
6567
6883
  meta: {
6568
6884
  name: "status",
6569
6885
  description: "Show polling state of the live bot"
@@ -6588,7 +6904,7 @@ var botStatusCmd = defineCommand30({
6588
6904
  if (!p.running) process.exitCode = 1;
6589
6905
  }
6590
6906
  });
6591
- var botRestartCmd = defineCommand30({
6907
+ var botRestartCmd = defineCommand32({
6592
6908
  meta: {
6593
6909
  name: "restart",
6594
6910
  description: "Force-restart the bot (tears down + brings up from current creds)"
@@ -6599,7 +6915,7 @@ var botRestartCmd = defineCommand30({
6599
6915
  console.log("restart requested");
6600
6916
  }
6601
6917
  });
6602
- var botCmd = defineCommand30({
6918
+ var botCmd = defineCommand32({
6603
6919
  meta: {
6604
6920
  name: "bot",
6605
6921
  description: "Inspect / control the live polling bot"
@@ -6609,7 +6925,7 @@ var botCmd = defineCommand30({
6609
6925
  restart: botRestartCmd
6610
6926
  }
6611
6927
  });
6612
- var bindCmd = defineCommand30({
6928
+ var bindCmd = defineCommand32({
6613
6929
  meta: {
6614
6930
  name: "bind",
6615
6931
  description: "Create a Telegram topic for an agent (manual fallback for /talk)"
@@ -6627,7 +6943,7 @@ var bindCmd = defineCommand30({
6627
6943
  console.log(` ${result.deepLink}`);
6628
6944
  }
6629
6945
  });
6630
- var unbindCmd = defineCommand30({
6946
+ var unbindCmd = defineCommand32({
6631
6947
  meta: {
6632
6948
  name: "unbind",
6633
6949
  description: "Clear an agent's Telegram topic binding (topic stays in Telegram as orphan)"
@@ -6641,7 +6957,7 @@ var unbindCmd = defineCommand30({
6641
6957
  console.log(`unbound agent ${args2.agent}`);
6642
6958
  }
6643
6959
  });
6644
- var listBindingsCmd = defineCommand30({
6960
+ var listBindingsCmd = defineCommand32({
6645
6961
  meta: {
6646
6962
  name: "list",
6647
6963
  description: "List agents and their Telegram topic bindings"
@@ -6669,7 +6985,7 @@ var listBindingsCmd = defineCommand30({
6669
6985
  }
6670
6986
  }
6671
6987
  });
6672
- var allowCmd = defineCommand30({
6988
+ var allowCmd = defineCommand32({
6673
6989
  meta: { name: "allow", description: "Add a Telegram user id to the allowlist" },
6674
6990
  args: {
6675
6991
  userId: { type: "positional", required: true, description: "Numeric Telegram user id" },
@@ -6685,7 +7001,7 @@ var allowCmd = defineCommand30({
6685
7001
  console.log(`allowed ${u.userId} (${u.role})`);
6686
7002
  }
6687
7003
  });
6688
- var denyCmd = defineCommand30({
7004
+ var denyCmd = defineCommand32({
6689
7005
  meta: { name: "deny", description: "Remove a Telegram user id from the allowlist" },
6690
7006
  args: { userId: { type: "positional", required: true } },
6691
7007
  async run({ args: args2 }) {
@@ -6694,7 +7010,7 @@ var denyCmd = defineCommand30({
6694
7010
  console.log(`removed ${args2.userId}`);
6695
7011
  }
6696
7012
  });
6697
- var allowedCmd = defineCommand30({
7013
+ var allowedCmd = defineCommand32({
6698
7014
  meta: { name: "allowed", description: "List allowlisted Telegram users" },
6699
7015
  async run() {
6700
7016
  const client = createClient2();
@@ -6709,7 +7025,7 @@ var allowedCmd = defineCommand30({
6709
7025
  }
6710
7026
  }
6711
7027
  });
6712
- var pairingCreateCmd = defineCommand30({
7028
+ var pairingCreateCmd = defineCommand32({
6713
7029
  meta: { name: "create", description: "Generate a one-time Telegram owner pairing code" },
6714
7030
  async run() {
6715
7031
  const result = await createClient2().post(
@@ -6720,7 +7036,7 @@ var pairingCreateCmd = defineCommand30({
6720
7036
  console.log("send `/pair <code>` in the configured \u2699 bazilion service topic");
6721
7037
  }
6722
7038
  });
6723
- var pairingStatusCmd = defineCommand30({
7039
+ var pairingStatusCmd = defineCommand32({
6724
7040
  meta: { name: "status", description: "Show Telegram owner pairing status" },
6725
7041
  async run() {
6726
7042
  const result = await createClient2().get("/api/config/telegram/pairing");
@@ -6731,14 +7047,14 @@ var pairingStatusCmd = defineCommand30({
6731
7047
  console.log(`expires: ${new Date(result.challengeExpiresAt).toISOString()}`);
6732
7048
  }
6733
7049
  });
6734
- var pairingCancelCmd = defineCommand30({
7050
+ var pairingCancelCmd = defineCommand32({
6735
7051
  meta: { name: "cancel", description: "Cancel the active Telegram pairing code" },
6736
7052
  async run() {
6737
7053
  await createClient2().del("/api/config/telegram/pairing/challenge");
6738
7054
  console.log("pairing challenge cancelled");
6739
7055
  }
6740
7056
  });
6741
- var pairingResetCmd = defineCommand30({
7057
+ var pairingResetCmd = defineCommand32({
6742
7058
  meta: { name: "reset", description: "Revoke the Telegram owner and require re-pairing" },
6743
7059
  args: {
6744
7060
  yes: { type: "boolean", description: "Confirm destructive owner reset", required: true }
@@ -6749,7 +7065,7 @@ var pairingResetCmd = defineCommand30({
6749
7065
  console.log("Telegram owner reset; ingress is closed until re-paired");
6750
7066
  }
6751
7067
  });
6752
- var pairingCmd = defineCommand30({
7068
+ var pairingCmd = defineCommand32({
6753
7069
  meta: { name: "pairing", description: "Manage single-owner Telegram pairing" },
6754
7070
  subCommands: {
6755
7071
  create: pairingCreateCmd,
@@ -6758,7 +7074,7 @@ var pairingCmd = defineCommand30({
6758
7074
  reset: pairingResetCmd
6759
7075
  }
6760
7076
  });
6761
- var telegramCommand = defineCommand30({
7077
+ var telegramCommand = defineCommand32({
6762
7078
  meta: {
6763
7079
  name: "telegram",
6764
7080
  description: "Telegram integration: credentials, health, bot lifecycle, bindings, access"
@@ -6779,7 +7095,7 @@ var telegramCommand = defineCommand30({
6779
7095
  });
6780
7096
 
6781
7097
  // src/commands/token.ts
6782
- import { defineCommand as defineCommand31 } from "citty";
7098
+ import { defineCommand as defineCommand33 } from "citty";
6783
7099
  import qrcode from "qrcode-terminal";
6784
7100
  function tokenRow(t) {
6785
7101
  const last = t.lastUsedAt ? new Date(t.lastUsedAt).toISOString() : "(never)";
@@ -6808,7 +7124,7 @@ function resolveQrServer(override) {
6808
7124
  }
6809
7125
  return url.origin;
6810
7126
  }
6811
- var createCmd3 = defineCommand31({
7127
+ var createCmd3 = defineCommand33({
6812
7128
  meta: { name: "create", description: "Mint a new web token (shown once)" },
6813
7129
  args: {
6814
7130
  label: { type: "positional", required: true, description: "Human-readable label" },
@@ -6851,7 +7167,7 @@ var createCmd3 = defineCommand31({
6851
7167
  qrcode.generate(pairUrl, { small: true }, (qr) => console.log(qr));
6852
7168
  }
6853
7169
  });
6854
- var listCmd11 = defineCommand31({
7170
+ var listCmd11 = defineCommand33({
6855
7171
  meta: { name: "list", description: "List web tokens" },
6856
7172
  args: {
6857
7173
  all: { type: "boolean", description: "Include revoked tokens" }
@@ -6867,7 +7183,7 @@ var listCmd11 = defineCommand31({
6867
7183
  for (const line of columnize(tokens.map(tokenRow))) console.log(line);
6868
7184
  }
6869
7185
  });
6870
- var showLocalCmd = defineCommand31({
7186
+ var showLocalCmd = defineCommand33({
6871
7187
  meta: {
6872
7188
  name: "show-local",
6873
7189
  description: "Print the bootstrap web token stored in ~/.bazilion/auth.json"
@@ -6877,7 +7193,7 @@ var showLocalCmd = defineCommand31({
6877
7193
  console.log(readAuthFile(paths.authFile).token);
6878
7194
  }
6879
7195
  });
6880
- var revokeCmd2 = defineCommand31({
7196
+ var revokeCmd2 = defineCommand33({
6881
7197
  meta: { name: "revoke", description: "Revoke a web token" },
6882
7198
  args: {
6883
7199
  id: { type: "positional", required: true }
@@ -6888,7 +7204,7 @@ var revokeCmd2 = defineCommand31({
6888
7204
  console.log(`revoked token ${args2.id}`);
6889
7205
  }
6890
7206
  });
6891
- var tokenCommand = defineCommand31({
7207
+ var tokenCommand = defineCommand33({
6892
7208
  meta: { name: "token", description: "Manage web tokens for API/CLI clients" },
6893
7209
  subCommands: {
6894
7210
  create: createCmd3,
@@ -6899,8 +7215,8 @@ var tokenCommand = defineCommand31({
6899
7215
  });
6900
7216
 
6901
7217
  // src/commands/trigger.ts
6902
- import { defineCommand as defineCommand32 } from "citty";
6903
- var addCmd3 = defineCommand32({
7218
+ import { defineCommand as defineCommand34 } from "citty";
7219
+ var addCmd3 = defineCommand34({
6904
7220
  meta: { name: "add", description: "Add an interval / cron trigger to an agent" },
6905
7221
  args: {
6906
7222
  agent: { type: "positional", required: true },
@@ -6948,7 +7264,7 @@ function triggerRow(t) {
6948
7264
  const msgPreview = t.message.length > 60 ? `${t.message.slice(0, 60)}\u2026` : t.message;
6949
7265
  return [t.id, state, spec, `last: ${last}`, `"${msgPreview}"`];
6950
7266
  }
6951
- var listCmd12 = defineCommand32({
7267
+ var listCmd12 = defineCommand34({
6952
7268
  meta: { name: "list", description: "List triggers for an agent" },
6953
7269
  args: {
6954
7270
  agent: { type: "positional", required: true }
@@ -6965,7 +7281,7 @@ var listCmd12 = defineCommand32({
6965
7281
  for (const line of columnize(triggers.map(triggerRow))) console.log(line);
6966
7282
  }
6967
7283
  });
6968
- var rmCmd6 = defineCommand32({
7284
+ var rmCmd6 = defineCommand34({
6969
7285
  meta: { name: "rm", description: "Delete a trigger" },
6970
7286
  args: {
6971
7287
  id: { type: "positional", required: true }
@@ -6976,7 +7292,7 @@ var rmCmd6 = defineCommand32({
6976
7292
  console.log(`removed trigger ${args2.id}`);
6977
7293
  }
6978
7294
  });
6979
- var enableCmd3 = defineCommand32({
7295
+ var enableCmd3 = defineCommand34({
6980
7296
  meta: { name: "enable", description: "Enable a trigger" },
6981
7297
  args: {
6982
7298
  id: { type: "positional", required: true }
@@ -6988,7 +7304,7 @@ var enableCmd3 = defineCommand32({
6988
7304
  console.log(`enabled trigger ${args2.id}`);
6989
7305
  }
6990
7306
  });
6991
- var disableCmd3 = defineCommand32({
7307
+ var disableCmd3 = defineCommand34({
6992
7308
  meta: { name: "disable", description: "Disable a trigger" },
6993
7309
  args: {
6994
7310
  id: { type: "positional", required: true }
@@ -7000,7 +7316,7 @@ var disableCmd3 = defineCommand32({
7000
7316
  console.log(`disabled trigger ${args2.id}`);
7001
7317
  }
7002
7318
  });
7003
- var historyCmd = defineCommand32({
7319
+ var historyCmd = defineCommand34({
7004
7320
  meta: { name: "history", description: "Show recent dispatches for a trigger" },
7005
7321
  args: {
7006
7322
  id: { type: "positional", required: true },
@@ -7028,7 +7344,7 @@ var historyCmd = defineCommand32({
7028
7344
  for (const line of columnize(rows)) console.log(line);
7029
7345
  }
7030
7346
  });
7031
- var triggerCommand = defineCommand32({
7347
+ var triggerCommand = defineCommand34({
7032
7348
  meta: { name: "trigger", description: "Manage scheduled agent triggers" },
7033
7349
  subCommands: {
7034
7350
  add: addCmd3,
@@ -7044,7 +7360,7 @@ var triggerCommand = defineCommand32({
7044
7360
  import { existsSync as existsSync7, lstatSync as lstatSync4, readdirSync as readdirSync2, realpathSync as realpathSync2, rmSync as rmSync4 } from "fs";
7045
7361
  import { homedir as homedir2 } from "os";
7046
7362
  import { isAbsolute as isAbsolute2, join as join6, parse as parse2, relative as relative2, resolve as resolve5, sep } from "path";
7047
- import { defineCommand as defineCommand33 } from "citty";
7363
+ import { defineCommand as defineCommand35 } from "citty";
7048
7364
  function makeLineReader() {
7049
7365
  let buffer = "";
7050
7366
  let ended = false;
@@ -7131,7 +7447,7 @@ function assertSafeUninstallHome(home) {
7131
7447
  }
7132
7448
  return target;
7133
7449
  }
7134
- var uninstallCommand = defineCommand33({
7450
+ var uninstallCommand = defineCommand35({
7135
7451
  meta: {
7136
7452
  name: "uninstall",
7137
7453
  description: "Wipe bazilion state from ~/.bazilion (or BAZILION_HOME)"
@@ -7235,7 +7551,7 @@ var uninstallCommand = defineCommand33({
7235
7551
 
7236
7552
  // src/index.ts
7237
7553
  var VERSION = package_default.version;
7238
- var main = defineCommand34({
7554
+ var main = defineCommand36({
7239
7555
  meta: {
7240
7556
  name: "bazilion",
7241
7557
  version: VERSION,