@wirecat/tg-cli 0.119.0 → 0.120.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 (107) hide show
  1. package/contracts/wirecat.json +2 -0
  2. package/dist/bin/tg.js +2 -2
  3. package/dist/bundle/{adapter-NEQQOANM.js → adapter-OJKHXGBC.js} +49 -49
  4. package/dist/bundle/{all-profiles-QFT46FTF.js → all-profiles-URIWNL23.js} +10 -10
  5. package/dist/bundle/{anthropic-UJ4RYCWU.js → anthropic-YUKNB63B.js} +5 -5
  6. package/dist/bundle/{app-server-NE3EL5IK.js → app-server-H5QNHGH4.js} +43 -43
  7. package/dist/bundle/{bot-api-D4H5SCP5.js → bot-api-27GN4Y3D.js} +49 -49
  8. package/dist/bundle/{bot-history-KF2PUMWA.js → bot-history-VVSWLVZM.js} +18 -18
  9. package/dist/bundle/{bun-F7MH5YKA.js → bun-PAAJX3GU.js} +2 -2
  10. package/dist/bundle/{bun-sqlite-FYDJXUHF.js → bun-sqlite-TPEBWFZH.js} +5 -5
  11. package/dist/bundle/{chunk-XM3P7LLT.js → chunk-34DSPJNN.js} +2 -2
  12. package/dist/bundle/{chunk-QD27C3BG.js → chunk-3FPFRDG2.js} +10 -8
  13. package/dist/bundle/{chunk-OG2CG2GS.js → chunk-3GLLWDM6.js} +12 -12
  14. package/dist/bundle/{chunk-FQ3C6DFV.js → chunk-3SANNNWS.js} +3 -3
  15. package/dist/bundle/{chunk-G3MQOH6Z.js → chunk-4JATS2J5.js} +3 -3
  16. package/dist/bundle/{chunk-6OE5I3PR.js → chunk-4OWY7QBE.js} +6 -6
  17. package/dist/bundle/{chunk-QG5U6HCI.js → chunk-4W4EVVL4.js} +4 -4
  18. package/dist/bundle/{chunk-JKKEMVW3.js → chunk-6XHZV7AQ.js} +4 -4
  19. package/dist/bundle/{chunk-IAGX5VFL.js → chunk-7DPWVKYS.js} +4 -4
  20. package/dist/bundle/{chunk-5EHJWIW4.js → chunk-7I6YVQHW.js} +2 -2
  21. package/dist/bundle/{chunk-TKHEVAEG.js → chunk-7N4IUEX3.js} +8 -8
  22. package/dist/bundle/{chunk-HV5YYAJX.js → chunk-7VNV426X.js} +51 -18
  23. package/dist/bundle/{chunk-YMWPRHXG.js → chunk-7WS3ULOO.js} +1185 -426
  24. package/dist/bundle/{chunk-FJKP6MMP.js → chunk-B7B65ZLU.js} +2 -2
  25. package/dist/bundle/{chunk-3EQ7USKJ.js → chunk-CGUDXNJE.js} +2 -2
  26. package/dist/bundle/{chunk-4AACB23H.js → chunk-CLTMVPGT.js} +13 -13
  27. package/dist/bundle/{chunk-FQZSS3AB.js → chunk-CLURRDNU.js} +6 -6
  28. package/dist/bundle/{chunk-RGU2G3KL.js → chunk-CYWV2RLN.js} +4 -4
  29. package/dist/bundle/{chunk-F223KYWG.js → chunk-D2WNQJUQ.js} +1 -1
  30. package/dist/bundle/{chunk-6ERQJRL2.js → chunk-DDKFAUQD.js} +2 -2
  31. package/dist/bundle/{chunk-Z4CGZAFQ.js → chunk-DE7QIEUP.js} +34 -34
  32. package/dist/bundle/{chunk-7VUNJDYU.js → chunk-DH7VKHTZ.js} +4 -4
  33. package/dist/bundle/{chunk-L33G5ARH.js → chunk-DQTQO6PB.js} +1005 -768
  34. package/dist/bundle/{chunk-TEZKCH5B.js → chunk-FATTEYZH.js} +2 -2
  35. package/dist/bundle/{chunk-23JGV5FQ.js → chunk-FPWXG53C.js} +11 -11
  36. package/dist/bundle/{chunk-MDLSI3EN.js → chunk-H5XC2WYO.js} +35 -589
  37. package/dist/bundle/{chunk-UBCLVM7C.js → chunk-HDSKBXAF.js} +3 -3
  38. package/dist/bundle/{chunk-X5PDWCG7.js → chunk-HIBYYKGO.js} +1 -1
  39. package/dist/bundle/{chunk-HPQQ76WF.js → chunk-JJY3TQTM.js} +3 -3
  40. package/dist/bundle/{chunk-D6YTBJY6.js → chunk-JQLGS3SG.js} +1 -1
  41. package/dist/bundle/{chunk-2BAJ6ORN.js → chunk-JSEIT2WO.js} +1 -1
  42. package/dist/bundle/{chunk-BXIPT2BO.js → chunk-KLHOQ6XQ.js} +1 -1
  43. package/dist/bundle/{chunk-CX2WCEQU.js → chunk-KP26Y5OA.js} +1440 -248
  44. package/dist/bundle/{chunk-3K65KTXD.js → chunk-KRCMKFUV.js} +2 -2
  45. package/dist/bundle/{chunk-HGMMRT4G.js → chunk-KTV5Y5EX.js} +2 -2
  46. package/dist/bundle/{chunk-7C6POLLO.js → chunk-KW6JZGG3.js} +1 -1
  47. package/dist/bundle/{chunk-D4Y2KL5V.js → chunk-LLCGOZ44.js} +4 -4
  48. package/dist/bundle/{chunk-FRW3CWC7.js → chunk-LS72R7DN.js} +34 -34
  49. package/dist/bundle/{chunk-NDSRND3E.js → chunk-LVGX7VTD.js} +4 -4
  50. package/dist/bundle/{chunk-5FEEFXJA.js → chunk-MCPOZNWG.js} +1 -1
  51. package/dist/bundle/{chunk-6K5R3YPN.js → chunk-MMPISXSU.js} +2 -2
  52. package/dist/bundle/{chunk-65BWMPCI.js → chunk-MTD6WZKV.js} +2 -2
  53. package/dist/bundle/{chunk-TT4CIXVH.js → chunk-PDYTNTQI.js} +6 -6
  54. package/dist/bundle/{chunk-KBHK5UGL.js → chunk-RX5CJ55S.js} +1 -1
  55. package/dist/bundle/{chunk-QTFXYR5W.js → chunk-S6OC367D.js} +4 -4
  56. package/dist/bundle/{chunk-DQELQ7BL.js → chunk-THJHYMFR.js} +1293 -1525
  57. package/dist/bundle/{chunk-RUNFFBJU.js → chunk-U2TPRUWK.js} +84 -72
  58. package/dist/bundle/{chunk-V5Z2JO6X.js → chunk-U6HEZPCR.js} +19 -19
  59. package/dist/bundle/{chunk-SMHLQEE2.js → chunk-VUBZFMGP.js} +2 -2
  60. package/dist/bundle/{chunk-W2BIBPRU.js → chunk-VUUR2SRS.js} +67 -44
  61. package/dist/bundle/{chunk-KC4MQRAB.js → chunk-WGGSFGNZ.js} +8 -8
  62. package/dist/bundle/{chunk-ZEQ7ONPZ.js → chunk-WLBPNLDF.js} +3 -3
  63. package/dist/bundle/{chunk-QQ3QZFFD.js → chunk-WQ55F4Y3.js} +8 -8
  64. package/dist/bundle/{chunk-72QLHHSO.js → chunk-YBOVL25O.js} +17 -15
  65. package/dist/bundle/{chunk-S3HAFJVC.js → chunk-YDROJG2Y.js} +86 -29
  66. package/dist/bundle/{chunk-CIDFV3IT.js → chunk-YQKEPT22.js} +1 -1
  67. package/dist/bundle/{chunk-XDMJVWWR.js → chunk-ZON7K5QE.js} +3 -3
  68. package/dist/bundle/{chunk-ROOUBFUW.js → chunk-ZRRZTPSB.js} +18152 -17010
  69. package/dist/bundle/command-contract-KW6FNOJO.js +33 -0
  70. package/dist/bundle/{decode-5N4ERCHC.js → decode-RVWSCZW4.js} +5 -5
  71. package/dist/bundle/{dispatch-TBGXBDHE.js → dispatch-U2DW6UI7.js} +8 -8
  72. package/dist/bundle/{echarts-YDEBAMXT.js → echarts-6VNUD3JF.js} +2 -2
  73. package/dist/bundle/{embed-T7H62XFR.js → embed-LWLCQKIK.js} +6 -6
  74. package/dist/bundle/{embedder-AW3O2TR3.js → embedder-CXKHLRJT.js} +9 -9
  75. package/dist/bundle/{entry-L2LJ2VPY.js → entry-HV4NSX3Z.js} +7 -7
  76. package/dist/bundle/{failure-AWHPW2HE.js → failure-HJD7S5UA.js} +2 -2
  77. package/dist/bundle/{first-run-6PBZSRZU.js → first-run-OPI6NIWQ.js} +11 -11
  78. package/dist/bundle/first-screen-BVQLF4LN.js +31 -0
  79. package/dist/bundle/{instructions-C3NJERO7.js → instructions-TK4HXL3A.js} +1 -1
  80. package/dist/bundle/{mcp-CWLASTLV.js → mcp-7KQUJNFN.js} +2 -2
  81. package/dist/bundle/{node-P3CIIYWU.js → node-WFPNBUCU.js} +2 -2
  82. package/dist/bundle/{node-sqlite-YVHMNRVA.js → node-sqlite-L5BRGJLK.js} +6 -6
  83. package/dist/bundle/{oauth-5OQYA2SV.js → oauth-CGVWL35B.js} +7 -7
  84. package/dist/bundle/{open-YGWUVSU7.js → open-HLL55C5S.js} +5 -5
  85. package/dist/bundle/{openai-U45JBQ6F.js → openai-YFCNXIJ4.js} +14 -14
  86. package/dist/bundle/{process-DCYX5EDG.js → process-4A5JP5LO.js} +1 -1
  87. package/dist/bundle/{program-UZBFH2EZ.js → program-IFGQGSUF.js} +52 -52
  88. package/dist/bundle/{prompt-HPVTPTFI.js → prompt-B5FYE2DQ.js} +5 -5
  89. package/dist/bundle/{proxy-transport-D7MCHGSV.js → proxy-transport-ENU2SJYT.js} +5 -5
  90. package/dist/bundle/{recognize-IJCPFJ76.js → recognize-ZHMHGIV3.js} +4 -4
  91. package/dist/bundle/{remote-MWDYQWFW.js → remote-A3W5HE52.js} +7 -7
  92. package/dist/bundle/{rerank-SXG64475.js → rerank-HWJAQOZM.js} +7 -7
  93. package/dist/bundle/{serve-KJQENHEH.js → serve-PP326Q2F.js} +9 -9
  94. package/dist/bundle/{server-MXVXZWN6.js → server-MV6CL63L.js} +35 -35
  95. package/dist/bundle/server-TZGGOJ26.js +60 -0
  96. package/dist/bundle/{state-CKKJWH27.js → state-Y3RJ7ZXB.js} +6 -6
  97. package/dist/bundle/{store-R3BE4V56.js → store-EVNI2MHZ.js} +13 -13
  98. package/dist/bundle/store-maintenance-command-XPQE47RE.js +49 -0
  99. package/dist/bundle/tg.js +13 -13
  100. package/dist/version.d.ts +1 -1
  101. package/dist/version.js +1 -1
  102. package/package.json +3 -3
  103. package/dist/bundle/command-contract-7TGMZRBE.js +0 -33
  104. package/dist/bundle/first-screen-UKCD7D2R.js +0 -31
  105. package/dist/bundle/server-RTMCRKQF.js +0 -60
  106. package/dist/bundle/store-maintenance-command-KDGBSBNU.js +0 -49
  107. /package/dist/bundle/{chunk-DWX4DE2I.js → chunk-YVNHQFLC.js} +0 -0
@@ -8,16 +8,19 @@ import {
8
8
  sameOrdinaryFile,
9
9
  syncDirectory,
10
10
  writeFileAtomic
11
- } from "./chunk-4AACB23H.js";
11
+ } from "./chunk-CLTMVPGT.js";
12
12
  import {
13
+ CEILING_KEY,
13
14
  Command,
14
15
  CustomTextModelShape,
15
16
  DEFAULT_IMAGE_MODEL,
16
17
  DEFAULT_RERANK_MODEL,
18
+ DEFAULT_TEXT_MODEL,
17
19
  InvalidArgumentError,
18
20
  LEVELS,
19
21
  LINK,
20
22
  Option,
23
+ PREVIOUS_DEFAULT_TEXT_MODEL,
21
24
  WEIGHTS,
22
25
  agenda,
23
26
  annotate,
@@ -34,6 +37,8 @@ import {
34
37
  imageModelsDirectory,
35
38
  isImageModelInstalled,
36
39
  itemOf,
40
+ keyForWrite,
41
+ levelFor,
37
42
  listOf,
38
43
  meaningFloor,
39
44
  nextStep,
@@ -45,24 +50,25 @@ import {
45
50
  rerankModel,
46
51
  sentIds,
47
52
  sharedCommand,
53
+ skipFlagFor,
48
54
  snakeKeys,
49
55
  tagging,
50
56
  task,
51
57
  textModel,
52
58
  textModels,
53
- typedCommand,
54
59
  vectorModelKey,
55
- withAttempt,
56
60
  writeTextModelsSection
57
- } from "./chunk-DQELQ7BL.js";
61
+ } from "./chunk-THJHYMFR.js";
58
62
  import {
59
63
  isNewer,
60
64
  updateCommand
61
- } from "./chunk-IAGX5VFL.js";
65
+ } from "./chunk-7DPWVKYS.js";
62
66
  import {
67
+ MESSENGER_CHANGE_REFUSAL,
63
68
  envName,
64
- readOnlyLockOf
65
- } from "./chunk-6ERQJRL2.js";
69
+ readOnlyLockOf,
70
+ readOnlyRefusal
71
+ } from "./chunk-DDKFAUQD.js";
66
72
  import {
67
73
  AGENDA_COLUMNS,
68
74
  BUSINESS_FIND_MAX,
@@ -73,7 +79,6 @@ import {
73
79
  CONVERSATION_COLUMNS,
74
80
  COUNTER_FIELDS,
75
81
  FIELD_VERSION,
76
- INTERNAL_NOTES,
77
82
  MAIL_AGENDA_COLUMNS,
78
83
  MAX_FILE_BYTES,
79
84
  MAX_TEXT_CHARS,
@@ -87,7 +92,6 @@ import {
87
92
  SEARCH_QUERY,
88
93
  TASK_RELATION_KINDS,
89
94
  TRACKED_CHAT_COLUMNS,
90
- UNKNOWN_PROVIDER,
91
95
  WORD_BODY,
92
96
  amountsOf,
93
97
  attachmentColumns,
@@ -106,55 +110,38 @@ import {
106
110
  cutChunks,
107
111
  delayStats,
108
112
  dueDayOf,
109
- entriesOfList,
110
113
  exhausted,
111
114
  fetchedKey,
112
- fitting,
113
- formatLocator,
114
- formatReference,
115
115
  googleDocumentLinks,
116
116
  hasStems,
117
117
  hasText,
118
118
  historyStartKey,
119
119
  hitFiles,
120
- holdsKind,
121
- holdsKindOf,
122
- inSource,
123
120
  inboxKey,
124
- isAccountList,
125
- isFolderProvider,
126
- isImportedProvider,
127
- isKind,
128
- isLocator,
129
121
  isQueryLimit,
130
122
  isStemmed,
131
- kindIn,
132
- listedHolds,
133
- looksLikeReference,
134
123
  matchDownloads,
135
124
  messageOfEmail,
136
125
  normalizeVocabularyName,
137
126
  openStore,
138
127
  outOfTime,
139
- parseLocator,
140
- parseReference,
141
128
  pdfPreviewLimits,
142
129
  plainQuery,
143
- providerLabel,
144
- providerNamed,
130
+ profilesOn,
145
131
  queryFilter,
146
132
  rankingContextRange,
147
133
  rankingOptions,
148
134
  rankingQuestion,
149
135
  searchError,
150
- sourceOf,
151
136
  threadConversation,
152
137
  validateAst,
153
138
  validateFields,
154
139
  withoutField
155
- } from "./chunk-ROOUBFUW.js";
140
+ } from "./chunk-ZRRZTPSB.js";
156
141
  import {
157
142
  EVENT_QUERY,
143
+ INTERNAL_NOTES,
144
+ LOG_ATTRIBUTES,
158
145
  MEETING_PROJECT_EVIDENCE_QUERY,
159
146
  MEETING_QUERY,
160
147
  MEETING_QUERY_GUIDE,
@@ -163,19 +150,42 @@ import {
163
150
  SAVE_HELP,
164
151
  TASK_KINDS,
165
152
  TASK_STATES,
153
+ UNKNOWN_PROVIDER,
154
+ accountsOfList,
166
155
  createTaskService,
156
+ currentRun,
167
157
  dateRange,
168
158
  defineQuery,
159
+ entriesOfList,
169
160
  eventItem,
170
161
  exportMeeting,
171
162
  fieldsHelp,
172
163
  fieldsNamed,
164
+ fitting,
165
+ formatLocator,
173
166
  formatMeetingReference,
167
+ formatReference,
168
+ fromLogAttributes,
169
+ holdsKind,
170
+ holdsKindOf,
174
171
  implicitTextTerms,
175
172
  importFiles,
173
+ inSource,
174
+ isAccountList,
176
175
  isClosedState,
176
+ isDocumentAccountProvider,
177
+ isFolderProvider,
178
+ isGroupName,
179
+ isImportedProvider,
180
+ isKind,
181
+ isLocator,
177
182
  isUsable,
183
+ keyOf,
184
+ kindIn,
178
185
  listed,
186
+ listedHolds,
187
+ logAttributes,
188
+ looksLikeReference,
179
189
  meetingCueFingerprint,
180
190
  meetingDetailsAnswer,
181
191
  meetingHitsList,
@@ -185,37 +195,46 @@ import {
185
195
  meetingsList,
186
196
  meetingsQuery,
187
197
  normalizeTag,
198
+ parseLocator,
188
199
  parseLucene,
189
200
  parseMeetingReference,
201
+ parseReference,
202
+ providerLabel,
203
+ providerNamed,
190
204
  pull,
191
205
  queryError,
192
206
  queryFieldsOf,
193
207
  readMeetingProjectEvidence,
208
+ sameAs,
209
+ sourceOf,
210
+ sourceOf2,
194
211
  strongRecordingValidator,
195
212
  timezoneOf,
213
+ typedCommand,
196
214
  validateMeetingHitSearch,
197
215
  validateMeetingPassage,
198
216
  validateQuery,
199
217
  walkQuery,
218
+ withAttempt,
200
219
  zonedMoment
201
- } from "./chunk-CX2WCEQU.js";
220
+ } from "./chunk-KP26Y5OA.js";
202
221
  import {
203
222
  isCliFailure,
204
223
  sqliteCode
205
- } from "./chunk-ZEQ7ONPZ.js";
224
+ } from "./chunk-WLBPNLDF.js";
206
225
  import {
207
226
  DEFAULT_STEMMERS,
208
227
  createStemmer,
209
228
  fold,
210
229
  normalize
211
- } from "./chunk-QQ3QZFFD.js";
230
+ } from "./chunk-WQ55F4Y3.js";
212
231
  import {
213
232
  DEFAULT_TASK_CATEGORIES,
214
233
  FALLBACK_CATEGORY,
215
234
  readSharedSection,
216
235
  sharedConfigPath,
217
236
  writeSharedSection
218
- } from "./chunk-FQZSS3AB.js";
237
+ } from "./chunk-CLURRDNU.js";
219
238
  import {
220
239
  MAX_MODEL_IMAGE_BYTES,
221
240
  checkedOptions,
@@ -223,10 +242,10 @@ import {
223
242
  range,
224
243
  systemFor,
225
244
  validateImages
226
- } from "./chunk-QTFXYR5W.js";
245
+ } from "./chunk-S6OC367D.js";
227
246
  import {
228
247
  remoteKey
229
- } from "./chunk-FQ3C6DFV.js";
248
+ } from "./chunk-3SANNNWS.js";
230
249
  import {
231
250
  Unzip,
232
251
  UnzipInflate,
@@ -237,21 +256,23 @@ import {
237
256
  placedText,
238
257
  runEmbedders,
239
258
  textModelsDirectory
240
- } from "./chunk-6OE5I3PR.js";
259
+ } from "./chunk-4OWY7QBE.js";
241
260
  import {
242
261
  installFiles,
243
262
  megabytes
244
- } from "./chunk-7VUNJDYU.js";
263
+ } from "./chunk-DH7VKHTZ.js";
245
264
  import {
246
265
  storePath,
247
266
  wirecatDirectory
248
- } from "./chunk-6K5R3YPN.js";
267
+ } from "./chunk-MMPISXSU.js";
249
268
  import {
250
269
  Credentials,
270
+ logRecordOf,
251
271
  pathsAreOverridden,
272
+ realSleep,
252
273
  resolvePaths,
253
274
  writeSecurely
254
- } from "./chunk-V5Z2JO6X.js";
275
+ } from "./chunk-U6HEZPCR.js";
255
276
  import {
256
277
  array,
257
278
  boolean,
@@ -279,7 +300,7 @@ import {
279
300
  trim,
280
301
  union,
281
302
  unknown
282
- } from "./chunk-KC4MQRAB.js";
303
+ } from "./chunk-WGGSFGNZ.js";
283
304
  import {
284
305
  importFrom,
285
306
  resolveFrom
@@ -289,7 +310,7 @@ import {
289
310
  isCliError,
290
311
  singleLine,
291
312
  visibleControls
292
- } from "./chunk-SMHLQEE2.js";
313
+ } from "./chunk-VUBZFMGP.js";
293
314
  import {
294
315
  __commonJS,
295
316
  __name,
@@ -16905,7 +16926,7 @@ var require_lib3 = __commonJS({
16905
16926
  }
16906
16927
  });
16907
16928
 
16908
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/conversations/link.js
16929
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/conversations/link.js
16909
16930
  var RULES_VERSION = 5;
16910
16931
  var LOOK_BACK = 50;
16911
16932
  var SAME_SENDER_WITHIN = 10;
@@ -16995,15 +17016,15 @@ var latest = /* @__PURE__ */ __name((window3, matches) => {
16995
17016
  var sameThread = /* @__PURE__ */ __name((a, b) => a.threadId === b.threadId, "sameThread");
16996
17017
  var link = /* @__PURE__ */ __name((message, parentId, source, kind, confidence, method) => ({ messageId: message.id, parentId, source, kind, confidence, method }), "link");
16997
17018
 
16998
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/ports/traits.js
17019
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/ports/traits.js
16999
17020
  var syncsOneChat = /* @__PURE__ */ __name((messenger) => messenger.history !== "store" || messenger.historyOnDemand === true, "syncsOneChat");
17000
17021
 
17001
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/sends/send-id.js
17022
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/sends/send-id.js
17002
17023
  import { randomBytes } from "node:crypto";
17003
17024
  var newSendId = /* @__PURE__ */ __name(() => randomBytes(8).readBigInt64BE().toString(), "newSendId");
17004
17025
  var newOperationId = newSendId;
17005
17026
 
17006
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/sends/upload.js
17027
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/sends/upload.js
17007
17028
  import { openAsBlob, realpathSync } from "node:fs";
17008
17029
  import { open, stat } from "node:fs/promises";
17009
17030
  import { basename, dirname, extname, isAbsolute, relative, resolve, sep } from "node:path";
@@ -17224,7 +17245,547 @@ var readStickerFile = /* @__PURE__ */ __name(async (path, maxBytes, read) => {
17224
17245
  return { name, source };
17225
17246
  }, "readStickerFile");
17226
17247
 
17227
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/messenger/lacks.js
17248
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/sends/guard.js
17249
+ import { randomUUID } from "node:crypto";
17250
+
17251
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/sends/flood.js
17252
+ import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
17253
+ import { dirname as dirname2, join } from "node:path";
17254
+ var MOST_DEADLINES = 50;
17255
+ var LIMITED_HOLD_MS = 60 * 60 * 1e3;
17256
+ var FROZEN_HOLD_MS = 24 * 60 * 60 * 1e3;
17257
+ var NO_END = "9999-12-31T23:59:59.999Z";
17258
+ var holdEnd = /* @__PURE__ */ __name((block, show = (iso4) => iso4) => block.until === null ? "until lifted" : `until ${show(block.until)}`, "holdEnd");
17259
+ var floodPathFor = /* @__PURE__ */ __name((app, profile, env = process.env) => join(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "flood", `${profile}.json`), "floodPathFor");
17260
+ var FloodMemory = class {
17261
+ static {
17262
+ __name(this, "FloodMemory");
17263
+ }
17264
+ path;
17265
+ now;
17266
+ constructor(path, now = Date.now) {
17267
+ this.path = path;
17268
+ this.now = now;
17269
+ }
17270
+ /** What is still in force; anything expired is left out. */
17271
+ read() {
17272
+ const now = this.now();
17273
+ let raw;
17274
+ try {
17275
+ raw = JSON.parse(readFileSync(this.path, "utf8"));
17276
+ } catch {
17277
+ return { deadlines: [] };
17278
+ }
17279
+ const alive = /* @__PURE__ */ __name((until) => typeof until === "string" && Date.parse(until) > now, "alive");
17280
+ const deadlines = Array.isArray(raw.deadlines) ? raw.deadlines.filter((one) => typeof one?.operation === "string" && alive(one.until)) : [];
17281
+ const block = raw.sendBlock && (raw.sendBlock.until === NO_END ? { ...raw.sendBlock, until: null } : raw.sendBlock);
17282
+ const held = block && (block.until === null || alive(block.until));
17283
+ return { deadlines, ...held ? { sendBlock: block } : {} };
17284
+ }
17285
+ /** The deadline this call is still under: one for its chat, or one for the call in every chat. */
17286
+ owed(operation, chatId) {
17287
+ return this.read().deadlines.filter((one) => one.operation === operation && (one.chatId === void 0 || one.chatId === chatId)).sort((a, b) => b.until.localeCompare(a.until))[0];
17288
+ }
17289
+ remember(deadline) {
17290
+ const { waitMs, ...rest } = deadline;
17291
+ const kept2 = { ...rest, until: new Date(this.now() + waitMs).toISOString() };
17292
+ const state = this.read();
17293
+ const others = state.deadlines.filter((one) => one.operation !== kept2.operation || one.chatId !== kept2.chatId);
17294
+ const deadlines = [...others, kept2].sort((a, b) => b.until.localeCompare(a.until)).slice(0, MOST_DEADLINES);
17295
+ this.#write({ ...state, deadlines });
17296
+ return kept2;
17297
+ }
17298
+ sendBlock() {
17299
+ return this.read().sendBlock;
17300
+ }
17301
+ /** A ban the messenger gave no end for holds until lifted; a spam limit or a freeze without one, for a while. */
17302
+ block(block) {
17303
+ const now = this.now();
17304
+ const holdMs = { limited: LIMITED_HOLD_MS, frozen: FROZEN_HOLD_MS, banned: void 0 }[block.state];
17305
+ const kept2 = {
17306
+ ...block,
17307
+ since: new Date(now).toISOString(),
17308
+ until: block.until ?? (holdMs === void 0 ? null : new Date(now + holdMs).toISOString())
17309
+ };
17310
+ this.#write({ ...this.read(), sendBlock: kept2 });
17311
+ return kept2;
17312
+ }
17313
+ /** Lifts only a block of this state: an account found not frozen may still be limited for spam. */
17314
+ unblock(state) {
17315
+ const { sendBlock, ...rest } = this.read();
17316
+ if (sendBlock?.state === state)
17317
+ this.#write(rest);
17318
+ }
17319
+ /** Forgets every wait and lifts the hold, and answers with what was still in force. */
17320
+ clear() {
17321
+ const cleared = this.read();
17322
+ this.#write({ deadlines: [] });
17323
+ return cleared;
17324
+ }
17325
+ #write({ sendBlock, ...rest }) {
17326
+ const state = sendBlock ? { ...rest, sendBlock: { ...sendBlock, until: sendBlock.until ?? NO_END } } : rest;
17327
+ mkdirSync(dirname2(this.path), { recursive: true, mode: 448 });
17328
+ const temporary = `${this.path}.${process.pid}.tmp`;
17329
+ writeFileSync(temporary, `${JSON.stringify(state)}
17330
+ `, { mode: 384 });
17331
+ renameSync(temporary, this.path);
17332
+ }
17333
+ };
17334
+
17335
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/sends/journal.js
17336
+ import { appendFileSync, mkdirSync as mkdirSync3, readFileSync as readFileSync2 } from "node:fs";
17337
+ import { dirname as dirname4, join as join2 } from "node:path";
17338
+
17339
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/sends/file-lock.js
17340
+ import { closeSync, mkdirSync as mkdirSync2, openSync, statSync, unlinkSync } from "node:fs";
17341
+ import { dirname as dirname3 } from "node:path";
17342
+ var LOCK_WAIT_MS = 5e3;
17343
+ var LOCK_STALE_MS = 3e4;
17344
+ var RETRY_MS = 20;
17345
+ var pause = new Int32Array(new SharedArrayBuffer(4));
17346
+ var withFileLock = /* @__PURE__ */ __name((path, what, body, waitMs = LOCK_WAIT_MS) => {
17347
+ const lock = lockFor(path);
17348
+ const deadline = Date.now() + waitMs;
17349
+ while (!taken(lock)) {
17350
+ if (Date.now() >= deadline)
17351
+ throw lockTimeout(what, waitMs, lock);
17352
+ Atomics.wait(pause, 0, 0, RETRY_MS);
17353
+ }
17354
+ return holding(lock, body);
17355
+ }, "withFileLock");
17356
+ var withFileLockAsync = /* @__PURE__ */ __name(async (path, what, body, waitMs = LOCK_WAIT_MS, sleep5 = realSleep) => {
17357
+ const lock = lockFor(path);
17358
+ const deadline = Date.now() + waitMs;
17359
+ while (!taken(lock)) {
17360
+ if (Date.now() >= deadline)
17361
+ throw lockTimeout(what, waitMs, lock);
17362
+ await sleep5(RETRY_MS);
17363
+ }
17364
+ return holding(lock, body);
17365
+ }, "withFileLockAsync");
17366
+ var lockFor = /* @__PURE__ */ __name((path) => {
17367
+ mkdirSync2(dirname3(path), { recursive: true, mode: 448 });
17368
+ return `${path}.lock`;
17369
+ }, "lockFor");
17370
+ var taken = /* @__PURE__ */ __name((lock) => {
17371
+ for (; ; ) {
17372
+ try {
17373
+ closeSync(openSync(lock, "wx", 384));
17374
+ return true;
17375
+ } catch (error) {
17376
+ if (error.code !== "EEXIST")
17377
+ throw error;
17378
+ if (Date.now() - lockTime(lock) <= LOCK_STALE_MS)
17379
+ return false;
17380
+ try {
17381
+ unlinkSync(lock);
17382
+ } catch {
17383
+ }
17384
+ }
17385
+ }
17386
+ }, "taken");
17387
+ var holding = /* @__PURE__ */ __name((lock, body) => {
17388
+ try {
17389
+ return body();
17390
+ } finally {
17391
+ try {
17392
+ unlinkSync(lock);
17393
+ } catch {
17394
+ }
17395
+ }
17396
+ }, "holding");
17397
+ var lockTimeout = /* @__PURE__ */ __name((what, waitMs, lock) => new CliError("timeout", `${what} stayed locked for ${waitMs / 1e3}s (${lock})`), "lockTimeout");
17398
+ var lockTime = /* @__PURE__ */ __name((lock) => {
17399
+ try {
17400
+ return statSync(lock).mtimeMs;
17401
+ } catch {
17402
+ return Date.now();
17403
+ }
17404
+ }, "lockTime");
17405
+
17406
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/sends/journal.js
17407
+ var sendsPathFor = /* @__PURE__ */ __name((app, profile, env = process.env) => join2(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "sends", `${profile}.jsonl`), "sendsPathFor");
17408
+ var SendJournal = class {
17409
+ static {
17410
+ __name(this, "SendJournal");
17411
+ }
17412
+ path;
17413
+ resource;
17414
+ constructor(path, resource = { service: "unknown", version: "unknown" }) {
17415
+ this.path = path;
17416
+ this.resource = resource;
17417
+ }
17418
+ /**
17419
+ * Runs `body` with the journal to itself, across processes: two sends at the limit must not both
17420
+ * read "one left". A lock file opened with `wx`, because `flock` is not there on Windows.
17421
+ */
17422
+ locked(body) {
17423
+ return withFileLock(this.path, "the send journal", body);
17424
+ }
17425
+ /** `locked` without blocking the thread while another process holds the journal: what `serve` uses. */
17426
+ lockedAsync(body) {
17427
+ return withFileLockAsync(this.path, "the send journal", body);
17428
+ }
17429
+ append(entry) {
17430
+ const { at, ...attributes } = entry;
17431
+ const { runId, command, traceId } = currentRun();
17432
+ const record2 = logRecordOf({
17433
+ severity: entry.outcome === "sent" || entry.outcome === "reserved" ? "info" : "warn",
17434
+ event: logAttributes({ event: "send.recorded", ...attributes }),
17435
+ time: at,
17436
+ runId,
17437
+ ...traceId === void 0 ? {} : { traceId },
17438
+ command,
17439
+ resource: this.resource,
17440
+ allow: LOG_ATTRIBUTES
17441
+ });
17442
+ mkdirSync3(dirname4(this.path), { recursive: true, mode: 448 });
17443
+ appendFileSync(this.path, `${JSON.stringify(record2)}
17444
+ `, { mode: 384 });
17445
+ }
17446
+ /**
17447
+ * Oldest first, each reservation folded into its outcome; one with no outcome yet is in flight,
17448
+ * or its process died. A line that does not parse is skipped: a torn last write must not block sending.
17449
+ */
17450
+ entries(filter) {
17451
+ const lines3 = this.#lines();
17452
+ const settled = new Set(lines3.filter((entry) => entry.outcome !== "reserved").map((entry) => entry.reservation));
17453
+ const entries = lines3.filter((entry) => entry.outcome !== "reserved" || !settled.has(entry.reservation)).map(({ reservation, ...entry }) => entry.outcome === "reserved" ? { ...entry, reservation } : entry).map(withSendId);
17454
+ return filter === void 0 ? entries : entries.filter((entry) => (filter.outcome === void 0 || entry.outcome === filter.outcome) && (filter.chatId === void 0 || entry.chatId === filter.chatId) && (filter.operationId === void 0 || entry.operationId === filter.operationId) && (filter.errorCode === void 0 || entry.errorCode === filter.errorCode) && (filter.key === void 0 || entry.key === filter.key));
17455
+ }
17456
+ #lines() {
17457
+ let text2;
17458
+ try {
17459
+ text2 = readFileSync2(this.path, "utf8");
17460
+ } catch {
17461
+ return [];
17462
+ }
17463
+ return text2.split("\n").filter((line3) => line3.trim() !== "").flatMap((line3) => {
17464
+ try {
17465
+ return [entryOf(JSON.parse(line3))];
17466
+ } catch {
17467
+ return [];
17468
+ }
17469
+ });
17470
+ }
17471
+ };
17472
+ var entryOf = /* @__PURE__ */ __name((line3) => {
17473
+ if (!("attributes" in line3))
17474
+ return line3;
17475
+ const { event: _, ...attributes } = line3.attributes;
17476
+ return { at: line3.time, ...fromLogAttributes(attributes) };
17477
+ }, "entryOf");
17478
+ var withSendId = /* @__PURE__ */ __name((entry) => {
17479
+ const { cid, ...rest } = entry;
17480
+ return cid === void 0 || rest.sendId !== void 0 ? rest : { ...rest, sendId: String(cid) };
17481
+ }, "withSendId");
17482
+
17483
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/sends/recipients.js
17484
+ import { existsSync, readFileSync as readFileSync3, rmSync } from "node:fs";
17485
+ import { join as join3 } from "node:path";
17486
+ var recipientsPathFor = /* @__PURE__ */ __name((app, profile, env = process.env) => join3(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "profiles", `${profile}.recipients.json`), "recipientsPathFor");
17487
+ var RecipientList = class {
17488
+ static {
17489
+ __name(this, "RecipientList");
17490
+ }
17491
+ path;
17492
+ command;
17493
+ lockWaitMs;
17494
+ /** `command` names the program in the hint that turns the list off. */
17495
+ constructor(path, command, lockWaitMs) {
17496
+ this.path = path;
17497
+ this.command = command;
17498
+ this.lockWaitMs = lockWaitMs;
17499
+ }
17500
+ /** `undefined` when the list is off. A file that cannot be read refuses rather than opening up. */
17501
+ read() {
17502
+ if (!existsSync(this.path))
17503
+ return void 0;
17504
+ try {
17505
+ const parsed = JSON.parse(readFileSync3(this.path, "utf8"));
17506
+ if (!Array.isArray(parsed.chats))
17507
+ throw new Error("no `chats` array");
17508
+ return parsed.chats;
17509
+ } catch (error) {
17510
+ throw new CliError("configuration_error", `the recipient list ${this.path} cannot be read (${error instanceof Error ? error.message : String(error)}) \u2014 fix the file or turn the list off with \`${this.command} recipients clear\``);
17511
+ }
17512
+ }
17513
+ list(filter = {}) {
17514
+ const chats = this.read();
17515
+ return {
17516
+ state: chats === void 0 ? "off" : chats.length === 0 ? "empty" : "on",
17517
+ items: (chats ?? []).filter((chat) => (filter.id === void 0 || chat.id === filter.id) && (filter.title === void 0 || chat.title?.toLocaleLowerCase() === filter.title.toLocaleLowerCase()))
17518
+ };
17519
+ }
17520
+ /** Whether it was new. Adding one again fills in a partner an older entry was stored without. */
17521
+ add(recipient) {
17522
+ return this.#locked(() => this.#added(recipient));
17523
+ }
17524
+ /** `add` waiting for the lock on timers: `recipients add` connects, so it runs inside `serve` when one holds the account. */
17525
+ addAsync(recipient) {
17526
+ return withFileLockAsync(this.path, "the recipient list", () => this.#added(recipient), this.lockWaitMs);
17527
+ }
17528
+ #added(recipient) {
17529
+ const chats = this.read() ?? [];
17530
+ const known2 = chats.find((chat) => chat.id === recipient.id);
17531
+ if (known2) {
17532
+ if (recipient.partnerId && !known2.partnerId) {
17533
+ this.#write(chats.map((chat) => chat === known2 ? { ...known2, partnerId: recipient.partnerId } : chat));
17534
+ }
17535
+ return false;
17536
+ }
17537
+ this.#write([...chats, recipient]);
17538
+ return true;
17539
+ }
17540
+ /** The id or the title as it was stored; `undefined` when neither matched. */
17541
+ remove(reference) {
17542
+ return this.#locked(() => {
17543
+ const chats = this.read() ?? [];
17544
+ const wanted = reference.trim();
17545
+ const gone = chats.find((chat) => chat.id === wanted) ?? chats.find((chat) => chat.title?.toLocaleLowerCase() === wanted.toLocaleLowerCase());
17546
+ if (gone)
17547
+ this.#write(chats.filter((chat) => chat !== gone));
17548
+ return gone;
17549
+ });
17550
+ }
17551
+ /**
17552
+ * The chat the messenger now names `to`: its entry, and a partner of that id, follow it. Only an entry already there
17553
+ * changes, and no list is created, so the list never opens up. Whether anything changed.
17554
+ */
17555
+ async rekey(from, to) {
17556
+ if (from === to)
17557
+ return false;
17558
+ return withFileLockAsync(this.path, "the recipient list", () => {
17559
+ const chats = this.read();
17560
+ if (!chats?.some((chat) => chat.id === from || chat.partnerId === from))
17561
+ return false;
17562
+ const held = chats.some((chat) => chat.id === to);
17563
+ this.#write(chats.filter((chat) => !(held && chat.id === from)).map((chat) => ({
17564
+ ...chat,
17565
+ ...chat.id === from ? { id: to } : {},
17566
+ ...chat.partnerId === from ? { partnerId: to } : {}
17567
+ })));
17568
+ return true;
17569
+ }, this.lockWaitMs);
17570
+ }
17571
+ /** Whether there was a list to turn off. */
17572
+ off() {
17573
+ return this.#locked(() => {
17574
+ if (!existsSync(this.path))
17575
+ return false;
17576
+ rmSync(this.path);
17577
+ return true;
17578
+ });
17579
+ }
17580
+ /**
17581
+ * Every change reads and writes under one lock: a `serve` re-keying while the owner removes a chat must not write
17582
+ * the removed chat back. A lock held too long refuses the change and leaves the list as it was. Blocks the thread
17583
+ * while it waits: for callers that cannot be async, and `recipients remove` and `clear`, which never
17584
+ * connect and so never run inside `serve`.
17585
+ */
17586
+ #locked(body) {
17587
+ return withFileLock(this.path, "the recipient list", body, this.lockWaitMs);
17588
+ }
17589
+ #write(chats) {
17590
+ writeSecurely(this.path, `${JSON.stringify({ chats }, null, 2)}
17591
+ `, 384);
17592
+ }
17593
+ };
17594
+
17595
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/sends/guard.js
17596
+ var HOUR_MS = 60 * 60 * 1e3;
17597
+ var READS_UNDER_HOLD = /* @__PURE__ */ new Set([
17598
+ "attachments.extract",
17599
+ "conversations.embeddings",
17600
+ "conversations.links",
17601
+ "messages.server-search",
17602
+ "messages.sync-first",
17603
+ "stats.contacts.top.sync-first",
17604
+ "stats.messages.counters.sync",
17605
+ "stats.messages.show.sync-first",
17606
+ "stats.messages.top.sync-first",
17607
+ "store.gaps.repair"
17608
+ ]);
17609
+ 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");
17610
+ 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");
17611
+ var timeOf = /* @__PURE__ */ __name((entry) => Date.parse(entry.scheduledFor ?? entry.at), "timeOf");
17612
+ var ceilingRefusal = /* @__PURE__ */ __name((key, command) => new CliError("permission_error", `${key} is not allowed: setup's answer keeps every WireCat tool read-only; the owner changes it at a terminal with \`${command} setup\``, { permission: key }), "ceilingRefusal");
17613
+ var levelRefusal = /* @__PURE__ */ __name((refused, fix = `${refused.command} ${refused.profile} config set permissions.${refused.key} allow`) => refused.named === CEILING_KEY ? ceilingRefusal(refused.key, refused.command) : new CliError("permission_error", `profile ${refused.profile} does not let ${refused.key} write (permissions.${refused.named} is ${refused.level}, from the ${refused.permissionSources[refused.named ?? ""] ?? "default"}); to allow it: ${fix}`, { permission: refused.key }), "levelRefusal");
17614
+ var sendGuard = /* @__PURE__ */ __name(({ profile, recipients, command = recipients.command, readOnlyLock, permissions, permissionSources = {}, permissionDefaults, permissionFix, ask = refuseToAsk, sendsPerHour, journal, flood, warn, now = /* @__PURE__ */ __name(() => /* @__PURE__ */ new Date(), "now") }) => {
17615
+ const currentPermissions = /* @__PURE__ */ __name(() => typeof permissions === "function" ? permissions() : permissions, "currentPermissions");
17616
+ let reservation;
17617
+ const answered = /* @__PURE__ */ new WeakSet();
17618
+ const refuseReadOnly = /* @__PURE__ */ __name(() => {
17619
+ if (readOnlyLock)
17620
+ throw readOnlyRefusal(readOnlyLock, MESSENGER_CHANGE_REFUSAL);
17621
+ }, "refuseReadOnly");
17622
+ const refuseHeld = /* @__PURE__ */ __name(({ key }) => {
17623
+ if (key !== void 0 && READS_UNDER_HOLD.has(key))
17624
+ return;
17625
+ const block = flood?.sendBlock();
17626
+ if (!block)
17627
+ return;
17628
+ throw new CliError("permission_error", `profile ${profile} holds its writes ${holdEnd(block)}: ${block.hint} \u2014 reads still work; do not retry: the owner checks the account with \`${command} ${profile} doctor --online\`, and lifts the hold with \`${command} ${profile} flood clear\` once it is over`, { sendBlock: block, standing: { state: block.state, hint: block.hint } });
17629
+ }, "refuseHeld");
17630
+ const permitted = /* @__PURE__ */ __name((request) => {
17631
+ const { chatId, kind = "message", action: action2, personIds: personIds2 } = request;
17632
+ refuseReadOnly();
17633
+ const levels = currentPermissions();
17634
+ if (levels !== void 0) {
17635
+ const key = request.key ?? keyForWrite(kind, action2);
17636
+ const { level: level2, key: named2 } = levelFor(levels, key, permissionDefaults);
17637
+ if (level2 === "deny" || level2 === "readonly")
17638
+ throw levelRefusal({ profile, command, key, level: level2, named: named2, permissionSources }, permissionFix?.(request, key));
17639
+ if (level2 === "ask" && !answered.has(request)) {
17640
+ throw new CliError("confirmation_required", `${key} asks before it acts, and it was not asked`);
17641
+ }
17642
+ }
17643
+ const allowed = recipients.read();
17644
+ if (chatId !== null && allowed && !allowed.some((chat) => chat.id === chatId)) {
17645
+ throw new CliError("confirmation_required", `chat ${chatId} is not on the recipient list of profile ${profile} \u2014 the owner adds it with \`${command} ${profile} recipients add ${chatId}\``, { chat_id: chatId });
17646
+ }
17647
+ const strangers = allowed ? (personIds2 ?? []).filter((id2) => !allowed.some((chat) => chat.partnerId === id2)) : [];
17648
+ if (strangers.length > 0) {
17649
+ throw new CliError("confirmation_required", `${strangers.join(", ")} ${strangers.length === 1 ? "is" : "are"} not on the recipient list of profile ${profile} \u2014 the owner adds the one-to-one chat with each person (\`${command} ${profile} recipients add <chat>\`); a chat added to the list earlier is added again to be recognised`, { person_ids: strangers });
17650
+ }
17651
+ }, "permitted");
17652
+ const withinLimit = /* @__PURE__ */ __name((request, entries) => {
17653
+ const { chatId, sendId } = request;
17654
+ const asked = { ...request, people: request.personIds?.length ?? request.count };
17655
+ const count4 = weightOf(asked);
17656
+ if (count4 > sendsPerHour) {
17657
+ throw new CliError("rate_limited", `${count4} at once is more than the hourly limit of profile ${profile} (sendsPerHour ${sendsPerHour}) \u2014 do fewer at a time`);
17658
+ }
17659
+ const at = request.scheduledFor ? Date.parse(request.scheduledFor) : now().getTime();
17660
+ const counted2 = entries.filter(countsTowardLimit).filter((entry) => entry.outcome === "sent" || entry.outcome === "outcome_unknown" || entry.outcome === "reserved").filter((entry) => Math.abs(timeOf(entry) - at) < HOUR_MS);
17661
+ const unsure = /* @__PURE__ */ __name((entry) => entry.outcome === "outcome_unknown", "unsure");
17662
+ const same2 = /* @__PURE__ */ __name((a, b) => a.sendId !== void 0 && a.sendId === b.sendId && a.chatId === b.chatId, "same");
17663
+ const last = [...counted2].reverse().find((entry) => same2(entry, { chatId, sendId }));
17664
+ if (sendId !== void 0 && last && unsure(last)) {
17665
+ if (last.sendAs !== request.sendAs) {
17666
+ throw new CliError("validation_error", "this send id was tried under another identity; repeat it with the same --send-as, or it may post twice", { operation_id: sendId, retryable: false });
17667
+ }
17668
+ return false;
17669
+ }
17670
+ const recent = counted2.filter((entry, index) => !(unsure(entry) && counted2.slice(index + 1).some((later) => same2(later, entry)))).map((entry) => ({ time: timeOf(entry), weight: weightOf(entry) })).sort((a, b) => a.time - b.time);
17671
+ const used = recent.reduce((sum2, { weight }) => sum2 + weight, 0);
17672
+ if (used + count4 > sendsPerHour) {
17673
+ let freed = 0;
17674
+ const opening = recent.find(({ weight }) => {
17675
+ freed += weight;
17676
+ return used - freed + count4 <= sendsPerHour;
17677
+ });
17678
+ const nextMs = (opening?.time ?? 0) + HOUR_MS;
17679
+ const next = new Date(nextMs).toISOString();
17680
+ throw new CliError("rate_limited", `profile ${profile} has sent ${used} messages in the hour around ${new Date(at).toISOString()}, and its limit is ${sendsPerHour} (sendsPerHour) \u2014 the next send is possible at ${next}`, { retry_after_ms: nextMs - now().getTime(), retry_at: next });
17681
+ }
17682
+ return true;
17683
+ }, "withinLimit");
17684
+ const counting = /* @__PURE__ */ __name((request) => {
17685
+ permitted(request);
17686
+ refuseHeld(request);
17687
+ const asked = { ...request, people: request.personIds?.length ?? request.count };
17688
+ const creatingTopic = request.kind === "chat" && request.action === "topic-create";
17689
+ if (!countsTowardLimit(asked) && !creatingTopic)
17690
+ return void 0;
17691
+ const checked2 = /* @__PURE__ */ __name((entries) => {
17692
+ if (!creatingTopic)
17693
+ return withinLimit(request, entries);
17694
+ if (request.sendId === void 0)
17695
+ throw new CliError("validation_error", "a topic creation needs an attempt id");
17696
+ if (entries.some((entry) => entry.action === "topic-create" && entry.sendId === request.sendId && ["sent", "outcome_unknown", "reserved"].includes(entry.outcome))) {
17697
+ throw new CliError("validation_error", "this topic creation was already attempted; check topics list and do not repeat an unknown creation", { operation_id: request.sendId, retryable: false });
17698
+ }
17699
+ return true;
17700
+ }, "checked");
17701
+ const reserving = /* @__PURE__ */ __name(() => {
17702
+ if (!checked2(journal.entries()))
17703
+ return;
17704
+ const id2 = randomUUID();
17705
+ const { chatId, kind, action: action2, sendId, operationId, scheduledFor, notify } = request;
17706
+ journal.append({
17707
+ at: now().toISOString(),
17708
+ profile,
17709
+ chatId,
17710
+ outcome: "reserved",
17711
+ reservation: id2,
17712
+ ...kind ? { kind } : {},
17713
+ ...action2 ? { action: action2 } : {},
17714
+ ...asked.people === void 0 ? {} : kind === "delete" || kind === "message" || kind === void 0 ? { count: asked.people } : { people: asked.people },
17715
+ ...sendId === void 0 ? {} : { sendId },
17716
+ ...operationId === void 0 ? {} : { operationId },
17717
+ ...scheduledFor ? { scheduledFor } : {},
17718
+ ...notify === void 0 ? {} : { notify }
17719
+ });
17720
+ reservation = id2;
17721
+ }, "reserving");
17722
+ return { checked: checked2, reserving };
17723
+ }, "counting");
17724
+ return {
17725
+ ask: /* @__PURE__ */ __name(async (request) => {
17726
+ refuseReadOnly();
17727
+ const levels = currentPermissions();
17728
+ if (levels === void 0)
17729
+ return;
17730
+ const key = request.key ?? keyForWrite(request.kind ?? "message", request.action);
17731
+ if (levelFor(levels, key, permissionDefaults).level !== "ask")
17732
+ return;
17733
+ refuseHeld(request);
17734
+ await ask(key, request);
17735
+ answered.add(request);
17736
+ }, "ask"),
17737
+ check: /* @__PURE__ */ __name((request, { reserve = true } = {}) => {
17738
+ const counted2 = counting(request);
17739
+ if (!counted2)
17740
+ return;
17741
+ if (reserve)
17742
+ journal.locked(counted2.reserving);
17743
+ else
17744
+ counted2.checked(journal.entries());
17745
+ }, "check"),
17746
+ reserve: /* @__PURE__ */ __name(async (request) => {
17747
+ const counted2 = counting(request);
17748
+ if (counted2)
17749
+ await journal.lockedAsync(counted2.reserving);
17750
+ }, "reserve"),
17751
+ // After a send, a failure to write here must not become the command's answer: the message is
17752
+ // already with a person, and an error would invite the caller to send it again.
17753
+ record: /* @__PURE__ */ __name((entry) => {
17754
+ const { personIds: _, ...kept2 } = entry;
17755
+ const settles = entry.outcome === "refused" ? void 0 : reservation;
17756
+ reservation = void 0;
17757
+ try {
17758
+ journal.append({ at: now().toISOString(), profile, ...kept2, ...settles ? { reservation: settles } : {} });
17759
+ } catch (error) {
17760
+ warn(`this send is not in the send journal: ${journalFailure(error)}`, {
17761
+ event: "warning",
17762
+ code: "send_not_journaled",
17763
+ operation: "sends.journal"
17764
+ });
17765
+ }
17766
+ }, "record")
17767
+ };
17768
+ }, "sendGuard");
17769
+ var refuseToAsk = /* @__PURE__ */ __name(async (key) => {
17770
+ throw new CliError("confirmation_required", `${key} asks before it acts (its permission level is ask), and nobody is here to answer \u2014 add ${skipFlagFor(key)} to go ahead`);
17771
+ }, "refuseToAsk");
17772
+ var guardFor = /* @__PURE__ */ __name((app, settings, warn, env = process.env, ask) => sendGuard({
17773
+ profile: settings.profile,
17774
+ command: app.command,
17775
+ ...settings.readOnlyLock ? { readOnlyLock: settings.readOnlyLock } : {},
17776
+ permissions: /* @__PURE__ */ __name(() => settings.permissions, "permissions"),
17777
+ permissionSources: settings.permissionSources,
17778
+ ...settings.permissionDefaults ? { permissionDefaults: settings.permissionDefaults } : {},
17779
+ ...ask ? { ask } : {},
17780
+ sendsPerHour: settings.sendsPerHour,
17781
+ journal: new SendJournal(sendsPathFor(app, settings.profile, env), { service: app.command, version: app.version }),
17782
+ recipients: new RecipientList(recipientsPathFor(app, settings.profile, env), app.command),
17783
+ flood: new FloodMemory(floodPathFor(app, settings.profile, env)),
17784
+ warn
17785
+ }), "guardFor");
17786
+ var journalFailure = /* @__PURE__ */ __name((error) => error?.code ?? (error instanceof Error ? error.name : "error"), "journalFailure");
17787
+
17788
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/cli/messenger/lacks.js
17228
17789
  var COMMAND_NEEDS = {
17229
17790
  "account update": ["updateProfile", "change the profile"],
17230
17791
  "account sessions list": ["sessions", "list the account's sessions"],
@@ -17274,7 +17835,7 @@ var hideNever = /* @__PURE__ */ __name((messenger, group) => {
17274
17835
  return group;
17275
17836
  }, "hideNever");
17276
17837
 
17277
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/members-audit.js
17838
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/members-audit.js
17278
17839
  var AUDIT_PAGE = 200;
17279
17840
  var AUDIT_BUDGET = 10;
17280
17841
  var AUDIT_PAUSE_MS = 1e3;
@@ -17354,7 +17915,7 @@ var burstJoins = /* @__PURE__ */ __name((members) => {
17354
17915
  return found;
17355
17916
  }, "burstJoins");
17356
17917
 
17357
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/cli/query-options.js
17918
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/cli/query-options.js
17358
17919
  var queryWordsAfterOptions = /* @__PURE__ */ __name((command) => {
17359
17920
  command.allowUnknownOption();
17360
17921
  const parse2 = command.parseOptions.bind(command);
@@ -17374,7 +17935,7 @@ var queryWordsAfterOptions = /* @__PURE__ */ __name((command) => {
17374
17935
  return command;
17375
17936
  }, "queryWordsAfterOptions");
17376
17937
 
17377
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/cli/passage.js
17938
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/cli/passage.js
17378
17939
  var count = /* @__PURE__ */ __name((value) => {
17379
17940
  if (!/^(0|[1-9]\d*)$/.test(value) || !Number.isSafeInteger(Number(value)))
17380
17941
  throw new CliError("validation_error", "expected a nonnegative safe integer");
@@ -17416,7 +17977,7 @@ var addMeetingPassageCommandDefinition = /* @__PURE__ */ __name((program, deps)
17416
17977
  var createMeetingPassageCommand = sharedCommand(createMeetingPassageCommandDefinition);
17417
17978
  var addMeetingPassageCommand = sharedCommand(addMeetingPassageCommandDefinition);
17418
17979
 
17419
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/cli/project-evidence.js
17980
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/cli/project-evidence.js
17420
17981
  var integer2 = /* @__PURE__ */ __name((value) => {
17421
17982
  if (!/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
17422
17983
  throw new CliError("validation_error", "expected a positive safe integer");
@@ -17439,7 +18000,7 @@ ${fieldsHelp(MEETING_PROJECT_EVIDENCE_QUERY)}`).option("--limit <n>", "hits in o
17439
18000
  }, "addMeetingProjectEvidenceCommandDefinition");
17440
18001
  var addMeetingProjectEvidenceCommand = sharedCommand(addMeetingProjectEvidenceCommandDefinition);
17441
18002
 
17442
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/cli/search.js
18003
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/cli/search.js
17443
18004
  var ZONED = /(?:Z|[+-]\d{2}:?\d{2})$/i;
17444
18005
  var moment = /* @__PURE__ */ __name((flag, end, readIn) => (value) => {
17445
18006
  const zone = timezoneOf();
@@ -17525,7 +18086,7 @@ var addMeetingSearchCommandDefinition = /* @__PURE__ */ __name((program, deps) =
17525
18086
  var createMeetingSearchCommand = sharedCommand(createMeetingSearchCommandDefinition);
17526
18087
  var addMeetingSearchCommand = sharedCommand(addMeetingSearchCommandDefinition);
17527
18088
 
17528
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/meetings/cli/index.js
18089
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/meetings/cli/index.js
17529
18090
  var integer4 = /* @__PURE__ */ __name((text2) => {
17530
18091
  if (!/^[1-9]\d*$/.test(text2) || !Number.isSafeInteger(Number(text2)))
17531
18092
  throw new InvalidArgumentError("expected a positive integer");
@@ -17669,7 +18230,7 @@ ${fieldsHelp(EVENT_QUERY, MEETING_QUERY_GUIDE)}`);
17669
18230
  }, "addMeetingCommandsDefinition");
17670
18231
  var addMeetingCommands = sharedCommand(addMeetingCommandsDefinition);
17671
18232
 
17672
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/list-query.js
18233
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/cli/list-query.js
17673
18234
  var LIST_QUERY_GUIDE = "https://github.com/WireCatLabs/cli-core/blob/main/docs/search/query-language.md";
17674
18235
  var QUERY_ARGUMENT = "field:value terms that narrow the list \u2014 the fields are below";
17675
18236
  var withQuery = /* @__PURE__ */ __name((command, registry) => {
@@ -17802,7 +18363,7 @@ var termField = /* @__PURE__ */ __name((name, type, example, more = {}) => nativ
17802
18363
  var queryHelp = /* @__PURE__ */ __name((registry) => `
17803
18364
  ${fieldsHelp(registry, LIST_QUERY_GUIDE)}`, "queryHelp");
17804
18365
 
17805
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/paging.js
18366
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/cli/paging.js
17806
18367
  var positiveCount = /* @__PURE__ */ __name((flag) => (value) => {
17807
18368
  if (!/^\d+$/.test(value.trim()) || Number(value) < 1)
17808
18369
  throw new CliError("validation_error", `${flag} takes a whole number from 1 upwards, not "${value}"`);
@@ -17811,7 +18372,7 @@ var positiveCount = /* @__PURE__ */ __name((flag) => (value) => {
17811
18372
  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");
17812
18373
  var window = /* @__PURE__ */ __name(({ limit, page, all }) => all ? { offset: 0 } : { limit, offset: (page - 1) * limit }, "window");
17813
18374
 
17814
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/messenger/chat-answers.js
18375
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/cli/messenger/chat-answers.js
17815
18376
  var defined = /* @__PURE__ */ __name((record2) => Object.fromEntries(Object.entries(record2).filter(([, value]) => value !== void 0)), "defined");
17816
18377
  var chatRef = /* @__PURE__ */ __name((account, chat) => formatReference({ type: "chat", provider: account.provider, account: account.account, chat }), "chatRef");
17817
18378
  var settingsOf = /* @__PURE__ */ __name((settings) => defined({
@@ -18073,7 +18634,7 @@ var sessionAnswer = /* @__PURE__ */ __name(({ current, client, device, location,
18073
18634
  ...createdAt === void 0 ? {} : { created_at: createdAt }
18074
18635
  }), "sessionAnswer");
18075
18636
 
18076
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/ports/messenger.js
18637
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/ports/messenger.js
18077
18638
  var throughWrapper = /* @__PURE__ */ __name((inner, handled, wrap = (_, call) => call) => new Proxy(handled, {
18078
18639
  get: /* @__PURE__ */ __name((own, key) => {
18079
18640
  if (key in own)
@@ -18090,7 +18651,7 @@ var capability = /* @__PURE__ */ __name((adapter, method, what) => {
18090
18651
  return found.bind(adapter);
18091
18652
  }, "capability");
18092
18653
 
18093
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/domain/ref-arguments.js
18654
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/domain/ref-arguments.js
18094
18655
  var TAKES = {
18095
18656
  chat: "a chat: chat:<provider>/<account>/<chat>, its id or its title",
18096
18657
  message: "a message: msg:<provider>/<account>/<chat>/<message>, or a chat and the message's id"
@@ -18143,14 +18704,14 @@ var wrongAccount = /* @__PURE__ */ __name((reference, scope, profiles) => {
18143
18704
  const others = profiles === void 0 ? "" : `. Profiles signed in to ${reference.account}: ${profiles.length > 0 ? profiles.join(", ") : "none here"}`;
18144
18705
  return new CliError("validation_error", `${reference.text} belongs to account ${reference.account}; ${here}${others}`, { reason: "ref.wrong-account" });
18145
18706
  }, "wrongAccount");
18146
- var ensureAccount = /* @__PURE__ */ __name(async (reference, scope, profilesOn) => {
18707
+ var ensureAccount = /* @__PURE__ */ __name(async (reference, scope, profilesOn2) => {
18147
18708
  if (scope.account !== void 0 && scope.account === reference.account)
18148
18709
  return;
18149
- const profiles = await profilesOn?.(reference.account).catch(() => void 0);
18710
+ const profiles = await profilesOn2?.(reference.account).catch(() => void 0);
18150
18711
  throw wrongAccount(reference, scope, profiles);
18151
18712
  }, "ensureAccount");
18152
18713
 
18153
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/resolve.js
18714
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/resolve.js
18154
18715
  var isId = /* @__PURE__ */ __name((reference) => /^-?\d+$/.test(reference.trim()), "isId");
18155
18716
  var foldName = /* @__PURE__ */ __name((name) => name.normalize("NFC").replace(/[\uFE0E\uFE0F\u200D]/g, "").toLowerCase().replaceAll("\u0451", "\u0435"), "foldName");
18156
18717
  var pickChat = /* @__PURE__ */ __name((reference, chats) => {
@@ -18195,7 +18756,7 @@ ${lines3}`, { candidates });
18195
18756
  }, "ambiguous");
18196
18757
  var isPresent = /* @__PURE__ */ __name((value) => value !== null && value !== void 0, "isPresent");
18197
18758
 
18198
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/deps.js
18759
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/deps.js
18199
18760
  var accountStore = /* @__PURE__ */ __name(async (deps) => (await deps.store()).forAccount(await deps.account()), "accountStore");
18200
18761
  var crossAccount = /* @__PURE__ */ __name((deps, _reason) => deps.store(), "crossAccount");
18201
18762
  var NO_LOCAL_STORE = "this answer comes from the messenger, not from the local store";
@@ -18257,7 +18818,7 @@ var storedDeps = /* @__PURE__ */ __name((messenger, store, account, guard) => ({
18257
18818
  }), "storedDeps");
18258
18819
  var storeModeDeps = /* @__PURE__ */ __name((messenger, store, account, guard) => ({ ...storedDeps(messenger, store, account, guard), offline: false, reads: "store" }), "storeModeDeps");
18259
18820
 
18260
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/patience.js
18821
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/patience.js
18261
18822
  import { setTimeout as sleep } from "node:timers/promises";
18262
18823
  var LONGEST_WAIT_MS = 5 * 60 * 1e3;
18263
18824
  var patiently = /* @__PURE__ */ __name(async (request, note, stop) => {
@@ -18280,10 +18841,10 @@ var patiently = /* @__PURE__ */ __name(async (request, note, stop) => {
18280
18841
  }
18281
18842
  }, "patiently");
18282
18843
 
18283
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/archive.js
18844
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/archive.js
18284
18845
  import { setTimeout as sleep2 } from "node:timers/promises";
18285
18846
 
18286
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/backfill-estimate.js
18847
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/backfill-estimate.js
18287
18848
  var REQUEST_MS = 400;
18288
18849
  var estimateBackfill = /* @__PURE__ */ __name(({ ranges, held, newest, page, maxPages, pauseMs }) => {
18289
18850
  const lowest = ranges[0];
@@ -18306,13 +18867,13 @@ var estimateBackfill = /* @__PURE__ */ __name(({ ranges, held, newest, page, max
18306
18867
  };
18307
18868
  }, "estimateBackfill");
18308
18869
 
18309
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/domain/recovery.js
18870
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/domain/recovery.js
18310
18871
  var withRecovery = /* @__PURE__ */ __name((error) => ({
18311
18872
  ...error,
18312
18873
  retryable: typeof error.retryable === "boolean" ? error.retryable : error.code === "rate_limited" || error.status === 429
18313
18874
  }), "withRecovery");
18314
18875
 
18315
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/batch.js
18876
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/batch.js
18316
18877
  var actionable = /* @__PURE__ */ __name((error) => {
18317
18878
  if (isCliFailure(error))
18318
18879
  return withRecovery({ code: error.code, message: error.message, ...error.details });
@@ -18395,7 +18956,7 @@ var mergeBatches = /* @__PURE__ */ __name((a, b) => {
18395
18956
  };
18396
18957
  }, "mergeBatches");
18397
18958
 
18398
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/message-resolution.js
18959
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/message-resolution.js
18399
18960
  var readChatId = /* @__PURE__ */ __name(async (deps, reference, store, account) => {
18400
18961
  if (deps.reads !== "store")
18401
18962
  return keptChatId(deps.messenger, reference, store, account);
@@ -18414,12 +18975,12 @@ var readChatId = /* @__PURE__ */ __name(async (deps, reference, store, account)
18414
18975
  var LEFT_EMPTY = "you left this chat, and the store holds none of its messages";
18415
18976
  var storedChatId = /* @__PURE__ */ __name((messenger, reference, store, account, { includeLeft = false } = {}) => {
18416
18977
  const renamed2 = /* @__PURE__ */ __name((id2) => store.chats.renamedChatId(account, id2), "renamed");
18417
- const profilesOn = profilesOnAccount(store, messenger.app?.command, account.provider);
18978
+ const profilesOn2 = profilesOnAccount(store, messenger.app?.command, account.provider);
18418
18979
  const among = chatIdAmong(messenger, reference, account, {
18419
18980
  held: /* @__PURE__ */ __name(() => store.chats.chats(account, {}), "held"),
18420
18981
  renamed: renamed2,
18421
18982
  left: /* @__PURE__ */ __name(async (id2) => leftIn(await store.chats.chats(account, byId(id2))), "left"),
18422
- profilesOn
18983
+ profilesOn: profilesOn2
18423
18984
  });
18424
18985
  if (!includeLeft)
18425
18986
  return among;
@@ -18429,7 +18990,7 @@ var storedChatId = /* @__PURE__ */ __name((messenger, reference, store, account,
18429
18990
  return chatIdAmong(messenger, reference, account, {
18430
18991
  held: /* @__PURE__ */ __name(() => store.chats.chats(account, { includeLeft: true }), "held"),
18431
18992
  renamed: renamed2,
18432
- profilesOn
18993
+ profilesOn: profilesOn2
18433
18994
  });
18434
18995
  });
18435
18996
  }, "storedChatId");
@@ -18461,16 +19022,16 @@ var leftIn = /* @__PURE__ */ __name(({ items }) => items.some((one) => one.membe
18461
19022
  var profilesOnAccount = /* @__PURE__ */ __name((store, app, provider) => async (account) => {
18462
19023
  if (app === void 0)
18463
19024
  return void 0;
18464
- return Object.entries((await store.accounts.profiles())[app] ?? {}).filter(([, key]) => key.provider === provider && key.account === account).map(([name]) => name);
19025
+ return profilesOn(await store.accounts.profiles(), app, { provider, account });
18465
19026
  }, "profilesOnAccount");
18466
- var chatIdAmong = /* @__PURE__ */ __name(async (messenger, reference, account, { held, renamed: renamed2, left, profilesOn }) => {
19027
+ var chatIdAmong = /* @__PURE__ */ __name(async (messenger, reference, account, { held, renamed: renamed2, left, profilesOn: profilesOn2 }) => {
18467
19028
  const trimmed = reference.trim();
18468
19029
  if (messenger.savedChatId && ["me", "self", "saved"].includes(trimmed.toLowerCase())) {
18469
19030
  return messenger.savedChatId(account);
18470
19031
  }
18471
19032
  const named2 = chatReferenceOf(trimmed, account.provider);
18472
19033
  if (named2)
18473
- await ensureAccount(named2, { account: account.account }, profilesOn);
19034
+ await ensureAccount(named2, { account: account.account }, profilesOn2);
18474
19035
  if (named2 || /^-?\d+$/.test(trimmed)) {
18475
19036
  const typed = named2?.chat ?? trimmed;
18476
19037
  const id2 = await renamed2(typed) ?? typed;
@@ -18554,7 +19115,7 @@ var senderAmong = /* @__PURE__ */ __name(async (store, accounts, reference) => {
18554
19115
  }
18555
19116
  }, "senderAmong");
18556
19117
 
18557
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/images/context/index.js
19118
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/images/context/index.js
18558
19119
  var CONTEXT_MESSAGES = 3;
18559
19120
  var CONTEXT_MINUTES = 10;
18560
19121
  var MAX_CHARS = 1200;
@@ -18578,12 +19139,12 @@ var context = {
18578
19139
  }, "describe")
18579
19140
  };
18580
19141
 
18581
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/images/registry.js
19142
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/images/registry.js
18582
19143
  var BUILT_INS = [context];
18583
19144
  var providers = [...BUILT_INS];
18584
19145
  var registeredImageProviders = /* @__PURE__ */ __name(() => providers, "registeredImageProviders");
18585
19146
 
18586
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/conversations.js
19147
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/conversations.js
18587
19148
  var READ_PAGE = 5e3;
18588
19149
  var CHAIN = 50;
18589
19150
  var CONVERSATION_QUERY = {
@@ -18735,7 +19296,7 @@ var sized = /* @__PURE__ */ __name((size2) => {
18735
19296
  return size2;
18736
19297
  }, "sized");
18737
19298
 
18738
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/embeddings-maintenance.js
19299
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/embeddings-maintenance.js
18739
19300
  var REFRESH_BOUNDS = { maxChats: 20, maxChunks: 2e3 };
18740
19301
  var MESSAGE_PAGE = 5e3;
18741
19302
  var PER_SESSION = 8;
@@ -18754,7 +19315,7 @@ var embeddingTarget = /* @__PURE__ */ __name((deps, choice = chosenTextModel(dep
18754
19315
  price: remote.price,
18755
19316
  installed: true,
18756
19317
  perBatch: PER_REQUEST * concurrency,
18757
- open: /* @__PURE__ */ __name(async () => (await import("./remote-MWDYQWFW.js")).openRemote(remote, apiKey, { concurrency }), "open")
19318
+ open: /* @__PURE__ */ __name(async () => (await import("./remote-A3W5HE52.js")).openRemote(remote, apiKey, { concurrency }), "open")
18758
19319
  };
18759
19320
  }
18760
19321
  const model = textModel(choice, deps.env);
@@ -18771,7 +19332,7 @@ var embeddingTarget = /* @__PURE__ */ __name((deps, choice = chosenTextModel(dep
18771
19332
  if (!isTextModelInstalled(model, directory2))
18772
19333
  throw notDownloaded(model.id);
18773
19334
  if (apart) {
18774
- const { openProcess } = await import("./process-DCYX5EDG.js");
19335
+ const { openProcess } = await import("./process-4A5JP5LO.js");
18775
19336
  return openProcess(model, directory2, { threads: threads ?? defaultThreads() });
18776
19337
  }
18777
19338
  return openEmbedder(model, directory2, { threads: threads ?? defaultThreads() });
@@ -19060,7 +19621,7 @@ var shaped = /* @__PURE__ */ __name(({ chatId, builtAt, algorithmVersion, pendin
19060
19621
  return { ...one, state };
19061
19622
  }, "shaped");
19062
19623
 
19063
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/search-catchup.js
19624
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/search-catchup.js
19064
19625
  var CATCH_UP_BOUNDS = { maxChunks: 500, maxMessages: 1e4, timeMs: 3e4 };
19065
19626
  var validateCatchUpBounds = /* @__PURE__ */ __name((options2) => {
19066
19627
  for (const [key, value, maximum] of [
@@ -19113,7 +19674,7 @@ var catchUpSearch = /* @__PURE__ */ __name(async (deps, chat, options2, signal,
19113
19674
  }
19114
19675
  }, "catchUpSearch");
19115
19676
 
19116
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/archive.js
19677
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/archive.js
19117
19678
  var pushed = /* @__PURE__ */ __name((deps, what) => {
19118
19679
  if (deps.reads === "store") {
19119
19680
  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`);
@@ -19121,7 +19682,7 @@ var pushed = /* @__PURE__ */ __name((deps, what) => {
19121
19682
  }, "pushed");
19122
19683
  var PAGE = 100;
19123
19684
  var FETCHING = { page: PAGE, maxPageSize: PAGE, pause: "1s", maxPages: 10, orderBy: "id" };
19124
- var keyOf = /* @__PURE__ */ __name((fetching = FETCHING) => (message) => fetching.orderBy === "time" ? Date.parse(message.timestamp) : Number(message.id), "keyOf");
19685
+ var keyOf2 = /* @__PURE__ */ __name((fetching = FETCHING) => (message) => fetching.orderBy === "time" ? Date.parse(message.timestamp) : Number(message.id), "keyOf");
19125
19686
  var done = /* @__PURE__ */ __name((one) => one.complete && !one.error && !one.stopped, "done");
19126
19687
  var archiveService = /* @__PURE__ */ __name((deps) => {
19127
19688
  const found = /* @__PURE__ */ __name(async (chat) => {
@@ -19240,17 +19801,21 @@ var archiveService = /* @__PURE__ */ __name((deps) => {
19240
19801
  pushed(deps, "`messages sync --all`");
19241
19802
  const connection = await deps.connection();
19242
19803
  const list3 = capability(connection, "chats", "list its chats");
19243
- const chats = [];
19804
+ const listed2 = [];
19244
19805
  for (let offset = 0; ; ) {
19245
19806
  const page = await patiently(() => list3({ offset, limit: 100 }), options2.note, options2.stop);
19246
- chats.push(...page.items);
19807
+ listed2.push(...page.items);
19247
19808
  offset += page.items.length;
19248
19809
  if (!page.hasMore || page.items.length === 0)
19249
19810
  break;
19250
19811
  }
19251
- chats.sort((one, other) => (other.lastMessageAt ?? "").localeCompare(one.lastMessageAt ?? ""));
19812
+ listed2.sort((one, other) => (other.lastMessageAt ?? "").localeCompare(one.lastMessageAt ?? ""));
19813
+ const muted = await mutedSkips(deps, listed2, options2.withMuted ?? deps.historyMuted ?? false);
19814
+ const chats = listed2.filter((chat) => !muted.has(chat.id));
19252
19815
  const own = archiveService({ ...deps, withConnection: void 0, connection: /* @__PURE__ */ __name(async () => connection, "connection") });
19253
19816
  const answer = { chats: chats.length, fetched: 0, complete: false, items: [] };
19817
+ if (muted.size > 0)
19818
+ answer.limited = { groupTooLarge: 0, olderThanWindow: 0, muted: muted.size };
19254
19819
  const batch = batchProgress(deps.env);
19255
19820
  const catchingUp = Boolean(options2.catchUp ?? deps.searchCatchUp);
19256
19821
  const upToDate = heldToNewest(await deps.store(), await deps.account(), deps.messenger.fetching ?? FETCHING, {
@@ -19313,6 +19878,17 @@ var archiveService = /* @__PURE__ */ __name((deps) => {
19313
19878
  }, "fetchAll")
19314
19879
  };
19315
19880
  }, "archiveService");
19881
+ var mutedNow = /* @__PURE__ */ __name((chat, now) => chat.muted === true && (chat.mutedUntil == null || Date.parse(chat.mutedUntil) > now), "mutedNow");
19882
+ var mutedSkips = /* @__PURE__ */ __name(async (deps, chats, readMuted) => {
19883
+ if (readMuted)
19884
+ return /* @__PURE__ */ new Set();
19885
+ const now = Date.now();
19886
+ const muted = chats.filter((chat) => mutedNow(chat, now)).map((chat) => chat.id);
19887
+ if (muted.length === 0)
19888
+ return /* @__PURE__ */ new Set();
19889
+ const shapes = await (await deps.store()).chats.historyShapes(await deps.account(), muted);
19890
+ return new Set(muted.filter((id2) => shapes.get(id2)?.included !== true));
19891
+ }, "mutedSkips");
19316
19892
  var limitOf = /* @__PURE__ */ __name(async (deps, store, account, chat, options2) => {
19317
19893
  if (!deps.historyLimits || options2.fullHistory)
19318
19894
  return void 0;
@@ -19350,7 +19926,7 @@ var fetchInto = /* @__PURE__ */ __name(async ({ history, store, account, fetchin
19350
19926
  if (window3 && (!Number.isSafeInteger(window3.from) || !Number.isSafeInteger(window3.to + 1) || window3.from > window3.to))
19351
19927
  throw new CliError("validation_error", "invalid history window");
19352
19928
  const byTime = fetching.orderBy === "time";
19353
- const keyed = keyOf(fetching);
19929
+ const keyed = keyOf2(fetching);
19354
19930
  let before2 = window3 === void 0 ? void 0 : byTime ? new Date(window3.to + (fetching.beforeInclusive ? 0 : 1)).toISOString() : String(window3.to + 1);
19355
19931
  let requests = 0;
19356
19932
  let windowComplete = false;
@@ -19462,7 +20038,7 @@ var heldToNewest = /* @__PURE__ */ __name((store, account, fetching, options2) =
19462
20038
  return false;
19463
20039
  const ranges = await store.sync.ranges(account, chat.id);
19464
20040
  const top = ranges.reduce((best, range2) => best && best.to >= range2.to ? best : range2, void 0);
19465
- const key = keyOf(fetching)(newest);
20041
+ const key = keyOf2(fetching)(newest);
19466
20042
  if (!top || key > top.to || key < top.from)
19467
20043
  return false;
19468
20044
  if (ranges.length === 1 && await store.sync.syncState(account, historyStartKey(chat.id)) !== void 0)
@@ -19479,7 +20055,7 @@ var timeOfKey = /* @__PURE__ */ __name(async (store, account, chatId, key, byTim
19479
20055
  return message?.timestamp ?? fallback;
19480
20056
  }, "timeOfKey");
19481
20057
 
19482
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/questions.js
20058
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/questions.js
19483
20059
  var LINKS = /https?:\/\/\S+/g;
19484
20060
  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");
19485
20061
  var questions = /* @__PURE__ */ __name((messages, { answerers: answerers2, asker = "others" }) => {
@@ -19509,7 +20085,7 @@ var questions = /* @__PURE__ */ __name((messages, { answerers: answerers2, asker
19509
20085
  });
19510
20086
  }, "questions");
19511
20087
 
19512
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/task-categories.js
20088
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/task-categories.js
19513
20089
  var names = /* @__PURE__ */ __name((categories) => categories.map(({ name }) => name).join(", "), "names");
19514
20090
  var taskCategoryOf = /* @__PURE__ */ __name((categories = DEFAULT_TASK_CATEGORIES, flag = "--category") => (typed) => {
19515
20091
  const name = typed.trim().toLowerCase();
@@ -19566,7 +20142,7 @@ var categorize = /* @__PURE__ */ __name((text2, categories = DEFAULT_TASK_CATEGO
19566
20142
  return best.name;
19567
20143
  }, "categorize");
19568
20144
 
19569
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/task-rules.js
20145
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/task-rules.js
19570
20146
  var taskAccount = /* @__PURE__ */ __name(({ provider, account }) => `${provider}:${account}`, "taskAccount");
19571
20147
  var RULES_IN = {
19572
20148
  dialog: "all",
@@ -19591,10 +20167,10 @@ var applyTaskRules = /* @__PURE__ */ __name(async (review, { store, account, now
19591
20167
  const tasks = createTaskService({ store, ...now ? { now } : {} });
19592
20168
  const owner = taskAccount(account);
19593
20169
  const result = { added: 0, closed: 0, review: 0 };
19594
- const sourceOf2 = /* @__PURE__ */ __name((message) => formatLocator({ provider: account.provider, account: account.account, chat: message.chatId, message: message.id }), "sourceOf");
20170
+ const sourceOf3 = /* @__PURE__ */ __name((message) => formatLocator({ provider: account.provider, account: account.account, chat: message.chatId, message: message.id }), "sourceOf");
19595
20171
  const open7 = /* @__PURE__ */ __name(async (message, group, kind) => {
19596
20172
  const { created, review: review2 = 0 } = await tasks.add({
19597
- source: sourceOf2(message),
20173
+ source: sourceOf3(message),
19598
20174
  sourceKind: "message",
19599
20175
  account: owner,
19600
20176
  group,
@@ -19607,7 +20183,7 @@ var applyTaskRules = /* @__PURE__ */ __name(async (review, { store, account, now
19607
20183
  result.review += review2;
19608
20184
  }, "open");
19609
20185
  const close = /* @__PURE__ */ __name(async (message, kind, answer) => {
19610
- for (const task2 of await store.findBySource(owner, sourceOf2(message))) {
20186
+ for (const task2 of await store.findBySource(owner, sourceOf3(message))) {
19611
20187
  if (task2.kind !== kind || isClosedState(task2.state))
19612
20188
  continue;
19613
20189
  result.closed += 1;
@@ -19617,11 +20193,11 @@ var applyTaskRules = /* @__PURE__ */ __name(async (review, { store, account, now
19617
20193
  if (answer)
19618
20194
  await store.answer(task2.id, {
19619
20195
  resolution: answer.outgoing ? "answered by the owner" : "answered in the group",
19620
- by: sourceOf2(answer)
20196
+ by: sourceOf3(answer)
19621
20197
  });
19622
20198
  }
19623
20199
  }, "close");
19624
- const hasTask = /* @__PURE__ */ __name(async (message) => (await store.findBySource(owner, sourceOf2(message))).length > 0, "hasTask");
20200
+ const hasTask = /* @__PURE__ */ __name(async (message) => (await store.findBySource(owner, sourceOf3(message))).length > 0, "hasTask");
19625
20201
  for (const chat of review.chats) {
19626
20202
  const scope = scopeOf(chat.kind, chat.watched === true);
19627
20203
  if (scope === "none")
@@ -19652,7 +20228,7 @@ var applyTaskRules = /* @__PURE__ */ __name(async (review, { store, account, now
19652
20228
  await open7(message, chat.id, kind);
19653
20229
  else if (!await hasTask(message)) {
19654
20230
  held += 1;
19655
- onHeld?.({ source: sourceOf2(message), kind, category: categorize(message.text, categories) });
20231
+ onHeld?.({ source: sourceOf3(message), kind, category: categorize(message.text, categories) });
19656
20232
  }
19657
20233
  }
19658
20234
  if (held > 0) {
@@ -19772,11 +20348,11 @@ var applyTaskRulesToChats = /* @__PURE__ */ __name(async (store, account, chatId
19772
20348
  return passes;
19773
20349
  }, "applyTaskRulesToChats");
19774
20350
 
19775
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/domain/vcard.js
20351
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/domain/vcard.js
19776
20352
  var AS_WORD = new RegExp(`^${WORD_BODY}$`);
19777
20353
  var encoder = new TextEncoder();
19778
20354
 
19779
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/moment.js
20355
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/moment.js
19780
20356
  var AGO = /^(\d+)(m|h|d)$/;
19781
20357
  var AGO_MS = { m: 6e4, h: 36e5, d: 864e5 };
19782
20358
  var DATE = /^\d{4}-\d{2}-\d{2}/;
@@ -19816,7 +20392,7 @@ var dateWindow = /* @__PURE__ */ __name(({ sinceTime, untilTime, zone, now = Dat
19816
20392
  };
19817
20393
  }, "dateWindow");
19818
20394
 
19819
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/botcheck/check.js
20395
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/botcheck/check.js
19820
20396
  var DAY_MS = 864e5;
19821
20397
  var NEW_DAYS = 30;
19822
20398
  var SAME_TEXT_MIN = 20;
@@ -19893,7 +20469,7 @@ var scorePerson = /* @__PURE__ */ __name(({ subject, provider, activity, photos,
19893
20469
  };
19894
20470
  }, "scorePerson");
19895
20471
 
19896
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/http/time-limit.js
20472
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/http/time-limit.js
19897
20473
  var timeLimit = /* @__PURE__ */ __name((ms) => {
19898
20474
  const controller = new AbortController();
19899
20475
  const timer = setTimeout(() => controller.abort(new DOMException("The operation timed out.", "TimeoutError")), ms);
@@ -19909,7 +20485,7 @@ var withTimeLimit = /* @__PURE__ */ __name(async (ms, run) => {
19909
20485
  }
19910
20486
  }, "withTimeLimit");
19911
20487
 
19912
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/botcheck/registries.js
20488
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/botcheck/registries.js
19913
20489
  var REGISTRIES = {
19914
20490
  cas: { title: "Combot Anti-Spam (CAS)", docs: "https://cas.chat/api" },
19915
20491
  lols: { title: "lols.bot", docs: "https://api.lols.bot/lols-bot.json" }
@@ -19996,7 +20572,7 @@ var notCovered = /* @__PURE__ */ __name((messenger, now = /* @__PURE__ */ new Da
19996
20572
  detail: `lists Telegram accounts only, not ${messenger} ones`
19997
20573
  })), "notCovered");
19998
20574
 
19999
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/botcheck/service.js
20575
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/botcheck/service.js
20000
20576
  var ACTIVITY_MESSAGES = 1e3;
20001
20577
  var botCheckService = /* @__PURE__ */ __name((deps) => {
20002
20578
  const subjectOf = /* @__PURE__ */ __name(async (reference) => {
@@ -20084,7 +20660,7 @@ var botCheckService = /* @__PURE__ */ __name((deps) => {
20084
20660
  };
20085
20661
  }, "botCheckService");
20086
20662
 
20087
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/domain/thread.js
20663
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/domain/thread.js
20088
20664
  var threadIdOf = /* @__PURE__ */ __name((value) => {
20089
20665
  if (value === void 0)
20090
20666
  return void 0;
@@ -20094,7 +20670,7 @@ var threadIdOf = /* @__PURE__ */ __name((value) => {
20094
20670
  return id2;
20095
20671
  }, "threadIdOf");
20096
20672
 
20097
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/chat-stats.js
20673
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/chat-stats.js
20098
20674
  var TOP_POSTS = 5;
20099
20675
  var JOINS = /* @__PURE__ */ new Set(["join", "add"]);
20100
20676
  var LEAVES = /* @__PURE__ */ new Set(["leave", "remove"]);
@@ -20172,7 +20748,7 @@ var membersOf = /* @__PURE__ */ __name(({ events, more }, messages, since) => {
20172
20748
  }, "membersOf");
20173
20749
  var seriesOf = /* @__PURE__ */ __name((messages, events, by, timezone) => {
20174
20750
  const dayOf = calendarKey(timezone, "day");
20175
- const keyOf6 = /* @__PURE__ */ __name((timestamp) => {
20751
+ const keyOf8 = /* @__PURE__ */ __name((timestamp) => {
20176
20752
  const day2 = dayOf(Date.parse(timestamp));
20177
20753
  if (by === "day")
20178
20754
  return day2;
@@ -20187,12 +20763,12 @@ var seriesOf = /* @__PURE__ */ __name((messages, events, by, timezone) => {
20187
20763
  return found;
20188
20764
  }, "row");
20189
20765
  for (const one of messages)
20190
- row(keyOf6(one.timestamp)).messages.push(one);
20766
+ row(keyOf8(one.timestamp)).messages.push(one);
20191
20767
  for (const { timestamp, event, people } of events?.events ?? []) {
20192
20768
  if (JOINS.has(event))
20193
- row(keyOf6(timestamp)).joined += people.length;
20769
+ row(keyOf8(timestamp)).joined += people.length;
20194
20770
  if (LEAVES.has(event))
20195
- row(keyOf6(timestamp)).left += people.length;
20771
+ row(keyOf8(timestamp)).left += people.length;
20196
20772
  }
20197
20773
  return [...rows.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([key, found]) => ({
20198
20774
  key,
@@ -20211,7 +20787,7 @@ var median = /* @__PURE__ */ __name((values) => {
20211
20787
  return Math.round(sorted.length % 2 === 0 ? ((sorted[middle - 1] ?? upper) + upper) / 2 : upper);
20212
20788
  }, "median");
20213
20789
 
20214
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/member-history.js
20790
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/member-history.js
20215
20791
  var memberEvents = /* @__PURE__ */ __name((stays, revisions, since = 0) => {
20216
20792
  const events = [];
20217
20793
  for (const stay of stays) {
@@ -20243,7 +20819,7 @@ var memberEvents = /* @__PURE__ */ __name((stays, revisions, since = 0) => {
20243
20819
  return events.filter(({ at }) => Date.parse(at) >= since).sort((a, b) => Date.parse(a.at) - Date.parse(b.at) || a.id.localeCompare(b.id));
20244
20820
  }, "memberEvents");
20245
20821
 
20246
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/chats.js
20822
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/chats.js
20247
20823
  var EVENTS_DAYS = 7;
20248
20824
  var TRACKED_DAYS = 30;
20249
20825
  var STATS_PAGE = 1e3;
@@ -20538,7 +21114,7 @@ var storedMembers = /* @__PURE__ */ __name(async (store, chatId) => {
20538
21114
  return members.length === 0 ? null : members;
20539
21115
  }, "storedMembers");
20540
21116
 
20541
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/inbox.js
21117
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/inbox.js
20542
21118
  var INBOX_CHATS = 20;
20543
21119
  var REVIEW_DAYS = 3;
20544
21120
  var UNANSWERED_HOURS = 24;
@@ -20746,7 +21322,7 @@ var inboxService = /* @__PURE__ */ __name((deps) => {
20746
21322
  };
20747
21323
  }, "inboxService");
20748
21324
 
20749
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/domain/formatting.js
21325
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/domain/formatting.js
20750
21326
  var invalid = /* @__PURE__ */ __name(() => new CliError("validation_error", "the messenger formatter returned invalid text spans"), "invalid");
20751
21327
  var validateFormattedText = /* @__PURE__ */ __name((formatted2) => {
20752
21328
  const { text: text2, spans } = formatted2;
@@ -20806,7 +21382,7 @@ var visibleFormattedText = /* @__PURE__ */ __name((formatted2) => {
20806
21382
  };
20807
21383
  }, "visibleFormattedText");
20808
21384
 
20809
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/moderation/check.js
21385
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/moderation/check.js
20810
21386
  var INVITE = /max\.ru\/join\/|(t|telegram)\.me\/(\+|joinchat\/)|tg:\/\/join/i;
20811
21387
  var LINK2 = /https?:\/\/\S+/i;
20812
21388
  var STRENGTH = { report: 0, delete: 1, remove: 2 };
@@ -20994,9 +21570,9 @@ var nextPoint = /* @__PURE__ */ __name((rows, found) => {
20994
21570
  }, "nextPoint");
20995
21571
  var someUndone = /* @__PURE__ */ __name((rows) => rows.some(undone), "someUndone");
20996
21572
 
20997
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/moderation/rules.js
20998
- import { existsSync, readFileSync } from "node:fs";
20999
- import { join } from "node:path";
21573
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/moderation/rules.js
21574
+ import { existsSync as existsSync2, readFileSync as readFileSync4 } from "node:fs";
21575
+ import { join as join4 } from "node:path";
21000
21576
  var RULE_ACTIONS = ["report", "delete", "remove"];
21001
21577
  var OLD_LEVELS = { forbid: "deny", flag: "ask", confirm: "ask", allow: "allow" };
21002
21578
  var level = pipe(picklist([...LEVELS, ...Object.keys(OLD_LEVELS)]), transform((typed) => OLD_LEVELS[typed] ?? typed));
@@ -21063,7 +21639,7 @@ var KEYS = {
21063
21639
  "consent.remove": { help: LEVELS.join("|"), parse: String }
21064
21640
  };
21065
21641
  var RULE_KEYS = Object.keys(KEYS);
21066
- var moderationPathFor = /* @__PURE__ */ __name((app, profile, env = process.env) => join(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "profiles", `${profile}.moderation.json`), "moderationPathFor");
21642
+ var moderationPathFor = /* @__PURE__ */ __name((app, profile, env = process.env) => join4(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "profiles", `${profile}.moderation.json`), "moderationPathFor");
21067
21643
  var ModerationRules = class {
21068
21644
  static {
21069
21645
  __name(this, "ModerationRules");
@@ -21107,11 +21683,11 @@ var ModerationRules = class {
21107
21683
  this.#write({ ...saved, checkedUntil: { ...saved.checkedUntil, [chatId]: at } });
21108
21684
  }
21109
21685
  #file() {
21110
- if (!existsSync(this.path))
21686
+ if (!existsSync2(this.path))
21111
21687
  return { groups: {} };
21112
21688
  let parsed;
21113
21689
  try {
21114
- parsed = JSON.parse(readFileSync(this.path, "utf8"));
21690
+ parsed = JSON.parse(readFileSync4(this.path, "utf8"));
21115
21691
  } catch (error) {
21116
21692
  throw broken(this.path, error instanceof Error ? error.message : String(error));
21117
21693
  }
@@ -21137,7 +21713,7 @@ var assign = /* @__PURE__ */ __name((rules, key, value) => {
21137
21713
  return { ...rules, [head]: { ...rules[head], [tail]: value } };
21138
21714
  }, "assign");
21139
21715
 
21140
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/person-context.js
21716
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/person-context.js
21141
21717
  var CONTEXT_MESSAGES2 = 10;
21142
21718
  var CONTEXT_BYTES = 64 * 1024;
21143
21719
  var toContext = /* @__PURE__ */ __name((key, message, chatTitle2) => ({
@@ -21223,9 +21799,9 @@ var readableAccounts = /* @__PURE__ */ __name(async (store, asked, scopes) => {
21223
21799
  return stored.filter((one) => allowed.includes(one.scope));
21224
21800
  }, "readableAccounts");
21225
21801
  var readsOf = /* @__PURE__ */ __name((record2, asked, readable) => {
21226
- const scopeOf4 = new Map(readable.map((one) => [nameOf(one), one.scope]));
21802
+ const scopeOf5 = new Map(readable.map((one) => [nameOf(one), one.scope]));
21227
21803
  return record2.identities.flatMap((identity) => (identity.provider === asked.provider ? [asked.account] : identity.accounts).flatMap((account) => {
21228
- const scope = scopeOf4.get(nameOf({ provider: identity.provider, account }));
21804
+ const scope = scopeOf5.get(nameOf({ provider: identity.provider, account }));
21229
21805
  return identity.accounts.includes(account) && scope !== void 0 ? [{ key: { provider: identity.provider, account }, scope, identity }] : [];
21230
21806
  }));
21231
21807
  }, "readsOf");
@@ -21240,7 +21816,7 @@ var personContext = /* @__PURE__ */ __name(async (store, asked, reference, optio
21240
21816
  ...await recordContext(store, record2, readsOf(record2, asked, readable), readable, options2)
21241
21817
  };
21242
21818
  }, "personContext");
21243
- var recordContext = /* @__PURE__ */ __name(async (store, record2, reads, readable, { messages = CONTEXT_MESSAGES2, bytes: bytes2 = CONTEXT_BYTES, since, now = Date.now() } = {}) => {
21819
+ var recordContext = /* @__PURE__ */ __name(async (store, record2, reads, readable, { messages = CONTEXT_MESSAGES2, bytes: bytes2 = CONTEXT_BYTES, since, now = Date.now(), calendarIds } = {}) => {
21244
21820
  const recent = /* @__PURE__ */ __name((message) => since === void 0 || Date.parse(message.timestamp) >= since, "recent");
21245
21821
  const shared = [];
21246
21822
  const notRead = [];
@@ -21302,7 +21878,8 @@ var recordContext = /* @__PURE__ */ __name(async (store, record2, reads, readabl
21302
21878
  for (const one of readable)
21303
21879
  if ((await store.calendar.calendars(one.id)).length)
21304
21880
  calendars.push(one);
21305
- const accountIds = calendars.map(({ id: id2 }) => id2);
21881
+ const readableIds = calendars.map(({ id: id2 }) => id2);
21882
+ const accountIds = calendarIds === void 0 ? readableIds : readableIds.filter((id2) => calendarIds.includes(id2));
21306
21883
  const nothing = { items: [], cut: false };
21307
21884
  const upcoming = accountIds.length ? await eventsOnce(store, { personId, accountIds, from: now }, messages) : nothing;
21308
21885
  const upcomingIds = new Set(upcoming.items.map(({ id: id2 }) => id2));
@@ -21426,10 +22003,10 @@ var personMessages = /* @__PURE__ */ __name(async (store, asked, reference, { ch
21426
22003
  };
21427
22004
  }, "personMessages");
21428
22005
 
21429
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
22006
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
21430
22007
  import { createHash } from "node:crypto";
21431
22008
 
21432
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/meeting-reference.js
22009
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/meeting-reference.js
21433
22010
  var missing2 = /* @__PURE__ */ __name(() => new CliError("not_found", "the meeting evidence is unavailable for this account"), "missing");
21434
22011
  var authorizedMeetingMetadata = /* @__PURE__ */ __name(async (store, accountId, reference, options2 = {}) => {
21435
22012
  const parsed = parseMeetingReference(reference);
@@ -21447,7 +22024,7 @@ var authorizedMeetingMetadata = /* @__PURE__ */ __name(async (store, accountId,
21447
22024
  return { parsed, meeting };
21448
22025
  }, "authorizedMeetingMetadata");
21449
22026
 
21450
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
22027
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
21451
22028
  var hash = /* @__PURE__ */ __name((value) => createHash("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
21452
22029
  var checkMeetingCancelled = /* @__PURE__ */ __name((signal) => {
21453
22030
  if (signal?.aborted)
@@ -21646,7 +22223,7 @@ var readMeetingEvidence = /* @__PURE__ */ __name(async (store, accountId, refere
21646
22223
  return { ...packet, fingerprint: hash(packet) };
21647
22224
  }, "readMeetingEvidence");
21648
22225
 
21649
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/person-meeting-context.js
22226
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/person-meeting-context.js
21650
22227
  var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference, options2) => {
21651
22228
  const { meetings = 10, cues = 5, bytes: bytes2 = 64 * 1024, scanLimit = 1e3, since, signal } = options2;
21652
22229
  const requestedAccounts = options2.accountIds;
@@ -21745,7 +22322,7 @@ var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference,
21745
22322
  };
21746
22323
  }, "personMeetingContext");
21747
22324
 
21748
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/person-preparation.js
22325
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/person-preparation.js
21749
22326
  var PREPARE_BYTES = 96 * 1024;
21750
22327
  var MEETINGS = 5;
21751
22328
  var CUES = 3;
@@ -21861,7 +22438,7 @@ var meetingsOf = /* @__PURE__ */ __name(async (store, uid, stored, since, left)
21861
22438
  }
21862
22439
  }, "meetingsOf");
21863
22440
 
21864
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/person-profile.js
22441
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/person-profile.js
21865
22442
  var personProfile = /* @__PURE__ */ __name(async (deps, person, known2) => {
21866
22443
  const online = deps.offline ? void 0 : await deps.connection();
21867
22444
  const held = await storeIfOpen(deps);
@@ -21931,7 +22508,7 @@ var quiet = /* @__PURE__ */ __name((facts) => facts.chats.map(({ id: id2, title,
21931
22508
  complete: false
21932
22509
  })), "quiet");
21933
22510
 
21934
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/person-timeline.js
22511
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/person-timeline.js
21935
22512
  var TIMELINE_ITEMS = 50;
21936
22513
  var TIMELINE_MAX = 500;
21937
22514
  var SCOPES = ["personal", "work"];
@@ -21986,7 +22563,7 @@ var personTimeline = /* @__PURE__ */ __name(async (store, asked, reference, { sc
21986
22563
  };
21987
22564
  }, "personTimeline");
21988
22565
 
21989
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/people.js
22566
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/people.js
21990
22567
  var peopleService = /* @__PURE__ */ __name((deps) => {
21991
22568
  const localCard = /* @__PURE__ */ __name(async (card, includeNotes = false) => {
21992
22569
  const held = await storeIfOpen(deps);
@@ -22077,8 +22654,12 @@ var peopleService = /* @__PURE__ */ __name((deps) => {
22077
22654
  ...detail ? { detail } : {}
22078
22655
  });
22079
22656
  }, "messagesIn"),
22080
- link: /* @__PURE__ */ __name(async (person, other, method = "manual") => linkPeople(await deps.store(), await deps.account(), person, other, method), "link"),
22081
- unlink: /* @__PURE__ */ __name(async (person) => {
22657
+ link: /* @__PURE__ */ __name(async (person, other, options2) => linkPeople(await deps.store(), await deps.account(), person, other, options2), "link"),
22658
+ unlink: /* @__PURE__ */ __name(async (person, { by }) => {
22659
+ if (by !== "owner")
22660
+ throw new CliError("permission_error", "only the owner unlinks an identity; the owner runs this", {
22661
+ reason: "identity.owner-only"
22662
+ });
22082
22663
  const store = await deps.store();
22083
22664
  return store.people.unlinkIdentity(await identityIn(store, await deps.account(), person), {
22084
22665
  method: "manual",
@@ -22154,14 +22735,37 @@ var peopleService = /* @__PURE__ */ __name((deps) => {
22154
22735
  };
22155
22736
  }, "peopleService");
22156
22737
  var IMPORT_CHUNK = 10;
22157
- var linkPeople = /* @__PURE__ */ __name(async (store, account, person, other, method = "manual") => {
22738
+ var linkPeople = /* @__PURE__ */ __name(async (store, account, person, other, { by, reason, method = "manual" }) => {
22158
22739
  const one = await identityIn(store, account, person);
22159
- if (other === "me")
22740
+ const owner = by === "owner";
22741
+ if (other === "me") {
22742
+ if (!owner)
22743
+ throw new CliError("permission_error", "only the owner links an identity to themselves; the owner runs this", {
22744
+ reason: "identity.owner-only"
22745
+ });
22160
22746
  return store.people.linkToOwner(one);
22747
+ }
22161
22748
  const two = await identityIn(store, account, other);
22162
22749
  if (one.provider === two.provider && one.id === two.id)
22163
22750
  throw new CliError("validation_error", "that is the same person twice");
22164
- return store.people.linkIdentities(one, two, { method, by: "owner" });
22751
+ if (owner)
22752
+ return store.people.linkIdentities(one, two, { method, by });
22753
+ const why = reason?.trim();
22754
+ if (!why)
22755
+ throw new CliError("validation_error", "an agent proposing a link gives a reason: --reason <why they are one>", {
22756
+ reason: "proposal.reason-required"
22757
+ });
22758
+ const record2 = await store.people.personOf(one);
22759
+ if (record2.identities.some(({ provider, id: id2 }) => provider === two.provider && id2 === two.id))
22760
+ return record2;
22761
+ const proposed = await store.people.proposeLink({
22762
+ identity: two,
22763
+ with: one,
22764
+ signal: "agent",
22765
+ by: { bot: by },
22766
+ reason: why
22767
+ });
22768
+ return { ...record2, proposal: proposed.id };
22165
22769
  }, "linkPeople");
22166
22770
  var phoneOf = /* @__PURE__ */ __name((typed) => {
22167
22771
  const digits = typed.replace(/[\s()+-]/g, "");
@@ -22213,7 +22817,7 @@ var withoutPhone = /* @__PURE__ */ __name((answer) => {
22213
22817
  return rest;
22214
22818
  }, "withoutPhone");
22215
22819
 
22216
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/task-stats.js
22820
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/task-stats.js
22217
22821
  var TASK_STATS_BY = ["chat", "meeting", "project"];
22218
22822
  var PERIOD_FIELD = "created";
22219
22823
  var refuseNestedPeriod = /* @__PURE__ */ __name((node, top = true) => {
@@ -22259,10 +22863,10 @@ var taskStatsOf = /* @__PURE__ */ __name(async (store, account, { by = "chat", q
22259
22863
  const closed = await store.tasks.statRows(scope, where(query && { ...query, root: renamed(query.root, PERIOD_FIELD, "closed") }, [
22260
22864
  { sql: "t.closed_at IS NOT NULL", params: [] }
22261
22865
  ]));
22262
- const keyOf6 = /* @__PURE__ */ __name((row) => by === "project" ? String(row.projectId) : row.group ?? "", "keyOf");
22866
+ const keyOf8 = /* @__PURE__ */ __name((row) => by === "project" ? String(row.projectId) : row.group ?? "", "keyOf");
22263
22867
  const groups = /* @__PURE__ */ new Map();
22264
22868
  const slot = /* @__PURE__ */ __name((row) => {
22265
- const key = keyOf6(row);
22869
+ const key = keyOf8(row);
22266
22870
  const found = groups.get(key) ?? { open: [], created: 0, closeMs: [] };
22267
22871
  groups.set(key, found);
22268
22872
  return found;
@@ -22316,7 +22920,7 @@ var meetingNames = /* @__PURE__ */ __name(async (store, groups) => {
22316
22920
  }));
22317
22921
  }, "meetingNames");
22318
22922
 
22319
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/task-tag-filters.js
22923
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/task-tag-filters.js
22320
22924
  var taskTagFilters = /* @__PURE__ */ __name(async (store, query) => {
22321
22925
  const tags = /* @__PURE__ */ new Map();
22322
22926
  for (const node of query ? walkQuery(query.root) : [])
@@ -22325,7 +22929,7 @@ var taskTagFilters = /* @__PURE__ */ __name(async (store, query) => {
22325
22929
  return tags;
22326
22930
  }, "taskTagFilters");
22327
22931
 
22328
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/tasks.js
22932
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/tasks.js
22329
22933
  var TASK_QUERY = {
22330
22934
  entity: "task",
22331
22935
  backend: "sql",
@@ -22817,7 +23421,7 @@ var taskView = /* @__PURE__ */ __name(async (store, account, task2) => {
22817
23421
  };
22818
23422
  }, "taskView");
22819
23423
 
22820
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/mail/owed.js
23424
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/mail/owed.js
22821
23425
  var mailTurn = /* @__PURE__ */ __name((newest) => {
22822
23426
  if (newest === null)
22823
23427
  return null;
@@ -22826,7 +23430,7 @@ var mailTurn = /* @__PURE__ */ __name((newest) => {
22826
23430
  return newest.addressed ? "owed" : null;
22827
23431
  }, "mailTurn");
22828
23432
 
22829
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/agenda-mail.js
23433
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/agenda-mail.js
22830
23434
  var absent = /* @__PURE__ */ __name((error) => {
22831
23435
  if (error instanceof CliError && error.code === "not_found")
22832
23436
  return void 0;
@@ -22884,7 +23488,7 @@ var mailActivity = /* @__PURE__ */ __name(async (store, account, since, chats) =
22884
23488
  };
22885
23489
  }, "mailActivity");
22886
23490
 
22887
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/chat-coverage.js
23491
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/chat-coverage.js
22888
23492
  var chatCoverage = /* @__PURE__ */ __name(async (store, account, chatIds) => {
22889
23493
  const ids = [...new Set(chatIds)];
22890
23494
  if (ids.length === 0)
@@ -22910,7 +23514,7 @@ var chatCoverage = /* @__PURE__ */ __name(async (store, account, chatIds) => {
22910
23514
  }));
22911
23515
  }, "chatCoverage");
22912
23516
 
22913
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/agenda.js
23517
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/agenda.js
22914
23518
  var DAY = 864e5;
22915
23519
  var AGENDA_DEFAULTS = { unanswered: DAY, waiting: 7 * DAY };
22916
23520
  var CLAIMS = ["none", "mine", "others", "any"];
@@ -23157,7 +23761,7 @@ var agendaItem = /* @__PURE__ */ __name((shown) => {
23157
23761
  };
23158
23762
  }, "agendaItem");
23159
23763
 
23160
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/context/evidence-response.js
23764
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/context/evidence-response.js
23161
23765
  var contextSourceKey = /* @__PURE__ */ __name((source) => JSON.stringify([source.kind, source.accountId, source.provider, source.account]), "contextSourceKey");
23162
23766
  var validateContextEvidencePage = /* @__PURE__ */ __name((page, request) => {
23163
23767
  const fail2 = /* @__PURE__ */ __name(() => {
@@ -23221,7 +23825,7 @@ var validateContextEvidencePage = /* @__PURE__ */ __name((page, request) => {
23221
23825
  }
23222
23826
  }, "validateContextEvidencePage");
23223
23827
 
23224
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/context/read-budget.js
23828
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/context/read-budget.js
23225
23829
  var contextReadBudget = /* @__PURE__ */ __name((limits = {}) => {
23226
23830
  if (!limits || typeof limits !== "object" || Array.isArray(limits))
23227
23831
  throw new CliError("validation_error", "limits needs a context read allowance");
@@ -23274,7 +23878,7 @@ var contextReadBudget = /* @__PURE__ */ __name((limits = {}) => {
23274
23878
  };
23275
23879
  }, "contextReadBudget");
23276
23880
 
23277
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/context-evidence.js
23881
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/context-evidence.js
23278
23882
  var createContextEvidenceReader = /* @__PURE__ */ __name((port, allowed, limits) => {
23279
23883
  if (!port || typeof port.read !== "function")
23280
23884
  throw new CliError("configuration_error", "context evidence reader is unavailable");
@@ -23318,7 +23922,7 @@ var createContextEvidenceReader = /* @__PURE__ */ __name((port, allowed, limits)
23318
23922
  };
23319
23923
  }, "createContextEvidenceReader");
23320
23924
 
23321
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/excerpt.js
23925
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/excerpt.js
23322
23926
  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");
23323
23927
  var excerpt = /* @__PURE__ */ __name((text2, query, size2 = 240, options2 = {}) => {
23324
23928
  const flat = text2.replace(/\s+/g, " ").trim();
@@ -23334,7 +23938,7 @@ var excerpt = /* @__PURE__ */ __name((text2, query, size2 = 240, options2 = {})
23334
23938
  }, "excerpt");
23335
23939
  var withExcerpt = /* @__PURE__ */ __name(({ matchedText, ...hit }, query) => ({ ...hit, excerpt: excerpt(matchedText ?? hit.text, query) }), "withExcerpt");
23336
23940
 
23337
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/project-purposes.js
23941
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/project-purposes.js
23338
23942
  var BUILT_IN_PURPOSES = ["work", "sales", "support", "other"];
23339
23943
  var DEFAULT_PURPOSES = ["work"];
23340
23944
  var LINK_PURPOSE = "work";
@@ -23364,7 +23968,7 @@ var purposeList = /* @__PURE__ */ __name((value, previous = []) => [
23364
23968
  ...value.split(",").map((one) => one.trim()).filter(Boolean)
23365
23969
  ], "purposeList");
23366
23970
 
23367
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/project-gathering-around.js
23971
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/project-gathering-around.js
23368
23972
  var storedMessageNeighbours = /* @__PURE__ */ __name((messages) => ({
23369
23973
  async around(ref, window3) {
23370
23974
  const at = parseLocator(ref);
@@ -23459,7 +24063,7 @@ var storedNeighbours = /* @__PURE__ */ __name((store) => {
23459
24063
  };
23460
24064
  }, "storedNeighbours");
23461
24065
 
23462
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/project-gathering-request.js
24066
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/project-gathering-request.js
23463
24067
  import { createHash as createHash2 } from "node:crypto";
23464
24068
  var DAY2 = 864e5;
23465
24069
  var MAX_TIME = 864e13;
@@ -23775,7 +24379,7 @@ var decodeCheckpoint = /* @__PURE__ */ __name((text2, plan) => {
23775
24379
  return value;
23776
24380
  }, "decodeCheckpoint");
23777
24381
 
23778
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/project-gathering.js
24382
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/project-gathering.js
23779
24383
  var terminal = /* @__PURE__ */ new Set(["done", "unavailable", "failed"]);
23780
24384
  var PAGE3 = 20;
23781
24385
  var PEOPLE = 20;
@@ -24060,7 +24664,7 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
24060
24664
  signal
24061
24665
  );
24062
24666
  const people = peopleOf(items, senderOf);
24063
- const coverageOf2 = /* @__PURE__ */ new Map();
24667
+ const coverageOf3 = /* @__PURE__ */ new Map();
24064
24668
  if (ports.coverage) {
24065
24669
  const byAccount = /* @__PURE__ */ new Map();
24066
24670
  for (const { provider, account, chat, source } of plan.linkedChats) {
@@ -24072,7 +24676,7 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
24072
24676
  }
24073
24677
  for (const [key, { account, chats }] of byAccount)
24074
24678
  for (const row of await ports.coverage(account, chats))
24075
- coverageOf2.set(`${key}${row.chatId}`, row);
24679
+ coverageOf3.set(`${key}${row.chatId}`, row);
24076
24680
  }
24077
24681
  const totals = {
24078
24682
  reads: (previous?.totals.reads ?? 0) + usage.reads,
@@ -24097,7 +24701,7 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
24097
24701
  const linkedRows = plan.linkedChats.map(({ provider, account, chat, ref, source, lane }) => {
24098
24702
  const laneUnits = units2.flatMap((unit, index) => unit.lane.id === lane ? [progress[index]] : []);
24099
24703
  const state = source === null ? "out-of-scope" : laneUnits.every((u) => u?.state === "unavailable") ? "unavailable" : laneUnits.every((u) => u?.state === "pending") ? "pending" : "in-scope";
24100
- const row = coverageOf2.get(`${JSON.stringify([provider, account])}${chat}`);
24704
+ const row = coverageOf3.get(`${JSON.stringify([provider, account])}${chat}`);
24101
24705
  return {
24102
24706
  provider,
24103
24707
  account,
@@ -24179,7 +24783,7 @@ var peopleOf = /* @__PURE__ */ __name((items, senderOf) => {
24179
24783
  return [...byKey.values()].sort((a, b) => b.items - a.items || a.name.localeCompare(b.name));
24180
24784
  }, "peopleOf");
24181
24785
 
24182
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidate-matching.js
24786
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidate-matching.js
24183
24787
  var normalizedText = /* @__PURE__ */ __name((text2) => text2.normalize("NFKC").toLowerCase().replace(/\s+/gu, " "), "normalizedText");
24184
24788
  var termsOf = /* @__PURE__ */ __name((entry) => [
24185
24789
  { name: entry.name, kind: "canonical" },
@@ -24223,7 +24827,7 @@ var matchVocabularyTerms = /* @__PURE__ */ __name((catalog, texts) => {
24223
24827
  return result.sort((a, b) => Number(a.entry.id) - Number(b.entry.id));
24224
24828
  }, "matchVocabularyTerms");
24225
24829
 
24226
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/project-gathering-mentions.js
24830
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/project-gathering-mentions.js
24227
24831
  var KINDS = ["project", "tag", "topic"];
24228
24832
  var findEvidenceMentions = /* @__PURE__ */ __name(async (vocabulary, gathering, options2 = {}) => {
24229
24833
  if (typeof vocabulary?.vocabulary !== "function")
@@ -24278,7 +24882,7 @@ var findEvidenceMentions = /* @__PURE__ */ __name(async (vocabulary, gathering,
24278
24882
  };
24279
24883
  }, "findEvidenceMentions");
24280
24884
 
24281
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/stored-project-gathering.js
24885
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/stored-project-gathering.js
24282
24886
  var storedChatCount = /* @__PURE__ */ __name((store) => async (account, chatId, { since, until }) => {
24283
24887
  const window3 = { since: new Date(since).toISOString(), until: new Date(until - 1).toISOString() };
24284
24888
  const [messages, newest, oldest] = await Promise.all([
@@ -24584,18 +25188,18 @@ var purposeHintOf = /* @__PURE__ */ __name((linked, rows, of) => {
24584
25188
  return { chat: top.ref, relationship: link4.relationship, items, of };
24585
25189
  }, "purposeHintOf");
24586
25190
 
24587
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/media-archive.js
25191
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/media-archive.js
24588
25192
  import { setTimeout as sleep3 } from "node:timers/promises";
24589
25193
 
24590
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
25194
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
24591
25195
  import { lstat } from "node:fs/promises";
24592
25196
 
24593
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
24594
- import { createHash as createHash4, randomUUID as randomUUID2 } from "node:crypto";
25197
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
25198
+ import { createHash as createHash4, randomUUID as randomUUID3 } from "node:crypto";
24595
25199
  import { open as open3, rename as rename2, unlink as unlink2 } from "node:fs/promises";
24596
- import { join as join3 } from "node:path";
25200
+ import { join as join6 } from "node:path";
24597
25201
 
24598
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-metadata.js
25202
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-metadata.js
24599
25203
  import { createHash as createHash3 } from "node:crypto";
24600
25204
  var metadataLimit = 16384;
24601
25205
  var partialIdentity = /* @__PURE__ */ __name((locator) => JSON.stringify([locator.provider, locator.account, locator.occurrenceId, locator.assetId]), "partialIdentity");
@@ -24655,10 +25259,10 @@ var readPartialMetadata = /* @__PURE__ */ __name(async (path, locator, maxBytes,
24655
25259
  }
24656
25260
  }, "readPartialMetadata");
24657
25261
 
24658
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-writer.js
24659
- import { randomUUID } from "node:crypto";
25262
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-writer.js
25263
+ import { randomUUID as randomUUID2 } from "node:crypto";
24660
25264
  import { open as open2, rename, unlink } from "node:fs/promises";
24661
- import { join as join2 } from "node:path";
25265
+ import { join as join5 } from "node:path";
24662
25266
  var partialWriter = /* @__PURE__ */ __name(async (input) => {
24663
25267
  const { file: file2, signal, partial } = input;
24664
25268
  const owned = await file2.stat({ bigint: true });
@@ -24666,7 +25270,7 @@ var partialWriter = /* @__PURE__ */ __name(async (input) => {
24666
25270
  const hash3 = input.fingerprint.hash;
24667
25271
  let closed = false;
24668
25272
  let failed = false;
24669
- const usable = /* @__PURE__ */ __name(async () => {
25273
+ const usable2 = /* @__PURE__ */ __name(async () => {
24670
25274
  signal?.throwIfAborted();
24671
25275
  if (closed || failed)
24672
25276
  throw new CliError("validation_error", "recording partial writer is no longer writable");
@@ -24674,7 +25278,7 @@ var partialWriter = /* @__PURE__ */ __name(async (input) => {
24674
25278
  throw new CliError("validation_error", "recording partial changed before append");
24675
25279
  }, "usable");
24676
25280
  const checkpoint = /* @__PURE__ */ __name(async () => {
24677
- await usable();
25281
+ await usable2();
24678
25282
  await file2.sync();
24679
25283
  if (!partial.validator || !input.persistent) {
24680
25284
  await syncDirectory(input.root);
@@ -24684,7 +25288,7 @@ var partialWriter = /* @__PURE__ */ __name(async (input) => {
24684
25288
  const content = JSON.stringify({ ...partial, offset: size2, sha256: hash3.copy().digest("hex") });
24685
25289
  if (Buffer.byteLength(content) > metadataLimit)
24686
25290
  throw new CliError("validation_error", "recording partial metadata exceeds its byte limit");
24687
- const temp = join2(input.root, `${input.prefix}${randomUUID()}.tmp`);
25291
+ const temp = join5(input.root, `${input.prefix}${randomUUID2()}.tmp`);
24688
25292
  const metadata = await open2(temp, "wx", 384);
24689
25293
  try {
24690
25294
  try {
@@ -24693,7 +25297,7 @@ var partialWriter = /* @__PURE__ */ __name(async (input) => {
24693
25297
  } finally {
24694
25298
  await metadata.close();
24695
25299
  }
24696
- await usable();
25300
+ await usable2();
24697
25301
  await rename(temp, input.metadataPath);
24698
25302
  await syncDirectory(input.root);
24699
25303
  signal?.throwIfAborted();
@@ -24706,7 +25310,7 @@ var partialWriter = /* @__PURE__ */ __name(async (input) => {
24706
25310
  }, "checkpoint");
24707
25311
  return {
24708
25312
  write: /* @__PURE__ */ __name(async (bytes2) => {
24709
- await usable();
25313
+ await usable2();
24710
25314
  if (!(bytes2 instanceof Uint8Array) || bytes2.length > input.maxBytes - size2)
24711
25315
  throw new CliError("validation_error", "recording partial exceeds its byte limit");
24712
25316
  let offset = 0;
@@ -24747,7 +25351,7 @@ var partialWriter = /* @__PURE__ */ __name(async (input) => {
24747
25351
  };
24748
25352
  }, "partialWriter");
24749
25353
 
24750
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
25354
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
24751
25355
  var NativeRecordingPartialStore = class {
24752
25356
  static {
24753
25357
  __name(this, "NativeRecordingPartialStore");
@@ -24769,9 +25373,9 @@ var NativeRecordingPartialStore = class {
24769
25373
  this.options = Object.freeze({ ...options2 });
24770
25374
  if (typeof root !== "string" || !root || root.includes("\0") || !/^\.[a-zA-Z0-9][a-zA-Z0-9._-]{0,95}-$/.test(options2.prefix) || typeof options2.persistent !== "boolean" || !Number.isSafeInteger(options2.maxBytes) || options2.maxBytes <= 0 || Object.values(this.locator).some((value) => typeof value !== "string" || !value.trim() || /[\0\r\n]/.test(value)))
24771
25375
  throw new CliError("validation_error", "invalid native recording partial options");
24772
- const key = options2.persistent ? createHash4("sha256").update(partialIdentity(this.locator)).digest("hex") : randomUUID2();
24773
- this.path = join3(root, `${options2.prefix}${key}.part`);
24774
- this.metadataPath = join3(root, `${options2.prefix}${key}.json`);
25376
+ const key = options2.persistent ? createHash4("sha256").update(partialIdentity(this.locator)).digest("hex") : randomUUID3();
25377
+ this.path = join6(root, `${options2.prefix}${key}.part`);
25378
+ this.metadataPath = join6(root, `${options2.prefix}${key}.json`);
24775
25379
  }
24776
25380
  scope(locator) {
24777
25381
  if (partialIdentity(locator) !== partialIdentity(this.locator))
@@ -24812,7 +25416,7 @@ var NativeRecordingPartialStore = class {
24812
25416
  if (resume) {
24813
25417
  file2 = await openOrdinaryFile(this.path, { writable: true });
24814
25418
  } else {
24815
- const temp = join3(this.root, `${this.options.prefix}${randomUUID2()}.tmp`);
25419
+ const temp = join6(this.root, `${this.options.prefix}${randomUUID3()}.tmp`);
24816
25420
  file2 = await open3(temp, "wx+", 384);
24817
25421
  try {
24818
25422
  await rename2(temp, this.path);
@@ -24854,12 +25458,12 @@ var NativeRecordingPartialStore = class {
24854
25458
  }
24855
25459
  };
24856
25460
 
24857
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
25461
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
24858
25462
  import { createHash as createHash5 } from "node:crypto";
24859
25463
  import { link as link2 } from "node:fs/promises";
24860
- import { basename as basename2, dirname as dirname2, join as join5, resolve as resolve2 } from "node:path";
25464
+ import { basename as basename2, dirname as dirname5, join as join8, resolve as resolve2 } from "node:path";
24861
25465
 
24862
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-files.js
25466
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-files.js
24863
25467
  import { unlink as unlink3 } from "node:fs/promises";
24864
25468
  var verifiedPublicationFile = /* @__PURE__ */ __name(async (path, expected2, signal, writable = false) => {
24865
25469
  signal?.throwIfAborted();
@@ -24894,10 +25498,10 @@ var commitPublication = /* @__PURE__ */ __name(async (root, partialPath, finalPa
24894
25498
  signal?.throwIfAborted();
24895
25499
  }, "commitPublication");
24896
25500
 
24897
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-journal.js
24898
- import { randomUUID as randomUUID3 } from "node:crypto";
25501
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-journal.js
25502
+ import { randomUUID as randomUUID4 } from "node:crypto";
24899
25503
  import { open as open4, rename as rename3, unlink as unlink4 } from "node:fs/promises";
24900
- import { join as join4 } from "node:path";
25504
+ import { join as join7 } from "node:path";
24901
25505
  var readPublicationJournal = /* @__PURE__ */ __name(async (path, codec, limit, signal) => {
24902
25506
  signal?.throwIfAborted();
24903
25507
  let file2;
@@ -24941,7 +25545,7 @@ var writePublicationJournal = /* @__PURE__ */ __name(async (root, path, prefix,
24941
25545
  if (Buffer.byteLength(content) > limit)
24942
25546
  throw new CliError("validation_error", "recording recovery record exceeds its metadata limit");
24943
25547
  codec.decode(JSON.parse(content));
24944
- const temp = join4(root, `${prefix}${randomUUID3()}.tmp`);
25548
+ const temp = join7(root, `${prefix}${randomUUID4()}.tmp`);
24945
25549
  const handle = await open4(temp, "wx", 384);
24946
25550
  let identity;
24947
25551
  try {
@@ -24967,7 +25571,7 @@ var writePublicationJournal = /* @__PURE__ */ __name(async (root, path, prefix,
24967
25571
  }
24968
25572
  }, "writePublicationJournal");
24969
25573
 
24970
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
25574
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
24971
25575
  var NativeRecordingPublication = class {
24972
25576
  static {
24973
25577
  __name(this, "NativeRecordingPublication");
@@ -24983,8 +25587,8 @@ var NativeRecordingPublication = class {
24983
25587
  throw new CliError("validation_error", "invalid native recording publication options");
24984
25588
  this.scope = partialIdentity(locator);
24985
25589
  this.options = Object.freeze({ ...options2, codec: Object.freeze({ ...options2.codec }) });
24986
- this.journalPath = join5(root, `${options2.prefix}${createHash5("sha256").update(this.scope).digest("hex")}.json`);
24987
- this.finalPath = join5(root, options2.filename);
25590
+ this.journalPath = join8(root, `${options2.prefix}${createHash5("sha256").update(this.scope).digest("hex")}.json`);
25591
+ this.finalPath = join8(root, options2.filename);
24988
25592
  if (this.finalPath === this.journalPath)
24989
25593
  throw new CliError("validation_error", "recording publication paths must be distinct");
24990
25594
  }
@@ -24995,7 +25599,7 @@ var NativeRecordingPublication = class {
24995
25599
  return writePublicationJournal(this.root, this.journalPath, this.options.prefix, value, this.options.codec, this.options.metadataLimit, this.options.signal);
24996
25600
  }
24997
25601
  validate(partialPath, expected2) {
24998
- if (resolve2(dirname2(partialPath)) !== resolve2(this.root) || resolve2(partialPath) === resolve2(this.finalPath) || resolve2(partialPath) === resolve2(this.journalPath) || !Number.isSafeInteger(expected2.size) || expected2.size < 0 || expected2.size > this.options.maxBytes || typeof expected2.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(expected2.sha256))
25602
+ if (resolve2(dirname5(partialPath)) !== resolve2(this.root) || resolve2(partialPath) === resolve2(this.finalPath) || resolve2(partialPath) === resolve2(this.journalPath) || !Number.isSafeInteger(expected2.size) || expected2.size < 0 || expected2.size > this.options.maxBytes || typeof expected2.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(expected2.sha256))
24999
25603
  throw new CliError("validation_error", "invalid recording publication evidence");
25000
25604
  this.options.signal?.throwIfAborted();
25001
25605
  }
@@ -25040,10 +25644,10 @@ var NativeRecordingPublication = class {
25040
25644
  }
25041
25645
  };
25042
25646
 
25043
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/media-archive-manifest.js
25647
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/media-archive-manifest.js
25044
25648
  import { createHash as createHash6 } from "node:crypto";
25045
25649
  import { readdir } from "node:fs/promises";
25046
- import { isAbsolute as isAbsolute2, join as join6, resolve as resolve3 } from "node:path";
25650
+ import { isAbsolute as isAbsolute2, join as join9, resolve as resolve3 } from "node:path";
25047
25651
  var mediaKey = /* @__PURE__ */ __name((one) => createHash6("sha256").update(JSON.stringify([one.provider, one.account, one.chat, one.message, one.position])).digest("hex"), "mediaKey");
25048
25652
  var mediaManifestName = /* @__PURE__ */ __name((one) => `.media-archive-${mediaKey(one)}.json`, "mediaManifestName");
25049
25653
  var missingMediaFile = /* @__PURE__ */ __name((error) => typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT", "missingMediaFile");
@@ -25091,7 +25695,7 @@ var readMediaManifests = /* @__PURE__ */ __name(async (root, signal) => {
25091
25695
  continue;
25092
25696
  let one;
25093
25697
  try {
25094
- one = parseMediaEntry(JSON.parse(await readBoundedUtf8File(join6(root, name), { maxBytes: 16384 })));
25698
+ one = parseMediaEntry(JSON.parse(await readBoundedUtf8File(join9(root, name), { maxBytes: 16384 })));
25095
25699
  } catch {
25096
25700
  throw new CliError("validation_error", "invalid media archive manifest");
25097
25701
  }
@@ -25111,23 +25715,23 @@ var verifyMediaEntry = /* @__PURE__ */ __name(async (root, one, signal) => {
25111
25715
  throw new CliError("validation_error", "media archive relocation cycle or excessive depth");
25112
25716
  visited.add(location);
25113
25717
  location = resolve3(entry.relocatedTo);
25114
- const target2 = parseMediaEntry(JSON.parse(await readBoundedUtf8File(join6(location, mediaManifestName(one)), { maxBytes: 16384 })));
25718
+ const target2 = parseMediaEntry(JSON.parse(await readBoundedUtf8File(join9(location, mediaManifestName(one)), { maxBytes: 16384 })));
25115
25719
  if (!sameMediaCopy(one, target2))
25116
25720
  return false;
25117
25721
  entry = target2;
25118
25722
  }
25119
25723
  if (visited.has(location))
25120
25724
  return false;
25121
- const actual = await mediaFingerprint(join6(location, one.path), signal);
25725
+ const actual = await mediaFingerprint(join9(location, one.path), signal);
25122
25726
  return actual.size === one.size && actual.sha256 === one.sha256;
25123
25727
  }, "verifyMediaEntry");
25124
25728
  var sameMediaCopy = /* @__PURE__ */ __name((a, b) => mediaKey(a) === mediaKey(b) && a.size === b.size && a.sha256 === b.sha256 && a.kind === b.kind && a.messageTime === b.messageTime && a.mime === b.mime, "sameMediaCopy");
25125
- var commitMediaEntry = /* @__PURE__ */ __name((root, one, beforePublish) => writeFileAtomic(join6(root, mediaManifestName(one)), JSON.stringify(parseMediaEntry(one)), {
25729
+ var commitMediaEntry = /* @__PURE__ */ __name((root, one, beforePublish) => writeFileAtomic(join9(root, mediaManifestName(one)), JSON.stringify(parseMediaEntry(one)), {
25126
25730
  overwrite: false,
25127
25731
  beforePublish
25128
25732
  }), "commitMediaEntry");
25129
25733
 
25130
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
25734
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
25131
25735
  var validator = '"media-completed-v1"';
25132
25736
  var maximumFileBytes = 64 * 1024 * 1024 * 1024;
25133
25737
  var archiveMediaFile = /* @__PURE__ */ __name(async (root, identity, kind, file2, beforeWrite, signal, metadata = {}) => {
@@ -25228,9 +25832,9 @@ var archiveMediaFile = /* @__PURE__ */ __name(async (root, identity, kind, file2
25228
25832
  return entry;
25229
25833
  }, "archiveMediaFile");
25230
25834
 
25231
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/media-archive-locks.js
25835
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/media-archive-locks.js
25232
25836
  import { mkdir, realpath } from "node:fs/promises";
25233
- import { join as join7, resolve as resolve4 } from "node:path";
25837
+ import { join as join10, resolve as resolve4 } from "node:path";
25234
25838
  var archiveLocations = /* @__PURE__ */ __name(async (initial, signal) => {
25235
25839
  const roots = /* @__PURE__ */ new Set();
25236
25840
  const queued = new Set(initial.map((directory2) => resolve4(directory2)));
@@ -25275,7 +25879,7 @@ var withMediaArchiveLocks = /* @__PURE__ */ __name(async (directory2, signal, ru
25275
25879
  const leases = [];
25276
25880
  try {
25277
25881
  for (const location of locations)
25278
- leases.push(await acquireLock(join7(location, ".media-writers"), { signal }));
25882
+ leases.push(await acquireLock(join10(location, ".media-writers"), { signal }));
25279
25883
  const current = await archiveLocations(initial, signal);
25280
25884
  if (current.some((location) => !locations.includes(location)))
25281
25885
  continue;
@@ -25295,7 +25899,7 @@ var withMediaArchiveLocks = /* @__PURE__ */ __name(async (directory2, signal, ru
25295
25899
  throw new CliError("validation_error", "archive locations changed during locking; run the command again");
25296
25900
  }, "withMediaArchiveLocks");
25297
25901
 
25298
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/media-archive.js
25902
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/media-archive.js
25299
25903
  var validateMediaSince = /* @__PURE__ */ __name((value, flag = "--since-time") => {
25300
25904
  if (value === void 0)
25301
25905
  return void 0;
@@ -25448,22 +26052,22 @@ var archiveMedia = /* @__PURE__ */ __name(async (ports, options2) => {
25448
26052
  }, { create: true });
25449
26053
  }, "archiveMedia");
25450
26054
 
25451
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/media-archive-move.js
26055
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/media-archive-move.js
25452
26056
  import { realpath as realpath2, unlink as unlink5 } from "node:fs/promises";
25453
- import { basename as basename3, dirname as dirname3, join as join8, resolve as resolve5 } from "node:path";
26057
+ import { basename as basename3, dirname as dirname6, join as join11, resolve as resolve5 } from "node:path";
25454
26058
  var canonicalDestination = /* @__PURE__ */ __name(async (directory2) => {
25455
26059
  const path = resolve5(directory2);
25456
26060
  try {
25457
26061
  return await realpath2(path);
25458
26062
  } catch (error) {
25459
- if (!missingMediaFile(error) || dirname3(path) === path)
26063
+ if (!missingMediaFile(error) || dirname6(path) === path)
25460
26064
  throw error;
25461
- return join8(await canonicalDestination(dirname3(path)), basename3(path));
26065
+ return join11(await canonicalDestination(dirname6(path)), basename3(path));
25462
26066
  }
25463
26067
  }, "canonicalDestination");
25464
26068
  var image = /* @__PURE__ */ __name((entry) => ["photo", "image"].includes(entry.kind) || entry.mime?.startsWith("image/"), "image");
25465
26069
  var removeLocalCopy = /* @__PURE__ */ __name(async (root, entry, beforeWrite, signal) => {
25466
- const path = join8(root, entry.path);
26070
+ const path = join11(root, entry.path);
25467
26071
  let file2;
25468
26072
  try {
25469
26073
  file2 = await openOrdinaryFile(path);
@@ -25550,7 +26154,7 @@ var moveMediaArchive = /* @__PURE__ */ __name(async (options2) => {
25550
26154
  for (const entry of candidates) {
25551
26155
  await beforeWrite();
25552
26156
  if (!known2.has(mediaKey(entry))) {
25553
- const file2 = await openOrdinaryFile(join8(root, entry.path));
26157
+ const file2 = await openOrdinaryFile(join11(root, entry.path));
25554
26158
  try {
25555
26159
  const identity = {
25556
26160
  provider: entry.provider,
@@ -25577,7 +26181,7 @@ var moveMediaArchive = /* @__PURE__ */ __name(async (options2) => {
25577
26181
  if (!await verifyMediaEntry(root, receipt, options2.signal))
25578
26182
  throw new CliError("validation_error", "archive destination changed before rotation; the original was preserved");
25579
26183
  await beforeWrite();
25580
- await writeFileAtomic(join8(root, mediaManifestName(entry)), JSON.stringify(receipt), {
26184
+ await writeFileAtomic(join11(root, mediaManifestName(entry)), JSON.stringify(receipt), {
25581
26185
  beforePublish: beforeWrite,
25582
26186
  signal: options2.signal
25583
26187
  });
@@ -25601,7 +26205,9 @@ var moveMediaArchive = /* @__PURE__ */ __name(async (options2) => {
25601
26205
  }, { additional: [target2], createAdditional: !options2.dryRun });
25602
26206
  }, "moveMediaArchive");
25603
26207
 
25604
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/model-downloads.js
26208
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/model-downloads.js
26209
+ import { writeFileSync as writeFileSync2 } from "node:fs";
26210
+ import { join as join12 } from "node:path";
25605
26211
  var bytesOf = /* @__PURE__ */ __name((model) => model.files.reduce((sum2, file2) => sum2 + file2.bytes, 0), "bytesOf");
25606
26212
  var nativeRuntime = /* @__PURE__ */ __name(async ({ env, progress = /* @__PURE__ */ __name(() => {
25607
26213
  }, "progress") }) => {
@@ -25612,19 +26218,19 @@ var nativeRuntime = /* @__PURE__ */ __name(async ({ env, progress = /* @__PURE__
25612
26218
  }
25613
26219
  }, "nativeRuntime");
25614
26220
  var downloadTextModel = /* @__PURE__ */ __name(async (id2, { env, progress = /* @__PURE__ */ __name(() => {
25615
- }, "progress"), bytes: bytes2, acceptTerms = false }) => {
26221
+ }, "progress"), bytes: bytes2 }) => {
25616
26222
  const model = textModel(id2, env);
25617
- if (model.terms && !acceptTerms) {
25618
- throw new CliError("validation_error", `${model.id} comes under the ${model.licence} (${model.terms}): read them, then run this again with --accept-terms`);
25619
- }
25620
26223
  const directory2 = textModelsDirectory(env);
25621
26224
  if (!isTextModelInstalled(model, directory2)) {
25622
26225
  progress(`${model.id}: ${megabytes(bytesOf(model))} from Hugging Face`);
25623
26226
  await installFiles(placedText(model, directory2), { progress, ...bytes2 ? { bytes: bytes2 } : {} });
25624
26227
  }
26228
+ if (model.notice)
26229
+ writeFileSync2(join12(directory2, model.id, "NOTICE"), `${model.notice}
26230
+ `);
25625
26231
  await nativeRuntime({ env, progress });
25626
26232
  progress(`${model.id}: loading it once to check it works`);
25627
- const { openEmbedder: openEmbedder2 } = await import("./embed-T7H62XFR.js");
26233
+ const { openEmbedder: openEmbedder2 } = await import("./embed-LWLCQKIK.js");
25628
26234
  const embedder = await openEmbedder2(model, directory2);
25629
26235
  try {
25630
26236
  const [vector] = await embedder.embed(["check"], "query");
@@ -25645,7 +26251,7 @@ var downloadRerankModel = /* @__PURE__ */ __name(async (id2, { env, progress = /
25645
26251
  }
25646
26252
  await nativeRuntime({ env, progress });
25647
26253
  progress(`${model.id}: loading it once to check it works`);
25648
- const { openReranker } = await import("./rerank-SXG64475.js");
26254
+ const { openReranker } = await import("./rerank-HWJAQOZM.js");
25649
26255
  const reranker = await openReranker(model, directory2);
25650
26256
  try {
25651
26257
  await reranker.score("check", ["check"]);
@@ -25663,7 +26269,7 @@ var downloadImageModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
25663
26269
  await installFiles(placedImage(model, directory2), { progress, ...bytes2 ? { bytes: bytes2 } : {} });
25664
26270
  }
25665
26271
  progress(`${model.id}: loading it once to check it works`);
25666
- const { openPictureEmbedder } = await import("./embedder-AW3O2TR3.js");
26272
+ const { openPictureEmbedder } = await import("./embedder-CXKHLRJT.js");
25667
26273
  const embedder = await openPictureEmbedder(model, directory2);
25668
26274
  try {
25669
26275
  const vector = await embedder.embedQuery("check");
@@ -25675,7 +26281,7 @@ var downloadImageModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
25675
26281
  return { model, directory: directory2 };
25676
26282
  }, "downloadImageModel");
25677
26283
 
25678
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/domain/money-words.js
26284
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/domain/money-words.js
25679
26285
  var MONEY_REQUEST = "money-request";
25680
26286
  var MONEY_DONE = "money-done";
25681
26287
  var PROMISE = "promise";
@@ -25709,10 +26315,10 @@ var MONEY_WORDS = [
25709
26315
  }
25710
26316
  ];
25711
26317
 
25712
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/money-words.js
26318
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/money-words.js
25713
26319
  var moneyClassesOf = /* @__PURE__ */ __name((text2) => listsHit(text2, MONEY_WORDS), "moneyClassesOf");
25714
26320
 
25715
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/domain/status-words.js
26321
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/domain/status-words.js
25716
26322
  var words = /* @__PURE__ */ __name((forms) => new RegExp(`(?<![\\p{L}\\p{N}])(?:${forms.join("|")})(?![\\p{L}\\p{N}])`, "iu"), "words");
25717
26323
  var MONEY_DONE_FORMS = words([
25718
26324
  "\u043E\u043F\u043B\u0430\u0442\u0438\u043B[\u0430\u0438]?",
@@ -25752,7 +26358,7 @@ var PROMISE_FORMS = words([
25752
26358
  "estar\xE1 listo"
25753
26359
  ]);
25754
26360
 
25755
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/project-status/items.js
26361
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/project-status/items.js
25756
26362
  var EXCERPT_CHARS = 80;
25757
26363
  var excerpt2 = /* @__PURE__ */ __name((text2) => {
25758
26364
  const flat = text2.replace(/\s+/g, " ").trim();
@@ -25774,7 +26380,7 @@ var whoOf = /* @__PURE__ */ __name((message) => ({
25774
26380
  var fromOwner = /* @__PURE__ */ __name((message) => message.outgoing === true, "fromOwner");
25775
26381
  var day = /* @__PURE__ */ __name((at) => new Date(at).toISOString().slice(0, 10), "day");
25776
26382
 
25777
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/project-status/signals/amounts.js
26383
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/project-status/signals/amounts.js
25778
26384
  var MONEY = DEFAULT_TASK_CATEGORIES.filter((category) => category.name === "money");
25779
26385
  var verbOf = /* @__PURE__ */ __name((text2) => {
25780
26386
  if (MONEY_DONE_FORMS.test(text2))
@@ -25855,7 +26461,7 @@ var amounts = {
25855
26461
  attention: /* @__PURE__ */ __name((items) => items.flatMap((item2) => item2.chat !== null && item2.data.state === "asked" ? [{ chat: item2.chat, weight: 2, why: "money asked" }] : []), "attention")
25856
26462
  };
25857
26463
 
25858
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/project-status/signals/children.js
26464
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/project-status/signals/children.js
25859
26465
  var children = {
25860
26466
  id: "children",
25861
26467
  version: 1,
@@ -25884,7 +26490,7 @@ var children = {
25884
26490
  }, "read")
25885
26491
  };
25886
26492
 
25887
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/project-status/signals/coverage.js
26493
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/project-status/signals/coverage.js
25888
26494
  var coverage = {
25889
26495
  id: "coverage",
25890
26496
  version: 1,
@@ -25913,8 +26519,8 @@ var coverage = {
25913
26519
  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")
25914
26520
  };
25915
26521
 
25916
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/project-status/signals/payments.js
25917
- var holding = /* @__PURE__ */ __name((row) => row.review !== "rejected", "holding");
26522
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/project-status/signals/payments.js
26523
+ var holding2 = /* @__PURE__ */ __name((row) => row.review !== "rejected", "holding");
25918
26524
  var item = /* @__PURE__ */ __name((row, at, data) => ({
25919
26525
  signal: "payments",
25920
26526
  chat: null,
@@ -25956,14 +26562,14 @@ var payments = {
25956
26562
  read: /* @__PURE__ */ __name(async (context2) => {
25957
26563
  const projects = [context2.project.ref, ...context2.project.children.map((child) => child.ref)];
25958
26564
  const rows = await Promise.all(projects.map(async (project) => [
25959
- ...(await context2.store.finance.payments({ project, limit: 500 })).filter(holding).map(paid),
25960
- ...(await context2.store.finance.invoices({ project, open: true, limit: 500 })).filter(holding).map(expected)
26565
+ ...(await context2.store.finance.payments({ project, limit: 500 })).filter(holding2).map(paid),
26566
+ ...(await context2.store.finance.invoices({ project, open: true, limit: 500 })).filter(holding2).map(expected)
25961
26567
  ]));
25962
26568
  return rows.flat();
25963
26569
  }, "read")
25964
26570
  };
25965
26571
 
25966
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/project-status/signals/promises.js
26572
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/project-status/signals/promises.js
25967
26573
  var PATTERNS_PER_CHAT = 3;
25968
26574
  var DAY3 = 864e5;
25969
26575
  var KINDS2 = /* @__PURE__ */ new Set(["promise", "request"]);
@@ -26052,7 +26658,7 @@ var promises = {
26052
26658
  }, "read")
26053
26659
  };
26054
26660
 
26055
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/project-status/signals/questions.js
26661
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/project-status/signals/questions.js
26056
26662
  var PER_SIDE = 5;
26057
26663
  var WEEK = 7 * 864e5;
26058
26664
  var NOBODY = /* @__PURE__ */ new Set();
@@ -26083,7 +26689,7 @@ var questions2 = {
26083
26689
  }, "attention")
26084
26690
  };
26085
26691
 
26086
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/project-status/signals/reply-next.js
26692
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/project-status/signals/reply-next.js
26087
26693
  var targetOf = /* @__PURE__ */ __name((message, chat, owners) => {
26088
26694
  const byId2 = /* @__PURE__ */ __name((id2) => chat.messages.find((one) => one.id === id2), "byId");
26089
26695
  const quoted = message.replyTo ?? (message.replyToId === void 0 ? void 0 : byId2(message.replyToId));
@@ -26151,7 +26757,7 @@ var replyNext = {
26151
26757
  attention: /* @__PURE__ */ __name((items) => items.flatMap((item2) => item2.chat !== null && item2.data.next === "owner" ? [{ chat: item2.chat, weight: 2, why: "your move" }] : []), "attention")
26152
26758
  };
26153
26759
 
26154
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/project-status/signals/topics.js
26760
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/project-status/signals/topics.js
26155
26761
  var escaped = /* @__PURE__ */ __name((text2) => text2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
26156
26762
  var wholeWord = /* @__PURE__ */ __name((word) => new RegExp(`(?<![\\p{L}\\p{N}])${escaped(word)}(?![\\p{L}\\p{N}])`, "u"), "wholeWord");
26157
26763
  var matcherOf = /* @__PURE__ */ __name((query) => {
@@ -26197,7 +26803,7 @@ var topics = {
26197
26803
  }, "read")
26198
26804
  };
26199
26805
 
26200
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/project-status/signals/index.js
26806
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/project-status/signals/index.js
26201
26807
  var STATUS_SIGNALS = [
26202
26808
  replyNext,
26203
26809
  questions2,
@@ -26209,7 +26815,7 @@ var STATUS_SIGNALS = [
26209
26815
  children
26210
26816
  ];
26211
26817
 
26212
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/project-status/index.js
26818
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/project-status/index.js
26213
26819
  var DAY4 = 864e5;
26214
26820
  var STATUS_WINDOW = 300;
26215
26821
  var STATUS_CHATS = 16;
@@ -26398,7 +27004,7 @@ var projectStatus = /* @__PURE__ */ __name(async (store, input) => {
26398
27004
  };
26399
27005
  }, "projectStatus");
26400
27006
 
26401
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/account.js
27007
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/account.js
26402
27008
  var accountService = /* @__PURE__ */ __name((deps) => {
26403
27009
  const online = /* @__PURE__ */ __name(async (command) => {
26404
27010
  if (deps.offline)
@@ -26470,7 +27076,7 @@ var accountService = /* @__PURE__ */ __name((deps) => {
26470
27076
  };
26471
27077
  }, "accountService");
26472
27078
 
26473
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/domain/send-time.js
27079
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/domain/send-time.js
26474
27080
  var MINUTE = 6e4;
26475
27081
  var YEAR = 365 * 24 * 60 * MINUTE;
26476
27082
  var DELAY = /^(\d+)(m|h|d)$/;
@@ -26489,7 +27095,7 @@ var sendTime = /* @__PURE__ */ __name((value, now = Date.now(), flag = "--at-tim
26489
27095
  return new Date(at - at % MINUTE).toISOString();
26490
27096
  }, "sendTime");
26491
27097
 
26492
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/admin.js
27098
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/admin.js
26493
27099
  var recordMembership = /* @__PURE__ */ __name(async (deps, operationId, done2, change, fix, write) => {
26494
27100
  try {
26495
27101
  const held = await accountStoreIfOpen(deps);
@@ -26520,9 +27126,9 @@ var adminService = /* @__PURE__ */ __name((deps) => {
26520
27126
  }, "create"),
26521
27127
  join: /* @__PURE__ */ __name(async (link4) => {
26522
27128
  const connection = await online("chats join");
26523
- const join13 = capability(connection, "join", "join a chat by its link");
27129
+ const join17 = capability(connection, "join", "join a chat by its link");
26524
27130
  const operationId = newOperationId();
26525
- const joined = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "chat", action: "join" }, () => join13(link4.trim()), (answer) => "requested" in answer ? {} : { chatId: answer.id });
27131
+ const joined = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "chat", action: "join" }, () => join17(link4.trim()), (answer) => "requested" in answer ? {} : { chatId: answer.id });
26526
27132
  if ("requested" in joined)
26527
27133
  return { operationId, requested: true };
26528
27134
  const fix = deps.reads === "store" ? reportedFix(deps, joined.id, "left", "join") : `an online \`${typedCommand(deps.messenger.app.command, "chats list")}\` that shows the chat corrects it`;
@@ -26736,7 +27342,7 @@ var linkLimits = /* @__PURE__ */ __name(({ approval, expires, maxUses }) => {
26736
27342
  return expires === void 0 ? void 0 : sendTime(expires, Date.now(), "--expire-time");
26737
27343
  }, "linkLimits");
26738
27344
 
26739
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/mail-search.js
27345
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/mail-search.js
26740
27346
  var THREADS_PAGE = 500;
26741
27347
  var threadsOf = /* @__PURE__ */ __name(async (store, key) => {
26742
27348
  const account = await store.accounts.storedAccount(key).catch(() => void 0);
@@ -26815,27 +27421,125 @@ var readMail = /* @__PURE__ */ __name(async (store, locator, { before: before2 =
26815
27421
  return thread.slice(Math.max(0, at - before2), at + after + 1).map((hit) => hit.id === message ? { ...hit, anchor: true } : hit);
26816
27422
  }, "readMail");
26817
27423
 
26818
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/search-kind.js
27424
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/search/groups.js
27425
+ var ALL = "all";
27426
+ var OWNER_NOTES = { provider: "notes", account: INTERNAL_NOTES };
27427
+ var NOT_GROUP_NAMES = /* @__PURE__ */ new Set([ALL, "bots"]);
27428
+ var hasGroup = /* @__PURE__ */ __name((groups, name) => Object.hasOwn(groups, name), "hasGroup");
27429
+ var membersOf2 = /* @__PURE__ */ __name((entries, context2, unresolved) => {
27430
+ const members = /* @__PURE__ */ new Map();
27431
+ for (const entry of entries)
27432
+ try {
27433
+ for (const { provider, account } of accountsOfList(entry, context2)) {
27434
+ const known2 = members.get(keyOf({ provider, account }));
27435
+ if (known2)
27436
+ known2.entries.push(entry);
27437
+ else
27438
+ members.set(keyOf({ provider, account }), {
27439
+ provider,
27440
+ account,
27441
+ entries: [entry],
27442
+ reason: "setting",
27443
+ profiles: [],
27444
+ also_in: []
27445
+ });
27446
+ }
27447
+ } catch (error) {
27448
+ if (!(error instanceof CliError))
27449
+ throw error;
27450
+ unresolved.push(entry);
27451
+ }
27452
+ return [...members.values()];
27453
+ }, "membersOf");
27454
+ var groupMembership = /* @__PURE__ */ __name((context2) => {
27455
+ const plain2 = { ...context2, groups: {} };
27456
+ const unresolved = [];
27457
+ const groups = {};
27458
+ for (const [name, entries] of Object.entries(context2.groups))
27459
+ if (name !== ALL)
27460
+ groups[name] = membersOf2(entries, plain2, unresolved);
27461
+ const system = [OWNER_NOTES, ...context2.held.filter(({ id: id2 }) => id2 === 0)].map(keyOf);
27462
+ const every = accountsOfList(ALL, plain2).filter((one) => !system.includes(keyOf(one))).map(({ provider, account }) => ({
27463
+ provider,
27464
+ account,
27465
+ entries: [sourceOf2({ provider, account })],
27466
+ reason: "all",
27467
+ profiles: [],
27468
+ also_in: []
27469
+ }));
27470
+ const recorded = Object.entries(context2.profiles).flatMap(([app, named2]) => Object.entries(named2).map(([profile, key]) => ({ app, profile, key })));
27471
+ const holding3 = /* @__PURE__ */ new Map();
27472
+ for (const [name, members] of Object.entries(groups))
27473
+ for (const one of members)
27474
+ holding3.set(keyOf(one), [...holding3.get(keyOf(one)) ?? [], name]);
27475
+ for (const [name, members] of [...Object.entries(groups), [ALL, every]])
27476
+ for (const one of members) {
27477
+ one.profiles = recorded.filter(({ key }) => sameAs(key)(one)).map(({ app, profile }) => `${app} ${profile}`);
27478
+ one.also_in = (holding3.get(keyOf(one)) ?? []).filter((other) => other !== name);
27479
+ }
27480
+ const duplicates = [...holding3.entries()].filter(([, names2]) => names2.length > 1).map(([key, names2]) => ({ member: key.replace("\0", ":"), groups: names2 }));
27481
+ const shared = /* @__PURE__ */ __name((app, profile) => hasGroup(context2.groups, profile) || recorded.some((other) => other.app !== app && other.profile === profile), "shared");
27482
+ const suggested = recorded.filter(({ app, profile, key }) => isGroupName(profile) && !NOT_GROUP_NAMES.has(profile.toLowerCase()) && shared(app, profile) && !holding3.get(keyOf(key))?.includes(profile)).map(({ app, profile, key }) => ({
27483
+ group: profile,
27484
+ member: sourceOf2(key),
27485
+ because: `profile named ${profile} (${app} ${profile})`
27486
+ }));
27487
+ return { groups: { ...groups, [ALL]: every }, duplicates, suggested, unresolved };
27488
+ }, "groupMembership");
27489
+ var inGroupOf = /* @__PURE__ */ __name((context2, group) => (key) => group === ALL || (hasGroup(context2.membership.groups, group) ? context2.membership.groups[group] ?? [] : []).some(sameAs(key)), "inGroupOf");
27490
+ var groupEntries = /* @__PURE__ */ __name((saved) => ({
27491
+ ...Object.fromEntries(Object.entries(saved).filter(([name]) => name !== ALL)),
27492
+ [ALL]: [ALL]
27493
+ }), "groupEntries");
27494
+
27495
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/search-kind.js
26819
27496
  var NO_MAIL = "no_mail";
26820
27497
  var MAIL = "email";
26821
- var listContextOf = /* @__PURE__ */ __name(async (store, account, app, stored) => {
27498
+ var groupLockOf = /* @__PURE__ */ __name((app, env) => {
27499
+ const lock = app === void 0 || env === void 0 ? void 0 : env[envName(app, "GROUP_LOCK")]?.trim();
27500
+ return lock && lock.toLowerCase() !== ALL ? lock : void 0;
27501
+ }, "groupLockOf");
27502
+ var listContextOf = /* @__PURE__ */ __name(async (store, account, app, stored, env) => {
26822
27503
  const all = stored ?? await store.accounts.storedAccounts();
26823
27504
  const held = all.some((one) => one.provider === account.provider && one.account === account.account) ? all : [...all, { id: 0, ...account, name: null, scope: "personal" }];
26824
- return {
27505
+ const context2 = {
26825
27506
  held,
26826
27507
  groups: await store.accounts.accountGroups(),
26827
27508
  profiles: await store.accounts.profiles(),
26828
27509
  running: { provider: account.provider, ...app ? { command: app.command } : {} }
26829
27510
  };
27511
+ const membership = groupMembership(context2);
27512
+ const groups = groupEntries(context2.groups);
27513
+ const lock = groupLockOf(app, env);
27514
+ if (lock === void 0)
27515
+ return { ...context2, groups, membership };
27516
+ const members = hasGroup(membership.groups, lock) ? membership.groups[lock] : void 0;
27517
+ if (!members)
27518
+ throw new CliError("permission_error", `this process is locked to group ${lock} (${envName(app, "GROUP_LOCK")}), which does not exist`);
27519
+ const only = new Set([...members, OWNER_NOTES].map(keyOf));
27520
+ const listedAs = /* @__PURE__ */ __name((one) => isFolderProvider(one.provider) || isDocumentAccountProvider(one.provider) ? { provider: "notes", account: String(one.id) } : one, "listedAs");
27521
+ return {
27522
+ ...context2,
27523
+ held: held.filter((one) => only.has(keyOf(listedAs(one)))),
27524
+ groups: { [lock]: groups[lock] ?? [] },
27525
+ membership: {
27526
+ groups: { [lock]: members },
27527
+ duplicates: membership.duplicates.filter(({ groups: names2 }) => names2.includes(lock)),
27528
+ suggested: membership.suggested.filter(({ group }) => group === lock),
27529
+ unresolved: membership.unresolved
27530
+ },
27531
+ only
27532
+ };
26830
27533
  }, "listContextOf");
26831
- var listedAccounts = /* @__PURE__ */ __name(async (store, account, source, app, kind) => {
26832
- if (source === void 0)
27534
+ var listedAccounts = /* @__PURE__ */ __name(async (store, account, source, app, kind, env) => {
27535
+ const lock = groupLockOf(app, env);
27536
+ if (source === void 0 && lock === void 0)
26833
27537
  return void 0;
26834
27538
  const stored = await store.accounts.storedAccounts();
26835
- const registered = isKind(source) || providerNamed(source) !== void 0 && !stored.some(({ provider }) => provider === source);
26836
- if (!isAccountList(source) && !registered)
27539
+ const registered = source !== void 0 && (isKind(source) || providerNamed(source) !== void 0 && !stored.some(({ provider }) => provider === source));
27540
+ if (lock === void 0 && source !== void 0 && !isAccountList(source) && !registered)
26837
27541
  return void 0;
26838
- const entries = entriesOfList(source, await listContextOf(store, account, app, stored));
27542
+ const entries = entriesOfList(source ?? `group:${lock}`, await listContextOf(store, account, app, stored, env));
26839
27543
  return fitting(entries, kind ? [kind] : ["messages", "mail"], `${app ? `${app.command} ` : ""}search ${kind ?? "messages"}`);
26840
27544
  }, "listedAccounts");
26841
27545
  var accountsOfKind = /* @__PURE__ */ __name((kind, chosen, held, explicit, command = void 0, mailAccount, listed2 = false) => {
@@ -26862,7 +27566,7 @@ var accountsOfKind = /* @__PURE__ */ __name((kind, chosen, held, explicit, comma
26862
27566
  return chosenMail.map(({ provider, account }) => ({ provider, account }));
26863
27567
  }, "accountsOfKind");
26864
27568
 
26865
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/messages-search.js
27569
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/messages-search.js
26866
27570
  var MAIL_FIELDS = /* @__PURE__ */ new Set(["to", "cc", "bcc", "subject", "mailbox", "label", "is"]);
26867
27571
  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");
26868
27572
  var prepareLucene = /* @__PURE__ */ __name(async (store, account, request, messenger) => {
@@ -26896,7 +27600,7 @@ var prepareLucene = /* @__PURE__ */ __name(async (store, account, request, messe
26896
27600
  const sources = positiveSources(ast.root).map((value) => sourceOf("in:", value, providers2));
26897
27601
  for (const leaf of leaves.filter(({ field }) => field === "in"))
26898
27602
  sourceOf("in:", leaf.value, providers2);
26899
- const listed2 = await listedAccounts(store, account, request.source, messenger.app, request.kind);
27603
+ const listed2 = await listedAccounts(store, account, request.source, messenger.app, request.kind, messenger.env);
26900
27604
  const source = request.source === void 0 || listed2 ? void 0 : sourceOf("--source", request.source, providers2);
26901
27605
  if (request.accounts !== void 0 && (request.source !== void 0 || sources.length > 0))
26902
27606
  throw new CliError("validation_error", "this search reads the accounts it was given \u2014 not with in: or --source");
@@ -27184,10 +27888,10 @@ var statsLucene = /* @__PURE__ */ __name(async (store, account, request, messeng
27184
27888
  const groups = prepared.scopeAccounts.length ? await count4(prepared.execution, calendar ? "time" : by) : [];
27185
27889
  let rows;
27186
27890
  if (calendar) {
27187
- const keyOf6 = calendarKey(prepared.timezone, by);
27891
+ const keyOf8 = calendarKey(prepared.timezone, by);
27188
27892
  const totals = /* @__PURE__ */ new Map();
27189
27893
  for (const { id: id2, count: count5 } of groups) {
27190
- const key = keyOf6(Number(id2));
27894
+ const key = keyOf8(Number(id2));
27191
27895
  totals.set(key, (totals.get(key) ?? 0) + count5);
27192
27896
  }
27193
27897
  rows = [...totals].sort(([a], [b]) => a.localeCompare(b)).map(([key, count5]) => ({ key, name: null, count: count5 }));
@@ -27210,7 +27914,7 @@ var statsLucene = /* @__PURE__ */ __name(async (store, account, request, messeng
27210
27914
  };
27211
27915
  }, "statsLucene");
27212
27916
 
27213
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/rankings-selection.js
27917
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/rankings-selection.js
27214
27918
  var RANKING_SELECTION_BYTES = 64 * 1024;
27215
27919
  var object2 = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0, "object");
27216
27920
  function invalid3(message = "ranking selection is invalid \u2014 obtain a new drilldown from stats top") {
@@ -27379,7 +28083,7 @@ var readRankingSelection = /* @__PURE__ */ __name(async (store, input) => {
27379
28083
  };
27380
28084
  }, "readRankingSelection");
27381
28085
 
27382
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/search-record.js
28086
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/search-record.js
27383
28087
  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");
27384
28088
  var searchRecordOf = /* @__PURE__ */ __name((command, params) => ({
27385
28089
  command,
@@ -27389,7 +28093,7 @@ var searchRecordOf = /* @__PURE__ */ __name((command, params) => ({
27389
28093
  fieldsVersion: FIELD_VERSION
27390
28094
  }), "searchRecordOf");
27391
28095
 
27392
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/admin-statistics.js
28096
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/admin-statistics.js
27393
28097
  function invalid4(message) {
27394
28098
  throw new CliError("validation_error", message);
27395
28099
  }
@@ -27683,8 +28387,8 @@ var adminStatisticsService = /* @__PURE__ */ __name((deps) => ({
27683
28387
  }, "evidence")
27684
28388
  }), "adminStatisticsService");
27685
28389
 
27686
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/archive-gaps.js
27687
- import { createHash as createHash7, randomUUID as randomUUID4 } from "node:crypto";
28390
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/archive-gaps.js
28391
+ import { createHash as createHash7, randomUUID as randomUUID5 } from "node:crypto";
27688
28392
  var GAP_BOUNDS = { maxGaps: 5, limit: 500, timeMs: 3e4 };
27689
28393
  var validateRepair = /* @__PURE__ */ __name((messenger, options2) => {
27690
28394
  const maxGaps = options2.maxGaps ?? GAP_BOUNDS.maxGaps;
@@ -27743,7 +28447,7 @@ var gapsService = /* @__PURE__ */ __name((deps) => {
27743
28447
  if (options2.fingerprint !== void 0 && options2.fingerprint !== before2.fingerprint)
27744
28448
  throw new CliError("validation_error", "the gap plan changed; inspect it again before repairing");
27745
28449
  const store = await deps.store();
27746
- const holder = randomUUID4();
28450
+ const holder = randomUUID5();
27747
28451
  if (!await store.sync.claim(before2.account, before2.chat, "gaps", holder, timeMs + 5e3))
27748
28452
  throw new CliError("validation_error", "another gap repair holds this chat; retry after it finishes");
27749
28453
  const started = Date.now();
@@ -27820,14 +28524,14 @@ var gapsService = /* @__PURE__ */ __name((deps) => {
27820
28524
  return { plan, repair };
27821
28525
  }, "gapsService");
27822
28526
 
27823
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/attachments.js
28527
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/attachments.js
27824
28528
  import { createHash as createHash9 } from "node:crypto";
27825
- import { constants as constants2, mkdirSync as mkdirSync2 } from "node:fs";
28529
+ import { constants as constants2, mkdirSync as mkdirSync5 } from "node:fs";
27826
28530
  import { lstat as lstat4, open as open6, readFile, stat as stat2 } from "node:fs/promises";
27827
28531
 
27828
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/attachments/directory.js
28532
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/attachments/directory.js
27829
28533
  import { lstat as lstat2, readdir as readdir2, realpath as realpath3 } from "node:fs/promises";
27830
- import { basename as basename4, join as join9, relative as relative2, sep as sep2 } from "node:path";
28534
+ import { basename as basename4, join as join13, relative as relative2, sep as sep2 } from "node:path";
27831
28535
  var MAX_FILES = 1e4;
27832
28536
  var directoryPaths = /* @__PURE__ */ __name(async (store, chat, directory2, app, env) => {
27833
28537
  if (refusedPlace(directory2, app, env))
@@ -27842,7 +28546,7 @@ var directoryPaths = /* @__PURE__ */ __name(async (store, chat, directory2, app,
27842
28546
  throw new CliError("validation_error", "--from-dir holds too many files; use a smaller directory");
27843
28547
  const files = /* @__PURE__ */ new Map();
27844
28548
  for (const name of names2) {
27845
- const path = join9(root, name);
28549
+ const path = join13(root, name);
27846
28550
  const info = await lstat2(path);
27847
28551
  if (info.isSymbolicLink())
27848
28552
  throw new CliError("validation_error", "--from-dir cannot read symbolic links");
@@ -27896,15 +28600,15 @@ var directoryPaths = /* @__PURE__ */ __name(async (store, chat, directory2, app,
27896
28600
  return choices;
27897
28601
  }, "directoryPaths");
27898
28602
 
27899
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/attachments/documents.js
28603
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/attachments/documents.js
27900
28604
  import { posix } from "node:path";
27901
28605
 
27902
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/attachments/container.js
28606
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/attachments/container.js
27903
28607
  import { setImmediate as tick } from "node:timers/promises";
27904
28608
  import { crc32 } from "node:zlib";
27905
28609
  var import_xmldom = __toESM(require_lib(), 1);
27906
28610
 
27907
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/attachments/encoding.js
28611
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/attachments/encoding.js
27908
28612
  var import_chardet = __toESM(require_lib2(), 1);
27909
28613
  var import_iconv_lite = __toESM(require_lib3(), 1);
27910
28614
  var SAMPLE = 65536;
@@ -28006,7 +28710,7 @@ var decodeXml = /* @__PURE__ */ __name((bytes2) => {
28006
28710
  return result.text;
28007
28711
  }, "decodeXml");
28008
28712
 
28009
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/attachments/container.js
28713
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/attachments/container.js
28010
28714
  var MAX_PART = 10 * 1024 * 1024;
28011
28715
  var MAX_ENTRIES = 1e3;
28012
28716
  var decoder = new TextDecoder("utf-8", { fatal: true });
@@ -28221,7 +28925,7 @@ var elements = /* @__PURE__ */ __name((node, name, namespace) => {
28221
28925
  return found;
28222
28926
  }, "elements");
28223
28927
 
28224
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/attachments/sheets.js
28928
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/attachments/sheets.js
28225
28929
  var columnName = /* @__PURE__ */ __name((column) => {
28226
28930
  let name = "";
28227
28931
  for (let rest = column; rest > 0; rest = Math.floor((rest - 1) / 26))
@@ -28276,7 +28980,7 @@ var sheetText = /* @__PURE__ */ __name((sheets2, maxChars = MAX_TEXT_CHARS) => {
28276
28980
  return { text: parts.join("").trim(), truncated: false };
28277
28981
  }, "sheetText");
28278
28982
 
28279
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/attachments/documents.js
28983
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/attachments/documents.js
28280
28984
  var OFFICE = "urn:oasis:names:tc:opendocument:xmlns:office:1.0";
28281
28985
  var TEXT = "urn:oasis:names:tc:opendocument:xmlns:text:1.0";
28282
28986
  var TABLE = "urn:oasis:names:tc:opendocument:xmlns:table:1.0";
@@ -28676,27 +29380,27 @@ var readDocument = /* @__PURE__ */ __name(async (bytes2, kind, signal) => {
28676
29380
  }
28677
29381
  }, "readDocument");
28678
29382
 
28679
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/attachments/extract.js
29383
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/attachments/extract.js
28680
29384
  import { extname as extname3 } from "node:path";
28681
29385
 
28682
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/readers/engine.js
28683
- import { readFileSync as readFileSync2 } from "node:fs";
28684
- import { dirname as dirname4, extname as extname2, join as join10 } from "node:path";
29386
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/readers/engine.js
29387
+ import { readFileSync as readFileSync5 } from "node:fs";
29388
+ import { dirname as dirname7, extname as extname2, join as join14 } from "node:path";
28685
29389
  import { fileURLToPath } from "node:url";
28686
29390
  var BUILT_IN = ["unpdf", "mammoth", "word-extractor", "linkedom", "defuddle/node"];
28687
29391
  var ENGINES = [...BUILT_IN, "@napi-rs/canvas"];
28688
29392
  var isMissing = /* @__PURE__ */ __name((error, name) => error?.code === "ERR_MODULE_NOT_FOUND" && String(error.message).includes(name), "isMissing");
28689
29393
  var versionOf = /* @__PURE__ */ __name((name) => {
28690
29394
  try {
28691
- let directory2 = dirname4(fileURLToPath(resolveFrom(new URL("readers/engine.js", import.meta.resolve("@wirecat/cli-core")).href, name)));
29395
+ let directory2 = dirname7(fileURLToPath(resolveFrom(new URL("readers/engine.js", import.meta.resolve("@wirecat/cli-core")).href, name)));
28692
29396
  for (let depth = 0; depth < 6; depth += 1) {
28693
29397
  try {
28694
- const manifest = JSON.parse(readFileSync2(join10(directory2, "package.json"), "utf8"));
29398
+ const manifest = JSON.parse(readFileSync5(join14(directory2, "package.json"), "utf8"));
28695
29399
  if (manifest.name === name && manifest.version)
28696
29400
  return `${name}@${manifest.version}`;
28697
29401
  } catch {
28698
29402
  }
28699
- directory2 = dirname4(directory2);
29403
+ directory2 = dirname7(directory2);
28700
29404
  }
28701
29405
  } catch {
28702
29406
  }
@@ -28740,7 +29444,7 @@ var derived = /* @__PURE__ */ __name((bytes2, extractor, read) => {
28740
29444
  }
28741
29445
  }, "derived");
28742
29446
 
28743
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/readers/image/index.js
29447
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/readers/image/index.js
28744
29448
  var IMAGES = /* @__PURE__ */ new Set([".jpg", ".jpeg", ".png", ".webp", ".gif", ".heic", ".tif", ".tiff", ".bmp"]);
28745
29449
  var image2 = {
28746
29450
  id: "image",
@@ -28749,7 +29453,7 @@ var image2 = {
28749
29453
  read: /* @__PURE__ */ __name(async () => ({ status: "needs-agent" }), "read")
28750
29454
  };
28751
29455
 
28752
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/readers/doc/index.js
29456
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/readers/doc/index.js
28753
29457
  var OLE = "\xD0\xCF\xE0\xA1\xB1\xE1";
28754
29458
  var doc = {
28755
29459
  id: "doc",
@@ -28761,7 +29465,7 @@ var doc = {
28761
29465
  }), "read")
28762
29466
  };
28763
29467
 
28764
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/readers/docx/index.js
29468
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/readers/docx/index.js
28765
29469
  var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
28766
29470
  var docx = {
28767
29471
  id: "docx",
@@ -28774,7 +29478,7 @@ var docx = {
28774
29478
  }), "read")
28775
29479
  };
28776
29480
 
28777
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/attachments/markup.js
29481
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/attachments/markup.js
28778
29482
  var import_iconv_lite2 = __toESM(require_lib3(), 1);
28779
29483
  var RTF_SKIPPED = /* @__PURE__ */ new Set([
28780
29484
  "fonttbl",
@@ -28950,7 +29654,7 @@ var htmlText = /* @__PURE__ */ __name((source) => {
28950
29654
  }, "htmlText");
28951
29655
  var safeChar = /* @__PURE__ */ __name((code, fallback) => code > 0 && code <= 1114111 ? String.fromCodePoint(code) : fallback, "safeChar");
28952
29656
 
28953
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/readers/html/page.js
29657
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/readers/html/page.js
28954
29658
  var clean = /* @__PURE__ */ __name((value) => typeof value === "string" ? value.replace(/\s+/g, " ").trim() : "", "clean");
28955
29659
  var namesIn = /* @__PURE__ */ __name((value) => [value].flat().map((entry) => typeof entry === "string" ? clean(entry) : clean(entry?.name)).filter(Boolean).join(", "), "namesIn");
28956
29660
  var jsonLdNodes = /* @__PURE__ */ __name((document) => {
@@ -29006,7 +29710,7 @@ var markdownSections = /* @__PURE__ */ __name((text2) => {
29006
29710
  return found.map((section, index) => ({ ...section, end: found[index + 1]?.start ?? text2.length }));
29007
29711
  }, "markdownSections");
29008
29712
 
29009
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/readers/html/index.js
29713
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/readers/html/index.js
29010
29714
  var HTML = /* @__PURE__ */ new Set([".html", ".htm", ".xhtml"]);
29011
29715
  var first = /* @__PURE__ */ __name((...values) => values.find((value) => typeof value === "string" && value !== ""), "first");
29012
29716
  var loaded = /* @__PURE__ */ __name(async (load, name) => {
@@ -29077,7 +29781,7 @@ var html = {
29077
29781
  }, "read")
29078
29782
  };
29079
29783
 
29080
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/readers/office/index.js
29784
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/readers/office/index.js
29081
29785
  var office = {
29082
29786
  id: "office",
29083
29787
  version: documentExtractor("odt"),
@@ -29088,7 +29792,7 @@ var office = {
29088
29792
  }, "read")
29089
29793
  };
29090
29794
 
29091
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/readers/pdf/index.js
29795
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/readers/pdf/index.js
29092
29796
  var pdf = {
29093
29797
  id: "pdf",
29094
29798
  version: "unpdf",
@@ -29155,7 +29859,7 @@ var pdf = {
29155
29859
  }), "read")
29156
29860
  };
29157
29861
 
29158
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/readers/plain/index.js
29862
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/readers/plain/index.js
29159
29863
  var PLAIN = /* @__PURE__ */ new Set([".txt", ".md", ".markdown", ".csv", ".tsv", ".json", ".log"]);
29160
29864
  var isPlain = /* @__PURE__ */ __name((hint) => PLAIN.has(extensionOf(hint)) || hint.mime?.startsWith("text/") || hint.mime === "application/json", "isPlain");
29161
29865
  var readPlain = /* @__PURE__ */ __name((bytes2) => {
@@ -29175,7 +29879,7 @@ var plain = {
29175
29879
  read: /* @__PURE__ */ __name(async (bytes2) => readPlain(bytes2), "read")
29176
29880
  };
29177
29881
 
29178
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/readers/rtf/index.js
29882
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/readers/rtf/index.js
29179
29883
  var rtf = {
29180
29884
  id: "rtf",
29181
29885
  version: "v1",
@@ -29183,10 +29887,10 @@ var rtf = {
29183
29887
  read: /* @__PURE__ */ __name(async (bytes2) => derived(bytes2, "rtf:v1", rtfText), "read")
29184
29888
  };
29185
29889
 
29186
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
29890
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
29187
29891
  import { basename as basename5 } from "node:path";
29188
29892
 
29189
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/attachments/csv-spans.js
29893
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/attachments/csv-spans.js
29190
29894
  var delimitedSpans = /* @__PURE__ */ __name((text2, delimiter, maxCells = 1e4) => {
29191
29895
  const cells = [];
29192
29896
  let row = 1, column = 1, start = 0, quoted = false, truncated = false;
@@ -29224,7 +29928,7 @@ var delimitedSpans = /* @__PURE__ */ __name((text2, delimiter, maxCells = 1e4) =
29224
29928
  return { cells, truncated };
29225
29929
  }, "delimitedSpans");
29226
29930
 
29227
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
29931
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
29228
29932
  var DELIMITED = {
29229
29933
  ".csv": ",",
29230
29934
  ".tsv": " ",
@@ -29263,7 +29967,7 @@ var sheets = {
29263
29967
  }, "read")
29264
29968
  };
29265
29969
 
29266
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/readers/registry.js
29970
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/readers/registry.js
29267
29971
  var BUILT_INS2 = [office, pdf, docx, doc, rtf, html, sheets, plain, image2];
29268
29972
  var HEAD_BYTES = 1024;
29269
29973
  var readers = [...BUILT_INS2];
@@ -29273,7 +29977,7 @@ var readWithRegistry = /* @__PURE__ */ __name(async (bytes2, hint, context2) =>
29273
29977
  return reader ? reader.read(bytes2, hint, context2) : { status: "unsupported" };
29274
29978
  }, "readWithRegistry");
29275
29979
 
29276
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/attachments/extract.js
29980
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/attachments/extract.js
29277
29981
  var importEngine = /* @__PURE__ */ __name((name) => importFrom(new URL("attachments/extract.js", import.meta.resolve("@wirecat/cli-core")).href, name), "importEngine");
29278
29982
  var extensionOf2 = /* @__PURE__ */ __name(({ name, path }) => extname3(name ?? path).toLowerCase(), "extensionOf");
29279
29983
  var extractText = /* @__PURE__ */ __name(async (bytes2, hint, load, signal, env = process.env) => {
@@ -30352,7 +31056,7 @@ function imageSize(input) {
30352
31056
  }
30353
31057
  __name(imageSize, "imageSize");
30354
31058
 
30355
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/attachments/ocr.js
31059
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/attachments/ocr.js
30356
31060
  var MAX_PAGES = 20;
30357
31061
  var MAX_PIXELS = 2e7;
30358
31062
  var cancelled2 = /* @__PURE__ */ __name((signal) => {
@@ -30503,7 +31207,7 @@ var ocrPdf = /* @__PURE__ */ __name(async (bytes2, pipeline2, load, signal) => {
30503
31207
  }
30504
31208
  }, "ocrPdf");
30505
31209
 
30506
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/attachments/pdf-preview.js
31210
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/attachments/pdf-preview.js
30507
31211
  var pdfPreview = /* @__PURE__ */ __name(async (bytes2, page, signal, load = importEngine, env = process.env) => {
30508
31212
  const limits = pdfPreviewLimits(env);
30509
31213
  const cancelled4 = /* @__PURE__ */ __name(() => {
@@ -30580,7 +31284,7 @@ var pdfPreview = /* @__PURE__ */ __name(async (bytes2, page, signal, load = impo
30580
31284
  }
30581
31285
  }, "pdfPreview");
30582
31286
 
30583
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/attachments/transfer.js
31287
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/attachments/transfer.js
30584
31288
  import { createHash as createHash8 } from "node:crypto";
30585
31289
  import { constants } from "node:fs";
30586
31290
  import { lstat as lstat3, open as open5 } from "node:fs/promises";
@@ -30688,10 +31392,10 @@ var transferMime = /* @__PURE__ */ __name((head, hint, name = null) => {
30688
31392
  return hint !== null && /^[a-z0-9.+-]+\/[a-z0-9.+-]+$/i.test(hint) ? hint : "application/octet-stream";
30689
31393
  }, "transferMime");
30690
31394
 
30691
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/file-download.js
30692
- import { createWriteStream, mkdirSync } from "node:fs";
31395
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/file-download.js
31396
+ import { createWriteStream, mkdirSync as mkdirSync4 } from "node:fs";
30693
31397
  import { link as link3, rm } from "node:fs/promises";
30694
- import { join as join11, resolve as resolve6 } from "node:path";
31398
+ import { join as join15, resolve as resolve6 } from "node:path";
30695
31399
  import { Readable, Transform } from "node:stream";
30696
31400
  import { pipeline } from "node:stream/promises";
30697
31401
  var refreshedFiles = /* @__PURE__ */ __name((files) => files.flatMap(({ kind, name, position, providerRef }) => providerRef === void 0 || Object.keys(providerRef).length === 0 ? [] : [
@@ -30723,7 +31427,7 @@ var recordPaths = /* @__PURE__ */ __name(async (messages, chat, message, files,
30723
31427
  }, "recordPaths");
30724
31428
  var downloadMessage = /* @__PURE__ */ __name(async (messages, chat, message, output, warn) => {
30725
31429
  const { files } = await messages.download(chat, message);
30726
- mkdirSync(output, { recursive: true });
31430
+ mkdirSync4(output, { recursive: true });
30727
31431
  const result = await saveFiles(messages, chat, message, files, output, { unique: true, warn });
30728
31432
  if (result.batch.failed > 0)
30729
31433
  throw new CliError("provider_error", "some attachments failed; completed downloads are retained", {
@@ -30771,7 +31475,7 @@ var save = /* @__PURE__ */ __name(async (file2, directory2, fallbackName, { uniq
30771
31475
  const extension = EXTENSIONS[file2.mime ?? ""] ?? BY_KIND[file2.kind];
30772
31476
  return own ?? (extension ? `${fallbackName}.${extension}` : fallbackName);
30773
31477
  }, "fileName");
30774
- const partial = join11(directory2, `.${fileName()}.${process.pid}.part`);
31478
+ const partial = join15(directory2, `.${fileName()}.${process.pid}.part`);
30775
31479
  let bytes2 = 0;
30776
31480
  const counting = new Transform({
30777
31481
  transform(chunk, _encoding, done2) {
@@ -30784,16 +31488,16 @@ var save = /* @__PURE__ */ __name(async (file2, directory2, fallbackName, { uniq
30784
31488
  const name = fileName();
30785
31489
  const names2 = unique && own ? [name, `${fallbackName}-${own}`] : [name];
30786
31490
  for (const candidate of names2) {
30787
- const path2 = resolve6(join11(directory2, candidate));
30788
- const taken = await link3(partial, path2).then(() => false, (error) => {
31491
+ const path2 = resolve6(join15(directory2, candidate));
31492
+ const taken2 = await link3(partial, path2).then(() => false, (error) => {
30789
31493
  if (error.code === "EEXIST")
30790
31494
  return true;
30791
31495
  throw error;
30792
31496
  });
30793
- if (!taken)
31497
+ if (!taken2)
30794
31498
  return { kind: file2.kind, path: path2, bytes: bytes2 };
30795
31499
  }
30796
- const path = resolve6(join11(directory2, names2.at(-1) ?? name));
31500
+ const path = resolve6(join15(directory2, names2.at(-1) ?? name));
30797
31501
  if (unique)
30798
31502
  return { kind: file2.kind, path, bytes: bytes2, existing: true };
30799
31503
  throw new CliError("validation_error", `${path} already exists \u2014 nothing was overwritten; choose --output-dir`);
@@ -30802,7 +31506,7 @@ var save = /* @__PURE__ */ __name(async (file2, directory2, fallbackName, { uniq
30802
31506
  }
30803
31507
  }, "save");
30804
31508
 
30805
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/attachments.js
31509
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/attachments.js
30806
31510
  var ATTACHMENT_QUERY = {
30807
31511
  entity: "attachment",
30808
31512
  backend: "sql",
@@ -31184,7 +31888,7 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
31184
31888
  throw new CliError("validation_error", "the saved attachment must be a regular file");
31185
31889
  return { file: file2, path: file2.localPath };
31186
31890
  }));
31187
- mkdirSync2(output, { recursive: true });
31891
+ mkdirSync5(output, { recursive: true });
31188
31892
  const saved = [];
31189
31893
  for (const { file: file2, path } of held)
31190
31894
  saved.push(await save({
@@ -31225,7 +31929,7 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
31225
31929
  }, "setText")
31226
31930
  }), "attachmentsService");
31227
31931
 
31228
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/chat-documents.js
31932
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/chat-documents.js
31229
31933
  var chatDocumentsService = /* @__PURE__ */ __name((deps) => ({
31230
31934
  list: /* @__PURE__ */ __name(async (chat, { limit, offset, ref }) => {
31231
31935
  const store = await accountStore(deps);
@@ -31255,7 +31959,7 @@ var chatDocumentsService = /* @__PURE__ */ __name((deps) => ({
31255
31959
  }, "list")
31256
31960
  }), "chatDocumentsService");
31257
31961
 
31258
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/retention.js
31962
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/retention.js
31259
31963
  var observationDuration = /* @__PURE__ */ __name((text2, flag) => {
31260
31964
  const match = /^(\d+(?:\.\d+)?)([smhdw])$/.exec(text2);
31261
31965
  const units2 = { s: 1e3, m: 6e4, h: 36e5, d: 864e5, w: 6048e5 };
@@ -31342,7 +32046,7 @@ var isRetentionSelection = /* @__PURE__ */ __name((selection) => {
31342
32046
  }
31343
32047
  }, "isRetentionSelection");
31344
32048
 
31345
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/counters.js
32049
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/counters.js
31346
32050
  var counterFields = /* @__PURE__ */ __name((text2 = "views,reactions,comments") => {
31347
32051
  const fields = text2.split(",").map((one) => one.trim());
31348
32052
  if (!fields.length || fields.some((one) => !COUNTER_FIELDS.includes(one)) || new Set(fields).size !== fields.length)
@@ -31549,10 +32253,10 @@ var countersService = /* @__PURE__ */ __name((deps) => {
31549
32253
  };
31550
32254
  }, "countersService");
31551
32255
 
31552
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/search-refresh.js
32256
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/search-refresh.js
31553
32257
  var SYNC_KEY = "messages.sync-first";
31554
32258
  var SYNC_BOUNDS = { maxChats: 5, timeMs: 3e4, maxMessages: 500 };
31555
- var keyOf2 = /* @__PURE__ */ __name((chat) => JSON.stringify([chat.account.provider, chat.account.account, chat.chatId]), "keyOf");
32259
+ var keyOf3 = /* @__PURE__ */ __name((chat) => JSON.stringify([chat.account.provider, chat.account.account, chat.chatId]), "keyOf");
31556
32260
  var sameAccount2 = /* @__PURE__ */ __name((one, other) => one.provider === other.provider && one.account === other.account, "sameAccount");
31557
32261
  var chatScope = /* @__PURE__ */ __name((node) => {
31558
32262
  if (node.kind === "predicate")
@@ -31560,7 +32264,7 @@ var chatScope = /* @__PURE__ */ __name((node) => {
31560
32264
  const required2 = node.clauses.filter(({ occur }) => occur === "must").map(({ node: node2 }) => chatScope(node2));
31561
32265
  const bounded = required2.filter((scope) => scope !== void 0);
31562
32266
  if (bounded.length)
31563
- return bounded.reduce((one, other) => one.filter((chat) => other.some((at) => keyOf2(at) === keyOf2(chat))));
32267
+ return bounded.reduce((one, other) => one.filter((chat) => other.some((at) => keyOf3(at) === keyOf3(chat))));
31564
32268
  const optional2 = node.clauses.filter(({ occur }) => occur === "should").map(({ node: node2 }) => chatScope(node2));
31565
32269
  if (!optional2.length || optional2.some((scope) => scope === void 0))
31566
32270
  return void 0;
@@ -31568,7 +32272,7 @@ var chatScope = /* @__PURE__ */ __name((node) => {
31568
32272
  }, "chatScope");
31569
32273
  var matchesChat = /* @__PURE__ */ __name((node, chat) => {
31570
32274
  if (node.kind === "predicate")
31571
- return node.resolution?.chat ? keyOf2(node.resolution.chat) === keyOf2(chat) : void 0;
32275
+ return node.resolution?.chat ? keyOf3(node.resolution.chat) === keyOf3(chat) : void 0;
31572
32276
  const must = node.clauses.filter(({ occur }) => occur === "must").map(({ node: node2 }) => matchesChat(node2, chat));
31573
32277
  const excluded = node.clauses.filter(({ occur }) => occur === "must_not").map(({ node: node2 }) => matchesChat(node2, chat));
31574
32278
  if (must.includes(false) || excluded.includes(true))
@@ -31620,7 +32324,7 @@ var refreshSearch = /* @__PURE__ */ __name(async (deps, request) => {
31620
32324
  candidates.push(chat);
31621
32325
  }
31622
32326
  const eligible = candidates.filter((chat) => matchesChat(execution.root, chat) !== false);
31623
- const unique = [...new Map(eligible.map((chat) => [keyOf2(chat), chat])).values()];
32327
+ const unique = [...new Map(eligible.map((chat) => [keyOf3(chat), chat])).values()];
31624
32328
  if (unique.length > options2.maxChats)
31625
32329
  result.complete = false;
31626
32330
  const controller = new AbortController();
@@ -31681,7 +32385,7 @@ var withRefresh = /* @__PURE__ */ __name((found, refreshed) => ({
31681
32385
  ...!refreshed || refreshed.complete ? {} : { coverage: { ...found.coverage, state: "stale" } }
31682
32386
  }), "withRefresh");
31683
32387
 
31684
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/embeddings-search.js
32388
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/embeddings-search.js
31685
32389
  var CANDIDATES = 50;
31686
32390
  var WORD_HITS = 200;
31687
32391
  var RRF_K = 60;
@@ -31799,7 +32503,7 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
31799
32503
  }, deps.messenger);
31800
32504
  const eligibility = filter === void 0 ? void 0 : await store.queries.conversationEligibility(prepared.execution);
31801
32505
  const selected = prepared.selectedChat;
31802
- const scopeOf4 = /* @__PURE__ */ __name((one) => selected ? selected.account.provider === one.provider && selected.account.account === one.account ? { chatId: selected.chatId } : null : {}, "scopeOf");
32506
+ const scopeOf5 = /* @__PURE__ */ __name((one) => selected ? selected.account.provider === one.provider && selected.account.account === one.account ? { chatId: selected.chatId } : null : {}, "scopeOf");
31803
32507
  const words3 = await byWords(query, prepared, eligibility?.conversations, since);
31804
32508
  const meaning = [];
31805
32509
  const sources = words3.sources;
@@ -31807,7 +32511,7 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
31807
32511
  await withEmbedder(deps, target2, choice, {}, async (embedder) => {
31808
32512
  const [vector] = await embedder.embed([query], "query");
31809
32513
  for (const one of prepared.scopeAccounts) {
31810
- const scope = scopeOf4(one);
32514
+ const scope = scopeOf5(one);
31811
32515
  if (scope === null)
31812
32516
  continue;
31813
32517
  const hits = await store.vectors.nearestConversations(one, {
@@ -31841,7 +32545,7 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
31841
32545
  const scoped = [];
31842
32546
  const elsewhere = [];
31843
32547
  for (const one of prepared.scopeAccounts) {
31844
- const scope = scopeOf4(one);
32548
+ const scope = scopeOf5(one);
31845
32549
  if (scope === null)
31846
32550
  continue;
31847
32551
  const eligibleChats = eligibility?.chats.filter(({ account: account2 }) => account2.provider === one.provider && account2.account === one.account).map(({ chat: chat2 }) => chat2);
@@ -31956,13 +32660,13 @@ var meanOf = /* @__PURE__ */ __name((vectors) => {
31956
32660
  return mean2.map((value) => value / length);
31957
32661
  }, "meanOf");
31958
32662
 
31959
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/embeddings.js
32663
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/embeddings.js
31960
32664
  var embeddingsService = /* @__PURE__ */ __name((deps) => ({
31961
32665
  ...embeddingsMaintenance(deps),
31962
32666
  ...embeddingsSearch(deps)
31963
32667
  }), "embeddingsService");
31964
32668
 
31965
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/folders.js
32669
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/folders.js
31966
32670
  var foldersService = /* @__PURE__ */ __name((deps) => {
31967
32671
  const online = /* @__PURE__ */ __name(async (command) => {
31968
32672
  if (deps.offline)
@@ -32095,15 +32799,15 @@ var foldersService = /* @__PURE__ */ __name((deps) => {
32095
32799
  if (link4.trim() === "")
32096
32800
  throw new CliError("validation_error", "give the folder's link");
32097
32801
  const connection = await online("chats folders join");
32098
- const join13 = capability(connection, "joinFolder", "join a shared folder");
32802
+ const join17 = capability(connection, "joinFolder", "join a shared folder");
32099
32803
  const operationId = newOperationId();
32100
- const folder = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "account", action: "folder-join" }, () => join13(link4.trim()));
32804
+ const folder = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "account", action: "folder-join" }, () => join17(link4.trim()));
32101
32805
  return { operationId, folder };
32102
32806
  }, "join")
32103
32807
  };
32104
32808
  }, "foldersService");
32105
32809
 
32106
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/mentions.js
32810
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/mentions.js
32107
32811
  var REVIEW_COUNT = 500;
32108
32812
  var mentionsService = /* @__PURE__ */ __name((deps) => {
32109
32813
  const located = /* @__PURE__ */ __name(async () => {
@@ -32182,7 +32886,7 @@ var mentionsService = /* @__PURE__ */ __name((deps) => {
32182
32886
  };
32183
32887
  }, "mentionsService");
32184
32888
 
32185
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/domain/message-link.js
32889
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/domain/message-link.js
32186
32890
  var fileLinks = /* @__PURE__ */ __name((attachments) => hitFiles(attachments).map(({ position, kind, name }) => ({
32187
32891
  position,
32188
32892
  kind,
@@ -32231,7 +32935,7 @@ var validatePermalink = /* @__PURE__ */ __name((link4) => {
32231
32935
  return { url: link4.url, access: link4.access, reason: link4.reason };
32232
32936
  }, "validatePermalink");
32233
32937
 
32234
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/domain/pin-duration.js
32938
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/domain/pin-duration.js
32235
32939
  var spokenSeconds = /* @__PURE__ */ __name((seconds) => {
32236
32940
  if (seconds % 86400 === 0 && seconds > 86400)
32237
32941
  return `${seconds / 86400}d`;
@@ -32263,7 +32967,7 @@ var pinDurationOf = /* @__PURE__ */ __name((value, allowed, flag = "--expire-tim
32263
32967
  return seconds;
32264
32968
  }, "pinDurationOf");
32265
32969
 
32266
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/sends/send-as.js
32970
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/sends/send-as.js
32267
32971
  var sendAsCheck = /* @__PURE__ */ __name((connection, sendAs) => {
32268
32972
  if (sendAs === void 0) {
32269
32973
  const saved = connection.savedSender?.bind(connection);
@@ -32288,7 +32992,7 @@ var typedSendAs = /* @__PURE__ */ __name((typed) => {
32288
32992
  return sendAs;
32289
32993
  }, "typedSendAs");
32290
32994
 
32291
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/search/total.js
32995
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/search/total.js
32292
32996
  var TOTAL_CAP = 1e4;
32293
32997
  var totalOf = /* @__PURE__ */ __name((count4, shown, hasMore, exact = true) => {
32294
32998
  const least = shown + (hasMore ? 1 : 0);
@@ -32299,7 +33003,7 @@ var totalOf = /* @__PURE__ */ __name((count4, shown, hasMore, exact = true) => {
32299
33003
  return { value: count4, relation: exact ? "eq" : "gte" };
32300
33004
  }, "totalOf");
32301
33005
 
32302
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/search/lucene/meaning-parts.js
33006
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/search/lucene/meaning-parts.js
32303
33007
  var WORD_FIELDS = /* @__PURE__ */ new Set(["text", "exact"]);
32304
33008
  var fieldsOfQuery = /* @__PURE__ */ __name((root, everything) => {
32305
33009
  let narrows = false;
@@ -32328,7 +33032,7 @@ var meaningWords = /* @__PURE__ */ __name((root) => {
32328
33032
  return wanted(root).join(" ").trim();
32329
33033
  }, "meaningWords");
32330
33034
 
32331
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/search/question-plan.js
33035
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/search/question-plan.js
32332
33036
  var words2 = /* @__PURE__ */ __name((text2) => normalize(text2).match(/[\p{L}\p{N}]+/gu) ?? [], "words");
32333
33037
  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"));
32334
33038
  var questionWord = /\b(?:what|which|how|who|where|when|can|could|should)\b|(?:^|\s)(?:сколько|какой|какая|какие|какое|кто|кому|кем|где|когда|как|что|можно|может|могут|ли)(?:\s|$)/iu;
@@ -32461,7 +33165,7 @@ var questionLookup = /* @__PURE__ */ __name((text2) => {
32461
33165
  return terms.length ? anyOfTerms(terms, plan.scope) : void 0;
32462
33166
  }, "questionLookup");
32463
33167
 
32464
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/messages-combined.js
33168
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/messages-combined.js
32465
33169
  var COMBINED_DEFAULTS = { candidateDepth: 300, rrfK: 60, rerank: "all", chatCap: 0 };
32466
33170
  var tokensOf = /* @__PURE__ */ __name((text2) => normalize(text2).match(/[\p{L}\p{N}\p{Co}\p{M}]+/gu) ?? [], "tokensOf");
32467
33171
  var searchCombined = /* @__PURE__ */ __name(async (store, account, request, messenger = {}, options2 = COMBINED_DEFAULTS) => {
@@ -32654,7 +33358,7 @@ var signals = /* @__PURE__ */ __name((hit, terms, corrections, execution, mode,
32654
33358
  return mode === "coverage" ? coverage2 * 4 : mode === "proximity" ? proximity : mode === "phrase" ? phrase : coverage2 * 4 + proximity + phrase;
32655
33359
  }, "signals");
32656
33360
 
32657
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/messages-discovery.js
33361
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/messages-discovery.js
32658
33362
  var MEANING_DEPTH = 100;
32659
33363
  var RRF_K2 = 60;
32660
33364
  var RERANK_DEPTH = 50;
@@ -32925,17 +33629,17 @@ var filterPks = /* @__PURE__ */ __name(async (store, account, request, messenger
32925
33629
  return pks === void 0 || pks.length > RANK_WITHIN_MESSAGES ? void 0 : pks;
32926
33630
  }, "filterPks");
32927
33631
  var nearEligible = /* @__PURE__ */ __name(async (store, account, request, messenger, ranked, scope) => {
32928
- const keyOf6 = /* @__PURE__ */ __name((one) => JSON.stringify([one.provider, one.account, one.chatId, one.id]), "keyOf");
32929
- const only = ranked.slice(0, MEANING_DEPTH).filter((m) => !request.only || request.only.some((key) => keyOf6(key) === keyOf6(m))).map(({ provider, account: account2, chatId, id: id2 }) => ({ provider, account: account2, chatId, id: id2 }));
33632
+ const keyOf8 = /* @__PURE__ */ __name((one) => JSON.stringify([one.provider, one.account, one.chatId, one.id]), "keyOf");
33633
+ const only = ranked.slice(0, MEANING_DEPTH).filter((m) => !request.only || request.only.some((key) => keyOf8(key) === keyOf8(m))).map(({ provider, account: account2, chatId, id: id2 }) => ({ provider, account: account2, chatId, id: id2 }));
32930
33634
  if (!only.length)
32931
33635
  return [];
32932
33636
  const eligible = await searchLucene(store, account, { ...request, text: void 0, ast: void 0, ...scope, limit: only.length, only, context: 0, thread: void 0 }, messenger);
32933
33637
  const hits = new Map(eligible.items.map((hit) => {
32934
33638
  const { provider, account: account2 } = parseLocator(hit.locator);
32935
- return [keyOf6({ provider, account: account2, chatId: hit.chatId, id: hit.id }), hit];
33639
+ return [keyOf8({ provider, account: account2, chatId: hit.chatId, id: hit.id }), hit];
32936
33640
  }));
32937
33641
  return ranked.flatMap((m) => {
32938
- const hit = hits.get(keyOf6(m));
33642
+ const hit = hits.get(keyOf8(m));
32939
33643
  return hit ? [{ ...hit, cosine: m.score }] : [];
32940
33644
  });
32941
33645
  }, "nearEligible");
@@ -32979,7 +33683,7 @@ var mixedWithReranker = /* @__PURE__ */ __name((head, scores) => {
32979
33683
  })).sort((a, b) => b.mixed - a.mixed).map(({ hit }) => hit);
32980
33684
  }, "mixedWithReranker");
32981
33685
 
32982
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/thread-context.js
33686
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/thread-context.js
32983
33687
  var THREAD_BOUNDS = { maxHops: 8, maxMessages: 50, maxBytes: 65536, withinMs: 864e5 };
32984
33688
  var bytes = /* @__PURE__ */ __name((items, links) => Buffer.byteLength(JSON.stringify({ items, links }), "utf8"), "bytes");
32985
33689
  var threadBounds = /* @__PURE__ */ __name((options2 = {}) => {
@@ -33178,7 +33882,7 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account, chat, mess
33178
33882
  return result;
33179
33883
  }, "readThreadContext");
33180
33884
 
33181
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/messages-archive-search.js
33885
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/messages-archive-search.js
33182
33886
  var SEARCH_FILL_MS = 200;
33183
33887
  var statsStore = /* @__PURE__ */ __name(async (store, account, request, messenger = {}) => {
33184
33888
  const stop = Date.now() + SEARCH_FILL_MS;
@@ -33245,14 +33949,29 @@ var accountOf2 = /* @__PURE__ */ __name((hit) => {
33245
33949
  const { provider, account } = parseLocator(hit.locator);
33246
33950
  return { provider, account };
33247
33951
  }, "accountOf");
33248
- var keyOf3 = /* @__PURE__ */ __name(({ provider, account }) => `${provider}/${account}`, "keyOf");
33249
-
33250
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/pictures.js
33952
+ var keyOf4 = /* @__PURE__ */ __name(({ provider, account }) => `${provider}/${account}`, "keyOf");
33953
+
33954
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/meaning-model.js
33955
+ var meaningModel = /* @__PURE__ */ __name(async (store, env = process.env) => {
33956
+ const chosen = chosenTextModel(env);
33957
+ if (chosen.from === "chosen" || chosen.id !== DEFAULT_TEXT_MODEL)
33958
+ return chosen.id;
33959
+ const models = textModels(env);
33960
+ const current = models.find(({ id: id2 }) => id2 === DEFAULT_TEXT_MODEL);
33961
+ const previous = models.find(({ id: id2 }) => id2 === PREVIOUS_DEFAULT_TEXT_MODEL);
33962
+ if (!current || !previous || !isTextModelInstalled(previous, textModelsDirectory(env)))
33963
+ return chosen.id;
33964
+ const [now, before2] = [vectorModelKey(current), vectorModelKey(previous)];
33965
+ const counts = await store.vectors.vectorCounts([now, before2]);
33966
+ return (counts.get(before2) ?? 0) > (counts.get(now) ?? 0) ? previous.id : current.id;
33967
+ }, "meaningModel");
33968
+
33969
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/pictures.js
33251
33970
  import { createHash as createHash10 } from "node:crypto";
33252
33971
  import { readFile as readFile2, stat as stat3 } from "node:fs/promises";
33253
33972
  import { setTimeout as sleep4 } from "node:timers/promises";
33254
33973
 
33255
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/domain/models.js
33974
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/domain/models.js
33256
33975
  var GROUP_SETTINGS = [
33257
33976
  "allCanPin",
33258
33977
  "onlyAdminsAdd",
@@ -33266,7 +33985,7 @@ var ADMIN_RIGHTS = ["read", "members", "admins", "info", "pin", "link", "post",
33266
33985
  var senderIsMe = /* @__PURE__ */ __name((message, account) => message.outgoing === true || message.senderId !== null && String(message.senderId) === account, "senderIsMe");
33267
33986
  var MEDIA_KINDS = ["photo", "video", "file", "audio", "link"];
33268
33987
 
33269
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/pictures.js
33988
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/pictures.js
33270
33989
  var PICTURE_MAX_BYTES = 25 * 1024 * 1024;
33271
33990
  var PICTURE_FLOOR = 0.25;
33272
33991
  var PAGE5 = 50;
@@ -33283,7 +34002,7 @@ var picturesService = /* @__PURE__ */ __name((deps) => {
33283
34002
  const directory2 = imageModelsDirectory(deps.env);
33284
34003
  if (!isImageModelInstalled(model2, directory2))
33285
34004
  throw new CliError("not_found", missingModel(model2.id), { reason: "model.not-downloaded", model: model2.id });
33286
- const { openPictureEmbedder } = await import("./embedder-AW3O2TR3.js");
34005
+ const { openPictureEmbedder } = await import("./embedder-CXKHLRJT.js");
33287
34006
  return openPictureEmbedder(model2, directory2);
33288
34007
  }, "open");
33289
34008
  const embedder = /* @__PURE__ */ __name(() => {
@@ -33480,7 +34199,7 @@ var withPictures = /* @__PURE__ */ __name((messages, pictures) => ({
33480
34199
  }, "search")
33481
34200
  }), "withPictures");
33482
34201
 
33483
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/messages-meaning.js
34202
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/messages-meaning.js
33484
34203
  var meaningText = /* @__PURE__ */ __name((question) => {
33485
34204
  try {
33486
34205
  const text2 = questionLookup(question) === void 0 ? question : questionText(question);
@@ -33493,14 +34212,13 @@ var meaningText = /* @__PURE__ */ __name((question) => {
33493
34212
  }
33494
34213
  }, "meaningText");
33495
34214
  var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, shared, within) => {
33496
- const model = chosenTextModel(deps.env).id;
33497
- const target2 = embeddingTarget(deps, model);
34215
+ const store = await deps.store();
34216
+ const target2 = embeddingTarget(deps, await meaningModel(store, deps.env));
33498
34217
  const skipped = /* @__PURE__ */ __name((reason, step) => ({
33499
34218
  skipped: { reason, model: target2.id, ...step ? { step } : {} }
33500
34219
  }), "skipped");
33501
34220
  if (!target2.installed)
33502
34221
  return skipped(`${target2.id} is not downloaded`, "models.download");
33503
- const store = await deps.store();
33504
34222
  const ready = [];
33505
34223
  const without = [];
33506
34224
  const mail = /* @__PURE__ */ new Map();
@@ -33544,7 +34262,7 @@ var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, sh
33544
34262
  if (shared && !deps.embedders)
33545
34263
  await lookUp(await shared.get(target2.key, () => target2.open()));
33546
34264
  else
33547
- await withEmbedder(deps, target2, model, {}, lookUp);
34265
+ await withEmbedder(deps, target2, target2.id, {}, lookUp);
33548
34266
  }
33549
34267
  if (ranked.length === 0 && without.length === accounts.length)
33550
34268
  return skipped("no message has a vector yet", "conversations.rebuild");
@@ -33560,7 +34278,7 @@ var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, sh
33560
34278
  }
33561
34279
  }, "meaningLane");
33562
34280
 
33563
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/messages-rerank.js
34281
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/messages-rerank.js
33564
34282
  var rerankLane = /* @__PURE__ */ __name((deps) => {
33565
34283
  const choice = deps.reranker ?? DEFAULT_RERANK_MODEL;
33566
34284
  if (choice === "off")
@@ -33572,9 +34290,9 @@ var rerankLane = /* @__PURE__ */ __name((deps) => {
33572
34290
  return { skipped: { reason: `${model.id} is not downloaded`, step: "models.download", model: model.id } };
33573
34291
  try {
33574
34292
  const warm = deps.embedders;
33575
- const reranker = warm ? await warm.reranker(`rerank:${model.id}`, async () => (await import("./process-DCYX5EDG.js")).openRerankerProcess(model, directory2, {
34293
+ const reranker = warm ? await warm.reranker(`rerank:${model.id}`, async () => (await import("./process-4A5JP5LO.js")).openRerankerProcess(model, directory2, {
33576
34294
  threads: defaultThreads()
33577
- })) : await (await import("./rerank-SXG64475.js")).openReranker(model, directory2);
34295
+ })) : await (await import("./rerank-HWJAQOZM.js")).openReranker(model, directory2);
33578
34296
  return {
33579
34297
  model: model.id,
33580
34298
  score: /* @__PURE__ */ __name((question, passages) => reranker.score(plainWords(question), passages), "score"),
@@ -33594,17 +34312,17 @@ var rerankLane = /* @__PURE__ */ __name((deps) => {
33594
34312
  };
33595
34313
  }, "rerankLane");
33596
34314
 
33597
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/document-pictures.js
34315
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/document-pictures.js
33598
34316
  var openPictureEmbedderFor = /* @__PURE__ */ __name(async ({ env, command } = {}) => {
33599
34317
  const model = imageModel(DEFAULT_IMAGE_MODEL);
33600
34318
  const directory2 = imageModelsDirectory(env);
33601
34319
  if (!isImageModelInstalled(model, directory2))
33602
34320
  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 });
33603
- const { openPictureEmbedder } = await import("./embedder-AW3O2TR3.js");
34321
+ const { openPictureEmbedder } = await import("./embedder-CXKHLRJT.js");
33604
34322
  return openPictureEmbedder(model, directory2);
33605
34323
  }, "openPictureEmbedderFor");
33606
34324
 
33607
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/document-source.js
34325
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/document-source.js
33608
34326
  var documentSource = /* @__PURE__ */ __name((note, accounts, profiles, file2) => {
33609
34327
  const metadata = note.frontMatter;
33610
34328
  const account = accounts.find(({ id: id2 }) => String(id2) === note.folderId);
@@ -33619,7 +34337,7 @@ var documentSource = /* @__PURE__ */ __name((note, accounts, profiles, file2) =>
33619
34337
  };
33620
34338
  }, "documentSource");
33621
34339
 
33622
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/embeddings/keys.js
34340
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/embeddings/keys.js
33623
34341
  var endpointKeyName = /* @__PURE__ */ __name((baseUrl) => {
33624
34342
  const host = new URL(baseUrl).host;
33625
34343
  return ["openai", "anthropic"].includes(host) ? `endpoint:${host}` : host;
@@ -33652,7 +34370,7 @@ var embeddingKeys = /* @__PURE__ */ __name((app, env = process.env, keyring) =>
33652
34370
  };
33653
34371
  }, "embeddingKeys");
33654
34372
 
33655
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/models/openai.js
34373
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/models/openai.js
33656
34374
  var options = strictObject({
33657
34375
  temperature: range(0, 2),
33658
34376
  top_p: range(0, 1),
@@ -33706,7 +34424,7 @@ var openai = {
33706
34424
  }), "complete")
33707
34425
  };
33708
34426
 
33709
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/models/index.js
34427
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/models/index.js
33710
34428
  var modelGateway = /* @__PURE__ */ __name((deps) => ({
33711
34429
  complete: /* @__PURE__ */ __name(async (request) => {
33712
34430
  if (deps.signal?.aborted)
@@ -33721,7 +34439,7 @@ var modelGateway = /* @__PURE__ */ __name((deps) => ({
33721
34439
  if (!adapter && target2.provider === "openai")
33722
34440
  adapter = openai;
33723
34441
  if (!adapter && target2.provider === "anthropic")
33724
- adapter = (await import("./anthropic-UJ4RYCWU.js")).anthropic;
34442
+ adapter = (await import("./anthropic-YUKNB63B.js")).anthropic;
33725
34443
  if (!adapter)
33726
34444
  throw new CliError("validation_error", `no model adapter for ${target2.provider}`);
33727
34445
  if (request.images !== void 0 && adapter.images !== true)
@@ -33737,14 +34455,24 @@ var modelGateway = /* @__PURE__ */ __name((deps) => ({
33737
34455
  throw new CliError("cancelled", "model request cancelled");
33738
34456
  const fetcher = deps.fetch ?? fetch;
33739
34457
  let limited = false;
34458
+ let unreachable = false;
34459
+ let refused = false;
33740
34460
  const cancellable = /* @__PURE__ */ __name(async (input, init) => {
33741
34461
  const signal = init?.signal ?? (input instanceof Request ? input.signal : void 0);
33742
- const response = await fetcher(input, {
33743
- ...init,
33744
- signal: deps.signal ? AbortSignal.any([deps.signal, ...signal ? [signal] : []]) : signal
33745
- });
34462
+ let response;
34463
+ try {
34464
+ response = await fetcher(input, {
34465
+ ...init,
34466
+ signal: deps.signal ? AbortSignal.any([deps.signal, ...signal ? [signal] : []]) : signal
34467
+ });
34468
+ } catch (error) {
34469
+ unreachable = true;
34470
+ throw error;
34471
+ }
33746
34472
  if (response.status === 429)
33747
34473
  limited = true;
34474
+ if (response.status === 401 || response.status === 403)
34475
+ refused = true;
33748
34476
  return response;
33749
34477
  }, "cancellable");
33750
34478
  try {
@@ -33757,12 +34485,13 @@ var modelGateway = /* @__PURE__ */ __name((deps) => ({
33757
34485
  } catch {
33758
34486
  if (limited)
33759
34487
  throw new CliError("rate_limited", `${request.purpose} provider rate limit reached; no result was stored`);
33760
- throw new CliError("invalid_response", `${request.purpose} provider failed or returned an incomplete response; no result was stored`);
34488
+ const reason = refused ? "model.key-rejected" : unreachable && !deps.signal?.aborted ? "model.unreachable" : void 0;
34489
+ throw new CliError("invalid_response", `${request.purpose} provider failed or returned an incomplete response; no result was stored`, reason === void 0 ? void 0 : { reason });
33761
34490
  }
33762
34491
  }, "complete")
33763
34492
  }), "modelGateway");
33764
34493
 
33765
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/enrichment-setting.js
34494
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/enrichment-setting.js
33766
34495
  var SECTION = "enrichment";
33767
34496
  var ENRICHMENT_PROVIDERS = ["openai", "anthropic"];
33768
34497
  var DEFAULT_BASE_URLS = {
@@ -33830,7 +34559,7 @@ var estimateEnrichment = /* @__PURE__ */ __name((records, chars, setting) => {
33830
34559
  };
33831
34560
  }, "estimateEnrichment");
33832
34561
 
33833
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/enrichment.js
34562
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/enrichment.js
33834
34563
  var ENRICH_PER_RUN = 600;
33835
34564
  var MAX_LINE = 400;
33836
34565
  var line2 = pipe(unknown(), transform((value) => typeof value === "string" ? value.replace(/\s+/g, " ").trim().slice(0, MAX_LINE) : ""));
@@ -33906,7 +34635,7 @@ var enrichmentState = /* @__PURE__ */ __name(async (store, env, estimateFor, key
33906
34635
  };
33907
34636
  }, "enrichmentState");
33908
34637
 
33909
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/notes-title-tier.js
34638
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/notes-title-tier.js
33910
34639
  var plainQueryWords = /* @__PURE__ */ __name((query) => {
33911
34640
  let root;
33912
34641
  try {
@@ -33933,7 +34662,7 @@ var titleTiers = /* @__PURE__ */ __name((hits, words3) => {
33933
34662
  return [...hits].sort((a, b) => rank(a) - rank(b));
33934
34663
  }, "titleTiers");
33935
34664
 
33936
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/notes-search.js
34665
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/notes-search.js
33937
34666
  var storeQuery = /* @__PURE__ */ __name(async (store, text2, { exact, timezone } = {}) => resolvedQuery(store, parsedQuery(text2, exact), timezone), "storeQuery");
33938
34667
  var parsedQuery = /* @__PURE__ */ __name((text2, exact) => validateFields(parseLucene(text2, { ...SEARCH_QUERY, defaultField: exact ? "exact" : "text" })).root, "parsedQuery");
33939
34668
  var resolvedQuery = /* @__PURE__ */ __name(async (store, root, timezone) => {
@@ -34009,7 +34738,7 @@ var nearestNotes = /* @__PURE__ */ __name(async (store, query, options2) => {
34009
34738
  var queryVector = /* @__PURE__ */ __name(async (store, query, { model: choice, folderIds, withInternal, source, env, threads, command, embedders }) => {
34010
34739
  if (!query.trim())
34011
34740
  throw new CliError("validation_error", "say what to find in the notes");
34012
- const { model, directory: directory2, key } = localModel(choice, env, command);
34741
+ const { model, directory: directory2, key } = localModel(choice ?? await meaningModel(store, env), env, command);
34013
34742
  const scope = {
34014
34743
  ...folderIds ? { folderIds } : {},
34015
34744
  ...withInternal ? { withInternal: true } : {},
@@ -34327,7 +35056,7 @@ var notesScopeOf = /* @__PURE__ */ __name((accounts) => {
34327
35056
  return { source: "internal" };
34328
35057
  return { folderIds, ...accounts.length > folderIds.length ? { withInternal: true } : {} };
34329
35058
  }, "notesScopeOf");
34330
- var searchNotesOf = /* @__PURE__ */ __name(async (store, account, text2, { accounts: list3, app, ...query }) => {
35059
+ var searchNotesOf = /* @__PURE__ */ __name(async (store, account, text2, { accounts: list3, app, env, ...query }) => {
34331
35060
  text2 = plainQuery(text2);
34332
35061
  const own = app?.command ?? query.command;
34333
35062
  const what = `${own === void 0 ? "" : `${own} `}search notes`;
@@ -34337,7 +35066,10 @@ var searchNotesOf = /* @__PURE__ */ __name(async (store, account, text2, { accou
34337
35066
  ...(await store.notes.documentsAccounts()).map(({ id: id2 }) => ({ provider: "notes", account: id2 })),
34338
35067
  ...[await store.notes.addedAccount()].flatMap((added) => added ? [{ provider: "notes", account: added.id }] : [])
34339
35068
  ];
34340
- const named2 = list3 === void 0 ? { accounts: held, skipped: [] } : fitting(entriesOfList(list3, await listContextOf(store, account, app)), ["notes", "documents"], what);
35069
+ const lock = groupLockOf(app, env);
35070
+ const typedScope = list3 ?? (lock === void 0 ? void 0 : `group:${lock}`);
35071
+ const notesScope = typedScope !== void 0 && /(^|,)\s*group:/i.test(typedScope) ? `${typedScope},${sourceOf2(OWNER_NOTES)}` : typedScope;
35072
+ const named2 = notesScope === void 0 ? { accounts: held, skipped: [] } : fitting(entriesOfList(notesScope, await listContextOf(store, account, app, void 0, env)), ["notes", "documents"], what);
34341
35073
  const source = query.source ?? noteSourceOfQuery(text2).source;
34342
35074
  const typed = named2.accounts.filter(({ account: account2 }) => source === void 0 || account2 === INTERNAL_NOTES === (source === "internal"));
34343
35075
  if (!typed.length && list3 !== void 0)
@@ -34355,7 +35087,7 @@ var searchNotesOf = /* @__PURE__ */ __name(async (store, account, text2, { accou
34355
35087
  };
34356
35088
  }, "searchNotesOf");
34357
35089
 
34358
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/events-search.js
35090
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/events-search.js
34359
35091
  var MAX_EVENTS_OFFSET = 1e3;
34360
35092
  var iso3 = /* @__PURE__ */ __name((at) => at === null ? null : new Date(at).toISOString(), "iso");
34361
35093
  var accountIdsOf = /* @__PURE__ */ __name(async (store, accounts) => {
@@ -34381,14 +35113,14 @@ var foundEvent = /* @__PURE__ */ __name((hit, query, foundBy) => ({
34381
35113
  }), "foundEvent");
34382
35114
  var CANDIDATES3 = 50;
34383
35115
  var nearestEvents = /* @__PURE__ */ __name(async (store, words3, { limit, accountIds, env, command, embedders }) => {
34384
- const { model, directory: directory2, key } = localModel(void 0, env, command);
35116
+ const { model, directory: directory2, key } = localModel(await meaningModel(store, env), env, command);
34385
35117
  if (!await store.calendar.embedded(key, accountIds ? { accountIds } : {}))
34386
35118
  throw new CliError("not_found", `no event has vectors of ${model.id} yet, so only words were matched`);
34387
35119
  const [vector] = await withLocal(model, directory2, void 0, (embedder) => embedder.embed([words3], "query"), embedders);
34388
35120
  const floor = meaningFloor(key);
34389
35121
  return (await store.calendar.nearest(key, vector, { limit, ...accountIds ? { accountIds } : {} })).filter(({ score }) => score > floor);
34390
35122
  }, "nearestEvents");
34391
- var keyOf4 = /* @__PURE__ */ __name(({ event }) => event.eventSeriesId === null ? `e${event.id}` : `s${event.eventSeriesId}`, "keyOf");
35123
+ var keyOf5 = /* @__PURE__ */ __name(({ event }) => event.eventSeriesId === null ? `e${event.id}` : `s${event.eventSeriesId}`, "keyOf");
34392
35124
  var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, offset = 0, accounts, exact, discover, newest, timezone, signal, candidates, env, command, embedders } = {}) => {
34393
35125
  if (!query.trim())
34394
35126
  throw new CliError("validation_error", "say what to find in the events");
@@ -34450,21 +35182,21 @@ var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, off
34450
35182
  };
34451
35183
  const ranked = /* @__PURE__ */ new Map();
34452
35184
  const add = /* @__PURE__ */ __name((list3, half) => list3.forEach((hit, rank) => {
34453
- const held = ranked.get(keyOf4(hit)) ?? { hit, score: 0, by: [] };
35185
+ const held = ranked.get(keyOf5(hit)) ?? { hit, score: 0, by: [] };
34454
35186
  held.score += 1 / (RRF_K3 + rank + 1);
34455
35187
  held.by.push(half);
34456
- ranked.set(keyOf4(hit), held);
35188
+ ranked.set(keyOf5(hit), held);
34457
35189
  }), "add");
34458
35190
  add(found.items, "words");
34459
35191
  add(meaning, "meaning");
34460
- const cosines = new Map(meaning.map((hit) => [keyOf4(hit), hit.score]));
35192
+ const cosines = new Map(meaning.map((hit) => [keyOf5(hit), hit.score]));
34461
35193
  const ordered = [...ranked.values()].sort((a, b) => b.score - a.score);
34462
35194
  const hasMore = ordered.length > window3 || found.hasMore;
34463
35195
  return {
34464
35196
  query,
34465
35197
  by,
34466
35198
  hits: ordered.slice(offset, window3).map(({ hit, by: halves }) => {
34467
- const cosine = cosines.get(keyOf4(hit));
35199
+ const cosine = cosines.get(keyOf5(hit));
34468
35200
  return { ...foundEvent(hit, query, halves), ...cosine === void 0 ? {} : { meaning_score: cosine } };
34469
35201
  }),
34470
35202
  has_more: hasMore,
@@ -34473,7 +35205,7 @@ var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, off
34473
35205
  };
34474
35206
  }, "searchEvents");
34475
35207
 
34476
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/search-all-business.js
35208
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/search-all-business.js
34477
35209
  var OWN_BUSINESS = { provider: "business", account: INTERNAL_NOTES };
34478
35210
  var BUSINESS_WORDS_ONLY = "invoices, payments, orders, contracts, subscriptions, products and wallets are found by the words of their numbers and names only";
34479
35211
  var placeOf = /* @__PURE__ */ __name(({ source, imported }) => source ?? (imported === void 0 ? OWN_BUSINESS : { provider: imported, account: "" }), "placeOf");
@@ -34504,7 +35236,7 @@ var searchBusiness = /* @__PURE__ */ __name(async (store, { words: words3, anyWo
34504
35236
  };
34505
35237
  }, "searchBusiness");
34506
35238
 
34507
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/search-all.js
35239
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/search-all.js
34508
35240
  var RESOURCES_SEARCHED = ["messages", "mail", "notes", "events", "crm", "business"];
34509
35241
  var refusal = /* @__PURE__ */ __name((error, text2) => {
34510
35242
  const { reason, span } = error.details ?? {};
@@ -34811,7 +35543,7 @@ var oneList = /* @__PURE__ */ __name((lists, cosines) => {
34811
35543
  return [...place.values()].sort((a, b) => head(a.rank) - head(b.rank) || b.cosine - a.cosine || a.rank - b.rank).map(({ item: item2 }) => item2);
34812
35544
  }, "oneList");
34813
35545
 
34814
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/search-all-meetings.js
35546
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/search-all-meetings.js
34815
35547
  var RESOURCES_SEARCHED_WITH_MEETINGS = [...RESOURCES_SEARCHED, "meetings"];
34816
35548
  var whole3 = /* @__PURE__ */ __name((value, minimum, maximum, label) => {
34817
35549
  if (!Number.isSafeInteger(value) || value < minimum || value > maximum)
@@ -35023,20 +35755,20 @@ var searchAllWithMeetings = /* @__PURE__ */ __name(async (store, account, reques
35023
35755
  var holdingMeetings = /* @__PURE__ */ __name(async (store, named2) => {
35024
35756
  if (named2.length < 2)
35025
35757
  return named2;
35026
- const holding2 = [];
35758
+ const holding3 = [];
35027
35759
  for (const key of named2) {
35028
35760
  const { id: id2 } = await store.accounts.storedAccount(key);
35029
35761
  if ((await store.meetings.meetings({ accountId: id2, limit: 1 })).length)
35030
- holding2.push(key);
35762
+ holding3.push(key);
35031
35763
  }
35032
- return holding2.length ? holding2 : named2;
35764
+ return holding3.length ? holding3 : named2;
35033
35765
  }, "holdingMeetings");
35034
- var keyOf5 = /* @__PURE__ */ __name(({ provider, account }) => `${provider}\0${account}`, "keyOf");
35766
+ var keyOf6 = /* @__PURE__ */ __name(({ provider, account }) => `${provider}\0${account}`, "keyOf");
35035
35767
  var searchAllOfSource = /* @__PURE__ */ __name(async (store, account, source, request, messenger, searchMessages, meaning) => {
35036
35768
  const only = request.only ?? RESOURCES_SEARCHED_WITH_MEETINGS;
35037
35769
  const entries = entriesOfList(source, await listContextOf(store, account, messenger.app));
35038
- const imported = only.includes("business") ? new Set((await store.business.accounts()).map(keyOf5)) : /* @__PURE__ */ new Set();
35039
- const holdsBusiness = /* @__PURE__ */ __name((one) => imported.has(keyOf5(one)), "holdsBusiness");
35770
+ const imported = only.includes("business") ? new Set((await store.business.accounts()).map(keyOf6)) : /* @__PURE__ */ new Set();
35771
+ const holdsBusiness = /* @__PURE__ */ __name((one) => imported.has(keyOf6(one)), "holdsBusiness");
35040
35772
  const { skipped } = fitting(entries, only.filter((one) => one !== "business"), "search all", (kind) => `--only leaves ${kind} out`, holdsBusiness);
35041
35773
  const named2 = /* @__PURE__ */ __name((resource) => [
35042
35774
  ...new Map(entries.flatMap(({ accounts }) => accounts).filter((one) => resource === "business" ? holdsBusiness(one) : listedHolds(one, resource)).map(({ provider, account: account2 }) => [`${provider}\0${account2}`, { provider, account: account2 }])).values()
@@ -35069,7 +35801,7 @@ var searchAllOfSource = /* @__PURE__ */ __name(async (store, account, source, re
35069
35801
  return { ...found, skipped: [...skipped, ...empty2, ...unnamed, ...found.skipped] };
35070
35802
  }, "searchAllOfSource");
35071
35803
 
35072
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/server-search.js
35804
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/server-search.js
35073
35805
  var SERVER_SEARCH_KEY = "messages.server-search";
35074
35806
  var SERVER_BOUNDS = { timeMs: 5e3, perCall: 100, maxCalls: 3, textBytes: 262144 };
35075
35807
  var DEFAULT_BACKEND = "both";
@@ -35258,7 +35990,7 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
35258
35990
  return { report, sources };
35259
35991
  }, "searchServer");
35260
35992
 
35261
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/messages.js
35993
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/messages.js
35262
35994
  var DELETE_AT_ONCE = 10;
35263
35995
  var filesOf = /* @__PURE__ */ __name(({ attachments }) => {
35264
35996
  const files = fileLinks(attachments);
@@ -35661,7 +36393,7 @@ var withServer = /* @__PURE__ */ __name((found, account, server) => server ? {
35661
36393
  server: server.report,
35662
36394
  items: found.items.map((hit) => ({
35663
36395
  ...hit,
35664
- source: keyOf3(accountOf2(hit)) === keyOf3(account) && server.sources.get(sourceKey(hit.chatId, hit.id)) || "archive"
36396
+ source: keyOf4(accountOf2(hit)) === keyOf4(account) && server.sources.get(sourceKey(hit.chatId, hit.id)) || "archive"
35665
36397
  }))
35666
36398
  } : found, "withServer");
35667
36399
  var paramsOf = /* @__PURE__ */ __name((command, query) => ({
@@ -35699,7 +36431,7 @@ var checkMediaOptions = /* @__PURE__ */ __name((messenger, asked, attachments) =
35699
36431
  throw new CliError("validation_error", `${MEDIA_FLAGS[first2]} needs a --photo or --file`);
35700
36432
  }, "checkMediaOptions");
35701
36433
 
35702
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/domain/channel-tags.js
36434
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/domain/channel-tags.js
35703
36435
  var CHANNEL_TAG_RULES_VERSION = "keywords-v1";
35704
36436
  var RULES = {
35705
36437
  ai: [/\b(ai|gpt|llm|machine learning|artificial intelligence)\b/iu, /нейросет|искусственн/iu],
@@ -35714,7 +36446,7 @@ var classifyChannel = /* @__PURE__ */ __name((metadata) => Object.entries(RULES)
35714
36446
  return fields.length ? [{ tag, score: fields.length / 3, fields }] : [];
35715
36447
  }), "classifyChannel");
35716
36448
 
35717
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/metadata.js
36449
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/metadata.js
35718
36450
  var metadataService = /* @__PURE__ */ __name((deps) => {
35719
36451
  const held = /* @__PURE__ */ __name(async (reference, { includeLeft = false } = {}) => {
35720
36452
  const store = await deps.store();
@@ -35800,7 +36532,7 @@ var metadataService = /* @__PURE__ */ __name((deps) => {
35800
36532
  };
35801
36533
  }, "metadataService");
35802
36534
 
35803
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/moderation/run.js
36535
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/moderation/run.js
35804
36536
  var FIRST_LOOK_MS = 24 * 36e5;
35805
36537
  var moderateWith = /* @__PURE__ */ __name(async (run) => {
35806
36538
  const { chatId, title, rules, point, since, dryRun } = run;
@@ -35837,7 +36569,7 @@ var moderateWith = /* @__PURE__ */ __name(async (run) => {
35837
36569
  return { chatId, rows, notes };
35838
36570
  }, "moderateWith");
35839
36571
 
35840
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/moderation.js
36572
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/moderation.js
35841
36573
  var moderationService = /* @__PURE__ */ __name((deps) => {
35842
36574
  const file2 = /* @__PURE__ */ __name(() => new ModerationRules(moderationPathFor(deps.messenger.app, deps.profile ?? "default", deps.env ?? process.env)), "file");
35843
36575
  const group = /* @__PURE__ */ __name(async (chat) => {
@@ -35915,7 +36647,7 @@ var moderatorOf = /* @__PURE__ */ __name((adapter, deps) => ({
35915
36647
  }, "removePerson")
35916
36648
  }), "moderatorOf");
35917
36649
 
35918
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/private-people.js
36650
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/private-people.js
35919
36651
  var noteItem = /* @__PURE__ */ __name((provider, note) => ({
35920
36652
  id: note.id,
35921
36653
  contact: formatReference({ type: "contact", provider, id: note.personId }),
@@ -35959,7 +36691,7 @@ var privatePeopleService = /* @__PURE__ */ __name((deps) => {
35959
36691
  };
35960
36692
  }, "privatePeopleService");
35961
36693
 
35962
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/rankings.js
36694
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/rankings.js
35963
36695
  var empty = /* @__PURE__ */ __name(() => ({
35964
36696
  total: 0,
35965
36697
  population: 0,
@@ -36215,7 +36947,7 @@ var rankingsService = /* @__PURE__ */ __name((deps) => ({
36215
36947
  }, "evidence")
36216
36948
  }), "rankingsService");
36217
36949
 
36218
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/reply-stats.js
36950
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/reply-stats.js
36219
36951
  var FIELDS = ["date", "chat", "kind"];
36220
36952
  var WAITING_TAIL = 100;
36221
36953
  var plainOnly = /* @__PURE__ */ __name((text2, command) => {
@@ -36309,9 +37041,9 @@ var replyStatsService = /* @__PURE__ */ __name((deps) => {
36309
37041
  }
36310
37042
  const days = /* @__PURE__ */ new Map();
36311
37043
  if (by === "day") {
36312
- const keyOf6 = calendarKey(timezone, "day");
37044
+ const keyOf8 = calendarKey(timezone, "day");
36313
37045
  for (const { repliedAt, delayMs } of delays) {
36314
- const key = keyOf6(repliedAt);
37046
+ const key = keyOf8(repliedAt);
36315
37047
  const list3 = days.get(key) ?? [];
36316
37048
  list3.push(delayMs);
36317
37049
  days.set(key, list3);
@@ -36342,7 +37074,7 @@ var replyStatsService = /* @__PURE__ */ __name((deps) => {
36342
37074
  };
36343
37075
  }, "replyStatsService");
36344
37076
 
36345
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/searches.js
37077
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/searches.js
36346
37078
  var savedSearchItem = /* @__PURE__ */ __name((one) => ({
36347
37079
  id: one.id,
36348
37080
  name: one.name,
@@ -36471,7 +37203,7 @@ var searchesService = /* @__PURE__ */ __name((deps) => {
36471
37203
  };
36472
37204
  }, "searchesService");
36473
37205
 
36474
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/tags.js
37206
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/tags.js
36475
37207
  var TAGGING_QUERY = {
36476
37208
  entity: "tagging",
36477
37209
  backend: "sql",
@@ -36555,7 +37287,7 @@ var tagsService = /* @__PURE__ */ __name((deps) => {
36555
37287
  };
36556
37288
  }, "tagsService");
36557
37289
 
36558
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/topics.js
37290
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/topics.js
36559
37291
  var actionOf = /* @__PURE__ */ __name(({ title, closed, pinned, hidden, icon }) => {
36560
37292
  const set = [closed, pinned, hidden].filter((one) => one !== void 0).length;
36561
37293
  if (title !== void 0 || icon !== void 0 || set !== 1)
@@ -36754,8 +37486,19 @@ var topicsService = /* @__PURE__ */ __name((deps) => {
36754
37486
  };
36755
37487
  }, "topicsService");
36756
37488
 
36757
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/evidence.js
36758
- import { createHash as createHash11, randomUUID as randomUUID5 } from "node:crypto";
37489
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/crm/sync.js
37490
+ var CLOCK_MARGIN = 60 * 6e4;
37491
+
37492
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/crm/writer.js
37493
+ var CRM_ASSIGN_OTHERS_KEY = "crm.assign-others";
37494
+ var CRM_WRITE_DEFAULTS = {
37495
+ "deals.delete": "ask",
37496
+ "leads.delete": "ask",
37497
+ [CRM_ASSIGN_OTHERS_KEY]: "deny"
37498
+ };
37499
+
37500
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/evidence.js
37501
+ import { createHash as createHash11, randomUUID as randomUUID6 } from "node:crypto";
36759
37502
  var hash2 = /* @__PURE__ */ __name((value) => createHash11("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
36760
37503
  var positive = /* @__PURE__ */ __name((value, name, minimum = 1) => {
36761
37504
  if (!Number.isSafeInteger(value) || value < minimum)
@@ -36825,10 +37568,10 @@ var prepareEvidencePacket = /* @__PURE__ */ __name(({ kind, source, page, limits
36825
37568
  },
36826
37569
  items
36827
37570
  };
36828
- return { ...content, id: randomUUID5(), fingerprint: hash2(content) };
37571
+ return { ...content, id: randomUUID6(), fingerprint: hash2(content) };
36829
37572
  }, "prepareEvidencePacket");
36830
37573
 
36831
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/evidence-read.js
37574
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/evidence-read.js
36832
37575
  var readEvidencePacket = /* @__PURE__ */ __name(async (store, account, { chat, limit, before: before2 }, messenger = {}) => {
36833
37576
  if (!Number.isSafeInteger(limit) || limit < 1 || limit > 100)
36834
37577
  throw new CliError("validation_error", "evidence message limit must be an integer from 1 to 100");
@@ -36848,7 +37591,7 @@ var readEvidencePacket = /* @__PURE__ */ __name(async (store, account, { chat, l
36848
37591
  return { ...packet, nextBeforeId: older && last ? last.id : null };
36849
37592
  }, "readEvidencePacket");
36850
37593
 
36851
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/meeting-project-discovery.js
37594
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/meeting-project-discovery.js
36852
37595
  var scopeKeys = [
36853
37596
  "accountId",
36854
37597
  "meetingId",
@@ -36870,13 +37613,13 @@ var optionKeys = /* @__PURE__ */ new Set([
36870
37613
  "maxVocabularyReadBytes"
36871
37614
  ]);
36872
37615
 
36873
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/text-model-choice.js
37616
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/text-model-choice.js
36874
37617
  import { createHash as createHash12 } from "node:crypto";
36875
- import { existsSync as existsSync2 } from "node:fs";
37618
+ import { existsSync as existsSync3 } from "node:fs";
36876
37619
  var useTextModel = /* @__PURE__ */ __name(async (id2, { env, command }) => {
36877
37620
  const model = textModel(id2, env);
36878
37621
  if (!isTextModelInstalled(model, textModelsDirectory(env)))
36879
- throw new CliError("not_found", `${model.id} is not downloaded \u2014 \`${command} models download ${model.id}${model.terms ? " --accept-terms" : ""}\` first`, { reason: "model.not-downloaded", model: model.id });
37622
+ throw new CliError("not_found", `${model.id} is not downloaded \u2014 \`${command} models download ${model.id}\` first`, { reason: "model.not-downloaded", model: model.id });
36880
37623
  const previous = chosenTextModel(env).id;
36881
37624
  const before2 = textModels(env).find((one) => one.id === previous);
36882
37625
  const toEmbed = previous === model.id ? 0 : before2 ? await missingVectors(before2, model, env) : null;
@@ -36889,7 +37632,7 @@ var useTextModel = /* @__PURE__ */ __name(async (id2, { env, command }) => {
36889
37632
  };
36890
37633
  }, "useTextModel");
36891
37634
  var missingVectors = /* @__PURE__ */ __name(async (from, to, env) => {
36892
- if (!existsSync2(storePath(env)))
37635
+ if (!existsSync3(storePath(env)))
36893
37636
  return null;
36894
37637
  try {
36895
37638
  const store = await openStore({ env });
@@ -37001,7 +37744,7 @@ var addCustomTextModel = /* @__PURE__ */ __name(async (id2, payload, { env, fetc
37001
37744
  return { ...checked2.output, custom: true };
37002
37745
  }, "addCustomTextModel");
37003
37746
 
37004
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/context/communication-selection.js
37747
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/context/communication-selection.js
37005
37748
  var communicationFields = {
37006
37749
  sources: pipe(array(strictObject({
37007
37750
  id: pipe(string(), regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/)),
@@ -37033,7 +37776,7 @@ var communicationRequest = /* @__PURE__ */ __name((value, preparationAfter) => {
37033
37776
  return { ...input, after, before: before2 };
37034
37777
  }, "communicationRequest");
37035
37778
 
37036
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/meeting-preparation-validation.js
37779
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/meeting-preparation-validation.js
37037
37780
  var MEETING_PREPARATION_LIMITS = {
37038
37781
  meetings: { min: 1, max: 20, default: 5 },
37039
37782
  cues: { min: 1, max: 100, default: 10 },
@@ -37106,7 +37849,7 @@ var validateMeetingPreparationRequest = /* @__PURE__ */ __name((externalId, orig
37106
37849
  };
37107
37850
  }, "validateMeetingPreparationRequest");
37108
37851
 
37109
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/meeting-communications-selection.js
37852
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/meeting-communications-selection.js
37110
37853
  var validatePreparationCommunications = /* @__PURE__ */ __name((section, request, after) => {
37111
37854
  const fail2 = /* @__PURE__ */ __name(() => {
37112
37855
  throw new CliError("invalid_response", "Preparation communications returned another selection or invalid evidence");
@@ -37154,7 +37897,7 @@ var validatePreparationCommunications = /* @__PURE__ */ __name((section, request
37154
37897
  }
37155
37898
  }, "validatePreparationCommunications");
37156
37899
 
37157
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/package-upgrade.js
37900
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/package-upgrade.js
37158
37901
  var upgradePackage = /* @__PURE__ */ __name(async ({ current, command, packageName, check: check2 }, ports) => {
37159
37902
  const installer = ports.installer();
37160
37903
  const argv = updateCommand(installer, packageName);
@@ -37219,7 +37962,7 @@ var dayAfter = /* @__PURE__ */ __name((published) => {
37219
37962
  return Number.isNaN(time) ? null : new Date(time + 24 * 60 * 60 * 1e3).toISOString();
37220
37963
  }, "dayAfter");
37221
37964
 
37222
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/services/index.js
37965
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/services/index.js
37223
37966
  var servicesFor = /* @__PURE__ */ __name((deps) => {
37224
37967
  const pictures = picturesService(deps);
37225
37968
  const base = {
@@ -37256,12 +37999,12 @@ var servicesFor = /* @__PURE__ */ __name((deps) => {
37256
37999
  return deps.messenger.services ? { ...base, ...deps.messenger.services(base, deps) } : base;
37257
38000
  }, "servicesFor");
37258
38001
 
37259
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/background/relay.js
38002
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/background/relay.js
37260
38003
  import { createHash as createHash13 } from "node:crypto";
37261
- import { chmodSync, lstatSync, mkdirSync as mkdirSync3, rmSync } from "node:fs";
38004
+ import { chmodSync, lstatSync, mkdirSync as mkdirSync6, rmSync as rmSync2 } from "node:fs";
37262
38005
  import { createConnection, createServer } from "node:net";
37263
38006
  import { tmpdir } from "node:os";
37264
- import { dirname as dirname5, isAbsolute as isAbsolute3, join as join12 } from "node:path";
38007
+ import { dirname as dirname8, isAbsolute as isAbsolute3, join as join16 } from "node:path";
37265
38008
  import { PassThrough, Writable } from "node:stream";
37266
38009
  var RELAY_PROTOCOL = 1;
37267
38010
  var requestSchema = strictObject({
@@ -37279,14 +38022,14 @@ var relayPath = /* @__PURE__ */ __name((lockPath) => {
37279
38022
  if (beside.length <= MAX_SOCKET_PATH)
37280
38023
  return beside;
37281
38024
  const hash3 = createHash13("sha256").update(beside).digest("hex").slice(0, 16);
37282
- const name = join12(`wirecat-relay-${process.getuid?.() ?? "user"}`, `${hash3}.sock`);
37283
- const temporary = join12(tmpdir(), name);
38025
+ const name = join16(`wirecat-relay-${process.getuid?.() ?? "user"}`, `${hash3}.sock`);
38026
+ const temporary = join16(tmpdir(), name);
37284
38027
  if (temporary.length <= MAX_SOCKET_PATH || process.platform === "win32")
37285
38028
  return temporary;
37286
- return join12("/tmp", name);
38029
+ return join16("/tmp", name);
37287
38030
  }, "relayPath");
37288
38031
  var privateDirectory = /* @__PURE__ */ __name((dir) => {
37289
- mkdirSync3(dir, { recursive: true, mode: 448 });
38032
+ mkdirSync6(dir, { recursive: true, mode: 448 });
37290
38033
  const stat4 = lstatSync(dir);
37291
38034
  const mine = process.getuid === void 0 || stat4.uid === process.getuid();
37292
38035
  if (!stat4.isDirectory() || !mine || (stat4.mode & 63) !== 0) {
@@ -37314,8 +38057,8 @@ var frame = /* @__PURE__ */ __name((socket, value) => {
37314
38057
  `);
37315
38058
  }, "frame");
37316
38059
  var listenRelay = /* @__PURE__ */ __name(async (path, run) => {
37317
- privateDirectory(dirname5(path));
37318
- rmSync(path, { force: true });
38060
+ privateDirectory(dirname8(path));
38061
+ rmSync2(path, { force: true });
37319
38062
  const open7 = /* @__PURE__ */ new Set();
37320
38063
  const running = /* @__PURE__ */ new Set();
37321
38064
  const server = createServer((socket) => {
@@ -37379,7 +38122,7 @@ var listenRelay = /* @__PURE__ */ __name(async (path, run) => {
37379
38122
  socket.destroy();
37380
38123
  await new Promise((resolve7) => server.close(() => resolve7()));
37381
38124
  await Promise.allSettled(running);
37382
- rmSync(path, { force: true });
38125
+ rmSync2(path, { force: true });
37383
38126
  }, "close")
37384
38127
  };
37385
38128
  }, "listenRelay");
@@ -37477,7 +38220,7 @@ var relayCommand = /* @__PURE__ */ __name((path, request, options2) => new Promi
37477
38220
  }, () => finish({ error: stopped() }));
37478
38221
  }), "relayCommand");
37479
38222
 
37480
- // node_modules/.pnpm/@wirecat+cli-core@0.618.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.87.0_commander@15._c25084c4731872baba927966435ce31d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-relay.js
38223
+ // node_modules/.pnpm/@wirecat+cli-core@0.619.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.93.0_commander@15._3343d636b3fedf7ef3285e4c7a47096e/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-relay.js
37481
38224
  var lentConnection = /* @__PURE__ */ __name((connection, watchers) => throughWrapper(connection, {
37482
38225
  close: /* @__PURE__ */ __name(async () => {
37483
38226
  }, "close"),
@@ -37596,7 +38339,7 @@ export {
37596
38339
  REFRESH_BOUNDS,
37597
38340
  validateCatchUpBounds,
37598
38341
  FETCHING,
37599
- keyOf,
38342
+ keyOf2 as keyOf,
37600
38343
  fetchInto,
37601
38344
  REGISTRIES,
37602
38345
  registriesCover,
@@ -37633,6 +38376,10 @@ export {
37633
38376
  projectStatus,
37634
38377
  sendTime,
37635
38378
  readMail,
38379
+ NOT_GROUP_NAMES,
38380
+ inGroupOf,
38381
+ groupLockOf,
38382
+ listContextOf,
37636
38383
  momentOf,
37637
38384
  aheadOf,
37638
38385
  dateWindow,
@@ -37706,6 +38453,18 @@ export {
37706
38453
  taskTypeOf,
37707
38454
  closedStateOf,
37708
38455
  taskLinkKindOf,
38456
+ holdEnd,
38457
+ floodPathFor,
38458
+ FloodMemory,
38459
+ withFileLockAsync,
38460
+ sendsPathFor,
38461
+ SendJournal,
38462
+ recipientsPathFor,
38463
+ RecipientList,
38464
+ ceilingRefusal,
38465
+ levelRefusal,
38466
+ sendGuard,
38467
+ guardFor,
37709
38468
  readEvidencePacket,
37710
38469
  useTextModel,
37711
38470
  addCustomTextModel,