@wirecat/zoom-cli 0.60.1 → 0.62.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 (182) hide show
  1. package/README.md +3 -3
  2. package/dist/answers.d.ts +16 -0
  3. package/dist/answers.d.ts.map +1 -1
  4. package/dist/bin/zm.js +2 -2
  5. package/dist/bundle/{chunk-3R437ICM.js → all-profiles-CGGNBINU.js} +11 -7
  6. package/dist/bundle/answer-policy-D46SGQ35.js +96 -0
  7. package/dist/bundle/{anthropic-CSLAACWX.js → anthropic-KVWPIHFG.js} +4 -4
  8. package/dist/bundle/{app-server-RYYXX6QV.js → app-server-NKKFBTQN.js} +50 -50
  9. package/dist/bundle/{bun-JVDJVDHL.js → bun-XRO6XJHQ.js} +2 -2
  10. package/dist/bundle/{bun-sqlite-B5CZHAV4.js → bun-sqlite-FWNCLOAR.js} +3 -3
  11. package/dist/bundle/{chunk-HAUAEGGI.js → chunk-2DPMYUWQ.js} +10 -10
  12. package/dist/bundle/{chunk-HBYE4EP2.js → chunk-2LLNPNMB.js} +1 -1
  13. package/dist/bundle/{chunk-WB7MQHUI.js → chunk-2NAM2XQG.js} +2 -2
  14. package/dist/bundle/{chunk-PAEBFJUC.js → chunk-2T7MUSDB.js} +118 -95
  15. package/dist/bundle/{chunk-LPY2ISJK.js → chunk-3YBDRVOG.js} +6 -6
  16. package/dist/bundle/{chunk-WEUXLXOZ.js → chunk-4OQVRDTG.js} +31 -21
  17. package/dist/bundle/{chunk-Q7U627RY.js → chunk-4OTXE6CF.js} +79 -59
  18. package/dist/bundle/{chunk-LPDYI5GR.js → chunk-4UUQEQ5D.js} +1 -1
  19. package/dist/bundle/{chunk-FWJ3Q7NO.js → chunk-5LMQTEU5.js} +5 -5
  20. package/dist/bundle/{chunk-6BJQBVMN.js → chunk-5MYLM6SU.js} +45 -27
  21. package/dist/bundle/{chunk-Z5H47R4G.js → chunk-5NLFQ644.js} +1034 -870
  22. package/dist/bundle/{chunk-XS72YFPV.js → chunk-6R3GMSLR.js} +2 -2
  23. package/dist/bundle/{chunk-AZZPMHP2.js → chunk-6SK5SHCR.js} +2 -2
  24. package/dist/bundle/{chunk-TY5PBEH2.js → chunk-6SPWQCJF.js} +11 -11
  25. package/dist/bundle/{chunk-EUHQ5D4K.js → chunk-6URISMGR.js} +26 -26
  26. package/dist/bundle/{chunk-43BX56ZI.js → chunk-72S5TXFN.js} +9 -9
  27. package/dist/bundle/{chunk-OBUKZ2ZM.js → chunk-73BAQ7PH.js} +31 -211
  28. package/dist/bundle/{chunk-3LBA63D5.js → chunk-7AY3ADNV.js} +22 -5
  29. package/dist/bundle/{chunk-RACSKYNX.js → chunk-7CNRZSAV.js} +7 -5
  30. package/dist/bundle/{chunk-IQENQXUJ.js → chunk-7LQLJ7LW.js} +2 -2
  31. package/dist/bundle/{chunk-EN5DBDKW.js → chunk-AMIIU3UZ.js} +4 -4
  32. package/dist/bundle/{chunk-RUEPZTNA.js → chunk-BJPFWPKH.js} +2 -2
  33. package/dist/bundle/{chunk-KNAS4VEA.js → chunk-BNTAQADF.js} +2 -2
  34. package/dist/bundle/{chunk-PEMLI3T7.js → chunk-BPMKLWHV.js} +6 -4
  35. package/dist/bundle/chunk-CXPHUOJR.js +380 -0
  36. package/dist/bundle/{chunk-LVHZQCP4.js → chunk-D6FTCPXA.js} +14 -10
  37. package/dist/bundle/{chunk-IRX2YVAH.js → chunk-DIXC56OU.js} +4 -4
  38. package/dist/bundle/{chunk-WFT2GGFH.js → chunk-ECXRRW7J.js} +25 -22
  39. package/dist/bundle/{chunk-KXEC5FVT.js → chunk-EG7HC4EC.js} +2 -2
  40. package/dist/bundle/{chunk-GEVHI226.js → chunk-EJFSS65P.js} +6 -6
  41. package/dist/bundle/{chunk-HIAO4MPA.js → chunk-EOEDICIE.js} +1 -1
  42. package/dist/bundle/{chunk-BO7J5Z3T.js → chunk-FAOLCUKV.js} +17 -17
  43. package/dist/bundle/{chunk-ZK7Y5K63.js → chunk-FDCGTODC.js} +1 -1
  44. package/dist/bundle/{chunk-IQSBMAYB.js → chunk-GOESXUJQ.js} +3 -3
  45. package/dist/bundle/{chunk-AOZGGGUK.js → chunk-HIZQYFY3.js} +3 -3
  46. package/dist/bundle/{chunk-YLATWUE7.js → chunk-IK2OSV5C.js} +6 -6
  47. package/dist/bundle/{chunk-46R2JTGO.js → chunk-IOCS5FXW.js} +2 -2
  48. package/dist/bundle/{chunk-Y3YURIZF.js → chunk-IOUPXUFH.js} +52 -38
  49. package/dist/bundle/{chunk-ZXQCA3ZW.js → chunk-IR73ZZY6.js} +8 -8
  50. package/dist/bundle/{chunk-EF2RCQ3L.js → chunk-JBBZCTTF.js} +1 -1
  51. package/dist/bundle/{chunk-OEEMCNAO.js → chunk-JDJDVYGS.js} +6 -6
  52. package/dist/bundle/{chunk-PATM7JGR.js → chunk-JYVFFUIX.js} +1 -1
  53. package/dist/bundle/{chunk-W5EUHV3J.js → chunk-KM7Q67Z3.js} +1 -1
  54. package/dist/bundle/{chunk-FZMRHNOP.js → chunk-KMQUZ4YM.js} +3 -3
  55. package/dist/bundle/{chunk-VLE3FWE3.js → chunk-LXYC75D3.js} +120 -32
  56. package/dist/bundle/{chunk-V53IB5AU.js → chunk-M2WQWF3I.js} +47 -47
  57. package/dist/bundle/{chunk-X7YPTYM4.js → chunk-M6FCCVYZ.js} +16 -3
  58. package/dist/bundle/{chunk-4TCQT57W.js → chunk-M7YNOK4D.js} +408 -420
  59. package/dist/bundle/chunk-MI3JK6MW.js +335 -0
  60. package/dist/bundle/{chunk-ES6UWVTM.js → chunk-MIUPH3WA.js} +6 -6
  61. package/dist/bundle/{chunk-VJBVNDFR.js → chunk-MLNC5N7H.js} +3 -3
  62. package/dist/bundle/{chunk-UWVNY5CA.js → chunk-N3KQ7XND.js} +2 -2
  63. package/dist/bundle/{chunk-VKUS2V4L.js → chunk-NQCFUYC2.js} +8 -8
  64. package/dist/bundle/{chunk-KYUIU5UR.js → chunk-Q4ZE2LXE.js} +2 -2
  65. package/dist/bundle/{chunk-VVKHF6VJ.js → chunk-QLQ7VVLK.js} +49 -24
  66. package/dist/bundle/{chunk-K6NPOZUP.js → chunk-QUWMFBMS.js} +7 -7
  67. package/dist/bundle/{chunk-WWNZS7ZY.js → chunk-RWG44LQD.js} +16 -4
  68. package/dist/bundle/{chunk-R4SRXI7M.js → chunk-SB47UAW2.js} +187 -113
  69. package/dist/bundle/{chunk-N27LOY3D.js → chunk-SEH7DBAM.js} +7 -7
  70. package/dist/bundle/{chunk-YEZQ7SD7.js → chunk-SPJJCD2A.js} +13 -13
  71. package/dist/bundle/{chunk-CGCJ6P3A.js → chunk-TILW3EJY.js} +696 -418
  72. package/dist/bundle/{chunk-XLJV3ZOH.js → chunk-TQFCPUIM.js} +1 -1
  73. package/dist/bundle/{chunk-ZDRDCANC.js → chunk-TZE6WXID.js} +693 -336
  74. package/dist/bundle/{chunk-XX7KVQIG.js → chunk-UD4FKICZ.js} +4 -4
  75. package/dist/bundle/{chunk-MFS52LTZ.js → chunk-UIPT6IAU.js} +1 -1
  76. package/dist/bundle/{chunk-QKSCDALS.js → chunk-URJZK4GX.js} +1 -1
  77. package/dist/bundle/{decode-CTQJQYNU.js → chunk-VFJ3MOIR.js} +21 -18
  78. package/dist/bundle/{chunk-REC3AZP6.js → chunk-XAXXEZZ5.js} +2 -2
  79. package/dist/bundle/{chunk-Z4D6M62I.js → chunk-YBMOFCY5.js} +2 -2
  80. package/dist/bundle/{chunk-PPHUBORC.js → chunk-YF2PT5KA.js} +32 -34
  81. package/dist/bundle/chunk-YFIUXE25.js +217 -0
  82. package/dist/bundle/{chunk-7IDNHVJS.js → chunk-YI6ZNDPC.js} +22 -12
  83. package/dist/bundle/{chunk-HYZ545ON.js → chunk-YJN4XYNA.js} +2 -2
  84. package/dist/bundle/{cli-CYKEKT5P.js → cli-AHPIESAC.js} +70 -54
  85. package/dist/bundle/command-contract-HVLI3OKU.js +38 -0
  86. package/dist/bundle/config-UW6W34I2.js +78 -0
  87. package/dist/bundle/decode-ZU7WLMMV.js +20 -0
  88. package/dist/bundle/{dist-YLSQKPPY.js → dist-LTS7VI3S.js} +14 -14
  89. package/dist/bundle/{echarts-4OQHS575.js → echarts-YNGCOYHW.js} +2 -2
  90. package/dist/bundle/{embed-P2BKRRJD.js → embed-VWWOW7PP.js} +4 -4
  91. package/dist/bundle/{embedder-HC6ZARP5.js → embedder-T5GJC7M2.js} +7 -7
  92. package/dist/bundle/{first-run-UERFFXBV.js → first-run-PX3SHPUU.js} +8 -8
  93. package/dist/bundle/first-screen-RAPEZG57.js +36 -0
  94. package/dist/bundle/{folders-RSLPTZLJ.js → folders-VXMDFC2D.js} +2 -2
  95. package/dist/bundle/{instructions-3QZBKKPF.js → instructions-GJHHFV64.js} +1 -1
  96. package/dist/bundle/{main-2T6D77JC.js → main-IYCD6MBH.js} +16 -16
  97. package/dist/bundle/{mcp-OQBZXELQ.js → mcp-EMNFFY4N.js} +2 -2
  98. package/dist/bundle/{meetings-ZIDSQZBJ.js → meetings-GHYNIOHG.js} +4 -4
  99. package/dist/bundle/{node-R2BLYUSB.js → node-GFOH6FKP.js} +2 -2
  100. package/dist/bundle/{node-sqlite-7CGHAHIS.js → node-sqlite-QXKSPHTP.js} +3 -3
  101. package/dist/bundle/{oauth-UBCYXTWV.js → oauth-A6I2OMDD.js} +5 -5
  102. package/dist/bundle/{open-AWUB4Q7Z.js → open-TQKCU447.js} +2 -2
  103. package/dist/bundle/openai-XE3BJXOI.js +22 -0
  104. package/dist/bundle/{output-file-SN22HAVL.js → output-file-FQNFCUKE.js} +3 -3
  105. package/dist/bundle/{process-IX5YWGDP.js → process-XVDX4SPD.js} +1 -1
  106. package/dist/bundle/{program-STYPTNT3.js → program-UYK4AD2W.js} +415 -428
  107. package/dist/bundle/{prompt-MAYUHEGN.js → prompt-ISYG5RWM.js} +3 -3
  108. package/dist/bundle/{recognize-FVTNXRTF.js → recognize-KENPECLZ.js} +4 -2
  109. package/dist/bundle/{remote-WCPRU73L.js → remote-ZP5XTDCC.js} +5 -5
  110. package/dist/bundle/{rerank-6CBLZBCV.js → rerank-SG653RHT.js} +5 -5
  111. package/dist/bundle/{run-log-G4WZTOBW.js → run-log-HYKGQ42E.js} +53 -53
  112. package/dist/bundle/{chunk-XNUFDYR6.js → serve-6UJCZD7Z.js} +8 -6
  113. package/dist/bundle/server-AXE37E6Q.js +66 -0
  114. package/dist/bundle/{chunk-INARC5O7.js → server-ZAYEDPFR.js} +43 -10
  115. package/dist/bundle/{services-326Z3TNE.js → services-KMH7XZPY.js} +37 -26
  116. package/dist/bundle/{speech-KSZ7RKM3.js → speech-LINBLG5E.js} +28 -5
  117. package/dist/bundle/{state-EPB3L2JM.js → state-4RKZNHE7.js} +4 -4
  118. package/dist/bundle/{store-7WX7SW2R.js → store-253N7NUC.js} +15 -15
  119. package/dist/bundle/{store-KO242JBK.js → store-JTBHRQZK.js} +13 -13
  120. package/dist/bundle/store-connection-PWLUMCP7.js +76 -0
  121. package/dist/bundle/store-maintenance-command-XRNECVDU.js +55 -0
  122. package/dist/bundle/{streaming-M6VDKBBH.js → streaming-YW64OKKQ.js} +4 -4
  123. package/dist/bundle/{tokens-BTNXHR7T.js → tokens-DPBC2P3I.js} +4 -4
  124. package/dist/bundle/zm.js +1 -1
  125. package/dist/commands.d.ts +1 -2
  126. package/dist/commands.d.ts.map +1 -1
  127. package/dist/commands.js +3 -16
  128. package/dist/commands.js.map +1 -1
  129. package/dist/contract-overrides.d.ts +0 -2
  130. package/dist/contract-overrides.d.ts.map +1 -1
  131. package/dist/contract-overrides.js +0 -158
  132. package/dist/contract-overrides.js.map +1 -1
  133. package/dist/program-bindings.d.ts +1 -1
  134. package/dist/program-bindings.d.ts.map +1 -1
  135. package/dist/program-bindings.js +16 -18
  136. package/dist/program-bindings.js.map +1 -1
  137. package/dist/program.d.ts +2 -4
  138. package/dist/program.d.ts.map +1 -1
  139. package/dist/program.js.map +1 -1
  140. package/dist/read-only.d.ts.map +1 -1
  141. package/dist/read-only.js +3 -0
  142. package/dist/read-only.js.map +1 -1
  143. package/dist/run.d.ts.map +1 -1
  144. package/dist/run.js +82 -32
  145. package/dist/run.js.map +1 -1
  146. package/dist/setup-commands.d.ts.map +1 -1
  147. package/dist/setup-commands.js +8 -46
  148. package/dist/setup-commands.js.map +1 -1
  149. package/dist/store-commands.d.ts.map +1 -1
  150. package/dist/store-commands.js +4 -1
  151. package/dist/store-commands.js.map +1 -1
  152. package/dist/tokens.d.ts +6 -1
  153. package/dist/tokens.d.ts.map +1 -1
  154. package/dist/tokens.js +21 -10
  155. package/dist/tokens.js.map +1 -1
  156. package/dist/version.d.ts +1 -1
  157. package/dist/version.js +1 -1
  158. package/package.json +3 -3
  159. package/dist/bundle/all-profiles-E6KXASLY.js +0 -25
  160. package/dist/bundle/answer-policy-YWCC55NB.js +0 -96
  161. package/dist/bundle/chunk-DBSWVZES.js +0 -48
  162. package/dist/bundle/chunk-WYRYLBST.js +0 -390
  163. package/dist/bundle/chunk-YLBNPI7H.js +0 -2
  164. package/dist/bundle/command-contract-P45QCCXM.js +0 -38
  165. package/dist/bundle/config-JYKTLEA3.js +0 -79
  166. package/dist/bundle/first-screen-VFIS7FX3.js +0 -36
  167. package/dist/bundle/mcp-4VHVUMCR.js +0 -92
  168. package/dist/bundle/mcp-6CLW2IZM.js +0 -189
  169. package/dist/bundle/serve-3IDUVTZL.js +0 -19
  170. package/dist/bundle/server-7GU36TER.js +0 -66
  171. package/dist/bundle/server-VHRS5UAL.js +0 -53
  172. package/dist/bundle/store-connection-K3MNDCQQ.js +0 -76
  173. package/dist/bundle/store-maintenance-command-GJDJYI2U.js +0 -54
  174. package/dist/mcp-command.d.ts +0 -33
  175. package/dist/mcp-command.d.ts.map +0 -1
  176. package/dist/mcp-command.js +0 -143
  177. package/dist/mcp-command.js.map +0 -1
  178. package/dist/mcp.d.ts +0 -30
  179. package/dist/mcp.d.ts.map +0 -1
  180. package/dist/mcp.js +0 -110
  181. package/dist/mcp.js.map +0 -1
  182. /package/dist/bundle/{chunk-O5EHUB2V.js → chunk-NPGVOZVK.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-CXPHUOJR.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-WEUXLXOZ.js";
37
+ } from "./chunk-4OQVRDTG.js";
30
38
  import {
31
39
  isCliFailure
32
- } from "./chunk-IQENQXUJ.js";
40
+ } from "./chunk-7LQLJ7LW.js";
33
41
  import {
34
42
  isNewer,
35
43
  updateCommand
36
- } from "./chunk-RACSKYNX.js";
44
+ } from "./chunk-7CNRZSAV.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-LPY2ISJK.js";
60
+ } from "./chunk-3YBDRVOG.js";
53
61
  import {
54
62
  MAX_MODEL_IMAGE_BYTES
55
- } from "./chunk-WB7MQHUI.js";
63
+ } from "./chunk-2NAM2XQG.js";
56
64
  import {
57
65
  OPENAI_URL,
58
66
  openRemote,
59
67
  remoteKey,
60
68
  remoteModel
61
- } from "./chunk-FZMRHNOP.js";
69
+ } from "./chunk-KMQUZ4YM.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-GEVHI226.js";
80
+ } from "./chunk-EJFSS65P.js";
73
81
  import {
74
82
  installFiles,
75
83
  megabytes
76
- } from "./chunk-PEMLI3T7.js";
84
+ } from "./chunk-BPMKLWHV.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-CGCJ6P3A.js";
142
+ } from "./chunk-TILW3EJY.js";
135
143
  import {
136
144
  TASK_KINDS,
137
145
  TASK_ORIGINS,
138
146
  TASK_STATES,
139
147
  createTaskService
140
- } from "./chunk-K6NPOZUP.js";
148
+ } from "./chunk-QUWMFBMS.js";
141
149
  import {
142
150
  DEFAULT_STEMMERS,
143
151
  createStemmer,
144
152
  fold,
145
153
  normalize
146
- } from "./chunk-ZXQCA3ZW.js";
154
+ } from "./chunk-IR73ZZY6.js";
147
155
  import {
148
156
  DEFAULT_TASK_CATEGORIES,
149
157
  FALLBACK_CATEGORY
150
- } from "./chunk-FWJ3Q7NO.js";
158
+ } from "./chunk-5LMQTEU5.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-ES6UWVTM.js";
177
+ } from "./chunk-MIUPH3WA.js";
170
178
  import {
171
179
  normalizeTag
172
- } from "./chunk-Z4D6M62I.js";
180
+ } from "./chunk-YBMOFCY5.js";
173
181
  import {
174
182
  storePath,
175
183
  wirecatDirectory
176
- } from "./chunk-KXEC5FVT.js";
184
+ } from "./chunk-EG7HC4EC.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-Q7U627RY.js";
202
+ } from "./chunk-4OTXE6CF.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-LVHZQCP4.js";
212
+ } from "./chunk-D6FTCPXA.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-R4SRXI7M.js";
230
+ } from "./chunk-SB47UAW2.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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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");
17384
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
17385
+ import { lstat } from "node:fs/promises";
17395
17386
 
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");
17461
-
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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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-P2BKRRJD.js");
18421
+ const { openEmbedder: openEmbedder2 } = await import("./embed-VWWOW7PP.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-6CBLZBCV.js");
18442
+ const { openReranker } = await import("./rerank-SG653RHT.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-HC6ZARP5.js");
18460
+ const { openPictureEmbedder } = await import("./embedder-T5GJC7M2.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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/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;
@@ -18912,7 +18584,8 @@ var BUDGETS = {
18912
18584
  maxReadBytes: [2097152, 16777216],
18913
18585
  maxPageBytes: [65536, 262144],
18914
18586
  maxElapsedMs: [6e4, 6e5],
18915
- maxItems: [100, 500]
18587
+ maxItems: [100, 500],
18588
+ maxFetchMs: [18e4, 18e5]
18916
18589
  };
18917
18590
  var fail = /* @__PURE__ */ __name((message, param) => {
18918
18591
  throw new CliError("validation_error", message, param ? { param } : void 0);
@@ -19208,12 +18881,80 @@ var decodeCheckpoint = /* @__PURE__ */ __name((text2, plan) => {
19208
18881
  return value;
19209
18882
  }, "decodeCheckpoint");
19210
18883
 
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
18884
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/project-gathering.js
19212
18885
  var terminal = /* @__PURE__ */ new Set(["done", "unavailable", "failed"]);
19213
18886
  var PAGE = 20;
19214
18887
  var PEOPLE = 20;
19215
18888
  var CONTEXTS = ["person-only", "sender", "linked-chat", "project"];
19216
18889
  var contextOf = /* @__PURE__ */ __name((lane) => lane.kinds.includes("linked-chat") ? "linked-chat" : lane.kinds.includes("sender") ? "sender" : lane.kinds.every((k) => k === "person") ? "person-only" : "project", "contextOf");
18890
+ var heldForWindow = /* @__PURE__ */ __name((row, after) => {
18891
+ if (!row)
18892
+ return false;
18893
+ const { state, upToDate, gaps } = row.completeness;
18894
+ if (state === "complete")
18895
+ return upToDate !== false;
18896
+ const oldest = row.held.oldestAt === null ? Number.NaN : Date.parse(row.held.oldestAt);
18897
+ return upToDate === true && !gaps && oldest <= after;
18898
+ }, "heldForWindow");
18899
+ var fetchLinkedChats = /* @__PURE__ */ __name(async (ports, plan, window2, now, signal) => {
18900
+ const wanted = [];
18901
+ for (const linked of plan.linkedChats) {
18902
+ if (linked.source === null)
18903
+ continue;
18904
+ const account2 = { provider: linked.provider, account: linked.account };
18905
+ const [row] = await ports.coverage(account2, [linked.chat]);
18906
+ if (!heldForWindow(row, window2.after))
18907
+ wanted.push({ ...linked, account: account2 });
18908
+ }
18909
+ const deadline = now() + plan.budgets.maxFetchMs;
18910
+ const results = [];
18911
+ for (const [index, linked] of wanted.entries()) {
18912
+ signal?.throwIfAborted();
18913
+ const started = now();
18914
+ const left = deadline - started;
18915
+ if (left <= 0) {
18916
+ results.push({ chat: linked.ref, state: "skipped", reason: "fetch-budget", elapsedMs: 0 });
18917
+ continue;
18918
+ }
18919
+ const budget = new AbortController();
18920
+ const timer = setTimeout(() => budget.abort(new CliError("timeout", "the fetch budget ran out")), left);
18921
+ const onProgress = ports.onFetchProgress;
18922
+ try {
18923
+ const answer = await ports.fetcher.fetch({
18924
+ account: linked.account,
18925
+ chatId: linked.chat,
18926
+ after: window2.after,
18927
+ before: window2.before,
18928
+ until: deadline,
18929
+ signal: signal ? AbortSignal.any([signal, budget.signal]) : budget.signal,
18930
+ ...onProgress ? { onProgress: /* @__PURE__ */ __name((progress) => onProgress({ ...progress, chat: linked.ref, index, of: wanted.length }), "onProgress") } : {}
18931
+ });
18932
+ if (!["complete", "partial", "failed"].includes(answer?.state))
18933
+ throw new CliError("invalid_response", "chat fetch returned an unknown state");
18934
+ const cut = budget.signal.aborted || now() > deadline;
18935
+ results.push({
18936
+ chat: linked.ref,
18937
+ state: cut && answer.state === "complete" ? "partial" : answer.state,
18938
+ reason: answer.reason ?? (cut && answer.state !== "failed" ? "fetch-budget" : null),
18939
+ elapsedMs: now() - started
18940
+ });
18941
+ } catch (error) {
18942
+ signal?.throwIfAborted();
18943
+ if (!(error instanceof CliError))
18944
+ throw error;
18945
+ const cut = budget.signal.aborted;
18946
+ results.push({
18947
+ chat: linked.ref,
18948
+ state: cut ? "partial" : "failed",
18949
+ reason: cut ? "fetch-budget" : error.code,
18950
+ elapsedMs: now() - started
18951
+ });
18952
+ } finally {
18953
+ clearTimeout(timer);
18954
+ }
18955
+ }
18956
+ return results;
18957
+ }, "fetchLinkedChats");
19217
18958
  var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
19218
18959
  if (!ports?.evidence || typeof ports.evidence.read !== "function")
19219
18960
  throw new CliError("configuration_error", "stored context reads are unavailable in this store");
@@ -19225,34 +18966,20 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
19225
18966
  const units2 = projectUnits(plan, window2);
19226
18967
  if (request.budgets?.maxReads === void 0)
19227
18968
  plan.budgets.maxReads = Math.min(512, Math.max(48, units2.length));
19228
- if (previous && (previous.units.length !== units2.length || previous.fetched.length !== plan.sources.length))
18969
+ if (previous && previous.units.length !== units2.length)
19229
18970
  throw new CliError("validation_error", "invalid project gathering checkpoint", { param: "checkpoint" });
19230
18971
  const progress = previous?.units.map((u) => ({ ...u })) ?? units2.map(() => ({ state: "pending", pages: 0, cursor: null, code: null }));
19231
- const fetched = previous?.fetched.map((f) => ({ ...f })) ?? plan.sources.map(() => ({ state: "not-requested", history: null, code: null }));
18972
+ let fetched = previous?.fetched.map((f) => ({ ...f })) ?? [];
19232
18973
  const seen = new Set(previous?.seen ?? []);
19233
18974
  const signal = plan.signal;
19234
18975
  const queries = plan.lanes.flatMap((lane) => lane.query === null ? [] : [lane.query]);
19235
- if (plan.fetch === "before-read" && !ports.fetcher)
19236
- throw new CliError("configuration_error", "this host cannot fetch source history; use fetch none", {
18976
+ if (plan.fetch === "before-read" && (!ports.fetcher || !ports.coverage))
18977
+ throw new CliError("configuration_error", "this host cannot fetch chat history; use fetch none", {
19237
18978
  param: "fetch"
19238
18979
  });
19239
- if (plan.fetch === "before-read" && ports.fetcher)
19240
- for (const [index, source] of plan.sources.entries()) {
19241
- if (fetched[index]?.state !== "not-requested")
19242
- continue;
19243
- signal?.throwIfAborted();
19244
- try {
19245
- const answer = await ports.fetcher.fetch({ source, after: window2.after, before: window2.before, signal });
19246
- if (!["fetched", "unsupported"].includes(answer?.status) || !["complete", "partial", "unknown"].includes(answer?.history))
19247
- throw new CliError("invalid_response", "source fetch returned an unknown status");
19248
- fetched[index] = { state: answer.status, history: answer.history, code: null };
19249
- } catch (error) {
19250
- signal?.throwIfAborted();
19251
- if (!(error instanceof CliError))
19252
- throw error;
19253
- fetched[index] = { state: "failed", history: null, code: error.code };
19254
- }
19255
- }
18980
+ if (plan.fetch === "before-read" && ports.fetcher && ports.coverage && previous === null)
18981
+ fetched = await fetchLinkedChats(ports, plan, window2, now, signal);
18982
+ const readFrom = now();
19256
18983
  const indexed = { state: "as-is", mail: 0, documents: 0, code: null };
19257
18984
  const kinds = [...new Set(plan.sources.map((source) => source.kind))].filter((kind) => kind !== "message");
19258
18985
  if (plan.index === "update" && kinds.length) {
@@ -19279,9 +19006,9 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
19279
19006
  const matchedAgain = /* @__PURE__ */ new Map();
19280
19007
  const oversized = /* @__PURE__ */ new Map();
19281
19008
  let stopped = null;
19282
- const open10 = /* @__PURE__ */ __name((u) => !terminal.has(u.state) && u.state !== "read-limited", "open");
19009
+ const open7 = /* @__PURE__ */ __name((u) => !terminal.has(u.state) && u.state !== "read-limited", "open");
19283
19010
  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] : []));
19011
+ const openLanes = new Set(progress.flatMap((u, index) => open7(u) ? [units2[index]?.lane.id] : []));
19285
19012
  const shares = [...linkedLanes].filter((id2) => openLanes.has(id2)).length + ([...openLanes].some((id2) => id2 !== void 0 && !linkedLanes.has(id2)) ? 1 : 0);
19286
19013
  const linkedLimit = Math.max(PAGE, Math.floor(plan.budgets.maxItems / Math.max(1, shares)));
19287
19014
  const linkedTaken = /* @__PURE__ */ new Map();
@@ -19340,9 +19067,9 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
19340
19067
  if (linkedLanes.has(lane.id))
19341
19068
  linkedTaken.set(lane.id, (linkedTaken.get(lane.id) ?? 0) + 1);
19342
19069
  }, "take");
19343
- const shallowest = progress.reduce((low, u) => open10(u) ? Math.min(low, u.pages) : low, Number.POSITIVE_INFINITY);
19070
+ const shallowest = progress.reduce((low, u) => open7(u) ? Math.min(low, u.pages) : low, Number.POSITIVE_INFINITY);
19344
19071
  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] : []);
19072
+ const due = progress.flatMap((u, index) => open7(u) && u.pages <= round && !capped3.has(units2[index]?.lane.id ?? "") ? [index] : []);
19346
19073
  if (!due.length)
19347
19074
  break;
19348
19075
  for (const index of due) {
@@ -19355,7 +19082,7 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
19355
19082
  capped3.add(unit.lane.id);
19356
19083
  continue;
19357
19084
  }
19358
- stopped = usage.reads >= plan.budgets.maxReads ? "reads" : usage.readBytes >= plan.budgets.maxReadBytes ? "read-bytes" : now() - started >= plan.budgets.maxElapsedMs ? "elapsed" : usage.items >= plan.budgets.maxItems ? "items" : null;
19085
+ stopped = usage.reads >= plan.budgets.maxReads ? "reads" : usage.readBytes >= plan.budgets.maxReadBytes ? "read-bytes" : now() - readFrom >= plan.budgets.maxElapsedMs ? "elapsed" : usage.items >= plan.budgets.maxItems ? "items" : null;
19359
19086
  if (stopped)
19360
19087
  break;
19361
19088
  const readPage2 = /* @__PURE__ */ __name(async (allowance, limit) => {
@@ -19439,6 +19166,20 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
19439
19166
  signal
19440
19167
  );
19441
19168
  const people = peopleOf(items, senderOf);
19169
+ const coverageOf2 = /* @__PURE__ */ new Map();
19170
+ if (ports.coverage) {
19171
+ const byAccount = /* @__PURE__ */ new Map();
19172
+ for (const { provider, account: account2, chat, source } of plan.linkedChats) {
19173
+ if (source === null)
19174
+ continue;
19175
+ const group = byAccount.get(JSON.stringify([provider, account2])) ?? { account: { provider, account: account2 }, chats: [] };
19176
+ group.chats.push(chat);
19177
+ byAccount.set(JSON.stringify([provider, account2]), group);
19178
+ }
19179
+ for (const [key, { account: account2, chats }] of byAccount)
19180
+ for (const row of await ports.coverage(account2, chats))
19181
+ coverageOf2.set(`${key}${row.chatId}`, row);
19182
+ }
19442
19183
  const totals = {
19443
19184
  reads: (previous?.totals.reads ?? 0) + usage.reads,
19444
19185
  readBytes: (previous?.totals.readBytes ?? 0) + usage.readBytes,
@@ -19459,6 +19200,27 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
19459
19200
  seen: [...seen],
19460
19201
  totals
19461
19202
  };
19203
+ const linkedRows = plan.linkedChats.map(({ provider, account: account2, chat, ref, source, lane }) => {
19204
+ const laneUnits = units2.flatMap((unit, index) => unit.lane.id === lane ? [progress[index]] : []);
19205
+ const state = source === null ? "out-of-scope" : laneUnits.every((u) => u?.state === "unavailable") ? "unavailable" : laneUnits.every((u) => u?.state === "pending") ? "pending" : "in-scope";
19206
+ const row = coverageOf2.get(`${JSON.stringify([provider, account2])}${chat}`);
19207
+ return {
19208
+ provider,
19209
+ account: account2,
19210
+ chat,
19211
+ ref,
19212
+ source,
19213
+ lane,
19214
+ state,
19215
+ title: row?.title ?? null,
19216
+ completeness: row?.completeness ?? null,
19217
+ held: row?.held ?? null,
19218
+ ...state === "pending" ? {} : { items: lane === null ? 0 : linkedTaken.get(lane) ?? 0 },
19219
+ ...state === "pending" ? {} : { capped: lane !== null && capped3.has(lane) }
19220
+ };
19221
+ });
19222
+ const states = linkedRows.flatMap((row) => row.completeness ? [row.completeness.state] : []);
19223
+ const completeness = !states.length ? "unknown" : states.includes("partial") ? "partial" : states.includes("unknown") || states.length < linkedRows.filter((row) => row.source !== null).length ? "unknown" : "complete";
19462
19224
  return {
19463
19225
  schemaVersion: 1,
19464
19226
  runKey: plan.runKey,
@@ -19475,18 +19237,8 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
19475
19237
  },
19476
19238
  scope: { origin: plan.scope, sources: plan.sources },
19477
19239
  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
- })),
19489
- fetch: fetched.map((f, index) => ({ source: index, ...f })),
19240
+ linkedChats: linkedRows,
19241
+ fetch: fetched,
19490
19242
  index: indexed,
19491
19243
  units: units2.map((unit, index) => ({
19492
19244
  lane: unit.lane.id,
@@ -19506,7 +19258,7 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
19506
19258
  totals,
19507
19259
  stopped,
19508
19260
  complete: !resumable,
19509
- completeness: "unknown",
19261
+ completeness,
19510
19262
  checkpoint: resumable ? encodeCheckpoint(checkpoint) : null
19511
19263
  };
19512
19264
  }, "gatherProjectEvidence");
@@ -19533,7 +19285,7 @@ var peopleOf = /* @__PURE__ */ __name((items, senderOf) => {
19533
19285
  return [...byKey.values()].sort((a, b) => b.items - a.items || a.name.localeCompare(b.name));
19534
19286
  }, "peopleOf");
19535
19287
 
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
19288
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidate-matching.js
19537
19289
  var normalizedText = /* @__PURE__ */ __name((text2) => text2.normalize("NFKC").toLowerCase().replace(/\s+/gu, " "), "normalizedText");
19538
19290
  var termsOf = /* @__PURE__ */ __name((entry) => [
19539
19291
  { name: entry.name, kind: "canonical" },
@@ -19598,7 +19350,7 @@ var matchProjectCandidates = /* @__PURE__ */ __name((catalog, input) => matchVoc
19598
19350
  omittedMatches: omitted
19599
19351
  })), "matchProjectCandidates");
19600
19352
 
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
19353
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/project-gathering-mentions.js
19602
19354
  var KINDS = ["project", "tag", "topic"];
19603
19355
  var findEvidenceMentions = /* @__PURE__ */ __name(async (vocabulary, gathering, options = {}) => {
19604
19356
  if (typeof vocabulary?.vocabulary !== "function")
@@ -19653,7 +19405,173 @@ var findEvidenceMentions = /* @__PURE__ */ __name(async (vocabulary, gathering,
19653
19405
  };
19654
19406
  }, "findEvidenceMentions");
19655
19407
 
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
19408
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/stored-project-gathering.js
19409
+ var PROJECT_ID = /^project:[1-9]\d*$/;
19410
+ var canonicalProjectRef = /* @__PURE__ */ __name(async (store, reference) => {
19411
+ if (PROJECT_ID.test(reference)) {
19412
+ const catalog = await store.knowledge.vocabulary({ kind: "project" });
19413
+ if (!catalog.entries.some((entry2) => entry2.id === reference.slice(8)))
19414
+ throw new CliError("not_found", "the owner project is unavailable");
19415
+ return reference;
19416
+ }
19417
+ const found = await store.knowledge.resolveVocabulary(reference, { kind: "project" });
19418
+ const [entry] = found.matches;
19419
+ if (found.matches.length !== 1 || !entry)
19420
+ throw new CliError(found.matches.length ? "validation_error" : "not_found", found.matches.length ? `${reference} names ${found.matches.length} projects; give one by its key or project:<id>` : `no project ${reference}`, { candidates: found.matches.map((one) => ({ id: one.id, key: one.key, name: one.name })) });
19421
+ return `project:${entry.id}`;
19422
+ }, "canonicalProjectRef");
19423
+ var projectOf = /* @__PURE__ */ __name(async (store, reference) => {
19424
+ const id2 = /^(project:)?[1-9]\d*$/.test(reference);
19425
+ let ref;
19426
+ try {
19427
+ ref = await canonicalProjectRef(store, id2 && !reference.startsWith("project:") ? `project:${reference}` : reference);
19428
+ } catch (error) {
19429
+ if (!id2 && error instanceof CliError && error.code === "not_found")
19430
+ return { ref: null, name: reference, key: null, aliases: [] };
19431
+ throw error;
19432
+ }
19433
+ const entry = (await store.knowledge.vocabulary({ kind: "project" })).entries.find((one) => one.id === ref.slice(8));
19434
+ if (!entry)
19435
+ throw new CliError("not_found", "the owner project is unavailable");
19436
+ return { ref, name: entry.name, key: entry.key, aliases: entry.aliases.map((alias) => alias.name) };
19437
+ }, "projectOf");
19438
+ var withOwner = /* @__PURE__ */ __name(async (store, reference) => {
19439
+ if (reference.trim() !== "person:me")
19440
+ return reference;
19441
+ const owner = await store.people.owner();
19442
+ if (owner === void 0 || owner.identities.length === 0)
19443
+ throw new CliError("not_found", "person:me: no person is marked as you in the store; mark yours with `<messenger> <profile> contacts link <your id> me`", { reason: "person.no-owner" });
19444
+ return `person:${owner.uid}`;
19445
+ }, "withOwner");
19446
+ var sendersOf = /* @__PURE__ */ __name((person) => person.identities.map((identity) => ({ provider: identity.provider, id: String(identity.id) })), "sendersOf");
19447
+ var contactOf = /* @__PURE__ */ __name(async (store, contact) => {
19448
+ const reference = await withOwner(store, contact);
19449
+ if (!reference.startsWith("person:"))
19450
+ return [{ name: contact }];
19451
+ const person = await store.people.personByUid(reference.slice("person:".length));
19452
+ if (!person)
19453
+ throw new CliError("not_found", `no person ${contact}`, { param: "contact" });
19454
+ const senders = sendersOf(person);
19455
+ const aliases = /* @__PURE__ */ new Set();
19456
+ for (const identity of person.identities)
19457
+ for (const account2 of identity.accounts) {
19458
+ const alias = await store.people.privateContact({ provider: identity.provider, account: account2 }, identity.id).then((one) => one.alias).catch((error) => {
19459
+ if (error instanceof CliError && error.code === "not_found")
19460
+ return null;
19461
+ throw error;
19462
+ });
19463
+ if (alias)
19464
+ aliases.add(alias);
19465
+ }
19466
+ if (!senders.length && !aliases.size)
19467
+ throw new CliError("validation_error", `${contact} has no stored identity or alias to search by; pass a name the texts use to --contact`, { param: "contact" });
19468
+ const names2 = [...aliases].map((name) => ({ name, reference: contact }));
19469
+ return senders.length ? [{ reference: contact, senders }, ...names2] : names2;
19470
+ }, "contactOf");
19471
+ var LINKED_CHATS = 16;
19472
+ var CORE_LIMIT = 16;
19473
+ var memberRefsOf = /* @__PURE__ */ __name(async (store, project) => {
19474
+ if (!project)
19475
+ return [];
19476
+ const refs = [];
19477
+ for (const relation of await store.knowledge.relations(null, project))
19478
+ if (relation.confirmed && relation.kind === "member-of" && relation.to === project && /^person:.+/.test(relation.from))
19479
+ refs.push(relation.from);
19480
+ return [...new Set(refs)].sort();
19481
+ }, "memberRefsOf");
19482
+ var memberLanesOf = /* @__PURE__ */ __name(async (store, project, given, room) => {
19483
+ const lanes = [];
19484
+ const left = [];
19485
+ for (const reference of (await memberRefsOf(store, project)).filter((one) => !given.has(one))) {
19486
+ const person = await store.people.personByUid(reference.slice("person:".length));
19487
+ const senders = person ? sendersOf(person) : [];
19488
+ if (!senders.length)
19489
+ left.push({ source: reference, kind: "member", reason: "no-identity" });
19490
+ else if (lanes.length >= room)
19491
+ left.push({ source: reference, kind: "member", reason: "member-limit" });
19492
+ else
19493
+ lanes.push({ reference, senders });
19494
+ }
19495
+ return { lanes, left };
19496
+ }, "memberLanesOf");
19497
+ var linkedChatsOf = /* @__PURE__ */ __name(async (store, project) => {
19498
+ if (!project)
19499
+ return [];
19500
+ const chats = [];
19501
+ for (const relation of await store.knowledge.relations(null, project)) {
19502
+ if (!relation.confirmed || relation.kind !== "member-of" || relation.to !== project)
19503
+ continue;
19504
+ if (!relation.from.startsWith("chat:"))
19505
+ continue;
19506
+ const reference = parseReference(relation.from);
19507
+ if (reference.type === "chat")
19508
+ chats.push(reference);
19509
+ }
19510
+ return chats.map(({ provider, account: account2, chat }) => ({ provider, account: account2, chat }));
19511
+ }, "linkedChatsOf");
19512
+ var gatherStoredProject = /* @__PURE__ */ __name(async (store, input) => {
19513
+ if (input.asOf !== void 0 && input.after !== void 0 && input.asOf <= input.after)
19514
+ throw new CliError("validation_error", "--before-time must be later than --since-time", { param: "before_time" });
19515
+ if (!store.contextEvidence)
19516
+ throw new CliError("configuration_error", "Stored context reads are unavailable in this store");
19517
+ const project = await projectOf(store, input.project);
19518
+ const { sources, unread, scope } = input.sources;
19519
+ if (sources.length === 0)
19520
+ throw new CliError("not_found", "no selected source holds anything to read", { param: "source" });
19521
+ const contacts = (await Promise.all([...new Set(input.people ?? [])].map((contact) => contactOf(store, contact)))).flat();
19522
+ const aliases = [.../* @__PURE__ */ new Set([...project.aliases, ...input.aliases ?? []])].filter((alias) => alias !== project.name);
19523
+ const searchLanes = 1 + (project.key ? 1 : 0) + aliases.length + (input.keywords?.length ?? 0) + contacts.filter((one) => one.name).length;
19524
+ const room = Math.min(CORE_LIMIT - contacts.length, CORE_LIMIT - searchLanes - contacts.filter((one) => one.senders).length);
19525
+ const members = await memberLanesOf(store, project.ref, new Set(contacts.flatMap((one) => one.reference ?? [])), room);
19526
+ const people = [...contacts, ...members.lanes];
19527
+ const linked = await linkedChatsOf(store, project.ref);
19528
+ const linkedChats = linked.slice(0, LINKED_CHATS);
19529
+ const budgets = {
19530
+ ...input.maxReads === void 0 ? {} : { maxReads: input.maxReads },
19531
+ ...input.limit === void 0 ? {} : { maxItems: input.limit },
19532
+ ...input.maxFetchMs === void 0 ? {} : { maxFetchMs: input.maxFetchMs }
19533
+ };
19534
+ const gathered = await gatherProjectEvidence({
19535
+ evidence: store.contextEvidence,
19536
+ neighbours: storedNeighbours(store),
19537
+ coverage: /* @__PURE__ */ __name((account2, chatIds) => chatCoverage(store, account2, chatIds), "coverage"),
19538
+ ...store.contextIndex ? { index: store.contextIndex } : {},
19539
+ ...input.fetcher ? { fetcher: input.fetcher } : {},
19540
+ ...input.onFetchProgress ? { onFetchProgress: input.onFetchProgress } : {}
19541
+ }, {
19542
+ project: {
19543
+ name: project.name,
19544
+ ...project.key ? { key: project.key } : {},
19545
+ ...aliases.length ? { aliases } : {}
19546
+ },
19547
+ index: input.catchUp === false ? "as-is" : "update",
19548
+ around: { before: input.beforeN ?? 2, after: input.afterN ?? 2 },
19549
+ ...input.keywords?.length ? { keywords: input.keywords } : {},
19550
+ ...people.length ? { people } : {},
19551
+ ...linkedChats.length ? { linkedChats } : {},
19552
+ ...input.fetcher ? { fetch: "before-read" } : {},
19553
+ sources,
19554
+ scope,
19555
+ ...input.days === void 0 ? {} : { lookbackDays: input.days },
19556
+ ...input.after === void 0 ? {} : { after: input.after },
19557
+ ...input.asOf === void 0 ? {} : { asOf: input.asOf },
19558
+ ...input.checkpoint === void 0 ? {} : { checkpoint: input.checkpoint },
19559
+ ...Object.keys(budgets).length ? { budgets } : {},
19560
+ ...input.signal ? { signal: input.signal } : {}
19561
+ });
19562
+ const mentions = await findEvidenceMentions(store.knowledge, gathered, { exclude: project.ref });
19563
+ const unreadChats = [
19564
+ ...gathered.linkedChats.filter((one) => one.state === "out-of-scope").map((one) => ({ source: one.ref, kind: "linked-chat", reason: "out-of-scope" })),
19565
+ ...linked.slice(LINKED_CHATS).map((one) => ({
19566
+ source: formatReference({ type: "chat", ...one }),
19567
+ kind: "linked-chat",
19568
+ reason: "linked-chat-limit"
19569
+ }))
19570
+ ];
19571
+ return { projectRef: project.ref, unreadSources: [...unread, ...unreadChats, ...members.left], ...gathered, mentions };
19572
+ }, "gatherStoredProject");
19573
+
19574
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/ports/messenger.js
19657
19575
  var throughWrapper = /* @__PURE__ */ __name((inner, handled, wrap = (_, call) => call) => new Proxy(handled, {
19658
19576
  get: /* @__PURE__ */ __name((own, key) => {
19659
19577
  if (key in own)
@@ -19670,12 +19588,12 @@ var capability = /* @__PURE__ */ __name((adapter, method, what) => {
19670
19588
  return found.bind(adapter);
19671
19589
  }, "capability");
19672
19590
 
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
19591
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/sends/send-id.js
19674
19592
  import { randomBytes } from "node:crypto";
19675
19593
  var newSendId = /* @__PURE__ */ __name(() => randomBytes(8).readBigInt64BE().toString(), "newSendId");
19676
19594
  var newOperationId = newSendId;
19677
19595
 
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
19596
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/account.js
19679
19597
  var accountService = /* @__PURE__ */ __name((deps) => {
19680
19598
  const online = /* @__PURE__ */ __name(async (command) => {
19681
19599
  if (deps.offline)
@@ -19747,7 +19665,7 @@ var accountService = /* @__PURE__ */ __name((deps) => {
19747
19665
  };
19748
19666
  }, "accountService");
19749
19667
 
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
19668
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/send-time.js
19751
19669
  var MINUTE = 6e4;
19752
19670
  var YEAR = 365 * 24 * 60 * MINUTE;
19753
19671
  var DELAY = /^(\d+)(m|h|d)$/;
@@ -19766,7 +19684,7 @@ var sendTime = /* @__PURE__ */ __name((value, now = Date.now(), flag = "--at-tim
19766
19684
  return new Date(at - at % MINUTE).toISOString();
19767
19685
  }, "sendTime");
19768
19686
 
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
19687
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/admin.js
19770
19688
  var recordMembership = /* @__PURE__ */ __name(async (deps, operationId, done2, change, fix, write) => {
19771
19689
  try {
19772
19690
  const held = await accountStoreIfOpen(deps);
@@ -19795,11 +19713,11 @@ var adminService = /* @__PURE__ */ __name((deps) => {
19795
19713
  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
19714
  return { operationId, chat };
19797
19715
  }, "create"),
19798
- join: /* @__PURE__ */ __name(async (link5) => {
19716
+ join: /* @__PURE__ */ __name(async (link4) => {
19799
19717
  const connection = await online("chats join");
19800
- const join14 = capability(connection, "join", "join a chat by its link");
19718
+ const join11 = capability(connection, "join", "join a chat by its link");
19801
19719
  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 });
19720
+ const joined = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "chat", action: "join" }, () => join11(link4.trim()), (answer) => "requested" in answer ? {} : { chatId: answer.id });
19803
19721
  if ("requested" in joined)
19804
19722
  return { operationId, requested: true };
19805
19723
  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 +19824,12 @@ var adminService = /* @__PURE__ */ __name((deps) => {
19906
19824
  const { already } = await guardedWrite(deps.guard, { operationId, chatId, kind: "chat", action: accept ? "requests.accept" : "requests.decline", people: 1 }, () => answer(chatId, personId, accept));
19907
19825
  return { operationId, chatId, personId, accepted: accept, already };
19908
19826
  }, "answerRequest"),
19909
- answerAllRequests: /* @__PURE__ */ __name(async (chat, accept, { link: link5 }) => {
19827
+ answerAllRequests: /* @__PURE__ */ __name(async (chat, accept, { link: link4 }) => {
19910
19828
  const connection = await online(`chats requests ${accept ? "accept" : "decline"} --all`);
19911
19829
  const list2 = capability(connection, "joinRequests", "read join requests");
19912
19830
  const answerAll = capability(connection, "answerAllJoinRequests", "answer every join request at once");
19913
19831
  const { id: chatId } = await connection.resolve(chat);
19914
- const page = await list2(chatId, { limit: 100, ...link5 === void 0 ? {} : { link: link5 } });
19832
+ const page = await list2(chatId, { limit: 100, ...link4 === void 0 ? {} : { link: link4 } });
19915
19833
  const counted2 = page.total ?? page.items.length;
19916
19834
  if (page.total === void 0 && page.hasMore)
19917
19835
  throw new CliError("validation_error", "too many requests to count; answer them by person, or by --link");
@@ -19925,7 +19843,7 @@ var adminService = /* @__PURE__ */ __name((deps) => {
19925
19843
  action: accept ? "requests.accept" : "requests.decline",
19926
19844
  count: counted2,
19927
19845
  people: counted2
19928
- }, () => answerAll(chatId, accept, link5));
19846
+ }, () => answerAll(chatId, accept, link4));
19929
19847
  return { operationId, chatId, accepted: accept, counted: counted2 };
19930
19848
  }, "answerAllRequests"),
19931
19849
  links: /* @__PURE__ */ __name(async (chat, window2) => {
@@ -19936,18 +19854,18 @@ var adminService = /* @__PURE__ */ __name((deps) => {
19936
19854
  const { id: chatId } = await connection.resolve(chat);
19937
19855
  return { chatId, ...await list2(chatId, window2) };
19938
19856
  }, "links"),
19939
- revokeLink: /* @__PURE__ */ __name(async (chat, link5) => {
19940
- if (link5.trim() === "")
19857
+ revokeLink: /* @__PURE__ */ __name(async (chat, link4) => {
19858
+ if (link4.trim() === "")
19941
19859
  throw new CliError("validation_error", "which link? give it as `chats links list` shows it");
19942
19860
  const connection = await online("chats links remove");
19943
19861
  const revoke = capability(connection, "revokeInviteLink", "revoke an invite link");
19944
19862
  const { id: chatId } = await connection.resolve(chat);
19945
19863
  const operationId = newOperationId();
19946
- const answer = await guardedWrite(deps.guard, { operationId, chatId, kind: "chat", action: "link.revoke" }, () => revoke(chatId, link5.trim()));
19864
+ const answer = await guardedWrite(deps.guard, { operationId, chatId, kind: "chat", action: "link.revoke" }, () => revoke(chatId, link4.trim()));
19947
19865
  return { operationId, chatId, ...answer };
19948
19866
  }, "revokeLink"),
19949
- updateLink: /* @__PURE__ */ __name(async (chat, link5, { approval, expires, maxUses }) => {
19950
- if (link5.trim() === "")
19867
+ updateLink: /* @__PURE__ */ __name(async (chat, link4, { approval, expires, maxUses }) => {
19868
+ if (link4.trim() === "")
19951
19869
  throw new CliError("validation_error", "which link? give it as `chats links list` shows it");
19952
19870
  if (approval === void 0 && expires === void 0 && maxUses === void 0)
19953
19871
  throw new CliError("validation_error", "nothing to change: give --approval, --no-approval, --expire-time or --max-uses");
@@ -19962,7 +19880,7 @@ var adminService = /* @__PURE__ */ __name((deps) => {
19962
19880
  ...maxUses === void 0 ? {} : { maxUses }
19963
19881
  };
19964
19882
  const operationId = newOperationId();
19965
- const answer = await guardedWrite(deps.guard, { operationId, chatId, kind: "chat", action: "link.update" }, () => update(chatId, link5.trim(), change));
19883
+ const answer = await guardedWrite(deps.guard, { operationId, chatId, kind: "chat", action: "link.update" }, () => update(chatId, link4.trim(), change));
19966
19884
  return { operationId, chatId, ...answer };
19967
19885
  }, "updateLink"),
19968
19886
  addMembers: /* @__PURE__ */ __name(async (chat, people, options) => {
@@ -20013,10 +19931,10 @@ var linkLimits = /* @__PURE__ */ __name(({ approval, expires, maxUses }) => {
20013
19931
  return expires === void 0 ? void 0 : sendTime(expires, Date.now(), "--expire-time");
20014
19932
  }, "linkLimits");
20015
19933
 
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
19934
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/ports/traits.js
20017
19935
  var syncsOneChat = /* @__PURE__ */ __name((messenger) => messenger.history !== "store" || messenger.historyOnDemand === true, "syncsOneChat");
20018
19936
 
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
19937
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/mail-search.js
20020
19938
  var THREADS_PAGE = 500;
20021
19939
  var threadsOf = /* @__PURE__ */ __name(async (store, key) => {
20022
19940
  const account2 = await store.accounts.storedAccount(key).catch(() => void 0);
@@ -20095,7 +20013,7 @@ var readMail = /* @__PURE__ */ __name(async (store, locator, { before: before2 =
20095
20013
  return thread.slice(Math.max(0, at - before2), at + after + 1).map((hit) => hit.id === message ? { ...hit, anchor: true } : hit);
20096
20014
  }, "readMail");
20097
20015
 
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
20016
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/message-resolution.js
20099
20017
  var readChatId = /* @__PURE__ */ __name(async (deps, reference, store, account2) => {
20100
20018
  if (deps.reads !== "store")
20101
20019
  return keptChatId(deps.messenger, reference, store, account2);
@@ -20242,7 +20160,7 @@ var senderAmong = /* @__PURE__ */ __name(async (store, accounts, reference) => {
20242
20160
  }
20243
20161
  }, "senderAmong");
20244
20162
 
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
20163
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/search-kind.js
20246
20164
  var NO_MAIL = "no_mail";
20247
20165
  var MAIL = "email";
20248
20166
  var listContextOf = /* @__PURE__ */ __name(async (store, account2, app, stored) => {
@@ -20289,7 +20207,7 @@ var accountsOfKind = /* @__PURE__ */ __name((kind, chosen, held, explicit, comma
20289
20207
  return chosenMail.map(({ provider, account: account2 }) => ({ provider, account: account2 }));
20290
20208
  }, "accountsOfKind");
20291
20209
 
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
20210
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/messages-search.js
20293
20211
  var MAIL_FIELDS = /* @__PURE__ */ new Set(["to", "cc", "bcc", "subject", "mailbox", "label", "is"]);
20294
20212
  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
20213
  var prepareLucene = /* @__PURE__ */ __name(async (store, account2, request, messenger) => {
@@ -20575,6 +20493,23 @@ var searchLucene = /* @__PURE__ */ __name(async (store, account2, request, messe
20575
20493
  ...request.kind === "mail" ? { accounts: mailAccounts.map(({ provider, account: account3 }) => ({ resource: "mail", provider, account: account3 })) } : {}
20576
20494
  };
20577
20495
  }, "searchLucene");
20496
+ var countLucene = /* @__PURE__ */ __name(async (store, account2, request, messenger, cap) => {
20497
+ const prepared = await prepareLucene(store, account2, request, messenger);
20498
+ if (!prepared.scopeAccounts.length)
20499
+ return 0;
20500
+ const count3 = /* @__PURE__ */ __name((execution) => store.queries.countMatches(execution, cap), "count");
20501
+ const mailAccounts = prepared.scopeAccounts.filter(({ provider }) => provider === MAIL);
20502
+ const messages = await count3(prepared.execution);
20503
+ let mail = 0;
20504
+ if (mailAccounts.length)
20505
+ try {
20506
+ mail = await count3({ ...prepared.execution, accounts: mailAccounts, corpus: "mail" });
20507
+ } catch (error) {
20508
+ if (!(request.kind !== "mail" && error instanceof CliError && error.code === "validation_error"))
20509
+ throw error;
20510
+ }
20511
+ return messages === void 0 || mail === void 0 ? void 0 : messages + mail;
20512
+ }, "countLucene");
20578
20513
  var correctionsOf = /* @__PURE__ */ __name((items) => {
20579
20514
  const found = /* @__PURE__ */ new Map();
20580
20515
  for (const { corrections = [] } of items)
@@ -20620,7 +20555,7 @@ var statsLucene = /* @__PURE__ */ __name(async (store, account2, request, messen
20620
20555
  };
20621
20556
  }, "statsLucene");
20622
20557
 
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
20558
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/moment.js
20624
20559
  var AGO = /^(\d+)(m|h|d)$/;
20625
20560
  var AGO_MS = { m: 6e4, h: 36e5, d: 864e5 };
20626
20561
  var DATE = /^\d{4}-\d{2}-\d{2}/;
@@ -20660,7 +20595,7 @@ var dateWindow = /* @__PURE__ */ __name(({ sinceTime, untilTime, zone, now = Dat
20660
20595
  };
20661
20596
  }, "dateWindow");
20662
20597
 
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
20598
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/rankings-selection.js
20664
20599
  var RANKING_SELECTION_BYTES = 64 * 1024;
20665
20600
  var object = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0, "object");
20666
20601
  function invalid(message = "ranking selection is invalid \u2014 obtain a new drilldown from stats top") {
@@ -20829,7 +20764,7 @@ var readRankingSelection = /* @__PURE__ */ __name(async (store, input) => {
20829
20764
  };
20830
20765
  }, "readRankingSelection");
20831
20766
 
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
20767
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/search-record.js
20833
20768
  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
20769
  var searchRecordOf = /* @__PURE__ */ __name((command, params) => ({
20835
20770
  command,
@@ -20839,7 +20774,7 @@ var searchRecordOf = /* @__PURE__ */ __name((command, params) => ({
20839
20774
  fieldsVersion: FIELD_VERSION
20840
20775
  }), "searchRecordOf");
20841
20776
 
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
20777
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/admin-statistics.js
20843
20778
  function invalid2(message) {
20844
20779
  throw new CliError("validation_error", message);
20845
20780
  }
@@ -21133,7 +21068,7 @@ var adminStatisticsService = /* @__PURE__ */ __name((deps) => ({
21133
21068
  }, "evidence")
21134
21069
  }), "adminStatisticsService");
21135
21070
 
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
21071
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/thread.js
21137
21072
  var threadIdOf = /* @__PURE__ */ __name((value) => {
21138
21073
  if (value === void 0)
21139
21074
  return void 0;
@@ -21143,7 +21078,7 @@ var threadIdOf = /* @__PURE__ */ __name((value) => {
21143
21078
  return id2;
21144
21079
  }, "threadIdOf");
21145
21080
 
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
21081
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/questions.js
21147
21082
  var LINKS = /https?:\/\/\S+/g;
21148
21083
  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
21084
  var questions = /* @__PURE__ */ __name((messages, { answerers: answerers2 }) => {
@@ -21170,7 +21105,7 @@ var questions = /* @__PURE__ */ __name((messages, { answerers: answerers2 }) =>
21170
21105
  });
21171
21106
  }, "questions");
21172
21107
 
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
21108
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/chat-stats.js
21174
21109
  var TOP_POSTS = 5;
21175
21110
  var JOINS = /* @__PURE__ */ new Set(["join", "add"]);
21176
21111
  var LEAVES = /* @__PURE__ */ new Set(["leave", "remove"]);
@@ -21187,7 +21122,7 @@ var chatStats = /* @__PURE__ */ __name((messages, { chatId, since, until, comple
21187
21122
  complete: completeness.state === "complete" && events?.more !== true,
21188
21123
  completeness,
21189
21124
  messages: held.length,
21190
- senders: sendersOf(held),
21125
+ senders: sendersOf2(held),
21191
21126
  replies: held.filter((one) => (one.replyToId ?? one.replyTo?.id) !== void 0).length,
21192
21127
  threads: held.filter((one) => replied.has(one.id) && (one.replyToId ?? one.replyTo?.id) === void 0).length,
21193
21128
  reactions: sum(held.map(reactionsOf)),
@@ -21205,7 +21140,7 @@ var chatStats = /* @__PURE__ */ __name((messages, { chatId, since, until, comple
21205
21140
  ...by ? { series: seriesOf(held, events, by, timezone) } : {}
21206
21141
  };
21207
21142
  }, "chatStats");
21208
- var sendersOf = /* @__PURE__ */ __name((messages) => new Set(messages.flatMap(({ senderId }) => senderId ?? [])).size, "sendersOf");
21143
+ var sendersOf2 = /* @__PURE__ */ __name((messages) => new Set(messages.flatMap(({ senderId }) => senderId ?? [])).size, "sendersOf");
21209
21144
  var reactionsOf = /* @__PURE__ */ __name(({ reactions }) => reactions?.total ?? 0, "reactionsOf");
21210
21145
  var counted = /* @__PURE__ */ __name((message, name) => {
21211
21146
  const value = message.providerMetadata?.[name];
@@ -21273,7 +21208,7 @@ var seriesOf = /* @__PURE__ */ __name((messages, events, by, timezone) => {
21273
21208
  return [...rows.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([key, found]) => ({
21274
21209
  key,
21275
21210
  messages: found.messages.length,
21276
- senders: sendersOf(found.messages),
21211
+ senders: sendersOf2(found.messages),
21277
21212
  ...events ? { joined: found.joined, left: found.left } : {}
21278
21213
  }));
21279
21214
  }, "seriesOf");
@@ -21287,7 +21222,7 @@ var median = /* @__PURE__ */ __name((values) => {
21287
21222
  return Math.round(sorted.length % 2 === 0 ? ((sorted[middle - 1] ?? upper) + upper) / 2 : upper);
21288
21223
  }, "median");
21289
21224
 
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
21225
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/member-history.js
21291
21226
  var memberEvents = /* @__PURE__ */ __name((stays, revisions, since = 0) => {
21292
21227
  const events = [];
21293
21228
  for (const stay of stays) {
@@ -21319,7 +21254,7 @@ var memberEvents = /* @__PURE__ */ __name((stays, revisions, since = 0) => {
21319
21254
  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
21255
  }, "memberEvents");
21321
21256
 
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
21257
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/members-audit.js
21323
21258
  var AUDIT_PAGE = 200;
21324
21259
  var AUDIT_BUDGET = 10;
21325
21260
  var AUDIT_PAUSE_MS = 1e3;
@@ -21399,7 +21334,7 @@ var burstJoins = /* @__PURE__ */ __name((members) => {
21399
21334
  return found;
21400
21335
  }, "burstJoins");
21401
21336
 
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
21337
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/chats.js
21403
21338
  var EVENTS_DAYS = 7;
21404
21339
  var TRACKED_DAYS = 30;
21405
21340
  var STATS_PAGE = 1e3;
@@ -21459,7 +21394,7 @@ var chatsService = /* @__PURE__ */ __name((deps) => ({
21459
21394
  }
21460
21395
  const connection = await deps.connection();
21461
21396
  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;
21397
+ 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
21398
  if (card.members !== null || card.kind === "channel")
21464
21399
  return card;
21465
21400
  const held = await accountStoreIfOpen(deps);
@@ -21486,11 +21421,11 @@ var chatsService = /* @__PURE__ */ __name((deps) => ({
21486
21421
  }
21487
21422
  return capability(await deps.connection(), "chatEvents", "read who joined or left")(chat, { since: from });
21488
21423
  }, "events"),
21489
- inspect: /* @__PURE__ */ __name(async (link5) => {
21424
+ inspect: /* @__PURE__ */ __name(async (link4) => {
21490
21425
  if (deps.offline) {
21491
21426
  throw new CliError("validation_error", "`chats inspect` asks the messenger about the link; not with --offline");
21492
21427
  }
21493
- return capability(await deps.connection(), "inspect", "read a link")(link5);
21428
+ return capability(await deps.connection(), "inspect", "read a link")(link4);
21494
21429
  }, "inspect"),
21495
21430
  stats: /* @__PURE__ */ __name(async (chat, { since, by, timezone }) => {
21496
21431
  const store = await accountStore(deps);
@@ -21694,7 +21629,7 @@ var storedMembers = /* @__PURE__ */ __name(async (store, chatId) => {
21694
21629
  return members.length === 0 ? null : members;
21695
21630
  }, "storedMembers");
21696
21631
 
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
21632
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/task-categories.js
21698
21633
  var names = /* @__PURE__ */ __name((categories) => categories.map(({ name }) => name).join(", "), "names");
21699
21634
  var taskCategoryOf = /* @__PURE__ */ __name((categories = DEFAULT_TASK_CATEGORIES, flag = "--category") => (typed) => {
21700
21635
  const name = typed.trim().toLowerCase();
@@ -21744,7 +21679,7 @@ var categorize = /* @__PURE__ */ __name((text2, categories = DEFAULT_TASK_CATEGO
21744
21679
  return best.name;
21745
21680
  }, "categorize");
21746
21681
 
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
21682
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/task-rules.js
21748
21683
  var taskAccount = /* @__PURE__ */ __name(({ provider, account: account2 }) => `${provider}:${account2}`, "taskAccount");
21749
21684
  var RULES_IN = {
21750
21685
  dialog: "all",
@@ -21770,7 +21705,7 @@ var applyTaskRules = /* @__PURE__ */ __name(async (review, { store, account: acc
21770
21705
  const owner = taskAccount(account2);
21771
21706
  const result = { added: 0, closed: 0, review: 0 };
21772
21707
  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) => {
21708
+ const open7 = /* @__PURE__ */ __name(async (message, group, kind) => {
21774
21709
  const { created, review: review2 = 0 } = await tasks.add({
21775
21710
  source: sourceOf2(message),
21776
21711
  sourceKind: "message",
@@ -21827,7 +21762,7 @@ var applyTaskRules = /* @__PURE__ */ __name(async (review, { store, account: acc
21827
21762
  let held = 0;
21828
21763
  for (const [index, { message, kind }] of opens.entries()) {
21829
21764
  if (index >= opens.length - keep2)
21830
- await open10(message, chat.id, kind);
21765
+ await open7(message, chat.id, kind);
21831
21766
  else if (!await hasTask(message)) {
21832
21767
  held += 1;
21833
21768
  onHeld?.({ source: sourceOf2(message), kind, category: categorize(message.text, categories) });
@@ -21950,7 +21885,7 @@ var applyTaskRulesToChats = /* @__PURE__ */ __name(async (store, account2, chatI
21950
21885
  return passes;
21951
21886
  }, "applyTaskRulesToChats");
21952
21887
 
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
21888
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/task-tag-filters.js
21954
21889
  var taskTagFilters = /* @__PURE__ */ __name(async (store, query) => {
21955
21890
  const tags = /* @__PURE__ */ new Map();
21956
21891
  for (const node of query ? walkQuery(query.root) : [])
@@ -21959,7 +21894,7 @@ var taskTagFilters = /* @__PURE__ */ __name(async (store, query) => {
21959
21894
  return tags;
21960
21895
  }, "taskTagFilters");
21961
21896
 
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
21897
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/agenda.js
21963
21898
  var DAY2 = 864e5;
21964
21899
  var CLAIMS = ["none", "mine", "others", "any"];
21965
21900
  var TASK_FIELDS = /* @__PURE__ */ new Set(["tag", "category", "claimed"]);
@@ -21997,9 +21932,9 @@ var agendaService = /* @__PURE__ */ __name((deps, now = Date.now) => ({
21997
21932
  return [];
21998
21933
  throw error;
21999
21934
  }), "find");
22000
- const open10 = await find();
21935
+ const open7 = await find();
22001
21936
  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;
21937
+ const listed = parts.tasks ? await find(queryFilter(parts.tasks, taskColumns(holder, at, tags), { command: "tasks agenda" })) : open7;
22003
21938
  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
21939
  id: task2.id,
22005
21940
  key: task2.key,
@@ -22039,23 +21974,31 @@ var agendaService = /* @__PURE__ */ __name((deps, now = Date.now) => ({
22039
21974
  chat: chat.chatId,
22040
21975
  message: lastMessageId
22041
21976
  }),
22042
- openTasks: open10.filter((task2) => chatOf(task2.source) === chat.chatId).map((task2) => task2.id)
21977
+ openTasks: open7.filter((task2) => chatOf(task2.source) === chat.chatId).map((task2) => task2.id)
22043
21978
  }));
21979
+ const silentFor = /* @__PURE__ */ __name((chat) => at - Date.parse(chat.lastMessageAt), "silentFor");
21980
+ const shown = {
21981
+ owed: chats.filter((chat) => chat.lastFromOwner === false && silentFor(chat) >= unanswered2),
21982
+ waiting: chats.filter((chat) => chat.lastFromOwner === true && silentFor(chat) >= waiting),
21983
+ unsynced: chats.filter((chat) => chat.lastMessage === null)
21984
+ };
21985
+ const covered = new Map((await chatCoverage(store, account2, Object.values(shown).flatMap((list2) => list2.map(({ chatId }) => chatId)))).map((one) => [one.chatId, one]));
21986
+ const withCoverage = /* @__PURE__ */ __name((list2) => list2.map((chat) => ({ ...chat, coverage: covered.get(chat.chatId) })), "withCoverage");
22044
21987
  const inList = new Set((await store.tasks.categories()).map(({ name }) => name));
22045
21988
  const unlisted = /* @__PURE__ */ new Map();
22046
- for (const { category } of open10)
21989
+ for (const { category } of open7)
22047
21990
  if (category && !inList.has(category))
22048
21991
  unlisted.set(category, (unlisted.get(category) ?? 0) + 1);
22049
- const silentFor = /* @__PURE__ */ __name((chat) => at - Date.parse(chat.lastMessageAt), "silentFor");
22050
21992
  return {
22051
21993
  at: new Date(at).toISOString(),
21994
+ since: new Date(at - within).toISOString(),
22052
21995
  account: taskAccount(account2),
22053
21996
  storedAt: activity.storedAt,
22054
21997
  stale: activity.storedAt === null || at - Date.parse(activity.storedAt) > DAY2,
22055
21998
  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),
21999
+ owed: withCoverage(shown.owed),
22000
+ waiting: withCoverage(shown.waiting),
22001
+ unsynced: withCoverage(shown.unsynced),
22059
22002
  assigned,
22060
22003
  unlistedCategories: [...unlisted].sort().map(([name, openTasks]) => ({ name, openTasks }))
22061
22004
  };
@@ -22141,7 +22084,19 @@ var agendaItem = /* @__PURE__ */ __name((shown) => {
22141
22084
  last_message: one.lastMessage,
22142
22085
  last_message_at: one.lastMessageAt,
22143
22086
  last_from_owner: one.lastFromOwner,
22144
- open_tasks: one.openTasks
22087
+ open_tasks: one.openTasks,
22088
+ completeness: {
22089
+ state: one.coverage.completeness.state,
22090
+ up_to_date: one.coverage.completeness.upToDate,
22091
+ gaps: one.coverage.completeness.gaps,
22092
+ reaches_start: one.coverage.completeness.reachesStart,
22093
+ fetched_at: one.coverage.completeness.fetchedAt
22094
+ },
22095
+ held: {
22096
+ messages: one.coverage.held.messages,
22097
+ oldest_at: one.coverage.held.oldestAt,
22098
+ newest_at: one.coverage.held.newestAt
22099
+ }
22145
22100
  }), "chat");
22146
22101
  return {
22147
22102
  at: shown.at,
@@ -22181,10 +22136,10 @@ var agendaItem = /* @__PURE__ */ __name((shown) => {
22181
22136
  };
22182
22137
  }, "agendaItem");
22183
22138
 
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
22139
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/archive.js
22185
22140
  import { setTimeout as sleep3 } from "node:timers/promises";
22186
22141
 
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
22142
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/backfill-estimate.js
22188
22143
  var REQUEST_MS = 400;
22189
22144
  var estimateBackfill = /* @__PURE__ */ __name(({ ranges, held, newest, page, maxPages, pauseMs }) => {
22190
22145
  const lowest = ranges[0];
@@ -22207,13 +22162,13 @@ var estimateBackfill = /* @__PURE__ */ __name(({ ranges, held, newest, page, max
22207
22162
  };
22208
22163
  }, "estimateBackfill");
22209
22164
 
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
22165
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/recovery.js
22211
22166
  var withRecovery = /* @__PURE__ */ __name((error) => ({
22212
22167
  ...error,
22213
22168
  retryable: typeof error.retryable === "boolean" ? error.retryable : error.code === "rate_limited" || error.status === 429
22214
22169
  }), "withRecovery");
22215
22170
 
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
22171
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/batch.js
22217
22172
  var actionable = /* @__PURE__ */ __name((error) => {
22218
22173
  if (isCliFailure(error))
22219
22174
  return withRecovery({ code: error.code, message: error.message, ...error.details });
@@ -22296,7 +22251,7 @@ var mergeBatches = /* @__PURE__ */ __name((a, b) => {
22296
22251
  };
22297
22252
  }, "mergeBatches");
22298
22253
 
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
22254
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/patience.js
22300
22255
  import { setTimeout as sleep2 } from "node:timers/promises";
22301
22256
  var LONGEST_WAIT_MS = 5 * 60 * 1e3;
22302
22257
  var patiently = /* @__PURE__ */ __name(async (request, note, stop) => {
@@ -22319,7 +22274,7 @@ var patiently = /* @__PURE__ */ __name(async (request, note, stop) => {
22319
22274
  }
22320
22275
  }, "patiently");
22321
22276
 
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
22277
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/conversations/link.js
22323
22278
  var RULES_VERSION = 5;
22324
22279
  var LOOK_BACK = 50;
22325
22280
  var SAME_SENDER_WITHIN = 10;
@@ -22351,7 +22306,7 @@ var linkMessages = /* @__PURE__ */ __name((messages, { handles = /* @__PURE__ */
22351
22306
  }
22352
22307
  return { links, parents, conversations };
22353
22308
  }, "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");
22309
+ var replyLink = /* @__PURE__ */ __name((message, held) => message.replyToId !== void 0 && held.has(message.replyToId) ? [link2(message, message.replyToId, "provider", "reply", 1, "reply")] : [], "replyLink");
22355
22310
  var mentionLinks = /* @__PURE__ */ __name((message, window2, handles) => {
22356
22311
  const links = [];
22357
22312
  const people = new Set([...mentioned(message.text, handles)].flatMap((handle) => handles.get(handle) ?? []));
@@ -22362,7 +22317,7 @@ var mentionLinks = /* @__PURE__ */ __name((message, window2, handles) => {
22362
22317
  continue;
22363
22318
  const target2 = latest(window2, (candidate) => candidate.senderId === sender && sameThread(candidate, message));
22364
22319
  if (target2)
22365
- links.push(link3(message, target2.id, "rule", "mention", 0.8, "mention-v1"));
22320
+ links.push(link2(message, target2.id, "rule", "mention", 0.8, "mention-v1"));
22366
22321
  }
22367
22322
  return links;
22368
22323
  }, "mentionLinks");
@@ -22371,7 +22326,7 @@ var sameSenderLink = /* @__PURE__ */ __name((message, window2) => {
22371
22326
  return [];
22372
22327
  const at = Date.parse(message.timestamp);
22373
22328
  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")] : [];
22329
+ return target2 ? [link2(message, target2.id, "rule", "same_sender", 0.5, "same-sender-v2")] : [];
22375
22330
  }, "sameSenderLink");
22376
22331
  var mentioned = /* @__PURE__ */ __name((text2, handles) => {
22377
22332
  const found = /* @__PURE__ */ new Set();
@@ -22407,9 +22362,9 @@ var latest = /* @__PURE__ */ __name((window2, matches) => {
22407
22362
  return void 0;
22408
22363
  }, "latest");
22409
22364
  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");
22365
+ var link2 = /* @__PURE__ */ __name((message, parentId, source, kind, confidence, method) => ({ messageId: message.id, parentId, source, kind, confidence, method }), "link");
22411
22366
 
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
22367
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/images/context/index.js
22413
22368
  var CONTEXT_MESSAGES = 3;
22414
22369
  var CONTEXT_MINUTES = 10;
22415
22370
  var MAX_CHARS = 1200;
@@ -22433,12 +22388,12 @@ var context = {
22433
22388
  }, "describe")
22434
22389
  };
22435
22390
 
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
22391
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/images/registry.js
22437
22392
  var BUILT_INS = [context];
22438
22393
  var providers = [...BUILT_INS];
22439
22394
  var registeredImageProviders = /* @__PURE__ */ __name(() => providers, "registeredImageProviders");
22440
22395
 
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
22396
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/conversations.js
22442
22397
  var READ_PAGE = 5e3;
22443
22398
  var CHAIN = 50;
22444
22399
  var CONVERSATION_QUERY = {
@@ -22569,7 +22524,7 @@ var conversationsService = /* @__PURE__ */ __name((deps) => {
22569
22524
  }, "clearAnswers"),
22570
22525
  links: /* @__PURE__ */ __name(async (chat, message) => {
22571
22526
  const { store, chatId } = await found(chat);
22572
- const chosenOf = /* @__PURE__ */ __name((links) => links.find((link5) => !link5.stale), "chosenOf");
22527
+ const chosenOf = /* @__PURE__ */ __name((links) => links.find((link4) => !link4.stale), "chosenOf");
22573
22528
  const own = await store.conversations.links(chatId, message);
22574
22529
  const chosen = chosenOf(own);
22575
22530
  const chain = [];
@@ -22579,7 +22534,7 @@ var conversationsService = /* @__PURE__ */ __name((deps) => {
22579
22534
  chain.push(parent);
22580
22535
  parent = chosenOf(await store.conversations.links(chatId, parent))?.parentId ?? null;
22581
22536
  }
22582
- return { chat: chatId, message, links: own.map((link5) => ({ ...link5, chosen: link5 === chosen })), chain };
22537
+ return { chat: chatId, message, links: own.map((link4) => ({ ...link4, chosen: link4 === chosen })), chain };
22583
22538
  }, "links")
22584
22539
  };
22585
22540
  }, "conversationsService");
@@ -22590,7 +22545,7 @@ var sized = /* @__PURE__ */ __name((size4) => {
22590
22545
  return size4;
22591
22546
  }, "sized");
22592
22547
 
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
22548
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/embeddings-maintenance.js
22594
22549
  var REFRESH_BOUNDS = { maxChats: 20, maxChunks: 2e3 };
22595
22550
  var MESSAGE_PAGE = 5e3;
22596
22551
  var PER_SESSION = 8;
@@ -22609,7 +22564,7 @@ var embeddingTarget = /* @__PURE__ */ __name((deps, choice = DEFAULT_TEXT_MODEL)
22609
22564
  price: remote.price,
22610
22565
  installed: true,
22611
22566
  perBatch: PER_REQUEST * concurrency,
22612
- open: /* @__PURE__ */ __name(async () => (await import("./remote-WCPRU73L.js")).openRemote(remote, apiKey, { concurrency }), "open")
22567
+ open: /* @__PURE__ */ __name(async () => (await import("./remote-ZP5XTDCC.js")).openRemote(remote, apiKey, { concurrency }), "open")
22613
22568
  };
22614
22569
  }
22615
22570
  const model = textModel(choice);
@@ -22626,7 +22581,7 @@ var embeddingTarget = /* @__PURE__ */ __name((deps, choice = DEFAULT_TEXT_MODEL)
22626
22581
  if (!isTextModelInstalled(model, directory2))
22627
22582
  throw notDownloaded(model.id);
22628
22583
  if (apart) {
22629
- const { openProcess } = await import("./process-IX5YWGDP.js");
22584
+ const { openProcess } = await import("./process-XVDX4SPD.js");
22630
22585
  return openProcess(model, directory2, { threads: threads ?? defaultThreads() });
22631
22586
  }
22632
22587
  return openEmbedder(model, directory2, { threads: threads ?? defaultThreads() });
@@ -22915,7 +22870,7 @@ var shaped = /* @__PURE__ */ __name(({ chatId, builtAt, algorithmVersion, pendin
22915
22870
  return { ...one, state };
22916
22871
  }, "shaped");
22917
22872
 
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
22873
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/search-catchup.js
22919
22874
  var CATCH_UP_BOUNDS = { maxChunks: 500, maxMessages: 1e4, timeMs: 3e4 };
22920
22875
  var validateCatchUpBounds = /* @__PURE__ */ __name((options) => {
22921
22876
  for (const [key, value, maximum] of [
@@ -22968,7 +22923,7 @@ var catchUpSearch = /* @__PURE__ */ __name(async (deps, chat, options, signal, c
22968
22923
  }
22969
22924
  }, "catchUpSearch");
22970
22925
 
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
22926
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/archive.js
22972
22927
  var pushed = /* @__PURE__ */ __name((deps, what) => {
22973
22928
  if (deps.reads === "store") {
22974
22929
  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`);
@@ -23097,6 +23052,8 @@ var archiveService = /* @__PURE__ */ __name((deps) => {
23097
23052
  ...options,
23098
23053
  catchUp: catchingUp ? options.catchUp ?? {} : false
23099
23054
  });
23055
+ const finished = /* @__PURE__ */ __name(() => options.onChat?.({ chats: chats.length, done: answer.items.length, fetched: answer.fetched }), "finished");
23056
+ finished();
23100
23057
  for (const chat of chats) {
23101
23058
  if (options.stop.aborted || batch.stopped) {
23102
23059
  answer.stopped = true;
@@ -23104,6 +23061,7 @@ var archiveService = /* @__PURE__ */ __name((deps) => {
23104
23061
  }
23105
23062
  if (await upToDate(chat)) {
23106
23063
  answer.items.push({ chat: chat.id, title: chat.title, fetched: 0, complete: true, current: true });
23064
+ finished();
23107
23065
  continue;
23108
23066
  }
23109
23067
  try {
@@ -23130,6 +23088,7 @@ var archiveService = /* @__PURE__ */ __name((deps) => {
23130
23088
  const issue = batch.fail(chat.id, "history", error);
23131
23089
  answer.items.push({ chat: chat.id, title: chat.title, fetched: 0, complete: false, error: issue.code, issue });
23132
23090
  }
23091
+ finished();
23133
23092
  }
23134
23093
  if (batch.failed > 0)
23135
23094
  answer.batch = batch.result();
@@ -23285,8 +23244,8 @@ var timeOfKey = /* @__PURE__ */ __name(async (store, account2, chatId, key, byTi
23285
23244
  return message?.timestamp ?? fallback;
23286
23245
  }, "timeOfKey");
23287
23246
 
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";
23247
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/archive-gaps.js
23248
+ import { createHash as createHash6, randomUUID as randomUUID4 } from "node:crypto";
23290
23249
  var GAP_BOUNDS = { maxGaps: 5, limit: 500, timeMs: 3e4 };
23291
23250
  var validateRepair = /* @__PURE__ */ __name((messenger, options) => {
23292
23251
  const maxGaps = options.maxGaps ?? GAP_BOUNDS.maxGaps;
@@ -23345,7 +23304,7 @@ var gapsService = /* @__PURE__ */ __name((deps) => {
23345
23304
  if (options.fingerprint !== void 0 && options.fingerprint !== before2.fingerprint)
23346
23305
  throw new CliError("validation_error", "the gap plan changed; inspect it again before repairing");
23347
23306
  const store = await deps.store();
23348
- const holder = randomUUID6();
23307
+ const holder = randomUUID4();
23349
23308
  if (!await store.sync.claim(before2.account, before2.chat, "gaps", holder, timeMs + 5e3))
23350
23309
  throw new CliError("validation_error", "another gap repair holds this chat; retry after it finishes");
23351
23310
  const started = Date.now();
@@ -23422,19 +23381,19 @@ var gapsService = /* @__PURE__ */ __name((deps) => {
23422
23381
  return { plan, repair };
23423
23382
  }, "gapsService");
23424
23383
 
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
23384
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/attachments.js
23426
23385
  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";
23386
+ import { constants as constants2 } from "node:fs";
23387
+ import { open as open6, readFile, stat as stat2 } from "node:fs/promises";
23429
23388
 
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";
23389
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/attachments/directory.js
23390
+ import { lstat as lstat2, readdir as readdir2, realpath as realpath3 } from "node:fs/promises";
23391
+ import { basename as basename4, join as join8, relative as relative2, sep as sep2 } from "node:path";
23433
23392
 
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
23393
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/sends/upload.js
23435
23394
  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";
23395
+ import { open as open4, stat } from "node:fs/promises";
23396
+ import { basename as basename3, dirname as dirname3, extname, isAbsolute as isAbsolute2, relative, resolve as resolve5, sep } from "node:path";
23438
23397
  var MAX_BUFFERED_UPLOAD_BYTES = 256 * 1024 * 1024;
23439
23398
  var uploadSize = /* @__PURE__ */ __name((source) => source.kind === "file" ? source.size : source.bytes.byteLength, "uploadSize");
23440
23399
  var PHOTO = /* @__PURE__ */ new Set([".jpg", ".jpeg", ".png", ".webp"]);
@@ -23450,7 +23409,7 @@ var SIGNATURES = {
23450
23409
  }, ".webp")
23451
23410
  };
23452
23411
  var fileHead = /* @__PURE__ */ __name(async (path) => {
23453
- const file = await open7(path, "r");
23412
+ const file = await open4(path, "r");
23454
23413
  try {
23455
23414
  const head = new Uint8Array(12);
23456
23415
  const { bytesRead } = await file.read(head, 0, head.length, 0);
@@ -23535,7 +23494,7 @@ var refusedPlace = /* @__PURE__ */ __name((path, app, env, platform = process.pl
23535
23494
  real = resolve5(realpathSync(ancestor), relative(ancestor, resolve5(path)));
23536
23495
  break;
23537
23496
  } catch {
23538
- const parent = dirname5(ancestor);
23497
+ const parent = dirname3(ancestor);
23539
23498
  if (parent === ancestor)
23540
23499
  break;
23541
23500
  ancestor = parent;
@@ -23587,7 +23546,7 @@ var readUpload = /* @__PURE__ */ __name(async (kind, path, { app, env = process.
23587
23546
  if (head !== void 0 && SIGNATURES[extension]?.(head) !== true) {
23588
23547
  throw new CliError("validation_error", `${path} is not a ${typesText(photoTypes ?? [])} image inside`);
23589
23548
  }
23590
- return { kind, name: basename5(path), source: { kind: "file", path: resolve5(path), size: size4 } };
23549
+ return { kind, name: basename3(path), source: { kind: "file", path: resolve5(path), size: size4 } };
23591
23550
  }, "readUpload");
23592
23551
  var checkFilename = /* @__PURE__ */ __name((filename, files) => {
23593
23552
  if (files.length === 0)
@@ -23633,28 +23592,28 @@ var readStickerFile = /* @__PURE__ */ __name(async (path, maxBytes, read) => {
23633
23592
  return { name, source };
23634
23593
  }, "readStickerFile");
23635
23594
 
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
23595
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/attachments/directory.js
23637
23596
  var MAX_FILES = 1e4;
23638
23597
  var directoryPaths = /* @__PURE__ */ __name(async (store, chat, directory2, app, env) => {
23639
23598
  if (refusedPlace(directory2, app, env))
23640
23599
  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(() => {
23600
+ const root = await realpath3(directory2).catch(() => {
23642
23601
  throw new CliError("validation_error", "--from-dir must name an existing directory");
23643
23602
  });
23644
- const names2 = await readdir3(root).catch(() => {
23603
+ const names2 = await readdir2(root).catch(() => {
23645
23604
  throw new CliError("validation_error", "--from-dir must name a readable directory");
23646
23605
  });
23647
23606
  if (names2.length > MAX_FILES)
23648
23607
  throw new CliError("validation_error", "--from-dir holds too many files; use a smaller directory");
23649
23608
  const files = /* @__PURE__ */ new Map();
23650
23609
  for (const name of names2) {
23651
- const path = join11(root, name);
23652
- const info = await lstat5(path);
23610
+ const path = join8(root, name);
23611
+ const info = await lstat2(path);
23653
23612
  if (info.isSymbolicLink())
23654
23613
  throw new CliError("validation_error", "--from-dir cannot read symbolic links");
23655
23614
  if (!info.isFile())
23656
23615
  continue;
23657
- const canonical2 = await realpath6(path);
23616
+ const canonical2 = await realpath3(path);
23658
23617
  if (refusedPlace(canonical2, app, env))
23659
23618
  throw new CliError("validation_error", "--from-dir cannot read credential files, the CLI's own files or the message store");
23660
23619
  const inside2 = relative2(root, canonical2);
@@ -23672,20 +23631,20 @@ var directoryPaths = /* @__PURE__ */ __name(async (store, chat, directory2, app,
23672
23631
  group.push(file);
23673
23632
  groups.set(file.messageId, group);
23674
23633
  if (file.name)
23675
- counts.set(basename6(file.name), (counts.get(basename6(file.name)) ?? 0) + 1);
23634
+ counts.set(basename4(file.name), (counts.get(basename4(file.name)) ?? 0) + 1);
23676
23635
  }
23677
23636
  const choices = /* @__PURE__ */ new Map();
23678
23637
  for (const group of groups.values()) {
23679
23638
  group.sort((a, b) => a.position - b.position);
23680
23639
  const candidates = group.map((file, index) => {
23681
23640
  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);
23641
+ return [...files].filter(([name]) => name === prefix || name.startsWith(`${prefix}.`) || file.name !== null && name === `${prefix}-${basename4(file.name)}`).map(([, path]) => path);
23683
23642
  });
23684
23643
  if (candidates.some((paths) => paths.length > 1))
23685
23644
  throw new CliError("validation_error", "more than one directory file matches a download ordinal");
23686
23645
  const complete = candidates.every((paths) => paths.length === 1);
23687
23646
  group.forEach((file, index) => {
23688
- const own = file.name === null ? void 0 : basename6(file.name);
23647
+ const own = file.name === null ? void 0 : basename4(file.name);
23689
23648
  const named2 = own && counts.get(own) === 1 ? files.get(own) : void 0;
23690
23649
  const canonical2 = complete ? candidates[index]?.[0] : void 0;
23691
23650
  if (named2 && canonical2 && named2 !== canonical2 || !complete && own && files.has(own) && (counts.get(own) ?? 0) > 1)
@@ -23702,15 +23661,15 @@ var directoryPaths = /* @__PURE__ */ __name(async (store, chat, directory2, app,
23702
23661
  return choices;
23703
23662
  }, "directoryPaths");
23704
23663
 
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
23664
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/attachments/documents.js
23706
23665
  import { posix } from "node:path";
23707
23666
 
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
23667
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/attachments/container.js
23709
23668
  import { setImmediate as tick } from "node:timers/promises";
23710
23669
  import { crc32 } from "node:zlib";
23711
23670
  var import_xmldom = __toESM(require_lib(), 1);
23712
23671
 
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
23672
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/attachments/encoding.js
23714
23673
  var import_chardet = __toESM(require_lib2(), 1);
23715
23674
  var import_iconv_lite = __toESM(require_lib3(), 1);
23716
23675
  var SAMPLE = 65536;
@@ -23812,7 +23771,7 @@ var decodeXml = /* @__PURE__ */ __name((bytes2) => {
23812
23771
  return result.text;
23813
23772
  }, "decodeXml");
23814
23773
 
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
23774
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/attachments/container.js
23816
23775
  var MAX_PART = 10 * 1024 * 1024;
23817
23776
  var MAX_ENTRIES = 1e3;
23818
23777
  var decoder = new TextDecoder("utf-8", { fatal: true });
@@ -24027,7 +23986,7 @@ var elements = /* @__PURE__ */ __name((node, name, namespace) => {
24027
23986
  return found;
24028
23987
  }, "elements");
24029
23988
 
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
23989
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/attachments/sheets.js
24031
23990
  var columnName = /* @__PURE__ */ __name((column) => {
24032
23991
  let name = "";
24033
23992
  for (let rest = column; rest > 0; rest = Math.floor((rest - 1) / 26))
@@ -24082,7 +24041,7 @@ var sheetText = /* @__PURE__ */ __name((sheets2, maxChars = MAX_TEXT_CHARS) => {
24082
24041
  return { text: parts.join("").trim(), truncated: false };
24083
24042
  }, "sheetText");
24084
24043
 
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
24044
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/attachments/documents.js
24086
24045
  var OFFICE = "urn:oasis:names:tc:opendocument:xmlns:office:1.0";
24087
24046
  var TEXT = "urn:oasis:names:tc:opendocument:xmlns:text:1.0";
24088
24047
  var TABLE = "urn:oasis:names:tc:opendocument:xmlns:table:1.0";
@@ -24482,27 +24441,27 @@ var readDocument = /* @__PURE__ */ __name(async (bytes2, kind, signal) => {
24482
24441
  }
24483
24442
  }, "readDocument");
24484
24443
 
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
24444
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/attachments/extract.js
24486
24445
  import { extname as extname3 } from "node:path";
24487
24446
 
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
24447
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/readers/engine.js
24489
24448
  import { readFileSync } from "node:fs";
24490
- import { dirname as dirname6, extname as extname2, join as join12 } from "node:path";
24449
+ import { dirname as dirname4, extname as extname2, join as join9 } from "node:path";
24491
24450
  import { fileURLToPath } from "node:url";
24492
24451
  var BUILT_IN = ["unpdf", "mammoth", "word-extractor", "linkedom", "defuddle/node"];
24493
24452
  var ENGINES = [...BUILT_IN, "@napi-rs/canvas"];
24494
24453
  var isMissing = /* @__PURE__ */ __name((error, name) => error?.code === "ERR_MODULE_NOT_FOUND" && String(error.message).includes(name), "isMissing");
24495
24454
  var versionOf = /* @__PURE__ */ __name((name) => {
24496
24455
  try {
24497
- let directory2 = dirname6(fileURLToPath(resolveFrom(new URL("readers/engine.js", import.meta.resolve("@wirecat/cli-core")).href, name)));
24456
+ let directory2 = dirname4(fileURLToPath(resolveFrom(new URL("readers/engine.js", import.meta.resolve("@wirecat/cli-core")).href, name)));
24498
24457
  for (let depth = 0; depth < 6; depth += 1) {
24499
24458
  try {
24500
- const manifest = JSON.parse(readFileSync(join12(directory2, "package.json"), "utf8"));
24459
+ const manifest = JSON.parse(readFileSync(join9(directory2, "package.json"), "utf8"));
24501
24460
  if (manifest.name === name && manifest.version)
24502
24461
  return `${name}@${manifest.version}`;
24503
24462
  } catch {
24504
24463
  }
24505
- directory2 = dirname6(directory2);
24464
+ directory2 = dirname4(directory2);
24506
24465
  }
24507
24466
  } catch {
24508
24467
  }
@@ -24546,7 +24505,7 @@ var derived = /* @__PURE__ */ __name((bytes2, extractor, read) => {
24546
24505
  }
24547
24506
  }, "derived");
24548
24507
 
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
24508
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/readers/image/index.js
24550
24509
  var IMAGES = /* @__PURE__ */ new Set([".jpg", ".jpeg", ".png", ".webp", ".gif", ".heic", ".tif", ".tiff", ".bmp"]);
24551
24510
  var image2 = {
24552
24511
  id: "image",
@@ -24555,7 +24514,7 @@ var image2 = {
24555
24514
  read: /* @__PURE__ */ __name(async () => ({ status: "needs-agent" }), "read")
24556
24515
  };
24557
24516
 
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
24517
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/readers/doc/index.js
24559
24518
  var OLE = "\xD0\xCF\xE0\xA1\xB1\xE1";
24560
24519
  var doc = {
24561
24520
  id: "doc",
@@ -24567,7 +24526,7 @@ var doc = {
24567
24526
  }), "read")
24568
24527
  };
24569
24528
 
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
24529
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/readers/docx/index.js
24571
24530
  var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
24572
24531
  var docx = {
24573
24532
  id: "docx",
@@ -24580,7 +24539,7 @@ var docx = {
24580
24539
  }), "read")
24581
24540
  };
24582
24541
 
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
24542
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/attachments/markup.js
24584
24543
  var import_iconv_lite2 = __toESM(require_lib3(), 1);
24585
24544
  var RTF_SKIPPED = /* @__PURE__ */ new Set([
24586
24545
  "fonttbl",
@@ -24723,11 +24682,11 @@ var dropHidden = /* @__PURE__ */ __name((source) => {
24723
24682
  const unclosed = /* @__PURE__ */ new Set();
24724
24683
  let out = "";
24725
24684
  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))
24685
+ for (const open7 of source.matchAll(HTML_DROPPED_OPEN)) {
24686
+ const name = open7[1].toLowerCase();
24687
+ if (open7.index < kept || unclosed.has(name))
24729
24688
  continue;
24730
- const gt = source.indexOf(">", open10.index + open10[0].length);
24689
+ const gt = source.indexOf(">", open7.index + open7[0].length);
24731
24690
  if (gt < 0)
24732
24691
  break;
24733
24692
  const close = HTML_DROPPED_CLOSE.get(name);
@@ -24737,7 +24696,7 @@ var dropHidden = /* @__PURE__ */ __name((source) => {
24737
24696
  unclosed.add(name);
24738
24697
  continue;
24739
24698
  }
24740
- out += source.slice(kept, open10.index);
24699
+ out += source.slice(kept, open7.index);
24741
24700
  kept = end.index + end[0].length;
24742
24701
  }
24743
24702
  return out + source.slice(kept);
@@ -24756,7 +24715,7 @@ var htmlText = /* @__PURE__ */ __name((source) => {
24756
24715
  }, "htmlText");
24757
24716
  var safeChar = /* @__PURE__ */ __name((code, fallback) => code > 0 && code <= 1114111 ? String.fromCodePoint(code) : fallback, "safeChar");
24758
24717
 
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
24718
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/readers/html/page.js
24760
24719
  var clean = /* @__PURE__ */ __name((value) => typeof value === "string" ? value.replace(/\s+/g, " ").trim() : "", "clean");
24761
24720
  var namesIn = /* @__PURE__ */ __name((value) => [value].flat().map((entry) => typeof entry === "string" ? clean(entry) : clean(entry?.name)).filter(Boolean).join(", "), "namesIn");
24762
24721
  var jsonLdNodes = /* @__PURE__ */ __name((document) => {
@@ -24812,7 +24771,7 @@ var markdownSections = /* @__PURE__ */ __name((text2) => {
24812
24771
  return found.map((section, index) => ({ ...section, end: found[index + 1]?.start ?? text2.length }));
24813
24772
  }, "markdownSections");
24814
24773
 
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
24774
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/readers/html/index.js
24816
24775
  var HTML = /* @__PURE__ */ new Set([".html", ".htm", ".xhtml"]);
24817
24776
  var first = /* @__PURE__ */ __name((...values) => values.find((value) => typeof value === "string" && value !== ""), "first");
24818
24777
  var loaded = /* @__PURE__ */ __name(async (load, name) => {
@@ -24850,8 +24809,8 @@ var readPage = /* @__PURE__ */ __name(async (source, load) => {
24850
24809
  };
24851
24810
  }, "readPage");
24852
24811
  var titleOf = /* @__PURE__ */ __name((source) => {
24853
- const open10 = /<title/i.exec(source);
24854
- const gt = open10 ? source.indexOf(">", open10.index + open10[0].length) : -1;
24812
+ const open7 = /<title/i.exec(source);
24813
+ const gt = open7 ? source.indexOf(">", open7.index + open7[0].length) : -1;
24855
24814
  if (gt < 0)
24856
24815
  return "";
24857
24816
  const close = /<\/title\s*>/gi;
@@ -24883,7 +24842,7 @@ var html = {
24883
24842
  }, "read")
24884
24843
  };
24885
24844
 
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
24845
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/readers/office/index.js
24887
24846
  var office = {
24888
24847
  id: "office",
24889
24848
  version: documentExtractor("odt"),
@@ -24894,7 +24853,7 @@ var office = {
24894
24853
  }, "read")
24895
24854
  };
24896
24855
 
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
24856
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/readers/pdf/index.js
24898
24857
  var pdf = {
24899
24858
  id: "pdf",
24900
24859
  version: "unpdf",
@@ -24961,7 +24920,7 @@ var pdf = {
24961
24920
  }), "read")
24962
24921
  };
24963
24922
 
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
24923
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/readers/plain/index.js
24965
24924
  var PLAIN = /* @__PURE__ */ new Set([".txt", ".md", ".markdown", ".csv", ".tsv", ".json", ".log"]);
24966
24925
  var isPlain = /* @__PURE__ */ __name((hint) => PLAIN.has(extensionOf(hint)) || hint.mime?.startsWith("text/") || hint.mime === "application/json", "isPlain");
24967
24926
  var readPlain = /* @__PURE__ */ __name((bytes2) => {
@@ -24981,7 +24940,7 @@ var plain = {
24981
24940
  read: /* @__PURE__ */ __name(async (bytes2) => readPlain(bytes2), "read")
24982
24941
  };
24983
24942
 
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
24943
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/readers/rtf/index.js
24985
24944
  var rtf = {
24986
24945
  id: "rtf",
24987
24946
  version: "v1",
@@ -24989,10 +24948,10 @@ var rtf = {
24989
24948
  read: /* @__PURE__ */ __name(async (bytes2) => derived(bytes2, "rtf:v1", rtfText), "read")
24990
24949
  };
24991
24950
 
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";
24951
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
24952
+ import { basename as basename5 } from "node:path";
24994
24953
 
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
24954
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/attachments/csv-spans.js
24996
24955
  var delimitedSpans = /* @__PURE__ */ __name((text2, delimiter, maxCells = 1e4) => {
24997
24956
  const cells = [];
24998
24957
  let row = 1, column = 1, start = 0, quoted = false, truncated = false;
@@ -25030,7 +24989,7 @@ var delimitedSpans = /* @__PURE__ */ __name((text2, delimiter, maxCells = 1e4) =
25030
24989
  return { cells, truncated };
25031
24990
  }, "delimitedSpans");
25032
24991
 
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
24992
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
25034
24993
  var DELIMITED = {
25035
24994
  ".csv": ",",
25036
24995
  ".tsv": " ",
@@ -25060,7 +25019,7 @@ var sheets = {
25060
25019
  column,
25061
25020
  value: unquoted(result.text.slice(start, end))
25062
25021
  }));
25063
- const name = basename7(hint.name ?? hint.path, extensionOf(hint)) || "Sheet";
25022
+ const name = basename5(hint.name ?? hint.path, extensionOf(hint)) || "Sheet";
25064
25023
  const { text: text2, truncated } = sheetText([{ name, cells }]);
25065
25024
  return text2 === "" ? { status: "needs-agent", extractor } : { status: "extracted", text: text2, extractor, ...truncated || spans.truncated ? { truncated: true } : {} };
25066
25025
  } catch {
@@ -25069,7 +25028,7 @@ var sheets = {
25069
25028
  }, "read")
25070
25029
  };
25071
25030
 
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
25031
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/readers/registry.js
25073
25032
  var BUILT_INS2 = [office, pdf, docx, doc, rtf, html, sheets, plain, image2];
25074
25033
  var HEAD_BYTES = 1024;
25075
25034
  var readers = [...BUILT_INS2];
@@ -25079,7 +25038,7 @@ var readWithRegistry = /* @__PURE__ */ __name(async (bytes2, hint, context2) =>
25079
25038
  return reader ? reader.read(bytes2, hint, context2) : { status: "unsupported" };
25080
25039
  }, "readWithRegistry");
25081
25040
 
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
25041
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/attachments/extract.js
25083
25042
  var importEngine = /* @__PURE__ */ __name((name) => importFrom(new URL("attachments/extract.js", import.meta.resolve("@wirecat/cli-core")).href, name), "importEngine");
25084
25043
  var extensionOf2 = /* @__PURE__ */ __name(({ name, path }) => extname3(name ?? path).toLowerCase(), "extensionOf");
25085
25044
  var extractText = /* @__PURE__ */ __name(async (bytes2, hint, load, signal, env = process.env) => {
@@ -26158,7 +26117,7 @@ function imageSize(input) {
26158
26117
  }
26159
26118
  __name(imageSize, "imageSize");
26160
26119
 
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
26120
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/attachments/ocr.js
26162
26121
  var MAX_PAGES = 20;
26163
26122
  var MAX_PIXELS = 2e7;
26164
26123
  var cancelled2 = /* @__PURE__ */ __name((signal) => {
@@ -26309,7 +26268,7 @@ var ocrPdf = /* @__PURE__ */ __name(async (bytes2, pipeline2, load, signal) => {
26309
26268
  }
26310
26269
  }, "ocrPdf");
26311
26270
 
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
26271
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/attachments/pdf-preview.js
26313
26272
  var pdfPreview = /* @__PURE__ */ __name(async (bytes2, page, signal, load = importEngine, env = process.env) => {
26314
26273
  const limits = pdfPreviewLimits(env);
26315
26274
  const cancelled5 = /* @__PURE__ */ __name(() => {
@@ -26386,10 +26345,10 @@ var pdfPreview = /* @__PURE__ */ __name(async (bytes2, page, signal, load = impo
26386
26345
  }
26387
26346
  }, "pdfPreview");
26388
26347
 
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
26348
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/attachments/transfer.js
26390
26349
  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";
26350
+ import { constants } from "node:fs";
26351
+ import { lstat as lstat3, open as open5 } from "node:fs/promises";
26393
26352
  var MAX_CHUNK_BYTES = 1024 * 1024;
26394
26353
  var validateWindow = /* @__PURE__ */ __name(({ offsetBytes = 0, chunkBytes = 524288, ifSha256 }) => {
26395
26354
  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 +26364,14 @@ var retainedBytes = /* @__PURE__ */ __name(async (path, options, captureFile = f
26405
26364
  }, "cancelled");
26406
26365
  cancelled5();
26407
26366
  try {
26408
- const before2 = await lstat6(path);
26367
+ const before2 = await lstat3(path);
26409
26368
  if (!before2.isFile() || before2.isSymbolicLink())
26410
26369
  throw new CliError("validation_error", "the retained attachment must be a regular file");
26411
26370
  if (before2.size > maxBytes)
26412
26371
  throw new CliError("validation_error", `the retained attachment exceeds ${maxBytes / 1024 / 1024} MiB; configure MESSAGING_ATTACHMENT_MAX_MIB`);
26413
26372
  if (offsetBytes > before2.size)
26414
26373
  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));
26374
+ const handle = await open5(path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0));
26416
26375
  try {
26417
26376
  const opened = await handle.stat();
26418
26377
  if (!opened.isFile() || opened.ino !== before2.ino || opened.dev !== before2.dev || opened.size !== before2.size)
@@ -26494,7 +26453,7 @@ var transferMime = /* @__PURE__ */ __name((head, hint, name = null) => {
26494
26453
  return hint !== null && /^[a-z0-9.+-]+\/[a-z0-9.+-]+$/i.test(hint) ? hint : "application/octet-stream";
26495
26454
  }, "transferMime");
26496
26455
 
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
26456
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/attachments.js
26498
26457
  var ATTACHMENT_QUERY = {
26499
26458
  entity: "attachment",
26500
26459
  backend: "sql",
@@ -26515,7 +26474,7 @@ var ATTACHMENT_QUERY = {
26515
26474
  var PAGE3 = 200;
26516
26475
  var outcome = /* @__PURE__ */ __name(async (file, path, load, signal, noFollow = false, ocr, env = process.env) => {
26517
26476
  const maxBytes = attachmentMaxBytes(env);
26518
- const tooLarge = /* @__PURE__ */ __name(() => ({
26477
+ const tooLarge2 = /* @__PURE__ */ __name(() => ({
26519
26478
  status: "too-large",
26520
26479
  issue: withRecovery({
26521
26480
  code: "validation_error",
@@ -26531,15 +26490,15 @@ var outcome = /* @__PURE__ */ __name(async (file, path, load, signal, noFollow =
26531
26490
  if (known2 === "unsupported")
26532
26491
  return { status: "unsupported" };
26533
26492
  if (size4 > maxBytes)
26534
- return tooLarge();
26535
- const handle = await open9(path, constants4.O_RDONLY | (noFollow ? constants4.O_NOFOLLOW : 0));
26493
+ return tooLarge2();
26494
+ const handle = await open6(path, constants2.O_RDONLY | (noFollow ? constants2.O_NOFOLLOW : 0));
26536
26495
  let bytes2;
26537
26496
  try {
26538
26497
  const opened = await handle.stat();
26539
26498
  if (!opened.isFile())
26540
26499
  return { status: "missing" };
26541
26500
  if (opened.size > maxBytes)
26542
- return tooLarge();
26501
+ return tooLarge2();
26543
26502
  bytes2 = new Uint8Array(await readFile(handle, { signal }));
26544
26503
  } finally {
26545
26504
  await handle.close();
@@ -26875,7 +26834,7 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
26875
26834
  }, "setText")
26876
26835
  }), "attachmentsService");
26877
26836
 
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
26837
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/chat-documents.js
26879
26838
  var chatDocumentsService = /* @__PURE__ */ __name((deps) => ({
26880
26839
  list: /* @__PURE__ */ __name(async (chat, { limit, offset, ref }) => {
26881
26840
  const store = await accountStore(deps);
@@ -26905,7 +26864,7 @@ var chatDocumentsService = /* @__PURE__ */ __name((deps) => ({
26905
26864
  }, "list")
26906
26865
  }), "chatDocumentsService");
26907
26866
 
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
26867
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/retention.js
26909
26868
  var observationDuration = /* @__PURE__ */ __name((text2, flag) => {
26910
26869
  const match = /^(\d+(?:\.\d+)?)([smhdw])$/.exec(text2);
26911
26870
  const units2 = { s: 1e3, m: 6e4, h: 36e5, d: 864e5, w: 6048e5 };
@@ -26992,7 +26951,7 @@ var isRetentionSelection = /* @__PURE__ */ __name((selection) => {
26992
26951
  }
26993
26952
  }, "isRetentionSelection");
26994
26953
 
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
26954
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/counters.js
26996
26955
  var counterFields = /* @__PURE__ */ __name((text2 = "views,reactions,comments") => {
26997
26956
  const fields = text2.split(",").map((one) => one.trim());
26998
26957
  if (!fields.length || fields.some((one) => !COUNTER_FIELDS.includes(one)) || new Set(fields).size !== fields.length)
@@ -27199,7 +27158,7 @@ var countersService = /* @__PURE__ */ __name((deps) => {
27199
27158
  };
27200
27159
  }, "countersService");
27201
27160
 
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
27161
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/search-refresh.js
27203
27162
  var SYNC_KEY = "messages.sync-first";
27204
27163
  var SYNC_BOUNDS = { maxChats: 5, timeMs: 3e4, maxMessages: 500 };
27205
27164
  var keyOf2 = /* @__PURE__ */ __name((chat) => JSON.stringify([chat.account.provider, chat.account.account, chat.chatId]), "keyOf");
@@ -27331,7 +27290,7 @@ var withRefresh = /* @__PURE__ */ __name((found, refreshed) => ({
27331
27290
  ...!refreshed || refreshed.complete ? {} : { coverage: { ...found.coverage, state: "stale" } }
27332
27291
  }), "withRefresh");
27333
27292
 
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
27293
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/embeddings-search.js
27335
27294
  var CANDIDATES = 50;
27336
27295
  var WORD_HITS = 200;
27337
27296
  var RRF_K = 60;
@@ -27449,7 +27408,7 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
27449
27408
  }, deps.messenger);
27450
27409
  const eligibility = filter === void 0 ? void 0 : await store.queries.conversationEligibility(prepared.execution);
27451
27410
  const selected = prepared.selectedChat;
27452
- const scopeOf2 = /* @__PURE__ */ __name((one) => selected ? selected.account.provider === one.provider && selected.account.account === one.account ? { chatId: selected.chatId } : null : {}, "scopeOf");
27411
+ const scopeOf3 = /* @__PURE__ */ __name((one) => selected ? selected.account.provider === one.provider && selected.account.account === one.account ? { chatId: selected.chatId } : null : {}, "scopeOf");
27453
27412
  const words2 = await byWords(query, prepared, eligibility?.conversations, since);
27454
27413
  const meaning = [];
27455
27414
  const sources = words2.sources;
@@ -27457,7 +27416,7 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
27457
27416
  await withEmbedder(deps, target2, choice, {}, async (embedder) => {
27458
27417
  const [vector] = await embedder.embed([query], "query");
27459
27418
  for (const one of prepared.scopeAccounts) {
27460
- const scope = scopeOf2(one);
27419
+ const scope = scopeOf3(one);
27461
27420
  if (scope === null)
27462
27421
  continue;
27463
27422
  const hits = await store.vectors.nearestConversations(one, {
@@ -27491,7 +27450,7 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
27491
27450
  const scoped = [];
27492
27451
  const elsewhere = [];
27493
27452
  for (const one of prepared.scopeAccounts) {
27494
- const scope = scopeOf2(one);
27453
+ const scope = scopeOf3(one);
27495
27454
  if (scope === null)
27496
27455
  continue;
27497
27456
  const eligibleChats = eligibility?.chats.filter(({ account: account3 }) => account3.provider === one.provider && account3.account === one.account).map(({ chat: chat2 }) => chat2);
@@ -27606,13 +27565,13 @@ var meanOf = /* @__PURE__ */ __name((vectors) => {
27606
27565
  return mean.map((value) => value / length);
27607
27566
  }, "meanOf");
27608
27567
 
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
27568
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/embeddings.js
27610
27569
  var embeddingsService = /* @__PURE__ */ __name((deps) => ({
27611
27570
  ...embeddingsMaintenance(deps),
27612
27571
  ...embeddingsSearch(deps)
27613
27572
  }), "embeddingsService");
27614
27573
 
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
27574
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/folders.js
27616
27575
  var foldersService = /* @__PURE__ */ __name((deps) => {
27617
27576
  const online = /* @__PURE__ */ __name(async (command) => {
27618
27577
  if (deps.offline)
@@ -27741,19 +27700,19 @@ var foldersService = /* @__PURE__ */ __name((deps) => {
27741
27700
  await guardedWrite(deps.guard, { operationId, chatId: null, kind: "account", action: "folder-order" }, () => reorder(folders.map((one) => one.id)));
27742
27701
  return { operationId, folders: folders.map(({ id: id2, title }) => ({ id: id2, title })) };
27743
27702
  }, "order"),
27744
- join: /* @__PURE__ */ __name(async (link5) => {
27745
- if (link5.trim() === "")
27703
+ join: /* @__PURE__ */ __name(async (link4) => {
27704
+ if (link4.trim() === "")
27746
27705
  throw new CliError("validation_error", "give the folder's link");
27747
27706
  const connection = await online("chats folders join");
27748
- const join14 = capability(connection, "joinFolder", "join a shared folder");
27707
+ const join11 = capability(connection, "joinFolder", "join a shared folder");
27749
27708
  const operationId = newOperationId();
27750
- const folder = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "account", action: "folder-join" }, () => join14(link5.trim()));
27709
+ const folder = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "account", action: "folder-join" }, () => join11(link4.trim()));
27751
27710
  return { operationId, folder };
27752
27711
  }, "join")
27753
27712
  };
27754
27713
  }, "foldersService");
27755
27714
 
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
27715
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/inbox.js
27757
27716
  var INBOX_CHATS = 20;
27758
27717
  var REVIEW_DAYS = 3;
27759
27718
  var UNANSWERED_HOURS = 24;
@@ -27906,7 +27865,7 @@ var reviewIn = /* @__PURE__ */ __name(async (adapter, { since, points, chat, kin
27906
27865
  await onReviewed?.(reviewed);
27907
27866
  if (unansweredAfterHours === void 0)
27908
27867
  return reviewed;
27909
- const open10 = [];
27868
+ const open7 = [];
27910
27869
  for (const one of reviewed.chats) {
27911
27870
  const admins = answerers2.get(one.id);
27912
27871
  const questions2 = unanswered(one.messages, {
@@ -27914,10 +27873,10 @@ var reviewIn = /* @__PURE__ */ __name(async (adapter, { since, points, chat, kin
27914
27873
  before: now - unansweredAfterHours * 36e5
27915
27874
  });
27916
27875
  if (questions2.length > 0) {
27917
- open10.push({ ...one, messages: questions2, answeredBy: admins === void 0 ? "owner" : "owner-and-admins" });
27876
+ open7.push({ ...one, messages: questions2, answeredBy: admins === void 0 ? "owner" : "owner-and-admins" });
27918
27877
  }
27919
27878
  }
27920
- return { ...reviewed, chats: open10, unanswered: { olderThanHours: unansweredAfterHours } };
27879
+ return { ...reviewed, chats: open7, unanswered: { olderThanHours: unansweredAfterHours } };
27921
27880
  }, "reviewIn");
27922
27881
  var inboxService = /* @__PURE__ */ __name((deps) => {
27923
27882
  const reader = /* @__PURE__ */ __name(async () => {
@@ -27961,7 +27920,7 @@ var inboxService = /* @__PURE__ */ __name((deps) => {
27961
27920
  };
27962
27921
  }, "inboxService");
27963
27922
 
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
27923
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/mentions.js
27965
27924
  var REVIEW_COUNT = 500;
27966
27925
  var mentionsService = /* @__PURE__ */ __name((deps) => {
27967
27926
  const located = /* @__PURE__ */ __name(async () => {
@@ -28040,7 +27999,7 @@ var mentionsService = /* @__PURE__ */ __name((deps) => {
28040
27999
  };
28041
28000
  }, "mentionsService");
28042
28001
 
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
28002
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/message-link.js
28044
28003
  var messageLinkTarget = /* @__PURE__ */ __name((reference, message, provider) => {
28045
28004
  if (isLocator(reference)) {
28046
28005
  if (message !== void 0)
@@ -28070,24 +28029,24 @@ var validMessageId = /* @__PURE__ */ __name((id2) => {
28070
28029
  }))
28071
28030
  throw new CliError("validation_error", "a message id must be nonempty, at most 256 characters, without spaces or controls");
28072
28031
  }, "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))
28032
+ var validatePermalink = /* @__PURE__ */ __name((link4) => {
28033
+ if (link4.url === null) {
28034
+ if (link4.access !== "unavailable" || !["unsupported_chat", "unsupported_provider", "offline"].includes(link4.reason))
28076
28035
  throw new CliError("validation_error", "the messenger returned invalid permalink metadata");
28077
- return { url: link5.url, access: link5.access, reason: link5.reason };
28036
+ return { url: link4.url, access: link4.access, reason: link4.reason };
28078
28037
  }
28079
28038
  let url;
28080
28039
  try {
28081
- url = new URL(link5.url);
28040
+ url = new URL(link4.url);
28082
28041
  } catch {
28083
28042
  throw new CliError("validation_error", "the messenger returned an invalid permalink");
28084
28043
  }
28085
- if (url.protocol !== "https:" || url.username || url.password || /\s/u.test(link5.url) || link5.reason !== null || !["public", "restricted", "unknown"].includes(link5.access))
28044
+ if (url.protocol !== "https:" || url.username || url.password || /\s/u.test(link4.url) || link4.reason !== null || !["public", "restricted", "unknown"].includes(link4.access))
28086
28045
  throw new CliError("validation_error", "the messenger returned an invalid permalink");
28087
- return { url: link5.url, access: link5.access, reason: link5.reason };
28046
+ return { url: link4.url, access: link4.access, reason: link4.reason };
28088
28047
  }, "validatePermalink");
28089
28048
 
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
28049
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/pin-duration.js
28091
28050
  var spokenSeconds = /* @__PURE__ */ __name((seconds) => {
28092
28051
  if (seconds % 86400 === 0 && seconds > 86400)
28093
28052
  return `${seconds / 86400}d`;
@@ -28119,7 +28078,7 @@ var pinDurationOf = /* @__PURE__ */ __name((value, allowed, flag = "--expire-tim
28119
28078
  return seconds;
28120
28079
  }, "pinDurationOf");
28121
28080
 
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
28081
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/sends/send-as.js
28123
28082
  var sendAsCheck = /* @__PURE__ */ __name((connection, sendAs) => {
28124
28083
  if (sendAs === void 0) {
28125
28084
  const saved = connection.savedSender?.bind(connection);
@@ -28144,7 +28103,47 @@ var typedSendAs = /* @__PURE__ */ __name((typed) => {
28144
28103
  return sendAs;
28145
28104
  }, "typedSendAs");
28146
28105
 
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
28106
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/total.js
28107
+ var TOTAL_CAP = 1e4;
28108
+ var totalOf = /* @__PURE__ */ __name((count3, shown, hasMore, exact = true) => {
28109
+ const least = shown + (hasMore ? 1 : 0);
28110
+ if (count3 === void 0 || count3 < least)
28111
+ return { value: least, relation: "gte" };
28112
+ if (count3 > TOTAL_CAP)
28113
+ return { value: TOTAL_CAP, relation: "gte" };
28114
+ return { value: count3, relation: exact ? "eq" : "gte" };
28115
+ }, "totalOf");
28116
+
28117
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/lucene/meaning-parts.js
28118
+ var WORD_FIELDS = /* @__PURE__ */ new Set(["text", "exact"]);
28119
+ var fieldsOfQuery = /* @__PURE__ */ __name((root, everything) => {
28120
+ let narrows = false;
28121
+ const kept = /* @__PURE__ */ __name((node) => {
28122
+ if (node.kind === "boolean")
28123
+ return {
28124
+ ...node,
28125
+ clauses: node.clauses.map(({ occur, node: node2 }) => {
28126
+ if (occur !== "must_not")
28127
+ return { occur, node: kept(node2) };
28128
+ narrows = true;
28129
+ return { occur, node: node2 };
28130
+ })
28131
+ };
28132
+ if (!WORD_FIELDS.has(node.field)) {
28133
+ narrows = true;
28134
+ return node;
28135
+ }
28136
+ return { ...everything, span: node.span };
28137
+ }, "kept");
28138
+ const fields = kept(root);
28139
+ return narrows ? fields : void 0;
28140
+ }, "fieldsOfQuery");
28141
+ var meaningWords = /* @__PURE__ */ __name((root) => {
28142
+ 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");
28143
+ return wanted(root).join(" ").trim();
28144
+ }, "meaningWords");
28145
+
28146
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/search/question-plan.js
28148
28147
  var words = /* @__PURE__ */ __name((text2) => normalize(text2).match(/[\p{L}\p{N}]+/gu) ?? [], "words");
28149
28148
  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
28149
  var questionWord = /\b(?:what|which|how|who|where|when|can|could|should)\b|(?:^|\s)(?:сколько|какой|какая|какие|какое|кто|кому|кем|где|когда|как|что|можно|может|могут|ли)(?:\s|$)/iu;
@@ -28260,7 +28259,7 @@ function planQuestion(text2, strict = false) {
28260
28259
  }
28261
28260
  __name(planQuestion, "planQuestion");
28262
28261
 
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
28262
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/messages-combined.js
28264
28263
  var COMBINED_DEFAULTS = { candidateDepth: 300, rrfK: 60, rerank: "all", chatCap: 0 };
28265
28264
  var tokensOf = /* @__PURE__ */ __name((text2) => normalize(text2).match(/[\p{L}\p{N}\p{Co}\p{M}]+/gu) ?? [], "tokensOf");
28266
28265
  var searchCombined = /* @__PURE__ */ __name(async (store, account2, request, messenger = {}, options = COMBINED_DEFAULTS) => {
@@ -28453,29 +28452,54 @@ var signals = /* @__PURE__ */ __name((hit, terms, corrections, execution, mode,
28453
28452
  return mode === "coverage" ? coverage * 4 : mode === "proximity" ? proximity : mode === "phrase" ? phrase : coverage * 4 + proximity + phrase;
28454
28453
  }, "signals");
28455
28454
 
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
28455
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/messages-discovery.js
28457
28456
  var MEANING_DEPTH = 100;
28458
28457
  var RRF_K2 = 60;
28459
28458
  var RERANK_DEPTH = 50;
28460
28459
  var RERANK_WEIGHT = 0.7;
28461
28460
  var RERANK_CHUNK = 5;
28462
28461
  var RERANK_MILLISECONDS = 15e3;
28462
+ var FOLLOW_UP_HITS = 5;
28463
+ var FOLLOW_UPS_PER_HIT = 2;
28464
+ var RARE_AT = 3;
28465
+ var FOLLOW_UP_CANDIDATES = 20;
28466
+ var RANK_WITHIN_MESSAGES = 1e5;
28467
+ var EVERY_MESSAGE = {
28468
+ kind: "predicate",
28469
+ field: "date",
28470
+ operator: "range",
28471
+ value: "*",
28472
+ upper: "*",
28473
+ lower_inclusive: true,
28474
+ upper_inclusive: true
28475
+ };
28476
+ var scopeOf2 = /* @__PURE__ */ __name((root) => root === void 0 ? {} : { ast: { version: 1, language: "lucene-v1", root } }, "scopeOf");
28477
+ var discoveryRequest = /* @__PURE__ */ __name((asked) => asked.ast !== void 0 || asked.exact || !asked.text ? asked : {
28478
+ ...asked,
28479
+ text: asked.text.replace(new RegExp("(?<=\\p{L})\\?(?=\\s|$)", "gu"), "").replace(/"(?:[^"\\]|\\.)*"|(?<=\d):(?=\d)/gu, (found) => found === ":" ? " " : found)
28480
+ }, "discoveryRequest");
28463
28481
  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"), "") };
28482
+ const request = discoveryRequest(asked);
28465
28483
  const original = await prepareLucene(store, account2, request, messenger);
28466
28484
  const text2 = request.text ?? "";
28467
28485
  const plan = planQuestion(text2, request.ast !== void 0 || !!request.exact || !!request.newest);
28468
- if (request.ast !== void 0 || request.exact || request.newest || implicitTextTerms(text2).size === 0)
28486
+ if (request.ast !== void 0 || request.exact || request.newest)
28469
28487
  return searchLucene(store, account2, request, messenger);
28470
28488
  const implicit = implicitTextTerms(text2);
28471
- if (!plan.changed && walkQuery(original.execution.root).some((node) => (node.field === "text" || node.field === "exact") && (node.operator !== "term" || node.field === "exact" || !implicit.has(node.span.start))))
28489
+ const explicit = implicit.size === 0 || !plan.changed && walkQuery(original.execution.root).some((node) => (node.field === "text" || node.field === "exact") && (node.operator !== "term" || node.field === "exact" || !implicit.has(node.span.start)));
28490
+ const root = explicit ? validateFields(parseLucene(text2, { ...MESSAGE_PARSING, defaultField: "text" })).root : void 0;
28491
+ const question = root === void 0 ? text2 : meaningWords(root);
28492
+ if (!question)
28472
28493
  return searchLucene(store, account2, request, messenger);
28473
- const terms = [...new Set(plan.terms.concat(plan.aliases.flatMap((alias) => words(alias.split(" -> ")[1] ?? ""))))];
28494
+ const terms = root === void 0 ? [...new Set(plan.terms.concat(plan.aliases.flatMap((alias) => words(alias.split(" -> ")[1] ?? ""))))] : [...new Set(words(question))];
28474
28495
  if (!terms.length)
28475
28496
  return searchLucene(store, account2, request, messenger);
28476
28497
  if (terms.length > 64)
28477
28498
  exhausted("discovery terms");
28478
- const lane = meaning ? await meaning(text2, original.scopeAccounts) : void 0;
28499
+ const narrowing = root === void 0 ? void 0 : fieldsOfQuery(root, EVERY_MESSAGE);
28500
+ const scope = root === void 0 ? plan.scope ? { text: plan.scope } : {} : scopeOf2(narrowing);
28501
+ const within = scope.text !== void 0 || scope.ast !== void 0 ? () => filterPks(store, account2, { ...request, text: void 0, ast: void 0, ...scope }, messenger) : void 0;
28502
+ const lane = meaning ? await meaning(question, original.scopeAccounts, void 0, within) : void 0;
28479
28503
  let started = performance.now();
28480
28504
  const check = /* @__PURE__ */ __name(() => {
28481
28505
  if (request.signal?.aborted)
@@ -28490,7 +28514,7 @@ var searchDiscovery = /* @__PURE__ */ __name(async (store, account2, asked, mess
28490
28514
  const previous = union.get(m.locator);
28491
28515
  union.set(m.locator, { ...previous, ...m, fused: (previous?.fused ?? 0) + 1 / (60 + rank + 1) });
28492
28516
  }), "add");
28493
- for (const query of plan.changed ? [] : plan.queries) {
28517
+ for (const query of plan.changed || root !== void 0 ? [] : plan.queries) {
28494
28518
  check();
28495
28519
  const found = await searchCombined(store, account2, { ...request, text: query, limit: 300 }, messenger, {
28496
28520
  candidateDepth: 300,
@@ -28504,7 +28528,7 @@ var searchDiscovery = /* @__PURE__ */ __name(async (store, account2, asked, mess
28504
28528
  truncated ||= found.hasMore || found.query.combined.truncated;
28505
28529
  }
28506
28530
  check();
28507
- const relaxed = `(${terms.join(" OR ")})${plan.scope ? ` ${plan.scope}` : ""}`;
28531
+ const relaxed = root === void 0 ? `(${terms.join(" OR ")})${plan.scope ? ` ${plan.scope}` : ""}` : text2;
28508
28532
  const partialRequest = { ...request, text: relaxed, ast: void 0, limit: 300, context: 0, thread: void 0 };
28509
28533
  const partial = await searchLucene(store, account2, partialRequest, messenger);
28510
28534
  add(partial.items);
@@ -28527,8 +28551,9 @@ var searchDiscovery = /* @__PURE__ */ __name(async (store, account2, asked, mess
28527
28551
  }).filter((m) => !request.only || request.only.some((key) => key.provider === m.provider && key.account === m.account && key.chatId === m.chatId && key.id === m.id));
28528
28552
  const eligible = await searchLucene(store, account2, {
28529
28553
  ...request,
28530
- text: plan.scope || void 0,
28554
+ text: void 0,
28531
28555
  ast: void 0,
28556
+ ...scope,
28532
28557
  limit: 500,
28533
28558
  only,
28534
28559
  context: 0,
@@ -28587,7 +28612,7 @@ var searchDiscovery = /* @__PURE__ */ __name(async (store, account2, asked, mess
28587
28612
  candidates = candidates.map(described).sort((a, b) => (b.score ?? 0) - (a.score ?? 0) || Number(parentByLocator.has(b.locator)) - Number(parentByLocator.has(a.locator)));
28588
28613
  let meaningCandidates = 0;
28589
28614
  if (lane && "ranked" in lane) {
28590
- const near2 = await nearEligible(store, account2, request, messenger, lane.ranked, plan.scope);
28615
+ const near2 = await nearEligible(store, account2, request, messenger, lane.ranked, scope);
28591
28616
  meaningCandidates = near2.length;
28592
28617
  candidates = fusedWithMeaning(candidates, near2, described);
28593
28618
  }
@@ -28628,7 +28653,10 @@ var searchDiscovery = /* @__PURE__ */ __name(async (store, account2, asked, mess
28628
28653
  started += performance.now() - opening;
28629
28654
  }
28630
28655
  check();
28631
- const items = await Promise.all(candidates.slice(0, request.limit).map(async ({ fused: _fused, ...m }) => {
28656
+ const followUps = await followUpsOf(store, account2, request, messenger, candidates, scope);
28657
+ const items = await Promise.all(candidates.slice(0, request.limit).map(async ({ fused: _fused, ...hit }) => {
28658
+ const later = followUps.get(hit.locator);
28659
+ const m = later?.length ? { ...hit, followUps: later } : hit;
28632
28660
  if (!request.context)
28633
28661
  return m;
28634
28662
  check();
@@ -28651,13 +28679,14 @@ var searchDiscovery = /* @__PURE__ */ __name(async (store, account2, asked, mess
28651
28679
  query: {
28652
28680
  ...partial.query,
28653
28681
  discovery: {
28654
- method: "lexical-partial",
28682
+ method: root === void 0 ? "lexical-partial" : "lexical-strict",
28655
28683
  candidateDepth: 300,
28656
28684
  candidates: candidates.length,
28657
28685
  repliesAdded: replyCount,
28686
+ followUps: [...followUps.values()].reduce((sum2, later) => sum2 + later.length, 0),
28658
28687
  truncated,
28659
28688
  terms,
28660
- queries: [...plan.changed ? [] : plan.queries, relaxed],
28689
+ queries: [...plan.changed || root !== void 0 ? [] : plan.queries, relaxed],
28661
28690
  ...lane && "ranked" in lane ? { meaning: { model: lane.model, candidates: meaningCandidates } } : {},
28662
28691
  ...reranked ? { rerank: reranked } : {}
28663
28692
  }
@@ -28667,12 +28696,41 @@ var searchDiscovery = /* @__PURE__ */ __name(async (store, account2, asked, mess
28667
28696
  ...lane && "partly" in lane && lane.partly ? { meaningSkipped: lane.partly } : {}
28668
28697
  };
28669
28698
  }, "searchDiscovery");
28699
+ var followUpsOf = /* @__PURE__ */ __name(async (store, account2, request, messenger, candidates, scope) => {
28700
+ const head = candidates.slice(0, Math.min(FOLLOW_UP_HITS, request.limit));
28701
+ 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 });
28702
+ const only = [...new Map(later.flat().map((m) => [m.locator, m])).values()].map((m) => ({
28703
+ ...accountOfHit(m),
28704
+ chatId: m.chatId,
28705
+ id: m.id
28706
+ }));
28707
+ const out = /* @__PURE__ */ new Map();
28708
+ if (!only.length)
28709
+ return out;
28710
+ const eligible = await searchLucene(store, account2, { ...request, text: void 0, ast: void 0, ...scope, limit: only.length, only, context: 0, thread: void 0 }, messenger);
28711
+ const allowed = new Map(eligible.items.map((m) => [m.locator, m]));
28712
+ const shown = /* @__PURE__ */ new Set();
28713
+ head.forEach((hit, i) => {
28714
+ shown.add(hit.locator);
28715
+ const picked = (later[i] ?? []).flatMap((m) => allowed.get(m.locator) ?? []).slice(0, FOLLOW_UPS_PER_HIT).filter((m) => !shown.has(m.locator));
28716
+ for (const m of picked)
28717
+ shown.add(m.locator);
28718
+ if (picked.length)
28719
+ out.set(hit.locator, picked);
28720
+ });
28721
+ return out;
28722
+ }, "followUpsOf");
28723
+ var filterPks = /* @__PURE__ */ __name(async (store, account2, request, messenger) => {
28724
+ const { execution } = await prepareLucene(store, account2, request, messenger);
28725
+ const pks = await store.queries.matchingPks(execution, RANK_WITHIN_MESSAGES);
28726
+ return pks === void 0 || pks.length > RANK_WITHIN_MESSAGES ? void 0 : pks;
28727
+ }, "filterPks");
28670
28728
  var nearEligible = /* @__PURE__ */ __name(async (store, account2, request, messenger, ranked, scope) => {
28671
28729
  const keyOf5 = /* @__PURE__ */ __name((one) => JSON.stringify([one.provider, one.account, one.chatId, one.id]), "keyOf");
28672
28730
  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 }));
28673
28731
  if (!only.length)
28674
28732
  return [];
28675
- const eligible = await searchLucene(store, account2, { ...request, text: scope || void 0, ast: void 0, limit: only.length, only, context: 0, thread: void 0 }, messenger);
28733
+ const eligible = await searchLucene(store, account2, { ...request, text: void 0, ast: void 0, ...scope, limit: only.length, only, context: 0, thread: void 0 }, messenger);
28676
28734
  const hits = new Map(eligible.items.map((hit) => {
28677
28735
  const { provider, account: account3 } = parseLocator(hit.locator);
28678
28736
  return [keyOf5({ provider, account: account3, chatId: hit.chatId, id: hit.id }), hit];
@@ -28722,7 +28780,7 @@ var mixedWithReranker = /* @__PURE__ */ __name((head, scores) => {
28722
28780
  })).sort((a, b) => b.mixed - a.mixed).map(({ hit }) => hit);
28723
28781
  }, "mixedWithReranker");
28724
28782
 
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
28783
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/thread-context.js
28726
28784
  var THREAD_BOUNDS = { maxHops: 8, maxMessages: 50, maxBytes: 65536, withinMs: 864e5 };
28727
28785
  var bytes = /* @__PURE__ */ __name((items, links) => Buffer.byteLength(JSON.stringify({ items, links }), "utf8"), "bytes");
28728
28786
  var threadBounds = /* @__PURE__ */ __name((options = {}) => {
@@ -28822,14 +28880,14 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account2, chat, mes
28822
28880
  const rows = await store.conversations.links(account2, chat, id2, { limit: bounds.maxMessages + 1 });
28823
28881
  if (rows.length > bounds.maxMessages)
28824
28882
  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
28883
+ cache.set(id2, rows.slice(0, bounds.maxMessages).map((link4) => ({
28884
+ ...link4,
28885
+ stale: link4.stale || link4.source !== "agent" && state.algorithmVersion !== RULES_VERSION
28828
28886
  })));
28829
28887
  }
28830
28888
  return cache.get(id2);
28831
28889
  }, "linksOf");
28832
- const chosen = /* @__PURE__ */ __name((links) => links.find((link5) => !link5.stale), "chosen");
28890
+ const chosen = /* @__PURE__ */ __name((links) => links.find((link4) => !link4.stale), "chosen");
28833
28891
  const queue = [{ id: message, hops: 0 }];
28834
28892
  const queued = /* @__PURE__ */ new Set([message]);
28835
28893
  const parents = /* @__PURE__ */ new Map();
@@ -28860,8 +28918,8 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account2, chat, mes
28860
28918
  const displayed2 = node.id === message ? { ...body, anchor: true } : body;
28861
28919
  const own = await linksOf(node.id);
28862
28920
  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);
28921
+ 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));
28922
+ result.stale ||= evidence.some((link4) => link4.stale);
28865
28923
  if (bytes([...result.items, displayed2], [...result.links, ...evidence]) > bounds.maxBytes) {
28866
28924
  stopped("bytes");
28867
28925
  break;
@@ -28897,9 +28955,9 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account2, chat, mes
28897
28955
  const childLinks = await linksOf(child.messageId);
28898
28956
  if (chosen(childLinks)?.parentId === node.id)
28899
28957
  add(child.messageId);
28900
- else if (childLinks.some((link5) => link5.stale && link5.parentId === node.id)) {
28958
+ else if (childLinks.some((link4) => link4.stale && link4.parentId === node.id)) {
28901
28959
  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));
28960
+ 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
28961
  if (bytes(result.items, [...result.links, ...stale]) <= bounds.maxBytes)
28904
28962
  result.links.push(...stale);
28905
28963
  else
@@ -28921,7 +28979,7 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account2, chat, mes
28921
28979
  return result;
28922
28980
  }, "readThreadContext");
28923
28981
 
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
28982
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/messages-archive-search.js
28925
28983
  var SEARCH_FILL_MS = 200;
28926
28984
  var statsStore = /* @__PURE__ */ __name(async (store, account2, request, messenger = {}) => {
28927
28985
  const stop = Date.now() + SEARCH_FILL_MS;
@@ -28956,8 +29014,15 @@ var searchStore = /* @__PURE__ */ __name(async (store, account2, request, messen
28956
29014
  if (!Number.isInteger(offset) || offset < 0 || offset > MAX_SEARCH_OFFSET)
28957
29015
  throw new CliError("validation_error", `offset takes a whole number from 0 to ${MAX_SEARCH_OFFSET}`);
28958
29016
  const found = await searchPage(store, account2, { ...request, limit: request.limit + offset }, messenger, meaning, rerank);
29017
+ const discovery = found.query?.discovery;
29018
+ 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) => {
29019
+ if (isCliError(error) && error.details.reason === "query.too-large")
29020
+ return void 0;
29021
+ throw error;
29022
+ }), found.items.length, found.hasMore);
28959
29023
  return {
28960
29024
  ...found,
29025
+ total,
28961
29026
  items: found.items.slice(offset),
28962
29027
  ...found.hasMore && offset + request.limit <= MAX_SEARCH_OFFSET ? { nextOffset: offset + request.limit } : {}
28963
29028
  };
@@ -28981,12 +29046,12 @@ var accountOf2 = /* @__PURE__ */ __name((hit) => {
28981
29046
  }, "accountOf");
28982
29047
  var keyOf3 = /* @__PURE__ */ __name(({ provider, account: account2 }) => `${provider}/${account2}`, "keyOf");
28983
29048
 
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
29049
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/pictures.js
28985
29050
  import { createHash as createHash9 } from "node:crypto";
28986
29051
  import { readFile as readFile2, stat as stat3 } from "node:fs/promises";
28987
29052
  import { setTimeout as sleep4 } from "node:timers/promises";
28988
29053
 
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
29054
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/models.js
28990
29055
  var GROUP_SETTINGS = [
28991
29056
  "allCanPin",
28992
29057
  "onlyAdminsAdd",
@@ -29000,10 +29065,10 @@ var ADMIN_RIGHTS = ["read", "members", "admins", "info", "pin", "link", "post",
29000
29065
  var senderIsMe = /* @__PURE__ */ __name((message, account2) => message.outgoing === true || message.senderId !== null && String(message.senderId) === account2, "senderIsMe");
29001
29066
  var MEDIA_KINDS = ["photo", "video", "file", "audio", "link"];
29002
29067
 
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
29068
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/file-download.js
29004
29069
  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";
29070
+ import { link as link3, rm } from "node:fs/promises";
29071
+ import { basename as basename6, join as join10, resolve as resolve6 } from "node:path";
29007
29072
  import { Readable, Transform } from "node:stream";
29008
29073
  import { pipeline } from "node:stream/promises";
29009
29074
  var refreshedFiles = /* @__PURE__ */ __name((files) => files.flatMap(({ kind, name, position, providerRef }) => providerRef === void 0 || Object.keys(providerRef).length === 0 ? [] : [
@@ -29078,7 +29143,7 @@ var EXTENSIONS = {
29078
29143
  };
29079
29144
  var BY_KIND = { photo: "jpg" };
29080
29145
  var safeName2 = /* @__PURE__ */ __name((name, platform = process.platform) => {
29081
- let plain2 = name === void 0 ? "" : basename8(name.replaceAll("\\", "/")).replace(/[\p{Cc}​-‏‪-‮⁦-⁩]/gu, "").replace(/^\.+/, "");
29146
+ let plain2 = name === void 0 ? "" : basename6(name.replaceAll("\\", "/")).replace(/[\p{Cc}​-‏‪-‮⁦-⁩]/gu, "").replace(/^\.+/, "");
29082
29147
  if (platform === "win32") {
29083
29148
  plain2 = plain2.replace(/[<>:"|?*]/g, "_").replace(/[. ]+$/, "");
29084
29149
  if (/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(plain2))
@@ -29092,7 +29157,7 @@ var save = /* @__PURE__ */ __name(async (file, directory2, fallbackName, { uniqu
29092
29157
  const extension = EXTENSIONS[file.mime ?? ""] ?? BY_KIND[file.kind];
29093
29158
  return own ?? (extension ? `${fallbackName}.${extension}` : fallbackName);
29094
29159
  }, "fileName");
29095
- const partial = join13(directory2, `.${fileName()}.${process.pid}.part`);
29160
+ const partial = join10(directory2, `.${fileName()}.${process.pid}.part`);
29096
29161
  let bytes2 = 0;
29097
29162
  const counting = new Transform({
29098
29163
  transform(chunk, _encoding, done2) {
@@ -29105,8 +29170,8 @@ var save = /* @__PURE__ */ __name(async (file, directory2, fallbackName, { uniqu
29105
29170
  const name = fileName();
29106
29171
  const names2 = unique && own ? [name, `${fallbackName}-${own}`] : [name];
29107
29172
  for (const candidate of names2) {
29108
- const path2 = resolve6(join13(directory2, candidate));
29109
- const taken = await link4(partial, path2).then(() => false, (error) => {
29173
+ const path2 = resolve6(join10(directory2, candidate));
29174
+ const taken = await link3(partial, path2).then(() => false, (error) => {
29110
29175
  if (error.code === "EEXIST")
29111
29176
  return true;
29112
29177
  throw error;
@@ -29114,7 +29179,7 @@ var save = /* @__PURE__ */ __name(async (file, directory2, fallbackName, { uniqu
29114
29179
  if (!taken)
29115
29180
  return { kind: file.kind, path: path2, bytes: bytes2 };
29116
29181
  }
29117
- const path = resolve6(join13(directory2, names2.at(-1) ?? name));
29182
+ const path = resolve6(join10(directory2, names2.at(-1) ?? name));
29118
29183
  if (unique)
29119
29184
  return { kind: file.kind, path, bytes: bytes2, existing: true };
29120
29185
  throw new CliError("validation_error", `${path} already exists \u2014 nothing was overwritten; choose --output-dir`);
@@ -29123,7 +29188,7 @@ var save = /* @__PURE__ */ __name(async (file, directory2, fallbackName, { uniqu
29123
29188
  }
29124
29189
  }, "save");
29125
29190
 
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
29191
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/pictures.js
29127
29192
  var PICTURE_MAX_BYTES = 25 * 1024 * 1024;
29128
29193
  var PICTURE_FLOOR = 0.25;
29129
29194
  var PAGE4 = 50;
@@ -29133,18 +29198,18 @@ var missingModel = /* @__PURE__ */ __name((id2) => `the picture model is not dow
29133
29198
  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
29199
  var picturesService = /* @__PURE__ */ __name((deps) => {
29135
29200
  let opened;
29136
- const open10 = /* @__PURE__ */ __name(async () => {
29201
+ const open7 = /* @__PURE__ */ __name(async () => {
29137
29202
  if (deps.pictureEmbedder)
29138
29203
  return deps.pictureEmbedder();
29139
29204
  const model2 = imageModel(DEFAULT_IMAGE_MODEL);
29140
29205
  const directory2 = imageModelsDirectory(deps.env);
29141
29206
  if (!isImageModelInstalled(model2, directory2))
29142
29207
  throw new CliError("not_found", missingModel(model2.id), { reason: "model.not-downloaded", model: model2.id });
29143
- const { openPictureEmbedder } = await import("./embedder-HC6ZARP5.js");
29208
+ const { openPictureEmbedder } = await import("./embedder-T5GJC7M2.js");
29144
29209
  return openPictureEmbedder(model2, directory2);
29145
29210
  }, "open");
29146
29211
  const embedder = /* @__PURE__ */ __name(() => {
29147
- opened ??= open10().catch((error) => {
29212
+ opened ??= open7().catch((error) => {
29148
29213
  opened = void 0;
29149
29214
  throw error;
29150
29215
  });
@@ -29337,8 +29402,8 @@ var withPictures = /* @__PURE__ */ __name((messages, pictures) => ({
29337
29402
  }, "search")
29338
29403
  }), "withPictures");
29339
29404
 
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
29341
- var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, shared) => {
29405
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/messages-meaning.js
29406
+ var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, shared, within) => {
29342
29407
  const target2 = embeddingTarget(deps, DEFAULT_TEXT_MODEL);
29343
29408
  const skipped = /* @__PURE__ */ __name((reason, step) => ({
29344
29409
  skipped: { reason, model: target2.id, ...step ? { step } : {} }
@@ -29356,10 +29421,11 @@ var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, sh
29356
29421
  try {
29357
29422
  const ranked = [];
29358
29423
  if (words2) {
29424
+ const pks = await within?.();
29359
29425
  const lookUp = /* @__PURE__ */ __name(async (embedder) => {
29360
29426
  const [query] = await embedder.embed([words2], "query");
29361
29427
  for (const one of ready) {
29362
- const near2 = await store.vectors.nearestMessages(one, {
29428
+ const near2 = pks ? await store.vectors.scoreMessages(one, { model: target2.key, query, pks }) : await store.vectors.nearestMessages(one, {
29363
29429
  model: target2.key,
29364
29430
  limit: MEANING_DEPTH,
29365
29431
  query
@@ -29385,7 +29451,7 @@ var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, sh
29385
29451
  }
29386
29452
  }, "meaningLane");
29387
29453
 
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
29454
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/messages-rerank.js
29389
29455
  var rerankLane = /* @__PURE__ */ __name((deps) => {
29390
29456
  const choice = deps.reranker ?? DEFAULT_RERANK_MODEL;
29391
29457
  if (choice === "off")
@@ -29397,9 +29463,9 @@ var rerankLane = /* @__PURE__ */ __name((deps) => {
29397
29463
  return { skipped: { reason: `${model.id} is not downloaded`, step: "models.download", model: model.id } };
29398
29464
  try {
29399
29465
  const warm = deps.embedders;
29400
- const reranker = warm ? await warm.reranker(`rerank:${model.id}`, async () => (await import("./process-IX5YWGDP.js")).openRerankerProcess(model, directory2, {
29466
+ const reranker = warm ? await warm.reranker(`rerank:${model.id}`, async () => (await import("./process-XVDX4SPD.js")).openRerankerProcess(model, directory2, {
29401
29467
  threads: defaultThreads()
29402
- })) : await (await import("./rerank-6CBLZBCV.js")).openReranker(model, directory2);
29468
+ })) : await (await import("./rerank-SG653RHT.js")).openReranker(model, directory2);
29403
29469
  return {
29404
29470
  model: model.id,
29405
29471
  score: /* @__PURE__ */ __name((question, passages) => reranker.score(plainWords(question), passages), "score"),
@@ -29419,7 +29485,7 @@ var rerankLane = /* @__PURE__ */ __name((deps) => {
29419
29485
  };
29420
29486
  }, "rerankLane");
29421
29487
 
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
29488
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/document-pictures.js
29423
29489
  import { createHash as createHash10 } from "node:crypto";
29424
29490
  var refOf = /* @__PURE__ */ __name((target2) => target2.ref ?? `document:${target2.documentId}`, "refOf");
29425
29491
  var openPictureEmbedderFor = /* @__PURE__ */ __name(async ({ env, command } = {}) => {
@@ -29427,7 +29493,7 @@ var openPictureEmbedderFor = /* @__PURE__ */ __name(async ({ env, command } = {}
29427
29493
  const directory2 = imageModelsDirectory(env);
29428
29494
  if (!isImageModelInstalled(model, directory2))
29429
29495
  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-HC6ZARP5.js");
29496
+ const { openPictureEmbedder } = await import("./embedder-T5GJC7M2.js");
29431
29497
  return openPictureEmbedder(model, directory2);
29432
29498
  }, "openPictureEmbedderFor");
29433
29499
  var savePicture = /* @__PURE__ */ __name(async (store, target2, bytes2, options = {}) => {
@@ -29448,24 +29514,22 @@ var savePicture = /* @__PURE__ */ __name(async (store, target2, bytes2, options
29448
29514
  }, "savePicture");
29449
29515
  var removePicture = /* @__PURE__ */ __name((store, target2) => store.notes.removePicture(refOf(target2)), "removePicture");
29450
29516
 
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
29517
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/document-source.js
29452
29518
  var documentSource = /* @__PURE__ */ __name((note, accounts, profiles, file) => {
29453
29519
  const metadata = note.frontMatter;
29454
29520
  const account2 = accounts.find(({ id: id2 }) => String(id2) === note.folderId);
29455
29521
  const remote = note.source === "file" && (account2 !== void 0 && kindIn(account2.provider) === "documents" || metadata?.source === "google-drive");
29456
29522
  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
29523
  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
29524
  return {
29460
29525
  kind: remote ? "document" : "note",
29461
29526
  provider: profile ? profile.command : "notes",
29462
29527
  account: profile?.name ?? note.folderId ?? "internal",
29463
- ...remote && url !== void 0 ? { url } : {},
29464
- updated_at: remote && modified !== void 0 ? modified : note.updatedAt
29528
+ ...remote && url !== void 0 ? { url } : {}
29465
29529
  };
29466
29530
  }, "documentSource");
29467
29531
 
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
29532
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/notes-title-tier.js
29469
29533
  var plainQueryWords = /* @__PURE__ */ __name((query) => {
29470
29534
  let root;
29471
29535
  try {
@@ -29492,9 +29556,11 @@ var titleTiers = /* @__PURE__ */ __name((hits, words2) => {
29492
29556
  return [...hits].sort((a, b) => rank(a) - rank(b));
29493
29557
  }, "titleTiers");
29494
29558
 
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" }));
29559
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/notes-search.js
29560
+ var storeQuery = /* @__PURE__ */ __name(async (store, text2, { exact, timezone } = {}) => resolvedQuery(store, parsedQuery(text2, exact), timezone), "storeQuery");
29561
+ var parsedQuery = /* @__PURE__ */ __name((text2, exact) => validateFields(parseLucene(text2, { ...SEARCH_QUERY, defaultField: exact ? "exact" : "text" })).root, "parsedQuery");
29562
+ var resolvedQuery = /* @__PURE__ */ __name(async (store, root, timezone) => {
29563
+ const ast = { root };
29498
29564
  const zone = timezoneOf(timezone);
29499
29565
  const resolve7 = /* @__PURE__ */ __name((node) => {
29500
29566
  if (node.kind === "boolean")
@@ -29515,7 +29581,7 @@ var storeQuery = /* @__PURE__ */ __name(async (store, text2, { exact, timezone }
29515
29581
  root: resolve7(ast.root),
29516
29582
  ...hasStems(ast.root) ? { stemmer: createStemmer(stemmers2 ?? DEFAULT_STEMMERS) } : {}
29517
29583
  };
29518
- }, "storeQuery");
29584
+ }, "resolvedQuery");
29519
29585
  var searchNotesQuery = /* @__PURE__ */ __name(async (store, request) => {
29520
29586
  if (!request.text.trim())
29521
29587
  throw new CliError("validation_error", "say what to find in the notes");
@@ -29580,7 +29646,17 @@ var embedChunks = /* @__PURE__ */ __name(async (store, source, { model: choice,
29580
29646
  var embedNotes = /* @__PURE__ */ __name((store, options = {}) => embedChunks(store, store.notes, options), "embedNotes");
29581
29647
  var embedEvents = /* @__PURE__ */ __name((store, options = {}) => embedChunks(store, store.calendar, options), "embedEvents");
29582
29648
  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 }) => {
29649
+ var nearestNotes = /* @__PURE__ */ __name(async (store, query, options) => {
29650
+ const { key, vector, floor } = await queryVector(store, query, options);
29651
+ const nearest = await store.notes.nearest(key, vector, {
29652
+ limit: options.limit,
29653
+ ...options.folderIds ? { folderIds: options.folderIds } : {},
29654
+ ...options.withInternal ? { withInternal: true } : {},
29655
+ ...options.source ? { source: options.source } : {}
29656
+ });
29657
+ return nearest.filter(({ score }) => score > floor);
29658
+ }, "nearestNotes");
29659
+ var queryVector = /* @__PURE__ */ __name(async (store, query, { model: choice, folderIds, withInternal, source, env, threads, command, embedders }) => {
29584
29660
  if (!query.trim())
29585
29661
  throw new CliError("validation_error", "say what to find in the notes");
29586
29662
  const { model, directory: directory2, key } = localModel(choice, env, command);
@@ -29592,19 +29668,15 @@ var nearestNotes = /* @__PURE__ */ __name(async (store, query, { model: choice,
29592
29668
  if (!await store.notes.embedded(key, scope))
29593
29669
  throw new CliError("not_found", `nothing searched here has vectors of ${model.id} yet, so only words were matched`);
29594
29670
  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");
29671
+ return { key, vector, floor: meaningFloor(key) };
29672
+ }, "queryVector");
29673
+ var nearestAmong = /* @__PURE__ */ __name(async (store, query, refs, options) => {
29674
+ const { key, vector, floor } = await queryVector(store, query, options);
29675
+ return (await store.notes.scoreNotes(key, vector, refs)).filter(({ score }) => score > floor);
29676
+ }, "nearestAmong");
29604
29677
  var MAX_LINE = 200;
29605
29678
  var MAX_NOTES_OFFSET = 1e3;
29606
29679
  var CANDIDATES2 = 50;
29607
- var FILTERED = 500;
29608
29680
  var RRF_K3 = 60;
29609
29681
  var firstLine = /* @__PURE__ */ __name((text2, query) => {
29610
29682
  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 +29734,83 @@ var noteSourceOfQuery = /* @__PURE__ */ __name((query) => {
29662
29734
  }
29663
29735
  return { source, rest };
29664
29736
  }, "noteSourceOfQuery");
29737
+ var EVERY_NOTE = { kind: "predicate", field: "in", operator: "term", value: "notes" };
29738
+ var fieldsOfQuery2 = /* @__PURE__ */ __name((root) => fieldsOfQuery(root, EVERY_NOTE), "fieldsOfQuery");
29739
+ var allOf = /* @__PURE__ */ __name((nodes) => nodes.length <= 1 ? nodes[0] : {
29740
+ kind: "boolean",
29741
+ clauses: nodes.map((node) => ({ occur: "must", node })),
29742
+ span: { start: 0, end: 0 }
29743
+ }, "allOf");
29744
+ var matching = /* @__PURE__ */ __name(async (store, refs, root, scope) => {
29745
+ if (refs.length === 0)
29746
+ return /* @__PURE__ */ new Map();
29747
+ const resolved = await resolvedQuery(store, root ?? { ...EVERY_NOTE, span: { start: 0, end: 0 } }, scope.timezone);
29748
+ const found = await store.notes.search({
29749
+ root: resolved.root,
29750
+ refs,
29751
+ limit: refs.length,
29752
+ ...scope.folderIds ? { folderIds: scope.folderIds } : {},
29753
+ ...scope.withInternal ? { withInternal: true } : {},
29754
+ ...scope.source ? { source: scope.source } : {},
29755
+ ...resolved.stemmer ? { stemmer: resolved.stemmer } : {}
29756
+ });
29757
+ return new Map(found.items.map(({ ref, note, at }) => [ref, { note, at }]));
29758
+ }, "matching");
29759
+ var RANK_WITHIN = 2e3;
29760
+ var filterRefs = /* @__PURE__ */ __name(async (store, narrowing, scope) => {
29761
+ const resolved = await resolvedQuery(store, narrowing, scope.timezone);
29762
+ try {
29763
+ const found = await store.notes.matchingRefs({
29764
+ root: resolved.root,
29765
+ limit: RANK_WITHIN,
29766
+ ...scope.folderIds ? { folderIds: scope.folderIds } : {},
29767
+ ...scope.withInternal ? { withInternal: true } : {},
29768
+ ...scope.source ? { source: scope.source } : {},
29769
+ ...resolved.stemmer ? { stemmer: resolved.stemmer } : {}
29770
+ });
29771
+ return found.hasMore ? void 0 : found.refs;
29772
+ } catch (error) {
29773
+ if (tooLarge(error))
29774
+ return void 0;
29775
+ throw error;
29776
+ }
29777
+ }, "filterRefs");
29778
+ var tooLarge = /* @__PURE__ */ __name((error) => isCliError(error) && error.details.reason === "query.too-large", "tooLarge");
29779
+ var notesTotal = /* @__PURE__ */ __name(async (store, text2, { exact, scope, shown, hasMore }, others, othersComplete) => {
29780
+ let words2;
29781
+ try {
29782
+ const { root, stemmer } = await storeQuery(store, text2, {
29783
+ exact,
29784
+ ...scope.timezone ? { timezone: scope.timezone } : {}
29785
+ });
29786
+ words2 = await store.notes.matchingRefs({
29787
+ root,
29788
+ limit: TOTAL_CAP,
29789
+ ...scope.folderIds ? { folderIds: scope.folderIds } : {},
29790
+ ...scope.withInternal ? { withInternal: true } : {},
29791
+ ...scope.source ? { source: scope.source } : {},
29792
+ ...stemmer ? { stemmer } : {}
29793
+ });
29794
+ } catch (error) {
29795
+ if (tooLarge(error))
29796
+ return totalOf(void 0, shown, hasMore);
29797
+ throw error;
29798
+ }
29799
+ const count3 = (/* @__PURE__ */ new Set([...words2.refs, ...others])).size + (words2.hasMore ? 1 : 0);
29800
+ return totalOf(count3, shown, hasMore, othersComplete);
29801
+ }, "notesTotal");
29665
29802
  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
29803
  const typed = noteSourceOfQuery(query);
29667
29804
  const source = given ?? typed.source;
29668
- const words2 = typed.source !== void 0 && typed.source === source ? typed.rest : query;
29805
+ const rest = typed.source !== void 0 && typed.source === source ? typed.rest : query;
29669
29806
  const label = tag === void 0 ? void 0 : normalizeTag(tag);
29670
29807
  const filter = [expression ? `(${expression})` : "", label === void 0 ? "" : `tag:${label}`].filter(Boolean).join(" AND ") || void 0;
29808
+ const parsed = query.trim() ? parsedQuery(query, exact) : void 0;
29809
+ const words2 = parsed === void 0 ? "" : meaningWords(parsed);
29810
+ const narrowing = allOf([
29811
+ ...parsed === void 0 ? [] : [fieldsOfQuery2(parsed)].filter((node) => node !== void 0),
29812
+ ...filter === void 0 ? [] : [parsedQuery(filter)]
29813
+ ]);
29671
29814
  const text2 = [query.trim() ? `(${query})` : "", filter ?? ""].filter(Boolean).join(" AND ");
29672
29815
  const window2 = offset + limit;
29673
29816
  const scope = {
@@ -29678,33 +29821,44 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
29678
29821
  };
29679
29822
  let meaningSkipped;
29680
29823
  let meaning;
29824
+ let meaningRefs;
29825
+ let meaningComplete = true;
29681
29826
  if (exact)
29682
29827
  meaningSkipped = "--exact searches words as written";
29683
- else if (words2.trim()) {
29828
+ else if (words2) {
29829
+ const lane2 = {
29830
+ command,
29831
+ ...env === void 0 ? {} : { env },
29832
+ ...embedders === void 0 ? {} : { embedders },
29833
+ ...folderIds === void 0 ? {} : { folderIds },
29834
+ ...withInternal ? { withInternal: true } : {},
29835
+ ...source === void 0 ? {} : { source }
29836
+ };
29837
+ const depth = Math.max(window2, CANDIDATES2);
29684
29838
  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 }
29839
+ const within = narrowing === void 0 ? void 0 : await filterRefs(store, narrowing, scope);
29840
+ let nearest;
29841
+ if (within === void 0) {
29842
+ nearest = await nearestNotes(store, words2, { ...lane2, limit: depth });
29843
+ meaningComplete = nearest.length < depth;
29844
+ } else {
29845
+ const ranked2 = within.length ? await nearestAmong(store, words2, within, lane2) : [];
29846
+ meaningRefs = new Set(ranked2.map(({ ref }) => ref));
29847
+ nearest = ranked2.slice(0, depth);
29848
+ }
29849
+ const allowed = await matching(store, nearest.map(({ ref }) => ref), narrowing, scope);
29850
+ meaning = nearest.flatMap(({ ref }) => {
29851
+ const found = allowed.get(ref);
29852
+ return found ? [{ ref, ...found }] : [];
29693
29853
  });
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
- }
29854
+ meaningRefs ??= new Set(meaning.map(({ ref }) => ref));
29701
29855
  } catch (error) {
29702
29856
  if (!(error instanceof CliError && error.code === "not_found"))
29703
29857
  throw error;
29704
29858
  meaningSkipped = error.message;
29705
29859
  }
29706
29860
  }
29707
- const titleWords = plainQueryWords(words2);
29861
+ const titleWords = plainQueryWords(rest);
29708
29862
  const titled = titleWords === void 0 ? { items: [], hasMore: false } : await searchNotesQuery(store, {
29709
29863
  text: [titleQuery(titleWords), filter ?? ""].filter(Boolean).join(" AND "),
29710
29864
  limit: Math.max(window2, CANDIDATES2),
@@ -29721,10 +29875,10 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
29721
29875
  ...scope
29722
29876
  });
29723
29877
  const ranked = /* @__PURE__ */ new Map();
29724
- const add = /* @__PURE__ */ __name((list2, by) => list2.forEach(({ ref, note }, rank) => {
29878
+ const add = /* @__PURE__ */ __name((list2, by) => list2.forEach(({ ref, note, at }, rank) => {
29725
29879
  if (tierRefs.has(ref))
29726
29880
  return;
29727
- const held = ranked.get(ref) ?? { note, score: 0, foundBy: [] };
29881
+ const held = ranked.get(ref) ?? { note, at, score: 0, foundBy: [] };
29728
29882
  held.score += 1 / (RRF_K3 + rank + 1);
29729
29883
  held.foundBy.push(by);
29730
29884
  ranked.set(ref, held);
@@ -29733,16 +29887,17 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
29733
29887
  if (meaning !== void 0)
29734
29888
  add(meaning, "meaning");
29735
29889
  const ordered = [
29736
- ...tier.map(({ ref, note }) => [ref, { note, score: 0, foundBy: ["title"] }]),
29890
+ ...tier.map(({ ref, note, at }) => [ref, { note, at, score: 0, foundBy: ["title"] }]),
29737
29891
  ...[...ranked.entries()].sort(([, a], [, b]) => b.score - a.score)
29738
29892
  ];
29739
29893
  const page = slice ? ordered : ordered.slice(offset, window2);
29740
29894
  const hasMore = slice ? matched.hasMore : ordered.length > window2 || matched.hasMore || titled.hasMore;
29895
+ const total = await notesTotal(store, text2, { exact, scope, shown: offset + page.length, hasMore }, [...tier.map(({ ref }) => ref), ...meaningRefs ?? []], meaningComplete);
29741
29896
  const hits = [];
29742
29897
  const counts = /* @__PURE__ */ new Map();
29743
29898
  const accounts = await store.accounts.storedAccounts();
29744
29899
  const profiles = await store.accounts.profiles();
29745
- for (const [ref, { note, foundBy }] of page) {
29900
+ for (const [ref, { note, at, foundBy }] of page) {
29746
29901
  const links = (await store.notes.links({ from: ref })).map(({ to, targetText, kind, anchor }) => ({
29747
29902
  to,
29748
29903
  target_text: targetText,
@@ -29756,13 +29911,14 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
29756
29911
  path: note.path,
29757
29912
  title: note.title,
29758
29913
  ...documentSource(note, accounts, profiles, note.source === "file" ? (await store.files.ofDocument(note.ref))[0] : void 0),
29914
+ updated_at: at,
29759
29915
  excerpt: firstLine(note.text, words2),
29760
29916
  links,
29761
29917
  found_by: foundBy
29762
29918
  });
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 };
29919
+ for (const link4 of new Map(links.map((link5) => [link5.to ?? `?${link5.target_text}`, link5])).values()) {
29920
+ const key = link4.to ?? `?${link4.target_text}`;
29921
+ const known2 = counts.get(key) ?? { ref: link4.to, name: link4.target_text, notes: 0 };
29766
29922
  known2.notes++;
29767
29923
  counts.set(key, known2);
29768
29924
  }
@@ -29787,6 +29943,10 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
29787
29943
  command,
29788
29944
  embedder: pictureEmbedder
29789
29945
  }) : {};
29946
+ if (lane.pictures && narrowing !== void 0) {
29947
+ const allowed = await matching(store, lane.pictures.map(({ ref }) => ref), narrowing, scope);
29948
+ lane.pictures = lane.pictures.filter(({ ref }) => allowed.has(ref));
29949
+ }
29790
29950
  return {
29791
29951
  query,
29792
29952
  ...label === void 0 ? {} : { tag: label },
@@ -29794,6 +29954,7 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
29794
29954
  by: meaning === void 0 ? "words" : "words and meaning",
29795
29955
  ...meaningSkipped === void 0 ? {} : { meaning_skipped: meaningSkipped },
29796
29956
  hits,
29957
+ total,
29797
29958
  has_more: hasMore,
29798
29959
  ...hasMore && window2 <= MAX_NOTES_OFFSET ? { next_offset: window2 } : {},
29799
29960
  linked: [...counts.values()].sort((a, b) => b.notes - a.notes || (a.name ?? a.ref ?? "").localeCompare(b.name ?? b.ref ?? "")),
@@ -29832,7 +29993,7 @@ var searchNotesOf = /* @__PURE__ */ __name(async (store, account2, text2, { acco
29832
29993
  };
29833
29994
  }, "searchNotesOf");
29834
29995
 
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
29996
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/events-search.js
29836
29997
  var MAX_EVENTS_OFFSET = 1e3;
29837
29998
  var iso = /* @__PURE__ */ __name((at) => at === null ? null : new Date(at).toISOString(), "iso");
29838
29999
  var accountIdsOf = /* @__PURE__ */ __name(async (store, accounts) => {
@@ -29944,7 +30105,7 @@ var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, off
29944
30105
  };
29945
30106
  }, "searchEvents");
29946
30107
 
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
30108
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/search-all.js
29948
30109
  var RESOURCES_SEARCHED = ["messages", "mail", "notes", "events"];
29949
30110
  var skippable = /* @__PURE__ */ __name((error) => error instanceof CliError && (error.code === "validation_error" || error.code === "not_found"), "skippable");
29950
30111
  var filtersBeside = /* @__PURE__ */ __name((text2) => {
@@ -29971,6 +30132,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account2, request, messenge
29971
30132
  let events;
29972
30133
  let messagesBy;
29973
30134
  let server;
30135
+ let coverage;
29974
30136
  const messagesOf = /* @__PURE__ */ __name(async (kind) => {
29975
30137
  const given = request.scope?.[kind];
29976
30138
  const query = {
@@ -29991,6 +30153,8 @@ var searchAll = /* @__PURE__ */ __name(async (store, account2, request, messenge
29991
30153
  const found = kind === "messages" ? await searchMessages(query) : await searchStore(store, account2, query, messenger);
29992
30154
  if (found.server)
29993
30155
  server = found.server;
30156
+ if (kind === "messages" && found.coverage)
30157
+ coverage = found.coverage;
29994
30158
  hasMore ||= found.hasMore;
29995
30159
  const read = found.coverage?.accounts ?? given ?? (await store.accounts.accounts()).filter(({ provider }) => kindIn(provider) === kind);
29996
30160
  for (const one of found.skipped ?? [])
@@ -30028,7 +30192,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account2, request, messenge
30028
30192
  return byWords;
30029
30193
  }
30030
30194
  messagesBy = { by: "words and meaning", ...lane.partly ? { meaningSkipped: lane.partly } : {} };
30031
- const near2 = await nearEligible(store, account2, query, messenger, lane.ranked, filters ?? "");
30195
+ const near2 = await nearEligible(store, account2, query, messenger, lane.ranked, filters ? { text: filters } : {});
30032
30196
  const fused2 = /* @__PURE__ */ new Map();
30033
30197
  byWords.forEach((item, rank) => {
30034
30198
  fused2.set(item.ref, { item, score: 1 / (RRF_K3 + rank + 1) });
@@ -30144,11 +30308,12 @@ var searchAll = /* @__PURE__ */ __name(async (store, account2, request, messenge
30144
30308
  ...notes === void 0 ? {} : { notes },
30145
30309
  ...events === void 0 ? {} : { events },
30146
30310
  ...messagesBy === void 0 ? {} : { messages: messagesBy },
30147
- ...server === void 0 ? {} : { server }
30311
+ ...server === void 0 ? {} : { server },
30312
+ ...coverage === void 0 ? {} : { coverage }
30148
30313
  };
30149
30314
  }, "searchAll");
30150
30315
 
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
30316
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/search-all-meetings.js
30152
30317
  var RESOURCES_SEARCHED_WITH_MEETINGS = [...RESOURCES_SEARCHED, "meetings"];
30153
30318
  var whole2 = /* @__PURE__ */ __name((value, minimum, maximum, label) => {
30154
30319
  if (!Number.isSafeInteger(value) || value < minimum || value > maximum)
@@ -30395,7 +30560,7 @@ var searchAllOfSource = /* @__PURE__ */ __name(async (store, account2, source, r
30395
30560
  return { ...found, skipped: [...skipped, ...empty2, ...unnamed, ...found.skipped] };
30396
30561
  }, "searchAllOfSource");
30397
30562
 
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
30563
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/server-search.js
30399
30564
  var SERVER_SEARCH_KEY = "messages.server-search";
30400
30565
  var SERVER_BOUNDS = { timeMs: 5e3, perCall: 100, maxCalls: 3 };
30401
30566
  var DEFAULT_BACKEND = "both";
@@ -30520,7 +30685,7 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
30520
30685
  const calls = unique.slice(0, SERVER_BOUNDS.maxCalls);
30521
30686
  const pending = new Set(calls);
30522
30687
  const found = [];
30523
- let open10 = true;
30688
+ let open7 = true;
30524
30689
  const fail3 = /* @__PURE__ */ __name((branch, reason) => {
30525
30690
  pending.delete(branch);
30526
30691
  report.complete = false;
@@ -30529,19 +30694,19 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
30529
30694
  const ask = /* @__PURE__ */ __name(async (adapter) => {
30530
30695
  const search = capability(adapter, "searchMessages", "search messages on its server");
30531
30696
  await Promise.all(calls.map(async (branch) => {
30532
- if (!open10)
30697
+ if (!open7)
30533
30698
  return;
30534
30699
  report.calls += 1;
30535
30700
  try {
30536
30701
  const page = await search(asQuery(branch), { limit: SERVER_BOUNDS.perCall, signal: stop });
30537
- if (!open10)
30702
+ if (!open7)
30538
30703
  return;
30539
30704
  pending.delete(branch);
30540
30705
  if (page.hasMore)
30541
30706
  report.complete = false;
30542
30707
  found.push(page);
30543
30708
  } catch (error) {
30544
- if (!open10)
30709
+ if (!open7)
30545
30710
  return;
30546
30711
  fail3(branch, error instanceof CliError && error.code === "rate_limited" ? "rate_limited" : "search_failed");
30547
30712
  }
@@ -30553,11 +30718,11 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
30553
30718
  run.then(() => "done", () => "failed"),
30554
30719
  bound2
30555
30720
  ]);
30556
- open10 = false;
30721
+ open7 = false;
30557
30722
  for (const branch of [...pending])
30558
30723
  fail3(branch, outcome2 === "failed" ? "search_failed" : "time_or_abort_bound");
30559
30724
  } finally {
30560
- open10 = false;
30725
+ open7 = false;
30561
30726
  clearTimeout(timer);
30562
30727
  }
30563
30728
  const chats = new Map(found.flatMap(({ chats: chats2 }) => chats2).map((chat) => [chat.id, chat]));
@@ -30584,7 +30749,7 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
30584
30749
  return { report, sources };
30585
30750
  }, "searchServer");
30586
30751
 
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
30752
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/messages.js
30588
30753
  var DELETE_AT_ONCE = 10;
30589
30754
  var messagesService = /* @__PURE__ */ __name((deps) => {
30590
30755
  const { guard } = deps;
@@ -31010,7 +31175,7 @@ var checkMediaOptions = /* @__PURE__ */ __name((messenger, asked, attachments) =
31010
31175
  throw new CliError("validation_error", `${MEDIA_FLAGS[first2]} needs a --photo or --file`);
31011
31176
  }, "checkMediaOptions");
31012
31177
 
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
31178
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/domain/channel-tags.js
31014
31179
  var CHANNEL_TAG_RULES_VERSION = "keywords-v1";
31015
31180
  var RULES = {
31016
31181
  ai: [/\b(ai|gpt|llm|machine learning|artificial intelligence)\b/iu, /нейросет|искусственн/iu],
@@ -31025,7 +31190,7 @@ var classifyChannel = /* @__PURE__ */ __name((metadata) => Object.entries(RULES)
31025
31190
  return fields.length ? [{ tag, score: fields.length / 3, fields }] : [];
31026
31191
  }), "classifyChannel");
31027
31192
 
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
31193
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/metadata.js
31029
31194
  var metadataService = /* @__PURE__ */ __name((deps) => {
31030
31195
  const held = /* @__PURE__ */ __name(async (reference, { includeLeft = false } = {}) => {
31031
31196
  const store = await deps.store();
@@ -31111,7 +31276,7 @@ var metadataService = /* @__PURE__ */ __name((deps) => {
31111
31276
  };
31112
31277
  }, "metadataService");
31113
31278
 
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
31279
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/moderation/run.js
31115
31280
  var FIRST_LOOK_MS = 24 * 36e5;
31116
31281
  var moderateWith = /* @__PURE__ */ __name(async (run) => {
31117
31282
  const { chatId, title, rules, point, since, dryRun } = run;
@@ -31148,7 +31313,7 @@ var moderateWith = /* @__PURE__ */ __name(async (run) => {
31148
31313
  return { chatId, rows, notes };
31149
31314
  }, "moderateWith");
31150
31315
 
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
31316
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/moderation.js
31152
31317
  var moderationService = /* @__PURE__ */ __name((deps) => {
31153
31318
  const file = /* @__PURE__ */ __name(() => new ModerationRules(moderationPathFor(deps.messenger.app, deps.profile ?? "default", deps.env ?? process.env)), "file");
31154
31319
  const group = /* @__PURE__ */ __name(async (chat) => {
@@ -31226,7 +31391,7 @@ var moderatorOf = /* @__PURE__ */ __name((adapter, deps) => ({
31226
31391
  }, "removePerson")
31227
31392
  }), "moderatorOf");
31228
31393
 
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
31394
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/person-context.js
31230
31395
  var CONTEXT_MESSAGES2 = 10;
31231
31396
  var CONTEXT_BYTES = 64 * 1024;
31232
31397
  var toContext = /* @__PURE__ */ __name((key, message, chatTitle) => ({
@@ -31482,10 +31647,10 @@ var personMessages = /* @__PURE__ */ __name(async (store, asked, reference, { ch
31482
31647
  };
31483
31648
  }, "personMessages");
31484
31649
 
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
31650
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
31486
31651
  import { createHash as createHash11 } from "node:crypto";
31487
31652
 
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
31653
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-reference.js
31489
31654
  var missing3 = /* @__PURE__ */ __name(() => new CliError("not_found", "the meeting evidence is unavailable for this account"), "missing");
31490
31655
  var authorizedMeetingMetadata = /* @__PURE__ */ __name(async (store, accountId, reference, options = {}) => {
31491
31656
  const parsed = parseMeetingReference(reference);
@@ -31533,7 +31698,7 @@ var resolveMeetingReference = /* @__PURE__ */ __name(async (store, accountId, re
31533
31698
  };
31534
31699
  }, "resolveMeetingReference");
31535
31700
 
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
31701
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
31537
31702
  var hash = /* @__PURE__ */ __name((value) => createHash11("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
31538
31703
  var checkMeetingCancelled = /* @__PURE__ */ __name((signal) => {
31539
31704
  if (signal?.aborted)
@@ -31732,7 +31897,7 @@ var readMeetingEvidence = /* @__PURE__ */ __name(async (store, accountId, refere
31732
31897
  return { ...packet, fingerprint: hash(packet) };
31733
31898
  }, "readMeetingEvidence");
31734
31899
 
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
31900
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/person-meeting-context.js
31736
31901
  var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference, options) => {
31737
31902
  const { meetings = 10, cues = 5, bytes: bytes2 = 64 * 1024, scanLimit = 1e3, since, signal } = options;
31738
31903
  const requestedAccounts = options.accountIds;
@@ -31831,7 +31996,7 @@ var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference,
31831
31996
  };
31832
31997
  }, "personMeetingContext");
31833
31998
 
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
31999
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/person-preparation.js
31835
32000
  var PREPARE_BYTES = 96 * 1024;
31836
32001
  var MEETINGS = 5;
31837
32002
  var CUES = 3;
@@ -31948,7 +32113,7 @@ var meetingsOf = /* @__PURE__ */ __name(async (store, uid, stored, since, left)
31948
32113
  }
31949
32114
  }, "meetingsOf");
31950
32115
 
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
32116
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/person-profile.js
31952
32117
  var personProfile = /* @__PURE__ */ __name(async (deps, person, known2) => {
31953
32118
  const online = deps.offline ? void 0 : await deps.connection();
31954
32119
  const held = await storeIfOpen(deps);
@@ -32018,7 +32183,7 @@ var quiet = /* @__PURE__ */ __name((facts) => facts.chats.map(({ id: id2, title,
32018
32183
  complete: false
32019
32184
  })), "quiet");
32020
32185
 
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
32186
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/person-timeline.js
32022
32187
  var TIMELINE_ITEMS = 50;
32023
32188
  var TIMELINE_MAX = 500;
32024
32189
  var SCOPES = ["personal", "work"];
@@ -32073,7 +32238,7 @@ var personTimeline = /* @__PURE__ */ __name(async (store, asked, reference, { sc
32073
32238
  };
32074
32239
  }, "personTimeline");
32075
32240
 
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
32241
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/people.js
32077
32242
  var peopleService = /* @__PURE__ */ __name((deps) => {
32078
32243
  const localCard = /* @__PURE__ */ __name(async (card, includeNotes = false) => {
32079
32244
  const held = await storeIfOpen(deps);
@@ -32300,7 +32465,7 @@ var withoutPhone = /* @__PURE__ */ __name((answer) => {
32300
32465
  return rest;
32301
32466
  }, "withoutPhone");
32302
32467
 
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
32468
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/private-people.js
32304
32469
  var noteItem = /* @__PURE__ */ __name((provider, note) => ({
32305
32470
  id: note.id,
32306
32471
  contact: formatReference({ type: "contact", provider, id: note.personId }),
@@ -32344,7 +32509,7 @@ var privatePeopleService = /* @__PURE__ */ __name((deps) => {
32344
32509
  };
32345
32510
  }, "privatePeopleService");
32346
32511
 
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
32512
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/rankings.js
32348
32513
  var empty = /* @__PURE__ */ __name(() => ({
32349
32514
  total: 0,
32350
32515
  population: 0,
@@ -32600,7 +32765,7 @@ var rankingsService = /* @__PURE__ */ __name((deps) => ({
32600
32765
  }, "evidence")
32601
32766
  }), "rankingsService");
32602
32767
 
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
32768
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/searches.js
32604
32769
  var savedSearchItem = /* @__PURE__ */ __name((one) => ({
32605
32770
  id: one.id,
32606
32771
  name: one.name,
@@ -32729,7 +32894,7 @@ var searchesService = /* @__PURE__ */ __name((deps) => {
32729
32894
  };
32730
32895
  }, "searchesService");
32731
32896
 
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
32897
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/tags.js
32733
32898
  var TAGGING_QUERY = {
32734
32899
  entity: "tagging",
32735
32900
  backend: "sql",
@@ -32813,7 +32978,7 @@ var tagsService = /* @__PURE__ */ __name((deps) => {
32813
32978
  };
32814
32979
  }, "tagsService");
32815
32980
 
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
32981
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/tasks.js
32817
32982
  var TASK_QUERY = {
32818
32983
  entity: "task",
32819
32984
  backend: "sql",
@@ -32945,13 +33110,13 @@ var tasksService = /* @__PURE__ */ __name((deps, categories) => {
32945
33110
  store.notes.links({ from: details.ref }),
32946
33111
  store.notes.links({ to: details.ref })
32947
33112
  ]);
32948
- return { ...details, links, linkedFrom: incoming.filter((link5) => link5.from.startsWith("task:")) };
33113
+ return { ...details, links, linkedFrom: incoming.filter((link4) => link4.from.startsWith("task:")) };
32949
33114
  }, "cardOf");
32950
33115
  const planOf = /* @__PURE__ */ __name(async (store, id2, plan, by) => {
32951
33116
  if (plan.category !== void 0)
32952
33117
  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))
33118
+ const open7 = (await store.tasks.details(id2)).status === "open";
33119
+ if (!open7 && (plan.dueAt != null || plan.nextCheckAt != null))
32955
33120
  throw new CliError("validation_error", "a closed task takes no due date or next check; it stays closed");
32956
33121
  const { assignees, ...fields } = plan;
32957
33122
  const author = by === "owner" ? "owner" : { bot: by };
@@ -33037,17 +33202,17 @@ var tasksService = /* @__PURE__ */ __name((deps, categories) => {
33037
33202
  if (choice.attach !== void 0) {
33038
33203
  const target2 = await owned(store, account2, choice.attach);
33039
33204
  const similarity = await store.tasks.compare(subject, target2.id);
33040
- const link5 = {
33205
+ const link4 = {
33041
33206
  from: (await store.tasks.details(target2.id)).ref,
33042
33207
  kind: "evidence",
33043
33208
  origin: origin === "owner" ? "owner" : "suggested"
33044
33209
  };
33045
33210
  try {
33046
- await store.notes.addLink({ ...link5, to: note ? note.ref : source });
33211
+ await store.notes.addLink({ ...link4, to: note ? note.ref : source });
33047
33212
  } catch (error) {
33048
33213
  if (!(error instanceof CliError && error.code === "not_found" && !note))
33049
33214
  throw error;
33050
- await store.notes.addLink({ ...link5, targetText: source });
33215
+ await store.notes.addLink({ ...link4, targetText: source });
33051
33216
  }
33052
33217
  await store.tasks.recordPair({ source, other: target2.id, decision: "attached", similarity, by });
33053
33218
  const review = await reviewAfterLink(store, target2.id);
@@ -33293,7 +33458,7 @@ var taskView = /* @__PURE__ */ __name(async (store, account2, task2) => {
33293
33458
  };
33294
33459
  }, "taskView");
33295
33460
 
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
33461
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/topics.js
33297
33462
  var actionOf = /* @__PURE__ */ __name(({ title, closed, pinned, hidden }) => {
33298
33463
  const set = [closed, pinned, hidden].filter((one) => one !== void 0).length;
33299
33464
  if (title !== void 0 || set !== 1)
@@ -33478,8 +33643,8 @@ var topicsService = /* @__PURE__ */ __name((deps) => {
33478
33643
  };
33479
33644
  }, "topicsService");
33480
33645
 
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";
33646
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/evidence.js
33647
+ import { createHash as createHash12, randomUUID as randomUUID5 } from "node:crypto";
33483
33648
  var hash2 = /* @__PURE__ */ __name((value) => createHash12("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
33484
33649
  var positive = /* @__PURE__ */ __name((value, name, minimum = 1) => {
33485
33650
  if (!Number.isSafeInteger(value) || value < minimum)
@@ -33549,10 +33714,10 @@ var prepareEvidencePacket = /* @__PURE__ */ __name(({ kind, source, page, limits
33549
33714
  },
33550
33715
  items
33551
33716
  };
33552
- return { ...content, id: randomUUID7(), fingerprint: hash2(content) };
33717
+ return { ...content, id: randomUUID5(), fingerprint: hash2(content) };
33553
33718
  }, "prepareEvidencePacket");
33554
33719
 
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
33720
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/evidence-read.js
33556
33721
  var readEvidencePacket = /* @__PURE__ */ __name(async (store, account2, { chat, limit, before: before2 }, messenger = {}) => {
33557
33722
  if (!Number.isSafeInteger(limit) || limit < 1 || limit > 100)
33558
33723
  throw new CliError("validation_error", "evidence message limit must be an integer from 1 to 100");
@@ -33572,7 +33737,7 @@ var readEvidencePacket = /* @__PURE__ */ __name(async (store, account2, { chat,
33572
33737
  return { ...packet, nextBeforeId: older && last ? last.id : null };
33573
33738
  }, "readEvidencePacket");
33574
33739
 
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
33740
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-hit-search.js
33576
33741
  var refreshMeetingIndex = /* @__PURE__ */ __name(async (meetings, accountId, signal) => {
33577
33742
  let before2 = Number.POSITIVE_INFINITY;
33578
33743
  for (; ; ) {
@@ -33634,7 +33799,7 @@ var searchMeetingHits = /* @__PURE__ */ __name(async (store, query, request, opt
33634
33799
  return { ...result, selection };
33635
33800
  }, "searchMeetingHits");
33636
33801
 
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
33802
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-links.js
33638
33803
  var readMeetingLinks = /* @__PURE__ */ __name(async (store, request) => {
33639
33804
  const { maxMessages, url, ...selecting } = request;
33640
33805
  const { input, selection } = await resolveMeetingSelection(store, selecting);
@@ -33647,7 +33812,7 @@ var readMeetingLinks = /* @__PURE__ */ __name(async (store, request) => {
33647
33812
  for (const found of findMentions(line2.text)) {
33648
33813
  if (found.kind !== "url" || url !== void 0 && found.value !== url)
33649
33814
  continue;
33650
- const link5 = links.get(found.value) ?? {
33815
+ const link4 = links.get(found.value) ?? {
33651
33816
  url: found.value,
33652
33817
  domain: found.domain,
33653
33818
  documentId: googleDocumentId(found.value),
@@ -33657,13 +33822,13 @@ var readMeetingLinks = /* @__PURE__ */ __name(async (store, request) => {
33657
33822
  senders: [],
33658
33823
  meetings: []
33659
33824
  };
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);
33825
+ link4.count += 1;
33826
+ link4.lastAt = line2.sentAt;
33827
+ if (line2.sender !== null && !link4.senders.includes(line2.sender))
33828
+ link4.senders.push(line2.sender);
33829
+ if (!link4.meetings.some((one) => one.meetingId === line2.meetingId))
33830
+ link4.meetings.push({ meetingId: line2.meetingId, accountId: line2.accountId, title: line2.title });
33831
+ links.set(found.value, link4);
33667
33832
  }
33668
33833
  return {
33669
33834
  items: [...links.values()].sort((a, b) => b.count - a.count || b.lastAt - a.lastAt),
@@ -33673,10 +33838,10 @@ var readMeetingLinks = /* @__PURE__ */ __name(async (store, request) => {
33673
33838
  };
33674
33839
  }, "readMeetingLinks");
33675
33840
 
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
33841
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidates.js
33677
33842
  import { createHash as createHash13 } from "node:crypto";
33678
33843
 
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
33844
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidate-validation.js
33680
33845
  function invalid3(field, response = false) {
33681
33846
  throw new CliError(response ? "invalid_response" : "validation_error", `invalid project candidate ${field}`);
33682
33847
  }
@@ -33795,7 +33960,7 @@ var candidateCatalog = /* @__PURE__ */ __name((catalog, limits) => {
33795
33960
  }
33796
33961
  }, "candidateCatalog");
33797
33962
 
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
33963
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidates.js
33799
33964
  var createMeetingProjectCandidateReader = /* @__PURE__ */ __name((scope, accountId, ports) => {
33800
33965
  const fixed = snapshotMeetingScope(scope);
33801
33966
  if (!Number.isSafeInteger(accountId) || accountId < 1 || typeof ports?.vocabulary?.vocabulary !== "function")
@@ -33848,7 +34013,7 @@ var createMeetingProjectCandidateReader = /* @__PURE__ */ __name((scope, account
33848
34013
  };
33849
34014
  }, "createMeetingProjectCandidateReader");
33850
34015
 
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
34016
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-project-discovery.js
33852
34017
  import { createHash as createHash14 } from "node:crypto";
33853
34018
  var scopeKeys = [
33854
34019
  "accountId",
@@ -33983,7 +34148,7 @@ var readMeetingProjectDiscovery = /* @__PURE__ */ __name(async (ports, projectNa
33983
34148
  };
33984
34149
  }, "readMeetingProjectDiscovery");
33985
34150
 
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
34151
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-review.js
33987
34152
  var readMeetingReview = /* @__PURE__ */ __name(async (store, request) => {
33988
34153
  const { limit, ...selecting } = request;
33989
34154
  const { input, selection } = await resolveMeetingSelection(store, selecting);
@@ -33991,7 +34156,7 @@ var readMeetingReview = /* @__PURE__ */ __name(async (store, request) => {
33991
34156
  return { ...review, selection };
33992
34157
  }, "readMeetingReview");
33993
34158
 
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
34159
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-searches.js
33995
34160
  var KIND = ["meetings-search"];
33996
34161
  var meetingSearchesService = /* @__PURE__ */ __name((searches) => {
33997
34162
  const found = /* @__PURE__ */ __name(async (reference) => {
@@ -34021,7 +34186,7 @@ var meetingSearchesService = /* @__PURE__ */ __name((searches) => {
34021
34186
  };
34022
34187
  }, "meetingSearchesService");
34023
34188
 
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
34189
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-stats.js
34025
34190
  var readMeetingStats = /* @__PURE__ */ __name(async (store, request) => {
34026
34191
  const { timeZone, maxRows, ...selecting } = request;
34027
34192
  const { input, selection } = await resolveMeetingSelection(store, selecting);
@@ -34033,7 +34198,7 @@ var readMeetingStats = /* @__PURE__ */ __name(async (store, request) => {
34033
34198
  return { ...stats, selection };
34034
34199
  }, "readMeetingStats");
34035
34200
 
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
34201
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-hit-context.js
34037
34202
  import { createHash as createHash15 } from "node:crypto";
34038
34203
  var contextCue = /* @__PURE__ */ __name((cue) => ({
34039
34204
  ref: cue.reference,
@@ -34151,7 +34316,7 @@ var readMeetingHitContext = /* @__PURE__ */ __name(async (store, accountId, refe
34151
34316
  return { ...packet, fingerprint: createHash15("sha256").update(JSON.stringify(packet)).digest("hex") };
34152
34317
  }, "readMeetingHitContext");
34153
34318
 
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
34319
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-passage-format.js
34155
34320
  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
34321
  var markdown = /* @__PURE__ */ __name((text2) => visible(text2).replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replace(/[\\`*_[\]#|~]/g, "\\$&"), "markdown");
34157
34322
  var timestamp = /* @__PURE__ */ __name((ms) => {
@@ -34228,7 +34393,7 @@ var readMeetingPassage = /* @__PURE__ */ __name(async (store, accountId, referen
34228
34393
  return { packet, content };
34229
34394
  }, "readMeetingPassage");
34230
34395
 
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
34396
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-batch.js
34232
34397
  var createMeetingBatchReader = /* @__PURE__ */ __name((store, accountId) => {
34233
34398
  if (!Number.isSafeInteger(accountId) || accountId < 1)
34234
34399
  throw new CliError("validation_error", "choose a positive meeting account");
@@ -34242,10 +34407,10 @@ var createMeetingBatchReader = /* @__PURE__ */ __name((store, accountId) => {
34242
34407
  };
34243
34408
  }, "createMeetingBatchReader");
34244
34409
 
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
34410
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-combined.js
34246
34411
  import { createHash as createHash16 } from "node:crypto";
34247
34412
 
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
34413
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-semantic.js
34249
34414
  var positive2 = /* @__PURE__ */ __name((value, name, max) => {
34250
34415
  if (!Number.isSafeInteger(value) || value < 1 || value > max)
34251
34416
  throw new CliError("validation_error", `Invalid ${name}`);
@@ -34397,7 +34562,7 @@ var applyMeetingEmbedding = /* @__PURE__ */ __name(async (store, accountId, embe
34397
34562
  };
34398
34563
  }, "applyMeetingEmbedding");
34399
34564
 
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
34565
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-combined.js
34401
34566
  var DEPTH = 200;
34402
34567
  var cursorOf3 = /* @__PURE__ */ __name((value, key) => {
34403
34568
  if (value === void 0)
@@ -34534,7 +34699,7 @@ var searchMeetingsCombined = /* @__PURE__ */ __name(async (store, embedder, type
34534
34699
  };
34535
34700
  }, "searchMeetingsCombined");
34536
34701
 
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
34702
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-context.js
34538
34703
  var meetingReferences = /* @__PURE__ */ __name((values) => values.map((value) => formatMeetingReference(parseMeetingReference(value))), "meetingReferences");
34539
34704
  var checkCancelled = /* @__PURE__ */ __name((signal) => {
34540
34705
  if (!signal?.aborted)
@@ -34639,7 +34804,7 @@ var createMeetingContextService = /* @__PURE__ */ __name(async (store, input, op
34639
34804
  };
34640
34805
  }, "createMeetingContextService");
34641
34806
 
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
34807
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-model.js
34643
34808
  var integer = /* @__PURE__ */ __name((value, name, max) => {
34644
34809
  if (!Number.isSafeInteger(value) || value < 1 || value > max)
34645
34810
  throw new CliError("validation_error", `Invalid ${name}`);
@@ -34866,7 +35031,7 @@ var openMeetingEmbedder = /* @__PURE__ */ __name(async (choice, options = {}) =>
34866
35031
  };
34867
35032
  }, "openMeetingEmbedder");
34868
35033
 
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
35034
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/context/communication-selection.js
34870
35035
  var communicationFields = {
34871
35036
  sources: pipe(array(strictObject({
34872
35037
  id: pipe(string(), regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/)),
@@ -34898,7 +35063,7 @@ var communicationRequest = /* @__PURE__ */ __name((value, preparationAfter) => {
34898
35063
  return { ...input, after, before: before2 };
34899
35064
  }, "communicationRequest");
34900
35065
 
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
35066
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-preparation-validation.js
34902
35067
  var MEETING_PREPARATION_LIMITS = {
34903
35068
  meetings: { min: 1, max: 20, default: 5 },
34904
35069
  cues: { min: 1, max: 100, default: 10 },
@@ -34984,7 +35149,7 @@ var preparationRequest = /* @__PURE__ */ __name((accountId, externalId, original
34984
35149
  return { ...input, history };
34985
35150
  }, "preparationRequest");
34986
35151
 
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
35152
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-communications-preparation.js
34988
35153
  var readPreparationCommunications = /* @__PURE__ */ __name(async (plan, signal) => {
34989
35154
  const section = {
34990
35155
  readUsage: plan.reader.usage(),
@@ -35089,7 +35254,7 @@ var appendPreparationCommunications = /* @__PURE__ */ __name((result, read) => {
35089
35254
  result.knowledge.coverage.otherSources = "see-communications";
35090
35255
  }, "appendPreparationCommunications");
35091
35256
 
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
35257
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-communications-selection.js
35093
35258
  var captureCommunicationSelections = /* @__PURE__ */ __name((port) => {
35094
35259
  if (port === void 0)
35095
35260
  return void 0;
@@ -35194,7 +35359,7 @@ var validatePreparationCommunications = /* @__PURE__ */ __name((section, request
35194
35359
  }
35195
35360
  }, "validatePreparationCommunications");
35196
35361
 
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
35362
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-knowledge-preparation.js
35198
35363
  var invalid4 = /* @__PURE__ */ __name(() => {
35199
35364
  throw new CliError("invalid_response", "Preparation knowledge returned an invalid selection");
35200
35365
  }, "invalid");
@@ -35263,7 +35428,7 @@ var appendKnowledgePreparation = /* @__PURE__ */ __name(async (store, result, in
35263
35428
  }
35264
35429
  }, "appendKnowledgePreparation");
35265
35430
 
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
35431
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-notes-preparation.js
35267
35432
  var invalid5 = /* @__PURE__ */ __name(() => {
35268
35433
  throw new CliError("invalid_response", "Preparation notes returned an invalid selection");
35269
35434
  }, "invalid");
@@ -35337,7 +35502,7 @@ var appendNotesPreparation = /* @__PURE__ */ __name(async (store, result, input)
35337
35502
  }
35338
35503
  }, "appendNotesPreparation");
35339
35504
 
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
35505
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-project-preparation.js
35341
35506
  var PAGE_LIMIT = 4;
35342
35507
  var size2 = /* @__PURE__ */ __name((value) => Buffer.byteLength(JSON.stringify(value), "utf8"), "size");
35343
35508
  var appendProjectPreparation = /* @__PURE__ */ __name(async (ports, result, input) => {
@@ -35387,7 +35552,7 @@ var appendProjectPreparation = /* @__PURE__ */ __name(async (ports, result, inpu
35387
35552
  }
35388
35553
  }, "appendProjectPreparation");
35389
35554
 
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
35555
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-related-preparation.js
35391
35556
  var appendRelatedPreparation = /* @__PURE__ */ __name(async (store, result, input) => {
35392
35557
  if (!result.series || !result.items.length || result.coverage.outputLimited)
35393
35558
  return;
@@ -35459,7 +35624,7 @@ var appendRelatedPreparation = /* @__PURE__ */ __name(async (store, result, inpu
35459
35624
  }
35460
35625
  }, "appendRelatedPreparation");
35461
35626
 
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
35627
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-preparation.js
35463
35628
  var size3 = /* @__PURE__ */ __name((value) => Buffer.byteLength(JSON.stringify(value), "utf8"), "size");
35464
35629
  var createMeetingPreparationService = /* @__PURE__ */ __name((scope, accountId, ports) => {
35465
35630
  const fixed = snapshotMeetingScope(scope);
@@ -35597,7 +35762,7 @@ var createMeetingPreparationService = /* @__PURE__ */ __name((scope, accountId,
35597
35762
  };
35598
35763
  }, "createMeetingPreparationService");
35599
35764
 
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
35765
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-task-proposal.js
35601
35766
  import { createHash as createHash17 } from "node:crypto";
35602
35767
  var proposeMeetingTask = /* @__PURE__ */ __name(async (store, accountId, reference, kind) => {
35603
35768
  if (!TASK_KINDS.includes(kind))
@@ -35617,7 +35782,7 @@ var proposeMeetingTask = /* @__PURE__ */ __name(async (store, accountId, referen
35617
35782
  };
35618
35783
  }, "proposeMeetingTask");
35619
35784
 
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
35785
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/meeting-tasks.js
35621
35786
  var accountSnapshot = /* @__PURE__ */ __name((key) => {
35622
35787
  const { provider, account: account2, scope } = key;
35623
35788
  if (!provider.trim() || provider.includes(":") || !account2.trim())
@@ -35680,7 +35845,7 @@ var readMeetingTask = /* @__PURE__ */ __name(async (store, account2, id2) => {
35680
35845
  }
35681
35846
  }, "readMeetingTask");
35682
35847
 
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
35848
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/package-upgrade.js
35684
35849
  var upgradePackage = /* @__PURE__ */ __name(async ({ current, command, packageName, check }, ports) => {
35685
35850
  const installer = ports.installer();
35686
35851
  const argv = updateCommand(installer, packageName);
@@ -35745,7 +35910,7 @@ var dayAfter = /* @__PURE__ */ __name((published) => {
35745
35910
  return Number.isNaN(time) ? null : new Date(time + 24 * 60 * 60 * 1e3).toISOString();
35746
35911
  }, "dayAfter");
35747
35912
 
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
35913
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/proposal-tasks.js
35749
35914
  var proposalSource = /* @__PURE__ */ __name((id2) => `proposed-action:${id2}`, "proposalSource");
35750
35915
  var approveAsTask = /* @__PURE__ */ __name(async (store, id2) => {
35751
35916
  const proposal = await store.proposedActions.get(id2);
@@ -35774,7 +35939,7 @@ var approveAsTask = /* @__PURE__ */ __name(async (store, id2) => {
35774
35939
  return { proposal: await store.proposedActions.approve(proposal.id, { task: task2.id }), task: task2 };
35775
35940
  }, "approveAsTask");
35776
35941
 
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
35942
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/stored-meeting-project-candidate-validation.js
35778
35943
  var storedCandidateRequest = /* @__PURE__ */ __name((reference, accountId, options) => {
35779
35944
  const invalid6 = /* @__PURE__ */ __name((field) => {
35780
35945
  throw new CliError("validation_error", `invalid stored project candidate ${field}`);
@@ -35816,7 +35981,7 @@ var storedCandidateRequest = /* @__PURE__ */ __name((reference, accountId, optio
35816
35981
  return { reference, limits, after, afterTranscriptId, signal };
35817
35982
  }, "storedCandidateRequest");
35818
35983
 
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
35984
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/stored-meeting-project-candidates.js
35820
35985
  var createStoredMeetingProjectCandidateReader = /* @__PURE__ */ __name((scope, accountId, ports) => {
35821
35986
  const fixed = snapshotMeetingScope(scope);
35822
35987
  const store = ports?.meetings;
@@ -35908,7 +36073,7 @@ var createStoredMeetingProjectCandidateReader = /* @__PURE__ */ __name((scope, a
35908
36073
  };
35909
36074
  }, "createStoredMeetingProjectCandidateReader");
35910
36075
 
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
36076
+ // node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/services/index.js
35912
36077
  var servicesFor = /* @__PURE__ */ __name((deps) => {
35913
36078
  const pictures = picturesService(deps);
35914
36079
  const base = {
@@ -35958,14 +36123,9 @@ export {
35958
36123
  storeOnlyDeps,
35959
36124
  REGISTRIES,
35960
36125
  registriesCover,
36126
+ chatCoverage,
35961
36127
  createContextEvidenceReader,
35962
36128
  excerpt,
35963
- writeFileAtomic,
35964
- openOrdinaryFile,
35965
- syncDirectory,
35966
- readBoundedUtf8File,
35967
- nativeWriterLeaseStore,
35968
- acquireLock,
35969
36129
  NativeRecordingPartialStore,
35970
36130
  NativeRecordingPublication,
35971
36131
  validateMediaSince,
@@ -35980,6 +36140,8 @@ export {
35980
36140
  storedNeighbours,
35981
36141
  gatherProjectEvidence,
35982
36142
  findEvidenceMentions,
36143
+ canonicalProjectRef,
36144
+ gatherStoredProject,
35983
36145
  throughWrapper,
35984
36146
  capability,
35985
36147
  accountService,
@@ -36064,6 +36226,7 @@ export {
36064
36226
  pinDurationOf,
36065
36227
  sendAsCheck,
36066
36228
  typedSendAs,
36229
+ TOTAL_CAP,
36067
36230
  THREAD_BOUNDS,
36068
36231
  readThreadContext,
36069
36232
  MAX_SEARCH_OFFSET,
@@ -36087,6 +36250,7 @@ export {
36087
36250
  embedEvents,
36088
36251
  embedMail,
36089
36252
  nearestNotes,
36253
+ RANK_WITHIN,
36090
36254
  searchNotes,
36091
36255
  searchNotesOf,
36092
36256
  calendarAccounts,