@wirecat/cli-template 0.13.2 → 0.15.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 (121) hide show
  1. package/.github/workflows/changelog-guard.yml +1 -1
  2. package/.github/workflows/ci.yml +1 -1
  3. package/.github/workflows/monthly.yml +1 -1
  4. package/.github/workflows/release.yml +1 -1
  5. package/CHANGELOG.md +35 -0
  6. package/config/parity-groups.json +32 -1
  7. package/contracts/mcp-tools.json +100 -0
  8. package/dist/bin/clidev.js +6 -2
  9. package/dist/bundle/{all-profiles-MJ6XSFOO.js → all-profiles-NVB2HT2S.js} +6 -6
  10. package/dist/bundle/{anthropic-W5UKBZUB.js → anthropic-ICTW7CNQ.js} +4 -4
  11. package/dist/bundle/{app-server-EZ46JAHB.js → app-server-OW5LT5XV.js} +40 -38
  12. package/dist/bundle/{bun-HB6O2TTT.js → bun-ILPS6AYA.js} +2 -2
  13. package/dist/bundle/{bun-sqlite-KBXOW2ES.js → bun-sqlite-JE6FJFQT.js} +3 -3
  14. package/dist/bundle/{chunk-KJTNT4SW.js → chunk-2DAXUNTS.js} +2 -2
  15. package/dist/bundle/chunk-3MDNAYQA.js +34 -0
  16. package/dist/bundle/chunk-3WDYHOAF.js +91 -0
  17. package/dist/bundle/{chunk-EGRB55FF.js → chunk-45244QQ6.js} +14 -12
  18. package/dist/bundle/{chunk-JHO2LL2J.js → chunk-4MU2UM4C.js} +7 -7
  19. package/dist/bundle/{chunk-N2Z3MCOF.js → chunk-5GTMQTQH.js} +37 -35
  20. package/dist/bundle/chunk-62JRF2JA.js +35 -0
  21. package/dist/bundle/{chunk-TGB5F7NC.js → chunk-66VMJGV6.js} +4 -4
  22. package/dist/bundle/{chunk-V3ZTQ24B.js → chunk-6AW4DDK4.js} +4 -4
  23. package/dist/bundle/{chunk-PJOVK7PG.js → chunk-7F5VMLVK.js} +49 -24
  24. package/dist/bundle/{chunk-YJNUDHJD.js → chunk-7UPBPE3Z.js} +139 -35
  25. package/dist/bundle/{chunk-MFS52LTZ.js → chunk-7Z4HR6GO.js} +1 -1
  26. package/dist/bundle/{chunk-E42W72PQ.js → chunk-AS2PJNQ2.js} +7 -5
  27. package/dist/bundle/{chunk-Z7MSIRSQ.js → chunk-CGFQT3LQ.js} +1 -1
  28. package/dist/bundle/{chunk-QKWRL4OD.js → chunk-DQIBGCF3.js} +6 -6
  29. package/dist/bundle/{chunk-RUKDZEID.js → chunk-DZLHY4IA.js} +3 -3
  30. package/dist/bundle/{chunk-TAYOKLGF.js → chunk-EMHCXXNJ.js} +7 -6
  31. package/dist/bundle/{chunk-AK257OMS.js → chunk-EX2FV7YJ.js} +209 -78
  32. package/dist/bundle/{chunk-IBBN7Z3A.js → chunk-F34HGYWF.js} +12 -3
  33. package/dist/bundle/{chunk-KRCCGWWS.js → chunk-FC53WQHG.js} +1 -1
  34. package/dist/bundle/{chunk-ERGB4NJA.js → chunk-G45R7M42.js} +1 -1
  35. package/dist/bundle/{chunk-ZLY6GUAS.js → chunk-G7W53MQP.js} +3 -3
  36. package/dist/bundle/{chunk-FZZIU4B7.js → chunk-GHF72SHT.js} +8196 -5601
  37. package/dist/bundle/{chunk-JAOGZMKQ.js → chunk-GUFPQZUA.js} +2 -2
  38. package/dist/bundle/{chunk-EFHLQXG6.js → chunk-IOJ2DTCY.js} +162 -55
  39. package/dist/bundle/{chunk-7IXL4UFK.js → chunk-KJ3UADR3.js} +8 -8
  40. package/dist/bundle/{chunk-L5WWMP5M.js → chunk-KLFYY7KC.js} +144 -31
  41. package/dist/bundle/{chunk-NOVLCHDV.js → chunk-LATYBJ4T.js} +2 -2
  42. package/dist/bundle/{chunk-QBP7OMN5.js → chunk-LFLSV353.js} +2 -2
  43. package/dist/bundle/{chunk-HDY5X3WQ.js → chunk-LU4A2T7Y.js} +4 -4
  44. package/dist/bundle/{chunk-SVDF6NJF.js → chunk-MWUHBEDN.js} +14 -14
  45. package/dist/bundle/{chunk-JRK73FOW.js → chunk-NENYWEXF.js} +1 -1
  46. package/dist/bundle/{chunk-ERKR3VJ5.js → chunk-NG7MOJBT.js} +141 -46
  47. package/dist/bundle/{chunk-2B5U4Z5H.js → chunk-NH6LZ3H3.js} +8 -13
  48. package/dist/bundle/{chunk-IGHEW777.js → chunk-NRZV7K4M.js} +5 -40
  49. package/dist/bundle/{chunk-4LURWBVV.js → chunk-NVGOHYTE.js} +188 -22
  50. package/dist/bundle/{chunk-OV6PHTAY.js → chunk-NVNUUHT5.js} +17130 -2232
  51. package/dist/bundle/chunk-PIJUGF5F.js +392 -0
  52. package/dist/bundle/{chunk-PBN4RBHS.js → chunk-R2JKPHH5.js} +8 -8
  53. package/dist/bundle/{chunk-PDGXMKJS.js → chunk-R5RYPD23.js} +2 -2
  54. package/dist/bundle/{chunk-35KYY65W.js → chunk-SOYOOU2D.js} +3 -3
  55. package/dist/bundle/{chunk-FDBINRWA.js → chunk-TJJ2XSJP.js} +5 -5
  56. package/dist/bundle/{chunk-O3UXNU3S.js → chunk-U6QD3J3F.js} +3 -3
  57. package/dist/bundle/{chunk-VYSUKHKL.js → chunk-VOTEB3AN.js} +1 -1
  58. package/dist/bundle/{chunk-IN3FVRPK.js → chunk-VS5LGSTM.js} +1 -1
  59. package/dist/bundle/{chunk-QJ6XW4DM.js → chunk-VVGPAHUN.js} +6211 -1207
  60. package/dist/bundle/{chunk-MJRSEUKG.js → chunk-VXOR76ZL.js} +13 -89
  61. package/dist/bundle/{chunk-CXQXVKUY.js → chunk-YIVY2WI3.js} +1 -1
  62. package/dist/bundle/{chunk-VLNKTMV7.js → chunk-YOJLIVGO.js} +959 -350
  63. package/dist/bundle/clidev.js +3 -3
  64. package/dist/bundle/command-contract-3MPKXBVL.js +28 -0
  65. package/dist/bundle/{decode-AMXUVKNY.js → decode-NXB5UKMO.js} +18 -16
  66. package/dist/bundle/{echarts-GJDMQ2AQ.js → echarts-DRDGGHJT.js} +2 -2
  67. package/dist/bundle/{embed-L4CRZ2XQ.js → embed-IKZ24BMC.js} +4 -4
  68. package/dist/bundle/{embedder-IBGV4M2K.js → embedder-GMQ24DOQ.js} +7 -7
  69. package/dist/bundle/{first-run-VTKC2IBV.js → first-run-PURIGDLD.js} +8 -8
  70. package/dist/bundle/first-screen-B2CF2CET.js +26 -0
  71. package/dist/bundle/{instructions-YJECS4KN.js → instructions-EOQOXY6V.js} +1 -1
  72. package/dist/bundle/{mcp-OQBZXELQ.js → mcp-7HBLFGCW.js} +2 -2
  73. package/dist/bundle/{mcp-GBSAK3VW.js → mcp-ASNYBQ5B.js} +38 -37
  74. package/dist/bundle/mcp-EY2NUYDQ.js +82 -0
  75. package/dist/bundle/{node-NQG4EVZR.js → node-52WF2326.js} +2 -2
  76. package/dist/bundle/{node-sqlite-BR7F3BLB.js → node-sqlite-73Z4SFOA.js} +9 -3
  77. package/dist/bundle/{oauth-J7UAWNIK.js → oauth-EVTPAMZP.js} +5 -5
  78. package/dist/bundle/{open-BR47R5UE.js → open-46WZAPJ3.js} +3 -2
  79. package/dist/bundle/openai-GWRDAHDU.js +248 -0
  80. package/dist/bundle/{process-66I7RDPJ.js → process-YIQPKLZI.js} +1 -1
  81. package/dist/bundle/{program-EM4FKOCK.js → program-37NVH5YJ.js} +11354 -9564
  82. package/dist/bundle/{prompt-NE5JJ7UP.js → prompt-IVEYRLS5.js} +3 -3
  83. package/dist/bundle/{recognize-GC3YFVIA.js → recognize-WVEKHODM.js} +4 -2
  84. package/dist/bundle/{remote-QELOMKQM.js → remote-4K5VPMC7.js} +5 -5
  85. package/dist/bundle/{rerank-BH6TZ2SP.js → rerank-V24UJZYJ.js} +5 -5
  86. package/dist/bundle/{serve-WWLRNDT2.js → serve-PJWSOV7F.js} +7 -7
  87. package/dist/bundle/server-3TPCEZ6P.js +40 -0
  88. package/dist/bundle/server-GQX5MZTT.js +53 -0
  89. package/dist/bundle/{state-2BEGXAMO.js → state-ZPYGECVP.js} +4 -4
  90. package/dist/bundle/{store-AH6WZMCF.js → store-6JQCLPQF.js} +14 -9
  91. package/dist/bundle/store-maintenance-command-ND4ADMGC.js +42 -0
  92. package/dist/config.d.ts +2 -0
  93. package/dist/config.d.ts.map +1 -1
  94. package/dist/config.js +4 -2
  95. package/dist/config.js.map +1 -1
  96. package/dist/program.d.ts.map +1 -1
  97. package/dist/program.js +2 -1
  98. package/dist/program.js.map +1 -1
  99. package/dist/version.d.ts +1 -1
  100. package/dist/version.js +1 -1
  101. package/docs/commands.md +37 -11
  102. package/docs/dev/reference-clis.md +1 -1
  103. package/docs/dev/skills/design-interview/SKILL.md +2 -2
  104. package/docs/dev/test-matrix.md +5 -1
  105. package/kit/dist/interview.js +1 -0
  106. package/kit/dist/new.js +8 -3
  107. package/package.json +3 -3
  108. package/src/config.ts +5 -2
  109. package/src/program.test.ts +86 -1
  110. package/src/program.ts +2 -1
  111. package/src/version.ts +1 -1
  112. package/dist/bundle/chunk-IDWW4TU2.js +0 -18
  113. package/dist/bundle/chunk-MUSYGFCY.js +0 -3556
  114. package/dist/bundle/chunk-O5EHUB2V.js +0 -2
  115. package/dist/bundle/command-contract-75VJ36U4.js +0 -29
  116. package/dist/bundle/first-screen-X5IJKBSU.js +0 -27
  117. package/dist/bundle/mcp-RDZGYPSY.js +0 -78
  118. package/dist/bundle/server-DE6NLNUF.js +0 -52
  119. package/dist/bundle/server-ZPSQKOAH.js +0 -39
  120. package/dist/bundle/store-maintenance-command-PBXX3IEV.js +0 -40
  121. /package/dist/bundle/{chunk-GOO67PDU.js → chunk-NL2DQPT7.js} +0 -0
@@ -4,21 +4,23 @@ import {
4
4
  OFFLINE,
5
5
  capability,
6
6
  chatIdIn,
7
+ chatReferenceOf,
8
+ ensureAccount,
7
9
  foldName,
8
10
  isId,
9
11
  pickPerson,
12
+ profilesOnAccount,
10
13
  refuseLacking,
11
14
  servicesFor,
12
15
  throughWrapper
13
- } from "./chunk-FZZIU4B7.js";
16
+ } from "./chunk-GHF72SHT.js";
14
17
  import {
15
18
  servingProfiles
16
- } from "./chunk-RUKDZEID.js";
17
- import {
18
- openStore
19
- } from "./chunk-OV6PHTAY.js";
19
+ } from "./chunk-DZLHY4IA.js";
20
20
  import {
21
+ AUTHORITY_KEY,
21
22
  CEILING_KEY,
23
+ DEFAULT_PERMISSIONS,
22
24
  LOG_ATTRIBUTES,
23
25
  MESSENGER_CHANGE_REFUSAL,
24
26
  WRITE_KEYS,
@@ -33,6 +35,7 @@ import {
33
35
  keyForCommand,
34
36
  keyForWrite,
35
37
  levelFor,
38
+ limitBatch,
36
39
  logAttributes,
37
40
  permissionIssues,
38
41
  publicIssue,
@@ -42,26 +45,29 @@ import {
42
45
  rememberAccount,
43
46
  rootOf2 as rootOf,
44
47
  skipFlagFor
45
- } from "./chunk-QJ6XW4DM.js";
48
+ } from "./chunk-VVGPAHUN.js";
46
49
  import {
47
50
  isCliFailure,
48
51
  providerErrorKey
49
- } from "./chunk-MJRSEUKG.js";
52
+ } from "./chunk-VXOR76ZL.js";
53
+ import {
54
+ openStore
55
+ } from "./chunk-NVNUUHT5.js";
50
56
  import {
51
57
  CliError,
52
58
  logRecordOf,
53
59
  realSleep,
54
60
  resolvePaths,
55
61
  writeSecurely
56
- } from "./chunk-EFHLQXG6.js";
62
+ } from "./chunk-IOJ2DTCY.js";
57
63
  import {
58
64
  __name
59
65
  } from "./chunk-ZVVMGPBJ.js";
60
66
 
61
- // node_modules/.pnpm/@wirecat+cli-core@0.495.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_24cca5e5c8b0984f2f26e7d1ba6b6d47/node_modules/@wirecat/cli-core/dist/sends/guard.js
67
+ // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/sends/guard.js
62
68
  import { randomUUID } from "node:crypto";
63
69
 
64
- // node_modules/.pnpm/@wirecat+cli-core@0.495.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_24cca5e5c8b0984f2f26e7d1ba6b6d47/node_modules/@wirecat/cli-core/dist/sends/flood.js
70
+ // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/sends/flood.js
65
71
  import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
66
72
  import { dirname, join } from "node:path";
67
73
  var MOST_DEADLINES = 50;
@@ -145,11 +151,11 @@ var FloodMemory = class {
145
151
  }
146
152
  };
147
153
 
148
- // node_modules/.pnpm/@wirecat+cli-core@0.495.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_24cca5e5c8b0984f2f26e7d1ba6b6d47/node_modules/@wirecat/cli-core/dist/sends/journal.js
154
+ // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/sends/journal.js
149
155
  import { appendFileSync, mkdirSync as mkdirSync3, readFileSync as readFileSync2 } from "node:fs";
150
156
  import { dirname as dirname3, join as join2 } from "node:path";
151
157
 
152
- // node_modules/.pnpm/@wirecat+cli-core@0.495.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_24cca5e5c8b0984f2f26e7d1ba6b6d47/node_modules/@wirecat/cli-core/dist/sends/file-lock.js
158
+ // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/sends/file-lock.js
153
159
  import { closeSync, mkdirSync as mkdirSync2, openSync, statSync, unlinkSync } from "node:fs";
154
160
  import { dirname as dirname2 } from "node:path";
155
161
  var LOCK_WAIT_MS = 5e3;
@@ -216,7 +222,7 @@ var lockTime = /* @__PURE__ */ __name((lock) => {
216
222
  }
217
223
  }, "lockTime");
218
224
 
219
- // node_modules/.pnpm/@wirecat+cli-core@0.495.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_24cca5e5c8b0984f2f26e7d1ba6b6d47/node_modules/@wirecat/cli-core/dist/sends/journal.js
225
+ // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/sends/journal.js
220
226
  var sendsPathFor = /* @__PURE__ */ __name((app, profile, env = process.env) => join2(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "sends", `${profile}.jsonl`), "sendsPathFor");
221
227
  var SendJournal = class {
222
228
  static {
@@ -293,7 +299,7 @@ var withSendId = /* @__PURE__ */ __name((entry) => {
293
299
  return cid === void 0 || rest.sendId !== void 0 ? rest : { ...rest, sendId: String(cid) };
294
300
  }, "withSendId");
295
301
 
296
- // node_modules/.pnpm/@wirecat+cli-core@0.495.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_24cca5e5c8b0984f2f26e7d1ba6b6d47/node_modules/@wirecat/cli-core/dist/sends/recipients.js
302
+ // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/sends/recipients.js
297
303
  import { existsSync, readFileSync as readFileSync3, rmSync } from "node:fs";
298
304
  import { join as join3 } from "node:path";
299
305
  var recipientsPathFor = /* @__PURE__ */ __name((app, profile, env = process.env) => join3(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "profiles", `${profile}.recipients.json`), "recipientsPathFor");
@@ -405,7 +411,7 @@ var RecipientList = class {
405
411
  }
406
412
  };
407
413
 
408
- // node_modules/.pnpm/@wirecat+cli-core@0.495.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_24cca5e5c8b0984f2f26e7d1ba6b6d47/node_modules/@wirecat/cli-core/dist/sends/guard.js
414
+ // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/sends/guard.js
409
415
  var HOUR_MS = 60 * 60 * 1e3;
410
416
  var READS_UNDER_HOLD = /* @__PURE__ */ new Set([
411
417
  "attachments.extract",
@@ -598,7 +604,7 @@ var guardFor = /* @__PURE__ */ __name((app, settings, warn, env = process.env, a
598
604
  }), "guardFor");
599
605
  var journalFailure = /* @__PURE__ */ __name((error) => error?.code ?? (error instanceof Error ? error.name : "error"), "journalFailure");
600
606
 
601
- // node_modules/.pnpm/@wirecat+cli-core@0.495.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_24cca5e5c8b0984f2f26e7d1ba6b6d47/node_modules/@wirecat/cli-core/dist/cli/messenger/ask.js
607
+ // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/messenger/ask.js
602
608
  import { openSync as openSync2 } from "node:fs";
603
609
  import { createInterface } from "node:readline";
604
610
  import { ReadStream } from "node:tty";
@@ -653,7 +659,7 @@ var terminalAsker = /* @__PURE__ */ __name((command) => async (key, request) =>
653
659
  throw new CliError("cancelled", `${key}: not done \u2014 the answer was no`);
654
660
  }, "terminalAsker");
655
661
 
656
- // node_modules/.pnpm/@wirecat+cli-core@0.495.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_24cca5e5c8b0984f2f26e7d1ba6b6d47/node_modules/@wirecat/cli-core/dist/sends/pace.js
662
+ // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/sends/pace.js
657
663
  import { readFileSync as readFileSync4, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
658
664
  import { join as join4 } from "node:path";
659
665
  var DEFAULT_PACE = { perMinute: 60, burst: 20 };
@@ -712,7 +718,27 @@ var Pacer = class {
712
718
  }
713
719
  };
714
720
 
715
- // node_modules/.pnpm/@wirecat+cli-core@0.495.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_24cca5e5c8b0984f2f26e7d1ba6b6d47/node_modules/@wirecat/cli-core/dist/cli/permission-keys.js
721
+ // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/permission-keys.js
722
+ var HOUSEKEEPING = /* @__PURE__ */ new Set([
723
+ "help",
724
+ "guide",
725
+ "config",
726
+ "session",
727
+ "doctor",
728
+ "commands",
729
+ "complete",
730
+ "upgrade",
731
+ "skill",
732
+ "mcp",
733
+ "runs"
734
+ ]);
735
+ var commandPathKey = /* @__PURE__ */ __name((path) => path[0] === void 0 || HOUSEKEEPING.has(path[0]) ? null : path.join("."), "commandPathKey");
736
+ var commandPermissions = /* @__PURE__ */ __name(({ keyOf = commandPathKey, extra = [], defaults = {}, alsoChecks } = {}) => ({
737
+ keyOf,
738
+ extra: [AUTHORITY_KEY, ...extra],
739
+ defaults: { ...DEFAULT_PERMISSIONS, ...defaults },
740
+ ...alsoChecks ? { alsoChecks } : {}
741
+ }), "commandPermissions");
716
742
  var pathOf = /* @__PURE__ */ __name((command) => {
717
743
  const words = [];
718
744
  for (let at = command; at?.parent; at = at.parent)
@@ -772,7 +798,7 @@ var refuseUnknownPermissionKeys = /* @__PURE__ */ __name((command, settings, too
772
798
  throw new CliError("validation_error", `--permission ${key} names no command`, { permission: key });
773
799
  }, "refuseUnknownPermissionKeys");
774
800
 
775
- // node_modules/.pnpm/@wirecat+cli-core@0.495.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_24cca5e5c8b0984f2f26e7d1ba6b6d47/node_modules/@wirecat/cli-core/dist/cli/messenger/flooded.js
801
+ // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/messenger/flooded.js
776
802
  var LONG_LIVED = /* @__PURE__ */ new Set(["self", "newSendId", "close", "formatMarkdown", "formatHtml", "storedChats"]);
777
803
  var LISTENING = /* @__PURE__ */ new Set(["watch", "feed", "listen", "listenHistory"]);
778
804
  var BLOCKING = /* @__PURE__ */ new Set(["frozen", "limited", "banned"]);
@@ -891,7 +917,7 @@ var flooded = /* @__PURE__ */ __name((messenger, memory, { name, warn, pacer })
891
917
  });
892
918
  }, "flooded");
893
919
 
894
- // node_modules/.pnpm/@wirecat+cli-core@0.495.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_24cca5e5c8b0984f2f26e7d1ba6b6d47/node_modules/@wirecat/cli-core/dist/cli/messenger/observed.js
920
+ // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/messenger/observed.js
895
921
  var observed = /* @__PURE__ */ __name((messenger, events) => {
896
922
  const timed = /* @__PURE__ */ __name(async (operation, named, work, after) => {
897
923
  const write = currentOperation();
@@ -927,9 +953,9 @@ var observed = /* @__PURE__ */ __name((messenger, events) => {
927
953
  }, "timed");
928
954
  const counted = /* @__PURE__ */ __name(async (operation, onItem, work, count) => {
929
955
  const counts = {};
930
- await timed(operation, {}, () => work((item) => {
956
+ await timed(operation, {}, () => work((item, ...rest) => {
931
957
  count(item, counts);
932
- onItem(item);
958
+ return onItem(item, ...rest);
933
959
  }), () => ({ counts }));
934
960
  }, "counted");
935
961
  const mint = messenger.newSendId;
@@ -990,10 +1016,37 @@ var byPart = /* @__PURE__ */ __name((batch, counts) => {
990
1016
  counts[part] = (counts[part] ?? 0) + items.length;
991
1017
  }, "byPart");
992
1018
 
993
- // node_modules/.pnpm/@wirecat+cli-core@0.495.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_24cca5e5c8b0984f2f26e7d1ba6b6d47/node_modules/@wirecat/cli-core/dist/cli/messenger/stored.js
1019
+ // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/messenger/stored.js
994
1020
  var REKEY_PACING = { lockMs: 50, pauseMs: 25 };
995
- var stored = /* @__PURE__ */ __name((messenger, { account, store, warn, events, pending, announcing, deletedWithoutChat, profile, rekeyed, rekeyPacing = REKEY_PACING, closing, namesFromStore, recipientIds, countsUnread = false }) => {
1021
+ var stored = /* @__PURE__ */ __name((messenger, { account, store, warn, events, pending, announcing, deletedWithoutChat, profile, rekeyed, rekeyPacing = REKEY_PACING, closing, namesFromStore, recipientIds, countsUnread = false, historyLimits, command = "cli" }) => {
996
1022
  let warned = false;
1023
+ let limitedNoted = false;
1024
+ const limited = /* @__PURE__ */ __name(async (opened, batch) => {
1025
+ if (!historyLimits || !batch.messages?.length)
1026
+ return { batch, skipped: /* @__PURE__ */ new Map() };
1027
+ const shapes = await opened.chats.historyShapes(account, [...new Set(batch.messages.map((one) => one.chatId))]);
1028
+ return limitBatch(batch, (chatId) => shapes.get(chatId), (chatId) => shapes.get(chatId)?.included === true, historyLimits);
1029
+ }, "limited");
1030
+ const noteLimited = /* @__PURE__ */ __name((skipped) => {
1031
+ if (skipped.size === 0)
1032
+ return;
1033
+ const counts = {
1034
+ chats: skipped.size,
1035
+ messages: 0,
1036
+ group_too_large: 0,
1037
+ older_than_window: 0
1038
+ };
1039
+ for (const skip of skipped.values()) {
1040
+ counts.messages = (counts.messages ?? 0) + skip.messages;
1041
+ counts[skip.reason] = (counts[skip.reason] ?? 0) + 1;
1042
+ }
1043
+ const warning = { event: "warning", code: "history_limited", operation: "history.save", counts };
1044
+ events(warning);
1045
+ if (limitedNoted)
1046
+ return;
1047
+ limitedNoted = true;
1048
+ warn(`history limits left out ${counts.messages} pushed messages of ${skipped.size} chats (big groups, older than the window) \u2014 \`${command} store status\` lists them; \`${command} messages sync <chat> --full-history\` fetches one and keeps it in full`, warning);
1049
+ }, "noteLimited");
997
1050
  let recorded = profile === void 0;
998
1051
  const notWritten = /* @__PURE__ */ __name((operation, error) => {
999
1052
  const warning = { event: "warning", code: "store_not_written", operation };
@@ -1005,15 +1058,18 @@ var stored = /* @__PURE__ */ __name((messenger, { account, store, warn, events,
1005
1058
  const attempt = /* @__PURE__ */ __name(async (operation, write) => {
1006
1059
  try {
1007
1060
  const opened = await store();
1008
- if (opened)
1009
- await write(opened);
1061
+ if (!opened)
1062
+ return false;
1063
+ await write(opened);
1010
1064
  if (opened && !recorded && profile) {
1011
1065
  recorded = true;
1012
1066
  await Promise.resolve().then(() => opened.accounts.saveProfile(profile.app, profile.name, account)).catch(() => {
1013
1067
  });
1014
1068
  }
1069
+ return true;
1015
1070
  } catch (error) {
1016
1071
  notWritten(operation, error);
1072
+ return false;
1017
1073
  }
1018
1074
  }, "attempt");
1019
1075
  const save = /* @__PURE__ */ __name((operation, writing) => {
@@ -1111,7 +1167,13 @@ var stored = /* @__PURE__ */ __name((messenger, { account, store, warn, events,
1111
1167
  rekeysQueued += rekeys.length;
1112
1168
  const saving = previous.then(async () => {
1113
1169
  await saveRekeys(rekeys, round);
1114
- await attempt(operation, (opened) => fill(opened, account, batch));
1170
+ return attempt(operation, async (opened) => {
1171
+ const { batch: kept, skipped } = await limited(opened, batch);
1172
+ await fill(opened, account, kept);
1173
+ if (skipped.size > 0)
1174
+ await opened.chats.recordHistorySkips(account, skipped);
1175
+ noteLimited(skipped);
1176
+ });
1115
1177
  });
1116
1178
  previous = saving;
1117
1179
  pending?.add(saving);
@@ -1121,10 +1183,11 @@ var stored = /* @__PURE__ */ __name((messenger, { account, store, warn, events,
1121
1183
  pending?.delete(saving);
1122
1184
  rekeysOnly.delete(saving);
1123
1185
  });
1124
- onBatch(batch);
1186
+ void onBatch(batch, saving);
1187
+ return saving;
1125
1188
  };
1126
1189
  }, "saveBatches");
1127
- return throughWrapper(messenger, {
1190
+ const wrapped = throughWrapper(messenger, {
1128
1191
  ...messenger.forumState ? {
1129
1192
  forumState: /* @__PURE__ */ __name(async (chatId) => {
1130
1193
  const state = await capability(messenger, "forumState", "read forum settings")(chatId);
@@ -1345,7 +1408,54 @@ var stored = /* @__PURE__ */ __name((messenger, { account, store, warn, events,
1345
1408
  return sent;
1346
1409
  }, "send")
1347
1410
  });
1411
+ const chatOf2 = /* @__PURE__ */ __name(async (typed) => {
1412
+ const named = chatReferenceOf(typed, account.provider);
1413
+ if (!named)
1414
+ return typed;
1415
+ let known;
1416
+ try {
1417
+ known = account.account;
1418
+ } catch {
1419
+ }
1420
+ await ensureAccount(named, { account: known, ...profile ? { profile: profile.name } : {} }, async (other) => {
1421
+ const opened = await store();
1422
+ return opened && profilesOnAccount(opened, profile?.app, account.provider)(other);
1423
+ });
1424
+ return named.chat;
1425
+ }, "chatOf");
1426
+ return withChatReferences(wrapped, chatOf2);
1348
1427
  }, "stored");
1428
+ var TYPED_CHAT = [
1429
+ "resolve",
1430
+ "chat",
1431
+ "history",
1432
+ "around",
1433
+ "historyAfter",
1434
+ "historyBefore",
1435
+ "historyFrom",
1436
+ "topics",
1437
+ "topic",
1438
+ "topicHistory",
1439
+ "download",
1440
+ "transcribe",
1441
+ "scheduled",
1442
+ "admins",
1443
+ "chatEvents",
1444
+ "leave",
1445
+ "group",
1446
+ "officialChatStats"
1447
+ ];
1448
+ var withChatReferences = /* @__PURE__ */ __name((adapter, chatOf2) => {
1449
+ const methods = adapter;
1450
+ const own = Object.fromEntries(TYPED_CHAT.flatMap((name) => {
1451
+ const method = methods[name];
1452
+ if (typeof method !== "function")
1453
+ return [];
1454
+ const call = /* @__PURE__ */ __name(async (typed, ...rest) => method.call(adapter, await chatOf2(typed), ...rest), "call");
1455
+ return [[name, call]];
1456
+ }));
1457
+ return throughWrapper(adapter, own);
1458
+ }, "withChatReferences");
1349
1459
  var saveSent = /* @__PURE__ */ __name((opened, account, typed, message, options, into = message.chatId || typed) => opened.messages.saveMessages(account, into, [message], { ...options, typedChatId: typed }), "saveSent");
1350
1460
  var storedChat = /* @__PURE__ */ __name(async (store, account, traits, reference) => {
1351
1461
  const bound = store.forAccount(account);
@@ -1482,7 +1592,7 @@ var keep = /* @__PURE__ */ __name(async (store, account, event, seenAt, among, c
1482
1592
  }
1483
1593
  }, "keep");
1484
1594
 
1485
- // node_modules/.pnpm/@wirecat+cli-core@0.495.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_24cca5e5c8b0984f2f26e7d1ba6b6d47/node_modules/@wirecat/cli-core/dist/cli/messenger/context.js
1595
+ // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/messenger/context.js
1486
1596
  var lazyStore = /* @__PURE__ */ __name((env, command, version) => {
1487
1597
  let opened;
1488
1598
  return {
@@ -1660,7 +1770,8 @@ var connected = /* @__PURE__ */ __name((connection, { app, provider, name, delet
1660
1770
  rekeyed: /* @__PURE__ */ __name((from, to) => rekeyRecipients(app, settings.profile, env, renderer.warn, from, to), "rekeyed"),
1661
1771
  recipientIds: /* @__PURE__ */ __name(() => (new RecipientList(recipientsPathFor(app, settings.profile, env), app.command).read() ?? []).flatMap((recipient) => [recipient.id, ...recipient.partnerId ? [recipient.partnerId] : []]), "recipientIds"),
1662
1772
  ...history === "store" ? { namesFromStore: savedChatId ? { savedChatId } : {} } : {},
1663
- ...unreadCounts === "store" ? { countsUnread: true } : {}
1773
+ ...unreadCounts === "store" ? { countsUnread: true } : {},
1774
+ ...history === "store" && settings.historyLimits ? { historyLimits: settings.historyLimits, command: `${app.command} ${settings.profile}` } : {}
1664
1775
  });
1665
1776
  const passives = history === "store" && self !== null && !watching ? passivesOf(saving).map((passive) => listened(passive, events, renderer.warn, closeWaitMs)) : [];
1666
1777
  return {
@@ -1822,6 +1933,7 @@ var messengerContext = /* @__PURE__ */ __name((command, messenger, resolving = {
1822
1933
  // Turning recording off by name (--no-record, or record: false) keeps no search history either.
1823
1934
  history: base.settings.record,
1824
1935
  searchCatchUp: base.settings.searchCatchUp,
1936
+ ...base.settings.historyLimits ? { historyLimits: base.settings.historyLimits } : {},
1825
1937
  pictures: base.settings.pictureSearch,
1826
1938
  reranker: base.settings.searchReranker,
1827
1939
  guard,
@@ -1889,6 +2001,7 @@ export {
1889
2001
  levelRefusal,
1890
2002
  sendGuard,
1891
2003
  guardFor,
2004
+ commandPermissions,
1892
2005
  knownPermissionKeys,
1893
2006
  knownBeside,
1894
2007
  unknownPermissionIssues,
@@ -2,12 +2,12 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  CliError
5
- } from "./chunk-EFHLQXG6.js";
5
+ } from "./chunk-IOJ2DTCY.js";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-ZVVMGPBJ.js";
9
9
 
10
- // node_modules/.pnpm/@wirecat+cli-core@0.495.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_24cca5e5c8b0984f2f26e7d1ba6b6d47/node_modules/@wirecat/cli-core/dist/models/types.js
10
+ // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/models/types.js
11
11
  var MAX_MODEL_IMAGE_BYTES = 4 * 1024 * 1024;
12
12
  var validateImages = /* @__PURE__ */ __name((images) => {
13
13
  if (images === void 0)
@@ -2,7 +2,7 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  CliError
5
- } from "./chunk-EFHLQXG6.js";
5
+ } from "./chunk-IOJ2DTCY.js";
6
6
  import {
7
7
  importFrom
8
8
  } from "./chunk-Y5E2WNWB.js";
@@ -10,7 +10,7 @@ import {
10
10
  __name
11
11
  } from "./chunk-ZVVMGPBJ.js";
12
12
 
13
- // node_modules/.pnpm/@wirecat+cli-core@0.495.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_24cca5e5c8b0984f2f26e7d1ba6b6d47/node_modules/@wirecat/cli-core/dist/store/vector-extension.js
13
+ // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/store/vector-extension.js
14
14
  import { readFileSync } from "node:fs";
15
15
  var musl = /* @__PURE__ */ __name(() => {
16
16
  if (process.platform !== "linux")
@@ -2,14 +2,14 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  answeredWire
5
- } from "./chunk-IN3FVRPK.js";
5
+ } from "./chunk-VS5LGSTM.js";
6
6
  import {
7
7
  CALLER_META_KEY,
8
8
  PROXY_CLIENT_NAME,
9
9
  StdioServerTransport,
10
10
  callerOf,
11
11
  serveStdio
12
- } from "./chunk-IBBN7Z3A.js";
12
+ } from "./chunk-F34HGYWF.js";
13
13
  import {
14
14
  McpServer
15
15
  } from "./chunk-5D4AEUVA.js";
@@ -17,7 +17,7 @@ import {
17
17
  __name
18
18
  } from "./chunk-ZVVMGPBJ.js";
19
19
 
20
- // node_modules/.pnpm/@wirecat+cli-core@0.495.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_24cca5e5c8b0984f2f26e7d1ba6b6d47/node_modules/@wirecat/cli-core/dist/mcp/all-profiles.js
20
+ // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/mcp/all-profiles.js
21
21
  import { spawn } from "node:child_process";
22
22
  import { randomUUID } from "node:crypto";
23
23
  var PROTOCOL = "2025-06-18";
@@ -251,7 +251,7 @@ var serveAllProfilesOverStdio = /* @__PURE__ */ __name(async (options, io = {})
251
251
  }, "serveAllProfilesOverStdio");
252
252
  var serveAllProfilesOverHttp = /* @__PURE__ */ __name(async (options, http) => {
253
253
  const { build, close } = allProfilesServer(options);
254
- const { serveOverHttp } = await import("./serve-WWLRNDT2.js");
254
+ const { serveOverHttp } = await import("./serve-PJWSOV7F.js");
255
255
  const listening = await serveOverHttp(build, {
256
256
  ...http,
257
257
  appName: options.command,
@@ -3,28 +3,28 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  installerOf,
5
5
  updateCommand
6
- } from "./chunk-E42W72PQ.js";
7
- import {
8
- DEFAULT_STEMMERS,
9
- LANGUAGES
10
- } from "./chunk-PBN4RBHS.js";
6
+ } from "./chunk-AS2PJNQ2.js";
11
7
  import {
12
8
  QUESTIONS,
13
9
  readSetupAnswers,
14
10
  unanswered,
15
11
  writeSetupAnswers
16
- } from "./chunk-O3UXNU3S.js";
12
+ } from "./chunk-U6QD3J3F.js";
13
+ import {
14
+ DEFAULT_STEMMERS,
15
+ LANGUAGES
16
+ } from "./chunk-R2JKPHH5.js";
17
17
  import {
18
18
  sharedConfigPath
19
- } from "./chunk-FDBINRWA.js";
19
+ } from "./chunk-TJJ2XSJP.js";
20
20
  import {
21
21
  storePath
22
- } from "./chunk-IDWW4TU2.js";
22
+ } from "./chunk-62JRF2JA.js";
23
23
  import {
24
24
  __name
25
25
  } from "./chunk-ZVVMGPBJ.js";
26
26
 
27
- // node_modules/.pnpm/@wirecat+cli-core@0.495.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_24cca5e5c8b0984f2f26e7d1ba6b6d47/node_modules/@wirecat/cli-core/dist/cli/first-run.js
27
+ // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/cli/first-run.js
28
28
  import { spawnSync } from "node:child_process";
29
29
  import { accessSync, constants, realpathSync } from "node:fs";
30
30
  import { delimiter, join } from "node:path";
@@ -82,7 +82,7 @@ var suggested = /* @__PURE__ */ __name((env, contentLanguages) => {
82
82
  return (own.length ? own : LANGUAGES.filter(({ code }) => code === "en" || code === system)).map(({ name }) => name);
83
83
  }, "suggested");
84
84
  var askLanguages = /* @__PURE__ */ __name(async ({ command, env, io, contentLanguages }) => {
85
- const { openStore } = await import("./store-AH6WZMCF.js");
85
+ const { openStore } = await import("./store-6JQCLPQF.js");
86
86
  const store = await openStore({ env });
87
87
  let rebuild = false;
88
88
  try {
@@ -111,8 +111,8 @@ var askLanguages = /* @__PURE__ */ __name(async ({ command, env, io, contentLang
111
111
  if (!rebuild)
112
112
  return;
113
113
  const [{ openCache }, { buildStems }] = await Promise.all([
114
- import("./open-BR47R5UE.js"),
115
- import("./store-maintenance-command-PBXX3IEV.js")
114
+ import("./open-46WZAPJ3.js"),
115
+ import("./store-maintenance-command-ND4ADMGC.js")
116
116
  ]);
117
117
  const database = await openCache(storePath(env));
118
118
  try {
@@ -124,7 +124,7 @@ var askLanguages = /* @__PURE__ */ __name(async ({ command, env, io, contentLang
124
124
  var askTools = /* @__PURE__ */ __name(async (run) => {
125
125
  const { command, env, io } = run;
126
126
  const installed = run.installed ?? ((name) => onPath(name, env));
127
- const { WIRECAT_TOOLS } = await import("./first-screen-X5IJKBSU.js");
127
+ const { WIRECAT_TOOLS } = await import("./first-screen-B2CF2CET.js");
128
128
  const others = WIRECAT_TOOLS.filter((tool) => tool.command !== command);
129
129
  const missing = others.filter((tool) => !installed(tool.command));
130
130
  io.say("Other WireCat tools \u2014 they share this store, so one search finds everything:");
@@ -197,7 +197,7 @@ var setupAtStart = /* @__PURE__ */ __name(async (start) => {
197
197
  contentLanguages: start.contentLanguages,
198
198
  all: start.path[0] === "setup",
199
199
  io: {
200
- ask: /* @__PURE__ */ __name(async (prompt) => (await import("./prompt-NE5JJ7UP.js")).readSecret(prompt, { input, echo: true }), "ask"),
200
+ ask: /* @__PURE__ */ __name(async (prompt) => (await import("./prompt-IVEYRLS5.js")).readSecret(prompt, { input, echo: true }), "ask"),
201
201
  say: /* @__PURE__ */ __name((text) => process.stderr.write(`${text}
202
202
  `), "say")
203
203
  }
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-core@0.495.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_24cca5e5c8b0984f2f26e7d1ba6b6d47/node_modules/@wirecat/cli-core/dist/http/listen.js
7
+ // node_modules/.pnpm/@wirecat+cli-core@0.584.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_ab8c0b68b8b4768d5b87d6e249ef10da/node_modules/@wirecat/cli-core/dist/http/listen.js
8
8
  import { createServer } from "node:http";
9
9
  import { Readable } from "node:stream";
10
10
  var MAX_BODY = 4 * 1024 * 1024;