@wirecat/tg-cli 0.112.0 → 0.114.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 (108) hide show
  1. package/dist/bin/tg.js +6 -2
  2. package/dist/bundle/{adapter-ILDV2YSZ.js → adapter-YAEHX3QB.js} +45 -45
  3. package/dist/bundle/{all-profiles-4SH2Q4WV.js → all-profiles-R5CW42HQ.js} +8 -8
  4. package/dist/bundle/{anthropic-64SM23YO.js → anthropic-F25RHYV2.js} +5 -5
  5. package/dist/bundle/{app-server-SSYZWCDJ.js → app-server-FAG6FNXR.js} +43 -42
  6. package/dist/bundle/{bot-api-OHAGQMES.js → bot-api-KOIAXTQR.js} +46 -46
  7. package/dist/bundle/{bot-history-AUFO7UL2.js → bot-history-PRAOZEWC.js} +16 -15
  8. package/dist/bundle/{bun-AHZX63TR.js → bun-XIMM6EHD.js} +2 -2
  9. package/dist/bundle/{bun-sqlite-KBIIODPV.js → bun-sqlite-DSUCO4TR.js} +4 -4
  10. package/dist/bundle/{chunk-JYOQMYNJ.js → chunk-2PAKHXIV.js} +31 -30
  11. package/dist/bundle/{chunk-KLNQXUDX.js → chunk-34USFPBF.js} +20 -18
  12. package/dist/bundle/{chunk-QMJGHSGN.js → chunk-3EZ43DAF.js} +3 -3
  13. package/dist/bundle/{chunk-NKACHGB2.js → chunk-3R43O3GG.js} +74 -15
  14. package/dist/bundle/{chunk-KYYAHIG2.js → chunk-4JOKO4IW.js} +6992 -5870
  15. package/dist/bundle/{chunk-XSYJKEA5.js → chunk-5HKMEXVQ.js} +35 -35
  16. package/dist/bundle/{chunk-NQKPXVLX.js → chunk-6SPLZI5P.js} +2 -2
  17. package/dist/bundle/{chunk-BIERCQVG.js → chunk-7FOT4XD2.js} +2232 -922
  18. package/dist/bundle/{chunk-4JXZKMXV.js → chunk-AL36NHO6.js} +5122 -949
  19. package/dist/bundle/{chunk-4IDJ7QCG.js → chunk-ALHKUQDZ.js} +4 -4
  20. package/dist/bundle/{chunk-2IGZLBTE.js → chunk-C34IDOA5.js} +2 -2
  21. package/dist/bundle/{chunk-KGYPSBTI.js → chunk-C7K7AP6G.js} +81 -33
  22. package/dist/bundle/{chunk-PDVSMGWO.js → chunk-CDCBFMEI.js} +2 -2
  23. package/dist/bundle/{chunk-TOBJGMMA.js → chunk-CS5DQ6KM.js} +15 -14
  24. package/dist/bundle/{chunk-DNYGJAEP.js → chunk-DQQEN3X4.js} +4 -4
  25. package/dist/bundle/{chunk-SC2DUQAK.js → chunk-E2IRSRTB.js} +1 -1
  26. package/dist/bundle/{chunk-QL4WBCL5.js → chunk-EARO464A.js} +13 -7
  27. package/dist/bundle/{chunk-5BNYW5RA.js → chunk-EQJG44KE.js} +4 -4
  28. package/dist/bundle/{chunk-WWKXTKCE.js → chunk-HA35XN2Z.js} +6 -4
  29. package/dist/bundle/{chunk-EO7PQE3J.js → chunk-I6BKSGZQ.js} +364 -178
  30. package/dist/bundle/{chunk-TUJEJ4D5.js → chunk-IN25CJ3D.js} +13 -13
  31. package/dist/bundle/{chunk-MCXVGHL6.js → chunk-J5U2HKGZ.js} +41 -28
  32. package/dist/bundle/{chunk-3GL4AOOG.js → chunk-KIZT2MI6.js} +1 -1
  33. package/dist/bundle/{chunk-3AJO4GER.js → chunk-KZQXOZFC.js} +5 -5
  34. package/dist/bundle/chunk-L4CMCC3V.js +34 -0
  35. package/dist/bundle/{chunk-COTC7HF3.js → chunk-LPUFOWL3.js} +1 -1
  36. package/dist/bundle/{chunk-ICEJKOKO.js → chunk-M3IWROIF.js} +7 -7
  37. package/dist/bundle/{chunk-K7VOCHVS.js → chunk-MQTTVQ3V.js} +6 -6
  38. package/dist/bundle/{chunk-D5JP2YWG.js → chunk-NJ2I4KFZ.js} +2 -2
  39. package/dist/bundle/{chunk-PXUHQO66.js → chunk-NKP3RUM4.js} +11 -11
  40. package/dist/bundle/{chunk-WI2S6INJ.js → chunk-NMVFFWF2.js} +6 -6
  41. package/dist/bundle/{chunk-GW7JRFTF.js → chunk-NTF34HJP.js} +3 -3
  42. package/dist/bundle/{chunk-EPAOLRUL.js → chunk-NUVBC3LJ.js} +8 -3
  43. package/dist/bundle/{chunk-7MFJFVUN.js → chunk-O7CBGHI7.js} +1 -1
  44. package/dist/bundle/{chunk-5W72OARG.js → chunk-OFDMD3YF.js} +8 -8
  45. package/dist/bundle/{chunk-RANORATG.js → chunk-OWHF6BON.js} +4 -4
  46. package/dist/bundle/{chunk-UXCWUEN7.js → chunk-P4YBABUC.js} +5 -40
  47. package/dist/bundle/{chunk-RPNRCFEE.js → chunk-QCXYJKPF.js} +2 -2
  48. package/dist/bundle/{chunk-6KGENDPF.js → chunk-RBC7JQ4Y.js} +2 -2
  49. package/dist/bundle/{chunk-GM44UNGL.js → chunk-RFRI2HFT.js} +1 -1
  50. package/dist/bundle/{chunk-UQOSZ2XX.js → chunk-TKNCJMYN.js} +1467 -707
  51. package/dist/bundle/{chunk-RHYMEHYK.js → chunk-TRRRRGMI.js} +2 -2
  52. package/dist/bundle/{chunk-UVRD447S.js → chunk-TTTDZOBW.js} +3 -3
  53. package/dist/bundle/{chunk-E4EJ2UTT.js → chunk-ULFTCR5W.js} +2 -2
  54. package/dist/bundle/{chunk-JPRYFDOJ.js → chunk-VHO66SMY.js} +174 -45
  55. package/dist/bundle/{chunk-GSGS62LX.js → chunk-VVKEWWSO.js} +1 -1
  56. package/dist/bundle/{chunk-JIGYVVWA.js → chunk-WIRDTH3J.js} +121 -31
  57. package/dist/bundle/{chunk-BTAET4U3.js → chunk-WOQGUIXE.js} +1 -1
  58. package/dist/bundle/{chunk-3W7BU2BL.js → chunk-XDOPONC3.js} +8 -13
  59. package/dist/bundle/{chunk-DFUTZGEV.js → chunk-Y3AQHPAJ.js} +1 -1
  60. package/dist/bundle/{chunk-JLB5LEXJ.js → chunk-Y4LCSCSH.js} +3 -3
  61. package/dist/bundle/{chunk-RC7EBLHM.js → chunk-YPABTT7A.js} +8 -8
  62. package/dist/bundle/{chunk-JXTYTAWE.js → chunk-YQ64ZNLD.js} +14 -13
  63. package/dist/bundle/{chunk-SFJFBIYP.js → chunk-ZFMOPKPT.js} +2 -2
  64. package/dist/bundle/command-contract-SOTDPG22.js +31 -0
  65. package/dist/bundle/{decode-FR3QHHJI.js → decode-7U4SXPAN.js} +4 -4
  66. package/dist/bundle/{echarts-VTV4C2OS.js → echarts-GKEZEAL7.js} +2 -2
  67. package/dist/bundle/{embed-US7X5P5D.js → embed-IDZDQMSW.js} +5 -5
  68. package/dist/bundle/{embedder-63Z7ZBYG.js → embedder-RY5R2PGO.js} +8 -8
  69. package/dist/bundle/{entry-B4J7IAG3.js → entry-P6YZ3ZV6.js} +8 -5
  70. package/dist/bundle/{first-run-MXPPUGII.js → first-run-66KTCVQK.js} +9 -9
  71. package/dist/bundle/first-screen-NY46X6QU.js +29 -0
  72. package/dist/bundle/{identity-AQWKU7SM.js → identity-GXVKGCNU.js} +3 -3
  73. package/dist/bundle/{instructions-GBR6DJTK.js → instructions-P5E34PQR.js} +1 -1
  74. package/dist/bundle/{mcp-YJEQYYTR.js → mcp-FUSDPAOL.js} +2 -2
  75. package/dist/bundle/{node-QXGPMDH2.js → node-GKPRXS5Y.js} +2 -2
  76. package/dist/bundle/{node-sqlite-L6CAMXQ2.js → node-sqlite-VUXFVPJ6.js} +10 -4
  77. package/dist/bundle/{oauth-5RK6J4SG.js → oauth-7SQIPMOY.js} +6 -6
  78. package/dist/bundle/{open-A3IAG7U6.js → open-W3BN2SIO.js} +4 -3
  79. package/dist/bundle/{openai-YKNGCHVV.js → openai-LQTK3ZMC.js} +13 -13
  80. package/dist/bundle/{process-CGLNXFIU.js → process-U2P5Z6UF.js} +1 -1
  81. package/dist/bundle/{program-AEDR6R5P.js → program-DIPSLR6O.js} +48 -48
  82. package/dist/bundle/{prompt-65CSCL2T.js → prompt-GESHKSM5.js} +4 -4
  83. package/dist/bundle/{proxy-transport-U3QOYMQF.js → proxy-transport-C2EUUT32.js} +4 -4
  84. package/dist/bundle/{recognize-ECRO6CFK.js → recognize-FEQTIJET.js} +3 -3
  85. package/dist/bundle/{remote-6IEFZFGO.js → remote-UXOPBPKS.js} +6 -6
  86. package/dist/bundle/{rerank-23GXWT2V.js → rerank-L4JM4REK.js} +6 -6
  87. package/dist/bundle/{serve-S65YTPZN.js → serve-DDWW44DB.js} +10 -9
  88. package/dist/bundle/{server-MVTBK7GV.js → server-UTWBIZHB.js} +32 -32
  89. package/dist/bundle/server-ZI7WDAW6.js +56 -0
  90. package/dist/bundle/{state-TH3UVQAW.js → state-EV7FGEK4.js} +5 -5
  91. package/dist/bundle/{store-2WFTUSNG.js → store-EXBUF4OG.js} +11 -10
  92. package/dist/bundle/store-maintenance-command-UBZE2Z6T.js +46 -0
  93. package/dist/bundle/tg.js +4 -4
  94. package/dist/commands/context.d.ts.map +1 -1
  95. package/dist/commands/context.js +6 -4
  96. package/dist/commands/context.js.map +1 -1
  97. package/dist/reasons.d.ts.map +1 -1
  98. package/dist/reasons.js +5 -0
  99. package/dist/reasons.js.map +1 -1
  100. package/dist/version.d.ts +1 -1
  101. package/dist/version.js +1 -1
  102. package/package.json +3 -3
  103. package/dist/bundle/chunk-B3Y2KZRS.js +0 -3588
  104. package/dist/bundle/command-contract-4KVJJZ46.js +0 -32
  105. package/dist/bundle/first-screen-GFYHUBBD.js +0 -30
  106. package/dist/bundle/server-IH24WEAC.js +0 -56
  107. package/dist/bundle/store-maintenance-command-PUOU2CL6.js +0 -45
  108. /package/dist/bundle/{chunk-WJWLHLQ7.js → chunk-NUN6OGOV.js} +0 -0
@@ -4,13 +4,16 @@ 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-KYYAHIG2.js";
16
+ } from "./chunk-4JOKO4IW.js";
14
17
  import {
15
18
  CEILING_KEY,
16
19
  LOG_ATTRIBUTES,
@@ -26,6 +29,7 @@ import {
26
29
  keyForCommand,
27
30
  keyForWrite,
28
31
  levelFor,
32
+ limitBatch,
29
33
  logAttributes,
30
34
  permissionIssues,
31
35
  publicIssue,
@@ -34,35 +38,35 @@ import {
34
38
  rememberAccount,
35
39
  rootOf2 as rootOf,
36
40
  skipFlagFor
37
- } from "./chunk-4JXZKMXV.js";
41
+ } from "./chunk-AL36NHO6.js";
38
42
  import {
39
43
  isCliFailure,
40
44
  providerErrorKey
41
- } from "./chunk-RC7EBLHM.js";
45
+ } from "./chunk-YPABTT7A.js";
42
46
  import {
43
47
  MESSENGER_CHANGE_REFUSAL,
44
48
  readOnlyRefusal
45
- } from "./chunk-2IGZLBTE.js";
49
+ } from "./chunk-C34IDOA5.js";
46
50
  import {
47
51
  servingProfiles
48
- } from "./chunk-GW7JRFTF.js";
52
+ } from "./chunk-NTF34HJP.js";
49
53
  import {
50
54
  openStore
51
- } from "./chunk-BIERCQVG.js";
55
+ } from "./chunk-7FOT4XD2.js";
52
56
  import {
53
57
  logRecordOf,
54
58
  realSleep,
55
59
  resolvePaths,
56
60
  writeSecurely
57
- } from "./chunk-KLNQXUDX.js";
61
+ } from "./chunk-34USFPBF.js";
58
62
  import {
59
63
  CliError
60
- } from "./chunk-QL4WBCL5.js";
64
+ } from "./chunk-EARO464A.js";
61
65
  import {
62
66
  __name
63
67
  } from "./chunk-ZVVMGPBJ.js";
64
68
 
65
- // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/cli/messenger/ask.js
69
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/cli/messenger/ask.js
66
70
  import { openSync } from "node:fs";
67
71
  import { createInterface } from "node:readline";
68
72
  import { ReadStream } from "node:tty";
@@ -117,10 +121,10 @@ var terminalAsker = /* @__PURE__ */ __name((command) => async (key, request) =>
117
121
  throw new CliError("cancelled", `${key}: not done \u2014 the answer was no`);
118
122
  }, "terminalAsker");
119
123
 
120
- // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/sends/guard.js
124
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/sends/guard.js
121
125
  import { randomUUID } from "node:crypto";
122
126
 
123
- // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/sends/flood.js
127
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/sends/flood.js
124
128
  import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
125
129
  import { dirname, join } from "node:path";
126
130
  var MOST_DEADLINES = 50;
@@ -204,11 +208,11 @@ var FloodMemory = class {
204
208
  }
205
209
  };
206
210
 
207
- // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/sends/journal.js
211
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/sends/journal.js
208
212
  import { appendFileSync, mkdirSync as mkdirSync3, readFileSync as readFileSync2 } from "node:fs";
209
213
  import { dirname as dirname3, join as join2 } from "node:path";
210
214
 
211
- // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/sends/file-lock.js
215
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/sends/file-lock.js
212
216
  import { closeSync, mkdirSync as mkdirSync2, openSync as openSync2, statSync, unlinkSync } from "node:fs";
213
217
  import { dirname as dirname2 } from "node:path";
214
218
  var LOCK_WAIT_MS = 5e3;
@@ -275,7 +279,7 @@ var lockTime = /* @__PURE__ */ __name((lock) => {
275
279
  }
276
280
  }, "lockTime");
277
281
 
278
- // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/sends/journal.js
282
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/sends/journal.js
279
283
  var sendsPathFor = /* @__PURE__ */ __name((app, profile, env = process.env) => join2(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "sends", `${profile}.jsonl`), "sendsPathFor");
280
284
  var SendJournal = class {
281
285
  static {
@@ -352,7 +356,7 @@ var withSendId = /* @__PURE__ */ __name((entry) => {
352
356
  return cid === void 0 || rest.sendId !== void 0 ? rest : { ...rest, sendId: String(cid) };
353
357
  }, "withSendId");
354
358
 
355
- // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/sends/recipients.js
359
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/sends/recipients.js
356
360
  import { existsSync, readFileSync as readFileSync3, rmSync } from "node:fs";
357
361
  import { join as join3 } from "node:path";
358
362
  var recipientsPathFor = /* @__PURE__ */ __name((app, profile, env = process.env) => join3(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "profiles", `${profile}.recipients.json`), "recipientsPathFor");
@@ -464,7 +468,7 @@ var RecipientList = class {
464
468
  }
465
469
  };
466
470
 
467
- // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/sends/guard.js
471
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/sends/guard.js
468
472
  var HOUR_MS = 60 * 60 * 1e3;
469
473
  var READS_UNDER_HOLD = /* @__PURE__ */ new Set([
470
474
  "attachments.extract",
@@ -657,7 +661,7 @@ var guardFor = /* @__PURE__ */ __name((app, settings, warn, env = process.env, a
657
661
  }), "guardFor");
658
662
  var journalFailure = /* @__PURE__ */ __name((error) => error?.code ?? (error instanceof Error ? error.name : "error"), "journalFailure");
659
663
 
660
- // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/sends/pace.js
664
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/sends/pace.js
661
665
  import { readFileSync as readFileSync4, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
662
666
  import { join as join4 } from "node:path";
663
667
  var DEFAULT_PACE = { perMinute: 60, burst: 20 };
@@ -716,7 +720,7 @@ var Pacer = class {
716
720
  }
717
721
  };
718
722
 
719
- // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/cli/permission-keys.js
723
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/cli/permission-keys.js
720
724
  var pathOf = /* @__PURE__ */ __name((command) => {
721
725
  const words = [];
722
726
  for (let at = command; at?.parent; at = at.parent)
@@ -776,7 +780,7 @@ var refuseUnknownPermissionKeys = /* @__PURE__ */ __name((command, settings, too
776
780
  throw new CliError("validation_error", `--permission ${key} names no command`, { permission: key });
777
781
  }, "refuseUnknownPermissionKeys");
778
782
 
779
- // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/cli/messenger/flooded.js
783
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/cli/messenger/flooded.js
780
784
  var LONG_LIVED = /* @__PURE__ */ new Set(["self", "newSendId", "close", "formatMarkdown", "formatHtml", "storedChats"]);
781
785
  var LISTENING = /* @__PURE__ */ new Set(["watch", "feed", "listen", "listenHistory"]);
782
786
  var BLOCKING = /* @__PURE__ */ new Set(["frozen", "limited", "banned"]);
@@ -895,7 +899,7 @@ var flooded = /* @__PURE__ */ __name((messenger, memory, { name, warn, pacer })
895
899
  });
896
900
  }, "flooded");
897
901
 
898
- // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/cli/messenger/observed.js
902
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/cli/messenger/observed.js
899
903
  var observed = /* @__PURE__ */ __name((messenger, events) => {
900
904
  const timed = /* @__PURE__ */ __name(async (operation, named, work, after) => {
901
905
  const write = currentOperation();
@@ -931,9 +935,9 @@ var observed = /* @__PURE__ */ __name((messenger, events) => {
931
935
  }, "timed");
932
936
  const counted = /* @__PURE__ */ __name(async (operation, onItem, work, count) => {
933
937
  const counts = {};
934
- await timed(operation, {}, () => work((item) => {
938
+ await timed(operation, {}, () => work((item, ...rest) => {
935
939
  count(item, counts);
936
- onItem(item);
940
+ return onItem(item, ...rest);
937
941
  }), () => ({ counts }));
938
942
  }, "counted");
939
943
  const mint = messenger.newSendId;
@@ -994,10 +998,37 @@ var byPart = /* @__PURE__ */ __name((batch, counts) => {
994
998
  counts[part] = (counts[part] ?? 0) + items.length;
995
999
  }, "byPart");
996
1000
 
997
- // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/cli/messenger/stored.js
1001
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/cli/messenger/stored.js
998
1002
  var REKEY_PACING = { lockMs: 50, pauseMs: 25 };
999
- var stored = /* @__PURE__ */ __name((messenger, { account, store, warn, events, pending, announcing, deletedWithoutChat, profile, rekeyed, rekeyPacing = REKEY_PACING, closing, namesFromStore, recipientIds, countsUnread = false }) => {
1003
+ 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" }) => {
1000
1004
  let warned = false;
1005
+ let limitedNoted = false;
1006
+ const limited = /* @__PURE__ */ __name(async (opened, batch) => {
1007
+ if (!historyLimits || !batch.messages?.length)
1008
+ return { batch, skipped: /* @__PURE__ */ new Map() };
1009
+ const shapes = await opened.chats.historyShapes(account, [...new Set(batch.messages.map((one) => one.chatId))]);
1010
+ return limitBatch(batch, (chatId) => shapes.get(chatId), (chatId) => shapes.get(chatId)?.included === true, historyLimits);
1011
+ }, "limited");
1012
+ const noteLimited = /* @__PURE__ */ __name((skipped) => {
1013
+ if (skipped.size === 0)
1014
+ return;
1015
+ const counts = {
1016
+ chats: skipped.size,
1017
+ messages: 0,
1018
+ group_too_large: 0,
1019
+ older_than_window: 0
1020
+ };
1021
+ for (const skip of skipped.values()) {
1022
+ counts.messages = (counts.messages ?? 0) + skip.messages;
1023
+ counts[skip.reason] = (counts[skip.reason] ?? 0) + 1;
1024
+ }
1025
+ const warning = { event: "warning", code: "history_limited", operation: "history.save", counts };
1026
+ events(warning);
1027
+ if (limitedNoted)
1028
+ return;
1029
+ limitedNoted = true;
1030
+ 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);
1031
+ }, "noteLimited");
1001
1032
  let recorded = profile === void 0;
1002
1033
  const notWritten = /* @__PURE__ */ __name((operation, error) => {
1003
1034
  const warning = { event: "warning", code: "store_not_written", operation };
@@ -1009,15 +1040,18 @@ var stored = /* @__PURE__ */ __name((messenger, { account, store, warn, events,
1009
1040
  const attempt = /* @__PURE__ */ __name(async (operation, write) => {
1010
1041
  try {
1011
1042
  const opened = await store();
1012
- if (opened)
1013
- await write(opened);
1043
+ if (!opened)
1044
+ return false;
1045
+ await write(opened);
1014
1046
  if (opened && !recorded && profile) {
1015
1047
  recorded = true;
1016
1048
  await Promise.resolve().then(() => opened.accounts.saveProfile(profile.app, profile.name, account)).catch(() => {
1017
1049
  });
1018
1050
  }
1051
+ return true;
1019
1052
  } catch (error) {
1020
1053
  notWritten(operation, error);
1054
+ return false;
1021
1055
  }
1022
1056
  }, "attempt");
1023
1057
  const save = /* @__PURE__ */ __name((operation, writing) => {
@@ -1115,7 +1149,13 @@ var stored = /* @__PURE__ */ __name((messenger, { account, store, warn, events,
1115
1149
  rekeysQueued += rekeys.length;
1116
1150
  const saving = previous.then(async () => {
1117
1151
  await saveRekeys(rekeys, round);
1118
- await attempt(operation, (opened) => fill(opened, account, batch));
1152
+ return attempt(operation, async (opened) => {
1153
+ const { batch: kept, skipped } = await limited(opened, batch);
1154
+ await fill(opened, account, kept);
1155
+ if (skipped.size > 0)
1156
+ await opened.chats.recordHistorySkips(account, skipped);
1157
+ noteLimited(skipped);
1158
+ });
1119
1159
  });
1120
1160
  previous = saving;
1121
1161
  pending?.add(saving);
@@ -1125,10 +1165,11 @@ var stored = /* @__PURE__ */ __name((messenger, { account, store, warn, events,
1125
1165
  pending?.delete(saving);
1126
1166
  rekeysOnly.delete(saving);
1127
1167
  });
1128
- onBatch(batch);
1168
+ void onBatch(batch, saving);
1169
+ return saving;
1129
1170
  };
1130
1171
  }, "saveBatches");
1131
- return throughWrapper(messenger, {
1172
+ const wrapped = throughWrapper(messenger, {
1132
1173
  ...messenger.forumState ? {
1133
1174
  forumState: /* @__PURE__ */ __name(async (chatId) => {
1134
1175
  const state = await capability(messenger, "forumState", "read forum settings")(chatId);
@@ -1349,7 +1390,54 @@ var stored = /* @__PURE__ */ __name((messenger, { account, store, warn, events,
1349
1390
  return sent;
1350
1391
  }, "send")
1351
1392
  });
1393
+ const chatOf2 = /* @__PURE__ */ __name(async (typed) => {
1394
+ const named = chatReferenceOf(typed, account.provider);
1395
+ if (!named)
1396
+ return typed;
1397
+ let known;
1398
+ try {
1399
+ known = account.account;
1400
+ } catch {
1401
+ }
1402
+ await ensureAccount(named, { account: known, ...profile ? { profile: profile.name } : {} }, async (other) => {
1403
+ const opened = await store();
1404
+ return opened && profilesOnAccount(opened, profile?.app, account.provider)(other);
1405
+ });
1406
+ return named.chat;
1407
+ }, "chatOf");
1408
+ return withChatReferences(wrapped, chatOf2);
1352
1409
  }, "stored");
1410
+ var TYPED_CHAT = [
1411
+ "resolve",
1412
+ "chat",
1413
+ "history",
1414
+ "around",
1415
+ "historyAfter",
1416
+ "historyBefore",
1417
+ "historyFrom",
1418
+ "topics",
1419
+ "topic",
1420
+ "topicHistory",
1421
+ "download",
1422
+ "transcribe",
1423
+ "scheduled",
1424
+ "admins",
1425
+ "chatEvents",
1426
+ "leave",
1427
+ "group",
1428
+ "officialChatStats"
1429
+ ];
1430
+ var withChatReferences = /* @__PURE__ */ __name((adapter, chatOf2) => {
1431
+ const methods = adapter;
1432
+ const own = Object.fromEntries(TYPED_CHAT.flatMap((name) => {
1433
+ const method = methods[name];
1434
+ if (typeof method !== "function")
1435
+ return [];
1436
+ const call = /* @__PURE__ */ __name(async (typed, ...rest) => method.call(adapter, await chatOf2(typed), ...rest), "call");
1437
+ return [[name, call]];
1438
+ }));
1439
+ return throughWrapper(adapter, own);
1440
+ }, "withChatReferences");
1353
1441
  var saveSent = /* @__PURE__ */ __name((opened, account, typed, message, options, into = message.chatId || typed) => opened.messages.saveMessages(account, into, [message], { ...options, typedChatId: typed }), "saveSent");
1354
1442
  var storedChat = /* @__PURE__ */ __name(async (store, account, traits, reference) => {
1355
1443
  const bound = store.forAccount(account);
@@ -1486,7 +1574,7 @@ var keep = /* @__PURE__ */ __name(async (store, account, event, seenAt, among, c
1486
1574
  }
1487
1575
  }, "keep");
1488
1576
 
1489
- // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/cli/messenger/context.js
1577
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/cli/messenger/context.js
1490
1578
  var lazyStore = /* @__PURE__ */ __name((env, command, version) => {
1491
1579
  let opened;
1492
1580
  return {
@@ -1664,7 +1752,8 @@ var connected = /* @__PURE__ */ __name((connection, { app, provider, name, delet
1664
1752
  rekeyed: /* @__PURE__ */ __name((from, to) => rekeyRecipients(app, settings.profile, env, renderer.warn, from, to), "rekeyed"),
1665
1753
  recipientIds: /* @__PURE__ */ __name(() => (new RecipientList(recipientsPathFor(app, settings.profile, env), app.command).read() ?? []).flatMap((recipient) => [recipient.id, ...recipient.partnerId ? [recipient.partnerId] : []]), "recipientIds"),
1666
1754
  ...history === "store" ? { namesFromStore: savedChatId ? { savedChatId } : {} } : {},
1667
- ...unreadCounts === "store" ? { countsUnread: true } : {}
1755
+ ...unreadCounts === "store" ? { countsUnread: true } : {},
1756
+ ...history === "store" && settings.historyLimits ? { historyLimits: settings.historyLimits, command: `${app.command} ${settings.profile}` } : {}
1668
1757
  });
1669
1758
  const passives = history === "store" && self !== null && !watching ? passivesOf(saving).map((passive) => listened(passive, events, renderer.warn, closeWaitMs)) : [];
1670
1759
  return {
@@ -1826,6 +1915,7 @@ var messengerContext = /* @__PURE__ */ __name((command, messenger, resolving = {
1826
1915
  // Turning recording off by name (--no-record, or record: false) keeps no search history either.
1827
1916
  history: base.settings.record,
1828
1917
  searchCatchUp: base.settings.searchCatchUp,
1918
+ ...base.settings.historyLimits ? { historyLimits: base.settings.historyLimits } : {},
1829
1919
  pictures: base.settings.pictureSearch,
1830
1920
  reranker: base.settings.searchReranker,
1831
1921
  guard,
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/mcp/bot/instructions.js
7
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/mcp/bot/instructions.js
8
8
  var botInstructions = /* @__PURE__ */ __name(({ command, name, profile, writes, skill }) => [
9
9
  `The owner's ${name} bot "${profile}", through the official Bot API \u2014 not the owner's personal account. What it writes, people see as the bot.`,
10
10
  "Use these tools to read the chats this bot is in, find a message or a person, and \u2014 when the profile allows \u2014 write as the bot.",
@@ -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-L4CMCC3V.js";
3
6
  import {
4
7
  CliError
5
- } from "./chunk-QL4WBCL5.js";
8
+ } from "./chunk-EARO464A.js";
6
9
  import {
7
10
  __name
8
11
  } from "./chunk-ZVVMGPBJ.js";
9
12
 
10
- // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/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.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/sqlite-warning.js
13
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/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.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/store/open.js
34
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/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-KBIIODPV.js");
47
+ const { openWithBunSqlite } = await import("./bun-sqlite-DSUCO4TR.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-L6CAMXQ2.js");
52
+ const { openWithNodeSqlite } = await import("./node-sqlite-VUXFVPJ6.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,
@@ -4,7 +4,7 @@ import {
4
4
  __name
5
5
  } from "./chunk-ZVVMGPBJ.js";
6
6
 
7
- // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/http/listen.js
7
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/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;
@@ -2,15 +2,15 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  unit
5
- } from "./chunk-K7VOCHVS.js";
5
+ } from "./chunk-MQTTVQ3V.js";
6
6
  import {
7
7
  CliError
8
- } from "./chunk-QL4WBCL5.js";
8
+ } from "./chunk-EARO464A.js";
9
9
  import {
10
10
  __name
11
11
  } from "./chunk-ZVVMGPBJ.js";
12
12
 
13
- // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/embeddings/remote.js
13
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/embeddings/remote.js
14
14
  import { setTimeout } from "node:timers/promises";
15
15
  var OPENAI_URL = "https://api.openai.com/v1";
16
16
  var OPENAI_MODELS = {
@@ -3,19 +3,19 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  errorCodes,
5
5
  isContentKey
6
- } from "./chunk-QL4WBCL5.js";
6
+ } from "./chunk-EARO464A.js";
7
7
  import {
8
8
  __name
9
9
  } from "./chunk-ZVVMGPBJ.js";
10
10
 
11
- // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/runs/run-context.js
11
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/runs/run-context.js
12
12
  import { AsyncLocalStorage } from "node:async_hooks";
13
13
  import { createHash } from "node:crypto";
14
14
 
15
- // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/runs/error-detail.js
15
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/runs/error-detail.js
16
16
  import { homedir } from "node:os";
17
17
 
18
- // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/errors/failures.js
18
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/errors/failures.js
19
19
  var isCliFailure = /* @__PURE__ */ __name((value) => value instanceof Error && value.name === "CliError" && errorCodes.includes(value.code), "isCliFailure");
20
20
  var isCommanderFailure = /* @__PURE__ */ __name((value) => {
21
21
  const { code, exitCode } = value ?? {};
@@ -23,7 +23,7 @@ var isCommanderFailure = /* @__PURE__ */ __name((value) => {
23
23
  }, "isCommanderFailure");
24
24
  var failureKey = /* @__PURE__ */ __name((error) => isCliFailure(error) ? error.code : error instanceof Error ? error.name : "error", "failureKey");
25
25
 
26
- // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/runs/events.js
26
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/runs/events.js
27
27
  var providerErrorKey = /* @__PURE__ */ __name((value) => typeof value === "string" && /^[A-Za-z][A-Za-z0-9._-]{0,63}$/.test(value) ? value : void 0, "providerErrorKey");
28
28
  var renderEvent = /* @__PURE__ */ __name((event) => {
29
29
  if (event.event === "warning") {
@@ -71,7 +71,7 @@ var MARK = { request: "\u2192", response: "\u2190", cache: "\u2022", warning: "!
71
71
  var age = /* @__PURE__ */ __name((ms) => ms < 1e3 ? `${ms}ms` : `${Math.round(ms / 1e3)}s`, "age");
72
72
  var size = /* @__PURE__ */ __name((bytes) => bytes < 1e3 ? `${bytes} B` : `${(bytes / 1e3).toFixed(1)} kB`, "size");
73
73
 
74
- // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/runs/secrets.js
74
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/runs/secrets.js
75
75
  var SECRET_WORDS = /* @__PURE__ */ new Set([
76
76
  "authorization",
77
77
  "cookie",
@@ -152,7 +152,7 @@ var withoutSecrets = /* @__PURE__ */ __name((text, mark = "[redacted]") => text.
152
152
  var RUN = /(?<![A-Za-z0-9_+/-])[A-Za-z0-9_+/-]{20,}/g;
153
153
  var HEX = /(?<![A-Za-z0-9])(?=[0-9]*[a-f])[0-9a-f]{20,}(?![A-Za-z0-9])/g;
154
154
 
155
- // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/runs/error-detail.js
155
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/runs/error-detail.js
156
156
  var MESSAGE_AT_MOST = 500;
157
157
  var CAUSES_AT_MOST = 5;
158
158
  var FRAMES_AT_MOST = 15;
@@ -261,7 +261,7 @@ var redactText = /* @__PURE__ */ __name((text) => {
261
261
  return out.length > MESSAGE_AT_MOST ? `${out.slice(0, MESSAGE_AT_MOST)}\u2026` : out;
262
262
  }, "redactText");
263
263
 
264
- // node_modules/.pnpm/@wirecat+cli-core@0.531.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.71.0_commander@15._cfa5eacb532b7a1817693c3848e83d75/node_modules/@wirecat/cli-core/dist/runs/run-context.js
264
+ // node_modules/.pnpm/@wirecat+cli-core@0.553.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.75.0_commander@15._c8fb11a0c49a39da33a9d557d170ff7b/node_modules/@wirecat/cli-core/dist/runs/run-context.js
265
265
  var REDACTED = "[redacted]";
266
266
  var keepsSuccess = /* @__PURE__ */ __name(({ record, fromFlag, env, caller, persistent = false }) => {
267
267
  if (!record)
@@ -13,40 +13,40 @@ import {
13
13
  privateFiles,
14
14
  providerRequest,
15
15
  withSqliteSidecars
16
- } from "./chunk-UQOSZ2XX.js";
16
+ } from "./chunk-TKNCJMYN.js";
17
17
  import {
18
18
  parseProxy,
19
19
  proxyAddress,
20
20
  proxyError,
21
21
  proxyLabel,
22
22
  proxySetting
23
- } from "./chunk-SC2DUQAK.js";
23
+ } from "./chunk-E2IRSRTB.js";
24
24
  import {
25
25
  messengerContext
26
- } from "./chunk-JIGYVVWA.js";
26
+ } from "./chunk-WIRDTH3J.js";
27
27
  import {
28
28
  uploadBlob
29
- } from "./chunk-KYYAHIG2.js";
29
+ } from "./chunk-4JOKO4IW.js";
30
30
  import {
31
31
  asFirstWord,
32
32
  currentAttempt,
33
33
  environmentOf,
34
34
  fromFile,
35
35
  settingsFor
36
- } from "./chunk-4JXZKMXV.js";
36
+ } from "./chunk-AL36NHO6.js";
37
37
  import {
38
38
  TG
39
- } from "./chunk-EPAOLRUL.js";
39
+ } from "./chunk-NUVBC3LJ.js";
40
40
  import {
41
41
  Credentials,
42
42
  pathsAreOverridden,
43
43
  resolvePaths
44
- } from "./chunk-KLNQXUDX.js";
44
+ } from "./chunk-34USFPBF.js";
45
45
  import {
46
46
  CliError,
47
47
  isCliError,
48
48
  optional
49
- } from "./chunk-QL4WBCL5.js";
49
+ } from "./chunk-EARO464A.js";
50
50
  import {
51
51
  importFrom
52
52
  } from "./chunk-Y5E2WNWB.js";
@@ -174,11 +174,12 @@ var telegramOf = /* @__PURE__ */ __name((command, base) => {
174
174
  const resolved = given ?? credentials.read();
175
175
  if (!resolved) {
176
176
  const loggedIn = existsSync(sessionPath);
177
- const unreachable = loggedIn && command.name() === "serve" ? "provider_unavailable" : "authentication_error";
178
- throw new CliError(unreachable, loggedIn ? `no Telegram app credentials found for profile "${profile}", although it has logged in on this machine \u2014 the keyring is probably out of reach (cron, ssh, an MCP client that trims the environment: set XDG_RUNTIME_DIR); \`tg ${asFirstWord(profile)}doctor\` shows it. Log in again only if they were removed` : `no Telegram app credentials for profile "${profile}" \u2014 run ${setup} in a local terminal first, or sign in from ${desktop}; agents: read \`tg skill show\``);
177
+ const background = command.name() === "serve" || base.env.TG_SCHEDULED !== void 0;
178
+ const temporary = loggedIn && background;
179
+ throw new CliError(temporary ? "provider_unavailable" : "authentication_error", loggedIn ? `no Telegram app credentials found for profile "${profile}", although it has logged in on this machine \u2014 the keyring is probably out of reach (cron, ssh, an MCP client that trims the environment: set XDG_RUNTIME_DIR); \`tg ${asFirstWord(profile)}doctor\` shows it. Log in again only if they were removed` : `no Telegram app credentials for profile "${profile}" \u2014 run ${setup} in a local terminal first, or sign in from ${desktop}; agents: read \`tg skill show\``, temporary ? { reason: "credentials.unreachable" } : {});
179
180
  }
180
181
  const options = { credentials: resolved, sessionPath, ...connecting };
181
- return environment.adapter ? await environment.adapter(options) : await (await import("./adapter-ILDV2YSZ.js")).TelegramAdapter.open({
182
+ return environment.adapter ? await environment.adapter(options) : await (await import("./adapter-YAEHX3QB.js")).TelegramAdapter.open({
182
183
  ...options,
183
184
  ...proxyOption(proxy()),
184
185
  diagnostic: /* @__PURE__ */ __name((line) => base.streams.diagnostic(line), "diagnostic"),
@@ -864,7 +865,7 @@ var TELEGRAM_BOT = {
864
865
  const botId = token.split(":", 1)[0] ?? "";
865
866
  if (!/^\d+$/.test(botId))
866
867
  throw new CliError("authentication_error", "the bot token has no valid bot id");
867
- const reader = await (environment.botHistory ?? (await import("./bot-history-AUFO7UL2.js")).openBotHistory)({
868
+ const reader = await (environment.botHistory ?? (await import("./bot-history-PRAOZEWC.js")).openBotHistory)({
868
869
  credentials,
869
870
  sessionPath: botSessionFile(profile, botId, env),
870
871
  token,
@@ -884,7 +885,7 @@ var TELEGRAM_BOT = {
884
885
  return void 0;
885
886
  let personal;
886
887
  try {
887
- personal = environment.adapter ? await environment.adapter({ credentials, sessionPath: personalPath }) : await (await import("./adapter-ILDV2YSZ.js")).TelegramAdapter.open({
888
+ personal = environment.adapter ? await environment.adapter({ credentials, sessionPath: personalPath }) : await (await import("./adapter-YAEHX3QB.js")).TelegramAdapter.open({
888
889
  credentials,
889
890
  sessionPath: personalPath,
890
891
  checks: words,
@@ -3,10 +3,10 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  proxyError,
5
5
  proxyLabel
6
- } from "./chunk-SC2DUQAK.js";
6
+ } from "./chunk-E2IRSRTB.js";
7
7
  import {
8
8
  CliError
9
- } from "./chunk-QL4WBCL5.js";
9
+ } from "./chunk-EARO464A.js";
10
10
  import {
11
11
  __name
12
12
  } from "./chunk-ZVVMGPBJ.js";
@@ -0,0 +1,31 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ SCHEMA_DIALECT,
5
+ commandContract,
6
+ commandPathOf,
7
+ findCommand,
8
+ outputOf
9
+ } from "./chunk-P4YBABUC.js";
10
+ import "./chunk-AL36NHO6.js";
11
+ import "./chunk-5HKMEXVQ.js";
12
+ import "./chunk-YPABTT7A.js";
13
+ import "./chunk-TTTDZOBW.js";
14
+ import "./chunk-C34IDOA5.js";
15
+ import "./chunk-KIZT2MI6.js";
16
+ import "./chunk-HA35XN2Z.js";
17
+ import "./chunk-I6BKSGZQ.js";
18
+ import "./chunk-NMVFFWF2.js";
19
+ import "./chunk-NUN6OGOV.js";
20
+ import "./chunk-TRRRRGMI.js";
21
+ import "./chunk-34USFPBF.js";
22
+ import "./chunk-EARO464A.js";
23
+ import "./chunk-Y5E2WNWB.js";
24
+ import "./chunk-ZVVMGPBJ.js";
25
+ export {
26
+ SCHEMA_DIALECT,
27
+ commandContract,
28
+ commandPathOf,
29
+ findCommand,
30
+ outputOf
31
+ };