@wirecat/zoom-cli 0.60.0 → 0.61.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 (191) hide show
  1. package/README.md +7 -6
  2. package/dist/answers.d.ts +16 -0
  3. package/dist/answers.d.ts.map +1 -1
  4. package/dist/bin/main.js +1 -0
  5. package/dist/bin/main.js.map +1 -1
  6. package/dist/bin/zm.js +2 -2
  7. package/dist/bundle/{chunk-PUOBYJFI.js → all-profiles-HZLIU6RZ.js} +11 -7
  8. package/dist/bundle/answer-policy-GRODO2DY.js +96 -0
  9. package/dist/bundle/{anthropic-TT2XV74T.js → anthropic-O2YYPCVK.js} +4 -4
  10. package/dist/bundle/{app-server-POMYD6QV.js → app-server-YYCANTUE.js} +50 -50
  11. package/dist/bundle/{bun-JVDJVDHL.js → bun-UEFRULAT.js} +2 -2
  12. package/dist/bundle/{bun-sqlite-BBOPAQVG.js → bun-sqlite-VVYKOY7S.js} +3 -3
  13. package/dist/bundle/{chunk-KVPYI52N.js → chunk-2M2U43IF.js} +2 -2
  14. package/dist/bundle/{chunk-7GVNQOV6.js → chunk-35X6G276.js} +1 -1
  15. package/dist/bundle/{chunk-RH5YXXAB.js → chunk-3TGR4RDD.js} +32 -34
  16. package/dist/bundle/{chunk-YZZ6NBXC.js → chunk-4XI4PDEH.js} +31 -21
  17. package/dist/bundle/{chunk-W5EUHV3J.js → chunk-4XPIOW5L.js} +1 -1
  18. package/dist/bundle/{chunk-PU4FKK5T.js → chunk-5NRBNGR3.js} +2 -2
  19. package/dist/bundle/{chunk-LYZNVNJA.js → chunk-67WW33JB.js} +49 -24
  20. package/dist/bundle/{chunk-3P4LUGXI.js → chunk-6LHTWR3X.js} +2 -2
  21. package/dist/bundle/{chunk-SG3WSP7Y.js → chunk-6RV7KXDF.js} +7 -7
  22. package/dist/bundle/{chunk-VYUSEJE4.js → chunk-6SLGIPLT.js} +2 -2
  23. package/dist/bundle/{chunk-EOZWDEJL.js → chunk-77GJITSU.js} +2 -2
  24. package/dist/bundle/{chunk-72A7CIPL.js → chunk-7ATLKYBN.js} +17 -17
  25. package/dist/bundle/{chunk-YSZQ5SZK.js → chunk-7DMMNCY2.js} +3 -3
  26. package/dist/bundle/chunk-ABCHE4YP.js +217 -0
  27. package/dist/bundle/{chunk-G3MXAGF2.js → chunk-AOSIU5T6.js} +51 -38
  28. package/dist/bundle/{chunk-TAQKNWCD.js → chunk-B3PTSX5D.js} +2 -2
  29. package/dist/bundle/{chunk-J3N2LL37.js → chunk-B45MFBBF.js} +6 -6
  30. package/dist/bundle/{chunk-GNRYFESK.js → chunk-BNUNZTOU.js} +25 -25
  31. package/dist/bundle/{chunk-SK3K2VHF.js → chunk-BPQNTYLN.js} +388 -299
  32. package/dist/bundle/{chunk-LKV3NRCJ.js → chunk-CMG54Q4X.js} +120 -32
  33. package/dist/bundle/{chunk-DP5DX45H.js → chunk-COU66X3X.js} +7 -5
  34. package/dist/bundle/{chunk-NKFRV2LB.js → chunk-CUSGSXSR.js} +2 -2
  35. package/dist/bundle/{chunk-MFS52LTZ.js → chunk-DLAFGSTN.js} +1 -1
  36. package/dist/bundle/{chunk-DKIIKMSE.js → chunk-E4QPLXZT.js} +47 -47
  37. package/dist/bundle/{chunk-MGYFSXI5.js → chunk-E4T7IJJO.js} +26 -26
  38. package/dist/bundle/{chunk-AJA5ZAV6.js → chunk-F32GKBMF.js} +22 -5
  39. package/dist/bundle/{chunk-DN7VHENQ.js → chunk-FAOVUALC.js} +13 -13
  40. package/dist/bundle/{chunk-EF2RCQ3L.js → chunk-FBJC7OCI.js} +1 -1
  41. package/dist/bundle/{chunk-HIAO4MPA.js → chunk-FQ54A7GI.js} +1 -1
  42. package/dist/bundle/{chunk-EXFAA4N3.js → chunk-FXY45HU7.js} +6 -6
  43. package/dist/bundle/{chunk-2EVRKK75.js → chunk-GNHPYQMM.js} +2 -2
  44. package/dist/bundle/{chunk-M5WLBRL7.js → chunk-H5EAHMQN.js} +11 -11
  45. package/dist/bundle/chunk-HF233RN4.js +335 -0
  46. package/dist/bundle/{chunk-24DLFGES.js → chunk-HTGBUE2U.js} +2 -2
  47. package/dist/bundle/{chunk-RSLXLUTS.js → chunk-IKZFR645.js} +10 -10
  48. package/dist/bundle/chunk-JKWYXBGK.js +380 -0
  49. package/dist/bundle/{chunk-DAQXO6SM.js → chunk-KGZHRJ7H.js} +4 -4
  50. package/dist/bundle/{chunk-ZK7Y5K63.js → chunk-KPZIQKOF.js} +1 -1
  51. package/dist/bundle/{chunk-7T3BUWJK.js → chunk-KXYURHVE.js} +118 -95
  52. package/dist/bundle/{chunk-4HZRZDMC.js → chunk-KZGHGU2M.js} +4 -4
  53. package/dist/bundle/{chunk-2TV7UTHK.js → chunk-KZV5GU7G.js} +8 -8
  54. package/dist/bundle/{chunk-YIMI6O7R.js → chunk-L7VIPVHL.js} +263 -199
  55. package/dist/bundle/{chunk-XLJV3ZOH.js → chunk-LPJ3S6GE.js} +1 -1
  56. package/dist/bundle/{chunk-HBYE4EP2.js → chunk-LX6DO44O.js} +1 -1
  57. package/dist/bundle/{chunk-3UMXCNDI.js → chunk-LXOSBFWW.js} +7 -7
  58. package/dist/bundle/{chunk-KUBCUE6T.js → chunk-M3EVVGR6.js} +2 -2
  59. package/dist/bundle/{chunk-WVXAQVLG.js → chunk-MBMDF5EL.js} +6 -6
  60. package/dist/bundle/{chunk-KUBWRI5E.js → chunk-MTAVA2LS.js} +2 -2
  61. package/dist/bundle/{chunk-AQDWGJZT.js → chunk-MVRCLMQL.js} +39 -2
  62. package/dist/bundle/{chunk-UOFOMU3T.js → chunk-NVN4O5IC.js} +14 -10
  63. package/dist/bundle/{chunk-SKENSSY2.js → chunk-O3WVOAT7.js} +408 -420
  64. package/dist/bundle/{chunk-EROQ5SC7.js → chunk-OLZE27RS.js} +2 -2
  65. package/dist/bundle/{chunk-22UBF6U6.js → chunk-OMUX4LSS.js} +4 -4
  66. package/dist/bundle/{chunk-QJCVOVNR.js → chunk-OU46OTTE.js} +3 -3
  67. package/dist/bundle/{chunk-JBGYI5BY.js → chunk-OVVDOVLN.js} +2 -2
  68. package/dist/bundle/{chunk-I45V6AFG.js → chunk-P2NRA7E5.js} +2 -2
  69. package/dist/bundle/{chunk-7PQY4ISY.js → chunk-PCUPOGKR.js} +6 -4
  70. package/dist/bundle/{chunk-4MC4Z45G.js → chunk-QHT2LZRW.js} +6 -6
  71. package/dist/bundle/{decode-UBPIHVNG.js → chunk-RGOBGHWE.js} +21 -18
  72. package/dist/bundle/{chunk-UOL4ILXT.js → chunk-RSXLI5GP.js} +79 -59
  73. package/dist/bundle/{chunk-RNX73QCL.js → chunk-S726LZCH.js} +6 -6
  74. package/dist/bundle/{chunk-TB72GE55.js → chunk-SVBM6F4Z.js} +1 -1
  75. package/dist/bundle/{chunk-GXACHTB2.js → chunk-T7IQMYPW.js} +15 -3
  76. package/dist/bundle/{chunk-Q4NDCDFG.js → chunk-TD4Y5LXG.js} +25 -22
  77. package/dist/bundle/{chunk-V2QOLHPM.js → chunk-U4Y2QQ2D.js} +3 -3
  78. package/dist/bundle/{chunk-ODFIV4OS.js → chunk-UPWHCUVA.js} +617 -380
  79. package/dist/bundle/{chunk-E3AMUYNB.js → chunk-UYAKSUT5.js} +5 -5
  80. package/dist/bundle/{chunk-J5ZVGKSZ.js → chunk-VARX3SBT.js} +1 -1
  81. package/dist/bundle/{chunk-IFXPNXAH.js → chunk-WVYSOV3C.js} +16 -4
  82. package/dist/bundle/{chunk-LZBWU2IA.js → chunk-XOJGXWTK.js} +8 -8
  83. package/dist/bundle/{chunk-4FTPE5SB.js → chunk-XX2PDQ54.js} +31 -211
  84. package/dist/bundle/{chunk-D6L35XQS.js → chunk-XZ4OVTA5.js} +9 -9
  85. package/dist/bundle/{chunk-XAF2LHZG.js → chunk-YESOQEOB.js} +735 -826
  86. package/dist/bundle/{cli-WIMAOCXF.js → cli-O4LAGYXI.js} +60 -54
  87. package/dist/bundle/command-contract-67QKBY6M.js +38 -0
  88. package/dist/bundle/config-ABURZDD2.js +78 -0
  89. package/dist/bundle/decode-WRMZJJCR.js +20 -0
  90. package/dist/bundle/{dist-YYDTME5J.js → dist-SQK4GIJT.js} +14 -14
  91. package/dist/bundle/{echarts-4OQHS575.js → echarts-3DOOJSQR.js} +2 -2
  92. package/dist/bundle/{embed-7JHEPBFD.js → embed-OYRHTMFI.js} +4 -4
  93. package/dist/bundle/{embedder-HTRPWR6T.js → embedder-ZAYCL22W.js} +7 -7
  94. package/dist/bundle/{first-run-I52ADRJ2.js → first-run-QXSPIXOQ.js} +8 -8
  95. package/dist/bundle/first-screen-MD6HWIJW.js +36 -0
  96. package/dist/bundle/{folders-5ZBUQHAM.js → folders-EXQLKXVK.js} +2 -2
  97. package/dist/bundle/{instructions-3QZBKKPF.js → instructions-GFEOB7XJ.js} +1 -1
  98. package/dist/bundle/{main-64VVZ5QG.js → main-RADF3CRI.js} +17 -16
  99. package/dist/bundle/{mcp-OQBZXELQ.js → mcp-WSGVVZWI.js} +2 -2
  100. package/dist/bundle/{meetings-RD3NU6NN.js → meetings-6BIIT42H.js} +4 -4
  101. package/dist/bundle/{node-R2BLYUSB.js → node-A3B2YRQI.js} +2 -2
  102. package/dist/bundle/{node-sqlite-DGEEDBXV.js → node-sqlite-XRP5FUDY.js} +3 -3
  103. package/dist/bundle/{oauth-NRZMCFH3.js → oauth-YICY4AN4.js} +5 -5
  104. package/dist/bundle/{open-SUGCOCAU.js → open-4CNKSQRB.js} +2 -2
  105. package/dist/bundle/openai-YYRO3X7I.js +22 -0
  106. package/dist/bundle/{output-file-SXV2ANW7.js → output-file-7BXYV6OL.js} +3 -3
  107. package/dist/bundle/{process-IX5YWGDP.js → process-A45QXKID.js} +1 -1
  108. package/dist/bundle/{program-WGNTV7NS.js → program-DTP7BRTW.js} +422 -431
  109. package/dist/bundle/{prompt-NICXDWN3.js → prompt-5LMKO7SE.js} +3 -3
  110. package/dist/bundle/{recognize-6DAHO6X6.js → recognize-MB6WRGUD.js} +4 -2
  111. package/dist/bundle/{remote-JZ3TXP6I.js → remote-PD7WMTTS.js} +5 -5
  112. package/dist/bundle/{rerank-YSXWCAGZ.js → rerank-7E6GQ5Y6.js} +5 -5
  113. package/dist/bundle/{run-log-APHZZWC7.js → run-log-TCFK4LEC.js} +53 -53
  114. package/dist/bundle/{chunk-HWZXQLR5.js → serve-JBT2BWHK.js} +8 -6
  115. package/dist/bundle/server-CFIKEPLG.js +66 -0
  116. package/dist/bundle/{chunk-EH6G2LEU.js → server-H2UPGGBI.js} +43 -10
  117. package/dist/bundle/{services-D64U72OE.js → services-SJOTKL5V.js} +33 -26
  118. package/dist/bundle/{speech-QLCQAT4O.js → speech-4SL25GSC.js} +28 -5
  119. package/dist/bundle/{state-KAD3R27T.js → state-FVMTDZ6B.js} +4 -4
  120. package/dist/bundle/{store-7UNPRLZ3.js → store-DNPKBUVO.js} +13 -13
  121. package/dist/bundle/{store-2BHHS77S.js → store-TI77SCNL.js} +15 -15
  122. package/dist/bundle/store-connection-GIFWWMNO.js +76 -0
  123. package/dist/bundle/store-maintenance-command-WBKGF2CZ.js +55 -0
  124. package/dist/bundle/{streaming-AK6Q2ZGQ.js → streaming-UHAHGPH5.js} +4 -4
  125. package/dist/bundle/{tokens-CCM3D4ZT.js → tokens-Y2MX6JBL.js} +4 -4
  126. package/dist/bundle/zm.js +1 -1
  127. package/dist/commands.d.ts +1 -2
  128. package/dist/commands.d.ts.map +1 -1
  129. package/dist/commands.js +3 -16
  130. package/dist/commands.js.map +1 -1
  131. package/dist/contract-overrides.d.ts +0 -2
  132. package/dist/contract-overrides.d.ts.map +1 -1
  133. package/dist/contract-overrides.js +0 -158
  134. package/dist/contract-overrides.js.map +1 -1
  135. package/dist/login.d.ts +1 -0
  136. package/dist/login.d.ts.map +1 -1
  137. package/dist/login.js +1 -1
  138. package/dist/login.js.map +1 -1
  139. package/dist/program-bindings.d.ts +1 -1
  140. package/dist/program-bindings.d.ts.map +1 -1
  141. package/dist/program-bindings.js +16 -18
  142. package/dist/program-bindings.js.map +1 -1
  143. package/dist/program.d.ts +2 -4
  144. package/dist/program.d.ts.map +1 -1
  145. package/dist/program.js.map +1 -1
  146. package/dist/read-only.d.ts.map +1 -1
  147. package/dist/read-only.js +3 -0
  148. package/dist/read-only.js.map +1 -1
  149. package/dist/recording-schedule-setup.d.ts.map +1 -1
  150. package/dist/recording-schedule-setup.js +1 -0
  151. package/dist/recording-schedule-setup.js.map +1 -1
  152. package/dist/run.d.ts.map +1 -1
  153. package/dist/run.js +82 -32
  154. package/dist/run.js.map +1 -1
  155. package/dist/setup-commands.d.ts.map +1 -1
  156. package/dist/setup-commands.js +14 -47
  157. package/dist/setup-commands.js.map +1 -1
  158. package/dist/store-commands.d.ts.map +1 -1
  159. package/dist/store-commands.js +4 -1
  160. package/dist/store-commands.js.map +1 -1
  161. package/dist/tokens.d.ts +15 -0
  162. package/dist/tokens.d.ts.map +1 -1
  163. package/dist/tokens.js +40 -1
  164. package/dist/tokens.js.map +1 -1
  165. package/dist/version.d.ts +1 -1
  166. package/dist/version.js +1 -1
  167. package/package.json +3 -3
  168. package/dist/bundle/all-profiles-7OZPJY76.js +0 -25
  169. package/dist/bundle/answer-policy-PVWMA2QC.js +0 -96
  170. package/dist/bundle/chunk-57LT4A2E.js +0 -48
  171. package/dist/bundle/chunk-XMCVB4Q4.js +0 -390
  172. package/dist/bundle/chunk-YLBNPI7H.js +0 -2
  173. package/dist/bundle/command-contract-J7PDZQMC.js +0 -38
  174. package/dist/bundle/config-G62PBNZF.js +0 -79
  175. package/dist/bundle/first-screen-XNCFWOLC.js +0 -36
  176. package/dist/bundle/mcp-5SJXWEJW.js +0 -92
  177. package/dist/bundle/mcp-ZMIPDB4R.js +0 -189
  178. package/dist/bundle/serve-7VWL475U.js +0 -19
  179. package/dist/bundle/server-7LABFAA5.js +0 -53
  180. package/dist/bundle/server-VFXB5WRG.js +0 -66
  181. package/dist/bundle/store-connection-QTMLZ7LR.js +0 -76
  182. package/dist/bundle/store-maintenance-command-ND6PQCVZ.js +0 -54
  183. package/dist/mcp-command.d.ts +0 -33
  184. package/dist/mcp-command.d.ts.map +0 -1
  185. package/dist/mcp-command.js +0 -143
  186. package/dist/mcp-command.js.map +0 -1
  187. package/dist/mcp.d.ts +0 -30
  188. package/dist/mcp.d.ts.map +0 -1
  189. package/dist/mcp.js +0 -110
  190. package/dist/mcp.js.map +0 -1
  191. /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-JKWYXBGK.js";
3
11
  import {
4
12
  DEFAULT_IMAGE_MODEL,
5
13
  DEFAULT_RERANK_MODEL,
@@ -26,14 +34,14 @@ import {
26
34
  typedCommand,
27
35
  vectorModelKey,
28
36
  withAttempt
29
- } from "./chunk-YZZ6NBXC.js";
37
+ } from "./chunk-4XI4PDEH.js";
30
38
  import {
31
39
  isCliFailure
32
- } from "./chunk-EOZWDEJL.js";
40
+ } from "./chunk-77GJITSU.js";
33
41
  import {
34
42
  isNewer,
35
43
  updateCommand
36
- } from "./chunk-DP5DX45H.js";
44
+ } from "./chunk-COU66X3X.js";
37
45
  import {
38
46
  MAX_ACTIONS,
39
47
  ModerationRules,
@@ -49,16 +57,16 @@ import {
49
57
  someUndone,
50
58
  validateFormattedText,
51
59
  visibleFormattedText
52
- } from "./chunk-RNX73QCL.js";
60
+ } from "./chunk-S726LZCH.js";
53
61
  import {
54
62
  MAX_MODEL_IMAGE_BYTES
55
- } from "./chunk-I45V6AFG.js";
63
+ } from "./chunk-P2NRA7E5.js";
56
64
  import {
57
65
  OPENAI_URL,
58
66
  openRemote,
59
67
  remoteKey,
60
68
  remoteModel
61
- } from "./chunk-V2QOLHPM.js";
69
+ } from "./chunk-U4Y2QQ2D.js";
62
70
  import {
63
71
  Unzip,
64
72
  UnzipInflate,
@@ -69,11 +77,11 @@ import {
69
77
  placedText,
70
78
  runEmbedders,
71
79
  textModelsDirectory
72
- } from "./chunk-J3N2LL37.js";
80
+ } from "./chunk-B45MFBBF.js";
73
81
  import {
74
82
  installFiles,
75
83
  megabytes
76
- } from "./chunk-7PQY4ISY.js";
84
+ } from "./chunk-PCUPOGKR.js";
77
85
  import {
78
86
  AGENDA_COLUMNS,
79
87
  CHAT_COLUMNS,
@@ -131,23 +139,23 @@ import {
131
139
  threadConversation,
132
140
  validateAst,
133
141
  validateFields
134
- } from "./chunk-ODFIV4OS.js";
142
+ } from "./chunk-UPWHCUVA.js";
135
143
  import {
136
144
  TASK_KINDS,
137
145
  TASK_ORIGINS,
138
146
  TASK_STATES,
139
147
  createTaskService
140
- } from "./chunk-SG3WSP7Y.js";
148
+ } from "./chunk-6RV7KXDF.js";
141
149
  import {
142
150
  DEFAULT_STEMMERS,
143
151
  createStemmer,
144
152
  fold,
145
153
  normalize
146
- } from "./chunk-2TV7UTHK.js";
154
+ } from "./chunk-KZV5GU7G.js";
147
155
  import {
148
156
  DEFAULT_TASK_CATEGORIES,
149
157
  FALLBACK_CATEGORY
150
- } from "./chunk-E3AMUYNB.js";
158
+ } from "./chunk-UYAKSUT5.js";
151
159
  import {
152
160
  COUNTER_FIELDS,
153
161
  INTERNAL_NOTES,
@@ -166,14 +174,14 @@ import {
166
174
  parseReference,
167
175
  providerNamed,
168
176
  rankingOptions
169
- } from "./chunk-EXFAA4N3.js";
177
+ } from "./chunk-FXY45HU7.js";
170
178
  import {
171
179
  normalizeTag
172
- } from "./chunk-JBGYI5BY.js";
180
+ } from "./chunk-OVVDOVLN.js";
173
181
  import {
174
182
  storePath,
175
183
  wirecatDirectory
176
- } from "./chunk-KUBCUE6T.js";
184
+ } from "./chunk-M3EVVGR6.js";
177
185
  import {
178
186
  MEETING_FINDINGS_KIND,
179
187
  canonicalMeetingReference,
@@ -191,7 +199,7 @@ import {
191
199
  validateMeetingHitSearch,
192
200
  validateMeetingPassage,
193
201
  validateMeetingSeriesHistory
194
- } from "./chunk-UOL4ILXT.js";
202
+ } from "./chunk-RSXLI5GP.js";
195
203
  import {
196
204
  dateRange,
197
205
  implicitTextTerms,
@@ -201,7 +209,7 @@ import {
201
209
  timezoneOf,
202
210
  validateQuery,
203
211
  walkQuery
204
- } from "./chunk-UOFOMU3T.js";
212
+ } from "./chunk-NVN4O5IC.js";
205
213
  import {
206
214
  CliError,
207
215
  array,
@@ -219,7 +227,7 @@ import {
219
227
  singleLine,
220
228
  strictObject,
221
229
  string
222
- } from "./chunk-YIMI6O7R.js";
230
+ } from "./chunk-L7VIPVHL.js";
223
231
  import {
224
232
  importFrom,
225
233
  resolveFrom
@@ -16839,7 +16847,7 @@ var require_lib3 = __commonJS({
16839
16847
  }
16840
16848
  });
16841
16849
 
16842
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/deps.js
16850
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/deps.js
16843
16851
  var accountStore = /* @__PURE__ */ __name(async (deps) => (await deps.store()).forAccount(await deps.account()), "accountStore");
16844
16852
  var crossAccount = /* @__PURE__ */ __name((deps, _reason) => deps.store(), "crossAccount");
16845
16853
  var NO_LOCAL_STORE = "this answer comes from the messenger, not from the local store";
@@ -16917,7 +16925,7 @@ var storeOnlyDeps = /* @__PURE__ */ __name((store, account2, { app, env }) => {
16917
16925
  return { ...storedDeps(messenger, store, account2, guard), ...env === void 0 ? {} : { env } };
16918
16926
  }, "storeOnlyDeps");
16919
16927
 
16920
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/botcheck/check.js
16928
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/botcheck/check.js
16921
16929
  var DAY_MS = 864e5;
16922
16930
  var NEW_DAYS = 30;
16923
16931
  var SAME_TEXT_MIN = 20;
@@ -16994,7 +17002,7 @@ var scorePerson = /* @__PURE__ */ __name(({ subject, provider, activity, photos,
16994
17002
  };
16995
17003
  }, "scorePerson");
16996
17004
 
16997
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/botcheck/registries.js
17005
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/botcheck/registries.js
16998
17006
  var REGISTRIES = {
16999
17007
  cas: { title: "Combot Anti-Spam (CAS)", docs: "https://cas.chat/api" },
17000
17008
  lols: { title: "lols.bot", docs: "https://api.lols.bot/lols-bot.json" }
@@ -17079,7 +17087,7 @@ var notCovered = /* @__PURE__ */ __name((messenger, now = /* @__PURE__ */ new Da
17079
17087
  detail: `lists Telegram accounts only, not ${messenger} ones`
17080
17088
  })), "notCovered");
17081
17089
 
17082
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/botcheck/service.js
17090
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/botcheck/service.js
17083
17091
  var ACTIVITY_MESSAGES = 1e3;
17084
17092
  var botCheckService = /* @__PURE__ */ __name((deps) => {
17085
17093
  const subjectOf = /* @__PURE__ */ __name(async (reference) => {
@@ -17167,7 +17175,33 @@ var botCheckService = /* @__PURE__ */ __name((deps) => {
17167
17175
  };
17168
17176
  }, "botCheckService");
17169
17177
 
17170
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/context/evidence-response.js
17178
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/chat-coverage.js
17179
+ var chatCoverage = /* @__PURE__ */ __name(async (store, account2, chatIds) => {
17180
+ const ids = [...new Set(chatIds)];
17181
+ if (ids.length === 0)
17182
+ return [];
17183
+ const found = new Map((await store.chats.chatCompleteness(account2, ids)).map((one) => [one.chatId, one]));
17184
+ return Promise.all(ids.map(async (chatId) => {
17185
+ const [stats] = await store.chats.chatStats(account2, chatId);
17186
+ const title = stats?.title ?? await store.chats.chatTitle(account2, chatId);
17187
+ const completeness = found.get(chatId) ?? {
17188
+ chatId,
17189
+ state: "unknown",
17190
+ upToDate: null,
17191
+ gaps: false,
17192
+ reachesStart: false,
17193
+ fetchedAt: null
17194
+ };
17195
+ return {
17196
+ chatId,
17197
+ title,
17198
+ completeness,
17199
+ held: { messages: stats?.messages ?? 0, oldestAt: stats?.oldestAt ?? null, newestAt: stats?.newestAt ?? null }
17200
+ };
17201
+ }));
17202
+ }, "chatCoverage");
17203
+
17204
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/context/evidence-response.js
17171
17205
  var contextSourceKey = /* @__PURE__ */ __name((source) => JSON.stringify([source.kind, source.accountId, source.provider, source.account]), "contextSourceKey");
17172
17206
  var validateContextEvidencePage = /* @__PURE__ */ __name((page, request) => {
17173
17207
  const fail3 = /* @__PURE__ */ __name(() => {
@@ -17231,7 +17265,7 @@ var validateContextEvidencePage = /* @__PURE__ */ __name((page, request) => {
17231
17265
  }
17232
17266
  }, "validateContextEvidencePage");
17233
17267
 
17234
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/context/read-budget.js
17268
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/context/read-budget.js
17235
17269
  var contextReadBudget = /* @__PURE__ */ __name((limits = {}) => {
17236
17270
  if (!limits || typeof limits !== "object" || Array.isArray(limits))
17237
17271
  throw new CliError("validation_error", "limits needs a context read allowance");
@@ -17284,7 +17318,7 @@ var contextReadBudget = /* @__PURE__ */ __name((limits = {}) => {
17284
17318
  };
17285
17319
  }, "contextReadBudget");
17286
17320
 
17287
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/context-evidence.js
17321
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/context-evidence.js
17288
17322
  var createContextEvidenceReader = /* @__PURE__ */ __name((port, allowed, limits) => {
17289
17323
  if (!port || typeof port.read !== "function")
17290
17324
  throw new CliError("configuration_error", "context evidence reader is unavailable");
@@ -17328,7 +17362,7 @@ var createContextEvidenceReader = /* @__PURE__ */ __name((port, allowed, limits)
17328
17362
  };
17329
17363
  }, "createContextEvidenceReader");
17330
17364
 
17331
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/excerpt.js
17365
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/excerpt.js
17332
17366
  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");
17333
17367
  var excerpt = /* @__PURE__ */ __name((text2, query, size4 = 240, options = {}) => {
17334
17368
  const flat = text2.replace(/\s+/g, " ").trim();
@@ -17344,380 +17378,18 @@ var excerpt = /* @__PURE__ */ __name((text2, query, size4 = 240, options = {}) =
17344
17378
  }, "excerpt");
17345
17379
  var withExcerpt = /* @__PURE__ */ __name(({ matchedText, ...hit }, query) => ({ ...hit, excerpt: excerpt(matchedText ?? hit.text, query) }), "withExcerpt");
17346
17380
 
17347
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/media-archive.js
17381
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/media-archive.js
17348
17382
  import { setTimeout as sleep } from "node:timers/promises";
17349
17383
 
17350
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
17351
- import { lstat as lstat4 } from "node:fs/promises";
17352
-
17353
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
17354
- import { createHash as createHash2, randomUUID as randomUUID4 } from "node:crypto";
17355
- import { open as open5, rename as rename3, unlink as unlink6 } from "node:fs/promises";
17356
- import { join as join5 } from "node:path";
17357
-
17358
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/files/atomic-write.js
17359
- import { randomUUID } from "node:crypto";
17360
- import { constants } from "node:fs";
17361
- import { link, open, realpath, rename, unlink } from "node:fs/promises";
17362
- import { basename, dirname, join } from "node:path";
17363
- var openFolder = /* @__PURE__ */ __name((folder) => process.platform === "win32" ? Promise.resolve(void 0) : open(folder, constants.O_RDONLY | (constants.O_DIRECTORY ?? 0) | (constants.O_NOFOLLOW ?? 0)), "openFolder");
17364
- var writeFileAtomic = /* @__PURE__ */ __name(async (path, content, { mode = 384, overwrite = true, signal, beforePublish } = {}) => {
17365
- signal?.throwIfAborted();
17366
- const folder = await realpath(dirname(path));
17367
- const target2 = join(folder, basename(path));
17368
- const directory2 = await openFolder(folder);
17369
- try {
17370
- const temporary = join(folder, `.${basename(path)}.${randomUUID()}.tmp`);
17371
- let handle = await open(temporary, "wx", mode);
17372
- let published = false;
17373
- try {
17374
- await handle.writeFile(content);
17375
- await handle.sync();
17376
- await handle.close();
17377
- handle = void 0;
17378
- signal?.throwIfAborted();
17379
- await beforePublish?.();
17380
- if (overwrite)
17381
- await rename(temporary, target2);
17382
- else
17383
- await link(temporary, target2);
17384
- published = overwrite;
17385
- await directory2?.sync();
17386
- } finally {
17387
- await handle?.close().catch(() => void 0);
17388
- if (!published)
17389
- await unlink(temporary).catch(() => void 0);
17390
- }
17391
- } finally {
17392
- await directory2?.close().catch(() => void 0);
17393
- }
17394
- }, "writeFileAtomic");
17395
-
17396
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/files/ordinary-file.js
17397
- import { constants as constants2 } from "node:fs";
17398
- import { lstat, open as open2 } from "node:fs/promises";
17399
- var deviceOf = /* @__PURE__ */ __name((dev) => process.platform === "win32" ? BigInt.asUintN(32, dev) : dev, "deviceOf");
17400
- var sameIdentity = /* @__PURE__ */ __name((left, right) => left.ino === right.ino && deviceOf(left.dev) === deviceOf(right.dev), "sameIdentity");
17401
- var openOrdinaryFile = /* @__PURE__ */ __name(async (path, options = {}) => {
17402
- const before2 = await lstat(path, { bigint: true });
17403
- if (before2.isSymbolicLink())
17404
- throw new CliError("validation_error", "archive path must be an ordinary file without a symlink");
17405
- if (!before2.isFile())
17406
- throw new CliError("validation_error", "archive path must be an ordinary file");
17407
- const access = options.writable ? constants2.O_RDWR : constants2.O_RDONLY;
17408
- const flags = process.platform === "win32" ? access : access | (constants2.O_NOFOLLOW ?? 0) | (constants2.O_NONBLOCK ?? 0);
17409
- const file = await open2(path, flags);
17410
- try {
17411
- const opened = await file.stat({ bigint: true });
17412
- const after = await lstat(path, { bigint: true });
17413
- if (!opened.isFile() || !after.isFile() || before2.ino !== opened.ino || before2.ino !== after.ino)
17414
- throw new CliError("validation_error", "archive file changed while opening");
17415
- if (process.platform === "win32" && before2.dev === 0n && after.dev === 0n) {
17416
- const witness = await open2(path, flags);
17417
- try {
17418
- const identified = await witness.stat({ bigint: true });
17419
- const final = await lstat(path, { bigint: true });
17420
- if (opened.dev === 0n || !identified.isFile() || !final.isFile() || !sameIdentity(identified, opened) || final.ino !== before2.ino || final.dev !== 0n && deviceOf(final.dev) !== deviceOf(opened.dev))
17421
- throw new CliError("validation_error", "archive file changed while opening");
17422
- } finally {
17423
- await witness.close();
17424
- }
17425
- } else if (deviceOf(before2.dev) !== deviceOf(opened.dev) || deviceOf(before2.dev) !== deviceOf(after.dev)) {
17426
- throw new CliError("validation_error", "archive file changed while opening");
17427
- }
17428
- return file;
17429
- } catch (error) {
17430
- await file.close();
17431
- throw error;
17432
- }
17433
- }, "openOrdinaryFile");
17434
- var sameOrdinaryFile = /* @__PURE__ */ __name(async (path, created) => {
17435
- let file;
17436
- try {
17437
- file = await openOrdinaryFile(path);
17438
- } catch (error) {
17439
- if (error instanceof CliError || typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
17440
- return false;
17441
- throw error;
17442
- }
17443
- try {
17444
- return sameIdentity(created, await file.stat({ bigint: true }));
17445
- } finally {
17446
- await file.close();
17447
- }
17448
- }, "sameOrdinaryFile");
17449
- var syncDirectory = /* @__PURE__ */ __name(async (path) => {
17450
- if (process.platform === "win32")
17451
- return;
17452
- const directory2 = await open2(path, constants2.O_RDONLY | (constants2.O_DIRECTORY ?? 0) | (constants2.O_NOFOLLOW ?? 0));
17453
- try {
17454
- if (!(await directory2.stat()).isDirectory())
17455
- throw new CliError("validation_error", "archive publication directory must be ordinary");
17456
- await directory2.sync();
17457
- } finally {
17458
- await directory2.close();
17459
- }
17460
- }, "syncDirectory");
17384
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
17385
+ import { lstat } from "node:fs/promises";
17461
17386
 
17462
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/files/bounded-utf8.js
17463
- var readBoundedUtf8File = /* @__PURE__ */ __name(async (path, { maxBytes }) => {
17464
- if (!Number.isSafeInteger(maxBytes) || maxBytes < 1 || maxBytes > 16 * 1024 * 1024)
17465
- throw new CliError("validation_error", "file maxBytes takes 1\u201316777216 bytes");
17466
- const file = await openOrdinaryFile(path);
17467
- try {
17468
- if ((await file.stat()).size > maxBytes)
17469
- throw new CliError("validation_error", "input file exceeds its byte budget");
17470
- const chunks = [], buffer = Buffer.alloc(Math.min(65536, maxBytes + 1));
17471
- let bytes2 = 0;
17472
- for (; ; ) {
17473
- const { bytesRead } = await file.read(buffer, 0, Math.min(buffer.length, maxBytes - bytes2 + 1), null);
17474
- if (bytesRead === 0)
17475
- break;
17476
- bytes2 += bytesRead;
17477
- if (bytes2 > maxBytes)
17478
- throw new CliError("validation_error", "input file exceeds its byte budget");
17479
- chunks.push(Buffer.from(buffer.subarray(0, bytesRead)));
17480
- }
17481
- try {
17482
- return new TextDecoder("utf-8", { fatal: true }).decode(Buffer.concat(chunks, bytes2));
17483
- } catch {
17484
- throw new CliError("validation_error", "input file must contain valid UTF-8");
17485
- }
17486
- } finally {
17487
- await file.close();
17488
- }
17489
- }, "readBoundedUtf8File");
17490
-
17491
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/files/lock.js
17492
- import { mkdir as mkdir2 } from "node:fs/promises";
17493
- import { basename as basename2, dirname as dirname2 } from "node:path";
17494
-
17495
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/files/native-writer-lease.js
17496
- import { randomUUID as randomUUID2 } from "node:crypto";
17497
- import { lstat as lstat3, mkdir, open as open3, realpath as realpath3, rmdir as rmdir2, unlink as unlink4 } from "node:fs/promises";
17498
- import { hostname as hostname2 } from "node:os";
17499
- import { join as join3 } from "node:path";
17500
-
17501
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/files/native-lease-inspection.js
17502
- import { lstat as lstat2, readdir, realpath as realpath2, unlink as unlink2 } from "node:fs/promises";
17387
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
17388
+ import { createHash as createHash2, randomUUID as randomUUID2 } from "node:crypto";
17389
+ import { open as open2, rename as rename2, unlink as unlink2 } from "node:fs/promises";
17503
17390
  import { join as join2 } from "node:path";
17504
17391
 
17505
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/files/native-lease-owner.js
17506
- import { hostname } from "node:os";
17507
- var missingLeaseFile = /* @__PURE__ */ __name((error) => typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT", "missingLeaseFile");
17508
- var readLeaseOwner = /* @__PURE__ */ __name(async (path, name, signal) => {
17509
- signal?.throwIfAborted();
17510
- try {
17511
- const file = await openOrdinaryFile(path);
17512
- try {
17513
- if ((await file.stat()).size > 4096)
17514
- return null;
17515
- const buffer = Buffer.alloc(4097);
17516
- let size4 = 0;
17517
- while (size4 < buffer.length) {
17518
- signal?.throwIfAborted();
17519
- const { bytesRead } = await file.read(buffer, size4, buffer.length - size4, size4);
17520
- if (bytesRead === 0)
17521
- break;
17522
- size4 += bytesRead;
17523
- }
17524
- signal?.throwIfAborted();
17525
- if (size4 > 4096)
17526
- return null;
17527
- const owner = JSON.parse(buffer.subarray(0, size4).toString("utf8"));
17528
- 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`)
17529
- return null;
17530
- return owner;
17531
- } finally {
17532
- await file.close();
17533
- }
17534
- } catch {
17535
- signal?.throwIfAborted();
17536
- return null;
17537
- }
17538
- }, "readLeaseOwner");
17539
- var leaseOwnerStatus = /* @__PURE__ */ __name((owner) => {
17540
- if (owner.host !== hostname())
17541
- return "foreign";
17542
- try {
17543
- process.kill(owner.pid, 0);
17544
- return "active";
17545
- } catch (error) {
17546
- return typeof error === "object" && error !== null && "code" in error && error.code === "ESRCH" ? "stale" : "active";
17547
- }
17548
- }, "leaseOwnerStatus");
17549
-
17550
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/files/native-lease-inspection.js
17551
- var leaseInspection = /* @__PURE__ */ __name((markerDirectory) => {
17552
- const inspect = /* @__PURE__ */ __name(async (destination, options = {}) => {
17553
- options.signal?.throwIfAborted();
17554
- const root = await realpath2(destination);
17555
- options.signal?.throwIfAborted();
17556
- const folder = join2(root, markerDirectory);
17557
- let names2;
17558
- try {
17559
- if ((await lstat2(folder)).isSymbolicLink())
17560
- throw new Error("symlink");
17561
- names2 = await readdir(folder);
17562
- } catch (error) {
17563
- options.signal?.throwIfAborted();
17564
- if (missingLeaseFile(error))
17565
- return [];
17566
- throw new CliError("configuration_error", "archive lock directory could not be read");
17567
- }
17568
- options.signal?.throwIfAborted();
17569
- const result = [];
17570
- for (const name of names2.sort()) {
17571
- options.signal?.throwIfAborted();
17572
- const owner = await readLeaseOwner(join2(folder, name), name, options.signal);
17573
- result.push({
17574
- name,
17575
- status: owner ? leaseOwnerStatus(owner) : "unrecognized",
17576
- pid: owner?.pid ?? null,
17577
- host: owner?.host ?? null
17578
- });
17579
- }
17580
- return result;
17581
- }, "inspect");
17582
- const recover = /* @__PURE__ */ __name(async (destination, options = {}) => {
17583
- options.signal?.throwIfAborted();
17584
- const root = await realpath2(destination);
17585
- const locks = await inspect(root, options);
17586
- const removed = [];
17587
- if (options.apply)
17588
- for (const lock of locks) {
17589
- options.signal?.throwIfAborted();
17590
- if (lock.status !== "stale")
17591
- continue;
17592
- const path = join2(root, markerDirectory, lock.name);
17593
- const owner = await readLeaseOwner(path, lock.name, options.signal);
17594
- if (!owner || leaseOwnerStatus(owner) !== "stale")
17595
- continue;
17596
- try {
17597
- await unlink2(path);
17598
- removed.push(lock.name);
17599
- } catch (error) {
17600
- if (!missingLeaseFile(error))
17601
- throw new CliError("configuration_error", "stale archive lock could not be removed");
17602
- }
17603
- }
17604
- return { locks, removed };
17605
- }, "recover");
17606
- return { inspect, recover };
17607
- }, "leaseInspection");
17608
-
17609
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/files/native-lease-release.js
17610
- import { rmdir, unlink as unlink3 } from "node:fs/promises";
17611
- var ownedNativeLease = /* @__PURE__ */ __name((path, name, owner, folder, identity) => {
17612
- let releasing;
17613
- const held = /* @__PURE__ */ __name(async () => {
17614
- if (!await sameOrdinaryFile(path, identity))
17615
- return false;
17616
- const current = await readLeaseOwner(path, name);
17617
- return current?.host === owner.host && current.pid === owner.pid && current.nonce === owner.nonce;
17618
- }, "held");
17619
- const release = /* @__PURE__ */ __name(async () => {
17620
- if (!await held())
17621
- throw new CliError("configuration_error", "owned archive lock changed before release");
17622
- await unlink3(path);
17623
- await rmdir(folder).catch(() => void 0);
17624
- }, "release");
17625
- return {
17626
- held,
17627
- release: /* @__PURE__ */ __name(() => releasing ??= release().catch((error) => {
17628
- releasing = void 0;
17629
- throw error;
17630
- }), "release")
17631
- };
17632
- }, "ownedNativeLease");
17633
-
17634
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/files/native-writer-lease.js
17635
- var validName = /* @__PURE__ */ __name((value) => typeof value === "string" && value.length > 0 && value !== "." && value !== ".." && !/[\\/\0:]/.test(value), "validName");
17636
- var nativeWriterLeaseStore = /* @__PURE__ */ __name((layout) => {
17637
- const { markerDirectory, legacyMarker } = layout;
17638
- if (!validName(markerDirectory) || legacyMarker !== void 0 && (!validName(legacyMarker) || legacyMarker === markerDirectory))
17639
- throw new CliError("validation_error", "archive lock layout requires distinct ordinary entry names");
17640
- const inspection = leaseInspection(markerDirectory);
17641
- return {
17642
- ...inspection,
17643
- acquire: /* @__PURE__ */ __name(async (destination, { signal } = {}) => {
17644
- signal?.throwIfAborted();
17645
- const root = await realpath3(destination);
17646
- signal?.throwIfAborted();
17647
- const folder = join3(root, markerDirectory);
17648
- const owner = { version: 1, pid: process.pid, host: hostname2(), nonce: randomUUID2() };
17649
- const name = `${owner.pid}-${owner.nonce}.json`;
17650
- const path = join3(folder, name);
17651
- const marker = /* @__PURE__ */ __name(async (attempt = 1) => {
17652
- await mkdir(folder, { recursive: true });
17653
- try {
17654
- if ((await lstat3(folder)).isSymbolicLink())
17655
- throw new CliError("validation_error", "archive lock directory must not be a symlink");
17656
- await inspection.recover(root, { apply: true, signal });
17657
- signal?.throwIfAborted();
17658
- return await open3(path, "wx", 384);
17659
- } catch (error) {
17660
- if (attempt < 5 && missingLeaseFile(error))
17661
- return marker(attempt + 1);
17662
- throw error;
17663
- }
17664
- }, "marker");
17665
- const file = await marker();
17666
- let retained = false;
17667
- let identity;
17668
- try {
17669
- identity = await file.stat({ bigint: true });
17670
- await file.writeFile(JSON.stringify(owner));
17671
- await file.sync();
17672
- await file.close();
17673
- signal?.throwIfAborted();
17674
- const inspected = await inspection.inspect(root, { signal });
17675
- const own = inspected.find((lock) => lock.name === name);
17676
- if (own?.status !== "active" || own.pid !== owner.pid || own.host !== owner.host)
17677
- throw new CliError("configuration_error", "archive writer lost its lock before acquisition");
17678
- const locks = inspected.filter((lock) => lock.name !== name);
17679
- if (locks.length)
17680
- return { status: "busy", locks };
17681
- if (legacyMarker) {
17682
- try {
17683
- await lstat3(join3(root, legacyMarker));
17684
- return { status: "legacy" };
17685
- } catch (error) {
17686
- if (!missingLeaseFile(error))
17687
- throw error;
17688
- }
17689
- }
17690
- signal?.throwIfAborted();
17691
- retained = true;
17692
- return { status: "acquired", lease: ownedNativeLease(path, name, owner, folder, identity) };
17693
- } finally {
17694
- await file.close().catch(() => void 0);
17695
- if (!retained) {
17696
- if (identity && await sameOrdinaryFile(path, identity))
17697
- await unlink4(path).catch(() => void 0);
17698
- await rmdir2(folder).catch(() => void 0);
17699
- }
17700
- }
17701
- }, "acquire")
17702
- };
17703
- }, "nativeWriterLeaseStore");
17704
-
17705
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/files/lock.js
17706
- var acquireLock = /* @__PURE__ */ __name(async (path, { signal } = {}) => {
17707
- const folder = dirname2(path);
17708
- await mkdir2(folder, { recursive: true, mode: 448 });
17709
- const acquired = await nativeWriterLeaseStore({ markerDirectory: basename2(path) }).acquire(folder, {
17710
- ...signal ? { signal } : {}
17711
- });
17712
- if (acquired.status === "acquired")
17713
- return acquired.lease;
17714
- throw new CliError("validation_error", `${basename2(path)} is locked by another process`, {
17715
- reason: "file.locked",
17716
- ...acquired.status === "busy" ? { holders: acquired.locks } : {}
17717
- });
17718
- }, "acquireLock");
17719
-
17720
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-metadata.js
17392
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-metadata.js
17721
17393
  import { createHash } from "node:crypto";
17722
17394
  var metadataLimit = 16384;
17723
17395
  var partialIdentity = /* @__PURE__ */ __name((locator) => JSON.stringify([locator.provider, locator.account, locator.occurrenceId, locator.assetId]), "partialIdentity");
@@ -17777,10 +17449,10 @@ var readPartialMetadata = /* @__PURE__ */ __name(async (path, locator, maxBytes,
17777
17449
  }
17778
17450
  }, "readPartialMetadata");
17779
17451
 
17780
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-writer.js
17781
- import { randomUUID as randomUUID3 } from "node:crypto";
17782
- import { open as open4, rename as rename2, unlink as unlink5 } from "node:fs/promises";
17783
- import { join as join4 } from "node:path";
17452
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-writer.js
17453
+ import { randomUUID } from "node:crypto";
17454
+ import { open, rename, unlink } from "node:fs/promises";
17455
+ import { join } from "node:path";
17784
17456
  var partialWriter = /* @__PURE__ */ __name(async (input) => {
17785
17457
  const { file, signal, partial } = input;
17786
17458
  const owned = await file.stat({ bigint: true });
@@ -17806,8 +17478,8 @@ var partialWriter = /* @__PURE__ */ __name(async (input) => {
17806
17478
  const content = JSON.stringify({ ...partial, offset: size4, sha256: hash3.copy().digest("hex") });
17807
17479
  if (Buffer.byteLength(content) > metadataLimit)
17808
17480
  throw new CliError("validation_error", "recording partial metadata exceeds its byte limit");
17809
- const temp = join4(input.root, `${input.prefix}${randomUUID3()}.tmp`);
17810
- const metadata = await open4(temp, "wx", 384);
17481
+ const temp = join(input.root, `${input.prefix}${randomUUID()}.tmp`);
17482
+ const metadata = await open(temp, "wx", 384);
17811
17483
  try {
17812
17484
  try {
17813
17485
  await metadata.writeFile(content);
@@ -17816,11 +17488,11 @@ var partialWriter = /* @__PURE__ */ __name(async (input) => {
17816
17488
  await metadata.close();
17817
17489
  }
17818
17490
  await usable();
17819
- await rename2(temp, input.metadataPath);
17491
+ await rename(temp, input.metadataPath);
17820
17492
  await syncDirectory(input.root);
17821
17493
  signal?.throwIfAborted();
17822
17494
  } finally {
17823
- await unlink5(temp).catch((error) => {
17495
+ await unlink(temp).catch((error) => {
17824
17496
  if (!missing(error))
17825
17497
  throw error;
17826
17498
  });
@@ -17869,7 +17541,7 @@ var partialWriter = /* @__PURE__ */ __name(async (input) => {
17869
17541
  };
17870
17542
  }, "partialWriter");
17871
17543
 
17872
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
17544
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
17873
17545
  var NativeRecordingPartialStore = class {
17874
17546
  static {
17875
17547
  __name(this, "NativeRecordingPartialStore");
@@ -17891,9 +17563,9 @@ var NativeRecordingPartialStore = class {
17891
17563
  this.options = Object.freeze({ ...options });
17892
17564
  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)))
17893
17565
  throw new CliError("validation_error", "invalid native recording partial options");
17894
- const key = options.persistent ? createHash2("sha256").update(partialIdentity(this.locator)).digest("hex") : randomUUID4();
17895
- this.path = join5(root, `${options.prefix}${key}.part`);
17896
- this.metadataPath = join5(root, `${options.prefix}${key}.json`);
17566
+ const key = options.persistent ? createHash2("sha256").update(partialIdentity(this.locator)).digest("hex") : randomUUID2();
17567
+ this.path = join2(root, `${options.prefix}${key}.part`);
17568
+ this.metadataPath = join2(root, `${options.prefix}${key}.json`);
17897
17569
  }
17898
17570
  scope(locator) {
17899
17571
  if (partialIdentity(locator) !== partialIdentity(this.locator))
@@ -17934,17 +17606,17 @@ var NativeRecordingPartialStore = class {
17934
17606
  if (resume) {
17935
17607
  file = await openOrdinaryFile(this.path, { writable: true });
17936
17608
  } else {
17937
- const temp = join5(this.root, `${this.options.prefix}${randomUUID4()}.tmp`);
17938
- file = await open5(temp, "wx+", 384);
17609
+ const temp = join2(this.root, `${this.options.prefix}${randomUUID2()}.tmp`);
17610
+ file = await open2(temp, "wx+", 384);
17939
17611
  try {
17940
- await rename3(temp, this.path);
17941
- await unlink6(this.metadataPath).catch((error) => {
17612
+ await rename2(temp, this.path);
17613
+ await unlink2(this.metadataPath).catch((error) => {
17942
17614
  if (!missing(error))
17943
17615
  throw error;
17944
17616
  });
17945
17617
  } catch (error) {
17946
17618
  await file.close();
17947
- await unlink6(temp).catch(() => void 0);
17619
+ await unlink2(temp).catch(() => void 0);
17948
17620
  throw error;
17949
17621
  }
17950
17622
  }
@@ -17976,13 +17648,13 @@ var NativeRecordingPartialStore = class {
17976
17648
  }
17977
17649
  };
17978
17650
 
17979
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
17651
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
17980
17652
  import { createHash as createHash3 } from "node:crypto";
17981
- import { link as link2 } from "node:fs/promises";
17982
- import { basename as basename3, dirname as dirname3, join as join7, resolve } from "node:path";
17653
+ import { link } from "node:fs/promises";
17654
+ import { basename, dirname, join as join4, resolve } from "node:path";
17983
17655
 
17984
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-files.js
17985
- import { unlink as unlink7 } from "node:fs/promises";
17656
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-files.js
17657
+ import { unlink as unlink3 } from "node:fs/promises";
17986
17658
  var verifiedPublicationFile = /* @__PURE__ */ __name(async (path, expected, signal, writable = false) => {
17987
17659
  signal?.throwIfAborted();
17988
17660
  const file = await openOrdinaryFile(path, { writable });
@@ -18011,15 +17683,15 @@ var commitPublication = /* @__PURE__ */ __name(async (root, partialPath, finalPa
18011
17683
  signal?.throwIfAborted();
18012
17684
  await assertPublicationIdentity(finalPath, final);
18013
17685
  await assertPublicationIdentity(partialPath, partial);
18014
- await unlink7(partialPath);
17686
+ await unlink3(partialPath);
18015
17687
  await syncDirectory(root);
18016
17688
  signal?.throwIfAborted();
18017
17689
  }, "commitPublication");
18018
17690
 
18019
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-journal.js
18020
- import { randomUUID as randomUUID5 } from "node:crypto";
18021
- import { open as open6, rename as rename4, unlink as unlink8 } from "node:fs/promises";
18022
- import { join as join6 } from "node:path";
17691
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-journal.js
17692
+ import { randomUUID as randomUUID3 } from "node:crypto";
17693
+ import { open as open3, rename as rename3, unlink as unlink4 } from "node:fs/promises";
17694
+ import { join as join3 } from "node:path";
18023
17695
  var readPublicationJournal = /* @__PURE__ */ __name(async (path, codec, limit, signal) => {
18024
17696
  signal?.throwIfAborted();
18025
17697
  let file;
@@ -18063,8 +17735,8 @@ var writePublicationJournal = /* @__PURE__ */ __name(async (root, path, prefix,
18063
17735
  if (Buffer.byteLength(content) > limit)
18064
17736
  throw new CliError("validation_error", "recording recovery record exceeds its metadata limit");
18065
17737
  codec.decode(JSON.parse(content));
18066
- const temp = join6(root, `${prefix}${randomUUID5()}.tmp`);
18067
- const handle = await open6(temp, "wx", 384);
17738
+ const temp = join3(root, `${prefix}${randomUUID3()}.tmp`);
17739
+ const handle = await open3(temp, "wx", 384);
18068
17740
  let identity;
18069
17741
  try {
18070
17742
  try {
@@ -18077,19 +17749,19 @@ var writePublicationJournal = /* @__PURE__ */ __name(async (root, path, prefix,
18077
17749
  signal?.throwIfAborted();
18078
17750
  if (!identity || !await sameOrdinaryFile(temp, identity))
18079
17751
  throw new CliError("validation_error", "recording publication journal changed");
18080
- await rename4(temp, path);
17752
+ await rename3(temp, path);
18081
17753
  await syncDirectory(root);
18082
17754
  signal?.throwIfAborted();
18083
17755
  } finally {
18084
17756
  if (identity && await sameOrdinaryFile(temp, identity))
18085
- await unlink8(temp).catch((error) => {
17757
+ await unlink4(temp).catch((error) => {
18086
17758
  if (!missing(error))
18087
17759
  throw error;
18088
17760
  });
18089
17761
  }
18090
17762
  }, "writePublicationJournal");
18091
17763
 
18092
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
17764
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
18093
17765
  var NativeRecordingPublication = class {
18094
17766
  static {
18095
17767
  __name(this, "NativeRecordingPublication");
@@ -18101,12 +17773,12 @@ var NativeRecordingPublication = class {
18101
17773
  options;
18102
17774
  constructor(root, locator, options) {
18103
17775
  this.root = root;
18104
- if (!root || root.includes("\0") || !/^\.[a-zA-Z0-9][a-zA-Z0-9._-]{0,95}-$/.test(options.prefix) || !options.filename || basename3(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)))
17776
+ if (!root || root.includes("\0") || !/^\.[a-zA-Z0-9][a-zA-Z0-9._-]{0,95}-$/.test(options.prefix) || !options.filename || basename(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)))
18105
17777
  throw new CliError("validation_error", "invalid native recording publication options");
18106
17778
  this.scope = partialIdentity(locator);
18107
17779
  this.options = Object.freeze({ ...options, codec: Object.freeze({ ...options.codec }) });
18108
- this.journalPath = join7(root, `${options.prefix}${createHash3("sha256").update(this.scope).digest("hex")}.json`);
18109
- this.finalPath = join7(root, options.filename);
17780
+ this.journalPath = join4(root, `${options.prefix}${createHash3("sha256").update(this.scope).digest("hex")}.json`);
17781
+ this.finalPath = join4(root, options.filename);
18110
17782
  if (this.finalPath === this.journalPath)
18111
17783
  throw new CliError("validation_error", "recording publication paths must be distinct");
18112
17784
  }
@@ -18117,7 +17789,7 @@ var NativeRecordingPublication = class {
18117
17789
  return writePublicationJournal(this.root, this.journalPath, this.options.prefix, value, this.options.codec, this.options.metadataLimit, this.options.signal);
18118
17790
  }
18119
17791
  validate(partialPath, expected) {
18120
- if (resolve(dirname3(partialPath)) !== resolve(this.root) || resolve(partialPath) === resolve(this.finalPath) || resolve(partialPath) === resolve(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))
17792
+ if (resolve(dirname(partialPath)) !== resolve(this.root) || resolve(partialPath) === resolve(this.finalPath) || resolve(partialPath) === resolve(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))
18121
17793
  throw new CliError("validation_error", "invalid recording publication evidence");
18122
17794
  this.options.signal?.throwIfAborted();
18123
17795
  }
@@ -18129,7 +17801,7 @@ var NativeRecordingPublication = class {
18129
17801
  await partial.sync();
18130
17802
  this.options.signal?.throwIfAborted();
18131
17803
  await assertPublicationIdentity(partialPath, partial);
18132
- await link2(partialPath, this.finalPath);
17804
+ await link(partialPath, this.finalPath);
18133
17805
  await assertPublicationIdentity(this.finalPath, partial);
18134
17806
  await commitPublication(this.root, partialPath, this.finalPath, partial, partial, commit, this.options.signal);
18135
17807
  } finally {
@@ -18162,10 +17834,10 @@ var NativeRecordingPublication = class {
18162
17834
  }
18163
17835
  };
18164
17836
 
18165
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/media-archive-manifest.js
17837
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/media-archive-manifest.js
18166
17838
  import { createHash as createHash4 } from "node:crypto";
18167
- import { readdir as readdir2 } from "node:fs/promises";
18168
- import { isAbsolute, join as join8, resolve as resolve2 } from "node:path";
17839
+ import { readdir } from "node:fs/promises";
17840
+ import { isAbsolute, join as join5, resolve as resolve2 } from "node:path";
18169
17841
  var mediaKey = /* @__PURE__ */ __name((one) => createHash4("sha256").update(JSON.stringify([one.provider, one.account, one.chat, one.message, one.position])).digest("hex"), "mediaKey");
18170
17842
  var mediaManifestName = /* @__PURE__ */ __name((one) => `.media-archive-${mediaKey(one)}.json`, "mediaManifestName");
18171
17843
  var missingMediaFile = /* @__PURE__ */ __name((error) => typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT", "missingMediaFile");
@@ -18207,13 +17879,13 @@ var mediaFingerprint = /* @__PURE__ */ __name(async (path, signal) => {
18207
17879
  }, "mediaFingerprint");
18208
17880
  var readMediaManifests = /* @__PURE__ */ __name(async (root, signal) => {
18209
17881
  const entries = [];
18210
- for (const name of await readdir2(root)) {
17882
+ for (const name of await readdir(root)) {
18211
17883
  signal?.throwIfAborted();
18212
17884
  if (!name.startsWith(".media-archive-") || !name.endsWith(".json"))
18213
17885
  continue;
18214
17886
  let one;
18215
17887
  try {
18216
- one = parseMediaEntry(JSON.parse(await readBoundedUtf8File(join8(root, name), { maxBytes: 16384 })));
17888
+ one = parseMediaEntry(JSON.parse(await readBoundedUtf8File(join5(root, name), { maxBytes: 16384 })));
18217
17889
  } catch {
18218
17890
  throw new CliError("validation_error", "invalid media archive manifest");
18219
17891
  }
@@ -18233,23 +17905,23 @@ var verifyMediaEntry = /* @__PURE__ */ __name(async (root, one, signal) => {
18233
17905
  throw new CliError("validation_error", "media archive relocation cycle or excessive depth");
18234
17906
  visited.add(location);
18235
17907
  location = resolve2(entry.relocatedTo);
18236
- const target2 = parseMediaEntry(JSON.parse(await readBoundedUtf8File(join8(location, mediaManifestName(one)), { maxBytes: 16384 })));
17908
+ const target2 = parseMediaEntry(JSON.parse(await readBoundedUtf8File(join5(location, mediaManifestName(one)), { maxBytes: 16384 })));
18237
17909
  if (!sameMediaCopy(one, target2))
18238
17910
  return false;
18239
17911
  entry = target2;
18240
17912
  }
18241
17913
  if (visited.has(location))
18242
17914
  return false;
18243
- const actual = await mediaFingerprint(join8(location, one.path), signal);
17915
+ const actual = await mediaFingerprint(join5(location, one.path), signal);
18244
17916
  return actual.size === one.size && actual.sha256 === one.sha256;
18245
17917
  }, "verifyMediaEntry");
18246
17918
  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");
18247
- var commitMediaEntry = /* @__PURE__ */ __name((root, one, beforePublish) => writeFileAtomic(join8(root, mediaManifestName(one)), JSON.stringify(parseMediaEntry(one)), {
17919
+ var commitMediaEntry = /* @__PURE__ */ __name((root, one, beforePublish) => writeFileAtomic(join5(root, mediaManifestName(one)), JSON.stringify(parseMediaEntry(one)), {
18248
17920
  overwrite: false,
18249
17921
  beforePublish
18250
17922
  }), "commitMediaEntry");
18251
17923
 
18252
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
17924
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
18253
17925
  var validator = '"media-completed-v1"';
18254
17926
  var maximumFileBytes = 64 * 1024 * 1024 * 1024;
18255
17927
  var archiveMediaFile = /* @__PURE__ */ __name(async (root, identity, kind, file, beforeWrite, signal, metadata = {}) => {
@@ -18293,7 +17965,7 @@ var archiveMediaFile = /* @__PURE__ */ __name(async (root, identity, kind, file,
18293
17965
  }, "commit");
18294
17966
  let exists = false;
18295
17967
  try {
18296
- await lstat4(publication.finalPath);
17968
+ await lstat(publication.finalPath);
18297
17969
  exists = true;
18298
17970
  } catch (error) {
18299
17971
  if (!missingMediaFile(error))
@@ -18350,9 +18022,9 @@ var archiveMediaFile = /* @__PURE__ */ __name(async (root, identity, kind, file,
18350
18022
  return entry;
18351
18023
  }, "archiveMediaFile");
18352
18024
 
18353
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/media-archive-locks.js
18354
- import { mkdir as mkdir3, realpath as realpath4 } from "node:fs/promises";
18355
- import { join as join9, resolve as resolve3 } from "node:path";
18025
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/media-archive-locks.js
18026
+ import { mkdir, realpath } from "node:fs/promises";
18027
+ import { join as join6, resolve as resolve3 } from "node:path";
18356
18028
  var archiveLocations = /* @__PURE__ */ __name(async (initial, signal) => {
18357
18029
  const roots = /* @__PURE__ */ new Set();
18358
18030
  const queued = new Set(initial.map((directory2) => resolve3(directory2)));
@@ -18361,7 +18033,7 @@ var archiveLocations = /* @__PURE__ */ __name(async (initial, signal) => {
18361
18033
  signal?.throwIfAborted();
18362
18034
  let root;
18363
18035
  try {
18364
- root = await realpath4(pending[at]);
18036
+ root = await realpath(pending[at]);
18365
18037
  } catch (error) {
18366
18038
  if (missingMediaFile(error))
18367
18039
  continue;
@@ -18386,18 +18058,18 @@ var archiveLocations = /* @__PURE__ */ __name(async (initial, signal) => {
18386
18058
  var withMediaArchiveLocks = /* @__PURE__ */ __name(async (directory2, signal, run, options = {}) => {
18387
18059
  signal?.throwIfAborted();
18388
18060
  if (options.create)
18389
- await mkdir3(directory2, { recursive: true, mode: 448 });
18390
- const root = await realpath4(directory2);
18061
+ await mkdir(directory2, { recursive: true, mode: 448 });
18062
+ const root = await realpath(directory2);
18391
18063
  if (options.createAdditional)
18392
18064
  for (const other of options.additional ?? [])
18393
- await mkdir3(other, { recursive: true, mode: 448 });
18065
+ await mkdir(other, { recursive: true, mode: 448 });
18394
18066
  const initial = [root, ...options.additional ?? []];
18395
18067
  for (let attempt = 0; attempt < 3; attempt++) {
18396
18068
  const locations = await archiveLocations(initial, signal);
18397
18069
  const leases = [];
18398
18070
  try {
18399
18071
  for (const location of locations)
18400
- leases.push(await acquireLock(join9(location, ".media-writers"), { signal }));
18072
+ leases.push(await acquireLock(join6(location, ".media-writers"), { signal }));
18401
18073
  const current = await archiveLocations(initial, signal);
18402
18074
  if (current.some((location) => !locations.includes(location)))
18403
18075
  continue;
@@ -18417,7 +18089,7 @@ var withMediaArchiveLocks = /* @__PURE__ */ __name(async (directory2, signal, ru
18417
18089
  throw new CliError("validation_error", "archive locations changed during locking; run the command again");
18418
18090
  }, "withMediaArchiveLocks");
18419
18091
 
18420
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/media-archive.js
18092
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/media-archive.js
18421
18093
  var validateMediaSince = /* @__PURE__ */ __name((value, flag = "--since-time") => {
18422
18094
  if (value === void 0)
18423
18095
  return void 0;
@@ -18570,22 +18242,22 @@ var archiveMedia = /* @__PURE__ */ __name(async (ports, options) => {
18570
18242
  }, { create: true });
18571
18243
  }, "archiveMedia");
18572
18244
 
18573
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/media-archive-move.js
18574
- import { realpath as realpath5, unlink as unlink9 } from "node:fs/promises";
18575
- import { basename as basename4, dirname as dirname4, join as join10, resolve as resolve4 } from "node:path";
18245
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/media-archive-move.js
18246
+ import { realpath as realpath2, unlink as unlink5 } from "node:fs/promises";
18247
+ import { basename as basename2, dirname as dirname2, join as join7, resolve as resolve4 } from "node:path";
18576
18248
  var canonicalDestination = /* @__PURE__ */ __name(async (directory2) => {
18577
18249
  const path = resolve4(directory2);
18578
18250
  try {
18579
- return await realpath5(path);
18251
+ return await realpath2(path);
18580
18252
  } catch (error) {
18581
- if (!missingMediaFile(error) || dirname4(path) === path)
18253
+ if (!missingMediaFile(error) || dirname2(path) === path)
18582
18254
  throw error;
18583
- return join10(await canonicalDestination(dirname4(path)), basename4(path));
18255
+ return join7(await canonicalDestination(dirname2(path)), basename2(path));
18584
18256
  }
18585
18257
  }, "canonicalDestination");
18586
18258
  var image = /* @__PURE__ */ __name((entry) => ["photo", "image"].includes(entry.kind) || entry.mime?.startsWith("image/"), "image");
18587
18259
  var removeLocalCopy = /* @__PURE__ */ __name(async (root, entry, beforeWrite, signal) => {
18588
- const path = join10(root, entry.path);
18260
+ const path = join7(root, entry.path);
18589
18261
  let file;
18590
18262
  try {
18591
18263
  file = await openOrdinaryFile(path);
@@ -18604,7 +18276,7 @@ var removeLocalCopy = /* @__PURE__ */ __name(async (root, entry, beforeWrite, si
18604
18276
  await beforeWrite();
18605
18277
  if (!await sameOrdinaryFile(path, identity))
18606
18278
  throw new CliError("validation_error", "local image was replaced; it was preserved");
18607
- await unlink9(path);
18279
+ await unlink5(path);
18608
18280
  await syncDirectory(root);
18609
18281
  } finally {
18610
18282
  await file.close();
@@ -18615,7 +18287,7 @@ var moveMediaArchive = /* @__PURE__ */ __name(async (options) => {
18615
18287
  if (cutoff === void 0)
18616
18288
  throw new CliError("validation_error", "--before-time is required");
18617
18289
  const target2 = await canonicalDestination(options.archiveDirectory);
18618
- const source = await realpath5(options.directory);
18290
+ const source = await realpath2(options.directory);
18619
18291
  if (source === target2)
18620
18292
  throw new CliError("validation_error", "choose a different archive destination");
18621
18293
  return withMediaArchiveLocks(source, options.signal, async (root, beforeWrite) => {
@@ -18672,7 +18344,7 @@ var moveMediaArchive = /* @__PURE__ */ __name(async (options) => {
18672
18344
  for (const entry of candidates) {
18673
18345
  await beforeWrite();
18674
18346
  if (!known2.has(mediaKey(entry))) {
18675
- const file = await openOrdinaryFile(join10(root, entry.path));
18347
+ const file = await openOrdinaryFile(join7(root, entry.path));
18676
18348
  try {
18677
18349
  const identity = {
18678
18350
  provider: entry.provider,
@@ -18699,7 +18371,7 @@ var moveMediaArchive = /* @__PURE__ */ __name(async (options) => {
18699
18371
  if (!await verifyMediaEntry(root, receipt, options.signal))
18700
18372
  throw new CliError("validation_error", "archive destination changed before rotation; the original was preserved");
18701
18373
  await beforeWrite();
18702
- await writeFileAtomic(join10(root, mediaManifestName(entry)), JSON.stringify(receipt), {
18374
+ await writeFileAtomic(join7(root, mediaManifestName(entry)), JSON.stringify(receipt), {
18703
18375
  beforePublish: beforeWrite,
18704
18376
  signal: options.signal
18705
18377
  });
@@ -18723,7 +18395,7 @@ var moveMediaArchive = /* @__PURE__ */ __name(async (options) => {
18723
18395
  }, { additional: [target2], createAdditional: !options.dryRun });
18724
18396
  }, "moveMediaArchive");
18725
18397
 
18726
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/model-downloads.js
18398
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/model-downloads.js
18727
18399
  var bytesOf = /* @__PURE__ */ __name((model) => model.files.reduce((sum2, file) => sum2 + file.bytes, 0), "bytesOf");
18728
18400
  var nativeRuntime = /* @__PURE__ */ __name(async ({ env, progress = /* @__PURE__ */ __name(() => {
18729
18401
  }, "progress") }) => {
@@ -18746,7 +18418,7 @@ var downloadTextModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
18746
18418
  }
18747
18419
  await nativeRuntime({ env, progress });
18748
18420
  progress(`${model.id}: loading it once to check it works`);
18749
- const { openEmbedder: openEmbedder2 } = await import("./embed-7JHEPBFD.js");
18421
+ const { openEmbedder: openEmbedder2 } = await import("./embed-OYRHTMFI.js");
18750
18422
  const embedder = await openEmbedder2(model, directory2);
18751
18423
  try {
18752
18424
  const [vector] = await embedder.embed(["check"], "query");
@@ -18767,7 +18439,7 @@ var downloadRerankModel = /* @__PURE__ */ __name(async (id2, { env, progress = /
18767
18439
  }
18768
18440
  await nativeRuntime({ env, progress });
18769
18441
  progress(`${model.id}: loading it once to check it works`);
18770
- const { openReranker } = await import("./rerank-YSXWCAGZ.js");
18442
+ const { openReranker } = await import("./rerank-7E6GQ5Y6.js");
18771
18443
  const reranker = await openReranker(model, directory2);
18772
18444
  try {
18773
18445
  await reranker.score("check", ["check"]);
@@ -18785,7 +18457,7 @@ var downloadImageModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
18785
18457
  await installFiles(placedImage(model, directory2), { progress });
18786
18458
  }
18787
18459
  progress(`${model.id}: loading it once to check it works`);
18788
- const { openPictureEmbedder } = await import("./embedder-HTRPWR6T.js");
18460
+ const { openPictureEmbedder } = await import("./embedder-ZAYCL22W.js");
18789
18461
  const embedder = await openPictureEmbedder(model, directory2);
18790
18462
  try {
18791
18463
  const vector = await embedder.embedQuery("check");
@@ -18797,7 +18469,7 @@ var downloadImageModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
18797
18469
  return { model, directory: directory2 };
18798
18470
  }, "downloadImageModel");
18799
18471
 
18800
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/project-gathering-around.js
18472
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/project-gathering-around.js
18801
18473
  var storedMessageNeighbours = /* @__PURE__ */ __name((messages) => ({
18802
18474
  async around(ref, window2) {
18803
18475
  const at = parseLocator(ref);
@@ -18817,8 +18489,8 @@ var documentMatches = /* @__PURE__ */ __name((text2, queries, window2) => {
18817
18489
  const paragraphs = text2.split(/\n\s*\n/).map((part) => part.replace(/\s+/g, " ").trim()).filter(Boolean);
18818
18490
  const query = queries.join(" ");
18819
18491
  const words2 = new Set(wordsOf(query));
18820
- const matching = paragraphs.flatMap((part, index) => wordsOf(part).some((word) => words2.has(word)) ? [index] : []);
18821
- const hit = matching[0];
18492
+ const matching2 = paragraphs.flatMap((part, index) => wordsOf(part).some((word) => words2.has(word)) ? [index] : []);
18493
+ const hit = matching2[0];
18822
18494
  if (hit === void 0 || paragraphs.length < 2)
18823
18495
  return { around: [], moreMatches: 0 };
18824
18496
  const from = Math.max(0, hit - window2.before);
@@ -18826,7 +18498,7 @@ var documentMatches = /* @__PURE__ */ __name((text2, queries, window2) => {
18826
18498
  text: excerpt(part, query, 200, { literal: true }),
18827
18499
  found: from + index === hit
18828
18500
  }));
18829
- return { around, moreMatches: matching.length - 1 };
18501
+ return { around, moreMatches: matching2.length - 1 };
18830
18502
  }, "documentMatches");
18831
18503
  var documentPassage = /* @__PURE__ */ __name((text2, query, window2) => documentMatches(text2, [query], window2).around, "documentPassage");
18832
18504
  var attachNeighbours = /* @__PURE__ */ __name(async (items, reader, window2, budget, known2, signal) => {
@@ -18893,7 +18565,7 @@ var storedNeighbours = /* @__PURE__ */ __name((store) => {
18893
18565
  };
18894
18566
  }, "storedNeighbours");
18895
18567
 
18896
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/project-gathering-request.js
18568
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/project-gathering-request.js
18897
18569
  import { createHash as createHash5 } from "node:crypto";
18898
18570
  var DAY = 864e5;
18899
18571
  var MAX_TIME = 864e13;
@@ -19208,7 +18880,7 @@ var decodeCheckpoint = /* @__PURE__ */ __name((text2, plan) => {
19208
18880
  return value;
19209
18881
  }, "decodeCheckpoint");
19210
18882
 
19211
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/project-gathering.js
18883
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/project-gathering.js
19212
18884
  var terminal = /* @__PURE__ */ new Set(["done", "unavailable", "failed"]);
19213
18885
  var PAGE = 20;
19214
18886
  var PEOPLE = 20;
@@ -19279,9 +18951,9 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
19279
18951
  const matchedAgain = /* @__PURE__ */ new Map();
19280
18952
  const oversized = /* @__PURE__ */ new Map();
19281
18953
  let stopped = null;
19282
- const open10 = /* @__PURE__ */ __name((u) => !terminal.has(u.state) && u.state !== "read-limited", "open");
18954
+ const open7 = /* @__PURE__ */ __name((u) => !terminal.has(u.state) && u.state !== "read-limited", "open");
19283
18955
  const linkedLanes = new Set(plan.linkedChats.flatMap((c) => c.lane === null ? [] : [c.lane]));
19284
- const openLanes = new Set(progress.flatMap((u, index) => open10(u) ? [units2[index]?.lane.id] : []));
18956
+ const openLanes = new Set(progress.flatMap((u, index) => open7(u) ? [units2[index]?.lane.id] : []));
19285
18957
  const shares = [...linkedLanes].filter((id2) => openLanes.has(id2)).length + ([...openLanes].some((id2) => id2 !== void 0 && !linkedLanes.has(id2)) ? 1 : 0);
19286
18958
  const linkedLimit = Math.max(PAGE, Math.floor(plan.budgets.maxItems / Math.max(1, shares)));
19287
18959
  const linkedTaken = /* @__PURE__ */ new Map();
@@ -19340,9 +19012,9 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
19340
19012
  if (linkedLanes.has(lane.id))
19341
19013
  linkedTaken.set(lane.id, (linkedTaken.get(lane.id) ?? 0) + 1);
19342
19014
  }, "take");
19343
- const shallowest = progress.reduce((low, u) => open10(u) ? Math.min(low, u.pages) : low, Number.POSITIVE_INFINITY);
19015
+ const shallowest = progress.reduce((low, u) => open7(u) ? Math.min(low, u.pages) : low, Number.POSITIVE_INFINITY);
19344
19016
  for (let round = shallowest; !stopped; round++) {
19345
- const due = progress.flatMap((u, index) => open10(u) && u.pages <= round && !capped3.has(units2[index]?.lane.id ?? "") ? [index] : []);
19017
+ const due = progress.flatMap((u, index) => open7(u) && u.pages <= round && !capped3.has(units2[index]?.lane.id ?? "") ? [index] : []);
19346
19018
  if (!due.length)
19347
19019
  break;
19348
19020
  for (const index of due) {
@@ -19439,6 +19111,20 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
19439
19111
  signal
19440
19112
  );
19441
19113
  const people = peopleOf(items, senderOf);
19114
+ const coverageOf2 = /* @__PURE__ */ new Map();
19115
+ if (ports.coverage) {
19116
+ const byAccount = /* @__PURE__ */ new Map();
19117
+ for (const { provider, account: account2, chat, source } of plan.linkedChats) {
19118
+ if (source === null)
19119
+ continue;
19120
+ const group = byAccount.get(JSON.stringify([provider, account2])) ?? { account: { provider, account: account2 }, chats: [] };
19121
+ group.chats.push(chat);
19122
+ byAccount.set(JSON.stringify([provider, account2]), group);
19123
+ }
19124
+ for (const [key, { account: account2, chats }] of byAccount)
19125
+ for (const row of await ports.coverage(account2, chats))
19126
+ coverageOf2.set(`${key}${row.chatId}`, row);
19127
+ }
19442
19128
  const totals = {
19443
19129
  reads: (previous?.totals.reads ?? 0) + usage.reads,
19444
19130
  readBytes: (previous?.totals.readBytes ?? 0) + usage.readBytes,
@@ -19459,6 +19145,27 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
19459
19145
  seen: [...seen],
19460
19146
  totals
19461
19147
  };
19148
+ const linkedRows = plan.linkedChats.map(({ provider, account: account2, chat, ref, source, lane }) => {
19149
+ const laneUnits = units2.flatMap((unit, index) => unit.lane.id === lane ? [progress[index]] : []);
19150
+ const state = source === null ? "out-of-scope" : laneUnits.every((u) => u?.state === "unavailable") ? "unavailable" : laneUnits.every((u) => u?.state === "pending") ? "pending" : "in-scope";
19151
+ const row = coverageOf2.get(`${JSON.stringify([provider, account2])}${chat}`);
19152
+ return {
19153
+ provider,
19154
+ account: account2,
19155
+ chat,
19156
+ ref,
19157
+ source,
19158
+ lane,
19159
+ state,
19160
+ title: row?.title ?? null,
19161
+ completeness: row?.completeness ?? null,
19162
+ held: row?.held ?? null,
19163
+ ...state === "pending" ? {} : { items: lane === null ? 0 : linkedTaken.get(lane) ?? 0 },
19164
+ ...state === "pending" ? {} : { capped: lane !== null && capped3.has(lane) }
19165
+ };
19166
+ });
19167
+ const states = linkedRows.flatMap((row) => row.completeness ? [row.completeness.state] : []);
19168
+ const completeness = !states.length ? "unknown" : states.includes("partial") ? "partial" : states.includes("unknown") || states.length < linkedRows.filter((row) => row.source !== null).length ? "unknown" : "complete";
19462
19169
  return {
19463
19170
  schemaVersion: 1,
19464
19171
  runKey: plan.runKey,
@@ -19475,17 +19182,7 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
19475
19182
  },
19476
19183
  scope: { origin: plan.scope, sources: plan.sources },
19477
19184
  lanes: plan.lanes,
19478
- linkedChats: plan.linkedChats.map(({ provider, account: account2, chat, ref, source, lane }) => ({
19479
- provider,
19480
- account: account2,
19481
- chat,
19482
- ref,
19483
- source,
19484
- lane,
19485
- state: source === null ? "out-of-scope" : units2.every((unit, index) => unit.lane.id !== lane || progress[index]?.state === "unavailable") ? "unavailable" : "in-scope",
19486
- items: lane === null ? 0 : linkedTaken.get(lane) ?? 0,
19487
- capped: lane !== null && capped3.has(lane)
19488
- })),
19185
+ linkedChats: linkedRows,
19489
19186
  fetch: fetched.map((f, index) => ({ source: index, ...f })),
19490
19187
  index: indexed,
19491
19188
  units: units2.map((unit, index) => ({
@@ -19506,7 +19203,7 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
19506
19203
  totals,
19507
19204
  stopped,
19508
19205
  complete: !resumable,
19509
- completeness: "unknown",
19206
+ completeness,
19510
19207
  checkpoint: resumable ? encodeCheckpoint(checkpoint) : null
19511
19208
  };
19512
19209
  }, "gatherProjectEvidence");
@@ -19533,7 +19230,7 @@ var peopleOf = /* @__PURE__ */ __name((items, senderOf) => {
19533
19230
  return [...byKey.values()].sort((a, b) => b.items - a.items || a.name.localeCompare(b.name));
19534
19231
  }, "peopleOf");
19535
19232
 
19536
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidate-matching.js
19233
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidate-matching.js
19537
19234
  var normalizedText = /* @__PURE__ */ __name((text2) => text2.normalize("NFKC").toLowerCase().replace(/\s+/gu, " "), "normalizedText");
19538
19235
  var termsOf = /* @__PURE__ */ __name((entry) => [
19539
19236
  { name: entry.name, kind: "canonical" },
@@ -19598,7 +19295,7 @@ var matchProjectCandidates = /* @__PURE__ */ __name((catalog, input) => matchVoc
19598
19295
  omittedMatches: omitted
19599
19296
  })), "matchProjectCandidates");
19600
19297
 
19601
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/project-gathering-mentions.js
19298
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/project-gathering-mentions.js
19602
19299
  var KINDS = ["project", "tag", "topic"];
19603
19300
  var findEvidenceMentions = /* @__PURE__ */ __name(async (vocabulary, gathering, options = {}) => {
19604
19301
  if (typeof vocabulary?.vocabulary !== "function")
@@ -19653,7 +19350,7 @@ var findEvidenceMentions = /* @__PURE__ */ __name(async (vocabulary, gathering,
19653
19350
  };
19654
19351
  }, "findEvidenceMentions");
19655
19352
 
19656
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/ports/messenger.js
19353
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/ports/messenger.js
19657
19354
  var throughWrapper = /* @__PURE__ */ __name((inner, handled, wrap = (_, call) => call) => new Proxy(handled, {
19658
19355
  get: /* @__PURE__ */ __name((own, key) => {
19659
19356
  if (key in own)
@@ -19670,12 +19367,12 @@ var capability = /* @__PURE__ */ __name((adapter, method, what) => {
19670
19367
  return found.bind(adapter);
19671
19368
  }, "capability");
19672
19369
 
19673
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/sends/send-id.js
19370
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/sends/send-id.js
19674
19371
  import { randomBytes } from "node:crypto";
19675
19372
  var newSendId = /* @__PURE__ */ __name(() => randomBytes(8).readBigInt64BE().toString(), "newSendId");
19676
19373
  var newOperationId = newSendId;
19677
19374
 
19678
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/account.js
19375
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/account.js
19679
19376
  var accountService = /* @__PURE__ */ __name((deps) => {
19680
19377
  const online = /* @__PURE__ */ __name(async (command) => {
19681
19378
  if (deps.offline)
@@ -19747,7 +19444,7 @@ var accountService = /* @__PURE__ */ __name((deps) => {
19747
19444
  };
19748
19445
  }, "accountService");
19749
19446
 
19750
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/domain/send-time.js
19447
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/domain/send-time.js
19751
19448
  var MINUTE = 6e4;
19752
19449
  var YEAR = 365 * 24 * 60 * MINUTE;
19753
19450
  var DELAY = /^(\d+)(m|h|d)$/;
@@ -19766,7 +19463,7 @@ var sendTime = /* @__PURE__ */ __name((value, now = Date.now(), flag = "--at-tim
19766
19463
  return new Date(at - at % MINUTE).toISOString();
19767
19464
  }, "sendTime");
19768
19465
 
19769
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/admin.js
19466
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/admin.js
19770
19467
  var recordMembership = /* @__PURE__ */ __name(async (deps, operationId, done2, change, fix, write) => {
19771
19468
  try {
19772
19469
  const held = await accountStoreIfOpen(deps);
@@ -19795,11 +19492,11 @@ var adminService = /* @__PURE__ */ __name((deps) => {
19795
19492
  const chat = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "chat", action: "create", personIds, people: personIds.length }, () => create(title.trim(), personIds, { channel }), (made) => ({ chatId: made.id }));
19796
19493
  return { operationId, chat };
19797
19494
  }, "create"),
19798
- join: /* @__PURE__ */ __name(async (link5) => {
19495
+ join: /* @__PURE__ */ __name(async (link4) => {
19799
19496
  const connection = await online("chats join");
19800
- const join14 = capability(connection, "join", "join a chat by its link");
19497
+ const join11 = capability(connection, "join", "join a chat by its link");
19801
19498
  const operationId = newOperationId();
19802
- const joined = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "chat", action: "join" }, () => join14(link5.trim()), (answer) => "requested" in answer ? {} : { chatId: answer.id });
19499
+ const joined = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "chat", action: "join" }, () => join11(link4.trim()), (answer) => "requested" in answer ? {} : { chatId: answer.id });
19803
19500
  if ("requested" in joined)
19804
19501
  return { operationId, requested: true };
19805
19502
  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`;
@@ -19906,12 +19603,12 @@ var adminService = /* @__PURE__ */ __name((deps) => {
19906
19603
  const { already } = await guardedWrite(deps.guard, { operationId, chatId, kind: "chat", action: accept ? "requests.accept" : "requests.decline", people: 1 }, () => answer(chatId, personId, accept));
19907
19604
  return { operationId, chatId, personId, accepted: accept, already };
19908
19605
  }, "answerRequest"),
19909
- answerAllRequests: /* @__PURE__ */ __name(async (chat, accept, { link: link5 }) => {
19606
+ answerAllRequests: /* @__PURE__ */ __name(async (chat, accept, { link: link4 }) => {
19910
19607
  const connection = await online(`chats requests ${accept ? "accept" : "decline"} --all`);
19911
19608
  const list2 = capability(connection, "joinRequests", "read join requests");
19912
19609
  const answerAll = capability(connection, "answerAllJoinRequests", "answer every join request at once");
19913
19610
  const { id: chatId } = await connection.resolve(chat);
19914
- const page = await list2(chatId, { limit: 100, ...link5 === void 0 ? {} : { link: link5 } });
19611
+ const page = await list2(chatId, { limit: 100, ...link4 === void 0 ? {} : { link: link4 } });
19915
19612
  const counted2 = page.total ?? page.items.length;
19916
19613
  if (page.total === void 0 && page.hasMore)
19917
19614
  throw new CliError("validation_error", "too many requests to count; answer them by person, or by --link");
@@ -19925,7 +19622,7 @@ var adminService = /* @__PURE__ */ __name((deps) => {
19925
19622
  action: accept ? "requests.accept" : "requests.decline",
19926
19623
  count: counted2,
19927
19624
  people: counted2
19928
- }, () => answerAll(chatId, accept, link5));
19625
+ }, () => answerAll(chatId, accept, link4));
19929
19626
  return { operationId, chatId, accepted: accept, counted: counted2 };
19930
19627
  }, "answerAllRequests"),
19931
19628
  links: /* @__PURE__ */ __name(async (chat, window2) => {
@@ -19936,18 +19633,18 @@ var adminService = /* @__PURE__ */ __name((deps) => {
19936
19633
  const { id: chatId } = await connection.resolve(chat);
19937
19634
  return { chatId, ...await list2(chatId, window2) };
19938
19635
  }, "links"),
19939
- revokeLink: /* @__PURE__ */ __name(async (chat, link5) => {
19940
- if (link5.trim() === "")
19636
+ revokeLink: /* @__PURE__ */ __name(async (chat, link4) => {
19637
+ if (link4.trim() === "")
19941
19638
  throw new CliError("validation_error", "which link? give it as `chats links list` shows it");
19942
19639
  const connection = await online("chats links remove");
19943
19640
  const revoke = capability(connection, "revokeInviteLink", "revoke an invite link");
19944
19641
  const { id: chatId } = await connection.resolve(chat);
19945
19642
  const operationId = newOperationId();
19946
- const answer = await guardedWrite(deps.guard, { operationId, chatId, kind: "chat", action: "link.revoke" }, () => revoke(chatId, link5.trim()));
19643
+ const answer = await guardedWrite(deps.guard, { operationId, chatId, kind: "chat", action: "link.revoke" }, () => revoke(chatId, link4.trim()));
19947
19644
  return { operationId, chatId, ...answer };
19948
19645
  }, "revokeLink"),
19949
- updateLink: /* @__PURE__ */ __name(async (chat, link5, { approval, expires, maxUses }) => {
19950
- if (link5.trim() === "")
19646
+ updateLink: /* @__PURE__ */ __name(async (chat, link4, { approval, expires, maxUses }) => {
19647
+ if (link4.trim() === "")
19951
19648
  throw new CliError("validation_error", "which link? give it as `chats links list` shows it");
19952
19649
  if (approval === void 0 && expires === void 0 && maxUses === void 0)
19953
19650
  throw new CliError("validation_error", "nothing to change: give --approval, --no-approval, --expire-time or --max-uses");
@@ -19962,7 +19659,7 @@ var adminService = /* @__PURE__ */ __name((deps) => {
19962
19659
  ...maxUses === void 0 ? {} : { maxUses }
19963
19660
  };
19964
19661
  const operationId = newOperationId();
19965
- const answer = await guardedWrite(deps.guard, { operationId, chatId, kind: "chat", action: "link.update" }, () => update(chatId, link5.trim(), change));
19662
+ const answer = await guardedWrite(deps.guard, { operationId, chatId, kind: "chat", action: "link.update" }, () => update(chatId, link4.trim(), change));
19966
19663
  return { operationId, chatId, ...answer };
19967
19664
  }, "updateLink"),
19968
19665
  addMembers: /* @__PURE__ */ __name(async (chat, people, options) => {
@@ -20013,10 +19710,10 @@ var linkLimits = /* @__PURE__ */ __name(({ approval, expires, maxUses }) => {
20013
19710
  return expires === void 0 ? void 0 : sendTime(expires, Date.now(), "--expire-time");
20014
19711
  }, "linkLimits");
20015
19712
 
20016
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/ports/traits.js
19713
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/ports/traits.js
20017
19714
  var syncsOneChat = /* @__PURE__ */ __name((messenger) => messenger.history !== "store" || messenger.historyOnDemand === true, "syncsOneChat");
20018
19715
 
20019
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/mail-search.js
19716
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/mail-search.js
20020
19717
  var THREADS_PAGE = 500;
20021
19718
  var threadsOf = /* @__PURE__ */ __name(async (store, key) => {
20022
19719
  const account2 = await store.accounts.storedAccount(key).catch(() => void 0);
@@ -20095,7 +19792,7 @@ var readMail = /* @__PURE__ */ __name(async (store, locator, { before: before2 =
20095
19792
  return thread.slice(Math.max(0, at - before2), at + after + 1).map((hit) => hit.id === message ? { ...hit, anchor: true } : hit);
20096
19793
  }, "readMail");
20097
19794
 
20098
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/message-resolution.js
19795
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/message-resolution.js
20099
19796
  var readChatId = /* @__PURE__ */ __name(async (deps, reference, store, account2) => {
20100
19797
  if (deps.reads !== "store")
20101
19798
  return keptChatId(deps.messenger, reference, store, account2);
@@ -20242,7 +19939,7 @@ var senderAmong = /* @__PURE__ */ __name(async (store, accounts, reference) => {
20242
19939
  }
20243
19940
  }, "senderAmong");
20244
19941
 
20245
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/search-kind.js
19942
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/search-kind.js
20246
19943
  var NO_MAIL = "no_mail";
20247
19944
  var MAIL = "email";
20248
19945
  var listContextOf = /* @__PURE__ */ __name(async (store, account2, app, stored) => {
@@ -20289,7 +19986,7 @@ var accountsOfKind = /* @__PURE__ */ __name((kind, chosen, held, explicit, comma
20289
19986
  return chosenMail.map(({ provider, account: account2 }) => ({ provider, account: account2 }));
20290
19987
  }, "accountsOfKind");
20291
19988
 
20292
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/messages-search.js
19989
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/messages-search.js
20293
19990
  var MAIL_FIELDS = /* @__PURE__ */ new Set(["to", "cc", "bcc", "subject", "mailbox", "label", "is"]);
20294
19991
  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");
20295
19992
  var prepareLucene = /* @__PURE__ */ __name(async (store, account2, request, messenger) => {
@@ -20575,6 +20272,23 @@ var searchLucene = /* @__PURE__ */ __name(async (store, account2, request, messe
20575
20272
  ...request.kind === "mail" ? { accounts: mailAccounts.map(({ provider, account: account3 }) => ({ resource: "mail", provider, account: account3 })) } : {}
20576
20273
  };
20577
20274
  }, "searchLucene");
20275
+ var countLucene = /* @__PURE__ */ __name(async (store, account2, request, messenger, cap) => {
20276
+ const prepared = await prepareLucene(store, account2, request, messenger);
20277
+ if (!prepared.scopeAccounts.length)
20278
+ return 0;
20279
+ const count3 = /* @__PURE__ */ __name((execution) => store.queries.countMatches(execution, cap), "count");
20280
+ const mailAccounts = prepared.scopeAccounts.filter(({ provider }) => provider === MAIL);
20281
+ const messages = await count3(prepared.execution);
20282
+ let mail = 0;
20283
+ if (mailAccounts.length)
20284
+ try {
20285
+ mail = await count3({ ...prepared.execution, accounts: mailAccounts, corpus: "mail" });
20286
+ } catch (error) {
20287
+ if (!(request.kind !== "mail" && error instanceof CliError && error.code === "validation_error"))
20288
+ throw error;
20289
+ }
20290
+ return messages === void 0 || mail === void 0 ? void 0 : messages + mail;
20291
+ }, "countLucene");
20578
20292
  var correctionsOf = /* @__PURE__ */ __name((items) => {
20579
20293
  const found = /* @__PURE__ */ new Map();
20580
20294
  for (const { corrections = [] } of items)
@@ -20620,7 +20334,7 @@ var statsLucene = /* @__PURE__ */ __name(async (store, account2, request, messen
20620
20334
  };
20621
20335
  }, "statsLucene");
20622
20336
 
20623
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/moment.js
20337
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/moment.js
20624
20338
  var AGO = /^(\d+)(m|h|d)$/;
20625
20339
  var AGO_MS = { m: 6e4, h: 36e5, d: 864e5 };
20626
20340
  var DATE = /^\d{4}-\d{2}-\d{2}/;
@@ -20660,7 +20374,7 @@ var dateWindow = /* @__PURE__ */ __name(({ sinceTime, untilTime, zone, now = Dat
20660
20374
  };
20661
20375
  }, "dateWindow");
20662
20376
 
20663
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/rankings-selection.js
20377
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/rankings-selection.js
20664
20378
  var RANKING_SELECTION_BYTES = 64 * 1024;
20665
20379
  var object = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0, "object");
20666
20380
  function invalid(message = "ranking selection is invalid \u2014 obtain a new drilldown from stats top") {
@@ -20829,7 +20543,7 @@ var readRankingSelection = /* @__PURE__ */ __name(async (store, input) => {
20829
20543
  };
20830
20544
  }, "readRankingSelection");
20831
20545
 
20832
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/search-record.js
20546
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/search-record.js
20833
20547
  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");
20834
20548
  var searchRecordOf = /* @__PURE__ */ __name((command, params) => ({
20835
20549
  command,
@@ -20839,7 +20553,7 @@ var searchRecordOf = /* @__PURE__ */ __name((command, params) => ({
20839
20553
  fieldsVersion: FIELD_VERSION
20840
20554
  }), "searchRecordOf");
20841
20555
 
20842
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/admin-statistics.js
20556
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/admin-statistics.js
20843
20557
  function invalid2(message) {
20844
20558
  throw new CliError("validation_error", message);
20845
20559
  }
@@ -21133,7 +20847,7 @@ var adminStatisticsService = /* @__PURE__ */ __name((deps) => ({
21133
20847
  }, "evidence")
21134
20848
  }), "adminStatisticsService");
21135
20849
 
21136
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/domain/thread.js
20850
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/domain/thread.js
21137
20851
  var threadIdOf = /* @__PURE__ */ __name((value) => {
21138
20852
  if (value === void 0)
21139
20853
  return void 0;
@@ -21143,7 +20857,7 @@ var threadIdOf = /* @__PURE__ */ __name((value) => {
21143
20857
  return id2;
21144
20858
  }, "threadIdOf");
21145
20859
 
21146
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/questions.js
20860
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/questions.js
21147
20861
  var LINKS = /https?:\/\/\S+/g;
21148
20862
  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");
21149
20863
  var questions = /* @__PURE__ */ __name((messages, { answerers: answerers2 }) => {
@@ -21170,7 +20884,7 @@ var questions = /* @__PURE__ */ __name((messages, { answerers: answerers2 }) =>
21170
20884
  });
21171
20885
  }, "questions");
21172
20886
 
21173
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/chat-stats.js
20887
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/chat-stats.js
21174
20888
  var TOP_POSTS = 5;
21175
20889
  var JOINS = /* @__PURE__ */ new Set(["join", "add"]);
21176
20890
  var LEAVES = /* @__PURE__ */ new Set(["leave", "remove"]);
@@ -21287,7 +21001,7 @@ var median = /* @__PURE__ */ __name((values) => {
21287
21001
  return Math.round(sorted.length % 2 === 0 ? ((sorted[middle - 1] ?? upper) + upper) / 2 : upper);
21288
21002
  }, "median");
21289
21003
 
21290
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/member-history.js
21004
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/member-history.js
21291
21005
  var memberEvents = /* @__PURE__ */ __name((stays, revisions, since = 0) => {
21292
21006
  const events = [];
21293
21007
  for (const stay of stays) {
@@ -21319,7 +21033,7 @@ var memberEvents = /* @__PURE__ */ __name((stays, revisions, since = 0) => {
21319
21033
  return events.filter(({ at }) => Date.parse(at) >= since).sort((a, b) => Date.parse(a.at) - Date.parse(b.at) || a.id.localeCompare(b.id));
21320
21034
  }, "memberEvents");
21321
21035
 
21322
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/members-audit.js
21036
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/members-audit.js
21323
21037
  var AUDIT_PAGE = 200;
21324
21038
  var AUDIT_BUDGET = 10;
21325
21039
  var AUDIT_PAUSE_MS = 1e3;
@@ -21399,7 +21113,7 @@ var burstJoins = /* @__PURE__ */ __name((members) => {
21399
21113
  return found;
21400
21114
  }, "burstJoins");
21401
21115
 
21402
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/chats.js
21116
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/chats.js
21403
21117
  var EVENTS_DAYS = 7;
21404
21118
  var TRACKED_DAYS = 30;
21405
21119
  var STATS_PAGE = 1e3;
@@ -21459,7 +21173,7 @@ var chatsService = /* @__PURE__ */ __name((deps) => ({
21459
21173
  }
21460
21174
  const connection = await deps.connection();
21461
21175
  const shown = await connection.chat(chat);
21462
- 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;
21176
+ 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;
21463
21177
  if (card.members !== null || card.kind === "channel")
21464
21178
  return card;
21465
21179
  const held = await accountStoreIfOpen(deps);
@@ -21486,11 +21200,11 @@ var chatsService = /* @__PURE__ */ __name((deps) => ({
21486
21200
  }
21487
21201
  return capability(await deps.connection(), "chatEvents", "read who joined or left")(chat, { since: from });
21488
21202
  }, "events"),
21489
- inspect: /* @__PURE__ */ __name(async (link5) => {
21203
+ inspect: /* @__PURE__ */ __name(async (link4) => {
21490
21204
  if (deps.offline) {
21491
21205
  throw new CliError("validation_error", "`chats inspect` asks the messenger about the link; not with --offline");
21492
21206
  }
21493
- return capability(await deps.connection(), "inspect", "read a link")(link5);
21207
+ return capability(await deps.connection(), "inspect", "read a link")(link4);
21494
21208
  }, "inspect"),
21495
21209
  stats: /* @__PURE__ */ __name(async (chat, { since, by, timezone }) => {
21496
21210
  const store = await accountStore(deps);
@@ -21694,7 +21408,7 @@ var storedMembers = /* @__PURE__ */ __name(async (store, chatId) => {
21694
21408
  return members.length === 0 ? null : members;
21695
21409
  }, "storedMembers");
21696
21410
 
21697
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/task-categories.js
21411
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/task-categories.js
21698
21412
  var names = /* @__PURE__ */ __name((categories) => categories.map(({ name }) => name).join(", "), "names");
21699
21413
  var taskCategoryOf = /* @__PURE__ */ __name((categories = DEFAULT_TASK_CATEGORIES, flag = "--category") => (typed) => {
21700
21414
  const name = typed.trim().toLowerCase();
@@ -21744,7 +21458,7 @@ var categorize = /* @__PURE__ */ __name((text2, categories = DEFAULT_TASK_CATEGO
21744
21458
  return best.name;
21745
21459
  }, "categorize");
21746
21460
 
21747
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/task-rules.js
21461
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/task-rules.js
21748
21462
  var taskAccount = /* @__PURE__ */ __name(({ provider, account: account2 }) => `${provider}:${account2}`, "taskAccount");
21749
21463
  var RULES_IN = {
21750
21464
  dialog: "all",
@@ -21770,7 +21484,7 @@ var applyTaskRules = /* @__PURE__ */ __name(async (review, { store, account: acc
21770
21484
  const owner = taskAccount(account2);
21771
21485
  const result = { added: 0, closed: 0, review: 0 };
21772
21486
  const sourceOf2 = /* @__PURE__ */ __name((message) => formatLocator({ provider: account2.provider, account: account2.account, chat: message.chatId, message: message.id }), "sourceOf");
21773
- const open10 = /* @__PURE__ */ __name(async (message, group, kind) => {
21487
+ const open7 = /* @__PURE__ */ __name(async (message, group, kind) => {
21774
21488
  const { created, review: review2 = 0 } = await tasks.add({
21775
21489
  source: sourceOf2(message),
21776
21490
  sourceKind: "message",
@@ -21827,7 +21541,7 @@ var applyTaskRules = /* @__PURE__ */ __name(async (review, { store, account: acc
21827
21541
  let held = 0;
21828
21542
  for (const [index, { message, kind }] of opens.entries()) {
21829
21543
  if (index >= opens.length - keep2)
21830
- await open10(message, chat.id, kind);
21544
+ await open7(message, chat.id, kind);
21831
21545
  else if (!await hasTask(message)) {
21832
21546
  held += 1;
21833
21547
  onHeld?.({ source: sourceOf2(message), kind, category: categorize(message.text, categories) });
@@ -21950,7 +21664,7 @@ var applyTaskRulesToChats = /* @__PURE__ */ __name(async (store, account2, chatI
21950
21664
  return passes;
21951
21665
  }, "applyTaskRulesToChats");
21952
21666
 
21953
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/task-tag-filters.js
21667
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/task-tag-filters.js
21954
21668
  var taskTagFilters = /* @__PURE__ */ __name(async (store, query) => {
21955
21669
  const tags = /* @__PURE__ */ new Map();
21956
21670
  for (const node of query ? walkQuery(query.root) : [])
@@ -21959,7 +21673,7 @@ var taskTagFilters = /* @__PURE__ */ __name(async (store, query) => {
21959
21673
  return tags;
21960
21674
  }, "taskTagFilters");
21961
21675
 
21962
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/agenda.js
21676
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/agenda.js
21963
21677
  var DAY2 = 864e5;
21964
21678
  var CLAIMS = ["none", "mine", "others", "any"];
21965
21679
  var TASK_FIELDS = /* @__PURE__ */ new Set(["tag", "category", "claimed"]);
@@ -21997,9 +21711,9 @@ var agendaService = /* @__PURE__ */ __name((deps, now = Date.now) => ({
21997
21711
  return [];
21998
21712
  throw error;
21999
21713
  }), "find");
22000
- const open10 = await find();
21714
+ const open7 = await find();
22001
21715
  const tags = await taskTagFilters(store, parts.tasks);
22002
- const listed = parts.tasks ? await find(queryFilter(parts.tasks, taskColumns(holder, at, tags), { command: "tasks agenda" })) : open10;
21716
+ const listed = parts.tasks ? await find(queryFilter(parts.tasks, taskColumns(holder, at, tags), { command: "tasks agenda" })) : open7;
22003
21717
  const tasks = listed.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 }) => ({
22004
21718
  id: task2.id,
22005
21719
  key: task2.key,
@@ -22039,23 +21753,31 @@ var agendaService = /* @__PURE__ */ __name((deps, now = Date.now) => ({
22039
21753
  chat: chat.chatId,
22040
21754
  message: lastMessageId
22041
21755
  }),
22042
- openTasks: open10.filter((task2) => chatOf(task2.source) === chat.chatId).map((task2) => task2.id)
21756
+ openTasks: open7.filter((task2) => chatOf(task2.source) === chat.chatId).map((task2) => task2.id)
22043
21757
  }));
21758
+ const silentFor = /* @__PURE__ */ __name((chat) => at - Date.parse(chat.lastMessageAt), "silentFor");
21759
+ const shown = {
21760
+ owed: chats.filter((chat) => chat.lastFromOwner === false && silentFor(chat) >= unanswered2),
21761
+ waiting: chats.filter((chat) => chat.lastFromOwner === true && silentFor(chat) >= waiting),
21762
+ unsynced: chats.filter((chat) => chat.lastMessage === null)
21763
+ };
21764
+ const covered = new Map((await chatCoverage(store, account2, Object.values(shown).flatMap((list2) => list2.map(({ chatId }) => chatId)))).map((one) => [one.chatId, one]));
21765
+ const withCoverage = /* @__PURE__ */ __name((list2) => list2.map((chat) => ({ ...chat, coverage: covered.get(chat.chatId) })), "withCoverage");
22044
21766
  const inList = new Set((await store.tasks.categories()).map(({ name }) => name));
22045
21767
  const unlisted = /* @__PURE__ */ new Map();
22046
- for (const { category } of open10)
21768
+ for (const { category } of open7)
22047
21769
  if (category && !inList.has(category))
22048
21770
  unlisted.set(category, (unlisted.get(category) ?? 0) + 1);
22049
- const silentFor = /* @__PURE__ */ __name((chat) => at - Date.parse(chat.lastMessageAt), "silentFor");
22050
21771
  return {
22051
21772
  at: new Date(at).toISOString(),
21773
+ since: new Date(at - within).toISOString(),
22052
21774
  account: taskAccount(account2),
22053
21775
  storedAt: activity.storedAt,
22054
21776
  stale: activity.storedAt === null || at - Date.parse(activity.storedAt) > DAY2,
22055
21777
  tasks,
22056
- owed: chats.filter((chat) => chat.lastFromOwner === false && silentFor(chat) >= unanswered2),
22057
- waiting: chats.filter((chat) => chat.lastFromOwner === true && silentFor(chat) >= waiting),
22058
- unsynced: chats.filter((chat) => chat.lastMessage === null),
21778
+ owed: withCoverage(shown.owed),
21779
+ waiting: withCoverage(shown.waiting),
21780
+ unsynced: withCoverage(shown.unsynced),
22059
21781
  assigned,
22060
21782
  unlistedCategories: [...unlisted].sort().map(([name, openTasks]) => ({ name, openTasks }))
22061
21783
  };
@@ -22141,7 +21863,19 @@ var agendaItem = /* @__PURE__ */ __name((shown) => {
22141
21863
  last_message: one.lastMessage,
22142
21864
  last_message_at: one.lastMessageAt,
22143
21865
  last_from_owner: one.lastFromOwner,
22144
- open_tasks: one.openTasks
21866
+ open_tasks: one.openTasks,
21867
+ completeness: {
21868
+ state: one.coverage.completeness.state,
21869
+ up_to_date: one.coverage.completeness.upToDate,
21870
+ gaps: one.coverage.completeness.gaps,
21871
+ reaches_start: one.coverage.completeness.reachesStart,
21872
+ fetched_at: one.coverage.completeness.fetchedAt
21873
+ },
21874
+ held: {
21875
+ messages: one.coverage.held.messages,
21876
+ oldest_at: one.coverage.held.oldestAt,
21877
+ newest_at: one.coverage.held.newestAt
21878
+ }
22145
21879
  }), "chat");
22146
21880
  return {
22147
21881
  at: shown.at,
@@ -22181,10 +21915,10 @@ var agendaItem = /* @__PURE__ */ __name((shown) => {
22181
21915
  };
22182
21916
  }, "agendaItem");
22183
21917
 
22184
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/archive.js
21918
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/archive.js
22185
21919
  import { setTimeout as sleep3 } from "node:timers/promises";
22186
21920
 
22187
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/backfill-estimate.js
21921
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/backfill-estimate.js
22188
21922
  var REQUEST_MS = 400;
22189
21923
  var estimateBackfill = /* @__PURE__ */ __name(({ ranges, held, newest, page, maxPages, pauseMs }) => {
22190
21924
  const lowest = ranges[0];
@@ -22207,13 +21941,13 @@ var estimateBackfill = /* @__PURE__ */ __name(({ ranges, held, newest, page, max
22207
21941
  };
22208
21942
  }, "estimateBackfill");
22209
21943
 
22210
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/domain/recovery.js
21944
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/domain/recovery.js
22211
21945
  var withRecovery = /* @__PURE__ */ __name((error) => ({
22212
21946
  ...error,
22213
21947
  retryable: typeof error.retryable === "boolean" ? error.retryable : error.code === "rate_limited" || error.status === 429
22214
21948
  }), "withRecovery");
22215
21949
 
22216
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/batch.js
21950
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/batch.js
22217
21951
  var actionable = /* @__PURE__ */ __name((error) => {
22218
21952
  if (isCliFailure(error))
22219
21953
  return withRecovery({ code: error.code, message: error.message, ...error.details });
@@ -22296,7 +22030,7 @@ var mergeBatches = /* @__PURE__ */ __name((a, b) => {
22296
22030
  };
22297
22031
  }, "mergeBatches");
22298
22032
 
22299
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/patience.js
22033
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/patience.js
22300
22034
  import { setTimeout as sleep2 } from "node:timers/promises";
22301
22035
  var LONGEST_WAIT_MS = 5 * 60 * 1e3;
22302
22036
  var patiently = /* @__PURE__ */ __name(async (request, note, stop) => {
@@ -22319,7 +22053,7 @@ var patiently = /* @__PURE__ */ __name(async (request, note, stop) => {
22319
22053
  }
22320
22054
  }, "patiently");
22321
22055
 
22322
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/conversations/link.js
22056
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/conversations/link.js
22323
22057
  var RULES_VERSION = 5;
22324
22058
  var LOOK_BACK = 50;
22325
22059
  var SAME_SENDER_WITHIN = 10;
@@ -22351,7 +22085,7 @@ var linkMessages = /* @__PURE__ */ __name((messages, { handles = /* @__PURE__ */
22351
22085
  }
22352
22086
  return { links, parents, conversations };
22353
22087
  }, "linkMessages");
22354
- var replyLink = /* @__PURE__ */ __name((message, held) => message.replyToId !== void 0 && held.has(message.replyToId) ? [link3(message, message.replyToId, "provider", "reply", 1, "reply")] : [], "replyLink");
22088
+ var replyLink = /* @__PURE__ */ __name((message, held) => message.replyToId !== void 0 && held.has(message.replyToId) ? [link2(message, message.replyToId, "provider", "reply", 1, "reply")] : [], "replyLink");
22355
22089
  var mentionLinks = /* @__PURE__ */ __name((message, window2, handles) => {
22356
22090
  const links = [];
22357
22091
  const people = new Set([...mentioned(message.text, handles)].flatMap((handle) => handles.get(handle) ?? []));
@@ -22362,7 +22096,7 @@ var mentionLinks = /* @__PURE__ */ __name((message, window2, handles) => {
22362
22096
  continue;
22363
22097
  const target2 = latest(window2, (candidate) => candidate.senderId === sender && sameThread(candidate, message));
22364
22098
  if (target2)
22365
- links.push(link3(message, target2.id, "rule", "mention", 0.8, "mention-v1"));
22099
+ links.push(link2(message, target2.id, "rule", "mention", 0.8, "mention-v1"));
22366
22100
  }
22367
22101
  return links;
22368
22102
  }, "mentionLinks");
@@ -22371,7 +22105,7 @@ var sameSenderLink = /* @__PURE__ */ __name((message, window2) => {
22371
22105
  return [];
22372
22106
  const at = Date.parse(message.timestamp);
22373
22107
  const target2 = latest(window2.slice(-SAME_SENDER_WITHIN), (candidate) => candidate.senderId === message.senderId && sameThread(candidate, message) && at - Date.parse(candidate.timestamp) <= SAME_SENDER_MS);
22374
- return target2 ? [link3(message, target2.id, "rule", "same_sender", 0.5, "same-sender-v2")] : [];
22108
+ return target2 ? [link2(message, target2.id, "rule", "same_sender", 0.5, "same-sender-v2")] : [];
22375
22109
  }, "sameSenderLink");
22376
22110
  var mentioned = /* @__PURE__ */ __name((text2, handles) => {
22377
22111
  const found = /* @__PURE__ */ new Set();
@@ -22407,9 +22141,9 @@ var latest = /* @__PURE__ */ __name((window2, matches) => {
22407
22141
  return void 0;
22408
22142
  }, "latest");
22409
22143
  var sameThread = /* @__PURE__ */ __name((a, b) => a.threadId === b.threadId, "sameThread");
22410
- var link3 = /* @__PURE__ */ __name((message, parentId, source, kind, confidence, method) => ({ messageId: message.id, parentId, source, kind, confidence, method }), "link");
22144
+ var link2 = /* @__PURE__ */ __name((message, parentId, source, kind, confidence, method) => ({ messageId: message.id, parentId, source, kind, confidence, method }), "link");
22411
22145
 
22412
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/images/context/index.js
22146
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/images/context/index.js
22413
22147
  var CONTEXT_MESSAGES = 3;
22414
22148
  var CONTEXT_MINUTES = 10;
22415
22149
  var MAX_CHARS = 1200;
@@ -22433,12 +22167,12 @@ var context = {
22433
22167
  }, "describe")
22434
22168
  };
22435
22169
 
22436
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/images/registry.js
22170
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/images/registry.js
22437
22171
  var BUILT_INS = [context];
22438
22172
  var providers = [...BUILT_INS];
22439
22173
  var registeredImageProviders = /* @__PURE__ */ __name(() => providers, "registeredImageProviders");
22440
22174
 
22441
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/conversations.js
22175
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/conversations.js
22442
22176
  var READ_PAGE = 5e3;
22443
22177
  var CHAIN = 50;
22444
22178
  var CONVERSATION_QUERY = {
@@ -22569,7 +22303,7 @@ var conversationsService = /* @__PURE__ */ __name((deps) => {
22569
22303
  }, "clearAnswers"),
22570
22304
  links: /* @__PURE__ */ __name(async (chat, message) => {
22571
22305
  const { store, chatId } = await found(chat);
22572
- const chosenOf = /* @__PURE__ */ __name((links) => links.find((link5) => !link5.stale), "chosenOf");
22306
+ const chosenOf = /* @__PURE__ */ __name((links) => links.find((link4) => !link4.stale), "chosenOf");
22573
22307
  const own = await store.conversations.links(chatId, message);
22574
22308
  const chosen = chosenOf(own);
22575
22309
  const chain = [];
@@ -22579,7 +22313,7 @@ var conversationsService = /* @__PURE__ */ __name((deps) => {
22579
22313
  chain.push(parent);
22580
22314
  parent = chosenOf(await store.conversations.links(chatId, parent))?.parentId ?? null;
22581
22315
  }
22582
- return { chat: chatId, message, links: own.map((link5) => ({ ...link5, chosen: link5 === chosen })), chain };
22316
+ return { chat: chatId, message, links: own.map((link4) => ({ ...link4, chosen: link4 === chosen })), chain };
22583
22317
  }, "links")
22584
22318
  };
22585
22319
  }, "conversationsService");
@@ -22590,7 +22324,7 @@ var sized = /* @__PURE__ */ __name((size4) => {
22590
22324
  return size4;
22591
22325
  }, "sized");
22592
22326
 
22593
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/embeddings-maintenance.js
22327
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/embeddings-maintenance.js
22594
22328
  var REFRESH_BOUNDS = { maxChats: 20, maxChunks: 2e3 };
22595
22329
  var MESSAGE_PAGE = 5e3;
22596
22330
  var PER_SESSION = 8;
@@ -22609,7 +22343,7 @@ var embeddingTarget = /* @__PURE__ */ __name((deps, choice = DEFAULT_TEXT_MODEL)
22609
22343
  price: remote.price,
22610
22344
  installed: true,
22611
22345
  perBatch: PER_REQUEST * concurrency,
22612
- open: /* @__PURE__ */ __name(async () => (await import("./remote-JZ3TXP6I.js")).openRemote(remote, apiKey, { concurrency }), "open")
22346
+ open: /* @__PURE__ */ __name(async () => (await import("./remote-PD7WMTTS.js")).openRemote(remote, apiKey, { concurrency }), "open")
22613
22347
  };
22614
22348
  }
22615
22349
  const model = textModel(choice);
@@ -22626,7 +22360,7 @@ var embeddingTarget = /* @__PURE__ */ __name((deps, choice = DEFAULT_TEXT_MODEL)
22626
22360
  if (!isTextModelInstalled(model, directory2))
22627
22361
  throw notDownloaded(model.id);
22628
22362
  if (apart) {
22629
- const { openProcess } = await import("./process-IX5YWGDP.js");
22363
+ const { openProcess } = await import("./process-A45QXKID.js");
22630
22364
  return openProcess(model, directory2, { threads: threads ?? defaultThreads() });
22631
22365
  }
22632
22366
  return openEmbedder(model, directory2, { threads: threads ?? defaultThreads() });
@@ -22915,7 +22649,7 @@ var shaped = /* @__PURE__ */ __name(({ chatId, builtAt, algorithmVersion, pendin
22915
22649
  return { ...one, state };
22916
22650
  }, "shaped");
22917
22651
 
22918
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/search-catchup.js
22652
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/search-catchup.js
22919
22653
  var CATCH_UP_BOUNDS = { maxChunks: 500, maxMessages: 1e4, timeMs: 3e4 };
22920
22654
  var validateCatchUpBounds = /* @__PURE__ */ __name((options) => {
22921
22655
  for (const [key, value, maximum] of [
@@ -22968,7 +22702,7 @@ var catchUpSearch = /* @__PURE__ */ __name(async (deps, chat, options, signal, c
22968
22702
  }
22969
22703
  }, "catchUpSearch");
22970
22704
 
22971
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/archive.js
22705
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/archive.js
22972
22706
  var pushed = /* @__PURE__ */ __name((deps, what) => {
22973
22707
  if (deps.reads === "store") {
22974
22708
  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`);
@@ -23285,8 +23019,8 @@ var timeOfKey = /* @__PURE__ */ __name(async (store, account2, chatId, key, byTi
23285
23019
  return message?.timestamp ?? fallback;
23286
23020
  }, "timeOfKey");
23287
23021
 
23288
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/archive-gaps.js
23289
- import { createHash as createHash6, randomUUID as randomUUID6 } from "node:crypto";
23022
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/archive-gaps.js
23023
+ import { createHash as createHash6, randomUUID as randomUUID4 } from "node:crypto";
23290
23024
  var GAP_BOUNDS = { maxGaps: 5, limit: 500, timeMs: 3e4 };
23291
23025
  var validateRepair = /* @__PURE__ */ __name((messenger, options) => {
23292
23026
  const maxGaps = options.maxGaps ?? GAP_BOUNDS.maxGaps;
@@ -23345,7 +23079,7 @@ var gapsService = /* @__PURE__ */ __name((deps) => {
23345
23079
  if (options.fingerprint !== void 0 && options.fingerprint !== before2.fingerprint)
23346
23080
  throw new CliError("validation_error", "the gap plan changed; inspect it again before repairing");
23347
23081
  const store = await deps.store();
23348
- const holder = randomUUID6();
23082
+ const holder = randomUUID4();
23349
23083
  if (!await store.sync.claim(before2.account, before2.chat, "gaps", holder, timeMs + 5e3))
23350
23084
  throw new CliError("validation_error", "another gap repair holds this chat; retry after it finishes");
23351
23085
  const started = Date.now();
@@ -23422,19 +23156,19 @@ var gapsService = /* @__PURE__ */ __name((deps) => {
23422
23156
  return { plan, repair };
23423
23157
  }, "gapsService");
23424
23158
 
23425
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/attachments.js
23159
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/attachments.js
23426
23160
  import { createHash as createHash8 } from "node:crypto";
23427
- import { constants as constants4 } from "node:fs";
23428
- import { open as open9, readFile, stat as stat2 } from "node:fs/promises";
23161
+ import { constants as constants2 } from "node:fs";
23162
+ import { open as open6, readFile, stat as stat2 } from "node:fs/promises";
23429
23163
 
23430
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/attachments/directory.js
23431
- import { lstat as lstat5, readdir as readdir3, realpath as realpath6 } from "node:fs/promises";
23432
- import { basename as basename6, join as join11, relative as relative2, sep as sep2 } from "node:path";
23164
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/attachments/directory.js
23165
+ import { lstat as lstat2, readdir as readdir2, realpath as realpath3 } from "node:fs/promises";
23166
+ import { basename as basename4, join as join8, relative as relative2, sep as sep2 } from "node:path";
23433
23167
 
23434
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/sends/upload.js
23168
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/sends/upload.js
23435
23169
  import { openAsBlob, realpathSync } from "node:fs";
23436
- import { open as open7, stat } from "node:fs/promises";
23437
- import { basename as basename5, dirname as dirname5, extname, isAbsolute as isAbsolute2, relative, resolve as resolve5, sep } from "node:path";
23170
+ import { open as open4, stat } from "node:fs/promises";
23171
+ import { basename as basename3, dirname as dirname3, extname, isAbsolute as isAbsolute2, relative, resolve as resolve5, sep } from "node:path";
23438
23172
  var MAX_BUFFERED_UPLOAD_BYTES = 256 * 1024 * 1024;
23439
23173
  var uploadSize = /* @__PURE__ */ __name((source) => source.kind === "file" ? source.size : source.bytes.byteLength, "uploadSize");
23440
23174
  var PHOTO = /* @__PURE__ */ new Set([".jpg", ".jpeg", ".png", ".webp"]);
@@ -23450,7 +23184,7 @@ var SIGNATURES = {
23450
23184
  }, ".webp")
23451
23185
  };
23452
23186
  var fileHead = /* @__PURE__ */ __name(async (path) => {
23453
- const file = await open7(path, "r");
23187
+ const file = await open4(path, "r");
23454
23188
  try {
23455
23189
  const head = new Uint8Array(12);
23456
23190
  const { bytesRead } = await file.read(head, 0, head.length, 0);
@@ -23535,7 +23269,7 @@ var refusedPlace = /* @__PURE__ */ __name((path, app, env, platform = process.pl
23535
23269
  real = resolve5(realpathSync(ancestor), relative(ancestor, resolve5(path)));
23536
23270
  break;
23537
23271
  } catch {
23538
- const parent = dirname5(ancestor);
23272
+ const parent = dirname3(ancestor);
23539
23273
  if (parent === ancestor)
23540
23274
  break;
23541
23275
  ancestor = parent;
@@ -23587,7 +23321,7 @@ var readUpload = /* @__PURE__ */ __name(async (kind, path, { app, env = process.
23587
23321
  if (head !== void 0 && SIGNATURES[extension]?.(head) !== true) {
23588
23322
  throw new CliError("validation_error", `${path} is not a ${typesText(photoTypes ?? [])} image inside`);
23589
23323
  }
23590
- return { kind, name: basename5(path), source: { kind: "file", path: resolve5(path), size: size4 } };
23324
+ return { kind, name: basename3(path), source: { kind: "file", path: resolve5(path), size: size4 } };
23591
23325
  }, "readUpload");
23592
23326
  var checkFilename = /* @__PURE__ */ __name((filename, files) => {
23593
23327
  if (files.length === 0)
@@ -23633,28 +23367,28 @@ var readStickerFile = /* @__PURE__ */ __name(async (path, maxBytes, read) => {
23633
23367
  return { name, source };
23634
23368
  }, "readStickerFile");
23635
23369
 
23636
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/attachments/directory.js
23370
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/attachments/directory.js
23637
23371
  var MAX_FILES = 1e4;
23638
23372
  var directoryPaths = /* @__PURE__ */ __name(async (store, chat, directory2, app, env) => {
23639
23373
  if (refusedPlace(directory2, app, env))
23640
23374
  throw new CliError("validation_error", "--from-dir cannot read credential folders, the CLI's own folders or the message store");
23641
- const root = await realpath6(directory2).catch(() => {
23375
+ const root = await realpath3(directory2).catch(() => {
23642
23376
  throw new CliError("validation_error", "--from-dir must name an existing directory");
23643
23377
  });
23644
- const names2 = await readdir3(root).catch(() => {
23378
+ const names2 = await readdir2(root).catch(() => {
23645
23379
  throw new CliError("validation_error", "--from-dir must name a readable directory");
23646
23380
  });
23647
23381
  if (names2.length > MAX_FILES)
23648
23382
  throw new CliError("validation_error", "--from-dir holds too many files; use a smaller directory");
23649
23383
  const files = /* @__PURE__ */ new Map();
23650
23384
  for (const name of names2) {
23651
- const path = join11(root, name);
23652
- const info = await lstat5(path);
23385
+ const path = join8(root, name);
23386
+ const info = await lstat2(path);
23653
23387
  if (info.isSymbolicLink())
23654
23388
  throw new CliError("validation_error", "--from-dir cannot read symbolic links");
23655
23389
  if (!info.isFile())
23656
23390
  continue;
23657
- const canonical2 = await realpath6(path);
23391
+ const canonical2 = await realpath3(path);
23658
23392
  if (refusedPlace(canonical2, app, env))
23659
23393
  throw new CliError("validation_error", "--from-dir cannot read credential files, the CLI's own files or the message store");
23660
23394
  const inside2 = relative2(root, canonical2);
@@ -23672,20 +23406,20 @@ var directoryPaths = /* @__PURE__ */ __name(async (store, chat, directory2, app,
23672
23406
  group.push(file);
23673
23407
  groups.set(file.messageId, group);
23674
23408
  if (file.name)
23675
- counts.set(basename6(file.name), (counts.get(basename6(file.name)) ?? 0) + 1);
23409
+ counts.set(basename4(file.name), (counts.get(basename4(file.name)) ?? 0) + 1);
23676
23410
  }
23677
23411
  const choices = /* @__PURE__ */ new Map();
23678
23412
  for (const group of groups.values()) {
23679
23413
  group.sort((a, b) => a.position - b.position);
23680
23414
  const candidates = group.map((file, index) => {
23681
23415
  const prefix = `${file.messageId}-${index + 1}`;
23682
- return [...files].filter(([name]) => name === prefix || name.startsWith(`${prefix}.`) || file.name !== null && name === `${prefix}-${basename6(file.name)}`).map(([, path]) => path);
23416
+ return [...files].filter(([name]) => name === prefix || name.startsWith(`${prefix}.`) || file.name !== null && name === `${prefix}-${basename4(file.name)}`).map(([, path]) => path);
23683
23417
  });
23684
23418
  if (candidates.some((paths) => paths.length > 1))
23685
23419
  throw new CliError("validation_error", "more than one directory file matches a download ordinal");
23686
23420
  const complete = candidates.every((paths) => paths.length === 1);
23687
23421
  group.forEach((file, index) => {
23688
- const own = file.name === null ? void 0 : basename6(file.name);
23422
+ const own = file.name === null ? void 0 : basename4(file.name);
23689
23423
  const named2 = own && counts.get(own) === 1 ? files.get(own) : void 0;
23690
23424
  const canonical2 = complete ? candidates[index]?.[0] : void 0;
23691
23425
  if (named2 && canonical2 && named2 !== canonical2 || !complete && own && files.has(own) && (counts.get(own) ?? 0) > 1)
@@ -23702,15 +23436,15 @@ var directoryPaths = /* @__PURE__ */ __name(async (store, chat, directory2, app,
23702
23436
  return choices;
23703
23437
  }, "directoryPaths");
23704
23438
 
23705
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/attachments/documents.js
23439
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/attachments/documents.js
23706
23440
  import { posix } from "node:path";
23707
23441
 
23708
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/attachments/container.js
23442
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/attachments/container.js
23709
23443
  import { setImmediate as tick } from "node:timers/promises";
23710
23444
  import { crc32 } from "node:zlib";
23711
23445
  var import_xmldom = __toESM(require_lib(), 1);
23712
23446
 
23713
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/attachments/encoding.js
23447
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/attachments/encoding.js
23714
23448
  var import_chardet = __toESM(require_lib2(), 1);
23715
23449
  var import_iconv_lite = __toESM(require_lib3(), 1);
23716
23450
  var SAMPLE = 65536;
@@ -23812,7 +23546,7 @@ var decodeXml = /* @__PURE__ */ __name((bytes2) => {
23812
23546
  return result.text;
23813
23547
  }, "decodeXml");
23814
23548
 
23815
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/attachments/container.js
23549
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/attachments/container.js
23816
23550
  var MAX_PART = 10 * 1024 * 1024;
23817
23551
  var MAX_ENTRIES = 1e3;
23818
23552
  var decoder = new TextDecoder("utf-8", { fatal: true });
@@ -24027,7 +23761,7 @@ var elements = /* @__PURE__ */ __name((node, name, namespace) => {
24027
23761
  return found;
24028
23762
  }, "elements");
24029
23763
 
24030
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/attachments/sheets.js
23764
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/attachments/sheets.js
24031
23765
  var columnName = /* @__PURE__ */ __name((column) => {
24032
23766
  let name = "";
24033
23767
  for (let rest = column; rest > 0; rest = Math.floor((rest - 1) / 26))
@@ -24082,7 +23816,7 @@ var sheetText = /* @__PURE__ */ __name((sheets2, maxChars = MAX_TEXT_CHARS) => {
24082
23816
  return { text: parts.join("").trim(), truncated: false };
24083
23817
  }, "sheetText");
24084
23818
 
24085
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/attachments/documents.js
23819
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/attachments/documents.js
24086
23820
  var OFFICE = "urn:oasis:names:tc:opendocument:xmlns:office:1.0";
24087
23821
  var TEXT = "urn:oasis:names:tc:opendocument:xmlns:text:1.0";
24088
23822
  var TABLE = "urn:oasis:names:tc:opendocument:xmlns:table:1.0";
@@ -24482,27 +24216,27 @@ var readDocument = /* @__PURE__ */ __name(async (bytes2, kind, signal) => {
24482
24216
  }
24483
24217
  }, "readDocument");
24484
24218
 
24485
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/attachments/extract.js
24219
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/attachments/extract.js
24486
24220
  import { extname as extname3 } from "node:path";
24487
24221
 
24488
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/readers/engine.js
24222
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/readers/engine.js
24489
24223
  import { readFileSync } from "node:fs";
24490
- import { dirname as dirname6, extname as extname2, join as join12 } from "node:path";
24224
+ import { dirname as dirname4, extname as extname2, join as join9 } from "node:path";
24491
24225
  import { fileURLToPath } from "node:url";
24492
24226
  var BUILT_IN = ["unpdf", "mammoth", "word-extractor", "linkedom", "defuddle/node"];
24493
24227
  var ENGINES = [...BUILT_IN, "@napi-rs/canvas"];
24494
24228
  var isMissing = /* @__PURE__ */ __name((error, name) => error?.code === "ERR_MODULE_NOT_FOUND" && String(error.message).includes(name), "isMissing");
24495
24229
  var versionOf = /* @__PURE__ */ __name((name) => {
24496
24230
  try {
24497
- let directory2 = dirname6(fileURLToPath(resolveFrom(new URL("readers/engine.js", import.meta.resolve("@wirecat/cli-core")).href, name)));
24231
+ let directory2 = dirname4(fileURLToPath(resolveFrom(new URL("readers/engine.js", import.meta.resolve("@wirecat/cli-core")).href, name)));
24498
24232
  for (let depth = 0; depth < 6; depth += 1) {
24499
24233
  try {
24500
- const manifest = JSON.parse(readFileSync(join12(directory2, "package.json"), "utf8"));
24234
+ const manifest = JSON.parse(readFileSync(join9(directory2, "package.json"), "utf8"));
24501
24235
  if (manifest.name === name && manifest.version)
24502
24236
  return `${name}@${manifest.version}`;
24503
24237
  } catch {
24504
24238
  }
24505
- directory2 = dirname6(directory2);
24239
+ directory2 = dirname4(directory2);
24506
24240
  }
24507
24241
  } catch {
24508
24242
  }
@@ -24546,7 +24280,7 @@ var derived = /* @__PURE__ */ __name((bytes2, extractor, read) => {
24546
24280
  }
24547
24281
  }, "derived");
24548
24282
 
24549
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/readers/image/index.js
24283
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/readers/image/index.js
24550
24284
  var IMAGES = /* @__PURE__ */ new Set([".jpg", ".jpeg", ".png", ".webp", ".gif", ".heic", ".tif", ".tiff", ".bmp"]);
24551
24285
  var image2 = {
24552
24286
  id: "image",
@@ -24555,7 +24289,7 @@ var image2 = {
24555
24289
  read: /* @__PURE__ */ __name(async () => ({ status: "needs-agent" }), "read")
24556
24290
  };
24557
24291
 
24558
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/readers/doc/index.js
24292
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/readers/doc/index.js
24559
24293
  var OLE = "\xD0\xCF\xE0\xA1\xB1\xE1";
24560
24294
  var doc = {
24561
24295
  id: "doc",
@@ -24567,7 +24301,7 @@ var doc = {
24567
24301
  }), "read")
24568
24302
  };
24569
24303
 
24570
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/readers/docx/index.js
24304
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/readers/docx/index.js
24571
24305
  var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
24572
24306
  var docx = {
24573
24307
  id: "docx",
@@ -24580,7 +24314,7 @@ var docx = {
24580
24314
  }), "read")
24581
24315
  };
24582
24316
 
24583
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/attachments/markup.js
24317
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/attachments/markup.js
24584
24318
  var import_iconv_lite2 = __toESM(require_lib3(), 1);
24585
24319
  var RTF_SKIPPED = /* @__PURE__ */ new Set([
24586
24320
  "fonttbl",
@@ -24723,11 +24457,11 @@ var dropHidden = /* @__PURE__ */ __name((source) => {
24723
24457
  const unclosed = /* @__PURE__ */ new Set();
24724
24458
  let out = "";
24725
24459
  let kept = 0;
24726
- for (const open10 of source.matchAll(HTML_DROPPED_OPEN)) {
24727
- const name = open10[1].toLowerCase();
24728
- if (open10.index < kept || unclosed.has(name))
24460
+ for (const open7 of source.matchAll(HTML_DROPPED_OPEN)) {
24461
+ const name = open7[1].toLowerCase();
24462
+ if (open7.index < kept || unclosed.has(name))
24729
24463
  continue;
24730
- const gt = source.indexOf(">", open10.index + open10[0].length);
24464
+ const gt = source.indexOf(">", open7.index + open7[0].length);
24731
24465
  if (gt < 0)
24732
24466
  break;
24733
24467
  const close = HTML_DROPPED_CLOSE.get(name);
@@ -24737,7 +24471,7 @@ var dropHidden = /* @__PURE__ */ __name((source) => {
24737
24471
  unclosed.add(name);
24738
24472
  continue;
24739
24473
  }
24740
- out += source.slice(kept, open10.index);
24474
+ out += source.slice(kept, open7.index);
24741
24475
  kept = end.index + end[0].length;
24742
24476
  }
24743
24477
  return out + source.slice(kept);
@@ -24756,7 +24490,7 @@ var htmlText = /* @__PURE__ */ __name((source) => {
24756
24490
  }, "htmlText");
24757
24491
  var safeChar = /* @__PURE__ */ __name((code, fallback) => code > 0 && code <= 1114111 ? String.fromCodePoint(code) : fallback, "safeChar");
24758
24492
 
24759
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/readers/html/page.js
24493
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/readers/html/page.js
24760
24494
  var clean = /* @__PURE__ */ __name((value) => typeof value === "string" ? value.replace(/\s+/g, " ").trim() : "", "clean");
24761
24495
  var namesIn = /* @__PURE__ */ __name((value) => [value].flat().map((entry) => typeof entry === "string" ? clean(entry) : clean(entry?.name)).filter(Boolean).join(", "), "namesIn");
24762
24496
  var jsonLdNodes = /* @__PURE__ */ __name((document) => {
@@ -24812,7 +24546,7 @@ var markdownSections = /* @__PURE__ */ __name((text2) => {
24812
24546
  return found.map((section, index) => ({ ...section, end: found[index + 1]?.start ?? text2.length }));
24813
24547
  }, "markdownSections");
24814
24548
 
24815
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/readers/html/index.js
24549
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/readers/html/index.js
24816
24550
  var HTML = /* @__PURE__ */ new Set([".html", ".htm", ".xhtml"]);
24817
24551
  var first = /* @__PURE__ */ __name((...values) => values.find((value) => typeof value === "string" && value !== ""), "first");
24818
24552
  var loaded = /* @__PURE__ */ __name(async (load, name) => {
@@ -24850,8 +24584,8 @@ var readPage = /* @__PURE__ */ __name(async (source, load) => {
24850
24584
  };
24851
24585
  }, "readPage");
24852
24586
  var titleOf = /* @__PURE__ */ __name((source) => {
24853
- const open10 = /<title/i.exec(source);
24854
- const gt = open10 ? source.indexOf(">", open10.index + open10[0].length) : -1;
24587
+ const open7 = /<title/i.exec(source);
24588
+ const gt = open7 ? source.indexOf(">", open7.index + open7[0].length) : -1;
24855
24589
  if (gt < 0)
24856
24590
  return "";
24857
24591
  const close = /<\/title\s*>/gi;
@@ -24883,7 +24617,7 @@ var html = {
24883
24617
  }, "read")
24884
24618
  };
24885
24619
 
24886
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/readers/office/index.js
24620
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/readers/office/index.js
24887
24621
  var office = {
24888
24622
  id: "office",
24889
24623
  version: documentExtractor("odt"),
@@ -24894,7 +24628,7 @@ var office = {
24894
24628
  }, "read")
24895
24629
  };
24896
24630
 
24897
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/readers/pdf/index.js
24631
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/readers/pdf/index.js
24898
24632
  var pdf = {
24899
24633
  id: "pdf",
24900
24634
  version: "unpdf",
@@ -24961,7 +24695,7 @@ var pdf = {
24961
24695
  }), "read")
24962
24696
  };
24963
24697
 
24964
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/readers/plain/index.js
24698
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/readers/plain/index.js
24965
24699
  var PLAIN = /* @__PURE__ */ new Set([".txt", ".md", ".markdown", ".csv", ".tsv", ".json", ".log"]);
24966
24700
  var isPlain = /* @__PURE__ */ __name((hint) => PLAIN.has(extensionOf(hint)) || hint.mime?.startsWith("text/") || hint.mime === "application/json", "isPlain");
24967
24701
  var readPlain = /* @__PURE__ */ __name((bytes2) => {
@@ -24981,7 +24715,7 @@ var plain = {
24981
24715
  read: /* @__PURE__ */ __name(async (bytes2) => readPlain(bytes2), "read")
24982
24716
  };
24983
24717
 
24984
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/readers/rtf/index.js
24718
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/readers/rtf/index.js
24985
24719
  var rtf = {
24986
24720
  id: "rtf",
24987
24721
  version: "v1",
@@ -24989,10 +24723,10 @@ var rtf = {
24989
24723
  read: /* @__PURE__ */ __name(async (bytes2) => derived(bytes2, "rtf:v1", rtfText), "read")
24990
24724
  };
24991
24725
 
24992
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
24993
- import { basename as basename7 } from "node:path";
24726
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
24727
+ import { basename as basename5 } from "node:path";
24994
24728
 
24995
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/attachments/csv-spans.js
24729
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/attachments/csv-spans.js
24996
24730
  var delimitedSpans = /* @__PURE__ */ __name((text2, delimiter, maxCells = 1e4) => {
24997
24731
  const cells = [];
24998
24732
  let row = 1, column = 1, start = 0, quoted = false, truncated = false;
@@ -25030,7 +24764,7 @@ var delimitedSpans = /* @__PURE__ */ __name((text2, delimiter, maxCells = 1e4) =
25030
24764
  return { cells, truncated };
25031
24765
  }, "delimitedSpans");
25032
24766
 
25033
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
24767
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
25034
24768
  var DELIMITED = {
25035
24769
  ".csv": ",",
25036
24770
  ".tsv": " ",
@@ -25060,7 +24794,7 @@ var sheets = {
25060
24794
  column,
25061
24795
  value: unquoted(result.text.slice(start, end))
25062
24796
  }));
25063
- const name = basename7(hint.name ?? hint.path, extensionOf(hint)) || "Sheet";
24797
+ const name = basename5(hint.name ?? hint.path, extensionOf(hint)) || "Sheet";
25064
24798
  const { text: text2, truncated } = sheetText([{ name, cells }]);
25065
24799
  return text2 === "" ? { status: "needs-agent", extractor } : { status: "extracted", text: text2, extractor, ...truncated || spans.truncated ? { truncated: true } : {} };
25066
24800
  } catch {
@@ -25069,7 +24803,7 @@ var sheets = {
25069
24803
  }, "read")
25070
24804
  };
25071
24805
 
25072
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/readers/registry.js
24806
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/readers/registry.js
25073
24807
  var BUILT_INS2 = [office, pdf, docx, doc, rtf, html, sheets, plain, image2];
25074
24808
  var HEAD_BYTES = 1024;
25075
24809
  var readers = [...BUILT_INS2];
@@ -25079,7 +24813,7 @@ var readWithRegistry = /* @__PURE__ */ __name(async (bytes2, hint, context2) =>
25079
24813
  return reader ? reader.read(bytes2, hint, context2) : { status: "unsupported" };
25080
24814
  }, "readWithRegistry");
25081
24815
 
25082
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/attachments/extract.js
24816
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/attachments/extract.js
25083
24817
  var importEngine = /* @__PURE__ */ __name((name) => importFrom(new URL("attachments/extract.js", import.meta.resolve("@wirecat/cli-core")).href, name), "importEngine");
25084
24818
  var extensionOf2 = /* @__PURE__ */ __name(({ name, path }) => extname3(name ?? path).toLowerCase(), "extensionOf");
25085
24819
  var extractText = /* @__PURE__ */ __name(async (bytes2, hint, load, signal, env = process.env) => {
@@ -26158,7 +25892,7 @@ function imageSize(input) {
26158
25892
  }
26159
25893
  __name(imageSize, "imageSize");
26160
25894
 
26161
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/attachments/ocr.js
25895
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/attachments/ocr.js
26162
25896
  var MAX_PAGES = 20;
26163
25897
  var MAX_PIXELS = 2e7;
26164
25898
  var cancelled2 = /* @__PURE__ */ __name((signal) => {
@@ -26309,7 +26043,7 @@ var ocrPdf = /* @__PURE__ */ __name(async (bytes2, pipeline2, load, signal) => {
26309
26043
  }
26310
26044
  }, "ocrPdf");
26311
26045
 
26312
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/attachments/pdf-preview.js
26046
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/attachments/pdf-preview.js
26313
26047
  var pdfPreview = /* @__PURE__ */ __name(async (bytes2, page, signal, load = importEngine, env = process.env) => {
26314
26048
  const limits = pdfPreviewLimits(env);
26315
26049
  const cancelled5 = /* @__PURE__ */ __name(() => {
@@ -26386,10 +26120,10 @@ var pdfPreview = /* @__PURE__ */ __name(async (bytes2, page, signal, load = impo
26386
26120
  }
26387
26121
  }, "pdfPreview");
26388
26122
 
26389
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/attachments/transfer.js
26123
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/attachments/transfer.js
26390
26124
  import { createHash as createHash7 } from "node:crypto";
26391
- import { constants as constants3 } from "node:fs";
26392
- import { lstat as lstat6, open as open8 } from "node:fs/promises";
26125
+ import { constants } from "node:fs";
26126
+ import { lstat as lstat3, open as open5 } from "node:fs/promises";
26393
26127
  var MAX_CHUNK_BYTES = 1024 * 1024;
26394
26128
  var validateWindow = /* @__PURE__ */ __name(({ offsetBytes = 0, chunkBytes = 524288, ifSha256 }) => {
26395
26129
  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))
@@ -26405,14 +26139,14 @@ var retainedBytes = /* @__PURE__ */ __name(async (path, options, captureFile = f
26405
26139
  }, "cancelled");
26406
26140
  cancelled5();
26407
26141
  try {
26408
- const before2 = await lstat6(path);
26142
+ const before2 = await lstat3(path);
26409
26143
  if (!before2.isFile() || before2.isSymbolicLink())
26410
26144
  throw new CliError("validation_error", "the retained attachment must be a regular file");
26411
26145
  if (before2.size > maxBytes)
26412
26146
  throw new CliError("validation_error", `the retained attachment exceeds ${maxBytes / 1024 / 1024} MiB; configure MESSAGING_ATTACHMENT_MAX_MIB`);
26413
26147
  if (offsetBytes > before2.size)
26414
26148
  throw new CliError("validation_error", "the byte offset is past the end of this attachment");
26415
- const handle = await open8(path, constants3.O_RDONLY | (constants3.O_NOFOLLOW ?? 0) | (constants3.O_NONBLOCK ?? 0));
26149
+ const handle = await open5(path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0));
26416
26150
  try {
26417
26151
  const opened = await handle.stat();
26418
26152
  if (!opened.isFile() || opened.ino !== before2.ino || opened.dev !== before2.dev || opened.size !== before2.size)
@@ -26494,7 +26228,7 @@ var transferMime = /* @__PURE__ */ __name((head, hint, name = null) => {
26494
26228
  return hint !== null && /^[a-z0-9.+-]+\/[a-z0-9.+-]+$/i.test(hint) ? hint : "application/octet-stream";
26495
26229
  }, "transferMime");
26496
26230
 
26497
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/attachments.js
26231
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/attachments.js
26498
26232
  var ATTACHMENT_QUERY = {
26499
26233
  entity: "attachment",
26500
26234
  backend: "sql",
@@ -26515,7 +26249,7 @@ var ATTACHMENT_QUERY = {
26515
26249
  var PAGE3 = 200;
26516
26250
  var outcome = /* @__PURE__ */ __name(async (file, path, load, signal, noFollow = false, ocr, env = process.env) => {
26517
26251
  const maxBytes = attachmentMaxBytes(env);
26518
- const tooLarge = /* @__PURE__ */ __name(() => ({
26252
+ const tooLarge2 = /* @__PURE__ */ __name(() => ({
26519
26253
  status: "too-large",
26520
26254
  issue: withRecovery({
26521
26255
  code: "validation_error",
@@ -26531,15 +26265,15 @@ var outcome = /* @__PURE__ */ __name(async (file, path, load, signal, noFollow =
26531
26265
  if (known2 === "unsupported")
26532
26266
  return { status: "unsupported" };
26533
26267
  if (size4 > maxBytes)
26534
- return tooLarge();
26535
- const handle = await open9(path, constants4.O_RDONLY | (noFollow ? constants4.O_NOFOLLOW : 0));
26268
+ return tooLarge2();
26269
+ const handle = await open6(path, constants2.O_RDONLY | (noFollow ? constants2.O_NOFOLLOW : 0));
26536
26270
  let bytes2;
26537
26271
  try {
26538
26272
  const opened = await handle.stat();
26539
26273
  if (!opened.isFile())
26540
26274
  return { status: "missing" };
26541
26275
  if (opened.size > maxBytes)
26542
- return tooLarge();
26276
+ return tooLarge2();
26543
26277
  bytes2 = new Uint8Array(await readFile(handle, { signal }));
26544
26278
  } finally {
26545
26279
  await handle.close();
@@ -26875,7 +26609,7 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
26875
26609
  }, "setText")
26876
26610
  }), "attachmentsService");
26877
26611
 
26878
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/chat-documents.js
26612
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/chat-documents.js
26879
26613
  var chatDocumentsService = /* @__PURE__ */ __name((deps) => ({
26880
26614
  list: /* @__PURE__ */ __name(async (chat, { limit, offset, ref }) => {
26881
26615
  const store = await accountStore(deps);
@@ -26905,7 +26639,7 @@ var chatDocumentsService = /* @__PURE__ */ __name((deps) => ({
26905
26639
  }, "list")
26906
26640
  }), "chatDocumentsService");
26907
26641
 
26908
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/retention.js
26642
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/retention.js
26909
26643
  var observationDuration = /* @__PURE__ */ __name((text2, flag) => {
26910
26644
  const match = /^(\d+(?:\.\d+)?)([smhdw])$/.exec(text2);
26911
26645
  const units2 = { s: 1e3, m: 6e4, h: 36e5, d: 864e5, w: 6048e5 };
@@ -26992,7 +26726,7 @@ var isRetentionSelection = /* @__PURE__ */ __name((selection) => {
26992
26726
  }
26993
26727
  }, "isRetentionSelection");
26994
26728
 
26995
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/counters.js
26729
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/counters.js
26996
26730
  var counterFields = /* @__PURE__ */ __name((text2 = "views,reactions,comments") => {
26997
26731
  const fields = text2.split(",").map((one) => one.trim());
26998
26732
  if (!fields.length || fields.some((one) => !COUNTER_FIELDS.includes(one)) || new Set(fields).size !== fields.length)
@@ -27199,7 +26933,7 @@ var countersService = /* @__PURE__ */ __name((deps) => {
27199
26933
  };
27200
26934
  }, "countersService");
27201
26935
 
27202
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/search-refresh.js
26936
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/search-refresh.js
27203
26937
  var SYNC_KEY = "messages.sync-first";
27204
26938
  var SYNC_BOUNDS = { maxChats: 5, timeMs: 3e4, maxMessages: 500 };
27205
26939
  var keyOf2 = /* @__PURE__ */ __name((chat) => JSON.stringify([chat.account.provider, chat.account.account, chat.chatId]), "keyOf");
@@ -27331,7 +27065,7 @@ var withRefresh = /* @__PURE__ */ __name((found, refreshed) => ({
27331
27065
  ...!refreshed || refreshed.complete ? {} : { coverage: { ...found.coverage, state: "stale" } }
27332
27066
  }), "withRefresh");
27333
27067
 
27334
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/embeddings-search.js
27068
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/embeddings-search.js
27335
27069
  var CANDIDATES = 50;
27336
27070
  var WORD_HITS = 200;
27337
27071
  var RRF_K = 60;
@@ -27606,13 +27340,13 @@ var meanOf = /* @__PURE__ */ __name((vectors) => {
27606
27340
  return mean.map((value) => value / length);
27607
27341
  }, "meanOf");
27608
27342
 
27609
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/embeddings.js
27343
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/embeddings.js
27610
27344
  var embeddingsService = /* @__PURE__ */ __name((deps) => ({
27611
27345
  ...embeddingsMaintenance(deps),
27612
27346
  ...embeddingsSearch(deps)
27613
27347
  }), "embeddingsService");
27614
27348
 
27615
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/folders.js
27349
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/folders.js
27616
27350
  var foldersService = /* @__PURE__ */ __name((deps) => {
27617
27351
  const online = /* @__PURE__ */ __name(async (command) => {
27618
27352
  if (deps.offline)
@@ -27741,19 +27475,19 @@ var foldersService = /* @__PURE__ */ __name((deps) => {
27741
27475
  await guardedWrite(deps.guard, { operationId, chatId: null, kind: "account", action: "folder-order" }, () => reorder(folders.map((one) => one.id)));
27742
27476
  return { operationId, folders: folders.map(({ id: id2, title }) => ({ id: id2, title })) };
27743
27477
  }, "order"),
27744
- join: /* @__PURE__ */ __name(async (link5) => {
27745
- if (link5.trim() === "")
27478
+ join: /* @__PURE__ */ __name(async (link4) => {
27479
+ if (link4.trim() === "")
27746
27480
  throw new CliError("validation_error", "give the folder's link");
27747
27481
  const connection = await online("chats folders join");
27748
- const join14 = capability(connection, "joinFolder", "join a shared folder");
27482
+ const join11 = capability(connection, "joinFolder", "join a shared folder");
27749
27483
  const operationId = newOperationId();
27750
- const folder = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "account", action: "folder-join" }, () => join14(link5.trim()));
27484
+ const folder = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "account", action: "folder-join" }, () => join11(link4.trim()));
27751
27485
  return { operationId, folder };
27752
27486
  }, "join")
27753
27487
  };
27754
27488
  }, "foldersService");
27755
27489
 
27756
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/inbox.js
27490
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/inbox.js
27757
27491
  var INBOX_CHATS = 20;
27758
27492
  var REVIEW_DAYS = 3;
27759
27493
  var UNANSWERED_HOURS = 24;
@@ -27906,7 +27640,7 @@ var reviewIn = /* @__PURE__ */ __name(async (adapter, { since, points, chat, kin
27906
27640
  await onReviewed?.(reviewed);
27907
27641
  if (unansweredAfterHours === void 0)
27908
27642
  return reviewed;
27909
- const open10 = [];
27643
+ const open7 = [];
27910
27644
  for (const one of reviewed.chats) {
27911
27645
  const admins = answerers2.get(one.id);
27912
27646
  const questions2 = unanswered(one.messages, {
@@ -27914,10 +27648,10 @@ var reviewIn = /* @__PURE__ */ __name(async (adapter, { since, points, chat, kin
27914
27648
  before: now - unansweredAfterHours * 36e5
27915
27649
  });
27916
27650
  if (questions2.length > 0) {
27917
- open10.push({ ...one, messages: questions2, answeredBy: admins === void 0 ? "owner" : "owner-and-admins" });
27651
+ open7.push({ ...one, messages: questions2, answeredBy: admins === void 0 ? "owner" : "owner-and-admins" });
27918
27652
  }
27919
27653
  }
27920
- return { ...reviewed, chats: open10, unanswered: { olderThanHours: unansweredAfterHours } };
27654
+ return { ...reviewed, chats: open7, unanswered: { olderThanHours: unansweredAfterHours } };
27921
27655
  }, "reviewIn");
27922
27656
  var inboxService = /* @__PURE__ */ __name((deps) => {
27923
27657
  const reader = /* @__PURE__ */ __name(async () => {
@@ -27961,7 +27695,7 @@ var inboxService = /* @__PURE__ */ __name((deps) => {
27961
27695
  };
27962
27696
  }, "inboxService");
27963
27697
 
27964
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/mentions.js
27698
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/mentions.js
27965
27699
  var REVIEW_COUNT = 500;
27966
27700
  var mentionsService = /* @__PURE__ */ __name((deps) => {
27967
27701
  const located = /* @__PURE__ */ __name(async () => {
@@ -28040,7 +27774,7 @@ var mentionsService = /* @__PURE__ */ __name((deps) => {
28040
27774
  };
28041
27775
  }, "mentionsService");
28042
27776
 
28043
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/domain/message-link.js
27777
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/domain/message-link.js
28044
27778
  var messageLinkTarget = /* @__PURE__ */ __name((reference, message, provider) => {
28045
27779
  if (isLocator(reference)) {
28046
27780
  if (message !== void 0)
@@ -28070,24 +27804,24 @@ var validMessageId = /* @__PURE__ */ __name((id2) => {
28070
27804
  }))
28071
27805
  throw new CliError("validation_error", "a message id must be nonempty, at most 256 characters, without spaces or controls");
28072
27806
  }, "validMessageId");
28073
- var validatePermalink = /* @__PURE__ */ __name((link5) => {
28074
- if (link5.url === null) {
28075
- if (link5.access !== "unavailable" || !["unsupported_chat", "unsupported_provider", "offline"].includes(link5.reason))
27807
+ var validatePermalink = /* @__PURE__ */ __name((link4) => {
27808
+ if (link4.url === null) {
27809
+ if (link4.access !== "unavailable" || !["unsupported_chat", "unsupported_provider", "offline"].includes(link4.reason))
28076
27810
  throw new CliError("validation_error", "the messenger returned invalid permalink metadata");
28077
- return { url: link5.url, access: link5.access, reason: link5.reason };
27811
+ return { url: link4.url, access: link4.access, reason: link4.reason };
28078
27812
  }
28079
27813
  let url;
28080
27814
  try {
28081
- url = new URL(link5.url);
27815
+ url = new URL(link4.url);
28082
27816
  } catch {
28083
27817
  throw new CliError("validation_error", "the messenger returned an invalid permalink");
28084
27818
  }
28085
- if (url.protocol !== "https:" || url.username || url.password || /\s/u.test(link5.url) || link5.reason !== null || !["public", "restricted", "unknown"].includes(link5.access))
27819
+ if (url.protocol !== "https:" || url.username || url.password || /\s/u.test(link4.url) || link4.reason !== null || !["public", "restricted", "unknown"].includes(link4.access))
28086
27820
  throw new CliError("validation_error", "the messenger returned an invalid permalink");
28087
- return { url: link5.url, access: link5.access, reason: link5.reason };
27821
+ return { url: link4.url, access: link4.access, reason: link4.reason };
28088
27822
  }, "validatePermalink");
28089
27823
 
28090
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/domain/pin-duration.js
27824
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/domain/pin-duration.js
28091
27825
  var spokenSeconds = /* @__PURE__ */ __name((seconds) => {
28092
27826
  if (seconds % 86400 === 0 && seconds > 86400)
28093
27827
  return `${seconds / 86400}d`;
@@ -28119,7 +27853,7 @@ var pinDurationOf = /* @__PURE__ */ __name((value, allowed, flag = "--expire-tim
28119
27853
  return seconds;
28120
27854
  }, "pinDurationOf");
28121
27855
 
28122
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/sends/send-as.js
27856
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/sends/send-as.js
28123
27857
  var sendAsCheck = /* @__PURE__ */ __name((connection, sendAs) => {
28124
27858
  if (sendAs === void 0) {
28125
27859
  const saved = connection.savedSender?.bind(connection);
@@ -28144,7 +27878,18 @@ var typedSendAs = /* @__PURE__ */ __name((typed) => {
28144
27878
  return sendAs;
28145
27879
  }, "typedSendAs");
28146
27880
 
28147
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/search/question-plan.js
27881
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/search/total.js
27882
+ var TOTAL_CAP = 1e4;
27883
+ var totalOf = /* @__PURE__ */ __name((count3, shown, hasMore, exact = true) => {
27884
+ const least = shown + (hasMore ? 1 : 0);
27885
+ if (count3 === void 0 || count3 < least)
27886
+ return { value: least, relation: "gte" };
27887
+ if (count3 > TOTAL_CAP)
27888
+ return { value: TOTAL_CAP, relation: "gte" };
27889
+ return { value: count3, relation: exact ? "eq" : "gte" };
27890
+ }, "totalOf");
27891
+
27892
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/search/question-plan.js
28148
27893
  var words = /* @__PURE__ */ __name((text2) => normalize(text2).match(/[\p{L}\p{N}]+/gu) ?? [], "words");
28149
27894
  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"));
28150
27895
  var questionWord = /\b(?:what|which|how|who|where|when|can|could|should)\b|(?:^|\s)(?:сколько|какой|какая|какие|какое|кто|кому|кем|где|когда|как|что|можно|может|могут|ли)(?:\s|$)/iu;
@@ -28260,7 +28005,7 @@ function planQuestion(text2, strict = false) {
28260
28005
  }
28261
28006
  __name(planQuestion, "planQuestion");
28262
28007
 
28263
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/messages-combined.js
28008
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/messages-combined.js
28264
28009
  var COMBINED_DEFAULTS = { candidateDepth: 300, rrfK: 60, rerank: "all", chatCap: 0 };
28265
28010
  var tokensOf = /* @__PURE__ */ __name((text2) => normalize(text2).match(/[\p{L}\p{N}\p{Co}\p{M}]+/gu) ?? [], "tokensOf");
28266
28011
  var searchCombined = /* @__PURE__ */ __name(async (store, account2, request, messenger = {}, options = COMBINED_DEFAULTS) => {
@@ -28453,15 +28198,23 @@ var signals = /* @__PURE__ */ __name((hit, terms, corrections, execution, mode,
28453
28198
  return mode === "coverage" ? coverage * 4 : mode === "proximity" ? proximity : mode === "phrase" ? phrase : coverage * 4 + proximity + phrase;
28454
28199
  }, "signals");
28455
28200
 
28456
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/messages-discovery.js
28201
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/messages-discovery.js
28457
28202
  var MEANING_DEPTH = 100;
28458
28203
  var RRF_K2 = 60;
28459
28204
  var RERANK_DEPTH = 50;
28460
28205
  var RERANK_WEIGHT = 0.7;
28461
28206
  var RERANK_CHUNK = 5;
28462
28207
  var RERANK_MILLISECONDS = 15e3;
28208
+ var FOLLOW_UP_HITS = 5;
28209
+ var FOLLOW_UPS_PER_HIT = 2;
28210
+ var RARE_AT = 3;
28211
+ var FOLLOW_UP_CANDIDATES = 20;
28212
+ var discoveryRequest = /* @__PURE__ */ __name((asked) => asked.ast !== void 0 || asked.exact || !asked.text ? asked : {
28213
+ ...asked,
28214
+ text: asked.text.replace(new RegExp("(?<=\\p{L})\\?(?=\\s|$)", "gu"), "").replace(/"(?:[^"\\]|\\.)*"|(?<=\d):(?=\d)/gu, (found) => found === ":" ? " " : found)
28215
+ }, "discoveryRequest");
28463
28216
  var searchDiscovery = /* @__PURE__ */ __name(async (store, account2, asked, messenger = {}, meaning, rerank) => {
28464
- const request = asked.ast !== void 0 || asked.exact || !asked.text ? asked : { ...asked, text: asked.text.replace(new RegExp("(?<=\\p{L})\\?(?=\\s|$)", "gu"), "") };
28217
+ const request = discoveryRequest(asked);
28465
28218
  const original = await prepareLucene(store, account2, request, messenger);
28466
28219
  const text2 = request.text ?? "";
28467
28220
  const plan = planQuestion(text2, request.ast !== void 0 || !!request.exact || !!request.newest);
@@ -28628,7 +28381,10 @@ var searchDiscovery = /* @__PURE__ */ __name(async (store, account2, asked, mess
28628
28381
  started += performance.now() - opening;
28629
28382
  }
28630
28383
  check();
28631
- const items = await Promise.all(candidates.slice(0, request.limit).map(async ({ fused: _fused, ...m }) => {
28384
+ const followUps = await followUpsOf(store, account2, request, messenger, candidates, plan.scope);
28385
+ const items = await Promise.all(candidates.slice(0, request.limit).map(async ({ fused: _fused, ...hit }) => {
28386
+ const later = followUps.get(hit.locator);
28387
+ const m = later?.length ? { ...hit, followUps: later } : hit;
28632
28388
  if (!request.context)
28633
28389
  return m;
28634
28390
  check();
@@ -28655,6 +28411,7 @@ var searchDiscovery = /* @__PURE__ */ __name(async (store, account2, asked, mess
28655
28411
  candidateDepth: 300,
28656
28412
  candidates: candidates.length,
28657
28413
  repliesAdded: replyCount,
28414
+ followUps: [...followUps.values()].reduce((sum2, later) => sum2 + later.length, 0),
28658
28415
  truncated,
28659
28416
  terms,
28660
28417
  queries: [...plan.changed ? [] : plan.queries, relaxed],
@@ -28667,6 +28424,30 @@ var searchDiscovery = /* @__PURE__ */ __name(async (store, account2, asked, mess
28667
28424
  ...lane && "partly" in lane && lane.partly ? { meaningSkipped: lane.partly } : {}
28668
28425
  };
28669
28426
  }, "searchDiscovery");
28427
+ var followUpsOf = /* @__PURE__ */ __name(async (store, account2, request, messenger, candidates, scope) => {
28428
+ const head = candidates.slice(0, Math.min(FOLLOW_UP_HITS, request.limit));
28429
+ 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 });
28430
+ const only = [...new Map(later.flat().map((m) => [m.locator, m])).values()].map((m) => ({
28431
+ ...accountOfHit(m),
28432
+ chatId: m.chatId,
28433
+ id: m.id
28434
+ }));
28435
+ const out = /* @__PURE__ */ new Map();
28436
+ if (!only.length)
28437
+ return out;
28438
+ const eligible = await searchLucene(store, account2, { ...request, text: scope || void 0, ast: void 0, limit: only.length, only, context: 0, thread: void 0 }, messenger);
28439
+ const allowed = new Map(eligible.items.map((m) => [m.locator, m]));
28440
+ const shown = /* @__PURE__ */ new Set();
28441
+ head.forEach((hit, i) => {
28442
+ shown.add(hit.locator);
28443
+ const picked = (later[i] ?? []).flatMap((m) => allowed.get(m.locator) ?? []).slice(0, FOLLOW_UPS_PER_HIT).filter((m) => !shown.has(m.locator));
28444
+ for (const m of picked)
28445
+ shown.add(m.locator);
28446
+ if (picked.length)
28447
+ out.set(hit.locator, picked);
28448
+ });
28449
+ return out;
28450
+ }, "followUpsOf");
28670
28451
  var nearEligible = /* @__PURE__ */ __name(async (store, account2, request, messenger, ranked, scope) => {
28671
28452
  const keyOf5 = /* @__PURE__ */ __name((one) => JSON.stringify([one.provider, one.account, one.chatId, one.id]), "keyOf");
28672
28453
  const only = ranked.slice(0, MEANING_DEPTH).filter((m) => !request.only || request.only.some((key) => keyOf5(key) === keyOf5(m))).map(({ provider, account: account3, chatId, id: id2 }) => ({ provider, account: account3, chatId, id: id2 }));
@@ -28722,7 +28503,7 @@ var mixedWithReranker = /* @__PURE__ */ __name((head, scores) => {
28722
28503
  })).sort((a, b) => b.mixed - a.mixed).map(({ hit }) => hit);
28723
28504
  }, "mixedWithReranker");
28724
28505
 
28725
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/thread-context.js
28506
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/thread-context.js
28726
28507
  var THREAD_BOUNDS = { maxHops: 8, maxMessages: 50, maxBytes: 65536, withinMs: 864e5 };
28727
28508
  var bytes = /* @__PURE__ */ __name((items, links) => Buffer.byteLength(JSON.stringify({ items, links }), "utf8"), "bytes");
28728
28509
  var threadBounds = /* @__PURE__ */ __name((options = {}) => {
@@ -28822,14 +28603,14 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account2, chat, mes
28822
28603
  const rows = await store.conversations.links(account2, chat, id2, { limit: bounds.maxMessages + 1 });
28823
28604
  if (rows.length > bounds.maxMessages)
28824
28605
  stopped("links");
28825
- cache.set(id2, rows.slice(0, bounds.maxMessages).map((link5) => ({
28826
- ...link5,
28827
- stale: link5.stale || link5.source !== "agent" && state.algorithmVersion !== RULES_VERSION
28606
+ cache.set(id2, rows.slice(0, bounds.maxMessages).map((link4) => ({
28607
+ ...link4,
28608
+ stale: link4.stale || link4.source !== "agent" && state.algorithmVersion !== RULES_VERSION
28828
28609
  })));
28829
28610
  }
28830
28611
  return cache.get(id2);
28831
28612
  }, "linksOf");
28832
- const chosen = /* @__PURE__ */ __name((links) => links.find((link5) => !link5.stale), "chosen");
28613
+ const chosen = /* @__PURE__ */ __name((links) => links.find((link4) => !link4.stale), "chosen");
28833
28614
  const queue = [{ id: message, hops: 0 }];
28834
28615
  const queued = /* @__PURE__ */ new Set([message]);
28835
28616
  const parents = /* @__PURE__ */ new Map();
@@ -28860,8 +28641,8 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account2, chat, mes
28860
28641
  const displayed2 = node.id === message ? { ...body, anchor: true } : body;
28861
28642
  const own = await linksOf(node.id);
28862
28643
  const parent = chosen(own);
28863
- 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));
28864
- result.stale ||= evidence.some((link5) => link5.stale);
28644
+ 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));
28645
+ result.stale ||= evidence.some((link4) => link4.stale);
28865
28646
  if (bytes([...result.items, displayed2], [...result.links, ...evidence]) > bounds.maxBytes) {
28866
28647
  stopped("bytes");
28867
28648
  break;
@@ -28897,9 +28678,9 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account2, chat, mes
28897
28678
  const childLinks = await linksOf(child.messageId);
28898
28679
  if (chosen(childLinks)?.parentId === node.id)
28899
28680
  add(child.messageId);
28900
- else if (childLinks.some((link5) => link5.stale && link5.parentId === node.id)) {
28681
+ else if (childLinks.some((link4) => link4.stale && link4.parentId === node.id)) {
28901
28682
  result.stale = true;
28902
- 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));
28683
+ 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));
28903
28684
  if (bytes(result.items, [...result.links, ...stale]) <= bounds.maxBytes)
28904
28685
  result.links.push(...stale);
28905
28686
  else
@@ -28921,7 +28702,7 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account2, chat, mes
28921
28702
  return result;
28922
28703
  }, "readThreadContext");
28923
28704
 
28924
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/messages-archive-search.js
28705
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/messages-archive-search.js
28925
28706
  var SEARCH_FILL_MS = 200;
28926
28707
  var statsStore = /* @__PURE__ */ __name(async (store, account2, request, messenger = {}) => {
28927
28708
  const stop = Date.now() + SEARCH_FILL_MS;
@@ -28956,8 +28737,15 @@ var searchStore = /* @__PURE__ */ __name(async (store, account2, request, messen
28956
28737
  if (!Number.isInteger(offset) || offset < 0 || offset > MAX_SEARCH_OFFSET)
28957
28738
  throw new CliError("validation_error", `offset takes a whole number from 0 to ${MAX_SEARCH_OFFSET}`);
28958
28739
  const found = await searchPage(store, account2, { ...request, limit: request.limit + offset }, messenger, meaning, rerank);
28740
+ const discovery = found.query?.discovery;
28741
+ const total = discovery ? totalOf(discovery.candidates, found.items.length, found.hasMore, !discovery.truncated) : totalOf(await countLucene(store, account2, { ...request.discover ? discoveryRequest(request) : request, limit: request.limit + offset }, messenger, TOTAL_CAP).catch((error) => {
28742
+ if (isCliError(error) && error.details.reason === "query.too-large")
28743
+ return void 0;
28744
+ throw error;
28745
+ }), found.items.length, found.hasMore);
28959
28746
  return {
28960
28747
  ...found,
28748
+ total,
28961
28749
  items: found.items.slice(offset),
28962
28750
  ...found.hasMore && offset + request.limit <= MAX_SEARCH_OFFSET ? { nextOffset: offset + request.limit } : {}
28963
28751
  };
@@ -28981,12 +28769,12 @@ var accountOf2 = /* @__PURE__ */ __name((hit) => {
28981
28769
  }, "accountOf");
28982
28770
  var keyOf3 = /* @__PURE__ */ __name(({ provider, account: account2 }) => `${provider}/${account2}`, "keyOf");
28983
28771
 
28984
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/pictures.js
28772
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/pictures.js
28985
28773
  import { createHash as createHash9 } from "node:crypto";
28986
28774
  import { readFile as readFile2, stat as stat3 } from "node:fs/promises";
28987
28775
  import { setTimeout as sleep4 } from "node:timers/promises";
28988
28776
 
28989
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/domain/models.js
28777
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/domain/models.js
28990
28778
  var GROUP_SETTINGS = [
28991
28779
  "allCanPin",
28992
28780
  "onlyAdminsAdd",
@@ -29000,10 +28788,10 @@ var ADMIN_RIGHTS = ["read", "members", "admins", "info", "pin", "link", "post",
29000
28788
  var senderIsMe = /* @__PURE__ */ __name((message, account2) => message.outgoing === true || message.senderId !== null && String(message.senderId) === account2, "senderIsMe");
29001
28789
  var MEDIA_KINDS = ["photo", "video", "file", "audio", "link"];
29002
28790
 
29003
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/file-download.js
28791
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/file-download.js
29004
28792
  import { createWriteStream, mkdirSync } from "node:fs";
29005
- import { link as link4, rm } from "node:fs/promises";
29006
- import { basename as basename8, join as join13, resolve as resolve6 } from "node:path";
28793
+ import { link as link3, rm } from "node:fs/promises";
28794
+ import { basename as basename6, join as join10, resolve as resolve6 } from "node:path";
29007
28795
  import { Readable, Transform } from "node:stream";
29008
28796
  import { pipeline } from "node:stream/promises";
29009
28797
  var refreshedFiles = /* @__PURE__ */ __name((files) => files.flatMap(({ kind, name, position, providerRef }) => providerRef === void 0 || Object.keys(providerRef).length === 0 ? [] : [
@@ -29078,7 +28866,7 @@ var EXTENSIONS = {
29078
28866
  };
29079
28867
  var BY_KIND = { photo: "jpg" };
29080
28868
  var safeName2 = /* @__PURE__ */ __name((name, platform = process.platform) => {
29081
- let plain2 = name === void 0 ? "" : basename8(name.replaceAll("\\", "/")).replace(/[\p{Cc}​-‏‪-‮⁦-⁩]/gu, "").replace(/^\.+/, "");
28869
+ let plain2 = name === void 0 ? "" : basename6(name.replaceAll("\\", "/")).replace(/[\p{Cc}​-‏‪-‮⁦-⁩]/gu, "").replace(/^\.+/, "");
29082
28870
  if (platform === "win32") {
29083
28871
  plain2 = plain2.replace(/[<>:"|?*]/g, "_").replace(/[. ]+$/, "");
29084
28872
  if (/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(plain2))
@@ -29092,7 +28880,7 @@ var save = /* @__PURE__ */ __name(async (file, directory2, fallbackName, { uniqu
29092
28880
  const extension = EXTENSIONS[file.mime ?? ""] ?? BY_KIND[file.kind];
29093
28881
  return own ?? (extension ? `${fallbackName}.${extension}` : fallbackName);
29094
28882
  }, "fileName");
29095
- const partial = join13(directory2, `.${fileName()}.${process.pid}.part`);
28883
+ const partial = join10(directory2, `.${fileName()}.${process.pid}.part`);
29096
28884
  let bytes2 = 0;
29097
28885
  const counting = new Transform({
29098
28886
  transform(chunk, _encoding, done2) {
@@ -29105,8 +28893,8 @@ var save = /* @__PURE__ */ __name(async (file, directory2, fallbackName, { uniqu
29105
28893
  const name = fileName();
29106
28894
  const names2 = unique && own ? [name, `${fallbackName}-${own}`] : [name];
29107
28895
  for (const candidate of names2) {
29108
- const path2 = resolve6(join13(directory2, candidate));
29109
- const taken = await link4(partial, path2).then(() => false, (error) => {
28896
+ const path2 = resolve6(join10(directory2, candidate));
28897
+ const taken = await link3(partial, path2).then(() => false, (error) => {
29110
28898
  if (error.code === "EEXIST")
29111
28899
  return true;
29112
28900
  throw error;
@@ -29114,7 +28902,7 @@ var save = /* @__PURE__ */ __name(async (file, directory2, fallbackName, { uniqu
29114
28902
  if (!taken)
29115
28903
  return { kind: file.kind, path: path2, bytes: bytes2 };
29116
28904
  }
29117
- const path = resolve6(join13(directory2, names2.at(-1) ?? name));
28905
+ const path = resolve6(join10(directory2, names2.at(-1) ?? name));
29118
28906
  if (unique)
29119
28907
  return { kind: file.kind, path, bytes: bytes2, existing: true };
29120
28908
  throw new CliError("validation_error", `${path} already exists \u2014 nothing was overwritten; choose --output-dir`);
@@ -29123,7 +28911,7 @@ var save = /* @__PURE__ */ __name(async (file, directory2, fallbackName, { uniqu
29123
28911
  }
29124
28912
  }, "save");
29125
28913
 
29126
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/pictures.js
28914
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/pictures.js
29127
28915
  var PICTURE_MAX_BYTES = 25 * 1024 * 1024;
29128
28916
  var PICTURE_FLOOR = 0.25;
29129
28917
  var PAGE4 = 50;
@@ -29133,18 +28921,18 @@ var missingModel = /* @__PURE__ */ __name((id2) => `the picture model is not dow
29133
28921
  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");
29134
28922
  var picturesService = /* @__PURE__ */ __name((deps) => {
29135
28923
  let opened;
29136
- const open10 = /* @__PURE__ */ __name(async () => {
28924
+ const open7 = /* @__PURE__ */ __name(async () => {
29137
28925
  if (deps.pictureEmbedder)
29138
28926
  return deps.pictureEmbedder();
29139
28927
  const model2 = imageModel(DEFAULT_IMAGE_MODEL);
29140
28928
  const directory2 = imageModelsDirectory(deps.env);
29141
28929
  if (!isImageModelInstalled(model2, directory2))
29142
28930
  throw new CliError("not_found", missingModel(model2.id), { reason: "model.not-downloaded", model: model2.id });
29143
- const { openPictureEmbedder } = await import("./embedder-HTRPWR6T.js");
28931
+ const { openPictureEmbedder } = await import("./embedder-ZAYCL22W.js");
29144
28932
  return openPictureEmbedder(model2, directory2);
29145
28933
  }, "open");
29146
28934
  const embedder = /* @__PURE__ */ __name(() => {
29147
- opened ??= open10().catch((error) => {
28935
+ opened ??= open7().catch((error) => {
29148
28936
  opened = void 0;
29149
28937
  throw error;
29150
28938
  });
@@ -29337,7 +29125,7 @@ var withPictures = /* @__PURE__ */ __name((messages, pictures) => ({
29337
29125
  }, "search")
29338
29126
  }), "withPictures");
29339
29127
 
29340
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/messages-meaning.js
29128
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/messages-meaning.js
29341
29129
  var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, shared) => {
29342
29130
  const target2 = embeddingTarget(deps, DEFAULT_TEXT_MODEL);
29343
29131
  const skipped = /* @__PURE__ */ __name((reason, step) => ({
@@ -29385,7 +29173,7 @@ var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, sh
29385
29173
  }
29386
29174
  }, "meaningLane");
29387
29175
 
29388
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/messages-rerank.js
29176
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/messages-rerank.js
29389
29177
  var rerankLane = /* @__PURE__ */ __name((deps) => {
29390
29178
  const choice = deps.reranker ?? DEFAULT_RERANK_MODEL;
29391
29179
  if (choice === "off")
@@ -29397,9 +29185,9 @@ var rerankLane = /* @__PURE__ */ __name((deps) => {
29397
29185
  return { skipped: { reason: `${model.id} is not downloaded`, step: "models.download", model: model.id } };
29398
29186
  try {
29399
29187
  const warm = deps.embedders;
29400
- const reranker = warm ? await warm.reranker(`rerank:${model.id}`, async () => (await import("./process-IX5YWGDP.js")).openRerankerProcess(model, directory2, {
29188
+ const reranker = warm ? await warm.reranker(`rerank:${model.id}`, async () => (await import("./process-A45QXKID.js")).openRerankerProcess(model, directory2, {
29401
29189
  threads: defaultThreads()
29402
- })) : await (await import("./rerank-YSXWCAGZ.js")).openReranker(model, directory2);
29190
+ })) : await (await import("./rerank-7E6GQ5Y6.js")).openReranker(model, directory2);
29403
29191
  return {
29404
29192
  model: model.id,
29405
29193
  score: /* @__PURE__ */ __name((question, passages) => reranker.score(plainWords(question), passages), "score"),
@@ -29419,7 +29207,7 @@ var rerankLane = /* @__PURE__ */ __name((deps) => {
29419
29207
  };
29420
29208
  }, "rerankLane");
29421
29209
 
29422
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/document-pictures.js
29210
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/document-pictures.js
29423
29211
  import { createHash as createHash10 } from "node:crypto";
29424
29212
  var refOf = /* @__PURE__ */ __name((target2) => target2.ref ?? `document:${target2.documentId}`, "refOf");
29425
29213
  var openPictureEmbedderFor = /* @__PURE__ */ __name(async ({ env, command } = {}) => {
@@ -29427,7 +29215,7 @@ var openPictureEmbedderFor = /* @__PURE__ */ __name(async ({ env, command } = {}
29427
29215
  const directory2 = imageModelsDirectory(env);
29428
29216
  if (!isImageModelInstalled(model, directory2))
29429
29217
  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 });
29430
- const { openPictureEmbedder } = await import("./embedder-HTRPWR6T.js");
29218
+ const { openPictureEmbedder } = await import("./embedder-ZAYCL22W.js");
29431
29219
  return openPictureEmbedder(model, directory2);
29432
29220
  }, "openPictureEmbedderFor");
29433
29221
  var savePicture = /* @__PURE__ */ __name(async (store, target2, bytes2, options = {}) => {
@@ -29448,24 +29236,22 @@ var savePicture = /* @__PURE__ */ __name(async (store, target2, bytes2, options
29448
29236
  }, "savePicture");
29449
29237
  var removePicture = /* @__PURE__ */ __name((store, target2) => store.notes.removePicture(refOf(target2)), "removePicture");
29450
29238
 
29451
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/document-source.js
29239
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/document-source.js
29452
29240
  var documentSource = /* @__PURE__ */ __name((note, accounts, profiles, file) => {
29453
29241
  const metadata = note.frontMatter;
29454
29242
  const account2 = accounts.find(({ id: id2 }) => String(id2) === note.folderId);
29455
29243
  const remote = note.source === "file" && (account2 !== void 0 && kindIn(account2.provider) === "documents" || metadata?.source === "google-drive");
29456
29244
  const profile = remote && account2 ? Object.entries(profiles).flatMap(([command, named2]) => Object.entries(named2).map(([name, key]) => ({ command, name, key }))).find(({ key }) => key.provider === account2.provider && key.account === account2.account || isFolderProvider(key.provider) && key.account === account2.name) : void 0;
29457
29245
  const url = file?.url ?? (remote && typeof metadata?.sourceUrl === "string" ? metadata.sourceUrl : void 0);
29458
- const modified = file?.externalUpdatedAt ?? (remote && typeof metadata?.modifiedAt === "string" && Number.isFinite(Date.parse(metadata.modifiedAt)) ? metadata.modifiedAt : void 0);
29459
29246
  return {
29460
29247
  kind: remote ? "document" : "note",
29461
29248
  provider: profile ? profile.command : "notes",
29462
29249
  account: profile?.name ?? note.folderId ?? "internal",
29463
- ...remote && url !== void 0 ? { url } : {},
29464
- updated_at: remote && modified !== void 0 ? modified : note.updatedAt
29250
+ ...remote && url !== void 0 ? { url } : {}
29465
29251
  };
29466
29252
  }, "documentSource");
29467
29253
 
29468
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/notes-title-tier.js
29254
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/notes-title-tier.js
29469
29255
  var plainQueryWords = /* @__PURE__ */ __name((query) => {
29470
29256
  let root;
29471
29257
  try {
@@ -29492,9 +29278,11 @@ var titleTiers = /* @__PURE__ */ __name((hits, words2) => {
29492
29278
  return [...hits].sort((a, b) => rank(a) - rank(b));
29493
29279
  }, "titleTiers");
29494
29280
 
29495
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/notes-search.js
29496
- var storeQuery = /* @__PURE__ */ __name(async (store, text2, { exact, timezone } = {}) => {
29497
- const ast = validateFields(parseLucene(text2, { ...SEARCH_QUERY, defaultField: exact ? "exact" : "text" }));
29281
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/notes-search.js
29282
+ var storeQuery = /* @__PURE__ */ __name(async (store, text2, { exact, timezone } = {}) => resolvedQuery(store, parsedQuery(text2, exact), timezone), "storeQuery");
29283
+ var parsedQuery = /* @__PURE__ */ __name((text2, exact) => validateFields(parseLucene(text2, { ...SEARCH_QUERY, defaultField: exact ? "exact" : "text" })).root, "parsedQuery");
29284
+ var resolvedQuery = /* @__PURE__ */ __name(async (store, root, timezone) => {
29285
+ const ast = { root };
29498
29286
  const zone = timezoneOf(timezone);
29499
29287
  const resolve7 = /* @__PURE__ */ __name((node) => {
29500
29288
  if (node.kind === "boolean")
@@ -29515,7 +29303,7 @@ var storeQuery = /* @__PURE__ */ __name(async (store, text2, { exact, timezone }
29515
29303
  root: resolve7(ast.root),
29516
29304
  ...hasStems(ast.root) ? { stemmer: createStemmer(stemmers2 ?? DEFAULT_STEMMERS) } : {}
29517
29305
  };
29518
- }, "storeQuery");
29306
+ }, "resolvedQuery");
29519
29307
  var searchNotesQuery = /* @__PURE__ */ __name(async (store, request) => {
29520
29308
  if (!request.text.trim())
29521
29309
  throw new CliError("validation_error", "say what to find in the notes");
@@ -29580,7 +29368,17 @@ var embedChunks = /* @__PURE__ */ __name(async (store, source, { model: choice,
29580
29368
  var embedNotes = /* @__PURE__ */ __name((store, options = {}) => embedChunks(store, store.notes, options), "embedNotes");
29581
29369
  var embedEvents = /* @__PURE__ */ __name((store, options = {}) => embedChunks(store, store.calendar, options), "embedEvents");
29582
29370
  var embedMail = /* @__PURE__ */ __name((store, options = {}) => embedChunks(store, store.mail, options), "embedMail");
29583
- var nearestNotes = /* @__PURE__ */ __name(async (store, query, { model: choice, limit, folderIds, withInternal, source, env, threads, command, embedders }) => {
29371
+ var nearestNotes = /* @__PURE__ */ __name(async (store, query, options) => {
29372
+ const { key, vector, floor } = await queryVector(store, query, options);
29373
+ const nearest = await store.notes.nearest(key, vector, {
29374
+ limit: options.limit,
29375
+ ...options.folderIds ? { folderIds: options.folderIds } : {},
29376
+ ...options.withInternal ? { withInternal: true } : {},
29377
+ ...options.source ? { source: options.source } : {}
29378
+ });
29379
+ return nearest.filter(({ score }) => score > floor);
29380
+ }, "nearestNotes");
29381
+ var queryVector = /* @__PURE__ */ __name(async (store, query, { model: choice, folderIds, withInternal, source, env, threads, command, embedders }) => {
29584
29382
  if (!query.trim())
29585
29383
  throw new CliError("validation_error", "say what to find in the notes");
29586
29384
  const { model, directory: directory2, key } = localModel(choice, env, command);
@@ -29592,19 +29390,15 @@ var nearestNotes = /* @__PURE__ */ __name(async (store, query, { model: choice,
29592
29390
  if (!await store.notes.embedded(key, scope))
29593
29391
  throw new CliError("not_found", `nothing searched here has vectors of ${model.id} yet, so only words were matched`);
29594
29392
  const [vector] = await withLocal(model, directory2, threads, (embedder) => embedder.embed([query], "query"), embedders);
29595
- const floor = meaningFloor(key);
29596
- const nearest = await store.notes.nearest(key, vector, {
29597
- limit,
29598
- ...folderIds ? { folderIds } : {},
29599
- ...withInternal ? { withInternal: true } : {},
29600
- ...source ? { source } : {}
29601
- });
29602
- return nearest.filter(({ score }) => score > floor);
29603
- }, "nearestNotes");
29393
+ return { key, vector, floor: meaningFloor(key) };
29394
+ }, "queryVector");
29395
+ var nearestAmong = /* @__PURE__ */ __name(async (store, query, refs, options) => {
29396
+ const { key, vector, floor } = await queryVector(store, query, options);
29397
+ return (await store.notes.scoreNotes(key, vector, refs)).filter(({ score }) => score > floor);
29398
+ }, "nearestAmong");
29604
29399
  var MAX_LINE = 200;
29605
29400
  var MAX_NOTES_OFFSET = 1e3;
29606
29401
  var CANDIDATES2 = 50;
29607
- var FILTERED = 500;
29608
29402
  var RRF_K3 = 60;
29609
29403
  var firstLine = /* @__PURE__ */ __name((text2, query) => {
29610
29404
  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));
@@ -29662,12 +29456,108 @@ var noteSourceOfQuery = /* @__PURE__ */ __name((query) => {
29662
29456
  }
29663
29457
  return { source, rest };
29664
29458
  }, "noteSourceOfQuery");
29459
+ var WORD_FIELDS = /* @__PURE__ */ new Set(["text", "exact"]);
29460
+ var fieldsOfQuery = /* @__PURE__ */ __name((root) => {
29461
+ let narrows = false;
29462
+ const kept = /* @__PURE__ */ __name((node) => {
29463
+ if (node.kind === "boolean")
29464
+ return {
29465
+ ...node,
29466
+ clauses: node.clauses.map(({ occur, node: node2 }) => {
29467
+ if (occur !== "must_not")
29468
+ return { occur, node: kept(node2) };
29469
+ narrows = true;
29470
+ return { occur, node: node2 };
29471
+ })
29472
+ };
29473
+ if (!WORD_FIELDS.has(node.field)) {
29474
+ narrows = true;
29475
+ return node;
29476
+ }
29477
+ return { kind: "predicate", field: "in", operator: "term", value: "notes", span: node.span };
29478
+ }, "kept");
29479
+ const fields = kept(root);
29480
+ return narrows ? fields : void 0;
29481
+ }, "fieldsOfQuery");
29482
+ var meaningWords = /* @__PURE__ */ __name((root) => {
29483
+ 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");
29484
+ return wanted(root).join(" ").trim();
29485
+ }, "meaningWords");
29486
+ var allOf = /* @__PURE__ */ __name((nodes) => nodes.length <= 1 ? nodes[0] : {
29487
+ kind: "boolean",
29488
+ clauses: nodes.map((node) => ({ occur: "must", node })),
29489
+ span: { start: 0, end: 0 }
29490
+ }, "allOf");
29491
+ var matching = /* @__PURE__ */ __name(async (store, refs, root, scope) => {
29492
+ if (refs.length === 0)
29493
+ return /* @__PURE__ */ new Map();
29494
+ const resolved = await resolvedQuery(store, root ?? { kind: "predicate", field: "in", operator: "term", value: "notes", span: { start: 0, end: 0 } }, scope.timezone);
29495
+ const found = await store.notes.search({
29496
+ root: resolved.root,
29497
+ refs,
29498
+ limit: refs.length,
29499
+ ...scope.folderIds ? { folderIds: scope.folderIds } : {},
29500
+ ...scope.withInternal ? { withInternal: true } : {},
29501
+ ...scope.source ? { source: scope.source } : {},
29502
+ ...resolved.stemmer ? { stemmer: resolved.stemmer } : {}
29503
+ });
29504
+ return new Map(found.items.map(({ ref, note, at }) => [ref, { note, at }]));
29505
+ }, "matching");
29506
+ var RANK_WITHIN = 2e3;
29507
+ var filterRefs = /* @__PURE__ */ __name(async (store, narrowing, scope) => {
29508
+ const resolved = await resolvedQuery(store, narrowing, scope.timezone);
29509
+ try {
29510
+ const found = await store.notes.matchingRefs({
29511
+ root: resolved.root,
29512
+ limit: RANK_WITHIN,
29513
+ ...scope.folderIds ? { folderIds: scope.folderIds } : {},
29514
+ ...scope.withInternal ? { withInternal: true } : {},
29515
+ ...scope.source ? { source: scope.source } : {},
29516
+ ...resolved.stemmer ? { stemmer: resolved.stemmer } : {}
29517
+ });
29518
+ return found.hasMore ? void 0 : found.refs;
29519
+ } catch (error) {
29520
+ if (tooLarge(error))
29521
+ return void 0;
29522
+ throw error;
29523
+ }
29524
+ }, "filterRefs");
29525
+ var tooLarge = /* @__PURE__ */ __name((error) => isCliError(error) && error.details.reason === "query.too-large", "tooLarge");
29526
+ var notesTotal = /* @__PURE__ */ __name(async (store, text2, { exact, scope, shown, hasMore }, others, othersComplete) => {
29527
+ let words2;
29528
+ try {
29529
+ const { root, stemmer } = await storeQuery(store, text2, {
29530
+ exact,
29531
+ ...scope.timezone ? { timezone: scope.timezone } : {}
29532
+ });
29533
+ words2 = await store.notes.matchingRefs({
29534
+ root,
29535
+ limit: TOTAL_CAP,
29536
+ ...scope.folderIds ? { folderIds: scope.folderIds } : {},
29537
+ ...scope.withInternal ? { withInternal: true } : {},
29538
+ ...scope.source ? { source: scope.source } : {},
29539
+ ...stemmer ? { stemmer } : {}
29540
+ });
29541
+ } catch (error) {
29542
+ if (tooLarge(error))
29543
+ return totalOf(void 0, shown, hasMore);
29544
+ throw error;
29545
+ }
29546
+ const count3 = (/* @__PURE__ */ new Set([...words2.refs, ...others])).size + (words2.hasMore ? 1 : 0);
29547
+ return totalOf(count3, shown, hasMore, othersComplete);
29548
+ }, "notesTotal");
29665
29549
  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 } = {}) => {
29666
29550
  const typed = noteSourceOfQuery(query);
29667
29551
  const source = given ?? typed.source;
29668
- const words2 = typed.source !== void 0 && typed.source === source ? typed.rest : query;
29552
+ const rest = typed.source !== void 0 && typed.source === source ? typed.rest : query;
29669
29553
  const label = tag === void 0 ? void 0 : normalizeTag(tag);
29670
29554
  const filter = [expression ? `(${expression})` : "", label === void 0 ? "" : `tag:${label}`].filter(Boolean).join(" AND ") || void 0;
29555
+ const parsed = query.trim() ? parsedQuery(query, exact) : void 0;
29556
+ const words2 = parsed === void 0 ? "" : meaningWords(parsed);
29557
+ const narrowing = allOf([
29558
+ ...parsed === void 0 ? [] : [fieldsOfQuery(parsed)].filter((node) => node !== void 0),
29559
+ ...filter === void 0 ? [] : [parsedQuery(filter)]
29560
+ ]);
29671
29561
  const text2 = [query.trim() ? `(${query})` : "", filter ?? ""].filter(Boolean).join(" AND ");
29672
29562
  const window2 = offset + limit;
29673
29563
  const scope = {
@@ -29678,33 +29568,44 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
29678
29568
  };
29679
29569
  let meaningSkipped;
29680
29570
  let meaning;
29571
+ let meaningRefs;
29572
+ let meaningComplete = true;
29681
29573
  if (exact)
29682
29574
  meaningSkipped = "--exact searches words as written";
29683
- else if (words2.trim()) {
29575
+ else if (words2) {
29576
+ const lane2 = {
29577
+ command,
29578
+ ...env === void 0 ? {} : { env },
29579
+ ...embedders === void 0 ? {} : { embedders },
29580
+ ...folderIds === void 0 ? {} : { folderIds },
29581
+ ...withInternal ? { withInternal: true } : {},
29582
+ ...source === void 0 ? {} : { source }
29583
+ };
29584
+ const depth = Math.max(window2, CANDIDATES2);
29684
29585
  try {
29685
- const nearest = await nearestNotes(store, words2, {
29686
- limit: Math.max(window2, CANDIDATES2),
29687
- command,
29688
- ...env === void 0 ? {} : { env },
29689
- ...embedders === void 0 ? {} : { embedders },
29690
- ...folderIds === void 0 ? {} : { folderIds },
29691
- ...withInternal ? { withInternal: true } : {},
29692
- ...source === void 0 ? {} : { source }
29586
+ const within = narrowing === void 0 ? void 0 : await filterRefs(store, narrowing, scope);
29587
+ let nearest;
29588
+ if (within === void 0) {
29589
+ nearest = await nearestNotes(store, words2, { ...lane2, limit: depth });
29590
+ meaningComplete = nearest.length < depth;
29591
+ } else {
29592
+ const ranked2 = within.length ? await nearestAmong(store, words2, within, lane2) : [];
29593
+ meaningRefs = new Set(ranked2.map(({ ref }) => ref));
29594
+ nearest = ranked2.slice(0, depth);
29595
+ }
29596
+ const allowed = await matching(store, nearest.map(({ ref }) => ref), narrowing, scope);
29597
+ meaning = nearest.flatMap(({ ref }) => {
29598
+ const found = allowed.get(ref);
29599
+ return found ? [{ ref, ...found }] : [];
29693
29600
  });
29694
- if (filter === void 0)
29695
- meaning = nearest;
29696
- else {
29697
- const allowed = await searchNotesQuery(store, { text: filter, limit: FILTERED, ...scope });
29698
- const refs = new Set(allowed.items.map(({ ref }) => ref));
29699
- meaning = nearest.filter(({ ref }) => refs.has(ref));
29700
- }
29601
+ meaningRefs ??= new Set(meaning.map(({ ref }) => ref));
29701
29602
  } catch (error) {
29702
29603
  if (!(error instanceof CliError && error.code === "not_found"))
29703
29604
  throw error;
29704
29605
  meaningSkipped = error.message;
29705
29606
  }
29706
29607
  }
29707
- const titleWords = plainQueryWords(words2);
29608
+ const titleWords = plainQueryWords(rest);
29708
29609
  const titled = titleWords === void 0 ? { items: [], hasMore: false } : await searchNotesQuery(store, {
29709
29610
  text: [titleQuery(titleWords), filter ?? ""].filter(Boolean).join(" AND "),
29710
29611
  limit: Math.max(window2, CANDIDATES2),
@@ -29721,10 +29622,10 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
29721
29622
  ...scope
29722
29623
  });
29723
29624
  const ranked = /* @__PURE__ */ new Map();
29724
- const add = /* @__PURE__ */ __name((list2, by) => list2.forEach(({ ref, note }, rank) => {
29625
+ const add = /* @__PURE__ */ __name((list2, by) => list2.forEach(({ ref, note, at }, rank) => {
29725
29626
  if (tierRefs.has(ref))
29726
29627
  return;
29727
- const held = ranked.get(ref) ?? { note, score: 0, foundBy: [] };
29628
+ const held = ranked.get(ref) ?? { note, at, score: 0, foundBy: [] };
29728
29629
  held.score += 1 / (RRF_K3 + rank + 1);
29729
29630
  held.foundBy.push(by);
29730
29631
  ranked.set(ref, held);
@@ -29733,16 +29634,17 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
29733
29634
  if (meaning !== void 0)
29734
29635
  add(meaning, "meaning");
29735
29636
  const ordered = [
29736
- ...tier.map(({ ref, note }) => [ref, { note, score: 0, foundBy: ["title"] }]),
29637
+ ...tier.map(({ ref, note, at }) => [ref, { note, at, score: 0, foundBy: ["title"] }]),
29737
29638
  ...[...ranked.entries()].sort(([, a], [, b]) => b.score - a.score)
29738
29639
  ];
29739
29640
  const page = slice ? ordered : ordered.slice(offset, window2);
29740
29641
  const hasMore = slice ? matched.hasMore : ordered.length > window2 || matched.hasMore || titled.hasMore;
29642
+ const total = await notesTotal(store, text2, { exact, scope, shown: offset + page.length, hasMore }, [...tier.map(({ ref }) => ref), ...meaningRefs ?? []], meaningComplete);
29741
29643
  const hits = [];
29742
29644
  const counts = /* @__PURE__ */ new Map();
29743
29645
  const accounts = await store.accounts.storedAccounts();
29744
29646
  const profiles = await store.accounts.profiles();
29745
- for (const [ref, { note, foundBy }] of page) {
29647
+ for (const [ref, { note, at, foundBy }] of page) {
29746
29648
  const links = (await store.notes.links({ from: ref })).map(({ to, targetText, kind, anchor }) => ({
29747
29649
  to,
29748
29650
  target_text: targetText,
@@ -29756,13 +29658,14 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
29756
29658
  path: note.path,
29757
29659
  title: note.title,
29758
29660
  ...documentSource(note, accounts, profiles, note.source === "file" ? (await store.files.ofDocument(note.ref))[0] : void 0),
29661
+ updated_at: at,
29759
29662
  excerpt: firstLine(note.text, words2),
29760
29663
  links,
29761
29664
  found_by: foundBy
29762
29665
  });
29763
- for (const link5 of new Map(links.map((link6) => [link6.to ?? `?${link6.target_text}`, link6])).values()) {
29764
- const key = link5.to ?? `?${link5.target_text}`;
29765
- const known2 = counts.get(key) ?? { ref: link5.to, name: link5.target_text, notes: 0 };
29666
+ for (const link4 of new Map(links.map((link5) => [link5.to ?? `?${link5.target_text}`, link5])).values()) {
29667
+ const key = link4.to ?? `?${link4.target_text}`;
29668
+ const known2 = counts.get(key) ?? { ref: link4.to, name: link4.target_text, notes: 0 };
29766
29669
  known2.notes++;
29767
29670
  counts.set(key, known2);
29768
29671
  }
@@ -29787,6 +29690,10 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
29787
29690
  command,
29788
29691
  embedder: pictureEmbedder
29789
29692
  }) : {};
29693
+ if (lane.pictures && narrowing !== void 0) {
29694
+ const allowed = await matching(store, lane.pictures.map(({ ref }) => ref), narrowing, scope);
29695
+ lane.pictures = lane.pictures.filter(({ ref }) => allowed.has(ref));
29696
+ }
29790
29697
  return {
29791
29698
  query,
29792
29699
  ...label === void 0 ? {} : { tag: label },
@@ -29794,6 +29701,7 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
29794
29701
  by: meaning === void 0 ? "words" : "words and meaning",
29795
29702
  ...meaningSkipped === void 0 ? {} : { meaning_skipped: meaningSkipped },
29796
29703
  hits,
29704
+ total,
29797
29705
  has_more: hasMore,
29798
29706
  ...hasMore && window2 <= MAX_NOTES_OFFSET ? { next_offset: window2 } : {},
29799
29707
  linked: [...counts.values()].sort((a, b) => b.notes - a.notes || (a.name ?? a.ref ?? "").localeCompare(b.name ?? b.ref ?? "")),
@@ -29832,7 +29740,7 @@ var searchNotesOf = /* @__PURE__ */ __name(async (store, account2, text2, { acco
29832
29740
  };
29833
29741
  }, "searchNotesOf");
29834
29742
 
29835
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/events-search.js
29743
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/events-search.js
29836
29744
  var MAX_EVENTS_OFFSET = 1e3;
29837
29745
  var iso = /* @__PURE__ */ __name((at) => at === null ? null : new Date(at).toISOString(), "iso");
29838
29746
  var accountIdsOf = /* @__PURE__ */ __name(async (store, accounts) => {
@@ -29944,7 +29852,7 @@ var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, off
29944
29852
  };
29945
29853
  }, "searchEvents");
29946
29854
 
29947
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/search-all.js
29855
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/search-all.js
29948
29856
  var RESOURCES_SEARCHED = ["messages", "mail", "notes", "events"];
29949
29857
  var skippable = /* @__PURE__ */ __name((error) => error instanceof CliError && (error.code === "validation_error" || error.code === "not_found"), "skippable");
29950
29858
  var filtersBeside = /* @__PURE__ */ __name((text2) => {
@@ -29971,6 +29879,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account2, request, messenge
29971
29879
  let events;
29972
29880
  let messagesBy;
29973
29881
  let server;
29882
+ let coverage;
29974
29883
  const messagesOf = /* @__PURE__ */ __name(async (kind) => {
29975
29884
  const given = request.scope?.[kind];
29976
29885
  const query = {
@@ -29991,6 +29900,8 @@ var searchAll = /* @__PURE__ */ __name(async (store, account2, request, messenge
29991
29900
  const found = kind === "messages" ? await searchMessages(query) : await searchStore(store, account2, query, messenger);
29992
29901
  if (found.server)
29993
29902
  server = found.server;
29903
+ if (kind === "messages" && found.coverage)
29904
+ coverage = found.coverage;
29994
29905
  hasMore ||= found.hasMore;
29995
29906
  const read = found.coverage?.accounts ?? given ?? (await store.accounts.accounts()).filter(({ provider }) => kindIn(provider) === kind);
29996
29907
  for (const one of found.skipped ?? [])
@@ -30144,11 +30055,12 @@ var searchAll = /* @__PURE__ */ __name(async (store, account2, request, messenge
30144
30055
  ...notes === void 0 ? {} : { notes },
30145
30056
  ...events === void 0 ? {} : { events },
30146
30057
  ...messagesBy === void 0 ? {} : { messages: messagesBy },
30147
- ...server === void 0 ? {} : { server }
30058
+ ...server === void 0 ? {} : { server },
30059
+ ...coverage === void 0 ? {} : { coverage }
30148
30060
  };
30149
30061
  }, "searchAll");
30150
30062
 
30151
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/search-all-meetings.js
30063
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/search-all-meetings.js
30152
30064
  var RESOURCES_SEARCHED_WITH_MEETINGS = [...RESOURCES_SEARCHED, "meetings"];
30153
30065
  var whole2 = /* @__PURE__ */ __name((value, minimum, maximum, label) => {
30154
30066
  if (!Number.isSafeInteger(value) || value < minimum || value > maximum)
@@ -30395,7 +30307,7 @@ var searchAllOfSource = /* @__PURE__ */ __name(async (store, account2, source, r
30395
30307
  return { ...found, skipped: [...skipped, ...empty2, ...unnamed, ...found.skipped] };
30396
30308
  }, "searchAllOfSource");
30397
30309
 
30398
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/server-search.js
30310
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/server-search.js
30399
30311
  var SERVER_SEARCH_KEY = "messages.server-search";
30400
30312
  var SERVER_BOUNDS = { timeMs: 5e3, perCall: 100, maxCalls: 3 };
30401
30313
  var DEFAULT_BACKEND = "both";
@@ -30520,7 +30432,7 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
30520
30432
  const calls = unique.slice(0, SERVER_BOUNDS.maxCalls);
30521
30433
  const pending = new Set(calls);
30522
30434
  const found = [];
30523
- let open10 = true;
30435
+ let open7 = true;
30524
30436
  const fail3 = /* @__PURE__ */ __name((branch, reason) => {
30525
30437
  pending.delete(branch);
30526
30438
  report.complete = false;
@@ -30529,19 +30441,19 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
30529
30441
  const ask = /* @__PURE__ */ __name(async (adapter) => {
30530
30442
  const search = capability(adapter, "searchMessages", "search messages on its server");
30531
30443
  await Promise.all(calls.map(async (branch) => {
30532
- if (!open10)
30444
+ if (!open7)
30533
30445
  return;
30534
30446
  report.calls += 1;
30535
30447
  try {
30536
30448
  const page = await search(asQuery(branch), { limit: SERVER_BOUNDS.perCall, signal: stop });
30537
- if (!open10)
30449
+ if (!open7)
30538
30450
  return;
30539
30451
  pending.delete(branch);
30540
30452
  if (page.hasMore)
30541
30453
  report.complete = false;
30542
30454
  found.push(page);
30543
30455
  } catch (error) {
30544
- if (!open10)
30456
+ if (!open7)
30545
30457
  return;
30546
30458
  fail3(branch, error instanceof CliError && error.code === "rate_limited" ? "rate_limited" : "search_failed");
30547
30459
  }
@@ -30553,11 +30465,11 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
30553
30465
  run.then(() => "done", () => "failed"),
30554
30466
  bound2
30555
30467
  ]);
30556
- open10 = false;
30468
+ open7 = false;
30557
30469
  for (const branch of [...pending])
30558
30470
  fail3(branch, outcome2 === "failed" ? "search_failed" : "time_or_abort_bound");
30559
30471
  } finally {
30560
- open10 = false;
30472
+ open7 = false;
30561
30473
  clearTimeout(timer);
30562
30474
  }
30563
30475
  const chats = new Map(found.flatMap(({ chats: chats2 }) => chats2).map((chat) => [chat.id, chat]));
@@ -30584,7 +30496,7 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
30584
30496
  return { report, sources };
30585
30497
  }, "searchServer");
30586
30498
 
30587
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/messages.js
30499
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/messages.js
30588
30500
  var DELETE_AT_ONCE = 10;
30589
30501
  var messagesService = /* @__PURE__ */ __name((deps) => {
30590
30502
  const { guard } = deps;
@@ -31010,7 +30922,7 @@ var checkMediaOptions = /* @__PURE__ */ __name((messenger, asked, attachments) =
31010
30922
  throw new CliError("validation_error", `${MEDIA_FLAGS[first2]} needs a --photo or --file`);
31011
30923
  }, "checkMediaOptions");
31012
30924
 
31013
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/domain/channel-tags.js
30925
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/domain/channel-tags.js
31014
30926
  var CHANNEL_TAG_RULES_VERSION = "keywords-v1";
31015
30927
  var RULES = {
31016
30928
  ai: [/\b(ai|gpt|llm|machine learning|artificial intelligence)\b/iu, /нейросет|искусственн/iu],
@@ -31025,7 +30937,7 @@ var classifyChannel = /* @__PURE__ */ __name((metadata) => Object.entries(RULES)
31025
30937
  return fields.length ? [{ tag, score: fields.length / 3, fields }] : [];
31026
30938
  }), "classifyChannel");
31027
30939
 
31028
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/metadata.js
30940
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/metadata.js
31029
30941
  var metadataService = /* @__PURE__ */ __name((deps) => {
31030
30942
  const held = /* @__PURE__ */ __name(async (reference, { includeLeft = false } = {}) => {
31031
30943
  const store = await deps.store();
@@ -31111,7 +31023,7 @@ var metadataService = /* @__PURE__ */ __name((deps) => {
31111
31023
  };
31112
31024
  }, "metadataService");
31113
31025
 
31114
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/moderation/run.js
31026
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/moderation/run.js
31115
31027
  var FIRST_LOOK_MS = 24 * 36e5;
31116
31028
  var moderateWith = /* @__PURE__ */ __name(async (run) => {
31117
31029
  const { chatId, title, rules, point, since, dryRun } = run;
@@ -31148,7 +31060,7 @@ var moderateWith = /* @__PURE__ */ __name(async (run) => {
31148
31060
  return { chatId, rows, notes };
31149
31061
  }, "moderateWith");
31150
31062
 
31151
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/moderation.js
31063
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/moderation.js
31152
31064
  var moderationService = /* @__PURE__ */ __name((deps) => {
31153
31065
  const file = /* @__PURE__ */ __name(() => new ModerationRules(moderationPathFor(deps.messenger.app, deps.profile ?? "default", deps.env ?? process.env)), "file");
31154
31066
  const group = /* @__PURE__ */ __name(async (chat) => {
@@ -31226,7 +31138,7 @@ var moderatorOf = /* @__PURE__ */ __name((adapter, deps) => ({
31226
31138
  }, "removePerson")
31227
31139
  }), "moderatorOf");
31228
31140
 
31229
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/person-context.js
31141
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/person-context.js
31230
31142
  var CONTEXT_MESSAGES2 = 10;
31231
31143
  var CONTEXT_BYTES = 64 * 1024;
31232
31144
  var toContext = /* @__PURE__ */ __name((key, message, chatTitle) => ({
@@ -31482,10 +31394,10 @@ var personMessages = /* @__PURE__ */ __name(async (store, asked, reference, { ch
31482
31394
  };
31483
31395
  }, "personMessages");
31484
31396
 
31485
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
31397
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
31486
31398
  import { createHash as createHash11 } from "node:crypto";
31487
31399
 
31488
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-reference.js
31400
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-reference.js
31489
31401
  var missing3 = /* @__PURE__ */ __name(() => new CliError("not_found", "the meeting evidence is unavailable for this account"), "missing");
31490
31402
  var authorizedMeetingMetadata = /* @__PURE__ */ __name(async (store, accountId, reference, options = {}) => {
31491
31403
  const parsed = parseMeetingReference(reference);
@@ -31533,7 +31445,7 @@ var resolveMeetingReference = /* @__PURE__ */ __name(async (store, accountId, re
31533
31445
  };
31534
31446
  }, "resolveMeetingReference");
31535
31447
 
31536
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
31448
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
31537
31449
  var hash = /* @__PURE__ */ __name((value) => createHash11("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
31538
31450
  var checkMeetingCancelled = /* @__PURE__ */ __name((signal) => {
31539
31451
  if (signal?.aborted)
@@ -31732,7 +31644,7 @@ var readMeetingEvidence = /* @__PURE__ */ __name(async (store, accountId, refere
31732
31644
  return { ...packet, fingerprint: hash(packet) };
31733
31645
  }, "readMeetingEvidence");
31734
31646
 
31735
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/person-meeting-context.js
31647
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/person-meeting-context.js
31736
31648
  var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference, options) => {
31737
31649
  const { meetings = 10, cues = 5, bytes: bytes2 = 64 * 1024, scanLimit = 1e3, since, signal } = options;
31738
31650
  const requestedAccounts = options.accountIds;
@@ -31831,7 +31743,7 @@ var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference,
31831
31743
  };
31832
31744
  }, "personMeetingContext");
31833
31745
 
31834
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/person-preparation.js
31746
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/person-preparation.js
31835
31747
  var PREPARE_BYTES = 96 * 1024;
31836
31748
  var MEETINGS = 5;
31837
31749
  var CUES = 3;
@@ -31948,7 +31860,7 @@ var meetingsOf = /* @__PURE__ */ __name(async (store, uid, stored, since, left)
31948
31860
  }
31949
31861
  }, "meetingsOf");
31950
31862
 
31951
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/person-profile.js
31863
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/person-profile.js
31952
31864
  var personProfile = /* @__PURE__ */ __name(async (deps, person, known2) => {
31953
31865
  const online = deps.offline ? void 0 : await deps.connection();
31954
31866
  const held = await storeIfOpen(deps);
@@ -32018,7 +31930,7 @@ var quiet = /* @__PURE__ */ __name((facts) => facts.chats.map(({ id: id2, title,
32018
31930
  complete: false
32019
31931
  })), "quiet");
32020
31932
 
32021
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/person-timeline.js
31933
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/person-timeline.js
32022
31934
  var TIMELINE_ITEMS = 50;
32023
31935
  var TIMELINE_MAX = 500;
32024
31936
  var SCOPES = ["personal", "work"];
@@ -32073,7 +31985,7 @@ var personTimeline = /* @__PURE__ */ __name(async (store, asked, reference, { sc
32073
31985
  };
32074
31986
  }, "personTimeline");
32075
31987
 
32076
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/people.js
31988
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/people.js
32077
31989
  var peopleService = /* @__PURE__ */ __name((deps) => {
32078
31990
  const localCard = /* @__PURE__ */ __name(async (card, includeNotes = false) => {
32079
31991
  const held = await storeIfOpen(deps);
@@ -32300,7 +32212,7 @@ var withoutPhone = /* @__PURE__ */ __name((answer) => {
32300
32212
  return rest;
32301
32213
  }, "withoutPhone");
32302
32214
 
32303
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/private-people.js
32215
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/private-people.js
32304
32216
  var noteItem = /* @__PURE__ */ __name((provider, note) => ({
32305
32217
  id: note.id,
32306
32218
  contact: formatReference({ type: "contact", provider, id: note.personId }),
@@ -32344,7 +32256,7 @@ var privatePeopleService = /* @__PURE__ */ __name((deps) => {
32344
32256
  };
32345
32257
  }, "privatePeopleService");
32346
32258
 
32347
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/rankings.js
32259
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/rankings.js
32348
32260
  var empty = /* @__PURE__ */ __name(() => ({
32349
32261
  total: 0,
32350
32262
  population: 0,
@@ -32600,7 +32512,7 @@ var rankingsService = /* @__PURE__ */ __name((deps) => ({
32600
32512
  }, "evidence")
32601
32513
  }), "rankingsService");
32602
32514
 
32603
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/searches.js
32515
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/searches.js
32604
32516
  var savedSearchItem = /* @__PURE__ */ __name((one) => ({
32605
32517
  id: one.id,
32606
32518
  name: one.name,
@@ -32729,7 +32641,7 @@ var searchesService = /* @__PURE__ */ __name((deps) => {
32729
32641
  };
32730
32642
  }, "searchesService");
32731
32643
 
32732
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/tags.js
32644
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/tags.js
32733
32645
  var TAGGING_QUERY = {
32734
32646
  entity: "tagging",
32735
32647
  backend: "sql",
@@ -32813,7 +32725,7 @@ var tagsService = /* @__PURE__ */ __name((deps) => {
32813
32725
  };
32814
32726
  }, "tagsService");
32815
32727
 
32816
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/tasks.js
32728
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/tasks.js
32817
32729
  var TASK_QUERY = {
32818
32730
  entity: "task",
32819
32731
  backend: "sql",
@@ -32945,13 +32857,13 @@ var tasksService = /* @__PURE__ */ __name((deps, categories) => {
32945
32857
  store.notes.links({ from: details.ref }),
32946
32858
  store.notes.links({ to: details.ref })
32947
32859
  ]);
32948
- return { ...details, links, linkedFrom: incoming.filter((link5) => link5.from.startsWith("task:")) };
32860
+ return { ...details, links, linkedFrom: incoming.filter((link4) => link4.from.startsWith("task:")) };
32949
32861
  }, "cardOf");
32950
32862
  const planOf = /* @__PURE__ */ __name(async (store, id2, plan, by) => {
32951
32863
  if (plan.category !== void 0)
32952
32864
  plan = { ...plan, category: await categoryOf(store, plan.category) };
32953
- const open10 = (await store.tasks.details(id2)).status === "open";
32954
- if (!open10 && (plan.dueAt != null || plan.nextCheckAt != null))
32865
+ const open7 = (await store.tasks.details(id2)).status === "open";
32866
+ if (!open7 && (plan.dueAt != null || plan.nextCheckAt != null))
32955
32867
  throw new CliError("validation_error", "a closed task takes no due date or next check; it stays closed");
32956
32868
  const { assignees, ...fields } = plan;
32957
32869
  const author = by === "owner" ? "owner" : { bot: by };
@@ -33037,17 +32949,17 @@ var tasksService = /* @__PURE__ */ __name((deps, categories) => {
33037
32949
  if (choice.attach !== void 0) {
33038
32950
  const target2 = await owned(store, account2, choice.attach);
33039
32951
  const similarity = await store.tasks.compare(subject, target2.id);
33040
- const link5 = {
32952
+ const link4 = {
33041
32953
  from: (await store.tasks.details(target2.id)).ref,
33042
32954
  kind: "evidence",
33043
32955
  origin: origin === "owner" ? "owner" : "suggested"
33044
32956
  };
33045
32957
  try {
33046
- await store.notes.addLink({ ...link5, to: note ? note.ref : source });
32958
+ await store.notes.addLink({ ...link4, to: note ? note.ref : source });
33047
32959
  } catch (error) {
33048
32960
  if (!(error instanceof CliError && error.code === "not_found" && !note))
33049
32961
  throw error;
33050
- await store.notes.addLink({ ...link5, targetText: source });
32962
+ await store.notes.addLink({ ...link4, targetText: source });
33051
32963
  }
33052
32964
  await store.tasks.recordPair({ source, other: target2.id, decision: "attached", similarity, by });
33053
32965
  const review = await reviewAfterLink(store, target2.id);
@@ -33293,7 +33205,7 @@ var taskView = /* @__PURE__ */ __name(async (store, account2, task2) => {
33293
33205
  };
33294
33206
  }, "taskView");
33295
33207
 
33296
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/topics.js
33208
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/topics.js
33297
33209
  var actionOf = /* @__PURE__ */ __name(({ title, closed, pinned, hidden }) => {
33298
33210
  const set = [closed, pinned, hidden].filter((one) => one !== void 0).length;
33299
33211
  if (title !== void 0 || set !== 1)
@@ -33478,8 +33390,8 @@ var topicsService = /* @__PURE__ */ __name((deps) => {
33478
33390
  };
33479
33391
  }, "topicsService");
33480
33392
 
33481
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/evidence.js
33482
- import { createHash as createHash12, randomUUID as randomUUID7 } from "node:crypto";
33393
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/evidence.js
33394
+ import { createHash as createHash12, randomUUID as randomUUID5 } from "node:crypto";
33483
33395
  var hash2 = /* @__PURE__ */ __name((value) => createHash12("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
33484
33396
  var positive = /* @__PURE__ */ __name((value, name, minimum = 1) => {
33485
33397
  if (!Number.isSafeInteger(value) || value < minimum)
@@ -33549,10 +33461,10 @@ var prepareEvidencePacket = /* @__PURE__ */ __name(({ kind, source, page, limits
33549
33461
  },
33550
33462
  items
33551
33463
  };
33552
- return { ...content, id: randomUUID7(), fingerprint: hash2(content) };
33464
+ return { ...content, id: randomUUID5(), fingerprint: hash2(content) };
33553
33465
  }, "prepareEvidencePacket");
33554
33466
 
33555
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/evidence-read.js
33467
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/evidence-read.js
33556
33468
  var readEvidencePacket = /* @__PURE__ */ __name(async (store, account2, { chat, limit, before: before2 }, messenger = {}) => {
33557
33469
  if (!Number.isSafeInteger(limit) || limit < 1 || limit > 100)
33558
33470
  throw new CliError("validation_error", "evidence message limit must be an integer from 1 to 100");
@@ -33572,7 +33484,7 @@ var readEvidencePacket = /* @__PURE__ */ __name(async (store, account2, { chat,
33572
33484
  return { ...packet, nextBeforeId: older && last ? last.id : null };
33573
33485
  }, "readEvidencePacket");
33574
33486
 
33575
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-hit-search.js
33487
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-hit-search.js
33576
33488
  var refreshMeetingIndex = /* @__PURE__ */ __name(async (meetings, accountId, signal) => {
33577
33489
  let before2 = Number.POSITIVE_INFINITY;
33578
33490
  for (; ; ) {
@@ -33634,7 +33546,7 @@ var searchMeetingHits = /* @__PURE__ */ __name(async (store, query, request, opt
33634
33546
  return { ...result, selection };
33635
33547
  }, "searchMeetingHits");
33636
33548
 
33637
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-links.js
33549
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-links.js
33638
33550
  var readMeetingLinks = /* @__PURE__ */ __name(async (store, request) => {
33639
33551
  const { maxMessages, url, ...selecting } = request;
33640
33552
  const { input, selection } = await resolveMeetingSelection(store, selecting);
@@ -33647,7 +33559,7 @@ var readMeetingLinks = /* @__PURE__ */ __name(async (store, request) => {
33647
33559
  for (const found of findMentions(line2.text)) {
33648
33560
  if (found.kind !== "url" || url !== void 0 && found.value !== url)
33649
33561
  continue;
33650
- const link5 = links.get(found.value) ?? {
33562
+ const link4 = links.get(found.value) ?? {
33651
33563
  url: found.value,
33652
33564
  domain: found.domain,
33653
33565
  documentId: googleDocumentId(found.value),
@@ -33657,13 +33569,13 @@ var readMeetingLinks = /* @__PURE__ */ __name(async (store, request) => {
33657
33569
  senders: [],
33658
33570
  meetings: []
33659
33571
  };
33660
- link5.count += 1;
33661
- link5.lastAt = line2.sentAt;
33662
- if (line2.sender !== null && !link5.senders.includes(line2.sender))
33663
- link5.senders.push(line2.sender);
33664
- if (!link5.meetings.some((one) => one.meetingId === line2.meetingId))
33665
- link5.meetings.push({ meetingId: line2.meetingId, accountId: line2.accountId, title: line2.title });
33666
- links.set(found.value, link5);
33572
+ link4.count += 1;
33573
+ link4.lastAt = line2.sentAt;
33574
+ if (line2.sender !== null && !link4.senders.includes(line2.sender))
33575
+ link4.senders.push(line2.sender);
33576
+ if (!link4.meetings.some((one) => one.meetingId === line2.meetingId))
33577
+ link4.meetings.push({ meetingId: line2.meetingId, accountId: line2.accountId, title: line2.title });
33578
+ links.set(found.value, link4);
33667
33579
  }
33668
33580
  return {
33669
33581
  items: [...links.values()].sort((a, b) => b.count - a.count || b.lastAt - a.lastAt),
@@ -33673,10 +33585,10 @@ var readMeetingLinks = /* @__PURE__ */ __name(async (store, request) => {
33673
33585
  };
33674
33586
  }, "readMeetingLinks");
33675
33587
 
33676
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidates.js
33588
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidates.js
33677
33589
  import { createHash as createHash13 } from "node:crypto";
33678
33590
 
33679
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidate-validation.js
33591
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidate-validation.js
33680
33592
  function invalid3(field, response = false) {
33681
33593
  throw new CliError(response ? "invalid_response" : "validation_error", `invalid project candidate ${field}`);
33682
33594
  }
@@ -33795,7 +33707,7 @@ var candidateCatalog = /* @__PURE__ */ __name((catalog, limits) => {
33795
33707
  }
33796
33708
  }, "candidateCatalog");
33797
33709
 
33798
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidates.js
33710
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidates.js
33799
33711
  var createMeetingProjectCandidateReader = /* @__PURE__ */ __name((scope, accountId, ports) => {
33800
33712
  const fixed = snapshotMeetingScope(scope);
33801
33713
  if (!Number.isSafeInteger(accountId) || accountId < 1 || typeof ports?.vocabulary?.vocabulary !== "function")
@@ -33848,7 +33760,7 @@ var createMeetingProjectCandidateReader = /* @__PURE__ */ __name((scope, account
33848
33760
  };
33849
33761
  }, "createMeetingProjectCandidateReader");
33850
33762
 
33851
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-project-discovery.js
33763
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-project-discovery.js
33852
33764
  import { createHash as createHash14 } from "node:crypto";
33853
33765
  var scopeKeys = [
33854
33766
  "accountId",
@@ -33983,7 +33895,7 @@ var readMeetingProjectDiscovery = /* @__PURE__ */ __name(async (ports, projectNa
33983
33895
  };
33984
33896
  }, "readMeetingProjectDiscovery");
33985
33897
 
33986
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-review.js
33898
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-review.js
33987
33899
  var readMeetingReview = /* @__PURE__ */ __name(async (store, request) => {
33988
33900
  const { limit, ...selecting } = request;
33989
33901
  const { input, selection } = await resolveMeetingSelection(store, selecting);
@@ -33991,7 +33903,7 @@ var readMeetingReview = /* @__PURE__ */ __name(async (store, request) => {
33991
33903
  return { ...review, selection };
33992
33904
  }, "readMeetingReview");
33993
33905
 
33994
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-searches.js
33906
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-searches.js
33995
33907
  var KIND = ["meetings-search"];
33996
33908
  var meetingSearchesService = /* @__PURE__ */ __name((searches) => {
33997
33909
  const found = /* @__PURE__ */ __name(async (reference) => {
@@ -34021,7 +33933,7 @@ var meetingSearchesService = /* @__PURE__ */ __name((searches) => {
34021
33933
  };
34022
33934
  }, "meetingSearchesService");
34023
33935
 
34024
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-stats.js
33936
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-stats.js
34025
33937
  var readMeetingStats = /* @__PURE__ */ __name(async (store, request) => {
34026
33938
  const { timeZone, maxRows, ...selecting } = request;
34027
33939
  const { input, selection } = await resolveMeetingSelection(store, selecting);
@@ -34033,7 +33945,7 @@ var readMeetingStats = /* @__PURE__ */ __name(async (store, request) => {
34033
33945
  return { ...stats, selection };
34034
33946
  }, "readMeetingStats");
34035
33947
 
34036
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-hit-context.js
33948
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-hit-context.js
34037
33949
  import { createHash as createHash15 } from "node:crypto";
34038
33950
  var contextCue = /* @__PURE__ */ __name((cue) => ({
34039
33951
  ref: cue.reference,
@@ -34151,7 +34063,7 @@ var readMeetingHitContext = /* @__PURE__ */ __name(async (store, accountId, refe
34151
34063
  return { ...packet, fingerprint: createHash15("sha256").update(JSON.stringify(packet)).digest("hex") };
34152
34064
  }, "readMeetingHitContext");
34153
34065
 
34154
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-passage-format.js
34066
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-passage-format.js
34155
34067
  var visible = /* @__PURE__ */ __name((text2) => text2.replace(/[\p{Cc}\p{Cf}]/gu, (value) => value === "\n" || value === " " ? value : `\\u{${value.codePointAt(0)?.toString(16)}}`), "visible");
34156
34068
  var markdown = /* @__PURE__ */ __name((text2) => visible(text2).replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replace(/[\\`*_[\]#|~]/g, "\\$&"), "markdown");
34157
34069
  var timestamp = /* @__PURE__ */ __name((ms) => {
@@ -34228,7 +34140,7 @@ var readMeetingPassage = /* @__PURE__ */ __name(async (store, accountId, referen
34228
34140
  return { packet, content };
34229
34141
  }, "readMeetingPassage");
34230
34142
 
34231
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-batch.js
34143
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-batch.js
34232
34144
  var createMeetingBatchReader = /* @__PURE__ */ __name((store, accountId) => {
34233
34145
  if (!Number.isSafeInteger(accountId) || accountId < 1)
34234
34146
  throw new CliError("validation_error", "choose a positive meeting account");
@@ -34242,10 +34154,10 @@ var createMeetingBatchReader = /* @__PURE__ */ __name((store, accountId) => {
34242
34154
  };
34243
34155
  }, "createMeetingBatchReader");
34244
34156
 
34245
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-combined.js
34157
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-combined.js
34246
34158
  import { createHash as createHash16 } from "node:crypto";
34247
34159
 
34248
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-semantic.js
34160
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-semantic.js
34249
34161
  var positive2 = /* @__PURE__ */ __name((value, name, max) => {
34250
34162
  if (!Number.isSafeInteger(value) || value < 1 || value > max)
34251
34163
  throw new CliError("validation_error", `Invalid ${name}`);
@@ -34397,7 +34309,7 @@ var applyMeetingEmbedding = /* @__PURE__ */ __name(async (store, accountId, embe
34397
34309
  };
34398
34310
  }, "applyMeetingEmbedding");
34399
34311
 
34400
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-combined.js
34312
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-combined.js
34401
34313
  var DEPTH = 200;
34402
34314
  var cursorOf3 = /* @__PURE__ */ __name((value, key) => {
34403
34315
  if (value === void 0)
@@ -34534,7 +34446,7 @@ var searchMeetingsCombined = /* @__PURE__ */ __name(async (store, embedder, type
34534
34446
  };
34535
34447
  }, "searchMeetingsCombined");
34536
34448
 
34537
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-context.js
34449
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-context.js
34538
34450
  var meetingReferences = /* @__PURE__ */ __name((values) => values.map((value) => formatMeetingReference(parseMeetingReference(value))), "meetingReferences");
34539
34451
  var checkCancelled = /* @__PURE__ */ __name((signal) => {
34540
34452
  if (!signal?.aborted)
@@ -34639,7 +34551,7 @@ var createMeetingContextService = /* @__PURE__ */ __name(async (store, input, op
34639
34551
  };
34640
34552
  }, "createMeetingContextService");
34641
34553
 
34642
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-model.js
34554
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-model.js
34643
34555
  var integer = /* @__PURE__ */ __name((value, name, max) => {
34644
34556
  if (!Number.isSafeInteger(value) || value < 1 || value > max)
34645
34557
  throw new CliError("validation_error", `Invalid ${name}`);
@@ -34866,7 +34778,7 @@ var openMeetingEmbedder = /* @__PURE__ */ __name(async (choice, options = {}) =>
34866
34778
  };
34867
34779
  }, "openMeetingEmbedder");
34868
34780
 
34869
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/context/communication-selection.js
34781
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/context/communication-selection.js
34870
34782
  var communicationFields = {
34871
34783
  sources: pipe(array(strictObject({
34872
34784
  id: pipe(string(), regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/)),
@@ -34898,7 +34810,7 @@ var communicationRequest = /* @__PURE__ */ __name((value, preparationAfter) => {
34898
34810
  return { ...input, after, before: before2 };
34899
34811
  }, "communicationRequest");
34900
34812
 
34901
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-preparation-validation.js
34813
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-preparation-validation.js
34902
34814
  var MEETING_PREPARATION_LIMITS = {
34903
34815
  meetings: { min: 1, max: 20, default: 5 },
34904
34816
  cues: { min: 1, max: 100, default: 10 },
@@ -34984,7 +34896,7 @@ var preparationRequest = /* @__PURE__ */ __name((accountId, externalId, original
34984
34896
  return { ...input, history };
34985
34897
  }, "preparationRequest");
34986
34898
 
34987
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-communications-preparation.js
34899
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-communications-preparation.js
34988
34900
  var readPreparationCommunications = /* @__PURE__ */ __name(async (plan, signal) => {
34989
34901
  const section = {
34990
34902
  readUsage: plan.reader.usage(),
@@ -35089,7 +35001,7 @@ var appendPreparationCommunications = /* @__PURE__ */ __name((result, read) => {
35089
35001
  result.knowledge.coverage.otherSources = "see-communications";
35090
35002
  }, "appendPreparationCommunications");
35091
35003
 
35092
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-communications-selection.js
35004
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-communications-selection.js
35093
35005
  var captureCommunicationSelections = /* @__PURE__ */ __name((port) => {
35094
35006
  if (port === void 0)
35095
35007
  return void 0;
@@ -35194,7 +35106,7 @@ var validatePreparationCommunications = /* @__PURE__ */ __name((section, request
35194
35106
  }
35195
35107
  }, "validatePreparationCommunications");
35196
35108
 
35197
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-knowledge-preparation.js
35109
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-knowledge-preparation.js
35198
35110
  var invalid4 = /* @__PURE__ */ __name(() => {
35199
35111
  throw new CliError("invalid_response", "Preparation knowledge returned an invalid selection");
35200
35112
  }, "invalid");
@@ -35263,7 +35175,7 @@ var appendKnowledgePreparation = /* @__PURE__ */ __name(async (store, result, in
35263
35175
  }
35264
35176
  }, "appendKnowledgePreparation");
35265
35177
 
35266
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-notes-preparation.js
35178
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-notes-preparation.js
35267
35179
  var invalid5 = /* @__PURE__ */ __name(() => {
35268
35180
  throw new CliError("invalid_response", "Preparation notes returned an invalid selection");
35269
35181
  }, "invalid");
@@ -35337,7 +35249,7 @@ var appendNotesPreparation = /* @__PURE__ */ __name(async (store, result, input)
35337
35249
  }
35338
35250
  }, "appendNotesPreparation");
35339
35251
 
35340
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-project-preparation.js
35252
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-project-preparation.js
35341
35253
  var PAGE_LIMIT = 4;
35342
35254
  var size2 = /* @__PURE__ */ __name((value) => Buffer.byteLength(JSON.stringify(value), "utf8"), "size");
35343
35255
  var appendProjectPreparation = /* @__PURE__ */ __name(async (ports, result, input) => {
@@ -35387,7 +35299,7 @@ var appendProjectPreparation = /* @__PURE__ */ __name(async (ports, result, inpu
35387
35299
  }
35388
35300
  }, "appendProjectPreparation");
35389
35301
 
35390
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-related-preparation.js
35302
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-related-preparation.js
35391
35303
  var appendRelatedPreparation = /* @__PURE__ */ __name(async (store, result, input) => {
35392
35304
  if (!result.series || !result.items.length || result.coverage.outputLimited)
35393
35305
  return;
@@ -35459,7 +35371,7 @@ var appendRelatedPreparation = /* @__PURE__ */ __name(async (store, result, inpu
35459
35371
  }
35460
35372
  }, "appendRelatedPreparation");
35461
35373
 
35462
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-preparation.js
35374
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-preparation.js
35463
35375
  var size3 = /* @__PURE__ */ __name((value) => Buffer.byteLength(JSON.stringify(value), "utf8"), "size");
35464
35376
  var createMeetingPreparationService = /* @__PURE__ */ __name((scope, accountId, ports) => {
35465
35377
  const fixed = snapshotMeetingScope(scope);
@@ -35597,7 +35509,7 @@ var createMeetingPreparationService = /* @__PURE__ */ __name((scope, accountId,
35597
35509
  };
35598
35510
  }, "createMeetingPreparationService");
35599
35511
 
35600
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-task-proposal.js
35512
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-task-proposal.js
35601
35513
  import { createHash as createHash17 } from "node:crypto";
35602
35514
  var proposeMeetingTask = /* @__PURE__ */ __name(async (store, accountId, reference, kind) => {
35603
35515
  if (!TASK_KINDS.includes(kind))
@@ -35617,7 +35529,7 @@ var proposeMeetingTask = /* @__PURE__ */ __name(async (store, accountId, referen
35617
35529
  };
35618
35530
  }, "proposeMeetingTask");
35619
35531
 
35620
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/meeting-tasks.js
35532
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/meeting-tasks.js
35621
35533
  var accountSnapshot = /* @__PURE__ */ __name((key) => {
35622
35534
  const { provider, account: account2, scope } = key;
35623
35535
  if (!provider.trim() || provider.includes(":") || !account2.trim())
@@ -35680,7 +35592,7 @@ var readMeetingTask = /* @__PURE__ */ __name(async (store, account2, id2) => {
35680
35592
  }
35681
35593
  }, "readMeetingTask");
35682
35594
 
35683
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/package-upgrade.js
35595
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/package-upgrade.js
35684
35596
  var upgradePackage = /* @__PURE__ */ __name(async ({ current, command, packageName, check }, ports) => {
35685
35597
  const installer = ports.installer();
35686
35598
  const argv = updateCommand(installer, packageName);
@@ -35745,7 +35657,7 @@ var dayAfter = /* @__PURE__ */ __name((published) => {
35745
35657
  return Number.isNaN(time) ? null : new Date(time + 24 * 60 * 60 * 1e3).toISOString();
35746
35658
  }, "dayAfter");
35747
35659
 
35748
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/proposal-tasks.js
35660
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/proposal-tasks.js
35749
35661
  var proposalSource = /* @__PURE__ */ __name((id2) => `proposed-action:${id2}`, "proposalSource");
35750
35662
  var approveAsTask = /* @__PURE__ */ __name(async (store, id2) => {
35751
35663
  const proposal = await store.proposedActions.get(id2);
@@ -35774,7 +35686,7 @@ var approveAsTask = /* @__PURE__ */ __name(async (store, id2) => {
35774
35686
  return { proposal: await store.proposedActions.approve(proposal.id, { task: task2.id }), task: task2 };
35775
35687
  }, "approveAsTask");
35776
35688
 
35777
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/stored-meeting-project-candidate-validation.js
35689
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/stored-meeting-project-candidate-validation.js
35778
35690
  var storedCandidateRequest = /* @__PURE__ */ __name((reference, accountId, options) => {
35779
35691
  const invalid6 = /* @__PURE__ */ __name((field) => {
35780
35692
  throw new CliError("validation_error", `invalid stored project candidate ${field}`);
@@ -35816,7 +35728,7 @@ var storedCandidateRequest = /* @__PURE__ */ __name((reference, accountId, optio
35816
35728
  return { reference, limits, after, afterTranscriptId, signal };
35817
35729
  }, "storedCandidateRequest");
35818
35730
 
35819
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/stored-meeting-project-candidates.js
35731
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/stored-meeting-project-candidates.js
35820
35732
  var createStoredMeetingProjectCandidateReader = /* @__PURE__ */ __name((scope, accountId, ports) => {
35821
35733
  const fixed = snapshotMeetingScope(scope);
35822
35734
  const store = ports?.meetings;
@@ -35908,7 +35820,7 @@ var createStoredMeetingProjectCandidateReader = /* @__PURE__ */ __name((scope, a
35908
35820
  };
35909
35821
  }, "createStoredMeetingProjectCandidateReader");
35910
35822
 
35911
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_type_1193098e908042dfe6f4070222ac0245/node_modules/@wirecat/cli-core/dist/services/index.js
35823
+ // node_modules/.pnpm/@wirecat+cli-core@0.503.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e5d4ab9592406842b4a214ba16b749bd/node_modules/@wirecat/cli-core/dist/services/index.js
35912
35824
  var servicesFor = /* @__PURE__ */ __name((deps) => {
35913
35825
  const pictures = picturesService(deps);
35914
35826
  const base = {
@@ -35958,14 +35870,9 @@ export {
35958
35870
  storeOnlyDeps,
35959
35871
  REGISTRIES,
35960
35872
  registriesCover,
35873
+ chatCoverage,
35961
35874
  createContextEvidenceReader,
35962
35875
  excerpt,
35963
- writeFileAtomic,
35964
- openOrdinaryFile,
35965
- syncDirectory,
35966
- readBoundedUtf8File,
35967
- nativeWriterLeaseStore,
35968
- acquireLock,
35969
35876
  NativeRecordingPartialStore,
35970
35877
  NativeRecordingPublication,
35971
35878
  validateMediaSince,
@@ -36064,6 +35971,7 @@ export {
36064
35971
  pinDurationOf,
36065
35972
  sendAsCheck,
36066
35973
  typedSendAs,
35974
+ TOTAL_CAP,
36067
35975
  THREAD_BOUNDS,
36068
35976
  readThreadContext,
36069
35977
  MAX_SEARCH_OFFSET,
@@ -36087,6 +35995,7 @@ export {
36087
35995
  embedEvents,
36088
35996
  embedMail,
36089
35997
  nearestNotes,
35998
+ RANK_WITHIN,
36090
35999
  searchNotes,
36091
36000
  searchNotesOf,
36092
36001
  calendarAccounts,