bazilion 0.18.0 → 0.19.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 (96) hide show
  1. package/dist/cli.js +607 -96
  2. package/dist/cli.js.map +1 -1
  3. package/dist/daemon.js +3225 -739
  4. package/dist/daemon.js.map +1 -1
  5. package/dist/migrations/0001_init.sql +142 -3
  6. package/dist/web/client/assets/{ChatPane-CAYS_fIQ.js → ChatPane-DCyGcqdh.js} +1 -1
  7. package/dist/web/client/assets/ConfirmDialog-C908TxS5.js +1 -0
  8. package/dist/web/client/assets/{FieldRow-W_54rw5c.js → FieldRow-CELqI-1V.js} +1 -1
  9. package/dist/web/client/assets/{ProductionTeamPolicyEditor-DNXVX8Lz.js → ProductionTeamPolicyEditor-DnTcWhG8.js} +1 -1
  10. package/dist/web/client/assets/{ProfileCommunicationEditor-DN0fOzqn.js → ProfileCommunicationEditor-BVIEaW3s.js} +1 -1
  11. package/dist/web/client/assets/{ResultSourceConversation-DoU4tOWc.js → ResultSourceConversation-4gbZCh_s.js} +1 -1
  12. package/dist/web/client/assets/{TeamTabs-BmTZRI4T.js → TeamTabs-V17b45X5.js} +1 -1
  13. package/dist/web/client/assets/{TemplatesTabs-Bs_OXKwx.js → TemplatesTabs-BMK3Qok_.js} +1 -1
  14. package/dist/web/client/assets/{UnsavedChangesGuard-CPRtFReU.js → UnsavedChangesGuard-BaE-UzyS.js} +1 -1
  15. package/dist/web/client/assets/{_id-Dbmei5tg.js → _id-BU1l9gP7.js} +1 -1
  16. package/dist/web/client/assets/{_id-DL4tJFQB.js → _id-BVANQm00.js} +1 -1
  17. package/dist/web/client/assets/{_id-DR9eFC17.js → _id-Bvh5LyUv.js} +1 -1
  18. package/dist/web/client/assets/{_id-ybF-pqmr.js → _id-CArZR-IO.js} +1 -1
  19. package/dist/web/client/assets/{_id-CxAB4TDr.js → _id-tUkSe5li.js} +1 -1
  20. package/dist/web/client/assets/{activity-oUyy77jD.js → activity-CWCnqjqj.js} +1 -1
  21. package/dist/web/client/assets/{agents-DkjJp7JP.js → agents-CX4STmGK.js} +1 -1
  22. package/dist/web/client/assets/{agents-D_TrEqAg.js → agents-CdCnhH06.js} +1 -1
  23. package/dist/web/client/assets/{approvals-DhOerWdt.js → approvals-CnNpwG78.js} +1 -1
  24. package/dist/web/client/assets/{attention-DGwiF-Jy.js → attention-CEE-wWrx.js} +1 -1
  25. package/dist/web/client/assets/chevron-right-CvCEwfSl.js +1 -0
  26. package/dist/web/client/assets/{config-BJ2ZzHPR.js → config-CSEtI-dq.js} +1 -1
  27. package/dist/web/client/assets/{inbox-BUElnGep.js → inbox-MYnBtPdF.js} +1 -1
  28. package/dist/web/client/assets/index-Ct31TjS-.js +52 -0
  29. package/dist/web/client/assets/{learning-BiTHNwB3.js → learning-BIR5FTgQ.js} +1 -1
  30. package/dist/web/client/assets/{login-BmcZvAH2.js → login-DIeceuOs.js} +1 -1
  31. package/dist/web/client/assets/{mcp-Cwk9V82W.js → mcp-CX3kJpGu.js} +1 -1
  32. package/dist/web/client/assets/{members-CHDNabFh.js → members-DlhSjye1.js} +1 -1
  33. package/dist/web/client/assets/{memory-Cx_Fpd4e.js → memory-CsDd6b2l.js} +1 -1
  34. package/dist/web/client/assets/{policy-C0nMdwcG.js → policy-DkWDhG0x.js} +1 -1
  35. package/dist/web/client/assets/{results-Bz3jASs-.js → results-BHdhNHJJ.js} +1 -1
  36. package/dist/web/client/assets/review-Dyw47eM1.js +1 -0
  37. package/dist/web/client/assets/{routes-DsMY_6oy.js → routes-DtYD4WJL.js} +1 -1
  38. package/dist/web/client/assets/{services-DItA6fJ7.js → services-WUlW7oEo.js} +1 -1
  39. package/dist/web/client/assets/{skills-DbNV2vgL.js → skills-jNoUfUSZ.js} +1 -1
  40. package/dist/web/client/assets/styles-DCX6QTqJ.css +2 -0
  41. package/dist/web/client/assets/{teams-D83scDxw.js → teams-C1kYRrtP.js} +1 -1
  42. package/dist/web/client/assets/{teams-DAny1ypN.js → teams-D3FaSKE7.js} +1 -1
  43. package/dist/web/client/assets/{telegram-BOmf9vUh.js → telegram-D86AO6V9.js} +1 -1
  44. package/dist/web/client/assets/{tokens-DBGH6Bw5.js → tokens-B42KDisP.js} +1 -1
  45. package/dist/web/client/assets/{triggers-D1_pseI3.js → triggers-yEfWnQ_K.js} +1 -1
  46. package/dist/web/client/assets/{verifications-CBTo-FyV.js → verifications-DrHQEQFx.js} +2 -2
  47. package/dist/web/client/assets/{welcome-DAfPOm15.js → welcome-D8IbF_P0.js} +1 -1
  48. package/dist/web/client/assets/{x-CWY-gUaM.js → x-CXKABZ7C.js} +1 -1
  49. package/dist/web/server/assets/{_id--zoh1vv7.js → _id-D2bDA1iV.js} +1 -1
  50. package/dist/web/server/assets/{_id-6p-mDmI8.js → _id-DL-SnSnK.js} +1 -1
  51. package/dist/web/server/assets/{_id-dUnXL-My2.js → _id-Dab2CVtO2.js} +1 -1
  52. package/dist/web/server/assets/{_id-DptBl3X8.js → _id-bVispdh-.js} +1 -1
  53. package/dist/web/server/assets/{_tanstack-start-manifest_v-B3M-dfRO.js → _tanstack-start-manifest_v-BcTOb0oj.js} +84 -85
  54. package/dist/web/server/assets/{activity-C5jpoEQI.js → activity-CLDAy6rk.js} +1 -1
  55. package/dist/web/server/assets/{agents-RE6aYOb-.js → agents-CdB2kuNN.js} +1 -1
  56. package/dist/web/server/assets/{agents-nAOx_H7s.js → agents-DfHcb2H2.js} +1 -1
  57. package/dist/web/server/assets/{approvals-DhHxIDrL.js → approvals-Bq846WaP.js} +1 -1
  58. package/dist/web/server/assets/{attention-CBWzWRni.js → attention-Sm-U7s_0.js} +1 -1
  59. package/dist/web/server/assets/{auth-tB3i6cFd.js → auth-PB5dVyvX.js} +1 -1
  60. package/dist/web/server/assets/{config-D1k_tTAw.js → config-BNGTBu80.js} +1 -1
  61. package/dist/web/server/assets/{daemon-client-C7qjQ2iO.js → daemon-client-CWQvck6B.js} +35 -0
  62. package/dist/web/server/assets/{git-review-Bf5ABFJg.js → git-review-C_h_tezf.js} +1 -1
  63. package/dist/web/server/assets/{inbox-Dw4pTevh.js → inbox-DJoU-bla.js} +1 -1
  64. package/dist/web/server/assets/{learning-CF8ZzFVD.js → learning-DVb0I_3Z.js} +1 -1
  65. package/dist/web/server/assets/{mcp-D5dmBT82.js → mcp-CeZqOiDG.js} +1 -1
  66. package/dist/web/server/assets/{members-CvwEN9pm.js → members-CcYjuqxB.js} +1 -1
  67. package/dist/web/server/assets/{memory-CcPK7um7.js → memory-CH2yNT89.js} +1 -1
  68. package/dist/web/server/assets/{policy-Dh6wd2wN.js → policy-DrRKinMr.js} +1 -1
  69. package/dist/web/server/assets/{results-BWnu3gXP.js → results-fT2zyiJx.js} +1 -1
  70. package/dist/web/server/assets/review-CvUPk4HA.js +38 -0
  71. package/dist/web/server/assets/review-DYcYdUTv.js +859 -0
  72. package/dist/web/server/assets/review-packets-e36PsTSX.js +172 -0
  73. package/dist/web/server/assets/{router-Deq94UJQ.js → router-NYhuYQCd.js} +4 -4
  74. package/dist/web/server/assets/{routes-CVKkvFVv.js → routes-RdppWPiW.js} +1 -1
  75. package/dist/web/server/assets/{services-CEr61xb5.js → services-Dgu7dcTC.js} +1 -1
  76. package/dist/web/server/assets/{skills-BImC3LTO.js → skills-DL7UIWa8.js} +1 -1
  77. package/dist/web/server/assets/{teams-8zEIo08E.js → teams-Cmn7mdx9.js} +1 -1
  78. package/dist/web/server/assets/{teams-D-yaAWLV.js → teams-DiC-MBg4.js} +1 -1
  79. package/dist/web/server/assets/{telegram-CGl_LFtJ.js → telegram-CLOFnLjF.js} +1 -1
  80. package/dist/web/server/assets/{tokens-cB-uf7qm.js → tokens-BVva7GHu.js} +1 -1
  81. package/dist/web/server/assets/{triggers-CtSj79L0.js → triggers-D4orksJq.js} +1 -1
  82. package/dist/web/server/assets/{verification-B5QjcpIo.js → verification-C1SHMTX8.js} +1 -1
  83. package/dist/web/server/assets/{verifications-CUq_6ZqL.js → verifications-C_ycXrPK.js} +1 -1
  84. package/dist/web/server/assets/{verifications-BfQsfwSE.js → verifications-Ci49n2Km.js} +14 -1
  85. package/dist/web/server/server.js +75 -39
  86. package/dist/worker.js +528 -111
  87. package/dist/worker.js.map +1 -1
  88. package/package.json +3 -3
  89. package/dist/web/client/assets/ConfirmDialog-BzIiABOP.js +0 -1
  90. package/dist/web/client/assets/chevron-right-DSa4xPTs.js +0 -1
  91. package/dist/web/client/assets/createServerFn-Dzfjt7mA.js +0 -3
  92. package/dist/web/client/assets/index-Bi-HxcPG.js +0 -50
  93. package/dist/web/client/assets/review-AK9WGmpv.js +0 -1
  94. package/dist/web/client/assets/styles-C6br2xxl.css +0 -2
  95. package/dist/web/server/assets/review-DUe3vHPU.js +0 -393
  96. package/dist/web/server/assets/review-c_-cFi7H.js +0 -14
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 defineCommand37, runCommand, showUsage } from "citty";
4
+ import { defineCommand as defineCommand38, runCommand, showUsage } from "citty";
5
5
 
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "bazilion",
9
- version: "0.18.0",
9
+ version: "0.19.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: {
@@ -203,6 +203,45 @@ function createClient(cfg) {
203
203
  cancel: (requestId) => request("POST", `${base}/${encodeURIComponent(requestId)}/cancel`)
204
204
  };
205
205
  },
206
+ /**
207
+ * Revision-bound review packets (BAZ-043).
208
+ *
209
+ * A packet binds one captured revision. Findings are append-only, and resolving one requires an
210
+ * explicit decision or a named later revision — a moved line proves nothing.
211
+ */
212
+ reviewPackets: (teamId) => {
213
+ const base = `/api/teams/${encodeURIComponent(teamId)}/reviews`;
214
+ const item = (packetId2) => `${base}/${encodeURIComponent(packetId2)}`;
215
+ return {
216
+ list: () => request("GET", base),
217
+ show: (packetId2) => request("GET", item(packetId2)),
218
+ create: (input) => request("POST", base, input),
219
+ addFinding: (packetId2, input) => request("POST", `${item(packetId2)}/findings`, input),
220
+ resolveFinding: (packetId2, findingId, input) => request(
221
+ "POST",
222
+ `${item(packetId2)}/findings/${encodeURIComponent(findingId)}/resolve`,
223
+ input
224
+ ),
225
+ recordConclusion: (packetId2, input) => request("POST", `${item(packetId2)}/conclusion`, input),
226
+ export: (packetId2) => request("GET", `${item(packetId2)}/export`),
227
+ /**
228
+ * Publish the export as a durable artifact through BAZ-034's contract. `held` and `denied` are
229
+ * outcomes, not errors: the bytes exist and stay unreadable, and an approval names them.
230
+ */
231
+ deliverExport: (packetId2) => request("POST", `${item(packetId2)}/export/deliver`),
232
+ reportState: (packetId2, input) => request("POST", `${item(packetId2)}/reported`, input),
233
+ /**
234
+ * Resolve what a file link would do. Read-only: no editor runs unless `openLink` is called, and
235
+ * the link itself says which host it names and whether it is the reviewed revision or the live file.
236
+ */
237
+ link: (packetId2, options) => {
238
+ const params = new URLSearchParams({ path: options.path });
239
+ if (options.line !== void 0) params.set("line", String(options.line));
240
+ return request("GET", `${item(packetId2)}/link?${params}`);
241
+ },
242
+ openLink: (packetId2, options) => request("POST", `${item(packetId2)}/link/open`, options)
243
+ };
244
+ },
206
245
  /** Read-only Git change review and bounded source snapshots (BAZ-042). */
207
246
  repositoryReview: (teamId) => {
208
247
  const base = `/api/teams/${encodeURIComponent(teamId)}/review`;
@@ -2422,7 +2461,7 @@ function pauseRestoredUserQueue(database) {
2422
2461
  // src/backup-schema.ts
2423
2462
  import { createHash } from "crypto";
2424
2463
  var CANONICAL_MIGRATION = "0001_init";
2425
- var CANONICAL_SCHEMA_HASH = "cb3811823a7dead88cce0beb08cd4066ea3143258af0f0b8ba329016465dda37";
2464
+ var CANONICAL_SCHEMA_HASH = "da37324d58fa517941ec0557529d00a7a812413f9fda7e5d611287ad42b47595";
2426
2465
  var CANONICAL_OBJECTS = [
2427
2466
  ["table", "team_coding_environments"],
2428
2467
  ["table", "workspace_writers"],
@@ -2435,6 +2474,18 @@ var CANONICAL_OBJECTS = [
2435
2474
  ["table", "source_snapshots"],
2436
2475
  ["index", "source_snapshots_retention"],
2437
2476
  ["index", "source_snapshots_team_time"],
2477
+ ["table", "review_packets"],
2478
+ ["index", "review_packets_team_time"],
2479
+ ["index", "review_packets_reviewer_dispatch"],
2480
+ ["index", "review_packets_retention"],
2481
+ ["table", "review_findings"],
2482
+ ["index", "review_findings_packet"],
2483
+ ["index", "review_findings_unresolved"],
2484
+ ["table", "review_conclusions"],
2485
+ ["index", "review_conclusions_packet"],
2486
+ ["table", "review_attempts"],
2487
+ ["index", "review_attempts_one_open_per_packet"],
2488
+ ["index", "review_attempts_lease"],
2438
2489
  ["table", "verification_requests"],
2439
2490
  ["index", "verification_requests_team_time"],
2440
2491
  ["index", "verification_requests_recipient_dispatch"],
@@ -2462,6 +2513,8 @@ var CANONICAL_OBJECTS = [
2462
2513
  ["table", "agent_conversations"],
2463
2514
  ["table", "agent_conversation_selection"],
2464
2515
  ["index", "agent_results_team_time"],
2516
+ ["index", "agent_results_session_source"],
2517
+ ["index", "agent_results_packet_source"],
2465
2518
  ["index", "agent_triggers_agent"],
2466
2519
  ["index", "agent_triggers_enabled"],
2467
2520
  ["index", "agent_loop_break_events_agent_time"],
@@ -5680,7 +5733,7 @@ var skillCommand = defineCommand25({
5680
5733
  // src/commands/team.ts
5681
5734
  import { readFileSync as readFileSync11 } from "fs";
5682
5735
  import { stdin as stdin2 } from "process";
5683
- import { defineCommand as defineCommand31 } from "citty";
5736
+ import { defineCommand as defineCommand32 } from "citty";
5684
5737
 
5685
5738
  // src/commands/team-coding-log.ts
5686
5739
  import { defineCommand as defineCommand26 } from "citty";
@@ -6236,20 +6289,466 @@ var teamPolicyCommand = defineCommand28({
6236
6289
  });
6237
6290
 
6238
6291
  // src/commands/team-review.ts
6292
+ import { defineCommand as defineCommand30 } from "citty";
6293
+
6294
+ // src/commands/team-review-packet.ts
6239
6295
  import { defineCommand as defineCommand29 } from "citty";
6240
- var slug = {
6296
+ var slug = { id: { type: "positional", required: true, description: "Team slug" } };
6297
+ var packetId = {
6298
+ packetId: { type: "positional", required: true, description: "Review packet id" }
6299
+ };
6300
+ var SEVERITIES = ["blocker", "major", "minor", "info"];
6301
+ function printReport(report) {
6302
+ const packet = report.packet;
6303
+ const requester = packet.requester.kind === "agent" ? `agent ${packet.requester.agentId}` : "operator";
6304
+ console.log(`${packet.id} ${packet.state}${report.applicability.stale ? " (stale)" : ""}`);
6305
+ console.log(
6306
+ ` change: snapshot ${packet.snapshot.id} (base ${packet.snapshot.baseOid.slice(0, 12)}${packet.snapshot.complete ? "" : ", INCOMPLETE COVERAGE"})`
6307
+ );
6308
+ console.log(` reviewer: ${packet.reviewerAgentId ?? "(none \u2014 nothing delegated)"}`);
6309
+ console.log(` asked by: ${requester}`);
6310
+ console.log(
6311
+ ` applicability: ${report.applicability.comparison === "identical" ? "unchanged since capture" : `${report.applicability.comparison} (never a pass)`}`
6312
+ );
6313
+ if (packet.summary) console.log(` summary: ${packet.summary}`);
6314
+ console.log(
6315
+ ` exported: ${packet.exportedAt ? `revision ${packet.exportRevision?.slice(0, 12)}` : "not exported"}`
6316
+ );
6317
+ if (report.findings.length === 0) {
6318
+ console.log(" findings: none recorded");
6319
+ } else {
6320
+ console.log(" findings:");
6321
+ for (const finding of report.findings) {
6322
+ const lines = finding.lineStart === null ? "" : `:${finding.lineStart}${finding.lineEnd && finding.lineEnd !== finding.lineStart ? `-${finding.lineEnd}` : ""}`;
6323
+ const resolution = finding.resolution ? ` resolved(${finding.resolution.kind})` : finding.state === "unverified" ? " UNVERIFIED \u2014 not correlated to the reviewed revision" : "";
6324
+ console.log(` [${finding.severity}] ${finding.path}${lines}${resolution} ${finding.note}`);
6325
+ }
6326
+ }
6327
+ if (report.conclusions.length === 0) {
6328
+ console.log(" conclusions: none \u2014 a packet with findings is not yet a review");
6329
+ } else {
6330
+ for (const conclusion of report.conclusions) {
6331
+ const who = conclusion.reviewer.kind === "agent" ? conclusion.reviewer.agentId : "operator";
6332
+ console.log(
6333
+ ` conclusion: ${conclusion.conclusion} (${who})${conclusion.note ? ` \u2014 ${conclusion.note}` : ""}`
6334
+ );
6335
+ }
6336
+ }
6337
+ const { facts } = report;
6338
+ const reported = Object.entries(facts.reported).filter(([, value]) => value !== null).map(([key, value]) => `${key}=${value} (reported)`);
6339
+ console.log(
6340
+ ` facts: change prepared=${facts.changePrepared} checks current=${facts.checksCurrent} reviewed=${facts.reviewed}`
6341
+ );
6342
+ if (reported.length > 0) console.log(` ${reported.join(" ")}`);
6343
+ console.log(
6344
+ " note: a review conclusion is not acceptance, and this command never commits, pushes, merges or deploys"
6345
+ );
6346
+ }
6347
+ var createCmd3 = defineCommand29({
6348
+ meta: { name: "create", description: "Capture a review packet for a retained revision" },
6349
+ args: {
6350
+ ...slug,
6351
+ snapshot: {
6352
+ type: "string",
6353
+ required: true,
6354
+ description: "BAZ-042 snapshot id to review (see `team review snapshots`)"
6355
+ },
6356
+ reviewer: {
6357
+ type: "string",
6358
+ description: "Agent who should review. Omit for an operator-only packet (nothing is delegated)"
6359
+ },
6360
+ summary: { type: "string", description: "What the change is for, in the requester\u2019s words" },
6361
+ json: { type: "boolean", description: "Emit the packet as JSON" }
6362
+ },
6363
+ async run({ args: args2 }) {
6364
+ const client = createClient2();
6365
+ try {
6366
+ const response = await client.reviewPackets(args2.id).create({
6367
+ snapshotId: args2.snapshot,
6368
+ reviewerAgentId: args2.reviewer ?? null,
6369
+ summary: args2.summary ?? null
6370
+ });
6371
+ if (args2.json) {
6372
+ console.log(JSON.stringify(response, null, 2));
6373
+ return;
6374
+ }
6375
+ printReport(response.report);
6376
+ } catch (error) {
6377
+ console.error(error instanceof Error ? error.message : String(error));
6378
+ process.exit(1);
6379
+ }
6380
+ }
6381
+ });
6382
+ var listCmd10 = defineCommand29({
6383
+ meta: { name: "list", description: "List review packets for a Team" },
6384
+ args: { ...slug, json: { type: "boolean", description: "Emit JSON" } },
6385
+ async run({ args: args2 }) {
6386
+ const client = createClient2();
6387
+ const response = await client.reviewPackets(args2.id).list();
6388
+ if (args2.json) {
6389
+ console.log(JSON.stringify(response, null, 2));
6390
+ return;
6391
+ }
6392
+ if (response.packets.length === 0) {
6393
+ console.log("no review packets");
6394
+ return;
6395
+ }
6396
+ const rows = [
6397
+ ["ID", "STATE", "REVIEWER", "FINDINGS", "OPEN", "CONCLUSION", "CHANGE"],
6398
+ ...response.packets.map((entry3) => [
6399
+ entry3.packet.id,
6400
+ entry3.packet.state,
6401
+ entry3.packet.reviewerAgentId ?? "(none)",
6402
+ String(entry3.counts.findings),
6403
+ String(entry3.counts.unresolved),
6404
+ entry3.conclusion ?? "\u2014",
6405
+ entry3.packet.snapshot.id.slice(0, 12)
6406
+ ])
6407
+ ];
6408
+ for (const line of columnize(rows)) console.log(line);
6409
+ console.log(
6410
+ "\nA packet of an older revision stays listed; `packet show` reports whether it is stale."
6411
+ );
6412
+ }
6413
+ });
6414
+ var showCmd5 = defineCommand29({
6415
+ meta: { name: "show", description: "Show one review packet, its findings and its conclusions" },
6416
+ args: { ...slug, ...packetId, json: { type: "boolean", description: "Emit JSON" } },
6417
+ async run({ args: args2 }) {
6418
+ const client = createClient2();
6419
+ try {
6420
+ const response = await client.reviewPackets(args2.id).show(args2.packetId);
6421
+ if (args2.json) {
6422
+ console.log(JSON.stringify(response, null, 2));
6423
+ return;
6424
+ }
6425
+ printReport(response.report);
6426
+ } catch (error) {
6427
+ console.error(error instanceof Error ? error.message : String(error));
6428
+ process.exit(1);
6429
+ }
6430
+ }
6431
+ });
6432
+ var findingCmd = defineCommand29({
6433
+ meta: { name: "finding", description: "Record a finding against the packet\u2019s captured revision" },
6434
+ args: {
6435
+ ...slug,
6436
+ ...packetId,
6437
+ path: { type: "string", required: true, description: "Repository-relative path" },
6438
+ severity: { type: "string", required: true, description: SEVERITIES.join(" | ") },
6439
+ note: { type: "string", required: true, description: "What is wrong, with evidence" },
6440
+ lines: {
6441
+ type: "string",
6442
+ description: 'Line context as "start" or "start-end". Context only: never identity.'
6443
+ },
6444
+ json: { type: "boolean", description: "Emit JSON" }
6445
+ },
6446
+ async run({ args: args2 }) {
6447
+ if (!SEVERITIES.includes(args2.severity)) {
6448
+ console.error(`severity must be one of: ${SEVERITIES.join(", ")}`);
6449
+ process.exit(1);
6450
+ }
6451
+ const [start, end] = (args2.lines ?? "").split("-");
6452
+ const body = {
6453
+ path: args2.path,
6454
+ severity: args2.severity,
6455
+ note: args2.note,
6456
+ ...start ? { lineStart: Number(start) } : {},
6457
+ ...end ? { lineEnd: Number(end) } : {}
6458
+ };
6459
+ const client = createClient2();
6460
+ try {
6461
+ const response = await client.reviewPackets(args2.id).addFinding(args2.packetId, body);
6462
+ if (args2.json) {
6463
+ console.log(JSON.stringify(response, null, 2));
6464
+ return;
6465
+ }
6466
+ console.log(
6467
+ `finding recorded against revision ${response.report.packet.snapshot.id.slice(0, 12)}`
6468
+ );
6469
+ printReport(response.report);
6470
+ } catch (error) {
6471
+ console.error(error instanceof Error ? error.message : String(error));
6472
+ process.exit(1);
6473
+ }
6474
+ }
6475
+ });
6476
+ var resolveCmd = defineCommand29({
6477
+ meta: { name: "resolve", description: "Resolve a finding with explicit proof" },
6478
+ args: {
6479
+ ...slug,
6480
+ ...packetId,
6481
+ findingId: { type: "positional", required: true, description: "Finding id" },
6482
+ kind: {
6483
+ type: "string",
6484
+ required: true,
6485
+ description: "explicit (a decision) | linked_revision (a named later revision)"
6486
+ },
6487
+ note: { type: "string", required: true, description: "How it was resolved" },
6488
+ json: { type: "boolean", description: "Emit JSON" }
6489
+ },
6490
+ async run({ args: args2 }) {
6491
+ if (args2.kind !== "explicit" && args2.kind !== "linked_revision") {
6492
+ console.error("kind must be `explicit` or `linked_revision`");
6493
+ process.exit(1);
6494
+ }
6495
+ const client = createClient2();
6496
+ try {
6497
+ const response = await client.reviewPackets(args2.id).resolveFinding(args2.packetId, args2.findingId, {
6498
+ resolutionKind: args2.kind,
6499
+ resolutionNote: args2.note
6500
+ });
6501
+ if (args2.json) {
6502
+ console.log(JSON.stringify(response, null, 2));
6503
+ return;
6504
+ }
6505
+ printReport(response.report);
6506
+ } catch (error) {
6507
+ console.error(error instanceof Error ? error.message : String(error));
6508
+ process.exit(1);
6509
+ }
6510
+ }
6511
+ });
6512
+ var concludeCmd = defineCommand29({
6513
+ meta: { name: "conclude", description: "Record the reviewer\u2019s conclusion for this revision" },
6514
+ args: {
6515
+ ...slug,
6516
+ ...packetId,
6517
+ conclusion: {
6518
+ type: "string",
6519
+ required: true,
6520
+ description: "changes_requested | commented | recommended"
6521
+ },
6522
+ note: { type: "string", description: "Why" },
6523
+ json: { type: "boolean", description: "Emit JSON" }
6524
+ },
6525
+ async run({ args: args2 }) {
6526
+ const allowed = ["changes_requested", "commented", "recommended"];
6527
+ if (!allowed.includes(args2.conclusion)) {
6528
+ console.error(`conclusion must be one of: ${allowed.join(", ")}`);
6529
+ process.exit(1);
6530
+ }
6531
+ const client = createClient2();
6532
+ try {
6533
+ const response = await client.reviewPackets(args2.id).recordConclusion(args2.packetId, {
6534
+ conclusion: args2.conclusion,
6535
+ note: args2.note ?? null
6536
+ });
6537
+ if (args2.json) {
6538
+ console.log(JSON.stringify(response, null, 2));
6539
+ return;
6540
+ }
6541
+ printReport(response.report);
6542
+ } catch (error) {
6543
+ console.error(error instanceof Error ? error.message : String(error));
6544
+ process.exit(1);
6545
+ }
6546
+ }
6547
+ });
6548
+ var snapshotCmd = defineCommand29({
6549
+ meta: { name: "snapshots", description: "List retained revisions that could be reviewed" },
6550
+ args: { ...slug, json: { type: "boolean", description: "Emit JSON" } },
6551
+ async run({ args: args2 }) {
6552
+ const client = createClient2();
6553
+ const list8 = await client.repositoryReview(args2.id).snapshots();
6554
+ if (args2.json) {
6555
+ console.log(JSON.stringify(list8, null, 2));
6556
+ return;
6557
+ }
6558
+ if (list8.snapshots.length === 0) {
6559
+ console.log("no retained revisions \u2014 capture one with `team review capture`");
6560
+ return;
6561
+ }
6562
+ const rows = [
6563
+ ["SNAPSHOT", "CAPTURED", "ENTRIES", "COMPLETE"],
6564
+ ...list8.snapshots.map((snapshot) => [
6565
+ snapshot.snapshotId.slice(0, 16),
6566
+ new Date(snapshot.createdAt).toISOString(),
6567
+ String(snapshot.entryCount),
6568
+ snapshot.complete ? "yes" : "NO"
6569
+ ])
6570
+ ];
6571
+ for (const line of columnize(rows)) console.log(line);
6572
+ }
6573
+ });
6574
+ var reportedCmd = defineCommand29({
6575
+ meta: {
6576
+ name: "reported",
6577
+ description: "Record an operator-reported external state (never verified by Bazilion)"
6578
+ },
6579
+ args: {
6580
+ ...slug,
6581
+ ...packetId,
6582
+ state: {
6583
+ type: "positional",
6584
+ required: true,
6585
+ description: "committed | pushed | pullRequest | merged | deployed | productionAccepted"
6586
+ },
6587
+ reference: {
6588
+ type: "string",
6589
+ description: "What the operator is pointing at: a commit id, a URL, a release name. Omit to clear it."
6590
+ },
6591
+ json: { type: "boolean", description: "Emit JSON" }
6592
+ },
6593
+ async run({ args: args2 }) {
6594
+ const client = createClient2();
6595
+ try {
6596
+ const response = await client.reviewPackets(args2.id).reportState(args2.packetId, {
6597
+ state: args2.state,
6598
+ reference: args2.reference ?? null
6599
+ });
6600
+ if (args2.json) {
6601
+ console.log(JSON.stringify(response, null, 2));
6602
+ return;
6603
+ }
6604
+ const reported = Object.entries(response.report.packet.reported).filter(([, value]) => value !== null).map(([key, value]) => `${key}=${value}`);
6605
+ console.log(
6606
+ `recorded (reported, not verified): ${reported.length > 0 ? reported.join(" ") : "nothing reported"}`
6607
+ );
6608
+ console.log(
6609
+ "Bazilion did not check this: there is no code-host integration, so it is whatever you reported."
6610
+ );
6611
+ } catch (error) {
6612
+ console.error(error instanceof Error ? error.message : String(error));
6613
+ process.exit(1);
6614
+ }
6615
+ }
6616
+ });
6617
+ var linkCmd = defineCommand29({
6618
+ meta: {
6619
+ name: "link",
6620
+ description: "Resolve where a file link points, and where it would open"
6621
+ },
6622
+ args: {
6623
+ ...slug,
6624
+ ...packetId,
6625
+ path: { type: "string", required: true, description: "Changed path in the reviewed revision" },
6626
+ line: { type: "string", description: "Line to point at" },
6627
+ open: {
6628
+ type: "boolean",
6629
+ description: "Actually open it on the daemon host (requires a configured editor)"
6630
+ },
6631
+ json: { type: "boolean", description: "Emit JSON" }
6632
+ },
6633
+ async run({ args: args2 }) {
6634
+ const client = createClient2();
6635
+ const options = {
6636
+ path: args2.path,
6637
+ ...args2.line ? { line: Number(args2.line) } : {}
6638
+ };
6639
+ try {
6640
+ if (args2.open) {
6641
+ const { link: link2, result } = await client.reviewPackets(args2.id).openLink(args2.packetId, options);
6642
+ console.log(result.opened ? `opened: ${result.detail}` : `not opened: ${result.detail}`);
6643
+ console.log(`host: ${link2.host.daemon ?? "unknown"} (owns the workspace)`);
6644
+ return;
6645
+ }
6646
+ const { link } = await client.reviewPackets(args2.id).link(args2.packetId, options);
6647
+ if (args2.json) {
6648
+ console.log(JSON.stringify(link, null, 2));
6649
+ return;
6650
+ }
6651
+ console.log(`copy: ${link.copyTarget}`);
6652
+ console.log(`host: ${link.host.daemon ?? "unknown"} (owns the workspace)`);
6653
+ console.log(`file: ${link.hostPath ?? "(not part of the reviewed revision)"}`);
6654
+ console.log(
6655
+ `mode: ${link.mode === "live" ? "the reviewed revision (the tree still matches the capture)" : link.mode === "stale" ? "the CURRENT file \u2014 the tree moved since the capture" : "unknown"}`
6656
+ );
6657
+ console.log(`open: ${link.canOpen ? link.command : "not configured on the daemon host"}`);
6658
+ for (const note of link.notes) console.log(` note: ${note}`);
6659
+ } catch (error) {
6660
+ console.error(error instanceof Error ? error.message : String(error));
6661
+ process.exit(1);
6662
+ }
6663
+ }
6664
+ });
6665
+ var exportCmd = defineCommand29({
6666
+ meta: { name: "export", description: "Print the patch and handoff text for a packet\u2019s revision" },
6667
+ args: {
6668
+ ...slug,
6669
+ ...packetId,
6670
+ patch: { type: "boolean", description: "Print only the unified patch" },
6671
+ deliver: {
6672
+ type: "boolean",
6673
+ description: "Publish the export as a durable artifact for the requesting Agent (subject to policy)"
6674
+ },
6675
+ handoff: { type: "boolean", description: "Print only the handoff text" },
6676
+ json: { type: "boolean", description: "Emit the export as JSON" }
6677
+ },
6678
+ async run({ args: args2 }) {
6679
+ const client = createClient2();
6680
+ try {
6681
+ if (args2.deliver) {
6682
+ const { delivery } = await client.reviewPackets(args2.id).deliverExport(args2.packetId);
6683
+ if (delivery.kind === "delivered") {
6684
+ console.log(`delivered: ${delivery.resultName} (result ${delivery.resultId})`);
6685
+ console.log(
6686
+ delivery.noticeHeld ? "the requester\u2019s notice is held for approval; the artifact itself is available" : "the requester was told where to find it"
6687
+ );
6688
+ } else if (delivery.kind === "held") {
6689
+ console.log(`held for approval: ${delivery.detail}`);
6690
+ console.log(`result ${delivery.resultId} stays unreadable until it is released`);
6691
+ } else {
6692
+ console.log(`not delivered (${delivery.kind}): ${delivery.detail}`);
6693
+ }
6694
+ return;
6695
+ }
6696
+ const { export: result } = await client.reviewPackets(args2.id).export(args2.packetId);
6697
+ if (args2.json) {
6698
+ console.log(JSON.stringify(result, null, 2));
6699
+ return;
6700
+ }
6701
+ if (args2.patch || !args2.handoff)
6702
+ console.log(result.patch || "(no patch: see the handoff limitations)");
6703
+ if (!args2.patch) {
6704
+ if (!args2.handoff) console.log("");
6705
+ console.log(result.handoff);
6706
+ }
6707
+ if (!args2.patch && result.limitations.length > 0) {
6708
+ console.error(
6709
+ `
6710
+ handoff names ${result.limitations.length} limitation(s), and a conclusion is not acceptance`
6711
+ );
6712
+ }
6713
+ } catch (error) {
6714
+ console.error(error instanceof Error ? error.message : String(error));
6715
+ process.exit(1);
6716
+ }
6717
+ }
6718
+ });
6719
+ var teamReviewPacketCommand = defineCommand29({
6720
+ meta: {
6721
+ name: "packet",
6722
+ description: "Revision-bound review packets: captured revision, findings, conclusion and handoff"
6723
+ },
6724
+ subCommands: {
6725
+ create: createCmd3,
6726
+ list: listCmd10,
6727
+ show: showCmd5,
6728
+ finding: findingCmd,
6729
+ resolve: resolveCmd,
6730
+ conclude: concludeCmd,
6731
+ reported: reportedCmd,
6732
+ link: linkCmd,
6733
+ export: exportCmd,
6734
+ snapshots: snapshotCmd
6735
+ }
6736
+ });
6737
+
6738
+ // src/commands/team-review.ts
6739
+ var slug2 = {
6241
6740
  id: { type: "positional", required: true, description: "Team slug" }
6242
6741
  };
6243
6742
  function printIssues(changes) {
6244
6743
  for (const issue of changes.issues) console.log(`note: ${issue.code}: ${issue.message}`);
6245
6744
  }
6246
- var showCmd5 = defineCommand29({
6745
+ var showCmd6 = defineCommand30({
6247
6746
  meta: {
6248
6747
  name: "show",
6249
6748
  description: "List changes since a baseline (read-only)"
6250
6749
  },
6251
6750
  args: {
6252
- ...slug,
6751
+ ...slug2,
6253
6752
  base: {
6254
6753
  type: "string",
6255
6754
  description: "Comparison base: branch, tag or commit id (default HEAD)"
@@ -6308,13 +6807,13 @@ var showCmd5 = defineCommand29({
6308
6807
  printIssues(changes);
6309
6808
  }
6310
6809
  });
6311
- var captureCmd = defineCommand29({
6810
+ var captureCmd = defineCommand30({
6312
6811
  meta: {
6313
6812
  name: "capture",
6314
6813
  description: "Capture a bounded source snapshot for a Team (read-only)"
6315
6814
  },
6316
6815
  args: {
6317
- ...slug,
6816
+ ...slug2,
6318
6817
  base: { type: "string", description: "Comparison base (default HEAD)" },
6319
6818
  include: {
6320
6819
  type: "string",
@@ -6351,9 +6850,9 @@ var captureCmd = defineCommand29({
6351
6850
  for (const issue of snapshot.issues) console.log(` note: ${issue.code}: ${issue.message}`);
6352
6851
  }
6353
6852
  });
6354
- var snapshotsCmd = defineCommand29({
6853
+ var snapshotsCmd = defineCommand30({
6355
6854
  meta: { name: "snapshots", description: "List retained source snapshots for a Team" },
6356
- args: { ...slug, json: { type: "boolean", description: "Emit JSON" } },
6855
+ args: { ...slug2, json: { type: "boolean", description: "Emit JSON" } },
6357
6856
  async run({ args: args2 }) {
6358
6857
  const client = createClient2();
6359
6858
  const list8 = await client.repositoryReview(args2.id).snapshots();
@@ -6375,10 +6874,10 @@ var snapshotsCmd = defineCommand29({
6375
6874
  for (const line of columnize(rows)) console.log(line);
6376
6875
  }
6377
6876
  });
6378
- var snapshotCmd = defineCommand29({
6877
+ var snapshotCmd2 = defineCommand30({
6379
6878
  meta: { name: "snapshot", description: "Show one retained source snapshot" },
6380
6879
  args: {
6381
- ...slug,
6880
+ ...slug2,
6382
6881
  snapshot: { type: "positional", required: true, description: "Snapshot id" },
6383
6882
  json: { type: "boolean", description: "Emit JSON" }
6384
6883
  },
@@ -6401,22 +6900,23 @@ var snapshotCmd = defineCommand29({
6401
6900
  for (const line of columnize(rows)) console.log(line);
6402
6901
  }
6403
6902
  });
6404
- var teamReviewCommand = defineCommand29({
6903
+ var teamReviewCommand = defineCommand30({
6405
6904
  meta: {
6406
6905
  name: "review",
6407
6906
  description: "Read-only Git change review and bounded source snapshots"
6408
6907
  },
6409
6908
  subCommands: {
6410
- show: showCmd5,
6909
+ show: showCmd6,
6411
6910
  capture: captureCmd,
6412
6911
  snapshots: snapshotsCmd,
6413
- snapshot: snapshotCmd
6912
+ snapshot: snapshotCmd2,
6913
+ packet: teamReviewPacketCommand
6414
6914
  }
6415
6915
  });
6416
6916
 
6417
6917
  // src/commands/team-verify.ts
6418
- import { defineCommand as defineCommand30 } from "citty";
6419
- var slug2 = {
6918
+ import { defineCommand as defineCommand31 } from "citty";
6919
+ var slug3 = {
6420
6920
  id: { type: "positional", required: true, description: "Team slug" }
6421
6921
  };
6422
6922
  var OUTCOME_GLYPH = {
@@ -6432,7 +6932,7 @@ var OUTCOME_GLYPH = {
6432
6932
  function latestAttempt(report) {
6433
6933
  return [...report.attempts].sort((a, b) => b.attemptNumber - a.attemptNumber)[0];
6434
6934
  }
6435
- function printReport(report) {
6935
+ function printReport2(report) {
6436
6936
  const { request } = report;
6437
6937
  const requester = request.requester.kind === "agent" ? `agent ${request.requester.agentId}` : "operator";
6438
6938
  console.log(`${request.id} ${request.state}`);
@@ -6457,16 +6957,27 @@ function printReport(report) {
6457
6957
  ` [${check.ordinal}] ${OUTCOME_GLYPH[state]}${exit}${receipt} ${check.command} (${check.purpose})`
6458
6958
  );
6459
6959
  }
6960
+ const writes = attempt?.observedWrites;
6961
+ if (writes?.undeclaredPaths.length) {
6962
+ const declared = writes.declaredPaths.length ? writes.declaredPaths.join(", ") : "none declared";
6963
+ console.log(
6964
+ ` wrote outside the declared output paths (${declared}): ${writes.undeclaredPaths.join(", ")}${writes.truncated ? " \u2026" : ""}`
6965
+ );
6966
+ } else if (writes?.comparison === "unknown") {
6967
+ console.log(
6968
+ " writes: could not be established (the tree could not be compared to the capture)"
6969
+ );
6970
+ }
6460
6971
  if (attempt?.error) console.log(` note: ${attempt.error}`);
6461
6972
  if (!attempt) console.log(" note: no attempt has run yet");
6462
6973
  }
6463
- var createCmd3 = defineCommand30({
6974
+ var createCmd4 = defineCommand31({
6464
6975
  meta: {
6465
6976
  name: "create",
6466
6977
  description: "Capture a verification request against a snapshot (does not run checks)"
6467
6978
  },
6468
6979
  args: {
6469
- ...slug2,
6980
+ ...slug3,
6470
6981
  agent: { type: "string", required: true, description: "Team member who will verify" },
6471
6982
  snapshot: { type: "string", required: true, description: "BAZ-042 snapshot id to verify" },
6472
6983
  check: {
@@ -6533,10 +7044,10 @@ var createCmd3 = defineCommand30({
6533
7044
  }
6534
7045
  }
6535
7046
  });
6536
- var listCmd10 = defineCommand30({
7047
+ var listCmd11 = defineCommand31({
6537
7048
  meta: { name: "list", description: "List verification requests for a Team" },
6538
7049
  args: {
6539
- ...slug2,
7050
+ ...slug3,
6540
7051
  json: { type: "boolean", description: "Emit JSON" }
6541
7052
  },
6542
7053
  async run({ args: args2 }) {
@@ -6563,10 +7074,10 @@ var listCmd10 = defineCommand30({
6563
7074
  console.log("run `bazilion team verify show <slug> <id>` for a request's current applicability");
6564
7075
  }
6565
7076
  });
6566
- var showCmd6 = defineCommand30({
7077
+ var showCmd7 = defineCommand31({
6567
7078
  meta: { name: "show", description: "Show one verification request and its evidence" },
6568
7079
  args: {
6569
- ...slug2,
7080
+ ...slug3,
6570
7081
  requestId: { type: "positional", required: true, description: "Verification request id" },
6571
7082
  json: { type: "boolean", description: "Emit JSON" }
6572
7083
  },
@@ -6578,17 +7089,17 @@ var showCmd6 = defineCommand30({
6578
7089
  console.log(JSON.stringify(response, null, 2));
6579
7090
  return;
6580
7091
  }
6581
- printReport(response.request);
7092
+ printReport2(response.request);
6582
7093
  } catch (error) {
6583
7094
  console.error(error instanceof Error ? error.message : String(error));
6584
7095
  process.exit(1);
6585
7096
  }
6586
7097
  }
6587
7098
  });
6588
- var cancelCmd2 = defineCommand30({
7099
+ var cancelCmd2 = defineCommand31({
6589
7100
  meta: { name: "cancel", description: "Cancel a pending or running verification request" },
6590
7101
  args: {
6591
- ...slug2,
7102
+ ...slug3,
6592
7103
  requestId: { type: "positional", required: true, description: "Verification request id" },
6593
7104
  json: { type: "boolean", description: "Emit JSON" }
6594
7105
  },
@@ -6601,28 +7112,28 @@ var cancelCmd2 = defineCommand30({
6601
7112
  return;
6602
7113
  }
6603
7114
  console.log(`cancelled or cancelled-pending: ${response.request.request.id}`);
6604
- printReport(response.request);
7115
+ printReport2(response.request);
6605
7116
  } catch (error) {
6606
7117
  console.error(error instanceof Error ? error.message : String(error));
6607
7118
  process.exit(1);
6608
7119
  }
6609
7120
  }
6610
7121
  });
6611
- var verifyCommand = defineCommand30({
7122
+ var verifyCommand = defineCommand31({
6612
7123
  meta: {
6613
7124
  name: "verify",
6614
7125
  description: "Specialist verification of a captured code change (BAZ-044)"
6615
7126
  },
6616
7127
  subCommands: {
6617
- create: createCmd3,
6618
- list: listCmd10,
6619
- show: showCmd6,
7128
+ create: createCmd4,
7129
+ list: listCmd11,
7130
+ show: showCmd7,
6620
7131
  cancel: cancelCmd2
6621
7132
  }
6622
7133
  });
6623
7134
 
6624
7135
  // src/commands/team.ts
6625
- var addCmd2 = defineCommand31({
7136
+ var addCmd2 = defineCommand32({
6626
7137
  meta: {
6627
7138
  name: "add",
6628
7139
  description: "Register a team at ~/.bazilion/teams/<slug>/ (use --link to point at an existing tree)"
@@ -6646,7 +7157,7 @@ var addCmd2 = defineCommand31({
6646
7157
  console.log(`registered team ${g.id} at ${g.path}`);
6647
7158
  }
6648
7159
  });
6649
- var listCmd11 = defineCommand31({
7160
+ var listCmd12 = defineCommand32({
6650
7161
  meta: { name: "list", description: "List teams" },
6651
7162
  async run() {
6652
7163
  const client = createClient2();
@@ -6659,7 +7170,7 @@ var listCmd11 = defineCommand31({
6659
7170
  for (const line of columnize(rows)) console.log(line);
6660
7171
  }
6661
7172
  });
6662
- var rmCmd5 = defineCommand31({
7173
+ var rmCmd5 = defineCommand32({
6663
7174
  meta: { name: "rm", description: "Remove a team registration" },
6664
7175
  args: {
6665
7176
  id: { type: "positional", required: true }
@@ -6680,7 +7191,7 @@ async function readStdin() {
6680
7191
  for await (const chunk of stdin2) chunks.push(chunk);
6681
7192
  return Buffer.concat(chunks).toString("utf8");
6682
7193
  }
6683
- var userMdShowCmd = defineCommand31({
7194
+ var userMdShowCmd = defineCommand32({
6684
7195
  meta: { name: "show", description: "Print the team's USER.md" },
6685
7196
  args: { id: { type: "positional", required: true } },
6686
7197
  async run({ args: args2 }) {
@@ -6690,7 +7201,7 @@ var userMdShowCmd = defineCommand31({
6690
7201
  if (g.userMd && !g.userMd.endsWith("\n")) process.stdout.write("\n");
6691
7202
  }
6692
7203
  });
6693
- var userMdSetCmd = defineCommand31({
7204
+ var userMdSetCmd = defineCommand32({
6694
7205
  meta: {
6695
7206
  name: "set",
6696
7207
  description: "Replace the team's USER.md (from --file, --from-stdin, or inline text)"
@@ -6716,7 +7227,7 @@ var userMdSetCmd = defineCommand31({
6716
7227
  console.log(`updated USER.md for team ${args2.id} (${content.length} bytes)`);
6717
7228
  }
6718
7229
  });
6719
- var userMdClearCmd = defineCommand31({
7230
+ var userMdClearCmd = defineCommand32({
6720
7231
  meta: { name: "clear", description: "Clear the team's USER.md to empty" },
6721
7232
  args: { id: { type: "positional", required: true } },
6722
7233
  async run({ args: args2 }) {
@@ -6726,7 +7237,7 @@ var userMdClearCmd = defineCommand31({
6726
7237
  console.log(`cleared USER.md for team ${args2.id}`);
6727
7238
  }
6728
7239
  });
6729
- var userMdCmd = defineCommand31({
7240
+ var userMdCmd = defineCommand32({
6730
7241
  meta: { name: "user-md", description: "View or edit a team's USER.md" },
6731
7242
  subCommands: {
6732
7243
  show: userMdShowCmd,
@@ -6734,7 +7245,7 @@ var userMdCmd = defineCommand31({
6734
7245
  clear: userMdClearCmd
6735
7246
  }
6736
7247
  });
6737
- var topicFormatShowCmd = defineCommand31({
7248
+ var topicFormatShowCmd = defineCommand32({
6738
7249
  meta: { name: "show", description: "Print the team's Telegram topic-name template" },
6739
7250
  args: { id: { type: "positional", required: true } },
6740
7251
  async run({ args: args2 }) {
@@ -6743,7 +7254,7 @@ var topicFormatShowCmd = defineCommand31({
6743
7254
  console.log(g.telegramTopicNameFormat ?? "(default naming)");
6744
7255
  }
6745
7256
  });
6746
- var topicFormatSetCmd = defineCommand31({
7257
+ var topicFormatSetCmd = defineCommand32({
6747
7258
  meta: {
6748
7259
  name: "set",
6749
7260
  description: "Set the topic-name template. Tokens: {agent.name} {team.name} {team.slug} (must include {agent.name})"
@@ -6763,7 +7274,7 @@ var topicFormatSetCmd = defineCommand31({
6763
7274
  console.log(`set topic-name template for team ${args2.id}: ${g.telegramTopicNameFormat}`);
6764
7275
  }
6765
7276
  });
6766
- var topicFormatClearCmd = defineCommand31({
7277
+ var topicFormatClearCmd = defineCommand32({
6767
7278
  meta: { name: "clear", description: "Clear the template (revert to built-in naming)" },
6768
7279
  args: { id: { type: "positional", required: true } },
6769
7280
  async run({ args: args2 }) {
@@ -6773,7 +7284,7 @@ var topicFormatClearCmd = defineCommand31({
6773
7284
  console.log(`cleared topic-name template for team ${args2.id}`);
6774
7285
  }
6775
7286
  });
6776
- var topicFormatCmd = defineCommand31({
7287
+ var topicFormatCmd = defineCommand32({
6777
7288
  meta: {
6778
7289
  name: "topic-format",
6779
7290
  description: "View or edit a team's Telegram forum-topic name template"
@@ -6784,7 +7295,7 @@ var topicFormatCmd = defineCommand31({
6784
7295
  clear: topicFormatClearCmd
6785
7296
  }
6786
7297
  });
6787
- var contextCmd = defineCommand31({
7298
+ var contextCmd = defineCommand32({
6788
7299
  meta: {
6789
7300
  name: "context",
6790
7301
  description: "Inspect repository instructions, Git state and command suggestions"
@@ -6831,7 +7342,7 @@ var contextCmd = defineCommand31({
6831
7342
  console.log(` ${issue.code}${issue.path ? `: ${safe2(issue.path)}` : ""} \u2014 ${issue.message}`);
6832
7343
  }
6833
7344
  });
6834
- var teamCommand = defineCommand31({
7345
+ var teamCommand = defineCommand32({
6835
7346
  meta: { name: "team", description: "Manage teams (collaboration contexts)" },
6836
7347
  subCommands: {
6837
7348
  environment: teamEnvironmentCommand,
@@ -6840,7 +7351,7 @@ var teamCommand = defineCommand31({
6840
7351
  verify: verifyCommand,
6841
7352
  context: contextCmd,
6842
7353
  add: addCmd2,
6843
- list: listCmd11,
7354
+ list: listCmd12,
6844
7355
  rm: rmCmd5,
6845
7356
  "user-md": userMdCmd,
6846
7357
  "topic-format": topicFormatCmd,
@@ -6850,7 +7361,7 @@ var teamCommand = defineCommand31({
6850
7361
 
6851
7362
  // src/commands/team-template.ts
6852
7363
  import { readFileSync as readFileSync12 } from "fs";
6853
- import { defineCommand as defineCommand32 } from "citty";
7364
+ import { defineCommand as defineCommand33 } from "citty";
6854
7365
  function jsonFile(path) {
6855
7366
  try {
6856
7367
  return JSON.parse(readFileSync12(path, "utf8"));
@@ -6878,7 +7389,7 @@ function printTeam(detail) {
6878
7389
  console.log(line);
6879
7390
  }
6880
7391
  }
6881
- var list7 = defineCommand32({
7392
+ var list7 = defineCommand33({
6882
7393
  meta: { name: "list", description: "List canonical Team templates" },
6883
7394
  args: { json: { type: "boolean", description: "Emit stable JSON" } },
6884
7395
  async run({ args: args2 }) {
@@ -6892,7 +7403,7 @@ var list7 = defineCommand32({
6892
7403
  console.log(line);
6893
7404
  }
6894
7405
  });
6895
- var show6 = defineCommand32({
7406
+ var show6 = defineCommand33({
6896
7407
  meta: { name: "show", description: "Show a canonical Team template" },
6897
7408
  args: {
6898
7409
  id: { type: "positional", required: true },
@@ -6906,7 +7417,7 @@ var show6 = defineCommand32({
6906
7417
  else printTeam(detail);
6907
7418
  }
6908
7419
  });
6909
- var exportCommand2 = defineCommand32({
7420
+ var exportCommand2 = defineCommand33({
6910
7421
  meta: {
6911
7422
  name: "export",
6912
7423
  description: "Export a portable versioned Team-template document to stdout"
@@ -6946,7 +7457,7 @@ function printImportDiff(current, document) {
6946
7457
  for (const value of diff2.added) console.log(` + ${value}`);
6947
7458
  for (const value of diff2.removed) console.log(` - ${value}`);
6948
7459
  }
6949
- var importCommand2 = defineCommand32({
7460
+ var importCommand2 = defineCommand33({
6950
7461
  meta: {
6951
7462
  name: "import",
6952
7463
  description: "Validate, diff, and explicitly apply a portable Team-template document"
@@ -7027,7 +7538,7 @@ var importCommand2 = defineCommand32({
7027
7538
  );
7028
7539
  }
7029
7540
  });
7030
- var teamTemplateCommand = defineCommand32({
7541
+ var teamTemplateCommand = defineCommand33({
7031
7542
  meta: {
7032
7543
  name: "team-template",
7033
7544
  description: "Inspect and exchange canonical Team templates"
@@ -7036,8 +7547,8 @@ var teamTemplateCommand = defineCommand32({
7036
7547
  });
7037
7548
 
7038
7549
  // src/commands/telegram.ts
7039
- import { defineCommand as defineCommand33 } from "citty";
7040
- var setCmd2 = defineCommand33({
7550
+ import { defineCommand as defineCommand34 } from "citty";
7551
+ var setCmd2 = defineCommand34({
7041
7552
  meta: {
7042
7553
  name: "set",
7043
7554
  description: "Save bot token + supergroup chat ID (paired write)"
@@ -7055,7 +7566,7 @@ var setCmd2 = defineCommand33({
7055
7566
  console.log(`saved \xB7 token ${state.botTokenPreview} \xB7 chat ${state.chatId}`);
7056
7567
  }
7057
7568
  });
7058
- var clearCmd = defineCommand33({
7569
+ var clearCmd = defineCommand34({
7059
7570
  meta: {
7060
7571
  name: "clear",
7061
7572
  description: "Remove stored bot token + chat ID"
@@ -7066,7 +7577,7 @@ var clearCmd = defineCommand33({
7066
7577
  console.log("cleared");
7067
7578
  }
7068
7579
  });
7069
- var showCmd7 = defineCommand33({
7580
+ var showCmd8 = defineCommand34({
7070
7581
  meta: {
7071
7582
  name: "show",
7072
7583
  description: "Show what credentials are stored (token is masked)"
@@ -7087,7 +7598,7 @@ var showCmd7 = defineCommand33({
7087
7598
  }
7088
7599
  }
7089
7600
  });
7090
- var reconnectCmd = defineCommand33({
7601
+ var reconnectCmd = defineCommand34({
7091
7602
  meta: {
7092
7603
  name: "reconnect",
7093
7604
  description: "Apply a pending supergroup chat-id migration + re-activate the bot"
@@ -7098,7 +7609,7 @@ var reconnectCmd = defineCommand33({
7098
7609
  console.log(`reconnected \xB7 chat ${state.chatId}`);
7099
7610
  }
7100
7611
  });
7101
- var configCmd = defineCommand33({
7612
+ var configCmd = defineCommand34({
7102
7613
  meta: {
7103
7614
  name: "config",
7104
7615
  description: "Manage Telegram credentials (bot token + chat ID)"
@@ -7106,10 +7617,10 @@ var configCmd = defineCommand33({
7106
7617
  subCommands: {
7107
7618
  set: setCmd2,
7108
7619
  clear: clearCmd,
7109
- show: showCmd7
7620
+ show: showCmd8
7110
7621
  }
7111
7622
  });
7112
- var healthCmd = defineCommand33({
7623
+ var healthCmd = defineCommand34({
7113
7624
  meta: {
7114
7625
  name: "health",
7115
7626
  description: "Run the four-step preflight against the Telegram Bot API"
@@ -7148,7 +7659,7 @@ var healthCmd = defineCommand33({
7148
7659
  if (!allOk) process.exitCode = 1;
7149
7660
  }
7150
7661
  });
7151
- var botStatusCmd = defineCommand33({
7662
+ var botStatusCmd = defineCommand34({
7152
7663
  meta: {
7153
7664
  name: "status",
7154
7665
  description: "Show polling state of the live bot"
@@ -7173,7 +7684,7 @@ var botStatusCmd = defineCommand33({
7173
7684
  if (!p.running) process.exitCode = 1;
7174
7685
  }
7175
7686
  });
7176
- var botRestartCmd = defineCommand33({
7687
+ var botRestartCmd = defineCommand34({
7177
7688
  meta: {
7178
7689
  name: "restart",
7179
7690
  description: "Force-restart the bot (tears down + brings up from current creds)"
@@ -7184,7 +7695,7 @@ var botRestartCmd = defineCommand33({
7184
7695
  console.log("restart requested");
7185
7696
  }
7186
7697
  });
7187
- var botCmd = defineCommand33({
7698
+ var botCmd = defineCommand34({
7188
7699
  meta: {
7189
7700
  name: "bot",
7190
7701
  description: "Inspect / control the live polling bot"
@@ -7194,7 +7705,7 @@ var botCmd = defineCommand33({
7194
7705
  restart: botRestartCmd
7195
7706
  }
7196
7707
  });
7197
- var bindCmd = defineCommand33({
7708
+ var bindCmd = defineCommand34({
7198
7709
  meta: {
7199
7710
  name: "bind",
7200
7711
  description: "Create a Telegram topic for an agent (manual fallback for /talk)"
@@ -7212,7 +7723,7 @@ var bindCmd = defineCommand33({
7212
7723
  console.log(` ${result.deepLink}`);
7213
7724
  }
7214
7725
  });
7215
- var unbindCmd = defineCommand33({
7726
+ var unbindCmd = defineCommand34({
7216
7727
  meta: {
7217
7728
  name: "unbind",
7218
7729
  description: "Clear an agent's Telegram topic binding (topic stays in Telegram as orphan)"
@@ -7226,7 +7737,7 @@ var unbindCmd = defineCommand33({
7226
7737
  console.log(`unbound agent ${args2.agent}`);
7227
7738
  }
7228
7739
  });
7229
- var listBindingsCmd = defineCommand33({
7740
+ var listBindingsCmd = defineCommand34({
7230
7741
  meta: {
7231
7742
  name: "list",
7232
7743
  description: "List agents and their Telegram topic bindings"
@@ -7254,7 +7765,7 @@ var listBindingsCmd = defineCommand33({
7254
7765
  }
7255
7766
  }
7256
7767
  });
7257
- var allowCmd = defineCommand33({
7768
+ var allowCmd = defineCommand34({
7258
7769
  meta: { name: "allow", description: "Add a Telegram user id to the allowlist" },
7259
7770
  args: {
7260
7771
  userId: { type: "positional", required: true, description: "Numeric Telegram user id" },
@@ -7270,7 +7781,7 @@ var allowCmd = defineCommand33({
7270
7781
  console.log(`allowed ${u.userId} (${u.role})`);
7271
7782
  }
7272
7783
  });
7273
- var denyCmd = defineCommand33({
7784
+ var denyCmd = defineCommand34({
7274
7785
  meta: { name: "deny", description: "Remove a Telegram user id from the allowlist" },
7275
7786
  args: { userId: { type: "positional", required: true } },
7276
7787
  async run({ args: args2 }) {
@@ -7279,7 +7790,7 @@ var denyCmd = defineCommand33({
7279
7790
  console.log(`removed ${args2.userId}`);
7280
7791
  }
7281
7792
  });
7282
- var allowedCmd = defineCommand33({
7793
+ var allowedCmd = defineCommand34({
7283
7794
  meta: { name: "allowed", description: "List allowlisted Telegram users" },
7284
7795
  async run() {
7285
7796
  const client = createClient2();
@@ -7294,7 +7805,7 @@ var allowedCmd = defineCommand33({
7294
7805
  }
7295
7806
  }
7296
7807
  });
7297
- var pairingCreateCmd = defineCommand33({
7808
+ var pairingCreateCmd = defineCommand34({
7298
7809
  meta: { name: "create", description: "Generate a one-time Telegram owner pairing code" },
7299
7810
  async run() {
7300
7811
  const result = await createClient2().post(
@@ -7305,7 +7816,7 @@ var pairingCreateCmd = defineCommand33({
7305
7816
  console.log("send `/pair <code>` in the configured \u2699 bazilion service topic");
7306
7817
  }
7307
7818
  });
7308
- var pairingStatusCmd = defineCommand33({
7819
+ var pairingStatusCmd = defineCommand34({
7309
7820
  meta: { name: "status", description: "Show Telegram owner pairing status" },
7310
7821
  async run() {
7311
7822
  const result = await createClient2().get("/api/config/telegram/pairing");
@@ -7316,14 +7827,14 @@ var pairingStatusCmd = defineCommand33({
7316
7827
  console.log(`expires: ${new Date(result.challengeExpiresAt).toISOString()}`);
7317
7828
  }
7318
7829
  });
7319
- var pairingCancelCmd = defineCommand33({
7830
+ var pairingCancelCmd = defineCommand34({
7320
7831
  meta: { name: "cancel", description: "Cancel the active Telegram pairing code" },
7321
7832
  async run() {
7322
7833
  await createClient2().del("/api/config/telegram/pairing/challenge");
7323
7834
  console.log("pairing challenge cancelled");
7324
7835
  }
7325
7836
  });
7326
- var pairingResetCmd = defineCommand33({
7837
+ var pairingResetCmd = defineCommand34({
7327
7838
  meta: { name: "reset", description: "Revoke the Telegram owner and require re-pairing" },
7328
7839
  args: {
7329
7840
  yes: { type: "boolean", description: "Confirm destructive owner reset", required: true }
@@ -7334,7 +7845,7 @@ var pairingResetCmd = defineCommand33({
7334
7845
  console.log("Telegram owner reset; ingress is closed until re-paired");
7335
7846
  }
7336
7847
  });
7337
- var pairingCmd = defineCommand33({
7848
+ var pairingCmd = defineCommand34({
7338
7849
  meta: { name: "pairing", description: "Manage single-owner Telegram pairing" },
7339
7850
  subCommands: {
7340
7851
  create: pairingCreateCmd,
@@ -7343,7 +7854,7 @@ var pairingCmd = defineCommand33({
7343
7854
  reset: pairingResetCmd
7344
7855
  }
7345
7856
  });
7346
- var telegramCommand = defineCommand33({
7857
+ var telegramCommand = defineCommand34({
7347
7858
  meta: {
7348
7859
  name: "telegram",
7349
7860
  description: "Telegram integration: credentials, health, bot lifecycle, bindings, access"
@@ -7364,7 +7875,7 @@ var telegramCommand = defineCommand33({
7364
7875
  });
7365
7876
 
7366
7877
  // src/commands/token.ts
7367
- import { defineCommand as defineCommand34 } from "citty";
7878
+ import { defineCommand as defineCommand35 } from "citty";
7368
7879
  import qrcode from "qrcode-terminal";
7369
7880
  function tokenRow(t) {
7370
7881
  const last = t.lastUsedAt ? new Date(t.lastUsedAt).toISOString() : "(never)";
@@ -7393,7 +7904,7 @@ function resolveQrServer(override) {
7393
7904
  }
7394
7905
  return url.origin;
7395
7906
  }
7396
- var createCmd4 = defineCommand34({
7907
+ var createCmd5 = defineCommand35({
7397
7908
  meta: { name: "create", description: "Mint a new web token (shown once)" },
7398
7909
  args: {
7399
7910
  label: { type: "positional", required: true, description: "Human-readable label" },
@@ -7436,7 +7947,7 @@ var createCmd4 = defineCommand34({
7436
7947
  qrcode.generate(pairUrl, { small: true }, (qr) => console.log(qr));
7437
7948
  }
7438
7949
  });
7439
- var listCmd12 = defineCommand34({
7950
+ var listCmd13 = defineCommand35({
7440
7951
  meta: { name: "list", description: "List web tokens" },
7441
7952
  args: {
7442
7953
  all: { type: "boolean", description: "Include revoked tokens" }
@@ -7452,7 +7963,7 @@ var listCmd12 = defineCommand34({
7452
7963
  for (const line of columnize(tokens.map(tokenRow))) console.log(line);
7453
7964
  }
7454
7965
  });
7455
- var showLocalCmd = defineCommand34({
7966
+ var showLocalCmd = defineCommand35({
7456
7967
  meta: {
7457
7968
  name: "show-local",
7458
7969
  description: "Print the bootstrap web token stored in ~/.bazilion/auth.json"
@@ -7462,7 +7973,7 @@ var showLocalCmd = defineCommand34({
7462
7973
  console.log(readAuthFile(paths.authFile).token);
7463
7974
  }
7464
7975
  });
7465
- var revokeCmd2 = defineCommand34({
7976
+ var revokeCmd2 = defineCommand35({
7466
7977
  meta: { name: "revoke", description: "Revoke a web token" },
7467
7978
  args: {
7468
7979
  id: { type: "positional", required: true }
@@ -7473,19 +7984,19 @@ var revokeCmd2 = defineCommand34({
7473
7984
  console.log(`revoked token ${args2.id}`);
7474
7985
  }
7475
7986
  });
7476
- var tokenCommand = defineCommand34({
7987
+ var tokenCommand = defineCommand35({
7477
7988
  meta: { name: "token", description: "Manage web tokens for API/CLI clients" },
7478
7989
  subCommands: {
7479
- create: createCmd4,
7480
- list: listCmd12,
7990
+ create: createCmd5,
7991
+ list: listCmd13,
7481
7992
  revoke: revokeCmd2,
7482
7993
  "show-local": showLocalCmd
7483
7994
  }
7484
7995
  });
7485
7996
 
7486
7997
  // src/commands/trigger.ts
7487
- import { defineCommand as defineCommand35 } from "citty";
7488
- var addCmd3 = defineCommand35({
7998
+ import { defineCommand as defineCommand36 } from "citty";
7999
+ var addCmd3 = defineCommand36({
7489
8000
  meta: { name: "add", description: "Add an interval / cron trigger to an agent" },
7490
8001
  args: {
7491
8002
  agent: { type: "positional", required: true },
@@ -7533,7 +8044,7 @@ function triggerRow(t) {
7533
8044
  const msgPreview = t.message.length > 60 ? `${t.message.slice(0, 60)}\u2026` : t.message;
7534
8045
  return [t.id, state, spec, `last: ${last}`, `"${msgPreview}"`];
7535
8046
  }
7536
- var listCmd13 = defineCommand35({
8047
+ var listCmd14 = defineCommand36({
7537
8048
  meta: { name: "list", description: "List triggers for an agent" },
7538
8049
  args: {
7539
8050
  agent: { type: "positional", required: true }
@@ -7550,7 +8061,7 @@ var listCmd13 = defineCommand35({
7550
8061
  for (const line of columnize(triggers.map(triggerRow))) console.log(line);
7551
8062
  }
7552
8063
  });
7553
- var rmCmd6 = defineCommand35({
8064
+ var rmCmd6 = defineCommand36({
7554
8065
  meta: { name: "rm", description: "Delete a trigger" },
7555
8066
  args: {
7556
8067
  id: { type: "positional", required: true }
@@ -7561,7 +8072,7 @@ var rmCmd6 = defineCommand35({
7561
8072
  console.log(`removed trigger ${args2.id}`);
7562
8073
  }
7563
8074
  });
7564
- var enableCmd3 = defineCommand35({
8075
+ var enableCmd3 = defineCommand36({
7565
8076
  meta: { name: "enable", description: "Enable a trigger" },
7566
8077
  args: {
7567
8078
  id: { type: "positional", required: true }
@@ -7573,7 +8084,7 @@ var enableCmd3 = defineCommand35({
7573
8084
  console.log(`enabled trigger ${args2.id}`);
7574
8085
  }
7575
8086
  });
7576
- var disableCmd3 = defineCommand35({
8087
+ var disableCmd3 = defineCommand36({
7577
8088
  meta: { name: "disable", description: "Disable a trigger" },
7578
8089
  args: {
7579
8090
  id: { type: "positional", required: true }
@@ -7585,7 +8096,7 @@ var disableCmd3 = defineCommand35({
7585
8096
  console.log(`disabled trigger ${args2.id}`);
7586
8097
  }
7587
8098
  });
7588
- var historyCmd = defineCommand35({
8099
+ var historyCmd = defineCommand36({
7589
8100
  meta: { name: "history", description: "Show recent dispatches for a trigger" },
7590
8101
  args: {
7591
8102
  id: { type: "positional", required: true },
@@ -7613,11 +8124,11 @@ var historyCmd = defineCommand35({
7613
8124
  for (const line of columnize(rows)) console.log(line);
7614
8125
  }
7615
8126
  });
7616
- var triggerCommand = defineCommand35({
8127
+ var triggerCommand = defineCommand36({
7617
8128
  meta: { name: "trigger", description: "Manage scheduled agent triggers" },
7618
8129
  subCommands: {
7619
8130
  add: addCmd3,
7620
- list: listCmd13,
8131
+ list: listCmd14,
7621
8132
  rm: rmCmd6,
7622
8133
  enable: enableCmd3,
7623
8134
  disable: disableCmd3,
@@ -7629,7 +8140,7 @@ var triggerCommand = defineCommand35({
7629
8140
  import { existsSync as existsSync7, lstatSync as lstatSync4, readdirSync as readdirSync2, realpathSync as realpathSync2, rmSync as rmSync4 } from "fs";
7630
8141
  import { homedir as homedir2 } from "os";
7631
8142
  import { isAbsolute as isAbsolute2, join as join6, parse as parse2, relative as relative2, resolve as resolve5, sep } from "path";
7632
- import { defineCommand as defineCommand36 } from "citty";
8143
+ import { defineCommand as defineCommand37 } from "citty";
7633
8144
  function makeLineReader() {
7634
8145
  let buffer = "";
7635
8146
  let ended = false;
@@ -7716,7 +8227,7 @@ function assertSafeUninstallHome(home) {
7716
8227
  }
7717
8228
  return target;
7718
8229
  }
7719
- var uninstallCommand = defineCommand36({
8230
+ var uninstallCommand = defineCommand37({
7720
8231
  meta: {
7721
8232
  name: "uninstall",
7722
8233
  description: "Wipe bazilion state from ~/.bazilion (or BAZILION_HOME)"
@@ -7820,7 +8331,7 @@ var uninstallCommand = defineCommand36({
7820
8331
 
7821
8332
  // src/index.ts
7822
8333
  var VERSION = package_default.version;
7823
- var main = defineCommand37({
8334
+ var main = defineCommand38({
7824
8335
  meta: {
7825
8336
  name: "bazilion",
7826
8337
  version: VERSION,