@wirecat/tg-cli 0.128.0 → 0.129.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 (125) hide show
  1. package/contracts/wirecat.json +26 -0
  2. package/dist/bin/tg.js +2 -2
  3. package/dist/bundle/{adapter-JOI34QLS.js → adapter-2XFPXBTA.js} +60 -52
  4. package/dist/bundle/{all-profiles-2BZEE7J2.js → all-profiles-GXFPZLYU.js} +9 -9
  5. package/dist/bundle/{anthropic-NW7DL3S3.js → anthropic-FHS5XNK5.js} +5 -5
  6. package/dist/bundle/{app-server-RUTYKELF.js → app-server-IZMFSFP2.js} +54 -46
  7. package/dist/bundle/{bot-api-DW6NAZAQ.js → bot-api-LQP75V5I.js} +61 -53
  8. package/dist/bundle/{bot-history-FAJ2W42U.js → bot-history-EJQOD4AQ.js} +22 -18
  9. package/dist/bundle/{bun-IVP5LSVI.js → bun-GBAZFRCV.js} +2 -2
  10. package/dist/bundle/{bun-sqlite-ATPCJ4CT.js → bun-sqlite-JB4BX6X7.js} +6 -6
  11. package/dist/bundle/chunk-2JZJPVBH.js +334 -0
  12. package/dist/bundle/{chunk-FHGAJK4I.js → chunk-2LPODKIF.js} +15 -15
  13. package/dist/bundle/chunk-3KZG63EH.js +170 -0
  14. package/dist/bundle/chunk-3XMUP55N.js +372 -0
  15. package/dist/bundle/{chunk-MDGLKMLD.js → chunk-4BJAQNJ5.js} +9 -9
  16. package/dist/bundle/{chunk-M4OP5ASJ.js → chunk-66PL7P4C.js} +1 -1
  17. package/dist/bundle/{chunk-MOUPWPNL.js → chunk-66UG67CE.js} +12 -12
  18. package/dist/bundle/{chunk-R4QVV3LN.js → chunk-6JBRQ6PM.js} +41 -19
  19. package/dist/bundle/{chunk-GYO4WXLG.js → chunk-6M3FAHPS.js} +3 -3
  20. package/dist/bundle/{chunk-2QHIOPSA.js → chunk-7F3LOHRB.js} +261 -501
  21. package/dist/bundle/{chunk-XS5C5TQ7.js → chunk-AUNNJDVD.js} +25 -8
  22. package/dist/bundle/{chunk-7D6LI2N7.js → chunk-B5RGPZDZ.js} +7 -7
  23. package/dist/bundle/{chunk-YRZXOQOB.js → chunk-B6NQJAUC.js} +2 -2
  24. package/dist/bundle/{chunk-IV2KJQ5F.js → chunk-BMSS3PCY.js} +58 -33
  25. package/dist/bundle/{chunk-LTADKMP5.js → chunk-C4ALE7CH.js} +1 -1
  26. package/dist/bundle/{chunk-WG3BF7SA.js → chunk-CKJ73EF3.js} +1 -1
  27. package/dist/bundle/{chunk-IX3GUNGV.js → chunk-CLG2ISQH.js} +4 -4
  28. package/dist/bundle/{chunk-G3PL3R45.js → chunk-EB2JE722.js} +1 -1
  29. package/dist/bundle/{chunk-J3SX36NE.js → chunk-EUL7HMUL.js} +2 -2
  30. package/dist/bundle/{chunk-PJA43HVE.js → chunk-F6CV4KUN.js} +2 -2
  31. package/dist/bundle/{chunk-7KCBPAQS.js → chunk-F6MLJ3V5.js} +2 -2
  32. package/dist/bundle/{chunk-3UGRMFWK.js → chunk-FH4YIBBH.js} +4 -4
  33. package/dist/bundle/chunk-FIO5NMK3.js +771 -0
  34. package/dist/bundle/{chunk-7I5NMVX7.js → chunk-G2SMVYBU.js} +2 -2
  35. package/dist/bundle/{chunk-FIVFP53N.js → chunk-GA3URWIF.js} +1 -1
  36. package/dist/bundle/{chunk-2A3TC52A.js → chunk-GGGBPWUS.js} +10 -15
  37. package/dist/bundle/{chunk-KKZQK6IK.js → chunk-GSHTLLCJ.js} +2 -2
  38. package/dist/bundle/{chunk-F4UIBEQK.js → chunk-GYCKRIRK.js} +3 -3
  39. package/dist/bundle/{chunk-WPMJQIEU.js → chunk-HHUK3XO5.js} +1 -1
  40. package/dist/bundle/{chunk-NM5GBJME.js → chunk-HT6OFANN.js} +19 -19
  41. package/dist/bundle/{chunk-ODBK56ZR.js → chunk-I5PILOTU.js} +1 -1
  42. package/dist/bundle/chunk-IBSHQWIJ.js +29 -0
  43. package/dist/bundle/{chunk-RZFIQMOA.js → chunk-IRWSZJYL.js} +60 -58
  44. package/dist/bundle/{chunk-BVCRDHI2.js → chunk-IV6SIKVH.js} +4 -4
  45. package/dist/bundle/{chunk-URFBZNLU.js → chunk-JUFLELQ7.js} +2 -2
  46. package/dist/bundle/{chunk-XYAH6QQO.js → chunk-KY3JLXW2.js} +4 -4
  47. package/dist/bundle/{chunk-YSXDCSBP.js → chunk-LPT5T6PU.js} +29 -30
  48. package/dist/bundle/chunk-LQPZDDDP.js +259 -0
  49. package/dist/bundle/{chunk-JI2PFQFL.js → chunk-M327UNS6.js} +6 -6
  50. package/dist/bundle/{chunk-SDLJJF7E.js → chunk-MS6YEIG5.js} +13 -13
  51. package/dist/bundle/{chunk-WMUPZ3IY.js → chunk-MVFSWKTM.js} +12 -12
  52. package/dist/bundle/{chunk-YVV5S2QA.js → chunk-NRCY3WBC.js} +2 -2
  53. package/dist/bundle/{chunk-2IL4YDGG.js → chunk-O2ULG7OO.js} +3 -3
  54. package/dist/bundle/{chunk-E56QE3UC.js → chunk-OJMDKWWL.js} +627 -503
  55. package/dist/bundle/{chunk-UURJO46N.js → chunk-OKTRB4ZQ.js} +1 -1
  56. package/dist/bundle/{chunk-OX6574YV.js → chunk-OOQVHMCS.js} +15 -15
  57. package/dist/bundle/{chunk-IIHCSJV2.js → chunk-OWVQMK7G.js} +700 -837
  58. package/dist/bundle/{chunk-WMF6SL5D.js → chunk-P4FZJO5F.js} +2 -2
  59. package/dist/bundle/{chunk-LD42OGKK.js → chunk-PS7ZS5HD.js} +4 -4
  60. package/dist/bundle/{chunk-EAUHYQUK.js → chunk-PWQKGFS2.js} +36 -34
  61. package/dist/bundle/{chunk-MGBVVQTU.js → chunk-QBNEWEJC.js} +3 -3
  62. package/dist/bundle/{chunk-QYN5RDTZ.js → chunk-QDEP2QOA.js} +3 -3
  63. package/dist/bundle/{chunk-QO4ON2X7.js → chunk-QFVIHBLD.js} +1 -1
  64. package/dist/bundle/{chunk-ZVLYK6CZ.js → chunk-QJDHRBXL.js} +7 -7
  65. package/dist/bundle/{chunk-IHLNXL2D.js → chunk-QJLCEOAP.js} +1 -1
  66. package/dist/bundle/{chunk-KF2Q776U.js → chunk-RAFK5KXU.js} +9 -9
  67. package/dist/bundle/{chunk-RIGNCUZD.js → chunk-RPWYTOLI.js} +5 -5
  68. package/dist/bundle/{chunk-4DSIGS2E.js → chunk-RZPMFVWM.js} +6 -6
  69. package/dist/bundle/chunk-S5UTBEV3.js +1974 -0
  70. package/dist/bundle/{chunk-MC6FOTCV.js → chunk-SYZXOEHY.js} +3 -3
  71. package/dist/bundle/{chunk-5AP25FMW.js → chunk-SZB5WRMI.js} +2 -2
  72. package/dist/bundle/{chunk-Q3ZO6Q3M.js → chunk-TGRB4SSZ.js} +4 -4
  73. package/dist/bundle/{chunk-TQFUAKU6.js → chunk-VSPSHBAC.js} +2 -2
  74. package/dist/bundle/{chunk-TGUXKG4B.js → chunk-VTJ3AOTT.js} +17 -17
  75. package/dist/bundle/{chunk-T2CWSFGY.js → chunk-VXWDQDRU.js} +6341 -6902
  76. package/dist/bundle/{chunk-JJGPU24U.js → chunk-X5H5NERR.js} +6 -6
  77. package/dist/bundle/{chunk-AF2XVV5P.js → chunk-XHX5D5VE.js} +727 -2598
  78. package/dist/bundle/chunk-XXW6PFAX.js +16 -0
  79. package/dist/bundle/{chunk-NXDQXDRN.js → chunk-ZRQQOGAZ.js} +4 -4
  80. package/dist/bundle/command-contract-G752BLKA.js +37 -0
  81. package/dist/bundle/{command-server-entry-BU3X4XNL.js → command-server-entry-YR6ONDWO.js} +27 -24
  82. package/dist/bundle/decode-VUKGWFSW.js +296 -0
  83. package/dist/bundle/{dispatch-PRAIGIFS.js → dispatch-ST5FK2KI.js} +8 -8
  84. package/dist/bundle/{echarts-NAXLKJLA.js → echarts-GOV5M733.js} +2 -2
  85. package/dist/bundle/{embed-LB6ONWHX.js → embed-2IVIYNAJ.js} +6 -6
  86. package/dist/bundle/{embedder-WE7B2RU5.js → embedder-2HU7JYZK.js} +9 -9
  87. package/dist/bundle/{entry-W6Y52ZRN.js → entry-CSTCXYI5.js} +9 -9
  88. package/dist/bundle/{failure-7Y34AUJT.js → failure-GMUQKQ5K.js} +2 -2
  89. package/dist/bundle/{first-run-NVYNZZA6.js → first-run-3IZGXZT5.js} +12 -11
  90. package/dist/bundle/first-screen-7QSNCZIK.js +35 -0
  91. package/dist/bundle/{instructions-MRUC57NS.js → instructions-YSXV6FAC.js} +1 -1
  92. package/dist/bundle/{mcp-TDKGDB4V.js → mcp-VFIOZDVY.js} +2 -2
  93. package/dist/bundle/meeting-combined-X4E3LSIJ.js +23 -0
  94. package/dist/bundle/meeting-model-FQBDHGRU.js +24 -0
  95. package/dist/bundle/meeting-semantic-ONNEOJX5.js +21 -0
  96. package/dist/bundle/{node-G7PMDYQV.js → node-FMQWCZRS.js} +2 -2
  97. package/dist/bundle/{node-sqlite-RXWQ3SES.js → node-sqlite-YN5OKOC6.js} +7 -7
  98. package/dist/bundle/{oauth-6ZWOL6KX.js → oauth-EW7PTZVT.js} +7 -7
  99. package/dist/bundle/{open-V7LMZCFI.js → open-Q2RDY344.js} +5 -5
  100. package/dist/bundle/{openai-P472V4ZM.js → openai-STON6G3O.js} +28 -26
  101. package/dist/bundle/{process-GSNPENHL.js → process-OQUC2TW3.js} +1 -1
  102. package/dist/bundle/{program-IELITPKT.js → program-7JJHTZ25.js} +66 -57
  103. package/dist/bundle/{prompt-2CP6CQ5N.js → prompt-WHVF7UTW.js} +5 -5
  104. package/dist/bundle/{proxy-transport-DP7SIMIC.js → proxy-transport-A4MRO3PF.js} +5 -5
  105. package/dist/bundle/{recognize-R2DEQ5TC.js → recognize-YDQWMXNI.js} +4 -4
  106. package/dist/bundle/{remote-JG3POFES.js → remote-477LQHP6.js} +9 -9
  107. package/dist/bundle/{rerank-TVMR3OLL.js → rerank-4YPB26FG.js} +7 -7
  108. package/dist/bundle/{serve-DBWSMLPH.js → serve-FXJNUOTS.js} +9 -9
  109. package/dist/bundle/{server-EXJ2WNZY.js → server-2S6HFBGR.js} +44 -36
  110. package/dist/bundle/server-UOSUTZNE.js +69 -0
  111. package/dist/bundle/{sqlite-runtime-AWMY7W4Q.js → sqlite-runtime-RXYNJYMC.js} +6 -6
  112. package/dist/bundle/{state-HN44BWNQ.js → state-I2GGYGRL.js} +6 -6
  113. package/dist/bundle/{store-LOVKYQDC.js → store-KX3AAQZH.js} +25 -20
  114. package/dist/bundle/{store-GIYS3LHV.js → store-VQXIB6KV.js} +17 -13
  115. package/dist/bundle/store-maintenance-command-LW2MMDLY.js +60 -0
  116. package/dist/bundle/tg.js +13 -13
  117. package/dist/version.d.ts +1 -1
  118. package/dist/version.js +1 -1
  119. package/package.json +3 -3
  120. package/dist/bundle/command-contract-3BSXDYBC.js +0 -34
  121. package/dist/bundle/decode-NXB7E46F.js +0 -162
  122. package/dist/bundle/first-screen-Z6TVHK6I.js +0 -32
  123. package/dist/bundle/server-SXNFFAIR.js +0 -61
  124. package/dist/bundle/store-maintenance-command-X3VOYNCG.js +0 -52
  125. /package/dist/bundle/{chunk-XWBPP2HX.js → chunk-ZI3YTXSF.js} +0 -0
@@ -8,16 +8,27 @@ import {
8
8
  sameOrdinaryFile,
9
9
  syncDirectory,
10
10
  writeFileAtomic
11
- } from "./chunk-SDLJJF7E.js";
11
+ } from "./chunk-MS6YEIG5.js";
12
+ import {
13
+ anyOfTerms,
14
+ isFunctionWord,
15
+ joinedHyphens,
16
+ lookupTerms,
17
+ planQuestion,
18
+ questionLookup,
19
+ questionText,
20
+ resolveMeetingSelection,
21
+ words
22
+ } from "./chunk-3XMUP55N.js";
12
23
  import {
13
24
  isNewer,
14
25
  updateCommand
15
- } from "./chunk-LD42OGKK.js";
26
+ } from "./chunk-PS7ZS5HD.js";
16
27
  import {
17
28
  localOnly,
18
29
  refuseOffComputer,
19
30
  remoteKey
20
- } from "./chunk-KF2Q776U.js";
31
+ } from "./chunk-RAFK5KXU.js";
21
32
  import {
22
33
  Unzip,
23
34
  UnzipInflate,
@@ -28,7 +39,7 @@ import {
28
39
  placedText,
29
40
  runEmbedders,
30
41
  textModelsDirectory
31
- } from "./chunk-4DSIGS2E.js";
42
+ } from "./chunk-RZPMFVWM.js";
32
43
  import {
33
44
  AGENDA_COLUMNS,
34
45
  BUSINESS_FIND_MAX,
@@ -38,26 +49,24 @@ import {
38
49
  CONTEXT_MAX_READ_BYTES,
39
50
  CONVERSATION_COLUMNS,
40
51
  COUNTER_FIELDS,
41
- FIELD_VERSION,
42
52
  MAIL_AGENDA_COLUMNS,
43
53
  MAX_FILE_BYTES,
44
54
  MAX_TEXT_CHARS,
45
55
  MENTION_QUERY,
46
- MESSAGE_PARSING,
56
+ MINUTE,
47
57
  NOT_FILES,
48
58
  PRESET_VERSION,
49
- QUERY_LIMITS,
50
- QUERY_VERSION,
51
59
  RANKING_TOKENIZER_VERSION,
52
- SEARCH_QUERY,
60
+ STOP_WORDS,
53
61
  TASK_RELATION_KINDS,
54
62
  TRACKED_CHAT_COLUMNS,
55
63
  WORD_BODY,
64
+ YEAR,
65
+ aheadOf,
56
66
  amountsOf,
57
67
  attachmentColumns,
58
68
  attachmentMaxBytes,
59
69
  calendarKey,
60
- calendarMoment,
61
70
  certaintyOf,
62
71
  chatReferenceOf,
63
72
  chatsMatching,
@@ -74,7 +83,6 @@ import {
74
83
  displayName,
75
84
  dueDayOf,
76
85
  ensureAccount,
77
- exhausted,
78
86
  fetchedKey,
79
87
  foldedWords,
80
88
  googleDocumentLinks,
@@ -84,37 +92,50 @@ import {
84
92
  hitFiles,
85
93
  inboxKey,
86
94
  isId,
87
- isPresence,
88
- isQueryLimit,
89
95
  isStemmed,
90
96
  matchDownloads,
91
97
  messageOfEmail,
92
98
  nearest,
93
99
  normalizeVocabularyName,
94
100
  openStore,
95
- outOfTime,
96
101
  pdfPreviewLimits,
97
102
  peopleMatching,
98
103
  pickChat,
99
104
  pickPerson,
100
- plainQuery,
101
105
  profilesOn,
102
106
  queryFilter,
103
107
  rankingContextRange,
104
108
  rankingOptions,
105
109
  rankingQuestion,
106
- searchError,
110
+ readMoment,
107
111
  threadConversation,
108
- validateAst,
109
- validateFields,
110
112
  withoutField
111
- } from "./chunk-T2CWSFGY.js";
113
+ } from "./chunk-VXWDQDRU.js";
114
+ import {
115
+ FIELD_VERSION,
116
+ MESSAGE_PARSING,
117
+ QUERY_LIMITS,
118
+ QUERY_VERSION,
119
+ RRF_K,
120
+ SEARCH_QUERY,
121
+ exhausted,
122
+ fuseRanked,
123
+ isPresence,
124
+ isQueryLimit,
125
+ outOfTime,
126
+ plainQuery,
127
+ searchError,
128
+ validateAst,
129
+ validateFields
130
+ } from "./chunk-FIO5NMK3.js";
112
131
  import {
113
132
  DEFAULT_STEMMERS,
114
- createStemmer,
133
+ createStemmer
134
+ } from "./chunk-GGGBPWUS.js";
135
+ import {
115
136
  fold,
116
137
  normalize
117
- } from "./chunk-2A3TC52A.js";
138
+ } from "./chunk-XXW6PFAX.js";
118
139
  import {
119
140
  EmptyAnswer,
120
141
  MAX_MODEL_IMAGE_BYTES,
@@ -123,26 +144,22 @@ import {
123
144
  range,
124
145
  systemFor,
125
146
  validateImages
126
- } from "./chunk-3UGRMFWK.js";
147
+ } from "./chunk-FH4YIBBH.js";
127
148
  import {
128
149
  CEILING_KEY,
129
150
  Command,
130
- CustomTextModelShape,
151
+ DEFAULT_CONFIG,
131
152
  DEFAULT_IMAGE_MODEL,
132
- DEFAULT_RERANK_MODEL,
133
- DEFAULT_TEXT_MODEL,
134
153
  InvalidArgumentError,
135
154
  LEVELS,
136
155
  LINK,
137
156
  Option,
138
- PREVIOUS_DEFAULT_TEXT_MODEL,
139
157
  STORE_ONLY_KEYS,
140
158
  WEIGHTS,
141
159
  agenda,
142
160
  annotate,
143
161
  annotateOption,
144
162
  attachment,
145
- chosenTextModel,
146
163
  codeOf,
147
164
  conversation,
148
165
  environmentOf,
@@ -155,14 +172,11 @@ import {
155
172
  keyForWrite,
156
173
  levelFor,
157
174
  listOf,
158
- meaningFloor,
159
175
  nextStep,
160
176
  oddName,
161
177
  parseDuration,
162
178
  placedImage,
163
- readTextModelsSection,
164
179
  renderAnswer,
165
- rerankModel,
166
180
  sentIds,
167
181
  sharedCommand,
168
182
  skipFlagFor,
@@ -170,65 +184,56 @@ import {
170
184
  stops,
171
185
  tagging,
172
186
  task,
173
- textModel,
174
- textModels,
175
- vectorModelKey,
176
- writeTextModelsSection
177
- } from "./chunk-2QHIOPSA.js";
187
+ withAgentLevels
188
+ } from "./chunk-7F3LOHRB.js";
178
189
  import {
179
190
  MESSENGER_CHANGE_REFUSAL,
180
191
  ancestorValue,
181
192
  envName,
182
193
  readOnlyLockOf,
183
194
  readOnlyRefusal
184
- } from "./chunk-YVV5S2QA.js";
195
+ } from "./chunk-NRCY3WBC.js";
196
+ import {
197
+ CustomTextModelShape,
198
+ DEFAULT_RERANK_MODEL,
199
+ DEFAULT_TEXT_MODEL,
200
+ PREVIOUS_DEFAULT_TEXT_MODEL,
201
+ chosenTextModel,
202
+ meaningFloor,
203
+ readTextModelsSection,
204
+ rerankModel,
205
+ textModel,
206
+ textModels,
207
+ vectorModelKey,
208
+ writeTextModelsSection
209
+ } from "./chunk-2JZJPVBH.js";
185
210
  import {
186
211
  PLAIN_HTTP_REFUSED,
187
212
  endpoint,
188
213
  endpointFetch,
189
214
  modelAddressAllowed,
190
215
  onThisComputer
191
- } from "./chunk-RIGNCUZD.js";
216
+ } from "./chunk-RPWYTOLI.js";
192
217
  import {
193
218
  installFiles,
194
219
  megabytes
195
- } from "./chunk-BVCRDHI2.js";
220
+ } from "./chunk-IV6SIKVH.js";
196
221
  import {
197
- BACKENDS,
198
- EVENT_QUERY,
199
222
  INTERNAL_NOTES,
200
223
  LOG_ATTRIBUTES,
201
- MEETING_PROJECT_EVIDENCE_QUERY,
202
- MEETING_QUERY,
203
- MEETING_QUERY_GUIDE,
204
- MeetingError,
205
- OPERATORS_BY_TYPE,
206
- READ_BUDGET_EXCEEDED,
207
- SAVE_HELP,
208
224
  TASK_KINDS,
209
225
  TASK_STATES,
210
226
  UNKNOWN_PROVIDER,
211
227
  accountsOfList,
212
228
  createTaskService,
213
229
  currentRun,
214
- dateRange,
215
- dayBoundary,
216
- defineQuery,
217
230
  entriesOfList,
218
- event,
219
- eventItem,
220
- exportMeeting,
221
- fieldsHelp,
222
- fieldsNamed,
223
231
  fitting,
224
232
  formatLocator,
225
- formatMeetingReference,
226
233
  formatReference,
227
234
  fromLogAttributes,
228
235
  holdsKind,
229
236
  holdsKindOf,
230
- implicitTextTerms,
231
- importFiles,
232
237
  inSource,
233
238
  isAccountList,
234
239
  isClosedState,
@@ -241,10 +246,54 @@ import {
241
246
  isUsable,
242
247
  keyOf,
243
248
  kindIn,
244
- liftMeetingFields,
245
- listed,
246
249
  listedHolds,
247
250
  logAttributes,
251
+ parseLocator,
252
+ parseReference,
253
+ providerNamed,
254
+ sameAs,
255
+ sourceOf2 as sourceOf,
256
+ sourceOf3 as sourceOf2,
257
+ typedCommand,
258
+ withAttempt
259
+ } from "./chunk-S5UTBEV3.js";
260
+ import {
261
+ isCliFailure,
262
+ sqliteCode
263
+ } from "./chunk-QBNEWEJC.js";
264
+ import {
265
+ normalizeTag
266
+ } from "./chunk-IBSHQWIJ.js";
267
+ import {
268
+ DEFAULT_TASK_CATEGORIES,
269
+ FALLBACK_CATEGORY,
270
+ readSharedSection,
271
+ sharedConfigPath,
272
+ writeSharedSection
273
+ } from "./chunk-B5RGPZDZ.js";
274
+ import {
275
+ BACKENDS,
276
+ EVENT_QUERY,
277
+ MEETING_PROJECT_EVIDENCE_QUERY,
278
+ MEETING_QUERY,
279
+ MEETING_QUERY_GUIDE,
280
+ MeetingError,
281
+ OPERATORS_BY_TYPE,
282
+ READ_BUDGET_EXCEEDED,
283
+ SAVE_HELP,
284
+ dateRange,
285
+ dayBoundary,
286
+ defineQuery,
287
+ event,
288
+ eventItem,
289
+ exportMeeting,
290
+ fieldsHelp,
291
+ fieldsNamed,
292
+ formatMeetingReference,
293
+ implicitTextTerms,
294
+ importFiles,
295
+ liftMeetingFields,
296
+ listed,
248
297
  meetingCueFingerprint,
249
298
  meetingDetailsBody,
250
299
  meetingHitsList,
@@ -254,48 +303,27 @@ import {
254
303
  meetingTranscriptAnswer,
255
304
  meetingsListThrough,
256
305
  meetingsQuery,
257
- normalizeTag,
258
- parseLocator,
259
306
  parseLucene,
260
307
  parseMeetingQuery,
261
308
  parseMeetingReference,
262
- parseReference,
263
- providerNamed,
264
309
  pull,
265
310
  queryError,
266
311
  queryFieldsOf,
267
312
  rangeOf,
268
313
  readMeetingProjectEvidence,
269
- sameAs,
270
314
  serviceCallsOf,
271
- sourceOf2 as sourceOf,
272
- sourceOf3 as sourceOf2,
273
315
  strongRecordingValidator,
274
316
  timezoneOf,
275
- typedCommand,
276
317
  validateMeetingHitSearch,
277
318
  validateMeetingPassage,
278
319
  validateQuery,
279
320
  walkQuery,
280
- windowOf,
281
- withAttempt,
282
- zonedMoment
283
- } from "./chunk-AF2XVV5P.js";
284
- import {
285
- isCliFailure,
286
- sqliteCode
287
- } from "./chunk-MGBVVQTU.js";
288
- import {
289
- DEFAULT_TASK_CATEGORIES,
290
- FALLBACK_CATEGORY,
291
- readSharedSection,
292
- sharedConfigPath,
293
- writeSharedSection
294
- } from "./chunk-7D6LI2N7.js";
321
+ windowOf
322
+ } from "./chunk-XHX5D5VE.js";
295
323
  import {
296
324
  storePath,
297
325
  wirecatDirectory
298
- } from "./chunk-TQFUAKU6.js";
326
+ } from "./chunk-VSPSHBAC.js";
299
327
  import {
300
328
  Credentials,
301
329
  logRecordOf,
@@ -303,7 +331,7 @@ import {
303
331
  realSleep,
304
332
  resolvePaths,
305
333
  writeSecurely
306
- } from "./chunk-NM5GBJME.js";
334
+ } from "./chunk-HT6OFANN.js";
307
335
  import {
308
336
  array,
309
337
  boolean,
@@ -332,7 +360,7 @@ import {
332
360
  trim,
333
361
  union,
334
362
  unknown
335
- } from "./chunk-XS5C5TQ7.js";
363
+ } from "./chunk-AUNNJDVD.js";
336
364
  import {
337
365
  importFrom,
338
366
  resolveFrom
@@ -342,7 +370,7 @@ import {
342
370
  isCliError,
343
371
  singleLine,
344
372
  visibleControls
345
- } from "./chunk-7KCBPAQS.js";
373
+ } from "./chunk-F6MLJ3V5.js";
346
374
  import {
347
375
  __commonJS,
348
376
  __name,
@@ -16958,7 +16986,7 @@ var require_lib3 = __commonJS({
16958
16986
  }
16959
16987
  });
16960
16988
 
16961
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/conversations/link.js
16989
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/conversations/link.js
16962
16990
  var RULES_VERSION = 5;
16963
16991
  var LOOK_BACK = 50;
16964
16992
  var SAME_SENDER_WITHIN = 10;
@@ -17048,10 +17076,10 @@ var latest = /* @__PURE__ */ __name((window3, matches) => {
17048
17076
  var sameThread = /* @__PURE__ */ __name((a, b) => a.threadId === b.threadId, "sameThread");
17049
17077
  var link = /* @__PURE__ */ __name((message, parentId, source, kind, confidence, method) => ({ messageId: message.id, parentId, source, kind, confidence, method }), "link");
17050
17078
 
17051
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/ports/traits.js
17079
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/ports/traits.js
17052
17080
  var syncsOneChat = /* @__PURE__ */ __name((messenger) => messenger.history !== "store" || messenger.historyOnDemand === true, "syncsOneChat");
17053
17081
 
17054
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/sends/upload.js
17082
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/sends/upload.js
17055
17083
  import { openAsBlob, realpathSync } from "node:fs";
17056
17084
  import { open, stat } from "node:fs/promises";
17057
17085
  import { basename, dirname, extname, isAbsolute, relative, resolve, sep } from "node:path";
@@ -17249,7 +17277,7 @@ var checkFilename = /* @__PURE__ */ __name((filename, files) => {
17249
17277
  throw new CliError("validation_error", "--filename is a name, not a path: no / or \\, at most 255 characters");
17250
17278
  }, "checkFilename");
17251
17279
  var listOf2 = /* @__PURE__ */ __name((value) => value === void 0 ? [] : typeof value === "string" ? [value] : value, "listOf");
17252
- var readAttachments = /* @__PURE__ */ __name(async ({ photo, file: file2, voice, asFile, filename, text: text2 }, read) => {
17280
+ var readAttachments = /* @__PURE__ */ __name(async ({ photo, file: file2, voice, asFile, filename, text: text2 }, read2) => {
17253
17281
  const photos = listOf2(photo);
17254
17282
  const files = listOf2(file2);
17255
17283
  if (voice !== void 0 && (photos.length > 0 || files.length > 0 || (text2 ?? "").trim() !== "")) {
@@ -17261,21 +17289,21 @@ var readAttachments = /* @__PURE__ */ __name(async ({ photo, file: file2, voice,
17261
17289
  checkFilename(filename, files);
17262
17290
  const uploads = [];
17263
17291
  for (const one of photos)
17264
- uploads.push(await readUpload("photo", one, read));
17292
+ uploads.push(await readUpload("photo", one, read2));
17265
17293
  for (const one of files)
17266
17294
  uploads.push({
17267
- ...await readUpload("file", one, read),
17295
+ ...await readUpload("file", one, read2),
17268
17296
  ...filename === void 0 ? {} : { name: filename },
17269
17297
  ...asFile ? { asFile: true } : {}
17270
17298
  });
17271
17299
  if (voice !== void 0)
17272
- uploads.push(await readUpload("voice", voice, read));
17300
+ uploads.push(await readUpload("voice", voice, read2));
17273
17301
  return uploads;
17274
17302
  }, "readAttachments");
17275
- var readStickerFile = /* @__PURE__ */ __name(async (path, maxBytes, read) => {
17303
+ var readStickerFile = /* @__PURE__ */ __name(async (path, maxBytes, read2) => {
17276
17304
  if (extname(path).toLowerCase() !== ".webp")
17277
17305
  throw new CliError("validation_error", `a sticker is a .webp \u2014 send ${path} as a photo or a file instead`);
17278
- const { name, source } = await readUpload("file", path, read);
17306
+ const { name, source } = await readUpload("file", path, read2);
17279
17307
  if (SIGNATURES[".webp"]?.(await fileHead(path)) !== true)
17280
17308
  throw new CliError("validation_error", `${path} is named .webp but is not a WebP image \u2014 nothing was sent`);
17281
17309
  const size2 = uploadSize(source);
@@ -17284,15 +17312,15 @@ var readStickerFile = /* @__PURE__ */ __name(async (path, maxBytes, read) => {
17284
17312
  return { name, source };
17285
17313
  }, "readStickerFile");
17286
17314
 
17287
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/sends/send-id.js
17315
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/sends/send-id.js
17288
17316
  import { randomBytes } from "node:crypto";
17289
17317
  var newSendId = /* @__PURE__ */ __name(() => randomBytes(8).readBigInt64BE().toString(), "newSendId");
17290
17318
  var newOperationId = newSendId;
17291
17319
 
17292
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/sends/guard.js
17320
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/sends/guard.js
17293
17321
  import { randomUUID } from "node:crypto";
17294
17322
 
17295
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/sends/flood.js
17323
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/sends/flood.js
17296
17324
  import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
17297
17325
  import { dirname as dirname2, join } from "node:path";
17298
17326
  var MOST_DEADLINES = 50;
@@ -17376,11 +17404,11 @@ var FloodMemory = class {
17376
17404
  }
17377
17405
  };
17378
17406
 
17379
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/sends/journal.js
17407
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/sends/journal.js
17380
17408
  import { appendFileSync, mkdirSync as mkdirSync3, readFileSync as readFileSync2 } from "node:fs";
17381
17409
  import { dirname as dirname4, join as join2 } from "node:path";
17382
17410
 
17383
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/sends/file-lock.js
17411
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/sends/file-lock.js
17384
17412
  import { closeSync, mkdirSync as mkdirSync2, openSync, statSync, unlinkSync } from "node:fs";
17385
17413
  import { dirname as dirname3 } from "node:path";
17386
17414
  var LOCK_WAIT_MS = 5e3;
@@ -17447,7 +17475,7 @@ var lockTime = /* @__PURE__ */ __name((lock) => {
17447
17475
  }
17448
17476
  }, "lockTime");
17449
17477
 
17450
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/sends/journal.js
17478
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/sends/journal.js
17451
17479
  var sendsPathFor = /* @__PURE__ */ __name((app, profile, env = process.env) => join2(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "sends", `${profile}.jsonl`), "sendsPathFor");
17452
17480
  var SendJournal = class {
17453
17481
  static {
@@ -17524,7 +17552,7 @@ var withSendId = /* @__PURE__ */ __name((entry) => {
17524
17552
  return cid === void 0 || rest.sendId !== void 0 ? rest : { ...rest, sendId: String(cid) };
17525
17553
  }, "withSendId");
17526
17554
 
17527
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/sends/recipients.js
17555
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/sends/recipients.js
17528
17556
  import { existsSync, readFileSync as readFileSync3, rmSync } from "node:fs";
17529
17557
  import { join as join3 } from "node:path";
17530
17558
  var recipientsPathFor = /* @__PURE__ */ __name((app, profile, env = process.env) => join3(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "profiles", `${profile}.recipients.json`), "recipientsPathFor");
@@ -17636,7 +17664,7 @@ var RecipientList = class {
17636
17664
  }
17637
17665
  };
17638
17666
 
17639
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/sends/guard.js
17667
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/sends/guard.js
17640
17668
  var HOUR_MS = 60 * 60 * 1e3;
17641
17669
  var countsTowardLimit = /* @__PURE__ */ __name(({ kind = "message", action: action2, notify }) => kind === "message" || kind === "forward" || kind === "edit" || kind === "delete" || kind === "pin" && notify === true || action2 === "create" || action2 === "members.add" || action2 === "requests.accept" || action2 === "join" || action2 === "contact-import", "countsTowardLimit");
17642
17670
  var weightOf = /* @__PURE__ */ __name(({ kind = "message", action: action2, count: count4, people }) => kind === "delete" || kind === "message" && action2 === void 0 ? Math.max(1, count4 ?? 1) : action2 === "create" || action2 === "members.add" || action2 === "requests.accept" || action2 === "contact-import" ? Math.max(1, people ?? count4 ?? 1) : 1, "weightOf");
@@ -17824,7 +17852,7 @@ var guardFor = /* @__PURE__ */ __name((app, settings, warn, env = process.env, a
17824
17852
  }), "guardFor");
17825
17853
  var journalFailure = /* @__PURE__ */ __name((error) => error?.code ?? (error instanceof Error ? error.name : "error"), "journalFailure");
17826
17854
 
17827
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/cli/messenger/lacks.js
17855
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/cli/messenger/lacks.js
17828
17856
  var COMMAND_NEEDS = {
17829
17857
  "account update": ["updateProfile", "change the profile"],
17830
17858
  "account sessions list": ["sessions", "list the account's sessions"],
@@ -17874,7 +17902,7 @@ var hideNever = /* @__PURE__ */ __name((messenger, group) => {
17874
17902
  return group;
17875
17903
  }, "hideNever");
17876
17904
 
17877
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/members-audit.js
17905
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/members-audit.js
17878
17906
  var AUDIT_PAGE = 200;
17879
17907
  var AUDIT_BUDGET = 10;
17880
17908
  var AUDIT_PAUSE_MS = 1e3;
@@ -17954,7 +17982,36 @@ var burstJoins = /* @__PURE__ */ __name((members) => {
17954
17982
  return found;
17955
17983
  }, "burstJoins");
17956
17984
 
17957
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/meetings/cli/management.js
17985
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/moment.js
17986
+ var read = /* @__PURE__ */ __name((reference, flag, now, at) => {
17987
+ const found = readMoment(reference, flag, { ...at, now });
17988
+ if (found === void 0)
17989
+ throw new CliError("validation_error", `${flag} takes an ISO 8601 time, today, yesterday, or 30m, 2h, 1d ago \u2014 not "${reference.trim()}"`);
17990
+ return found;
17991
+ }, "read");
17992
+ var momentOf = /* @__PURE__ */ __name((reference, flag = "--since", now = Date.now(), at = {}) => read(reference, flag, now, at).time, "momentOf");
17993
+ var dateWindow = /* @__PURE__ */ __name(({ sinceTime, untilTime, zone, now = Date.now(), names: names2 = ["--since-time", "--until-time"] }) => {
17994
+ const at = zone === void 0 ? {} : { zone };
17995
+ const lower = sinceTime === void 0 ? void 0 : read(sinceTime, names2[0], now, at);
17996
+ const upper = untilTime === void 0 ? void 0 : read(untilTime, names2[1], now, { ...at, end: true });
17997
+ const since = lower?.time;
17998
+ const until = upper?.time;
17999
+ const readInZone = lower?.local === true || upper?.local === true;
18000
+ const window3 = {
18001
+ ...since === void 0 ? {} : { since: new Date(since).toISOString() },
18002
+ ...until === void 0 ? {} : { until: new Date(until).toISOString() }
18003
+ };
18004
+ return {
18005
+ ...since === void 0 ? {} : { since },
18006
+ ...until === void 0 ? {} : { until },
18007
+ meta: {
18008
+ ...readInZone ? { timezone: timezoneOf(zone) } : {},
18009
+ ...since === void 0 && until === void 0 ? {} : { window: window3 }
18010
+ }
18011
+ };
18012
+ }, "dateWindow");
18013
+
18014
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/meetings/cli/management.js
17958
18015
  var REMOTE_READ = { remote: "read", local: "read" };
17959
18016
  var REMOTE_WRITE = { remote: "write", local: "write" };
17960
18017
  var minutes = /* @__PURE__ */ __name((text2) => {
@@ -18029,7 +18086,7 @@ var addMeetingManagementCommands = /* @__PURE__ */ __name((group, deps) => {
18029
18086
  }).description("the invitation text the service writes for a meeting"))).action(async (id2, _flags, command) => inRun(command, async () => print({ item: { ...await management.invitation(id2), untrusted: ["invitation"] } }, command)));
18030
18087
  }, "addMeetingManagementCommands");
18031
18088
 
18032
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/meetings/cli/query-options.js
18089
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/meetings/cli/query-options.js
18033
18090
  var queryWordsAfterOptions = /* @__PURE__ */ __name((command) => {
18034
18091
  command.allowUnknownOption();
18035
18092
  const parse2 = command.parseOptions.bind(command);
@@ -18049,7 +18106,7 @@ var queryWordsAfterOptions = /* @__PURE__ */ __name((command) => {
18049
18106
  return command;
18050
18107
  }, "queryWordsAfterOptions");
18051
18108
 
18052
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/meetings/cli/passage.js
18109
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/meetings/cli/passage.js
18053
18110
  var count = /* @__PURE__ */ __name((value) => {
18054
18111
  if (!/^(0|[1-9]\d*)$/.test(value) || !Number.isSafeInteger(Number(value)))
18055
18112
  throw new CliError("validation_error", "expected a nonnegative safe integer");
@@ -18091,7 +18148,7 @@ var addMeetingPassageCommandDefinition = /* @__PURE__ */ __name((program, deps)
18091
18148
  var createMeetingPassageCommand = sharedCommand(createMeetingPassageCommandDefinition);
18092
18149
  var addMeetingPassageCommand = sharedCommand(addMeetingPassageCommandDefinition);
18093
18150
 
18094
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/meetings/cli/project-evidence.js
18151
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/meetings/cli/project-evidence.js
18095
18152
  var integer2 = /* @__PURE__ */ __name((value) => {
18096
18153
  if (!/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
18097
18154
  throw new CliError("validation_error", "expected a positive safe integer");
@@ -18114,24 +18171,12 @@ ${fieldsHelp(MEETING_PROJECT_EVIDENCE_QUERY)}`).option("--limit <n>", "hits in o
18114
18171
  }, "addMeetingProjectEvidenceCommandDefinition");
18115
18172
  var addMeetingProjectEvidenceCommand = sharedCommand(addMeetingProjectEvidenceCommandDefinition);
18116
18173
 
18117
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/meetings/cli/search.js
18118
- var ZONED = /(?:Z|[+-]\d{2}:?\d{2})$/i;
18119
- var AGO = /^(\d+)(m|h|d)$/;
18120
- var AGO_MS = { m: 6e4, h: 36e5, d: 864e5 };
18174
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/meetings/cli/search.js
18121
18175
  var moment = /* @__PURE__ */ __name((flag, end, readIn) => (value) => {
18122
- const [, amount, unit] = AGO.exec(value.trim()) ?? [];
18123
- if (amount && unit)
18124
- return Date.now() - Number(amount) * (AGO_MS[unit] ?? 0);
18125
- const zone = timezoneOf();
18126
- let time;
18127
- try {
18128
- time = zonedMoment(value, zone, { start: 0, end: value.length }, { end });
18129
- } catch {
18130
- throw new CliError("validation_error", `${flag} takes an ISO date, a time with or without an offset, or 30m, 2h, 7d ago`);
18131
- }
18132
- if (!ZONED.test(value.trim()))
18133
- readIn(zone);
18134
- return time;
18176
+ const { since, until, meta } = dateWindow(end ? { untilTime: value, names: [flag, flag] } : { sinceTime: value, names: [flag, flag] });
18177
+ if (meta.timezone)
18178
+ readIn(meta.timezone);
18179
+ return end ? until : since;
18135
18180
  }, "moment");
18136
18181
  var integer3 = /* @__PURE__ */ __name((value) => {
18137
18182
  if (!/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
@@ -18145,7 +18190,7 @@ var createMeetingSearchCommandDefinition = /* @__PURE__ */ __name((program) => {
18145
18190
  program.addCommand(search);
18146
18191
  }
18147
18192
  const readIn = /* @__PURE__ */ __name((zone) => command.setOptionValue("timesReadIn", zone), "readIn");
18148
- const command = search.command("meetings").description("find words in stored meetings, indexing new ones first").argument("<query>", 'words, OR, (groups), -word, "a phrase", "a b"~N (within N lines), exact:word, from:"Name" (who said the line); date>=30d, project:, tag:, topic: choose meetings; a word also matches its other forms and spellings speech recognition garbled').option("--meeting-id <id>", "only this stored meeting", integer3).option("--identity-id <id>", "meetings with this participant identity; does not say who spoke a hit", integer3).option("--person-id <id>", "meetings with a participant linked to this person", integer3).option("--event-id <id>", "only meetings linked to this stored event", integer3).option("--series-id <id>", "only meetings in this stored series", integer3).option("--project <project>", "meetings confirmed in this project, by name, key or alias").option("--tag <name>", "meetings with this tag, by name or alias").option("--topic-name <name>", "meetings with this topic, by name or alias").option("--since-time <time>", "meetings starting at or after this ISO 8601 date or time, or 30m, 2h, 7d ago", moment("--since-time", false, readIn)).option("--until-time <time>", "meetings starting at or before this ISO 8601 date or time; a date alone covers that whole local day", moment("--until-time", true, readIn)).option("--limit <n>", "how many hits, 1 through 1000 (default 100)", integer3).option("--cursor <cursor>", "continue from the previous page's page.next_cursor, with the same query and filters").option("--max-read-bytes <bytes>", "most stored bytes to read, 1 through 67108864 (default 4194304)", integer3);
18193
+ const command = search.command("meetings").description("find words in stored meetings, indexing new ones first").argument("<query>", 'words, OR, (groups), -word, "a phrase", "a b"~N (within N lines), exact:word, from:"Name" (who said the line); date>=30d, project:, tag:, topic: choose meetings; a word also matches its other forms and spellings speech recognition garbled').option("--meeting-id <id>", "only this stored meeting", integer3).option("--identity-id <id>", "meetings with this participant identity; does not say who spoke a hit", integer3).option("--person-id <id>", "meetings with a participant linked to this person", integer3).option("--event-id <id>", "only meetings linked to this stored event", integer3).option("--series-id <id>", "only meetings in this stored series", integer3).option("--project <project>", "meetings confirmed in this project, by name, key or alias").option("--tag <name>", "meetings with this tag, by name or alias").option("--topic-name <name>", "meetings with this topic, by name or alias").option("--since-time <time>", "meetings starting at or after this ISO 8601 date or time, or 30m, 2h, 7d ago", moment("--since-time", false, readIn)).option("--until-time <time>", "meetings starting at or before this ISO 8601 date or time; a date alone covers that whole local day", moment("--until-time", true, readIn)).option("--limit <n>", "how many hits, 1 through 1000; the profile's defaults.limit when absent", integer3).option("--cursor <cursor>", "continue from the previous page's page.next_cursor, with the same query and filters").option("--max-read-bytes <bytes>", "most stored bytes to read, 1 through 67108864 (default 4194304)", integer3);
18149
18194
  annotate(command, {
18150
18195
  origin: "handwritten",
18151
18196
  effects: { remote: "none", local: "read" },
@@ -18153,7 +18198,7 @@ var createMeetingSearchCommandDefinition = /* @__PURE__ */ __name((program) => {
18153
18198
  });
18154
18199
  return command;
18155
18200
  }, "createMeetingSearchCommandDefinition");
18156
- var meetingHitSearchRequest = /* @__PURE__ */ __name((query, options2, signal) => {
18201
+ var meetingHitSearchRequest = /* @__PURE__ */ __name((query, options2, limit, signal) => {
18157
18202
  const request = {
18158
18203
  meetingId: options2.meetingId,
18159
18204
  participantIdentityId: options2.identityId,
@@ -18165,7 +18210,7 @@ var meetingHitSearchRequest = /* @__PURE__ */ __name((query, options2, signal) =
18165
18210
  topic: options2.topicName ?? options2.topic,
18166
18211
  since: options2.sinceTime,
18167
18212
  until: options2.untilTime,
18168
- limit: options2.limit,
18213
+ limit: options2.limit ?? limit,
18169
18214
  after: options2.cursor,
18170
18215
  maxReadBytes: options2.maxReadBytes,
18171
18216
  signal
@@ -18198,14 +18243,14 @@ var meetingSearchMeta = /* @__PURE__ */ __name((options2) => {
18198
18243
  ...Object.keys(window3).length === 0 ? {} : { window: window3 }
18199
18244
  };
18200
18245
  }, "meetingSearchMeta");
18201
- var addMeetingSearchCommandDefinition = /* @__PURE__ */ __name((program, deps) => createMeetingSearchCommand(program).action(async (query, options2) => {
18202
- const request = meetingHitSearchRequest(query, options2, deps.signal());
18203
- deps.output(meetingHitsList(await deps.search(query, request, options2), request.limit ?? 100, "search meetings", meetingSearchArguments(query, options2), meetingSearchMeta(options2)));
18246
+ var addMeetingSearchCommandDefinition = /* @__PURE__ */ __name((program, deps) => createMeetingSearchCommand(program).action(async (query, options2, command) => {
18247
+ const request = meetingHitSearchRequest(query, options2, deps.pagingOf(command).limit, deps.signal());
18248
+ deps.output(meetingHitsList(await deps.search(query, request, options2), request.limit, "search meetings", meetingSearchArguments(query, options2), meetingSearchMeta(options2)));
18204
18249
  }), "addMeetingSearchCommandDefinition");
18205
18250
  var createMeetingSearchCommand = sharedCommand(createMeetingSearchCommandDefinition);
18206
18251
  var addMeetingSearchCommand = sharedCommand(addMeetingSearchCommandDefinition);
18207
18252
 
18208
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/meetings/cli/index.js
18253
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/meetings/cli/index.js
18209
18254
  var integer4 = /* @__PURE__ */ __name((text2) => {
18210
18255
  if (!/^[1-9]\d*$/.test(text2) || !Number.isSafeInteger(Number(text2)))
18211
18256
  throw new InvalidArgumentError("expected a positive integer");
@@ -18216,13 +18261,6 @@ var lookbackDays = /* @__PURE__ */ __name((text2) => {
18216
18261
  throw new InvalidArgumentError("expected an integer from 0 through 31 days");
18217
18262
  return Number(text2);
18218
18263
  }, "lookbackDays");
18219
- var date = /* @__PURE__ */ __name((text2) => {
18220
- try {
18221
- return zonedMoment(text2, timezoneOf(), { start: 0, end: text2.length });
18222
- } catch {
18223
- throw new InvalidArgumentError("expected an ISO date, or a time with or without an offset");
18224
- }
18225
- }, "date");
18226
18264
  var LOCAL_READ = { remote: "none", local: "read" };
18227
18265
  var REMOTE_READ2 = { remote: "read", local: "read" };
18228
18266
  var backendOf = /* @__PURE__ */ __name((value) => {
@@ -18238,11 +18276,7 @@ var addMeetingCommandsDefinition = /* @__PURE__ */ __name((program, deps) => {
18238
18276
  const group = annotate(program.command("meetings").description("stored meetings and their records"), {
18239
18277
  effects: { remote: "none", local: "none" }
18240
18278
  });
18241
- const output = /* @__PURE__ */ __name((command) => command.option("--json", "one JSON value").option("--jsonl", "one JSON object per item").hook("preAction", (cmd) => {
18242
- const opts = cmd.optsWithGlobals();
18243
- if (opts.json && opts.jsonl)
18244
- throw new MeetingError("validation_error", "choose --json or --jsonl");
18245
- }), "output");
18279
+ const output = /* @__PURE__ */ __name((command) => command, "output");
18246
18280
  const print = /* @__PURE__ */ __name((value, command) => {
18247
18281
  const opts = command.optsWithGlobals();
18248
18282
  deps.write(value, opts.json ? "json" : opts.jsonl ? "jsonl" : "text");
@@ -18262,13 +18296,14 @@ ${BACKEND_HELP}`);
18262
18296
  query: defineQuery(MEETING_QUERY),
18263
18297
  output: { entity: "meeting" }
18264
18298
  });
18265
- backendOption(output(list3)).option("--limit <n>", "meetings per page", integer4, 100).option("--page <n>", "page number", integer4, 1).action(async (words3, opts, command) => {
18299
+ backendOption(output(list3)).option("--limit <n>", "meetings per page; the profile's defaults.limit when absent", integer4).option("--page <n>", "which page, starting at 1", integer4).action(async (words3, opts, command) => {
18266
18300
  const query = meetingsQuery(words3.join(" "));
18301
+ const { limit, page } = deps.pagingOf(command);
18267
18302
  await deps.inRun(command, async () => {
18268
18303
  const { server: _server, ...answer } = await meetingsListThrough(deps.source, deps.store, {
18269
18304
  accountId: deps.accountId,
18270
- limit: opts.limit,
18271
- offset: (opts.page - 1) * opts.limit,
18305
+ limit,
18306
+ offset: (page - 1) * limit,
18272
18307
  ...query ? { query } : {}
18273
18308
  }, access(command, opts.backend));
18274
18309
  print(answer, command);
@@ -18329,7 +18364,7 @@ ${BACKEND_HELP}`))).action(async (meeting, opts, command) => {
18329
18364
  output: { entity: "meeting_ingestion" },
18330
18365
  // Only a sync that stops itself at its budget may outlive the one-shot deadline.
18331
18366
  ...deps.budgetOf ? { cooperative: true, partial: true } : {}
18332
- }).description("bring the stored meetings up to date from the connected account, oldest first; a run that stops before its deadline keeps what it saved and the next one goes on from there")).option("--since-time <time>", "fetch meetings starting at or after this ISO 8601 date or time", date).option("--lookback-days <days>", "revisit recent occurrences for late transcripts (0\u201331)", lookbackDays).option("--rescan", "read the last 30 days again, not only what came after the last sync").action(async (opts, command) => {
18367
+ }).description("bring the stored meetings up to date from the connected account, oldest first; a run that stops before its deadline keeps what it saved and the next one goes on from there")).option("--since-time <time>", "fetch meetings starting at or after this ISO 8601 date or time, or 30m, 2h, 7d ago", (text2) => dateWindow({ sinceTime: text2, ...deps.timezone ? { zone: deps.timezone } : {}, now: deps.now?.() }).since).option("--lookback-days <days>", "revisit recent occurrences for late transcripts (0\u201331)", lookbackDays).option("--rescan", "read the last 30 days again, not only what came after the last sync").action(async (opts, command) => {
18333
18368
  const source = deps.source;
18334
18369
  if (!source)
18335
18370
  throw new MeetingError("configuration_error", "meeting source is unavailable");
@@ -18394,7 +18429,7 @@ ${fieldsHelp(EVENT_QUERY, MEETING_QUERY_GUIDE)}`);
18394
18429
  }, "addMeetingCommandsDefinition");
18395
18430
  var addMeetingCommands = sharedCommand(addMeetingCommandsDefinition);
18396
18431
 
18397
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/cli/list-query.js
18432
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/cli/list-query.js
18398
18433
  var LIST_QUERY_GUIDE = "https://github.com/WireCatLabs/cli-core/blob/main/docs/search/query-language.md";
18399
18434
  var QUERY_ARGUMENT = "field:value terms that narrow the list \u2014 the fields are below";
18400
18435
  var withQuery = /* @__PURE__ */ __name((command, registry) => {
@@ -18414,9 +18449,9 @@ var unfilteredQuery = /* @__PURE__ */ __name((entity, schema2) => ({
18414
18449
  }), "unfilteredQuery");
18415
18450
  var withTomorrow = /* @__PURE__ */ __name((query, registry, zone = timezoneOf(), now = Date.now()) => {
18416
18451
  const times = new Set(registry.fields.filter(({ type }) => type === "time").map(({ name }) => name));
18417
- const date2 = /* @__PURE__ */ new Date(`${new Intl.DateTimeFormat("en-CA", { timeZone: zone }).format(now)}T00:00:00Z`);
18418
- date2.setUTCDate(date2.getUTCDate() + 1);
18419
- const tomorrow = date2.toISOString().slice(0, 10);
18452
+ const date = /* @__PURE__ */ new Date(`${new Intl.DateTimeFormat("en-CA", { timeZone: zone }).format(now)}T00:00:00Z`);
18453
+ date.setUTCDate(date.getUTCDate() + 1);
18454
+ const tomorrow = date.toISOString().slice(0, 10);
18420
18455
  const day2 = /* @__PURE__ */ __name((value) => value.toLowerCase() === "tomorrow" ? tomorrow : value, "day");
18421
18456
  const map = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? times.has(node.field) ? { ...node, value: day2(node.value), ...node.upper === void 0 ? {} : { upper: day2(node.upper) } } : node : { ...node, clauses: node.clauses.map((clause) => ({ ...clause, node: map(clause.node) })) }, "map");
18422
18457
  return { ...query, root: map(query.root) };
@@ -18528,16 +18563,34 @@ var termField = /* @__PURE__ */ __name((name, type, example, more = {}) => nativ
18528
18563
  var queryHelp = /* @__PURE__ */ __name((registry) => `
18529
18564
  ${fieldsHelp(registry, LIST_QUERY_GUIDE)}`, "queryHelp");
18530
18565
 
18531
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/cli/paging.js
18566
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/cli/paging.js
18532
18567
  var positiveCount = /* @__PURE__ */ __name((flag) => (value) => {
18533
18568
  if (!/^\d+$/.test(value.trim()) || Number(value) < 1)
18534
18569
  throw new CliError("validation_error", `${flag} takes a whole number from 1 upwards, not "${value}"`);
18535
18570
  return Number(value);
18536
18571
  }, "positiveCount");
18572
+ var configuredLimit = /* @__PURE__ */ __name((command, most = Number.POSITIVE_INFINITY) => {
18573
+ const { resolveSettings, env } = environmentOf(command);
18574
+ const { limit: _typed, ...flags } = command.optsWithGlobals();
18575
+ const configured = resolveSettings?.(flags, { needsProfile: false, ...env ? { env } : {} }).limit ?? DEFAULT_CONFIG.defaults.limit;
18576
+ return Math.min(configured, most);
18577
+ }, "configuredLimit");
18537
18578
  var withPaging = /* @__PURE__ */ __name((command) => command.option("--limit <n>", "how many to show", positiveCount("--limit")).option("--page <n>", "which page, starting at 1", positiveCount("--page")).option("--all", "every row, no paging"), "withPaging");
18538
18579
  var window = /* @__PURE__ */ __name(({ limit, page, all }) => all ? { offset: 0 } : { limit, offset: (page - 1) * limit }, "window");
18580
+ var pagingOf = /* @__PURE__ */ __name((command) => {
18581
+ const environment = environmentOf(command);
18582
+ const flags = command.optsWithGlobals();
18583
+ if (!environment.resolveSettings)
18584
+ return { limit: flags.limit ?? DEFAULT_CONFIG.defaults.limit, page: flags.page ?? 1 };
18585
+ const { limit, page } = environment.resolveSettings(withAgentLevels(command, command.optsWithGlobals()), {
18586
+ env: environment.env ?? process.env,
18587
+ needsProfile: false,
18588
+ readOnly: true
18589
+ });
18590
+ return { limit: limit ?? DEFAULT_CONFIG.defaults.limit, page: page ?? 1 };
18591
+ }, "pagingOf");
18539
18592
 
18540
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/cli/messenger/chat-answers.js
18593
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/cli/messenger/chat-answers.js
18541
18594
  var defined = /* @__PURE__ */ __name((record2) => Object.fromEntries(Object.entries(record2).filter(([, value]) => value !== void 0)), "defined");
18542
18595
  var chatRef = /* @__PURE__ */ __name((account, chat) => formatReference({ type: "chat", provider: account.provider, account: account.account, chat }), "chatRef");
18543
18596
  var settingsOf = /* @__PURE__ */ __name((settings) => defined({
@@ -18799,7 +18852,7 @@ var sessionAnswer = /* @__PURE__ */ __name(({ current, client, device, location,
18799
18852
  ...createdAt === void 0 ? {} : { created_at: createdAt }
18800
18853
  }), "sessionAnswer");
18801
18854
 
18802
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/ports/messenger.js
18855
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/ports/messenger.js
18803
18856
  var throughWrapper = /* @__PURE__ */ __name((inner, handled, wrap = (_, call) => call) => new Proxy(handled, {
18804
18857
  get: /* @__PURE__ */ __name((own, key) => {
18805
18858
  if (key in own)
@@ -18816,7 +18869,7 @@ var capability = /* @__PURE__ */ __name((adapter, method, what) => {
18816
18869
  return found.bind(adapter);
18817
18870
  }, "capability");
18818
18871
 
18819
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/deps.js
18872
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/deps.js
18820
18873
  var accountStore = /* @__PURE__ */ __name(async (deps) => (await deps.store()).forAccount(await deps.account()), "accountStore");
18821
18874
  var crossAccount = /* @__PURE__ */ __name((deps, _reason) => deps.store(), "crossAccount");
18822
18875
  var NO_LOCAL_STORE = "this answer comes from the messenger, not from the local store";
@@ -18878,7 +18931,7 @@ var storedDeps = /* @__PURE__ */ __name((messenger, store, account, guard) => ({
18878
18931
  }), "storedDeps");
18879
18932
  var storeModeDeps = /* @__PURE__ */ __name((messenger, store, account, guard) => ({ ...storedDeps(messenger, store, account, guard), offline: false, reads: "store" }), "storeModeDeps");
18880
18933
 
18881
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/patience.js
18934
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/patience.js
18882
18935
  import { setTimeout as sleep } from "node:timers/promises";
18883
18936
  var LONGEST_WAIT_MS = 5 * 60 * 1e3;
18884
18937
  var patiently = /* @__PURE__ */ __name(async (request, note, stop) => {
@@ -18901,10 +18954,10 @@ var patiently = /* @__PURE__ */ __name(async (request, note, stop) => {
18901
18954
  }
18902
18955
  }, "patiently");
18903
18956
 
18904
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/archive.js
18957
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/archive.js
18905
18958
  import { setTimeout as sleep2 } from "node:timers/promises";
18906
18959
 
18907
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/backfill-estimate.js
18960
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/backfill-estimate.js
18908
18961
  var REQUEST_MS = 400;
18909
18962
  var estimateBackfill = /* @__PURE__ */ __name(({ ranges, held, newest, page, maxPages, pauseMs }) => {
18910
18963
  const lowest = ranges[0];
@@ -18927,13 +18980,13 @@ var estimateBackfill = /* @__PURE__ */ __name(({ ranges, held, newest, page, max
18927
18980
  };
18928
18981
  }, "estimateBackfill");
18929
18982
 
18930
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/domain/recovery.js
18983
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/domain/recovery.js
18931
18984
  var withRecovery = /* @__PURE__ */ __name((error) => ({
18932
18985
  ...error,
18933
18986
  retryable: typeof error.retryable === "boolean" ? error.retryable : error.code === "rate_limited" || error.status === 429
18934
18987
  }), "withRecovery");
18935
18988
 
18936
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/batch.js
18989
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/batch.js
18937
18990
  var actionable = /* @__PURE__ */ __name((error) => {
18938
18991
  if (isCliFailure(error))
18939
18992
  return withRecovery({ code: error.code, message: error.message, ...error.details });
@@ -19016,7 +19069,7 @@ var mergeBatches = /* @__PURE__ */ __name((a, b) => {
19016
19069
  };
19017
19070
  }, "mergeBatches");
19018
19071
 
19019
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/search/groups.js
19072
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/search/groups.js
19020
19073
  var ALL = "all";
19021
19074
  var OWNER_NOTES = { provider: "notes", account: INTERNAL_NOTES };
19022
19075
  var NOT_GROUP_NAMES = /* @__PURE__ */ new Set([ALL, "bots"]);
@@ -19088,7 +19141,7 @@ var groupEntries = /* @__PURE__ */ __name((saved) => ({
19088
19141
  [ALL]: [ALL]
19089
19142
  }), "groupEntries");
19090
19143
 
19091
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/search-kind.js
19144
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/search-kind.js
19092
19145
  var NO_MAIL = "no_mail";
19093
19146
  var MAIL = "email";
19094
19147
  var groupLockOf = /* @__PURE__ */ __name((app, env) => {
@@ -19162,7 +19215,7 @@ var accountsOfKind = /* @__PURE__ */ __name((kind, chosen, held, explicit, comma
19162
19215
  return chosenMail.map(({ provider, account }) => ({ provider, account }));
19163
19216
  }, "accountsOfKind");
19164
19217
 
19165
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/message-resolution.js
19218
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/message-resolution.js
19166
19219
  var readChatId = /* @__PURE__ */ __name(async (deps, reference, store, account) => {
19167
19220
  if (deps.reads !== "store")
19168
19221
  return keptChatId(deps.messenger, reference, store, account);
@@ -19363,14 +19416,14 @@ var chatsMatchingIn = /* @__PURE__ */ __name(async (store, accounts, pattern) =>
19363
19416
  }, "chatsMatchingIn");
19364
19417
  var isText = /* @__PURE__ */ __name((value) => typeof value === "string" && value !== "", "isText");
19365
19418
 
19366
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/images/context/index.js
19419
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/images/context/index.js
19367
19420
  var CONTEXT_MESSAGES = 3;
19368
19421
  var CONTEXT_MINUTES = 10;
19369
19422
  var MAX_CHARS = 1200;
19370
19423
  var line = /* @__PURE__ */ __name(({ sender, text: text2 }) => sender ? `${sender}: ${text2.trim()}` : text2.trim(), "line");
19371
19424
  var near = /* @__PURE__ */ __name((messages, sentAt) => messages.filter(({ text: text2, sentAt: at }) => text2.trim() && Math.abs(at - sentAt) <= CONTEXT_MINUTES * 6e4).slice(0, CONTEXT_MESSAGES), "near");
19372
- var contextText = /* @__PURE__ */ __name(({ chatTitle: chatTitle2, sender, caption, sentAt, before: before2, after }) => {
19373
- const earlier = near(before2, sentAt).reverse();
19425
+ var contextText = /* @__PURE__ */ __name(({ chatTitle: chatTitle2, sender, caption, sentAt, before, after }) => {
19426
+ const earlier = near(before, sentAt).reverse();
19374
19427
  const later = near(after, sentAt);
19375
19428
  if (!caption.trim() && earlier.length === 0 && later.length === 0)
19376
19429
  return void 0;
@@ -19387,12 +19440,12 @@ var context = {
19387
19440
  }, "describe")
19388
19441
  };
19389
19442
 
19390
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/images/registry.js
19443
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/images/registry.js
19391
19444
  var BUILT_INS = [context];
19392
19445
  var providers = [...BUILT_INS];
19393
19446
  var registeredImageProviders = /* @__PURE__ */ __name(() => providers, "registeredImageProviders");
19394
19447
 
19395
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/conversations.js
19448
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/conversations.js
19396
19449
  var READ_PAGE = 5e3;
19397
19450
  var CHAIN = 50;
19398
19451
  var CONVERSATION_QUERY = {
@@ -19473,7 +19526,7 @@ var conversationsService = /* @__PURE__ */ __name((deps) => {
19473
19526
  const { store, chatId } = await found(chat);
19474
19527
  if (!(await store.conversations.conversationState(chatId))?.builtAt)
19475
19528
  throw notBuilt(chatId);
19476
- const where = query ? queryFilter(query, CONVERSATION_COLUMNS, { command: "conversations list" }) : void 0;
19529
+ const where = query ? queryFilter(query, CONVERSATION_COLUMNS, { command: "conversations list", zone: timezoneOf() }) : void 0;
19477
19530
  const page = await store.conversations.conversations(chatId, { limit, offset, ...where ? { where } : {} });
19478
19531
  const account = await deps.account();
19479
19532
  return { items: page.items.map((one) => conversationItem(account, one)), hasMore: page.hasMore };
@@ -19544,7 +19597,7 @@ var sized = /* @__PURE__ */ __name((size2) => {
19544
19597
  return size2;
19545
19598
  }, "sized");
19546
19599
 
19547
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/embeddings-maintenance.js
19600
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/embeddings-maintenance.js
19548
19601
  var REFRESH_BOUNDS = { maxChats: 20, maxChunks: 2e3 };
19549
19602
  var MESSAGE_PAGE = 5e3;
19550
19603
  var PER_SESSION = 8;
@@ -19563,7 +19616,7 @@ var embeddingTarget = /* @__PURE__ */ __name((deps, choice = chosenTextModel(dep
19563
19616
  price: remote.price,
19564
19617
  installed: true,
19565
19618
  perBatch: PER_REQUEST * concurrency,
19566
- open: /* @__PURE__ */ __name(async () => (await import("./remote-JG3POFES.js")).openRemote(remote, apiKey, {
19619
+ open: /* @__PURE__ */ __name(async () => (await import("./remote-477LQHP6.js")).openRemote(remote, apiKey, {
19567
19620
  concurrency,
19568
19621
  env: deps.env ?? process.env
19569
19622
  }), "open")
@@ -19583,7 +19636,7 @@ var embeddingTarget = /* @__PURE__ */ __name((deps, choice = chosenTextModel(dep
19583
19636
  if (!isTextModelInstalled(model, directory2))
19584
19637
  throw notDownloaded(model.id);
19585
19638
  if (apart) {
19586
- const { openProcess } = await import("./process-GSNPENHL.js");
19639
+ const { openProcess } = await import("./process-OQUC2TW3.js");
19587
19640
  return openProcess(model, directory2, { threads: threads ?? defaultThreads() });
19588
19641
  }
19589
19642
  return openEmbedder(model, directory2, { threads: threads ?? defaultThreads() });
@@ -19872,7 +19925,7 @@ var shaped = /* @__PURE__ */ __name(({ chatId, builtAt, algorithmVersion, pendin
19872
19925
  return { ...one, state };
19873
19926
  }, "shaped");
19874
19927
 
19875
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/search-catchup.js
19928
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/search-catchup.js
19876
19929
  var CATCH_UP_BOUNDS = { maxChunks: 500, maxMessages: 1e4, timeMs: 3e4 };
19877
19930
  var validateCatchUpBounds = /* @__PURE__ */ __name((options2) => {
19878
19931
  for (const [key, value, maximum] of [
@@ -19925,7 +19978,7 @@ var catchUpSearch = /* @__PURE__ */ __name(async (deps, chat, options2, signal,
19925
19978
  }
19926
19979
  }, "catchUpSearch");
19927
19980
 
19928
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/archive.js
19981
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/archive.js
19929
19982
  var pushed = /* @__PURE__ */ __name((deps, what) => {
19930
19983
  if (deps.reads === "store") {
19931
19984
  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`);
@@ -20159,7 +20212,7 @@ var recordSkip = /* @__PURE__ */ __name(async (store, account, chatId, skip) =>
20159
20212
  const at = (/* @__PURE__ */ new Date()).toISOString();
20160
20213
  await store.chats.recordHistorySkips(account, /* @__PURE__ */ new Map([[chatId, { ...skip, messages: 0, oldestAt: at, newestAt: at, unread: true }]]));
20161
20214
  }, "recordSkip");
20162
- var abortable = /* @__PURE__ */ __name(async (read, signal) => {
20215
+ var abortable = /* @__PURE__ */ __name(async (read2, signal) => {
20163
20216
  signal.throwIfAborted();
20164
20217
  let listener = /* @__PURE__ */ __name(() => {
20165
20218
  }, "listener");
@@ -20168,7 +20221,7 @@ var abortable = /* @__PURE__ */ __name(async (read, signal) => {
20168
20221
  signal.addEventListener("abort", listener, { once: true });
20169
20222
  });
20170
20223
  try {
20171
- return await Promise.race([read(), interrupted]);
20224
+ return await Promise.race([read2(), interrupted]);
20172
20225
  } finally {
20173
20226
  signal.removeEventListener("abort", listener);
20174
20227
  }
@@ -20178,7 +20231,7 @@ var fetchInto = /* @__PURE__ */ __name(async ({ history, store, account, fetchin
20178
20231
  throw new CliError("validation_error", "invalid history window");
20179
20232
  const byTime = fetching.orderBy === "time";
20180
20233
  const keyed = keyOf2(fetching);
20181
- let before2 = window3 === void 0 ? void 0 : byTime ? new Date(window3.to + (fetching.beforeInclusive ? 0 : 1)).toISOString() : String(window3.to + 1);
20234
+ let before = window3 === void 0 ? void 0 : byTime ? new Date(window3.to + (fetching.beforeInclusive ? 0 : 1)).toISOString() : String(window3.to + 1);
20182
20235
  let requests = 0;
20183
20236
  let windowComplete = false;
20184
20237
  let chatId;
@@ -20196,8 +20249,8 @@ var fetchInto = /* @__PURE__ */ __name(async ({ history, store, account, fetchin
20196
20249
  page = await patiently(() => {
20197
20250
  requests += 1;
20198
20251
  onRequest?.();
20199
- const read = /* @__PURE__ */ __name(() => history({ limit: Math.min(pageSize, limit - fetched), ...before2 ? { before: before2 } : {} }), "read");
20200
- return window3 ? abortable(read, stop) : read();
20252
+ const read2 = /* @__PURE__ */ __name(() => history({ limit: Math.min(pageSize, limit - fetched), ...before ? { before } : {} }), "read");
20253
+ return window3 ? abortable(read2, stop) : read2();
20201
20254
  }, note, stop);
20202
20255
  } catch (error) {
20203
20256
  if (stop.aborted)
@@ -20234,7 +20287,7 @@ var fetchInto = /* @__PURE__ */ __name(async ({ history, store, account, fetchin
20234
20287
  onPage({ fetched, chatId, oldest: window3.from });
20235
20288
  break;
20236
20289
  }
20237
- if (window3 === void 0 && before2 === void 0)
20290
+ if (window3 === void 0 && before === void 0)
20238
20291
  await store.sync.setSyncState(account, fetchedKey(chatId), String(top));
20239
20292
  onPage({ fetched, chatId, oldest: held.from });
20240
20293
  idle = fresh === 0 ? idle + 1 : 0;
@@ -20256,7 +20309,7 @@ var fetchInto = /* @__PURE__ */ __name(async ({ history, store, account, fetchin
20256
20309
  break;
20257
20310
  }
20258
20311
  const boundary = window3 === void 0 ? held.from : low;
20259
- before2 = byTime ? new Date(boundary + (fresh > 0 && !(window3 && fetching.beforeInclusive) ? 1 : 0)).toISOString() : String(boundary);
20312
+ before = byTime ? new Date(boundary + (fresh > 0 && !(window3 && fetching.beforeInclusive) ? 1 : 0)).toISOString() : String(boundary);
20260
20313
  note(`${fetched} messages so far, back to ${fromAt.slice(0, 10)}`);
20261
20314
  const wait = fetching.jitter ? pauseMs * (1 + Math.random()) : pauseMs;
20262
20315
  await sleep2(wait, void 0, { signal: stop }).catch(() => {
@@ -20271,7 +20324,7 @@ var fetchInto = /* @__PURE__ */ __name(async ({ history, store, account, fetchin
20271
20324
  fetched,
20272
20325
  complete: reachedStart && ranges.length === 1,
20273
20326
  ranges,
20274
- ...issue ? { issue, resume: { ...before2 === void 0 ? {} : { before: before2 } } } : {},
20327
+ ...issue ? { issue, resume: { ...before === void 0 ? {} : { before } } } : {},
20275
20328
  ...window3 === void 0 ? {} : { windowComplete, requests },
20276
20329
  ...reachedSince ? { reachedSince: true } : {},
20277
20330
  ...reachedLast ? { reachedLast: true } : {},
@@ -20306,9 +20359,9 @@ var timeOfKey = /* @__PURE__ */ __name(async (store, account, chatId, key, byTim
20306
20359
  return message?.timestamp ?? fallback;
20307
20360
  }, "timeOfKey");
20308
20361
 
20309
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/questions.js
20362
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/questions.js
20310
20363
  var LINKS = /https?:\/\/\S+/g;
20311
- 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");
20364
+ var unanswered = /* @__PURE__ */ __name((messages, { answerers: answerers2, before }) => questions(messages, { answerers: answerers2 }).filter(({ question, answer }) => answer === void 0 && Date.parse(question.timestamp) < before).map(({ question }) => question), "unanswered");
20312
20365
  var questions = /* @__PURE__ */ __name((messages, { answerers: answerers2, asker = "others" }) => {
20313
20366
  const fromOwner2 = /* @__PURE__ */ __name((message) => message.outgoing === true, "fromOwner");
20314
20367
  const answers = asker === "owner" ? (message) => !fromOwner2(message) : (message) => fromOwner2(message) || message.senderId !== null && answerers2.has(message.senderId);
@@ -20336,7 +20389,7 @@ var questions = /* @__PURE__ */ __name((messages, { answerers: answerers2, asker
20336
20389
  });
20337
20390
  }, "questions");
20338
20391
 
20339
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/task-categories.js
20392
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/task-categories.js
20340
20393
  var names = /* @__PURE__ */ __name((categories) => categories.map(({ name }) => name).join(", "), "names");
20341
20394
  var taskCategoryOf = /* @__PURE__ */ __name((categories = DEFAULT_TASK_CATEGORIES, flag = "--category") => (typed) => {
20342
20395
  const name = typed.trim().toLowerCase();
@@ -20393,7 +20446,7 @@ var categorize = /* @__PURE__ */ __name((text2, categories = DEFAULT_TASK_CATEGO
20393
20446
  return best.name;
20394
20447
  }, "categorize");
20395
20448
 
20396
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/task-rules.js
20449
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/task-rules.js
20397
20450
  var taskAccount = /* @__PURE__ */ __name(({ provider, account }) => `${provider}:${account}`, "taskAccount");
20398
20451
  var RULES_IN = {
20399
20452
  dialog: "all",
@@ -20599,51 +20652,11 @@ var applyTaskRulesToChats = /* @__PURE__ */ __name(async (store, account, chatId
20599
20652
  return passes;
20600
20653
  }, "applyTaskRulesToChats");
20601
20654
 
20602
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/domain/vcard.js
20655
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/domain/vcard.js
20603
20656
  var AS_WORD = new RegExp(`^${WORD_BODY}$`);
20604
20657
  var encoder = new TextEncoder();
20605
20658
 
20606
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/moment.js
20607
- var AGO2 = /^(\d+)(m|h|d)$/;
20608
- var AGO_MS2 = { m: 6e4, h: 36e5, d: 864e5 };
20609
- var DATE = /^\d{4}-\d{2}-\d{2}/;
20610
- var momentOf = /* @__PURE__ */ __name((reference, flag = "--since", now = Date.now(), at = {}) => {
20611
- const wanted = reference.trim();
20612
- const [, amount, unit] = AGO2.exec(wanted) ?? [];
20613
- const time = amount && unit ? now - Number(amount) * (AGO_MS2[unit] ?? 0) : DATE.test(wanted) ? calendarMoment(wanted, flag, at) : Number.NaN;
20614
- if (Number.isNaN(time)) {
20615
- throw new CliError("validation_error", `${flag} takes an ISO 8601 time or 30m, 2h, 1d ago \u2014 not "${wanted}"`);
20616
- }
20617
- return time;
20618
- }, "momentOf");
20619
- var aheadOf = /* @__PURE__ */ __name((reference, flag, now = Date.now(), at = {}) => {
20620
- const wanted = reference.trim();
20621
- const [, amount, unit] = AGO2.exec(wanted) ?? [];
20622
- const time = amount && unit ? now + Number(amount) * (AGO_MS2[unit] ?? 0) : DATE.test(wanted) ? calendarMoment(wanted, flag, at) : Number.NaN;
20623
- if (Number.isNaN(time)) {
20624
- throw new CliError("validation_error", `${flag} takes an ISO 8601 time or 30m, 2h, 3d from now \u2014 not "${wanted}"`);
20625
- }
20626
- return time;
20627
- }, "aheadOf");
20628
- var dateWindow = /* @__PURE__ */ __name(({ sinceTime, untilTime, zone, now = Date.now(), names: names2 = ["--since-time", "--until-time"] }) => {
20629
- const since = sinceTime === void 0 ? void 0 : momentOf(sinceTime, names2[0], now, { zone });
20630
- const until = untilTime === void 0 ? void 0 : momentOf(untilTime, names2[1], now, { zone, end: true });
20631
- const readInZone = [sinceTime, untilTime].some((value) => value !== void 0 && DATE.test(value.trim()) && !/(?:Z|[+-]\d{2}:?\d{2})$/i.test(value.trim()));
20632
- const window3 = {
20633
- ...since === void 0 ? {} : { since: new Date(since).toISOString() },
20634
- ...until === void 0 ? {} : { until: new Date(until).toISOString() }
20635
- };
20636
- return {
20637
- ...since === void 0 ? {} : { since },
20638
- ...until === void 0 ? {} : { until },
20639
- meta: {
20640
- ...readInZone ? { timezone: timezoneOf(zone) } : {},
20641
- ...since === void 0 && until === void 0 ? {} : { window: window3 }
20642
- }
20643
- };
20644
- }, "dateWindow");
20645
-
20646
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/botcheck/check.js
20659
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/botcheck/check.js
20647
20660
  var DAY_MS = 864e5;
20648
20661
  var NEW_DAYS = 30;
20649
20662
  var SAME_TEXT_MIN = 20;
@@ -20720,7 +20733,7 @@ var scorePerson = /* @__PURE__ */ __name(({ subject, provider, activity, photos,
20720
20733
  };
20721
20734
  }, "scorePerson");
20722
20735
 
20723
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/http/time-limit.js
20736
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/http/time-limit.js
20724
20737
  var timeLimit = /* @__PURE__ */ __name((ms) => {
20725
20738
  const controller = new AbortController();
20726
20739
  const timer = setTimeout(() => controller.abort(new DOMException("The operation timed out.", "TimeoutError")), ms);
@@ -20736,7 +20749,7 @@ var withTimeLimit = /* @__PURE__ */ __name(async (ms, run2) => {
20736
20749
  }
20737
20750
  }, "withTimeLimit");
20738
20751
 
20739
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/botcheck/registries.js
20752
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/botcheck/registries.js
20740
20753
  var REGISTRIES = {
20741
20754
  cas: { title: "Combot Anti-Spam (CAS)", docs: "https://cas.chat/api" },
20742
20755
  lols: { title: "lols.bot", docs: "https://api.lols.bot/lols-bot.json" }
@@ -20823,7 +20836,7 @@ var notCovered = /* @__PURE__ */ __name((messenger, now = /* @__PURE__ */ new Da
20823
20836
  detail: `lists Telegram accounts only, not ${messenger} ones`
20824
20837
  })), "notCovered");
20825
20838
 
20826
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/botcheck/service.js
20839
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/botcheck/service.js
20827
20840
  var ACTIVITY_MESSAGES = 1e3;
20828
20841
  var botCheckService = /* @__PURE__ */ __name((deps) => {
20829
20842
  const subjectOf = /* @__PURE__ */ __name(async (reference) => {
@@ -20911,7 +20924,7 @@ var botCheckService = /* @__PURE__ */ __name((deps) => {
20911
20924
  };
20912
20925
  }, "botCheckService");
20913
20926
 
20914
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/domain/thread.js
20927
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/domain/thread.js
20915
20928
  var threadIdOf = /* @__PURE__ */ __name((value) => {
20916
20929
  if (value === void 0)
20917
20930
  return void 0;
@@ -20921,7 +20934,7 @@ var threadIdOf = /* @__PURE__ */ __name((value) => {
20921
20934
  return id2;
20922
20935
  }, "threadIdOf");
20923
20936
 
20924
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/chat-stats.js
20937
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/chat-stats.js
20925
20938
  var TOP_POSTS = 5;
20926
20939
  var JOINS = /* @__PURE__ */ new Set(["join", "add"]);
20927
20940
  var LEAVES = /* @__PURE__ */ new Set(["leave", "remove"]);
@@ -21003,9 +21016,9 @@ var seriesOf = /* @__PURE__ */ __name((messages, events, by, timezone) => {
21003
21016
  const day2 = dayOf(Date.parse(timestamp));
21004
21017
  if (by === "day")
21005
21018
  return day2;
21006
- const date2 = /* @__PURE__ */ new Date(`${day2}T00:00:00Z`);
21007
- date2.setUTCDate(date2.getUTCDate() - (date2.getUTCDay() + 6) % 7);
21008
- return date2.toISOString().slice(0, 10);
21019
+ const date = /* @__PURE__ */ new Date(`${day2}T00:00:00Z`);
21020
+ date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 6) % 7);
21021
+ return date.toISOString().slice(0, 10);
21009
21022
  }, "keyOf");
21010
21023
  const rows = /* @__PURE__ */ new Map();
21011
21024
  const row = /* @__PURE__ */ __name((key) => {
@@ -21038,7 +21051,7 @@ var median = /* @__PURE__ */ __name((values) => {
21038
21051
  return Math.round(sorted.length % 2 === 0 ? ((sorted[middle - 1] ?? upper) + upper) / 2 : upper);
21039
21052
  }, "median");
21040
21053
 
21041
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/member-history.js
21054
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/member-history.js
21042
21055
  var memberEvents = /* @__PURE__ */ __name((stays, revisions, since = 0) => {
21043
21056
  const events = [];
21044
21057
  for (const stay of stays) {
@@ -21054,9 +21067,9 @@ var memberEvents = /* @__PURE__ */ __name((stays, revisions, since = 0) => {
21054
21067
  }
21055
21068
  const last = /* @__PURE__ */ new Map();
21056
21069
  for (const revision of revisions) {
21057
- const before2 = last.get(revision.id);
21070
+ const before = last.get(revision.id);
21058
21071
  last.set(revision.id, revision);
21059
- if (!before2)
21072
+ if (!before)
21060
21073
  continue;
21061
21074
  events.push({
21062
21075
  at: revision.capturedAt,
@@ -21064,13 +21077,13 @@ var memberEvents = /* @__PURE__ */ __name((stays, revisions, since = 0) => {
21064
21077
  id: revision.id,
21065
21078
  name: revision.name,
21066
21079
  username: revision.username,
21067
- before: { name: before2.name, username: before2.username, marks: before2.marks }
21080
+ before: { name: before.name, username: before.username, marks: before.marks }
21068
21081
  });
21069
21082
  }
21070
21083
  return events.filter(({ at }) => Date.parse(at) >= since).sort((a, b) => Date.parse(a.at) - Date.parse(b.at) || a.id.localeCompare(b.id));
21071
21084
  }, "memberEvents");
21072
21085
 
21073
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/chats.js
21086
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/chats.js
21074
21087
  var EVENTS_DAYS = 7;
21075
21088
  var TRACKED_DAYS = 30;
21076
21089
  var STATS_PAGE = 1e3;
@@ -21106,7 +21119,7 @@ var deepChecks = /* @__PURE__ */ __name(async (deps, items, deep, pauseMs, regis
21106
21119
  var chatsService = /* @__PURE__ */ __name((deps) => ({
21107
21120
  list: /* @__PURE__ */ __name(async (window3, query) => {
21108
21121
  if (fromStore(deps)) {
21109
- const where = query ? queryFilter(query, CHAT_COLUMNS, { command: "chats list" }) : void 0;
21122
+ const where = query ? queryFilter(query, CHAT_COLUMNS, { command: "chats list", zone: timezoneOf() }) : void 0;
21110
21123
  return (await accountStore(deps)).chats.chats({ ...window3, ...where ? { where } : {} });
21111
21124
  }
21112
21125
  const [term] = query ? walkQuery(query.root) : [];
@@ -21205,10 +21218,10 @@ var chatsService = /* @__PURE__ */ __name((deps) => ({
21205
21218
  throw new CliError("validation_error", "`chats members check` reads the member list from the messenger; not with --offline");
21206
21219
  }
21207
21220
  const connection = await deps.connection();
21208
- const { chatId: id2, members: read, more, participants } = await readMembers(connection, chat, budget, pauseMs);
21221
+ const { chatId: id2, members: read2, more, participants } = await readMembers(connection, chat, budget, pauseMs);
21209
21222
  const held = await accountStoreIfOpen(deps);
21210
21223
  const stored = held ? await storedFacts(held, id2) : void 0;
21211
- const { items: judged, unknown: unknown3 } = auditMembers(read, {
21224
+ const { items: judged, unknown: unknown3 } = auditMembers(read2, {
21212
21225
  firstMessages: stored?.firstMessages,
21213
21226
  self: connection.self(),
21214
21227
  minScore
@@ -21216,7 +21229,7 @@ var chatsService = /* @__PURE__ */ __name((deps) => ({
21216
21229
  const items = deep > 0 ? await deepChecks(deps, judged, deep, pauseMs, registry) : judged;
21217
21230
  return {
21218
21231
  chatId: id2,
21219
- read: read.length,
21232
+ read: read2.length,
21220
21233
  participantsCount: participants ?? stored?.participantsCount ?? null,
21221
21234
  more,
21222
21235
  unknown: unknown3,
@@ -21230,11 +21243,11 @@ var chatsService = /* @__PURE__ */ __name((deps) => ({
21230
21243
  throw new CliError("validation_error", "`chats members fetch` reads the member list from the messenger; not with --offline");
21231
21244
  }
21232
21245
  const startedAt = (/* @__PURE__ */ new Date()).toISOString();
21233
- const read = await readMembers(await deps.connection(), chat, budget, pauseMs);
21246
+ const read2 = await readMembers(await deps.connection(), chat, budget, pauseMs);
21234
21247
  const observedAt = (/* @__PURE__ */ new Date()).toISOString();
21235
- const { chatId, members, more } = read;
21248
+ const { chatId, members, more } = read2;
21236
21249
  const store = await accountStore(deps);
21237
- const participants = read.participants ?? (await store.chats.chats({})).items.find(({ id: id2 }) => id2 === chatId)?.participantsCount ?? null;
21250
+ const participants = read2.participants ?? (await store.chats.chats({})).items.find(({ id: id2 }) => id2 === chatId)?.participantsCount ?? null;
21238
21251
  const complete = !more && participants !== null && members.length >= participants;
21239
21252
  const change = await store.roster.saveRoster(chatId, {
21240
21253
  members,
@@ -21248,7 +21261,7 @@ var chatsService = /* @__PURE__ */ __name((deps) => ({
21248
21261
  return { chatId, read: members.length, participants, complete, more, ...change, tracked };
21249
21262
  }, "fetchMembers"),
21250
21263
  tracked: /* @__PURE__ */ __name(async (query) => {
21251
- const where = query ? queryFilter(query, TRACKED_CHAT_COLUMNS, { command: "chats tracking list" }) : void 0;
21264
+ const where = query ? queryFilter(query, TRACKED_CHAT_COLUMNS, { command: "chats tracking list", zone: timezoneOf() }) : void 0;
21252
21265
  return (await accountStore(deps)).roster.trackedChats(where ? { where } : {});
21253
21266
  }, "tracked"),
21254
21267
  memberHistory: /* @__PURE__ */ __name(async (chat, { since }) => {
@@ -21314,16 +21327,16 @@ var storedFacts = /* @__PURE__ */ __name(async (store, chatId) => {
21314
21327
  const chat = (await store.chats.chats({})).items.find((one) => one.id === chatId);
21315
21328
  const [completeness] = await store.chats.chatCompleteness([chatId]);
21316
21329
  const firstMessages = /* @__PURE__ */ new Map();
21317
- let before2;
21330
+ let before;
21318
21331
  for (; ; ) {
21319
- const page = await store.messages.messages(chatId, { limit: STATS_PAGE, ...before2 ? { before: before2 } : {} });
21332
+ const page = await store.messages.messages(chatId, { limit: STATS_PAGE, ...before ? { before } : {} });
21320
21333
  for (const message of [...page.items].reverse())
21321
21334
  if (message.senderId)
21322
21335
  firstMessages.set(message.senderId, message);
21323
21336
  const oldest = page.items[0];
21324
21337
  if (!page.hasMore || !oldest)
21325
21338
  break;
21326
- before2 = oldest.id;
21339
+ before = oldest.id;
21327
21340
  }
21328
21341
  return {
21329
21342
  participantsCount: chat?.participantsCount ?? null,
@@ -21333,39 +21346,39 @@ var storedFacts = /* @__PURE__ */ __name(async (store, chatId) => {
21333
21346
  }, "storedFacts");
21334
21347
  var storedSince = /* @__PURE__ */ __name(async (store, chatId, since) => {
21335
21348
  const pages = [];
21336
- let before2;
21349
+ let before;
21337
21350
  for (; ; ) {
21338
- const page = await store.messages.messages(chatId, { limit: STATS_PAGE, since, ...before2 ? { before: before2 } : {} });
21351
+ const page = await store.messages.messages(chatId, { limit: STATS_PAGE, since, ...before ? { before } : {} });
21339
21352
  pages.unshift(page.items);
21340
21353
  const oldest = page.items[0];
21341
21354
  if (!page.hasMore || !oldest)
21342
21355
  return pages.flat();
21343
- before2 = oldest.id;
21356
+ before = oldest.id;
21344
21357
  }
21345
21358
  }, "storedSince");
21346
21359
  var readMembers = /* @__PURE__ */ __name(async (connection, chat, budget, pauseMs) => {
21347
21360
  const members = capability(connection, "members", "list a group's members");
21348
- const read = [];
21361
+ const read2 = [];
21349
21362
  let chatId;
21350
21363
  let participants = null;
21351
21364
  let more = true;
21352
21365
  for (let page = 0; page < budget && more; page++) {
21353
21366
  if (page > 0)
21354
21367
  await new Promise((resolve7) => setTimeout(resolve7, pauseMs));
21355
- const found = await members(chatId ?? chat, { limit: AUDIT_PAGE, offset: read.length });
21368
+ const found = await members(chatId ?? chat, { limit: AUDIT_PAGE, offset: read2.length });
21356
21369
  chatId = found.chatId;
21357
21370
  participants = found.participantsCount ?? participants;
21358
- read.push(...found.items);
21371
+ read2.push(...found.items);
21359
21372
  more = found.hasMore && found.items.length > 0;
21360
21373
  }
21361
- return { chatId: chatId ?? chat, members: read, more, participants };
21374
+ return { chatId: chatId ?? chat, members: read2, more, participants };
21362
21375
  }, "readMembers");
21363
21376
  var storedMembers = /* @__PURE__ */ __name(async (store, chatId) => {
21364
21377
  const members = (await store.roster.members(chatId)).filter((one) => one.id !== store.account.account);
21365
21378
  return members.length === 0 ? null : members;
21366
21379
  }, "storedMembers");
21367
21380
 
21368
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/inbox.js
21381
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/inbox.js
21369
21382
  var INBOX_CHATS = 20;
21370
21383
  var REVIEW_DAYS = 3;
21371
21384
  var UNANSWERED_HOURS = 24;
@@ -21410,9 +21423,9 @@ var capped = /* @__PURE__ */ __name((chats, most) => ({
21410
21423
  var unreadIn = /* @__PURE__ */ __name(async (adapter, { limit, all = false, kinds }) => {
21411
21424
  const page = await everyChat(adapter);
21412
21425
  const { heard: waiting, quiet: quiet2 } = heard(byRecency(ofKinds(page.items, kinds).filter((chat) => (chat.unreadCount ?? 0) > 0 || chat.markedUnread === true)), all);
21413
- const { read, skipped } = capped(waiting, INBOX_CHATS);
21426
+ const { read: read2, skipped } = capped(waiting, INBOX_CHATS);
21414
21427
  const chats = [];
21415
- for (const { id: id2, title, kind, unreadCount } of read) {
21428
+ for (const { id: id2, title, kind, unreadCount } of read2) {
21416
21429
  const count4 = unreadCount ?? 0;
21417
21430
  if (count4 === 0) {
21418
21431
  const newest = (await adapter.history(id2, { limit })).items.findLast((message) => !message.outgoing);
@@ -21435,10 +21448,10 @@ var newIn = /* @__PURE__ */ __name(async (adapter, { since, points, limit, all =
21435
21448
  const changed2 = byRecency(ofKinds(changedAll, kinds));
21436
21449
  const cut = changed2.reduce((latest2, chat) => Math.max(latest2, Date.parse(chat.lastMessageAt ?? "")), since);
21437
21450
  const { heard: wanted, quiet: quiet2 } = heard(changed2, all);
21438
- const { read, skipped } = capped(wanted, INBOX_CHATS);
21451
+ const { read: read2, skipped } = capped(wanted, INBOX_CHATS);
21439
21452
  const chats = [];
21440
21453
  const checked2 = {};
21441
- for (const { id: id2, title, kind, unreadCount } of read) {
21454
+ for (const { id: id2, title, kind, unreadCount } of read2) {
21442
21455
  const { items } = await adapter.history(id2, { limit });
21443
21456
  const fresh = items.filter((message) => {
21444
21457
  const time = Date.parse(message.timestamp);
@@ -21466,9 +21479,9 @@ var REVIEW_PAGE = 100;
21466
21479
  var REVIEW_PER_CHAT = 300;
21467
21480
  var window2 = /* @__PURE__ */ __name(async (adapter, chat, since, cut) => {
21468
21481
  const messages = [];
21469
- let before2;
21482
+ let before;
21470
21483
  while (true) {
21471
- const page = await adapter.history(chat, { limit: REVIEW_PAGE, ...before2 === void 0 ? {} : { before: before2 } });
21484
+ const page = await adapter.history(chat, { limit: REVIEW_PAGE, ...before === void 0 ? {} : { before } });
21472
21485
  const time = /* @__PURE__ */ __name((message) => Date.parse(message.timestamp), "time");
21473
21486
  messages.unshift(...page.items.filter((message) => time(message) > since && time(message) <= cut));
21474
21487
  const oldest = page.items[0];
@@ -21476,7 +21489,7 @@ var window2 = /* @__PURE__ */ __name(async (adapter, chat, since, cut) => {
21476
21489
  return { messages, more: false };
21477
21490
  if (messages.length >= REVIEW_PER_CHAT)
21478
21491
  return { messages: messages.slice(-REVIEW_PER_CHAT), more: true };
21479
- before2 = oldest.id;
21492
+ before = oldest.id;
21480
21493
  }
21481
21494
  }, "window");
21482
21495
  var reviewIn = /* @__PURE__ */ __name(async (adapter, { since, points, chat, kinds, all = false, unansweredAfterHours, now = Date.now(), enrich, onReviewed }) => {
@@ -21486,10 +21499,10 @@ var reviewIn = /* @__PURE__ */ __name(async (adapter, { since, points, chat, kin
21486
21499
  const cut = changed2.reduce((latest2, one) => Math.max(latest2, Date.parse(one.lastMessageAt ?? "")), since);
21487
21500
  const only = chat === void 0 ? void 0 : (await adapter.resolve(chat)).id;
21488
21501
  const { heard: wanted, quiet: quiet2 } = only === void 0 ? heard(ofKinds(changed2, kinds), all) : { heard: changed2.filter((one) => one.id === only), quiet: 0 };
21489
- const { read, skipped } = capped(wanted, REVIEW_CHATS);
21502
+ const { read: read2, skipped } = capped(wanted, REVIEW_CHATS);
21490
21503
  const chats = [];
21491
21504
  const checked2 = {};
21492
- for (const { id: id2, title, kind } of read) {
21505
+ for (const { id: id2, title, kind } of read2) {
21493
21506
  const { messages, more } = await window2(adapter, id2, startOf(id2), cut);
21494
21507
  if (messages.length > 0)
21495
21508
  chats.push({ id: id2, title, kind, messages, more });
@@ -21573,7 +21586,7 @@ var inboxService = /* @__PURE__ */ __name((deps) => {
21573
21586
  };
21574
21587
  }, "inboxService");
21575
21588
 
21576
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/domain/formatting.js
21589
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/domain/formatting.js
21577
21590
  var invalid = /* @__PURE__ */ __name(() => new CliError("validation_error", "the messenger formatter returned invalid text spans"), "invalid");
21578
21591
  var validateFormattedText = /* @__PURE__ */ __name((formatted2) => {
21579
21592
  const { text: text2, spans } = formatted2;
@@ -21633,7 +21646,7 @@ var visibleFormattedText = /* @__PURE__ */ __name((formatted2) => {
21633
21646
  };
21634
21647
  }, "visibleFormattedText");
21635
21648
 
21636
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/moderation/check.js
21649
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/moderation/check.js
21637
21650
  var INVITE = /max\.ru\/join\/|(t|telegram)\.me\/(\+|joinchat\/)|tg:\/\/join/i;
21638
21651
  var LINK2 = /https?:\/\/\S+/i;
21639
21652
  var STRENGTH = { report: 0, delete: 1, remove: 2 };
@@ -21821,8 +21834,8 @@ var nextPoint = /* @__PURE__ */ __name((rows, found) => {
21821
21834
  }, "nextPoint");
21822
21835
  var someUndone = /* @__PURE__ */ __name((rows) => rows.some(undone), "someUndone");
21823
21836
 
21824
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/moderation/rules.js
21825
- import { existsSync as existsSync2, readFileSync as readFileSync4 } from "node:fs";
21837
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/moderation/rules.js
21838
+ import { existsSync as existsSync2, readdirSync, readFileSync as readFileSync4 } from "node:fs";
21826
21839
  import { join as join4 } from "node:path";
21827
21840
  var RULE_ACTIONS = ["report", "delete", "remove"];
21828
21841
  var OLD_LEVELS = { forbid: "deny", flag: "ask", confirm: "ask", allow: "allow" };
@@ -21890,7 +21903,16 @@ var KEYS = {
21890
21903
  "consent.remove": { help: LEVELS.join("|"), parse: String }
21891
21904
  };
21892
21905
  var RULE_KEYS = Object.keys(KEYS);
21893
- var moderationPathFor = /* @__PURE__ */ __name((app, profile, env = process.env) => join4(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "profiles", `${profile}.moderation.json`), "moderationPathFor");
21906
+ var stateFolder = /* @__PURE__ */ __name((app, env, folder) => join4(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, folder), "stateFolder");
21907
+ var profilesFolder = /* @__PURE__ */ __name((app, env) => stateFolder(app, env, "profiles"), "profilesFolder");
21908
+ var moderationPathFor = /* @__PURE__ */ __name((app, profile, env = process.env) => join4(profilesFolder(app, env), `${profile}.moderation.json`), "moderationPathFor");
21909
+ var namesIn = /* @__PURE__ */ __name((folder, suffix) => existsSync2(folder) ? readdirSync(folder).filter((name) => name.endsWith(suffix)).map((name) => name.slice(0, -suffix.length)) : [], "namesIn");
21910
+ var moderationProfiles = /* @__PURE__ */ __name((app, env = process.env) => [
21911
+ .../* @__PURE__ */ new Set([
21912
+ ...namesIn(stateFolder(app, env, "accounts"), ".json"),
21913
+ ...namesIn(profilesFolder(app, env), ".moderation.json")
21914
+ ])
21915
+ ].sort(), "moderationProfiles");
21894
21916
  var ModerationRules = class {
21895
21917
  static {
21896
21918
  __name(this, "ModerationRules");
@@ -21964,7 +21986,7 @@ var assign = /* @__PURE__ */ __name((rules, key, value) => {
21964
21986
  return { ...rules, [head]: { ...rules[head], [tail]: value } };
21965
21987
  }, "assign");
21966
21988
 
21967
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/person-meetings.js
21989
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/person-meetings.js
21968
21990
  var SCAN = 1e3;
21969
21991
  var personMeetings = /* @__PURE__ */ __name(async (store, people, accounts, { limit = 10, since, until } = {}) => {
21970
21992
  const byId2 = new Map(accounts.map((one) => [one.id, one]));
@@ -22016,7 +22038,7 @@ var personMeetings = /* @__PURE__ */ __name(async (store, people, accounts, { li
22016
22038
  return { items, total: newest.length, hasMore: cut || newest.length > limit };
22017
22039
  }, "personMeetings");
22018
22040
 
22019
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/person-context.js
22041
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/person-context.js
22020
22042
  var CONTEXT_MESSAGES2 = 10;
22021
22043
  var CONTEXT_BYTES = 64 * 1024;
22022
22044
  var toContext = /* @__PURE__ */ __name((key, message, chatTitle2) => ({
@@ -22216,12 +22238,12 @@ var recordContext = /* @__PURE__ */ __name(async (store, record2, reads, readabl
22216
22238
  };
22217
22239
  cut ||= direct.length > messages || groups.length > messages || mentions.length > messages;
22218
22240
  const kept2 = withinBytes(lists, bytes2);
22219
- const read = [
22241
+ const read2 = [
22220
22242
  ...reads.map(({ key, scope }) => ({ ...key, scope })),
22221
22243
  ...calendars.map(({ provider, account, scope }) => ({ provider, account, scope })),
22222
22244
  ...recorded.items.flatMap(({ account }) => readable.filter((one) => nameOf(one) === nameOf(account)))
22223
22245
  ].map(({ provider, account, scope }) => ({ provider, account, scope }));
22224
- const accounts = [...new Map(read.map((one) => [nameOf(one), one])).values()].sort((a, b) => nameOf(a).localeCompare(nameOf(b)));
22246
+ const accounts = [...new Map(read2.map((one) => [nameOf(one), one])).values()].sort((a, b) => nameOf(a).localeCompare(nameOf(b)));
22225
22247
  return {
22226
22248
  accounts,
22227
22249
  shared: shared.sort((a, b) => Date.parse(b.lastMessageAt ?? "") - Date.parse(a.lastMessageAt ?? "")),
@@ -22322,10 +22344,10 @@ var personMessages = /* @__PURE__ */ __name(async (store, asked, reference, { ch
22322
22344
  };
22323
22345
  }, "personMessages");
22324
22346
 
22325
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
22347
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
22326
22348
  import { createHash } from "node:crypto";
22327
22349
 
22328
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/meeting-reference.js
22350
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/meeting-reference.js
22329
22351
  var missing2 = /* @__PURE__ */ __name(() => new CliError("not_found", "the meeting evidence is unavailable for this account"), "missing");
22330
22352
  var authorizedMeetingMetadata = /* @__PURE__ */ __name(async (store, accountId, reference, options2 = {}) => {
22331
22353
  const parsed = parseMeetingReference(reference);
@@ -22343,7 +22365,7 @@ var authorizedMeetingMetadata = /* @__PURE__ */ __name(async (store, accountId,
22343
22365
  return { parsed, meeting };
22344
22366
  }, "authorizedMeetingMetadata");
22345
22367
 
22346
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
22368
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
22347
22369
  var hash = /* @__PURE__ */ __name((value) => createHash("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
22348
22370
  var checkMeetingCancelled = /* @__PURE__ */ __name((signal) => {
22349
22371
  if (signal?.aborted)
@@ -22542,7 +22564,7 @@ var readMeetingEvidence = /* @__PURE__ */ __name(async (store, accountId, refere
22542
22564
  return { ...packet, fingerprint: hash(packet) };
22543
22565
  }, "readMeetingEvidence");
22544
22566
 
22545
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/person-meeting-context.js
22567
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/person-meeting-context.js
22546
22568
  var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference, options2) => {
22547
22569
  const { meetings = 10, cues = 5, bytes: bytes2 = 64 * 1024, scanLimit = 1e3, since, signal } = options2;
22548
22570
  const requestedAccounts = options2.accountIds;
@@ -22641,7 +22663,7 @@ var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference,
22641
22663
  };
22642
22664
  }, "personMeetingContext");
22643
22665
 
22644
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/person-preparation.js
22666
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/person-preparation.js
22645
22667
  var PREPARE_BYTES = 96 * 1024;
22646
22668
  var MEETINGS = 5;
22647
22669
  var CUES = 3;
@@ -22750,11 +22772,11 @@ var meetingsOf = /* @__PURE__ */ __name(async (store, uid, stored, since, left)
22750
22772
  bytes: Math.min(left(), 4 * 1024 * 1024),
22751
22773
  ...since === void 0 ? {} : { since }
22752
22774
  });
22753
- const read = new Set(found.items.map((item2) => parseMeetingReference(item2.reference).accountId));
22775
+ const read2 = new Set(found.items.map((item2) => parseMeetingReference(item2.reference).accountId));
22754
22776
  return {
22755
22777
  items: found.items,
22756
22778
  hasMore: found.coverage.truncatedBy !== null || found.coverage.scanLimitReached,
22757
- accounts: stored.filter(({ id: id2 }) => read.has(id2)).map(accountName),
22779
+ accounts: stored.filter(({ id: id2 }) => read2.has(id2)).map(accountName),
22758
22780
  pending: found.coverage.pending
22759
22781
  };
22760
22782
  } catch (error) {
@@ -22764,18 +22786,18 @@ var meetingsOf = /* @__PURE__ */ __name(async (store, uid, stored, since, left)
22764
22786
  }
22765
22787
  }, "meetingsOf");
22766
22788
 
22767
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/person-profile.js
22789
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/person-profile.js
22768
22790
  var personProfile = /* @__PURE__ */ __name(async (deps, person, known2) => {
22769
22791
  const online = deps.offline ? void 0 : await deps.connection();
22770
22792
  const held = await storeIfOpen(deps);
22771
- const read = online?.profile ? await online.profile(person) : known2 ? factsOfCard(known2) : await storedFacts2(held ?? { store: await deps.store(), account: await deps.account() }, person);
22793
+ const read2 = online?.profile ? await online.profile(person) : known2 ? factsOfCard(known2) : await storedFacts2(held ?? { store: await deps.store(), account: await deps.account() }, person);
22772
22794
  if (!held)
22773
- return { ...read, chats: quiet(read), aliases: [] };
22774
- if (online?.profile && read.phone) {
22775
- await unlessBusy(() => held.store.people.savePeople(held.account, [{ id: read.id, name: read.name, phone: read.phone }]));
22795
+ return { ...read2, chats: quiet(read2), aliases: [] };
22796
+ if (online?.profile && read2.phone) {
22797
+ await unlessBusy(() => held.store.people.savePeople(held.account, [{ id: read2.id, name: read2.name, phone: read2.phone }]));
22776
22798
  }
22777
- const phone = read.phone ?? await held.store.people.phoneOf(held.account, read.id);
22778
- const facts = phone ? { ...read, phone } : read;
22799
+ const phone = read2.phone ?? await held.store.people.phoneOf(held.account, read2.id);
22800
+ const facts = phone ? { ...read2, phone } : read2;
22779
22801
  return {
22780
22802
  ...facts,
22781
22803
  chats: await activityIn(held.store, held.account, facts),
@@ -22834,7 +22856,7 @@ var quiet = /* @__PURE__ */ __name((facts) => facts.chats.map(({ id: id2, title,
22834
22856
  complete: false
22835
22857
  })), "quiet");
22836
22858
 
22837
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/person-timeline.js
22859
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/person-timeline.js
22838
22860
  var TIMELINE_ITEMS = 50;
22839
22861
  var TIMELINE_MAX = 500;
22840
22862
  var SCOPES = ["personal", "work"];
@@ -22856,7 +22878,7 @@ var personTimeline = /* @__PURE__ */ __name(async (store, asked, reference, { sc
22856
22878
  throw new CliError("permission_error", `this profile reads ${allowed.join(" and ")}, not ${scope}`, {
22857
22879
  reason: "selection.out-of-scope"
22858
22880
  });
22859
- const read = scope === void 0 ? [...allowed] : [scope];
22881
+ const read2 = scope === void 0 ? [...allowed] : [scope];
22860
22882
  const found = pickPerson(reference, await store.people.people(asked.provider, { account: asked.account }));
22861
22883
  const record2 = await store.people.personOf({ provider: asked.provider, id: found.id });
22862
22884
  if (!record2)
@@ -22864,7 +22886,7 @@ var personTimeline = /* @__PURE__ */ __name(async (store, asked, reference, { sc
22864
22886
  const personId = Number(record2.uid);
22865
22887
  const pending = store.involvements.pending();
22866
22888
  const rows = store.involvements.forPerson(personId, {
22867
- scopes: read,
22889
+ scopes: read2,
22868
22890
  ...since === void 0 ? {} : { since },
22869
22891
  ...until === void 0 ? {} : { until },
22870
22892
  only: asked,
@@ -22876,7 +22898,7 @@ var personTimeline = /* @__PURE__ */ __name(async (store, asked, reference, { sc
22876
22898
  const hasMore = rows.length > limit;
22877
22899
  return {
22878
22900
  person: { uid: record2.uid, name: record2.name },
22879
- scopes: read,
22901
+ scopes: read2,
22880
22902
  items: shown.map((row) => ({
22881
22903
  at: new Date(row.occurredAt).toISOString(),
22882
22904
  subject: row.subjectType,
@@ -22896,7 +22918,7 @@ var personTimeline = /* @__PURE__ */ __name(async (store, asked, reference, { sc
22896
22918
  };
22897
22919
  }, "personTimeline");
22898
22920
 
22899
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/chat-coverage.js
22921
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/chat-coverage.js
22900
22922
  var chatCoverage = /* @__PURE__ */ __name(async (store, account, chatIds) => {
22901
22923
  const ids = [...new Set(chatIds)];
22902
22924
  if (ids.length === 0)
@@ -22922,14 +22944,14 @@ var chatCoverage = /* @__PURE__ */ __name(async (store, account, chatIds) => {
22922
22944
  }));
22923
22945
  }, "chatCoverage");
22924
22946
 
22925
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/context/evidence-response.js
22947
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/context/evidence-response.js
22926
22948
  var contextSourceKey = /* @__PURE__ */ __name((source) => JSON.stringify([source.kind, source.accountId, source.provider, source.account]), "contextSourceKey");
22927
22949
  var validateContextEvidencePage = /* @__PURE__ */ __name((page, request) => {
22928
22950
  const fail2 = /* @__PURE__ */ __name(() => {
22929
22951
  throw new CliError("invalid_response", "context reader returned invalid or out-of-scope evidence");
22930
22952
  }, "fail");
22931
22953
  try {
22932
- const { source, chat, senders, after, before: before2, limit, maxReadBytes } = contextEvidenceRequest(request);
22954
+ const { source, chat, senders, after, before, limit, maxReadBytes } = contextEvidenceRequest(request);
22933
22955
  if (!page || contextSourceKey(contextSource(page.source)) !== contextSourceKey(source))
22934
22956
  fail2();
22935
22957
  if (!Array.isArray(page.items) || page.items.length > limit || !Number.isSafeInteger(page.readBytes) || page.readBytes < 0 || page.readBytes > maxReadBytes)
@@ -22948,7 +22970,7 @@ var validateContextEvidencePage = /* @__PURE__ */ __name((page, request) => {
22948
22970
  for (const item2 of page.items) {
22949
22971
  if (!item2 || item2.provider !== source.provider || item2.account !== source.account || typeof item2.text !== "string" || typeof item2.ref !== "string")
22950
22972
  fail2();
22951
- if (!Number.isSafeInteger(item2.at) || item2.at < after || item2.at >= before2 || !Number.isSafeInteger(item2.updatedAt) || item2.updatedAt < 0)
22973
+ if (!Number.isSafeInteger(item2.at) || item2.at < after || item2.at >= before || !Number.isSafeInteger(item2.updatedAt) || item2.updatedAt < 0)
22952
22974
  fail2();
22953
22975
  if (item2.revision !== null && (!Number.isSafeInteger(item2.revision) || item2.revision < 1))
22954
22976
  fail2();
@@ -22986,7 +23008,7 @@ var validateContextEvidencePage = /* @__PURE__ */ __name((page, request) => {
22986
23008
  }
22987
23009
  }, "validateContextEvidencePage");
22988
23010
 
22989
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/context/read-budget.js
23011
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/context/read-budget.js
22990
23012
  var contextReadBudget = /* @__PURE__ */ __name((limits = {}) => {
22991
23013
  if (!limits || typeof limits !== "object" || Array.isArray(limits))
22992
23014
  throw new CliError("validation_error", "limits needs a context read allowance");
@@ -23039,7 +23061,7 @@ var contextReadBudget = /* @__PURE__ */ __name((limits = {}) => {
23039
23061
  };
23040
23062
  }, "contextReadBudget");
23041
23063
 
23042
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/context-evidence.js
23064
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/context-evidence.js
23043
23065
  var createContextEvidenceReader = /* @__PURE__ */ __name((port, allowed, limits) => {
23044
23066
  if (!port || typeof port.read !== "function")
23045
23067
  throw new CliError("configuration_error", "context evidence reader is unavailable");
@@ -23047,7 +23069,7 @@ var createContextEvidenceReader = /* @__PURE__ */ __name((port, allowed, limits)
23047
23069
  throw new CliError("validation_error", "allowed needs 1\u20138 explicitly authorized sources");
23048
23070
  const keys = new Set(allowed.map(contextSource).map(contextSourceKey));
23049
23071
  const budget = contextReadBudget(limits);
23050
- const read = port.read.bind(port);
23072
+ const read2 = port.read.bind(port);
23051
23073
  return {
23052
23074
  usage: budget.usage,
23053
23075
  async read(original) {
@@ -23070,7 +23092,7 @@ var createContextEvidenceReader = /* @__PURE__ */ __name((port, allowed, limits)
23070
23092
  signal
23071
23093
  });
23072
23094
  try {
23073
- const page = await read(request);
23095
+ const page = await read2(request);
23074
23096
  signal?.throwIfAborted();
23075
23097
  validateContextEvidencePage(page, request);
23076
23098
  reservation.complete(page.readBytes);
@@ -23083,7 +23105,7 @@ var createContextEvidenceReader = /* @__PURE__ */ __name((port, allowed, limits)
23083
23105
  };
23084
23106
  }, "createContextEvidenceReader");
23085
23107
 
23086
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/excerpt.js
23108
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/excerpt.js
23087
23109
  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");
23088
23110
  var excerpt = /* @__PURE__ */ __name((text2, query, size2 = 240, options2 = {}) => {
23089
23111
  const flat = text2.replace(/\s+/g, " ").trim();
@@ -23099,7 +23121,7 @@ var excerpt = /* @__PURE__ */ __name((text2, query, size2 = 240, options2 = {})
23099
23121
  }, "excerpt");
23100
23122
  var withExcerpt = /* @__PURE__ */ __name(({ matchedText, ...hit }, query) => ({ ...hit, excerpt: excerpt(matchedText ?? hit.text, query) }), "withExcerpt");
23101
23123
 
23102
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/project-gathering-around.js
23124
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/project-gathering-around.js
23103
23125
  var storedMessageNeighbours = /* @__PURE__ */ __name((messages) => ({
23104
23126
  async around(ref, window3) {
23105
23127
  const at = parseLocator(ref);
@@ -23194,7 +23216,7 @@ var storedNeighbours = /* @__PURE__ */ __name((store) => {
23194
23216
  };
23195
23217
  }, "storedNeighbours");
23196
23218
 
23197
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/project-gathering-request.js
23219
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/project-gathering-request.js
23198
23220
  import { createHash as createHash2 } from "node:crypto";
23199
23221
  var DAY = 864e5;
23200
23222
  var MAX_TIME = 864e13;
@@ -23396,10 +23418,10 @@ var projectGatheringRequest = /* @__PURE__ */ __name((input, now) => {
23396
23418
  const lookbackDays2 = explicit ? null : whole2(input.lookbackDays ?? 60, "lookbackDays", 1, LIMITS.lookbackDays);
23397
23419
  const window3 = explicit ? (() => {
23398
23420
  const after = whole2(input.after, "after", 0, MAX_TIME);
23399
- const before2 = whole2(input.before ?? asOf ?? now, "before", after + 1, MAX_TIME);
23400
- if (before2 - after > LIMITS.lookbackDays * DAY)
23421
+ const before = whole2(input.before ?? asOf ?? now, "before", after + 1, MAX_TIME);
23422
+ if (before - after > LIMITS.lookbackDays * DAY)
23401
23423
  fail(`window must not exceed ${LIMITS.lookbackDays} days`, "after");
23402
- return { after, before: before2, asOf: asOf ?? before2 };
23424
+ return { after, before, asOf: asOf ?? before };
23403
23425
  })() : { after: Math.max(0, (asOf ?? now) - lookbackDays2 * DAY), before: asOf ?? now, asOf: asOf ?? now };
23404
23426
  if (input.budgets !== void 0 && (!input.budgets || typeof input.budgets !== "object"))
23405
23427
  fail("budgets needs whole-run limits", "budgets");
@@ -23448,9 +23470,9 @@ var projectGatheringRequest = /* @__PURE__ */ __name((input, now) => {
23448
23470
  signal: input.signal
23449
23471
  };
23450
23472
  }, "projectGatheringRequest");
23451
- var contextChunks = /* @__PURE__ */ __name((after, before2) => {
23473
+ var contextChunks = /* @__PURE__ */ __name((after, before) => {
23452
23474
  const chunks = [];
23453
- for (let end = before2; end > after; end -= CONTEXT_CHUNK_DAYS * DAY)
23475
+ for (let end = before; end > after; end -= CONTEXT_CHUNK_DAYS * DAY)
23454
23476
  chunks.push({ after: Math.max(after, end - CONTEXT_CHUNK_DAYS * DAY), before: end });
23455
23477
  return chunks;
23456
23478
  }, "contextChunks");
@@ -23510,7 +23532,7 @@ var decodeCheckpoint = /* @__PURE__ */ __name((text2, plan) => {
23510
23532
  return value;
23511
23533
  }, "decodeCheckpoint");
23512
23534
 
23513
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/project-gathering.js
23535
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/project-gathering.js
23514
23536
  var terminal = /* @__PURE__ */ new Set(["done", "unavailable", "failed"]);
23515
23537
  var PAGE3 = 20;
23516
23538
  var PEOPLE = 20;
@@ -23914,7 +23936,7 @@ var peopleOf = /* @__PURE__ */ __name((items, senderOf) => {
23914
23936
  return [...byKey.values()].sort((a, b) => b.items - a.items || a.name.localeCompare(b.name));
23915
23937
  }, "peopleOf");
23916
23938
 
23917
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidate-matching.js
23939
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidate-matching.js
23918
23940
  var normalizedText = /* @__PURE__ */ __name((text2) => text2.normalize("NFKC").toLowerCase().replace(/\s+/gu, " "), "normalizedText");
23919
23941
  var termsOf = /* @__PURE__ */ __name((entry) => [
23920
23942
  { name: entry.name, kind: "canonical" },
@@ -23958,7 +23980,7 @@ var matchVocabularyTerms = /* @__PURE__ */ __name((catalog, texts) => {
23958
23980
  return result.sort((a, b) => Number(a.entry.id) - Number(b.entry.id));
23959
23981
  }, "matchVocabularyTerms");
23960
23982
 
23961
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/project-gathering-mentions.js
23983
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/project-gathering-mentions.js
23962
23984
  var KINDS = ["project", "tag", "topic"];
23963
23985
  var findEvidenceMentions = /* @__PURE__ */ __name(async (vocabulary, gathering, options2 = {}) => {
23964
23986
  if (typeof vocabulary?.vocabulary !== "function")
@@ -24013,7 +24035,7 @@ var findEvidenceMentions = /* @__PURE__ */ __name(async (vocabulary, gathering,
24013
24035
  };
24014
24036
  }, "findEvidenceMentions");
24015
24037
 
24016
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/project-purposes.js
24038
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/project-purposes.js
24017
24039
  var BUILT_IN_PURPOSES = ["work", "sales", "support", "other"];
24018
24040
  var DEFAULT_PURPOSES = ["work"];
24019
24041
  var LINK_PURPOSE = "work";
@@ -24043,7 +24065,7 @@ var purposeList = /* @__PURE__ */ __name((value, previous = []) => [
24043
24065
  ...value.split(",").map((one) => one.trim()).filter(Boolean)
24044
24066
  ], "purposeList");
24045
24067
 
24046
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/stored-project-gathering.js
24068
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/stored-project-gathering.js
24047
24069
  var storedChatCount = /* @__PURE__ */ __name((store) => async (account, chatId, { since, until }) => {
24048
24070
  const window3 = { since: new Date(since).toISOString(), until: new Date(until - 1).toISOString() };
24049
24071
  const [messages, newest, oldest] = await Promise.all([
@@ -24354,7 +24376,7 @@ var purposeHintOf = /* @__PURE__ */ __name((linked, rows, of) => {
24354
24376
  return { chat: top.ref, relationship: link4.relationship, items, of };
24355
24377
  }, "purposeHintOf");
24356
24378
 
24357
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/people.js
24379
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/people.js
24358
24380
  var peopleService = /* @__PURE__ */ __name((deps) => {
24359
24381
  const localCard = /* @__PURE__ */ __name(async (card, includeNotes = false) => {
24360
24382
  const held = await storeIfOpen(deps);
@@ -24470,11 +24492,11 @@ var peopleService = /* @__PURE__ */ __name((deps) => {
24470
24492
  const people = await capability(await deps.connection(), "addressBook", "list its contacts")();
24471
24493
  const store = await deps.store();
24472
24494
  const account = await deps.account();
24473
- const before2 = await store.people.people(account.provider, { account: account.account });
24495
+ const before = await store.people.people(account.provider, { account: account.account });
24474
24496
  let added = 0;
24475
24497
  let changed2 = 0;
24476
24498
  for (const person of people) {
24477
- const known2 = before2.get(person.id);
24499
+ const known2 = before.get(person.id);
24478
24500
  if (!known2)
24479
24501
  added += 1;
24480
24502
  else if (known2.name !== person.name || known2.username !== person.username)
@@ -24619,7 +24641,7 @@ var withoutPhone = /* @__PURE__ */ __name((answer) => {
24619
24641
  return rest;
24620
24642
  }, "withoutPhone");
24621
24643
 
24622
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/task-stats.js
24644
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/task-stats.js
24623
24645
  var TASK_STATS_BY = ["chat", "meeting", "project"];
24624
24646
  var PERIOD_FIELD = "created";
24625
24647
  var refuseNestedPeriod = /* @__PURE__ */ __name((node, top = true) => {
@@ -24653,14 +24675,14 @@ var taskStatsOf = /* @__PURE__ */ __name(async (store, accounts, { by = "chat",
24653
24675
  const several = Array.isArray(accounts);
24654
24676
  const list3 = several ? [...new Map(accounts.map((one) => [taskAccount(one), one])).values()] : [accounts];
24655
24677
  const time = /* @__PURE__ */ __name((sql) => ({ type: "time", sql }), "time");
24656
- const read = { ...columns, [PERIOD_FIELD]: time("t.created_at"), closed: time("t.closed_at") };
24678
+ const read2 = { ...columns, [PERIOD_FIELD]: time("t.created_at"), closed: time("t.closed_at") };
24657
24679
  const fixed = [
24658
24680
  ...group === void 0 ? [] : [{ sql: "t.source_group = ?", params: [group] }],
24659
24681
  ...kind === void 0 ? [] : [{ sql: "t.type = ?", params: [kind] }],
24660
24682
  ...by === "meeting" ? [{ sql: "t.source_kind = 'meeting'", params: [] }] : []
24661
24683
  ];
24662
- const options2 = { command: "stats tasks show", now, ...timezone === void 0 ? {} : { zone: timezone } };
24663
- const where = /* @__PURE__ */ __name((ast, more = []) => and([...fixed, ...more, ...ast ? [queryFilter(ast, read, options2)] : []]), "where");
24684
+ const options2 = { command: "stats tasks show", now, zone: timezoneOf(timezone) };
24685
+ const where = /* @__PURE__ */ __name((ast, more = []) => and([...fixed, ...more, ...ast ? [queryFilter(ast, read2, options2)] : []]), "where");
24664
24686
  const scopes = by === "project" ? [{ scope: { board: true } }] : list3.map((one) => ({ account: one, scope: { account: taskAccount(one) } }));
24665
24687
  const rowsOf2 = /* @__PURE__ */ __name(async (filter) => (await Promise.all(scopes.map(async ({ account, scope }) => (await store.tasks.statRows(scope, filter)).map((row) => account ? { ...row, account } : row)))).flat(), "rowsOf");
24666
24688
  const all = await rowsOf2(where(withoutField(query, PERIOD_FIELD)));
@@ -24750,7 +24772,7 @@ var meetingNames = /* @__PURE__ */ __name(async (store, groups) => {
24750
24772
  }));
24751
24773
  }, "meetingNames");
24752
24774
 
24753
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/task-tag-filters.js
24775
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/task-tag-filters.js
24754
24776
  var taskTagFilters = /* @__PURE__ */ __name(async (store, query) => {
24755
24777
  const tags = /* @__PURE__ */ new Map();
24756
24778
  for (const node of query ? walkQuery(query.root) : [])
@@ -24759,7 +24781,7 @@ var taskTagFilters = /* @__PURE__ */ __name(async (store, query) => {
24759
24781
  return tags;
24760
24782
  }, "taskTagFilters");
24761
24783
 
24762
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/tasks.js
24784
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/tasks.js
24763
24785
  var TASK_QUERY = {
24764
24786
  entity: "task",
24765
24787
  backend: "sql",
@@ -24952,7 +24974,7 @@ var tasksService = /* @__PURE__ */ __name((deps, categories) => {
24952
24974
  const reviewAfterLink = /* @__PURE__ */ __name(async (store, id2) => !isClosedState((await store.tasks.get(id2))?.state ?? "done") ? store.tasks.reviewDuplicates(id2, { linked: true }) : 0, "reviewAfterLink");
24953
24975
  return {
24954
24976
  list: /* @__PURE__ */ __name(({ query, limit, offset, previews }) => inStore(async (store, account) => {
24955
- const where = query ? queryFilter(query, await queryColumns(store, account, query), { command: "tasks list" }) : void 0;
24977
+ const where = query ? queryFilter(query, await queryColumns(store, account, query), { command: "tasks list", zone: timezoneOf() }) : void 0;
24956
24978
  const rows = await store.tasks.query(taskAccount(account), where, { limit: limit + 1, offset });
24957
24979
  const shown = rows.slice(0, limit);
24958
24980
  return {
@@ -25259,7 +25281,7 @@ var taskView = /* @__PURE__ */ __name(async (store, account, task2) => {
25259
25281
  };
25260
25282
  }, "taskView");
25261
25283
 
25262
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/mail/owed.js
25284
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/mail/owed.js
25263
25285
  var mailTurn = /* @__PURE__ */ __name((newest) => {
25264
25286
  if (newest === null)
25265
25287
  return null;
@@ -25268,7 +25290,7 @@ var mailTurn = /* @__PURE__ */ __name((newest) => {
25268
25290
  return newest.addressed ? "owed" : null;
25269
25291
  }, "mailTurn");
25270
25292
 
25271
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/agenda-mail.js
25293
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/agenda-mail.js
25272
25294
  var absent = /* @__PURE__ */ __name((error) => {
25273
25295
  if (error instanceof CliError && error.code === "not_found")
25274
25296
  return void 0;
@@ -25278,7 +25300,7 @@ var mailActivity = /* @__PURE__ */ __name(async (store, account, since, chats) =
25278
25300
  const stored = await store.accounts.storedAccount(account).catch(absent);
25279
25301
  if (!stored)
25280
25302
  return { chats: [], storedAt: null, coverage: /* @__PURE__ */ __name(() => [], "coverage") };
25281
- const where = chats ? queryFilter(chats, MAIL_AGENDA_COLUMNS, { command: "tasks agenda" }) : void 0;
25303
+ const where = chats ? queryFilter(chats, MAIL_AGENDA_COLUMNS, { command: "tasks agenda", zone: timezoneOf() }) : void 0;
25282
25304
  const threads = await store.mail.threadActivity(stored.id, since, where);
25283
25305
  const synced = await store.sync.syncState(account, "mail_coverage");
25284
25306
  const window3 = (() => {
@@ -25326,7 +25348,7 @@ var mailActivity = /* @__PURE__ */ __name(async (store, account, since, chats) =
25326
25348
  };
25327
25349
  }, "mailActivity");
25328
25350
 
25329
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/agenda.js
25351
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/agenda.js
25330
25352
  var DAY2 = 864e5;
25331
25353
  var AGENDA_DEFAULTS = { unanswered: DAY2, waiting: 7 * DAY2 };
25332
25354
  var CLAIMS = ["none", "mine", "others", "any"];
@@ -25374,7 +25396,7 @@ var agendaService = /* @__PURE__ */ __name((deps, now = Date.now) => ({
25374
25396
  }), "find");
25375
25397
  const open7 = await find();
25376
25398
  const tags = await taskTagFilters(store, parts.tasks);
25377
- const listed2 = parts.tasks ? await find(queryFilter(parts.tasks, taskColumns2(holder, at, tags), { command: "tasks agenda" })) : open7;
25399
+ const listed2 = parts.tasks ? await find(queryFilter(parts.tasks, taskColumns2(holder, at, tags), { command: "tasks agenda", zone: timezoneOf() })) : open7;
25378
25400
  const tasks = listed2.map((task2) => ({ task: task2, reasons: reasonsOf(task2, at, dueWithin) })).filter(({ reasons }) => reasons.length > 0).sort((a, b) => urgency(a.task) - urgency(b.task)).map(({ task: task2, reasons }) => ({
25379
25401
  id: task2.id,
25380
25402
  key: task2.key,
@@ -25405,7 +25427,7 @@ var agendaService = /* @__PURE__ */ __name((deps, now = Date.now) => ({
25405
25427
  assignees
25406
25428
  }));
25407
25429
  const mail = account.provider === "email" ? await mailActivity(store, account, at - within, parts.chats) : void 0;
25408
- const activity = mail ?? await store.chats.chatActivity(account, at - within, parts.chats ? queryFilter(parts.chats, AGENDA_COLUMNS, { command: "tasks agenda" }) : void 0);
25430
+ const activity = mail ?? await store.chats.chatActivity(account, at - within, parts.chats ? queryFilter(parts.chats, AGENDA_COLUMNS, { command: "tasks agenda", zone: timezoneOf() }) : void 0);
25409
25431
  const turnOf = /* @__PURE__ */ __name((chat) => "turn" in chat ? chat.turn : chat.lastFromOwner === null ? null : chat.lastFromOwner ? "waiting" : "owed", "turnOf");
25410
25432
  const chats = activity.chats.map(({ lastMessageId, ...chat }) => ({
25411
25433
  turn: turnOf({ lastMessageId, ...chat }),
@@ -25580,18 +25602,18 @@ var agendaItem = /* @__PURE__ */ __name((shown) => {
25580
25602
  };
25581
25603
  }, "agendaItem");
25582
25604
 
25583
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/media-archive.js
25605
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/media-archive.js
25584
25606
  import { setTimeout as sleep3 } from "node:timers/promises";
25585
25607
 
25586
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
25608
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
25587
25609
  import { lstat } from "node:fs/promises";
25588
25610
 
25589
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
25611
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
25590
25612
  import { createHash as createHash4, randomUUID as randomUUID3 } from "node:crypto";
25591
25613
  import { open as open3, rename as rename2, unlink as unlink2 } from "node:fs/promises";
25592
25614
  import { join as join6 } from "node:path";
25593
25615
 
25594
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-metadata.js
25616
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-metadata.js
25595
25617
  import { createHash as createHash3 } from "node:crypto";
25596
25618
  var metadataLimit = 16384;
25597
25619
  var partialIdentity = /* @__PURE__ */ __name((locator) => JSON.stringify([locator.provider, locator.account, locator.occurrenceId, locator.assetId]), "partialIdentity");
@@ -25651,7 +25673,7 @@ var readPartialMetadata = /* @__PURE__ */ __name(async (path, locator, maxBytes,
25651
25673
  }
25652
25674
  }, "readPartialMetadata");
25653
25675
 
25654
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-writer.js
25676
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-writer.js
25655
25677
  import { randomUUID as randomUUID2 } from "node:crypto";
25656
25678
  import { open as open2, rename, unlink } from "node:fs/promises";
25657
25679
  import { join as join5 } from "node:path";
@@ -25743,7 +25765,7 @@ var partialWriter = /* @__PURE__ */ __name(async (input) => {
25743
25765
  };
25744
25766
  }, "partialWriter");
25745
25767
 
25746
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
25768
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
25747
25769
  var NativeRecordingPartialStore = class {
25748
25770
  static {
25749
25771
  __name(this, "NativeRecordingPartialStore");
@@ -25850,12 +25872,12 @@ var NativeRecordingPartialStore = class {
25850
25872
  }
25851
25873
  };
25852
25874
 
25853
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
25875
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
25854
25876
  import { createHash as createHash5 } from "node:crypto";
25855
25877
  import { link as link2 } from "node:fs/promises";
25856
25878
  import { basename as basename2, dirname as dirname5, join as join8, resolve as resolve2 } from "node:path";
25857
25879
 
25858
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-files.js
25880
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-files.js
25859
25881
  import { unlink as unlink3 } from "node:fs/promises";
25860
25882
  var verifiedPublicationFile = /* @__PURE__ */ __name(async (path, expected2, signal, writable = false) => {
25861
25883
  signal?.throwIfAborted();
@@ -25890,7 +25912,7 @@ var commitPublication = /* @__PURE__ */ __name(async (root, partialPath, finalPa
25890
25912
  signal?.throwIfAborted();
25891
25913
  }, "commitPublication");
25892
25914
 
25893
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-journal.js
25915
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-journal.js
25894
25916
  import { randomUUID as randomUUID4 } from "node:crypto";
25895
25917
  import { open as open4, rename as rename3, unlink as unlink4 } from "node:fs/promises";
25896
25918
  import { join as join7 } from "node:path";
@@ -25963,7 +25985,7 @@ var writePublicationJournal = /* @__PURE__ */ __name(async (root, path, prefix,
25963
25985
  }
25964
25986
  }, "writePublicationJournal");
25965
25987
 
25966
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
25988
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
25967
25989
  var NativeRecordingPublication = class {
25968
25990
  static {
25969
25991
  __name(this, "NativeRecordingPublication");
@@ -26036,7 +26058,7 @@ var NativeRecordingPublication = class {
26036
26058
  }
26037
26059
  };
26038
26060
 
26039
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/media-archive-manifest.js
26061
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/media-archive-manifest.js
26040
26062
  import { createHash as createHash6 } from "node:crypto";
26041
26063
  import { readdir } from "node:fs/promises";
26042
26064
  import { isAbsolute as isAbsolute2, join as join9, resolve as resolve3 } from "node:path";
@@ -26123,7 +26145,7 @@ var commitMediaEntry = /* @__PURE__ */ __name((root, one, beforePublish) => writ
26123
26145
  beforePublish
26124
26146
  }), "commitMediaEntry");
26125
26147
 
26126
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
26148
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
26127
26149
  var validator = '"media-completed-v1"';
26128
26150
  var maximumFileBytes = 64 * 1024 * 1024 * 1024;
26129
26151
  var archiveMediaFile = /* @__PURE__ */ __name(async (root, identity, kind, file2, beforeWrite, signal, metadata = {}) => {
@@ -26224,7 +26246,7 @@ var archiveMediaFile = /* @__PURE__ */ __name(async (root, identity, kind, file2
26224
26246
  return entry;
26225
26247
  }, "archiveMediaFile");
26226
26248
 
26227
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/media-archive-locks.js
26249
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/media-archive-locks.js
26228
26250
  import { mkdir, realpath } from "node:fs/promises";
26229
26251
  import { join as join10, resolve as resolve4 } from "node:path";
26230
26252
  var archiveLocations = /* @__PURE__ */ __name(async (initial, signal) => {
@@ -26291,17 +26313,7 @@ var withMediaArchiveLocks = /* @__PURE__ */ __name(async (directory2, signal, ru
26291
26313
  throw new CliError("validation_error", "archive locations changed during locking; run the command again");
26292
26314
  }, "withMediaArchiveLocks");
26293
26315
 
26294
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/media-archive.js
26295
- var validateMediaSince = /* @__PURE__ */ __name((value, flag = "--since-time") => {
26296
- if (value === void 0)
26297
- return void 0;
26298
- if (!/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.\d{1,3})?(?:Z|[+-]\d\d:\d\d)$/.test(value) || !Number.isFinite(Date.parse(value)))
26299
- throw new CliError("validation_error", `${flag} needs an ISO timestamp with a time zone`);
26300
- const date2 = value.slice(0, 10);
26301
- if ((/* @__PURE__ */ new Date(`${date2}T00:00:00Z`)).toISOString().slice(0, 10) !== date2)
26302
- throw new CliError("validation_error", `${flag} has an invalid calendar date`);
26303
- return Date.parse(value);
26304
- }, "validateMediaSince");
26316
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/media-archive.js
26305
26317
  var checkMediaArchive = /* @__PURE__ */ __name((directory2, signal) => withMediaArchiveLocks(directory2, signal, async (root) => {
26306
26318
  const entries = await readMediaManifests(root, signal);
26307
26319
  if (!entries.length)
@@ -26352,7 +26364,7 @@ var saveMessage = /* @__PURE__ */ __name(async (root, account, message, ports, k
26352
26364
  return { saved, existing };
26353
26365
  }, "saveMessage");
26354
26366
  var archiveMedia = /* @__PURE__ */ __name(async (ports, options2) => {
26355
- const since = validateMediaSince(options2.sinceTime);
26367
+ const since = options2.sinceTime === void 0 ? void 0 : momentOf(options2.sinceTime, "--since-time");
26356
26368
  const pageSize = options2.pageSize ?? 100;
26357
26369
  const pauseMs = options2.pauseMs ?? 1e3;
26358
26370
  if (!Number.isSafeInteger(pageSize) || pageSize < 1 || pageSize > 1e3 || !Number.isSafeInteger(pauseMs) || pauseMs < 0)
@@ -26374,10 +26386,10 @@ var archiveMedia = /* @__PURE__ */ __name(async (ports, options2) => {
26374
26386
  let saved = 0, existing = 0, chats = 0;
26375
26387
  const walk = /* @__PURE__ */ __name(async (chat) => {
26376
26388
  const seen = /* @__PURE__ */ new Set();
26377
- let before2;
26389
+ let before;
26378
26390
  for (; ; ) {
26379
26391
  await beforeWrite();
26380
- const page = await ports.messages.list(chat, { limit: pageSize, ...before2 ? { before: before2 } : {} });
26392
+ const page = await ports.messages.list(chat, { limit: pageSize, ...before ? { before } : {} });
26381
26393
  let fresh = 0;
26382
26394
  let reachedSince = false;
26383
26395
  let oldest;
@@ -26403,7 +26415,7 @@ var archiveMedia = /* @__PURE__ */ __name(async (ports, options2) => {
26403
26415
  break;
26404
26416
  if (!oldest || !fresh)
26405
26417
  throw new CliError("invalid_response", "media history pagination did not advance; archive is incomplete");
26406
- before2 = options2.orderByTime ? new Date(Date.parse(oldest.timestamp) + 1).toISOString() : page.items[0]?.id;
26418
+ before = options2.orderByTime ? new Date(Date.parse(oldest.timestamp) + 1).toISOString() : page.items[0]?.id;
26407
26419
  if (pauseMs)
26408
26420
  await sleep3(pauseMs, void 0, { signal: options2.signal });
26409
26421
  }
@@ -26444,7 +26456,7 @@ var archiveMedia = /* @__PURE__ */ __name(async (ports, options2) => {
26444
26456
  }, { create: true });
26445
26457
  }, "archiveMedia");
26446
26458
 
26447
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/media-archive-move.js
26459
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/media-archive-move.js
26448
26460
  import { realpath as realpath2, unlink as unlink5 } from "node:fs/promises";
26449
26461
  import { basename as basename3, dirname as dirname6, join as join11, resolve as resolve5 } from "node:path";
26450
26462
  var canonicalDestination = /* @__PURE__ */ __name(async (directory2) => {
@@ -26485,9 +26497,7 @@ var removeLocalCopy = /* @__PURE__ */ __name(async (root, entry, beforeWrite, si
26485
26497
  }
26486
26498
  }, "removeLocalCopy");
26487
26499
  var moveMediaArchive = /* @__PURE__ */ __name(async (options2) => {
26488
- const cutoff = validateMediaSince(options2.beforeTime, "--before-time");
26489
- if (cutoff === void 0)
26490
- throw new CliError("validation_error", "--before-time is required");
26500
+ const cutoff = momentOf(options2.beforeTime, "--before-time");
26491
26501
  const target2 = await canonicalDestination(options2.archiveDirectory);
26492
26502
  const source = await realpath2(options2.directory);
26493
26503
  if (source === target2)
@@ -26597,7 +26607,7 @@ var moveMediaArchive = /* @__PURE__ */ __name(async (options2) => {
26597
26607
  }, { additional: [target2], createAdditional: !options2.dryRun });
26598
26608
  }, "moveMediaArchive");
26599
26609
 
26600
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/model-downloads.js
26610
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/model-downloads.js
26601
26611
  import { writeFileSync as writeFileSync2 } from "node:fs";
26602
26612
  import { join as join12 } from "node:path";
26603
26613
  var bytesOf = /* @__PURE__ */ __name((model) => model.files.reduce((sum2, file2) => sum2 + file2.bytes, 0), "bytesOf");
@@ -26622,7 +26632,7 @@ var downloadTextModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
26622
26632
  `);
26623
26633
  await nativeRuntime({ env, progress });
26624
26634
  progress(`${model.id}: loading it once to check it works`);
26625
- const { openEmbedder: openEmbedder2 } = await import("./embed-LB6ONWHX.js");
26635
+ const { openEmbedder: openEmbedder2 } = await import("./embed-2IVIYNAJ.js");
26626
26636
  const embedder = await openEmbedder2(model, directory2);
26627
26637
  try {
26628
26638
  const [vector] = await embedder.embed(["check"], "query");
@@ -26643,7 +26653,7 @@ var downloadRerankModel = /* @__PURE__ */ __name(async (id2, { env, progress = /
26643
26653
  }
26644
26654
  await nativeRuntime({ env, progress });
26645
26655
  progress(`${model.id}: loading it once to check it works`);
26646
- const { openReranker } = await import("./rerank-TVMR3OLL.js");
26656
+ const { openReranker } = await import("./rerank-4YPB26FG.js");
26647
26657
  const reranker = await openReranker(model, directory2);
26648
26658
  try {
26649
26659
  await reranker.score("check", ["check"]);
@@ -26661,7 +26671,7 @@ var downloadImageModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
26661
26671
  await installFiles(placedImage(model, directory2), { progress, ...bytes2 ? { bytes: bytes2 } : {} });
26662
26672
  }
26663
26673
  progress(`${model.id}: loading it once to check it works`);
26664
- const { openPictureEmbedder } = await import("./embedder-WE7B2RU5.js");
26674
+ const { openPictureEmbedder } = await import("./embedder-2HU7JYZK.js");
26665
26675
  const embedder = await openPictureEmbedder(model, directory2);
26666
26676
  try {
26667
26677
  const vector = await embedder.embedQuery("check");
@@ -26673,7 +26683,7 @@ var downloadImageModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
26673
26683
  return { model, directory: directory2 };
26674
26684
  }, "downloadImageModel");
26675
26685
 
26676
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/domain/money-words.js
26686
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/domain/money-words.js
26677
26687
  var MONEY_REQUEST = "money-request";
26678
26688
  var MONEY_DONE = "money-done";
26679
26689
  var PROMISE = "promise";
@@ -26707,12 +26717,12 @@ var MONEY_WORDS = [
26707
26717
  }
26708
26718
  ];
26709
26719
 
26710
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/money-words.js
26720
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/money-words.js
26711
26721
  var moneyClassesOf = /* @__PURE__ */ __name((text2) => listsHit(text2, MONEY_WORDS), "moneyClassesOf");
26712
26722
 
26713
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/domain/status-words.js
26714
- var words = /* @__PURE__ */ __name((forms) => new RegExp(`(?<![\\p{L}\\p{N}])(?:${forms.join("|")})(?![\\p{L}\\p{N}])`, "iu"), "words");
26715
- var MONEY_DONE_FORMS = words([
26723
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/domain/status-words.js
26724
+ var words2 = /* @__PURE__ */ __name((forms) => new RegExp(`(?<![\\p{L}\\p{N}])(?:${forms.join("|")})(?![\\p{L}\\p{N}])`, "iu"), "words");
26725
+ var MONEY_DONE_FORMS = words2([
26716
26726
  "\u043E\u043F\u043B\u0430\u0442\u0438\u043B[\u0430\u0438]?",
26717
26727
  "\u0437\u0430\u043F\u043B\u0430\u0442\u0438\u043B[\u0430\u0438]?",
26718
26728
  "\u043F\u0435\u0440\u0435\u0432\u0435\u043B[\u0430\u0438]?",
@@ -26726,7 +26736,7 @@ var MONEY_DONE_FORMS = words([
26726
26736
  "pagado",
26727
26737
  "transfer\xED"
26728
26738
  ]);
26729
- var PROMISE_FORMS = words([
26739
+ var PROMISE_FORMS = words2([
26730
26740
  "\u0441\u0434\u0435\u043B\u0430\u044E",
26731
26741
  "\u043F\u0440\u0438\u0448\u043B\u044E",
26732
26742
  "\u043E\u0442\u043F\u0440\u0430\u0432\u043B\u044E",
@@ -26750,7 +26760,7 @@ var PROMISE_FORMS = words([
26750
26760
  "estar\xE1 listo"
26751
26761
  ]);
26752
26762
 
26753
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/project-status/items.js
26763
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/project-status/items.js
26754
26764
  var EXCERPT_CHARS = 80;
26755
26765
  var excerpt2 = /* @__PURE__ */ __name((text2) => {
26756
26766
  const flat = text2.replace(/\s+/g, " ").trim();
@@ -26772,7 +26782,7 @@ var whoOf = /* @__PURE__ */ __name((message) => ({
26772
26782
  var fromOwner = /* @__PURE__ */ __name((message) => message.outgoing === true, "fromOwner");
26773
26783
  var day = /* @__PURE__ */ __name((at) => new Date(at).toISOString().slice(0, 10), "day");
26774
26784
 
26775
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/project-status/signals/amounts.js
26785
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/project-status/signals/amounts.js
26776
26786
  var MONEY = DEFAULT_TASK_CATEGORIES.filter((category) => category.name === "money");
26777
26787
  var verbOf = /* @__PURE__ */ __name((text2) => {
26778
26788
  if (MONEY_DONE_FORMS.test(text2))
@@ -26853,7 +26863,7 @@ var amounts = {
26853
26863
  attention: /* @__PURE__ */ __name((items) => items.flatMap((item2) => item2.chat !== null && item2.data.state === "asked" ? [{ chat: item2.chat, weight: 2, why: "money asked" }] : []), "attention")
26854
26864
  };
26855
26865
 
26856
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/project-status/signals/children.js
26866
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/project-status/signals/children.js
26857
26867
  var children = {
26858
26868
  id: "children",
26859
26869
  version: 1,
@@ -26882,7 +26892,7 @@ var children = {
26882
26892
  }, "read")
26883
26893
  };
26884
26894
 
26885
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/project-status/signals/coverage.js
26895
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/project-status/signals/coverage.js
26886
26896
  var coverage = {
26887
26897
  id: "coverage",
26888
26898
  version: 1,
@@ -26911,7 +26921,7 @@ var coverage = {
26911
26921
  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")
26912
26922
  };
26913
26923
 
26914
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/project-status/signals/payments.js
26924
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/project-status/signals/payments.js
26915
26925
  var holding2 = /* @__PURE__ */ __name((row) => row.review !== "rejected", "holding");
26916
26926
  var item = /* @__PURE__ */ __name((row, at, data) => ({
26917
26927
  signal: "payments",
@@ -26961,7 +26971,7 @@ var payments = {
26961
26971
  }, "read")
26962
26972
  };
26963
26973
 
26964
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/project-status/signals/promises.js
26974
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/project-status/signals/promises.js
26965
26975
  var PATTERNS_PER_CHAT = 3;
26966
26976
  var DAY3 = 864e5;
26967
26977
  var KINDS2 = /* @__PURE__ */ new Set(["promise", "request"]);
@@ -27050,7 +27060,7 @@ var promises = {
27050
27060
  }, "read")
27051
27061
  };
27052
27062
 
27053
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/project-status/signals/questions.js
27063
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/project-status/signals/questions.js
27054
27064
  var PER_SIDE = 5;
27055
27065
  var WEEK = 7 * 864e5;
27056
27066
  var NOBODY = /* @__PURE__ */ new Set();
@@ -27081,7 +27091,7 @@ var questions2 = {
27081
27091
  }, "attention")
27082
27092
  };
27083
27093
 
27084
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/project-status/signals/reply-next.js
27094
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/project-status/signals/reply-next.js
27085
27095
  var targetOf = /* @__PURE__ */ __name((message, chat, owners) => {
27086
27096
  const byId2 = /* @__PURE__ */ __name((id2) => chat.messages.find((one) => one.id === id2), "byId");
27087
27097
  const quoted = message.replyTo ?? (message.replyToId === void 0 ? void 0 : byId2(message.replyToId));
@@ -27149,7 +27159,7 @@ var replyNext = {
27149
27159
  attention: /* @__PURE__ */ __name((items) => items.flatMap((item2) => item2.chat !== null && item2.data.next === "owner" ? [{ chat: item2.chat, weight: 2, why: "your move" }] : []), "attention")
27150
27160
  };
27151
27161
 
27152
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/project-status/signals/topics.js
27162
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/project-status/signals/topics.js
27153
27163
  var escaped = /* @__PURE__ */ __name((text2) => text2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
27154
27164
  var wholeWord = /* @__PURE__ */ __name((word) => new RegExp(`(?<![\\p{L}\\p{N}])${escaped(word)}(?![\\p{L}\\p{N}])`, "u"), "wholeWord");
27155
27165
  var matcherOf = /* @__PURE__ */ __name((query) => {
@@ -27195,7 +27205,7 @@ var topics = {
27195
27205
  }, "read")
27196
27206
  };
27197
27207
 
27198
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/project-status/signals/index.js
27208
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/project-status/signals/index.js
27199
27209
  var STATUS_SIGNALS = [
27200
27210
  replyNext,
27201
27211
  questions2,
@@ -27207,7 +27217,7 @@ var STATUS_SIGNALS = [
27207
27217
  children
27208
27218
  ];
27209
27219
 
27210
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/project-status/index.js
27220
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/project-status/index.js
27211
27221
  var DAY4 = 864e5;
27212
27222
  var STATUS_WINDOW = 300;
27213
27223
  var STATUS_CHATS = 16;
@@ -27396,7 +27406,7 @@ var projectStatus = /* @__PURE__ */ __name(async (store, input) => {
27396
27406
  };
27397
27407
  }, "projectStatus");
27398
27408
 
27399
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/account.js
27409
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/account.js
27400
27410
  var accountService = /* @__PURE__ */ __name((deps) => {
27401
27411
  const online = /* @__PURE__ */ __name(async (command) => {
27402
27412
  if (deps.offline)
@@ -27468,26 +27478,18 @@ var accountService = /* @__PURE__ */ __name((deps) => {
27468
27478
  };
27469
27479
  }, "accountService");
27470
27480
 
27471
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/domain/send-time.js
27472
- var MINUTE = 6e4;
27473
- var YEAR = 365 * 24 * 60 * MINUTE;
27474
- var DELAY = /^(\d+)(m|h|d)$/;
27475
- var UNIT_MS = { m: MINUTE, h: 60 * MINUTE, d: 24 * 60 * MINUTE };
27481
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/domain/send-time.js
27476
27482
  var sendTime = /* @__PURE__ */ __name((value, now = Date.now(), flag = "--at-time", zone) => {
27477
- const trimmed = value.trim();
27478
- const [, amount, unit] = DELAY.exec(trimmed) ?? [];
27479
- const at = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}/.test(trimmed) ? calendarMoment(trimmed.replace(" ", "T"), flag, zone === void 0 ? {} : { zone }) : amount && unit ? now + Number(amount) * (UNIT_MS[unit] ?? 0) : Number.NaN;
27480
- if (Number.isNaN(at)) {
27481
- throw new CliError("validation_error", `${flag} takes a time like 2026-09-25T09:00 or a delay like 30m, 2h, 1d \u2014 not "${value}"`);
27482
- }
27483
- if (at < now + MINUTE)
27484
- throw new CliError("validation_error", `${flag} has to be at least a minute from now`);
27485
- if (at > now + YEAR)
27486
- throw new CliError("validation_error", `${flag} can be at most a year from now`);
27483
+ const at = aheadOf(value, flag, now, {
27484
+ ...zone === void 0 ? {} : { zone },
27485
+ refuseDate: true,
27486
+ soonest: MINUTE,
27487
+ latest: YEAR
27488
+ });
27487
27489
  return new Date(at - at % MINUTE).toISOString();
27488
27490
  }, "sendTime");
27489
27491
 
27490
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/admin.js
27492
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/admin.js
27491
27493
  var recordMembership = /* @__PURE__ */ __name(async (deps, operationId, done2, change, fix, write) => {
27492
27494
  try {
27493
27495
  const held = await accountStoreIfOpen(deps);
@@ -27734,7 +27736,7 @@ var linkLimits = /* @__PURE__ */ __name(({ approval, expires, maxUses }) => {
27734
27736
  return expires === void 0 ? void 0 : sendTime(expires, Date.now(), "--expire-time");
27735
27737
  }, "linkLimits");
27736
27738
 
27737
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/mail-search.js
27739
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/mail-search.js
27738
27740
  var THREADS_PAGE = 500;
27739
27741
  var threadsOf = /* @__PURE__ */ __name(async (store, key) => {
27740
27742
  const account = await store.accounts.storedAccount(key).catch(() => void 0);
@@ -27771,18 +27773,14 @@ var withMailThreads = /* @__PURE__ */ __name((store) => {
27771
27773
  get: /* @__PURE__ */ __name((target2, key, receiver) => key === "chats" ? chats : Reflect.get(target2, key, receiver), "get")
27772
27774
  });
27773
27775
  }, "withMailThreads");
27774
- var before = /* @__PURE__ */ __name((newest) => (a, b) => {
27775
- if (!newest) {
27776
- if ((a.exact ?? false) !== (b.exact ?? false))
27777
- return a.exact ? -1 : 1;
27778
- if (a.score !== b.score)
27779
- return a.score === null ? 1 : b.score === null ? -1 : b.score - a.score;
27780
- }
27781
- return b.timestamp.localeCompare(a.timestamp);
27782
- }, "before");
27783
27776
  var mergeMail = /* @__PURE__ */ __name((messages, mail, limit, newest = false) => {
27784
27777
  const moved = new Set(mail.items.map(({ locator }) => locator));
27785
- const items = [...messages.items.filter(({ locator }) => !moved.has(locator)), ...mail.items].sort(before(newest));
27778
+ const kept2 = messages.items.filter(({ locator }) => !moved.has(locator));
27779
+ const items = newest ? [...kept2, ...mail.items].sort((a, b) => b.timestamp.localeCompare(a.timestamp)) : fuseRanked([kept2, mail.items], (hit) => ({
27780
+ exact: hit.exact,
27781
+ ranked: hit.score !== null,
27782
+ at: Date.parse(hit.timestamp)
27783
+ }));
27786
27784
  return {
27787
27785
  items: items.slice(0, limit),
27788
27786
  hasMore: messages.hasMore || mail.hasMore || items.length > limit
@@ -27799,7 +27797,7 @@ var mailAround = /* @__PURE__ */ __name(async (store, hit, count4) => {
27799
27797
  return void 0;
27800
27798
  return emails.slice(Math.max(0, at - count4), at + count4 + 1).map((email) => email.externalId === hit.id ? { ...messageOfEmail(email, hit.chatId), anchor: true } : messageOfEmail(email, hit.chatId));
27801
27799
  }, "mailAround");
27802
- var readMail = /* @__PURE__ */ __name(async (store, locator, { before: before2 = 0, after = 0 } = {}) => {
27800
+ var readMail = /* @__PURE__ */ __name(async (store, locator, { before = 0, after = 0 } = {}) => {
27803
27801
  const { provider, account, chat, message } = parseLocator(locator);
27804
27802
  if (provider !== "email")
27805
27803
  throw new CliError("validation_error", `${locator} is not an email \u2014 it names ${provider}`);
@@ -27810,10 +27808,10 @@ var readMail = /* @__PURE__ */ __name(async (store, locator, { before: before2 =
27810
27808
  const at = thread.findIndex(({ id: id2 }) => id2 === message);
27811
27809
  if (at < 0)
27812
27810
  throw new CliError("not_found", `no stored email ${message} in that thread`);
27813
- return thread.slice(Math.max(0, at - before2), at + after + 1).map((hit) => hit.id === message ? { ...hit, anchor: true } : hit);
27811
+ return thread.slice(Math.max(0, at - before), at + after + 1).map((hit) => hit.id === message ? { ...hit, anchor: true } : hit);
27814
27812
  }, "readMail");
27815
27813
 
27816
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/messages-search.js
27814
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/messages-search.js
27817
27815
  var PERSON_FIELDS = /* @__PURE__ */ new Set(["from", "to", "cc", "bcc"]);
27818
27816
  var MAIL_FIELDS = /* @__PURE__ */ new Set(["to", "cc", "bcc", "subject", "mailbox", "label", "is", "list"]);
27819
27817
  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");
@@ -28180,7 +28178,7 @@ var statsLucene = /* @__PURE__ */ __name(async (store, account, request, messeng
28180
28178
  };
28181
28179
  }, "statsLucene");
28182
28180
 
28183
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/rankings-selection.js
28181
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/rankings-selection.js
28184
28182
  var RANKING_SELECTION_BYTES = 64 * 1024;
28185
28183
  var object2 = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0, "object");
28186
28184
  function invalid3(message = "ranking selection is invalid \u2014 obtain a new drilldown from stats top") {
@@ -28349,7 +28347,7 @@ var readRankingSelection = /* @__PURE__ */ __name(async (store, input) => {
28349
28347
  };
28350
28348
  }, "readRankingSelection");
28351
28349
 
28352
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/search-record.js
28350
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/search-record.js
28353
28351
  var canonical = /* @__PURE__ */ __name((value, nested = false) => Array.isArray(value) ? value.map((one) => canonical(one, true)) : value !== null && typeof value === "object" ? Object.fromEntries(Object.entries(value).filter(([, one]) => one !== void 0 && (nested || one !== false)).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([key, one]) => [key, canonical(one, true)])) : value, "canonical");
28354
28352
  var searchRecordOf = /* @__PURE__ */ __name((command, params) => ({
28355
28353
  command,
@@ -28359,7 +28357,7 @@ var searchRecordOf = /* @__PURE__ */ __name((command, params) => ({
28359
28357
  fieldsVersion: FIELD_VERSION
28360
28358
  }), "searchRecordOf");
28361
28359
 
28362
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/admin-statistics.js
28360
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/admin-statistics.js
28363
28361
  function invalid4(message) {
28364
28362
  throw new CliError("validation_error", message);
28365
28363
  }
@@ -28653,7 +28651,7 @@ var adminStatisticsService = /* @__PURE__ */ __name((deps) => ({
28653
28651
  }, "evidence")
28654
28652
  }), "adminStatisticsService");
28655
28653
 
28656
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/archive-gaps.js
28654
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/archive-gaps.js
28657
28655
  import { createHash as createHash7, randomUUID as randomUUID5 } from "node:crypto";
28658
28656
  var GAP_BOUNDS = { maxGaps: 5, limit: 500, timeMs: 3e4 };
28659
28657
  var validateRepair = /* @__PURE__ */ __name((messenger, options2) => {
@@ -28709,12 +28707,12 @@ var gapsService = /* @__PURE__ */ __name((deps) => {
28709
28707
  if (prepare)
28710
28708
  validateCatchUp(deps, prepare);
28711
28709
  deps.guard.check({ chatId: null, key: "store.gaps.repair" }, { reserve: false });
28712
- const before2 = await plan(chat);
28713
- if (options2.fingerprint !== void 0 && options2.fingerprint !== before2.fingerprint)
28710
+ const before = await plan(chat);
28711
+ if (options2.fingerprint !== void 0 && options2.fingerprint !== before.fingerprint)
28714
28712
  throw new CliError("validation_error", "the gap plan changed; inspect it again before repairing");
28715
28713
  const store = await deps.store();
28716
28714
  const holder = randomUUID5();
28717
- if (!await store.sync.claim(before2.account, before2.chat, "gaps", holder, timeMs + 5e3))
28715
+ if (!await store.sync.claim(before.account, before.chat, "gaps", holder, timeMs + 5e3))
28718
28716
  throw new CliError("validation_error", "another gap repair holds this chat; retry after it finishes");
28719
28717
  const started = Date.now();
28720
28718
  const controller = new AbortController();
@@ -28726,7 +28724,7 @@ var gapsService = /* @__PURE__ */ __name((deps) => {
28726
28724
  let stopped;
28727
28725
  try {
28728
28726
  for (let round = 0; round < maxGaps; round += 1) {
28729
- const current = await plan(before2.chat);
28727
+ const current = await plan(before.chat);
28730
28728
  const gap = current.gaps.at(-1);
28731
28729
  if (!gap)
28732
28730
  break;
@@ -28737,7 +28735,7 @@ var gapsService = /* @__PURE__ */ __name((deps) => {
28737
28735
  let result;
28738
28736
  let windowFetched = 0;
28739
28737
  try {
28740
- result = await abortable(() => archiveService(deps).fetch(before2.chat, {
28738
+ result = await abortable(() => archiveService(deps).fetch(before.chat, {
28741
28739
  window: gap,
28742
28740
  onRequest: /* @__PURE__ */ __name(() => {
28743
28741
  requests += 1;
@@ -28766,14 +28764,14 @@ var gapsService = /* @__PURE__ */ __name((deps) => {
28766
28764
  }
28767
28765
  repaired.push(gap);
28768
28766
  }
28769
- const after = await plan(before2.chat);
28767
+ const after = await plan(before.chat);
28770
28768
  const remainingMs = timeMs - (Date.now() - started);
28771
- const prepared = !prepare ? void 0 : remainingMs <= 0 || signal.aborted ? { complete: false, reason: "time_or_abort_bound" } : await catchUpSearch(deps, before2.chat, { ...prepare, timeMs: Math.min(prepare.timeMs ?? 3e4, remainingMs) }, signal);
28769
+ const prepared = !prepare ? void 0 : remainingMs <= 0 || signal.aborted ? { complete: false, reason: "time_or_abort_bound" } : await catchUpSearch(deps, before.chat, { ...prepare, timeMs: Math.min(prepare.timeMs ?? 3e4, remainingMs) }, signal);
28772
28770
  return {
28773
28771
  version: 1,
28774
28772
  scope: "interior",
28775
- chat: before2.chat,
28776
- before: before2,
28773
+ chat: before.chat,
28774
+ before,
28777
28775
  after,
28778
28776
  repaired,
28779
28777
  fetched,
@@ -28784,18 +28782,18 @@ var gapsService = /* @__PURE__ */ __name((deps) => {
28784
28782
  };
28785
28783
  } finally {
28786
28784
  clearTimeout(timer);
28787
- await store.sync.release(before2.account, before2.chat, "gaps", holder);
28785
+ await store.sync.release(before.account, before.chat, "gaps", holder);
28788
28786
  }
28789
28787
  }, "repair");
28790
28788
  return { plan, repair };
28791
28789
  }, "gapsService");
28792
28790
 
28793
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/attachments.js
28791
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/attachments.js
28794
28792
  import { createHash as createHash10 } from "node:crypto";
28795
28793
  import { constants as constants2, mkdirSync as mkdirSync5 } from "node:fs";
28796
28794
  import { lstat as lstat5, open as open6, readFile as readFile2, stat as stat2 } from "node:fs/promises";
28797
28795
 
28798
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/attachments/directory.js
28796
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/attachments/directory.js
28799
28797
  import { lstat as lstat2, readdir as readdir2, realpath as realpath3 } from "node:fs/promises";
28800
28798
  import { basename as basename4, join as join13, relative as relative2, sep as sep2 } from "node:path";
28801
28799
  var MAX_FILES = 1e4;
@@ -28866,15 +28864,15 @@ var directoryPaths = /* @__PURE__ */ __name(async (store, chat, directory2, app,
28866
28864
  return choices;
28867
28865
  }, "directoryPaths");
28868
28866
 
28869
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/attachments/documents.js
28867
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/attachments/documents.js
28870
28868
  import { posix } from "node:path";
28871
28869
 
28872
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/attachments/container.js
28870
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/attachments/container.js
28873
28871
  import { setImmediate as tick } from "node:timers/promises";
28874
28872
  import { crc32 } from "node:zlib";
28875
28873
  var import_xmldom = __toESM(require_lib(), 1);
28876
28874
 
28877
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/attachments/encoding.js
28875
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/attachments/encoding.js
28878
28876
  var import_chardet = __toESM(require_lib2(), 1);
28879
28877
  var import_iconv_lite = __toESM(require_lib3(), 1);
28880
28878
  var SAMPLE = 65536;
@@ -28976,7 +28974,7 @@ var decodeXml = /* @__PURE__ */ __name((bytes2) => {
28976
28974
  return result.text;
28977
28975
  }, "decodeXml");
28978
28976
 
28979
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/attachments/container.js
28977
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/attachments/container.js
28980
28978
  var MAX_PART = 10 * 1024 * 1024;
28981
28979
  var MAX_ENTRIES = 1e3;
28982
28980
  var decoder = new TextDecoder("utf-8", { fatal: true });
@@ -29191,7 +29189,7 @@ var elements = /* @__PURE__ */ __name((node, name, namespace) => {
29191
29189
  return found;
29192
29190
  }, "elements");
29193
29191
 
29194
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/attachments/sheets.js
29192
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/attachments/sheets.js
29195
29193
  var columnName = /* @__PURE__ */ __name((column) => {
29196
29194
  let name = "";
29197
29195
  for (let rest = column; rest > 0; rest = Math.floor((rest - 1) / 26))
@@ -29246,7 +29244,7 @@ var sheetText = /* @__PURE__ */ __name((sheets2, maxChars = MAX_TEXT_CHARS) => {
29246
29244
  return { text: parts.join("").trim(), truncated: false };
29247
29245
  }, "sheetText");
29248
29246
 
29249
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/attachments/documents.js
29247
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/attachments/documents.js
29250
29248
  var OFFICE = "urn:oasis:names:tc:opendocument:xmlns:office:1.0";
29251
29249
  var TEXT = "urn:oasis:names:tc:opendocument:xmlns:text:1.0";
29252
29250
  var TABLE = "urn:oasis:names:tc:opendocument:xmlns:table:1.0";
@@ -29646,10 +29644,10 @@ var readDocument = /* @__PURE__ */ __name(async (bytes2, kind, signal) => {
29646
29644
  }
29647
29645
  }, "readDocument");
29648
29646
 
29649
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/attachments/extract.js
29647
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/attachments/extract.js
29650
29648
  import { extname as extname3 } from "node:path";
29651
29649
 
29652
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/readers/engine.js
29650
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/readers/engine.js
29653
29651
  import { readFileSync as readFileSync5 } from "node:fs";
29654
29652
  import { dirname as dirname7, extname as extname2, join as join14 } from "node:path";
29655
29653
  import { fileURLToPath } from "node:url";
@@ -29672,7 +29670,7 @@ var versionOf = /* @__PURE__ */ __name((name) => {
29672
29670
  }
29673
29671
  return name;
29674
29672
  }, "versionOf");
29675
- var withEngine = /* @__PURE__ */ __name(async (load, name, read) => {
29673
+ var withEngine = /* @__PURE__ */ __name(async (load, name, read2) => {
29676
29674
  let engine;
29677
29675
  try {
29678
29676
  const loaded2 = await load(name);
@@ -29684,7 +29682,7 @@ var withEngine = /* @__PURE__ */ __name(async (load, name, read) => {
29684
29682
  }
29685
29683
  const extractor = `${name === "mammoth" ? "docx" : name === "word-extractor" ? "doc" : "pdf"}:${versionOf(name)}`;
29686
29684
  try {
29687
- return await read(engine, extractor);
29685
+ return await read2(engine, extractor);
29688
29686
  } catch (error) {
29689
29687
  if (error instanceof ReaderLimit)
29690
29688
  return { status: "too-large" };
@@ -29696,12 +29694,12 @@ var withEngine = /* @__PURE__ */ __name(async (load, name, read) => {
29696
29694
  var startsWith = /* @__PURE__ */ __name((bytes2, magic) => bytes2.length >= magic.length && [...magic].every((char, index) => bytes2[index] === char.charCodeAt(0)), "startsWith");
29697
29695
  var extensionOf = /* @__PURE__ */ __name(({ name, path }) => extname2(name ?? path).toLowerCase(), "extensionOf");
29698
29696
  var capped2 = /* @__PURE__ */ __name((text2) => text2.length > MAX_TEXT_CHARS ? text2.slice(0, MAX_TEXT_CHARS) : text2, "capped");
29699
- var derived = /* @__PURE__ */ __name((bytes2, extractor, read) => {
29697
+ var derived = /* @__PURE__ */ __name((bytes2, extractor, read2) => {
29700
29698
  const decoded = decodeText(bytes2);
29701
29699
  if ("error" in decoded)
29702
29700
  return { status: "unreadable", extractor, error: decoded.error };
29703
29701
  try {
29704
- const text2 = read(decoded.text);
29702
+ const text2 = read2(decoded.text);
29705
29703
  return text2 === "" ? { status: "needs-agent", extractor } : { status: "extracted", text: capped2(text2), extractor };
29706
29704
  } catch (error) {
29707
29705
  if (error instanceof ReaderLimit)
@@ -29710,7 +29708,7 @@ var derived = /* @__PURE__ */ __name((bytes2, extractor, read) => {
29710
29708
  }
29711
29709
  }, "derived");
29712
29710
 
29713
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/readers/image/index.js
29711
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/readers/image/index.js
29714
29712
  var IMAGES = /* @__PURE__ */ new Set([".jpg", ".jpeg", ".png", ".webp", ".gif", ".heic", ".tif", ".tiff", ".bmp"]);
29715
29713
  var image2 = {
29716
29714
  id: "image",
@@ -29719,7 +29717,7 @@ var image2 = {
29719
29717
  read: /* @__PURE__ */ __name(async () => ({ status: "needs-agent" }), "read")
29720
29718
  };
29721
29719
 
29722
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/readers/doc/index.js
29720
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/readers/doc/index.js
29723
29721
  var OLE = "\xD0\xCF\xE0\xA1\xB1\xE1";
29724
29722
  var doc = {
29725
29723
  id: "doc",
@@ -29731,7 +29729,7 @@ var doc = {
29731
29729
  }), "read")
29732
29730
  };
29733
29731
 
29734
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/readers/docx/index.js
29732
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/readers/docx/index.js
29735
29733
  var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
29736
29734
  var docx = {
29737
29735
  id: "docx",
@@ -29744,10 +29742,10 @@ var docx = {
29744
29742
  }), "read")
29745
29743
  };
29746
29744
 
29747
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/attachments/markup.js
29745
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/attachments/markup.js
29748
29746
  var import_iconv_lite2 = __toESM(require_lib3(), 1);
29749
29747
 
29750
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/domain/html-entities.js
29748
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/domain/html-entities.js
29751
29749
  var NAMED = {
29752
29750
  amp: "&",
29753
29751
  lt: "<",
@@ -29799,7 +29797,7 @@ var decodeEntities = /* @__PURE__ */ __name((text2) => text2.replace(/&(#x[0-9a-
29799
29797
  return body[1] === "x" || body[1] === "X" ? character(Number.parseInt(body.slice(2), 16), entity) : character(Number(body.slice(1)), entity);
29800
29798
  }), "decodeEntities");
29801
29799
 
29802
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/attachments/markup.js
29800
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/attachments/markup.js
29803
29801
  var RTF_SKIPPED = /* @__PURE__ */ new Set([
29804
29802
  "fonttbl",
29805
29803
  "colortbl",
@@ -29965,9 +29963,9 @@ var htmlText = /* @__PURE__ */ __name((source) => {
29965
29963
  return decodeEntities(replaceTags(blocks, /<[^>]*>/g, "")).replace(/(?<![ \t\u00a0])[ \t\u00a0]+\n/g, "\n").replace(/\n{3,}/g, "\n\n").trim();
29966
29964
  }, "htmlText");
29967
29965
 
29968
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/readers/html/page.js
29966
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/readers/html/page.js
29969
29967
  var clean = /* @__PURE__ */ __name((value) => typeof value === "string" ? value.replace(/\s+/g, " ").trim() : "", "clean");
29970
- var namesIn = /* @__PURE__ */ __name((value) => [value].flat().map((entry) => typeof entry === "string" ? clean(entry) : clean(entry?.name)).filter(Boolean).join(", "), "namesIn");
29968
+ var namesIn2 = /* @__PURE__ */ __name((value) => [value].flat().map((entry) => typeof entry === "string" ? clean(entry) : clean(entry?.name)).filter(Boolean).join(", "), "namesIn");
29971
29969
  var jsonLdNodes = /* @__PURE__ */ __name((document) => {
29972
29970
  const nodes = [];
29973
29971
  for (const script of document.querySelectorAll('script[type="application/ld+json"]')) {
@@ -29991,7 +29989,7 @@ var pageMetadata = /* @__PURE__ */ __name((document) => {
29991
29989
  }, "set");
29992
29990
  set("title", clean(document.title));
29993
29991
  set("description", meta('meta[name="description"]') || meta('meta[property="og:description"]'));
29994
- set("author", meta('meta[name="author"]') || meta('meta[property="article:author"]') || namesIn(primary?.author));
29992
+ set("author", meta('meta[name="author"]') || meta('meta[property="article:author"]') || namesIn2(primary?.author));
29995
29993
  set("published", meta('meta[property="article:published_time"]') || clean(primary?.datePublished));
29996
29994
  set("language", clean(document.documentElement.getAttribute("lang")));
29997
29995
  set("site", meta('meta[property="og:site_name"]'));
@@ -30021,7 +30019,7 @@ var markdownSections = /* @__PURE__ */ __name((text2) => {
30021
30019
  return found.map((section, index) => ({ ...section, end: found[index + 1]?.start ?? text2.length }));
30022
30020
  }, "markdownSections");
30023
30021
 
30024
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/readers/html/index.js
30022
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/readers/html/index.js
30025
30023
  var HTML = /* @__PURE__ */ new Set([".html", ".htm", ".xhtml"]);
30026
30024
  var first = /* @__PURE__ */ __name((...values) => values.find((value) => typeof value === "string" && value !== ""), "first");
30027
30025
  var loaded = /* @__PURE__ */ __name(async (load, name) => {
@@ -30092,7 +30090,7 @@ var html = {
30092
30090
  }, "read")
30093
30091
  };
30094
30092
 
30095
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/readers/office/index.js
30093
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/readers/office/index.js
30096
30094
  var office = {
30097
30095
  id: "office",
30098
30096
  version: documentExtractor("odt"),
@@ -30103,7 +30101,7 @@ var office = {
30103
30101
  }, "read")
30104
30102
  };
30105
30103
 
30106
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/readers/pdf/index.js
30104
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/readers/pdf/index.js
30107
30105
  var pdf = {
30108
30106
  id: "pdf",
30109
30107
  version: "unpdf",
@@ -30170,7 +30168,7 @@ var pdf = {
30170
30168
  }), "read")
30171
30169
  };
30172
30170
 
30173
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/readers/plain/index.js
30171
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/readers/plain/index.js
30174
30172
  var PLAIN = /* @__PURE__ */ new Set([".txt", ".md", ".markdown", ".csv", ".tsv", ".json", ".log"]);
30175
30173
  var isPlain = /* @__PURE__ */ __name((hint) => PLAIN.has(extensionOf(hint)) || hint.mime?.startsWith("text/") || hint.mime === "application/json", "isPlain");
30176
30174
  var readPlain = /* @__PURE__ */ __name((bytes2) => {
@@ -30190,7 +30188,7 @@ var plain = {
30190
30188
  read: /* @__PURE__ */ __name(async (bytes2) => readPlain(bytes2), "read")
30191
30189
  };
30192
30190
 
30193
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/readers/rtf/index.js
30191
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/readers/rtf/index.js
30194
30192
  var rtf = {
30195
30193
  id: "rtf",
30196
30194
  version: "v1",
@@ -30198,10 +30196,10 @@ var rtf = {
30198
30196
  read: /* @__PURE__ */ __name(async (bytes2) => derived(bytes2, "rtf:v1", rtfText), "read")
30199
30197
  };
30200
30198
 
30201
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
30199
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
30202
30200
  import { basename as basename5 } from "node:path";
30203
30201
 
30204
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/attachments/csv-spans.js
30202
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/attachments/csv-spans.js
30205
30203
  var delimitedSpans = /* @__PURE__ */ __name((text2, delimiter, maxCells = 1e4) => {
30206
30204
  const cells = [];
30207
30205
  let row = 1, column = 1, start = 0, quoted = false, truncated = false;
@@ -30239,7 +30237,7 @@ var delimitedSpans = /* @__PURE__ */ __name((text2, delimiter, maxCells = 1e4) =
30239
30237
  return { cells, truncated };
30240
30238
  }, "delimitedSpans");
30241
30239
 
30242
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
30240
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
30243
30241
  var DELIMITED = {
30244
30242
  ".csv": ",",
30245
30243
  ".tsv": " ",
@@ -30278,7 +30276,7 @@ var sheets = {
30278
30276
  }, "read")
30279
30277
  };
30280
30278
 
30281
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/readers/registry.js
30279
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/readers/registry.js
30282
30280
  var BUILT_INS2 = [office, pdf, docx, doc, rtf, html, sheets, plain, image2];
30283
30281
  var HEAD_BYTES = 1024;
30284
30282
  var readers = [...BUILT_INS2];
@@ -30288,7 +30286,7 @@ var readWithRegistry = /* @__PURE__ */ __name(async (bytes2, hint, context2) =>
30288
30286
  return reader ? reader.read(bytes2, hint, context2) : { status: "unsupported" };
30289
30287
  }, "readWithRegistry");
30290
30288
 
30291
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/attachments/extract.js
30289
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/attachments/extract.js
30292
30290
  var importEngine = /* @__PURE__ */ __name((name) => importFrom(new URL("attachments/extract.js", import.meta.resolve("@wirecat/cli-core")).href, name), "importEngine");
30293
30291
  var extensionOf2 = /* @__PURE__ */ __name(({ name, path }) => extname3(name ?? path).toLowerCase(), "extensionOf");
30294
30292
  var extractText = /* @__PURE__ */ __name(async (bytes2, hint, load, signal, env = process.env) => {
@@ -31367,7 +31365,7 @@ function imageSize(input) {
31367
31365
  }
31368
31366
  __name(imageSize, "imageSize");
31369
31367
 
31370
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/attachments/ocr.js
31368
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/attachments/ocr.js
31371
31369
  var MAX_PAGES = 20;
31372
31370
  var MAX_PIXELS = 2e7;
31373
31371
  var cancelled2 = /* @__PURE__ */ __name((signal) => {
@@ -31527,7 +31525,7 @@ var ocrPdf = /* @__PURE__ */ __name(async (bytes2, pipeline2, load, signal) => {
31527
31525
  }
31528
31526
  }, "ocrPdf");
31529
31527
 
31530
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/attachments/pdf-preview.js
31528
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/attachments/pdf-preview.js
31531
31529
  var pdfPreview = /* @__PURE__ */ __name(async (bytes2, page, signal, load = importEngine, env = process.env) => {
31532
31530
  const limits = pdfPreviewLimits(env);
31533
31531
  const cancelled3 = /* @__PURE__ */ __name(() => {
@@ -31604,7 +31602,7 @@ var pdfPreview = /* @__PURE__ */ __name(async (bytes2, page, signal, load = impo
31604
31602
  }
31605
31603
  }, "pdfPreview");
31606
31604
 
31607
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/attachments/picture-reading.js
31605
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/attachments/picture-reading.js
31608
31606
  import { spawn } from "node:child_process";
31609
31607
  import { mkdtempSync, readFileSync as readFileSync6, rmSync as rmSync2, writeFileSync as writeFileSync3 } from "node:fs";
31610
31608
  import { tmpdir } from "node:os";
@@ -31758,16 +31756,16 @@ Read the attached picture.`,
31758
31756
  text2 = readFileSync6(answer, "utf8");
31759
31757
  } catch {
31760
31758
  }
31761
- const read = text2.trim();
31762
- if (read === "")
31759
+ const read2 = text2.trim();
31760
+ if (read2 === "")
31763
31761
  throw new CliError("invalid_response", `${TITLE[agent]} answered nothing`, { reason: "picture-reading.failed" });
31764
- return read;
31762
+ return read2;
31765
31763
  } finally {
31766
31764
  rmSync2(folder, { recursive: true, force: true });
31767
31765
  }
31768
31766
  }, "readPictureWithAgent");
31769
31767
 
31770
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/attachments/transfer.js
31768
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/attachments/transfer.js
31771
31769
  import { createHash as createHash8 } from "node:crypto";
31772
31770
  import { constants } from "node:fs";
31773
31771
  import { lstat as lstat3, open as open5 } from "node:fs/promises";
@@ -31786,17 +31784,17 @@ var retainedBytes = /* @__PURE__ */ __name(async (path, options2, captureFile =
31786
31784
  }, "cancelled");
31787
31785
  cancelled3();
31788
31786
  try {
31789
- const before2 = await lstat3(path);
31790
- if (!before2.isFile() || before2.isSymbolicLink())
31787
+ const before = await lstat3(path);
31788
+ if (!before.isFile() || before.isSymbolicLink())
31791
31789
  throw new CliError("validation_error", "the retained attachment must be a regular file");
31792
- if (before2.size > maxBytes)
31790
+ if (before.size > maxBytes)
31793
31791
  throw new CliError("validation_error", `the retained attachment exceeds ${maxBytes / 1024 / 1024} MiB; configure MESSAGING_ATTACHMENT_MAX_MIB`);
31794
- if (offsetBytes > before2.size)
31792
+ if (offsetBytes > before.size)
31795
31793
  throw new CliError("validation_error", "the byte offset is past the end of this attachment");
31796
31794
  const handle = await open5(path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0));
31797
31795
  try {
31798
31796
  const opened = await handle.stat();
31799
- if (!opened.isFile() || opened.ino !== before2.ino || opened.dev !== before2.dev || opened.size !== before2.size)
31797
+ if (!opened.isFile() || opened.ino !== before.ino || opened.dev !== before.dev || opened.size !== before.size)
31800
31798
  throw new CliError("validation_error", "the retained attachment changed; restart its transfer");
31801
31799
  const bytes2 = Buffer.alloc(Math.min(chunkBytes, opened.size - offsetBytes));
31802
31800
  const capturedFile = captureFile ? Buffer.alloc(opened.size) : void 0;
@@ -31875,7 +31873,7 @@ var transferMime = /* @__PURE__ */ __name((head, hint, name = null) => {
31875
31873
  return hint !== null && /^[a-z0-9.+-]+\/[a-z0-9.+-]+$/i.test(hint) ? hint : "application/octet-stream";
31876
31874
  }, "transferMime");
31877
31875
 
31878
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/file-download.js
31876
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/file-download.js
31879
31877
  import { createWriteStream, mkdirSync as mkdirSync4 } from "node:fs";
31880
31878
  import { link as link3, rm } from "node:fs/promises";
31881
31879
  import { join as join16, resolve as resolve6 } from "node:path";
@@ -31989,12 +31987,12 @@ var save = /* @__PURE__ */ __name(async (file2, directory2, fallbackName, { uniq
31989
31987
  }
31990
31988
  }, "save");
31991
31989
 
31992
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/pictures.js
31990
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/pictures.js
31993
31991
  import { createHash as createHash9 } from "node:crypto";
31994
31992
  import { lstat as lstat4, readFile } from "node:fs/promises";
31995
31993
  import { setTimeout as sleep4 } from "node:timers/promises";
31996
31994
 
31997
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/domain/models.js
31995
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/domain/models.js
31998
31996
  var GROUP_SETTINGS = [
31999
31997
  "allCanPin",
32000
31998
  "onlyAdminsAdd",
@@ -32008,7 +32006,7 @@ var ADMIN_RIGHTS = ["read", "members", "admins", "info", "pin", "link", "post",
32008
32006
  var senderIsMe = /* @__PURE__ */ __name((message, account) => message.outgoing === true || message.senderId !== null && String(message.senderId) === account, "senderIsMe");
32009
32007
  var MEDIA_KINDS = ["photo", "video", "file", "audio", "link"];
32010
32008
 
32011
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/pictures.js
32009
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/pictures.js
32012
32010
  var PICTURE_MAX_BYTES = 25 * 1024 * 1024;
32013
32011
  var PICTURE_FLOOR = 0.25;
32014
32012
  var PAGE4 = 50;
@@ -32016,7 +32014,7 @@ var SAVE_EVERY = 8;
32016
32014
  var PICTURES_OFF = "picture search is off for this profile \u2014 set pictureSearch to true in its config to turn it on";
32017
32015
  var missingModel = /* @__PURE__ */ __name((id2) => `the picture model is not downloaded \u2014 \`images models download ${id2}\` fetches it`, "missingModel");
32018
32016
  var plainWords = /* @__PURE__ */ __name((query) => query.replace(/\b(?:text|content|transcript|filename):("[^"]*"|\S+)/gi, "$1").replace(/\b[a-z_]+:("[^"]*"|\[[^\]]*\]|\{[^}]*\}|\([^)]*\)|\S+)/gi, " ").replace(/\b(?:AND|OR|NOT)\b/g, " ").replace(/[()"+\-~^*?\\[\]{}!|&]/g, " ").replace(/\s+/g, " ").trim(), "plainWords");
32019
- var pictureBytes = /* @__PURE__ */ __name(async (picture, files, read) => {
32017
+ var pictureBytes = /* @__PURE__ */ __name(async (picture, files, read2) => {
32020
32018
  if (picture.localPath) {
32021
32019
  try {
32022
32020
  const found = await lstat4(picture.localPath);
@@ -32037,7 +32035,7 @@ var pictureBytes = /* @__PURE__ */ __name(async (picture, files, read) => {
32037
32035
  return void 0;
32038
32036
  parts.push(part);
32039
32037
  }
32040
- await read(file2);
32038
+ await read2(file2);
32041
32039
  return Buffer.concat(parts);
32042
32040
  }, "pictureBytes");
32043
32041
  var picturesService = /* @__PURE__ */ __name((deps) => {
@@ -32049,7 +32047,7 @@ var picturesService = /* @__PURE__ */ __name((deps) => {
32049
32047
  const directory2 = imageModelsDirectory(deps.env);
32050
32048
  if (!isImageModelInstalled(model2, directory2))
32051
32049
  throw new CliError("not_found", missingModel(model2.id), { reason: "model.not-downloaded", model: model2.id });
32052
- const { openPictureEmbedder } = await import("./embedder-WE7B2RU5.js");
32050
+ const { openPictureEmbedder } = await import("./embedder-2HU7JYZK.js");
32053
32051
  return openPictureEmbedder(model2, directory2);
32054
32052
  }, "open");
32055
32053
  const embedder = /* @__PURE__ */ __name(() => {
@@ -32223,7 +32221,7 @@ var withPictures = /* @__PURE__ */ __name((messages, pictures) => ({
32223
32221
  }, "search")
32224
32222
  }), "withPictures");
32225
32223
 
32226
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/attachments.js
32224
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/attachments.js
32227
32225
  var ATTACHMENT_QUERY = {
32228
32226
  entity: "attachment",
32229
32227
  backend: "sql",
@@ -32387,7 +32385,7 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
32387
32385
  };
32388
32386
  const batch = batchProgress(deps.env);
32389
32387
  const fetched = /* @__PURE__ */ new Set();
32390
- let read = 0;
32388
+ let read2 = 0;
32391
32389
  let beforePk = cursor === void 0 ? void 0 : Number(cursor);
32392
32390
  let scanned = 0;
32393
32391
  const pending = [];
@@ -32410,12 +32408,12 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
32410
32408
  if (extraction && bytes2 !== void 0 && (!ocr || status === "extracted") && (status === "extracted" || file2.read?.error !== null)) {
32411
32409
  if (await keep(store, file2, extraction, bytes2, sha) === false) {
32412
32410
  run2.unchanged += 1;
32413
- read += 1;
32411
+ read2 += 1;
32414
32412
  return;
32415
32413
  }
32416
32414
  }
32417
32415
  if (status !== "missing" && status !== "too-large" && status !== "engine-missing")
32418
- read += 1;
32416
+ read2 += 1;
32419
32417
  if (extraction?.status === "engine-missing" && !run2.enginesMissing.includes(extraction.engine))
32420
32418
  run2.enginesMissing.push(extraction.engine);
32421
32419
  if (status === "extracted")
@@ -32471,9 +32469,9 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
32471
32469
  limit: PAGE5
32472
32470
  });
32473
32471
  for (const file2 of page) {
32474
- while (pending.length && (pending.length >= concurrency || limit !== void 0 && read + pending.length >= limit))
32472
+ while (pending.length && (pending.length >= concurrency || limit !== void 0 && read2 + pending.length >= limit))
32475
32473
  await pending.shift();
32476
- if (batch.stopped || signal?.aborted || limit !== void 0 && read >= limit || scanLimit !== void 0 && scanned >= scanLimit) {
32474
+ if (batch.stopped || signal?.aborted || limit !== void 0 && read2 >= limit || scanLimit !== void 0 && scanned >= scanLimit) {
32477
32475
  run2.complete = false;
32478
32476
  if (beforePk !== void 0)
32479
32477
  run2.cursor = String(beforePk);
@@ -32532,7 +32530,7 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
32532
32530
  if (node.field === "chat" && node.operator !== "wildcard" && !chats.has(node.value))
32533
32531
  chats.set(node.value, await chatIdIn(deps.messenger, node.value, store, { includeLeft: true }));
32534
32532
  }
32535
- const where = query ? queryFilter(query, attachmentColumns(chats), { command: "attachments list" }) : void 0;
32533
+ const where = query ? queryFilter(query, attachmentColumns(chats), { command: "attachments list", zone: timezoneOf() }) : void 0;
32536
32534
  const views = await store.attachments.attachments({ ...where ? { where } : {}, offset, limit: limit + 1 });
32537
32535
  return { items: views.slice(0, limit).map((view) => itemOf2(account, view)), hasMore: views.length > limit };
32538
32536
  }, "list"),
@@ -32672,8 +32670,8 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
32672
32670
  const mime = transferMime(Buffer.from(bytes2.subarray(0, 16)), null);
32673
32671
  if (!mime.startsWith("image/"))
32674
32672
  throw notPicture;
32675
- const read = await readPictureWithAgent({ ...reader, bytes: bytes2, mime, env, ...signal ? { signal } : {} });
32676
- const text2 = read.slice(0, MAX_TEXT_CHARS);
32673
+ const read2 = await readPictureWithAgent({ ...reader, bytes: bytes2, mime, env, ...signal ? { signal } : {} });
32674
+ const text2 = read2.slice(0, MAX_TEXT_CHARS);
32677
32675
  const extractor = pictureExtractor(reader.agent, reader.model);
32678
32676
  await store.attachments.keepAttachmentText(chosen.pk, {
32679
32677
  text: text2,
@@ -32694,7 +32692,7 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
32694
32692
  }, "readPicture")
32695
32693
  }), "attachmentsService");
32696
32694
 
32697
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/chat-documents.js
32695
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/chat-documents.js
32698
32696
  var chatDocumentsService = /* @__PURE__ */ __name((deps) => ({
32699
32697
  list: /* @__PURE__ */ __name(async (chat, { limit, offset, ref }) => {
32700
32698
  const store = await accountStore(deps);
@@ -32724,7 +32722,7 @@ var chatDocumentsService = /* @__PURE__ */ __name((deps) => ({
32724
32722
  }, "list")
32725
32723
  }), "chatDocumentsService");
32726
32724
 
32727
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/retention.js
32725
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/retention.js
32728
32726
  var observationDuration = /* @__PURE__ */ __name((text2, flag) => {
32729
32727
  const match = /^(\d+(?:\.\d+)?)([smhdw])$/.exec(text2);
32730
32728
  const units2 = { s: 1e3, m: 6e4, h: 36e5, d: 864e5, w: 6048e5 };
@@ -32811,7 +32809,7 @@ var isRetentionSelection = /* @__PURE__ */ __name((selection) => {
32811
32809
  }
32812
32810
  }, "isRetentionSelection");
32813
32811
 
32814
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/counters.js
32812
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/counters.js
32815
32813
  var counterFields = /* @__PURE__ */ __name((text2 = "views,reactions,comments") => {
32816
32814
  const fields = text2.split(",").map((one) => one.trim());
32817
32815
  if (!fields.length || fields.some((one) => !COUNTER_FIELDS.includes(one)) || new Set(fields).size !== fields.length)
@@ -33018,7 +33016,7 @@ var countersService = /* @__PURE__ */ __name((deps) => {
33018
33016
  };
33019
33017
  }, "countersService");
33020
33018
 
33021
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/search-refresh.js
33019
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/search-refresh.js
33022
33020
  var SYNC_KEY = "messages.sync-first";
33023
33021
  var SYNC_BOUNDS = { maxChats: 5, timeMs: 3e4, maxMessages: 500 };
33024
33022
  var keyOf3 = /* @__PURE__ */ __name((chat) => JSON.stringify([chat.account.provider, chat.account.account, chat.chatId]), "keyOf");
@@ -33150,14 +33148,16 @@ var withRefresh = /* @__PURE__ */ __name((found, refreshed) => ({
33150
33148
  ...!refreshed || refreshed.complete ? {} : { coverage: { ...found.coverage, state: "stale" } }
33151
33149
  }), "withRefresh");
33152
33150
 
33153
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/embeddings-search.js
33151
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/embeddings-search.js
33154
33152
  var CANDIDATES = 50;
33155
33153
  var WORD_HITS = 200;
33156
- var RRF_K = 60;
33154
+ var RRF_K2 = 60;
33157
33155
  var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
33158
33156
  const command = deps.messenger.app.command;
33159
- const byWords = /* @__PURE__ */ __name(async (query, prepared, conversations, since) => {
33160
- const words3 = [...new Set(query.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? [])];
33157
+ const byWords = /* @__PURE__ */ __name(async (query, prepared, conversations, since, timeLimitMs) => {
33158
+ const all = [...new Set(query.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? [])];
33159
+ const content = all.filter((word) => !STOP_WORDS.has(normalize(word)));
33160
+ const words3 = content.length ? content : all;
33161
33161
  const outside = /* @__PURE__ */ new Map();
33162
33162
  if (!words3.length || !prepared.scopeAccounts.length)
33163
33163
  return { hits: [], outside, sources: /* @__PURE__ */ new Map() };
@@ -33165,7 +33165,8 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
33165
33165
  const lexical = await prepareLucene(store, await deps.account(), {
33166
33166
  text: words3.map((word) => word.length >= 3 ? `${word}*` : `"${word}"`).join(" OR "),
33167
33167
  accounts: prepared.scopeAccounts,
33168
- limit: WORD_HITS
33168
+ limit: WORD_HITS,
33169
+ ...timeLimitMs === void 0 ? {} : { timeLimitMs }
33169
33170
  }, deps.messenger);
33170
33171
  const { items } = await store.queries.matchQuery({
33171
33172
  ...lexical.execution,
@@ -33192,9 +33193,16 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
33192
33193
  });
33193
33194
  outside.set(JSON.stringify(account), { account, chats });
33194
33195
  }
33195
- const ranked = items.flatMap(({ id: id2, score }, index) => {
33196
+ let ranked = items.flatMap(({ id: id2, score, timestamp }, index) => {
33196
33197
  const summary = summaries.get(index);
33197
- return summary ? [{ summary, chunk: { firstMessageId: id2, lastMessageId: id2 }, score }] : [];
33198
+ return summary ? [
33199
+ {
33200
+ summary,
33201
+ chunk: { firstMessageId: id2, lastMessageId: id2 },
33202
+ ranked: score !== null,
33203
+ at: Date.parse(timestamp)
33204
+ }
33205
+ ] : [];
33198
33206
  });
33199
33207
  const mailAccounts = prepared.scopeAccounts.filter(({ provider }) => provider === MAIL);
33200
33208
  if (mailAccounts.length && conversations === void 0) {
@@ -33208,6 +33216,7 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
33208
33216
  return { items: [] };
33209
33217
  throw error;
33210
33218
  });
33219
+ const emails = [];
33211
33220
  for (const account of mailAccounts) {
33212
33221
  const found = mail.items.filter((hit) => {
33213
33222
  const at = parseLocator(hit.locator);
@@ -33223,10 +33232,15 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
33223
33232
  continue;
33224
33233
  const summary = threadConversation(place, Date.now());
33225
33234
  sources.set(summary.id, account);
33226
- ranked.push({ summary, chunk: { firstMessageId: hit.id, lastMessageId: hit.id }, score: hit.score });
33235
+ emails.push({
33236
+ summary,
33237
+ chunk: { firstMessageId: hit.id, lastMessageId: hit.id },
33238
+ ranked: hit.score !== null,
33239
+ at: Date.parse(hit.timestamp)
33240
+ });
33227
33241
  }
33228
33242
  }
33229
- ranked.sort((a, b) => (b.score ?? Number.NEGATIVE_INFINITY) - (a.score ?? Number.NEGATIVE_INFINITY));
33243
+ ranked = fuseRanked([ranked, emails], (one) => one);
33230
33244
  }
33231
33245
  const seen = /* @__PURE__ */ new Set();
33232
33246
  const hits = ranked.flatMap(({ summary, chunk }) => {
@@ -33238,7 +33252,7 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
33238
33252
  return { hits, outside, sources };
33239
33253
  }, "byWords");
33240
33254
  return {
33241
- search: /* @__PURE__ */ __name(async (query, { chat, model: choice, since, limit, filter, source, timezone, syncFirst, signal, refresh }) => {
33255
+ search: /* @__PURE__ */ __name(async (query, { chat, model: choice, since, limit, filter, source, timezone, syncFirst, signal, refresh, timeLimitMs }) => {
33242
33256
  if (!query.trim())
33243
33257
  searchError("query.invalid-syntax", { start: 0, end: query.length }, "give words to search for");
33244
33258
  if (new TextEncoder().encode(query).length > QUERY_LIMITS.bytes)
@@ -33269,7 +33283,13 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
33269
33283
  const eligibility = filter === void 0 ? void 0 : await store.queries.conversationEligibility(prepared.execution);
33270
33284
  const selected = prepared.selectedChat;
33271
33285
  const scopeOf5 = /* @__PURE__ */ __name((one) => selected ? selected.account.provider === one.provider && selected.account.account === one.account ? { chatId: selected.chatId } : null : {}, "scopeOf");
33272
- const words3 = await byWords(query, prepared, eligibility?.conversations, since);
33286
+ let wordsOutOfTime = false;
33287
+ const words3 = await byWords(query, prepared, eligibility?.conversations, since, timeLimitMs).catch((error) => {
33288
+ if (!isQueryLimit(error))
33289
+ throw error;
33290
+ wordsOutOfTime = true;
33291
+ return { hits: [], outside: /* @__PURE__ */ new Map(), sources: /* @__PURE__ */ new Map() };
33292
+ });
33273
33293
  const meaning = [];
33274
33294
  const sources = words3.sources;
33275
33295
  if (target2.installed && prepared.scopeAccounts.length && eligibility?.conversations.length !== 0) {
@@ -33331,6 +33351,7 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
33331
33351
  accounts: prepared.scopeAccounts,
33332
33352
  model: target2.id,
33333
33353
  meaning: target2.installed ? "searched" : "unavailable",
33354
+ ...wordsOutOfTime ? { words: "out-of-time" } : {},
33334
33355
  hits: fused(meaning, words3.hits, meaningFloor(target2.key)).slice(0, limit).map((hit) => {
33335
33356
  const source2 = sources.get(hit.summary.id);
33336
33357
  return {
@@ -33387,11 +33408,11 @@ var fused = /* @__PURE__ */ __name((meaning, words3, minimumCosine) => {
33387
33408
  by: ["meaning"],
33388
33409
  stale,
33389
33410
  ...matchedIn ? { matchedIn } : {},
33390
- fused: 1 / (RRF_K + index + 1)
33411
+ fused: 1 / (RRF_K2 + index + 1)
33391
33412
  });
33392
33413
  });
33393
33414
  words3.forEach(({ summary, chunk }, index) => {
33394
- const share = 1 / (RRF_K + index + 1);
33415
+ const share = 1 / (RRF_K2 + index + 1);
33395
33416
  const held = merged2.get(summary.id);
33396
33417
  if (held) {
33397
33418
  held.fused += share;
@@ -33425,13 +33446,13 @@ var meanOf = /* @__PURE__ */ __name((vectors) => {
33425
33446
  return mean2.map((value) => value / length);
33426
33447
  }, "meanOf");
33427
33448
 
33428
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/embeddings.js
33449
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/embeddings.js
33429
33450
  var embeddingsService = /* @__PURE__ */ __name((deps) => ({
33430
33451
  ...embeddingsMaintenance(deps),
33431
33452
  ...embeddingsSearch(deps)
33432
33453
  }), "embeddingsService");
33433
33454
 
33434
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/folders.js
33455
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/folders.js
33435
33456
  var foldersService = /* @__PURE__ */ __name((deps) => {
33436
33457
  const online = /* @__PURE__ */ __name(async (command) => {
33437
33458
  if (deps.offline)
@@ -33572,7 +33593,7 @@ var foldersService = /* @__PURE__ */ __name((deps) => {
33572
33593
  };
33573
33594
  }, "foldersService");
33574
33595
 
33575
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/mentions.js
33596
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/mentions.js
33576
33597
  var REVIEW_COUNT = 500;
33577
33598
  var mentionsService = /* @__PURE__ */ __name((deps) => {
33578
33599
  const located = /* @__PURE__ */ __name(async () => {
@@ -33633,8 +33654,8 @@ var mentionsService = /* @__PURE__ */ __name((deps) => {
33633
33654
  const found = await store.mentions.mention(id2);
33634
33655
  if (!found)
33635
33656
  throw new CliError("not_found", `no mention ${id2} in this account`);
33636
- const { before: before2, after, sameValue, candidates, ...rest } = found;
33637
- return { ...mention(rest), before: before2, after, sameValue, candidates };
33657
+ const { before, after, sameValue, candidates, ...rest } = found;
33658
+ return { ...mention(rest), before, after, sameValue, candidates };
33638
33659
  }, "show"),
33639
33660
  confirm: /* @__PURE__ */ __name(async (id2, target2, by, inChat = false) => {
33640
33661
  let owner;
@@ -33651,7 +33672,7 @@ var mentionsService = /* @__PURE__ */ __name((deps) => {
33651
33672
  };
33652
33673
  }, "mentionsService");
33653
33674
 
33654
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/domain/message-link.js
33675
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/domain/message-link.js
33655
33676
  var fileLinks = /* @__PURE__ */ __name((attachments) => hitFiles(attachments).map(({ position, kind, name }) => ({
33656
33677
  position,
33657
33678
  kind,
@@ -33700,7 +33721,7 @@ var validatePermalink = /* @__PURE__ */ __name((link4) => {
33700
33721
  return { url: link4.url, access: link4.access, reason: link4.reason };
33701
33722
  }, "validatePermalink");
33702
33723
 
33703
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/domain/pin-duration.js
33724
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/domain/pin-duration.js
33704
33725
  var spokenSeconds = /* @__PURE__ */ __name((seconds) => {
33705
33726
  if (seconds % 86400 === 0 && seconds > 86400)
33706
33727
  return `${seconds / 86400}d`;
@@ -33732,7 +33753,7 @@ var pinDurationOf = /* @__PURE__ */ __name((value, allowed, flag = "--expire-tim
33732
33753
  return seconds;
33733
33754
  }, "pinDurationOf");
33734
33755
 
33735
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/sends/send-as.js
33756
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/sends/send-as.js
33736
33757
  var sendAsCheck = /* @__PURE__ */ __name((connection, sendAs) => {
33737
33758
  if (sendAs === void 0) {
33738
33759
  const saved = connection.savedSender?.bind(connection);
@@ -33757,7 +33778,7 @@ var typedSendAs = /* @__PURE__ */ __name((typed) => {
33757
33778
  return sendAs;
33758
33779
  }, "typedSendAs");
33759
33780
 
33760
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/search/total.js
33781
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/search/total.js
33761
33782
  var TOTAL_CAP = 1e4;
33762
33783
  var totalOf = /* @__PURE__ */ __name((count4, shown, hasMore, exact = true) => {
33763
33784
  const least = shown + (hasMore ? 1 : 0);
@@ -33768,7 +33789,7 @@ var totalOf = /* @__PURE__ */ __name((count4, shown, hasMore, exact = true) => {
33768
33789
  return { value: count4, relation: exact ? "eq" : "gte" };
33769
33790
  }, "totalOf");
33770
33791
 
33771
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/search/lucene/meaning-parts.js
33792
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/search/lucene/meaning-parts.js
33772
33793
  var WORD_FIELDS = /* @__PURE__ */ new Set(["text", "exact"]);
33773
33794
  var fieldsOfQuery = /* @__PURE__ */ __name((root, everything) => {
33774
33795
  let narrows = false;
@@ -33797,140 +33818,7 @@ var meaningWords = /* @__PURE__ */ __name((root) => {
33797
33818
  return wanted(root).join(" ").trim();
33798
33819
  }, "meaningWords");
33799
33820
 
33800
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/search/question-plan.js
33801
- var words2 = /* @__PURE__ */ __name((text2) => normalize(text2).match(/[\p{L}\p{N}]+/gu) ?? [], "words");
33802
- 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"));
33803
- var questionWord = /\b(?:what|which|how|who|where|when|can|could|should)\b|(?:^|\s)(?:сколько|какой|какая|какие|какое|кто|кому|кем|где|когда|как|что|можно|может|могут|ли)(?:\s|$)/iu;
33804
- var QUESTION_STARTS = new Set(words2("what which how who whom whose where when why can could should would did do does is are was were will \u0447\u0442\u043E \u043A\u0442\u043E \u043A\u043E\u0433\u043E \u043A\u043E\u043C\u0443 \u043A\u0435\u043C \u0433\u0434\u0435 \u043A\u043E\u0433\u0434\u0430 \u043A\u0430\u043A \u043A\u0430\u043A\u043E\u0439 \u043A\u0430\u043A\u0430\u044F \u043A\u0430\u043A\u043E\u0435 \u043A\u0430\u043A\u0438\u0435 \u043A\u0430\u043A\u0443\u044E \u043A\u0430\u043A\u0438\u043C \u043A\u0430\u043A\u043E\u0433\u043E \u043A\u0430\u043A\u0438\u0445 \u043F\u043E\u0447\u0435\u043C\u0443 \u0437\u0430\u0447\u0435\u043C \u043E\u0442\u043A\u0443\u0434\u0430 \u043A\u0443\u0434\u0430 \u0441\u043A\u043E\u043B\u044C\u043A\u043E \u043B\u0438 \u043C\u043E\u0436\u043D\u043E \u0440\u0430\u0437\u0432\u0435 \u0447\u0435\u0439 \u0447\u044C\u044F \u0447\u044C\u0451 \u0447\u044C\u0438"));
33805
- var QUESTION_FILLER = new Set(words2("about any did does why whom whose would will \u044D\u0442\u043E \u043C\u044B \u0432\u044B \u044F \u043E\u043D\u0438 \u043E\u043D \u043E\u043D\u0430 \u043E \u043E\u0431 \u043F\u0440\u043E \u043B\u0438"));
33806
- function planQuestion(text2, strict = false) {
33807
- if (strict)
33808
- return {
33809
- changed: false,
33810
- natural: false,
33811
- queries: [text2],
33812
- scope: "",
33813
- terms: words2(text2),
33814
- rankingTerms: words2(text2),
33815
- removed: [],
33816
- aliases: []
33817
- };
33818
- const inputAst = parseLucene(text2, MESSAGE_PARSING);
33819
- const rawTextual = walkQuery(inputAst.root).filter((node) => node.field === "text" || node.field === "exact");
33820
- const body = rawTextual.map((node) => node.value).join(" ");
33821
- const prefix = words2(body).slice(0, 2);
33822
- const questionPrefix = [
33823
- "what",
33824
- "which",
33825
- "how",
33826
- "who",
33827
- "where",
33828
- "when",
33829
- "can",
33830
- "could",
33831
- "should",
33832
- "\u0441\u043A\u043E\u043B\u044C\u043A\u043E",
33833
- "\u043A\u0430\u043A\u043E\u0438",
33834
- "\u043A\u0430\u043A\u0430\u044F",
33835
- "\u043A\u0430\u043A\u0438\u0435",
33836
- "\u043A\u0430\u043A\u043E\u0435",
33837
- "\u043A\u0442\u043E",
33838
- "\u043A\u043E\u043C\u0443",
33839
- "\u043A\u0435\u043C",
33840
- "\u0433\u0434\u0435",
33841
- "\u043A\u043E\u0433\u0434\u0430",
33842
- "\u043A\u0430\u043A",
33843
- "\u0447\u0442\u043E",
33844
- "\u043C\u043E\u0436\u043D\u043E",
33845
- "\u043C\u043E\u0436\u0435\u0442",
33846
- "\u043C\u043E\u0433\u0443\u0442"
33847
- ].includes(prefix[0] ?? "") || ["\u043A", "\u0432\u043E"].includes(prefix[0] ?? "") && ["\u043A\u043E\u043C\u0443", "\u0441\u043A\u043E\u043B\u044C\u043A\u043E"].includes(prefix[1] ?? "");
33848
- const natural = questionWord.test(body) && (/\?/u.test(body) || questionPrefix);
33849
- let cleaned = text2;
33850
- if (natural && !text2.includes("\\")) {
33851
- const last = rawTextual.at(-1);
33852
- const mark = (last?.span.end ?? 0) - 1;
33853
- if (last?.operator === "wildcard" && text2[mark] === "?")
33854
- cleaned = text2.slice(0, mark) + text2.slice(mark + 1);
33855
- }
33856
- const ast = cleaned === text2 ? inputAst : parseLucene(cleaned, MESSAGE_PARSING);
33857
- const predicates = walkQuery(ast.root);
33858
- const textual = predicates.filter((p) => p.field === "text" || p.field === "exact");
33859
- const fields = predicates.filter((p) => p.field !== "text" && p.field !== "exact");
33860
- const scope = fields.map((p) => {
33861
- const raw = cleaned.slice(p.span.start, p.span.end);
33862
- return new RegExp(`^${p.field}[:=<>]`, "u").test(raw) ? raw : `${p.field}:${raw}`;
33863
- }).join(" ");
33864
- const bypass = strict || !natural || implicitTextTerms(cleaned).size === 0 || // A quoted single word is how `plainQuery` keeps `10:30` or `HH:MM` literal; it is no phrase the asker wrote.
33865
- textual.some((p) => !(p.operator === "term" || p.operator === "phrase" && !/\s/u.test(p.value)) || p.field === "exact");
33866
- if (bypass)
33867
- return {
33868
- changed: false,
33869
- natural: false,
33870
- queries: [text2],
33871
- scope,
33872
- terms: textual.flatMap((p) => words2(p.value)),
33873
- rankingTerms: textual.flatMap((p) => words2(p.value)),
33874
- removed: [],
33875
- aliases: []
33876
- };
33877
- const original = textual.flatMap((p) => words2(p.value));
33878
- const removed = original.filter((w) => scaffolding.has(w));
33879
- const terms = [...new Set(original.filter((w) => !scaffolding.has(w)))];
33880
- if (!terms.length)
33881
- return {
33882
- changed: false,
33883
- natural: true,
33884
- queries: [text2],
33885
- scope,
33886
- terms,
33887
- rankingTerms: original,
33888
- removed,
33889
- aliases: []
33890
- };
33891
- const alias = [...terms];
33892
- const changes = [];
33893
- const replace = /* @__PURE__ */ __name((from, to) => {
33894
- for (let i = 0; i < alias.length; i++)
33895
- if (from.includes(alias[i] ?? "")) {
33896
- changes.push(`${alias[i]} -> ${to}`);
33897
- alias[i] = to;
33898
- }
33899
- }, "replace");
33900
- if (terms.some((w) => ["refund", "euros", "euro", "money", "\u0432\u043E\u0437\u0432\u0440\u0430\u0442\u0430", "\u0432\u043E\u0437\u0432\u0440\u0430\u0442", "\u0435\u0432\u0440\u043E"].includes(w))) {
33901
- replace(["returned", "refunded", "received"], "refund");
33902
- replace(["\u0432\u0435\u0440\u043D\u0443\u043B\u0438", "\u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0435\u043D\u043E", "\u043F\u0435\u0440\u0435\u0447\u0438\u0441\u043B\u0435\u043D\u043E"], "\u0432\u043E\u0437\u0432\u0440\u0430\u0442");
33903
- }
33904
- if (terms.some((w) => ["log", "logs", "retention", "backup", "\u043B\u043E\u0433\u043E\u0432", "\u043B\u043E\u0433\u0438", "\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0435", "\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u044F"].includes(w))) {
33905
- replace(["lifetime", "kept", "keep"], "retention");
33906
- replace(["\u0445\u0440\u0430\u043D\u044F\u0442\u0441\u044F", "\u0445\u0440\u0430\u043D\u044F\u0442", "\u0445\u0440\u0430\u043D\u0438\u0442\u044C", "\u0441\u0440\u043E\u043A"], "\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0435");
33907
- }
33908
- if (terms.includes("service") || terms.includes("build"))
33909
- replace(["currently", "now"], "current");
33910
- const render = /* @__PURE__ */ __name((ws) => [...new Set(ws)].join(" ") + (scope ? ` ${scope}` : ""), "render");
33911
- const queries = [.../* @__PURE__ */ new Set([render(terms), render(alias)])].slice(0, 2);
33912
- return { changed: true, natural: true, queries, scope, terms, rankingTerms: original, removed, aliases: changes };
33913
- }
33914
- __name(planQuestion, "planQuestion");
33915
- var questionText = /* @__PURE__ */ __name((text2) => text2.replace(new RegExp("(?<=\\p{L})\\?(?=\\s|$)", "gu"), "").replace(/"(?:[^"\\]|\\.)*"|(?<=\d):(?=\d)/gu, (found) => found === ":" ? " " : found), "questionText");
33916
- var lookupTerms = /* @__PURE__ */ __name((plan) => [
33917
- ...new Set(plan.terms.concat(plan.aliases.flatMap((alias) => words2(alias.split(" -> ")[1] ?? ""))))
33918
- ], "lookupTerms");
33919
- var anyOfTerms = /* @__PURE__ */ __name((terms, scope) => `(${terms.join(" OR ")})${scope ? ` ${scope}` : ""}`, "anyOfTerms");
33920
- var questionLookup = /* @__PURE__ */ __name((text2) => {
33921
- let plan;
33922
- try {
33923
- plan = planQuestion(questionText(text2));
33924
- } catch (error) {
33925
- if (error instanceof CliError)
33926
- return void 0;
33927
- throw error;
33928
- }
33929
- const terms = plan.changed ? lookupTerms(plan) : [];
33930
- return terms.length ? anyOfTerms(terms, plan.scope) : void 0;
33931
- }, "questionLookup");
33932
-
33933
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/messages-combined.js
33821
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/messages-combined.js
33934
33822
  var COMBINED_DEFAULTS = { candidateDepth: 300, rrfK: 60, rerank: "all", chatCap: 0 };
33935
33823
  var tokensOf = /* @__PURE__ */ __name((text2) => normalize(text2).match(/[\p{L}\p{N}\p{Co}\p{M}]+/gu) ?? [], "tokensOf");
33936
33824
  var searchCombined = /* @__PURE__ */ __name(async (store, account, request, messenger = {}, options2 = COMBINED_DEFAULTS) => {
@@ -33958,6 +33846,13 @@ var searchCombined = /* @__PURE__ */ __name(async (store, account, request, mess
33958
33846
  const corrections = expanding ? await correctWords(store.searchIndex, [...new Set(eligible.map((leaf) => normalize(leaf.value)))]) : /* @__PURE__ */ new Map();
33959
33847
  check2();
33960
33848
  const bySpan = new Map(eligible.map((leaf) => [leaf.span.start, leaf]));
33849
+ const widenable = /* @__PURE__ */ __name((node) => node.kind === "predicate" && bySpan.has(node.span.start) && [...normalize(node.value)].length >= 3 && !isFunctionWord(normalize(node.value)), "widenable");
33850
+ const beginning = /* @__PURE__ */ __name((node) => ({
33851
+ ...node,
33852
+ operator: "wildcard",
33853
+ value: `${normalize(node.value)}*`,
33854
+ widened: true
33855
+ }), "beginning");
33961
33856
  const transform2 = /* @__PURE__ */ __name((node, source, exact2 = false) => {
33962
33857
  if (node.kind === "boolean")
33963
33858
  return {
@@ -33968,8 +33863,8 @@ var searchCombined = /* @__PURE__ */ __name(async (store, account, request, mess
33968
33863
  return { ...node, field: "exact" };
33969
33864
  if (!bySpan.has(node.span.start))
33970
33865
  return node;
33971
- if (source === "beginnings" && [...normalize(node.value)].length >= 3)
33972
- return { ...node, operator: "wildcard", value: `${normalize(node.value)}*` };
33866
+ if (source === "beginnings" && widenable(node))
33867
+ return beginning(node);
33973
33868
  if (source !== "corrected")
33974
33869
  return node;
33975
33870
  const fixes = corrections.get(normalize(node.value));
@@ -33978,7 +33873,7 @@ var searchCombined = /* @__PURE__ */ __name(async (store, account, request, mess
33978
33873
  const clauses = fixes.map((value) => ({ occur: "should", node: { ...node, field: "exact", value } }));
33979
33874
  return { kind: "boolean", clauses, span: node.span };
33980
33875
  }, "transform");
33981
- const read = /* @__PURE__ */ __name(async (root, limit) => {
33876
+ const read2 = /* @__PURE__ */ __name(async (root, limit) => {
33982
33877
  check2();
33983
33878
  const nodes = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? 1 : 1 + node.clauses.reduce((sum2, clause) => sum2 + nodes(clause.node), 0), "nodes");
33984
33879
  if (nodes(root) > QUERY_LIMITS.nodes)
@@ -33988,16 +33883,16 @@ var searchCombined = /* @__PURE__ */ __name(async (store, account, request, mess
33988
33883
  return found;
33989
33884
  }, "read");
33990
33885
  if (!expanding) {
33991
- const found = await read(execution.root, request.limit);
33886
+ const found = await read2(execution.root, request.limit);
33992
33887
  return finish(found.items, found.hasMore, [], false, false);
33993
33888
  }
33994
- const exact = await read(transform2(execution.root, "words", true), depth);
33995
- const stemmed = await read(execution.root, depth);
33996
- const prefix = await read(transform2(execution.root, "beginnings"), depth);
33997
- const fixed = corrections.size ? await read(transform2(execution.root, "corrected"), depth) : { items: [], hasMore: false };
33889
+ const exact = await read2(transform2(execution.root, "words", true), depth);
33890
+ const stemmed = await read2(execution.root, depth);
33891
+ const prefix = await read2(transform2(execution.root, "beginnings"), depth);
33892
+ const fixed = corrections.size ? await read2(transform2(execution.root, "corrected"), depth) : { items: [], hasMore: false };
33998
33893
  const fixedPrefixRoot = transform2(execution.root, "corrected");
33999
- const correctedBeginnings = /* @__PURE__ */ __name((node) => node.kind === "boolean" ? { ...node, clauses: node.clauses.map((clause) => ({ ...clause, node: correctedBeginnings(clause.node) })) } : bySpan.has(node.span.start) && [...normalize(node.value)].length >= 3 ? { ...node, field: "exact", operator: "wildcard", value: `${normalize(node.value)}*` } : node, "correctedBeginnings");
34000
- const fixedPrefix = corrections.size ? await read(correctedBeginnings(fixedPrefixRoot), depth) : { items: [], hasMore: false };
33894
+ const correctedBeginnings = /* @__PURE__ */ __name((node) => node.kind === "boolean" ? { ...node, clauses: node.clauses.map((clause) => ({ ...clause, node: correctedBeginnings(clause.node) })) } : widenable(node) ? { ...beginning(node), field: "exact" } : node, "correctedBeginnings");
33895
+ const fixedPrefix = corrections.size ? await read2(correctedBeginnings(fixedPrefixRoot), depth) : { items: [], hasMore: false };
34001
33896
  const ranked = /* @__PURE__ */ new Map();
34002
33897
  const add = /* @__PURE__ */ __name((lists, source) => {
34003
33898
  const shares = /* @__PURE__ */ new Map();
@@ -34124,9 +34019,9 @@ var signals = /* @__PURE__ */ __name((hit, terms, corrections, execution, mode,
34124
34019
  return mode === "coverage" ? coverage2 * 4 : mode === "proximity" ? proximity : mode === "phrase" ? phrase2 : coverage2 * 4 + proximity + phrase2;
34125
34020
  }, "signals");
34126
34021
 
34127
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/messages-discovery.js
34022
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/messages-discovery.js
34128
34023
  var MEANING_DEPTH = 100;
34129
- var RRF_K2 = 60;
34024
+ var RRF_K3 = 60;
34130
34025
  var RERANK_DEPTH = 50;
34131
34026
  var RERANK_WEIGHT = 0.7;
34132
34027
  var RERANK_CHUNK = 5;
@@ -34160,7 +34055,7 @@ var searchDiscovery = /* @__PURE__ */ __name(async (store, account, asked, messe
34160
34055
  const question = root === void 0 ? text2 : meaningWords(root);
34161
34056
  if (!question)
34162
34057
  return searchLucene(store, account, request, messenger);
34163
- const terms = root === void 0 ? lookupTerms(plan) : [...new Set(words2(question))];
34058
+ const terms = [.../* @__PURE__ */ new Set([...root === void 0 ? lookupTerms(plan) : words(question), ...joinedHyphens(text2)])];
34164
34059
  if (!terms.length)
34165
34060
  return searchLucene(store, account, request, messenger);
34166
34061
  if (terms.length > 64)
@@ -34264,7 +34159,7 @@ var searchDiscovery = /* @__PURE__ */ __name(async (store, account, asked, messe
34264
34159
  bytes2 += Buffer.byteLength(body);
34265
34160
  if (bytes2 > QUERY_LIMITS.bodyBytes)
34266
34161
  exhausted("bodyBytes");
34267
- const tokens = new Set(words2(body).map(stem));
34162
+ const tokens = new Set(words(body).map(stem));
34268
34163
  const matchedTerms = terms.filter((_, i) => tokens.has(stems[i] ?? ""));
34269
34164
  const missingTerms = terms.filter((_, i) => !tokens.has(stems[i] ?? ""));
34270
34165
  const coverage2 = matchedTerms.length / terms.length;
@@ -34414,10 +34309,10 @@ var fusedWithMeaning = /* @__PURE__ */ __name((words3, near2, described) => {
34414
34309
  const merged2 = /* @__PURE__ */ new Map();
34415
34310
  const by = /* @__PURE__ */ __name((hit, foundBy) => hit.discovery ? { ...hit, discovery: { ...hit.discovery, foundBy } } : hit, "by");
34416
34311
  words3.forEach((hit, rank) => {
34417
- merged2.set(hit.locator, { hit: by(hit, ["words"]), rrf: 1 / (RRF_K2 + rank + 1) });
34312
+ merged2.set(hit.locator, { hit: by(hit, ["words"]), rrf: 1 / (RRF_K3 + rank + 1) });
34418
34313
  });
34419
34314
  near2.forEach(({ cosine: _, ...m }, rank) => {
34420
- const share = 1 / (RRF_K2 + rank + 1);
34315
+ const share = 1 / (RRF_K3 + rank + 1);
34421
34316
  const held = merged2.get(m.locator);
34422
34317
  if (held) {
34423
34318
  held.rrf += share;
@@ -34443,14 +34338,14 @@ var scaled = /* @__PURE__ */ __name((values) => {
34443
34338
  }, "scaled");
34444
34339
  var mixedWithReranker = /* @__PURE__ */ __name((head, scores) => {
34445
34340
  const fused2 = scaled(head.map((m) => m.score ?? 0));
34446
- const read = scaled(scores);
34341
+ const read2 = scaled(scores);
34447
34342
  return head.map((m, i) => ({
34448
34343
  hit: m.discovery ? { ...m, discovery: { ...m.discovery, rerankerScore: scores[i] } } : m,
34449
- mixed: (1 - RERANK_WEIGHT) * fused2[i] + RERANK_WEIGHT * read[i]
34344
+ mixed: (1 - RERANK_WEIGHT) * fused2[i] + RERANK_WEIGHT * read2[i]
34450
34345
  })).sort((a, b) => b.mixed - a.mixed).map(({ hit }) => hit);
34451
34346
  }, "mixedWithReranker");
34452
34347
 
34453
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/thread-context.js
34348
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/thread-context.js
34454
34349
  var THREAD_BOUNDS = { maxHops: 8, maxMessages: 50, maxBytes: 65536, withinMs: 864e5 };
34455
34350
  var bytes = /* @__PURE__ */ __name((items, links) => Buffer.byteLength(JSON.stringify({ items, links }), "utf8"), "bytes");
34456
34351
  var threadBounds = /* @__PURE__ */ __name((options2 = {}) => {
@@ -34496,7 +34391,7 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account, chat, mess
34496
34391
  stopped("aborted");
34497
34392
  return result;
34498
34393
  }
34499
- const around = /* @__PURE__ */ __name((id2, before2 = 0, after = 0) => store.messages.around(account, chat, id2, { before: before2, after }).catch((error) => {
34394
+ const around = /* @__PURE__ */ __name((id2, before = 0, after = 0) => store.messages.around(account, chat, id2, { before, after }).catch((error) => {
34500
34395
  if (isCliFailure(error) && error.code === "not_found")
34501
34396
  return [];
34502
34397
  throw error;
@@ -34513,12 +34408,12 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account, chat, mess
34513
34408
  const wantedBefore = options2.before ?? 5;
34514
34409
  const wantedAfter = options2.after ?? 5;
34515
34410
  const available = bounds.maxMessages - 1;
34516
- let before2 = Math.min(wantedBefore, Math.ceil(available / 2));
34517
- const after = Math.min(wantedAfter, available - before2);
34518
- before2 = Math.min(wantedBefore, available - after);
34519
- if (anchor && before2 + after < wantedBefore + wantedAfter)
34411
+ let before = Math.min(wantedBefore, Math.ceil(available / 2));
34412
+ const after = Math.min(wantedAfter, available - before);
34413
+ before = Math.min(wantedBefore, available - after);
34414
+ if (anchor && before + after < wantedBefore + wantedAfter)
34520
34415
  stopped("messages");
34521
- const neighbours = anchor ? await around(message, before2, after) : [];
34416
+ const neighbours = anchor ? await around(message, before, after) : [];
34522
34417
  const nearest2 = neighbours.sort((a, b) => Number(a.id !== message) - Number(b.id !== message) || Math.abs(Date.parse(a.timestamp) - Date.parse(anchor?.timestamp ?? "")) - Math.abs(Date.parse(b.timestamp) - Date.parse(anchor?.timestamp ?? "")));
34523
34418
  for (const item2 of nearest2) {
34524
34419
  if (item2.threadId !== anchor?.threadId) {
@@ -34649,7 +34544,7 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account, chat, mess
34649
34544
  return result;
34650
34545
  }, "readThreadContext");
34651
34546
 
34652
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/messages-archive-search.js
34547
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/messages-archive-search.js
34653
34548
  var SEARCH_FILL_MS = 200;
34654
34549
  var statsStore = /* @__PURE__ */ __name(async (store, account, request, messenger = {}) => {
34655
34550
  const stop = Date.now() + SEARCH_FILL_MS;
@@ -34718,7 +34613,7 @@ var accountOf2 = /* @__PURE__ */ __name((hit) => {
34718
34613
  }, "accountOf");
34719
34614
  var keyOf4 = /* @__PURE__ */ __name(({ provider, account }) => `${provider}/${account}`, "keyOf");
34720
34615
 
34721
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/meaning-model.js
34616
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/meaning-model.js
34722
34617
  var meaningModel = /* @__PURE__ */ __name(async (store, env = process.env) => {
34723
34618
  const chosen = chosenTextModel(env);
34724
34619
  if (chosen.from === "chosen" || chosen.id !== DEFAULT_TEXT_MODEL)
@@ -34728,12 +34623,12 @@ var meaningModel = /* @__PURE__ */ __name(async (store, env = process.env) => {
34728
34623
  const previous = models.find(({ id: id2 }) => id2 === PREVIOUS_DEFAULT_TEXT_MODEL);
34729
34624
  if (!current || !previous || !isTextModelInstalled(previous, textModelsDirectory(env)))
34730
34625
  return chosen.id;
34731
- const [now, before2] = [vectorModelKey(current), vectorModelKey(previous)];
34732
- const counts = await store.vectors.vectorCounts([now, before2]);
34733
- return (counts.get(before2) ?? 0) > (counts.get(now) ?? 0) ? previous.id : current.id;
34626
+ const [now, before] = [vectorModelKey(current), vectorModelKey(previous)];
34627
+ const counts = await store.vectors.vectorCounts([now, before]);
34628
+ return (counts.get(before) ?? 0) > (counts.get(now) ?? 0) ? previous.id : current.id;
34734
34629
  }, "meaningModel");
34735
34630
 
34736
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/messages-meaning.js
34631
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/messages-meaning.js
34737
34632
  var meaningText = /* @__PURE__ */ __name((question) => {
34738
34633
  try {
34739
34634
  const text2 = questionLookup(question) === void 0 ? question : questionText(question);
@@ -34812,7 +34707,7 @@ var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, sh
34812
34707
  }
34813
34708
  }, "meaningLane");
34814
34709
 
34815
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/messages-rerank.js
34710
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/messages-rerank.js
34816
34711
  var rerankLane = /* @__PURE__ */ __name((deps) => {
34817
34712
  const choice = deps.reranker ?? DEFAULT_RERANK_MODEL;
34818
34713
  if (choice === "off")
@@ -34824,9 +34719,9 @@ var rerankLane = /* @__PURE__ */ __name((deps) => {
34824
34719
  return { skipped: { reason: `${model.id} is not downloaded`, step: "models.download", model: model.id } };
34825
34720
  try {
34826
34721
  const warm = deps.embedders;
34827
- const reranker = warm ? await warm.reranker(`rerank:${model.id}`, async () => (await import("./process-GSNPENHL.js")).openRerankerProcess(model, directory2, {
34722
+ const reranker = warm ? await warm.reranker(`rerank:${model.id}`, async () => (await import("./process-OQUC2TW3.js")).openRerankerProcess(model, directory2, {
34828
34723
  threads: defaultThreads()
34829
- })) : await (await import("./rerank-TVMR3OLL.js")).openReranker(model, directory2);
34724
+ })) : await (await import("./rerank-4YPB26FG.js")).openReranker(model, directory2);
34830
34725
  return {
34831
34726
  model: model.id,
34832
34727
  score: /* @__PURE__ */ __name((question, passages) => reranker.score(plainWords(question), passages), "score"),
@@ -34846,7 +34741,7 @@ var rerankLane = /* @__PURE__ */ __name((deps) => {
34846
34741
  };
34847
34742
  }, "rerankLane");
34848
34743
 
34849
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/search/question-period.js
34744
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/search/question-period.js
34850
34745
  var DAY5 = 864e5;
34851
34746
  var SPAN = { start: 0, end: 0 };
34852
34747
  var phrase = /* @__PURE__ */ __name((source) => new RegExp(`(?<![\\p{L}\\p{N}])(?:${source})(?![\\p{L}\\p{N}])`, "giu"), "phrase");
@@ -34971,17 +34866,17 @@ var questionPeriod = /* @__PURE__ */ __name((text2, now, zone) => {
34971
34866
  };
34972
34867
  }, "questionPeriod");
34973
34868
 
34974
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/document-pictures.js
34869
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/document-pictures.js
34975
34870
  var openPictureEmbedderFor = /* @__PURE__ */ __name(async ({ env, command } = {}) => {
34976
34871
  const model = imageModel(DEFAULT_IMAGE_MODEL);
34977
34872
  const directory2 = imageModelsDirectory(env);
34978
34873
  if (!isImageModelInstalled(model, directory2))
34979
34874
  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 });
34980
- const { openPictureEmbedder } = await import("./embedder-WE7B2RU5.js");
34875
+ const { openPictureEmbedder } = await import("./embedder-2HU7JYZK.js");
34981
34876
  return openPictureEmbedder(model, directory2);
34982
34877
  }, "openPictureEmbedderFor");
34983
34878
 
34984
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/document-source.js
34879
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/document-source.js
34985
34880
  var documentSource = /* @__PURE__ */ __name((note, accounts, profiles, file2) => {
34986
34881
  const metadata = note.frontMatter;
34987
34882
  const account = accounts.find(({ id: id2 }) => String(id2) === note.folderId);
@@ -34992,7 +34887,7 @@ var documentSource = /* @__PURE__ */ __name((note, accounts, profiles, file2) =>
34992
34887
  account: account.account,
34993
34888
  ...file2?.url ? { url: file2.url } : {}
34994
34889
  };
34995
- const remote = note.source === "file" && (account !== void 0 && kindIn(account.provider) === "documents" || metadata?.source === "google-drive");
34890
+ const remote = note.source === "file" && (account !== void 0 && isDocumentAccountProvider(account.provider) || isDocumentAccountProvider(metadata?.source));
34996
34891
  const profile = remote && account ? Object.entries(profiles).flatMap(([command, named2]) => Object.entries(named2).map(([name, key]) => ({ command, name, key }))).find(({ key }) => key.provider === account.provider && key.account === account.account || isFolderProvider(key.provider) && key.account === account.name) : void 0;
34997
34892
  const url = file2?.url ?? (remote && typeof metadata?.sourceUrl === "string" ? metadata.sourceUrl : void 0);
34998
34893
  return {
@@ -35003,7 +34898,7 @@ var documentSource = /* @__PURE__ */ __name((note, accounts, profiles, file2) =>
35003
34898
  };
35004
34899
  }, "documentSource");
35005
34900
 
35006
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/embeddings/keys.js
34901
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/embeddings/keys.js
35007
34902
  var endpointKeyName = /* @__PURE__ */ __name((baseUrl) => {
35008
34903
  const host = new URL(baseUrl).host;
35009
34904
  return ["openai", "anthropic"].includes(host) ? `endpoint:${host}` : host;
@@ -35036,7 +34931,7 @@ var embeddingKeys = /* @__PURE__ */ __name((app, env = process.env, keyring) =>
35036
34931
  };
35037
34932
  }, "embeddingKeys");
35038
34933
 
35039
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/models/openai.js
34934
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/models/openai.js
35040
34935
  var options = strictObject({
35041
34936
  temperature: range(0, 2),
35042
34937
  top_p: range(0, 1),
@@ -35103,7 +34998,7 @@ var openai = {
35103
34998
  }), "complete")
35104
34999
  };
35105
35000
 
35106
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/models/index.js
35001
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/models/index.js
35107
35002
  var modelGateway = /* @__PURE__ */ __name((deps) => ({
35108
35003
  complete: /* @__PURE__ */ __name(async (request) => {
35109
35004
  if (deps.signal?.aborted)
@@ -35118,7 +35013,7 @@ var modelGateway = /* @__PURE__ */ __name((deps) => ({
35118
35013
  if (!adapter && target2.provider === "openai")
35119
35014
  adapter = openai;
35120
35015
  if (!adapter && target2.provider === "anthropic")
35121
- adapter = (await import("./anthropic-NW7DL3S3.js")).anthropic;
35016
+ adapter = (await import("./anthropic-FHS5XNK5.js")).anthropic;
35122
35017
  if (!adapter)
35123
35018
  throw new CliError("validation_error", `no model adapter for ${target2.provider}`);
35124
35019
  if (request.images !== void 0 && adapter.images !== true)
@@ -35178,7 +35073,7 @@ var modelGateway = /* @__PURE__ */ __name((deps) => ({
35178
35073
  }, "complete")
35179
35074
  }), "modelGateway");
35180
35075
 
35181
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/enrichment-setting.js
35076
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/enrichment-setting.js
35182
35077
  var SECTION2 = "enrichment";
35183
35078
  var ENRICHMENT_PROVIDERS = ["openai", "anthropic"];
35184
35079
  var DEFAULT_BASE_URLS = {
@@ -35253,7 +35148,7 @@ var costOf = /* @__PURE__ */ __name((usage, setting) => {
35253
35148
  return price ? Math.round((usage.input * price.input + usage.output * price.output) * 1e6) / 1e6 : null;
35254
35149
  }, "costOf");
35255
35150
 
35256
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/enrichment.js
35151
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/enrichment.js
35257
35152
  var ENRICH_PER_RUN = 600;
35258
35153
  var MAX_LINE = 400;
35259
35154
  var line2 = pipe(unknown(), transform((value) => typeof value === "string" ? value.replace(/\s+/g, " ").trim().slice(0, MAX_LINE) : ""));
@@ -35329,7 +35224,7 @@ var enrichmentState = /* @__PURE__ */ __name(async (store, env, estimateFor, key
35329
35224
  };
35330
35225
  }, "enrichmentState");
35331
35226
 
35332
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/notes-title-tier.js
35227
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/notes-title-tier.js
35333
35228
  var plainQueryWords = /* @__PURE__ */ __name((query) => {
35334
35229
  let root;
35335
35230
  try {
@@ -35356,7 +35251,7 @@ var titleTiers = /* @__PURE__ */ __name((hits, words3) => {
35356
35251
  return [...hits].sort((a, b) => rank(a) - rank(b));
35357
35252
  }, "titleTiers");
35358
35253
 
35359
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/notes-search.js
35254
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/notes-search.js
35360
35255
  var storeQuery = /* @__PURE__ */ __name(async (store, text2, { exact, timezone } = {}) => resolvedQuery(store, parsedQuery(text2, exact), timezone), "storeQuery");
35361
35256
  var parsedQuery = /* @__PURE__ */ __name((text2, exact) => validateFields(parseLucene(text2, { ...SEARCH_QUERY, defaultField: exact ? "exact" : "text" })).root, "parsedQuery");
35362
35257
  var resolvedQuery = /* @__PURE__ */ __name(async (store, root, timezone) => {
@@ -35450,7 +35345,6 @@ var nearestAmong = /* @__PURE__ */ __name(async (store, query, refs, options2) =
35450
35345
  var MAX_LINE2 = 200;
35451
35346
  var MAX_NOTES_OFFSET = 1e3;
35452
35347
  var CANDIDATES2 = 50;
35453
- var RRF_K3 = 60;
35454
35348
  var firstLine2 = /* @__PURE__ */ __name((text2, query) => {
35455
35349
  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));
35456
35350
  const lines3 = text2.split("\n");
@@ -35659,7 +35553,7 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
35659
35553
  const held = ranked.get(ref) ?? { note, at, score: 0, foundBy: [] };
35660
35554
  held.foundBy.push(by);
35661
35555
  ranked.set(ref, held);
35662
- const vote = 1 / (RRF_K3 + rank + 1);
35556
+ const vote = 1 / (RRF_K + rank + 1);
35663
35557
  if (by === "meaning" && lookup2 !== void 0 && held.foundBy.includes("words"))
35664
35558
  held.score = Math.max(held.score, vote);
35665
35559
  else
@@ -35785,7 +35679,7 @@ var searchNotesOf = /* @__PURE__ */ __name(async (store, account, text2, { accou
35785
35679
  };
35786
35680
  }, "searchNotesOf");
35787
35681
 
35788
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/events-search.js
35682
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/events-search.js
35789
35683
  var MAX_EVENTS_OFFSET = 1e3;
35790
35684
  var iso3 = /* @__PURE__ */ __name((at) => at === null ? null : new Date(at).toISOString(), "iso");
35791
35685
  var accountIdsOf = /* @__PURE__ */ __name(async (store, accounts) => {
@@ -35881,7 +35775,7 @@ var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, off
35881
35775
  const ranked = /* @__PURE__ */ new Map();
35882
35776
  const add = /* @__PURE__ */ __name((list3, half) => list3.forEach((hit, rank) => {
35883
35777
  const held = ranked.get(keyOf5(hit)) ?? { hit, score: 0, by: [] };
35884
- held.score += 1 / (RRF_K3 + rank + 1);
35778
+ held.score += 1 / (RRF_K + rank + 1);
35885
35779
  held.by.push(half);
35886
35780
  ranked.set(keyOf5(hit), held);
35887
35781
  }), "add");
@@ -35903,7 +35797,7 @@ var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, off
35903
35797
  };
35904
35798
  }, "searchEvents");
35905
35799
 
35906
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/search-all-business.js
35800
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/search-all-business.js
35907
35801
  var OWN_BUSINESS = { provider: "business", account: INTERNAL_NOTES };
35908
35802
  var BUSINESS_WORDS_ONLY = "invoices, payments, orders, contracts, subscriptions, products and wallets are found by the words of their numbers and names only";
35909
35803
  var placeOf = /* @__PURE__ */ __name(({ source, imported }) => source ?? (imported === void 0 ? OWN_BUSINESS : { provider: imported, account: "" }), "placeOf");
@@ -35933,45 +35827,7 @@ var searchBusiness = /* @__PURE__ */ __name(async (store, { words: words3, anyWo
35933
35827
  };
35934
35828
  }, "searchBusiness");
35935
35829
 
35936
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/meeting-hit-search.js
35937
- var resolveMeetingSelection = /* @__PURE__ */ __name(async (store, request) => {
35938
- const { project, tag, topic, ...input } = request;
35939
- input.signal?.throwIfAborted();
35940
- if (project !== void 0 && input.projectId !== void 0 || [tag, topic].filter((value) => value !== void 0).length + Number(input.tagId !== void 0) > 1)
35941
- throw new CliError("validation_error", "choose one project selector and one tag or topic selector");
35942
- const selection = [];
35943
- const knowledge = store.knowledge;
35944
- if (!knowledge && [project, tag, topic].some((value) => value !== void 0))
35945
- throw new CliError("configuration_error", "this store cannot resolve project, tag or topic names");
35946
- for (const [kind, name] of [
35947
- ["project", project],
35948
- ["tag", tag],
35949
- ["topic", topic]
35950
- ]) {
35951
- if (name === void 0)
35952
- continue;
35953
- if (!knowledge)
35954
- continue;
35955
- const found = await knowledge.resolveVocabulary(name, { kind, signal: input.signal });
35956
- input.signal?.throwIfAborted();
35957
- if (found.ambiguous || found.matches.length !== 1)
35958
- throw new CliError(found.matches.length ? "validation_error" : "not_found", `the ${kind} name needs one canonical record`, {
35959
- candidates: found.matches.map((entry2) => ({ kind: entry2.kind, id: entry2.id, name: entry2.name }))
35960
- });
35961
- const entry = found.matches[0];
35962
- const id2 = Number(entry?.id);
35963
- if (!entry || entry.kind !== kind || !Number.isSafeInteger(id2) || id2 < 1)
35964
- throw new CliError("invalid_response", "vocabulary resolution returned an invalid canonical record");
35965
- if (kind === "project")
35966
- input.projectId = id2;
35967
- else
35968
- input.tagId = id2;
35969
- selection.push({ kind, id: id2, name: entry.name, by: "explicit-link" });
35970
- }
35971
- return { input, selection };
35972
- }, "resolveMeetingSelection");
35973
-
35974
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/search-all-meetings.js
35830
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/search-all-meetings.js
35975
35831
  var MOST_HITS_PER_MEETING = 3;
35976
35832
  var PAGE_ROWS = 200;
35977
35833
  var MOST_PAGES = 25;
@@ -36032,8 +35888,8 @@ var meetingLane = /* @__PURE__ */ __name(async (store, caller, request) => {
36032
35888
  const meetings = all.filter((one) => holdsKind(one.provider, "meetings"));
36033
35889
  const stored = meetings.filter((one) => scopes.includes(one.scope));
36034
35890
  const chosen = request.accounts;
36035
- const read = chosen ? stored.filter((one) => chosen.some((key) => sameAccount3(key, one))) : stored;
36036
- const skipped = (chosen ?? []).filter((key) => !read.some((one) => sameAccount3(key, one))).map(({ provider, account }) => {
35891
+ const read2 = chosen ? stored.filter((one) => chosen.some((key) => sameAccount3(key, one))) : stored;
35892
+ const skipped = (chosen ?? []).filter((key) => !read2.some((one) => sameAccount3(key, one))).map(({ provider, account }) => {
36037
35893
  const other = meetings.find((one) => sameAccount3({ provider, account }, one));
36038
35894
  return {
36039
35895
  source: `${provider}:${account}`,
@@ -36041,7 +35897,7 @@ var meetingLane = /* @__PURE__ */ __name(async (store, caller, request) => {
36041
35897
  reason: !other ? "no meetings stored for it" : unknownCaller ? "this account is not in the store yet, so no scope is read" : `a ${other.scope} account; this run reads ${scopes.join(" and ")} accounts`
36042
35898
  };
36043
35899
  });
36044
- const [first2] = read;
35900
+ const [first2] = read2;
36045
35901
  if (!first2) {
36046
35902
  if (!skipped.length && request.asked)
36047
35903
  skipped.push({
@@ -36049,7 +35905,7 @@ var meetingLane = /* @__PURE__ */ __name(async (store, caller, request) => {
36049
35905
  code: "not_found",
36050
35906
  reason: !meetings.length ? "no meeting account stored" : unknownCaller ? "this account is not in the store yet" : "no meeting account in this scope"
36051
35907
  });
36052
- return { items: [], hasMore: false, read, skipped, coverage: [] };
35908
+ return { items: [], hasMore: false, read: read2, skipped, coverage: [] };
36053
35909
  }
36054
35910
  const lifted = liftMeetingFields(request.text, { accountId: first2.id }, void 0, request.timezone);
36055
35911
  const parsed = parseMeetingQuery(lifted.query);
@@ -36061,7 +35917,7 @@ var meetingLane = /* @__PURE__ */ __name(async (store, caller, request) => {
36061
35917
  const lists = [];
36062
35918
  const coverage2 = [];
36063
35919
  const answered = [];
36064
- for (const account of read) {
35920
+ for (const account of read2) {
36065
35921
  try {
36066
35922
  const found = await accountHits(store, account, query, { ...input, accountId: account.id }, request);
36067
35923
  lists.push(found.ranked);
@@ -36199,7 +36055,7 @@ var titleItem = /* @__PURE__ */ __name((account, meeting, query) => ({
36199
36055
  foundBy: ["title"]
36200
36056
  }), "titleItem");
36201
36057
 
36202
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/search-harder.js
36058
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/search-harder.js
36203
36059
  var SECTION3 = "search_harder";
36204
36060
  var HARDER_MODELS = {
36205
36061
  anthropic: "claude-haiku-5-5",
@@ -36445,7 +36301,7 @@ var reorderHarder = /* @__PURE__ */ __name(async (question, hits, { laterPage, a
36445
36301
  };
36446
36302
  }, "reorderHarder");
36447
36303
 
36448
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/search-all.js
36304
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/search-all.js
36449
36305
  var RESOURCES_SEARCHED = ["messages", "mail", "notes", "events", "crm", "business", "meetings"];
36450
36306
  var refusal = /* @__PURE__ */ __name((error, text2) => {
36451
36307
  const { reason, span } = error.details ?? {};
@@ -36551,11 +36407,11 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, asked, messenger =
36551
36407
  if (kind === "messages" && found.coverage)
36552
36408
  coverage2 = found.coverage;
36553
36409
  hasMore ||= found.hasMore;
36554
- const read = found.coverage?.accounts ?? given ?? (await store.accounts.accounts()).filter(({ provider }) => holdsKind(provider, kind));
36410
+ const read2 = found.coverage?.accounts ?? given ?? (await store.accounts.accounts()).filter(({ provider }) => holdsKind(provider, kind));
36555
36411
  for (const one of found.skipped ?? [])
36556
36412
  if (!skipped.some(({ source }) => source === one.source))
36557
36413
  skipped.push(one);
36558
- accounts.push(...read.map(({ provider, account: account2 }) => ({ resource: kind, provider, account: account2 })));
36414
+ accounts.push(...read2.map(({ provider, account: account2 }) => ({ resource: kind, provider, account: account2 })));
36559
36415
  const itemOf3 = /* @__PURE__ */ __name((hit, foundBy) => {
36560
36416
  const at = parseLocator(hit.locator);
36561
36417
  return {
@@ -36582,7 +36438,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, asked, messenger =
36582
36438
  reason: "the query uses NOT, or a filter under OR or in a group, which meaning cannot follow",
36583
36439
  model: chosenTextModel(request.env).id
36584
36440
  }
36585
- } : await meaning(request.text, read, embedders);
36441
+ } : await meaning(request.text, read2, embedders);
36586
36442
  if ("skipped" in lane) {
36587
36443
  by[kind] = { by: "words", meaningSkipped: lane.skipped };
36588
36444
  return byWords;
@@ -36591,14 +36447,14 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, asked, messenger =
36591
36447
  const near2 = await nearEligible(store, account, query, messenger, lane.ranked, filters ? { text: filters } : {});
36592
36448
  const fused2 = /* @__PURE__ */ new Map();
36593
36449
  byWords.forEach((item2, rank) => {
36594
- fused2.set(item2.ref, { item: item2, score: 1 / (RRF_K3 + rank + 1) });
36450
+ fused2.set(item2.ref, { item: item2, score: 1 / (RRF_K + rank + 1) });
36595
36451
  });
36596
36452
  near2.forEach((hit, rank) => {
36597
36453
  cosines.set(hit.locator, hit.cosine);
36598
36454
  const held = fused2.get(hit.locator);
36599
36455
  if (held)
36600
36456
  held.item.foundBy = ["words", "meaning"];
36601
- const vote = 1 / (RRF_K3 + rank + 1);
36457
+ const vote = 1 / (RRF_K + rank + 1);
36602
36458
  if (held && discovers)
36603
36459
  held.score = Math.max(held.score, vote);
36604
36460
  else
@@ -36641,7 +36497,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, asked, messenger =
36641
36497
  text: hit.excerpt,
36642
36498
  foundBy: hit.found_by
36643
36499
  })));
36644
- const read = chosen2 ?? [
36500
+ const read2 = chosen2 ?? [
36645
36501
  ...[
36646
36502
  INTERNAL_NOTES,
36647
36503
  ...(await store.notes.folders()).map(({ id: id2 }) => id2),
@@ -36650,14 +36506,14 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, asked, messenger =
36650
36506
  ].map((account2) => ({ provider: "notes", account: account2 })),
36651
36507
  ...(await importAccounts(store)).map(({ provider, account: account2 }) => ({ provider, account: account2 }))
36652
36508
  ];
36653
- accounts.push(...read.map(({ provider, account: account2 }) => ({ resource, provider, account: account2 })));
36509
+ accounts.push(...read2.map(({ provider, account: account2 }) => ({ resource, provider, account: account2 })));
36654
36510
  } else if (resource === "events") {
36655
- const read = scope?.events ?? await calendarAccounts(store);
36656
- if (!read.length)
36511
+ const read2 = scope?.events ?? await calendarAccounts(store);
36512
+ if (!read2.length)
36657
36513
  continue;
36658
36514
  const found = await searchEvents(store, request.text, {
36659
36515
  limit: depth,
36660
- accounts: read,
36516
+ accounts: read2,
36661
36517
  embedders,
36662
36518
  ...command === void 0 ? {} : { command },
36663
36519
  ...request.env === void 0 ? {} : { env: request.env },
@@ -36685,7 +36541,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, asked, messenger =
36685
36541
  text: hit.excerpt,
36686
36542
  foundBy: hit.found_by
36687
36543
  })));
36688
- accounts.push(...read.map(({ provider, account: account2 }) => ({ resource, provider, account: account2 })));
36544
+ accounts.push(...read2.map(({ provider, account: account2 }) => ({ resource, provider, account: account2 })));
36689
36545
  } else if (resource === "crm") {
36690
36546
  const { words: words3, anyWord } = titleWords2(request.text);
36691
36547
  const chosen2 = scope?.crm;
@@ -36710,8 +36566,8 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, asked, messenger =
36710
36566
  foundBy: deal.matched.includes("title") ? ["title"] : ["words"],
36711
36567
  ...deal.corrections ? { match: "corrected", corrections: deal.corrections } : {}
36712
36568
  })));
36713
- const read = chosen2 ?? [...await crmAccounts(store), { provider: "crm", account: INTERNAL_NOTES }];
36714
- for (const { provider, account: account2 } of read)
36569
+ const read2 = chosen2 ?? [...await crmAccounts(store), { provider: "crm", account: INTERNAL_NOTES }];
36570
+ for (const { provider, account: account2 } of read2)
36715
36571
  accounts.push({ resource, provider, account: account2 });
36716
36572
  } else if (resource === "business") {
36717
36573
  const { words: words3, anyWord } = titleWords2(request.text, BUSINESS_WORDS_ONLY);
@@ -36802,8 +36658,8 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, asked, messenger =
36802
36658
  ...harder === void 0 ? {} : { harder }
36803
36659
  };
36804
36660
  }, "searchAll");
36805
- var withMeetingDocuments = /* @__PURE__ */ __name(async (store, lists, read) => {
36806
- if (!read.size)
36661
+ var withMeetingDocuments = /* @__PURE__ */ __name(async (store, lists, read2) => {
36662
+ if (!read2.size)
36807
36663
  return lists;
36808
36664
  const documentOf = /* @__PURE__ */ __name((item2) => item2.kind === "document" && /^document:\d+$/.test(item2.ref) ? Number(item2.ref.slice("document:".length)) : void 0, "documentOf");
36809
36665
  const documents = lists.flat().flatMap((item2) => documentOf(item2) ?? []);
@@ -36820,7 +36676,7 @@ var withMeetingDocuments = /* @__PURE__ */ __name(async (store, lists, read) =>
36820
36676
  return [item2];
36821
36677
  if (owner.role === "transcript" && meetings.has(owner.meetingId))
36822
36678
  return [];
36823
- if (!read.has(owner.accountId))
36679
+ if (!read2.has(owner.accountId))
36824
36680
  return [item2];
36825
36681
  return [
36826
36682
  {
@@ -36858,7 +36714,7 @@ var insidePeriodFirst = /* @__PURE__ */ __name((ordered, period) => {
36858
36714
  return ordered.map((item2, rank) => ({ item: item2, score: 1 - rank / PERIOD_DEPTH + (inside2(item2) ? PERIOD_BOOST : 0) })).sort((a, b) => b.score - a.score).map(({ item: item2 }) => item2);
36859
36715
  }, "insidePeriodFirst");
36860
36716
 
36861
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/server-search.js
36717
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/server-search.js
36862
36718
  var SERVER_SEARCH_KEY = "messages.server-search";
36863
36719
  var SERVER_BOUNDS = { timeMs: 5e3, perCall: 100, maxCalls: 3, textBytes: 262144 };
36864
36720
  var DEFAULT_BACKEND = "both";
@@ -36894,13 +36750,13 @@ var serverReads = /* @__PURE__ */ __name((account) => ({
36894
36750
  leaf: /* @__PURE__ */ __name((node) => {
36895
36751
  if (node.field === "text" || node.field === "exact")
36896
36752
  return { words: node.value === "" ? [] : [node.value] };
36897
- const { chat, sender, date: date2 } = node.resolution ?? {};
36753
+ const { chat, sender, date } = node.resolution ?? {};
36898
36754
  if (chat)
36899
36755
  return sameAccount4(chat.account, account) ? { words: [], chat: chat.chatId } : void 0;
36900
36756
  if (sender?.provider === account.provider)
36901
36757
  return { words: [], from: sender.id };
36902
- if (date2) {
36903
- const { from, to } = windowOf(date2);
36758
+ if (date) {
36759
+ const { from, to } = windowOf(date);
36904
36760
  return {
36905
36761
  words: [],
36906
36762
  ...from === void 0 ? {} : { minDate: from },
@@ -37049,7 +36905,7 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
37049
36905
  return { report, sources };
37050
36906
  }, "searchServer");
37051
36907
 
37052
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/messages.js
36908
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/messages.js
37053
36909
  var DELETE_AT_ONCE = 10;
37054
36910
  var filesOf = /* @__PURE__ */ __name(({ attachments }) => {
37055
36911
  const files = fileLinks(attachments);
@@ -37057,7 +36913,7 @@ var filesOf = /* @__PURE__ */ __name(({ attachments }) => {
37057
36913
  }, "filesOf");
37058
36914
  var messagesService = /* @__PURE__ */ __name((deps) => {
37059
36915
  const { guard } = deps;
37060
- const inStore = /* @__PURE__ */ __name(async (read) => read(await deps.store(), await deps.account()), "inStore");
36916
+ const inStore = /* @__PURE__ */ __name(async (read2) => read2(await deps.store(), await deps.account()), "inStore");
37061
36917
  const ownTarget = /* @__PURE__ */ __name(async (target2, account) => {
37062
36918
  if (account.provider !== deps.messenger.provider)
37063
36919
  throw new CliError("validation_error", "that locator belongs to another account; select its profile first");
@@ -37099,18 +36955,18 @@ var messagesService = /* @__PURE__ */ __name((deps) => {
37099
36955
  await guardedWrite(guard, { operationId, chatId, kind: "pin", key: pinned ? "messages.pin" : "messages.unpin", messageId: message, notify }, () => act2(chatId, message, { notify, ...duration2 === void 0 ? {} : { duration: duration2 } }));
37100
36956
  return { operationId, chatId, messageId: message, pinned };
37101
36957
  }, "pinning");
37102
- const topicPage = /* @__PURE__ */ __name(async (chat, threadId, { limit, before: before2, beforeTime, after, until }) => {
36958
+ const topicPage = /* @__PURE__ */ __name(async (chat, threadId, { limit, before, beforeTime, after, until }) => {
37103
36959
  if (beforeTime !== void 0 || after !== void 0 || until !== void 0)
37104
36960
  throw new CliError("validation_error", "a topic is read back from its newest message, or from --before-id");
37105
36961
  if (threadId === "1")
37106
36962
  throw new CliError("validation_error", "the General topic's messages carry no topic id \u2014 read the whole chat without --topic");
37107
- const window3 = { limit, ...before2 === void 0 ? {} : { before: before2 } };
36963
+ const window3 = { limit, ...before === void 0 ? {} : { before } };
37108
36964
  if (fromStore(deps)) {
37109
36965
  return inStore(async (store, account) => store.messages.messages(account, await readChatId(deps, chat, store, account), { ...window3, threadId }));
37110
36966
  }
37111
36967
  return capability(await deps.connection(), "topicHistory", "read one forum topic")(chat, threadId, window3);
37112
36968
  }, "topicPage");
37113
- const listPage = /* @__PURE__ */ __name(async (chat, { limit, before: before2, beforeTime, after, until, threadId: typedThread, starred }) => {
36969
+ const listPage = /* @__PURE__ */ __name(async (chat, { limit, before, beforeTime, after, until, threadId: typedThread, starred }) => {
37114
36970
  if (starred !== void 0) {
37115
36971
  if (!fromStore(deps))
37116
36972
  throw new CliError("validation_error", "starred: reads the local store; not while reading from the messenger");
@@ -37118,17 +36974,17 @@ var messagesService = /* @__PURE__ */ __name((deps) => {
37118
36974
  throw new CliError("validation_error", "starred: pages back through the whole chat; give only id< with it");
37119
36975
  return inStore(async (store, account) => store.messages.messages(account, await readChatId(deps, chat, store, account), {
37120
36976
  limit,
37121
- ...before2 === void 0 ? {} : { before: before2 },
36977
+ ...before === void 0 ? {} : { before },
37122
36978
  starred
37123
36979
  }));
37124
36980
  }
37125
36981
  const threadId = threadIdOf(typedThread);
37126
36982
  if (threadId !== void 0)
37127
- return topicPage(chat, threadId, { limit, before: before2, beforeTime, after, until });
36983
+ return topicPage(chat, threadId, { limit, before, beforeTime, after, until });
37128
36984
  if (fromStore(deps)) {
37129
36985
  const window4 = after ? { limit, after, ...until === void 0 ? {} : { until } } : {
37130
36986
  limit,
37131
- ...before2 === void 0 ? {} : { before: before2 },
36987
+ ...before === void 0 ? {} : { before },
37132
36988
  // historyBefore reads strictly before its moment; the store's end is inclusive.
37133
36989
  ...beforeTime === void 0 ? {} : { until: beforeTime - 1 }
37134
36990
  };
@@ -37144,7 +37000,7 @@ var messagesService = /* @__PURE__ */ __name((deps) => {
37144
37000
  const items = page.items.filter((one) => Date.parse(one.timestamp) <= until);
37145
37001
  return { items, hasMore: page.hasMore && items.length === page.items.length };
37146
37002
  }
37147
- const window3 = { limit, ...before2 === void 0 ? {} : { before: before2 } };
37003
+ const window3 = { limit, ...before === void 0 ? {} : { before } };
37148
37004
  return capability(connection, "history", "read a chat's history")(chat, window3);
37149
37005
  }, "listPage");
37150
37006
  return {
@@ -37489,7 +37345,7 @@ var checkMediaOptions = /* @__PURE__ */ __name((messenger, asked, attachments) =
37489
37345
  throw new CliError("validation_error", `${MEDIA_FLAGS[first2]} needs a --photo or --file`);
37490
37346
  }, "checkMediaOptions");
37491
37347
 
37492
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/domain/channel-tags.js
37348
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/domain/channel-tags.js
37493
37349
  var CHANNEL_TAG_RULES_VERSION = "keywords-v1";
37494
37350
  var RULES2 = {
37495
37351
  ai: [/\b(ai|gpt|llm|machine learning|artificial intelligence)\b/iu, /нейросет|искусственн/iu],
@@ -37504,7 +37360,7 @@ var classifyChannel = /* @__PURE__ */ __name((metadata) => Object.entries(RULES2
37504
37360
  return fields.length ? [{ tag, score: fields.length / 3, fields }] : [];
37505
37361
  }), "classifyChannel");
37506
37362
 
37507
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/metadata.js
37363
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/metadata.js
37508
37364
  var metadataService = /* @__PURE__ */ __name((deps) => {
37509
37365
  const held = /* @__PURE__ */ __name(async (reference, { includeLeft = false } = {}) => {
37510
37366
  const store = await deps.store();
@@ -37519,8 +37375,8 @@ var metadataService = /* @__PURE__ */ __name((deps) => {
37519
37375
  const found = (await store.chats.chats(account, {})).items.find((chat) => chat.id === chatId);
37520
37376
  if (!found || found.kind !== "group" && found.kind !== "channel")
37521
37377
  throw new CliError("validation_error", "metadata sync applies to groups and channels");
37522
- const read = /* @__PURE__ */ __name(async (adapter) => capability(adapter, "group", "read group or channel metadata")(chatId), "read");
37523
- const card = deps.withConnection ? await deps.withConnection(read) : await read(await deps.connection());
37378
+ const read2 = /* @__PURE__ */ __name(async (adapter) => capability(adapter, "group", "read group or channel metadata")(chatId), "read");
37379
+ const card = deps.withConnection ? await deps.withConnection(read2) : await read2(await deps.connection());
37524
37380
  return store.chats.saveChatMetadata(account, {
37525
37381
  chatId,
37526
37382
  title: card.title,
@@ -37590,7 +37446,7 @@ var metadataService = /* @__PURE__ */ __name((deps) => {
37590
37446
  };
37591
37447
  }, "metadataService");
37592
37448
 
37593
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/moderation/run.js
37449
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/moderation/run.js
37594
37450
  var FIRST_LOOK_MS = 24 * 36e5;
37595
37451
  var moderateWith = /* @__PURE__ */ __name(async (run2) => {
37596
37452
  const { chatId, title, rules, point, since, dryRun } = run2;
@@ -37627,9 +37483,16 @@ var moderateWith = /* @__PURE__ */ __name(async (run2) => {
37627
37483
  return { chatId, rows, notes };
37628
37484
  }, "moderateWith");
37629
37485
 
37630
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/moderation.js
37486
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/moderation.js
37631
37487
  var moderationService = /* @__PURE__ */ __name((deps) => {
37632
- const file2 = /* @__PURE__ */ __name(() => new ModerationRules(moderationPathFor(deps.messenger.app, deps.profile ?? "default", deps.env ?? process.env)), "file");
37488
+ const file2 = /* @__PURE__ */ __name(() => {
37489
+ const env = deps.env ?? process.env;
37490
+ if (deps.profile === void 0) {
37491
+ const choices = moderationProfiles(deps.messenger.app, env);
37492
+ throw new CliError("validation_error", `name a profile: moderation rules are kept per profile \u2014 ${choices.length ? `profiles here: ${choices.join(", ")}` : "there is none on this computer yet"}`, { profiles: choices });
37493
+ }
37494
+ return new ModerationRules(moderationPathFor(deps.messenger.app, deps.profile, env));
37495
+ }, "file");
37633
37496
  const group = /* @__PURE__ */ __name(async (chat) => {
37634
37497
  if (deps.offline)
37635
37498
  throw new CliError("validation_error", "a group's rules are kept by its id, which the messenger gives");
@@ -37705,7 +37568,7 @@ var moderatorOf = /* @__PURE__ */ __name((adapter, deps) => ({
37705
37568
  }, "removePerson")
37706
37569
  }), "moderatorOf");
37707
37570
 
37708
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/private-people.js
37571
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/private-people.js
37709
37572
  var noteItem = /* @__PURE__ */ __name((provider, note) => ({
37710
37573
  id: note.id,
37711
37574
  contact: formatReference({ type: "contact", provider, id: note.personId }),
@@ -37749,7 +37612,7 @@ var privatePeopleService = /* @__PURE__ */ __name((deps) => {
37749
37612
  };
37750
37613
  }, "privatePeopleService");
37751
37614
 
37752
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/rankings.js
37615
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/rankings.js
37753
37616
  var empty = /* @__PURE__ */ __name(() => ({
37754
37617
  total: 0,
37755
37618
  population: 0,
@@ -38005,7 +37868,7 @@ var rankingsService = /* @__PURE__ */ __name((deps) => ({
38005
37868
  }, "evidence")
38006
37869
  }), "rankingsService");
38007
37870
 
38008
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/reply-stats.js
37871
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/reply-stats.js
38009
37872
  var FIELDS = ["date", "chat", "kind", "muted"];
38010
37873
  var WAITING_TAIL = 100;
38011
37874
  var plainOnly = /* @__PURE__ */ __name((text2, command) => {
@@ -38034,7 +37897,7 @@ var scopeOf3 = /* @__PURE__ */ __name((root, accounts) => {
38034
37897
  visit(clause.node);
38035
37898
  return;
38036
37899
  }
38037
- const { chat, date: date2 } = node.resolution ?? {};
37900
+ const { chat, date } = node.resolution ?? {};
38038
37901
  if (chat)
38039
37902
  scope.chats.push(chat);
38040
37903
  else if (node.field === "kind")
@@ -38046,13 +37909,13 @@ var scopeOf3 = /* @__PURE__ */ __name((root, accounts) => {
38046
37909
  reason: "query.conflict"
38047
37910
  });
38048
37911
  scope.muted = muted;
38049
- } else if (date2) {
38050
- if (date2.lower !== void 0) {
38051
- const lower = date2.lower + (date2.lower_inclusive ? 0 : 1);
37912
+ } else if (date) {
37913
+ if (date.lower !== void 0) {
37914
+ const lower = date.lower + (date.lower_inclusive ? 0 : 1);
38052
37915
  scope.since = Math.max(scope.since ?? lower, lower);
38053
37916
  }
38054
- if (date2.upper !== void 0) {
38055
- const upper = date2.upper - (date2.upper_inclusive ? 0 : 1);
37917
+ if (date.upper !== void 0) {
37918
+ const upper = date.upper - (date.upper_inclusive ? 0 : 1);
38056
37919
  scope.until = Math.min(scope.until ?? upper, upper);
38057
37920
  }
38058
37921
  }
@@ -38139,7 +38002,7 @@ var replyStatsService = /* @__PURE__ */ __name((deps) => {
38139
38002
  };
38140
38003
  }, "replyStatsService");
38141
38004
 
38142
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/searches.js
38005
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/searches.js
38143
38006
  var savedSearchItem = /* @__PURE__ */ __name((one) => ({
38144
38007
  id: one.id,
38145
38008
  name: one.name,
@@ -38265,7 +38128,7 @@ var searchesService = /* @__PURE__ */ __name((deps) => {
38265
38128
  };
38266
38129
  }, "searchesService");
38267
38130
 
38268
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/tags.js
38131
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/tags.js
38269
38132
  var TAGGING_QUERY = {
38270
38133
  entity: "tagging",
38271
38134
  backend: "sql",
@@ -38339,7 +38202,7 @@ var tagsService = /* @__PURE__ */ __name((deps) => {
38339
38202
  return { target: viewOf(account, target2), removed, unchanged: tags.filter((tag) => !removed.includes(tag)) };
38340
38203
  }), "remove"),
38341
38204
  list: /* @__PURE__ */ __name(({ query, limit, offset }) => inStore(async (store, account) => {
38342
- const where = query ? queryFilter(query, TAGGING_COLUMNS, { command: "tags list" }) : void 0;
38205
+ const where = query ? queryFilter(query, TAGGING_COLUMNS, { command: "tags list", zone: timezoneOf() }) : void 0;
38343
38206
  const rows = await store.tags.tags(account, {
38344
38207
  ...where ? { where } : {},
38345
38208
  window: { limit: limit + 1, offset }
@@ -38349,7 +38212,7 @@ var tagsService = /* @__PURE__ */ __name((deps) => {
38349
38212
  };
38350
38213
  }, "tagsService");
38351
38214
 
38352
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/topics.js
38215
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/topics.js
38353
38216
  var actionOf = /* @__PURE__ */ __name(({ title, closed, pinned, hidden, icon }) => {
38354
38217
  const set = [closed, pinned, hidden].filter((one) => one !== void 0).length;
38355
38218
  if (title !== void 0 || icon !== void 0 || set !== 1)
@@ -38548,10 +38411,10 @@ var topicsService = /* @__PURE__ */ __name((deps) => {
38548
38411
  };
38549
38412
  }, "topicsService");
38550
38413
 
38551
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/crm/sync.js
38414
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/crm/sync.js
38552
38415
  var CLOCK_MARGIN = 60 * 6e4;
38553
38416
 
38554
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/crm/writer.js
38417
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/crm/writer.js
38555
38418
  var CRM_ASSIGN_OTHERS_KEY = "crm.assign-others";
38556
38419
  var CRM_WRITE_DEFAULTS = {
38557
38420
  "deals.delete": "ask",
@@ -38559,7 +38422,7 @@ var CRM_WRITE_DEFAULTS = {
38559
38422
  [CRM_ASSIGN_OTHERS_KEY]: "deny"
38560
38423
  };
38561
38424
 
38562
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/evidence.js
38425
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/evidence.js
38563
38426
  import { createHash as createHash11, randomUUID as randomUUID6 } from "node:crypto";
38564
38427
  var hash2 = /* @__PURE__ */ __name((value) => createHash11("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
38565
38428
  var positive2 = /* @__PURE__ */ __name((value, name, minimum = 1) => {
@@ -38633,14 +38496,14 @@ var prepareEvidencePacket = /* @__PURE__ */ __name(({ kind, source, page, limits
38633
38496
  return { ...content, id: randomUUID6(), fingerprint: hash2(content) };
38634
38497
  }, "prepareEvidencePacket");
38635
38498
 
38636
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/evidence-read.js
38637
- var readEvidencePacket = /* @__PURE__ */ __name(async (store, account, { chat, limit, before: before2 }, messenger = {}) => {
38499
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/evidence-read.js
38500
+ var readEvidencePacket = /* @__PURE__ */ __name(async (store, account, { chat, limit, before }, messenger = {}) => {
38638
38501
  if (!Number.isSafeInteger(limit) || limit < 1 || limit > 100)
38639
38502
  throw new CliError("validation_error", "evidence message limit must be an integer from 1 to 100");
38640
- if (before2 !== void 0 && !before2.trim())
38503
+ if (before !== void 0 && !before.trim())
38641
38504
  throw new CliError("validation_error", "evidence before id must not be empty");
38642
38505
  const chatId = await storedChatId(messenger, chat, store, account, { includeLeft: true });
38643
- const page = await store.messages.messages(account, chatId, { limit, ...before2 === void 0 ? {} : { before: before2 } });
38506
+ const page = await store.messages.messages(account, chatId, { limit, ...before === void 0 ? {} : { before } });
38644
38507
  const items = page.items.toReversed();
38645
38508
  const packet = prepareEvidencePacket({
38646
38509
  kind: "chats",
@@ -38653,7 +38516,7 @@ var readEvidencePacket = /* @__PURE__ */ __name(async (store, account, { chat, l
38653
38516
  return { ...packet, nextBeforeId: older && last ? last.id : null };
38654
38517
  }, "readEvidencePacket");
38655
38518
 
38656
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/meeting-project-discovery.js
38519
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/meeting-project-discovery.js
38657
38520
  var scopeKeys = [
38658
38521
  "accountId",
38659
38522
  "meetingId",
@@ -38675,7 +38538,7 @@ var optionKeys = /* @__PURE__ */ new Set([
38675
38538
  "maxVocabularyReadBytes"
38676
38539
  ]);
38677
38540
 
38678
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/text-model-choice.js
38541
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/text-model-choice.js
38679
38542
  import { createHash as createHash12 } from "node:crypto";
38680
38543
  import { existsSync as existsSync3 } from "node:fs";
38681
38544
  var useTextModel = /* @__PURE__ */ __name(async (id2, { env, command }) => {
@@ -38683,8 +38546,8 @@ var useTextModel = /* @__PURE__ */ __name(async (id2, { env, command }) => {
38683
38546
  if (!isTextModelInstalled(model, textModelsDirectory(env)))
38684
38547
  throw new CliError("not_found", `${model.id} is not downloaded \u2014 \`${command} models download ${model.id}\` first`, { reason: "model.not-downloaded", model: model.id });
38685
38548
  const previous = chosenTextModel(env).id;
38686
- const before2 = textModels(env).find((one) => one.id === previous);
38687
- const toEmbed = previous === model.id ? 0 : before2 ? await missingVectors(before2, model, env) : null;
38549
+ const before = textModels(env).find((one) => one.id === previous);
38550
+ const toEmbed = previous === model.id ? 0 : before ? await missingVectors(before, model, env) : null;
38688
38551
  writeTextModelsSection({ ...readTextModelsSection(env), use: model.id }, env);
38689
38552
  return {
38690
38553
  model,
@@ -38806,14 +38669,14 @@ var addCustomTextModel = /* @__PURE__ */ __name(async (id2, payload, { env, fetc
38806
38669
  return { ...checked2.output, custom: true };
38807
38670
  }, "addCustomTextModel");
38808
38671
 
38809
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/calendar/sync.js
38672
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/calendar/sync.js
38810
38673
  var DAY6 = 864e5;
38811
38674
  var SLOTS_EVERY = 7 * DAY6;
38812
38675
 
38813
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/calendar/feeds.js
38676
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/calendar/feeds.js
38814
38677
  var FEED_LIMITS = { maxBytes: 10 * 1024 * 1024, timeoutMs: 3e4, redirects: 5 };
38815
38678
 
38816
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/calendar/reads.js
38679
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/calendar/reads.js
38817
38680
  var LIST = "events list";
38818
38681
  var EVENT_TYPES = [
38819
38682
  "default",
@@ -38872,7 +38735,7 @@ var EVENTS_QUERY = {
38872
38735
  } : field)
38873
38736
  };
38874
38737
 
38875
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/calendar/writer.js
38738
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/calendar/writer.js
38876
38739
  var EVENTS_NOTIFY_KEY = "events.notify";
38877
38740
  var EVENTS_DELETE_SERIES_KEY = "events.delete.series";
38878
38741
  var EVENTS_REMIND_HOOK_KEY = "events.remind.hook";
@@ -38890,7 +38753,7 @@ var CALENDAR_WRITE_DEFAULTS = {
38890
38753
  [EVENTS_REMIND_HOOK_KEY]: "deny"
38891
38754
  };
38892
38755
 
38893
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/context/communication-selection.js
38756
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/context/communication-selection.js
38894
38757
  var communicationFields = {
38895
38758
  sources: pipe(array(strictObject({
38896
38759
  id: pipe(string(), regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/)),
@@ -38913,16 +38776,16 @@ var communicationRequest = /* @__PURE__ */ __name((value, preparationAfter) => {
38913
38776
  const words3 = input.query.match(/[\p{L}\p{N}]+/gu) ?? [];
38914
38777
  if (Buffer.byteLength(input.query) > 2048 || !words3.length || words3.length > 16)
38915
38778
  throw new CliError("validation_error", "communications.query needs 1\u201316 literal words within 2048 UTF-8 bytes");
38916
- const before2 = input.before ?? preparationAfter;
38917
- const after = input.after ?? Math.max(0, before2 - 14 * 864e5);
38918
- if (before2 > preparationAfter || after >= before2 || before2 - after > 90 * 864e5)
38779
+ const before = input.before ?? preparationAfter;
38780
+ const after = input.after ?? Math.max(0, before - 14 * 864e5);
38781
+ if (before > preparationAfter || after >= before || before - after > 90 * 864e5)
38919
38782
  throw new CliError("validation_error", "communications window must be nonempty, span at most 90 days and end by preparation after");
38920
38783
  if (new Set(input.sources.map((s) => s.id)).size !== input.sources.length)
38921
38784
  throw new CliError("validation_error", "communications.sources must not repeat a selection");
38922
- return { ...input, after, before: before2 };
38785
+ return { ...input, after, before };
38923
38786
  }, "communicationRequest");
38924
38787
 
38925
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/meeting-preparation-validation.js
38788
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/meeting-preparation-validation.js
38926
38789
  var MEETING_PREPARATION_LIMITS = {
38927
38790
  meetings: { min: 1, max: 20, default: 5 },
38928
38791
  cues: { min: 1, max: 100, default: 10 },
@@ -38995,7 +38858,7 @@ var validateMeetingPreparationRequest = /* @__PURE__ */ __name((externalId, orig
38995
38858
  };
38996
38859
  }, "validateMeetingPreparationRequest");
38997
38860
 
38998
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/meeting-communications-selection.js
38861
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/meeting-communications-selection.js
38999
38862
  var validatePreparationCommunications = /* @__PURE__ */ __name((section, request, after) => {
39000
38863
  const fail2 = /* @__PURE__ */ __name(() => {
39001
38864
  throw new CliError("invalid_response", "Preparation communications returned another selection or invalid evidence");
@@ -39043,7 +38906,7 @@ var validatePreparationCommunications = /* @__PURE__ */ __name((section, request
39043
38906
  }
39044
38907
  }, "validatePreparationCommunications");
39045
38908
 
39046
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/package-upgrade.js
38909
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/package-upgrade.js
39047
38910
  var upgradePackage = /* @__PURE__ */ __name(async ({ current, command, packageName, check: check2 }, ports) => {
39048
38911
  const installer = ports.installer();
39049
38912
  const argv = updateCommand(installer, packageName);
@@ -39075,9 +38938,9 @@ var upgradePackage = /* @__PURE__ */ __name(async ({ current, command, packageNa
39075
38938
  const installed = await ports.installed?.();
39076
38939
  if (installed === void 0)
39077
38940
  return restart(result, ports);
39078
- const read = { ...result, installed };
38941
+ const read2 = { ...result, installed };
39079
38942
  if (!isNewer(latest2, installed))
39080
- return restart(read, ports);
38943
+ return restart(read2, ports);
39081
38944
  const heldBack = {
39082
38945
  // pnpm 11 resolves `@latest` to the newest version older than minimumReleaseAge, 1 day by default.
39083
38946
  until: installer === "pnpm" ? dayAfter(await ports.publishedAt?.(latest2)) : null,
@@ -39085,8 +38948,8 @@ var upgradePackage = /* @__PURE__ */ __name(async ({ current, command, packageNa
39085
38948
  command: argv.map((word) => word === `${packageName}@latest` ? `${packageName}@${latest2}` : word).join(" ")
39086
38949
  };
39087
38950
  if (installed === current)
39088
- return { result: { ...read, heldBack }, reason: "held_back", left: [] };
39089
- return { ...await restart({ ...read, heldBack }, ports), reason: "held_back" };
38951
+ return { result: { ...read2, heldBack }, reason: "held_back", left: [] };
38952
+ return { ...await restart({ ...read2, heldBack }, ports), reason: "held_back" };
39090
38953
  }, "upgradePackage");
39091
38954
  var restart = /* @__PURE__ */ __name(async (result, ports) => {
39092
38955
  const servers = await ports.afterUpdate?.();
@@ -39108,7 +38971,7 @@ var dayAfter = /* @__PURE__ */ __name((published) => {
39108
38971
  return Number.isNaN(time) ? null : new Date(time + 24 * 60 * 60 * 1e3).toISOString();
39109
38972
  }, "dayAfter");
39110
38973
 
39111
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/services/index.js
38974
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/services/index.js
39112
38975
  var servicesFor = /* @__PURE__ */ __name((deps) => {
39113
38976
  const pictures = picturesService(deps);
39114
38977
  const base = {
@@ -39145,7 +39008,7 @@ var servicesFor = /* @__PURE__ */ __name((deps) => {
39145
39008
  return deps.messenger.services ? { ...base, ...deps.messenger.services(base, deps) } : base;
39146
39009
  }, "servicesFor");
39147
39010
 
39148
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/background/relay.js
39011
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/background/relay.js
39149
39012
  import { createHash as createHash13 } from "node:crypto";
39150
39013
  import { chmodSync, lstatSync, mkdirSync as mkdirSync6, rmSync as rmSync3 } from "node:fs";
39151
39014
  import { createConnection, createServer } from "node:net";
@@ -39366,7 +39229,7 @@ var relayCommand = /* @__PURE__ */ __name((path, request, options2) => new Promi
39366
39229
  }, () => finish({ error: stopped() }));
39367
39230
  }), "relayCommand");
39368
39231
 
39369
- // node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-relay.js
39232
+ // node_modules/.pnpm/@wirecat+cli-core@0.665.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.101.0_commander@15_1712fa6347d2f5f4f52e592cd2c1c3bf/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-relay.js
39370
39233
  var lentConnection = /* @__PURE__ */ __name((connection, watchers) => throughWrapper(connection, {
39371
39234
  close: /* @__PURE__ */ __name(async () => {
39372
39235
  }, "close"),
@@ -39516,7 +39379,8 @@ export {
39516
39379
  BUILT_IN_PURPOSES,
39517
39380
  purposeList,
39518
39381
  gatherStoredProject,
39519
- validateMediaSince,
39382
+ momentOf,
39383
+ dateWindow,
39520
39384
  checkMediaArchive,
39521
39385
  archiveMedia,
39522
39386
  moveMediaArchive,
@@ -39527,9 +39391,6 @@ export {
39527
39391
  projectStatus,
39528
39392
  sendTime,
39529
39393
  readMail,
39530
- momentOf,
39531
- aheadOf,
39532
- dateWindow,
39533
39394
  RANKING_SELECTION_BYTES,
39534
39395
  readRankingSelection,
39535
39396
  isAdminSelection,
@@ -39663,8 +39524,10 @@ export {
39663
39524
  lentConnection,
39664
39525
  serveRelay,
39665
39526
  positiveCount,
39527
+ configuredLimit,
39666
39528
  withPaging,
39667
39529
  window,
39530
+ pagingOf,
39668
39531
  chatRef,
39669
39532
  chatAnswer,
39670
39533
  memberAnswer,