@wirecat/drive-cli 0.61.0 → 0.63.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 (152) hide show
  1. package/dist/bin/drive.js +2 -2
  2. package/dist/browse.d.ts +20 -0
  3. package/dist/browse.d.ts.map +1 -0
  4. package/dist/browse.js +146 -0
  5. package/dist/browse.js.map +1 -0
  6. package/dist/bundle/{all-profiles-H4L3Z5UM.js → all-profiles-GZJS3UKC.js} +13 -14
  7. package/dist/bundle/{anthropic-PPGFISVP.js → anthropic-RGV3WXX5.js} +9 -9
  8. package/dist/bundle/{app-server-YXVK2FUZ.js → app-server-AA2PJ7PV.js} +57 -55
  9. package/dist/bundle/{bun-DKZAL6ML.js → bun-OXZYIA3R.js} +2 -2
  10. package/dist/bundle/{bun-sqlite-MTZY36QK.js → bun-sqlite-D45NSDM3.js} +8 -8
  11. package/dist/bundle/{chunk-KV4267S4.js → chunk-27YUUGXQ.js} +1 -1
  12. package/dist/bundle/{chunk-6IBM4Z3V.js → chunk-2HF2MRXI.js} +1 -1
  13. package/dist/bundle/{chunk-HGOYQUT7.js → chunk-2NIC72HH.js} +4 -2
  14. package/dist/bundle/{chunk-XZBR2O63.js → chunk-2TDUGC5D.js} +1501 -781
  15. package/dist/bundle/{chunk-DEPMQHXQ.js → chunk-2TFXK3R4.js} +4 -4
  16. package/dist/bundle/{chunk-JVBLXSAA.js → chunk-33MGFUED.js} +652 -249
  17. package/dist/bundle/{chunk-S4YK6TTG.js → chunk-3BZRKLJ6.js} +13 -13
  18. package/dist/bundle/{chunk-6SUGANRJ.js → chunk-3HK5WMI5.js} +6 -6
  19. package/dist/bundle/{chunk-YWIU4HOT.js → chunk-3QINVLZI.js} +1 -1
  20. package/dist/bundle/{chunk-XYCCGGKN.js → chunk-44SBK6KB.js} +1207 -643
  21. package/dist/bundle/{chunk-LARQTWIL.js → chunk-4CIZWCXV.js} +1 -1
  22. package/dist/bundle/{chunk-WZ5XK74U.js → chunk-4OSSOWDM.js} +1 -1
  23. package/dist/bundle/{chunk-XGNC5OJG.js → chunk-4S4JMW6I.js} +1 -1
  24. package/dist/bundle/{chunk-WIU733D2.js → chunk-534OBX5Y.js} +1 -1
  25. package/dist/bundle/{chunk-UO2IUDVK.js → chunk-5PPL7JDM.js} +2 -2
  26. package/dist/bundle/{chunk-OFFA54TW.js → chunk-6EY46GAN.js} +2 -2
  27. package/dist/bundle/{chunk-RFRCOAWS.js → chunk-6KQJSFYF.js} +22 -22
  28. package/dist/bundle/{chunk-6DN4VPA7.js → chunk-6MQSQ4LX.js} +33 -31
  29. package/dist/bundle/{chunk-NIX2MWHZ.js → chunk-7EMQ26BA.js} +39 -25
  30. package/dist/bundle/{chunk-X2CXW4HM.js → chunk-ABYGSJZ4.js} +7 -7
  31. package/dist/bundle/{chunk-I26VL4W7.js → chunk-AEX37ETW.js} +2 -2
  32. package/dist/bundle/{chunk-36CWGEVX.js → chunk-BKYMKVHT.js} +2 -2
  33. package/dist/bundle/{chunk-3WZH3WV3.js → chunk-CE2TJBLP.js} +3 -3
  34. package/dist/bundle/{chunk-YMBFZA3H.js → chunk-DJ3SDJZY.js} +8 -8
  35. package/dist/bundle/{chunk-DXPOVLQC.js → chunk-DJHLVUL6.js} +227 -90
  36. package/dist/bundle/{chunk-VPDAH7PJ.js → chunk-E4SDKMBJ.js} +59 -1
  37. package/dist/bundle/{chunk-NZ2EIZLX.js → chunk-EOOGWUTP.js} +10 -10
  38. package/dist/bundle/{chunk-VYXVPYA3.js → chunk-FEZF3TII.js} +6 -6
  39. package/dist/bundle/{chunk-Q4XVBKX4.js → chunk-FRIJUILO.js} +3 -3
  40. package/dist/bundle/{chunk-OLPJRD4S.js → chunk-FUITWY7O.js} +1 -1
  41. package/dist/bundle/{chunk-AM4RIWOZ.js → chunk-HZZCEQTH.js} +18 -4
  42. package/dist/bundle/{chunk-2RJA4BQB.js → chunk-J24ZFCWM.js} +39 -26
  43. package/dist/bundle/{chunk-QSGT4ZH4.js → chunk-J4DIHPZ6.js} +1 -1
  44. package/dist/bundle/{chunk-ZHYRHERD.js → chunk-L37LMMRJ.js} +2 -2
  45. package/dist/bundle/{chunk-XLFJLZJL.js → chunk-LMAVCYLQ.js} +22 -14
  46. package/dist/bundle/{chunk-E6J5YH2N.js → chunk-LZEOQW7S.js} +36 -36
  47. package/dist/bundle/{chunk-FE5JJXKA.js → chunk-MOTRI3SY.js} +2 -2
  48. package/dist/bundle/{chunk-PJTX2MOI.js → chunk-ND6LLYGF.js} +98 -81
  49. package/dist/bundle/{chunk-3I2D5TK2.js → chunk-NEFSGCVA.js} +10 -10
  50. package/dist/bundle/{chunk-OGNOQDWB.js → chunk-O2XOX4HB.js} +34 -10
  51. package/dist/bundle/{chunk-DCBFNBEB.js → chunk-OD4U7GUY.js} +20 -20
  52. package/dist/bundle/{chunk-BXR7BKM3.js → chunk-OTROVC4E.js} +1 -1
  53. package/dist/bundle/{chunk-UKOYQC5O.js → chunk-OXY6SSZG.js} +184 -29
  54. package/dist/bundle/{chunk-ZMNYK3FC.js → chunk-PDCCYHCH.js} +5 -5
  55. package/dist/bundle/{chunk-J5UDQD5S.js → chunk-PO5RQQIG.js} +5 -5
  56. package/dist/bundle/{chunk-PY7LKNOS.js → chunk-Q5DJTRKV.js} +2 -2
  57. package/dist/bundle/{chunk-E5EXJ2XS.js → chunk-QCKZ3GAA.js} +4 -4
  58. package/dist/bundle/{chunk-3SJQNS72.js → chunk-RKELRWH7.js} +5 -5
  59. package/dist/bundle/{chunk-6Y2FWJZ4.js → chunk-S4RXABDR.js} +3 -3
  60. package/dist/bundle/{chunk-BQMIDYBA.js → chunk-SXM6MHRR.js} +12 -12
  61. package/dist/bundle/chunk-TF23BZW5.js +64 -0
  62. package/dist/bundle/{chunk-N2RLJTIW.js → chunk-TWUH22Z5.js} +4 -4
  63. package/dist/bundle/chunk-UPOSDTPT.js +87 -0
  64. package/dist/bundle/{chunk-J4HQVHMN.js → chunk-UQLWMGSD.js} +5 -5
  65. package/dist/bundle/{chunk-K7LS3NGM.js → chunk-V3NVXIQR.js} +736 -230
  66. package/dist/bundle/{chunk-TKGAYKXW.js → chunk-VAUMOZU5.js} +228 -66
  67. package/dist/bundle/{chunk-BF6TQMNB.js → chunk-VJEOGKAN.js} +8 -10
  68. package/dist/bundle/{chunk-XGMDWIUP.js → chunk-VKPCONDQ.js} +4 -4
  69. package/dist/bundle/{chunk-73WSULMI.js → chunk-WYGWWHZP.js} +2 -2
  70. package/dist/bundle/{chunk-5W56YMQS.js → chunk-XDC3TWTL.js} +60 -51
  71. package/dist/bundle/{chunk-5W7D5H2R.js → chunk-XIUDS3OK.js} +1 -1
  72. package/dist/bundle/{chunk-3UPIJ7DW.js → chunk-XNVFKMVR.js} +21868 -4533
  73. package/dist/bundle/{chunk-O5CUFS7T.js → chunk-XR6ESRU6.js} +2 -2
  74. package/dist/bundle/{chunk-EPCJUL6M.js → chunk-Y6GNA7HE.js} +3 -3
  75. package/dist/bundle/{chunk-67HS46KM.js → chunk-YGU6ULU5.js} +12 -12
  76. package/dist/bundle/{chunk-HFM653T3.js → chunk-YIP7ELON.js} +768 -131
  77. package/dist/bundle/{chunk-3252WXOL.js → chunk-YUWPNG7B.js} +1 -1
  78. package/dist/bundle/{chunk-QR5VQXQ5.js → chunk-Z42YYLTS.js} +59 -37
  79. package/dist/bundle/{chunk-AWN22PJK.js → chunk-Z5KC7XBR.js} +3 -3
  80. package/dist/bundle/{chunk-ECEYAQGN.js → chunk-ZM5J6ZMB.js} +4 -2
  81. package/dist/bundle/{chunk-YPF6OS37.js → chunk-ZMOUUOT2.js} +1 -1
  82. package/dist/bundle/{chunk-CACYL36O.js → chunk-ZOJU7ZFI.js} +8 -8
  83. package/dist/bundle/command-contract-BRW3AP44.js +38 -0
  84. package/dist/bundle/{decode-62A3HGPW.js → decode-G5YEIPNC.js} +8 -8
  85. package/dist/bundle/{dispatch-IE7PBEQC.js → dispatch-GEFIXA6X.js} +9 -9
  86. package/dist/bundle/drive.js +11 -11
  87. package/dist/bundle/{echarts-BGBPRGR5.js → echarts-W2CWHNXR.js} +2 -2
  88. package/dist/bundle/{embed-J3IBVV2V.js → embed-OBFFPVF4.js} +9 -9
  89. package/dist/bundle/{embedder-QFPMDRT2.js → embedder-NGCBQHIG.js} +12 -12
  90. package/dist/bundle/entry-ET6HGM7A.js +22 -0
  91. package/dist/bundle/{failure-BKOGBMIC.js → failure-GV77W3CD.js} +4 -4
  92. package/dist/bundle/first-run-JG52UZVO.js +30 -0
  93. package/dist/bundle/first-screen-CIL3GFAA.js +36 -0
  94. package/dist/bundle/{google-RXM2XEPD.js → google-CIWUVJ5C.js} +13 -13
  95. package/dist/bundle/{google-api-NC65BZO4.js → google-api-Z3NSTBBR.js} +56 -57
  96. package/dist/bundle/grants-3S4RL3WB.js +104 -0
  97. package/dist/bundle/{identity-PI6F2GWA.js → identity-OM6GFZ7T.js} +6 -6
  98. package/dist/bundle/{instructions-6LPDSKAD.js → instructions-YQBQSYSS.js} +1 -1
  99. package/dist/bundle/{login-HTY7GT2S.js → login-7RYSDVN3.js} +62 -63
  100. package/dist/bundle/{mcp-PPVOM4SE.js → mcp-GWDA3HOA.js} +2 -2
  101. package/dist/bundle/{node-IB246NCQ.js → node-IVU33RL7.js} +2 -2
  102. package/dist/bundle/{node-sqlite-G2Y5SFJM.js → node-sqlite-SIH5BEW2.js} +9 -9
  103. package/dist/bundle/oauth-PT4JEHLL.js +22 -0
  104. package/dist/bundle/{open-WD4GFSJD.js → open-IAO2SNII.js} +8 -8
  105. package/dist/bundle/{openai-QVM4PMY7.js → openai-SGOUBHXP.js} +17 -17
  106. package/dist/bundle/{process-SWPJGPQC.js → process-BPBMV3AT.js} +1 -1
  107. package/dist/bundle/{program-WHYFAMXR.js → program-MYKKJ4F6.js} +231 -87
  108. package/dist/bundle/prompt-3ZM64DCB.js +17 -0
  109. package/dist/bundle/{reasons-Q34DQWB6.js → reasons-57J2D77K.js} +5 -5
  110. package/dist/bundle/{recognize-DM3YWHSE.js → recognize-A5C5RPB3.js} +7 -7
  111. package/dist/bundle/{remote-KXVWRK7J.js → remote-VWYFLRGO.js} +10 -10
  112. package/dist/bundle/{rerank-TINXM3MY.js → rerank-4NGQWREA.js} +10 -10
  113. package/dist/bundle/{serve-IY2WL656.js → serve-Y6LQTFH5.js} +12 -12
  114. package/dist/bundle/{server-VPY3OWPC.js → server-6AUHIIUA.js} +43 -44
  115. package/dist/bundle/server-PFHI35HA.js +69 -0
  116. package/dist/bundle/{services-PXNBOCOC.js → services-2W4J7EMW.js} +47 -32
  117. package/dist/bundle/{sqlite-runtime-5ZK2CV7Y.js → sqlite-runtime-P6BBDX2H.js} +9 -9
  118. package/dist/bundle/{start-LDVCN3DK.js → start-AFFA3LKM.js} +9 -7
  119. package/dist/bundle/{state-3MKTT3VS.js → state-PXKKXR3R.js} +9 -9
  120. package/dist/bundle/{store-4VQOT5IJ.js → store-CN6JEUC4.js} +28 -18
  121. package/dist/bundle/{store-7M4MSUJV.js → store-IVV2BAGZ.js} +78 -28
  122. package/dist/bundle/store-maintenance-command-MSY2QNEH.js +59 -0
  123. package/dist/bundle/tokens-P4LPNUFW.js +102 -0
  124. package/dist/commands/config.d.ts.map +1 -1
  125. package/dist/commands/config.js +5 -1
  126. package/dist/commands/config.js.map +1 -1
  127. package/dist/commands/folders.d.ts +2 -1
  128. package/dist/commands/folders.d.ts.map +1 -1
  129. package/dist/commands/folders.js +16 -3
  130. package/dist/commands/folders.js.map +1 -1
  131. package/dist/program.js +1 -1
  132. package/dist/program.js.map +1 -1
  133. package/dist/tokens.d.ts.map +1 -1
  134. package/dist/tokens.js +15 -6
  135. package/dist/tokens.js.map +1 -1
  136. package/dist/version.d.ts +1 -1
  137. package/dist/version.js +1 -1
  138. package/package.json +3 -3
  139. package/dist/bundle/chunk-BCWUDTYQ.js +0 -22
  140. package/dist/bundle/chunk-W767AUNR.js +0 -132
  141. package/dist/bundle/chunk-WUP2MJDN.js +0 -42
  142. package/dist/bundle/command-contract-T3EO5AYD.js +0 -39
  143. package/dist/bundle/entry-YQSYER66.js +0 -22
  144. package/dist/bundle/first-run-ZIFPVZAI.js +0 -30
  145. package/dist/bundle/first-screen-L5U26EY7.js +0 -37
  146. package/dist/bundle/grants-SEWUYYH3.js +0 -105
  147. package/dist/bundle/oauth-MWBKBI4T.js +0 -22
  148. package/dist/bundle/prompt-OVYCGZB7.js +0 -17
  149. package/dist/bundle/server-EMWVVT2C.js +0 -70
  150. package/dist/bundle/store-maintenance-command-NRATYBWD.js +0 -60
  151. package/dist/bundle/tokens-XUKLM3SL.js +0 -103
  152. /package/dist/bundle/{chunk-LU3WKZBA.js → chunk-ZQ3GWKDQ.js} +0 -0
@@ -6,8 +6,9 @@ import {
6
6
  documentKind,
7
7
  engineMissing,
8
8
  extractText,
9
- importEngine
10
- } from "./chunk-PJTX2MOI.js";
9
+ importEngine,
10
+ withTimeLimit
11
+ } from "./chunk-ND6LLYGF.js";
11
12
  import {
12
13
  acquireLock,
13
14
  openOrdinaryFile,
@@ -16,7 +17,7 @@ import {
16
17
  sameOrdinaryFile,
17
18
  syncDirectory,
18
19
  writeFileAtomic
19
- } from "./chunk-S4YK6TTG.js";
20
+ } from "./chunk-3BZRKLJ6.js";
20
21
  import {
21
22
  DEFAULT_IMAGE_MODEL,
22
23
  DEFAULT_RERANK_MODEL,
@@ -45,23 +46,20 @@ import {
45
46
  typedCommand,
46
47
  vectorModelKey,
47
48
  withAttempt
48
- } from "./chunk-6DN4VPA7.js";
49
- import {
50
- isCliFailure
51
- } from "./chunk-BCWUDTYQ.js";
49
+ } from "./chunk-6MQSQ4LX.js";
52
50
  import {
53
51
  isNewer,
54
52
  updateCommand
55
- } from "./chunk-E5EXJ2XS.js";
53
+ } from "./chunk-QCKZ3GAA.js";
56
54
  import {
57
55
  MAX_MODEL_IMAGE_BYTES
58
- } from "./chunk-FE5JJXKA.js";
56
+ } from "./chunk-MOTRI3SY.js";
59
57
  import {
60
58
  OPENAI_URL,
61
59
  openRemote,
62
60
  remoteKey,
63
61
  remoteModel
64
- } from "./chunk-3WZH3WV3.js";
62
+ } from "./chunk-CE2TJBLP.js";
65
63
  import {
66
64
  defaultThreads,
67
65
  installNativeRuntime,
@@ -70,11 +68,11 @@ import {
70
68
  placedText,
71
69
  runEmbedders,
72
70
  textModelsDirectory
73
- } from "./chunk-J5UDQD5S.js";
71
+ } from "./chunk-PO5RQQIG.js";
74
72
  import {
75
73
  installFiles,
76
74
  megabytes
77
- } from "./chunk-XLFJLZJL.js";
75
+ } from "./chunk-LMAVCYLQ.js";
78
76
  import {
79
77
  AGENDA_COLUMNS,
80
78
  CHAT_COLUMNS,
@@ -96,10 +94,12 @@ import {
96
94
  QUERY_VERSION,
97
95
  RANKING_TOKENIZER_VERSION,
98
96
  SEARCH_QUERY,
97
+ SOURCE_REVIEW_KIND,
99
98
  TASK_CLOSE_KIND,
100
99
  TASK_RELATION_KINDS,
101
100
  TRACKED_CHAT_COLUMNS,
102
101
  UNKNOWN_PROVIDER,
102
+ WORD_BODY,
103
103
  amountsOf,
104
104
  assertGenericAction,
105
105
  assertMayDecide,
@@ -127,23 +127,26 @@ import {
127
127
  fitting,
128
128
  formatLocator,
129
129
  formatReference,
130
- googleDocumentId,
131
- googleDocumentLinks,
132
130
  hasStems,
133
131
  hasText,
132
+ headerErrors,
134
133
  historyStartKey,
135
134
  hitFiles,
135
+ holdsKind,
136
+ holdsKindOf,
136
137
  inSource,
137
138
  inboxKey,
138
139
  isAccountList,
139
140
  isFolderProvider,
141
+ isImportedProvider,
140
142
  isKind,
141
143
  isLocator,
142
144
  isOwnerOnlyKind,
143
145
  isQueryLimit,
144
146
  isStemmed,
147
+ jsonLine,
145
148
  kindIn,
146
- kindOf,
149
+ listedHolds,
147
150
  looksLikeReference,
148
151
  matchDownloads,
149
152
  mayDecide,
@@ -152,6 +155,7 @@ import {
152
155
  outOfTime,
153
156
  parseLocator,
154
157
  parseReference,
158
+ plainQuery,
155
159
  pointerOf,
156
160
  proposerOfAction,
157
161
  providerLabel,
@@ -164,16 +168,21 @@ import {
164
168
  searchError,
165
169
  sourceOf,
166
170
  threadConversation,
171
+ typedPhone,
167
172
  validateAst,
168
173
  validateFields,
174
+ waitingPointer,
169
175
  withoutField
170
- } from "./chunk-3UPIJ7DW.js";
176
+ } from "./chunk-XNVFKMVR.js";
171
177
  import {
172
178
  MAX_TEXT_CHARS,
173
179
  attachmentMaxBytes,
180
+ googleDocumentId,
181
+ googleDocumentLinks,
174
182
  pdfPreviewLimits
175
- } from "./chunk-WUP2MJDN.js";
183
+ } from "./chunk-UPOSDTPT.js";
176
184
  import {
185
+ MEETING_FIELD_NAMES,
177
186
  MEETING_FINDINGS_KIND,
178
187
  TASK_KINDS,
179
188
  TASK_ORIGINS,
@@ -183,6 +192,7 @@ import {
183
192
  createTaskService,
184
193
  formatMeetingReference,
185
194
  isClosedState,
195
+ isUsable,
186
196
  liftMeetingFields,
187
197
  meetingCueFingerprint,
188
198
  meetingHitContextLimits,
@@ -197,7 +207,7 @@ import {
197
207
  validateMeetingHitSearch,
198
208
  validateMeetingPassage,
199
209
  validateMeetingSeriesHistory
200
- } from "./chunk-K7LS3NGM.js";
210
+ } from "./chunk-V3NVXIQR.js";
201
211
  import {
202
212
  OPERATORS_BY_TYPE,
203
213
  dateRange,
@@ -208,29 +218,33 @@ import {
208
218
  timezoneOf,
209
219
  validateQuery,
210
220
  walkQuery
211
- } from "./chunk-NZ2EIZLX.js";
221
+ } from "./chunk-EOOGWUTP.js";
222
+ import {
223
+ isCliFailure,
224
+ sqliteCode
225
+ } from "./chunk-E4SDKMBJ.js";
212
226
  import {
213
227
  DEFAULT_STEMMERS,
214
228
  createStemmer,
215
229
  fold,
216
230
  normalize
217
- } from "./chunk-CACYL36O.js";
231
+ } from "./chunk-ZOJU7ZFI.js";
218
232
  import {
219
233
  DEFAULT_TASK_CATEGORIES,
220
234
  FALLBACK_CATEGORY
221
- } from "./chunk-X2CXW4HM.js";
235
+ } from "./chunk-ABYGSJZ4.js";
222
236
  import {
223
237
  storePath,
224
238
  wirecatDirectory
225
- } from "./chunk-I26VL4W7.js";
239
+ } from "./chunk-AEX37ETW.js";
226
240
  import {
227
241
  resolvePaths,
228
242
  writeSecurely
229
- } from "./chunk-DCBFNBEB.js";
243
+ } from "./chunk-OD4U7GUY.js";
230
244
  import {
231
245
  singleLine,
232
246
  visibleControls
233
- } from "./chunk-6IBM4Z3V.js";
247
+ } from "./chunk-2HF2MRXI.js";
234
248
  import {
235
249
  array,
236
250
  getDotPath,
@@ -251,16 +265,16 @@ import {
251
265
  string,
252
266
  transform,
253
267
  unknown
254
- } from "./chunk-VYXVPYA3.js";
268
+ } from "./chunk-FEZF3TII.js";
255
269
  import {
256
270
  CliError,
257
271
  isCliError
258
- } from "./chunk-WZ5XK74U.js";
272
+ } from "./chunk-4OSSOWDM.js";
259
273
  import {
260
274
  __name
261
275
  } from "./chunk-ZVVMGPBJ.js";
262
276
 
263
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/domain/ref-arguments.js
277
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/ref-arguments.js
264
278
  var TAKES = {
265
279
  chat: "a chat: chat:<provider>/<account>/<chat>, its id or its title",
266
280
  message: "a message: msg:<provider>/<account>/<chat>/<message>, or a chat and the message's id"
@@ -320,9 +334,9 @@ var ensureAccount = /* @__PURE__ */ __name(async (reference, scope, profilesOn)
320
334
  throw wrongAccount(reference, scope, profiles);
321
335
  }, "ensureAccount");
322
336
 
323
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/resolve.js
337
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/resolve.js
324
338
  var isId = /* @__PURE__ */ __name((reference) => /^-?\d+$/.test(reference.trim()), "isId");
325
- var foldName = /* @__PURE__ */ __name((name) => name.normalize("NFC").replace(/[\uFE0E\uFE0F\u200D]/g, "").toLowerCase(), "foldName");
339
+ var foldName = /* @__PURE__ */ __name((name) => name.normalize("NFC").replace(/[\uFE0E\uFE0F\u200D]/g, "").toLowerCase().replaceAll("\u0451", "\u0435"), "foldName");
326
340
  var pickChat = /* @__PURE__ */ __name((reference, chats) => {
327
341
  const wanted = foldName(reference.trim());
328
342
  const matches = chats.filter((chat) => chat.title !== null && foldName(chat.title).includes(wanted));
@@ -365,7 +379,7 @@ ${lines}`, { candidates });
365
379
  }, "ambiguous");
366
380
  var isPresent = /* @__PURE__ */ __name((value) => value !== null && value !== void 0, "isPresent");
367
381
 
368
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/deps.js
382
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/deps.js
369
383
  var accountStore = /* @__PURE__ */ __name(async (deps) => (await deps.store()).forAccount(await deps.account()), "accountStore");
370
384
  var crossAccount = /* @__PURE__ */ __name((deps, _reason) => deps.store(), "crossAccount");
371
385
  var NO_LOCAL_STORE = "this answer comes from the messenger, not from the local store";
@@ -373,9 +387,7 @@ var SQLITE_BUSY = 5;
373
387
  var storeAbsent = /* @__PURE__ */ __name((error) => {
374
388
  if (isCliFailure(error))
375
389
  return error.code === "validation_error" && error.message === NO_LOCAL_STORE;
376
- const { errcode, errno } = error ?? {};
377
- const code = errcode ?? errno;
378
- return error instanceof Error && typeof code === "number" && (code & 255) === SQLITE_BUSY;
390
+ return error instanceof Error && sqliteCode(error) === SQLITE_BUSY;
379
391
  }, "storeAbsent");
380
392
  var accountUnknown = /* @__PURE__ */ __name((error) => isCliFailure(error) && (error.code === "not_found" || error.code === "authentication_error"), "accountUnknown");
381
393
  var unless = /* @__PURE__ */ __name(async (work, expected2) => {
@@ -442,7 +454,7 @@ var storeOnlyDeps = /* @__PURE__ */ __name((store, account2, { app, env }) => {
442
454
  return { ...storedDeps(messenger, store, account2, guard), ...env === void 0 ? {} : { env } };
443
455
  }, "storeOnlyDeps");
444
456
 
445
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/botcheck/check.js
457
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/botcheck/check.js
446
458
  var DAY_MS = 864e5;
447
459
  var NEW_DAYS = 30;
448
460
  var SAME_TEXT_MIN = 20;
@@ -519,7 +531,7 @@ var scorePerson = /* @__PURE__ */ __name(({ subject, provider, activity, photos,
519
531
  };
520
532
  }, "scorePerson");
521
533
 
522
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/botcheck/registries.js
534
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/botcheck/registries.js
523
535
  var REGISTRIES = {
524
536
  cas: { title: "Combot Anti-Spam (CAS)", docs: "https://cas.chat/api" },
525
537
  lols: { title: "lols.bot", docs: "https://api.lols.bot/lols-bot.json" }
@@ -528,16 +540,18 @@ var TIMEOUT_MS = 1e4;
528
540
  var askRegistries = /* @__PURE__ */ __name(async (id2, options = {}) => Promise.all([askCas(id2, options), askLols(id2, options)]), "askRegistries");
529
541
  var getJson = /* @__PURE__ */ __name(async (url, headers, { fetch: fetchFn = fetch, timeoutMs = TIMEOUT_MS }) => {
530
542
  try {
531
- const response = await fetchFn(url, {
532
- headers: { accept: "application/json", ...headers },
533
- signal: AbortSignal.timeout(timeoutMs),
534
- redirect: "error"
543
+ const { status, text: text2 } = await withTimeLimit(timeoutMs, async (signal) => {
544
+ const response = await fetchFn(url, {
545
+ headers: { accept: "application/json", ...headers },
546
+ signal,
547
+ redirect: "error"
548
+ });
549
+ return { status: response.status, text: await response.text() };
535
550
  });
536
- const text2 = await response.text();
537
551
  try {
538
- return { status: response.status, body: JSON.parse(text2) };
552
+ return { status, body: JSON.parse(text2) };
539
553
  } catch {
540
- return { failed: `answered ${response.status} with something that is not JSON` };
554
+ return { failed: `answered ${status} with something that is not JSON` };
541
555
  }
542
556
  } catch (error) {
543
557
  return {
@@ -604,7 +618,7 @@ var notCovered = /* @__PURE__ */ __name((messenger, now = /* @__PURE__ */ new Da
604
618
  detail: `lists Telegram accounts only, not ${messenger} ones`
605
619
  })), "notCovered");
606
620
 
607
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/botcheck/service.js
621
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/botcheck/service.js
608
622
  var ACTIVITY_MESSAGES = 1e3;
609
623
  var botCheckService = /* @__PURE__ */ __name((deps) => {
610
624
  const subjectOf = /* @__PURE__ */ __name(async (reference) => {
@@ -692,7 +706,7 @@ var botCheckService = /* @__PURE__ */ __name((deps) => {
692
706
  };
693
707
  }, "botCheckService");
694
708
 
695
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/mail/owed.js
709
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/mail/owed.js
696
710
  var mailTurn = /* @__PURE__ */ __name((newest) => {
697
711
  if (newest === null)
698
712
  return null;
@@ -701,7 +715,7 @@ var mailTurn = /* @__PURE__ */ __name((newest) => {
701
715
  return newest.addressed ? "owed" : null;
702
716
  }, "mailTurn");
703
717
 
704
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/agenda-mail.js
718
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/agenda-mail.js
705
719
  var absent = /* @__PURE__ */ __name((error) => {
706
720
  if (error instanceof CliError && error.code === "not_found")
707
721
  return void 0;
@@ -759,7 +773,7 @@ var mailActivity = /* @__PURE__ */ __name(async (store, account2, since, chats)
759
773
  };
760
774
  }, "mailActivity");
761
775
 
762
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/chat-coverage.js
776
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/chat-coverage.js
763
777
  var chatCoverage = /* @__PURE__ */ __name(async (store, account2, chatIds) => {
764
778
  const ids = [...new Set(chatIds)];
765
779
  if (ids.length === 0)
@@ -785,7 +799,7 @@ var chatCoverage = /* @__PURE__ */ __name(async (store, account2, chatIds) => {
785
799
  }));
786
800
  }, "chatCoverage");
787
801
 
788
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/domain/thread.js
802
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/thread.js
789
803
  var threadIdOf = /* @__PURE__ */ __name((value) => {
790
804
  if (value === void 0)
791
805
  return void 0;
@@ -795,7 +809,7 @@ var threadIdOf = /* @__PURE__ */ __name((value) => {
795
809
  return id2;
796
810
  }, "threadIdOf");
797
811
 
798
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/ports/messenger.js
812
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/ports/messenger.js
799
813
  var throughWrapper = /* @__PURE__ */ __name((inner, handled, wrap = (_, call) => call) => new Proxy(handled, {
800
814
  get: /* @__PURE__ */ __name((own, key) => {
801
815
  if (key in own)
@@ -812,15 +826,15 @@ var capability = /* @__PURE__ */ __name((adapter, method, what) => {
812
826
  return found.bind(adapter);
813
827
  }, "capability");
814
828
 
815
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/ports/traits.js
829
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/ports/traits.js
816
830
  var syncsOneChat = /* @__PURE__ */ __name((messenger) => messenger.history !== "store" || messenger.historyOnDemand === true, "syncsOneChat");
817
831
 
818
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/sends/send-id.js
832
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/sends/send-id.js
819
833
  import { randomBytes } from "node:crypto";
820
834
  var newSendId = /* @__PURE__ */ __name(() => randomBytes(8).readBigInt64BE().toString(), "newSendId");
821
835
  var newOperationId = newSendId;
822
836
 
823
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/questions.js
837
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/questions.js
824
838
  var LINKS = /https?:\/\/\S+/g;
825
839
  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");
826
840
  var questions = /* @__PURE__ */ __name((messages, { answerers: answerers2, asker = "others" }) => {
@@ -850,7 +864,7 @@ var questions = /* @__PURE__ */ __name((messages, { answerers: answerers2, asker
850
864
  });
851
865
  }, "questions");
852
866
 
853
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/chat-stats.js
867
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/chat-stats.js
854
868
  var TOP_POSTS = 5;
855
869
  var JOINS = /* @__PURE__ */ new Set(["join", "add"]);
856
870
  var LEAVES = /* @__PURE__ */ new Set(["leave", "remove"]);
@@ -967,7 +981,7 @@ var median = /* @__PURE__ */ __name((values) => {
967
981
  return Math.round(sorted.length % 2 === 0 ? ((sorted[middle - 1] ?? upper) + upper) / 2 : upper);
968
982
  }, "median");
969
983
 
970
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/member-history.js
984
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/member-history.js
971
985
  var memberEvents = /* @__PURE__ */ __name((stays, revisions, since = 0) => {
972
986
  const events = [];
973
987
  for (const stay of stays) {
@@ -999,7 +1013,7 @@ var memberEvents = /* @__PURE__ */ __name((stays, revisions, since = 0) => {
999
1013
  return events.filter(({ at }) => Date.parse(at) >= since).sort((a, b) => Date.parse(a.at) - Date.parse(b.at) || a.id.localeCompare(b.id));
1000
1014
  }, "memberEvents");
1001
1015
 
1002
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/members-audit.js
1016
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/members-audit.js
1003
1017
  var AUDIT_PAGE = 200;
1004
1018
  var AUDIT_BUDGET = 10;
1005
1019
  var AUDIT_PAUSE_MS = 1e3;
@@ -1079,7 +1093,7 @@ var burstJoins = /* @__PURE__ */ __name((members) => {
1079
1093
  return found;
1080
1094
  }, "burstJoins");
1081
1095
 
1082
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/message-resolution.js
1096
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/message-resolution.js
1083
1097
  var readChatId = /* @__PURE__ */ __name(async (deps, reference, store, account2) => {
1084
1098
  if (deps.reads !== "store")
1085
1099
  return keptChatId(deps.messenger, reference, store, account2);
@@ -1238,7 +1252,7 @@ var senderAmong = /* @__PURE__ */ __name(async (store, accounts, reference) => {
1238
1252
  }
1239
1253
  }, "senderAmong");
1240
1254
 
1241
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/chats.js
1255
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/chats.js
1242
1256
  var EVENTS_DAYS = 7;
1243
1257
  var TRACKED_DAYS = 30;
1244
1258
  var STATS_PAGE = 1e3;
@@ -1356,8 +1370,8 @@ var chatsService = /* @__PURE__ */ __name((deps) => ({
1356
1370
  });
1357
1371
  const counts = await store.roster.memberCounts(chatId, { since: new Date(from).toISOString().slice(0, 10) });
1358
1372
  const known2 = unrecorded ? { ...stats, complete: false, membersUnrecorded: true } : stats;
1359
- const counted3 = counts.length > 0 ? { ...known2, memberCounts: counts } : known2;
1360
- return completeness.state === "complete" || !syncsOneChat(deps.messenger) ? counted3 : { ...counted3, fetch: typedCommand(deps.messenger.app.command, `messages sync ${chatId}`) };
1373
+ const counted2 = counts.length > 0 ? { ...known2, memberCounts: counts } : known2;
1374
+ return completeness.state === "complete" || !syncsOneChat(deps.messenger) ? counted2 : { ...counted2, fetch: typedCommand(deps.messenger.app.command, `messages sync ${chatId}`) };
1361
1375
  }, "stats"),
1362
1376
  sendAs: /* @__PURE__ */ __name(async (chat) => {
1363
1377
  if (deps.offline) {
@@ -1533,7 +1547,7 @@ var storedMembers = /* @__PURE__ */ __name(async (store, chatId) => {
1533
1547
  return members.length === 0 ? null : members;
1534
1548
  }, "storedMembers");
1535
1549
 
1536
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/task-categories.js
1550
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/task-categories.js
1537
1551
  var names = /* @__PURE__ */ __name((categories) => categories.map(({ name }) => name).join(", "), "names");
1538
1552
  var taskCategoryOf = /* @__PURE__ */ __name((categories = DEFAULT_TASK_CATEGORIES, flag = "--category") => (typed) => {
1539
1553
  const name = typed.trim().toLowerCase();
@@ -1557,7 +1571,7 @@ var triggerStems = /* @__PURE__ */ __name((categories) => {
1557
1571
  const { english, spanish } = stemmersOf();
1558
1572
  const built = categories.map(({ name, triggers }) => ({
1559
1573
  name,
1560
- english: new Set(Object.values(triggers).flatMap((words3) => words3.flatMap((word) => english.stemTokens(word)))),
1574
+ english: new Set(Object.values(triggers).flatMap((words4) => words4.flatMap((word) => english.stemTokens(word)))),
1561
1575
  spanish: new Set(triggers.es.flatMap((word) => spanish.stemTokens(word)))
1562
1576
  }));
1563
1577
  stemsByList.set(categories, built);
@@ -1567,7 +1581,7 @@ var hitsByList = /* @__PURE__ */ __name((text2, categories) => {
1567
1581
  const stem = stemmersOf();
1568
1582
  const english = stem.english.stemTokens(text2);
1569
1583
  const spanish = readsSpanish(text2) ? stem.spanish.stemTokens(text2) : [];
1570
- const counted3 = [];
1584
+ const counted2 = [];
1571
1585
  for (const triggers of triggerStems(categories)) {
1572
1586
  const hit = /* @__PURE__ */ new Set();
1573
1587
  english.forEach((word, at) => {
@@ -1577,20 +1591,20 @@ var hitsByList = /* @__PURE__ */ __name((text2, categories) => {
1577
1591
  else if (other !== void 0 && triggers.spanish.has(other))
1578
1592
  hit.add(other);
1579
1593
  });
1580
- counted3.push({ name: triggers.name, hits: hit.size });
1594
+ counted2.push({ name: triggers.name, hits: hit.size });
1581
1595
  }
1582
- return counted3;
1596
+ return counted2;
1583
1597
  }, "hitsByList");
1584
1598
  var listsHit = /* @__PURE__ */ __name((text2, categories) => hitsByList(text2, categories).filter(({ hits }) => hits > 0).map(({ name }) => name), "listsHit");
1585
1599
  var categorize = /* @__PURE__ */ __name((text2, categories = DEFAULT_TASK_CATEGORIES) => {
1586
1600
  let best = { name: FALLBACK_CATEGORY, hits: 0 };
1587
- for (const counted3 of hitsByList(text2, categories))
1588
- if (counted3.hits > best.hits)
1589
- best = counted3;
1601
+ for (const counted2 of hitsByList(text2, categories))
1602
+ if (counted2.hits > best.hits)
1603
+ best = counted2;
1590
1604
  return best.name;
1591
1605
  }, "categorize");
1592
1606
 
1593
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/task-rules.js
1607
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/task-rules.js
1594
1608
  var taskAccount = /* @__PURE__ */ __name(({ provider, account: account2 }) => `${provider}:${account2}`, "taskAccount");
1595
1609
  var RULES_IN = {
1596
1610
  dialog: "all",
@@ -1687,7 +1701,7 @@ var applyTaskRules = /* @__PURE__ */ __name(async (review, { store, account: acc
1687
1701
  return result;
1688
1702
  }, "applyTaskRules");
1689
1703
  var ARRIVAL_WINDOW = 50;
1690
- var kindOf2 = /* @__PURE__ */ __name(async (store, account2, chat) => await store.chats.chatKind(account2, chat) ?? "unknown", "kindOf");
1704
+ var kindOf = /* @__PURE__ */ __name(async (store, account2, chat) => await store.chats.chatKind(account2, chat) ?? "unknown", "kindOf");
1691
1705
  var applyTaskRulesOnArrival = /* @__PURE__ */ __name(async (store, account2, message) => {
1692
1706
  const page = await store.messages.messages(account2, message.chatId, { limit: ARRIVAL_WINDOW });
1693
1707
  const messages = [...page.items.filter((one2) => one2.id !== message.id), message].sort((a, b) => Date.parse(a.timestamp) - Date.parse(b.timestamp));
@@ -1696,7 +1710,7 @@ var applyTaskRulesOnArrival = /* @__PURE__ */ __name(async (store, account2, mes
1696
1710
  {
1697
1711
  id: message.chatId,
1698
1712
  messages,
1699
- kind: await kindOf2(store, account2, message.chatId),
1713
+ kind: await kindOf(store, account2, message.chatId),
1700
1714
  watched: (await watchedChats(store, account2)).has(message.chatId)
1701
1715
  }
1702
1716
  ]
@@ -1788,7 +1802,7 @@ var applyTaskRulesToChats = /* @__PURE__ */ __name(async (store, account2, chatI
1788
1802
  const tasks = [];
1789
1803
  const pass = await applyTaskRules({
1790
1804
  chats: [
1791
- { id: chat, messages: page.items, kind: await kindOf2(store, account2, chat), watched: watched.has(chat) }
1805
+ { id: chat, messages: page.items, kind: await kindOf(store, account2, chat), watched: watched.has(chat) }
1792
1806
  ]
1793
1807
  }, { store: store.tasks, account: account2, categories, dryRun: !yes, onHeld: /* @__PURE__ */ __name((task2) => tasks.push(task2), "onHeld") });
1794
1808
  passes.push({ chat, messages: page.items.length, ...pass, tasks });
@@ -1796,7 +1810,7 @@ var applyTaskRulesToChats = /* @__PURE__ */ __name(async (store, account2, chatI
1796
1810
  return passes;
1797
1811
  }, "applyTaskRulesToChats");
1798
1812
 
1799
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/task-tag-filters.js
1813
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/task-tag-filters.js
1800
1814
  var taskTagFilters = /* @__PURE__ */ __name(async (store, query) => {
1801
1815
  const tags = /* @__PURE__ */ new Map();
1802
1816
  for (const node of query ? walkQuery(query.root) : [])
@@ -1805,7 +1819,7 @@ var taskTagFilters = /* @__PURE__ */ __name(async (store, query) => {
1805
1819
  return tags;
1806
1820
  }, "taskTagFilters");
1807
1821
 
1808
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/agenda.js
1822
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/agenda.js
1809
1823
  var DAY = 864e5;
1810
1824
  var AGENDA_DEFAULTS = { unanswered: DAY, waiting: 7 * DAY };
1811
1825
  var CLAIMS = ["none", "mine", "others", "any"];
@@ -2052,7 +2066,7 @@ var agendaItem = /* @__PURE__ */ __name((shown) => {
2052
2066
  };
2053
2067
  }, "agendaItem");
2054
2068
 
2055
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/context/evidence-response.js
2069
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/context/evidence-response.js
2056
2070
  var contextSourceKey = /* @__PURE__ */ __name((source) => JSON.stringify([source.kind, source.accountId, source.provider, source.account]), "contextSourceKey");
2057
2071
  var validateContextEvidencePage = /* @__PURE__ */ __name((page, request) => {
2058
2072
  const fail3 = /* @__PURE__ */ __name(() => {
@@ -2116,7 +2130,7 @@ var validateContextEvidencePage = /* @__PURE__ */ __name((page, request) => {
2116
2130
  }
2117
2131
  }, "validateContextEvidencePage");
2118
2132
 
2119
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/context/read-budget.js
2133
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/context/read-budget.js
2120
2134
  var contextReadBudget = /* @__PURE__ */ __name((limits = {}) => {
2121
2135
  if (!limits || typeof limits !== "object" || Array.isArray(limits))
2122
2136
  throw new CliError("validation_error", "limits needs a context read allowance");
@@ -2169,7 +2183,7 @@ var contextReadBudget = /* @__PURE__ */ __name((limits = {}) => {
2169
2183
  };
2170
2184
  }, "contextReadBudget");
2171
2185
 
2172
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/context-evidence.js
2186
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/context-evidence.js
2173
2187
  var createContextEvidenceReader = /* @__PURE__ */ __name((port, allowed, limits) => {
2174
2188
  if (!port || typeof port.read !== "function")
2175
2189
  throw new CliError("configuration_error", "context evidence reader is unavailable");
@@ -2213,7 +2227,7 @@ var createContextEvidenceReader = /* @__PURE__ */ __name((port, allowed, limits)
2213
2227
  };
2214
2228
  }, "createContextEvidenceReader");
2215
2229
 
2216
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/excerpt.js
2230
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/excerpt.js
2217
2231
  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");
2218
2232
  var excerpt = /* @__PURE__ */ __name((text2, query, size4 = 240, options = {}) => {
2219
2233
  const flat = text2.replace(/\s+/g, " ").trim();
@@ -2229,8 +2243,247 @@ var excerpt = /* @__PURE__ */ __name((text2, query, size4 = 240, options = {}) =
2229
2243
  }, "excerpt");
2230
2244
  var withExcerpt = /* @__PURE__ */ __name(({ matchedText, ...hit }, query) => ({ ...hit, excerpt: excerpt(matchedText ?? hit.text, query) }), "withExcerpt");
2231
2245
 
2232
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/ingest.js
2233
- var emptyReceipt = /* @__PURE__ */ __name((dryRun) => ({
2246
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/ingest.js
2247
+ import { createInterface } from "node:readline";
2248
+
2249
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/vcard.js
2250
+ import { createHash } from "node:crypto";
2251
+ var MAX_ID = 512;
2252
+ var AS_WORD = new RegExp(`^${WORD_BODY}$`);
2253
+ var isQuotedPrintable = /* @__PURE__ */ __name((line2) => {
2254
+ const colon = line2.indexOf(":");
2255
+ return /;(ENCODING=)?QUOTED-PRINTABLE\b/i.test(colon < 0 ? line2 : line2.slice(0, colon));
2256
+ }, "isQuotedPrintable");
2257
+ var PROPERTY_START = /^([A-Za-z0-9-]+\.)?[A-Za-z][A-Za-z0-9-]*(;[^:]*)?:/;
2258
+ var isSoft = /* @__PURE__ */ __name((line2) => line2 !== void 0 && isQuotedPrintable(line2) && line2.endsWith("="), "isSoft");
2259
+ var unfolded = /* @__PURE__ */ __name((text2) => {
2260
+ const lines = [];
2261
+ for (const raw of text2.replace(/^\uFEFF/, "").split(/\r\n|\r|\n/)) {
2262
+ const last2 = lines.length - 1;
2263
+ const previous = lines[last2];
2264
+ const bounds = /^(BEGIN|END):/i.test(raw);
2265
+ if (isSoft(previous) && !bounds && !PROPERTY_START.test(raw))
2266
+ lines[last2] = previous.slice(0, -1) + raw.replace(/^[ \t]/, "");
2267
+ else if (previous !== void 0 && /^[ \t]/.test(raw) && !bounds)
2268
+ lines[last2] = previous + raw.slice(1);
2269
+ else {
2270
+ if (isSoft(previous))
2271
+ lines[last2] = previous.slice(0, -1);
2272
+ lines.push(raw);
2273
+ }
2274
+ }
2275
+ const last = lines.length - 1;
2276
+ if (isSoft(lines[last]))
2277
+ lines[last] = lines[last].slice(0, -1);
2278
+ return lines.filter((line2) => line2.trim() !== "");
2279
+ }, "unfolded");
2280
+ var propertyOf = /* @__PURE__ */ __name((line2) => {
2281
+ let quoted = false;
2282
+ let colon = -1;
2283
+ for (let index = 0; index < line2.length; index += 1) {
2284
+ if (line2[index] === '"')
2285
+ quoted = !quoted;
2286
+ else if (line2[index] === ":" && !quoted) {
2287
+ colon = index;
2288
+ break;
2289
+ }
2290
+ }
2291
+ if (colon < 0)
2292
+ return void 0;
2293
+ const [head = "", ...rest] = line2.slice(0, colon).split(";");
2294
+ const params = /* @__PURE__ */ new Map();
2295
+ for (const part of rest) {
2296
+ const equals = part.indexOf("=");
2297
+ const key = equals < 0 ? /^(QUOTED-PRINTABLE|BASE64|8BIT|7BIT|B)$/i.test(part) ? "ENCODING" : "TYPE" : part.slice(0, equals);
2298
+ const values = (equals < 0 ? part : part.slice(equals + 1)).replaceAll('"', "").split(",");
2299
+ params.set(key.toUpperCase(), [...params.get(key.toUpperCase()) ?? [], ...values.map((one2) => one2.toUpperCase())]);
2300
+ }
2301
+ const name = head.replace(/^[^.]*\./, "").toUpperCase();
2302
+ return { name, params, value: line2.slice(colon + 1) };
2303
+ }, "propertyOf");
2304
+ var encoder = new TextEncoder();
2305
+ var decoded = /* @__PURE__ */ __name((property, report) => {
2306
+ const encoding = property.params.get("ENCODING")?.[0];
2307
+ if (encoding !== "QUOTED-PRINTABLE")
2308
+ return property.value;
2309
+ const bytes2 = [];
2310
+ const { value } = property;
2311
+ for (let index = 0; index < value.length; index += 1) {
2312
+ const hex = value.slice(index + 1, index + 3);
2313
+ if (value[index] === "=" && /^[0-9A-F]{2}$/i.test(hex)) {
2314
+ bytes2.push(Number.parseInt(hex, 16));
2315
+ index += 2;
2316
+ } else
2317
+ for (const byte of encoder.encode(value[index]))
2318
+ bytes2.push(byte);
2319
+ }
2320
+ const charset = property.params.get("CHARSET")?.[0]?.toLowerCase() ?? "utf-8";
2321
+ try {
2322
+ return new TextDecoder(charset).decode(new Uint8Array(bytes2));
2323
+ } catch {
2324
+ report(`${property.name} names the unknown charset ${charset}: read as UTF-8`);
2325
+ return new TextDecoder("utf-8").decode(new Uint8Array(bytes2));
2326
+ }
2327
+ }, "decoded");
2328
+ var components = /* @__PURE__ */ __name((value) => {
2329
+ const parts = [""];
2330
+ for (let index = 0; index < value.length; index += 1) {
2331
+ const char = value[index];
2332
+ if (char === "\\" && index + 1 < value.length) {
2333
+ const next = value[index + 1];
2334
+ parts[parts.length - 1] += next === "n" || next === "N" ? "\n" : next;
2335
+ index += 1;
2336
+ } else if (char === ";")
2337
+ parts.push("");
2338
+ else
2339
+ parts[parts.length - 1] += char;
2340
+ }
2341
+ return parts.map((part) => part.trim());
2342
+ }, "components");
2343
+ var textOf = /* @__PURE__ */ __name((property, report) => components(decoded(property, report)).join(";").trim(), "textOf");
2344
+ var e164 = /* @__PURE__ */ __name((typed, region) => {
2345
+ const text2 = typed.replace(/^tel:/i, "").replace(/;.*$/, "").trim();
2346
+ const international = /^(\+|00)/.test(text2);
2347
+ if (!international && region === void 0)
2348
+ return void 0;
2349
+ const value = typedPhone(text2, region === void 0 ? {} : { phoneCountries: [region] })?.value;
2350
+ return value?.startsWith("+") ? value : void 0;
2351
+ }, "e164");
2352
+ var foldedName = /* @__PURE__ */ __name((name) => name.normalize("NFKC").toLowerCase().replace(/\s+/g, " ").trim(), "foldedName");
2353
+ var hashed = /* @__PURE__ */ __name((prefix, parts) => `${prefix}${createHash("sha256").update(parts.join("\n")).digest("hex").slice(0, 32)}`, "hashed");
2354
+ var organizationId = /* @__PURE__ */ __name((name) => {
2355
+ const id2 = `org:${foldedName(name)}`;
2356
+ return id2.length <= MAX_ID ? id2 : hashed("org:", [foldedName(name)]);
2357
+ }, "organizationId");
2358
+ var titleWord = /* @__PURE__ */ __name((title) => {
2359
+ const word = title.toLowerCase().trim().replace(/\s+/g, "-");
2360
+ return AS_WORD.test(word) ? word : void 0;
2361
+ }, "titleWord");
2362
+ var nameOf = /* @__PURE__ */ __name((properties, report) => {
2363
+ const full = properties.find(({ name }) => name === "FN");
2364
+ const text2 = full ? textOf(full, report) : "";
2365
+ if (text2)
2366
+ return text2;
2367
+ const structured = properties.find(({ name }) => name === "N");
2368
+ if (!structured)
2369
+ return void 0;
2370
+ const [family = "", given = "", additional = ""] = components(decoded(structured, report));
2371
+ return [given, additional, family].filter(Boolean).join(" ") || void 0;
2372
+ }, "nameOf");
2373
+ var SKIPPED = /* @__PURE__ */ new Set(["PHOTO", "LOGO", "SOUND", "KEY"]);
2374
+ var cardsOf = /* @__PURE__ */ __name((text2) => {
2375
+ const cards = [];
2376
+ const issues = [];
2377
+ let card;
2378
+ const isBound = /* @__PURE__ */ __name((property, name) => property.name === name && property.value.trim().toUpperCase() === "VCARD", "isBound");
2379
+ for (const line2 of unfolded(text2)) {
2380
+ const property = propertyOf(line2);
2381
+ if (!property)
2382
+ continue;
2383
+ if (isBound(property, "BEGIN")) {
2384
+ if (card) {
2385
+ issues.push({ card: cards.length, message: "BEGIN:VCARD inside a card: the card ends there, unfinished" });
2386
+ cards.push(card);
2387
+ }
2388
+ card = [];
2389
+ } else if (isBound(property, "END")) {
2390
+ if (card)
2391
+ cards.push(card);
2392
+ card = void 0;
2393
+ } else if (card && !SKIPPED.has(property.name))
2394
+ card.push(property);
2395
+ }
2396
+ if (card) {
2397
+ issues.push({ card: cards.length, message: "the file ends inside a card, with no END:VCARD" });
2398
+ cards.push(card);
2399
+ }
2400
+ return { cards, issues };
2401
+ }, "cardsOf");
2402
+ var envelopeOfVcard = /* @__PURE__ */ __name((text2, { provider, account: account2, batchId, region }) => {
2403
+ const { cards, issues } = cardsOf(text2);
2404
+ const people = [];
2405
+ const organizations = /* @__PURE__ */ new Map();
2406
+ const seen = /* @__PURE__ */ new Set();
2407
+ for (const [index, properties] of cards.entries()) {
2408
+ const report = /* @__PURE__ */ __name((message) => {
2409
+ if (!issues.some((one2) => one2.card === index && one2.message === message))
2410
+ issues.push({ card: index, message });
2411
+ }, "report");
2412
+ const values = /* @__PURE__ */ __name((wanted) => properties.filter(({ name: name2 }) => name2 === wanted).map((one2) => textOf(one2, report)).filter(Boolean), "values");
2413
+ const name = nameOf(properties, report);
2414
+ const phones = [];
2415
+ const unread = [];
2416
+ for (const typed of values("TEL")) {
2417
+ const value = e164(typed, region);
2418
+ if (value !== void 0) {
2419
+ if (!phones.includes(value))
2420
+ phones.push(value);
2421
+ } else {
2422
+ unread.push(typed);
2423
+ issues.push({
2424
+ card: index,
2425
+ message: `${typed} has no country code${region === void 0 ? " and no region was given" : ` in ${region}`}: kept, not matched`
2426
+ });
2427
+ }
2428
+ }
2429
+ const emails = [...new Set(values("EMAIL").map((one2) => one2.replace(/^mailto:/i, "").toLowerCase()))];
2430
+ if (name === void 0 && phones.length === 0 && unread.length === 0 && emails.length === 0) {
2431
+ report("the card holds no name, number or address: left out");
2432
+ continue;
2433
+ }
2434
+ const uid = values("UID")[0];
2435
+ const externalId = uid === void 0 ? hashed("vcard:", [name ?? "", ...[...phones].sort(), ...emails.sort()]) : uid.length <= MAX_ID ? uid : hashed("vcard:", [uid]);
2436
+ if (seen.has(externalId)) {
2437
+ issues.push({ card: index, message: `another card of the file is ${externalId}: left out` });
2438
+ continue;
2439
+ }
2440
+ seen.add(externalId);
2441
+ const organization = properties.find(({ name: name2 }) => name2 === "ORG");
2442
+ const organizationName = organization ? components(decoded(organization, report))[0] : void 0;
2443
+ const title = values("TITLE")[0];
2444
+ const relations = [];
2445
+ if (organizationName) {
2446
+ const id2 = organizationId(organizationName);
2447
+ if (!organizations.has(id2))
2448
+ organizations.set(id2, {
2449
+ key: id2,
2450
+ type: "organization",
2451
+ external_id: id2,
2452
+ operation: "upsert",
2453
+ fields: { name: organizationName }
2454
+ });
2455
+ const as = title === void 0 ? void 0 : titleWord(title);
2456
+ relations.push({ role: "member-of", type: "organization", external_id: id2, ...as ? { as } : {} });
2457
+ }
2458
+ people.push({
2459
+ key: `person:${externalId}`,
2460
+ type: "person",
2461
+ external_id: externalId,
2462
+ operation: "upsert",
2463
+ fields: {
2464
+ ...name === void 0 ? {} : { name },
2465
+ ...phones.length ? { phone: phones } : {},
2466
+ ...emails.length ? { email: emails } : {},
2467
+ ...unread.length ? { phone_unread: unread } : {},
2468
+ ...organizationName ? { organization: organizationName } : {},
2469
+ ...title === void 0 ? {} : { title }
2470
+ },
2471
+ ...relations.length ? { relations } : {}
2472
+ });
2473
+ }
2474
+ return {
2475
+ envelope: {
2476
+ schema_version: 1,
2477
+ source: { provider, account: account2, batch_id: batchId },
2478
+ ...region === void 0 ? {} : { options: { phone_region: region } },
2479
+ records: [...organizations.values(), ...people]
2480
+ },
2481
+ issues
2482
+ };
2483
+ }, "envelopeOfVcard");
2484
+
2485
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/ingest.js
2486
+ var emptyReceipt = /* @__PURE__ */ __name((dryRun, errors) => ({
2234
2487
  dryRun,
2235
2488
  source: null,
2236
2489
  created: 0,
@@ -2241,70 +2494,91 @@ var emptyReceipt = /* @__PURE__ */ __name((dryRun) => ({
2241
2494
  proposed: [],
2242
2495
  waiting: [],
2243
2496
  flagged: [],
2244
- errors: []
2497
+ unmatched: [],
2498
+ ignored: [],
2499
+ errors,
2500
+ truncated: false
2245
2501
  }), "emptyReceipt");
2246
- var ingest = /* @__PURE__ */ __name(async (store, envelope, { account: account2, dryRun = false, chunk = 1e3 }) => {
2247
- const receipt = emptyReceipt(dryRun);
2248
- const broken2 = envelopeErrors(envelope, account2);
2249
- if (broken2.length > 0)
2250
- return { ...receipt, errors: broken2 };
2251
- const { source, records } = envelope;
2252
- receipt.source = { provider: source.provider, account: source.account, batchId: source.batch_id };
2253
- const taken = [];
2254
- const keys = /* @__PURE__ */ new Set();
2255
- const identities = /* @__PURE__ */ new Set();
2256
- for (const [index, record2] of records.entries()) {
2257
- const errors = recordErrors(record2, index);
2258
- const valid = record2;
2259
- if (errors.length === 0 && keys.has(valid.key))
2260
- errors.push({
2261
- pointer: pointerOf("records", index, "key"),
2262
- code: "record.duplicate-key",
2263
- message: "another record of this envelope has this key",
2264
- key: valid.key
2265
- });
2266
- const identity = errors.length === 0 ? `${valid.type}\0${valid.external_id}` : "";
2267
- if (errors.length === 0 && identities.has(identity))
2268
- errors.push({
2269
- pointer: pointerOf("records", index, "external_id"),
2270
- code: "record.duplicate",
2271
- message: `another record of this envelope is ${valid.type} ${valid.external_id}`,
2272
- key: valid.key
2273
- });
2274
- if (errors.length > 0) {
2275
- receipt.refused += 1;
2276
- for (const error of errors)
2277
- receipt.errors.push(error);
2278
- continue;
2279
- }
2280
- keys.add(valid.key);
2281
- identities.add(identity);
2282
- taken.push({ index, record: valid });
2283
- }
2284
- const written = await store.records.write(source, taken, { dryRun, chunk });
2285
- for (const outcome2 of written.outcomes) {
2286
- receipt[outcome2.status] += 1;
2287
- if (outcome2.error)
2288
- receipt.errors.push(outcome2.error);
2289
- }
2290
- for (const error of written.laterErrors)
2291
- receipt.errors.push(error);
2292
- receipt.errors.sort((a, b) => a.pointer.localeCompare(b.pointer, "en", { numeric: true }));
2293
- receipt.proposed = written.proposed;
2294
- receipt.waiting = written.waiting.map(({ index, key, missing: missing4 }) => ({
2502
+ var receiptOf = /* @__PURE__ */ __name((dryRun, source, run) => ({
2503
+ dryRun,
2504
+ source: { provider: source.provider, account: source.account, batchId: source.batch_id },
2505
+ created: run.created,
2506
+ updated: run.updated,
2507
+ unchanged: run.unchanged,
2508
+ deleted: run.deleted,
2509
+ refused: run.refused,
2510
+ proposed: run.proposed,
2511
+ waiting: run.waiting.map(({ index, key, missing: missing4 }) => ({ key, pointer: waitingPointer(index, missing4), missing: missing4 })),
2512
+ flagged: run.flagged.map(({ index, ...flag }) => ({ ...flag, pointer: pointerOf("records", index) })),
2513
+ unmatched: run.unmatched.map(({ index, key, reason, candidates }) => ({
2295
2514
  key,
2296
- pointer: pointerOf("records", index, "relations"),
2297
- missing: missing4
2298
- }));
2299
- receipt.flagged = written.flagged.map(({ index, key, entity }) => ({
2515
+ pointer: pointerOf("records", index, "fields"),
2516
+ reason,
2517
+ candidates
2518
+ })),
2519
+ ignored: run.ignored.map(({ index, key, at, reason }) => ({
2300
2520
  key,
2301
- pointer: pointerOf("records", index),
2302
- entity
2303
- }));
2304
- return receipt;
2521
+ pointer: pointerOf("records", index, ...at),
2522
+ reason
2523
+ })),
2524
+ errors: run.errors,
2525
+ truncated: run.truncated
2526
+ }), "receiptOf");
2527
+ var itemOf = /* @__PURE__ */ __name((record2, index) => {
2528
+ const errors = recordErrors(record2, index);
2529
+ return { index, record: record2, ...errors.length > 0 ? { errors } : {} };
2530
+ }, "itemOf");
2531
+ var refusedAll = /* @__PURE__ */ __name((dryRun, errors, onIssue) => {
2532
+ for (const error of errors)
2533
+ onIssue?.(error);
2534
+ return emptyReceipt(dryRun, errors);
2535
+ }, "refusedAll");
2536
+ var ingest = /* @__PURE__ */ __name(async (store, envelope, { account: account2, dryRun = false, chunk = 1e3, onIssue }) => {
2537
+ const broken2 = envelopeErrors(envelope, account2);
2538
+ if (broken2.length > 0)
2539
+ return refusedAll(dryRun, broken2, onIssue);
2540
+ const { source, records, options } = envelope;
2541
+ const items = records.map(itemOf);
2542
+ return receiptOf(dryRun, source, await store.records.run(source, items, { dryRun, chunk, options, onIssue }));
2305
2543
  }, "ingest");
2544
+ var jsonlLines = /* @__PURE__ */ __name((stream) => createInterface({ input: stream, crlfDelay: Number.POSITIVE_INFINITY }), "jsonlLines");
2545
+ var ingestLines = /* @__PURE__ */ __name(async (store, lines, { account: account2, dryRun = false, chunk = 1e3, onIssue }) => {
2546
+ const iterator = lines[Symbol.asyncIterator]();
2547
+ let header = {};
2548
+ for (let next = await iterator.next(); !next.done; next = await iterator.next())
2549
+ if (next.value.trim() !== "" && next.value !== "\uFEFF") {
2550
+ header = jsonLine(next.value);
2551
+ break;
2552
+ }
2553
+ const broken2 = headerErrors(header, account2);
2554
+ if (broken2.length > 0) {
2555
+ await iterator.return?.();
2556
+ return refusedAll(dryRun, broken2, onIssue);
2557
+ }
2558
+ const { source, options } = header;
2559
+ async function* items() {
2560
+ let index = 0;
2561
+ for (let next = await iterator.next(); !next.done; next = await iterator.next()) {
2562
+ if (next.value.trim() === "")
2563
+ continue;
2564
+ yield itemOf(jsonLine(next.value), index);
2565
+ index += 1;
2566
+ }
2567
+ }
2568
+ __name(items, "items");
2569
+ return receiptOf(dryRun, source, await store.records.run(source, items(), { dryRun, chunk, options, onIssue }));
2570
+ }, "ingestLines");
2571
+ var ingestVcard = /* @__PURE__ */ __name(async (store, text2, { provider, batchId, region, ...options }) => {
2572
+ const { envelope, issues } = envelopeOfVcard(text2, {
2573
+ provider,
2574
+ account: options.account,
2575
+ batchId,
2576
+ ...region === void 0 ? {} : { region }
2577
+ });
2578
+ return { ...await ingest(store, envelope, options), vcard: issues };
2579
+ }, "ingestVcard");
2306
2580
 
2307
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/link-scorers/shared.js
2581
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/link-scorers/shared.js
2308
2582
  var escaped = /* @__PURE__ */ __name((text2) => text2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
2309
2583
  var folded = /* @__PURE__ */ __name((text2) => text2.normalize("NFKC").toLowerCase().replace(/\s+/gu, " "), "folded");
2310
2584
  var wholeWords = /* @__PURE__ */ __name((term) => new RegExp(`(?<![\\p{L}\\p{N}\\p{M}_])${escaped(normalizeVocabularyName(term))}(?![\\p{L}\\p{N}\\p{M}_])`, "u"), "wholeWords");
@@ -2331,7 +2605,10 @@ var personRefOf = /* @__PURE__ */ __name(async (store, provider, id2) => {
2331
2605
  const person = await store.people.personOf({ provider, id: id2 });
2332
2606
  return person ? `person:${person.uid}` : void 0;
2333
2607
  }, "personRefOf");
2334
- var projectsOf = /* @__PURE__ */ __name(async (store, person) => new Set((await store.knowledge.relations(null, person)).filter((one2) => one2.confirmed && one2.kind === "member-of" && one2.from === person && one2.to.startsWith("project:")).map((one2) => one2.to)).size, "projectsOf");
2608
+ var projectsOf = /* @__PURE__ */ __name(async (store, person, project) => (/* @__PURE__ */ new Set([
2609
+ project,
2610
+ ...(await store.knowledge.relations(null, person)).filter((one2) => isUsable(one2.standing) && one2.kind === "member-of" && one2.from === person && one2.to.startsWith("project:")).map((one2) => one2.to)
2611
+ ])).size, "projectsOf");
2335
2612
  var identitiesIn = /* @__PURE__ */ __name(async (store, people, provider) => {
2336
2613
  const found = [];
2337
2614
  for (const person of people) {
@@ -2343,7 +2620,7 @@ var identitiesIn = /* @__PURE__ */ __name(async (store, people, provider) => {
2343
2620
  return found;
2344
2621
  }, "identitiesIn");
2345
2622
 
2346
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/link-scorers/alias-hits.js
2623
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/link-scorers/alias-hits.js
2347
2624
  var SEARCH_LIMIT = 500;
2348
2625
  var aliasWeight = /* @__PURE__ */ __name((hits) => hits >= 10 ? 0.55 : hits >= 3 ? 0.35 : 0, "aliasWeight");
2349
2626
  var aliasHits = {
@@ -2392,15 +2669,17 @@ var aliasHits = {
2392
2669
  }, "candidates")
2393
2670
  };
2394
2671
 
2395
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/link-scorers/chat-senders.js
2672
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/link-scorers/chat-senders.js
2396
2673
  var WEIGHT = 0.5;
2397
2674
  var LARGE_GROUP_WEIGHT = 0.2;
2398
2675
  var LARGE_GROUP = 30;
2676
+ var SMALL_CHAT = 10;
2399
2677
  var MIN_MESSAGES = 5;
2400
2678
  var READ_LIMIT = 2e3;
2401
2679
  var chatSenders = {
2402
2680
  id: "chat-senders",
2403
- version: 1,
2681
+ version: 2,
2682
+ spreads: true,
2404
2683
  candidates: /* @__PURE__ */ __name(async ({ store, project, confirmed, sources, since, owner, signal }) => {
2405
2684
  if (!project)
2406
2685
  return [];
@@ -2424,7 +2703,7 @@ var chatSenders = {
2424
2703
  const size4 = Math.max((await store.roster.members(key, reference.chat)).length, senders.size);
2425
2704
  const weight = size4 > LARGE_GROUP ? LARGE_GROUP_WEIGHT : WEIGHT;
2426
2705
  for (const [id2, { count: count2, last }] of senders) {
2427
- if (count2 < MIN_MESSAGES)
2706
+ if (size4 > SMALL_CHAT && count2 < MIN_MESSAGES)
2428
2707
  continue;
2429
2708
  const person = await personRefOf(store, key.provider, id2);
2430
2709
  if (!person || person === owner)
@@ -2444,7 +2723,7 @@ var chatSenders = {
2444
2723
  }, "candidates")
2445
2724
  };
2446
2725
 
2447
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/link-scorers/chat-title.js
2726
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/link-scorers/chat-title.js
2448
2727
  var WEIGHT2 = 0.7;
2449
2728
  var chatTitle = {
2450
2729
  id: "chat-title",
@@ -2483,7 +2762,7 @@ var chatTitle = {
2483
2762
  }, "candidates")
2484
2763
  };
2485
2764
 
2486
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/link-scorers/email-domain.js
2765
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/link-scorers/email-domain.js
2487
2766
  var WEIGHT3 = 0.3;
2488
2767
  var CONTACTS = 500;
2489
2768
  var MOST_PAIRS = 200;
@@ -2544,13 +2823,14 @@ var emailDomain = {
2544
2823
  }, "candidates")
2545
2824
  };
2546
2825
 
2547
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/link-scorers/mail-thread.js
2826
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/link-scorers/mail-thread.js
2548
2827
  var NAMED = 0.7;
2549
2828
  var MEMBER_ONLY = 0.3;
2550
2829
  var READ_LIMIT2 = 500;
2551
2830
  var mailThread = {
2552
2831
  id: "mail-thread",
2553
2832
  version: 1,
2833
+ spreads: true,
2554
2834
  candidates: /* @__PURE__ */ __name(async ({ store, project, confirmed, sources, since, owner, signal }) => {
2555
2835
  if (!project)
2556
2836
  return [];
@@ -2617,11 +2897,12 @@ var mailThread = {
2617
2897
  }, "candidates")
2618
2898
  };
2619
2899
 
2620
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/link-scorers/member-chats.js
2900
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/link-scorers/member-chats.js
2621
2901
  var WEIGHT4 = 0.5;
2622
2902
  var memberChats = {
2623
2903
  id: "member-chats",
2624
2904
  version: 1,
2905
+ spreads: true,
2625
2906
  candidates: /* @__PURE__ */ __name(async ({ store, project, confirmed, sources, owner, signal }) => {
2626
2907
  if (!project)
2627
2908
  return [];
@@ -2657,11 +2938,12 @@ var memberChats = {
2657
2938
  }, "candidates")
2658
2939
  };
2659
2940
 
2660
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/link-scorers/member-dialog.js
2941
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/link-scorers/member-dialog.js
2661
2942
  var WEIGHT5 = 0.6;
2662
2943
  var memberDialog = {
2663
2944
  id: "member-dialog",
2664
- version: 1,
2945
+ version: 2,
2946
+ spreads: true,
2665
2947
  candidates: /* @__PURE__ */ __name(async ({ store, project, confirmed, sources, owner, signal }) => {
2666
2948
  if (!project)
2667
2949
  return [];
@@ -2675,7 +2957,7 @@ var memberDialog = {
2675
2957
  if (chat.kind !== "dialog")
2676
2958
  continue;
2677
2959
  if (!projects.has(person))
2678
- projects.set(person, Math.max(1, await projectsOf(store, person)));
2960
+ projects.set(person, await projectsOf(store, person, project.ref));
2679
2961
  const shared = projects.get(person) ?? 1;
2680
2962
  found.push({
2681
2963
  from: chatRef(key, chat.id),
@@ -2691,7 +2973,7 @@ var memberDialog = {
2691
2973
  }, "candidates")
2692
2974
  };
2693
2975
 
2694
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/project-purposes.js
2976
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/project-purposes.js
2695
2977
  var BUILT_IN_PURPOSES = ["work", "sales", "support", "other"];
2696
2978
  var DEFAULT_PURPOSES = ["work"];
2697
2979
  var LINK_PURPOSE = "work";
@@ -2702,15 +2984,15 @@ var unknown2 = /* @__PURE__ */ __name((asked, config) => {
2702
2984
  throw new CliError("validation_error", `unknown purpose ${wrong.join(", ")}; the configured ones are ${config.purposes.join(", ")}, or all`, { param: "purpose", purposes: [...config.purposes] });
2703
2985
  }, "unknown");
2704
2986
  var purposesOf = /* @__PURE__ */ __name((asked, config = BUILT_IN_PURPOSE_CONFIG, project) => {
2705
- const words3 = (asked ?? []).map((one2) => one2.trim()).filter(Boolean);
2706
- if (words3.includes("all")) {
2707
- if (words3.length > 1)
2987
+ const words4 = (asked ?? []).map((one2) => one2.trim()).filter(Boolean);
2988
+ if (words4.includes("all")) {
2989
+ if (words4.length > 1)
2708
2990
  throw new CliError("validation_error", "--purpose all reads every purpose; give it alone");
2709
2991
  return "all";
2710
2992
  }
2711
- if (words3.length) {
2712
- unknown2(words3, config);
2713
- return new Set(words3);
2993
+ if (words4.length) {
2994
+ unknown2(words4, config);
2995
+ return new Set(words4);
2714
2996
  }
2715
2997
  const own = (project?.key ? config.projects?.[project.key] : void 0) ?? (project?.ref ? config.projects?.[project.ref] : void 0);
2716
2998
  return new Set(own ?? config.defaults);
@@ -2721,7 +3003,7 @@ var purposeList = /* @__PURE__ */ __name((value, previous = []) => [
2721
3003
  ...value.split(",").map((one2) => one2.trim()).filter(Boolean)
2722
3004
  ], "purposeList");
2723
3005
 
2724
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/project-gathering-around.js
3006
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/project-gathering-around.js
2725
3007
  var storedMessageNeighbours = /* @__PURE__ */ __name((messages) => ({
2726
3008
  async around(ref, window2) {
2727
3009
  const at = parseLocator(ref);
@@ -2740,8 +3022,8 @@ var wordsOf = /* @__PURE__ */ __name((text2) => (text2.match(/[\p{L}\p{N}\p{M}]+
2740
3022
  var documentMatches = /* @__PURE__ */ __name((text2, queries, window2) => {
2741
3023
  const paragraphs = text2.split(/\n\s*\n/).map((part) => part.replace(/\s+/g, " ").trim()).filter(Boolean);
2742
3024
  const query = queries.join(" ");
2743
- const words3 = new Set(wordsOf(query));
2744
- const matching2 = paragraphs.flatMap((part, index) => wordsOf(part).some((word) => words3.has(word)) ? [index] : []);
3025
+ const words4 = new Set(wordsOf(query));
3026
+ const matching2 = paragraphs.flatMap((part, index) => wordsOf(part).some((word) => words4.has(word)) ? [index] : []);
2745
3027
  const hit = matching2[0];
2746
3028
  if (hit === void 0 || paragraphs.length < 2)
2747
3029
  return { around: [], moreMatches: 0 };
@@ -2817,8 +3099,8 @@ var storedNeighbours = /* @__PURE__ */ __name((store) => {
2817
3099
  };
2818
3100
  }, "storedNeighbours");
2819
3101
 
2820
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/project-gathering-request.js
2821
- import { createHash } from "node:crypto";
3102
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/project-gathering-request.js
3103
+ import { createHash as createHash2 } from "node:crypto";
2822
3104
  var DAY2 = 864e5;
2823
3105
  var MAX_TIME = 864e13;
2824
3106
  var CONTEXT_CHUNK_DAYS = 90;
@@ -2851,10 +3133,10 @@ var text = /* @__PURE__ */ __name((value, name, max) => typeof value === "string
2851
3133
  var whole = /* @__PURE__ */ __name((value, name, low, high) => Number.isSafeInteger(value) && value >= low && value <= high ? value : fail(`${name} must be a whole number from ${low} to ${high}`, name), "whole");
2852
3134
  var laneQuery = /* @__PURE__ */ __name((value, name) => {
2853
3135
  const query = text(value, name, 2048);
2854
- const words3 = query.match(/[\p{L}\p{N}]+/gu) ?? [];
2855
- if (!words3.length || words3.length > 16)
3136
+ const words4 = query.match(/[\p{L}\p{N}]+/gu) ?? [];
3137
+ if (!words4.length || words4.length > 16)
2856
3138
  fail(`${name} needs 1\u201316 literal words`, name);
2857
- return words3.join(" ");
3139
+ return words4.join(" ");
2858
3140
  }, "laneQuery");
2859
3141
  var list = /* @__PURE__ */ __name((value, name, max) => {
2860
3142
  if (value === void 0)
@@ -3034,7 +3316,7 @@ var projectGatheringRequest = /* @__PURE__ */ __name((input, now) => {
3034
3316
  ]));
3035
3317
  if (budgets.maxPageBytes > budgets.maxReadBytes)
3036
3318
  budgets.maxPageBytes = budgets.maxReadBytes;
3037
- const fingerprint = createHash("sha256").update(JSON.stringify([
3319
+ const fingerprint = createHash2("sha256").update(JSON.stringify([
3038
3320
  "project-gathering-v1",
3039
3321
  project,
3040
3322
  lanes,
@@ -3046,7 +3328,7 @@ var projectGatheringRequest = /* @__PURE__ */ __name((input, now) => {
3046
3328
  asOf,
3047
3329
  fetch2
3048
3330
  ])).digest("hex");
3049
- const linkedKey = linkedChats.length ? createHash("sha256").update(JSON.stringify(linkedChats.map((c) => c.ref))).digest("hex") : void 0;
3331
+ const linkedKey = linkedChats.length ? createHash2("sha256").update(JSON.stringify(linkedChats.map((c) => c.ref))).digest("hex") : void 0;
3050
3332
  const runKey = input.runKey === void 0 ? fingerprint : text(input.runKey, "runKey", 256);
3051
3333
  if (input.checkpoint !== void 0 && typeof input.checkpoint !== "string")
3052
3334
  fail("checkpoint must be text", "checkpoint");
@@ -3111,7 +3393,7 @@ var projectUnits = /* @__PURE__ */ __name((plan, window2) => {
3111
3393
  fail(`${units2.length} lane \xD7 source \xD7 90-day reads exceed ${LIMITS.units}; narrow the lanes, sources or window`);
3112
3394
  return units2;
3113
3395
  }, "projectUnits");
3114
- var seenKey = /* @__PURE__ */ __name((ref) => createHash("sha256").update(ref).digest("base64url").slice(0, 16), "seenKey");
3396
+ var seenKey = /* @__PURE__ */ __name((ref) => createHash2("sha256").update(ref).digest("base64url").slice(0, 16), "seenKey");
3115
3397
  var encodeCheckpoint = /* @__PURE__ */ __name((checkpoint) => Buffer.from(JSON.stringify(checkpoint)).toString("base64url"), "encodeCheckpoint");
3116
3398
  var decodeCheckpoint = /* @__PURE__ */ __name((text2, plan) => {
3117
3399
  let value;
@@ -3133,7 +3415,7 @@ var decodeCheckpoint = /* @__PURE__ */ __name((text2, plan) => {
3133
3415
  return value;
3134
3416
  }, "decodeCheckpoint");
3135
3417
 
3136
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/project-gathering.js
3418
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/project-gathering.js
3137
3419
  var terminal = /* @__PURE__ */ new Set(["done", "unavailable", "failed"]);
3138
3420
  var PAGE = 20;
3139
3421
  var PEOPLE = 20;
@@ -3537,7 +3819,7 @@ var peopleOf = /* @__PURE__ */ __name((items, senderOf) => {
3537
3819
  return [...byKey.values()].sort((a, b) => b.items - a.items || a.name.localeCompare(b.name));
3538
3820
  }, "peopleOf");
3539
3821
 
3540
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidate-matching.js
3822
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidate-matching.js
3541
3823
  var normalizedText = /* @__PURE__ */ __name((text2) => text2.normalize("NFKC").toLowerCase().replace(/\s+/gu, " "), "normalizedText");
3542
3824
  var termsOf = /* @__PURE__ */ __name((entry) => [
3543
3825
  { name: entry.name, kind: "canonical" },
@@ -3602,7 +3884,7 @@ var matchProjectCandidates = /* @__PURE__ */ __name((catalog, input) => matchVoc
3602
3884
  omittedMatches: omitted
3603
3885
  })), "matchProjectCandidates");
3604
3886
 
3605
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/project-gathering-mentions.js
3887
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/project-gathering-mentions.js
3606
3888
  var KINDS = ["project", "tag", "topic"];
3607
3889
  var findEvidenceMentions = /* @__PURE__ */ __name(async (vocabulary, gathering, options = {}) => {
3608
3890
  if (typeof vocabulary?.vocabulary !== "function")
@@ -3657,7 +3939,7 @@ var findEvidenceMentions = /* @__PURE__ */ __name(async (vocabulary, gathering,
3657
3939
  };
3658
3940
  }, "findEvidenceMentions");
3659
3941
 
3660
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/stored-project-gathering.js
3942
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/stored-project-gathering.js
3661
3943
  var storedChatCount = /* @__PURE__ */ __name((store) => async (account2, chatId, { since, until }) => {
3662
3944
  const window2 = { since: new Date(since).toISOString(), until: new Date(until - 1).toISOString() };
3663
3945
  const [messages, newest, oldest] = await Promise.all([
@@ -3752,7 +4034,7 @@ var proposedLinksOf = /* @__PURE__ */ __name(async (store, project) => {
3752
4034
  }
3753
4035
  ];
3754
4036
  }).sort((a, b) => Number(a.id) - Number(b.id));
3755
- const legacy = (await store.knowledge.relations(null, project)).filter((one2) => !one2.confirmed && one2.kind === "member-of" && one2.to === project).map((one2) => ({ from: one2.from, id: `link:${one2.id}`, role: one2.role, purpose: one2.purpose }));
4037
+ const legacy = (await store.knowledge.relations(null, project)).filter((one2) => one2.standing === "proposed" && one2.kind === "member-of" && one2.to === project).map((one2) => ({ from: one2.from, id: `link:${one2.id}`, role: one2.role, purpose: one2.purpose }));
3756
4038
  return [...proposals, ...legacy];
3757
4039
  }, "proposedLinksOf");
3758
4040
  var memberRefsOf = /* @__PURE__ */ __name(async (store, project, includeProposed) => {
@@ -3760,7 +4042,7 @@ var memberRefsOf = /* @__PURE__ */ __name(async (store, project, includeProposed
3760
4042
  return [];
3761
4043
  const confirmed = /* @__PURE__ */ new Set();
3762
4044
  for (const relation of await store.knowledge.relations(null, project))
3763
- if (relation.confirmed && relation.kind === "member-of" && relation.to === project && /^person:.+/.test(relation.from))
4045
+ if (isUsable(relation.standing) && relation.kind === "member-of" && relation.to === project && /^person:.+/.test(relation.from))
3764
4046
  confirmed.add(relation.from);
3765
4047
  const members = [...confirmed].sort().map((ref) => ({ ref }));
3766
4048
  if (!includeProposed)
@@ -3798,7 +4080,7 @@ var linkedChatsOf = /* @__PURE__ */ __name(async (store, project, options = {})
3798
4080
  return [];
3799
4081
  const chats = [];
3800
4082
  for (const relation of await store.knowledge.relations(null, project)) {
3801
- if (!relation.confirmed || relation.kind !== "member-of" || relation.to !== project)
4083
+ if (!isUsable(relation.standing) || relation.kind !== "member-of" || relation.to !== project)
3802
4084
  continue;
3803
4085
  const reference = chatOf2(relation.from);
3804
4086
  if (reference)
@@ -3925,7 +4207,7 @@ var gatherStoredProject = /* @__PURE__ */ __name(async (store, input) => {
3925
4207
  const leftOut = [];
3926
4208
  for (const one2 of all.filter((chat) => !purposeRead(purposes, chat.purpose))) {
3927
4209
  const account2 = { provider: one2.provider, account: one2.account };
3928
- const [counted3, [held]] = await Promise.all([
4210
+ const [counted2, [held]] = await Promise.all([
3929
4211
  count2(account2, one2.chat, { since: gathered.window.after, until: gathered.window.before }),
3930
4212
  chatCoverage(store, account2, [one2.chat])
3931
4213
  ]);
@@ -3938,7 +4220,7 @@ var gatherStoredProject = /* @__PURE__ */ __name(async (store, input) => {
3938
4220
  purpose: one2.purpose ?? LINK_PURPOSE,
3939
4221
  relationship: one2.relationship,
3940
4222
  ...one2.proposed ? { proposed: one2.proposed } : {},
3941
- ...counted3
4223
+ ...counted2
3942
4224
  });
3943
4225
  }
3944
4226
  return {
@@ -3963,13 +4245,14 @@ var purposeHintOf = /* @__PURE__ */ __name((linked, rows, of) => {
3963
4245
  return { chat: top.ref, relationship: link4.relationship, items, of };
3964
4246
  }, "purposeHintOf");
3965
4247
 
3966
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/link-scorers/scan.js
4248
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/link-scorers/scan.js
3967
4249
  var SCORERS = [chatTitle, aliasHits, memberChats, memberDialog, chatSenders, mailThread];
3968
4250
  var PERSON_SCORERS = [emailDomain];
3969
4251
  var SCAN_BOT = { bot: "memo-scan", kind: "rule" };
3970
4252
  var DEFAULT_THRESHOLD = 0.5;
3971
4253
  var PERSON_THRESHOLD = 0.3;
3972
4254
  var DEFAULT_LIMIT = 20;
4255
+ var MAX_HOPS = 4;
3973
4256
  var projectOf2 = /* @__PURE__ */ __name(async (store, reference) => {
3974
4257
  const ref = await canonicalProjectRef(store, reference);
3975
4258
  const entry = (await store.knowledge.vocabulary({ kind: "project" })).entries.find((one2) => one2.id === ref.slice(8));
@@ -3980,7 +4263,7 @@ var projectOf2 = /* @__PURE__ */ __name(async (store, reference) => {
3980
4263
  var confirmedOf = /* @__PURE__ */ __name(async (store, project) => {
3981
4264
  if (!project)
3982
4265
  return { chats: [], people: [] };
3983
- const members = (await store.knowledge.relations(null, project.ref)).filter((one2) => one2.confirmed && one2.kind === "member-of" && one2.to === project.ref);
4266
+ const members = (await store.knowledge.relations(null, project.ref)).filter((one2) => isUsable(one2.standing) && one2.kind === "member-of" && one2.to === project.ref);
3984
4267
  return {
3985
4268
  chats: [...new Set(members.map((one2) => one2.from).filter((ref) => ref.startsWith("chat:")))].sort(),
3986
4269
  people: [...new Set(members.map((one2) => one2.from).filter((ref) => ref.startsWith("person:")))].sort()
@@ -4036,56 +4319,28 @@ var scanProjectLinks = /* @__PURE__ */ __name(async (store, input) => {
4036
4319
  nameOnly: 0,
4037
4320
  unresolved: 0
4038
4321
  };
4039
- const pairs = /* @__PURE__ */ new Map();
4040
- const nameOnly = /* @__PURE__ */ new Set();
4041
- for (const scorer of scorers) {
4042
- input.signal?.throwIfAborted();
4043
- for (const candidate of await scorer.candidates(scorerInput)) {
4044
- const key = pairKey(candidate);
4045
- const verdict = await admissible(store, scorerInput, candidate);
4046
- if (verdict === "owner")
4047
- continue;
4048
- if (verdict === "name-only") {
4049
- if (!nameOnly.has(key))
4050
- skipped.nameOnly++;
4051
- nameOnly.add(key);
4052
- continue;
4053
- }
4054
- if (verdict !== "ok") {
4055
- skipped.unresolved++;
4056
- continue;
4057
- }
4058
- const weight = Math.min(1, Math.max(0, candidate.weight));
4059
- const held = pairs.get(key) ?? { candidate, signals: /* @__PURE__ */ new Map() };
4060
- const scorerId = `${scorer.id}@${scorer.version}`;
4061
- const before2 = held.signals.get(scorerId);
4062
- if (!before2 || before2.weight < weight)
4063
- held.signals.set(scorerId, {
4064
- scorer: scorerId,
4065
- weight,
4066
- why: candidate.why.slice(0, 500),
4067
- ...candidate.purpose && scorerInput.purposes.includes(candidate.purpose) ? { purpose: candidate.purpose } : {}
4068
- });
4069
- held.candidate = {
4070
- ...held.candidate,
4071
- evidence: [.../* @__PURE__ */ new Set([...held.candidate.evidence, ...candidate.evidence])]
4072
- };
4073
- pairs.set(key, held);
4074
- }
4322
+ const fixed = /* @__PURE__ */ new Map();
4323
+ const candidatesOf = /* @__PURE__ */ __name(async (scorer, seeds2) => {
4324
+ if (scorer.spreads)
4325
+ return scorer.candidates({ ...scorerInput, confirmed: seeds2 });
4326
+ const held = fixed.get(scorer) ?? await scorer.candidates(scorerInput);
4327
+ fixed.set(scorer, held);
4328
+ return held;
4329
+ }, "candidatesOf");
4330
+ let seeds = scorerInput.confirmed;
4331
+ let collected = await collect(store, scorerInput, scorers, (scorer) => candidatesOf(scorer, seeds));
4332
+ for (let hop = 0; hop < MAX_HOPS && scorers.some((one2) => one2.spreads); hop++) {
4333
+ const grown = await seedsOf(store, seeds, collected.scored, threshold);
4334
+ if (!grown)
4335
+ break;
4336
+ seeds = grown;
4337
+ collected = await collect(store, scorerInput, scorers, (scorer) => candidatesOf(scorer, seeds));
4075
4338
  }
4076
- const scored = [...pairs.values()].map(({ candidate, signals: signals2 }) => {
4077
- const list3 = [...signals2.values()].sort((a, b) => b.weight - a.weight || a.scorer.localeCompare(b.scorer));
4078
- const purpose = list3.find((one2) => one2.purpose)?.purpose;
4079
- return {
4080
- candidate,
4081
- purpose,
4082
- signals: list3.map(({ scorer, weight, why }) => ({ scorer, weight, why })),
4083
- score: combinedScore(list3.map((one2) => one2.weight))
4084
- };
4085
- }).sort((a, b) => b.score - a.score || a.candidate.from.localeCompare(b.candidate.from));
4339
+ skipped.nameOnly = collected.nameOnly;
4340
+ skipped.unresolved = collected.unresolved;
4086
4341
  const proposals = [];
4087
4342
  let fresh = 0;
4088
- for (const { candidate, purpose, signals: signals2, score } of scored) {
4343
+ for (const { candidate, purpose, signals: signals2, score } of collected.scored) {
4089
4344
  const state = await store.knowledge.relationState(null, candidate);
4090
4345
  if (!state) {
4091
4346
  skipped.unresolved++;
@@ -4142,6 +4397,73 @@ var scanProjectLinks = /* @__PURE__ */ __name(async (store, input) => {
4142
4397
  }
4143
4398
  return { project: project?.ref ?? null, proposals, skipped };
4144
4399
  }, "scanProjectLinks");
4400
+ var collect = /* @__PURE__ */ __name(async (store, input, scorers, candidatesOf) => {
4401
+ const pairs = /* @__PURE__ */ new Map();
4402
+ const nameOnly = /* @__PURE__ */ new Set();
4403
+ let unresolved = 0;
4404
+ for (const scorer of scorers) {
4405
+ input.signal?.throwIfAborted();
4406
+ for (const candidate of await candidatesOf(scorer)) {
4407
+ const key = pairKey(candidate);
4408
+ const verdict = await admissible(store, input, candidate);
4409
+ if (verdict === "owner")
4410
+ continue;
4411
+ if (verdict === "name-only") {
4412
+ nameOnly.add(key);
4413
+ continue;
4414
+ }
4415
+ if (verdict !== "ok") {
4416
+ unresolved++;
4417
+ continue;
4418
+ }
4419
+ const weight = Math.min(1, Math.max(0, candidate.weight));
4420
+ const held = pairs.get(key) ?? { candidate, signals: /* @__PURE__ */ new Map() };
4421
+ const scorerId = `${scorer.id}@${scorer.version}`;
4422
+ const before2 = held.signals.get(scorerId);
4423
+ if (!before2 || before2.weight < weight)
4424
+ held.signals.set(scorerId, {
4425
+ scorer: scorerId,
4426
+ weight,
4427
+ why: candidate.why.slice(0, 500),
4428
+ ...candidate.purpose && input.purposes.includes(candidate.purpose) ? { purpose: candidate.purpose } : {}
4429
+ });
4430
+ held.candidate = {
4431
+ ...held.candidate,
4432
+ evidence: [.../* @__PURE__ */ new Set([...held.candidate.evidence, ...candidate.evidence])]
4433
+ };
4434
+ pairs.set(key, held);
4435
+ }
4436
+ }
4437
+ const scored = [...pairs.values()].map(({ candidate, signals: signals2 }) => {
4438
+ const list3 = [...signals2.values()].sort((a, b) => b.weight - a.weight || a.scorer.localeCompare(b.scorer));
4439
+ const purpose = list3.find((one2) => one2.purpose)?.purpose;
4440
+ return {
4441
+ candidate,
4442
+ purpose,
4443
+ signals: list3.map(({ scorer, weight, why }) => ({ scorer, weight, why })),
4444
+ score: combinedScore(list3.map((one2) => one2.weight))
4445
+ };
4446
+ }).sort((a, b) => b.score - a.score || a.candidate.from.localeCompare(b.candidate.from));
4447
+ return { scored, nameOnly: nameOnly.size, unresolved };
4448
+ }, "collect");
4449
+ var seedsOf = /* @__PURE__ */ __name(async (store, seeds, scored, threshold) => {
4450
+ const chats = new Set(seeds.chats);
4451
+ const people = new Set(seeds.people);
4452
+ const size4 = chats.size + people.size;
4453
+ for (const { candidate, score } of scored) {
4454
+ if (score < threshold || candidate.kind !== "member-of")
4455
+ continue;
4456
+ if (chats.has(candidate.from) || people.has(candidate.from))
4457
+ continue;
4458
+ if ((await store.knowledge.relationState(null, candidate))?.rejected !== false)
4459
+ continue;
4460
+ if (candidate.from.startsWith("chat:"))
4461
+ chats.add(candidate.from);
4462
+ else if (candidate.from.startsWith("person:"))
4463
+ people.add(candidate.from);
4464
+ }
4465
+ return chats.size + people.size === size4 ? void 0 : { chats: [...chats].sort(), people: [...people].sort() };
4466
+ }, "seedsOf");
4145
4467
  var admissible = /* @__PURE__ */ __name(async (store, input, candidate) => {
4146
4468
  if (candidate.from === candidate.to || !Number.isFinite(candidate.weight))
4147
4469
  return "unresolved";
@@ -4171,24 +4493,24 @@ var referenceOf = /* @__PURE__ */ __name((text2) => {
4171
4493
  }, "referenceOf");
4172
4494
  var rejectedReversed = /* @__PURE__ */ __name(async (store, candidate) => candidate.kind === "related-to" && candidate.to.startsWith("person:") && ((await store.knowledge.relationState(null, { from: candidate.to, to: candidate.from, kind: candidate.kind }))?.rejected ?? false), "rejectedReversed");
4173
4495
 
4174
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/media-archive.js
4496
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/media-archive.js
4175
4497
  import { setTimeout as sleep } from "node:timers/promises";
4176
4498
 
4177
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
4499
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
4178
4500
  import { lstat } from "node:fs/promises";
4179
4501
 
4180
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
4181
- import { createHash as createHash3, randomUUID as randomUUID2 } from "node:crypto";
4502
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
4503
+ import { createHash as createHash4, randomUUID as randomUUID2 } from "node:crypto";
4182
4504
  import { open as open2, rename as rename2, unlink as unlink2 } from "node:fs/promises";
4183
4505
  import { join as join2 } from "node:path";
4184
4506
 
4185
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-metadata.js
4186
- import { createHash as createHash2 } from "node:crypto";
4507
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-metadata.js
4508
+ import { createHash as createHash3 } from "node:crypto";
4187
4509
  var metadataLimit = 16384;
4188
4510
  var partialIdentity = /* @__PURE__ */ __name((locator) => JSON.stringify([locator.provider, locator.account, locator.occurrenceId, locator.assetId]), "partialIdentity");
4189
4511
  var missing2 = /* @__PURE__ */ __name((error) => typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT", "missing");
4190
4512
  var fingerprintPartial = /* @__PURE__ */ __name(async (file2, signal, length) => {
4191
- const hash3 = createHash2("sha256");
4513
+ const hash3 = createHash3("sha256");
4192
4514
  let size4 = 0;
4193
4515
  const buffer = Buffer.alloc(65536);
4194
4516
  for (; ; ) {
@@ -4242,7 +4564,7 @@ var readPartialMetadata = /* @__PURE__ */ __name(async (path, locator, maxBytes,
4242
4564
  }
4243
4565
  }, "readPartialMetadata");
4244
4566
 
4245
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-writer.js
4567
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-writer.js
4246
4568
  import { randomUUID } from "node:crypto";
4247
4569
  import { open, rename, unlink } from "node:fs/promises";
4248
4570
  import { join } from "node:path";
@@ -4334,7 +4656,7 @@ var partialWriter = /* @__PURE__ */ __name(async (input) => {
4334
4656
  };
4335
4657
  }, "partialWriter");
4336
4658
 
4337
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
4659
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
4338
4660
  var NativeRecordingPartialStore = class {
4339
4661
  static {
4340
4662
  __name(this, "NativeRecordingPartialStore");
@@ -4356,7 +4678,7 @@ var NativeRecordingPartialStore = class {
4356
4678
  this.options = Object.freeze({ ...options });
4357
4679
  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)))
4358
4680
  throw new CliError("validation_error", "invalid native recording partial options");
4359
- const key = options.persistent ? createHash3("sha256").update(partialIdentity(this.locator)).digest("hex") : randomUUID2();
4681
+ const key = options.persistent ? createHash4("sha256").update(partialIdentity(this.locator)).digest("hex") : randomUUID2();
4360
4682
  this.path = join2(root, `${options.prefix}${key}.part`);
4361
4683
  this.metadataPath = join2(root, `${options.prefix}${key}.json`);
4362
4684
  }
@@ -4441,12 +4763,12 @@ var NativeRecordingPartialStore = class {
4441
4763
  }
4442
4764
  };
4443
4765
 
4444
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
4445
- import { createHash as createHash4 } from "node:crypto";
4766
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
4767
+ import { createHash as createHash5 } from "node:crypto";
4446
4768
  import { link } from "node:fs/promises";
4447
4769
  import { basename, dirname, join as join4, resolve } from "node:path";
4448
4770
 
4449
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-files.js
4771
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-files.js
4450
4772
  import { unlink as unlink3 } from "node:fs/promises";
4451
4773
  var verifiedPublicationFile = /* @__PURE__ */ __name(async (path, expected2, signal, writable = false) => {
4452
4774
  signal?.throwIfAborted();
@@ -4481,7 +4803,7 @@ var commitPublication = /* @__PURE__ */ __name(async (root, partialPath, finalPa
4481
4803
  signal?.throwIfAborted();
4482
4804
  }, "commitPublication");
4483
4805
 
4484
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-journal.js
4806
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-journal.js
4485
4807
  import { randomUUID as randomUUID3 } from "node:crypto";
4486
4808
  import { open as open3, rename as rename3, unlink as unlink4 } from "node:fs/promises";
4487
4809
  import { join as join3 } from "node:path";
@@ -4554,7 +4876,7 @@ var writePublicationJournal = /* @__PURE__ */ __name(async (root, path, prefix,
4554
4876
  }
4555
4877
  }, "writePublicationJournal");
4556
4878
 
4557
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
4879
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
4558
4880
  var NativeRecordingPublication = class {
4559
4881
  static {
4560
4882
  __name(this, "NativeRecordingPublication");
@@ -4570,7 +4892,7 @@ var NativeRecordingPublication = class {
4570
4892
  throw new CliError("validation_error", "invalid native recording publication options");
4571
4893
  this.scope = partialIdentity(locator);
4572
4894
  this.options = Object.freeze({ ...options, codec: Object.freeze({ ...options.codec }) });
4573
- this.journalPath = join4(root, `${options.prefix}${createHash4("sha256").update(this.scope).digest("hex")}.json`);
4895
+ this.journalPath = join4(root, `${options.prefix}${createHash5("sha256").update(this.scope).digest("hex")}.json`);
4574
4896
  this.finalPath = join4(root, options.filename);
4575
4897
  if (this.finalPath === this.journalPath)
4576
4898
  throw new CliError("validation_error", "recording publication paths must be distinct");
@@ -4627,11 +4949,11 @@ var NativeRecordingPublication = class {
4627
4949
  }
4628
4950
  };
4629
4951
 
4630
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/media-archive-manifest.js
4631
- import { createHash as createHash5 } from "node:crypto";
4952
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/media-archive-manifest.js
4953
+ import { createHash as createHash6 } from "node:crypto";
4632
4954
  import { readdir } from "node:fs/promises";
4633
4955
  import { isAbsolute, join as join5, resolve as resolve2 } from "node:path";
4634
- var mediaKey = /* @__PURE__ */ __name((one2) => createHash5("sha256").update(JSON.stringify([one2.provider, one2.account, one2.chat, one2.message, one2.position])).digest("hex"), "mediaKey");
4956
+ var mediaKey = /* @__PURE__ */ __name((one2) => createHash6("sha256").update(JSON.stringify([one2.provider, one2.account, one2.chat, one2.message, one2.position])).digest("hex"), "mediaKey");
4635
4957
  var mediaManifestName = /* @__PURE__ */ __name((one2) => `.media-archive-${mediaKey(one2)}.json`, "mediaManifestName");
4636
4958
  var missingMediaFile = /* @__PURE__ */ __name((error) => typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT", "missingMediaFile");
4637
4959
  var parseMediaEntry = /* @__PURE__ */ __name((value) => {
@@ -4658,7 +4980,7 @@ var mediaFingerprint = /* @__PURE__ */ __name(async (path, signal) => {
4658
4980
  signal?.throwIfAborted();
4659
4981
  const file2 = await openOrdinaryFile(path);
4660
4982
  try {
4661
- const hash3 = createHash5("sha256");
4983
+ const hash3 = createHash6("sha256");
4662
4984
  let size4 = 0;
4663
4985
  for await (const chunk of file2.createReadStream({ autoClose: false, ...signal ? { signal } : {} })) {
4664
4986
  signal?.throwIfAborted();
@@ -4714,7 +5036,7 @@ var commitMediaEntry = /* @__PURE__ */ __name((root, one2, beforePublish) => wri
4714
5036
  beforePublish
4715
5037
  }), "commitMediaEntry");
4716
5038
 
4717
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
5039
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
4718
5040
  var validator = '"media-completed-v1"';
4719
5041
  var maximumFileBytes = 64 * 1024 * 1024 * 1024;
4720
5042
  var archiveMediaFile = /* @__PURE__ */ __name(async (root, identity, kind, file2, beforeWrite, signal, metadata = {}) => {
@@ -4815,7 +5137,7 @@ var archiveMediaFile = /* @__PURE__ */ __name(async (root, identity, kind, file2
4815
5137
  return entry;
4816
5138
  }, "archiveMediaFile");
4817
5139
 
4818
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/media-archive-locks.js
5140
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/media-archive-locks.js
4819
5141
  import { mkdir, realpath } from "node:fs/promises";
4820
5142
  import { join as join6, resolve as resolve3 } from "node:path";
4821
5143
  var archiveLocations = /* @__PURE__ */ __name(async (initial, signal) => {
@@ -4882,7 +5204,7 @@ var withMediaArchiveLocks = /* @__PURE__ */ __name(async (directory, signal, run
4882
5204
  throw new CliError("validation_error", "archive locations changed during locking; run the command again");
4883
5205
  }, "withMediaArchiveLocks");
4884
5206
 
4885
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/media-archive.js
5207
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/media-archive.js
4886
5208
  var validateMediaSince = /* @__PURE__ */ __name((value, flag = "--since-time") => {
4887
5209
  if (value === void 0)
4888
5210
  return void 0;
@@ -5035,7 +5357,7 @@ var archiveMedia = /* @__PURE__ */ __name(async (ports, options) => {
5035
5357
  }, { create: true });
5036
5358
  }, "archiveMedia");
5037
5359
 
5038
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/media-archive-move.js
5360
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/media-archive-move.js
5039
5361
  import { realpath as realpath2, unlink as unlink5 } from "node:fs/promises";
5040
5362
  import { basename as basename2, dirname as dirname2, join as join7, resolve as resolve4 } from "node:path";
5041
5363
  var canonicalDestination = /* @__PURE__ */ __name(async (directory) => {
@@ -5188,7 +5510,7 @@ var moveMediaArchive = /* @__PURE__ */ __name(async (options) => {
5188
5510
  }, { additional: [target], createAdditional: !options.dryRun });
5189
5511
  }, "moveMediaArchive");
5190
5512
 
5191
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/model-downloads.js
5513
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/model-downloads.js
5192
5514
  var bytesOf = /* @__PURE__ */ __name((model) => model.files.reduce((sum2, file2) => sum2 + file2.bytes, 0), "bytesOf");
5193
5515
  var nativeRuntime = /* @__PURE__ */ __name(async ({ env, progress = /* @__PURE__ */ __name(() => {
5194
5516
  }, "progress") }) => {
@@ -5199,7 +5521,7 @@ var nativeRuntime = /* @__PURE__ */ __name(async ({ env, progress = /* @__PURE__
5199
5521
  }
5200
5522
  }, "nativeRuntime");
5201
5523
  var downloadTextModel = /* @__PURE__ */ __name(async (id2, { env, progress = /* @__PURE__ */ __name(() => {
5202
- }, "progress"), acceptTerms = false }) => {
5524
+ }, "progress"), bytes: bytes2, acceptTerms = false }) => {
5203
5525
  const model = textModel(id2);
5204
5526
  if (model.terms && !acceptTerms) {
5205
5527
  throw new CliError("validation_error", `${model.id} comes under the ${model.licence} (${model.terms}): read them, then run this again with --accept-terms`);
@@ -5207,11 +5529,11 @@ var downloadTextModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
5207
5529
  const directory = textModelsDirectory(env);
5208
5530
  if (!isTextModelInstalled(model, directory)) {
5209
5531
  progress(`${model.id}: ${megabytes(bytesOf(model))} from Hugging Face`);
5210
- await installFiles(placedText(model, directory), { progress });
5532
+ await installFiles(placedText(model, directory), { progress, ...bytes2 ? { bytes: bytes2 } : {} });
5211
5533
  }
5212
5534
  await nativeRuntime({ env, progress });
5213
5535
  progress(`${model.id}: loading it once to check it works`);
5214
- const { openEmbedder: openEmbedder2 } = await import("./embed-J3IBVV2V.js");
5536
+ const { openEmbedder: openEmbedder2 } = await import("./embed-OBFFPVF4.js");
5215
5537
  const embedder = await openEmbedder2(model, directory);
5216
5538
  try {
5217
5539
  const [vector] = await embedder.embed(["check"], "query");
@@ -5223,16 +5545,16 @@ var downloadTextModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
5223
5545
  return { model, directory };
5224
5546
  }, "downloadTextModel");
5225
5547
  var downloadRerankModel = /* @__PURE__ */ __name(async (id2, { env, progress = /* @__PURE__ */ __name(() => {
5226
- }, "progress") }) => {
5548
+ }, "progress"), bytes: bytes2 }) => {
5227
5549
  const model = rerankModel(id2);
5228
5550
  const directory = textModelsDirectory(env);
5229
5551
  if (!isTextModelInstalled(model, directory)) {
5230
5552
  progress(`${model.id}: ${megabytes(bytesOf(model))} from Hugging Face`);
5231
- await installFiles(placedText(model, directory), { progress });
5553
+ await installFiles(placedText(model, directory), { progress, ...bytes2 ? { bytes: bytes2 } : {} });
5232
5554
  }
5233
5555
  await nativeRuntime({ env, progress });
5234
5556
  progress(`${model.id}: loading it once to check it works`);
5235
- const { openReranker } = await import("./rerank-TINXM3MY.js");
5557
+ const { openReranker } = await import("./rerank-4NGQWREA.js");
5236
5558
  const reranker = await openReranker(model, directory);
5237
5559
  try {
5238
5560
  await reranker.score("check", ["check"]);
@@ -5242,15 +5564,15 @@ var downloadRerankModel = /* @__PURE__ */ __name(async (id2, { env, progress = /
5242
5564
  return { model, directory };
5243
5565
  }, "downloadRerankModel");
5244
5566
  var downloadImageModel = /* @__PURE__ */ __name(async (id2, { env, progress = /* @__PURE__ */ __name(() => {
5245
- }, "progress") }) => {
5567
+ }, "progress"), bytes: bytes2 }) => {
5246
5568
  const model = imageModel(id2);
5247
5569
  const directory = imageModelsDirectory(env);
5248
5570
  if (!isImageModelInstalled(model, directory)) {
5249
5571
  progress(`${model.id}: ${megabytes(bytesOf(model))} from Hugging Face`);
5250
- await installFiles(placedImage(model, directory), { progress });
5572
+ await installFiles(placedImage(model, directory), { progress, ...bytes2 ? { bytes: bytes2 } : {} });
5251
5573
  }
5252
5574
  progress(`${model.id}: loading it once to check it works`);
5253
- const { openPictureEmbedder } = await import("./embedder-QFPMDRT2.js");
5575
+ const { openPictureEmbedder } = await import("./embedder-NGCBQHIG.js");
5254
5576
  const embedder = await openPictureEmbedder(model, directory);
5255
5577
  try {
5256
5578
  const vector = await embedder.embedQuery("check");
@@ -5262,7 +5584,7 @@ var downloadImageModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
5262
5584
  return { model, directory };
5263
5585
  }, "downloadImageModel");
5264
5586
 
5265
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/domain/money-words.js
5587
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/money-words.js
5266
5588
  var MONEY_REQUEST = "money-request";
5267
5589
  var MONEY_DONE = "money-done";
5268
5590
  var PROMISE = "promise";
@@ -5296,10 +5618,10 @@ var MONEY_WORDS = [
5296
5618
  }
5297
5619
  ];
5298
5620
 
5299
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/money-words.js
5621
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/money-words.js
5300
5622
  var moneyClassesOf = /* @__PURE__ */ __name((text2) => listsHit(text2, MONEY_WORDS), "moneyClassesOf");
5301
5623
 
5302
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/domain/status-words.js
5624
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/status-words.js
5303
5625
  var words = /* @__PURE__ */ __name((forms) => new RegExp(`(?<![\\p{L}\\p{N}])(?:${forms.join("|")})(?![\\p{L}\\p{N}])`, "iu"), "words");
5304
5626
  var MONEY_DONE_FORMS = words([
5305
5627
  "\u043E\u043F\u043B\u0430\u0442\u0438\u043B[\u0430\u0438]?",
@@ -5339,7 +5661,7 @@ var PROMISE_FORMS = words([
5339
5661
  "estar\xE1 listo"
5340
5662
  ]);
5341
5663
 
5342
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/project-status/items.js
5664
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/project-status/items.js
5343
5665
  var EXCERPT_CHARS = 80;
5344
5666
  var excerpt2 = /* @__PURE__ */ __name((text2) => {
5345
5667
  const flat = text2.replace(/\s+/g, " ").trim();
@@ -5361,7 +5683,7 @@ var whoOf = /* @__PURE__ */ __name((message) => ({
5361
5683
  var fromOwner = /* @__PURE__ */ __name((message) => message.outgoing === true, "fromOwner");
5362
5684
  var day = /* @__PURE__ */ __name((at) => new Date(at).toISOString().slice(0, 10), "day");
5363
5685
 
5364
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/project-status/signals/amounts.js
5686
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/project-status/signals/amounts.js
5365
5687
  var MONEY = DEFAULT_TASK_CATEGORIES.filter((category) => category.name === "money");
5366
5688
  var verbOf = /* @__PURE__ */ __name((text2) => {
5367
5689
  if (MONEY_DONE_FORMS.test(text2))
@@ -5401,10 +5723,10 @@ var rowsOf = /* @__PURE__ */ __name((chat) => chat.messages.flatMap((message) =>
5401
5723
  var centsText = /* @__PURE__ */ __name((cents) => `${Math.floor(cents / 100)}.${String(cents % 100).padStart(2, "0")}`, "centsText");
5402
5724
  var amounts = {
5403
5725
  id: "amounts",
5404
- version: 1,
5726
+ version: 3,
5405
5727
  scope: "chat",
5406
- read: /* @__PURE__ */ __name(async (_context, chat) => {
5407
- if (!chat)
5728
+ read: /* @__PURE__ */ __name(async (context2, chat) => {
5729
+ if (!chat || context2.books)
5408
5730
  return [];
5409
5731
  const groups = /* @__PURE__ */ new Map();
5410
5732
  for (const row of rowsOf(chat)) {
@@ -5417,7 +5739,8 @@ var amounts = {
5417
5739
  const lastAsk = asks.at(-1);
5418
5740
  const first = asks[0] ?? done2[0] ?? rows[0];
5419
5741
  const paidAfter = done2.some((row) => !lastAsk || Date.parse(row.message.timestamp) >= Date.parse(lastAsk.message.timestamp));
5420
- const state = asks.length ? paidAfter ? "paid-mentioned" : "open" : done2.length ? "paid-mentioned" : "mentioned";
5742
+ const paid2 = asks.length ? paidAfter : done2.length > 0;
5743
+ const state = paid2 ? "paid-mentioned" : asks.length ? "asked" : "mentioned";
5421
5744
  const cited2 = asks.length ? [...asks, ...paidAfter ? done2.slice(-1) : []] : rows;
5422
5745
  return {
5423
5746
  signal: "amounts",
@@ -5438,10 +5761,10 @@ var amounts = {
5438
5761
  };
5439
5762
  });
5440
5763
  }, "read"),
5441
- attention: /* @__PURE__ */ __name((items) => items.flatMap((item2) => item2.chat !== null && item2.data.state === "open" ? [{ chat: item2.chat, weight: 2, why: "money open" }] : []), "attention")
5764
+ attention: /* @__PURE__ */ __name((items) => items.flatMap((item2) => item2.chat !== null && item2.data.state === "asked" ? [{ chat: item2.chat, weight: 2, why: "money asked" }] : []), "attention")
5442
5765
  };
5443
5766
 
5444
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/project-status/signals/children.js
5767
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/project-status/signals/children.js
5445
5768
  var children = {
5446
5769
  id: "children",
5447
5770
  version: 1,
@@ -5470,7 +5793,7 @@ var children = {
5470
5793
  }, "read")
5471
5794
  };
5472
5795
 
5473
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/project-status/signals/coverage.js
5796
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/project-status/signals/coverage.js
5474
5797
  var coverage = {
5475
5798
  id: "coverage",
5476
5799
  version: 1,
@@ -5499,29 +5822,7 @@ var coverage = {
5499
5822
  attention: /* @__PURE__ */ __name((items) => items.flatMap((item2) => item2.chat !== null && item2.data.state !== "complete" && item2.data.beforeHeld ? [{ chat: item2.chat, weight: 3, why: "held in part" }] : []), "attention")
5500
5823
  };
5501
5824
 
5502
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/project-status/signals/last-message.js
5503
- var lastMessage = {
5504
- id: "last-message",
5505
- version: 1,
5506
- scope: "chat",
5507
- read: /* @__PURE__ */ __name(async (_context, chat) => {
5508
- const last = chat?.messages.at(-1);
5509
- if (!chat || !last)
5510
- return [];
5511
- const item2 = {
5512
- signal: "last-message",
5513
- chat: chat.ref,
5514
- at: last.timestamp,
5515
- who: whoOf(last),
5516
- evidence: evidenceOf(chat, last),
5517
- basis: "store",
5518
- data: {}
5519
- };
5520
- return [item2];
5521
- }, "read")
5522
- };
5523
-
5524
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/project-status/signals/payments.js
5825
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/project-status/signals/payments.js
5525
5826
  var holding = /* @__PURE__ */ __name((row) => row.review !== "rejected", "holding");
5526
5827
  var item = /* @__PURE__ */ __name((row, at, data) => ({
5527
5828
  signal: "payments",
@@ -5571,7 +5872,7 @@ var payments = {
5571
5872
  }, "read")
5572
5873
  };
5573
5874
 
5574
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/project-status/signals/promises.js
5875
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/project-status/signals/promises.js
5575
5876
  var PATTERNS_PER_CHAT = 3;
5576
5877
  var DAY3 = 864e5;
5577
5878
  var KINDS2 = /* @__PURE__ */ new Set(["promise", "request"]);
@@ -5660,7 +5961,7 @@ var promises = {
5660
5961
  }, "read")
5661
5962
  };
5662
5963
 
5663
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/project-status/signals/questions.js
5964
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/project-status/signals/questions.js
5664
5965
  var PER_SIDE = 5;
5665
5966
  var WEEK = 7 * 864e5;
5666
5967
  var NOBODY = /* @__PURE__ */ new Set();
@@ -5691,7 +5992,7 @@ var questions2 = {
5691
5992
  }, "attention")
5692
5993
  };
5693
5994
 
5694
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/project-status/signals/reply-next.js
5995
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/project-status/signals/reply-next.js
5695
5996
  var targetOf = /* @__PURE__ */ __name((message, chat, owners) => {
5696
5997
  const byId2 = /* @__PURE__ */ __name((id2) => chat.messages.find((one2) => one2.id === id2), "byId");
5697
5998
  const quoted = message.replyTo ?? (message.replyToId === void 0 ? void 0 : byId2(message.replyToId));
@@ -5759,14 +6060,14 @@ var replyNext = {
5759
6060
  attention: /* @__PURE__ */ __name((items) => items.flatMap((item2) => item2.chat !== null && item2.data.next === "owner" ? [{ chat: item2.chat, weight: 2, why: "your move" }] : []), "attention")
5760
6061
  };
5761
6062
 
5762
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/project-status/signals/topics.js
6063
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/project-status/signals/topics.js
5763
6064
  var escaped2 = /* @__PURE__ */ __name((text2) => text2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
5764
6065
  var wholeWord = /* @__PURE__ */ __name((word) => new RegExp(`(?<![\\p{L}\\p{N}])${escaped2(word)}(?![\\p{L}\\p{N}])`, "u"), "wholeWord");
5765
6066
  var matcherOf = /* @__PURE__ */ __name((query) => {
5766
- const words3 = normalize(query).split(" ").filter(Boolean).map(wholeWord);
6067
+ const words4 = normalize(query).split(" ").filter(Boolean).map(wholeWord);
5767
6068
  return (text2) => {
5768
6069
  const folded2 = normalize(text2);
5769
- return words3.length > 0 && words3.every((word) => word.test(folded2));
6070
+ return words4.length > 0 && words4.every((word) => word.test(folded2));
5770
6071
  };
5771
6072
  }, "matcherOf");
5772
6073
  var topics = {
@@ -5805,9 +6106,8 @@ var topics = {
5805
6106
  }, "read")
5806
6107
  };
5807
6108
 
5808
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/project-status/signals/index.js
6109
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/project-status/signals/index.js
5809
6110
  var STATUS_SIGNALS = [
5810
- lastMessage,
5811
6111
  replyNext,
5812
6112
  questions2,
5813
6113
  promises,
@@ -5818,7 +6118,7 @@ var STATUS_SIGNALS = [
5818
6118
  children
5819
6119
  ];
5820
6120
 
5821
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/project-status/index.js
6121
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/project-status/index.js
5822
6122
  var DAY4 = 864e5;
5823
6123
  var STATUS_WINDOW = 300;
5824
6124
  var STATUS_CHATS = 16;
@@ -5834,7 +6134,7 @@ var childrenOf = /* @__PURE__ */ __name(async (store, root, catalog) => {
5834
6134
  const below = [];
5835
6135
  for (const parent of level2)
5836
6136
  for (const relation of await store.knowledge.relations(null, parent)) {
5837
- if (!relation.confirmed || relation.kind !== "member-of" || relation.to !== parent)
6137
+ if (!isUsable(relation.standing) || relation.kind !== "member-of" || relation.to !== parent)
5838
6138
  continue;
5839
6139
  if (!relation.from.startsWith("project:"))
5840
6140
  continue;
@@ -5863,17 +6163,23 @@ var childrenOf = /* @__PURE__ */ __name(async (store, root, catalog) => {
5863
6163
  }, "childrenOf");
5864
6164
  var inAccounts = /* @__PURE__ */ __name((accounts, provider, account2) => accounts === void 0 || accounts.some((one2) => one2.provider === provider && one2.account === account2), "inAccounts");
5865
6165
  var failure = /* @__PURE__ */ __name((error) => error instanceof Error ? error.message : String(error), "failure");
5866
- var counted2 = /* @__PURE__ */ __name((items) => {
5867
- const confirmed = /* @__PURE__ */ __name((item2) => item2.signal === "payments" && item2.data.status === "confirmed", "confirmed");
5868
- const recorded = new Set(items.filter(confirmed).flatMap((item2) => item2.evidence.slice(1).map((one2) => one2.ref)));
5869
- return (item2, state) => item2.signal === "payments" ? state === "expected" && confirmed(item2) : item2.signal === "amounts" && state === "open" && !item2.evidence.some((one2) => recorded.has(one2.ref));
5870
- }, "counted");
6166
+ var owed = /* @__PURE__ */ __name((item2) => {
6167
+ const data = item2.data;
6168
+ return item2.signal === "payments" && data.state === "expected" && data.status === "confirmed";
6169
+ }, "owed");
6170
+ var keepsBooks = /* @__PURE__ */ __name(async (store, projects) => {
6171
+ for (const project of projects) {
6172
+ const filter = { project, review: "confirmed", limit: 1 };
6173
+ if ((await store.finance.invoices(filter)).length || (await store.finance.payments(filter)).length)
6174
+ return true;
6175
+ }
6176
+ return false;
6177
+ }, "keepsBooks");
5871
6178
  var totalsOf = /* @__PURE__ */ __name((items) => {
5872
6179
  const totals = /* @__PURE__ */ new Map();
5873
- const open7 = counted2(items);
5874
6180
  for (const item2 of items) {
5875
6181
  const data = item2.data;
5876
- if (!open7(item2, data.state) || data.amount === void 0)
6182
+ if (!owed(item2) || data.amount === void 0)
5877
6183
  continue;
5878
6184
  const key = `${data.direction}|${data.currency ?? ""}`;
5879
6185
  const total = totals.get(key) ?? {
@@ -5956,6 +6262,7 @@ var projectStatus = /* @__PURE__ */ __name(async (store, input) => {
5956
6262
  chats,
5957
6263
  project: { ...root, children: children2, cut },
5958
6264
  store,
6265
+ books: await keepsBooks(store, [root.ref, ...children2.map((child) => child.ref)]),
5959
6266
  contextQueries: input.contextQueries ?? []
5960
6267
  };
5961
6268
  const items = [];
@@ -6000,7 +6307,7 @@ var projectStatus = /* @__PURE__ */ __name(async (store, input) => {
6000
6307
  };
6001
6308
  }, "projectStatus");
6002
6309
 
6003
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/account.js
6310
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/account.js
6004
6311
  var accountService = /* @__PURE__ */ __name((deps) => {
6005
6312
  const online = /* @__PURE__ */ __name(async (command) => {
6006
6313
  if (deps.offline)
@@ -6072,7 +6379,7 @@ var accountService = /* @__PURE__ */ __name((deps) => {
6072
6379
  };
6073
6380
  }, "accountService");
6074
6381
 
6075
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/domain/send-time.js
6382
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/send-time.js
6076
6383
  var MINUTE = 6e4;
6077
6384
  var YEAR = 365 * 24 * 60 * MINUTE;
6078
6385
  var DELAY = /^(\d+)(m|h|d)$/;
@@ -6091,7 +6398,7 @@ var sendTime = /* @__PURE__ */ __name((value, now = Date.now(), flag = "--at-tim
6091
6398
  return new Date(at - at % MINUTE).toISOString();
6092
6399
  }, "sendTime");
6093
6400
 
6094
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/admin.js
6401
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/admin.js
6095
6402
  var recordMembership = /* @__PURE__ */ __name(async (deps, operationId, done2, change, fix, write) => {
6096
6403
  try {
6097
6404
  const held = await accountStoreIfOpen(deps);
@@ -6237,21 +6544,21 @@ var adminService = /* @__PURE__ */ __name((deps) => {
6237
6544
  const answerAll = capability(connection, "answerAllJoinRequests", "answer every join request at once");
6238
6545
  const { id: chatId } = await connection.resolve(chat);
6239
6546
  const page = await list3(chatId, { limit: 100, ...link4 === void 0 ? {} : { link: link4 } });
6240
- const counted3 = page.total ?? page.items.length;
6547
+ const counted2 = page.total ?? page.items.length;
6241
6548
  if (page.total === void 0 && page.hasMore)
6242
6549
  throw new CliError("validation_error", "too many requests to count; answer them by person, or by --link");
6243
- if (counted3 === 0)
6244
- return { chatId, accepted: accept, counted: counted3 };
6550
+ if (counted2 === 0)
6551
+ return { chatId, accepted: accept, counted: counted2 };
6245
6552
  const operationId = newOperationId();
6246
6553
  await guardedWrite(deps.guard, {
6247
6554
  operationId,
6248
6555
  chatId,
6249
6556
  kind: "chat",
6250
6557
  action: accept ? "requests.accept" : "requests.decline",
6251
- count: counted3,
6252
- people: counted3
6558
+ count: counted2,
6559
+ people: counted2
6253
6560
  }, () => answerAll(chatId, accept, link4));
6254
- return { operationId, chatId, accepted: accept, counted: counted3 };
6561
+ return { operationId, chatId, accepted: accept, counted: counted2 };
6255
6562
  }, "answerAllRequests"),
6256
6563
  links: /* @__PURE__ */ __name(async (chat, window2) => {
6257
6564
  if (deps.offline)
@@ -6338,7 +6645,7 @@ var linkLimits = /* @__PURE__ */ __name(({ approval, expires, maxUses }) => {
6338
6645
  return expires === void 0 ? void 0 : sendTime(expires, Date.now(), "--expire-time");
6339
6646
  }, "linkLimits");
6340
6647
 
6341
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/mail-search.js
6648
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/mail-search.js
6342
6649
  var THREADS_PAGE = 500;
6343
6650
  var threadsOf = /* @__PURE__ */ __name(async (store, key) => {
6344
6651
  const account2 = await store.accounts.storedAccount(key).catch(() => void 0);
@@ -6417,7 +6724,7 @@ var readMail = /* @__PURE__ */ __name(async (store, locator, { before: before2 =
6417
6724
  return thread.slice(Math.max(0, at - before2), at + after + 1).map((hit) => hit.id === message ? { ...hit, anchor: true } : hit);
6418
6725
  }, "readMail");
6419
6726
 
6420
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/search-kind.js
6727
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/search-kind.js
6421
6728
  var NO_MAIL = "no_mail";
6422
6729
  var MAIL = "email";
6423
6730
  var listContextOf = /* @__PURE__ */ __name(async (store, account2, app, stored) => {
@@ -6448,11 +6755,11 @@ var accountsOfKind = /* @__PURE__ */ __name((kind, chosen, held, explicit, comma
6448
6755
  if (kind === "messages") {
6449
6756
  if (explicit === MAIL)
6450
6757
  throw new CliError("validation_error", "mail is searched with `memo search mail`, not search messages");
6451
- return chosen.filter(({ provider }) => kindOf(provider) === "messages");
6758
+ return chosen.filter(({ provider }) => holdsKindOf(provider, "messages"));
6452
6759
  }
6453
6760
  if (explicit !== void 0 && explicit !== MAIL && explicit !== "all")
6454
6761
  throw new CliError("validation_error", `search mail reads mail only \u2014 \`${command === void 0 ? "" : `${command} `}search messages\` searches ${explicit}`);
6455
- const mail = (listed ? chosen : held).filter(({ provider }) => kindOf(provider) === "mail");
6762
+ const mail = (listed ? chosen : held).filter(({ provider }) => holdsKindOf(provider, "mail"));
6456
6763
  if (mail.length === 0)
6457
6764
  throw new CliError("not_found", "no mail in the store yet \u2014 `memo sync --only mail --since-time <time>` imports it", {
6458
6765
  reason: NO_MAIL
@@ -6464,7 +6771,7 @@ var accountsOfKind = /* @__PURE__ */ __name((kind, chosen, held, explicit, comma
6464
6771
  return chosenMail.map(({ provider, account: account2 }) => ({ provider, account: account2 }));
6465
6772
  }, "accountsOfKind");
6466
6773
 
6467
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/messages-search.js
6774
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/messages-search.js
6468
6775
  var MAIL_FIELDS = /* @__PURE__ */ new Set(["to", "cc", "bcc", "subject", "mailbox", "label", "is"]);
6469
6776
  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");
6470
6777
  var prepareLucene = /* @__PURE__ */ __name(async (store, account2, request, messenger) => {
@@ -6647,7 +6954,7 @@ var coverageOf = /* @__PURE__ */ __name(async (store, { scopeAccounts, selectedC
6647
6954
  const completeness = [];
6648
6955
  const stats = /* @__PURE__ */ new Map();
6649
6956
  let inventoryComplete = scopeAccounts.length > 0;
6650
- for (const selected of scopeAccounts) {
6957
+ for (const selected of scopeAccounts.filter(({ provider }) => !isImportedProvider(provider))) {
6651
6958
  if (!await store.sync.syncState(selected, CHAT_LIST_KEY)) {
6652
6959
  inventoryComplete = false;
6653
6960
  }
@@ -6812,7 +7119,7 @@ var statsLucene = /* @__PURE__ */ __name(async (store, account2, request, messen
6812
7119
  };
6813
7120
  }, "statsLucene");
6814
7121
 
6815
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/moment.js
7122
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/moment.js
6816
7123
  var AGO = /^(\d+)(m|h|d)$/;
6817
7124
  var AGO_MS = { m: 6e4, h: 36e5, d: 864e5 };
6818
7125
  var DATE = /^\d{4}-\d{2}-\d{2}/;
@@ -6852,7 +7159,7 @@ var dateWindow = /* @__PURE__ */ __name(({ sinceTime, untilTime, zone, now = Dat
6852
7159
  };
6853
7160
  }, "dateWindow");
6854
7161
 
6855
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/rankings-selection.js
7162
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/rankings-selection.js
6856
7163
  var RANKING_SELECTION_BYTES = 64 * 1024;
6857
7164
  var object = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0, "object");
6858
7165
  function invalid(message = "ranking selection is invalid \u2014 obtain a new drilldown from stats top") {
@@ -7021,7 +7328,7 @@ var readRankingSelection = /* @__PURE__ */ __name(async (store, input) => {
7021
7328
  };
7022
7329
  }, "readRankingSelection");
7023
7330
 
7024
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/search-record.js
7331
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/search-record.js
7025
7332
  var canonical = /* @__PURE__ */ __name((value, nested = false) => Array.isArray(value) ? value.map((one2) => canonical(one2, true)) : value !== null && typeof value === "object" ? Object.fromEntries(Object.entries(value).filter(([, one2]) => one2 !== void 0 && (nested || one2 !== false)).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([key, one2]) => [key, canonical(one2, true)])) : value, "canonical");
7026
7333
  var searchRecordOf = /* @__PURE__ */ __name((command, params) => ({
7027
7334
  command,
@@ -7031,7 +7338,7 @@ var searchRecordOf = /* @__PURE__ */ __name((command, params) => ({
7031
7338
  fieldsVersion: FIELD_VERSION
7032
7339
  }), "searchRecordOf");
7033
7340
 
7034
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/admin-statistics.js
7341
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/admin-statistics.js
7035
7342
  function invalid2(message) {
7036
7343
  throw new CliError("validation_error", message);
7037
7344
  }
@@ -7065,13 +7372,13 @@ var answerers = /* @__PURE__ */ __name(async (store, refs, accounts) => {
7065
7372
  const parts = ref.slice(7).split("/");
7066
7373
  if (parts.length !== 3 || parts.some((part) => !part))
7067
7374
  invalid2("answerer needs person:<provider>/<account>/<id>");
7068
- let decoded;
7375
+ let decoded2;
7069
7376
  try {
7070
- decoded = parts.map(decodeURIComponent);
7377
+ decoded2 = parts.map(decodeURIComponent);
7071
7378
  } catch {
7072
7379
  return invalid2("invalid answerer encoding");
7073
7380
  }
7074
- const [provider, account2, id2] = decoded;
7381
+ const [provider, account2, id2] = decoded2;
7075
7382
  if (!accounts.some((one2) => one2.provider === provider && one2.account === account2))
7076
7383
  invalid2("answerer account is outside this query");
7077
7384
  return { provider, account: account2, id: id2 };
@@ -7325,10 +7632,10 @@ var adminStatisticsService = /* @__PURE__ */ __name((deps) => ({
7325
7632
  }, "evidence")
7326
7633
  }), "adminStatisticsService");
7327
7634
 
7328
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/archive.js
7635
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/archive.js
7329
7636
  import { setTimeout as sleep3 } from "node:timers/promises";
7330
7637
 
7331
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/backfill-estimate.js
7638
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/backfill-estimate.js
7332
7639
  var REQUEST_MS = 400;
7333
7640
  var estimateBackfill = /* @__PURE__ */ __name(({ ranges, held, newest, page, maxPages, pauseMs }) => {
7334
7641
  const lowest = ranges[0];
@@ -7351,13 +7658,13 @@ var estimateBackfill = /* @__PURE__ */ __name(({ ranges, held, newest, page, max
7351
7658
  };
7352
7659
  }, "estimateBackfill");
7353
7660
 
7354
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/domain/recovery.js
7661
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/recovery.js
7355
7662
  var withRecovery = /* @__PURE__ */ __name((error) => ({
7356
7663
  ...error,
7357
7664
  retryable: typeof error.retryable === "boolean" ? error.retryable : error.code === "rate_limited" || error.status === 429
7358
7665
  }), "withRecovery");
7359
7666
 
7360
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/batch.js
7667
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/batch.js
7361
7668
  var actionable = /* @__PURE__ */ __name((error) => {
7362
7669
  if (isCliFailure(error))
7363
7670
  return withRecovery({ code: error.code, message: error.message, ...error.details });
@@ -7440,7 +7747,7 @@ var mergeBatches = /* @__PURE__ */ __name((a, b) => {
7440
7747
  };
7441
7748
  }, "mergeBatches");
7442
7749
 
7443
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/patience.js
7750
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/patience.js
7444
7751
  import { setTimeout as sleep2 } from "node:timers/promises";
7445
7752
  var LONGEST_WAIT_MS = 5 * 60 * 1e3;
7446
7753
  var patiently = /* @__PURE__ */ __name(async (request, note, stop) => {
@@ -7463,7 +7770,7 @@ var patiently = /* @__PURE__ */ __name(async (request, note, stop) => {
7463
7770
  }
7464
7771
  }, "patiently");
7465
7772
 
7466
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/conversations/link.js
7773
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/conversations/link.js
7467
7774
  var RULES_VERSION = 5;
7468
7775
  var LOOK_BACK = 50;
7469
7776
  var SAME_SENDER_WITHIN = 10;
@@ -7553,7 +7860,7 @@ var latest = /* @__PURE__ */ __name((window2, matches) => {
7553
7860
  var sameThread = /* @__PURE__ */ __name((a, b) => a.threadId === b.threadId, "sameThread");
7554
7861
  var link2 = /* @__PURE__ */ __name((message, parentId, source, kind, confidence, method) => ({ messageId: message.id, parentId, source, kind, confidence, method }), "link");
7555
7862
 
7556
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/images/context/index.js
7863
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/images/context/index.js
7557
7864
  var CONTEXT_MESSAGES = 3;
7558
7865
  var CONTEXT_MINUTES = 10;
7559
7866
  var MAX_CHARS = 1200;
@@ -7577,12 +7884,12 @@ var context = {
7577
7884
  }, "describe")
7578
7885
  };
7579
7886
 
7580
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/images/registry.js
7887
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/images/registry.js
7581
7888
  var BUILT_INS = [context];
7582
7889
  var providers = [...BUILT_INS];
7583
7890
  var registeredImageProviders = /* @__PURE__ */ __name(() => providers, "registeredImageProviders");
7584
7891
 
7585
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/conversations.js
7892
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/conversations.js
7586
7893
  var READ_PAGE = 5e3;
7587
7894
  var CHAIN = 50;
7588
7895
  var CONVERSATION_QUERY = {
@@ -7734,7 +8041,7 @@ var sized = /* @__PURE__ */ __name((size4) => {
7734
8041
  return size4;
7735
8042
  }, "sized");
7736
8043
 
7737
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/embeddings-maintenance.js
8044
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/embeddings-maintenance.js
7738
8045
  var REFRESH_BOUNDS = { maxChats: 20, maxChunks: 2e3 };
7739
8046
  var MESSAGE_PAGE = 5e3;
7740
8047
  var PER_SESSION = 8;
@@ -7753,7 +8060,7 @@ var embeddingTarget = /* @__PURE__ */ __name((deps, choice = DEFAULT_TEXT_MODEL)
7753
8060
  price: remote.price,
7754
8061
  installed: true,
7755
8062
  perBatch: PER_REQUEST * concurrency,
7756
- open: /* @__PURE__ */ __name(async () => (await import("./remote-KXVWRK7J.js")).openRemote(remote, apiKey, { concurrency }), "open")
8063
+ open: /* @__PURE__ */ __name(async () => (await import("./remote-VWYFLRGO.js")).openRemote(remote, apiKey, { concurrency }), "open")
7757
8064
  };
7758
8065
  }
7759
8066
  const model = textModel(choice);
@@ -7770,7 +8077,7 @@ var embeddingTarget = /* @__PURE__ */ __name((deps, choice = DEFAULT_TEXT_MODEL)
7770
8077
  if (!isTextModelInstalled(model, directory))
7771
8078
  throw notDownloaded(model.id);
7772
8079
  if (apart) {
7773
- const { openProcess } = await import("./process-SWPJGPQC.js");
8080
+ const { openProcess } = await import("./process-BPBMV3AT.js");
7774
8081
  return openProcess(model, directory, { threads: threads ?? defaultThreads() });
7775
8082
  }
7776
8083
  return openEmbedder(model, directory, { threads: threads ?? defaultThreads() });
@@ -8059,7 +8366,7 @@ var shaped = /* @__PURE__ */ __name(({ chatId, builtAt, algorithmVersion, pendin
8059
8366
  return { ...one2, state };
8060
8367
  }, "shaped");
8061
8368
 
8062
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/search-catchup.js
8369
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/search-catchup.js
8063
8370
  var CATCH_UP_BOUNDS = { maxChunks: 500, maxMessages: 1e4, timeMs: 3e4 };
8064
8371
  var validateCatchUpBounds = /* @__PURE__ */ __name((options) => {
8065
8372
  for (const [key, value, maximum] of [
@@ -8112,7 +8419,7 @@ var catchUpSearch = /* @__PURE__ */ __name(async (deps, chat, options, signal, c
8112
8419
  }
8113
8420
  }, "catchUpSearch");
8114
8421
 
8115
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/archive.js
8422
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/archive.js
8116
8423
  var pushed = /* @__PURE__ */ __name((deps, what) => {
8117
8424
  if (deps.reads === "store") {
8118
8425
  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`);
@@ -8478,8 +8785,8 @@ var timeOfKey = /* @__PURE__ */ __name(async (store, account2, chatId, key, byTi
8478
8785
  return message?.timestamp ?? fallback;
8479
8786
  }, "timeOfKey");
8480
8787
 
8481
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/archive-gaps.js
8482
- import { createHash as createHash6, randomUUID as randomUUID4 } from "node:crypto";
8788
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/archive-gaps.js
8789
+ import { createHash as createHash7, randomUUID as randomUUID4 } from "node:crypto";
8483
8790
  var GAP_BOUNDS = { maxGaps: 5, limit: 500, timeMs: 3e4 };
8484
8791
  var validateRepair = /* @__PURE__ */ __name((messenger, options) => {
8485
8792
  const maxGaps = options.maxGaps ?? GAP_BOUNDS.maxGaps;
@@ -8520,7 +8827,7 @@ var gapsService = /* @__PURE__ */ __name((deps) => {
8520
8827
  limits: { ...GAP_BOUNDS, pageSize: (deps.messenger.fetching ?? FETCHING).page },
8521
8828
  gaps,
8522
8829
  unknown: unknown3,
8523
- fingerprint: createHash6("sha256").update(JSON.stringify(identity)).digest("hex")
8830
+ fingerprint: createHash7("sha256").update(JSON.stringify(identity)).digest("hex")
8524
8831
  };
8525
8832
  }, "plan");
8526
8833
  const repair = /* @__PURE__ */ __name(async (chat, options = {}) => {
@@ -8615,16 +8922,16 @@ var gapsService = /* @__PURE__ */ __name((deps) => {
8615
8922
  return { plan, repair };
8616
8923
  }, "gapsService");
8617
8924
 
8618
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/attachments.js
8619
- import { createHash as createHash8 } from "node:crypto";
8925
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/attachments.js
8926
+ import { createHash as createHash9 } from "node:crypto";
8620
8927
  import { constants as constants2, mkdirSync as mkdirSync2 } from "node:fs";
8621
8928
  import { lstat as lstat4, open as open6, readFile, stat as stat2 } from "node:fs/promises";
8622
8929
 
8623
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/attachments/directory.js
8930
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/attachments/directory.js
8624
8931
  import { lstat as lstat2, readdir as readdir2, realpath as realpath3 } from "node:fs/promises";
8625
8932
  import { basename as basename4, join as join8, relative as relative2, sep as sep2 } from "node:path";
8626
8933
 
8627
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/sends/upload.js
8934
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/sends/upload.js
8628
8935
  import { openAsBlob, realpathSync } from "node:fs";
8629
8936
  import { open as open4, stat } from "node:fs/promises";
8630
8937
  import { basename as basename3, dirname as dirname3, extname, isAbsolute as isAbsolute2, relative, resolve as resolve5, sep } from "node:path";
@@ -8826,7 +9133,7 @@ var readStickerFile = /* @__PURE__ */ __name(async (path, maxBytes, read) => {
8826
9133
  return { name, source };
8827
9134
  }, "readStickerFile");
8828
9135
 
8829
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/attachments/directory.js
9136
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/attachments/directory.js
8830
9137
  var MAX_FILES = 1e4;
8831
9138
  var directoryPaths = /* @__PURE__ */ __name(async (store, chat, directory, app, env) => {
8832
9139
  if (refusedPlace(directory, app, env))
@@ -9936,7 +10243,7 @@ function imageSize(input) {
9936
10243
  }
9937
10244
  __name(imageSize, "imageSize");
9938
10245
 
9939
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/attachments/ocr.js
10246
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/attachments/ocr.js
9940
10247
  var MAX_PAGES = 20;
9941
10248
  var MAX_PIXELS = 2e7;
9942
10249
  var cancelled = /* @__PURE__ */ __name((signal) => {
@@ -10087,7 +10394,7 @@ var ocrPdf = /* @__PURE__ */ __name(async (bytes2, pipeline2, load, signal) => {
10087
10394
  }
10088
10395
  }, "ocrPdf");
10089
10396
 
10090
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/attachments/pdf-preview.js
10397
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/attachments/pdf-preview.js
10091
10398
  var pdfPreview = /* @__PURE__ */ __name(async (bytes2, page, signal, load = importEngine, env = process.env) => {
10092
10399
  const limits = pdfPreviewLimits(env);
10093
10400
  const cancelled4 = /* @__PURE__ */ __name(() => {
@@ -10164,8 +10471,8 @@ var pdfPreview = /* @__PURE__ */ __name(async (bytes2, page, signal, load = impo
10164
10471
  }
10165
10472
  }, "pdfPreview");
10166
10473
 
10167
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/attachments/transfer.js
10168
- import { createHash as createHash7 } from "node:crypto";
10474
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/attachments/transfer.js
10475
+ import { createHash as createHash8 } from "node:crypto";
10169
10476
  import { constants } from "node:fs";
10170
10477
  import { lstat as lstat3, open as open5 } from "node:fs/promises";
10171
10478
  var MAX_CHUNK_BYTES = 1024 * 1024;
@@ -10198,7 +10505,7 @@ var retainedBytes = /* @__PURE__ */ __name(async (path, options, captureFile = f
10198
10505
  const bytes2 = Buffer.alloc(Math.min(chunkBytes, opened.size - offsetBytes));
10199
10506
  const capturedFile = captureFile ? Buffer.alloc(opened.size) : void 0;
10200
10507
  const head = Buffer.alloc(32);
10201
- const hash3 = createHash7("sha256");
10508
+ const hash3 = createHash8("sha256");
10202
10509
  let seen = 0;
10203
10510
  let copied = 0;
10204
10511
  const scratch = Buffer.alloc(65536);
@@ -10272,7 +10579,7 @@ var transferMime = /* @__PURE__ */ __name((head, hint, name = null) => {
10272
10579
  return hint !== null && /^[a-z0-9.+-]+\/[a-z0-9.+-]+$/i.test(hint) ? hint : "application/octet-stream";
10273
10580
  }, "transferMime");
10274
10581
 
10275
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/file-download.js
10582
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/file-download.js
10276
10583
  import { createWriteStream, mkdirSync } from "node:fs";
10277
10584
  import { link as link3, rm } from "node:fs/promises";
10278
10585
  import { join as join9, resolve as resolve6 } from "node:path";
@@ -10386,7 +10693,7 @@ var save = /* @__PURE__ */ __name(async (file2, directory, fallbackName, { uniqu
10386
10693
  }
10387
10694
  }, "save");
10388
10695
 
10389
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/attachments.js
10696
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/attachments.js
10390
10697
  var ATTACHMENT_QUERY = {
10391
10698
  entity: "attachment",
10392
10699
  backend: "sql",
@@ -10436,7 +10743,7 @@ var outcome = /* @__PURE__ */ __name(async (file2, path, load, signal, noFollow
10436
10743
  } finally {
10437
10744
  await handle.close();
10438
10745
  }
10439
- const sha = createHash8("sha256").update(bytes2).digest("hex");
10746
+ const sha = createHash9("sha256").update(bytes2).digest("hex");
10440
10747
  const isPdf = Buffer.from(bytes2.subarray(0, 5)).toString() === "%PDF-";
10441
10748
  const ocrCandidate = ocr !== void 0 && (known2 === "image" || isPdf);
10442
10749
  const localKind = documentKind(hint);
@@ -10475,7 +10782,7 @@ var keep = /* @__PURE__ */ __name(async (store, file2, extraction, bytes2, sha)
10475
10782
  });
10476
10783
  }
10477
10784
  }, "keep");
10478
- var itemOf = /* @__PURE__ */ __name((account2, view) => ({
10785
+ var itemOf2 = /* @__PURE__ */ __name((account2, view) => ({
10479
10786
  message: formatLocator({ ...account2, chat: view.chatId, message: view.messageId }),
10480
10787
  kind: view.kind,
10481
10788
  position: view.position + 1,
@@ -10687,7 +10994,7 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
10687
10994
  }
10688
10995
  const where = query ? queryFilter(query, attachmentColumns(chats), { command: "attachments list" }) : void 0;
10689
10996
  const views = await store.attachments.attachments({ ...where ? { where } : {}, offset, limit: limit + 1 });
10690
- return { items: views.slice(0, limit).map((view) => itemOf(account2, view)), has_more: views.length > limit };
10997
+ return { items: views.slice(0, limit).map((view) => itemOf2(account2, view)), has_more: views.length > limit };
10691
10998
  }, "list"),
10692
10999
  show: /* @__PURE__ */ __name(async ({ chat, message, attachment: attachment2, page, load, ...window2 }) => {
10693
11000
  validateWindow(window2);
@@ -10723,7 +11030,7 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
10723
11030
  nextOffsetBytes: null,
10724
11031
  complete: true,
10725
11032
  base64: rendered.bytes.toString("base64"),
10726
- sha256: createHash8("sha256").update(rendered.bytes).digest("hex"),
11033
+ sha256: createHash9("sha256").update(rendered.bytes).digest("hex"),
10727
11034
  pdf: {
10728
11035
  page: rendered.page,
10729
11036
  pageCount: rendered.pageCount,
@@ -10809,7 +11116,7 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
10809
11116
  }, "setText")
10810
11117
  }), "attachmentsService");
10811
11118
 
10812
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/chat-documents.js
11119
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/chat-documents.js
10813
11120
  var chatDocumentsService = /* @__PURE__ */ __name((deps) => ({
10814
11121
  list: /* @__PURE__ */ __name(async (chat, { limit, offset, ref }) => {
10815
11122
  const store = await accountStore(deps);
@@ -10839,7 +11146,7 @@ var chatDocumentsService = /* @__PURE__ */ __name((deps) => ({
10839
11146
  }, "list")
10840
11147
  }), "chatDocumentsService");
10841
11148
 
10842
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/retention.js
11149
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/retention.js
10843
11150
  var observationDuration = /* @__PURE__ */ __name((text2, flag) => {
10844
11151
  const match = /^(\d+(?:\.\d+)?)([smhdw])$/.exec(text2);
10845
11152
  const units2 = { s: 1e3, m: 6e4, h: 36e5, d: 864e5, w: 6048e5 };
@@ -10926,7 +11233,7 @@ var isRetentionSelection = /* @__PURE__ */ __name((selection) => {
10926
11233
  }
10927
11234
  }, "isRetentionSelection");
10928
11235
 
10929
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/counters.js
11236
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/counters.js
10930
11237
  var counterFields = /* @__PURE__ */ __name((text2 = "views,reactions,comments") => {
10931
11238
  const fields = text2.split(",").map((one2) => one2.trim());
10932
11239
  if (!fields.length || fields.some((one2) => !COUNTER_FIELDS.includes(one2)) || new Set(fields).size !== fields.length)
@@ -11133,7 +11440,7 @@ var countersService = /* @__PURE__ */ __name((deps) => {
11133
11440
  };
11134
11441
  }, "countersService");
11135
11442
 
11136
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/search-refresh.js
11443
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/search-refresh.js
11137
11444
  var SYNC_KEY = "messages.sync-first";
11138
11445
  var SYNC_BOUNDS = { maxChats: 5, timeMs: 3e4, maxMessages: 500 };
11139
11446
  var keyOf2 = /* @__PURE__ */ __name((chat) => JSON.stringify([chat.account.provider, chat.account.account, chat.chatId]), "keyOf");
@@ -11225,7 +11532,7 @@ var refreshSearch = /* @__PURE__ */ __name(async (deps, request) => {
11225
11532
  }
11226
11533
  try {
11227
11534
  const newest = (await store.messages.messages(account2, chatId, { limit: 1 })).items[0];
11228
- let counted3 = 0;
11535
+ let counted2 = 0;
11229
11536
  const fetched = await archiveService(deps).fetch(chatId, {
11230
11537
  limit: options.maxMessages - result.messages,
11231
11538
  pageSize: Math.min(100, deps.messenger.fetching?.maxPageSize ?? 100),
@@ -11234,11 +11541,11 @@ var refreshSearch = /* @__PURE__ */ __name(async (deps, request) => {
11234
11541
  stop,
11235
11542
  note,
11236
11543
  onPage: /* @__PURE__ */ __name(({ fetched: fetched2 }) => {
11237
- result.messages += fetched2 - counted3;
11238
- counted3 = fetched2;
11544
+ result.messages += fetched2 - counted2;
11545
+ counted2 = fetched2;
11239
11546
  }, "onPage")
11240
11547
  });
11241
- result.messages += fetched.fetched - counted3;
11548
+ result.messages += fetched.fetched - counted2;
11242
11549
  if (fetched.stopped || !fetched.complete && !fetched.reachedSince) {
11243
11550
  result.complete = false;
11244
11551
  result.failed.push({
@@ -11265,20 +11572,20 @@ var withRefresh = /* @__PURE__ */ __name((found, refreshed) => ({
11265
11572
  ...!refreshed || refreshed.complete ? {} : { coverage: { ...found.coverage, state: "stale" } }
11266
11573
  }), "withRefresh");
11267
11574
 
11268
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/embeddings-search.js
11575
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/embeddings-search.js
11269
11576
  var CANDIDATES = 50;
11270
11577
  var WORD_HITS = 200;
11271
11578
  var RRF_K = 60;
11272
11579
  var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
11273
11580
  const command = deps.messenger.app.command;
11274
11581
  const byWords = /* @__PURE__ */ __name(async (query, prepared, conversations, since) => {
11275
- const words3 = [...new Set(query.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? [])];
11582
+ const words4 = [...new Set(query.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? [])];
11276
11583
  const outside = /* @__PURE__ */ new Map();
11277
- if (!words3.length || !prepared.scopeAccounts.length)
11584
+ if (!words4.length || !prepared.scopeAccounts.length)
11278
11585
  return { hits: [], outside, sources: /* @__PURE__ */ new Map() };
11279
11586
  const store = await deps.store();
11280
11587
  const lexical = await prepareLucene(store, await deps.account(), {
11281
- text: words3.map((word) => word.length >= 3 ? `${word}*` : `"${word}"`).join(" OR "),
11588
+ text: words4.map((word) => word.length >= 3 ? `${word}*` : `"${word}"`).join(" OR "),
11282
11589
  accounts: prepared.scopeAccounts,
11283
11590
  limit: WORD_HITS
11284
11591
  }, deps.messenger);
@@ -11384,9 +11691,9 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
11384
11691
  const eligibility = filter === void 0 ? void 0 : await store.queries.conversationEligibility(prepared.execution);
11385
11692
  const selected = prepared.selectedChat;
11386
11693
  const scopeOf4 = /* @__PURE__ */ __name((one2) => selected ? selected.account.provider === one2.provider && selected.account.account === one2.account ? { chatId: selected.chatId } : null : {}, "scopeOf");
11387
- const words3 = await byWords(query, prepared, eligibility?.conversations, since);
11694
+ const words4 = await byWords(query, prepared, eligibility?.conversations, since);
11388
11695
  const meaning = [];
11389
- const sources = words3.sources;
11696
+ const sources = words4.sources;
11390
11697
  if (target.installed && prepared.scopeAccounts.length && eligibility?.conversations.length !== 0) {
11391
11698
  await withEmbedder(deps, target, choice, {}, async (embedder) => {
11392
11699
  const [vector] = await embedder.embed([query], "query");
@@ -11430,7 +11737,7 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
11430
11737
  continue;
11431
11738
  const eligibleChats = eligibility?.chats.filter(({ account: account3 }) => account3.provider === one2.provider && account3.account === one2.account).map(({ chat: chat2 }) => chat2);
11432
11739
  const rows = eligibleChats === void 0 ? await store.vectors.readiness(one2, { ...scope, model: target.key, searchableOnly: true }) : (await Promise.all(eligibleChats.map((chatId) => store.vectors.readiness(one2, { chatId, model: target.key })))).flat();
11433
- const readiness2 = searchReadiness(rows.map(shaped), target.installed, words3.outside.get(JSON.stringify(one2))?.chats ?? /* @__PURE__ */ new Set());
11740
+ const readiness2 = searchReadiness(rows.map(shaped), target.installed, words4.outside.get(JSON.stringify(one2))?.chats ?? /* @__PURE__ */ new Set());
11434
11741
  scoped.push({ source: one2, readiness: readiness2 });
11435
11742
  const other = await store.vectors.embeddedOnlyElsewhere(one2, { ...scope, model: target.key });
11436
11743
  elsewhere.push(...other.filter((id2) => eligibleChats === void 0 || eligibleChats.includes(id2)).map((id2) => prepared.scopeAccounts.length > 1 ? [one2.provider, one2.account, id2].map(encodeURIComponent).join("/") : id2));
@@ -11446,7 +11753,7 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
11446
11753
  accounts: prepared.scopeAccounts,
11447
11754
  model: target.id,
11448
11755
  meaning: target.installed ? "searched" : "unavailable",
11449
- hits: fused(meaning, words3.hits, meaningFloor(target.key)).slice(0, limit).map((hit) => {
11756
+ hits: fused(meaning, words4.hits, meaningFloor(target.key)).slice(0, limit).map((hit) => {
11450
11757
  const source2 = sources.get(hit.summary.id);
11451
11758
  return {
11452
11759
  ...hit,
@@ -11492,7 +11799,7 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
11492
11799
  }, "related")
11493
11800
  };
11494
11801
  }, "embeddingsSearch");
11495
- var fused = /* @__PURE__ */ __name((meaning, words3, minimumCosine) => {
11802
+ var fused = /* @__PURE__ */ __name((meaning, words4, minimumCosine) => {
11496
11803
  const merged = /* @__PURE__ */ new Map();
11497
11804
  meaning.filter(({ score }) => score > minimumCosine).forEach(({ summary, chunk, score, stale, matchedIn }, index) => {
11498
11805
  merged.set(matchedIn ? `${summary.id}#${chunk.firstMessageId}` : summary.id, {
@@ -11505,7 +11812,7 @@ var fused = /* @__PURE__ */ __name((meaning, words3, minimumCosine) => {
11505
11812
  fused: 1 / (RRF_K + index + 1)
11506
11813
  });
11507
11814
  });
11508
- words3.forEach(({ summary, chunk }, index) => {
11815
+ words4.forEach(({ summary, chunk }, index) => {
11509
11816
  const share = 1 / (RRF_K + index + 1);
11510
11817
  const held = merged.get(summary.id);
11511
11818
  if (held) {
@@ -11540,13 +11847,13 @@ var meanOf = /* @__PURE__ */ __name((vectors) => {
11540
11847
  return mean2.map((value) => value / length);
11541
11848
  }, "meanOf");
11542
11849
 
11543
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/embeddings.js
11850
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/embeddings.js
11544
11851
  var embeddingsService = /* @__PURE__ */ __name((deps) => ({
11545
11852
  ...embeddingsMaintenance(deps),
11546
11853
  ...embeddingsSearch(deps)
11547
11854
  }), "embeddingsService");
11548
11855
 
11549
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/folders.js
11856
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/folders.js
11550
11857
  var foldersService = /* @__PURE__ */ __name((deps) => {
11551
11858
  const online = /* @__PURE__ */ __name(async (command) => {
11552
11859
  if (deps.offline)
@@ -11687,7 +11994,7 @@ var foldersService = /* @__PURE__ */ __name((deps) => {
11687
11994
  };
11688
11995
  }, "foldersService");
11689
11996
 
11690
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/inbox.js
11997
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/inbox.js
11691
11998
  var INBOX_CHATS = 20;
11692
11999
  var REVIEW_DAYS = 3;
11693
12000
  var UNANSWERED_HOURS = 24;
@@ -11895,7 +12202,7 @@ var inboxService = /* @__PURE__ */ __name((deps) => {
11895
12202
  };
11896
12203
  }, "inboxService");
11897
12204
 
11898
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/mentions.js
12205
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/mentions.js
11899
12206
  var REVIEW_COUNT = 500;
11900
12207
  var mentionsService = /* @__PURE__ */ __name((deps) => {
11901
12208
  const located = /* @__PURE__ */ __name(async () => {
@@ -11974,7 +12281,7 @@ var mentionsService = /* @__PURE__ */ __name((deps) => {
11974
12281
  };
11975
12282
  }, "mentionsService");
11976
12283
 
11977
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/domain/formatting.js
12284
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/formatting.js
11978
12285
  var invalid3 = /* @__PURE__ */ __name(() => new CliError("validation_error", "the messenger formatter returned invalid text spans"), "invalid");
11979
12286
  var validateFormattedText = /* @__PURE__ */ __name((formatted2) => {
11980
12287
  const { text: text2, spans } = formatted2;
@@ -12034,7 +12341,7 @@ var visibleFormattedText = /* @__PURE__ */ __name((formatted2) => {
12034
12341
  };
12035
12342
  }, "visibleFormattedText");
12036
12343
 
12037
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/domain/message-link.js
12344
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/message-link.js
12038
12345
  var fileLinks = /* @__PURE__ */ __name((attachments) => hitFiles(attachments).map(({ position, kind, name }) => ({
12039
12346
  position,
12040
12347
  kind,
@@ -12083,7 +12390,7 @@ var validatePermalink = /* @__PURE__ */ __name((link4) => {
12083
12390
  return { url: link4.url, access: link4.access, reason: link4.reason };
12084
12391
  }, "validatePermalink");
12085
12392
 
12086
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/domain/pin-duration.js
12393
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/pin-duration.js
12087
12394
  var spokenSeconds = /* @__PURE__ */ __name((seconds) => {
12088
12395
  if (seconds % 86400 === 0 && seconds > 86400)
12089
12396
  return `${seconds / 86400}d`;
@@ -12094,8 +12401,8 @@ var spokenSeconds = /* @__PURE__ */ __name((seconds) => {
12094
12401
  return `${seconds}s`;
12095
12402
  }, "spokenSeconds");
12096
12403
  var pinDurationsText = /* @__PURE__ */ __name((allowed) => {
12097
- const words3 = allowed.map(spokenSeconds);
12098
- return words3.length > 1 ? `${words3.slice(0, -1).join(", ")} or ${words3.at(-1)}` : words3[0] ?? "";
12404
+ const words4 = allowed.map(spokenSeconds);
12405
+ return words4.length > 1 ? `${words4.slice(0, -1).join(", ")} or ${words4.at(-1)}` : words4[0] ?? "";
12099
12406
  }, "pinDurationsText");
12100
12407
  var pinLengthHelp = /* @__PURE__ */ __name((allowed, fallback) => `how long the pin lasts: ${pinDurationsText(allowed)}` + (fallback === void 0 ? "" : `; ${spokenSeconds(fallback)} by default`), "pinLengthHelp");
12101
12408
  var pinDurationOf = /* @__PURE__ */ __name((value, allowed, flag = "--expire-time") => {
@@ -12115,7 +12422,7 @@ var pinDurationOf = /* @__PURE__ */ __name((value, allowed, flag = "--expire-tim
12115
12422
  return seconds;
12116
12423
  }, "pinDurationOf");
12117
12424
 
12118
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/sends/send-as.js
12425
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/sends/send-as.js
12119
12426
  var sendAsCheck = /* @__PURE__ */ __name((connection, sendAs) => {
12120
12427
  if (sendAs === void 0) {
12121
12428
  const saved = connection.savedSender?.bind(connection);
@@ -12140,7 +12447,7 @@ var typedSendAs = /* @__PURE__ */ __name((typed) => {
12140
12447
  return sendAs;
12141
12448
  }, "typedSendAs");
12142
12449
 
12143
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/search/total.js
12450
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/search/total.js
12144
12451
  var TOTAL_CAP = 1e4;
12145
12452
  var totalOf = /* @__PURE__ */ __name((count2, shown, hasMore, exact = true) => {
12146
12453
  const least = shown + (hasMore ? 1 : 0);
@@ -12151,7 +12458,7 @@ var totalOf = /* @__PURE__ */ __name((count2, shown, hasMore, exact = true) => {
12151
12458
  return { value: count2, relation: exact ? "eq" : "gte" };
12152
12459
  }, "totalOf");
12153
12460
 
12154
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/search/lucene/meaning-parts.js
12461
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/search/lucene/meaning-parts.js
12155
12462
  var WORD_FIELDS = /* @__PURE__ */ new Set(["text", "exact"]);
12156
12463
  var fieldsOfQuery = /* @__PURE__ */ __name((root, everything) => {
12157
12464
  let narrows = false;
@@ -12180,7 +12487,7 @@ var meaningWords = /* @__PURE__ */ __name((root) => {
12180
12487
  return wanted(root).join(" ").trim();
12181
12488
  }, "meaningWords");
12182
12489
 
12183
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/search/question-plan.js
12490
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/search/question-plan.js
12184
12491
  var words2 = /* @__PURE__ */ __name((text2) => normalize(text2).match(/[\p{L}\p{N}]+/gu) ?? [], "words");
12185
12492
  var scaffolding = new Set(words2("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"));
12186
12493
  var questionWord = /\b(?:what|which|how|who|where|when|can|could|should)\b|(?:^|\s)(?:сколько|какой|какая|какие|какое|кто|кому|кем|где|когда|как|что|можно|может|могут|ли)(?:\s|$)/iu;
@@ -12313,7 +12620,7 @@ var questionLookup = /* @__PURE__ */ __name((text2) => {
12313
12620
  return terms.length ? anyOfTerms(terms, plan.scope) : void 0;
12314
12621
  }, "questionLookup");
12315
12622
 
12316
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/messages-combined.js
12623
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/messages-combined.js
12317
12624
  var COMBINED_DEFAULTS = { candidateDepth: 300, rrfK: 60, rerank: "all", chatCap: 0 };
12318
12625
  var tokensOf = /* @__PURE__ */ __name((text2) => normalize(text2).match(/[\p{L}\p{N}\p{Co}\p{M}]+/gu) ?? [], "tokensOf");
12319
12626
  var searchCombined = /* @__PURE__ */ __name(async (store, account2, request, messenger = {}, options = COMBINED_DEFAULTS) => {
@@ -12506,7 +12813,7 @@ var signals = /* @__PURE__ */ __name((hit, terms, corrections, execution, mode,
12506
12813
  return mode === "coverage" ? coverage2 * 4 : mode === "proximity" ? proximity : mode === "phrase" ? phrase : coverage2 * 4 + proximity + phrase;
12507
12814
  }, "signals");
12508
12815
 
12509
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/messages-discovery.js
12816
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/messages-discovery.js
12510
12817
  var MEANING_DEPTH = 100;
12511
12818
  var RRF_K2 = 60;
12512
12819
  var RERANK_DEPTH = 50;
@@ -12791,10 +13098,10 @@ var nearEligible = /* @__PURE__ */ __name(async (store, account2, request, messe
12791
13098
  return hit ? [{ ...hit, cosine: m.score }] : [];
12792
13099
  });
12793
13100
  }, "nearEligible");
12794
- var fusedWithMeaning = /* @__PURE__ */ __name((words3, near2, described) => {
13101
+ var fusedWithMeaning = /* @__PURE__ */ __name((words4, near2, described) => {
12795
13102
  const merged = /* @__PURE__ */ new Map();
12796
13103
  const by = /* @__PURE__ */ __name((hit, foundBy) => hit.discovery ? { ...hit, discovery: { ...hit.discovery, foundBy } } : hit, "by");
12797
- words3.forEach((hit, rank) => {
13104
+ words4.forEach((hit, rank) => {
12798
13105
  merged.set(hit.locator, { hit: by(hit, ["words"]), rrf: 1 / (RRF_K2 + rank + 1) });
12799
13106
  });
12800
13107
  near2.forEach(({ cosine: _, ...m }, rank) => {
@@ -12831,7 +13138,7 @@ var mixedWithReranker = /* @__PURE__ */ __name((head, scores) => {
12831
13138
  })).sort((a, b) => b.mixed - a.mixed).map(({ hit }) => hit);
12832
13139
  }, "mixedWithReranker");
12833
13140
 
12834
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/thread-context.js
13141
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/thread-context.js
12835
13142
  var THREAD_BOUNDS = { maxHops: 8, maxMessages: 50, maxBytes: 65536, withinMs: 864e5 };
12836
13143
  var bytes = /* @__PURE__ */ __name((items, links) => Buffer.byteLength(JSON.stringify({ items, links }), "utf8"), "bytes");
12837
13144
  var threadBounds = /* @__PURE__ */ __name((options = {}) => {
@@ -13030,7 +13337,7 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account2, chat, mes
13030
13337
  return result;
13031
13338
  }, "readThreadContext");
13032
13339
 
13033
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/messages-archive-search.js
13340
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/messages-archive-search.js
13034
13341
  var SEARCH_FILL_MS = 200;
13035
13342
  var statsStore = /* @__PURE__ */ __name(async (store, account2, request, messenger = {}) => {
13036
13343
  const stop = Date.now() + SEARCH_FILL_MS;
@@ -13061,6 +13368,8 @@ var topUp = /* @__PURE__ */ __name(async (store) => {
13061
13368
  }, "topUp");
13062
13369
  var MAX_SEARCH_OFFSET = 1e3;
13063
13370
  var searchStore = /* @__PURE__ */ __name(async (store, account2, request, messenger = {}, meaning, rerank) => {
13371
+ if (request.text !== void 0)
13372
+ request = { ...request, text: plainQuery(request.text) };
13064
13373
  const offset = request.offset ?? 0;
13065
13374
  if (!Number.isInteger(offset) || offset < 0 || offset > MAX_SEARCH_OFFSET)
13066
13375
  throw new CliError("validation_error", `offset takes a whole number from 0 to ${MAX_SEARCH_OFFSET}`);
@@ -13097,12 +13406,12 @@ var accountOf2 = /* @__PURE__ */ __name((hit) => {
13097
13406
  }, "accountOf");
13098
13407
  var keyOf3 = /* @__PURE__ */ __name(({ provider, account: account2 }) => `${provider}/${account2}`, "keyOf");
13099
13408
 
13100
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/pictures.js
13101
- import { createHash as createHash9 } from "node:crypto";
13409
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/pictures.js
13410
+ import { createHash as createHash10 } from "node:crypto";
13102
13411
  import { readFile as readFile2, stat as stat3 } from "node:fs/promises";
13103
13412
  import { setTimeout as sleep4 } from "node:timers/promises";
13104
13413
 
13105
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/domain/models.js
13414
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/models.js
13106
13415
  var GROUP_SETTINGS = [
13107
13416
  "allCanPin",
13108
13417
  "onlyAdminsAdd",
@@ -13116,7 +13425,7 @@ var ADMIN_RIGHTS = ["read", "members", "admins", "info", "pin", "link", "post",
13116
13425
  var senderIsMe = /* @__PURE__ */ __name((message, account2) => message.outgoing === true || message.senderId !== null && String(message.senderId) === account2, "senderIsMe");
13117
13426
  var MEDIA_KINDS = ["photo", "video", "file", "audio", "link"];
13118
13427
 
13119
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/pictures.js
13428
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/pictures.js
13120
13429
  var PICTURE_MAX_BYTES = 25 * 1024 * 1024;
13121
13430
  var PICTURE_FLOOR = 0.25;
13122
13431
  var PAGE4 = 50;
@@ -13133,7 +13442,7 @@ var picturesService = /* @__PURE__ */ __name((deps) => {
13133
13442
  const directory = imageModelsDirectory(deps.env);
13134
13443
  if (!isImageModelInstalled(model2, directory))
13135
13444
  throw new CliError("not_found", missingModel(model2.id), { reason: "model.not-downloaded", model: model2.id });
13136
- const { openPictureEmbedder } = await import("./embedder-QFPMDRT2.js");
13445
+ const { openPictureEmbedder } = await import("./embedder-NGCBQHIG.js");
13137
13446
  return openPictureEmbedder(model2, directory);
13138
13447
  }, "open");
13139
13448
  const embedder = /* @__PURE__ */ __name(() => {
@@ -13230,7 +13539,7 @@ var picturesService = /* @__PURE__ */ __name((deps) => {
13230
13539
  const vector = await use.embedImage(bytes2);
13231
13540
  pending.push({
13232
13541
  attachmentPk: picture.attachmentPk,
13233
- hash: createHash9("sha256").update(bytes2).digest("hex"),
13542
+ hash: createHash10("sha256").update(bytes2).digest("hex"),
13234
13543
  bytes: bytes2.length,
13235
13544
  occurredAt: picture.sentAt,
13236
13545
  vector
@@ -13264,8 +13573,8 @@ var picturesService = /* @__PURE__ */ __name((deps) => {
13264
13573
  lane: /* @__PURE__ */ __name(async (query, { chat, since, limit = 5 } = {}) => {
13265
13574
  if (!deps.pictures)
13266
13575
  return {};
13267
- const words3 = plainWords(query);
13268
- if (words3 === "")
13576
+ const words4 = plainWords(query);
13577
+ if (words4 === "")
13269
13578
  return {};
13270
13579
  const store = await deps.store();
13271
13580
  const account2 = await deps.account();
@@ -13273,7 +13582,7 @@ var picturesService = /* @__PURE__ */ __name((deps) => {
13273
13582
  let vector;
13274
13583
  try {
13275
13584
  const use = await embedder();
13276
- vector = await use.embedQuery(words3);
13585
+ vector = await use.embedQuery(words4);
13277
13586
  } catch (error) {
13278
13587
  if (error instanceof CliError && error.code === "not_found")
13279
13588
  return { picturesSkipped: error.message, picturesModel: model.id };
@@ -13330,7 +13639,7 @@ var withPictures = /* @__PURE__ */ __name((messages, pictures) => ({
13330
13639
  }, "search")
13331
13640
  }), "withPictures");
13332
13641
 
13333
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/messages-meaning.js
13642
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/messages-meaning.js
13334
13643
  var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, shared, within) => {
13335
13644
  const target = embeddingTarget(deps, DEFAULT_TEXT_MODEL);
13336
13645
  const skipped = /* @__PURE__ */ __name((reason, step) => ({
@@ -13352,13 +13661,13 @@ var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, sh
13352
13661
  }
13353
13662
  if (ready.length === 0 && mail.size === 0)
13354
13663
  return skipped("no message has a vector yet", "conversations.rebuild");
13355
- const words3 = plainWords(question);
13664
+ const words4 = plainWords(question);
13356
13665
  try {
13357
13666
  const ranked = [];
13358
- if (words3) {
13667
+ if (words4) {
13359
13668
  const pks = await within?.();
13360
13669
  const lookUp = /* @__PURE__ */ __name(async (embedder) => {
13361
- const [query] = await embedder.embed([words3], "query");
13670
+ const [query] = await embedder.embed([words4], "query");
13362
13671
  for (const one2 of ready) {
13363
13672
  const near2 = pks ? await store.vectors.scoreMessages(one2, { model: target.key, query, pks }) : await store.vectors.nearestMessages(one2, {
13364
13673
  model: target.key,
@@ -13398,7 +13707,7 @@ var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, sh
13398
13707
  }
13399
13708
  }, "meaningLane");
13400
13709
 
13401
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/messages-rerank.js
13710
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/messages-rerank.js
13402
13711
  var rerankLane = /* @__PURE__ */ __name((deps) => {
13403
13712
  const choice = deps.reranker ?? DEFAULT_RERANK_MODEL;
13404
13713
  if (choice === "off")
@@ -13410,9 +13719,9 @@ var rerankLane = /* @__PURE__ */ __name((deps) => {
13410
13719
  return { skipped: { reason: `${model.id} is not downloaded`, step: "models.download", model: model.id } };
13411
13720
  try {
13412
13721
  const warm = deps.embedders;
13413
- const reranker = warm ? await warm.reranker(`rerank:${model.id}`, async () => (await import("./process-SWPJGPQC.js")).openRerankerProcess(model, directory, {
13722
+ const reranker = warm ? await warm.reranker(`rerank:${model.id}`, async () => (await import("./process-BPBMV3AT.js")).openRerankerProcess(model, directory, {
13414
13723
  threads: defaultThreads()
13415
- })) : await (await import("./rerank-TINXM3MY.js")).openReranker(model, directory);
13724
+ })) : await (await import("./rerank-4NGQWREA.js")).openReranker(model, directory);
13416
13725
  return {
13417
13726
  model: model.id,
13418
13727
  score: /* @__PURE__ */ __name((question, passages) => reranker.score(plainWords(question), passages), "score"),
@@ -13432,21 +13741,21 @@ var rerankLane = /* @__PURE__ */ __name((deps) => {
13432
13741
  };
13433
13742
  }, "rerankLane");
13434
13743
 
13435
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/document-pictures.js
13436
- import { createHash as createHash10 } from "node:crypto";
13744
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/document-pictures.js
13745
+ import { createHash as createHash11 } from "node:crypto";
13437
13746
  var refOf = /* @__PURE__ */ __name((target) => target.ref ?? `document:${target.documentId}`, "refOf");
13438
13747
  var openPictureEmbedderFor = /* @__PURE__ */ __name(async ({ env, command } = {}) => {
13439
13748
  const model = imageModel(DEFAULT_IMAGE_MODEL);
13440
13749
  const directory = imageModelsDirectory(env);
13441
13750
  if (!isImageModelInstalled(model, directory))
13442
13751
  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 });
13443
- const { openPictureEmbedder } = await import("./embedder-QFPMDRT2.js");
13752
+ const { openPictureEmbedder } = await import("./embedder-NGCBQHIG.js");
13444
13753
  return openPictureEmbedder(model, directory);
13445
13754
  }, "openPictureEmbedderFor");
13446
13755
  var savePicture = /* @__PURE__ */ __name(async (store, target, bytes2, options = {}) => {
13447
13756
  const ref = refOf(target);
13448
13757
  const model = imageModel(DEFAULT_IMAGE_MODEL);
13449
- const hash3 = createHash10("sha256").update(bytes2).digest("hex");
13758
+ const hash3 = createHash11("sha256").update(bytes2).digest("hex");
13450
13759
  if (await store.notes.pictureHash(ref, model.key) === hash3)
13451
13760
  return "unchanged";
13452
13761
  const embedder = options.embedder ?? await openPictureEmbedderFor(options);
@@ -13461,7 +13770,7 @@ var savePicture = /* @__PURE__ */ __name(async (store, target, bytes2, options =
13461
13770
  }, "savePicture");
13462
13771
  var removePicture = /* @__PURE__ */ __name((store, target) => store.notes.removePicture(refOf(target)), "removePicture");
13463
13772
 
13464
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/document-source.js
13773
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/document-source.js
13465
13774
  var documentSource = /* @__PURE__ */ __name((note, accounts, profiles, file2) => {
13466
13775
  const metadata = note.frontMatter;
13467
13776
  const account2 = accounts.find(({ id: id2 }) => String(id2) === note.folderId);
@@ -13476,7 +13785,7 @@ var documentSource = /* @__PURE__ */ __name((note, accounts, profiles, file2) =>
13476
13785
  };
13477
13786
  }, "documentSource");
13478
13787
 
13479
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/notes-title-tier.js
13788
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/notes-title-tier.js
13480
13789
  var plainQueryWords = /* @__PURE__ */ __name((query) => {
13481
13790
  let root;
13482
13791
  try {
@@ -13491,19 +13800,19 @@ var plainQueryWords = /* @__PURE__ */ __name((query) => {
13491
13800
  return void 0;
13492
13801
  values.push(leaf.value);
13493
13802
  }
13494
- const words3 = normalize(values.join(" "));
13495
- return words3 === "" || /["\\]/u.test(words3) ? void 0 : words3;
13803
+ const words4 = normalize(values.join(" "));
13804
+ return words4 === "" || /["\\]/u.test(words4) ? void 0 : words4;
13496
13805
  }, "plainQueryWords");
13497
- var titleQuery = /* @__PURE__ */ __name((words3) => words3.split(" ").map((word) => `title:"${word}"`).join(" AND "), "titleQuery");
13498
- var titleTiers = /* @__PURE__ */ __name((hits, words3) => {
13806
+ var titleQuery = /* @__PURE__ */ __name((words4) => words4.split(" ").map((word) => `title:"${word}"`).join(" AND "), "titleQuery");
13807
+ var titleTiers = /* @__PURE__ */ __name((hits, words4) => {
13499
13808
  const rank = /* @__PURE__ */ __name(({ note }) => {
13500
13809
  const title = normalize(note.title ?? "");
13501
- return title === words3 ? 0 : title.includes(words3) ? 1 : 2;
13810
+ return title === words4 ? 0 : title.includes(words4) ? 1 : 2;
13502
13811
  }, "rank");
13503
13812
  return [...hits].sort((a, b) => rank(a) - rank(b));
13504
13813
  }, "titleTiers");
13505
13814
 
13506
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/notes-search.js
13815
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/notes-search.js
13507
13816
  var storeQuery = /* @__PURE__ */ __name(async (store, text2, { exact, timezone } = {}) => resolvedQuery(store, parsedQuery(text2, exact), timezone), "storeQuery");
13508
13817
  var parsedQuery = /* @__PURE__ */ __name((text2, exact) => validateFields(parseLucene(text2, { ...SEARCH_QUERY, defaultField: exact ? "exact" : "text" })).root, "parsedQuery");
13509
13818
  var resolvedQuery = /* @__PURE__ */ __name(async (store, root, timezone) => {
@@ -13626,14 +13935,14 @@ var MAX_NOTES_OFFSET = 1e3;
13626
13935
  var CANDIDATES2 = 50;
13627
13936
  var RRF_K3 = 60;
13628
13937
  var firstLine = /* @__PURE__ */ __name((text2, query) => {
13629
- const words3 = 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));
13938
+ const words4 = 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));
13630
13939
  const lines = text2.split("\n");
13631
- const found = lines.find((line2) => words3.some((word) => line2.toLowerCase().includes(word)));
13940
+ const found = lines.find((line2) => words4.some((word) => line2.toLowerCase().includes(word)));
13632
13941
  return (found ?? lines.find((line2) => line2.trim() !== "") ?? "").trim().slice(0, MAX_LINE);
13633
13942
  }, "firstLine");
13634
13943
  var pictureLane = /* @__PURE__ */ __name(async (store, query, { folderIds, source, limit, env, command, embedder }) => {
13635
- const words3 = plainWords(query);
13636
- if (words3 === "" || source === "internal")
13944
+ const words4 = plainWords(query);
13945
+ if (words4 === "" || source === "internal")
13637
13946
  return {};
13638
13947
  let vector;
13639
13948
  try {
@@ -13642,7 +13951,7 @@ var pictureLane = /* @__PURE__ */ __name(async (store, query, { folderIds, sourc
13642
13951
  ...command === void 0 ? {} : { command }
13643
13952
  });
13644
13953
  try {
13645
- vector = await use.embedQuery(words3);
13954
+ vector = await use.embedQuery(words4);
13646
13955
  } finally {
13647
13956
  if (!embedder)
13648
13957
  await use.close();
@@ -13723,13 +14032,13 @@ var filterRefs = /* @__PURE__ */ __name(async (store, narrowing, scope) => {
13723
14032
  }
13724
14033
  }, "filterRefs");
13725
14034
  var notesTotal = /* @__PURE__ */ __name(async (store, text2, { exact, scope, shown, hasMore }, others, othersComplete) => {
13726
- let words3;
14035
+ let words4;
13727
14036
  try {
13728
14037
  const { root, stemmer } = await storeQuery(store, text2, {
13729
14038
  exact,
13730
14039
  ...scope.timezone ? { timezone: scope.timezone } : {}
13731
14040
  });
13732
- words3 = await store.notes.matchingRefs({
14041
+ words4 = await store.notes.matchingRefs({
13733
14042
  root,
13734
14043
  limit: TOTAL_CAP,
13735
14044
  ...scope.folderIds ? { folderIds: scope.folderIds } : {},
@@ -13742,10 +14051,11 @@ var notesTotal = /* @__PURE__ */ __name(async (store, text2, { exact, scope, sho
13742
14051
  return totalOf(void 0, shown, hasMore);
13743
14052
  throw error;
13744
14053
  }
13745
- const count2 = (/* @__PURE__ */ new Set([...words3.refs, ...others])).size + (words3.hasMore ? 1 : 0);
14054
+ const count2 = (/* @__PURE__ */ new Set([...words4.refs, ...others])).size + (words4.hasMore ? 1 : 0);
13746
14055
  return totalOf(count2, shown, hasMore, othersComplete);
13747
14056
  }, "notesTotal");
13748
14057
  var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offset = 0, tag, filter: expression, folderIds, withInternal, source: given, exact = false, discover = false, timezone, env, command, embedders, pictures: withPictures2 = false, pictureLimit = 5, pictureEmbedder } = {}) => {
14058
+ query = plainQuery(query);
13749
14059
  const typed = noteSourceOfQuery(query);
13750
14060
  const source = given ?? typed.source;
13751
14061
  const rest = typed.source !== void 0 && typed.source === source ? typed.rest : query;
@@ -13753,7 +14063,7 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
13753
14063
  const filter = [expression ? `(${expression})` : "", label === void 0 ? "" : `tag:${label}`].filter(Boolean).join(" AND ") || void 0;
13754
14064
  const lookup2 = discover && !exact ? questionLookup(query) : void 0;
13755
14065
  const parsed = query.trim() ? parsedQuery(lookup2 === void 0 ? query : questionText(query), exact) : void 0;
13756
- const words3 = parsed === void 0 ? "" : meaningWords(parsed);
14066
+ const words4 = parsed === void 0 ? "" : meaningWords(parsed);
13757
14067
  const narrowing = allOf([
13758
14068
  ...parsed === void 0 ? [] : [fieldsOfQuery2(parsed)].filter((node) => node !== void 0),
13759
14069
  ...filter === void 0 ? [] : [parsedQuery(filter)]
@@ -13774,7 +14084,7 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
13774
14084
  let meaningComplete = true;
13775
14085
  if (exact)
13776
14086
  meaningSkipped = "--exact searches words as written";
13777
- else if (words3) {
14087
+ else if (words4) {
13778
14088
  const lane2 = {
13779
14089
  command,
13780
14090
  ...env === void 0 ? {} : { env },
@@ -13788,10 +14098,10 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
13788
14098
  const within = narrowing === void 0 ? void 0 : await filterRefs(store, narrowing, scope);
13789
14099
  let nearest;
13790
14100
  if (within === void 0) {
13791
- nearest = await nearestNotes(store, words3, { ...lane2, limit: depth });
14101
+ nearest = await nearestNotes(store, words4, { ...lane2, limit: depth });
13792
14102
  meaningComplete = nearest.length < depth;
13793
14103
  } else {
13794
- const ranked2 = within.length ? await nearestAmong(store, words3, within, lane2) : [];
14104
+ const ranked2 = within.length ? await nearestAmong(store, words4, within, lane2) : [];
13795
14105
  meaningRefs = new Set(ranked2.map(({ ref }) => ref));
13796
14106
  nearest = ranked2.slice(0, depth);
13797
14107
  }
@@ -13809,13 +14119,13 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
13809
14119
  meaningSkipped = error.message;
13810
14120
  }
13811
14121
  }
13812
- const titleWords = plainQueryWords(rest);
13813
- const titled = titleWords === void 0 ? { items: [], hasMore: false } : await searchNotesQuery(store, {
13814
- text: [titleQuery(titleWords), filter ?? ""].filter(Boolean).join(" AND "),
14122
+ const titleWords2 = plainQueryWords(rest);
14123
+ const titled = titleWords2 === void 0 ? { items: [], hasMore: false } : await searchNotesQuery(store, {
14124
+ text: [titleQuery(titleWords2), filter ?? ""].filter(Boolean).join(" AND "),
13815
14125
  limit: Math.max(window2, CANDIDATES2),
13816
14126
  ...scope
13817
14127
  });
13818
- const tier = titleWords === void 0 ? [] : titleTiers(titled.items, titleWords);
14128
+ const tier = titleWords2 === void 0 ? [] : titleTiers(titled.items, titleWords2);
13819
14129
  const tierRefs = new Set(tier.map(({ ref }) => ref));
13820
14130
  const slice = meaning === void 0 && tier.length === 0;
13821
14131
  const matched = await searchNotesQuery(store, {
@@ -13832,9 +14142,11 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
13832
14142
  const held = ranked.get(ref) ?? { note, at, score: 0, foundBy: [] };
13833
14143
  held.foundBy.push(by);
13834
14144
  ranked.set(ref, held);
14145
+ const vote = 1 / (RRF_K3 + rank + 1);
13835
14146
  if (by === "meaning" && lookup2 !== void 0 && held.foundBy.includes("words"))
13836
- return;
13837
- held.score += 1 / (RRF_K3 + rank + 1);
14147
+ held.score = Math.max(held.score, vote);
14148
+ else
14149
+ held.score += vote;
13838
14150
  }), "add");
13839
14151
  add(matched.items, "words");
13840
14152
  if (meaning !== void 0)
@@ -13865,7 +14177,7 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
13865
14177
  title: note.title,
13866
14178
  ...documentSource(note, accounts, profiles, note.source === "file" ? (await store.files.ofDocument(note.ref))[0] : void 0),
13867
14179
  updated_at: at,
13868
- excerpt: firstLine(note.text, words3),
14180
+ excerpt: firstLine(note.text, words4),
13869
14181
  links,
13870
14182
  found_by: foundBy,
13871
14183
  ...cosines.has(ref) ? { meaning_score: cosines.get(ref) } : {}
@@ -13889,7 +14201,7 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
13889
14201
  if (record2.ref?.startsWith("note:") || record2.ref?.startsWith("document:"))
13890
14202
  record2.name = (await store.notes.note(record2.ref).catch(() => void 0))?.title ?? record2.name;
13891
14203
  }
13892
- const lane = withPictures2 ? await pictureLane(store, words3, {
14204
+ const lane = withPictures2 ? await pictureLane(store, words4, {
13893
14205
  folderIds,
13894
14206
  source,
13895
14207
  limit: pictureLimit,
@@ -13922,12 +14234,14 @@ var notesScopeOf = /* @__PURE__ */ __name((accounts) => {
13922
14234
  return { folderIds, ...accounts.length > folderIds.length ? { withInternal: true } : {} };
13923
14235
  }, "notesScopeOf");
13924
14236
  var searchNotesOf = /* @__PURE__ */ __name(async (store, account2, text2, { accounts: list3, app, ...query }) => {
14237
+ text2 = plainQuery(text2);
13925
14238
  const own = app?.command ?? query.command;
13926
14239
  const what = `${own === void 0 ? "" : `${own} `}search notes`;
13927
14240
  const held = [
13928
14241
  { provider: "notes", account: INTERNAL_NOTES },
13929
14242
  ...(await store.notes.folders()).map(({ id: id2 }) => ({ provider: "notes", account: id2 })),
13930
- ...(await store.notes.documentsAccounts()).map(({ id: id2 }) => ({ provider: "notes", account: id2 }))
14243
+ ...(await store.notes.documentsAccounts()).map(({ id: id2 }) => ({ provider: "notes", account: id2 })),
14244
+ ...[await store.notes.addedAccount()].flatMap((added) => added ? [{ provider: "notes", account: added.id }] : [])
13931
14245
  ];
13932
14246
  const named2 = list3 === void 0 ? { accounts: held, skipped: [] } : fitting(entriesOfList(list3, await listContextOf(store, account2, app)), ["notes", "documents"], what);
13933
14247
  const source = query.source ?? noteSourceOfQuery(text2).source;
@@ -13947,14 +14261,14 @@ var searchNotesOf = /* @__PURE__ */ __name(async (store, account2, text2, { acco
13947
14261
  };
13948
14262
  }, "searchNotesOf");
13949
14263
 
13950
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/events-search.js
14264
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/events-search.js
13951
14265
  var MAX_EVENTS_OFFSET = 1e3;
13952
14266
  var iso = /* @__PURE__ */ __name((at) => at === null ? null : new Date(at).toISOString(), "iso");
13953
14267
  var accountIdsOf = /* @__PURE__ */ __name(async (store, accounts) => {
13954
14268
  const held = await store.accounts.storedAccounts();
13955
14269
  return held.filter((one2) => accounts.some(({ provider, account: account2 }) => one2.provider === provider && one2.account === account2)).map(({ id: id2 }) => String(id2));
13956
14270
  }, "accountIdsOf");
13957
- var calendarAccounts = /* @__PURE__ */ __name(async (store) => (await store.accounts.storedAccounts()).filter(({ provider }) => kindIn(provider) === "events").map(({ provider, account: account2 }) => ({ provider, account: account2 })), "calendarAccounts");
14271
+ var calendarAccounts = /* @__PURE__ */ __name(async (store) => (await store.accounts.storedAccounts()).filter(({ provider }) => holdsKind(provider, "events")).map(({ provider, account: account2 }) => ({ provider, account: account2 })), "calendarAccounts");
13958
14272
  var foundEvent = /* @__PURE__ */ __name((hit, query, foundBy) => ({
13959
14273
  ref: hit.ref,
13960
14274
  provider: hit.account?.provider ?? null,
@@ -13972,11 +14286,11 @@ var foundEvent = /* @__PURE__ */ __name((hit, query, foundBy) => ({
13972
14286
  found_by: foundBy
13973
14287
  }), "foundEvent");
13974
14288
  var CANDIDATES3 = 50;
13975
- var nearestEvents = /* @__PURE__ */ __name(async (store, words3, { limit, accountIds, env, command, embedders }) => {
14289
+ var nearestEvents = /* @__PURE__ */ __name(async (store, words4, { limit, accountIds, env, command, embedders }) => {
13976
14290
  const { model, directory, key } = localModel(void 0, env, command);
13977
14291
  if (!await store.calendar.embedded(key, accountIds ? { accountIds } : {}))
13978
14292
  throw new CliError("not_found", `no event has vectors of ${model.id} yet, so only words were matched`);
13979
- const [vector] = await withLocal(model, directory, void 0, (embedder) => embedder.embed([words3], "query"), embedders);
14293
+ const [vector] = await withLocal(model, directory, void 0, (embedder) => embedder.embed([words4], "query"), embedders);
13980
14294
  const floor = meaningFloor(key);
13981
14295
  return (await store.calendar.nearest(key, vector, { limit, ...accountIds ? { accountIds } : {} })).filter(({ score }) => score > floor);
13982
14296
  }, "nearestEvents");
@@ -13984,6 +14298,7 @@ var keyOf4 = /* @__PURE__ */ __name(({ event }) => event.eventSeriesId === null
13984
14298
  var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, offset = 0, accounts, exact, discover, newest, timezone, signal, candidates, env, command, embedders } = {}) => {
13985
14299
  if (!query.trim())
13986
14300
  throw new CliError("validation_error", "say what to find in the events");
14301
+ query = plainQuery(query);
13987
14302
  const asked = discover && !exact && !newest ? questionLookup(query) : void 0;
13988
14303
  const { root, stemmer } = await storeQuery(store, asked ?? query, {
13989
14304
  ...exact ? { exact: true } : {},
@@ -13992,7 +14307,7 @@ var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, off
13992
14307
  const accountIds = accounts === void 0 ? void 0 : await accountIdsOf(store, accounts);
13993
14308
  if (accountIds?.length === 0)
13994
14309
  return { query, by: "words", hits: [], has_more: false };
13995
- const words3 = plainQueryWords(asked === void 0 ? query : questionText(query));
14310
+ const words4 = plainQueryWords(asked === void 0 ? query : questionText(query));
13996
14311
  const window2 = offset + limit;
13997
14312
  let meaningSkipped;
13998
14313
  let meaning;
@@ -14000,11 +14315,11 @@ var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, off
14000
14315
  meaningSkipped = "--exact searches words as written";
14001
14316
  else if (newest)
14002
14317
  meaningSkipped = "newest first orders by time";
14003
- else if (words3 === void 0)
14318
+ else if (words4 === void 0)
14004
14319
  meaningSkipped = "the query has fields or operators, which meaning cannot follow";
14005
14320
  else
14006
14321
  try {
14007
- meaning = await nearestEvents(store, words3, {
14322
+ meaning = await nearestEvents(store, words4, {
14008
14323
  limit: Math.max(window2, CANDIDATES3),
14009
14324
  ...accountIds ? { accountIds } : {},
14010
14325
  ...env === void 0 ? {} : { env },
@@ -14064,8 +14379,14 @@ var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, off
14064
14379
  };
14065
14380
  }, "searchEvents");
14066
14381
 
14067
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/search-all.js
14068
- var RESOURCES_SEARCHED = ["messages", "mail", "notes", "events"];
14382
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/search-all.js
14383
+ var RESOURCES_SEARCHED = ["messages", "mail", "notes", "events", "crm"];
14384
+ var refusal = /* @__PURE__ */ __name((error, text2) => {
14385
+ const { reason, span } = error.details ?? {};
14386
+ const why = typeof reason === "string" ? reason : void 0;
14387
+ const token = span && Number.isInteger(span.start) && Number.isInteger(span.end) ? text2.slice(span.start, span.end).trim() : "";
14388
+ return { ...why ? { why } : {}, ...token ? { token } : {} };
14389
+ }, "refusal");
14069
14390
  var skippable = /* @__PURE__ */ __name((error) => error instanceof CliError && (error.code === "validation_error" || error.code === "not_found"), "skippable");
14070
14391
  var filtersBeside = /* @__PURE__ */ __name((text2) => {
14071
14392
  const { root } = parseLucene(text2, MESSAGE_PARSING);
@@ -14073,9 +14394,22 @@ var filtersBeside = /* @__PURE__ */ __name((text2) => {
14073
14394
  const top = root.kind === "boolean" ? root.clauses : [{ node: root, occur: "must" }];
14074
14395
  return top.every(({ node, occur }) => occur !== "must_not" && followable(node, occur === "must")) ? planQuestion(text2).scope : void 0;
14075
14396
  }, "filtersBeside");
14076
- var searchAll = /* @__PURE__ */ __name(async (store, account2, request, messenger = {}, searchMessages = (query) => searchStore(store, account2, query, messenger), meaning) => {
14077
- if (!request.text.trim())
14397
+ var titleWords = /* @__PURE__ */ __name((text2) => {
14398
+ const { root } = parseLucene(text2, SEARCH_QUERY);
14399
+ const clauses = root.kind === "boolean" ? root.clauses : [{ node: root, occur: "must" }];
14400
+ const words4 = clauses.map(({ node, occur }) => occur !== "must_not" && node.kind === "predicate" && node.field === "text" && (node.operator === "term" || node.operator === "phrase") ? (
14401
+ // A title holds "invoice", not the question mark of "invoice?".
14402
+ node.value.replace(/\?+$/u, "") || node.value
14403
+ ) : (() => {
14404
+ throw new CliError("validation_error", "deals and leads are found by the words of their title only");
14405
+ })());
14406
+ return { words: words4, anyWord: clauses.length > 1 && clauses.every(({ occur }) => occur === "should") };
14407
+ }, "titleWords");
14408
+ var crmAccounts = /* @__PURE__ */ __name(async (store) => (await store.accounts.accounts()).filter(({ provider }) => holdsKind(provider, "crm")), "crmAccounts");
14409
+ var searchAll = /* @__PURE__ */ __name(async (store, account2, asked, messenger = {}, searchMessages = (query) => searchStore(store, account2, query, messenger), meaning) => {
14410
+ if (!asked.text.trim())
14078
14411
  throw new CliError("validation_error", "say what to find");
14412
+ const request = { ...asked, text: plainQuery(asked.text) };
14079
14413
  const offset = request.offset ?? 0;
14080
14414
  if (!Number.isInteger(offset) || offset < 0 || offset > MAX_SEARCH_OFFSET)
14081
14415
  throw new CliError("validation_error", `offset takes a whole number from 0 to ${MAX_SEARCH_OFFSET}`);
@@ -14119,12 +14453,12 @@ var searchAll = /* @__PURE__ */ __name(async (store, account2, request, messenge
14119
14453
  if (kind === "messages" && found.coverage)
14120
14454
  coverage2 = found.coverage;
14121
14455
  hasMore ||= found.hasMore;
14122
- const read = found.coverage?.accounts ?? given ?? (await store.accounts.accounts()).filter(({ provider }) => kindIn(provider) === kind);
14456
+ const read = found.coverage?.accounts ?? given ?? (await store.accounts.accounts()).filter(({ provider }) => holdsKind(provider, kind));
14123
14457
  for (const one2 of found.skipped ?? [])
14124
14458
  if (!skipped.some(({ source }) => source === one2.source))
14125
14459
  skipped.push(one2);
14126
14460
  accounts.push(...read.map(({ provider, account: account3 }) => ({ resource: kind, provider, account: account3 })));
14127
- const itemOf2 = /* @__PURE__ */ __name((hit, foundBy) => {
14461
+ const itemOf3 = /* @__PURE__ */ __name((hit, foundBy) => {
14128
14462
  const at = parseLocator(hit.locator);
14129
14463
  return {
14130
14464
  kind: kind === "mail" ? "mail" : "message",
@@ -14141,7 +14475,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account2, request, messenge
14141
14475
  foundBy
14142
14476
  };
14143
14477
  }, "itemOf");
14144
- const byWords = found.items.map((hit) => itemOf2(hit, ["words"]));
14478
+ const byWords = found.items.map((hit) => itemOf3(hit, ["words"]));
14145
14479
  if (!meaning || request.exact || kind === "messages" && request.backend === "server")
14146
14480
  return byWords;
14147
14481
  const filters = filtersBeside(request.text);
@@ -14166,12 +14500,11 @@ var searchAll = /* @__PURE__ */ __name(async (store, account2, request, messenge
14166
14500
  const held = fused2.get(hit.locator);
14167
14501
  if (held)
14168
14502
  held.item.foundBy = ["words", "meaning"];
14503
+ const vote = 1 / (RRF_K3 + rank + 1);
14169
14504
  if (held && discovers)
14170
- return;
14171
- fused2.set(hit.locator, {
14172
- item: held?.item ?? itemOf2(hit, ["meaning"]),
14173
- score: (held?.score ?? 0) + 1 / (RRF_K3 + rank + 1)
14174
- });
14505
+ held.score = Math.max(held.score, vote);
14506
+ else
14507
+ fused2.set(hit.locator, { item: held?.item ?? itemOf3(hit, ["meaning"]), score: (held?.score ?? 0) + vote });
14175
14508
  });
14176
14509
  return [...fused2.values()].sort((a, b) => b.score - a.score).map(({ item: item2 }) => item2);
14177
14510
  }, "messagesOf");
@@ -14213,7 +14546,8 @@ var searchAll = /* @__PURE__ */ __name(async (store, account2, request, messenge
14213
14546
  const read = chosen?.map(({ account: account3 }) => account3) ?? [
14214
14547
  INTERNAL_NOTES,
14215
14548
  ...(await store.notes.folders()).map(({ id: id2 }) => id2),
14216
- ...(await store.notes.documentsAccounts()).map(({ id: id2 }) => id2)
14549
+ ...(await store.notes.documentsAccounts()).map(({ id: id2 }) => id2),
14550
+ ...[await store.notes.addedAccount()].flatMap((added) => added ? [added.id] : [])
14217
14551
  ];
14218
14552
  accounts.push(...read.map((account3) => ({ resource, provider: "notes", account: account3 })));
14219
14553
  } else if (resource === "events") {
@@ -14251,13 +14585,37 @@ var searchAll = /* @__PURE__ */ __name(async (store, account2, request, messenge
14251
14585
  foundBy: hit.found_by
14252
14586
  })));
14253
14587
  accounts.push(...read.map(({ provider, account: account3 }) => ({ resource, provider, account: account3 })));
14588
+ } else if (resource === "crm") {
14589
+ const { words: words4, anyWord } = titleWords(request.text);
14590
+ const chosen = request.scope?.crm;
14591
+ const found = await store.deals.find({
14592
+ words: words4,
14593
+ anyWord: anyWord || discover,
14594
+ ...request.crmKinds === void 0 ? {} : { kinds: request.crmKinds },
14595
+ limit: Math.min(window2 + 1, 500),
14596
+ ...chosen === void 0 ? {} : { accounts: chosen }
14597
+ });
14598
+ hasMore ||= found.length > window2;
14599
+ lists.push(found.slice(0, window2).map((deal) => ({
14600
+ kind: deal.kind,
14601
+ ref: deal.ref,
14602
+ provider: deal.account?.provider ?? "crm",
14603
+ account: deal.account?.account ?? INTERNAL_NOTES,
14604
+ title: deal.title,
14605
+ timestamp: deal.updatedAt,
14606
+ text: deal.summary,
14607
+ foundBy: ["title"]
14608
+ })));
14609
+ const read = chosen ?? [...await crmAccounts(store), { provider: "crm", account: INTERNAL_NOTES }];
14610
+ for (const { provider, account: account3 } of read)
14611
+ accounts.push({ resource, provider, account: account3 });
14254
14612
  } else
14255
14613
  lists.push(await messagesOf(resource));
14256
14614
  searched.push(resource);
14257
14615
  } catch (error) {
14258
14616
  if (!skippable(error))
14259
14617
  throw error;
14260
- skipped.push({ resource, code: error.code, reason: error.message });
14618
+ skipped.push({ resource, code: error.code, reason: error.message, ...refusal(error, request.text) });
14261
14619
  }
14262
14620
  }
14263
14621
  } finally {
@@ -14266,7 +14624,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account2, request, messenge
14266
14624
  const ordered = oneList(lists, cosines);
14267
14625
  const more = hasMore || ordered.length > window2;
14268
14626
  return {
14269
- query: request.text,
14627
+ query: asked.text,
14270
14628
  items: ordered.slice(offset, window2),
14271
14629
  hasMore: more,
14272
14630
  ...more && window2 <= MAX_SEARCH_OFFSET ? { nextOffset: window2 } : {},
@@ -14293,7 +14651,7 @@ var oneList = /* @__PURE__ */ __name((lists, cosines) => {
14293
14651
  return [...place.values()].sort((a, b) => a.rank - b.rank || cosine(b.item.ref) - cosine(a.item.ref)).map(({ item: item2 }) => item2);
14294
14652
  }, "oneList");
14295
14653
 
14296
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/search-all-meetings.js
14654
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/search-all-meetings.js
14297
14655
  var RESOURCES_SEARCHED_WITH_MEETINGS = [...RESOURCES_SEARCHED, "meetings"];
14298
14656
  var whole2 = /* @__PURE__ */ __name((value, minimum, maximum, label) => {
14299
14657
  if (!Number.isSafeInteger(value) || value < minimum || value > maximum)
@@ -14518,7 +14876,7 @@ var searchAllOfSource = /* @__PURE__ */ __name(async (store, account2, source, r
14518
14876
  const entries = entriesOfList(source, await listContextOf(store, account2, messenger.app));
14519
14877
  const { skipped } = fitting(entries, only, "search all", (kind) => `--only leaves ${kind} out`);
14520
14878
  const named2 = /* @__PURE__ */ __name((resource) => [
14521
- ...new Map(entries.flatMap(({ accounts }) => accounts).filter(({ kind }) => kind === resource).map(({ provider, account: account3 }) => [`${provider}\0${account3}`, { provider, account: account3 }])).values()
14879
+ ...new Map(entries.flatMap(({ accounts }) => accounts).filter((one2) => listedHolds(one2, resource)).map(({ provider, account: account3 }) => [`${provider}\0${account3}`, { provider, account: account3 }])).values()
14522
14880
  ], "named");
14523
14881
  const meetings = await holdingMeetings(store, named2("meetings"));
14524
14882
  const empty2 = named2("meetings").filter((one2) => !meetings.some(({ provider, account: account3 }) => provider === one2.provider && account3 === one2.account)).map(({ provider, account: account3 }) => ({
@@ -14538,7 +14896,8 @@ var searchAllOfSource = /* @__PURE__ */ __name(async (store, account2, source, r
14538
14896
  messages: named2("messages"),
14539
14897
  mail: named2("mail"),
14540
14898
  notes: named2("notes"),
14541
- events: named2("events")
14899
+ events: named2("events"),
14900
+ crm: named2("crm")
14542
14901
  },
14543
14902
  ...meetings[0] ? { meetingAccount: meetings[0] } : {}
14544
14903
  }, messenger, searchMessages, meaning);
@@ -14546,7 +14905,7 @@ var searchAllOfSource = /* @__PURE__ */ __name(async (store, account2, source, r
14546
14905
  return { ...found, skipped: [...skipped, ...empty2, ...unnamed, ...found.skipped] };
14547
14906
  }, "searchAllOfSource");
14548
14907
 
14549
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/server-search.js
14908
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/server-search.js
14550
14909
  var SERVER_SEARCH_KEY = "messages.server-search";
14551
14910
  var SERVER_BOUNDS = { timeMs: 5e3, perCall: 100, maxCalls: 3, textBytes: 262144 };
14552
14911
  var DEFAULT_BACKEND = "both";
@@ -14594,12 +14953,12 @@ var branchesOf = /* @__PURE__ */ __name((node, account2) => {
14594
14953
  const should = node.clauses.filter(({ occur }) => occur === "should");
14595
14954
  return should.length ? should.flatMap(({ node: node2 }) => branchesOf(node2, account2)) : [{ words: [] }];
14596
14955
  }, "branchesOf");
14597
- var asQuery = /* @__PURE__ */ __name(({ words: words3, from, ...rest }) => ({
14598
- text: words3.join(" "),
14956
+ var asQuery = /* @__PURE__ */ __name(({ words: words4, from, ...rest }) => ({
14957
+ text: words4.join(" "),
14599
14958
  ...rest,
14600
14959
  ...from !== void 0 && rest.chat !== void 0 ? { from } : {}
14601
14960
  }), "asQuery");
14602
- var refusal = {
14961
+ var refusal2 = {
14603
14962
  unsupported: "this messenger's server cannot search messages \u2014 use --backend archive",
14604
14963
  pushed_history: "this messenger's server cannot search messages \u2014 use --backend archive",
14605
14964
  offline: "--backend server needs the network \u2014 not with --offline",
@@ -14623,7 +14982,7 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
14623
14982
  if (quiet2)
14624
14983
  return void 0;
14625
14984
  if (backend === "server")
14626
- throw new CliError(reason === "not_allowed" ? "permission_error" : "validation_error", refusal[reason], {
14985
+ throw new CliError(reason === "not_allowed" ? "permission_error" : "validation_error", refusal2[reason], {
14627
14986
  reason
14628
14987
  });
14629
14988
  return { report: { ...report, skipped: reason, complete: false }, sources };
@@ -14652,7 +15011,7 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
14652
15011
  return skip("other_accounts");
14653
15012
  const all = branchesOf(execution.root, account2).flatMap((branch) => merge(scoped, branch) ?? []);
14654
15013
  const unique = [
14655
- ...new Map(all.filter(({ words: words3 }) => words3.length).map((branch) => [JSON.stringify(branch), branch])).values()
15014
+ ...new Map(all.filter(({ words: words4 }) => words4.length).map((branch) => [JSON.stringify(branch), branch])).values()
14656
15015
  ];
14657
15016
  if (!unique.length)
14658
15017
  return skip("no_words");
@@ -14735,7 +15094,7 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
14735
15094
  return { report, sources };
14736
15095
  }, "searchServer");
14737
15096
 
14738
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/messages.js
15097
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/messages.js
14739
15098
  var DELETE_AT_ONCE = 10;
14740
15099
  var filesOf = /* @__PURE__ */ __name(({ attachments }) => {
14741
15100
  const files = fileLinks(attachments);
@@ -15176,7 +15535,7 @@ var checkMediaOptions = /* @__PURE__ */ __name((messenger, asked, attachments) =
15176
15535
  throw new CliError("validation_error", `${MEDIA_FLAGS[first]} needs a --photo or --file`);
15177
15536
  }, "checkMediaOptions");
15178
15537
 
15179
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/domain/channel-tags.js
15538
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/domain/channel-tags.js
15180
15539
  var CHANNEL_TAG_RULES_VERSION = "keywords-v1";
15181
15540
  var RULES = {
15182
15541
  ai: [/\b(ai|gpt|llm|machine learning|artificial intelligence)\b/iu, /нейросет|искусственн/iu],
@@ -15191,7 +15550,7 @@ var classifyChannel = /* @__PURE__ */ __name((metadata) => Object.entries(RULES)
15191
15550
  return fields.length ? [{ tag, score: fields.length / 3, fields }] : [];
15192
15551
  }), "classifyChannel");
15193
15552
 
15194
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/metadata.js
15553
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/metadata.js
15195
15554
  var metadataService = /* @__PURE__ */ __name((deps) => {
15196
15555
  const held = /* @__PURE__ */ __name(async (reference, { includeLeft = false } = {}) => {
15197
15556
  const store = await deps.store();
@@ -15277,7 +15636,7 @@ var metadataService = /* @__PURE__ */ __name((deps) => {
15277
15636
  };
15278
15637
  }, "metadataService");
15279
15638
 
15280
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/moderation/check.js
15639
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/moderation/check.js
15281
15640
  var INVITE = /max\.ru\/join\/|(t|telegram)\.me\/(\+|joinchat\/)|tg:\/\/join/i;
15282
15641
  var LINK2 = /https?:\/\/\S+/i;
15283
15642
  var STRENGTH = { report: 0, delete: 1, remove: 2 };
@@ -15465,7 +15824,7 @@ var nextPoint = /* @__PURE__ */ __name((rows, found) => {
15465
15824
  }, "nextPoint");
15466
15825
  var someUndone = /* @__PURE__ */ __name((rows) => rows.some(undone), "someUndone");
15467
15826
 
15468
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/moderation/rules.js
15827
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/moderation/rules.js
15469
15828
  import { existsSync, readFileSync } from "node:fs";
15470
15829
  import { join as join10 } from "node:path";
15471
15830
  var RULE_ACTIONS = ["report", "delete", "remove"];
@@ -15608,7 +15967,7 @@ var assign = /* @__PURE__ */ __name((rules, key, value) => {
15608
15967
  return { ...rules, [head]: { ...rules[head], [tail]: value } };
15609
15968
  }, "assign");
15610
15969
 
15611
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/moderation/run.js
15970
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/moderation/run.js
15612
15971
  var FIRST_LOOK_MS = 24 * 36e5;
15613
15972
  var moderateWith = /* @__PURE__ */ __name(async (run) => {
15614
15973
  const { chatId, title, rules, point, since, dryRun } = run;
@@ -15645,7 +16004,7 @@ var moderateWith = /* @__PURE__ */ __name(async (run) => {
15645
16004
  return { chatId, rows, notes };
15646
16005
  }, "moderateWith");
15647
16006
 
15648
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/moderation.js
16007
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/moderation.js
15649
16008
  var moderationService = /* @__PURE__ */ __name((deps) => {
15650
16009
  const file2 = /* @__PURE__ */ __name(() => new ModerationRules(moderationPathFor(deps.messenger.app, deps.profile ?? "default", deps.env ?? process.env)), "file");
15651
16010
  const group = /* @__PURE__ */ __name(async (chat) => {
@@ -15723,7 +16082,7 @@ var moderatorOf = /* @__PURE__ */ __name((adapter, deps) => ({
15723
16082
  }, "removePerson")
15724
16083
  }), "moderatorOf");
15725
16084
 
15726
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/person-context.js
16085
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/person-context.js
15727
16086
  var CONTEXT_MESSAGES2 = 10;
15728
16087
  var CONTEXT_BYTES = 64 * 1024;
15729
16088
  var toContext = /* @__PURE__ */ __name((key, message, chatTitle2) => ({
@@ -15799,18 +16158,34 @@ var eventsOnce = /* @__PURE__ */ __name(async (store, filter, limit) => {
15799
16158
  }
15800
16159
  return { items, cut: true };
15801
16160
  }, "eventsOnce");
15802
- var readsOf = /* @__PURE__ */ __name((record2, asked) => record2.identities.flatMap((identity) => (identity.provider === asked.provider ? [asked.account] : identity.accounts).filter((account2) => identity.accounts.includes(account2)).map((account2) => ({ key: { provider: identity.provider, account: account2 }, identity }))), "readsOf");
16161
+ var nameOf2 = /* @__PURE__ */ __name(({ provider, account: account2 }) => `${provider}:${account2}`, "nameOf");
16162
+ var readableAccounts = /* @__PURE__ */ __name(async (store, asked, scopes) => {
16163
+ const stored = await store.accounts.storedAccounts();
16164
+ const own = stored.find((one2) => nameOf2(one2) === nameOf2(asked));
16165
+ if (!own || asked.scope !== void 0 && asked.scope !== own.scope)
16166
+ throw new CliError("not_found", `no ${asked.provider} account ${asked.account} in the store`);
16167
+ const allowed = scopes ?? [own.scope];
16168
+ return stored.filter((one2) => allowed.includes(one2.scope));
16169
+ }, "readableAccounts");
16170
+ var readsOf = /* @__PURE__ */ __name((record2, asked, readable) => {
16171
+ const scopeOf4 = new Map(readable.map((one2) => [nameOf2(one2), one2.scope]));
16172
+ return record2.identities.flatMap((identity) => (identity.provider === asked.provider ? [asked.account] : identity.accounts).flatMap((account2) => {
16173
+ const scope = scopeOf4.get(nameOf2({ provider: identity.provider, account: account2 }));
16174
+ return identity.accounts.includes(account2) && scope !== void 0 ? [{ key: { provider: identity.provider, account: account2 }, scope, identity }] : [];
16175
+ }));
16176
+ }, "readsOf");
15803
16177
  var personContext = /* @__PURE__ */ __name(async (store, asked, reference, options = {}) => {
15804
16178
  const found = pickPerson(reference, await store.people.people(asked.provider, { account: asked.account }));
15805
16179
  const record2 = await store.people.personOf({ provider: asked.provider, id: found.id });
15806
16180
  if (!record2)
15807
16181
  throw new CliError("not_found", `no person ${found.id} in the store`);
16182
+ const readable = await readableAccounts(store, asked, options.scopes);
15808
16183
  return {
15809
16184
  person: { ...record2, provider: asked.provider, id: found.id },
15810
- ...await recordContext(store, record2, readsOf(record2, asked), options)
16185
+ ...await recordContext(store, record2, readsOf(record2, asked, readable), readable, options)
15811
16186
  };
15812
16187
  }, "personContext");
15813
- var recordContext = /* @__PURE__ */ __name(async (store, record2, reads, { messages = CONTEXT_MESSAGES2, bytes: bytes2 = CONTEXT_BYTES, since, now = Date.now() } = {}) => {
16188
+ var recordContext = /* @__PURE__ */ __name(async (store, record2, reads, readable, { messages = CONTEXT_MESSAGES2, bytes: bytes2 = CONTEXT_BYTES, since, now = Date.now() } = {}) => {
15814
16189
  const recent = /* @__PURE__ */ __name((message) => since === void 0 || Date.parse(message.timestamp) >= since, "recent");
15815
16190
  const shared = [];
15816
16191
  const notRead = [];
@@ -15868,9 +16243,15 @@ var recordContext = /* @__PURE__ */ __name(async (store, record2, reads, { messa
15868
16243
  cut ||= named2.hasMore;
15869
16244
  }
15870
16245
  const personId = Number(record2.uid);
15871
- const upcoming = await eventsOnce(store, { personId, from: now }, messages);
16246
+ const calendars = [];
16247
+ for (const one2 of readable)
16248
+ if ((await store.calendar.calendars(one2.id)).length)
16249
+ calendars.push(one2);
16250
+ const accountIds = calendars.map(({ id: id2 }) => id2);
16251
+ const nothing = { items: [], cut: false };
16252
+ const upcoming = accountIds.length ? await eventsOnce(store, { personId, accountIds, from: now }, messages) : nothing;
15872
16253
  const upcomingIds = new Set(upcoming.items.map(({ id: id2 }) => id2));
15873
- const past = await eventsOnce(store, { personId, to: now, newest: true, ...since === void 0 ? {} : { from: since } }, messages);
16254
+ const past = accountIds.length ? await eventsOnce(store, { personId, accountIds, to: now, newest: true, ...since === void 0 ? {} : { from: since } }, messages) : nothing;
15874
16255
  cut ||= upcoming.cut || past.cut;
15875
16256
  direct.sort(newestFirst);
15876
16257
  const each = [...direct, ...beyond].sort(newestFirst);
@@ -15886,7 +16267,13 @@ var recordContext = /* @__PURE__ */ __name(async (store, record2, reads, { messa
15886
16267
  };
15887
16268
  cut ||= direct.length > messages || groups.length > messages || mentions.length > messages;
15888
16269
  const kept2 = withinBytes(lists, bytes2);
16270
+ const read = [
16271
+ ...reads.map(({ key, scope }) => ({ ...key, scope })),
16272
+ ...calendars.map(({ provider, account: account2, scope }) => ({ provider, account: account2, scope }))
16273
+ ];
16274
+ const accounts = [...new Map(read.map((one2) => [nameOf2(one2), one2])).values()].sort((a, b) => nameOf2(a).localeCompare(nameOf2(b)));
15889
16275
  return {
16276
+ accounts,
15890
16277
  shared: shared.sort((a, b) => Date.parse(b.lastMessageAt ?? "") - Date.parse(a.lastMessageAt ?? "")),
15891
16278
  last: {
15892
16279
  fromThem: each.find((message) => !message.outgoing) ?? null,
@@ -15958,7 +16345,7 @@ var lean = /* @__PURE__ */ __name((key, message, detail) => {
15958
16345
  replyTo: message.replyTo?.id ?? message.replyToId ?? null
15959
16346
  };
15960
16347
  }, "lean");
15961
- var kindOf3 = /* @__PURE__ */ __name((chat, chatId, person) => chat && chat.kind !== "unknown" ? chat.kind : chatId === person ? "dialog" : chat?.kind ?? "unknown", "kindOf");
16348
+ var kindOf2 = /* @__PURE__ */ __name((chat, chatId, person) => chat && chat.kind !== "unknown" ? chat.kind : chatId === person ? "dialog" : chat?.kind ?? "unknown", "kindOf");
15962
16349
  var personMessages = /* @__PURE__ */ __name(async (store, asked, reference, { chats, limit = CHAT_MESSAGES, detail = 0 }) => {
15963
16350
  const found = pickPerson(reference, await store.people.people(asked.provider, { account: asked.account }));
15964
16351
  const record2 = await store.people.personOf({ provider: asked.provider, id: found.id });
@@ -15971,7 +16358,7 @@ var personMessages = /* @__PURE__ */ __name(async (store, asked, reference, { ch
15971
16358
  const chat = stored.find((one2) => one2.id === chatId);
15972
16359
  const page = await store.messages.find({ account: asked, senders: [found.id], chatId, limit });
15973
16360
  answer.push({
15974
- chat: { id: chatId, title: chat?.title ?? null, kind: kindOf3(chat, chatId, found.id) },
16361
+ chat: { id: chatId, title: chat?.title ?? null, kind: kindOf2(chat, chatId, found.id) },
15975
16362
  messages: page.items.toSorted((a, b) => Date.parse(a.timestamp) - Date.parse(b.timestamp)).map((message) => lean(asked, message, detail)),
15976
16363
  complete: held.get(chatId) === "complete",
15977
16364
  more: page.hasMore
@@ -15984,10 +16371,10 @@ var personMessages = /* @__PURE__ */ __name(async (store, asked, reference, { ch
15984
16371
  };
15985
16372
  }, "personMessages");
15986
16373
 
15987
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
15988
- import { createHash as createHash11 } from "node:crypto";
16374
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
16375
+ import { createHash as createHash12 } from "node:crypto";
15989
16376
 
15990
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-reference.js
16377
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-reference.js
15991
16378
  var missing3 = /* @__PURE__ */ __name(() => new CliError("not_found", "the meeting evidence is unavailable for this account"), "missing");
15992
16379
  var authorizedMeetingMetadata = /* @__PURE__ */ __name(async (store, accountId, reference, options = {}) => {
15993
16380
  const parsed = parseMeetingReference(reference);
@@ -16035,8 +16422,8 @@ var resolveMeetingReference = /* @__PURE__ */ __name(async (store, accountId, re
16035
16422
  };
16036
16423
  }, "resolveMeetingReference");
16037
16424
 
16038
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
16039
- var hash = /* @__PURE__ */ __name((value) => createHash11("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
16425
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
16426
+ var hash = /* @__PURE__ */ __name((value) => createHash12("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
16040
16427
  var checkMeetingCancelled = /* @__PURE__ */ __name((signal) => {
16041
16428
  if (signal?.aborted)
16042
16429
  throw new CliError("cancelled", "meeting evidence reading was cancelled");
@@ -16234,7 +16621,7 @@ var readMeetingEvidence = /* @__PURE__ */ __name(async (store, accountId, refere
16234
16621
  return { ...packet, fingerprint: hash(packet) };
16235
16622
  }, "readMeetingEvidence");
16236
16623
 
16237
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/person-meeting-context.js
16624
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/person-meeting-context.js
16238
16625
  var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference, options) => {
16239
16626
  const { meetings = 10, cues = 5, bytes: bytes2 = 64 * 1024, scanLimit = 1e3, since, signal } = options;
16240
16627
  const requestedAccounts = options.accountIds;
@@ -16333,7 +16720,7 @@ var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference,
16333
16720
  };
16334
16721
  }, "personMeetingContext");
16335
16722
 
16336
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/person-preparation.js
16723
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/person-preparation.js
16337
16724
  var PREPARE_BYTES = 96 * 1024;
16338
16725
  var MEETINGS = 5;
16339
16726
  var CUES = 3;
@@ -16361,7 +16748,6 @@ var personPreparation = /* @__PURE__ */ __name(async (store, asked, reference, o
16361
16748
  coverage: { included: items.length, hasMore: over || cut, cutBy: cut ? "bytes" : over ? "limit" : null }
16362
16749
  };
16363
16750
  }, "budgeted");
16364
- const reads = readsOf(context2.person, asked);
16365
16751
  const partial = new Set(context2.notRead.map((chat) => `${chat.provider}/${chat.account}/${chat.chatId}`));
16366
16752
  const waiting = [];
16367
16753
  for (const chat of context2.shared.filter((one2) => one2.kind === "dialog")) {
@@ -16378,10 +16764,10 @@ var personPreparation = /* @__PURE__ */ __name(async (store, asked, reference, o
16378
16764
  });
16379
16765
  }
16380
16766
  waiting.sort((a, b) => Date.parse(b.message.timestamp) - Date.parse(a.message.timestamp));
16381
- const accounts = [...new Map(reads.map(({ key }) => [accountName(key), key])).values()];
16767
+ const accounts = context2.accounts.map(({ provider, account: account2 }) => ({ provider, account: account2 }));
16382
16768
  const held = await store.people.preparation(context2.person.uid, { accounts, limit });
16383
- const stored = await store.accounts.storedAccounts();
16384
- const meetings = await meetingsOf(store, context2.person.uid, stored, options.since, () => left);
16769
+ const readable = await readableAccounts(store, asked, options.scopes);
16770
+ const meetings = await meetingsOf(store, context2.person.uid, readable, options.since, () => left);
16385
16771
  const sections = {
16386
16772
  waiting: budgeted({ items: waiting, hasMore: false }),
16387
16773
  tasks: budgeted(held.tasks),
@@ -16450,7 +16836,7 @@ var meetingsOf = /* @__PURE__ */ __name(async (store, uid, stored, since, left)
16450
16836
  }
16451
16837
  }, "meetingsOf");
16452
16838
 
16453
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/person-profile.js
16839
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/person-profile.js
16454
16840
  var personProfile = /* @__PURE__ */ __name(async (deps, person, known2) => {
16455
16841
  const online = deps.offline ? void 0 : await deps.connection();
16456
16842
  const held = await storeIfOpen(deps);
@@ -16520,7 +16906,7 @@ var quiet = /* @__PURE__ */ __name((facts) => facts.chats.map(({ id: id2, title,
16520
16906
  complete: false
16521
16907
  })), "quiet");
16522
16908
 
16523
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/person-timeline.js
16909
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/person-timeline.js
16524
16910
  var TIMELINE_ITEMS = 50;
16525
16911
  var TIMELINE_MAX = 500;
16526
16912
  var SCOPES = ["personal", "work"];
@@ -16575,7 +16961,7 @@ var personTimeline = /* @__PURE__ */ __name(async (store, asked, reference, { sc
16575
16961
  };
16576
16962
  }, "personTimeline");
16577
16963
 
16578
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/people.js
16964
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/people.js
16579
16965
  var peopleService = /* @__PURE__ */ __name((deps) => {
16580
16966
  const localCard = /* @__PURE__ */ __name(async (card, includeNotes = false) => {
16581
16967
  const held = await storeIfOpen(deps);
@@ -16802,7 +17188,7 @@ var withoutPhone = /* @__PURE__ */ __name((answer) => {
16802
17188
  return rest;
16803
17189
  }, "withoutPhone");
16804
17190
 
16805
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/private-people.js
17191
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/private-people.js
16806
17192
  var noteItem = /* @__PURE__ */ __name((provider, note) => ({
16807
17193
  id: note.id,
16808
17194
  contact: formatReference({ type: "contact", provider, id: note.personId }),
@@ -16846,7 +17232,7 @@ var privatePeopleService = /* @__PURE__ */ __name((deps) => {
16846
17232
  };
16847
17233
  }, "privatePeopleService");
16848
17234
 
16849
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/rankings.js
17235
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/rankings.js
16850
17236
  var empty = /* @__PURE__ */ __name(() => ({
16851
17237
  total: 0,
16852
17238
  population: 0,
@@ -17102,7 +17488,7 @@ var rankingsService = /* @__PURE__ */ __name((deps) => ({
17102
17488
  }, "evidence")
17103
17489
  }), "rankingsService");
17104
17490
 
17105
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/reply-stats.js
17491
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/reply-stats.js
17106
17492
  var FIELDS = ["date", "chat", "kind"];
17107
17493
  var WAITING_TAIL = 100;
17108
17494
  var plainOnly = /* @__PURE__ */ __name((text2, command) => {
@@ -17229,7 +17615,7 @@ var replyStatsService = /* @__PURE__ */ __name((deps) => {
17229
17615
  };
17230
17616
  }, "replyStatsService");
17231
17617
 
17232
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/searches.js
17618
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/searches.js
17233
17619
  var savedSearchItem = /* @__PURE__ */ __name((one2) => ({
17234
17620
  id: one2.id,
17235
17621
  name: one2.name,
@@ -17250,7 +17636,7 @@ var MESSAGE_SEARCH_COMMANDS = [
17250
17636
  "admin-statistics"
17251
17637
  ];
17252
17638
  var NAME = /^[a-z0-9][a-z0-9-]{0,63}$/;
17253
- var nameOf = /* @__PURE__ */ __name((value) => {
17639
+ var nameOf3 = /* @__PURE__ */ __name((value) => {
17254
17640
  const name = value.trim().toLowerCase();
17255
17641
  if (!NAME.test(name) || /^\d+$/.test(name))
17256
17642
  throw new CliError("validation_error", `"${singleLine(value)}" cannot name a saved search \u2014 use up to 64 letters a\u2013z, digits and hyphens, not only digits`, { reason: "name.invalid" });
@@ -17275,14 +17661,14 @@ var named = /* @__PURE__ */ __name((search, check) => {
17275
17661
  throw new CliError(error.code, `${label}: ${error.message}`, error.details);
17276
17662
  }
17277
17663
  }, "named");
17278
- var both = /* @__PURE__ */ __name((stored, words3) => ({
17664
+ var both = /* @__PURE__ */ __name((stored, words4) => ({
17279
17665
  version: 1,
17280
17666
  language: "lucene-v1",
17281
17667
  root: {
17282
17668
  kind: "boolean",
17283
17669
  clauses: [
17284
17670
  { occur: "must", node: stored.root },
17285
- { occur: "must", node: parseLucene(words3, MESSAGE_PARSING).root }
17671
+ { occur: "must", node: parseLucene(words4, MESSAGE_PARSING).root }
17286
17672
  ],
17287
17673
  span: { start: 0, end: 0 }
17288
17674
  }
@@ -17305,13 +17691,13 @@ var searchesService = /* @__PURE__ */ __name((deps) => {
17305
17691
  if (isAdminSelection(params.selection)) {
17306
17692
  const selected = await readAdminSelection(store, params.selection);
17307
17693
  const normalized2 = typeof params.selection === "string" ? JSON.parse(params.selection) : params.selection;
17308
- return store.searches.saveSearch(nameOf(name), searchRecordOf("admin-statistics", {
17694
+ return store.searches.saveSearch(nameOf3(name), searchRecordOf("admin-statistics", {
17309
17695
  adminReport: selected.options.report,
17310
17696
  selection: normalized2,
17311
17697
  timezone: selected.base.timezone
17312
17698
  }), { replace });
17313
17699
  }
17314
- return store.searches.saveSearch(nameOf(name), searchRecordOf(params.target ? params.target === "messages" ? "message-top" : "author-top" : params.by === void 0 ? "search" : "stats", checked(params)), {
17700
+ return store.searches.saveSearch(nameOf3(name), searchRecordOf(params.target ? params.target === "messages" ? "message-top" : "author-top" : params.by === void 0 ? "search" : "stats", checked(params)), {
17315
17701
  replace
17316
17702
  });
17317
17703
  }), "create"),
@@ -17323,7 +17709,7 @@ var searchesService = /* @__PURE__ */ __name((deps) => {
17323
17709
  }), "history"),
17324
17710
  delete: /* @__PURE__ */ __name((reference) => inStore(async (store) => store.searches.deleteSearch((await found(store, reference)).id)), "delete"),
17325
17711
  clear: /* @__PURE__ */ __name(() => inStore(async (store) => ({ cleared: await store.searches.clearSearchHistory(MESSAGE_SEARCH_COMMANDS) })), "clear"),
17326
- resolve: /* @__PURE__ */ __name((reference, { text: words3, ...typed }) => inStore(async (store) => {
17712
+ resolve: /* @__PURE__ */ __name((reference, { text: words4, ...typed }) => inStore(async (store) => {
17327
17713
  const search = await found(store, reference);
17328
17714
  const stored = search.params;
17329
17715
  const inherited = { ...stored };
@@ -17344,7 +17730,7 @@ var searchesService = /* @__PURE__ */ __name((deps) => {
17344
17730
  throw new CliError("validation_error", "the legacy search and --regex are gone; save it again as Lucene");
17345
17731
  checked(stored);
17346
17732
  });
17347
- const extra = words3?.trim() ? words3.trim() : void 0;
17733
+ const extra = words4?.trim() ? words4.trim() : void 0;
17348
17734
  if (extra !== void 0) {
17349
17735
  if (params.ast !== void 0)
17350
17736
  params.ast = both(validateAst(params.ast), extra);
@@ -17358,7 +17744,7 @@ var searchesService = /* @__PURE__ */ __name((deps) => {
17358
17744
  };
17359
17745
  }, "searchesService");
17360
17746
 
17361
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/tags.js
17747
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/tags.js
17362
17748
  var TAGGING_QUERY = {
17363
17749
  entity: "tagging",
17364
17750
  backend: "sql",
@@ -17442,7 +17828,7 @@ var tagsService = /* @__PURE__ */ __name((deps) => {
17442
17828
  };
17443
17829
  }, "tagsService");
17444
17830
 
17445
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/task-stats.js
17831
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/task-stats.js
17446
17832
  var TASK_STATS_BY = ["chat", "meeting", "project"];
17447
17833
  var PERIOD_FIELD = "created";
17448
17834
  var refuseNestedPeriod = /* @__PURE__ */ __name((node, top = true) => {
@@ -17545,7 +17931,7 @@ var meetingNames = /* @__PURE__ */ __name(async (store, groups) => {
17545
17931
  }));
17546
17932
  }, "meetingNames");
17547
17933
 
17548
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/tasks.js
17934
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/tasks.js
17549
17935
  var TASK_QUERY = {
17550
17936
  entity: "task",
17551
17937
  backend: "sql",
@@ -18037,7 +18423,7 @@ var taskView = /* @__PURE__ */ __name(async (store, account2, task2) => {
18037
18423
  };
18038
18424
  }, "taskView");
18039
18425
 
18040
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/topics.js
18426
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/topics.js
18041
18427
  var actionOf = /* @__PURE__ */ __name(({ title, closed, pinned, hidden, icon }) => {
18042
18428
  const set = [closed, pinned, hidden].filter((one2) => one2 !== void 0).length;
18043
18429
  if (title !== void 0 || icon !== void 0 || set !== 1)
@@ -18236,9 +18622,9 @@ var topicsService = /* @__PURE__ */ __name((deps) => {
18236
18622
  };
18237
18623
  }, "topicsService");
18238
18624
 
18239
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/evidence.js
18240
- import { createHash as createHash12, randomUUID as randomUUID5 } from "node:crypto";
18241
- var hash2 = /* @__PURE__ */ __name((value) => createHash12("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
18625
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/evidence.js
18626
+ import { createHash as createHash13, randomUUID as randomUUID5 } from "node:crypto";
18627
+ var hash2 = /* @__PURE__ */ __name((value) => createHash13("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
18242
18628
  var positive = /* @__PURE__ */ __name((value, name, minimum = 1) => {
18243
18629
  if (!Number.isSafeInteger(value) || value < minimum)
18244
18630
  throw new CliError("validation_error", `${name} must be a safe integer of at least ${minimum}`);
@@ -18310,7 +18696,7 @@ var prepareEvidencePacket = /* @__PURE__ */ __name(({ kind, source, page, limits
18310
18696
  return { ...content, id: randomUUID5(), fingerprint: hash2(content) };
18311
18697
  }, "prepareEvidencePacket");
18312
18698
 
18313
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/evidence-read.js
18699
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/evidence-read.js
18314
18700
  var readEvidencePacket = /* @__PURE__ */ __name(async (store, account2, { chat, limit, before: before2 }, messenger = {}) => {
18315
18701
  if (!Number.isSafeInteger(limit) || limit < 1 || limit > 100)
18316
18702
  throw new CliError("validation_error", "evidence message limit must be an integer from 1 to 100");
@@ -18330,7 +18716,7 @@ var readEvidencePacket = /* @__PURE__ */ __name(async (store, account2, { chat,
18330
18716
  return { ...packet, nextBeforeId: older && last ? last.id : null };
18331
18717
  }, "readEvidencePacket");
18332
18718
 
18333
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-hit-search.js
18719
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-hit-search.js
18334
18720
  var refreshMeetingIndex = /* @__PURE__ */ __name(async (meetings, accountId, signal) => {
18335
18721
  let before2 = Number.POSITIVE_INFINITY;
18336
18722
  for (; ; ) {
@@ -18383,7 +18769,7 @@ var resolveMeetingSelection = /* @__PURE__ */ __name(async (store, request) => {
18383
18769
  return { input, selection };
18384
18770
  }, "resolveMeetingSelection");
18385
18771
  var searchMeetingHits = /* @__PURE__ */ __name(async (store, query, request, options = {}) => {
18386
- const lifted = liftMeetingFields(query, request);
18772
+ const lifted = liftMeetingFields(plainQuery(query, MEETING_FIELD_NAMES), request);
18387
18773
  const { input, selection } = await resolveMeetingSelection(store, lifted.request);
18388
18774
  if (options.refreshIndex !== false)
18389
18775
  await refreshMeetingIndex(store.meetings, input.accountId, input.signal);
@@ -18392,7 +18778,7 @@ var searchMeetingHits = /* @__PURE__ */ __name(async (store, query, request, opt
18392
18778
  return { ...result, selection };
18393
18779
  }, "searchMeetingHits");
18394
18780
 
18395
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-links.js
18781
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-links.js
18396
18782
  var readMeetingLinks = /* @__PURE__ */ __name(async (store, request) => {
18397
18783
  const { maxMessages, url, ...selecting } = request;
18398
18784
  const { input, selection } = await resolveMeetingSelection(store, selecting);
@@ -18431,10 +18817,10 @@ var readMeetingLinks = /* @__PURE__ */ __name(async (store, request) => {
18431
18817
  };
18432
18818
  }, "readMeetingLinks");
18433
18819
 
18434
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidates.js
18435
- import { createHash as createHash13 } from "node:crypto";
18820
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidates.js
18821
+ import { createHash as createHash14 } from "node:crypto";
18436
18822
 
18437
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidate-validation.js
18823
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidate-validation.js
18438
18824
  function invalid5(field, response = false) {
18439
18825
  throw new CliError(response ? "invalid_response" : "validation_error", `invalid project candidate ${field}`);
18440
18826
  }
@@ -18553,7 +18939,7 @@ var candidateCatalog = /* @__PURE__ */ __name((catalog, limits) => {
18553
18939
  }
18554
18940
  }, "candidateCatalog");
18555
18941
 
18556
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidates.js
18942
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidates.js
18557
18943
  var createMeetingProjectCandidateReader = /* @__PURE__ */ __name((scope, accountId, ports) => {
18558
18944
  const fixed = snapshotMeetingScope(scope);
18559
18945
  if (!Number.isSafeInteger(accountId) || accountId < 1 || typeof ports?.vocabulary?.vocabulary !== "function")
@@ -18578,7 +18964,7 @@ var createMeetingProjectCandidateReader = /* @__PURE__ */ __name((scope, account
18578
18964
  schemaVersion: 1,
18579
18965
  kind: "meeting_project_candidates",
18580
18966
  source: { ...owner, reference: input.reference },
18581
- inputFingerprint: createHash13("sha256").update(JSON.stringify(input)).digest("hex"),
18967
+ inputFingerprint: createHash14("sha256").update(JSON.stringify(input)).digest("hex"),
18582
18968
  vocabularyFingerprint: catalog.fingerprint,
18583
18969
  association: "unconfirmed-literal-evidence",
18584
18970
  items: found.slice(0, limits.limit),
@@ -18606,8 +18992,8 @@ var createMeetingProjectCandidateReader = /* @__PURE__ */ __name((scope, account
18606
18992
  };
18607
18993
  }, "createMeetingProjectCandidateReader");
18608
18994
 
18609
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-project-discovery.js
18610
- import { createHash as createHash14 } from "node:crypto";
18995
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-project-discovery.js
18996
+ import { createHash as createHash15 } from "node:crypto";
18611
18997
  var scopeKeys = [
18612
18998
  "accountId",
18613
18999
  "meetingId",
@@ -18705,7 +19091,7 @@ var readMeetingProjectDiscovery = /* @__PURE__ */ __name(async (ports, projectNa
18705
19091
  add({ name: alias.name, kind: "alias", aliasId: alias.id });
18706
19092
  if (!terms.length || terms.length > maxTerms)
18707
19093
  return fail2("project discovery names exceed the selected term budget or contain no words");
18708
- const key = createHash14("sha256").update(JSON.stringify([query, found.fingerprint, project, terms, scopeKeys.map((name) => input[name] ?? null)])).digest("hex");
19094
+ const key = createHash15("sha256").update(JSON.stringify([query, found.fingerprint, project, terms, scopeKeys.map((name) => input[name] ?? null)])).digest("hex");
18709
19095
  const previous = cursorOf2(cursor, key, terms.length);
18710
19096
  const termIndex = previous?.term ?? 0;
18711
19097
  const term = terms[termIndex];
@@ -18741,7 +19127,7 @@ var readMeetingProjectDiscovery = /* @__PURE__ */ __name(async (ports, projectNa
18741
19127
  };
18742
19128
  }, "readMeetingProjectDiscovery");
18743
19129
 
18744
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-review.js
19130
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-review.js
18745
19131
  var readMeetingReview = /* @__PURE__ */ __name(async (store, request) => {
18746
19132
  const { limit, ...selecting } = request;
18747
19133
  const { input, selection } = await resolveMeetingSelection(store, selecting);
@@ -18749,7 +19135,7 @@ var readMeetingReview = /* @__PURE__ */ __name(async (store, request) => {
18749
19135
  return { ...review, selection };
18750
19136
  }, "readMeetingReview");
18751
19137
 
18752
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-searches.js
19138
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-searches.js
18753
19139
  var KIND = ["meetings-search"];
18754
19140
  var meetingSearchesService = /* @__PURE__ */ __name((searches) => {
18755
19141
  const found = /* @__PURE__ */ __name(async (reference) => {
@@ -18765,7 +19151,7 @@ var meetingSearchesService = /* @__PURE__ */ __name((searches) => {
18765
19151
  }, "found");
18766
19152
  const record2 = /* @__PURE__ */ __name(({ query, options }) => searchRecordOf("meetings-search", { ...options, text: query }), "record");
18767
19153
  return {
18768
- create: /* @__PURE__ */ __name(async (name, params, { replace = false } = {}) => (await searches()).saveSearch(nameOf(name), record2(params), { replace }), "create"),
19154
+ create: /* @__PURE__ */ __name(async (name, params, { replace = false } = {}) => (await searches()).saveSearch(nameOf3(name), record2(params), { replace }), "create"),
18769
19155
  list: /* @__PURE__ */ __name(async () => (await searches()).savedSearches(KIND), "list"),
18770
19156
  show: found,
18771
19157
  delete: /* @__PURE__ */ __name(async (reference) => (await searches()).deleteSearch((await found(reference)).id), "delete"),
@@ -18779,7 +19165,7 @@ var meetingSearchesService = /* @__PURE__ */ __name((searches) => {
18779
19165
  };
18780
19166
  }, "meetingSearchesService");
18781
19167
 
18782
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-stats.js
19168
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-stats.js
18783
19169
  var readMeetingStats = /* @__PURE__ */ __name(async (store, request) => {
18784
19170
  const { timeZone, maxRows, ...selecting } = request;
18785
19171
  const { input, selection } = await resolveMeetingSelection(store, selecting);
@@ -18802,8 +19188,8 @@ var readMeetingCounts = /* @__PURE__ */ __name(async (store, request) => {
18802
19188
  return { ...counts, selection };
18803
19189
  }, "readMeetingCounts");
18804
19190
 
18805
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-hit-context.js
18806
- import { createHash as createHash15 } from "node:crypto";
19191
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-hit-context.js
19192
+ import { createHash as createHash16 } from "node:crypto";
18807
19193
  var contextCue = /* @__PURE__ */ __name((cue) => ({
18808
19194
  ref: cue.reference,
18809
19195
  fingerprint: cue.fingerprint,
@@ -18917,10 +19303,10 @@ var readMeetingHitContext = /* @__PURE__ */ __name(async (store, accountId, refe
18917
19303
  },
18918
19304
  items: picked
18919
19305
  };
18920
- return { ...packet, fingerprint: createHash15("sha256").update(JSON.stringify(packet)).digest("hex") };
19306
+ return { ...packet, fingerprint: createHash16("sha256").update(JSON.stringify(packet)).digest("hex") };
18921
19307
  }, "readMeetingHitContext");
18922
19308
 
18923
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-passage-format.js
19309
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-passage-format.js
18924
19310
  var visible = /* @__PURE__ */ __name((text2) => text2.replace(/[\p{Cc}\p{Cf}]/gu, (value) => value === "\n" || value === " " ? value : `\\u{${value.codePointAt(0)?.toString(16)}}`), "visible");
18925
19311
  var markdown = /* @__PURE__ */ __name((text2) => visible(text2).replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replace(/[\\`*_[\]#|~]/g, "\\$&"), "markdown");
18926
19312
  var timestamp = /* @__PURE__ */ __name((ms) => {
@@ -18996,7 +19382,7 @@ var readMeetingPassage = /* @__PURE__ */ __name(async (store, accountId, referen
18996
19382
  return { packet, content };
18997
19383
  }, "readMeetingPassage");
18998
19384
 
18999
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-batch.js
19385
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-batch.js
19000
19386
  var createMeetingBatchReader = /* @__PURE__ */ __name((store, accountId) => {
19001
19387
  if (!Number.isSafeInteger(accountId) || accountId < 1)
19002
19388
  throw new CliError("validation_error", "choose a positive meeting account");
@@ -19010,10 +19396,10 @@ var createMeetingBatchReader = /* @__PURE__ */ __name((store, accountId) => {
19010
19396
  };
19011
19397
  }, "createMeetingBatchReader");
19012
19398
 
19013
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-combined.js
19014
- import { createHash as createHash16 } from "node:crypto";
19399
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-combined.js
19400
+ import { createHash as createHash17 } from "node:crypto";
19015
19401
 
19016
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-semantic.js
19402
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-semantic.js
19017
19403
  var positive2 = /* @__PURE__ */ __name((value, name, max) => {
19018
19404
  if (!Number.isSafeInteger(value) || value < 1 || value > max)
19019
19405
  throw new CliError("validation_error", `Invalid ${name}`);
@@ -19165,7 +19551,7 @@ var applyMeetingEmbedding = /* @__PURE__ */ __name(async (store, accountId, embe
19165
19551
  };
19166
19552
  }, "applyMeetingEmbedding");
19167
19553
 
19168
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-combined.js
19554
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-combined.js
19169
19555
  var DEPTH = 200;
19170
19556
  var cursorOf3 = /* @__PURE__ */ __name((value, key) => {
19171
19557
  if (value === void 0)
@@ -19182,12 +19568,12 @@ var cursorOf3 = /* @__PURE__ */ __name((value, key) => {
19182
19568
  }, "cursorOf");
19183
19569
  var searchMeetingsCombined = /* @__PURE__ */ __name(async (store, embedder, typed, request) => {
19184
19570
  const { maxChunks, maxRows, maxTextBytes, ...chosen } = request;
19185
- const { query, request: words3 } = liftMeetingFields(typed, chosen);
19186
- const { input, selection } = await resolveMeetingSelection(store, words3);
19571
+ const { query, request: words4 } = liftMeetingFields(typed, chosen);
19572
+ const { input, selection } = await resolveMeetingSelection(store, words4);
19187
19573
  const { after, limit = 20, maxReadBytes, ...filters } = input;
19188
19574
  const terms = questionTerms(query);
19189
19575
  const wordQuery = terms === null ? query : terms.join(" ");
19190
- const key = createHash16("sha256").update(JSON.stringify([query, embedder.key, Object.entries(filters).filter(([name]) => name !== "signal")])).digest("base64url");
19576
+ const key = createHash17("sha256").update(JSON.stringify([query, embedder.key, Object.entries(filters).filter(([name]) => name !== "signal")])).digest("base64url");
19191
19577
  const offset = cursorOf3(after, key);
19192
19578
  let byWords = [];
19193
19579
  let indexing = "ready";
@@ -19302,7 +19688,7 @@ var searchMeetingsCombined = /* @__PURE__ */ __name(async (store, embedder, type
19302
19688
  };
19303
19689
  }, "searchMeetingsCombined");
19304
19690
 
19305
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-context.js
19691
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-context.js
19306
19692
  var meetingReferences = /* @__PURE__ */ __name((values) => values.map((value) => formatMeetingReference(parseMeetingReference(value))), "meetingReferences");
19307
19693
  var checkCancelled = /* @__PURE__ */ __name((signal) => {
19308
19694
  if (!signal?.aborted)
@@ -19407,7 +19793,7 @@ var createMeetingContextService = /* @__PURE__ */ __name(async (store, input, op
19407
19793
  };
19408
19794
  }, "createMeetingContextService");
19409
19795
 
19410
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-model.js
19796
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-model.js
19411
19797
  var integer2 = /* @__PURE__ */ __name((value, name, max) => {
19412
19798
  if (!Number.isSafeInteger(value) || value < 1 || value > max)
19413
19799
  throw new CliError("validation_error", `Invalid ${name}`);
@@ -19634,7 +20020,7 @@ var openMeetingEmbedder = /* @__PURE__ */ __name(async (choice, options = {}) =>
19634
20020
  };
19635
20021
  }, "openMeetingEmbedder");
19636
20022
 
19637
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/context/communication-selection.js
20023
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/context/communication-selection.js
19638
20024
  var communicationFields = {
19639
20025
  sources: pipe(array(strictObject({
19640
20026
  id: pipe(string(), regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/)),
@@ -19654,8 +20040,8 @@ var communicationRequest = /* @__PURE__ */ __name((value, preparationAfter) => {
19654
20040
  throw new CliError("validation_error", `invalid communications.${field}`);
19655
20041
  }
19656
20042
  const input = parsed.output;
19657
- const words3 = input.query.match(/[\p{L}\p{N}]+/gu) ?? [];
19658
- if (Buffer.byteLength(input.query) > 2048 || !words3.length || words3.length > 16)
20043
+ const words4 = input.query.match(/[\p{L}\p{N}]+/gu) ?? [];
20044
+ if (Buffer.byteLength(input.query) > 2048 || !words4.length || words4.length > 16)
19659
20045
  throw new CliError("validation_error", "communications.query needs 1\u201316 literal words within 2048 UTF-8 bytes");
19660
20046
  const before2 = input.before ?? preparationAfter;
19661
20047
  const after = input.after ?? Math.max(0, before2 - 14 * 864e5);
@@ -19666,7 +20052,7 @@ var communicationRequest = /* @__PURE__ */ __name((value, preparationAfter) => {
19666
20052
  return { ...input, after, before: before2 };
19667
20053
  }, "communicationRequest");
19668
20054
 
19669
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-preparation-validation.js
20055
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-preparation-validation.js
19670
20056
  var MEETING_PREPARATION_LIMITS = {
19671
20057
  meetings: { min: 1, max: 20, default: 5 },
19672
20058
  cues: { min: 1, max: 100, default: 10 },
@@ -19752,7 +20138,7 @@ var preparationRequest = /* @__PURE__ */ __name((accountId, externalId, original
19752
20138
  return { ...input, history };
19753
20139
  }, "preparationRequest");
19754
20140
 
19755
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-communications-preparation.js
20141
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-communications-preparation.js
19756
20142
  var readPreparationCommunications = /* @__PURE__ */ __name(async (plan, signal) => {
19757
20143
  const section = {
19758
20144
  readUsage: plan.reader.usage(),
@@ -19857,7 +20243,7 @@ var appendPreparationCommunications = /* @__PURE__ */ __name((result, read) => {
19857
20243
  result.knowledge.coverage.otherSources = "see-communications";
19858
20244
  }, "appendPreparationCommunications");
19859
20245
 
19860
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-communications-selection.js
20246
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-communications-selection.js
19861
20247
  var captureCommunicationSelections = /* @__PURE__ */ __name((port) => {
19862
20248
  if (port === void 0)
19863
20249
  return void 0;
@@ -19962,7 +20348,7 @@ var validatePreparationCommunications = /* @__PURE__ */ __name((section, request
19962
20348
  }
19963
20349
  }, "validatePreparationCommunications");
19964
20350
 
19965
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-knowledge-preparation.js
20351
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-knowledge-preparation.js
19966
20352
  var invalid6 = /* @__PURE__ */ __name(() => {
19967
20353
  throw new CliError("invalid_response", "Preparation knowledge returned an invalid selection");
19968
20354
  }, "invalid");
@@ -20031,7 +20417,7 @@ var appendKnowledgePreparation = /* @__PURE__ */ __name(async (store, result, in
20031
20417
  }
20032
20418
  }, "appendKnowledgePreparation");
20033
20419
 
20034
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-notes-preparation.js
20420
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-notes-preparation.js
20035
20421
  var invalid7 = /* @__PURE__ */ __name(() => {
20036
20422
  throw new CliError("invalid_response", "Preparation notes returned an invalid selection");
20037
20423
  }, "invalid");
@@ -20105,7 +20491,7 @@ var appendNotesPreparation = /* @__PURE__ */ __name(async (store, result, input)
20105
20491
  }
20106
20492
  }, "appendNotesPreparation");
20107
20493
 
20108
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-project-preparation.js
20494
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-project-preparation.js
20109
20495
  var PAGE_LIMIT = 4;
20110
20496
  var size2 = /* @__PURE__ */ __name((value) => Buffer.byteLength(JSON.stringify(value), "utf8"), "size");
20111
20497
  var appendProjectPreparation = /* @__PURE__ */ __name(async (ports, result, input) => {
@@ -20155,7 +20541,7 @@ var appendProjectPreparation = /* @__PURE__ */ __name(async (ports, result, inpu
20155
20541
  }
20156
20542
  }, "appendProjectPreparation");
20157
20543
 
20158
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-related-preparation.js
20544
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-related-preparation.js
20159
20545
  var appendRelatedPreparation = /* @__PURE__ */ __name(async (store, result, input) => {
20160
20546
  if (!result.series || !result.items.length || result.coverage.outputLimited)
20161
20547
  return;
@@ -20227,7 +20613,7 @@ var appendRelatedPreparation = /* @__PURE__ */ __name(async (store, result, inpu
20227
20613
  }
20228
20614
  }, "appendRelatedPreparation");
20229
20615
 
20230
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-preparation.js
20616
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-preparation.js
20231
20617
  var size3 = /* @__PURE__ */ __name((value) => Buffer.byteLength(JSON.stringify(value), "utf8"), "size");
20232
20618
  var createMeetingPreparationService = /* @__PURE__ */ __name((scope, accountId, ports) => {
20233
20619
  const fixed = snapshotMeetingScope(scope);
@@ -20365,14 +20751,14 @@ var createMeetingPreparationService = /* @__PURE__ */ __name((scope, accountId,
20365
20751
  };
20366
20752
  }, "createMeetingPreparationService");
20367
20753
 
20368
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-task-proposal.js
20369
- import { createHash as createHash17 } from "node:crypto";
20754
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-task-proposal.js
20755
+ import { createHash as createHash18 } from "node:crypto";
20370
20756
  var proposeMeetingTask = /* @__PURE__ */ __name(async (store, accountId, reference, kind) => {
20371
20757
  if (!TASK_KINDS.includes(kind))
20372
20758
  throw new CliError("validation_error", "unknown task kind");
20373
20759
  const resolved = await resolveMeetingReference(store, accountId, reference);
20374
20760
  return {
20375
- id: createHash17("sha256").update(JSON.stringify({ source: resolved.reference, kind })).digest("hex"),
20761
+ id: createHash18("sha256").update(JSON.stringify({ source: resolved.reference, kind })).digest("hex"),
20376
20762
  source: resolved.reference,
20377
20763
  sourceKind: "meeting",
20378
20764
  group: formatMeetingReference({ type: "meeting", accountId, meetingId: resolved.meeting.id }),
@@ -20385,7 +20771,7 @@ var proposeMeetingTask = /* @__PURE__ */ __name(async (store, accountId, referen
20385
20771
  };
20386
20772
  }, "proposeMeetingTask");
20387
20773
 
20388
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/meeting-tasks.js
20774
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/meeting-tasks.js
20389
20775
  var accountSnapshot = /* @__PURE__ */ __name((key) => {
20390
20776
  const { provider, account: account2, scope } = key;
20391
20777
  if (!provider.trim() || provider.includes(":") || !account2.trim())
@@ -20448,7 +20834,7 @@ var readMeetingTask = /* @__PURE__ */ __name(async (store, account2, id2) => {
20448
20834
  }
20449
20835
  }, "readMeetingTask");
20450
20836
 
20451
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/package-upgrade.js
20837
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/package-upgrade.js
20452
20838
  var upgradePackage = /* @__PURE__ */ __name(async ({ current, command, packageName, check }, ports) => {
20453
20839
  const installer = ports.installer();
20454
20840
  const argv = updateCommand(installer, packageName);
@@ -20513,7 +20899,7 @@ var dayAfter = /* @__PURE__ */ __name((published) => {
20513
20899
  return Number.isNaN(time) ? null : new Date(time + 24 * 60 * 60 * 1e3).toISOString();
20514
20900
  }, "dayAfter");
20515
20901
 
20516
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/proposal-tasks.js
20902
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/proposal-tasks.js
20517
20903
  var proposalSource = /* @__PURE__ */ __name((id2) => `proposed-action:${id2}`, "proposalSource");
20518
20904
  var approveAsTask = /* @__PURE__ */ __name(async (store, id2, by) => {
20519
20905
  const proposal = await store.proposedActions.get(id2);
@@ -20536,7 +20922,7 @@ var approveAsTask = /* @__PURE__ */ __name(async (store, id2, by) => {
20536
20922
  return { proposal: await store.proposedActions.approve(proposal.id, by, { task: task2.id }), task: task2 };
20537
20923
  }, "approveAsTask");
20538
20924
 
20539
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/proposals/ids.js
20925
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/proposals/ids.js
20540
20926
  var MAX_IDS = 500;
20541
20927
  var refuse = /* @__PURE__ */ __name((message) => {
20542
20928
  throw new CliError("validation_error", message, { reason: "proposal.ids" });
@@ -20578,7 +20964,7 @@ var parseProposalIds = /* @__PURE__ */ __name((text2) => {
20578
20964
  return ids;
20579
20965
  }, "parseProposalIds");
20580
20966
 
20581
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/shared.js
20967
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/shared.js
20582
20968
  var proposerOfAuthor = /* @__PURE__ */ __name((author) => {
20583
20969
  if (author.type === "person")
20584
20970
  return { type: "person", id: author.id };
@@ -20619,8 +21005,38 @@ var storedStatus = /* @__PURE__ */ __name((filter) => {
20619
21005
  const status = filter.status ?? "proposed";
20620
21006
  return status === "proposed" || status === "rejected" ? status : void 0;
20621
21007
  }, "storedStatus");
21008
+ var reviewedRow = /* @__PURE__ */ __name((kind, entry, object3) => ({
21009
+ id: entry.ref,
21010
+ kind,
21011
+ status: entry.review,
21012
+ project: entry.project,
21013
+ subject: entry.ref,
21014
+ object: object3,
21015
+ summary: entry.title,
21016
+ proposedBy: proposerOfAuthor(entry.author),
21017
+ reason: entry.reason,
21018
+ evidence: [],
21019
+ score: null,
21020
+ signals: null,
21021
+ parts: null,
21022
+ createdAt: entry.createdAt
21023
+ }), "reviewedRow");
21024
+ var reviewedKind = /* @__PURE__ */ __name((spec) => ({
21025
+ kind: spec.type,
21026
+ prefix: spec.type,
21027
+ list: /* @__PURE__ */ __name(async (filter) => {
21028
+ const status = filter.status ?? "proposed";
21029
+ const entries = await spec.list({ ...pushed2(filter), ...status === "all" ? {} : { review: status } });
21030
+ return kept(entries.map(spec.row), filter);
21031
+ }, "list"),
21032
+ get: /* @__PURE__ */ __name(async (id2) => spec.row(await spec.get(id2)), "get"),
21033
+ decide: /* @__PURE__ */ __name(async (id2, { confirm, by, reason }) => {
21034
+ const made = await spec.decide(id2, confirm, { by, reason });
21035
+ return { id: id2, kind: spec.type, status: confirm ? "confirmed" : "rejected", made: confirm ? [made] : [] };
21036
+ }, "decide")
21037
+ }), "reviewedKind");
20622
21038
 
20623
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/findings.js
21039
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/findings.js
20624
21040
  var FACT_SUMMARIES = {
20625
21041
  fact: /* @__PURE__ */ __name((finding) => finding.statement, "fact"),
20626
21042
  task: /* @__PURE__ */ __name((finding) => finding.title, "task"),
@@ -20692,8 +21108,64 @@ var findingsKind = /* @__PURE__ */ __name((store) => {
20692
21108
  };
20693
21109
  }, "findingsKind");
20694
21110
 
20695
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/action.js
20696
- var rowOf2 = /* @__PURE__ */ __name((action2) => ({
21111
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/organization.js
21112
+ var ORGANIZATION_ADD_KIND = "organization_add";
21113
+ var ORGANIZATION_RENAME_KIND = "organization_rename";
21114
+ var rowOf2 = /* @__PURE__ */ __name((action2) => {
21115
+ const renamed2 = action2.kind === ORGANIZATION_RENAME_KIND;
21116
+ const { name, kind } = action2.payload;
21117
+ const { organization } = action2.payload;
21118
+ return {
21119
+ id: action2.id,
21120
+ kind: "organization",
21121
+ status: actionStatus(action2.status),
21122
+ project: null,
21123
+ subject: renamed2 ? organization : "organization:new",
21124
+ object: null,
21125
+ summary: renamed2 ? `rename ${organization} to ${name}` : `add ${kind} ${name}`,
21126
+ proposedBy: proposerOfAction(action2),
21127
+ reason: action2.reason,
21128
+ evidence: [],
21129
+ score: null,
21130
+ signals: null,
21131
+ parts: null,
21132
+ createdAt: action2.createdAt
21133
+ };
21134
+ }, "rowOf");
21135
+ var organizationKind = /* @__PURE__ */ __name((store) => ({
21136
+ kind: "organization",
21137
+ stored: [ORGANIZATION_ADD_KIND, ORGANIZATION_RENAME_KIND],
21138
+ list: /* @__PURE__ */ __name(async (filter) => {
21139
+ const status = storedStatus(filter);
21140
+ const actions = await store.proposedActions.list({
21141
+ kinds: [ORGANIZATION_ADD_KIND, ORGANIZATION_RENAME_KIND],
21142
+ ...status === void 0 ? {} : { status },
21143
+ ...pushed2(filter)
21144
+ });
21145
+ return kept(actions.map(rowOf2), filter);
21146
+ }, "list"),
21147
+ get: /* @__PURE__ */ __name(async (id2) => rowOf2(await store.proposedActions.get(id2)), "get"),
21148
+ decide: /* @__PURE__ */ __name(async (id2, { confirm, by, reason }) => {
21149
+ if (!confirm) {
21150
+ await store.proposedActions.reject(id2, by, reason);
21151
+ return { id: id2, kind: "organization", status: "rejected", made: [] };
21152
+ }
21153
+ const action2 = await store.proposedActions.get(id2);
21154
+ if (action2.kind === ORGANIZATION_RENAME_KIND) {
21155
+ const { organization, name: name2 } = action2.payload;
21156
+ const renamed2 = await store.knowledge.updateOrganization(organization, { name: name2 });
21157
+ await store.proposedActions.approve(id2, by, { organization: renamed2.ref });
21158
+ return { id: id2, kind: "organization", status: "confirmed", made: [] };
21159
+ }
21160
+ const { name, kind, scope } = action2.payload;
21161
+ const made = await store.knowledge.addOrganization({ name, kind, ...scope === void 0 ? {} : { scope } });
21162
+ await store.proposedActions.approve(id2, by, { organization: made.ref });
21163
+ return { id: id2, kind: "organization", status: "confirmed", made: [made.ref] };
21164
+ }, "decide")
21165
+ }), "organizationKind");
21166
+
21167
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/action.js
21168
+ var rowOf3 = /* @__PURE__ */ __name((action2) => ({
20697
21169
  id: action2.id,
20698
21170
  kind: "action",
20699
21171
  status: actionStatus(action2.status),
@@ -20719,9 +21191,9 @@ var actionKind = /* @__PURE__ */ __name((store, claimed) => ({
20719
21191
  ...status === void 0 ? {} : { status },
20720
21192
  ...pushed2(filter)
20721
21193
  });
20722
- return kept(actions.map(rowOf2), filter);
21194
+ return kept(actions.map(rowOf3), filter);
20723
21195
  }, "list"),
20724
- get: /* @__PURE__ */ __name(async (id2) => rowOf2(await store.proposedActions.get(id2)), "get"),
21196
+ get: /* @__PURE__ */ __name(async (id2) => rowOf3(await store.proposedActions.get(id2)), "get"),
20725
21197
  decide: /* @__PURE__ */ __name(async (id2, { confirm, by, reason }) => {
20726
21198
  if (!confirm) {
20727
21199
  await store.proposedActions.reject(id2, by, reason);
@@ -20732,7 +21204,16 @@ var actionKind = /* @__PURE__ */ __name((store, claimed) => ({
20732
21204
  }, "decide")
20733
21205
  }), "actionKind");
20734
21206
 
20735
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/fact.js
21207
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/contracts.js
21208
+ var contractKind = /* @__PURE__ */ __name((store) => reviewedKind({
21209
+ type: "contract",
21210
+ list: /* @__PURE__ */ __name((options) => store.contracts.list(options), "list"),
21211
+ get: /* @__PURE__ */ __name((id2) => store.contracts.get(id2), "get"),
21212
+ row: /* @__PURE__ */ __name((contract) => reviewedRow("contract", contract, contract.deal), "row"),
21213
+ decide: /* @__PURE__ */ __name(async (id2, confirm, { by, reason }) => (confirm ? await store.contracts.confirm(id2, by, reason) : await store.contracts.reject(id2, by, reason)).ref, "decide")
21214
+ }), "contractKind");
21215
+
21216
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/fact.js
20736
21217
  var STATUS = {
20737
21218
  proposed: "proposed",
20738
21219
  accepted: "confirmed",
@@ -20740,7 +21221,7 @@ var STATUS = {
20740
21221
  reversed: "confirmed",
20741
21222
  rejected: "rejected"
20742
21223
  };
20743
- var rowOf3 = /* @__PURE__ */ __name((fact) => ({
21224
+ var rowOf4 = /* @__PURE__ */ __name((fact) => ({
20744
21225
  id: fact.ref,
20745
21226
  kind: "fact",
20746
21227
  status: STATUS[fact.status],
@@ -20766,51 +21247,32 @@ var factKind = /* @__PURE__ */ __name((store) => ({
20766
21247
  ...status === "all" ? {} : { status: status === "confirmed" ? "accepted" : status },
20767
21248
  order: "created"
20768
21249
  });
20769
- return kept(facts.map(rowOf3), filter);
21250
+ return kept(facts.map(rowOf4), filter);
20770
21251
  }, "list"),
20771
- get: /* @__PURE__ */ __name(async (id2) => rowOf3(await store.facts.get(id2)), "get"),
21252
+ get: /* @__PURE__ */ __name(async (id2) => rowOf4(await store.facts.get(id2)), "get"),
20772
21253
  decide: /* @__PURE__ */ __name(async (id2, { confirm, by, reason }) => {
20773
21254
  const fact = confirm ? await store.facts.accept(id2, by, reason) : await store.facts.reject(id2, by, reason);
20774
21255
  return { id: id2, kind: "fact", status: confirm ? "confirmed" : "rejected", made: confirm ? [fact.ref] : [] };
20775
21256
  }, "decide")
20776
21257
  }), "factKind");
20777
21258
 
20778
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/finance.js
20779
- var rowOf4 = /* @__PURE__ */ __name((kind, entry) => ({
20780
- id: entry.ref,
20781
- kind,
20782
- status: entry.review,
20783
- project: entry.project,
20784
- subject: entry.ref,
20785
- object: "counterparty" in entry ? entry.counterparty.ref : (entry.direction === "in" ? entry.payer : entry.payee)?.ref ?? null,
20786
- summary: entry.title,
20787
- proposedBy: proposerOfAuthor(entry.author),
20788
- reason: entry.reason,
20789
- evidence: [],
20790
- score: null,
20791
- signals: null,
20792
- parts: null,
20793
- createdAt: entry.createdAt
20794
- }), "rowOf");
20795
- var financeKind = /* @__PURE__ */ __name((store, kind) => ({
20796
- kind,
20797
- prefix: kind,
20798
- list: /* @__PURE__ */ __name(async (filter) => {
20799
- const status = filter.status ?? "proposed";
20800
- const options = { ...pushed2(filter), ...status === "all" ? {} : { review: status } };
20801
- const entries = kind === "invoice" ? await store.finance.invoices(options) : await store.finance.payments(options);
20802
- return kept(entries.map((entry) => rowOf4(kind, entry)), filter);
20803
- }, "list"),
20804
- get: /* @__PURE__ */ __name(async (id2) => rowOf4(kind, kind === "invoice" ? await store.finance.invoice(id2) : await store.finance.payment(id2)), "get"),
20805
- decide: /* @__PURE__ */ __name(async (id2, { confirm, by, reason }) => {
20806
- const entry = confirm ? await store.finance.confirm(id2, by, reason) : await store.finance.reject(id2, by, reason);
20807
- return { id: id2, kind, status: confirm ? "confirmed" : "rejected", made: confirm ? [entry.ref] : [] };
20808
- }, "decide")
20809
- }), "financeKind");
20810
- var invoiceKind = /* @__PURE__ */ __name((store) => financeKind(store, "invoice"), "invoiceKind");
20811
- var paymentKind = /* @__PURE__ */ __name((store) => financeKind(store, "payment"), "paymentKind");
21259
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/finance.js
21260
+ var invoiceKind = /* @__PURE__ */ __name((store) => reviewedKind({
21261
+ type: "invoice",
21262
+ list: /* @__PURE__ */ __name((options) => store.finance.invoices(options), "list"),
21263
+ get: /* @__PURE__ */ __name((id2) => store.finance.invoice(id2), "get"),
21264
+ row: /* @__PURE__ */ __name((invoice) => reviewedRow("invoice", invoice, invoice.counterparty.ref), "row"),
21265
+ decide: /* @__PURE__ */ __name(async (id2, confirm, { by, reason }) => (confirm ? await store.finance.confirm(id2, by, reason) : await store.finance.reject(id2, by, reason)).ref, "decide")
21266
+ }), "invoiceKind");
21267
+ var paymentKind = /* @__PURE__ */ __name((store) => reviewedKind({
21268
+ type: "payment",
21269
+ list: /* @__PURE__ */ __name((options) => store.finance.payments(options), "list"),
21270
+ get: /* @__PURE__ */ __name((id2) => store.finance.payment(id2), "get"),
21271
+ row: /* @__PURE__ */ __name((payment) => reviewedRow("payment", payment, (payment.direction === "in" ? payment.payer : payment.payee)?.ref ?? null), "row"),
21272
+ decide: /* @__PURE__ */ __name(async (id2, confirm, { by, reason }) => (confirm ? await store.finance.confirm(id2, by, reason) : await store.finance.reject(id2, by, reason)).ref, "decide")
21273
+ }), "paymentKind");
20812
21274
 
20813
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/key-document.js
21275
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/key-document.js
20814
21276
  var linkRow = /* @__PURE__ */ __name((link4) => ({
20815
21277
  id: `key:${link4.id}`,
20816
21278
  kind: "key_document",
@@ -20878,7 +21340,8 @@ var keyDocumentKind = /* @__PURE__ */ __name((store) => {
20878
21340
  };
20879
21341
  }, "keyDocumentKind");
20880
21342
 
20881
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/mail-findings.js
21343
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/mail-findings.js
21344
+ var words3 = /* @__PURE__ */ __name((...parts) => parts.filter(Boolean).join(" "), "words");
20882
21345
  var summaryOf = /* @__PURE__ */ __name((finding) => {
20883
21346
  switch (finding.kind) {
20884
21347
  case "task":
@@ -20893,6 +21356,14 @@ var summaryOf = /* @__PURE__ */ __name((finding) => {
20893
21356
  return `${finding.from} \u2192 ${finding.to}`;
20894
21357
  case "new_contact":
20895
21358
  return `${finding.name} <${finding.address}>`;
21359
+ case "invoice":
21360
+ return words3("invoice", finding.number, finding.total, finding.currency, finding.counterpartyName, `\xB7 ${finding.reason}`);
21361
+ case "payment":
21362
+ return words3("payment", finding.amount, finding.currency, finding.date, `\xB7 ${finding.reason}`);
21363
+ case "order":
21364
+ return words3("order", finding.number, finding.supplierName, finding.status ?? "placed", `\xB7 ${finding.reason}`);
21365
+ case "order_update":
21366
+ return words3("order", finding.number, finding.supplierName, finding.status, `\xB7 ${finding.reason}`);
20896
21367
  }
20897
21368
  }, "summaryOf");
20898
21369
  var rowOf5 = /* @__PURE__ */ __name((batch, createdAt) => {
@@ -20957,7 +21428,7 @@ var mailFindingsKind = /* @__PURE__ */ __name((store) => {
20957
21428
  };
20958
21429
  }, "mailFindingsKind");
20959
21430
 
20960
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/meeting-findings.js
21431
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/meeting-findings.js
20961
21432
  var rowOf6 = /* @__PURE__ */ __name((action2, batch) => {
20962
21433
  const findings = batch.input.findings;
20963
21434
  const projects = [...new Set(findings.map((one2) => "project" in one2 ? one2.project : void 0))];
@@ -21021,7 +21492,7 @@ var meetingFindingsKind = /* @__PURE__ */ __name((store) => {
21021
21492
  };
21022
21493
  }, "meetingFindingsKind");
21023
21494
 
21024
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/memory.js
21495
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/memory.js
21025
21496
  var STATUS2 = {
21026
21497
  proposed: "proposed",
21027
21498
  confirmed: "confirmed",
@@ -21062,7 +21533,16 @@ var memoryKind = /* @__PURE__ */ __name((store) => ({
21062
21533
  }, "decide")
21063
21534
  }), "memoryKind");
21064
21535
 
21065
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/relationship.js
21536
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/orders.js
21537
+ var orderKind = /* @__PURE__ */ __name((store) => reviewedKind({
21538
+ type: "order",
21539
+ list: /* @__PURE__ */ __name((options) => store.orders.list(options), "list"),
21540
+ get: /* @__PURE__ */ __name((id2) => store.orders.get(id2), "get"),
21541
+ row: /* @__PURE__ */ __name((order) => reviewedRow("order", order, order.supplier?.ref ?? null), "row"),
21542
+ decide: /* @__PURE__ */ __name(async (id2, confirm, { by, reason }) => (confirm ? await store.orders.confirm(id2, by, reason) : await store.orders.reject(id2, by, reason)).ref, "decide")
21543
+ }), "orderKind");
21544
+
21545
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/relationship.js
21066
21546
  var linkRow2 = /* @__PURE__ */ __name((link4) => ({
21067
21547
  id: `link:${link4.id}`,
21068
21548
  kind: "relationship",
@@ -21136,7 +21616,7 @@ var relationshipKind = /* @__PURE__ */ __name((store) => {
21136
21616
  };
21137
21617
  }, "relationshipKind");
21138
21618
 
21139
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/relationship-update.js
21619
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/relationship-update.js
21140
21620
  var KIND2 = "relationship_update";
21141
21621
  var summaryOf2 = /* @__PURE__ */ __name(({ changes }) => Object.entries(changes).map(([field, value]) => `${field} ${value ?? "cleared"}`).join(", "), "summaryOf");
21142
21622
  var rowOf8 = /* @__PURE__ */ __name((action2) => {
@@ -21186,8 +21666,70 @@ var relationshipUpdateKind = /* @__PURE__ */ __name((store) => ({
21186
21666
  }, "decide")
21187
21667
  }), "relationshipUpdateKind");
21188
21668
 
21189
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/task-close.js
21190
- var rowOf9 = /* @__PURE__ */ __name((task2) => {
21669
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/source-review.js
21670
+ var rowOf9 = /* @__PURE__ */ __name((action2) => {
21671
+ const payload = action2.payload;
21672
+ const sources = payload.sources.flatMap((source) => source.ref ?? []);
21673
+ const contradicting = payload.challenges.flatMap((challenge) => challenge.evidence);
21674
+ const replacement = payload.sources.find((source) => source.replacement !== void 0)?.replacement ?? null;
21675
+ return {
21676
+ id: action2.id,
21677
+ kind: SOURCE_REVIEW_KIND,
21678
+ status: actionStatus(action2.status),
21679
+ project: null,
21680
+ subject: action2.target ?? payload.target,
21681
+ object: replacement,
21682
+ summary: `${payload.cause}: ${payload.sources.length} source(s), ${payload.challenges.length} challenge(s)`,
21683
+ proposedBy: proposerOfAction(action2),
21684
+ reason: payload.challenges.at(-1)?.reason ?? action2.reason,
21685
+ evidence: [.../* @__PURE__ */ new Set([...sources, ...contradicting])].slice(0, 5),
21686
+ score: null,
21687
+ signals: null,
21688
+ parts: null,
21689
+ createdAt: payload.raisedAt
21690
+ };
21691
+ }, "rowOf");
21692
+ var sourceReviewKind = /* @__PURE__ */ __name((store) => ({
21693
+ kind: SOURCE_REVIEW_KIND,
21694
+ stored: [SOURCE_REVIEW_KIND],
21695
+ ownerOnly: true,
21696
+ list: /* @__PURE__ */ __name(async (filter) => {
21697
+ const status = storedStatus(filter);
21698
+ const stored = await store.proposedActions.list({
21699
+ kinds: [SOURCE_REVIEW_KIND],
21700
+ ...status === void 0 ? {} : { status },
21701
+ ...pushed2(filter)
21702
+ });
21703
+ return kept(stored.map(rowOf9), filter);
21704
+ }, "list"),
21705
+ get: /* @__PURE__ */ __name(async (id2) => rowOf9(await store.proposedActions.get(id2)), "get"),
21706
+ decide: /* @__PURE__ */ __name(async (id2, { confirm, by, reason }) => {
21707
+ await store.knowledge.decideSourceReview(id2, { confirm, by, ...reason === void 0 ? {} : { reason } });
21708
+ return { id: id2, kind: SOURCE_REVIEW_KIND, status: confirm ? "confirmed" : "rejected", made: [] };
21709
+ }, "decide")
21710
+ }), "sourceReviewKind");
21711
+
21712
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/subscriptions.js
21713
+ var subscriptionKind = /* @__PURE__ */ __name((store) => reviewedKind({
21714
+ type: "subscription",
21715
+ list: /* @__PURE__ */ __name((options) => store.subscriptions.list(options), "list"),
21716
+ get: /* @__PURE__ */ __name((id2) => store.subscriptions.get(id2), "get"),
21717
+ row: /* @__PURE__ */ __name((subscription) => reviewedRow("subscription", subscription, (subscription.direction === "receivable" ? subscription.customer : subscription.supplier).ref), "row"),
21718
+ decide: /* @__PURE__ */ __name(async (id2, confirm, { by, reason }) => (confirm ? await store.subscriptions.confirm(id2, by, reason) : await store.subscriptions.reject(id2, by, reason)).ref, "decide")
21719
+ }), "subscriptionKind");
21720
+ var subscriptionPriceKind = /* @__PURE__ */ __name((store) => reviewedKind({
21721
+ type: "subscription_price",
21722
+ list: /* @__PURE__ */ __name(({ review, proposedBy, limit }) => store.subscriptions.prices({ review, proposedBy, limit }), "list"),
21723
+ get: /* @__PURE__ */ __name((id2) => store.subscriptions.price(id2), "get"),
21724
+ row: /* @__PURE__ */ __name((price) => reviewedRow("subscription_price", price, price.subscription), "row"),
21725
+ decide: /* @__PURE__ */ __name(async (id2, confirm, { by, reason }) => {
21726
+ await (confirm ? store.subscriptions.confirm(id2, by, reason) : store.subscriptions.reject(id2, by, reason));
21727
+ return id2;
21728
+ }, "decide")
21729
+ }), "subscriptionPriceKind");
21730
+
21731
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/task-close.js
21732
+ var rowOf10 = /* @__PURE__ */ __name((task2) => {
21191
21733
  const suggestion = task2.closeSuggestion;
21192
21734
  if (suggestion === null)
21193
21735
  return void 0;
@@ -21212,7 +21754,7 @@ var taskCloseKind = /* @__PURE__ */ __name((store) => {
21212
21754
  const taskOf = /* @__PURE__ */ __name(async (id2) => {
21213
21755
  const key = id2.slice("close:".length);
21214
21756
  const task2 = await store.tasks.details(key).catch(() => void 0);
21215
- const row = task2 && rowOf9(task2);
21757
+ const row = task2 && rowOf10(task2);
21216
21758
  if (!task2 || !row)
21217
21759
  throw new CliError("not_found", `no close waits on task ${key}`);
21218
21760
  return { task: task2, row };
@@ -21229,7 +21771,7 @@ var taskCloseKind = /* @__PURE__ */ __name((store) => {
21229
21771
  where: { sql: "t.close_suggested_as IS NOT NULL", params: [] },
21230
21772
  limit: filter.offset + filter.limit
21231
21773
  });
21232
- return kept(tasks.flatMap((task2) => rowOf9(task2) ?? []), { ...filter, limit: filter.offset + filter.limit });
21774
+ return kept(tasks.flatMap((task2) => rowOf10(task2) ?? []), { ...filter, limit: filter.offset + filter.limit });
21233
21775
  }, "list"),
21234
21776
  get: /* @__PURE__ */ __name(async (id2) => (await taskOf(id2)).row, "get"),
21235
21777
  decide: /* @__PURE__ */ __name(async (id2, { confirm, by, reason }) => {
@@ -21254,7 +21796,16 @@ var taskCloseKind = /* @__PURE__ */ __name((store) => {
21254
21796
  };
21255
21797
  }, "taskCloseKind");
21256
21798
 
21257
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/proposals/registry.js
21799
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/proposals/kinds/transactions.js
21800
+ var transactionKind = /* @__PURE__ */ __name((store) => reviewedKind({
21801
+ type: "transaction",
21802
+ list: /* @__PURE__ */ __name((options) => store.transactions.list(options), "list"),
21803
+ get: /* @__PURE__ */ __name((id2) => store.transactions.get(id2), "get"),
21804
+ row: /* @__PURE__ */ __name((transaction) => reviewedRow("transaction", transaction, transaction.counterparty?.ref ?? transaction.wallet), "row"),
21805
+ decide: /* @__PURE__ */ __name(async (id2, confirm, { by, reason }) => (confirm ? await store.transactions.confirm(id2, by, reason) : await store.transactions.reject(id2, by, reason)).ref, "decide")
21806
+ }), "transactionKind");
21807
+
21808
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/proposals/registry.js
21258
21809
  var PREFIX = /^([a-z][a-z_]*):/;
21259
21810
  var marked = /* @__PURE__ */ __name((kind, row) => kind.ownerOnly ? { ...row, ownerOnly: true } : row, "marked");
21260
21811
  var refusalOf = /* @__PURE__ */ __name((id2, error) => {
@@ -21268,7 +21819,7 @@ var emptyProposalRegistry = /* @__PURE__ */ __name((store) => {
21268
21819
  const policy = store.decisionPolicy;
21269
21820
  const kinds = [];
21270
21821
  const claimed = /* @__PURE__ */ __name(() => kinds.flatMap((kind) => kind.stored ?? []), "claimed");
21271
- const kindOf4 = /* @__PURE__ */ __name(async (id2) => {
21822
+ const kindOf3 = /* @__PURE__ */ __name(async (id2) => {
21272
21823
  const prefix = PREFIX.exec(id2)?.[1];
21273
21824
  const found = prefix !== void 0 ? kinds.find((kind) => kind.prefix === prefix) : await (async () => {
21274
21825
  const stored = (await store.proposedActions.get(id2)).kind;
@@ -21300,7 +21851,7 @@ var emptyProposalRegistry = /* @__PURE__ */ __name((store) => {
21300
21851
  return { items: page.slice(0, filter.limit), hasMore: page.length > filter.limit };
21301
21852
  }, "list"),
21302
21853
  get: /* @__PURE__ */ __name(async (id2) => {
21303
- const kind = await kindOf4(id2);
21854
+ const kind = await kindOf3(id2);
21304
21855
  return marked(kind, await kind.get(id2));
21305
21856
  }, "get"),
21306
21857
  decide: /* @__PURE__ */ __name(async (ids, decision) => {
@@ -21330,7 +21881,7 @@ var emptyProposalRegistry = /* @__PURE__ */ __name((store) => {
21330
21881
  continue;
21331
21882
  }
21332
21883
  try {
21333
- const kind = await kindOf4(id2);
21884
+ const kind = await kindOf3(id2);
21334
21885
  if (chosen.length && !kind.parts) {
21335
21886
  refuseIds(id2, `a ${kind.kind} proposal has no parts; name ${id2} alone`);
21336
21887
  continue;
@@ -21345,9 +21896,9 @@ var emptyProposalRegistry = /* @__PURE__ */ __name((store) => {
21345
21896
  });
21346
21897
  continue;
21347
21898
  }
21348
- const refusal2 = mayDecide(row, decision.by, policy);
21349
- if (refusal2) {
21350
- refused.push(refusal2);
21899
+ const refusal3 = mayDecide(row, decision.by, policy);
21900
+ if (refusal3) {
21901
+ refused.push(refusal3);
21351
21902
  continue;
21352
21903
  }
21353
21904
  decided.push(await kind.decide(id2, chosen.length ? { ...decision, parts: chosen } : decision));
@@ -21369,18 +21920,25 @@ var proposalRegistry = /* @__PURE__ */ __name((store) => {
21369
21920
  factKind(store),
21370
21921
  invoiceKind(store),
21371
21922
  paymentKind(store),
21923
+ orderKind(store),
21924
+ contractKind(store),
21925
+ subscriptionKind(store),
21926
+ subscriptionPriceKind(store),
21927
+ transactionKind(store),
21928
+ organizationKind(store),
21372
21929
  memoryKind(store),
21373
21930
  findingsKind(store),
21374
21931
  mailFindingsKind(store),
21375
21932
  meetingFindingsKind(store),
21376
- taskCloseKind(store)
21933
+ taskCloseKind(store),
21934
+ sourceReviewKind(store)
21377
21935
  ])
21378
21936
  registry.register(kind);
21379
21937
  registry.register(actionKind(store, registry.claimed));
21380
21938
  return registry;
21381
21939
  }, "proposalRegistry");
21382
21940
 
21383
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/stored-meeting-project-candidate-validation.js
21941
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/stored-meeting-project-candidate-validation.js
21384
21942
  var storedCandidateRequest = /* @__PURE__ */ __name((reference, accountId, options) => {
21385
21943
  const invalid8 = /* @__PURE__ */ __name((field) => {
21386
21944
  throw new CliError("validation_error", `invalid stored project candidate ${field}`);
@@ -21422,7 +21980,7 @@ var storedCandidateRequest = /* @__PURE__ */ __name((reference, accountId, optio
21422
21980
  return { reference, limits, after, afterTranscriptId, signal };
21423
21981
  }, "storedCandidateRequest");
21424
21982
 
21425
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/stored-meeting-project-candidates.js
21983
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/stored-meeting-project-candidates.js
21426
21984
  var createStoredMeetingProjectCandidateReader = /* @__PURE__ */ __name((scope, accountId, ports) => {
21427
21985
  const fixed = snapshotMeetingScope(scope);
21428
21986
  const store = ports?.meetings;
@@ -21514,7 +22072,7 @@ var createStoredMeetingProjectCandidateReader = /* @__PURE__ */ __name((scope, a
21514
22072
  };
21515
22073
  }, "createStoredMeetingProjectCandidateReader");
21516
22074
 
21517
- // node_modules/.pnpm/@wirecat+cli-core@0.566.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_2c70ab84360472ff0036a7904a884c42/node_modules/@wirecat/cli-core/dist/services/index.js
22075
+ // node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_835308f42ae01aacd71fad942c0d0dc0/node_modules/@wirecat/cli-core/dist/services/index.js
21518
22076
  var servicesFor = /* @__PURE__ */ __name((deps) => {
21519
22077
  const pictures = picturesService(deps);
21520
22078
  const base = {
@@ -21618,6 +22176,9 @@ export {
21618
22176
  createContextEvidenceReader,
21619
22177
  excerpt,
21620
22178
  ingest,
22179
+ jsonlLines,
22180
+ ingestLines,
22181
+ ingestVcard,
21621
22182
  aliasHits,
21622
22183
  chatSenders,
21623
22184
  chatTitle,
@@ -21711,6 +22272,7 @@ export {
21711
22272
  sendAsCheck,
21712
22273
  typedSendAs,
21713
22274
  TOTAL_CAP,
22275
+ questionLookup,
21714
22276
  THREAD_BOUNDS,
21715
22277
  readThreadContext,
21716
22278
  MAX_SEARCH_OFFSET,
@@ -21828,6 +22390,8 @@ export {
21828
22390
  approveAsTask,
21829
22391
  parseProposalIds,
21830
22392
  FACT_SUMMARIES,
22393
+ ORGANIZATION_ADD_KIND,
22394
+ ORGANIZATION_RENAME_KIND,
21831
22395
  emptyProposalRegistry,
21832
22396
  proposalRegistry,
21833
22397
  createStoredMeetingProjectCandidateReader,