@wirecat/tg-cli 0.107.0 → 0.109.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 (102) hide show
  1. package/dist/bin/tg.js +2 -2
  2. package/dist/bundle/{adapter-PN5AXCJ7.js → adapter-6JLFYFL5.js} +45 -44
  3. package/dist/bundle/{all-profiles-SDHNKZQQ.js → all-profiles-X7Y3T5S4.js} +8 -8
  4. package/dist/bundle/{anthropic-F3BXQLYB.js → anthropic-LGVXAADT.js} +5 -5
  5. package/dist/bundle/{app-server-XDKMWVCD.js → app-server-UI3AFSJX.js} +40 -39
  6. package/dist/bundle/{bot-api-YXJL4CEV.js → bot-api-TQYRNYJQ.js} +46 -45
  7. package/dist/bundle/{bot-history-SDLHR7PV.js → bot-history-DDNTNMNB.js} +15 -15
  8. package/dist/bundle/{bun-SMH7PKUS.js → bun-WXGS6HML.js} +2 -2
  9. package/dist/bundle/{bun-sqlite-KB6PSTWH.js → bun-sqlite-M6JEXKRT.js} +4 -4
  10. package/dist/bundle/{chunk-NCWB3KXP.js → chunk-25VC6U3A.js} +1 -1
  11. package/dist/bundle/{chunk-NUVHRCUK.js → chunk-2ILQYCBY.js} +390 -291
  12. package/dist/bundle/{chunk-X7M7YZPF.js → chunk-3PEZWXKO.js} +6 -6
  13. package/dist/bundle/{chunk-YSDA3EWT.js → chunk-4R4AH6FM.js} +117 -94
  14. package/dist/bundle/{chunk-TEHAIU6I.js → chunk-5SUFMBU5.js} +44 -44
  15. package/dist/bundle/chunk-76C5SSMR.js +379 -0
  16. package/dist/bundle/{chunk-STGY3EAZ.js → chunk-7AJ2IESO.js} +1 -1
  17. package/dist/bundle/{chunk-3UEFJ75D.js → chunk-7T7ILNCU.js} +2 -2
  18. package/dist/bundle/{chunk-O7VQHFMZ.js → chunk-AD3QPYI3.js} +2 -2
  19. package/dist/bundle/{chunk-IY7IEM56.js → chunk-AGVKIJB7.js} +6 -6
  20. package/dist/bundle/{chunk-OIHAM73W.js → chunk-BESIMQ5U.js} +1 -1
  21. package/dist/bundle/{chunk-CJJVFGFX.js → chunk-BHPCZCX7.js} +2 -2
  22. package/dist/bundle/{chunk-GJS26XEB.js → chunk-BZIZLEJN.js} +4 -4
  23. package/dist/bundle/{chunk-REJM262E.js → chunk-C3RX3UOE.js} +11 -11
  24. package/dist/bundle/{chunk-WXIGT6FY.js → chunk-CH2ESVV5.js} +22 -22
  25. package/dist/bundle/{chunk-DFZBGU4G.js → chunk-CHI6D4D6.js} +4 -4
  26. package/dist/bundle/{chunk-BYDDYOF4.js → chunk-CVLDXFRP.js} +8 -8
  27. package/dist/bundle/{chunk-MFS52LTZ.js → chunk-DLAFGSTN.js} +1 -1
  28. package/dist/bundle/{chunk-P4A27ETD.js → chunk-DO33KAMM.js} +94 -59
  29. package/dist/bundle/{chunk-GGAG3G7B.js → chunk-DZVYGBZB.js} +79 -56
  30. package/dist/bundle/{chunk-WAGDZB62.js → chunk-GUFM5RLW.js} +2 -2
  31. package/dist/bundle/{chunk-LA2OUJK5.js → chunk-IGIPIO4J.js} +11 -11
  32. package/dist/bundle/{chunk-5QBTHR57.js → chunk-INYO2QFW.js} +3 -3
  33. package/dist/bundle/{chunk-VMKPRAIB.js → chunk-IULYECPC.js} +12 -12
  34. package/dist/bundle/{chunk-DBZVF73F.js → chunk-IV2QWSPG.js} +2 -2
  35. package/dist/bundle/{chunk-YA44IPCS.js → chunk-KHKC236O.js} +2 -2
  36. package/dist/bundle/{chunk-TKCZYJAT.js → chunk-M62LF3QE.js} +2140 -1648
  37. package/dist/bundle/{chunk-RGNKRI5T.js → chunk-MF6NKU3Z.js} +81 -30
  38. package/dist/bundle/{chunk-MOZX3JX3.js → chunk-N56WXUCW.js} +2 -2
  39. package/dist/bundle/{chunk-T4SDOYPY.js → chunk-N5FSRC6H.js} +117 -70
  40. package/dist/bundle/{chunk-FG2QTYEF.js → chunk-NAVNCM5K.js} +1 -1
  41. package/dist/bundle/{chunk-NMTFZNFU.js → chunk-OHLMHBDI.js} +28 -28
  42. package/dist/bundle/{chunk-P5UG655O.js → chunk-P55L4S6N.js} +3 -3
  43. package/dist/bundle/{chunk-JZOXKRDG.js → chunk-P57R2P75.js} +7 -7
  44. package/dist/bundle/{chunk-BMXGEQDA.js → chunk-P5ILJ7MN.js} +5 -5
  45. package/dist/bundle/{chunk-PYRJO6B3.js → chunk-QQF7RDLR.js} +49 -24
  46. package/dist/bundle/{chunk-TFV4UPQZ.js → chunk-RD2NLJSU.js} +16 -4
  47. package/dist/bundle/{chunk-KROO42KC.js → chunk-S7B6MTXX.js} +6 -6
  48. package/dist/bundle/{chunk-NSQL3YRD.js → chunk-SH63Q4QR.js} +22 -22
  49. package/dist/bundle/{chunk-JAWXJILO.js → chunk-TMXNMO66.js} +3 -3
  50. package/dist/bundle/{chunk-44UANKAI.js → chunk-UIPBAT2T.js} +31 -14
  51. package/dist/bundle/{chunk-53RW4KLL.js → chunk-UUQ3BH2Z.js} +2 -2
  52. package/dist/bundle/{chunk-VMU4SGCE.js → chunk-VFVMB3NV.js} +8 -6
  53. package/dist/bundle/{chunk-AWBJSYX6.js → chunk-VYR2IIWW.js} +1 -1
  54. package/dist/bundle/{chunk-53QVFV34.js → chunk-WHYS6OSG.js} +2 -2
  55. package/dist/bundle/{chunk-WS3S7DXT.js → chunk-WNTXIQMB.js} +2 -2
  56. package/dist/bundle/{chunk-P5KMLJQR.js → chunk-XJVGCCQE.js} +666 -782
  57. package/dist/bundle/{chunk-67SRVSPU.js → chunk-XMMWKHNY.js} +26 -9
  58. package/dist/bundle/{chunk-A4DS5ANQ.js → chunk-YXCQ4DLZ.js} +1 -1
  59. package/dist/bundle/{chunk-465FPHSG.js → chunk-YYOIULA2.js} +8 -8
  60. package/dist/bundle/{chunk-WFG7KFM4.js → chunk-ZFMS5G4H.js} +2 -2
  61. package/dist/bundle/{chunk-BGVODG6P.js → chunk-ZHP44EML.js} +3 -3
  62. package/dist/bundle/{chunk-6FSG6QZH.js → chunk-ZMZKZL3Y.js} +1 -1
  63. package/dist/bundle/{chunk-H4LIQVPN.js → chunk-ZUOS7QUB.js} +11 -11
  64. package/dist/bundle/command-contract-E2MWR3T3.js +32 -0
  65. package/dist/bundle/{decode-WEP3HD56.js → decode-RKPOGPBE.js} +19 -17
  66. package/dist/bundle/{echarts-MRMILSAF.js → echarts-H5QQRBHI.js} +2 -2
  67. package/dist/bundle/{embed-LCLTUVUD.js → embed-7TVAPNP7.js} +5 -5
  68. package/dist/bundle/{embedder-O4WNEXUC.js → embedder-YOOHWWN6.js} +8 -8
  69. package/dist/bundle/{entry-7HDX6BDR.js → entry-SAKW5HEZ.js} +5 -5
  70. package/dist/bundle/{first-run-M7YVVQJS.js → first-run-C744N572.js} +9 -9
  71. package/dist/bundle/first-screen-7GKUEIWS.js +30 -0
  72. package/dist/bundle/{identity-EEMHQOTN.js → identity-NRWTZIQ4.js} +3 -3
  73. package/dist/bundle/{instructions-YIH3J4TI.js → instructions-6LWRAW47.js} +1 -1
  74. package/dist/bundle/{mcp-OQBZXELQ.js → mcp-WSGVVZWI.js} +2 -2
  75. package/dist/bundle/{node-YWT7RFN6.js → node-XN4PIVWW.js} +2 -2
  76. package/dist/bundle/node-sqlite-PCBGROGQ.js +62 -0
  77. package/dist/bundle/{oauth-CADZB7TT.js → oauth-PX6NGHUV.js} +6 -6
  78. package/dist/bundle/{open-AMRU27KK.js → open-BKJGJ6GX.js} +3 -3
  79. package/dist/bundle/openai-MJP7CZXP.js +250 -0
  80. package/dist/bundle/{process-JC76J5UD.js → process-4PRR3MLT.js} +1 -1
  81. package/dist/bundle/{program-FI6MTY2V.js → program-7YZUO42B.js} +48 -47
  82. package/dist/bundle/{prompt-SPYTHKHN.js → prompt-CILSZC2R.js} +4 -4
  83. package/dist/bundle/{proxy-transport-YSBYG26I.js → proxy-transport-FWGKTYBL.js} +4 -4
  84. package/dist/bundle/{recognize-G5VVM6MU.js → recognize-AVFDJAIL.js} +5 -3
  85. package/dist/bundle/{remote-Z3HW42CH.js → remote-2VYXGOM4.js} +6 -6
  86. package/dist/bundle/{rerank-QJ5NLZUU.js → rerank-6FU2JPCD.js} +6 -6
  87. package/dist/bundle/{serve-3I4C6Y5X.js → serve-3YQOHBR6.js} +8 -8
  88. package/dist/bundle/server-S2K4YDDG.js +56 -0
  89. package/dist/bundle/{server-2L4BONHN.js → server-TPK3LNEX.js} +32 -31
  90. package/dist/bundle/{state-IXZYPH46.js → state-LLUNBLZE.js} +5 -5
  91. package/dist/bundle/{store-KS4XIA2R.js → store-27FQ743G.js} +10 -10
  92. package/dist/bundle/store-maintenance-command-AFJMKEBK.js +45 -0
  93. package/dist/bundle/tg.js +4 -4
  94. package/dist/version.d.ts +1 -1
  95. package/dist/version.js +1 -1
  96. package/package.json +3 -3
  97. package/dist/bundle/command-contract-B4DA4MXP.js +0 -32
  98. package/dist/bundle/first-screen-MXW3UZFB.js +0 -30
  99. package/dist/bundle/node-sqlite-LVHTONMA.js +0 -46
  100. package/dist/bundle/server-7TJ337SR.js +0 -55
  101. package/dist/bundle/store-maintenance-command-I3L24P22.js +0 -44
  102. /package/dist/bundle/{chunk-O5EHUB2V.js → chunk-62EDJKGP.js} +0 -0
@@ -1,5 +1,13 @@
1
1
  import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ acquireLock,
5
+ openOrdinaryFile,
6
+ readBoundedUtf8File,
7
+ sameOrdinaryFile,
8
+ syncDirectory,
9
+ writeFileAtomic
10
+ } from "./chunk-76C5SSMR.js";
3
11
  import {
4
12
  Command,
5
13
  DEFAULT_IMAGE_MODEL,
@@ -38,23 +46,23 @@ import {
38
46
  typedCommand,
39
47
  vectorModelKey,
40
48
  withAttempt
41
- } from "./chunk-GGAG3G7B.js";
49
+ } from "./chunk-DZVYGBZB.js";
42
50
  import {
43
51
  isCliFailure
44
- } from "./chunk-BYDDYOF4.js";
52
+ } from "./chunk-CVLDXFRP.js";
45
53
  import {
46
54
  isNewer,
47
55
  updateCommand
48
- } from "./chunk-VMU4SGCE.js";
56
+ } from "./chunk-VFVMB3NV.js";
49
57
  import {
50
58
  readOnlyLockOf
51
- } from "./chunk-3UEFJ75D.js";
59
+ } from "./chunk-7T7ILNCU.js";
52
60
  import {
53
61
  MAX_MODEL_IMAGE_BYTES
54
- } from "./chunk-YA44IPCS.js";
62
+ } from "./chunk-KHKC236O.js";
55
63
  import {
56
64
  remoteKey
57
- } from "./chunk-5QBTHR57.js";
65
+ } from "./chunk-INYO2QFW.js";
58
66
  import {
59
67
  Unzip,
60
68
  UnzipInflate,
@@ -65,11 +73,11 @@ import {
65
73
  placedText,
66
74
  runEmbedders,
67
75
  textModelsDirectory
68
- } from "./chunk-X7M7YZPF.js";
76
+ } from "./chunk-3PEZWXKO.js";
69
77
  import {
70
78
  installFiles,
71
79
  megabytes
72
- } from "./chunk-VMKPRAIB.js";
80
+ } from "./chunk-IULYECPC.js";
73
81
  import {
74
82
  AGENDA_COLUMNS,
75
83
  CHAT_COLUMNS,
@@ -137,7 +145,7 @@ import {
137
145
  threadConversation,
138
146
  validateAst,
139
147
  validateFields
140
- } from "./chunk-TKCZYJAT.js";
148
+ } from "./chunk-M62LF3QE.js";
141
149
  import {
142
150
  EVENT_QUERY,
143
151
  MEETING_PROJECT_EVIDENCE_QUERY,
@@ -181,27 +189,27 @@ import {
181
189
  validateQuery,
182
190
  walkQuery,
183
191
  zonedMoment
184
- } from "./chunk-P4A27ETD.js";
192
+ } from "./chunk-DO33KAMM.js";
185
193
  import {
186
194
  DEFAULT_STEMMERS,
187
195
  createStemmer,
188
196
  fold,
189
197
  normalize
190
- } from "./chunk-465FPHSG.js";
198
+ } from "./chunk-YYOIULA2.js";
191
199
  import {
192
200
  DEFAULT_TASK_CATEGORIES,
193
201
  FALLBACK_CATEGORY
194
- } from "./chunk-IY7IEM56.js";
202
+ } from "./chunk-AGVKIJB7.js";
195
203
  import {
196
204
  storePath,
197
205
  wirecatDirectory
198
- } from "./chunk-53RW4KLL.js";
206
+ } from "./chunk-UUQ3BH2Z.js";
199
207
  import {
200
208
  resolvePaths,
201
209
  singleLine,
202
210
  visibleControls,
203
211
  writeSecurely
204
- } from "./chunk-T4SDOYPY.js";
212
+ } from "./chunk-N5FSRC6H.js";
205
213
  import {
206
214
  CliError,
207
215
  array,
@@ -226,7 +234,7 @@ import {
226
234
  string,
227
235
  transform,
228
236
  unknown
229
- } from "./chunk-67SRVSPU.js";
237
+ } from "./chunk-XMMWKHNY.js";
230
238
  import {
231
239
  importFrom,
232
240
  resolveFrom
@@ -16846,7 +16854,7 @@ var require_lib3 = __commonJS({
16846
16854
  }
16847
16855
  });
16848
16856
 
16849
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/conversations/link.js
16857
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/conversations/link.js
16850
16858
  var RULES_VERSION = 5;
16851
16859
  var LOOK_BACK = 50;
16852
16860
  var SAME_SENDER_WITHIN = 10;
@@ -16936,15 +16944,15 @@ var latest = /* @__PURE__ */ __name((window3, matches) => {
16936
16944
  var sameThread = /* @__PURE__ */ __name((a, b) => a.threadId === b.threadId, "sameThread");
16937
16945
  var link = /* @__PURE__ */ __name((message, parentId, source, kind, confidence, method) => ({ messageId: message.id, parentId, source, kind, confidence, method }), "link");
16938
16946
 
16939
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/ports/traits.js
16947
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/ports/traits.js
16940
16948
  var syncsOneChat = /* @__PURE__ */ __name((messenger) => messenger.history !== "store" || messenger.historyOnDemand === true, "syncsOneChat");
16941
16949
 
16942
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/sends/send-id.js
16950
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/sends/send-id.js
16943
16951
  import { randomBytes } from "node:crypto";
16944
16952
  var newSendId = /* @__PURE__ */ __name(() => randomBytes(8).readBigInt64BE().toString(), "newSendId");
16945
16953
  var newOperationId = newSendId;
16946
16954
 
16947
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/sends/upload.js
16955
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/sends/upload.js
16948
16956
  import { openAsBlob, realpathSync } from "node:fs";
16949
16957
  import { open, stat } from "node:fs/promises";
16950
16958
  import { basename, dirname, extname, isAbsolute, relative, resolve, sep } from "node:path";
@@ -17165,7 +17173,7 @@ var readStickerFile = /* @__PURE__ */ __name(async (path, maxBytes, read) => {
17165
17173
  return { name, source };
17166
17174
  }, "readStickerFile");
17167
17175
 
17168
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/cli/messenger/lacks.js
17176
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/cli/messenger/lacks.js
17169
17177
  var COMMAND_NEEDS = {
17170
17178
  "account update": ["updateProfile", "change the profile"],
17171
17179
  "account sessions list": ["sessions", "list the account's sessions"],
@@ -17215,7 +17223,7 @@ var hideNever = /* @__PURE__ */ __name((messenger, group) => {
17215
17223
  return group;
17216
17224
  }, "hideNever");
17217
17225
 
17218
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/members-audit.js
17226
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/members-audit.js
17219
17227
  var AUDIT_PAGE = 200;
17220
17228
  var AUDIT_BUDGET = 10;
17221
17229
  var AUDIT_PAUSE_MS = 1e3;
@@ -17295,7 +17303,7 @@ var burstJoins = /* @__PURE__ */ __name((members) => {
17295
17303
  return found;
17296
17304
  }, "burstJoins");
17297
17305
 
17298
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/meetings/cli/query-options.js
17306
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/meetings/cli/query-options.js
17299
17307
  var queryWordsAfterOptions = /* @__PURE__ */ __name((command) => {
17300
17308
  command.allowUnknownOption();
17301
17309
  const parse = command.parseOptions.bind(command);
@@ -17315,7 +17323,7 @@ var queryWordsAfterOptions = /* @__PURE__ */ __name((command) => {
17315
17323
  return command;
17316
17324
  }, "queryWordsAfterOptions");
17317
17325
 
17318
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/meetings/cli/passage.js
17326
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/meetings/cli/passage.js
17319
17327
  var count = /* @__PURE__ */ __name((value) => {
17320
17328
  if (!/^(0|[1-9]\d*)$/.test(value) || !Number.isSafeInteger(Number(value)))
17321
17329
  throw new CliError("validation_error", "expected a nonnegative safe integer");
@@ -17357,7 +17365,7 @@ var addMeetingPassageCommandDefinition = /* @__PURE__ */ __name((program, deps)
17357
17365
  var createMeetingPassageCommand = sharedCommand(createMeetingPassageCommandDefinition);
17358
17366
  var addMeetingPassageCommand = sharedCommand(addMeetingPassageCommandDefinition);
17359
17367
 
17360
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/meetings/cli/project-evidence.js
17368
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/meetings/cli/project-evidence.js
17361
17369
  var integer2 = /* @__PURE__ */ __name((value) => {
17362
17370
  if (!/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
17363
17371
  throw new CliError("validation_error", "expected a positive safe integer");
@@ -17380,7 +17388,7 @@ ${fieldsHelp(MEETING_PROJECT_EVIDENCE_QUERY)}`).option("--limit <n>", "hits in o
17380
17388
  }, "addMeetingProjectEvidenceCommandDefinition");
17381
17389
  var addMeetingProjectEvidenceCommand = sharedCommand(addMeetingProjectEvidenceCommandDefinition);
17382
17390
 
17383
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/meetings/cli/search.js
17391
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/meetings/cli/search.js
17384
17392
  var ZONED = /(?:Z|[+-]\d{2}:?\d{2})$/i;
17385
17393
  var moment = /* @__PURE__ */ __name((flag, end, readIn) => (value) => {
17386
17394
  const zone = timezoneOf();
@@ -17466,7 +17474,7 @@ var addMeetingSearchCommandDefinition = /* @__PURE__ */ __name((program, deps) =
17466
17474
  var createMeetingSearchCommand = sharedCommand(createMeetingSearchCommandDefinition);
17467
17475
  var addMeetingSearchCommand = sharedCommand(addMeetingSearchCommandDefinition);
17468
17476
 
17469
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/meetings/cli/index.js
17477
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/meetings/cli/index.js
17470
17478
  var integer4 = /* @__PURE__ */ __name((text) => {
17471
17479
  if (!/^[1-9]\d*$/.test(text) || !Number.isSafeInteger(Number(text)))
17472
17480
  throw new InvalidArgumentError("expected a positive integer");
@@ -17586,7 +17594,7 @@ ${fieldsHelp(EVENT_QUERY, MEETING_QUERY_GUIDE)}`);
17586
17594
  }, "addMeetingCommandsDefinition");
17587
17595
  var addMeetingCommands = sharedCommand(addMeetingCommandsDefinition);
17588
17596
 
17589
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/cli/list-query.js
17597
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/cli/list-query.js
17590
17598
  var LIST_QUERY_GUIDE = "https://github.com/WireCatLabs/cli-core/blob/main/docs/search/query-language.md";
17591
17599
  var withQuery = /* @__PURE__ */ __name((command, registry) => {
17592
17600
  const query = defineQuery(registry);
@@ -17700,7 +17708,7 @@ var termField = /* @__PURE__ */ __name((name, type, example, more = {}) => nativ
17700
17708
  var queryHelp = /* @__PURE__ */ __name((registry) => `
17701
17709
  ${fieldsHelp(registry, LIST_QUERY_GUIDE)}`, "queryHelp");
17702
17710
 
17703
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/cli/paging.js
17711
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/cli/paging.js
17704
17712
  var positiveCount = /* @__PURE__ */ __name((flag) => (value) => {
17705
17713
  if (!/^\d+$/.test(value.trim()) || Number(value) < 1)
17706
17714
  throw new CliError("validation_error", `${flag} takes a whole number from 1 upwards, not "${value}"`);
@@ -17709,7 +17717,7 @@ var positiveCount = /* @__PURE__ */ __name((flag) => (value) => {
17709
17717
  var withPaging = /* @__PURE__ */ __name((command) => command.option("--limit <n>", "how many to show", positiveCount("--limit")).option("--page <n>", "which page, starting at 1", positiveCount("--page")).option("--all", "every row, no paging"), "withPaging");
17710
17718
  var window = /* @__PURE__ */ __name(({ limit, page, all }) => all ? { offset: 0 } : { limit, offset: (page - 1) * limit }, "window");
17711
17719
 
17712
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/cli/messenger/chat-answers.js
17720
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/cli/messenger/chat-answers.js
17713
17721
  var defined = /* @__PURE__ */ __name((record2) => Object.fromEntries(Object.entries(record2).filter(([, value]) => value !== void 0)), "defined");
17714
17722
  var chatRef = /* @__PURE__ */ __name((account, chat) => formatReference({ type: "chat", provider: account.provider, account: account.account, chat }), "chatRef");
17715
17723
  var settingsOf = /* @__PURE__ */ __name((settings) => defined({
@@ -17843,15 +17851,15 @@ var memberEventAnswer = /* @__PURE__ */ __name((chatId, event) => defined({
17843
17851
  people: [{ id: event.id, name: event.name, username: event.username }],
17844
17852
  before: event.before ? { name: event.before.name, username: event.before.username } : void 0
17845
17853
  }), "memberEventAnswer");
17846
- var inviteLinkAnswer = /* @__PURE__ */ __name((link5) => defined({
17847
- link: link5.link,
17848
- approval: link5.approval,
17849
- expires_at: link5.expiresAt,
17850
- max_uses: link5.maxUses,
17851
- primary: link5.primary,
17852
- revoked: link5.revoked,
17853
- pending_count: link5.pending,
17854
- joined_count: link5.joined
17854
+ var inviteLinkAnswer = /* @__PURE__ */ __name((link4) => defined({
17855
+ link: link4.link,
17856
+ approval: link4.approval,
17857
+ expires_at: link4.expiresAt,
17858
+ max_uses: link4.maxUses,
17859
+ primary: link4.primary,
17860
+ revoked: link4.revoked,
17861
+ pending_count: link4.pending,
17862
+ joined_count: link4.joined
17855
17863
  }), "inviteLinkAnswer");
17856
17864
  var joinRequestAnswer = /* @__PURE__ */ __name((request) => defined({
17857
17865
  person_id: request.person.id,
@@ -17971,7 +17979,7 @@ var sessionAnswer = /* @__PURE__ */ __name(({ current, client, device, location,
17971
17979
  ...createdAt === void 0 ? {} : { created_at: createdAt }
17972
17980
  }), "sessionAnswer");
17973
17981
 
17974
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/deps.js
17982
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/deps.js
17975
17983
  var accountStore = /* @__PURE__ */ __name(async (deps) => (await deps.store()).forAccount(await deps.account()), "accountStore");
17976
17984
  var crossAccount = /* @__PURE__ */ __name((deps, _reason) => deps.store(), "crossAccount");
17977
17985
  var NO_LOCAL_STORE = "this answer comes from the messenger, not from the local store";
@@ -18036,7 +18044,7 @@ var storedDeps = /* @__PURE__ */ __name((messenger, store, account, guard) => ({
18036
18044
  }), "storedDeps");
18037
18045
  var storeModeDeps = /* @__PURE__ */ __name((messenger, store, account, guard) => ({ ...storedDeps(messenger, store, account, guard), offline: false, reads: "store" }), "storeModeDeps");
18038
18046
 
18039
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/resolve.js
18047
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/resolve.js
18040
18048
  var isId = /* @__PURE__ */ __name((reference) => /^-?\d+$/.test(reference.trim()), "isId");
18041
18049
  var foldName = /* @__PURE__ */ __name((name) => name.normalize("NFC").replace(/[\uFE0E\uFE0F\u200D]/g, "").toLowerCase(), "foldName");
18042
18050
  var pickChat = /* @__PURE__ */ __name((reference, chats) => {
@@ -18074,7 +18082,7 @@ ${lines3}`, { candidates });
18074
18082
  }, "ambiguous");
18075
18083
  var isPresent = /* @__PURE__ */ __name((value) => value !== null && value !== void 0, "isPresent");
18076
18084
 
18077
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/ports/messenger.js
18085
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/ports/messenger.js
18078
18086
  var throughWrapper = /* @__PURE__ */ __name((inner, handled, wrap = (_, call) => call) => new Proxy(handled, {
18079
18087
  get: /* @__PURE__ */ __name((own, key) => {
18080
18088
  if (key in own)
@@ -18091,7 +18099,7 @@ var capability = /* @__PURE__ */ __name((adapter, method, what) => {
18091
18099
  return found.bind(adapter);
18092
18100
  }, "capability");
18093
18101
 
18094
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/moment.js
18102
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/moment.js
18095
18103
  var AGO = /^(\d+)(m|h|d)$/;
18096
18104
  var AGO_MS = { m: 6e4, h: 36e5, d: 864e5 };
18097
18105
  var DATE = /^\d{4}-\d{2}-\d{2}/;
@@ -18131,7 +18139,7 @@ var dateWindow = /* @__PURE__ */ __name(({ sinceTime, untilTime, zone, now = Dat
18131
18139
  };
18132
18140
  }, "dateWindow");
18133
18141
 
18134
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/questions.js
18142
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/questions.js
18135
18143
  var LINKS = /https?:\/\/\S+/g;
18136
18144
  var unanswered = /* @__PURE__ */ __name((messages, { answerers: answerers2, before: before2 }) => questions(messages, { answerers: answerers2 }).filter(({ question, answer }) => answer === void 0 && Date.parse(question.timestamp) < before2).map(({ question }) => question), "unanswered");
18137
18145
  var questions = /* @__PURE__ */ __name((messages, { answerers: answerers2 }) => {
@@ -18158,7 +18166,7 @@ var questions = /* @__PURE__ */ __name((messages, { answerers: answerers2 }) =>
18158
18166
  });
18159
18167
  }, "questions");
18160
18168
 
18161
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/task-categories.js
18169
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/task-categories.js
18162
18170
  var names = /* @__PURE__ */ __name((categories) => categories.map(({ name }) => name).join(", "), "names");
18163
18171
  var taskCategoryOf = /* @__PURE__ */ __name((categories = DEFAULT_TASK_CATEGORIES, flag = "--category") => (typed) => {
18164
18172
  const name = typed.trim().toLowerCase();
@@ -18208,7 +18216,7 @@ var categorize = /* @__PURE__ */ __name((text, categories = DEFAULT_TASK_CATEGOR
18208
18216
  return best.name;
18209
18217
  }, "categorize");
18210
18218
 
18211
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/task-rules.js
18219
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/task-rules.js
18212
18220
  var taskAccount = /* @__PURE__ */ __name(({ provider, account }) => `${provider}:${account}`, "taskAccount");
18213
18221
  var RULES_IN = {
18214
18222
  dialog: "all",
@@ -18234,7 +18242,7 @@ var applyTaskRules = /* @__PURE__ */ __name(async (review, { store, account, now
18234
18242
  const owner = taskAccount(account);
18235
18243
  const result = { added: 0, closed: 0, review: 0 };
18236
18244
  const sourceOf2 = /* @__PURE__ */ __name((message) => formatLocator({ provider: account.provider, account: account.account, chat: message.chatId, message: message.id }), "sourceOf");
18237
- const open10 = /* @__PURE__ */ __name(async (message, group, kind) => {
18245
+ const open7 = /* @__PURE__ */ __name(async (message, group, kind) => {
18238
18246
  const { created, review: review2 = 0 } = await tasks.add({
18239
18247
  source: sourceOf2(message),
18240
18248
  sourceKind: "message",
@@ -18291,7 +18299,7 @@ var applyTaskRules = /* @__PURE__ */ __name(async (review, { store, account, now
18291
18299
  let held = 0;
18292
18300
  for (const [index, { message, kind }] of opens.entries()) {
18293
18301
  if (index >= opens.length - keep2)
18294
- await open10(message, chat.id, kind);
18302
+ await open7(message, chat.id, kind);
18295
18303
  else if (!await hasTask(message)) {
18296
18304
  held += 1;
18297
18305
  onHeld?.({ source: sourceOf2(message), kind, category: categorize(message.text, categories) });
@@ -18414,7 +18422,7 @@ var applyTaskRulesToChats = /* @__PURE__ */ __name(async (store, account, chatId
18414
18422
  return passes;
18415
18423
  }, "applyTaskRulesToChats");
18416
18424
 
18417
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/botcheck/check.js
18425
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/botcheck/check.js
18418
18426
  var DAY_MS = 864e5;
18419
18427
  var NEW_DAYS = 30;
18420
18428
  var SAME_TEXT_MIN = 20;
@@ -18491,7 +18499,7 @@ var scorePerson = /* @__PURE__ */ __name(({ subject, provider, activity, photos,
18491
18499
  };
18492
18500
  }, "scorePerson");
18493
18501
 
18494
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/botcheck/registries.js
18502
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/botcheck/registries.js
18495
18503
  var REGISTRIES = {
18496
18504
  cas: { title: "Combot Anti-Spam (CAS)", docs: "https://cas.chat/api" },
18497
18505
  lols: { title: "lols.bot", docs: "https://api.lols.bot/lols-bot.json" }
@@ -18576,7 +18584,7 @@ var notCovered = /* @__PURE__ */ __name((messenger, now = /* @__PURE__ */ new Da
18576
18584
  detail: `lists Telegram accounts only, not ${messenger} ones`
18577
18585
  })), "notCovered");
18578
18586
 
18579
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/botcheck/service.js
18587
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/botcheck/service.js
18580
18588
  var ACTIVITY_MESSAGES = 1e3;
18581
18589
  var botCheckService = /* @__PURE__ */ __name((deps) => {
18582
18590
  const subjectOf = /* @__PURE__ */ __name(async (reference) => {
@@ -18664,7 +18672,7 @@ var botCheckService = /* @__PURE__ */ __name((deps) => {
18664
18672
  };
18665
18673
  }, "botCheckService");
18666
18674
 
18667
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/domain/thread.js
18675
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/domain/thread.js
18668
18676
  var threadIdOf = /* @__PURE__ */ __name((value) => {
18669
18677
  if (value === void 0)
18670
18678
  return void 0;
@@ -18674,7 +18682,7 @@ var threadIdOf = /* @__PURE__ */ __name((value) => {
18674
18682
  return id2;
18675
18683
  }, "threadIdOf");
18676
18684
 
18677
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/chat-stats.js
18685
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/chat-stats.js
18678
18686
  var TOP_POSTS = 5;
18679
18687
  var JOINS = /* @__PURE__ */ new Set(["join", "add"]);
18680
18688
  var LEAVES = /* @__PURE__ */ new Set(["leave", "remove"]);
@@ -18791,7 +18799,7 @@ var median = /* @__PURE__ */ __name((values) => {
18791
18799
  return Math.round(sorted.length % 2 === 0 ? ((sorted[middle - 1] ?? upper) + upper) / 2 : upper);
18792
18800
  }, "median");
18793
18801
 
18794
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/member-history.js
18802
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/member-history.js
18795
18803
  var memberEvents = /* @__PURE__ */ __name((stays, revisions, since = 0) => {
18796
18804
  const events = [];
18797
18805
  for (const stay of stays) {
@@ -18823,7 +18831,7 @@ var memberEvents = /* @__PURE__ */ __name((stays, revisions, since = 0) => {
18823
18831
  return events.filter(({ at }) => Date.parse(at) >= since).sort((a, b) => Date.parse(a.at) - Date.parse(b.at) || a.id.localeCompare(b.id));
18824
18832
  }, "memberEvents");
18825
18833
 
18826
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/message-resolution.js
18834
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/message-resolution.js
18827
18835
  var readChatId = /* @__PURE__ */ __name(async (deps, reference, store, account) => {
18828
18836
  if (deps.reads !== "store")
18829
18837
  return keptChatId(deps.messenger, reference, store, account);
@@ -18970,7 +18978,7 @@ var senderAmong = /* @__PURE__ */ __name(async (store, accounts, reference) => {
18970
18978
  }
18971
18979
  }, "senderAmong");
18972
18980
 
18973
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/chats.js
18981
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/chats.js
18974
18982
  var EVENTS_DAYS = 7;
18975
18983
  var TRACKED_DAYS = 30;
18976
18984
  var STATS_PAGE = 1e3;
@@ -19030,7 +19038,7 @@ var chatsService = /* @__PURE__ */ __name((deps) => ({
19030
19038
  }
19031
19039
  const connection = await deps.connection();
19032
19040
  const shown = await connection.chat(chat);
19033
- const card = connection.group && (shown.kind === "group" || shown.kind === "channel") ? (({ description, link: link5, settings }) => ({ ...shown, description, link: link5, settings }))(await connection.group(shown.id)) : shown;
19041
+ const card = connection.group && (shown.kind === "group" || shown.kind === "channel") ? (({ description, link: link4, settings }) => ({ ...shown, description, link: link4, settings }))(await connection.group(shown.id)) : shown;
19034
19042
  if (card.members !== null || card.kind === "channel")
19035
19043
  return card;
19036
19044
  const held = await accountStoreIfOpen(deps);
@@ -19057,11 +19065,11 @@ var chatsService = /* @__PURE__ */ __name((deps) => ({
19057
19065
  }
19058
19066
  return capability(await deps.connection(), "chatEvents", "read who joined or left")(chat, { since: from });
19059
19067
  }, "events"),
19060
- inspect: /* @__PURE__ */ __name(async (link5) => {
19068
+ inspect: /* @__PURE__ */ __name(async (link4) => {
19061
19069
  if (deps.offline) {
19062
19070
  throw new CliError("validation_error", "`chats inspect` asks the messenger about the link; not with --offline");
19063
19071
  }
19064
- return capability(await deps.connection(), "inspect", "read a link")(link5);
19072
+ return capability(await deps.connection(), "inspect", "read a link")(link4);
19065
19073
  }, "inspect"),
19066
19074
  stats: /* @__PURE__ */ __name(async (chat, { since, by, timezone }) => {
19067
19075
  const store = await accountStore(deps);
@@ -19265,7 +19273,7 @@ var storedMembers = /* @__PURE__ */ __name(async (store, chatId) => {
19265
19273
  return members.length === 0 ? null : members;
19266
19274
  }, "storedMembers");
19267
19275
 
19268
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/inbox.js
19276
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/inbox.js
19269
19277
  var INBOX_CHATS = 20;
19270
19278
  var REVIEW_DAYS = 3;
19271
19279
  var UNANSWERED_HOURS = 24;
@@ -19418,7 +19426,7 @@ var reviewIn = /* @__PURE__ */ __name(async (adapter, { since, points, chat, kin
19418
19426
  await onReviewed?.(reviewed);
19419
19427
  if (unansweredAfterHours === void 0)
19420
19428
  return reviewed;
19421
- const open10 = [];
19429
+ const open7 = [];
19422
19430
  for (const one of reviewed.chats) {
19423
19431
  const admins = answerers2.get(one.id);
19424
19432
  const questions2 = unanswered(one.messages, {
@@ -19426,10 +19434,10 @@ var reviewIn = /* @__PURE__ */ __name(async (adapter, { since, points, chat, kin
19426
19434
  before: now - unansweredAfterHours * 36e5
19427
19435
  });
19428
19436
  if (questions2.length > 0) {
19429
- open10.push({ ...one, messages: questions2, answeredBy: admins === void 0 ? "owner" : "owner-and-admins" });
19437
+ open7.push({ ...one, messages: questions2, answeredBy: admins === void 0 ? "owner" : "owner-and-admins" });
19430
19438
  }
19431
19439
  }
19432
- return { ...reviewed, chats: open10, unanswered: { olderThanHours: unansweredAfterHours } };
19440
+ return { ...reviewed, chats: open7, unanswered: { olderThanHours: unansweredAfterHours } };
19433
19441
  }, "reviewIn");
19434
19442
  var inboxService = /* @__PURE__ */ __name((deps) => {
19435
19443
  const reader = /* @__PURE__ */ __name(async () => {
@@ -19473,7 +19481,7 @@ var inboxService = /* @__PURE__ */ __name((deps) => {
19473
19481
  };
19474
19482
  }, "inboxService");
19475
19483
 
19476
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/domain/formatting.js
19484
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/domain/formatting.js
19477
19485
  var invalid = /* @__PURE__ */ __name(() => new CliError("validation_error", "the messenger formatter returned invalid text spans"), "invalid");
19478
19486
  var validateFormattedText = /* @__PURE__ */ __name((formatted2) => {
19479
19487
  const { text, spans } = formatted2;
@@ -19533,7 +19541,7 @@ var visibleFormattedText = /* @__PURE__ */ __name((formatted2) => {
19533
19541
  };
19534
19542
  }, "visibleFormattedText");
19535
19543
 
19536
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/moderation/check.js
19544
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/moderation/check.js
19537
19545
  var INVITE = /max\.ru\/join\/|(t|telegram)\.me\/(\+|joinchat\/)|tg:\/\/join/i;
19538
19546
  var LINK2 = /https?:\/\/\S+/i;
19539
19547
  var STRENGTH = { report: 0, delete: 1, remove: 2 };
@@ -19721,7 +19729,7 @@ var nextPoint = /* @__PURE__ */ __name((rows, found) => {
19721
19729
  }, "nextPoint");
19722
19730
  var someUndone = /* @__PURE__ */ __name((rows) => rows.some(undone), "someUndone");
19723
19731
 
19724
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/moderation/rules.js
19732
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/moderation/rules.js
19725
19733
  import { existsSync, readFileSync } from "node:fs";
19726
19734
  import { join } from "node:path";
19727
19735
  var RULE_ACTIONS = ["report", "delete", "remove"];
@@ -19864,7 +19872,7 @@ var assign = /* @__PURE__ */ __name((rules, key, value) => {
19864
19872
  return { ...rules, [head]: { ...rules[head], [tail]: value } };
19865
19873
  }, "assign");
19866
19874
 
19867
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/person-context.js
19875
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/person-context.js
19868
19876
  var CONTEXT_MESSAGES = 10;
19869
19877
  var CONTEXT_BYTES = 64 * 1024;
19870
19878
  var toContext = /* @__PURE__ */ __name((key, message, chatTitle) => ({
@@ -20120,10 +20128,10 @@ var personMessages = /* @__PURE__ */ __name(async (store, asked, reference, { ch
20120
20128
  };
20121
20129
  }, "personMessages");
20122
20130
 
20123
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
20131
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
20124
20132
  import { createHash } from "node:crypto";
20125
20133
 
20126
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/meeting-reference.js
20134
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/meeting-reference.js
20127
20135
  var missing2 = /* @__PURE__ */ __name(() => new CliError("not_found", "the meeting evidence is unavailable for this account"), "missing");
20128
20136
  var authorizedMeetingMetadata = /* @__PURE__ */ __name(async (store, accountId, reference, options = {}) => {
20129
20137
  const parsed = parseMeetingReference(reference);
@@ -20141,7 +20149,7 @@ var authorizedMeetingMetadata = /* @__PURE__ */ __name(async (store, accountId,
20141
20149
  return { parsed, meeting };
20142
20150
  }, "authorizedMeetingMetadata");
20143
20151
 
20144
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
20152
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
20145
20153
  var hash = /* @__PURE__ */ __name((value) => createHash("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
20146
20154
  var checkMeetingCancelled = /* @__PURE__ */ __name((signal) => {
20147
20155
  if (signal?.aborted)
@@ -20340,7 +20348,7 @@ var readMeetingEvidence = /* @__PURE__ */ __name(async (store, accountId, refere
20340
20348
  return { ...packet, fingerprint: hash(packet) };
20341
20349
  }, "readMeetingEvidence");
20342
20350
 
20343
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/person-meeting-context.js
20351
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/person-meeting-context.js
20344
20352
  var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference, options) => {
20345
20353
  const { meetings = 10, cues = 5, bytes: bytes2 = 64 * 1024, scanLimit = 1e3, since, signal } = options;
20346
20354
  const requestedAccounts = options.accountIds;
@@ -20439,7 +20447,7 @@ var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference,
20439
20447
  };
20440
20448
  }, "personMeetingContext");
20441
20449
 
20442
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/person-preparation.js
20450
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/person-preparation.js
20443
20451
  var PREPARE_BYTES = 96 * 1024;
20444
20452
  var MEETINGS = 5;
20445
20453
  var CUES = 3;
@@ -20556,7 +20564,7 @@ var meetingsOf = /* @__PURE__ */ __name(async (store, uid, stored, since, left)
20556
20564
  }
20557
20565
  }, "meetingsOf");
20558
20566
 
20559
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/person-profile.js
20567
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/person-profile.js
20560
20568
  var personProfile = /* @__PURE__ */ __name(async (deps, person, known) => {
20561
20569
  const online = deps.offline ? void 0 : await deps.connection();
20562
20570
  const held = await storeIfOpen(deps);
@@ -20626,7 +20634,7 @@ var quiet = /* @__PURE__ */ __name((facts) => facts.chats.map(({ id: id2, title,
20626
20634
  complete: false
20627
20635
  })), "quiet");
20628
20636
 
20629
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/person-timeline.js
20637
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/person-timeline.js
20630
20638
  var TIMELINE_ITEMS = 50;
20631
20639
  var TIMELINE_MAX = 500;
20632
20640
  var SCOPES = ["personal", "work"];
@@ -20681,7 +20689,7 @@ var personTimeline = /* @__PURE__ */ __name(async (store, asked, reference, { sc
20681
20689
  };
20682
20690
  }, "personTimeline");
20683
20691
 
20684
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/people.js
20692
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/people.js
20685
20693
  var peopleService = /* @__PURE__ */ __name((deps) => {
20686
20694
  const localCard = /* @__PURE__ */ __name(async (card, includeNotes = false) => {
20687
20695
  const held = await storeIfOpen(deps);
@@ -20908,7 +20916,7 @@ var withoutPhone = /* @__PURE__ */ __name((answer) => {
20908
20916
  return rest;
20909
20917
  }, "withoutPhone");
20910
20918
 
20911
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/task-tag-filters.js
20919
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/task-tag-filters.js
20912
20920
  var taskTagFilters = /* @__PURE__ */ __name(async (store, query) => {
20913
20921
  const tags = /* @__PURE__ */ new Map();
20914
20922
  for (const node of query ? walkQuery(query.root) : [])
@@ -20917,7 +20925,7 @@ var taskTagFilters = /* @__PURE__ */ __name(async (store, query) => {
20917
20925
  return tags;
20918
20926
  }, "taskTagFilters");
20919
20927
 
20920
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/tasks.js
20928
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/tasks.js
20921
20929
  var TASK_QUERY = {
20922
20930
  entity: "task",
20923
20931
  backend: "sql",
@@ -21049,13 +21057,13 @@ var tasksService = /* @__PURE__ */ __name((deps, categories) => {
21049
21057
  store.notes.links({ from: details.ref }),
21050
21058
  store.notes.links({ to: details.ref })
21051
21059
  ]);
21052
- return { ...details, links, linkedFrom: incoming.filter((link5) => link5.from.startsWith("task:")) };
21060
+ return { ...details, links, linkedFrom: incoming.filter((link4) => link4.from.startsWith("task:")) };
21053
21061
  }, "cardOf");
21054
21062
  const planOf = /* @__PURE__ */ __name(async (store, id2, plan, by) => {
21055
21063
  if (plan.category !== void 0)
21056
21064
  plan = { ...plan, category: await categoryOf(store, plan.category) };
21057
- const open10 = (await store.tasks.details(id2)).status === "open";
21058
- if (!open10 && (plan.dueAt != null || plan.nextCheckAt != null))
21065
+ const open7 = (await store.tasks.details(id2)).status === "open";
21066
+ if (!open7 && (plan.dueAt != null || plan.nextCheckAt != null))
21059
21067
  throw new CliError("validation_error", "a closed task takes no due date or next check; it stays closed");
21060
21068
  const { assignees, ...fields } = plan;
21061
21069
  const author = by === "owner" ? "owner" : { bot: by };
@@ -21141,17 +21149,17 @@ var tasksService = /* @__PURE__ */ __name((deps, categories) => {
21141
21149
  if (choice.attach !== void 0) {
21142
21150
  const target2 = await owned(store, account, choice.attach);
21143
21151
  const similarity = await store.tasks.compare(subject, target2.id);
21144
- const link5 = {
21152
+ const link4 = {
21145
21153
  from: (await store.tasks.details(target2.id)).ref,
21146
21154
  kind: "evidence",
21147
21155
  origin: origin === "owner" ? "owner" : "suggested"
21148
21156
  };
21149
21157
  try {
21150
- await store.notes.addLink({ ...link5, to: note ? note.ref : source });
21158
+ await store.notes.addLink({ ...link4, to: note ? note.ref : source });
21151
21159
  } catch (error) {
21152
21160
  if (!(error instanceof CliError && error.code === "not_found" && !note))
21153
21161
  throw error;
21154
- await store.notes.addLink({ ...link5, targetText: source });
21162
+ await store.notes.addLink({ ...link4, targetText: source });
21155
21163
  }
21156
21164
  await store.tasks.recordPair({ source, other: target2.id, decision: "attached", similarity, by });
21157
21165
  const review = await reviewAfterLink(store, target2.id);
@@ -21397,7 +21405,33 @@ var taskView = /* @__PURE__ */ __name(async (store, account, task2) => {
21397
21405
  };
21398
21406
  }, "taskView");
21399
21407
 
21400
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/excerpt.js
21408
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/chat-coverage.js
21409
+ var chatCoverage = /* @__PURE__ */ __name(async (store, account, chatIds) => {
21410
+ const ids = [...new Set(chatIds)];
21411
+ if (ids.length === 0)
21412
+ return [];
21413
+ const found = new Map((await store.chats.chatCompleteness(account, ids)).map((one) => [one.chatId, one]));
21414
+ return Promise.all(ids.map(async (chatId) => {
21415
+ const [stats] = await store.chats.chatStats(account, chatId);
21416
+ const title = stats?.title ?? await store.chats.chatTitle(account, chatId);
21417
+ const completeness = found.get(chatId) ?? {
21418
+ chatId,
21419
+ state: "unknown",
21420
+ upToDate: null,
21421
+ gaps: false,
21422
+ reachesStart: false,
21423
+ fetchedAt: null
21424
+ };
21425
+ return {
21426
+ chatId,
21427
+ title,
21428
+ completeness,
21429
+ held: { messages: stats?.messages ?? 0, oldestAt: stats?.oldestAt ?? null, newestAt: stats?.newestAt ?? null }
21430
+ };
21431
+ }));
21432
+ }, "chatCoverage");
21433
+
21434
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/excerpt.js
21401
21435
  var queryWords = /* @__PURE__ */ __name((query) => query.toLowerCase().split(/\s+/).map((word) => word.replace(/^[\p{L}_]+:/u, "").replace(/~\d+$/u, "").replace(/^[^\p{L}\p{N}]+|[^\p{L}\p{N}]+$/gu, "")).filter((word) => word.length > 2 && !["and", "or", "not"].includes(word)), "queryWords");
21402
21436
  var excerpt = /* @__PURE__ */ __name((text, query, size2 = 240, options = {}) => {
21403
21437
  const flat = text.replace(/\s+/g, " ").trim();
@@ -21413,380 +21447,18 @@ var excerpt = /* @__PURE__ */ __name((text, query, size2 = 240, options = {}) =>
21413
21447
  }, "excerpt");
21414
21448
  var withExcerpt = /* @__PURE__ */ __name(({ matchedText, ...hit }, query) => ({ ...hit, excerpt: excerpt(matchedText ?? hit.text, query) }), "withExcerpt");
21415
21449
 
21416
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/media-archive.js
21450
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/media-archive.js
21417
21451
  import { setTimeout as sleep } from "node:timers/promises";
21418
21452
 
21419
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
21420
- import { lstat as lstat4 } from "node:fs/promises";
21421
-
21422
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
21423
- import { createHash as createHash3, randomUUID as randomUUID4 } from "node:crypto";
21424
- import { open as open6, rename as rename3, unlink as unlink6 } from "node:fs/promises";
21425
- import { join as join6 } from "node:path";
21426
-
21427
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/files/atomic-write.js
21428
- import { randomUUID } from "node:crypto";
21429
- import { constants } from "node:fs";
21430
- import { link as link2, open as open2, realpath, rename, unlink } from "node:fs/promises";
21431
- import { basename as basename2, dirname as dirname2, join as join2 } from "node:path";
21432
- var openFolder = /* @__PURE__ */ __name((folder) => process.platform === "win32" ? Promise.resolve(void 0) : open2(folder, constants.O_RDONLY | (constants.O_DIRECTORY ?? 0) | (constants.O_NOFOLLOW ?? 0)), "openFolder");
21433
- var writeFileAtomic = /* @__PURE__ */ __name(async (path, content, { mode = 384, overwrite = true, signal, beforePublish } = {}) => {
21434
- signal?.throwIfAborted();
21435
- const folder = await realpath(dirname2(path));
21436
- const target2 = join2(folder, basename2(path));
21437
- const directory2 = await openFolder(folder);
21438
- try {
21439
- const temporary = join2(folder, `.${basename2(path)}.${randomUUID()}.tmp`);
21440
- let handle = await open2(temporary, "wx", mode);
21441
- let published = false;
21442
- try {
21443
- await handle.writeFile(content);
21444
- await handle.sync();
21445
- await handle.close();
21446
- handle = void 0;
21447
- signal?.throwIfAborted();
21448
- await beforePublish?.();
21449
- if (overwrite)
21450
- await rename(temporary, target2);
21451
- else
21452
- await link2(temporary, target2);
21453
- published = overwrite;
21454
- await directory2?.sync();
21455
- } finally {
21456
- await handle?.close().catch(() => void 0);
21457
- if (!published)
21458
- await unlink(temporary).catch(() => void 0);
21459
- }
21460
- } finally {
21461
- await directory2?.close().catch(() => void 0);
21462
- }
21463
- }, "writeFileAtomic");
21464
-
21465
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/files/ordinary-file.js
21466
- import { constants as constants2 } from "node:fs";
21467
- import { lstat, open as open3 } from "node:fs/promises";
21468
- var deviceOf = /* @__PURE__ */ __name((dev) => process.platform === "win32" ? BigInt.asUintN(32, dev) : dev, "deviceOf");
21469
- var sameIdentity = /* @__PURE__ */ __name((left, right) => left.ino === right.ino && deviceOf(left.dev) === deviceOf(right.dev), "sameIdentity");
21470
- var openOrdinaryFile = /* @__PURE__ */ __name(async (path, options = {}) => {
21471
- const before2 = await lstat(path, { bigint: true });
21472
- if (before2.isSymbolicLink())
21473
- throw new CliError("validation_error", "archive path must be an ordinary file without a symlink");
21474
- if (!before2.isFile())
21475
- throw new CliError("validation_error", "archive path must be an ordinary file");
21476
- const access = options.writable ? constants2.O_RDWR : constants2.O_RDONLY;
21477
- const flags = process.platform === "win32" ? access : access | (constants2.O_NOFOLLOW ?? 0) | (constants2.O_NONBLOCK ?? 0);
21478
- const file2 = await open3(path, flags);
21479
- try {
21480
- const opened = await file2.stat({ bigint: true });
21481
- const after = await lstat(path, { bigint: true });
21482
- if (!opened.isFile() || !after.isFile() || before2.ino !== opened.ino || before2.ino !== after.ino)
21483
- throw new CliError("validation_error", "archive file changed while opening");
21484
- if (process.platform === "win32" && before2.dev === 0n && after.dev === 0n) {
21485
- const witness = await open3(path, flags);
21486
- try {
21487
- const identified = await witness.stat({ bigint: true });
21488
- const final = await lstat(path, { bigint: true });
21489
- if (opened.dev === 0n || !identified.isFile() || !final.isFile() || !sameIdentity(identified, opened) || final.ino !== before2.ino || final.dev !== 0n && deviceOf(final.dev) !== deviceOf(opened.dev))
21490
- throw new CliError("validation_error", "archive file changed while opening");
21491
- } finally {
21492
- await witness.close();
21493
- }
21494
- } else if (deviceOf(before2.dev) !== deviceOf(opened.dev) || deviceOf(before2.dev) !== deviceOf(after.dev)) {
21495
- throw new CliError("validation_error", "archive file changed while opening");
21496
- }
21497
- return file2;
21498
- } catch (error) {
21499
- await file2.close();
21500
- throw error;
21501
- }
21502
- }, "openOrdinaryFile");
21503
- var sameOrdinaryFile = /* @__PURE__ */ __name(async (path, created) => {
21504
- let file2;
21505
- try {
21506
- file2 = await openOrdinaryFile(path);
21507
- } catch (error) {
21508
- if (error instanceof CliError || typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
21509
- return false;
21510
- throw error;
21511
- }
21512
- try {
21513
- return sameIdentity(created, await file2.stat({ bigint: true }));
21514
- } finally {
21515
- await file2.close();
21516
- }
21517
- }, "sameOrdinaryFile");
21518
- var syncDirectory = /* @__PURE__ */ __name(async (path) => {
21519
- if (process.platform === "win32")
21520
- return;
21521
- const directory2 = await open3(path, constants2.O_RDONLY | (constants2.O_DIRECTORY ?? 0) | (constants2.O_NOFOLLOW ?? 0));
21522
- try {
21523
- if (!(await directory2.stat()).isDirectory())
21524
- throw new CliError("validation_error", "archive publication directory must be ordinary");
21525
- await directory2.sync();
21526
- } finally {
21527
- await directory2.close();
21528
- }
21529
- }, "syncDirectory");
21530
-
21531
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/files/bounded-utf8.js
21532
- var readBoundedUtf8File = /* @__PURE__ */ __name(async (path, { maxBytes }) => {
21533
- if (!Number.isSafeInteger(maxBytes) || maxBytes < 1 || maxBytes > 16 * 1024 * 1024)
21534
- throw new CliError("validation_error", "file maxBytes takes 1\u201316777216 bytes");
21535
- const file2 = await openOrdinaryFile(path);
21536
- try {
21537
- if ((await file2.stat()).size > maxBytes)
21538
- throw new CliError("validation_error", "input file exceeds its byte budget");
21539
- const chunks = [], buffer = Buffer.alloc(Math.min(65536, maxBytes + 1));
21540
- let bytes2 = 0;
21541
- for (; ; ) {
21542
- const { bytesRead } = await file2.read(buffer, 0, Math.min(buffer.length, maxBytes - bytes2 + 1), null);
21543
- if (bytesRead === 0)
21544
- break;
21545
- bytes2 += bytesRead;
21546
- if (bytes2 > maxBytes)
21547
- throw new CliError("validation_error", "input file exceeds its byte budget");
21548
- chunks.push(Buffer.from(buffer.subarray(0, bytesRead)));
21549
- }
21550
- try {
21551
- return new TextDecoder("utf-8", { fatal: true }).decode(Buffer.concat(chunks, bytes2));
21552
- } catch {
21553
- throw new CliError("validation_error", "input file must contain valid UTF-8");
21554
- }
21555
- } finally {
21556
- await file2.close();
21557
- }
21558
- }, "readBoundedUtf8File");
21559
-
21560
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/files/lock.js
21561
- import { mkdir as mkdir2 } from "node:fs/promises";
21562
- import { basename as basename3, dirname as dirname3 } from "node:path";
21563
-
21564
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/files/native-writer-lease.js
21565
- import { randomUUID as randomUUID2 } from "node:crypto";
21566
- import { lstat as lstat3, mkdir, open as open4, realpath as realpath3, rmdir as rmdir2, unlink as unlink4 } from "node:fs/promises";
21567
- import { hostname as hostname2 } from "node:os";
21568
- import { join as join4 } from "node:path";
21453
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
21454
+ import { lstat } from "node:fs/promises";
21569
21455
 
21570
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/files/native-lease-inspection.js
21571
- import { lstat as lstat2, readdir, realpath as realpath2, unlink as unlink2 } from "node:fs/promises";
21456
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
21457
+ import { createHash as createHash3, randomUUID as randomUUID2 } from "node:crypto";
21458
+ import { open as open3, rename as rename2, unlink as unlink2 } from "node:fs/promises";
21572
21459
  import { join as join3 } from "node:path";
21573
21460
 
21574
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/files/native-lease-owner.js
21575
- import { hostname } from "node:os";
21576
- var missingLeaseFile = /* @__PURE__ */ __name((error) => typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT", "missingLeaseFile");
21577
- var readLeaseOwner = /* @__PURE__ */ __name(async (path, name, signal) => {
21578
- signal?.throwIfAborted();
21579
- try {
21580
- const file2 = await openOrdinaryFile(path);
21581
- try {
21582
- if ((await file2.stat()).size > 4096)
21583
- return null;
21584
- const buffer = Buffer.alloc(4097);
21585
- let size2 = 0;
21586
- while (size2 < buffer.length) {
21587
- signal?.throwIfAborted();
21588
- const { bytesRead } = await file2.read(buffer, size2, buffer.length - size2, size2);
21589
- if (bytesRead === 0)
21590
- break;
21591
- size2 += bytesRead;
21592
- }
21593
- signal?.throwIfAborted();
21594
- if (size2 > 4096)
21595
- return null;
21596
- const owner = JSON.parse(buffer.subarray(0, size2).toString("utf8"));
21597
- if (owner?.version !== 1 || !Number.isSafeInteger(owner.pid) || owner.pid <= 0 || typeof owner.host !== "string" || !owner.host.trim() || !/^[a-f0-9-]{36}$/.test(owner.nonce) || name !== `${owner.pid}-${owner.nonce}.json`)
21598
- return null;
21599
- return owner;
21600
- } finally {
21601
- await file2.close();
21602
- }
21603
- } catch {
21604
- signal?.throwIfAborted();
21605
- return null;
21606
- }
21607
- }, "readLeaseOwner");
21608
- var leaseOwnerStatus = /* @__PURE__ */ __name((owner) => {
21609
- if (owner.host !== hostname())
21610
- return "foreign";
21611
- try {
21612
- process.kill(owner.pid, 0);
21613
- return "active";
21614
- } catch (error) {
21615
- return typeof error === "object" && error !== null && "code" in error && error.code === "ESRCH" ? "stale" : "active";
21616
- }
21617
- }, "leaseOwnerStatus");
21618
-
21619
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/files/native-lease-inspection.js
21620
- var leaseInspection = /* @__PURE__ */ __name((markerDirectory) => {
21621
- const inspect = /* @__PURE__ */ __name(async (destination, options = {}) => {
21622
- options.signal?.throwIfAborted();
21623
- const root = await realpath2(destination);
21624
- options.signal?.throwIfAborted();
21625
- const folder = join3(root, markerDirectory);
21626
- let names2;
21627
- try {
21628
- if ((await lstat2(folder)).isSymbolicLink())
21629
- throw new Error("symlink");
21630
- names2 = await readdir(folder);
21631
- } catch (error) {
21632
- options.signal?.throwIfAborted();
21633
- if (missingLeaseFile(error))
21634
- return [];
21635
- throw new CliError("configuration_error", "archive lock directory could not be read");
21636
- }
21637
- options.signal?.throwIfAborted();
21638
- const result = [];
21639
- for (const name of names2.sort()) {
21640
- options.signal?.throwIfAborted();
21641
- const owner = await readLeaseOwner(join3(folder, name), name, options.signal);
21642
- result.push({
21643
- name,
21644
- status: owner ? leaseOwnerStatus(owner) : "unrecognized",
21645
- pid: owner?.pid ?? null,
21646
- host: owner?.host ?? null
21647
- });
21648
- }
21649
- return result;
21650
- }, "inspect");
21651
- const recover = /* @__PURE__ */ __name(async (destination, options = {}) => {
21652
- options.signal?.throwIfAborted();
21653
- const root = await realpath2(destination);
21654
- const locks = await inspect(root, options);
21655
- const removed = [];
21656
- if (options.apply)
21657
- for (const lock of locks) {
21658
- options.signal?.throwIfAborted();
21659
- if (lock.status !== "stale")
21660
- continue;
21661
- const path = join3(root, markerDirectory, lock.name);
21662
- const owner = await readLeaseOwner(path, lock.name, options.signal);
21663
- if (!owner || leaseOwnerStatus(owner) !== "stale")
21664
- continue;
21665
- try {
21666
- await unlink2(path);
21667
- removed.push(lock.name);
21668
- } catch (error) {
21669
- if (!missingLeaseFile(error))
21670
- throw new CliError("configuration_error", "stale archive lock could not be removed");
21671
- }
21672
- }
21673
- return { locks, removed };
21674
- }, "recover");
21675
- return { inspect, recover };
21676
- }, "leaseInspection");
21677
-
21678
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/files/native-lease-release.js
21679
- import { rmdir, unlink as unlink3 } from "node:fs/promises";
21680
- var ownedNativeLease = /* @__PURE__ */ __name((path, name, owner, folder, identity) => {
21681
- let releasing;
21682
- const held = /* @__PURE__ */ __name(async () => {
21683
- if (!await sameOrdinaryFile(path, identity))
21684
- return false;
21685
- const current = await readLeaseOwner(path, name);
21686
- return current?.host === owner.host && current.pid === owner.pid && current.nonce === owner.nonce;
21687
- }, "held");
21688
- const release = /* @__PURE__ */ __name(async () => {
21689
- if (!await held())
21690
- throw new CliError("configuration_error", "owned archive lock changed before release");
21691
- await unlink3(path);
21692
- await rmdir(folder).catch(() => void 0);
21693
- }, "release");
21694
- return {
21695
- held,
21696
- release: /* @__PURE__ */ __name(() => releasing ??= release().catch((error) => {
21697
- releasing = void 0;
21698
- throw error;
21699
- }), "release")
21700
- };
21701
- }, "ownedNativeLease");
21702
-
21703
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/files/native-writer-lease.js
21704
- var validName = /* @__PURE__ */ __name((value) => typeof value === "string" && value.length > 0 && value !== "." && value !== ".." && !/[\\/\0:]/.test(value), "validName");
21705
- var nativeWriterLeaseStore = /* @__PURE__ */ __name((layout) => {
21706
- const { markerDirectory, legacyMarker } = layout;
21707
- if (!validName(markerDirectory) || legacyMarker !== void 0 && (!validName(legacyMarker) || legacyMarker === markerDirectory))
21708
- throw new CliError("validation_error", "archive lock layout requires distinct ordinary entry names");
21709
- const inspection = leaseInspection(markerDirectory);
21710
- return {
21711
- ...inspection,
21712
- acquire: /* @__PURE__ */ __name(async (destination, { signal } = {}) => {
21713
- signal?.throwIfAborted();
21714
- const root = await realpath3(destination);
21715
- signal?.throwIfAborted();
21716
- const folder = join4(root, markerDirectory);
21717
- const owner = { version: 1, pid: process.pid, host: hostname2(), nonce: randomUUID2() };
21718
- const name = `${owner.pid}-${owner.nonce}.json`;
21719
- const path = join4(folder, name);
21720
- const marker = /* @__PURE__ */ __name(async (attempt = 1) => {
21721
- await mkdir(folder, { recursive: true });
21722
- try {
21723
- if ((await lstat3(folder)).isSymbolicLink())
21724
- throw new CliError("validation_error", "archive lock directory must not be a symlink");
21725
- await inspection.recover(root, { apply: true, signal });
21726
- signal?.throwIfAborted();
21727
- return await open4(path, "wx", 384);
21728
- } catch (error) {
21729
- if (attempt < 5 && missingLeaseFile(error))
21730
- return marker(attempt + 1);
21731
- throw error;
21732
- }
21733
- }, "marker");
21734
- const file2 = await marker();
21735
- let retained = false;
21736
- let identity;
21737
- try {
21738
- identity = await file2.stat({ bigint: true });
21739
- await file2.writeFile(JSON.stringify(owner));
21740
- await file2.sync();
21741
- await file2.close();
21742
- signal?.throwIfAborted();
21743
- const inspected = await inspection.inspect(root, { signal });
21744
- const own = inspected.find((lock) => lock.name === name);
21745
- if (own?.status !== "active" || own.pid !== owner.pid || own.host !== owner.host)
21746
- throw new CliError("configuration_error", "archive writer lost its lock before acquisition");
21747
- const locks = inspected.filter((lock) => lock.name !== name);
21748
- if (locks.length)
21749
- return { status: "busy", locks };
21750
- if (legacyMarker) {
21751
- try {
21752
- await lstat3(join4(root, legacyMarker));
21753
- return { status: "legacy" };
21754
- } catch (error) {
21755
- if (!missingLeaseFile(error))
21756
- throw error;
21757
- }
21758
- }
21759
- signal?.throwIfAborted();
21760
- retained = true;
21761
- return { status: "acquired", lease: ownedNativeLease(path, name, owner, folder, identity) };
21762
- } finally {
21763
- await file2.close().catch(() => void 0);
21764
- if (!retained) {
21765
- if (identity && await sameOrdinaryFile(path, identity))
21766
- await unlink4(path).catch(() => void 0);
21767
- await rmdir2(folder).catch(() => void 0);
21768
- }
21769
- }
21770
- }, "acquire")
21771
- };
21772
- }, "nativeWriterLeaseStore");
21773
-
21774
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/files/lock.js
21775
- var acquireLock = /* @__PURE__ */ __name(async (path, { signal } = {}) => {
21776
- const folder = dirname3(path);
21777
- await mkdir2(folder, { recursive: true, mode: 448 });
21778
- const acquired = await nativeWriterLeaseStore({ markerDirectory: basename3(path) }).acquire(folder, {
21779
- ...signal ? { signal } : {}
21780
- });
21781
- if (acquired.status === "acquired")
21782
- return acquired.lease;
21783
- throw new CliError("validation_error", `${basename3(path)} is locked by another process`, {
21784
- reason: "file.locked",
21785
- ...acquired.status === "busy" ? { holders: acquired.locks } : {}
21786
- });
21787
- }, "acquireLock");
21788
-
21789
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-metadata.js
21461
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-metadata.js
21790
21462
  import { createHash as createHash2 } from "node:crypto";
21791
21463
  var metadataLimit = 16384;
21792
21464
  var partialIdentity = /* @__PURE__ */ __name((locator) => JSON.stringify([locator.provider, locator.account, locator.occurrenceId, locator.assetId]), "partialIdentity");
@@ -21846,10 +21518,10 @@ var readPartialMetadata = /* @__PURE__ */ __name(async (path, locator, maxBytes,
21846
21518
  }
21847
21519
  }, "readPartialMetadata");
21848
21520
 
21849
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-writer.js
21850
- import { randomUUID as randomUUID3 } from "node:crypto";
21851
- import { open as open5, rename as rename2, unlink as unlink5 } from "node:fs/promises";
21852
- import { join as join5 } from "node:path";
21521
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-writer.js
21522
+ import { randomUUID } from "node:crypto";
21523
+ import { open as open2, rename, unlink } from "node:fs/promises";
21524
+ import { join as join2 } from "node:path";
21853
21525
  var partialWriter = /* @__PURE__ */ __name(async (input) => {
21854
21526
  const { file: file2, signal, partial } = input;
21855
21527
  const owned = await file2.stat({ bigint: true });
@@ -21875,8 +21547,8 @@ var partialWriter = /* @__PURE__ */ __name(async (input) => {
21875
21547
  const content = JSON.stringify({ ...partial, offset: size2, sha256: hash3.copy().digest("hex") });
21876
21548
  if (Buffer.byteLength(content) > metadataLimit)
21877
21549
  throw new CliError("validation_error", "recording partial metadata exceeds its byte limit");
21878
- const temp = join5(input.root, `${input.prefix}${randomUUID3()}.tmp`);
21879
- const metadata = await open5(temp, "wx", 384);
21550
+ const temp = join2(input.root, `${input.prefix}${randomUUID()}.tmp`);
21551
+ const metadata = await open2(temp, "wx", 384);
21880
21552
  try {
21881
21553
  try {
21882
21554
  await metadata.writeFile(content);
@@ -21885,11 +21557,11 @@ var partialWriter = /* @__PURE__ */ __name(async (input) => {
21885
21557
  await metadata.close();
21886
21558
  }
21887
21559
  await usable();
21888
- await rename2(temp, input.metadataPath);
21560
+ await rename(temp, input.metadataPath);
21889
21561
  await syncDirectory(input.root);
21890
21562
  signal?.throwIfAborted();
21891
21563
  } finally {
21892
- await unlink5(temp).catch((error) => {
21564
+ await unlink(temp).catch((error) => {
21893
21565
  if (!missing3(error))
21894
21566
  throw error;
21895
21567
  });
@@ -21938,7 +21610,7 @@ var partialWriter = /* @__PURE__ */ __name(async (input) => {
21938
21610
  };
21939
21611
  }, "partialWriter");
21940
21612
 
21941
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
21613
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
21942
21614
  var NativeRecordingPartialStore = class {
21943
21615
  static {
21944
21616
  __name(this, "NativeRecordingPartialStore");
@@ -21960,9 +21632,9 @@ var NativeRecordingPartialStore = class {
21960
21632
  this.options = Object.freeze({ ...options });
21961
21633
  if (typeof root !== "string" || !root || root.includes("\0") || !/^\.[a-zA-Z0-9][a-zA-Z0-9._-]{0,95}-$/.test(options.prefix) || typeof options.persistent !== "boolean" || !Number.isSafeInteger(options.maxBytes) || options.maxBytes <= 0 || Object.values(this.locator).some((value) => typeof value !== "string" || !value.trim() || /[\0\r\n]/.test(value)))
21962
21634
  throw new CliError("validation_error", "invalid native recording partial options");
21963
- const key = options.persistent ? createHash3("sha256").update(partialIdentity(this.locator)).digest("hex") : randomUUID4();
21964
- this.path = join6(root, `${options.prefix}${key}.part`);
21965
- this.metadataPath = join6(root, `${options.prefix}${key}.json`);
21635
+ const key = options.persistent ? createHash3("sha256").update(partialIdentity(this.locator)).digest("hex") : randomUUID2();
21636
+ this.path = join3(root, `${options.prefix}${key}.part`);
21637
+ this.metadataPath = join3(root, `${options.prefix}${key}.json`);
21966
21638
  }
21967
21639
  scope(locator) {
21968
21640
  if (partialIdentity(locator) !== partialIdentity(this.locator))
@@ -22003,17 +21675,17 @@ var NativeRecordingPartialStore = class {
22003
21675
  if (resume) {
22004
21676
  file2 = await openOrdinaryFile(this.path, { writable: true });
22005
21677
  } else {
22006
- const temp = join6(this.root, `${this.options.prefix}${randomUUID4()}.tmp`);
22007
- file2 = await open6(temp, "wx+", 384);
21678
+ const temp = join3(this.root, `${this.options.prefix}${randomUUID2()}.tmp`);
21679
+ file2 = await open3(temp, "wx+", 384);
22008
21680
  try {
22009
- await rename3(temp, this.path);
22010
- await unlink6(this.metadataPath).catch((error) => {
21681
+ await rename2(temp, this.path);
21682
+ await unlink2(this.metadataPath).catch((error) => {
22011
21683
  if (!missing3(error))
22012
21684
  throw error;
22013
21685
  });
22014
21686
  } catch (error) {
22015
21687
  await file2.close();
22016
- await unlink6(temp).catch(() => void 0);
21688
+ await unlink2(temp).catch(() => void 0);
22017
21689
  throw error;
22018
21690
  }
22019
21691
  }
@@ -22045,13 +21717,13 @@ var NativeRecordingPartialStore = class {
22045
21717
  }
22046
21718
  };
22047
21719
 
22048
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
21720
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
22049
21721
  import { createHash as createHash4 } from "node:crypto";
22050
- import { link as link3 } from "node:fs/promises";
22051
- import { basename as basename4, dirname as dirname4, join as join8, resolve as resolve2 } from "node:path";
21722
+ import { link as link2 } from "node:fs/promises";
21723
+ import { basename as basename2, dirname as dirname2, join as join5, resolve as resolve2 } from "node:path";
22052
21724
 
22053
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-files.js
22054
- import { unlink as unlink7 } from "node:fs/promises";
21725
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-files.js
21726
+ import { unlink as unlink3 } from "node:fs/promises";
22055
21727
  var verifiedPublicationFile = /* @__PURE__ */ __name(async (path, expected, signal, writable = false) => {
22056
21728
  signal?.throwIfAborted();
22057
21729
  const file2 = await openOrdinaryFile(path, { writable });
@@ -22080,15 +21752,15 @@ var commitPublication = /* @__PURE__ */ __name(async (root, partialPath, finalPa
22080
21752
  signal?.throwIfAborted();
22081
21753
  await assertPublicationIdentity(finalPath, final);
22082
21754
  await assertPublicationIdentity(partialPath, partial);
22083
- await unlink7(partialPath);
21755
+ await unlink3(partialPath);
22084
21756
  await syncDirectory(root);
22085
21757
  signal?.throwIfAborted();
22086
21758
  }, "commitPublication");
22087
21759
 
22088
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-journal.js
22089
- import { randomUUID as randomUUID5 } from "node:crypto";
22090
- import { open as open7, rename as rename4, unlink as unlink8 } from "node:fs/promises";
22091
- import { join as join7 } from "node:path";
21760
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-journal.js
21761
+ import { randomUUID as randomUUID3 } from "node:crypto";
21762
+ import { open as open4, rename as rename3, unlink as unlink4 } from "node:fs/promises";
21763
+ import { join as join4 } from "node:path";
22092
21764
  var readPublicationJournal = /* @__PURE__ */ __name(async (path, codec, limit, signal) => {
22093
21765
  signal?.throwIfAborted();
22094
21766
  let file2;
@@ -22132,8 +21804,8 @@ var writePublicationJournal = /* @__PURE__ */ __name(async (root, path, prefix,
22132
21804
  if (Buffer.byteLength(content) > limit)
22133
21805
  throw new CliError("validation_error", "recording recovery record exceeds its metadata limit");
22134
21806
  codec.decode(JSON.parse(content));
22135
- const temp = join7(root, `${prefix}${randomUUID5()}.tmp`);
22136
- const handle = await open7(temp, "wx", 384);
21807
+ const temp = join4(root, `${prefix}${randomUUID3()}.tmp`);
21808
+ const handle = await open4(temp, "wx", 384);
22137
21809
  let identity;
22138
21810
  try {
22139
21811
  try {
@@ -22146,19 +21818,19 @@ var writePublicationJournal = /* @__PURE__ */ __name(async (root, path, prefix,
22146
21818
  signal?.throwIfAborted();
22147
21819
  if (!identity || !await sameOrdinaryFile(temp, identity))
22148
21820
  throw new CliError("validation_error", "recording publication journal changed");
22149
- await rename4(temp, path);
21821
+ await rename3(temp, path);
22150
21822
  await syncDirectory(root);
22151
21823
  signal?.throwIfAborted();
22152
21824
  } finally {
22153
21825
  if (identity && await sameOrdinaryFile(temp, identity))
22154
- await unlink8(temp).catch((error) => {
21826
+ await unlink4(temp).catch((error) => {
22155
21827
  if (!missing3(error))
22156
21828
  throw error;
22157
21829
  });
22158
21830
  }
22159
21831
  }, "writePublicationJournal");
22160
21832
 
22161
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
21833
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
22162
21834
  var NativeRecordingPublication = class {
22163
21835
  static {
22164
21836
  __name(this, "NativeRecordingPublication");
@@ -22170,12 +21842,12 @@ var NativeRecordingPublication = class {
22170
21842
  options;
22171
21843
  constructor(root, locator, options) {
22172
21844
  this.root = root;
22173
- if (!root || root.includes("\0") || !/^\.[a-zA-Z0-9][a-zA-Z0-9._-]{0,95}-$/.test(options.prefix) || !options.filename || basename4(options.filename) !== options.filename || /[\\/\0]/.test(options.filename) || [".", ".."].includes(options.filename) || !Number.isSafeInteger(options.maxBytes) || options.maxBytes <= 0 || !Number.isSafeInteger(options.metadataLimit) || options.metadataLimit <= 0 || options.metadataLimit > 1048576 || [locator.provider, locator.account, locator.occurrenceId, locator.assetId].some((value) => typeof value !== "string" || !value.trim() || /[\0\r\n]/.test(value)))
21845
+ if (!root || root.includes("\0") || !/^\.[a-zA-Z0-9][a-zA-Z0-9._-]{0,95}-$/.test(options.prefix) || !options.filename || basename2(options.filename) !== options.filename || /[\\/\0]/.test(options.filename) || [".", ".."].includes(options.filename) || !Number.isSafeInteger(options.maxBytes) || options.maxBytes <= 0 || !Number.isSafeInteger(options.metadataLimit) || options.metadataLimit <= 0 || options.metadataLimit > 1048576 || [locator.provider, locator.account, locator.occurrenceId, locator.assetId].some((value) => typeof value !== "string" || !value.trim() || /[\0\r\n]/.test(value)))
22174
21846
  throw new CliError("validation_error", "invalid native recording publication options");
22175
21847
  this.scope = partialIdentity(locator);
22176
21848
  this.options = Object.freeze({ ...options, codec: Object.freeze({ ...options.codec }) });
22177
- this.journalPath = join8(root, `${options.prefix}${createHash4("sha256").update(this.scope).digest("hex")}.json`);
22178
- this.finalPath = join8(root, options.filename);
21849
+ this.journalPath = join5(root, `${options.prefix}${createHash4("sha256").update(this.scope).digest("hex")}.json`);
21850
+ this.finalPath = join5(root, options.filename);
22179
21851
  if (this.finalPath === this.journalPath)
22180
21852
  throw new CliError("validation_error", "recording publication paths must be distinct");
22181
21853
  }
@@ -22186,7 +21858,7 @@ var NativeRecordingPublication = class {
22186
21858
  return writePublicationJournal(this.root, this.journalPath, this.options.prefix, value, this.options.codec, this.options.metadataLimit, this.options.signal);
22187
21859
  }
22188
21860
  validate(partialPath, expected) {
22189
- if (resolve2(dirname4(partialPath)) !== resolve2(this.root) || resolve2(partialPath) === resolve2(this.finalPath) || resolve2(partialPath) === resolve2(this.journalPath) || !Number.isSafeInteger(expected.size) || expected.size < 0 || expected.size > this.options.maxBytes || typeof expected.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(expected.sha256))
21861
+ if (resolve2(dirname2(partialPath)) !== resolve2(this.root) || resolve2(partialPath) === resolve2(this.finalPath) || resolve2(partialPath) === resolve2(this.journalPath) || !Number.isSafeInteger(expected.size) || expected.size < 0 || expected.size > this.options.maxBytes || typeof expected.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(expected.sha256))
22190
21862
  throw new CliError("validation_error", "invalid recording publication evidence");
22191
21863
  this.options.signal?.throwIfAborted();
22192
21864
  }
@@ -22198,7 +21870,7 @@ var NativeRecordingPublication = class {
22198
21870
  await partial.sync();
22199
21871
  this.options.signal?.throwIfAborted();
22200
21872
  await assertPublicationIdentity(partialPath, partial);
22201
- await link3(partialPath, this.finalPath);
21873
+ await link2(partialPath, this.finalPath);
22202
21874
  await assertPublicationIdentity(this.finalPath, partial);
22203
21875
  await commitPublication(this.root, partialPath, this.finalPath, partial, partial, commit, this.options.signal);
22204
21876
  } finally {
@@ -22231,10 +21903,10 @@ var NativeRecordingPublication = class {
22231
21903
  }
22232
21904
  };
22233
21905
 
22234
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/media-archive-manifest.js
21906
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/media-archive-manifest.js
22235
21907
  import { createHash as createHash5 } from "node:crypto";
22236
- import { readdir as readdir2 } from "node:fs/promises";
22237
- import { isAbsolute as isAbsolute2, join as join9, resolve as resolve3 } from "node:path";
21908
+ import { readdir } from "node:fs/promises";
21909
+ import { isAbsolute as isAbsolute2, join as join6, resolve as resolve3 } from "node:path";
22238
21910
  var mediaKey = /* @__PURE__ */ __name((one) => createHash5("sha256").update(JSON.stringify([one.provider, one.account, one.chat, one.message, one.position])).digest("hex"), "mediaKey");
22239
21911
  var mediaManifestName = /* @__PURE__ */ __name((one) => `.media-archive-${mediaKey(one)}.json`, "mediaManifestName");
22240
21912
  var missingMediaFile = /* @__PURE__ */ __name((error) => typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT", "missingMediaFile");
@@ -22276,13 +21948,13 @@ var mediaFingerprint = /* @__PURE__ */ __name(async (path, signal) => {
22276
21948
  }, "mediaFingerprint");
22277
21949
  var readMediaManifests = /* @__PURE__ */ __name(async (root, signal) => {
22278
21950
  const entries = [];
22279
- for (const name of await readdir2(root)) {
21951
+ for (const name of await readdir(root)) {
22280
21952
  signal?.throwIfAborted();
22281
21953
  if (!name.startsWith(".media-archive-") || !name.endsWith(".json"))
22282
21954
  continue;
22283
21955
  let one;
22284
21956
  try {
22285
- one = parseMediaEntry(JSON.parse(await readBoundedUtf8File(join9(root, name), { maxBytes: 16384 })));
21957
+ one = parseMediaEntry(JSON.parse(await readBoundedUtf8File(join6(root, name), { maxBytes: 16384 })));
22286
21958
  } catch {
22287
21959
  throw new CliError("validation_error", "invalid media archive manifest");
22288
21960
  }
@@ -22302,23 +21974,23 @@ var verifyMediaEntry = /* @__PURE__ */ __name(async (root, one, signal) => {
22302
21974
  throw new CliError("validation_error", "media archive relocation cycle or excessive depth");
22303
21975
  visited.add(location);
22304
21976
  location = resolve3(entry.relocatedTo);
22305
- const target2 = parseMediaEntry(JSON.parse(await readBoundedUtf8File(join9(location, mediaManifestName(one)), { maxBytes: 16384 })));
21977
+ const target2 = parseMediaEntry(JSON.parse(await readBoundedUtf8File(join6(location, mediaManifestName(one)), { maxBytes: 16384 })));
22306
21978
  if (!sameMediaCopy(one, target2))
22307
21979
  return false;
22308
21980
  entry = target2;
22309
21981
  }
22310
21982
  if (visited.has(location))
22311
21983
  return false;
22312
- const actual = await mediaFingerprint(join9(location, one.path), signal);
21984
+ const actual = await mediaFingerprint(join6(location, one.path), signal);
22313
21985
  return actual.size === one.size && actual.sha256 === one.sha256;
22314
21986
  }, "verifyMediaEntry");
22315
21987
  var sameMediaCopy = /* @__PURE__ */ __name((a, b) => mediaKey(a) === mediaKey(b) && a.size === b.size && a.sha256 === b.sha256 && a.kind === b.kind && a.messageTime === b.messageTime && a.mime === b.mime, "sameMediaCopy");
22316
- var commitMediaEntry = /* @__PURE__ */ __name((root, one, beforePublish) => writeFileAtomic(join9(root, mediaManifestName(one)), JSON.stringify(parseMediaEntry(one)), {
21988
+ var commitMediaEntry = /* @__PURE__ */ __name((root, one, beforePublish) => writeFileAtomic(join6(root, mediaManifestName(one)), JSON.stringify(parseMediaEntry(one)), {
22317
21989
  overwrite: false,
22318
21990
  beforePublish
22319
21991
  }), "commitMediaEntry");
22320
21992
 
22321
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
21993
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
22322
21994
  var validator = '"media-completed-v1"';
22323
21995
  var maximumFileBytes = 64 * 1024 * 1024 * 1024;
22324
21996
  var archiveMediaFile = /* @__PURE__ */ __name(async (root, identity, kind, file2, beforeWrite, signal, metadata = {}) => {
@@ -22362,7 +22034,7 @@ var archiveMediaFile = /* @__PURE__ */ __name(async (root, identity, kind, file2
22362
22034
  }, "commit");
22363
22035
  let exists = false;
22364
22036
  try {
22365
- await lstat4(publication.finalPath);
22037
+ await lstat(publication.finalPath);
22366
22038
  exists = true;
22367
22039
  } catch (error) {
22368
22040
  if (!missingMediaFile(error))
@@ -22419,9 +22091,9 @@ var archiveMediaFile = /* @__PURE__ */ __name(async (root, identity, kind, file2
22419
22091
  return entry;
22420
22092
  }, "archiveMediaFile");
22421
22093
 
22422
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/media-archive-locks.js
22423
- import { mkdir as mkdir3, realpath as realpath4 } from "node:fs/promises";
22424
- import { join as join10, resolve as resolve4 } from "node:path";
22094
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/media-archive-locks.js
22095
+ import { mkdir, realpath } from "node:fs/promises";
22096
+ import { join as join7, resolve as resolve4 } from "node:path";
22425
22097
  var archiveLocations = /* @__PURE__ */ __name(async (initial, signal) => {
22426
22098
  const roots = /* @__PURE__ */ new Set();
22427
22099
  const queued = new Set(initial.map((directory2) => resolve4(directory2)));
@@ -22430,7 +22102,7 @@ var archiveLocations = /* @__PURE__ */ __name(async (initial, signal) => {
22430
22102
  signal?.throwIfAborted();
22431
22103
  let root;
22432
22104
  try {
22433
- root = await realpath4(pending[at]);
22105
+ root = await realpath(pending[at]);
22434
22106
  } catch (error) {
22435
22107
  if (missingMediaFile(error))
22436
22108
  continue;
@@ -22455,18 +22127,18 @@ var archiveLocations = /* @__PURE__ */ __name(async (initial, signal) => {
22455
22127
  var withMediaArchiveLocks = /* @__PURE__ */ __name(async (directory2, signal, run, options = {}) => {
22456
22128
  signal?.throwIfAborted();
22457
22129
  if (options.create)
22458
- await mkdir3(directory2, { recursive: true, mode: 448 });
22459
- const root = await realpath4(directory2);
22130
+ await mkdir(directory2, { recursive: true, mode: 448 });
22131
+ const root = await realpath(directory2);
22460
22132
  if (options.createAdditional)
22461
22133
  for (const other of options.additional ?? [])
22462
- await mkdir3(other, { recursive: true, mode: 448 });
22134
+ await mkdir(other, { recursive: true, mode: 448 });
22463
22135
  const initial = [root, ...options.additional ?? []];
22464
22136
  for (let attempt = 0; attempt < 3; attempt++) {
22465
22137
  const locations = await archiveLocations(initial, signal);
22466
22138
  const leases = [];
22467
22139
  try {
22468
22140
  for (const location of locations)
22469
- leases.push(await acquireLock(join10(location, ".media-writers"), { signal }));
22141
+ leases.push(await acquireLock(join7(location, ".media-writers"), { signal }));
22470
22142
  const current = await archiveLocations(initial, signal);
22471
22143
  if (current.some((location) => !locations.includes(location)))
22472
22144
  continue;
@@ -22486,7 +22158,7 @@ var withMediaArchiveLocks = /* @__PURE__ */ __name(async (directory2, signal, ru
22486
22158
  throw new CliError("validation_error", "archive locations changed during locking; run the command again");
22487
22159
  }, "withMediaArchiveLocks");
22488
22160
 
22489
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/media-archive.js
22161
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/media-archive.js
22490
22162
  var validateMediaSince = /* @__PURE__ */ __name((value, flag = "--since-time") => {
22491
22163
  if (value === void 0)
22492
22164
  return void 0;
@@ -22639,22 +22311,22 @@ var archiveMedia = /* @__PURE__ */ __name(async (ports, options) => {
22639
22311
  }, { create: true });
22640
22312
  }, "archiveMedia");
22641
22313
 
22642
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/media-archive-move.js
22643
- import { realpath as realpath5, unlink as unlink9 } from "node:fs/promises";
22644
- import { basename as basename5, dirname as dirname5, join as join11, resolve as resolve5 } from "node:path";
22314
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/media-archive-move.js
22315
+ import { realpath as realpath2, unlink as unlink5 } from "node:fs/promises";
22316
+ import { basename as basename3, dirname as dirname3, join as join8, resolve as resolve5 } from "node:path";
22645
22317
  var canonicalDestination = /* @__PURE__ */ __name(async (directory2) => {
22646
22318
  const path = resolve5(directory2);
22647
22319
  try {
22648
- return await realpath5(path);
22320
+ return await realpath2(path);
22649
22321
  } catch (error) {
22650
- if (!missingMediaFile(error) || dirname5(path) === path)
22322
+ if (!missingMediaFile(error) || dirname3(path) === path)
22651
22323
  throw error;
22652
- return join11(await canonicalDestination(dirname5(path)), basename5(path));
22324
+ return join8(await canonicalDestination(dirname3(path)), basename3(path));
22653
22325
  }
22654
22326
  }, "canonicalDestination");
22655
22327
  var image = /* @__PURE__ */ __name((entry) => ["photo", "image"].includes(entry.kind) || entry.mime?.startsWith("image/"), "image");
22656
22328
  var removeLocalCopy = /* @__PURE__ */ __name(async (root, entry, beforeWrite, signal) => {
22657
- const path = join11(root, entry.path);
22329
+ const path = join8(root, entry.path);
22658
22330
  let file2;
22659
22331
  try {
22660
22332
  file2 = await openOrdinaryFile(path);
@@ -22673,7 +22345,7 @@ var removeLocalCopy = /* @__PURE__ */ __name(async (root, entry, beforeWrite, si
22673
22345
  await beforeWrite();
22674
22346
  if (!await sameOrdinaryFile(path, identity))
22675
22347
  throw new CliError("validation_error", "local image was replaced; it was preserved");
22676
- await unlink9(path);
22348
+ await unlink5(path);
22677
22349
  await syncDirectory(root);
22678
22350
  } finally {
22679
22351
  await file2.close();
@@ -22684,7 +22356,7 @@ var moveMediaArchive = /* @__PURE__ */ __name(async (options) => {
22684
22356
  if (cutoff === void 0)
22685
22357
  throw new CliError("validation_error", "--before-time is required");
22686
22358
  const target2 = await canonicalDestination(options.archiveDirectory);
22687
- const source = await realpath5(options.directory);
22359
+ const source = await realpath2(options.directory);
22688
22360
  if (source === target2)
22689
22361
  throw new CliError("validation_error", "choose a different archive destination");
22690
22362
  return withMediaArchiveLocks(source, options.signal, async (root, beforeWrite) => {
@@ -22741,7 +22413,7 @@ var moveMediaArchive = /* @__PURE__ */ __name(async (options) => {
22741
22413
  for (const entry of candidates) {
22742
22414
  await beforeWrite();
22743
22415
  if (!known.has(mediaKey(entry))) {
22744
- const file2 = await openOrdinaryFile(join11(root, entry.path));
22416
+ const file2 = await openOrdinaryFile(join8(root, entry.path));
22745
22417
  try {
22746
22418
  const identity = {
22747
22419
  provider: entry.provider,
@@ -22768,7 +22440,7 @@ var moveMediaArchive = /* @__PURE__ */ __name(async (options) => {
22768
22440
  if (!await verifyMediaEntry(root, receipt, options.signal))
22769
22441
  throw new CliError("validation_error", "archive destination changed before rotation; the original was preserved");
22770
22442
  await beforeWrite();
22771
- await writeFileAtomic(join11(root, mediaManifestName(entry)), JSON.stringify(receipt), {
22443
+ await writeFileAtomic(join8(root, mediaManifestName(entry)), JSON.stringify(receipt), {
22772
22444
  beforePublish: beforeWrite,
22773
22445
  signal: options.signal
22774
22446
  });
@@ -22792,7 +22464,7 @@ var moveMediaArchive = /* @__PURE__ */ __name(async (options) => {
22792
22464
  }, { additional: [target2], createAdditional: !options.dryRun });
22793
22465
  }, "moveMediaArchive");
22794
22466
 
22795
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/model-downloads.js
22467
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/model-downloads.js
22796
22468
  var bytesOf = /* @__PURE__ */ __name((model) => model.files.reduce((sum2, file2) => sum2 + file2.bytes, 0), "bytesOf");
22797
22469
  var nativeRuntime = /* @__PURE__ */ __name(async ({ env, progress = /* @__PURE__ */ __name(() => {
22798
22470
  }, "progress") }) => {
@@ -22815,7 +22487,7 @@ var downloadTextModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
22815
22487
  }
22816
22488
  await nativeRuntime({ env, progress });
22817
22489
  progress(`${model.id}: loading it once to check it works`);
22818
- const { openEmbedder: openEmbedder2 } = await import("./embed-LCLTUVUD.js");
22490
+ const { openEmbedder: openEmbedder2 } = await import("./embed-7TVAPNP7.js");
22819
22491
  const embedder = await openEmbedder2(model, directory2);
22820
22492
  try {
22821
22493
  const [vector] = await embedder.embed(["check"], "query");
@@ -22836,7 +22508,7 @@ var downloadRerankModel = /* @__PURE__ */ __name(async (id2, { env, progress = /
22836
22508
  }
22837
22509
  await nativeRuntime({ env, progress });
22838
22510
  progress(`${model.id}: loading it once to check it works`);
22839
- const { openReranker } = await import("./rerank-QJ5NLZUU.js");
22511
+ const { openReranker } = await import("./rerank-6FU2JPCD.js");
22840
22512
  const reranker = await openReranker(model, directory2);
22841
22513
  try {
22842
22514
  await reranker.score("check", ["check"]);
@@ -22854,7 +22526,7 @@ var downloadImageModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
22854
22526
  await installFiles(placedImage(model, directory2), { progress });
22855
22527
  }
22856
22528
  progress(`${model.id}: loading it once to check it works`);
22857
- const { openPictureEmbedder } = await import("./embedder-O4WNEXUC.js");
22529
+ const { openPictureEmbedder } = await import("./embedder-YOOHWWN6.js");
22858
22530
  const embedder = await openPictureEmbedder(model, directory2);
22859
22531
  try {
22860
22532
  const vector = await embedder.embedQuery("check");
@@ -22866,7 +22538,7 @@ var downloadImageModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
22866
22538
  return { model, directory: directory2 };
22867
22539
  }, "downloadImageModel");
22868
22540
 
22869
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/account.js
22541
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/account.js
22870
22542
  var accountService = /* @__PURE__ */ __name((deps) => {
22871
22543
  const online = /* @__PURE__ */ __name(async (command) => {
22872
22544
  if (deps.offline)
@@ -22938,7 +22610,7 @@ var accountService = /* @__PURE__ */ __name((deps) => {
22938
22610
  };
22939
22611
  }, "accountService");
22940
22612
 
22941
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/domain/send-time.js
22613
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/domain/send-time.js
22942
22614
  var MINUTE = 6e4;
22943
22615
  var YEAR = 365 * 24 * 60 * MINUTE;
22944
22616
  var DELAY = /^(\d+)(m|h|d)$/;
@@ -22957,7 +22629,7 @@ var sendTime = /* @__PURE__ */ __name((value, now = Date.now(), flag = "--at-tim
22957
22629
  return new Date(at - at % MINUTE).toISOString();
22958
22630
  }, "sendTime");
22959
22631
 
22960
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/admin.js
22632
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/admin.js
22961
22633
  var recordMembership = /* @__PURE__ */ __name(async (deps, operationId, done2, change, fix, write) => {
22962
22634
  try {
22963
22635
  const held = await accountStoreIfOpen(deps);
@@ -22986,11 +22658,11 @@ var adminService = /* @__PURE__ */ __name((deps) => {
22986
22658
  const chat = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "chat", action: "create", personIds: personIds2, people: personIds2.length }, () => create(title.trim(), personIds2, { channel }), (made) => ({ chatId: made.id }));
22987
22659
  return { operationId, chat };
22988
22660
  }, "create"),
22989
- join: /* @__PURE__ */ __name(async (link5) => {
22661
+ join: /* @__PURE__ */ __name(async (link4) => {
22990
22662
  const connection = await online("chats join");
22991
- const join16 = capability(connection, "join", "join a chat by its link");
22663
+ const join13 = capability(connection, "join", "join a chat by its link");
22992
22664
  const operationId = newOperationId();
22993
- const joined = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "chat", action: "join" }, () => join16(link5.trim()), (answer) => "requested" in answer ? {} : { chatId: answer.id });
22665
+ const joined = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "chat", action: "join" }, () => join13(link4.trim()), (answer) => "requested" in answer ? {} : { chatId: answer.id });
22994
22666
  if ("requested" in joined)
22995
22667
  return { operationId, requested: true };
22996
22668
  const fix = deps.reads === "store" ? reportedFix(deps, joined.id, "left", "join") : `an online \`${typedCommand(deps.messenger.app.command, "chats list")}\` that shows the chat corrects it`;
@@ -23097,12 +22769,12 @@ var adminService = /* @__PURE__ */ __name((deps) => {
23097
22769
  const { already } = await guardedWrite(deps.guard, { operationId, chatId, kind: "chat", action: accept ? "requests.accept" : "requests.decline", people: 1 }, () => answer(chatId, personId, accept));
23098
22770
  return { operationId, chatId, personId, accepted: accept, already };
23099
22771
  }, "answerRequest"),
23100
- answerAllRequests: /* @__PURE__ */ __name(async (chat, accept, { link: link5 }) => {
22772
+ answerAllRequests: /* @__PURE__ */ __name(async (chat, accept, { link: link4 }) => {
23101
22773
  const connection = await online(`chats requests ${accept ? "accept" : "decline"} --all`);
23102
22774
  const list2 = capability(connection, "joinRequests", "read join requests");
23103
22775
  const answerAll = capability(connection, "answerAllJoinRequests", "answer every join request at once");
23104
22776
  const { id: chatId } = await connection.resolve(chat);
23105
- const page = await list2(chatId, { limit: 100, ...link5 === void 0 ? {} : { link: link5 } });
22777
+ const page = await list2(chatId, { limit: 100, ...link4 === void 0 ? {} : { link: link4 } });
23106
22778
  const counted2 = page.total ?? page.items.length;
23107
22779
  if (page.total === void 0 && page.hasMore)
23108
22780
  throw new CliError("validation_error", "too many requests to count; answer them by person, or by --link");
@@ -23116,7 +22788,7 @@ var adminService = /* @__PURE__ */ __name((deps) => {
23116
22788
  action: accept ? "requests.accept" : "requests.decline",
23117
22789
  count: counted2,
23118
22790
  people: counted2
23119
- }, () => answerAll(chatId, accept, link5));
22791
+ }, () => answerAll(chatId, accept, link4));
23120
22792
  return { operationId, chatId, accepted: accept, counted: counted2 };
23121
22793
  }, "answerAllRequests"),
23122
22794
  links: /* @__PURE__ */ __name(async (chat, window3) => {
@@ -23127,18 +22799,18 @@ var adminService = /* @__PURE__ */ __name((deps) => {
23127
22799
  const { id: chatId } = await connection.resolve(chat);
23128
22800
  return { chatId, ...await list2(chatId, window3) };
23129
22801
  }, "links"),
23130
- revokeLink: /* @__PURE__ */ __name(async (chat, link5) => {
23131
- if (link5.trim() === "")
22802
+ revokeLink: /* @__PURE__ */ __name(async (chat, link4) => {
22803
+ if (link4.trim() === "")
23132
22804
  throw new CliError("validation_error", "which link? give it as `chats links list` shows it");
23133
22805
  const connection = await online("chats links remove");
23134
22806
  const revoke = capability(connection, "revokeInviteLink", "revoke an invite link");
23135
22807
  const { id: chatId } = await connection.resolve(chat);
23136
22808
  const operationId = newOperationId();
23137
- const answer = await guardedWrite(deps.guard, { operationId, chatId, kind: "chat", action: "link.revoke" }, () => revoke(chatId, link5.trim()));
22809
+ const answer = await guardedWrite(deps.guard, { operationId, chatId, kind: "chat", action: "link.revoke" }, () => revoke(chatId, link4.trim()));
23138
22810
  return { operationId, chatId, ...answer };
23139
22811
  }, "revokeLink"),
23140
- updateLink: /* @__PURE__ */ __name(async (chat, link5, { approval, expires, maxUses }) => {
23141
- if (link5.trim() === "")
22812
+ updateLink: /* @__PURE__ */ __name(async (chat, link4, { approval, expires, maxUses }) => {
22813
+ if (link4.trim() === "")
23142
22814
  throw new CliError("validation_error", "which link? give it as `chats links list` shows it");
23143
22815
  if (approval === void 0 && expires === void 0 && maxUses === void 0)
23144
22816
  throw new CliError("validation_error", "nothing to change: give --approval, --no-approval, --expire-time or --max-uses");
@@ -23153,7 +22825,7 @@ var adminService = /* @__PURE__ */ __name((deps) => {
23153
22825
  ...maxUses === void 0 ? {} : { maxUses }
23154
22826
  };
23155
22827
  const operationId = newOperationId();
23156
- const answer = await guardedWrite(deps.guard, { operationId, chatId, kind: "chat", action: "link.update" }, () => update(chatId, link5.trim(), change));
22828
+ const answer = await guardedWrite(deps.guard, { operationId, chatId, kind: "chat", action: "link.update" }, () => update(chatId, link4.trim(), change));
23157
22829
  return { operationId, chatId, ...answer };
23158
22830
  }, "updateLink"),
23159
22831
  addMembers: /* @__PURE__ */ __name(async (chat, people, options) => {
@@ -23204,7 +22876,7 @@ var linkLimits = /* @__PURE__ */ __name(({ approval, expires, maxUses }) => {
23204
22876
  return expires === void 0 ? void 0 : sendTime(expires, Date.now(), "--expire-time");
23205
22877
  }, "linkLimits");
23206
22878
 
23207
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/mail-search.js
22879
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/mail-search.js
23208
22880
  var THREADS_PAGE = 500;
23209
22881
  var threadsOf = /* @__PURE__ */ __name(async (store, key) => {
23210
22882
  const account = await store.accounts.storedAccount(key).catch(() => void 0);
@@ -23283,7 +22955,7 @@ var readMail = /* @__PURE__ */ __name(async (store, locator, { before: before2 =
23283
22955
  return thread.slice(Math.max(0, at - before2), at + after + 1).map((hit) => hit.id === message ? { ...hit, anchor: true } : hit);
23284
22956
  }, "readMail");
23285
22957
 
23286
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/search-kind.js
22958
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/search-kind.js
23287
22959
  var NO_MAIL = "no_mail";
23288
22960
  var MAIL = "email";
23289
22961
  var listContextOf = /* @__PURE__ */ __name(async (store, account, app, stored) => {
@@ -23330,7 +23002,7 @@ var accountsOfKind = /* @__PURE__ */ __name((kind, chosen, held, explicit, comma
23330
23002
  return chosenMail.map(({ provider, account }) => ({ provider, account }));
23331
23003
  }, "accountsOfKind");
23332
23004
 
23333
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/messages-search.js
23005
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/messages-search.js
23334
23006
  var MAIL_FIELDS = /* @__PURE__ */ new Set(["to", "cc", "bcc", "subject", "mailbox", "label", "is"]);
23335
23007
  var positiveSources = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? node.field === "in" ? [node.value.toLowerCase()] : [] : node.clauses.filter(({ occur }) => occur !== "must_not").flatMap(({ node: node2 }) => positiveSources(node2)), "positiveSources");
23336
23008
  var prepareLucene = /* @__PURE__ */ __name(async (store, account, request, messenger) => {
@@ -23616,6 +23288,23 @@ var searchLucene = /* @__PURE__ */ __name(async (store, account, request, messen
23616
23288
  ...request.kind === "mail" ? { accounts: mailAccounts.map(({ provider, account: account2 }) => ({ resource: "mail", provider, account: account2 })) } : {}
23617
23289
  };
23618
23290
  }, "searchLucene");
23291
+ var countLucene = /* @__PURE__ */ __name(async (store, account, request, messenger, cap) => {
23292
+ const prepared = await prepareLucene(store, account, request, messenger);
23293
+ if (!prepared.scopeAccounts.length)
23294
+ return 0;
23295
+ const count4 = /* @__PURE__ */ __name((execution) => store.queries.countMatches(execution, cap), "count");
23296
+ const mailAccounts = prepared.scopeAccounts.filter(({ provider }) => provider === MAIL);
23297
+ const messages = await count4(prepared.execution);
23298
+ let mail = 0;
23299
+ if (mailAccounts.length)
23300
+ try {
23301
+ mail = await count4({ ...prepared.execution, accounts: mailAccounts, corpus: "mail" });
23302
+ } catch (error) {
23303
+ if (!(request.kind !== "mail" && error instanceof CliError && error.code === "validation_error"))
23304
+ throw error;
23305
+ }
23306
+ return messages === void 0 || mail === void 0 ? void 0 : messages + mail;
23307
+ }, "countLucene");
23619
23308
  var correctionsOf = /* @__PURE__ */ __name((items) => {
23620
23309
  const found = /* @__PURE__ */ new Map();
23621
23310
  for (const { corrections = [] } of items)
@@ -23661,7 +23350,7 @@ var statsLucene = /* @__PURE__ */ __name(async (store, account, request, messeng
23661
23350
  };
23662
23351
  }, "statsLucene");
23663
23352
 
23664
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/rankings-selection.js
23353
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/rankings-selection.js
23665
23354
  var RANKING_SELECTION_BYTES = 64 * 1024;
23666
23355
  var object = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0, "object");
23667
23356
  function invalid3(message = "ranking selection is invalid \u2014 obtain a new drilldown from stats top") {
@@ -23830,7 +23519,7 @@ var readRankingSelection = /* @__PURE__ */ __name(async (store, input) => {
23830
23519
  };
23831
23520
  }, "readRankingSelection");
23832
23521
 
23833
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/search-record.js
23522
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/search-record.js
23834
23523
  var canonical = /* @__PURE__ */ __name((value, nested = false) => Array.isArray(value) ? value.map((one) => canonical(one, true)) : value !== null && typeof value === "object" ? Object.fromEntries(Object.entries(value).filter(([, one]) => one !== void 0 && (nested || one !== false)).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([key, one]) => [key, canonical(one, true)])) : value, "canonical");
23835
23524
  var searchRecordOf = /* @__PURE__ */ __name((command, params) => ({
23836
23525
  command,
@@ -23840,7 +23529,7 @@ var searchRecordOf = /* @__PURE__ */ __name((command, params) => ({
23840
23529
  fieldsVersion: FIELD_VERSION
23841
23530
  }), "searchRecordOf");
23842
23531
 
23843
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/admin-statistics.js
23532
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/admin-statistics.js
23844
23533
  function invalid4(message) {
23845
23534
  throw new CliError("validation_error", message);
23846
23535
  }
@@ -24134,7 +23823,7 @@ var adminStatisticsService = /* @__PURE__ */ __name((deps) => ({
24134
23823
  }, "evidence")
24135
23824
  }), "adminStatisticsService");
24136
23825
 
24137
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/agenda.js
23826
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/agenda.js
24138
23827
  var DAY = 864e5;
24139
23828
  var CLAIMS = ["none", "mine", "others", "any"];
24140
23829
  var TASK_FIELDS = /* @__PURE__ */ new Set(["tag", "category", "claimed"]);
@@ -24172,9 +23861,9 @@ var agendaService = /* @__PURE__ */ __name((deps, now = Date.now) => ({
24172
23861
  return [];
24173
23862
  throw error;
24174
23863
  }), "find");
24175
- const open10 = await find();
23864
+ const open7 = await find();
24176
23865
  const tags = await taskTagFilters(store, parts.tasks);
24177
- const listed2 = parts.tasks ? await find(queryFilter(parts.tasks, taskColumns2(holder, at, tags), { command: "tasks agenda" })) : open10;
23866
+ const listed2 = parts.tasks ? await find(queryFilter(parts.tasks, taskColumns2(holder, at, tags), { command: "tasks agenda" })) : open7;
24178
23867
  const tasks = listed2.map((task2) => ({ task: task2, reasons: reasonsOf(task2, at, dueWithin) })).filter(({ reasons }) => reasons.length > 0).sort((a, b) => urgency(a.task) - urgency(b.task)).map(({ task: task2, reasons }) => ({
24179
23868
  id: task2.id,
24180
23869
  key: task2.key,
@@ -24214,23 +23903,31 @@ var agendaService = /* @__PURE__ */ __name((deps, now = Date.now) => ({
24214
23903
  chat: chat.chatId,
24215
23904
  message: lastMessageId
24216
23905
  }),
24217
- openTasks: open10.filter((task2) => chatOf(task2.source) === chat.chatId).map((task2) => task2.id)
23906
+ openTasks: open7.filter((task2) => chatOf(task2.source) === chat.chatId).map((task2) => task2.id)
24218
23907
  }));
23908
+ const silentFor = /* @__PURE__ */ __name((chat) => at - Date.parse(chat.lastMessageAt), "silentFor");
23909
+ const shown = {
23910
+ owed: chats.filter((chat) => chat.lastFromOwner === false && silentFor(chat) >= unanswered2),
23911
+ waiting: chats.filter((chat) => chat.lastFromOwner === true && silentFor(chat) >= waiting),
23912
+ unsynced: chats.filter((chat) => chat.lastMessage === null)
23913
+ };
23914
+ const covered = new Map((await chatCoverage(store, account, Object.values(shown).flatMap((list2) => list2.map(({ chatId }) => chatId)))).map((one) => [one.chatId, one]));
23915
+ const withCoverage = /* @__PURE__ */ __name((list2) => list2.map((chat) => ({ ...chat, coverage: covered.get(chat.chatId) })), "withCoverage");
24219
23916
  const inList = new Set((await store.tasks.categories()).map(({ name }) => name));
24220
23917
  const unlisted = /* @__PURE__ */ new Map();
24221
- for (const { category } of open10)
23918
+ for (const { category } of open7)
24222
23919
  if (category && !inList.has(category))
24223
23920
  unlisted.set(category, (unlisted.get(category) ?? 0) + 1);
24224
- const silentFor = /* @__PURE__ */ __name((chat) => at - Date.parse(chat.lastMessageAt), "silentFor");
24225
23921
  return {
24226
23922
  at: new Date(at).toISOString(),
23923
+ since: new Date(at - within).toISOString(),
24227
23924
  account: taskAccount(account),
24228
23925
  storedAt: activity.storedAt,
24229
23926
  stale: activity.storedAt === null || at - Date.parse(activity.storedAt) > DAY,
24230
23927
  tasks,
24231
- owed: chats.filter((chat) => chat.lastFromOwner === false && silentFor(chat) >= unanswered2),
24232
- waiting: chats.filter((chat) => chat.lastFromOwner === true && silentFor(chat) >= waiting),
24233
- unsynced: chats.filter((chat) => chat.lastMessage === null),
23928
+ owed: withCoverage(shown.owed),
23929
+ waiting: withCoverage(shown.waiting),
23930
+ unsynced: withCoverage(shown.unsynced),
24234
23931
  assigned,
24235
23932
  unlistedCategories: [...unlisted].sort().map(([name, openTasks]) => ({ name, openTasks }))
24236
23933
  };
@@ -24316,7 +24013,19 @@ var agendaItem = /* @__PURE__ */ __name((shown) => {
24316
24013
  last_message: one.lastMessage,
24317
24014
  last_message_at: one.lastMessageAt,
24318
24015
  last_from_owner: one.lastFromOwner,
24319
- open_tasks: one.openTasks
24016
+ open_tasks: one.openTasks,
24017
+ completeness: {
24018
+ state: one.coverage.completeness.state,
24019
+ up_to_date: one.coverage.completeness.upToDate,
24020
+ gaps: one.coverage.completeness.gaps,
24021
+ reaches_start: one.coverage.completeness.reachesStart,
24022
+ fetched_at: one.coverage.completeness.fetchedAt
24023
+ },
24024
+ held: {
24025
+ messages: one.coverage.held.messages,
24026
+ oldest_at: one.coverage.held.oldestAt,
24027
+ newest_at: one.coverage.held.newestAt
24028
+ }
24320
24029
  }), "chat");
24321
24030
  return {
24322
24031
  at: shown.at,
@@ -24356,10 +24065,10 @@ var agendaItem = /* @__PURE__ */ __name((shown) => {
24356
24065
  };
24357
24066
  }, "agendaItem");
24358
24067
 
24359
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/archive.js
24068
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/archive.js
24360
24069
  import { setTimeout as sleep3 } from "node:timers/promises";
24361
24070
 
24362
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/backfill-estimate.js
24071
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/backfill-estimate.js
24363
24072
  var REQUEST_MS = 400;
24364
24073
  var estimateBackfill = /* @__PURE__ */ __name(({ ranges, held, newest, page, maxPages, pauseMs }) => {
24365
24074
  const lowest = ranges[0];
@@ -24382,13 +24091,13 @@ var estimateBackfill = /* @__PURE__ */ __name(({ ranges, held, newest, page, max
24382
24091
  };
24383
24092
  }, "estimateBackfill");
24384
24093
 
24385
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/domain/recovery.js
24094
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/domain/recovery.js
24386
24095
  var withRecovery = /* @__PURE__ */ __name((error) => ({
24387
24096
  ...error,
24388
24097
  retryable: typeof error.retryable === "boolean" ? error.retryable : error.code === "rate_limited" || error.status === 429
24389
24098
  }), "withRecovery");
24390
24099
 
24391
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/batch.js
24100
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/batch.js
24392
24101
  var actionable = /* @__PURE__ */ __name((error) => {
24393
24102
  if (isCliFailure(error))
24394
24103
  return withRecovery({ code: error.code, message: error.message, ...error.details });
@@ -24471,7 +24180,7 @@ var mergeBatches = /* @__PURE__ */ __name((a, b) => {
24471
24180
  };
24472
24181
  }, "mergeBatches");
24473
24182
 
24474
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/patience.js
24183
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/patience.js
24475
24184
  import { setTimeout as sleep2 } from "node:timers/promises";
24476
24185
  var LONGEST_WAIT_MS = 5 * 60 * 1e3;
24477
24186
  var patiently = /* @__PURE__ */ __name(async (request, note, stop) => {
@@ -24494,7 +24203,7 @@ var patiently = /* @__PURE__ */ __name(async (request, note, stop) => {
24494
24203
  }
24495
24204
  }, "patiently");
24496
24205
 
24497
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/images/context/index.js
24206
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/images/context/index.js
24498
24207
  var CONTEXT_MESSAGES2 = 3;
24499
24208
  var CONTEXT_MINUTES = 10;
24500
24209
  var MAX_CHARS = 1200;
@@ -24518,12 +24227,12 @@ var context = {
24518
24227
  }, "describe")
24519
24228
  };
24520
24229
 
24521
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/images/registry.js
24230
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/images/registry.js
24522
24231
  var BUILT_INS = [context];
24523
24232
  var providers = [...BUILT_INS];
24524
24233
  var registeredImageProviders = /* @__PURE__ */ __name(() => providers, "registeredImageProviders");
24525
24234
 
24526
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/conversations.js
24235
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/conversations.js
24527
24236
  var READ_PAGE = 5e3;
24528
24237
  var CHAIN = 50;
24529
24238
  var CONVERSATION_QUERY = {
@@ -24654,7 +24363,7 @@ var conversationsService = /* @__PURE__ */ __name((deps) => {
24654
24363
  }, "clearAnswers"),
24655
24364
  links: /* @__PURE__ */ __name(async (chat, message) => {
24656
24365
  const { store, chatId } = await found(chat);
24657
- const chosenOf = /* @__PURE__ */ __name((links) => links.find((link5) => !link5.stale), "chosenOf");
24366
+ const chosenOf = /* @__PURE__ */ __name((links) => links.find((link4) => !link4.stale), "chosenOf");
24658
24367
  const own = await store.conversations.links(chatId, message);
24659
24368
  const chosen = chosenOf(own);
24660
24369
  const chain = [];
@@ -24664,7 +24373,7 @@ var conversationsService = /* @__PURE__ */ __name((deps) => {
24664
24373
  chain.push(parent);
24665
24374
  parent = chosenOf(await store.conversations.links(chatId, parent))?.parentId ?? null;
24666
24375
  }
24667
- return { chat: chatId, message, links: own.map((link5) => ({ ...link5, chosen: link5 === chosen })), chain };
24376
+ return { chat: chatId, message, links: own.map((link4) => ({ ...link4, chosen: link4 === chosen })), chain };
24668
24377
  }, "links")
24669
24378
  };
24670
24379
  }, "conversationsService");
@@ -24675,7 +24384,7 @@ var sized = /* @__PURE__ */ __name((size2) => {
24675
24384
  return size2;
24676
24385
  }, "sized");
24677
24386
 
24678
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/embeddings-maintenance.js
24387
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/embeddings-maintenance.js
24679
24388
  var REFRESH_BOUNDS = { maxChats: 20, maxChunks: 2e3 };
24680
24389
  var MESSAGE_PAGE = 5e3;
24681
24390
  var PER_SESSION = 8;
@@ -24694,7 +24403,7 @@ var embeddingTarget = /* @__PURE__ */ __name((deps, choice = DEFAULT_TEXT_MODEL)
24694
24403
  price: remote.price,
24695
24404
  installed: true,
24696
24405
  perBatch: PER_REQUEST * concurrency,
24697
- open: /* @__PURE__ */ __name(async () => (await import("./remote-Z3HW42CH.js")).openRemote(remote, apiKey, { concurrency }), "open")
24406
+ open: /* @__PURE__ */ __name(async () => (await import("./remote-2VYXGOM4.js")).openRemote(remote, apiKey, { concurrency }), "open")
24698
24407
  };
24699
24408
  }
24700
24409
  const model = textModel(choice);
@@ -24711,7 +24420,7 @@ var embeddingTarget = /* @__PURE__ */ __name((deps, choice = DEFAULT_TEXT_MODEL)
24711
24420
  if (!isTextModelInstalled(model, directory2))
24712
24421
  throw notDownloaded(model.id);
24713
24422
  if (apart) {
24714
- const { openProcess } = await import("./process-JC76J5UD.js");
24423
+ const { openProcess } = await import("./process-4PRR3MLT.js");
24715
24424
  return openProcess(model, directory2, { threads: threads ?? defaultThreads() });
24716
24425
  }
24717
24426
  return openEmbedder(model, directory2, { threads: threads ?? defaultThreads() });
@@ -25000,7 +24709,7 @@ var shaped = /* @__PURE__ */ __name(({ chatId, builtAt, algorithmVersion, pendin
25000
24709
  return { ...one, state };
25001
24710
  }, "shaped");
25002
24711
 
25003
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/search-catchup.js
24712
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/search-catchup.js
25004
24713
  var CATCH_UP_BOUNDS = { maxChunks: 500, maxMessages: 1e4, timeMs: 3e4 };
25005
24714
  var validateCatchUpBounds = /* @__PURE__ */ __name((options) => {
25006
24715
  for (const [key, value, maximum] of [
@@ -25053,7 +24762,7 @@ var catchUpSearch = /* @__PURE__ */ __name(async (deps, chat, options, signal, c
25053
24762
  }
25054
24763
  }, "catchUpSearch");
25055
24764
 
25056
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/archive.js
24765
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/archive.js
25057
24766
  var pushed = /* @__PURE__ */ __name((deps, what) => {
25058
24767
  if (deps.reads === "store") {
25059
24768
  throw new CliError("validation_error", `${what} asks for older history, and this messenger pushes its history instead \u2014 keep \`${typedCommand(deps.messenger.app.command, "serve")}\` running`);
@@ -25370,8 +25079,8 @@ var timeOfKey = /* @__PURE__ */ __name(async (store, account, chatId, key, byTim
25370
25079
  return message?.timestamp ?? fallback;
25371
25080
  }, "timeOfKey");
25372
25081
 
25373
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/archive-gaps.js
25374
- import { createHash as createHash6, randomUUID as randomUUID6 } from "node:crypto";
25082
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/archive-gaps.js
25083
+ import { createHash as createHash6, randomUUID as randomUUID4 } from "node:crypto";
25375
25084
  var GAP_BOUNDS = { maxGaps: 5, limit: 500, timeMs: 3e4 };
25376
25085
  var validateRepair = /* @__PURE__ */ __name((messenger, options) => {
25377
25086
  const maxGaps = options.maxGaps ?? GAP_BOUNDS.maxGaps;
@@ -25430,7 +25139,7 @@ var gapsService = /* @__PURE__ */ __name((deps) => {
25430
25139
  if (options.fingerprint !== void 0 && options.fingerprint !== before2.fingerprint)
25431
25140
  throw new CliError("validation_error", "the gap plan changed; inspect it again before repairing");
25432
25141
  const store = await deps.store();
25433
- const holder = randomUUID6();
25142
+ const holder = randomUUID4();
25434
25143
  if (!await store.sync.claim(before2.account, before2.chat, "gaps", holder, timeMs + 5e3))
25435
25144
  throw new CliError("validation_error", "another gap repair holds this chat; retry after it finishes");
25436
25145
  const started = Date.now();
@@ -25507,35 +25216,35 @@ var gapsService = /* @__PURE__ */ __name((deps) => {
25507
25216
  return { plan, repair };
25508
25217
  }, "gapsService");
25509
25218
 
25510
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/attachments.js
25219
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/attachments.js
25511
25220
  import { createHash as createHash8 } from "node:crypto";
25512
- import { constants as constants4 } from "node:fs";
25513
- import { open as open9, readFile, stat as stat2 } from "node:fs/promises";
25221
+ import { constants as constants2 } from "node:fs";
25222
+ import { open as open6, readFile, stat as stat2 } from "node:fs/promises";
25514
25223
 
25515
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/attachments/directory.js
25516
- import { lstat as lstat5, readdir as readdir3, realpath as realpath6 } from "node:fs/promises";
25517
- import { basename as basename6, join as join12, relative as relative2, sep as sep2 } from "node:path";
25224
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/attachments/directory.js
25225
+ import { lstat as lstat2, readdir as readdir2, realpath as realpath3 } from "node:fs/promises";
25226
+ import { basename as basename4, join as join9, relative as relative2, sep as sep2 } from "node:path";
25518
25227
  var MAX_FILES = 1e4;
25519
25228
  var directoryPaths = /* @__PURE__ */ __name(async (store, chat, directory2, app, env) => {
25520
25229
  if (refusedPlace(directory2, app, env))
25521
25230
  throw new CliError("validation_error", "--from-dir cannot read credential folders, the CLI's own folders or the message store");
25522
- const root = await realpath6(directory2).catch(() => {
25231
+ const root = await realpath3(directory2).catch(() => {
25523
25232
  throw new CliError("validation_error", "--from-dir must name an existing directory");
25524
25233
  });
25525
- const names2 = await readdir3(root).catch(() => {
25234
+ const names2 = await readdir2(root).catch(() => {
25526
25235
  throw new CliError("validation_error", "--from-dir must name a readable directory");
25527
25236
  });
25528
25237
  if (names2.length > MAX_FILES)
25529
25238
  throw new CliError("validation_error", "--from-dir holds too many files; use a smaller directory");
25530
25239
  const files = /* @__PURE__ */ new Map();
25531
25240
  for (const name of names2) {
25532
- const path = join12(root, name);
25533
- const info = await lstat5(path);
25241
+ const path = join9(root, name);
25242
+ const info = await lstat2(path);
25534
25243
  if (info.isSymbolicLink())
25535
25244
  throw new CliError("validation_error", "--from-dir cannot read symbolic links");
25536
25245
  if (!info.isFile())
25537
25246
  continue;
25538
- const canonical2 = await realpath6(path);
25247
+ const canonical2 = await realpath3(path);
25539
25248
  if (refusedPlace(canonical2, app, env))
25540
25249
  throw new CliError("validation_error", "--from-dir cannot read credential files, the CLI's own files or the message store");
25541
25250
  const inside2 = relative2(root, canonical2);
@@ -25553,20 +25262,20 @@ var directoryPaths = /* @__PURE__ */ __name(async (store, chat, directory2, app,
25553
25262
  group.push(file2);
25554
25263
  groups.set(file2.messageId, group);
25555
25264
  if (file2.name)
25556
- counts.set(basename6(file2.name), (counts.get(basename6(file2.name)) ?? 0) + 1);
25265
+ counts.set(basename4(file2.name), (counts.get(basename4(file2.name)) ?? 0) + 1);
25557
25266
  }
25558
25267
  const choices = /* @__PURE__ */ new Map();
25559
25268
  for (const group of groups.values()) {
25560
25269
  group.sort((a, b) => a.position - b.position);
25561
25270
  const candidates = group.map((file2, index) => {
25562
25271
  const prefix = `${file2.messageId}-${index + 1}`;
25563
- return [...files].filter(([name]) => name === prefix || name.startsWith(`${prefix}.`) || file2.name !== null && name === `${prefix}-${basename6(file2.name)}`).map(([, path]) => path);
25272
+ return [...files].filter(([name]) => name === prefix || name.startsWith(`${prefix}.`) || file2.name !== null && name === `${prefix}-${basename4(file2.name)}`).map(([, path]) => path);
25564
25273
  });
25565
25274
  if (candidates.some((paths) => paths.length > 1))
25566
25275
  throw new CliError("validation_error", "more than one directory file matches a download ordinal");
25567
25276
  const complete = candidates.every((paths) => paths.length === 1);
25568
25277
  group.forEach((file2, index) => {
25569
- const own = file2.name === null ? void 0 : basename6(file2.name);
25278
+ const own = file2.name === null ? void 0 : basename4(file2.name);
25570
25279
  const named2 = own && counts.get(own) === 1 ? files.get(own) : void 0;
25571
25280
  const canonical2 = complete ? candidates[index]?.[0] : void 0;
25572
25281
  if (named2 && canonical2 && named2 !== canonical2 || !complete && own && files.has(own) && (counts.get(own) ?? 0) > 1)
@@ -25583,15 +25292,15 @@ var directoryPaths = /* @__PURE__ */ __name(async (store, chat, directory2, app,
25583
25292
  return choices;
25584
25293
  }, "directoryPaths");
25585
25294
 
25586
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/attachments/documents.js
25295
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/attachments/documents.js
25587
25296
  import { posix } from "node:path";
25588
25297
 
25589
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/attachments/container.js
25298
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/attachments/container.js
25590
25299
  import { setImmediate as tick } from "node:timers/promises";
25591
25300
  import { crc32 } from "node:zlib";
25592
25301
  var import_xmldom = __toESM(require_lib(), 1);
25593
25302
 
25594
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/attachments/encoding.js
25303
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/attachments/encoding.js
25595
25304
  var import_chardet = __toESM(require_lib2(), 1);
25596
25305
  var import_iconv_lite = __toESM(require_lib3(), 1);
25597
25306
  var SAMPLE = 65536;
@@ -25693,7 +25402,7 @@ var decodeXml = /* @__PURE__ */ __name((bytes2) => {
25693
25402
  return result.text;
25694
25403
  }, "decodeXml");
25695
25404
 
25696
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/attachments/container.js
25405
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/attachments/container.js
25697
25406
  var MAX_PART = 10 * 1024 * 1024;
25698
25407
  var MAX_ENTRIES = 1e3;
25699
25408
  var decoder = new TextDecoder("utf-8", { fatal: true });
@@ -25908,7 +25617,7 @@ var elements = /* @__PURE__ */ __name((node, name, namespace) => {
25908
25617
  return found;
25909
25618
  }, "elements");
25910
25619
 
25911
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/attachments/sheets.js
25620
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/attachments/sheets.js
25912
25621
  var columnName = /* @__PURE__ */ __name((column) => {
25913
25622
  let name = "";
25914
25623
  for (let rest = column; rest > 0; rest = Math.floor((rest - 1) / 26))
@@ -25963,7 +25672,7 @@ var sheetText = /* @__PURE__ */ __name((sheets2, maxChars = MAX_TEXT_CHARS) => {
25963
25672
  return { text: parts.join("").trim(), truncated: false };
25964
25673
  }, "sheetText");
25965
25674
 
25966
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/attachments/documents.js
25675
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/attachments/documents.js
25967
25676
  var OFFICE = "urn:oasis:names:tc:opendocument:xmlns:office:1.0";
25968
25677
  var TEXT = "urn:oasis:names:tc:opendocument:xmlns:text:1.0";
25969
25678
  var TABLE = "urn:oasis:names:tc:opendocument:xmlns:table:1.0";
@@ -26363,27 +26072,27 @@ var readDocument = /* @__PURE__ */ __name(async (bytes2, kind, signal) => {
26363
26072
  }
26364
26073
  }, "readDocument");
26365
26074
 
26366
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/attachments/extract.js
26075
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/attachments/extract.js
26367
26076
  import { extname as extname3 } from "node:path";
26368
26077
 
26369
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/readers/engine.js
26078
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/readers/engine.js
26370
26079
  import { readFileSync as readFileSync2 } from "node:fs";
26371
- import { dirname as dirname6, extname as extname2, join as join13 } from "node:path";
26080
+ import { dirname as dirname4, extname as extname2, join as join10 } from "node:path";
26372
26081
  import { fileURLToPath } from "node:url";
26373
26082
  var BUILT_IN = ["unpdf", "mammoth", "word-extractor", "linkedom", "defuddle/node"];
26374
26083
  var ENGINES = [...BUILT_IN, "@napi-rs/canvas"];
26375
26084
  var isMissing = /* @__PURE__ */ __name((error, name) => error?.code === "ERR_MODULE_NOT_FOUND" && String(error.message).includes(name), "isMissing");
26376
26085
  var versionOf = /* @__PURE__ */ __name((name) => {
26377
26086
  try {
26378
- let directory2 = dirname6(fileURLToPath(resolveFrom(new URL("readers/engine.js", import.meta.resolve("@wirecat/cli-core")).href, name)));
26087
+ let directory2 = dirname4(fileURLToPath(resolveFrom(new URL("readers/engine.js", import.meta.resolve("@wirecat/cli-core")).href, name)));
26379
26088
  for (let depth = 0; depth < 6; depth += 1) {
26380
26089
  try {
26381
- const manifest = JSON.parse(readFileSync2(join13(directory2, "package.json"), "utf8"));
26090
+ const manifest = JSON.parse(readFileSync2(join10(directory2, "package.json"), "utf8"));
26382
26091
  if (manifest.name === name && manifest.version)
26383
26092
  return `${name}@${manifest.version}`;
26384
26093
  } catch {
26385
26094
  }
26386
- directory2 = dirname6(directory2);
26095
+ directory2 = dirname4(directory2);
26387
26096
  }
26388
26097
  } catch {
26389
26098
  }
@@ -26427,7 +26136,7 @@ var derived = /* @__PURE__ */ __name((bytes2, extractor, read) => {
26427
26136
  }
26428
26137
  }, "derived");
26429
26138
 
26430
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/readers/image/index.js
26139
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/readers/image/index.js
26431
26140
  var IMAGES = /* @__PURE__ */ new Set([".jpg", ".jpeg", ".png", ".webp", ".gif", ".heic", ".tif", ".tiff", ".bmp"]);
26432
26141
  var image2 = {
26433
26142
  id: "image",
@@ -26436,7 +26145,7 @@ var image2 = {
26436
26145
  read: /* @__PURE__ */ __name(async () => ({ status: "needs-agent" }), "read")
26437
26146
  };
26438
26147
 
26439
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/readers/doc/index.js
26148
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/readers/doc/index.js
26440
26149
  var OLE = "\xD0\xCF\xE0\xA1\xB1\xE1";
26441
26150
  var doc = {
26442
26151
  id: "doc",
@@ -26448,7 +26157,7 @@ var doc = {
26448
26157
  }), "read")
26449
26158
  };
26450
26159
 
26451
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/readers/docx/index.js
26160
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/readers/docx/index.js
26452
26161
  var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
26453
26162
  var docx = {
26454
26163
  id: "docx",
@@ -26461,7 +26170,7 @@ var docx = {
26461
26170
  }), "read")
26462
26171
  };
26463
26172
 
26464
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/attachments/markup.js
26173
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/attachments/markup.js
26465
26174
  var import_iconv_lite2 = __toESM(require_lib3(), 1);
26466
26175
  var RTF_SKIPPED = /* @__PURE__ */ new Set([
26467
26176
  "fonttbl",
@@ -26604,11 +26313,11 @@ var dropHidden = /* @__PURE__ */ __name((source) => {
26604
26313
  const unclosed = /* @__PURE__ */ new Set();
26605
26314
  let out = "";
26606
26315
  let kept = 0;
26607
- for (const open10 of source.matchAll(HTML_DROPPED_OPEN)) {
26608
- const name = open10[1].toLowerCase();
26609
- if (open10.index < kept || unclosed.has(name))
26316
+ for (const open7 of source.matchAll(HTML_DROPPED_OPEN)) {
26317
+ const name = open7[1].toLowerCase();
26318
+ if (open7.index < kept || unclosed.has(name))
26610
26319
  continue;
26611
- const gt = source.indexOf(">", open10.index + open10[0].length);
26320
+ const gt = source.indexOf(">", open7.index + open7[0].length);
26612
26321
  if (gt < 0)
26613
26322
  break;
26614
26323
  const close = HTML_DROPPED_CLOSE.get(name);
@@ -26618,7 +26327,7 @@ var dropHidden = /* @__PURE__ */ __name((source) => {
26618
26327
  unclosed.add(name);
26619
26328
  continue;
26620
26329
  }
26621
- out += source.slice(kept, open10.index);
26330
+ out += source.slice(kept, open7.index);
26622
26331
  kept = end.index + end[0].length;
26623
26332
  }
26624
26333
  return out + source.slice(kept);
@@ -26637,7 +26346,7 @@ var htmlText = /* @__PURE__ */ __name((source) => {
26637
26346
  }, "htmlText");
26638
26347
  var safeChar = /* @__PURE__ */ __name((code, fallback) => code > 0 && code <= 1114111 ? String.fromCodePoint(code) : fallback, "safeChar");
26639
26348
 
26640
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/readers/html/page.js
26349
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/readers/html/page.js
26641
26350
  var clean = /* @__PURE__ */ __name((value) => typeof value === "string" ? value.replace(/\s+/g, " ").trim() : "", "clean");
26642
26351
  var namesIn = /* @__PURE__ */ __name((value) => [value].flat().map((entry) => typeof entry === "string" ? clean(entry) : clean(entry?.name)).filter(Boolean).join(", "), "namesIn");
26643
26352
  var jsonLdNodes = /* @__PURE__ */ __name((document) => {
@@ -26693,7 +26402,7 @@ var markdownSections = /* @__PURE__ */ __name((text) => {
26693
26402
  return found.map((section, index) => ({ ...section, end: found[index + 1]?.start ?? text.length }));
26694
26403
  }, "markdownSections");
26695
26404
 
26696
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/readers/html/index.js
26405
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/readers/html/index.js
26697
26406
  var HTML = /* @__PURE__ */ new Set([".html", ".htm", ".xhtml"]);
26698
26407
  var first = /* @__PURE__ */ __name((...values) => values.find((value) => typeof value === "string" && value !== ""), "first");
26699
26408
  var loaded = /* @__PURE__ */ __name(async (load, name) => {
@@ -26731,8 +26440,8 @@ var readPage = /* @__PURE__ */ __name(async (source, load) => {
26731
26440
  };
26732
26441
  }, "readPage");
26733
26442
  var titleOf = /* @__PURE__ */ __name((source) => {
26734
- const open10 = /<title/i.exec(source);
26735
- const gt = open10 ? source.indexOf(">", open10.index + open10[0].length) : -1;
26443
+ const open7 = /<title/i.exec(source);
26444
+ const gt = open7 ? source.indexOf(">", open7.index + open7[0].length) : -1;
26736
26445
  if (gt < 0)
26737
26446
  return "";
26738
26447
  const close = /<\/title\s*>/gi;
@@ -26764,7 +26473,7 @@ var html = {
26764
26473
  }, "read")
26765
26474
  };
26766
26475
 
26767
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/readers/office/index.js
26476
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/readers/office/index.js
26768
26477
  var office = {
26769
26478
  id: "office",
26770
26479
  version: documentExtractor("odt"),
@@ -26775,7 +26484,7 @@ var office = {
26775
26484
  }, "read")
26776
26485
  };
26777
26486
 
26778
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/readers/pdf/index.js
26487
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/readers/pdf/index.js
26779
26488
  var pdf = {
26780
26489
  id: "pdf",
26781
26490
  version: "unpdf",
@@ -26842,7 +26551,7 @@ var pdf = {
26842
26551
  }), "read")
26843
26552
  };
26844
26553
 
26845
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/readers/plain/index.js
26554
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/readers/plain/index.js
26846
26555
  var PLAIN = /* @__PURE__ */ new Set([".txt", ".md", ".markdown", ".csv", ".tsv", ".json", ".log"]);
26847
26556
  var isPlain = /* @__PURE__ */ __name((hint) => PLAIN.has(extensionOf(hint)) || hint.mime?.startsWith("text/") || hint.mime === "application/json", "isPlain");
26848
26557
  var readPlain = /* @__PURE__ */ __name((bytes2) => {
@@ -26862,7 +26571,7 @@ var plain = {
26862
26571
  read: /* @__PURE__ */ __name(async (bytes2) => readPlain(bytes2), "read")
26863
26572
  };
26864
26573
 
26865
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/readers/rtf/index.js
26574
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/readers/rtf/index.js
26866
26575
  var rtf = {
26867
26576
  id: "rtf",
26868
26577
  version: "v1",
@@ -26870,10 +26579,10 @@ var rtf = {
26870
26579
  read: /* @__PURE__ */ __name(async (bytes2) => derived(bytes2, "rtf:v1", rtfText), "read")
26871
26580
  };
26872
26581
 
26873
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
26874
- import { basename as basename7 } from "node:path";
26582
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
26583
+ import { basename as basename5 } from "node:path";
26875
26584
 
26876
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/attachments/csv-spans.js
26585
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/attachments/csv-spans.js
26877
26586
  var delimitedSpans = /* @__PURE__ */ __name((text, delimiter, maxCells = 1e4) => {
26878
26587
  const cells = [];
26879
26588
  let row = 1, column = 1, start = 0, quoted = false, truncated = false;
@@ -26911,7 +26620,7 @@ var delimitedSpans = /* @__PURE__ */ __name((text, delimiter, maxCells = 1e4) =>
26911
26620
  return { cells, truncated };
26912
26621
  }, "delimitedSpans");
26913
26622
 
26914
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
26623
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
26915
26624
  var DELIMITED = {
26916
26625
  ".csv": ",",
26917
26626
  ".tsv": " ",
@@ -26941,7 +26650,7 @@ var sheets = {
26941
26650
  column,
26942
26651
  value: unquoted(result.text.slice(start, end))
26943
26652
  }));
26944
- const name = basename7(hint.name ?? hint.path, extensionOf(hint)) || "Sheet";
26653
+ const name = basename5(hint.name ?? hint.path, extensionOf(hint)) || "Sheet";
26945
26654
  const { text, truncated } = sheetText([{ name, cells }]);
26946
26655
  return text === "" ? { status: "needs-agent", extractor } : { status: "extracted", text, extractor, ...truncated || spans.truncated ? { truncated: true } : {} };
26947
26656
  } catch {
@@ -26950,7 +26659,7 @@ var sheets = {
26950
26659
  }, "read")
26951
26660
  };
26952
26661
 
26953
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/readers/registry.js
26662
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/readers/registry.js
26954
26663
  var BUILT_INS2 = [office, pdf, docx, doc, rtf, html, sheets, plain, image2];
26955
26664
  var HEAD_BYTES = 1024;
26956
26665
  var readers = [...BUILT_INS2];
@@ -26960,7 +26669,7 @@ var readWithRegistry = /* @__PURE__ */ __name(async (bytes2, hint, context2) =>
26960
26669
  return reader ? reader.read(bytes2, hint, context2) : { status: "unsupported" };
26961
26670
  }, "readWithRegistry");
26962
26671
 
26963
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/attachments/extract.js
26672
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/attachments/extract.js
26964
26673
  var importEngine = /* @__PURE__ */ __name((name) => importFrom(new URL("attachments/extract.js", import.meta.resolve("@wirecat/cli-core")).href, name), "importEngine");
26965
26674
  var extensionOf2 = /* @__PURE__ */ __name(({ name, path }) => extname3(name ?? path).toLowerCase(), "extensionOf");
26966
26675
  var extractText = /* @__PURE__ */ __name(async (bytes2, hint, load, signal, env = process.env) => {
@@ -28039,7 +27748,7 @@ function imageSize(input) {
28039
27748
  }
28040
27749
  __name(imageSize, "imageSize");
28041
27750
 
28042
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/attachments/ocr.js
27751
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/attachments/ocr.js
28043
27752
  var MAX_PAGES = 20;
28044
27753
  var MAX_PIXELS = 2e7;
28045
27754
  var cancelled2 = /* @__PURE__ */ __name((signal) => {
@@ -28190,7 +27899,7 @@ var ocrPdf = /* @__PURE__ */ __name(async (bytes2, pipeline2, load, signal) => {
28190
27899
  }
28191
27900
  }, "ocrPdf");
28192
27901
 
28193
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/attachments/pdf-preview.js
27902
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/attachments/pdf-preview.js
28194
27903
  var pdfPreview = /* @__PURE__ */ __name(async (bytes2, page, signal, load = importEngine, env = process.env) => {
28195
27904
  const limits = pdfPreviewLimits(env);
28196
27905
  const cancelled4 = /* @__PURE__ */ __name(() => {
@@ -28267,10 +27976,10 @@ var pdfPreview = /* @__PURE__ */ __name(async (bytes2, page, signal, load = impo
28267
27976
  }
28268
27977
  }, "pdfPreview");
28269
27978
 
28270
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/attachments/transfer.js
27979
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/attachments/transfer.js
28271
27980
  import { createHash as createHash7 } from "node:crypto";
28272
- import { constants as constants3 } from "node:fs";
28273
- import { lstat as lstat6, open as open8 } from "node:fs/promises";
27981
+ import { constants } from "node:fs";
27982
+ import { lstat as lstat3, open as open5 } from "node:fs/promises";
28274
27983
  var MAX_CHUNK_BYTES = 1024 * 1024;
28275
27984
  var validateWindow = /* @__PURE__ */ __name(({ offsetBytes = 0, chunkBytes = 524288, ifSha256 }) => {
28276
27985
  if (!Number.isSafeInteger(offsetBytes) || offsetBytes < 0 || !Number.isSafeInteger(chunkBytes) || chunkBytes < 1 || chunkBytes > MAX_CHUNK_BYTES || ifSha256 !== void 0 && !/^[a-f0-9]{64}$/i.test(ifSha256))
@@ -28286,14 +27995,14 @@ var retainedBytes = /* @__PURE__ */ __name(async (path, options, captureFile = f
28286
27995
  }, "cancelled");
28287
27996
  cancelled4();
28288
27997
  try {
28289
- const before2 = await lstat6(path);
27998
+ const before2 = await lstat3(path);
28290
27999
  if (!before2.isFile() || before2.isSymbolicLink())
28291
28000
  throw new CliError("validation_error", "the retained attachment must be a regular file");
28292
28001
  if (before2.size > maxBytes)
28293
28002
  throw new CliError("validation_error", `the retained attachment exceeds ${maxBytes / 1024 / 1024} MiB; configure MESSAGING_ATTACHMENT_MAX_MIB`);
28294
28003
  if (offsetBytes > before2.size)
28295
28004
  throw new CliError("validation_error", "the byte offset is past the end of this attachment");
28296
- const handle = await open8(path, constants3.O_RDONLY | (constants3.O_NOFOLLOW ?? 0) | (constants3.O_NONBLOCK ?? 0));
28005
+ const handle = await open5(path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0));
28297
28006
  try {
28298
28007
  const opened = await handle.stat();
28299
28008
  if (!opened.isFile() || opened.ino !== before2.ino || opened.dev !== before2.dev || opened.size !== before2.size)
@@ -28375,7 +28084,7 @@ var transferMime = /* @__PURE__ */ __name((head, hint, name = null) => {
28375
28084
  return hint !== null && /^[a-z0-9.+-]+\/[a-z0-9.+-]+$/i.test(hint) ? hint : "application/octet-stream";
28376
28085
  }, "transferMime");
28377
28086
 
28378
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/attachments.js
28087
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/attachments.js
28379
28088
  var ATTACHMENT_QUERY = {
28380
28089
  entity: "attachment",
28381
28090
  backend: "sql",
@@ -28396,7 +28105,7 @@ var ATTACHMENT_QUERY = {
28396
28105
  var PAGE3 = 200;
28397
28106
  var outcome = /* @__PURE__ */ __name(async (file2, path, load, signal, noFollow = false, ocr, env = process.env) => {
28398
28107
  const maxBytes = attachmentMaxBytes(env);
28399
- const tooLarge = /* @__PURE__ */ __name(() => ({
28108
+ const tooLarge2 = /* @__PURE__ */ __name(() => ({
28400
28109
  status: "too-large",
28401
28110
  issue: withRecovery({
28402
28111
  code: "validation_error",
@@ -28412,15 +28121,15 @@ var outcome = /* @__PURE__ */ __name(async (file2, path, load, signal, noFollow
28412
28121
  if (known === "unsupported")
28413
28122
  return { status: "unsupported" };
28414
28123
  if (size2 > maxBytes)
28415
- return tooLarge();
28416
- const handle = await open9(path, constants4.O_RDONLY | (noFollow ? constants4.O_NOFOLLOW : 0));
28124
+ return tooLarge2();
28125
+ const handle = await open6(path, constants2.O_RDONLY | (noFollow ? constants2.O_NOFOLLOW : 0));
28417
28126
  let bytes2;
28418
28127
  try {
28419
28128
  const opened = await handle.stat();
28420
28129
  if (!opened.isFile())
28421
28130
  return { status: "missing" };
28422
28131
  if (opened.size > maxBytes)
28423
- return tooLarge();
28132
+ return tooLarge2();
28424
28133
  bytes2 = new Uint8Array(await readFile(handle, { signal }));
28425
28134
  } finally {
28426
28135
  await handle.close();
@@ -28756,7 +28465,7 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
28756
28465
  }, "setText")
28757
28466
  }), "attachmentsService");
28758
28467
 
28759
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/chat-documents.js
28468
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/chat-documents.js
28760
28469
  var chatDocumentsService = /* @__PURE__ */ __name((deps) => ({
28761
28470
  list: /* @__PURE__ */ __name(async (chat, { limit, offset, ref }) => {
28762
28471
  const store = await accountStore(deps);
@@ -28786,7 +28495,7 @@ var chatDocumentsService = /* @__PURE__ */ __name((deps) => ({
28786
28495
  }, "list")
28787
28496
  }), "chatDocumentsService");
28788
28497
 
28789
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/retention.js
28498
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/retention.js
28790
28499
  var observationDuration = /* @__PURE__ */ __name((text, flag) => {
28791
28500
  const match = /^(\d+(?:\.\d+)?)([smhdw])$/.exec(text);
28792
28501
  const units2 = { s: 1e3, m: 6e4, h: 36e5, d: 864e5, w: 6048e5 };
@@ -28873,7 +28582,7 @@ var isRetentionSelection = /* @__PURE__ */ __name((selection) => {
28873
28582
  }
28874
28583
  }, "isRetentionSelection");
28875
28584
 
28876
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/counters.js
28585
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/counters.js
28877
28586
  var counterFields = /* @__PURE__ */ __name((text = "views,reactions,comments") => {
28878
28587
  const fields = text.split(",").map((one) => one.trim());
28879
28588
  if (!fields.length || fields.some((one) => !COUNTER_FIELDS.includes(one)) || new Set(fields).size !== fields.length)
@@ -29080,7 +28789,7 @@ var countersService = /* @__PURE__ */ __name((deps) => {
29080
28789
  };
29081
28790
  }, "countersService");
29082
28791
 
29083
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/search-refresh.js
28792
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/search-refresh.js
29084
28793
  var SYNC_KEY = "messages.sync-first";
29085
28794
  var SYNC_BOUNDS = { maxChats: 5, timeMs: 3e4, maxMessages: 500 };
29086
28795
  var keyOf2 = /* @__PURE__ */ __name((chat) => JSON.stringify([chat.account.provider, chat.account.account, chat.chatId]), "keyOf");
@@ -29212,7 +28921,7 @@ var withRefresh = /* @__PURE__ */ __name((found, refreshed) => ({
29212
28921
  ...!refreshed || refreshed.complete ? {} : { coverage: { ...found.coverage, state: "stale" } }
29213
28922
  }), "withRefresh");
29214
28923
 
29215
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/embeddings-search.js
28924
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/embeddings-search.js
29216
28925
  var CANDIDATES = 50;
29217
28926
  var WORD_HITS = 200;
29218
28927
  var RRF_K = 60;
@@ -29487,13 +29196,13 @@ var meanOf = /* @__PURE__ */ __name((vectors) => {
29487
29196
  return mean.map((value) => value / length);
29488
29197
  }, "meanOf");
29489
29198
 
29490
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/embeddings.js
29199
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/embeddings.js
29491
29200
  var embeddingsService = /* @__PURE__ */ __name((deps) => ({
29492
29201
  ...embeddingsMaintenance(deps),
29493
29202
  ...embeddingsSearch(deps)
29494
29203
  }), "embeddingsService");
29495
29204
 
29496
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/folders.js
29205
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/folders.js
29497
29206
  var foldersService = /* @__PURE__ */ __name((deps) => {
29498
29207
  const online = /* @__PURE__ */ __name(async (command) => {
29499
29208
  if (deps.offline)
@@ -29622,19 +29331,19 @@ var foldersService = /* @__PURE__ */ __name((deps) => {
29622
29331
  await guardedWrite(deps.guard, { operationId, chatId: null, kind: "account", action: "folder-order" }, () => reorder(folders.map((one) => one.id)));
29623
29332
  return { operationId, folders: folders.map(({ id: id2, title }) => ({ id: id2, title })) };
29624
29333
  }, "order"),
29625
- join: /* @__PURE__ */ __name(async (link5) => {
29626
- if (link5.trim() === "")
29334
+ join: /* @__PURE__ */ __name(async (link4) => {
29335
+ if (link4.trim() === "")
29627
29336
  throw new CliError("validation_error", "give the folder's link");
29628
29337
  const connection = await online("chats folders join");
29629
- const join16 = capability(connection, "joinFolder", "join a shared folder");
29338
+ const join13 = capability(connection, "joinFolder", "join a shared folder");
29630
29339
  const operationId = newOperationId();
29631
- const folder = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "account", action: "folder-join" }, () => join16(link5.trim()));
29340
+ const folder = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "account", action: "folder-join" }, () => join13(link4.trim()));
29632
29341
  return { operationId, folder };
29633
29342
  }, "join")
29634
29343
  };
29635
29344
  }, "foldersService");
29636
29345
 
29637
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/mentions.js
29346
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/mentions.js
29638
29347
  var REVIEW_COUNT = 500;
29639
29348
  var mentionsService = /* @__PURE__ */ __name((deps) => {
29640
29349
  const located = /* @__PURE__ */ __name(async () => {
@@ -29713,7 +29422,7 @@ var mentionsService = /* @__PURE__ */ __name((deps) => {
29713
29422
  };
29714
29423
  }, "mentionsService");
29715
29424
 
29716
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/domain/message-link.js
29425
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/domain/message-link.js
29717
29426
  var messageLinkTarget = /* @__PURE__ */ __name((reference, message, provider) => {
29718
29427
  if (isLocator(reference)) {
29719
29428
  if (message !== void 0)
@@ -29743,24 +29452,24 @@ var validMessageId = /* @__PURE__ */ __name((id2) => {
29743
29452
  }))
29744
29453
  throw new CliError("validation_error", "a message id must be nonempty, at most 256 characters, without spaces or controls");
29745
29454
  }, "validMessageId");
29746
- var validatePermalink = /* @__PURE__ */ __name((link5) => {
29747
- if (link5.url === null) {
29748
- if (link5.access !== "unavailable" || !["unsupported_chat", "unsupported_provider", "offline"].includes(link5.reason))
29455
+ var validatePermalink = /* @__PURE__ */ __name((link4) => {
29456
+ if (link4.url === null) {
29457
+ if (link4.access !== "unavailable" || !["unsupported_chat", "unsupported_provider", "offline"].includes(link4.reason))
29749
29458
  throw new CliError("validation_error", "the messenger returned invalid permalink metadata");
29750
- return { url: link5.url, access: link5.access, reason: link5.reason };
29459
+ return { url: link4.url, access: link4.access, reason: link4.reason };
29751
29460
  }
29752
29461
  let url;
29753
29462
  try {
29754
- url = new URL(link5.url);
29463
+ url = new URL(link4.url);
29755
29464
  } catch {
29756
29465
  throw new CliError("validation_error", "the messenger returned an invalid permalink");
29757
29466
  }
29758
- if (url.protocol !== "https:" || url.username || url.password || /\s/u.test(link5.url) || link5.reason !== null || !["public", "restricted", "unknown"].includes(link5.access))
29467
+ if (url.protocol !== "https:" || url.username || url.password || /\s/u.test(link4.url) || link4.reason !== null || !["public", "restricted", "unknown"].includes(link4.access))
29759
29468
  throw new CliError("validation_error", "the messenger returned an invalid permalink");
29760
- return { url: link5.url, access: link5.access, reason: link5.reason };
29469
+ return { url: link4.url, access: link4.access, reason: link4.reason };
29761
29470
  }, "validatePermalink");
29762
29471
 
29763
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/domain/pin-duration.js
29472
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/domain/pin-duration.js
29764
29473
  var spokenSeconds = /* @__PURE__ */ __name((seconds) => {
29765
29474
  if (seconds % 86400 === 0 && seconds > 86400)
29766
29475
  return `${seconds / 86400}d`;
@@ -29792,7 +29501,7 @@ var pinDurationOf = /* @__PURE__ */ __name((value, allowed, flag = "--expire-tim
29792
29501
  return seconds;
29793
29502
  }, "pinDurationOf");
29794
29503
 
29795
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/sends/send-as.js
29504
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/sends/send-as.js
29796
29505
  var sendAsCheck = /* @__PURE__ */ __name((connection, sendAs) => {
29797
29506
  if (sendAs === void 0) {
29798
29507
  const saved = connection.savedSender?.bind(connection);
@@ -29817,7 +29526,18 @@ var typedSendAs = /* @__PURE__ */ __name((typed) => {
29817
29526
  return sendAs;
29818
29527
  }, "typedSendAs");
29819
29528
 
29820
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/search/question-plan.js
29529
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/search/total.js
29530
+ var TOTAL_CAP = 1e4;
29531
+ var totalOf = /* @__PURE__ */ __name((count4, shown, hasMore, exact = true) => {
29532
+ const least = shown + (hasMore ? 1 : 0);
29533
+ if (count4 === void 0 || count4 < least)
29534
+ return { value: least, relation: "gte" };
29535
+ if (count4 > TOTAL_CAP)
29536
+ return { value: TOTAL_CAP, relation: "gte" };
29537
+ return { value: count4, relation: exact ? "eq" : "gte" };
29538
+ }, "totalOf");
29539
+
29540
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/search/question-plan.js
29821
29541
  var words = /* @__PURE__ */ __name((text) => normalize(text).match(/[\p{L}\p{N}]+/gu) ?? [], "words");
29822
29542
  var scaffolding = new Set(words("what which how many much who where when is are was were do does did can could should we the a an for of to under from in on at has have \u0441\u043A\u043E\u043B\u044C\u043A\u043E \u043A\u0430\u043A\u043E\u0439 \u043A\u0430\u043A\u0430\u044F \u043A\u0430\u043A\u0438\u0435 \u043A\u0430\u043A\u043E\u0435 \u043A\u0442\u043E \u043A\u043E\u043C\u0443 \u043A\u0435\u043C \u0433\u0434\u0435 \u043A\u043E\u0433\u0434\u0430 \u043A\u0430\u043A \u0447\u0442\u043E \u0432\u043E \u043F\u043E \u043D\u0430 \u0432 \u043A \u0441 \u0443 \u0447\u0435\u0440\u0435\u0437 \u043B\u0438 \u0434\u043E\u043B\u0436\u0435\u043D \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0443\u0436\u043D\u043E \u0438\u0434\u0451\u0442 \u0438\u0434\u0435\u0442 \u043C\u043E\u0436\u043D\u043E \u043C\u043E\u0436\u0435\u0442 \u043C\u043E\u0433\u0443\u0442"));
29823
29543
  var questionWord = /\b(?:what|which|how|who|where|when|can|could|should)\b|(?:^|\s)(?:сколько|какой|какая|какие|какое|кто|кому|кем|где|когда|как|что|можно|может|могут|ли)(?:\s|$)/iu;
@@ -29932,7 +29652,7 @@ function planQuestion(text, strict = false) {
29932
29652
  }
29933
29653
  __name(planQuestion, "planQuestion");
29934
29654
 
29935
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/messages-combined.js
29655
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/messages-combined.js
29936
29656
  var COMBINED_DEFAULTS = { candidateDepth: 300, rrfK: 60, rerank: "all", chatCap: 0 };
29937
29657
  var tokensOf = /* @__PURE__ */ __name((text) => normalize(text).match(/[\p{L}\p{N}\p{Co}\p{M}]+/gu) ?? [], "tokensOf");
29938
29658
  var searchCombined = /* @__PURE__ */ __name(async (store, account, request, messenger = {}, options = COMBINED_DEFAULTS) => {
@@ -30125,15 +29845,23 @@ var signals = /* @__PURE__ */ __name((hit, terms, corrections, execution, mode,
30125
29845
  return mode === "coverage" ? coverage * 4 : mode === "proximity" ? proximity : mode === "phrase" ? phrase : coverage * 4 + proximity + phrase;
30126
29846
  }, "signals");
30127
29847
 
30128
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/messages-discovery.js
29848
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/messages-discovery.js
30129
29849
  var MEANING_DEPTH = 100;
30130
29850
  var RRF_K2 = 60;
30131
29851
  var RERANK_DEPTH = 50;
30132
29852
  var RERANK_WEIGHT = 0.7;
30133
29853
  var RERANK_CHUNK = 5;
30134
29854
  var RERANK_MILLISECONDS = 15e3;
29855
+ var FOLLOW_UP_HITS = 5;
29856
+ var FOLLOW_UPS_PER_HIT = 2;
29857
+ var RARE_AT = 3;
29858
+ var FOLLOW_UP_CANDIDATES = 20;
29859
+ var discoveryRequest = /* @__PURE__ */ __name((asked) => asked.ast !== void 0 || asked.exact || !asked.text ? asked : {
29860
+ ...asked,
29861
+ text: asked.text.replace(new RegExp("(?<=\\p{L})\\?(?=\\s|$)", "gu"), "").replace(/"(?:[^"\\]|\\.)*"|(?<=\d):(?=\d)/gu, (found) => found === ":" ? " " : found)
29862
+ }, "discoveryRequest");
30135
29863
  var searchDiscovery = /* @__PURE__ */ __name(async (store, account, asked, messenger = {}, meaning, rerank) => {
30136
- const request = asked.ast !== void 0 || asked.exact || !asked.text ? asked : { ...asked, text: asked.text.replace(new RegExp("(?<=\\p{L})\\?(?=\\s|$)", "gu"), "") };
29864
+ const request = discoveryRequest(asked);
30137
29865
  const original = await prepareLucene(store, account, request, messenger);
30138
29866
  const text = request.text ?? "";
30139
29867
  const plan = planQuestion(text, request.ast !== void 0 || !!request.exact || !!request.newest);
@@ -30300,7 +30028,10 @@ var searchDiscovery = /* @__PURE__ */ __name(async (store, account, asked, messe
30300
30028
  started += performance.now() - opening;
30301
30029
  }
30302
30030
  check2();
30303
- const items = await Promise.all(candidates.slice(0, request.limit).map(async ({ fused: _fused, ...m }) => {
30031
+ const followUps = await followUpsOf(store, account, request, messenger, candidates, plan.scope);
30032
+ const items = await Promise.all(candidates.slice(0, request.limit).map(async ({ fused: _fused, ...hit }) => {
30033
+ const later = followUps.get(hit.locator);
30034
+ const m = later?.length ? { ...hit, followUps: later } : hit;
30304
30035
  if (!request.context)
30305
30036
  return m;
30306
30037
  check2();
@@ -30327,6 +30058,7 @@ var searchDiscovery = /* @__PURE__ */ __name(async (store, account, asked, messe
30327
30058
  candidateDepth: 300,
30328
30059
  candidates: candidates.length,
30329
30060
  repliesAdded: replyCount,
30061
+ followUps: [...followUps.values()].reduce((sum2, later) => sum2 + later.length, 0),
30330
30062
  truncated,
30331
30063
  terms,
30332
30064
  queries: [...plan.changed ? [] : plan.queries, relaxed],
@@ -30339,6 +30071,30 @@ var searchDiscovery = /* @__PURE__ */ __name(async (store, account, asked, messe
30339
30071
  ...lane && "partly" in lane && lane.partly ? { meaningSkipped: lane.partly } : {}
30340
30072
  };
30341
30073
  }, "searchDiscovery");
30074
+ var followUpsOf = /* @__PURE__ */ __name(async (store, account, request, messenger, candidates, scope) => {
30075
+ const head = candidates.slice(0, Math.min(FOLLOW_UP_HITS, request.limit));
30076
+ const later = await store.messages.laterSharingRare(head.map((hit) => ({ account: accountOfHit(hit), chatId: hit.chatId, id: hit.id })), { rareAt: RARE_AT, limit: FOLLOW_UP_CANDIDATES });
30077
+ const only = [...new Map(later.flat().map((m) => [m.locator, m])).values()].map((m) => ({
30078
+ ...accountOfHit(m),
30079
+ chatId: m.chatId,
30080
+ id: m.id
30081
+ }));
30082
+ const out = /* @__PURE__ */ new Map();
30083
+ if (!only.length)
30084
+ return out;
30085
+ const eligible = await searchLucene(store, account, { ...request, text: scope || void 0, ast: void 0, limit: only.length, only, context: 0, thread: void 0 }, messenger);
30086
+ const allowed = new Map(eligible.items.map((m) => [m.locator, m]));
30087
+ const shown = /* @__PURE__ */ new Set();
30088
+ head.forEach((hit, i) => {
30089
+ shown.add(hit.locator);
30090
+ const picked = (later[i] ?? []).flatMap((m) => allowed.get(m.locator) ?? []).slice(0, FOLLOW_UPS_PER_HIT).filter((m) => !shown.has(m.locator));
30091
+ for (const m of picked)
30092
+ shown.add(m.locator);
30093
+ if (picked.length)
30094
+ out.set(hit.locator, picked);
30095
+ });
30096
+ return out;
30097
+ }, "followUpsOf");
30342
30098
  var nearEligible = /* @__PURE__ */ __name(async (store, account, request, messenger, ranked, scope) => {
30343
30099
  const keyOf5 = /* @__PURE__ */ __name((one) => JSON.stringify([one.provider, one.account, one.chatId, one.id]), "keyOf");
30344
30100
  const only = ranked.slice(0, MEANING_DEPTH).filter((m) => !request.only || request.only.some((key) => keyOf5(key) === keyOf5(m))).map(({ provider, account: account2, chatId, id: id2 }) => ({ provider, account: account2, chatId, id: id2 }));
@@ -30394,7 +30150,7 @@ var mixedWithReranker = /* @__PURE__ */ __name((head, scores) => {
30394
30150
  })).sort((a, b) => b.mixed - a.mixed).map(({ hit }) => hit);
30395
30151
  }, "mixedWithReranker");
30396
30152
 
30397
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/thread-context.js
30153
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/thread-context.js
30398
30154
  var THREAD_BOUNDS = { maxHops: 8, maxMessages: 50, maxBytes: 65536, withinMs: 864e5 };
30399
30155
  var bytes = /* @__PURE__ */ __name((items, links) => Buffer.byteLength(JSON.stringify({ items, links }), "utf8"), "bytes");
30400
30156
  var threadBounds = /* @__PURE__ */ __name((options = {}) => {
@@ -30494,14 +30250,14 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account, chat, mess
30494
30250
  const rows = await store.conversations.links(account, chat, id2, { limit: bounds.maxMessages + 1 });
30495
30251
  if (rows.length > bounds.maxMessages)
30496
30252
  stopped("links");
30497
- cache.set(id2, rows.slice(0, bounds.maxMessages).map((link5) => ({
30498
- ...link5,
30499
- stale: link5.stale || link5.source !== "agent" && state.algorithmVersion !== RULES_VERSION
30253
+ cache.set(id2, rows.slice(0, bounds.maxMessages).map((link4) => ({
30254
+ ...link4,
30255
+ stale: link4.stale || link4.source !== "agent" && state.algorithmVersion !== RULES_VERSION
30500
30256
  })));
30501
30257
  }
30502
30258
  return cache.get(id2);
30503
30259
  }, "linksOf");
30504
- const chosen = /* @__PURE__ */ __name((links) => links.find((link5) => !link5.stale), "chosen");
30260
+ const chosen = /* @__PURE__ */ __name((links) => links.find((link4) => !link4.stale), "chosen");
30505
30261
  const queue = [{ id: message, hops: 0 }];
30506
30262
  const queued = /* @__PURE__ */ new Set([message]);
30507
30263
  const parents = /* @__PURE__ */ new Map();
@@ -30532,8 +30288,8 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account, chat, mess
30532
30288
  const displayed2 = node.id === message ? { ...body, anchor: true } : body;
30533
30289
  const own = await linksOf(node.id);
30534
30290
  const parent = chosen(own);
30535
- const evidence = own.filter((link5) => link5 === parent || link5.stale).map((link5) => ({ ...link5, messageId: node.id, chosen: link5 === parent })).filter((link5) => !result.links.some((old) => old.messageId === link5.messageId && old.parentId === link5.parentId && old.source === link5.source && old.kind === link5.kind && old.method === link5.method));
30536
- result.stale ||= evidence.some((link5) => link5.stale);
30291
+ const evidence = own.filter((link4) => link4 === parent || link4.stale).map((link4) => ({ ...link4, messageId: node.id, chosen: link4 === parent })).filter((link4) => !result.links.some((old) => old.messageId === link4.messageId && old.parentId === link4.parentId && old.source === link4.source && old.kind === link4.kind && old.method === link4.method));
30292
+ result.stale ||= evidence.some((link4) => link4.stale);
30537
30293
  if (bytes([...result.items, displayed2], [...result.links, ...evidence]) > bounds.maxBytes) {
30538
30294
  stopped("bytes");
30539
30295
  break;
@@ -30569,9 +30325,9 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account, chat, mess
30569
30325
  const childLinks = await linksOf(child.messageId);
30570
30326
  if (chosen(childLinks)?.parentId === node.id)
30571
30327
  add(child.messageId);
30572
- else if (childLinks.some((link5) => link5.stale && link5.parentId === node.id)) {
30328
+ else if (childLinks.some((link4) => link4.stale && link4.parentId === node.id)) {
30573
30329
  result.stale = true;
30574
- const stale = childLinks.filter((link5) => link5.stale && link5.parentId === node.id).map((link5) => ({ ...link5, messageId: child.messageId, chosen: false })).filter((link5) => !result.links.some((old) => old.messageId === link5.messageId && old.parentId === link5.parentId && old.source === link5.source && old.kind === link5.kind && old.method === link5.method));
30330
+ const stale = childLinks.filter((link4) => link4.stale && link4.parentId === node.id).map((link4) => ({ ...link4, messageId: child.messageId, chosen: false })).filter((link4) => !result.links.some((old) => old.messageId === link4.messageId && old.parentId === link4.parentId && old.source === link4.source && old.kind === link4.kind && old.method === link4.method));
30575
30331
  if (bytes(result.items, [...result.links, ...stale]) <= bounds.maxBytes)
30576
30332
  result.links.push(...stale);
30577
30333
  else
@@ -30593,7 +30349,7 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account, chat, mess
30593
30349
  return result;
30594
30350
  }, "readThreadContext");
30595
30351
 
30596
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/messages-archive-search.js
30352
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/messages-archive-search.js
30597
30353
  var SEARCH_FILL_MS = 200;
30598
30354
  var statsStore = /* @__PURE__ */ __name(async (store, account, request, messenger = {}) => {
30599
30355
  const stop = Date.now() + SEARCH_FILL_MS;
@@ -30628,8 +30384,15 @@ var searchStore = /* @__PURE__ */ __name(async (store, account, request, messeng
30628
30384
  if (!Number.isInteger(offset) || offset < 0 || offset > MAX_SEARCH_OFFSET)
30629
30385
  throw new CliError("validation_error", `offset takes a whole number from 0 to ${MAX_SEARCH_OFFSET}`);
30630
30386
  const found = await searchPage(store, account, { ...request, limit: request.limit + offset }, messenger, meaning, rerank);
30387
+ const discovery = found.query?.discovery;
30388
+ const total = discovery ? totalOf(discovery.candidates, found.items.length, found.hasMore, !discovery.truncated) : totalOf(await countLucene(store, account, { ...request.discover ? discoveryRequest(request) : request, limit: request.limit + offset }, messenger, TOTAL_CAP).catch((error) => {
30389
+ if (isCliError(error) && error.details.reason === "query.too-large")
30390
+ return void 0;
30391
+ throw error;
30392
+ }), found.items.length, found.hasMore);
30631
30393
  return {
30632
30394
  ...found,
30395
+ total,
30633
30396
  items: found.items.slice(offset),
30634
30397
  ...found.hasMore && offset + request.limit <= MAX_SEARCH_OFFSET ? { nextOffset: offset + request.limit } : {}
30635
30398
  };
@@ -30653,12 +30416,12 @@ var accountOf2 = /* @__PURE__ */ __name((hit) => {
30653
30416
  }, "accountOf");
30654
30417
  var keyOf3 = /* @__PURE__ */ __name(({ provider, account }) => `${provider}/${account}`, "keyOf");
30655
30418
 
30656
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/pictures.js
30419
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/pictures.js
30657
30420
  import { createHash as createHash9 } from "node:crypto";
30658
30421
  import { readFile as readFile2, stat as stat3 } from "node:fs/promises";
30659
30422
  import { setTimeout as sleep4 } from "node:timers/promises";
30660
30423
 
30661
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/domain/models.js
30424
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/domain/models.js
30662
30425
  var GROUP_SETTINGS = [
30663
30426
  "allCanPin",
30664
30427
  "onlyAdminsAdd",
@@ -30672,10 +30435,10 @@ var ADMIN_RIGHTS = ["read", "members", "admins", "info", "pin", "link", "post",
30672
30435
  var senderIsMe = /* @__PURE__ */ __name((message, account) => message.outgoing === true || message.senderId !== null && String(message.senderId) === account, "senderIsMe");
30673
30436
  var MEDIA_KINDS = ["photo", "video", "file", "audio", "link"];
30674
30437
 
30675
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/file-download.js
30438
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/file-download.js
30676
30439
  import { createWriteStream, mkdirSync } from "node:fs";
30677
- import { link as link4, rm } from "node:fs/promises";
30678
- import { basename as basename8, join as join14, resolve as resolve6 } from "node:path";
30440
+ import { link as link3, rm } from "node:fs/promises";
30441
+ import { basename as basename6, join as join11, resolve as resolve6 } from "node:path";
30679
30442
  import { Readable, Transform } from "node:stream";
30680
30443
  import { pipeline } from "node:stream/promises";
30681
30444
  var refreshedFiles = /* @__PURE__ */ __name((files) => files.flatMap(({ kind, name, position, providerRef }) => providerRef === void 0 || Object.keys(providerRef).length === 0 ? [] : [
@@ -30750,7 +30513,7 @@ var EXTENSIONS = {
30750
30513
  };
30751
30514
  var BY_KIND = { photo: "jpg" };
30752
30515
  var safeName2 = /* @__PURE__ */ __name((name, platform = process.platform) => {
30753
- let plain2 = name === void 0 ? "" : basename8(name.replaceAll("\\", "/")).replace(/[\p{Cc}​-‏‪-‮⁦-⁩]/gu, "").replace(/^\.+/, "");
30516
+ let plain2 = name === void 0 ? "" : basename6(name.replaceAll("\\", "/")).replace(/[\p{Cc}​-‏‪-‮⁦-⁩]/gu, "").replace(/^\.+/, "");
30754
30517
  if (platform === "win32") {
30755
30518
  plain2 = plain2.replace(/[<>:"|?*]/g, "_").replace(/[. ]+$/, "");
30756
30519
  if (/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(plain2))
@@ -30764,7 +30527,7 @@ var save = /* @__PURE__ */ __name(async (file2, directory2, fallbackName, { uniq
30764
30527
  const extension = EXTENSIONS[file2.mime ?? ""] ?? BY_KIND[file2.kind];
30765
30528
  return own ?? (extension ? `${fallbackName}.${extension}` : fallbackName);
30766
30529
  }, "fileName");
30767
- const partial = join14(directory2, `.${fileName()}.${process.pid}.part`);
30530
+ const partial = join11(directory2, `.${fileName()}.${process.pid}.part`);
30768
30531
  let bytes2 = 0;
30769
30532
  const counting = new Transform({
30770
30533
  transform(chunk, _encoding, done2) {
@@ -30777,8 +30540,8 @@ var save = /* @__PURE__ */ __name(async (file2, directory2, fallbackName, { uniq
30777
30540
  const name = fileName();
30778
30541
  const names2 = unique && own ? [name, `${fallbackName}-${own}`] : [name];
30779
30542
  for (const candidate of names2) {
30780
- const path2 = resolve6(join14(directory2, candidate));
30781
- const taken = await link4(partial, path2).then(() => false, (error) => {
30543
+ const path2 = resolve6(join11(directory2, candidate));
30544
+ const taken = await link3(partial, path2).then(() => false, (error) => {
30782
30545
  if (error.code === "EEXIST")
30783
30546
  return true;
30784
30547
  throw error;
@@ -30786,7 +30549,7 @@ var save = /* @__PURE__ */ __name(async (file2, directory2, fallbackName, { uniq
30786
30549
  if (!taken)
30787
30550
  return { kind: file2.kind, path: path2, bytes: bytes2 };
30788
30551
  }
30789
- const path = resolve6(join14(directory2, names2.at(-1) ?? name));
30552
+ const path = resolve6(join11(directory2, names2.at(-1) ?? name));
30790
30553
  if (unique)
30791
30554
  return { kind: file2.kind, path, bytes: bytes2, existing: true };
30792
30555
  throw new CliError("validation_error", `${path} already exists \u2014 nothing was overwritten; choose --output-dir`);
@@ -30795,7 +30558,7 @@ var save = /* @__PURE__ */ __name(async (file2, directory2, fallbackName, { uniq
30795
30558
  }
30796
30559
  }, "save");
30797
30560
 
30798
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/pictures.js
30561
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/pictures.js
30799
30562
  var PICTURE_MAX_BYTES = 25 * 1024 * 1024;
30800
30563
  var PICTURE_FLOOR = 0.25;
30801
30564
  var PAGE4 = 50;
@@ -30805,18 +30568,18 @@ var missingModel = /* @__PURE__ */ __name((id2) => `the picture model is not dow
30805
30568
  var plainWords = /* @__PURE__ */ __name((query) => query.replace(/\b(?:text|content|transcript|filename):("[^"]*"|\S+)/gi, "$1").replace(/\b[a-z_]+:("[^"]*"|\[[^\]]*\]|\{[^}]*\}|\([^)]*\)|\S+)/gi, " ").replace(/\b(?:AND|OR|NOT)\b/g, " ").replace(/[()"+\-~^*?\\[\]{}!|&]/g, " ").replace(/\s+/g, " ").trim(), "plainWords");
30806
30569
  var picturesService = /* @__PURE__ */ __name((deps) => {
30807
30570
  let opened;
30808
- const open10 = /* @__PURE__ */ __name(async () => {
30571
+ const open7 = /* @__PURE__ */ __name(async () => {
30809
30572
  if (deps.pictureEmbedder)
30810
30573
  return deps.pictureEmbedder();
30811
30574
  const model2 = imageModel(DEFAULT_IMAGE_MODEL);
30812
30575
  const directory2 = imageModelsDirectory(deps.env);
30813
30576
  if (!isImageModelInstalled(model2, directory2))
30814
30577
  throw new CliError("not_found", missingModel(model2.id), { reason: "model.not-downloaded", model: model2.id });
30815
- const { openPictureEmbedder } = await import("./embedder-O4WNEXUC.js");
30578
+ const { openPictureEmbedder } = await import("./embedder-YOOHWWN6.js");
30816
30579
  return openPictureEmbedder(model2, directory2);
30817
30580
  }, "open");
30818
30581
  const embedder = /* @__PURE__ */ __name(() => {
30819
- opened ??= open10().catch((error) => {
30582
+ opened ??= open7().catch((error) => {
30820
30583
  opened = void 0;
30821
30584
  throw error;
30822
30585
  });
@@ -31009,7 +30772,7 @@ var withPictures = /* @__PURE__ */ __name((messages, pictures) => ({
31009
30772
  }, "search")
31010
30773
  }), "withPictures");
31011
30774
 
31012
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/messages-meaning.js
30775
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/messages-meaning.js
31013
30776
  var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, shared) => {
31014
30777
  const target2 = embeddingTarget(deps, DEFAULT_TEXT_MODEL);
31015
30778
  const skipped = /* @__PURE__ */ __name((reason, step) => ({
@@ -31057,7 +30820,7 @@ var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, sh
31057
30820
  }
31058
30821
  }, "meaningLane");
31059
30822
 
31060
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/messages-rerank.js
30823
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/messages-rerank.js
31061
30824
  var rerankLane = /* @__PURE__ */ __name((deps) => {
31062
30825
  const choice = deps.reranker ?? DEFAULT_RERANK_MODEL;
31063
30826
  if (choice === "off")
@@ -31069,9 +30832,9 @@ var rerankLane = /* @__PURE__ */ __name((deps) => {
31069
30832
  return { skipped: { reason: `${model.id} is not downloaded`, step: "models.download", model: model.id } };
31070
30833
  try {
31071
30834
  const warm = deps.embedders;
31072
- const reranker = warm ? await warm.reranker(`rerank:${model.id}`, async () => (await import("./process-JC76J5UD.js")).openRerankerProcess(model, directory2, {
30835
+ const reranker = warm ? await warm.reranker(`rerank:${model.id}`, async () => (await import("./process-4PRR3MLT.js")).openRerankerProcess(model, directory2, {
31073
30836
  threads: defaultThreads()
31074
- })) : await (await import("./rerank-QJ5NLZUU.js")).openReranker(model, directory2);
30837
+ })) : await (await import("./rerank-6FU2JPCD.js")).openReranker(model, directory2);
31075
30838
  return {
31076
30839
  model: model.id,
31077
30840
  score: /* @__PURE__ */ __name((question, passages) => reranker.score(plainWords(question), passages), "score"),
@@ -31091,34 +30854,32 @@ var rerankLane = /* @__PURE__ */ __name((deps) => {
31091
30854
  };
31092
30855
  }, "rerankLane");
31093
30856
 
31094
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/document-pictures.js
30857
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/document-pictures.js
31095
30858
  var openPictureEmbedderFor = /* @__PURE__ */ __name(async ({ env, command } = {}) => {
31096
30859
  const model = imageModel(DEFAULT_IMAGE_MODEL);
31097
30860
  const directory2 = imageModelsDirectory(env);
31098
30861
  if (!isImageModelInstalled(model, directory2))
31099
30862
  throw new CliError("not_found", `the picture model is not downloaded \u2014 ${command === void 0 ? "install it with a WireCat CLI that has `images models download` (tg, max or wa); they share the model folder" : `\`${command} images models download ${model.id}\` fetches it`}`, { reason: "model.not-downloaded", model: model.id });
31100
- const { openPictureEmbedder } = await import("./embedder-O4WNEXUC.js");
30863
+ const { openPictureEmbedder } = await import("./embedder-YOOHWWN6.js");
31101
30864
  return openPictureEmbedder(model, directory2);
31102
30865
  }, "openPictureEmbedderFor");
31103
30866
 
31104
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/document-source.js
30867
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/document-source.js
31105
30868
  var documentSource = /* @__PURE__ */ __name((note, accounts, profiles, file2) => {
31106
30869
  const metadata = note.frontMatter;
31107
30870
  const account = accounts.find(({ id: id2 }) => String(id2) === note.folderId);
31108
30871
  const remote = note.source === "file" && (account !== void 0 && kindIn(account.provider) === "documents" || metadata?.source === "google-drive");
31109
30872
  const profile = remote && account ? Object.entries(profiles).flatMap(([command, named2]) => Object.entries(named2).map(([name, key]) => ({ command, name, key }))).find(({ key }) => key.provider === account.provider && key.account === account.account || isFolderProvider(key.provider) && key.account === account.name) : void 0;
31110
30873
  const url = file2?.url ?? (remote && typeof metadata?.sourceUrl === "string" ? metadata.sourceUrl : void 0);
31111
- const modified = file2?.externalUpdatedAt ?? (remote && typeof metadata?.modifiedAt === "string" && Number.isFinite(Date.parse(metadata.modifiedAt)) ? metadata.modifiedAt : void 0);
31112
30874
  return {
31113
30875
  kind: remote ? "document" : "note",
31114
30876
  provider: profile ? profile.command : "notes",
31115
30877
  account: profile?.name ?? note.folderId ?? "internal",
31116
- ...remote && url !== void 0 ? { url } : {},
31117
- updated_at: remote && modified !== void 0 ? modified : note.updatedAt
30878
+ ...remote && url !== void 0 ? { url } : {}
31118
30879
  };
31119
30880
  }, "documentSource");
31120
30881
 
31121
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/notes-title-tier.js
30882
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/notes-title-tier.js
31122
30883
  var plainQueryWords = /* @__PURE__ */ __name((query) => {
31123
30884
  let root;
31124
30885
  try {
@@ -31145,9 +30906,11 @@ var titleTiers = /* @__PURE__ */ __name((hits, words2) => {
31145
30906
  return [...hits].sort((a, b) => rank(a) - rank(b));
31146
30907
  }, "titleTiers");
31147
30908
 
31148
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/notes-search.js
31149
- var storeQuery = /* @__PURE__ */ __name(async (store, text, { exact, timezone } = {}) => {
31150
- const ast = validateFields(parseLucene(text, { ...SEARCH_QUERY, defaultField: exact ? "exact" : "text" }));
30909
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/notes-search.js
30910
+ var storeQuery = /* @__PURE__ */ __name(async (store, text, { exact, timezone } = {}) => resolvedQuery(store, parsedQuery(text, exact), timezone), "storeQuery");
30911
+ var parsedQuery = /* @__PURE__ */ __name((text, exact) => validateFields(parseLucene(text, { ...SEARCH_QUERY, defaultField: exact ? "exact" : "text" })).root, "parsedQuery");
30912
+ var resolvedQuery = /* @__PURE__ */ __name(async (store, root, timezone) => {
30913
+ const ast = { root };
31151
30914
  const zone = timezoneOf(timezone);
31152
30915
  const resolve7 = /* @__PURE__ */ __name((node) => {
31153
30916
  if (node.kind === "boolean")
@@ -31168,7 +30931,7 @@ var storeQuery = /* @__PURE__ */ __name(async (store, text, { exact, timezone }
31168
30931
  root: resolve7(ast.root),
31169
30932
  ...hasStems(ast.root) ? { stemmer: createStemmer(stemmers2 ?? DEFAULT_STEMMERS) } : {}
31170
30933
  };
31171
- }, "storeQuery");
30934
+ }, "resolvedQuery");
31172
30935
  var searchNotesQuery = /* @__PURE__ */ __name(async (store, request) => {
31173
30936
  if (!request.text.trim())
31174
30937
  throw new CliError("validation_error", "say what to find in the notes");
@@ -31206,7 +30969,17 @@ var withLocal = /* @__PURE__ */ __name(async (model, directory2, threads, work,
31206
30969
  await embedder.close();
31207
30970
  }
31208
30971
  }, "withLocal");
31209
- var nearestNotes = /* @__PURE__ */ __name(async (store, query, { model: choice, limit, folderIds, withInternal, source, env, threads, command, embedders }) => {
30972
+ var nearestNotes = /* @__PURE__ */ __name(async (store, query, options) => {
30973
+ const { key, vector, floor } = await queryVector(store, query, options);
30974
+ const nearest = await store.notes.nearest(key, vector, {
30975
+ limit: options.limit,
30976
+ ...options.folderIds ? { folderIds: options.folderIds } : {},
30977
+ ...options.withInternal ? { withInternal: true } : {},
30978
+ ...options.source ? { source: options.source } : {}
30979
+ });
30980
+ return nearest.filter(({ score }) => score > floor);
30981
+ }, "nearestNotes");
30982
+ var queryVector = /* @__PURE__ */ __name(async (store, query, { model: choice, folderIds, withInternal, source, env, threads, command, embedders }) => {
31210
30983
  if (!query.trim())
31211
30984
  throw new CliError("validation_error", "say what to find in the notes");
31212
30985
  const { model, directory: directory2, key } = localModel(choice, env, command);
@@ -31218,19 +30991,15 @@ var nearestNotes = /* @__PURE__ */ __name(async (store, query, { model: choice,
31218
30991
  if (!await store.notes.embedded(key, scope))
31219
30992
  throw new CliError("not_found", `nothing searched here has vectors of ${model.id} yet, so only words were matched`);
31220
30993
  const [vector] = await withLocal(model, directory2, threads, (embedder) => embedder.embed([query], "query"), embedders);
31221
- const floor = meaningFloor(key);
31222
- const nearest = await store.notes.nearest(key, vector, {
31223
- limit,
31224
- ...folderIds ? { folderIds } : {},
31225
- ...withInternal ? { withInternal: true } : {},
31226
- ...source ? { source } : {}
31227
- });
31228
- return nearest.filter(({ score }) => score > floor);
31229
- }, "nearestNotes");
30994
+ return { key, vector, floor: meaningFloor(key) };
30995
+ }, "queryVector");
30996
+ var nearestAmong = /* @__PURE__ */ __name(async (store, query, refs, options) => {
30997
+ const { key, vector, floor } = await queryVector(store, query, options);
30998
+ return (await store.notes.scoreNotes(key, vector, refs)).filter(({ score }) => score > floor);
30999
+ }, "nearestAmong");
31230
31000
  var MAX_LINE = 200;
31231
31001
  var MAX_NOTES_OFFSET = 1e3;
31232
31002
  var CANDIDATES2 = 50;
31233
- var FILTERED = 500;
31234
31003
  var RRF_K3 = 60;
31235
31004
  var firstLine = /* @__PURE__ */ __name((text, query) => {
31236
31005
  const words2 = query.toLowerCase().split(/\s+/).map((word) => word.replace(/^[^\p{L}\p{N}]+|[^\p{L}\p{N}]+$/gu, "")).filter((word) => word.length > 2 && !["and", "or", "not"].includes(word));
@@ -31288,12 +31057,108 @@ var noteSourceOfQuery = /* @__PURE__ */ __name((query) => {
31288
31057
  }
31289
31058
  return { source, rest };
31290
31059
  }, "noteSourceOfQuery");
31060
+ var WORD_FIELDS = /* @__PURE__ */ new Set(["text", "exact"]);
31061
+ var fieldsOfQuery = /* @__PURE__ */ __name((root) => {
31062
+ let narrows = false;
31063
+ const kept = /* @__PURE__ */ __name((node) => {
31064
+ if (node.kind === "boolean")
31065
+ return {
31066
+ ...node,
31067
+ clauses: node.clauses.map(({ occur, node: node2 }) => {
31068
+ if (occur !== "must_not")
31069
+ return { occur, node: kept(node2) };
31070
+ narrows = true;
31071
+ return { occur, node: node2 };
31072
+ })
31073
+ };
31074
+ if (!WORD_FIELDS.has(node.field)) {
31075
+ narrows = true;
31076
+ return node;
31077
+ }
31078
+ return { kind: "predicate", field: "in", operator: "term", value: "notes", span: node.span };
31079
+ }, "kept");
31080
+ const fields = kept(root);
31081
+ return narrows ? fields : void 0;
31082
+ }, "fieldsOfQuery");
31083
+ var meaningWords = /* @__PURE__ */ __name((root) => {
31084
+ const wanted = /* @__PURE__ */ __name((node) => node.kind === "boolean" ? node.clauses.flatMap(({ occur, node: node2 }) => occur === "must_not" ? [] : wanted(node2)) : WORD_FIELDS.has(node.field) && (node.operator === "term" || node.operator === "phrase") ? [node.value] : [], "wanted");
31085
+ return wanted(root).join(" ").trim();
31086
+ }, "meaningWords");
31087
+ var allOf = /* @__PURE__ */ __name((nodes) => nodes.length <= 1 ? nodes[0] : {
31088
+ kind: "boolean",
31089
+ clauses: nodes.map((node) => ({ occur: "must", node })),
31090
+ span: { start: 0, end: 0 }
31091
+ }, "allOf");
31092
+ var matching = /* @__PURE__ */ __name(async (store, refs, root, scope) => {
31093
+ if (refs.length === 0)
31094
+ return /* @__PURE__ */ new Map();
31095
+ const resolved = await resolvedQuery(store, root ?? { kind: "predicate", field: "in", operator: "term", value: "notes", span: { start: 0, end: 0 } }, scope.timezone);
31096
+ const found = await store.notes.search({
31097
+ root: resolved.root,
31098
+ refs,
31099
+ limit: refs.length,
31100
+ ...scope.folderIds ? { folderIds: scope.folderIds } : {},
31101
+ ...scope.withInternal ? { withInternal: true } : {},
31102
+ ...scope.source ? { source: scope.source } : {},
31103
+ ...resolved.stemmer ? { stemmer: resolved.stemmer } : {}
31104
+ });
31105
+ return new Map(found.items.map(({ ref, note, at }) => [ref, { note, at }]));
31106
+ }, "matching");
31107
+ var RANK_WITHIN = 2e3;
31108
+ var filterRefs = /* @__PURE__ */ __name(async (store, narrowing, scope) => {
31109
+ const resolved = await resolvedQuery(store, narrowing, scope.timezone);
31110
+ try {
31111
+ const found = await store.notes.matchingRefs({
31112
+ root: resolved.root,
31113
+ limit: RANK_WITHIN,
31114
+ ...scope.folderIds ? { folderIds: scope.folderIds } : {},
31115
+ ...scope.withInternal ? { withInternal: true } : {},
31116
+ ...scope.source ? { source: scope.source } : {},
31117
+ ...resolved.stemmer ? { stemmer: resolved.stemmer } : {}
31118
+ });
31119
+ return found.hasMore ? void 0 : found.refs;
31120
+ } catch (error) {
31121
+ if (tooLarge(error))
31122
+ return void 0;
31123
+ throw error;
31124
+ }
31125
+ }, "filterRefs");
31126
+ var tooLarge = /* @__PURE__ */ __name((error) => isCliError(error) && error.details.reason === "query.too-large", "tooLarge");
31127
+ var notesTotal = /* @__PURE__ */ __name(async (store, text, { exact, scope, shown, hasMore }, others, othersComplete) => {
31128
+ let words2;
31129
+ try {
31130
+ const { root, stemmer } = await storeQuery(store, text, {
31131
+ exact,
31132
+ ...scope.timezone ? { timezone: scope.timezone } : {}
31133
+ });
31134
+ words2 = await store.notes.matchingRefs({
31135
+ root,
31136
+ limit: TOTAL_CAP,
31137
+ ...scope.folderIds ? { folderIds: scope.folderIds } : {},
31138
+ ...scope.withInternal ? { withInternal: true } : {},
31139
+ ...scope.source ? { source: scope.source } : {},
31140
+ ...stemmer ? { stemmer } : {}
31141
+ });
31142
+ } catch (error) {
31143
+ if (tooLarge(error))
31144
+ return totalOf(void 0, shown, hasMore);
31145
+ throw error;
31146
+ }
31147
+ const count4 = (/* @__PURE__ */ new Set([...words2.refs, ...others])).size + (words2.hasMore ? 1 : 0);
31148
+ return totalOf(count4, shown, hasMore, othersComplete);
31149
+ }, "notesTotal");
31291
31150
  var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offset = 0, tag, filter: expression, folderIds, withInternal, source: given, exact = false, timezone, env, command, embedders, pictures: withPictures2 = false, pictureLimit = 5, pictureEmbedder } = {}) => {
31292
31151
  const typed = noteSourceOfQuery(query);
31293
31152
  const source = given ?? typed.source;
31294
- const words2 = typed.source !== void 0 && typed.source === source ? typed.rest : query;
31153
+ const rest = typed.source !== void 0 && typed.source === source ? typed.rest : query;
31295
31154
  const label = tag === void 0 ? void 0 : normalizeTag(tag);
31296
31155
  const filter = [expression ? `(${expression})` : "", label === void 0 ? "" : `tag:${label}`].filter(Boolean).join(" AND ") || void 0;
31156
+ const parsed = query.trim() ? parsedQuery(query, exact) : void 0;
31157
+ const words2 = parsed === void 0 ? "" : meaningWords(parsed);
31158
+ const narrowing = allOf([
31159
+ ...parsed === void 0 ? [] : [fieldsOfQuery(parsed)].filter((node) => node !== void 0),
31160
+ ...filter === void 0 ? [] : [parsedQuery(filter)]
31161
+ ]);
31297
31162
  const text = [query.trim() ? `(${query})` : "", filter ?? ""].filter(Boolean).join(" AND ");
31298
31163
  const window3 = offset + limit;
31299
31164
  const scope = {
@@ -31304,33 +31169,44 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
31304
31169
  };
31305
31170
  let meaningSkipped;
31306
31171
  let meaning;
31172
+ let meaningRefs;
31173
+ let meaningComplete = true;
31307
31174
  if (exact)
31308
31175
  meaningSkipped = "--exact searches words as written";
31309
- else if (words2.trim()) {
31176
+ else if (words2) {
31177
+ const lane2 = {
31178
+ command,
31179
+ ...env === void 0 ? {} : { env },
31180
+ ...embedders === void 0 ? {} : { embedders },
31181
+ ...folderIds === void 0 ? {} : { folderIds },
31182
+ ...withInternal ? { withInternal: true } : {},
31183
+ ...source === void 0 ? {} : { source }
31184
+ };
31185
+ const depth = Math.max(window3, CANDIDATES2);
31310
31186
  try {
31311
- const nearest = await nearestNotes(store, words2, {
31312
- limit: Math.max(window3, CANDIDATES2),
31313
- command,
31314
- ...env === void 0 ? {} : { env },
31315
- ...embedders === void 0 ? {} : { embedders },
31316
- ...folderIds === void 0 ? {} : { folderIds },
31317
- ...withInternal ? { withInternal: true } : {},
31318
- ...source === void 0 ? {} : { source }
31187
+ const within = narrowing === void 0 ? void 0 : await filterRefs(store, narrowing, scope);
31188
+ let nearest;
31189
+ if (within === void 0) {
31190
+ nearest = await nearestNotes(store, words2, { ...lane2, limit: depth });
31191
+ meaningComplete = nearest.length < depth;
31192
+ } else {
31193
+ const ranked2 = within.length ? await nearestAmong(store, words2, within, lane2) : [];
31194
+ meaningRefs = new Set(ranked2.map(({ ref }) => ref));
31195
+ nearest = ranked2.slice(0, depth);
31196
+ }
31197
+ const allowed = await matching(store, nearest.map(({ ref }) => ref), narrowing, scope);
31198
+ meaning = nearest.flatMap(({ ref }) => {
31199
+ const found = allowed.get(ref);
31200
+ return found ? [{ ref, ...found }] : [];
31319
31201
  });
31320
- if (filter === void 0)
31321
- meaning = nearest;
31322
- else {
31323
- const allowed = await searchNotesQuery(store, { text: filter, limit: FILTERED, ...scope });
31324
- const refs = new Set(allowed.items.map(({ ref }) => ref));
31325
- meaning = nearest.filter(({ ref }) => refs.has(ref));
31326
- }
31202
+ meaningRefs ??= new Set(meaning.map(({ ref }) => ref));
31327
31203
  } catch (error) {
31328
31204
  if (!(error instanceof CliError && error.code === "not_found"))
31329
31205
  throw error;
31330
31206
  meaningSkipped = error.message;
31331
31207
  }
31332
31208
  }
31333
- const titleWords = plainQueryWords(words2);
31209
+ const titleWords = plainQueryWords(rest);
31334
31210
  const titled = titleWords === void 0 ? { items: [], hasMore: false } : await searchNotesQuery(store, {
31335
31211
  text: [titleQuery(titleWords), filter ?? ""].filter(Boolean).join(" AND "),
31336
31212
  limit: Math.max(window3, CANDIDATES2),
@@ -31347,10 +31223,10 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
31347
31223
  ...scope
31348
31224
  });
31349
31225
  const ranked = /* @__PURE__ */ new Map();
31350
- const add = /* @__PURE__ */ __name((list2, by) => list2.forEach(({ ref, note }, rank) => {
31226
+ const add = /* @__PURE__ */ __name((list2, by) => list2.forEach(({ ref, note, at }, rank) => {
31351
31227
  if (tierRefs.has(ref))
31352
31228
  return;
31353
- const held = ranked.get(ref) ?? { note, score: 0, foundBy: [] };
31229
+ const held = ranked.get(ref) ?? { note, at, score: 0, foundBy: [] };
31354
31230
  held.score += 1 / (RRF_K3 + rank + 1);
31355
31231
  held.foundBy.push(by);
31356
31232
  ranked.set(ref, held);
@@ -31359,16 +31235,17 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
31359
31235
  if (meaning !== void 0)
31360
31236
  add(meaning, "meaning");
31361
31237
  const ordered = [
31362
- ...tier.map(({ ref, note }) => [ref, { note, score: 0, foundBy: ["title"] }]),
31238
+ ...tier.map(({ ref, note, at }) => [ref, { note, at, score: 0, foundBy: ["title"] }]),
31363
31239
  ...[...ranked.entries()].sort(([, a], [, b]) => b.score - a.score)
31364
31240
  ];
31365
31241
  const page = slice ? ordered : ordered.slice(offset, window3);
31366
31242
  const hasMore = slice ? matched.hasMore : ordered.length > window3 || matched.hasMore || titled.hasMore;
31243
+ const total = await notesTotal(store, text, { exact, scope, shown: offset + page.length, hasMore }, [...tier.map(({ ref }) => ref), ...meaningRefs ?? []], meaningComplete);
31367
31244
  const hits = [];
31368
31245
  const counts = /* @__PURE__ */ new Map();
31369
31246
  const accounts = await store.accounts.storedAccounts();
31370
31247
  const profiles = await store.accounts.profiles();
31371
- for (const [ref, { note, foundBy }] of page) {
31248
+ for (const [ref, { note, at, foundBy }] of page) {
31372
31249
  const links = (await store.notes.links({ from: ref })).map(({ to, targetText, kind, anchor }) => ({
31373
31250
  to,
31374
31251
  target_text: targetText,
@@ -31382,13 +31259,14 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
31382
31259
  path: note.path,
31383
31260
  title: note.title,
31384
31261
  ...documentSource(note, accounts, profiles, note.source === "file" ? (await store.files.ofDocument(note.ref))[0] : void 0),
31262
+ updated_at: at,
31385
31263
  excerpt: firstLine(note.text, words2),
31386
31264
  links,
31387
31265
  found_by: foundBy
31388
31266
  });
31389
- for (const link5 of new Map(links.map((link6) => [link6.to ?? `?${link6.target_text}`, link6])).values()) {
31390
- const key = link5.to ?? `?${link5.target_text}`;
31391
- const known = counts.get(key) ?? { ref: link5.to, name: link5.target_text, notes: 0 };
31267
+ for (const link4 of new Map(links.map((link5) => [link5.to ?? `?${link5.target_text}`, link5])).values()) {
31268
+ const key = link4.to ?? `?${link4.target_text}`;
31269
+ const known = counts.get(key) ?? { ref: link4.to, name: link4.target_text, notes: 0 };
31392
31270
  known.notes++;
31393
31271
  counts.set(key, known);
31394
31272
  }
@@ -31413,6 +31291,10 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
31413
31291
  command,
31414
31292
  embedder: pictureEmbedder
31415
31293
  }) : {};
31294
+ if (lane.pictures && narrowing !== void 0) {
31295
+ const allowed = await matching(store, lane.pictures.map(({ ref }) => ref), narrowing, scope);
31296
+ lane.pictures = lane.pictures.filter(({ ref }) => allowed.has(ref));
31297
+ }
31416
31298
  return {
31417
31299
  query,
31418
31300
  ...label === void 0 ? {} : { tag: label },
@@ -31420,6 +31302,7 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
31420
31302
  by: meaning === void 0 ? "words" : "words and meaning",
31421
31303
  ...meaningSkipped === void 0 ? {} : { meaning_skipped: meaningSkipped },
31422
31304
  hits,
31305
+ total,
31423
31306
  has_more: hasMore,
31424
31307
  ...hasMore && window3 <= MAX_NOTES_OFFSET ? { next_offset: window3 } : {},
31425
31308
  linked: [...counts.values()].sort((a, b) => b.notes - a.notes || (a.name ?? a.ref ?? "").localeCompare(b.name ?? b.ref ?? "")),
@@ -31458,7 +31341,7 @@ var searchNotesOf = /* @__PURE__ */ __name(async (store, account, text, { accoun
31458
31341
  };
31459
31342
  }, "searchNotesOf");
31460
31343
 
31461
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/events-search.js
31344
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/events-search.js
31462
31345
  var MAX_EVENTS_OFFSET = 1e3;
31463
31346
  var iso3 = /* @__PURE__ */ __name((at) => at === null ? null : new Date(at).toISOString(), "iso");
31464
31347
  var accountIdsOf = /* @__PURE__ */ __name(async (store, accounts) => {
@@ -31570,7 +31453,7 @@ var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, off
31570
31453
  };
31571
31454
  }, "searchEvents");
31572
31455
 
31573
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/search-all.js
31456
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/search-all.js
31574
31457
  var RESOURCES_SEARCHED = ["messages", "mail", "notes", "events"];
31575
31458
  var skippable = /* @__PURE__ */ __name((error) => error instanceof CliError && (error.code === "validation_error" || error.code === "not_found"), "skippable");
31576
31459
  var filtersBeside = /* @__PURE__ */ __name((text) => {
@@ -31597,6 +31480,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
31597
31480
  let events;
31598
31481
  let messagesBy;
31599
31482
  let server;
31483
+ let coverage;
31600
31484
  const messagesOf = /* @__PURE__ */ __name(async (kind) => {
31601
31485
  const given = request.scope?.[kind];
31602
31486
  const query = {
@@ -31617,6 +31501,8 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
31617
31501
  const found = kind === "messages" ? await searchMessages(query) : await searchStore(store, account, query, messenger);
31618
31502
  if (found.server)
31619
31503
  server = found.server;
31504
+ if (kind === "messages" && found.coverage)
31505
+ coverage = found.coverage;
31620
31506
  hasMore ||= found.hasMore;
31621
31507
  const read = found.coverage?.accounts ?? given ?? (await store.accounts.accounts()).filter(({ provider }) => kindIn(provider) === kind);
31622
31508
  for (const one of found.skipped ?? [])
@@ -31770,11 +31656,12 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, request, messenger
31770
31656
  ...notes === void 0 ? {} : { notes },
31771
31657
  ...events === void 0 ? {} : { events },
31772
31658
  ...messagesBy === void 0 ? {} : { messages: messagesBy },
31773
- ...server === void 0 ? {} : { server }
31659
+ ...server === void 0 ? {} : { server },
31660
+ ...coverage === void 0 ? {} : { coverage }
31774
31661
  };
31775
31662
  }, "searchAll");
31776
31663
 
31777
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/search-all-meetings.js
31664
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/search-all-meetings.js
31778
31665
  var RESOURCES_SEARCHED_WITH_MEETINGS = [...RESOURCES_SEARCHED, "meetings"];
31779
31666
  var whole2 = /* @__PURE__ */ __name((value, minimum, maximum, label) => {
31780
31667
  if (!Number.isSafeInteger(value) || value < minimum || value > maximum)
@@ -32021,7 +31908,7 @@ var searchAllOfSource = /* @__PURE__ */ __name(async (store, account, source, re
32021
31908
  return { ...found, skipped: [...skipped, ...empty2, ...unnamed, ...found.skipped] };
32022
31909
  }, "searchAllOfSource");
32023
31910
 
32024
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/server-search.js
31911
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/server-search.js
32025
31912
  var SERVER_SEARCH_KEY = "messages.server-search";
32026
31913
  var SERVER_BOUNDS = { timeMs: 5e3, perCall: 100, maxCalls: 3 };
32027
31914
  var DEFAULT_BACKEND = "both";
@@ -32146,7 +32033,7 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
32146
32033
  const calls = unique.slice(0, SERVER_BOUNDS.maxCalls);
32147
32034
  const pending = new Set(calls);
32148
32035
  const found = [];
32149
- let open10 = true;
32036
+ let open7 = true;
32150
32037
  const fail = /* @__PURE__ */ __name((branch, reason) => {
32151
32038
  pending.delete(branch);
32152
32039
  report.complete = false;
@@ -32155,19 +32042,19 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
32155
32042
  const ask = /* @__PURE__ */ __name(async (adapter) => {
32156
32043
  const search = capability(adapter, "searchMessages", "search messages on its server");
32157
32044
  await Promise.all(calls.map(async (branch) => {
32158
- if (!open10)
32045
+ if (!open7)
32159
32046
  return;
32160
32047
  report.calls += 1;
32161
32048
  try {
32162
32049
  const page = await search(asQuery(branch), { limit: SERVER_BOUNDS.perCall, signal: stop });
32163
- if (!open10)
32050
+ if (!open7)
32164
32051
  return;
32165
32052
  pending.delete(branch);
32166
32053
  if (page.hasMore)
32167
32054
  report.complete = false;
32168
32055
  found.push(page);
32169
32056
  } catch (error) {
32170
- if (!open10)
32057
+ if (!open7)
32171
32058
  return;
32172
32059
  fail(branch, error instanceof CliError && error.code === "rate_limited" ? "rate_limited" : "search_failed");
32173
32060
  }
@@ -32179,11 +32066,11 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
32179
32066
  run.then(() => "done", () => "failed"),
32180
32067
  bound2
32181
32068
  ]);
32182
- open10 = false;
32069
+ open7 = false;
32183
32070
  for (const branch of [...pending])
32184
32071
  fail(branch, outcome2 === "failed" ? "search_failed" : "time_or_abort_bound");
32185
32072
  } finally {
32186
- open10 = false;
32073
+ open7 = false;
32187
32074
  clearTimeout(timer);
32188
32075
  }
32189
32076
  const chats = new Map(found.flatMap(({ chats: chats2 }) => chats2).map((chat) => [chat.id, chat]));
@@ -32210,7 +32097,7 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
32210
32097
  return { report, sources };
32211
32098
  }, "searchServer");
32212
32099
 
32213
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/messages.js
32100
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/messages.js
32214
32101
  var DELETE_AT_ONCE = 10;
32215
32102
  var messagesService = /* @__PURE__ */ __name((deps) => {
32216
32103
  const { guard } = deps;
@@ -32636,7 +32523,7 @@ var checkMediaOptions = /* @__PURE__ */ __name((messenger, asked, attachments) =
32636
32523
  throw new CliError("validation_error", `${MEDIA_FLAGS[first2]} needs a --photo or --file`);
32637
32524
  }, "checkMediaOptions");
32638
32525
 
32639
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/domain/channel-tags.js
32526
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/domain/channel-tags.js
32640
32527
  var CHANNEL_TAG_RULES_VERSION = "keywords-v1";
32641
32528
  var RULES = {
32642
32529
  ai: [/\b(ai|gpt|llm|machine learning|artificial intelligence)\b/iu, /нейросет|искусственн/iu],
@@ -32651,7 +32538,7 @@ var classifyChannel = /* @__PURE__ */ __name((metadata) => Object.entries(RULES)
32651
32538
  return fields.length ? [{ tag, score: fields.length / 3, fields }] : [];
32652
32539
  }), "classifyChannel");
32653
32540
 
32654
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/metadata.js
32541
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/metadata.js
32655
32542
  var metadataService = /* @__PURE__ */ __name((deps) => {
32656
32543
  const held = /* @__PURE__ */ __name(async (reference, { includeLeft = false } = {}) => {
32657
32544
  const store = await deps.store();
@@ -32737,7 +32624,7 @@ var metadataService = /* @__PURE__ */ __name((deps) => {
32737
32624
  };
32738
32625
  }, "metadataService");
32739
32626
 
32740
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/moderation/run.js
32627
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/moderation/run.js
32741
32628
  var FIRST_LOOK_MS = 24 * 36e5;
32742
32629
  var moderateWith = /* @__PURE__ */ __name(async (run) => {
32743
32630
  const { chatId, title, rules, point, since, dryRun } = run;
@@ -32774,7 +32661,7 @@ var moderateWith = /* @__PURE__ */ __name(async (run) => {
32774
32661
  return { chatId, rows, notes };
32775
32662
  }, "moderateWith");
32776
32663
 
32777
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/moderation.js
32664
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/moderation.js
32778
32665
  var moderationService = /* @__PURE__ */ __name((deps) => {
32779
32666
  const file2 = /* @__PURE__ */ __name(() => new ModerationRules(moderationPathFor(deps.messenger.app, deps.profile ?? "default", deps.env ?? process.env)), "file");
32780
32667
  const group = /* @__PURE__ */ __name(async (chat) => {
@@ -32852,7 +32739,7 @@ var moderatorOf = /* @__PURE__ */ __name((adapter, deps) => ({
32852
32739
  }, "removePerson")
32853
32740
  }), "moderatorOf");
32854
32741
 
32855
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/private-people.js
32742
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/private-people.js
32856
32743
  var noteItem = /* @__PURE__ */ __name((provider, note) => ({
32857
32744
  id: note.id,
32858
32745
  contact: formatReference({ type: "contact", provider, id: note.personId }),
@@ -32896,7 +32783,7 @@ var privatePeopleService = /* @__PURE__ */ __name((deps) => {
32896
32783
  };
32897
32784
  }, "privatePeopleService");
32898
32785
 
32899
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/rankings.js
32786
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/rankings.js
32900
32787
  var empty = /* @__PURE__ */ __name(() => ({
32901
32788
  total: 0,
32902
32789
  population: 0,
@@ -33152,7 +33039,7 @@ var rankingsService = /* @__PURE__ */ __name((deps) => ({
33152
33039
  }, "evidence")
33153
33040
  }), "rankingsService");
33154
33041
 
33155
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/searches.js
33042
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/searches.js
33156
33043
  var savedSearchItem = /* @__PURE__ */ __name((one) => ({
33157
33044
  id: one.id,
33158
33045
  name: one.name,
@@ -33281,7 +33168,7 @@ var searchesService = /* @__PURE__ */ __name((deps) => {
33281
33168
  };
33282
33169
  }, "searchesService");
33283
33170
 
33284
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/tags.js
33171
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/tags.js
33285
33172
  var TAGGING_QUERY = {
33286
33173
  entity: "tagging",
33287
33174
  backend: "sql",
@@ -33365,7 +33252,7 @@ var tagsService = /* @__PURE__ */ __name((deps) => {
33365
33252
  };
33366
33253
  }, "tagsService");
33367
33254
 
33368
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/topics.js
33255
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/topics.js
33369
33256
  var actionOf = /* @__PURE__ */ __name(({ title, closed, pinned, hidden }) => {
33370
33257
  const set = [closed, pinned, hidden].filter((one) => one !== void 0).length;
33371
33258
  if (title !== void 0 || set !== 1)
@@ -33550,8 +33437,8 @@ var topicsService = /* @__PURE__ */ __name((deps) => {
33550
33437
  };
33551
33438
  }, "topicsService");
33552
33439
 
33553
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/evidence.js
33554
- import { createHash as createHash10, randomUUID as randomUUID7 } from "node:crypto";
33440
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/evidence.js
33441
+ import { createHash as createHash10, randomUUID as randomUUID5 } from "node:crypto";
33555
33442
  var hash2 = /* @__PURE__ */ __name((value) => createHash10("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
33556
33443
  var positive = /* @__PURE__ */ __name((value, name, minimum = 1) => {
33557
33444
  if (!Number.isSafeInteger(value) || value < minimum)
@@ -33621,10 +33508,10 @@ var prepareEvidencePacket = /* @__PURE__ */ __name(({ kind, source, page, limits
33621
33508
  },
33622
33509
  items
33623
33510
  };
33624
- return { ...content, id: randomUUID7(), fingerprint: hash2(content) };
33511
+ return { ...content, id: randomUUID5(), fingerprint: hash2(content) };
33625
33512
  }, "prepareEvidencePacket");
33626
33513
 
33627
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/evidence-read.js
33514
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/evidence-read.js
33628
33515
  var readEvidencePacket = /* @__PURE__ */ __name(async (store, account, { chat, limit, before: before2 }, messenger = {}) => {
33629
33516
  if (!Number.isSafeInteger(limit) || limit < 1 || limit > 100)
33630
33517
  throw new CliError("validation_error", "evidence message limit must be an integer from 1 to 100");
@@ -33644,7 +33531,7 @@ var readEvidencePacket = /* @__PURE__ */ __name(async (store, account, { chat, l
33644
33531
  return { ...packet, nextBeforeId: older && last ? last.id : null };
33645
33532
  }, "readEvidencePacket");
33646
33533
 
33647
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/meeting-project-discovery.js
33534
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/meeting-project-discovery.js
33648
33535
  var scopeKeys = [
33649
33536
  "accountId",
33650
33537
  "meetingId",
@@ -33666,7 +33553,7 @@ var optionKeys = /* @__PURE__ */ new Set([
33666
33553
  "maxVocabularyReadBytes"
33667
33554
  ]);
33668
33555
 
33669
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/context/communication-selection.js
33556
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/context/communication-selection.js
33670
33557
  var communicationFields = {
33671
33558
  sources: pipe(array(strictObject({
33672
33559
  id: pipe(string(), regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/)),
@@ -33698,7 +33585,7 @@ var communicationRequest = /* @__PURE__ */ __name((value, preparationAfter) => {
33698
33585
  return { ...input, after, before: before2 };
33699
33586
  }, "communicationRequest");
33700
33587
 
33701
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/meeting-preparation-validation.js
33588
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/meeting-preparation-validation.js
33702
33589
  var MEETING_PREPARATION_LIMITS = {
33703
33590
  meetings: { min: 1, max: 20, default: 5 },
33704
33591
  cues: { min: 1, max: 100, default: 10 },
@@ -33771,7 +33658,7 @@ var validateMeetingPreparationRequest = /* @__PURE__ */ __name((externalId, orig
33771
33658
  };
33772
33659
  }, "validateMeetingPreparationRequest");
33773
33660
 
33774
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/meeting-communications-selection.js
33661
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/meeting-communications-selection.js
33775
33662
  var validatePreparationCommunications = /* @__PURE__ */ __name((section, request, after) => {
33776
33663
  const fail = /* @__PURE__ */ __name(() => {
33777
33664
  throw new CliError("invalid_response", "Preparation communications returned another selection or invalid evidence");
@@ -33819,7 +33706,7 @@ var validatePreparationCommunications = /* @__PURE__ */ __name((section, request
33819
33706
  }
33820
33707
  }, "validatePreparationCommunications");
33821
33708
 
33822
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/package-upgrade.js
33709
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/package-upgrade.js
33823
33710
  var upgradePackage = /* @__PURE__ */ __name(async ({ current, command, packageName, check: check2 }, ports) => {
33824
33711
  const installer = ports.installer();
33825
33712
  const argv = updateCommand(installer, packageName);
@@ -33884,7 +33771,7 @@ var dayAfter = /* @__PURE__ */ __name((published) => {
33884
33771
  return Number.isNaN(time) ? null : new Date(time + 24 * 60 * 60 * 1e3).toISOString();
33885
33772
  }, "dayAfter");
33886
33773
 
33887
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/services/index.js
33774
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/services/index.js
33888
33775
  var servicesFor = /* @__PURE__ */ __name((deps) => {
33889
33776
  const pictures = picturesService(deps);
33890
33777
  const base = {
@@ -33920,12 +33807,12 @@ var servicesFor = /* @__PURE__ */ __name((deps) => {
33920
33807
  return deps.messenger.services ? { ...base, ...deps.messenger.services(base, deps) } : base;
33921
33808
  }, "servicesFor");
33922
33809
 
33923
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/background/relay.js
33810
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/background/relay.js
33924
33811
  import { createHash as createHash11 } from "node:crypto";
33925
33812
  import { chmodSync, lstatSync, mkdirSync as mkdirSync2, rmSync } from "node:fs";
33926
33813
  import { createConnection, createServer } from "node:net";
33927
33814
  import { tmpdir } from "node:os";
33928
- import { dirname as dirname7, isAbsolute as isAbsolute3, join as join15 } from "node:path";
33815
+ import { dirname as dirname5, isAbsolute as isAbsolute3, join as join12 } from "node:path";
33929
33816
  import { PassThrough, Writable } from "node:stream";
33930
33817
  var RELAY_PROTOCOL = 1;
33931
33818
  var requestSchema = strictObject({
@@ -33943,11 +33830,11 @@ var relayPath = /* @__PURE__ */ __name((lockPath) => {
33943
33830
  if (beside.length <= MAX_SOCKET_PATH)
33944
33831
  return beside;
33945
33832
  const hash3 = createHash11("sha256").update(beside).digest("hex").slice(0, 16);
33946
- const name = join15(`wirecat-relay-${process.getuid?.() ?? "user"}`, `${hash3}.sock`);
33947
- const temporary = join15(tmpdir(), name);
33833
+ const name = join12(`wirecat-relay-${process.getuid?.() ?? "user"}`, `${hash3}.sock`);
33834
+ const temporary = join12(tmpdir(), name);
33948
33835
  if (temporary.length <= MAX_SOCKET_PATH || process.platform === "win32")
33949
33836
  return temporary;
33950
- return join15("/tmp", name);
33837
+ return join12("/tmp", name);
33951
33838
  }, "relayPath");
33952
33839
  var privateDirectory = /* @__PURE__ */ __name((dir) => {
33953
33840
  mkdirSync2(dir, { recursive: true, mode: 448 });
@@ -33978,19 +33865,19 @@ var frame = /* @__PURE__ */ __name((socket, value) => {
33978
33865
  `);
33979
33866
  }, "frame");
33980
33867
  var listenRelay = /* @__PURE__ */ __name(async (path, run) => {
33981
- privateDirectory(dirname7(path));
33868
+ privateDirectory(dirname5(path));
33982
33869
  rmSync(path, { force: true });
33983
- const open10 = /* @__PURE__ */ new Set();
33870
+ const open7 = /* @__PURE__ */ new Set();
33984
33871
  const running = /* @__PURE__ */ new Set();
33985
33872
  const server = createServer((socket) => {
33986
- open10.add(socket);
33873
+ open7.add(socket);
33987
33874
  const stop = new AbortController();
33988
33875
  const stdin = new PassThrough();
33989
33876
  let started = false;
33990
33877
  socket.on("error", () => {
33991
33878
  });
33992
33879
  socket.on("close", () => {
33993
- open10.delete(socket);
33880
+ open7.delete(socket);
33994
33881
  stop.abort(new CliError("cancelled", "the client went away", { retryable: false }));
33995
33882
  if (!stdin.writableEnded)
33996
33883
  stdin.end();
@@ -34039,7 +33926,7 @@ var listenRelay = /* @__PURE__ */ __name(async (path, run) => {
34039
33926
  chmodSync(path, 384);
34040
33927
  return {
34041
33928
  close: /* @__PURE__ */ __name(async () => {
34042
- for (const socket of open10)
33929
+ for (const socket of open7)
34043
33930
  socket.destroy();
34044
33931
  await new Promise((resolve7) => server.close(() => resolve7()));
34045
33932
  await Promise.allSettled(running);
@@ -34141,7 +34028,7 @@ var relayCommand = /* @__PURE__ */ __name((path, request, options) => new Promis
34141
34028
  }, () => finish({ error: stopped() }));
34142
34029
  }), "relayCommand");
34143
34030
 
34144
- // node_modules/.pnpm/@wirecat+cli-core@0.484.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._745f5d1ffb248c61bc3ef77928e0c2a2/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-relay.js
34031
+ // node_modules/.pnpm/@wirecat+cli-core@0.501.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.67.0_commander@15._175d7b0a70ee7b08949f50032917d93e/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-relay.js
34145
34032
  var lentConnection = /* @__PURE__ */ __name((connection, watchers) => throughWrapper(connection, {
34146
34033
  close: /* @__PURE__ */ __name(async () => {
34147
34034
  }, "close"),
@@ -34241,11 +34128,8 @@ export {
34241
34128
  pickPerson,
34242
34129
  REGISTRIES,
34243
34130
  registriesCover,
34131
+ chatCoverage,
34244
34132
  excerpt,
34245
- writeFileAtomic,
34246
- syncDirectory,
34247
- readBoundedUtf8File,
34248
- acquireLock,
34249
34133
  validateMediaSince,
34250
34134
  checkMediaArchive,
34251
34135
  archiveMedia,