@wirecat/cli-template 0.13.2 → 0.14.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 (112) 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 +25 -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-B6BCKXR7.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-4PA6DJ7F.js} +7 -7
  19. package/dist/bundle/{chunk-FZZIU4B7.js → chunk-5SAF3XOL.js} +8196 -5601
  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-MFS52LTZ.js → chunk-7Z4HR6GO.js} +1 -1
  25. package/dist/bundle/{chunk-E42W72PQ.js → chunk-AS2PJNQ2.js} +7 -5
  26. package/dist/bundle/{chunk-SVDF6NJF.js → chunk-ASHVHS52.js} +14 -14
  27. package/dist/bundle/{chunk-N2Z3MCOF.js → chunk-BEBD27QT.js} +37 -35
  28. package/dist/bundle/{chunk-IGHEW777.js → chunk-BM5ZCDPQ.js} +5 -40
  29. package/dist/bundle/{chunk-AK257OMS.js → chunk-BVLPNNEL.js} +209 -78
  30. package/dist/bundle/{chunk-ERKR3VJ5.js → chunk-BWBZCYUN.js} +141 -46
  31. package/dist/bundle/{chunk-Z7MSIRSQ.js → chunk-CGFQT3LQ.js} +1 -1
  32. package/dist/bundle/{chunk-QKWRL4OD.js → chunk-DQIBGCF3.js} +6 -6
  33. package/dist/bundle/{chunk-RUKDZEID.js → chunk-DZLHY4IA.js} +3 -3
  34. package/dist/bundle/{chunk-TAYOKLGF.js → chunk-EMHCXXNJ.js} +7 -6
  35. package/dist/bundle/{chunk-IBBN7Z3A.js → chunk-F34HGYWF.js} +12 -3
  36. package/dist/bundle/{chunk-ERGB4NJA.js → chunk-G45R7M42.js} +1 -1
  37. package/dist/bundle/{chunk-ZLY6GUAS.js → chunk-G7W53MQP.js} +3 -3
  38. package/dist/bundle/{chunk-JAOGZMKQ.js → chunk-GUFPQZUA.js} +2 -2
  39. package/dist/bundle/{chunk-4LURWBVV.js → chunk-HYTHTSJP.js} +188 -22
  40. package/dist/bundle/{chunk-EFHLQXG6.js → chunk-IOJ2DTCY.js} +162 -55
  41. package/dist/bundle/{chunk-L5WWMP5M.js → chunk-IZKXJJ7V.js} +121 -31
  42. package/dist/bundle/{chunk-NOVLCHDV.js → chunk-LATYBJ4T.js} +2 -2
  43. package/dist/bundle/{chunk-QBP7OMN5.js → chunk-LFLSV353.js} +2 -2
  44. package/dist/bundle/{chunk-HDY5X3WQ.js → chunk-LU4A2T7Y.js} +4 -4
  45. package/dist/bundle/{chunk-JRK73FOW.js → chunk-NENYWEXF.js} +1 -1
  46. package/dist/bundle/{chunk-2B5U4Z5H.js → chunk-NH6LZ3H3.js} +8 -13
  47. package/dist/bundle/{chunk-OV6PHTAY.js → chunk-NVNUUHT5.js} +17130 -2232
  48. package/dist/bundle/chunk-PIJUGF5F.js +392 -0
  49. package/dist/bundle/{chunk-7IXL4UFK.js → chunk-PX2KP4QE.js} +8 -8
  50. package/dist/bundle/{chunk-KRCCGWWS.js → chunk-QXOSPYM3.js} +1 -1
  51. package/dist/bundle/{chunk-PBN4RBHS.js → chunk-R2JKPHH5.js} +8 -8
  52. package/dist/bundle/{chunk-PDGXMKJS.js → chunk-R5RYPD23.js} +2 -2
  53. package/dist/bundle/{chunk-QJ6XW4DM.js → chunk-RJ7AS7UB.js} +6210 -1207
  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-YJNUDHJD.js → chunk-UT5TQ6MD.js} +139 -35
  58. package/dist/bundle/{chunk-VYSUKHKL.js → chunk-VOTEB3AN.js} +1 -1
  59. package/dist/bundle/{chunk-IN3FVRPK.js → chunk-VS5LGSTM.js} +1 -1
  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-JMVMT5HT.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-MDD4SIUK.js} +8 -8
  70. package/dist/bundle/first-screen-376CXGXJ.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-KHUZOJO6.js +82 -0
  74. package/dist/bundle/{mcp-GBSAK3VW.js → mcp-MZHWJXAE.js} +38 -37
  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-B3CY3FP7.js} +11346 -9559
  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-2ZN7KZHZ.js +40 -0
  88. package/dist/bundle/server-5VYM7CCF.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-7XICIYHW.js +42 -0
  92. package/dist/version.d.ts +1 -1
  93. package/dist/version.js +1 -1
  94. package/docs/commands.md +37 -11
  95. package/docs/dev/reference-clis.md +1 -1
  96. package/docs/dev/skills/design-interview/SKILL.md +2 -2
  97. package/docs/dev/test-matrix.md +5 -1
  98. package/kit/dist/interview.js +1 -0
  99. package/kit/dist/new.js +8 -3
  100. package/package.json +3 -3
  101. package/src/program.test.ts +56 -0
  102. package/src/version.ts +1 -1
  103. package/dist/bundle/chunk-IDWW4TU2.js +0 -18
  104. package/dist/bundle/chunk-MUSYGFCY.js +0 -3556
  105. package/dist/bundle/chunk-O5EHUB2V.js +0 -2
  106. package/dist/bundle/command-contract-75VJ36U4.js +0 -29
  107. package/dist/bundle/first-screen-X5IJKBSU.js +0 -27
  108. package/dist/bundle/mcp-RDZGYPSY.js +0 -78
  109. package/dist/bundle/server-DE6NLNUF.js +0 -52
  110. package/dist/bundle/server-ZPSQKOAH.js +0 -39
  111. package/dist/bundle/store-maintenance-command-PBXX3IEV.js +0 -40
  112. /package/dist/bundle/{chunk-GOO67PDU.js → chunk-NL2DQPT7.js} +0 -0
@@ -4,19 +4,19 @@ 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-5SAF3XOL.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
21
  CEILING_KEY,
22
22
  LOG_ATTRIBUTES,
@@ -33,6 +33,7 @@ import {
33
33
  keyForCommand,
34
34
  keyForWrite,
35
35
  levelFor,
36
+ limitBatch,
36
37
  logAttributes,
37
38
  permissionIssues,
38
39
  publicIssue,
@@ -42,26 +43,29 @@ import {
42
43
  rememberAccount,
43
44
  rootOf2 as rootOf,
44
45
  skipFlagFor
45
- } from "./chunk-QJ6XW4DM.js";
46
+ } from "./chunk-RJ7AS7UB.js";
46
47
  import {
47
48
  isCliFailure,
48
49
  providerErrorKey
49
- } from "./chunk-MJRSEUKG.js";
50
+ } from "./chunk-VXOR76ZL.js";
51
+ import {
52
+ openStore
53
+ } from "./chunk-NVNUUHT5.js";
50
54
  import {
51
55
  CliError,
52
56
  logRecordOf,
53
57
  realSleep,
54
58
  resolvePaths,
55
59
  writeSecurely
56
- } from "./chunk-EFHLQXG6.js";
60
+ } from "./chunk-IOJ2DTCY.js";
57
61
  import {
58
62
  __name
59
63
  } from "./chunk-ZVVMGPBJ.js";
60
64
 
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
65
+ // 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
66
  import { randomUUID } from "node:crypto";
63
67
 
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
68
+ // 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
69
  import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
66
70
  import { dirname, join } from "node:path";
67
71
  var MOST_DEADLINES = 50;
@@ -145,11 +149,11 @@ var FloodMemory = class {
145
149
  }
146
150
  };
147
151
 
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
152
+ // 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
153
  import { appendFileSync, mkdirSync as mkdirSync3, readFileSync as readFileSync2 } from "node:fs";
150
154
  import { dirname as dirname3, join as join2 } from "node:path";
151
155
 
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
156
+ // 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
157
  import { closeSync, mkdirSync as mkdirSync2, openSync, statSync, unlinkSync } from "node:fs";
154
158
  import { dirname as dirname2 } from "node:path";
155
159
  var LOCK_WAIT_MS = 5e3;
@@ -216,7 +220,7 @@ var lockTime = /* @__PURE__ */ __name((lock) => {
216
220
  }
217
221
  }, "lockTime");
218
222
 
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
223
+ // 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
224
  var sendsPathFor = /* @__PURE__ */ __name((app, profile, env = process.env) => join2(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "sends", `${profile}.jsonl`), "sendsPathFor");
221
225
  var SendJournal = class {
222
226
  static {
@@ -293,7 +297,7 @@ var withSendId = /* @__PURE__ */ __name((entry) => {
293
297
  return cid === void 0 || rest.sendId !== void 0 ? rest : { ...rest, sendId: String(cid) };
294
298
  }, "withSendId");
295
299
 
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
300
+ // 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
301
  import { existsSync, readFileSync as readFileSync3, rmSync } from "node:fs";
298
302
  import { join as join3 } from "node:path";
299
303
  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 +409,7 @@ var RecipientList = class {
405
409
  }
406
410
  };
407
411
 
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
412
+ // 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
413
  var HOUR_MS = 60 * 60 * 1e3;
410
414
  var READS_UNDER_HOLD = /* @__PURE__ */ new Set([
411
415
  "attachments.extract",
@@ -598,7 +602,7 @@ var guardFor = /* @__PURE__ */ __name((app, settings, warn, env = process.env, a
598
602
  }), "guardFor");
599
603
  var journalFailure = /* @__PURE__ */ __name((error) => error?.code ?? (error instanceof Error ? error.name : "error"), "journalFailure");
600
604
 
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
605
+ // 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
606
  import { openSync as openSync2 } from "node:fs";
603
607
  import { createInterface } from "node:readline";
604
608
  import { ReadStream } from "node:tty";
@@ -653,7 +657,7 @@ var terminalAsker = /* @__PURE__ */ __name((command) => async (key, request) =>
653
657
  throw new CliError("cancelled", `${key}: not done \u2014 the answer was no`);
654
658
  }, "terminalAsker");
655
659
 
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
660
+ // 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
661
  import { readFileSync as readFileSync4, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
658
662
  import { join as join4 } from "node:path";
659
663
  var DEFAULT_PACE = { perMinute: 60, burst: 20 };
@@ -712,7 +716,7 @@ var Pacer = class {
712
716
  }
713
717
  };
714
718
 
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
719
+ // 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
716
720
  var pathOf = /* @__PURE__ */ __name((command) => {
717
721
  const words = [];
718
722
  for (let at = command; at?.parent; at = at.parent)
@@ -772,7 +776,7 @@ var refuseUnknownPermissionKeys = /* @__PURE__ */ __name((command, settings, too
772
776
  throw new CliError("validation_error", `--permission ${key} names no command`, { permission: key });
773
777
  }, "refuseUnknownPermissionKeys");
774
778
 
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
779
+ // 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
780
  var LONG_LIVED = /* @__PURE__ */ new Set(["self", "newSendId", "close", "formatMarkdown", "formatHtml", "storedChats"]);
777
781
  var LISTENING = /* @__PURE__ */ new Set(["watch", "feed", "listen", "listenHistory"]);
778
782
  var BLOCKING = /* @__PURE__ */ new Set(["frozen", "limited", "banned"]);
@@ -891,7 +895,7 @@ var flooded = /* @__PURE__ */ __name((messenger, memory, { name, warn, pacer })
891
895
  });
892
896
  }, "flooded");
893
897
 
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
898
+ // 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
899
  var observed = /* @__PURE__ */ __name((messenger, events) => {
896
900
  const timed = /* @__PURE__ */ __name(async (operation, named, work, after) => {
897
901
  const write = currentOperation();
@@ -927,9 +931,9 @@ var observed = /* @__PURE__ */ __name((messenger, events) => {
927
931
  }, "timed");
928
932
  const counted = /* @__PURE__ */ __name(async (operation, onItem, work, count) => {
929
933
  const counts = {};
930
- await timed(operation, {}, () => work((item) => {
934
+ await timed(operation, {}, () => work((item, ...rest) => {
931
935
  count(item, counts);
932
- onItem(item);
936
+ return onItem(item, ...rest);
933
937
  }), () => ({ counts }));
934
938
  }, "counted");
935
939
  const mint = messenger.newSendId;
@@ -990,10 +994,37 @@ var byPart = /* @__PURE__ */ __name((batch, counts) => {
990
994
  counts[part] = (counts[part] ?? 0) + items.length;
991
995
  }, "byPart");
992
996
 
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
997
+ // 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
998
  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 }) => {
999
+ 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
1000
  let warned = false;
1001
+ let limitedNoted = false;
1002
+ const limited = /* @__PURE__ */ __name(async (opened, batch) => {
1003
+ if (!historyLimits || !batch.messages?.length)
1004
+ return { batch, skipped: /* @__PURE__ */ new Map() };
1005
+ const shapes = await opened.chats.historyShapes(account, [...new Set(batch.messages.map((one) => one.chatId))]);
1006
+ return limitBatch(batch, (chatId) => shapes.get(chatId), (chatId) => shapes.get(chatId)?.included === true, historyLimits);
1007
+ }, "limited");
1008
+ const noteLimited = /* @__PURE__ */ __name((skipped) => {
1009
+ if (skipped.size === 0)
1010
+ return;
1011
+ const counts = {
1012
+ chats: skipped.size,
1013
+ messages: 0,
1014
+ group_too_large: 0,
1015
+ older_than_window: 0
1016
+ };
1017
+ for (const skip of skipped.values()) {
1018
+ counts.messages = (counts.messages ?? 0) + skip.messages;
1019
+ counts[skip.reason] = (counts[skip.reason] ?? 0) + 1;
1020
+ }
1021
+ const warning = { event: "warning", code: "history_limited", operation: "history.save", counts };
1022
+ events(warning);
1023
+ if (limitedNoted)
1024
+ return;
1025
+ limitedNoted = true;
1026
+ 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);
1027
+ }, "noteLimited");
997
1028
  let recorded = profile === void 0;
998
1029
  const notWritten = /* @__PURE__ */ __name((operation, error) => {
999
1030
  const warning = { event: "warning", code: "store_not_written", operation };
@@ -1005,15 +1036,18 @@ var stored = /* @__PURE__ */ __name((messenger, { account, store, warn, events,
1005
1036
  const attempt = /* @__PURE__ */ __name(async (operation, write) => {
1006
1037
  try {
1007
1038
  const opened = await store();
1008
- if (opened)
1009
- await write(opened);
1039
+ if (!opened)
1040
+ return false;
1041
+ await write(opened);
1010
1042
  if (opened && !recorded && profile) {
1011
1043
  recorded = true;
1012
1044
  await Promise.resolve().then(() => opened.accounts.saveProfile(profile.app, profile.name, account)).catch(() => {
1013
1045
  });
1014
1046
  }
1047
+ return true;
1015
1048
  } catch (error) {
1016
1049
  notWritten(operation, error);
1050
+ return false;
1017
1051
  }
1018
1052
  }, "attempt");
1019
1053
  const save = /* @__PURE__ */ __name((operation, writing) => {
@@ -1111,7 +1145,13 @@ var stored = /* @__PURE__ */ __name((messenger, { account, store, warn, events,
1111
1145
  rekeysQueued += rekeys.length;
1112
1146
  const saving = previous.then(async () => {
1113
1147
  await saveRekeys(rekeys, round);
1114
- await attempt(operation, (opened) => fill(opened, account, batch));
1148
+ return attempt(operation, async (opened) => {
1149
+ const { batch: kept, skipped } = await limited(opened, batch);
1150
+ await fill(opened, account, kept);
1151
+ if (skipped.size > 0)
1152
+ await opened.chats.recordHistorySkips(account, skipped);
1153
+ noteLimited(skipped);
1154
+ });
1115
1155
  });
1116
1156
  previous = saving;
1117
1157
  pending?.add(saving);
@@ -1121,10 +1161,11 @@ var stored = /* @__PURE__ */ __name((messenger, { account, store, warn, events,
1121
1161
  pending?.delete(saving);
1122
1162
  rekeysOnly.delete(saving);
1123
1163
  });
1124
- onBatch(batch);
1164
+ void onBatch(batch, saving);
1165
+ return saving;
1125
1166
  };
1126
1167
  }, "saveBatches");
1127
- return throughWrapper(messenger, {
1168
+ const wrapped = throughWrapper(messenger, {
1128
1169
  ...messenger.forumState ? {
1129
1170
  forumState: /* @__PURE__ */ __name(async (chatId) => {
1130
1171
  const state = await capability(messenger, "forumState", "read forum settings")(chatId);
@@ -1345,7 +1386,54 @@ var stored = /* @__PURE__ */ __name((messenger, { account, store, warn, events,
1345
1386
  return sent;
1346
1387
  }, "send")
1347
1388
  });
1389
+ const chatOf2 = /* @__PURE__ */ __name(async (typed) => {
1390
+ const named = chatReferenceOf(typed, account.provider);
1391
+ if (!named)
1392
+ return typed;
1393
+ let known;
1394
+ try {
1395
+ known = account.account;
1396
+ } catch {
1397
+ }
1398
+ await ensureAccount(named, { account: known, ...profile ? { profile: profile.name } : {} }, async (other) => {
1399
+ const opened = await store();
1400
+ return opened && profilesOnAccount(opened, profile?.app, account.provider)(other);
1401
+ });
1402
+ return named.chat;
1403
+ }, "chatOf");
1404
+ return withChatReferences(wrapped, chatOf2);
1348
1405
  }, "stored");
1406
+ var TYPED_CHAT = [
1407
+ "resolve",
1408
+ "chat",
1409
+ "history",
1410
+ "around",
1411
+ "historyAfter",
1412
+ "historyBefore",
1413
+ "historyFrom",
1414
+ "topics",
1415
+ "topic",
1416
+ "topicHistory",
1417
+ "download",
1418
+ "transcribe",
1419
+ "scheduled",
1420
+ "admins",
1421
+ "chatEvents",
1422
+ "leave",
1423
+ "group",
1424
+ "officialChatStats"
1425
+ ];
1426
+ var withChatReferences = /* @__PURE__ */ __name((adapter, chatOf2) => {
1427
+ const methods = adapter;
1428
+ const own = Object.fromEntries(TYPED_CHAT.flatMap((name) => {
1429
+ const method = methods[name];
1430
+ if (typeof method !== "function")
1431
+ return [];
1432
+ const call = /* @__PURE__ */ __name(async (typed, ...rest) => method.call(adapter, await chatOf2(typed), ...rest), "call");
1433
+ return [[name, call]];
1434
+ }));
1435
+ return throughWrapper(adapter, own);
1436
+ }, "withChatReferences");
1349
1437
  var saveSent = /* @__PURE__ */ __name((opened, account, typed, message, options, into = message.chatId || typed) => opened.messages.saveMessages(account, into, [message], { ...options, typedChatId: typed }), "saveSent");
1350
1438
  var storedChat = /* @__PURE__ */ __name(async (store, account, traits, reference) => {
1351
1439
  const bound = store.forAccount(account);
@@ -1482,7 +1570,7 @@ var keep = /* @__PURE__ */ __name(async (store, account, event, seenAt, among, c
1482
1570
  }
1483
1571
  }, "keep");
1484
1572
 
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
1573
+ // 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
1574
  var lazyStore = /* @__PURE__ */ __name((env, command, version) => {
1487
1575
  let opened;
1488
1576
  return {
@@ -1660,7 +1748,8 @@ var connected = /* @__PURE__ */ __name((connection, { app, provider, name, delet
1660
1748
  rekeyed: /* @__PURE__ */ __name((from, to) => rekeyRecipients(app, settings.profile, env, renderer.warn, from, to), "rekeyed"),
1661
1749
  recipientIds: /* @__PURE__ */ __name(() => (new RecipientList(recipientsPathFor(app, settings.profile, env), app.command).read() ?? []).flatMap((recipient) => [recipient.id, ...recipient.partnerId ? [recipient.partnerId] : []]), "recipientIds"),
1662
1750
  ...history === "store" ? { namesFromStore: savedChatId ? { savedChatId } : {} } : {},
1663
- ...unreadCounts === "store" ? { countsUnread: true } : {}
1751
+ ...unreadCounts === "store" ? { countsUnread: true } : {},
1752
+ ...history === "store" && settings.historyLimits ? { historyLimits: settings.historyLimits, command: `${app.command} ${settings.profile}` } : {}
1664
1753
  });
1665
1754
  const passives = history === "store" && self !== null && !watching ? passivesOf(saving).map((passive) => listened(passive, events, renderer.warn, closeWaitMs)) : [];
1666
1755
  return {
@@ -1822,6 +1911,7 @@ var messengerContext = /* @__PURE__ */ __name((command, messenger, resolving = {
1822
1911
  // Turning recording off by name (--no-record, or record: false) keeps no search history either.
1823
1912
  history: base.settings.record,
1824
1913
  searchCatchUp: base.settings.searchCatchUp,
1914
+ ...base.settings.historyLimits ? { historyLimits: base.settings.historyLimits } : {},
1825
1915
  pictures: base.settings.pictureSearch,
1826
1916
  reranker: base.settings.searchReranker,
1827
1917
  guard,
@@ -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,
@@ -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;
@@ -1,20 +1,16 @@
1
1
  import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ PRAGMAS
5
+ } from "./chunk-3MDNAYQA.js";
3
6
  import {
4
7
  CliError
5
- } from "./chunk-EFHLQXG6.js";
8
+ } from "./chunk-IOJ2DTCY.js";
6
9
  import {
7
10
  __name
8
11
  } from "./chunk-ZVVMGPBJ.js";
9
12
 
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/store/driver.js
11
- var PRAGMAS = `
12
- PRAGMA busy_timeout = 5000;
13
- PRAGMA journal_mode = WAL;
14
- PRAGMA foreign_keys = ON;
15
- `;
16
-
17
- // 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/sqlite-warning.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/sqlite-warning.js
18
14
  var SQLITE_WARNING = "SQLite is an experimental feature";
19
15
  var quieted = /* @__PURE__ */ new WeakSet();
20
16
  var quietSqliteWarning = /* @__PURE__ */ __name((host = process) => {
@@ -35,7 +31,7 @@ var isSqliteWarning = /* @__PURE__ */ __name((warning, options) => {
35
31
  return name === "ExperimentalWarning" && message.startsWith(SQLITE_WARNING);
36
32
  }, "isSqliteWarning");
37
33
 
38
- // 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/open.js
34
+ // 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/open.js
39
35
  var openCache = /* @__PURE__ */ __name(async (path) => {
40
36
  const database = await openFile(path);
41
37
  try {
@@ -48,12 +44,12 @@ var openCache = /* @__PURE__ */ __name(async (path) => {
48
44
  }, "openCache");
49
45
  var openFile = /* @__PURE__ */ __name((path) => "Bun" in globalThis ? openUnderBun(path) : openUnderNode(path), "openFile");
50
46
  var openUnderBun = /* @__PURE__ */ __name(async (path) => {
51
- const { openWithBunSqlite } = await import("./bun-sqlite-KBXOW2ES.js");
47
+ const { openWithBunSqlite } = await import("./bun-sqlite-JE6FJFQT.js");
52
48
  return await openWithBunSqlite(path);
53
49
  }, "openUnderBun");
54
50
  var openUnderNode = /* @__PURE__ */ __name(async (path) => {
55
51
  quietSqliteWarning();
56
- const { openWithNodeSqlite } = await import("./node-sqlite-BR7F3BLB.js");
52
+ const { openWithNodeSqlite } = await import("./node-sqlite-73Z4SFOA.js");
57
53
  return openWithNodeSqlite(path);
58
54
  }, "openUnderNode");
59
55
  var runtime = /* @__PURE__ */ __name(() => {
@@ -90,7 +86,6 @@ var storeCapable = /* @__PURE__ */ __name(() => {
90
86
  }, "storeCapable");
91
87
 
92
88
  export {
93
- PRAGMAS,
94
89
  quietSqliteWarning,
95
90
  openCache,
96
91
  openFile,