@wirecat/amo-cli 0.2.0 → 0.3.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 (174) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +11 -10
  3. package/contracts/wirecat.json +45 -6
  4. package/dist/amo/button.d.ts +53 -0
  5. package/dist/amo/button.d.ts.map +1 -0
  6. package/dist/amo/button.js +234 -0
  7. package/dist/amo/button.js.map +1 -0
  8. package/dist/amo/oauth.d.ts +12 -3
  9. package/dist/amo/oauth.d.ts.map +1 -1
  10. package/dist/amo/oauth.js +19 -6
  11. package/dist/amo/oauth.js.map +1 -1
  12. package/dist/bin/amo.js +2 -2
  13. package/dist/bundle/agent-FDNP27SW.js +40 -0
  14. package/dist/bundle/{all-profiles-3KQVWDV4.js → all-profiles-PPUN52SP.js} +63 -21
  15. package/dist/bundle/amo.js +28 -26
  16. package/dist/bundle/{anthropic-N5NOX7K7.js → anthropic-RDNDT6ZP.js} +5 -5
  17. package/dist/bundle/{app-server-2MST5EZ5.js → app-server-MMALJDBP.js} +79 -68
  18. package/dist/bundle/{bun-4NHWOFX2.js → bun-Y4FRPURU.js} +2 -2
  19. package/dist/bundle/{bun-sqlite-DRSXPWPR.js → bun-sqlite-7NXJGZCO.js} +6 -6
  20. package/dist/bundle/{chunk-GNTJMB6X.js → chunk-2YEDK2XV.js} +4 -4
  21. package/dist/bundle/chunk-3NDMVXGS.js +80 -0
  22. package/dist/bundle/{chunk-Y37A3232.js → chunk-3RP57VDS.js} +114 -7
  23. package/dist/bundle/{chunk-ODNQU7DH.js → chunk-3YOZTGZ6.js} +43 -64
  24. package/dist/bundle/{chunk-ESZSMZKT.js → chunk-4EYPFFTN.js} +2 -2
  25. package/dist/bundle/{chunk-5QFHNBGB.js → chunk-4MVTSMWP.js} +2 -2
  26. package/dist/bundle/{chunk-LJQUYECN.js → chunk-5DPMNYQT.js} +1 -1
  27. package/dist/bundle/{chunk-7PKFYX7V.js → chunk-5POLHHDZ.js} +8 -8
  28. package/dist/bundle/{chunk-A33TIM5D.js → chunk-5RXH35ZA.js} +225 -225
  29. package/dist/bundle/{chunk-BVMNXI53.js → chunk-77FP6AWC.js} +25 -25
  30. package/dist/bundle/{chunk-L6AFE73L.js → chunk-7E6QSIRQ.js} +1 -1
  31. package/dist/bundle/chunk-7SBAHYZW.js +734 -0
  32. package/dist/bundle/{chunk-GQ7VFIYM.js → chunk-7USADF2W.js} +23 -7
  33. package/dist/bundle/{chunk-AHJ4W2IL.js → chunk-7VSYOMEH.js} +2 -2
  34. package/dist/bundle/chunk-7Z6NYSAN.js +52 -0
  35. package/dist/bundle/chunk-AYR6FIXN.js +30 -0
  36. package/dist/bundle/{chunk-ADEWU4P4.js → chunk-B4ITT55D.js} +1 -1
  37. package/dist/bundle/{chunk-AUBB72VF.js → chunk-BKTLAXUK.js} +41 -10
  38. package/dist/bundle/{chunk-63F65DHU.js → chunk-BYVDMPLX.js} +2 -2
  39. package/dist/bundle/{chunk-V77XNPXG.js → chunk-CQ472K6W.js} +11 -11
  40. package/dist/bundle/{chunk-FKR3M62D.js → chunk-CUZISGWH.js} +13 -13
  41. package/dist/bundle/{chunk-LDEBZ3IX.js → chunk-D6UPCAPD.js} +1 -1
  42. package/dist/bundle/{chunk-P3WQRTYZ.js → chunk-E2DLRLJ5.js} +1 -1
  43. package/dist/bundle/{chunk-NJYAL3UW.js → chunk-EHULZEXQ.js} +1 -1
  44. package/dist/bundle/chunk-EKNP326Q.js +108 -0
  45. package/dist/bundle/{chunk-DJD7TBYG.js → chunk-ELJGALVX.js} +76 -74
  46. package/dist/bundle/{chunk-RPWAJYI6.js → chunk-FI2TP6TY.js} +3 -3
  47. package/dist/bundle/{chunk-CDY2NJFE.js → chunk-FPDTIQOK.js} +2 -2
  48. package/dist/bundle/{chunk-NC76INB2.js → chunk-FPIUFSWK.js} +3099 -2266
  49. package/dist/bundle/{chunk-SZ2V62HB.js → chunk-GCUFGDKE.js} +2 -2
  50. package/dist/bundle/{chunk-LRBPT7LQ.js → chunk-GKP7CKW2.js} +6 -6
  51. package/dist/bundle/chunk-H34RBRS3.js +209 -0
  52. package/dist/bundle/{chunk-O2UCU52O.js → chunk-HQH4YPO5.js} +134 -569
  53. package/dist/bundle/{chunk-TNUFLULO.js → chunk-I4QCJZW7.js} +8 -8
  54. package/dist/bundle/{chunk-DXGGCGRP.js → chunk-IDQ7BNCZ.js} +14 -14
  55. package/dist/bundle/{chunk-JMDLPBXK.js → chunk-IEAPNTHT.js} +17 -17
  56. package/dist/bundle/{chunk-XQL7FEF4.js → chunk-ILUREFWJ.js} +9 -9
  57. package/dist/bundle/{chunk-QRQYUHCZ.js → chunk-IYUWVMGP.js} +12 -12
  58. package/dist/bundle/chunk-JTFAG3BX.js +338 -0
  59. package/dist/bundle/{chunk-CHUKWON6.js → chunk-JZ2AITOE.js} +3 -3
  60. package/dist/bundle/{chunk-JR6TSMFX.js → chunk-KEOKH2OZ.js} +103 -70
  61. package/dist/bundle/{chunk-UMVRT7VQ.js → chunk-KKXF6TSS.js} +1 -1
  62. package/dist/bundle/{chunk-5E5R65CA.js → chunk-KTLCQ7GC.js} +2 -2
  63. package/dist/bundle/{chunk-QDMXZZG4.js → chunk-KZDBO2FT.js} +18 -8
  64. package/dist/bundle/{chunk-VX37MPTJ.js → chunk-L2ZQDTDU.js} +1 -1
  65. package/dist/bundle/{chunk-CUZRHF34.js → chunk-L3JDQNBC.js} +4 -4
  66. package/dist/bundle/{chunk-3IRJDH2U.js → chunk-L72UALL5.js} +2 -100
  67. package/dist/bundle/{chunk-XRTD2GCU.js → chunk-LOSOWTAZ.js} +19 -258
  68. package/dist/bundle/{chunk-LGQXGOPJ.js → chunk-LYRICHEK.js} +2 -2
  69. package/dist/bundle/{chunk-UBRREVLJ.js → chunk-MMOEAH5G.js} +2 -2
  70. package/dist/bundle/{chunk-EQ7A6NA6.js → chunk-MPXKBF37.js} +1 -1
  71. package/dist/bundle/{chunk-SMSTGO2G.js → chunk-MYMBPQPQ.js} +4 -4
  72. package/dist/bundle/chunk-N4A6E2LL.js +559 -0
  73. package/dist/bundle/{chunk-5HGGG3QO.js → chunk-NJ2LJKNH.js} +16 -3
  74. package/dist/bundle/{chunk-TGEQNS6G.js → chunk-OMH3WP7F.js} +1 -1
  75. package/dist/bundle/{chunk-ULXQ5MJM.js → chunk-ORFLQGWH.js} +4 -4
  76. package/dist/bundle/{chunk-DQV2IKCF.js → chunk-PFZ7WG2B.js} +10 -3
  77. package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
  78. package/dist/bundle/{chunk-6RS7OYTD.js → chunk-Q2YVY7IR.js} +3 -3
  79. package/dist/bundle/{chunk-DOSJONCX.js → chunk-QHA33ZS6.js} +7 -7
  80. package/dist/bundle/{chunk-JH3UOHRE.js → chunk-QQT7WUR4.js} +4 -4
  81. package/dist/bundle/{chunk-EROSAUNP.js → chunk-R23DRW2T.js} +5 -5
  82. package/dist/bundle/{chunk-WCYCUTSK.js → chunk-SBQ5MFHM.js} +7 -7
  83. package/dist/bundle/{chunk-DAY6TSPF.js → chunk-SJYVKR54.js} +62 -50
  84. package/dist/bundle/{chunk-T2UDLX76.js → chunk-SJZ52MZE.js} +6 -6
  85. package/dist/bundle/{chunk-ZM7I52EP.js → chunk-T6D34X5S.js} +3 -4
  86. package/dist/bundle/{chunk-P5LYZRKW.js → chunk-TCDER3G7.js} +1586 -749
  87. package/dist/bundle/{chunk-2I5UVMLW.js → chunk-TWZF7VO6.js} +1726 -1159
  88. package/dist/bundle/{chunk-VVHRQ46X.js → chunk-UA7C57IB.js} +2 -2
  89. package/dist/bundle/{chunk-5SBLU7D7.js → chunk-UM6SDFB6.js} +1 -1
  90. package/dist/bundle/{chunk-7U5HJEPZ.js → chunk-UOPP6ORQ.js} +21 -19
  91. package/dist/bundle/{chunk-U7RLVJ34.js → chunk-UT3ODJMI.js} +4 -4
  92. package/dist/bundle/{chunk-7GTUZY7M.js → chunk-UZLT6VSP.js} +3 -3
  93. package/dist/bundle/{chunk-5RLUHTK6.js → chunk-V3ZWYMXT.js} +1 -1
  94. package/dist/bundle/{chunk-LSND5QYI.js → chunk-VD7HD25M.js} +9 -9
  95. package/dist/bundle/{chunk-PFO76YFP.js → chunk-VEGNZPQU.js} +18 -18
  96. package/dist/bundle/{chunk-5Z5PEEKP.js → chunk-VFU25P57.js} +4 -4
  97. package/dist/bundle/{chunk-4ZAK773N.js → chunk-VJHOBOJR.js} +3 -3
  98. package/dist/bundle/{chunk-PM77PRB6.js → chunk-VPBSZ4HQ.js} +185 -162
  99. package/dist/bundle/{chunk-Q2VNBY4Y.js → chunk-VY27K2SH.js} +746 -1205
  100. package/dist/bundle/{chunk-XEFAMLSD.js → chunk-W4KY5JF5.js} +3 -3
  101. package/dist/bundle/{chunk-73CXFE36.js → chunk-WBWVBEHH.js} +29 -1
  102. package/dist/bundle/{chunk-NHXJYS4R.js → chunk-XDT74W5P.js} +32 -28
  103. package/dist/bundle/{chunk-EPOV5UIO.js → chunk-XI75EKLG.js} +11 -11
  104. package/dist/bundle/{chunk-CHH42KI4.js → chunk-XM2G62YF.js} +8 -6
  105. package/dist/bundle/{chunk-5D4Z2B5B.js → chunk-YSOGGUK3.js} +9 -9
  106. package/dist/bundle/chunk-YVO2YGML.js +353 -0
  107. package/dist/bundle/{chunk-EQUKVVHX.js → chunk-ZIFEIJRK.js} +7 -7
  108. package/dist/bundle/{cli-QVWTXADI.js → cli-GAO7LDDA.js} +150 -103
  109. package/dist/bundle/command-contract-RLIBGIDT.js +39 -0
  110. package/dist/bundle/{command-server-entry-5VL5U5EE.js → command-server-entry-BCDJP7XE.js} +28 -28
  111. package/dist/bundle/{decode-SQ5WGNDX.js → decode-OY2GR442.js} +5 -5
  112. package/dist/bundle/{dispatch-LA4DFXJD.js → dispatch-JWEJCBTF.js} +8 -8
  113. package/dist/bundle/dist-PAKDDIBT.js +191 -0
  114. package/dist/bundle/{echarts-25Z3RINX.js → echarts-AHEPEA5P.js} +2 -2
  115. package/dist/bundle/{embed-BNOTNXMA.js → embed-RVSUV54Z.js} +6 -6
  116. package/dist/bundle/{embedder-BCUT7KKV.js → embedder-GRZXZUXR.js} +9 -9
  117. package/dist/bundle/{failure-PKAC6XCT.js → failure-DDCSR54L.js} +2 -2
  118. package/dist/bundle/{first-run-EO5K5GME.js → first-run-G3WI4DH4.js} +12 -12
  119. package/dist/bundle/first-screen-6MLCMW2U.js +39 -0
  120. package/dist/bundle/{instructions-VLM3QAYB.js → instructions-NWQC5IP4.js} +1 -1
  121. package/dist/bundle/{mcp-7ILNMJH5.js → mcp-KGWT6TGO.js} +2 -2
  122. package/dist/bundle/meeting-combined-SVTFVZNJ.js +24 -0
  123. package/dist/bundle/{meeting-model-GHMMUQ34.js → meeting-model-I6T5HIZ5.js} +11 -11
  124. package/dist/bundle/{meeting-semantic-BMP6323L.js → meeting-semantic-47UA5JBF.js} +6 -6
  125. package/dist/bundle/{node-CT3N3TNL.js → node-7VXN7F4B.js} +2 -2
  126. package/dist/bundle/{node-sqlite-MELD2SBX.js → node-sqlite-BSEON57L.js} +7 -7
  127. package/dist/bundle/{oauth-YBH5OKC2.js → oauth-V6UAT4YD.js} +8 -8
  128. package/dist/bundle/{open-WNSBWTAG.js → open-7LVAY7ZU.js} +5 -5
  129. package/dist/bundle/{openai-XSNMNLW6.js → openai-OIEH342H.js} +15 -15
  130. package/dist/bundle/{process-I2QKOMM7.js → process-PTUCNLZ7.js} +1 -1
  131. package/dist/bundle/{program-G6O3IJR2.js → program-S5WY5IZP.js} +640 -852
  132. package/dist/bundle/{prompt-SOG4AKPM.js → prompt-7XWTEQ62.js} +5 -5
  133. package/dist/bundle/{recognize-WMQLWMXH.js → recognize-HGIAJXDR.js} +4 -4
  134. package/dist/bundle/{remote-4BTFOLFY.js → remote-X4SVEMHS.js} +9 -9
  135. package/dist/bundle/{rerank-LJ3TWRNV.js → rerank-QWM3DQMU.js} +7 -7
  136. package/dist/bundle/{serve-B6UANKXN.js → serve-VVG3TXYT.js} +10 -10
  137. package/dist/bundle/{server-YRH6GJ5Z.js → server-EHYK62BJ.js} +73 -61
  138. package/dist/bundle/server-WRPTBVNW.js +86 -0
  139. package/dist/bundle/source-YISMYLBQ.js +44 -0
  140. package/dist/bundle/{sqlite-runtime-R7QFWFE7.js → sqlite-runtime-MCKXDNYC.js} +6 -6
  141. package/dist/bundle/{state-DIJ5YUOE.js → state-MYNYQJCT.js} +6 -6
  142. package/dist/bundle/store-A7R2SZVD.js +34 -0
  143. package/dist/bundle/{store-MYTYDV6A.js → store-B7O3F3QB.js} +28 -21
  144. package/dist/bundle/{store-6WFWW7EC.js → store-FPIU2546.js} +24 -23
  145. package/dist/bundle/store-maintenance-command-D55FRTIK.js +73 -0
  146. package/dist/bundle/surface-3EX6IGHW.js +72 -0
  147. package/dist/bundle/writer-XDHZ54JD.js +46 -0
  148. package/dist/commands/session.d.ts +23 -0
  149. package/dist/commands/session.d.ts.map +1 -1
  150. package/dist/commands/session.js +115 -45
  151. package/dist/commands/session.js.map +1 -1
  152. package/dist/identity.js +1 -1
  153. package/dist/identity.js.map +1 -1
  154. package/dist/reasons.d.ts.map +1 -1
  155. package/dist/reasons.js +2 -0
  156. package/dist/reasons.js.map +1 -1
  157. package/dist/setup/flow.d.ts.map +1 -1
  158. package/dist/setup/flow.js +74 -4
  159. package/dist/setup/flow.js.map +1 -1
  160. package/dist/setup/texts.en.json +22 -1
  161. package/dist/setup/texts.es.json +22 -1
  162. package/dist/setup/texts.ru.json +22 -1
  163. package/dist/version.d.ts +1 -1
  164. package/dist/version.js +1 -1
  165. package/package.json +3 -3
  166. package/skills/amo-cli/references/setup.md +8 -2
  167. package/dist/bundle/command-contract-QBUQBXH7.js +0 -39
  168. package/dist/bundle/first-screen-GMN3T6RW.js +0 -39
  169. package/dist/bundle/meeting-combined-LAMF7S2B.js +0 -24
  170. package/dist/bundle/server-S6XD6V6E.js +0 -77
  171. package/dist/bundle/source-DGFTA2TN.js +0 -42
  172. package/dist/bundle/store-CHWY2USQ.js +0 -32
  173. package/dist/bundle/store-maintenance-command-B5TMKFMG.js +0 -68
  174. package/dist/bundle/writer-GP7VIMAU.js +0 -44
@@ -8,29 +8,33 @@ import {
8
8
  sameOrdinaryFile,
9
9
  syncDirectory,
10
10
  writeFileAtomic
11
- } from "./chunk-FKR3M62D.js";
11
+ } from "./chunk-CUZISGWH.js";
12
12
  import {
13
- LIST_QUERY_GUIDE,
14
13
  MAIL,
15
14
  OWNER_NOTES,
16
15
  accountsOfKind,
17
16
  crmViewerOf,
18
- dateWindow,
19
17
  groupLockOf,
20
18
  listContextOf,
21
19
  listedAccounts,
22
- momentOf,
23
- nativeTerms,
24
20
  newOperationId,
25
21
  newSendId
26
- } from "./chunk-2I5UVMLW.js";
22
+ } from "./chunk-TWZF7VO6.js";
27
23
  import {
28
24
  WIRECAT_TOOLS
29
- } from "./chunk-73CXFE36.js";
25
+ } from "./chunk-WBWVBEHH.js";
30
26
  import {
31
27
  isNewer,
32
28
  updateCommand
33
- } from "./chunk-GNTJMB6X.js";
29
+ } from "./chunk-2YEDK2XV.js";
30
+ import {
31
+ capability
32
+ } from "./chunk-AYR6FIXN.js";
33
+ import {
34
+ LIST_QUERY_GUIDE,
35
+ dateWindow,
36
+ momentOf
37
+ } from "./chunk-7SBAHYZW.js";
34
38
  import {
35
39
  EmptyAnswer,
36
40
  MAX_MODEL_IMAGE_BYTES,
@@ -39,7 +43,7 @@ import {
39
43
  range,
40
44
  systemFor,
41
45
  validateImages
42
- } from "./chunk-ULXQ5MJM.js";
46
+ } from "./chunk-ORFLQGWH.js";
43
47
  import {
44
48
  anyOfTerms,
45
49
  isFunctionWord,
@@ -50,9 +54,8 @@ import {
50
54
  questionText,
51
55
  resolveMeetingSelection,
52
56
  words
53
- } from "./chunk-V77XNPXG.js";
57
+ } from "./chunk-CQ472K6W.js";
54
58
  import {
55
- DEFAULT_CONFIG,
56
59
  DEFAULT_IMAGE_MODEL,
57
60
  LINK,
58
61
  WEIGHTS,
@@ -62,26 +65,19 @@ import {
62
65
  codeOf,
63
66
  conversation,
64
67
  envName,
65
- environmentOf,
66
68
  guardedWrite,
67
69
  historyWindow,
68
70
  imageModel,
69
71
  imageModelsDirectory,
70
72
  isImageModelInstalled,
71
- itemOf,
72
- listOf,
73
- nextStep,
74
73
  oddName,
75
74
  parseDuration,
76
75
  placedImage,
77
76
  readOnlyLockOf,
78
- renderAnswer,
79
77
  sentIds,
80
- snakeKeys,
81
78
  tagging,
82
- task,
83
- withAgentLevels
84
- } from "./chunk-PM77PRB6.js";
79
+ task
80
+ } from "./chunk-VPBSZ4HQ.js";
85
81
  import {
86
82
  CustomTextModelShape,
87
83
  DEFAULT_RERANK_MODEL,
@@ -95,7 +91,7 @@ import {
95
91
  textModels,
96
92
  vectorModelKey,
97
93
  writeTextModelsSection
98
- } from "./chunk-5D4Z2B5B.js";
94
+ } from "./chunk-YSOGGUK3.js";
99
95
  import {
100
96
  AGENDA_COLUMNS,
101
97
  BUSINESS_FIND_MAX,
@@ -108,14 +104,11 @@ import {
108
104
  MAX_FILE_BYTES,
109
105
  MAX_TEXT_CHARS,
110
106
  MENTION_QUERY,
111
- MINUTE,
112
107
  NOT_FILES,
113
108
  PRESET_VERSION,
114
109
  STOP_WORDS,
115
110
  TASK_RELATION_KINDS,
116
111
  TRACKED_CHAT_COLUMNS,
117
- YEAR,
118
- aheadOf,
119
112
  amountsOf,
120
113
  attachmentColumns,
121
114
  attachmentMaxBytes,
@@ -149,12 +142,17 @@ import {
149
142
  rankingContextRange,
150
143
  threadConversation,
151
144
  withoutField
152
- } from "./chunk-P5LYZRKW.js";
145
+ } from "./chunk-TCDER3G7.js";
153
146
  import {
154
147
  DEFAULT_STEMMERS,
155
148
  createStemmer,
156
149
  cutsDeep
157
- } from "./chunk-TNUFLULO.js";
150
+ } from "./chunk-I4QCJZW7.js";
151
+ import {
152
+ MINUTE,
153
+ YEAR,
154
+ aheadOf
155
+ } from "./chunk-3NDMVXGS.js";
158
156
  import {
159
157
  FIELD_VERSION,
160
158
  RRF_K,
@@ -163,7 +161,7 @@ import {
163
161
  plainQuery,
164
162
  validateAst,
165
163
  validateFields
166
- } from "./chunk-XQL7FEF4.js";
164
+ } from "./chunk-ILUREFWJ.js";
167
165
  import {
168
166
  TASK_KINDS,
169
167
  TASK_STATES,
@@ -177,30 +175,23 @@ import {
177
175
  sourceOf3 as sourceOf2,
178
176
  typedCommand,
179
177
  withAttempt
180
- } from "./chunk-BVMNXI53.js";
178
+ } from "./chunk-77FP6AWC.js";
181
179
  import {
182
180
  isCliFailure,
183
181
  sqliteCode
184
- } from "./chunk-UBRREVLJ.js";
182
+ } from "./chunk-MMOEAH5G.js";
185
183
  import {
186
184
  localOnly,
187
185
  refuseOffComputer,
188
186
  remoteKey
189
- } from "./chunk-EPOV5UIO.js";
187
+ } from "./chunk-XI75EKLG.js";
190
188
  import {
191
189
  PLAIN_HTTP_REFUSED,
192
190
  endpoint,
193
191
  endpointFetch,
194
192
  modelAddressAllowed,
195
193
  onThisComputer
196
- } from "./chunk-GQ7VFIYM.js";
197
- import {
198
- DEFAULT_TASK_CATEGORIES,
199
- FALLBACK_CATEGORY,
200
- readSharedSection,
201
- sharedConfigPath,
202
- writeSharedSection
203
- } from "./chunk-DOSJONCX.js";
194
+ } from "./chunk-7USADF2W.js";
204
195
  import {
205
196
  Unzip,
206
197
  UnzipInflate,
@@ -211,11 +202,11 @@ import {
211
202
  placedText,
212
203
  runEmbedders,
213
204
  textModelsDirectory
214
- } from "./chunk-ODNQU7DH.js";
205
+ } from "./chunk-3YOZTGZ6.js";
215
206
  import {
216
207
  installFiles,
217
208
  megabytes
218
- } from "./chunk-U7RLVJ34.js";
209
+ } from "./chunk-UT3ODJMI.js";
219
210
  import {
220
211
  MAX_ACTIONS,
221
212
  ModerationRules,
@@ -229,7 +220,7 @@ import {
229
220
  someUndone,
230
221
  validateFormattedText,
231
222
  visibleFormattedText
232
- } from "./chunk-LSND5QYI.js";
223
+ } from "./chunk-VD7HD25M.js";
233
224
  import {
234
225
  COUNTER_FIELDS,
235
226
  RANKING_TOKENIZER_VERSION,
@@ -246,7 +237,7 @@ import {
246
237
  pickPerson,
247
238
  rankingOptions,
248
239
  rankingQuestion
249
- } from "./chunk-PFO76YFP.js";
240
+ } from "./chunk-VEGNZPQU.js";
250
241
  import {
251
242
  MESSAGE_PARSING,
252
243
  QUERY_LIMITS,
@@ -256,11 +247,11 @@ import {
256
247
  isQueryLimit,
257
248
  outOfTime,
258
249
  searchError
259
- } from "./chunk-DQV2IKCF.js";
250
+ } from "./chunk-PFZ7WG2B.js";
260
251
  import {
261
252
  fold,
262
253
  normalize
263
- } from "./chunk-TGEQNS6G.js";
254
+ } from "./chunk-OMH3WP7F.js";
264
255
  import {
265
256
  INTERNAL_NOTES,
266
257
  UNKNOWN_PROVIDER,
@@ -275,10 +266,10 @@ import {
275
266
  kindIn,
276
267
  parseLocator,
277
268
  parseReference
278
- } from "./chunk-QRQYUHCZ.js";
269
+ } from "./chunk-IYUWVMGP.js";
279
270
  import {
280
271
  normalizeTag
281
- } from "./chunk-63F65DHU.js";
272
+ } from "./chunk-BYVDMPLX.js";
282
273
  import {
283
274
  OPERATORS_BY_TYPE,
284
275
  READ_BUDGET_EXCEEDED,
@@ -303,19 +294,25 @@ import {
303
294
  validateQuery,
304
295
  walkQuery,
305
296
  windowOf
306
- } from "./chunk-A33TIM5D.js";
297
+ } from "./chunk-5RXH35ZA.js";
298
+ import {
299
+ DEFAULT_TASK_CATEGORIES,
300
+ FALLBACK_CATEGORY,
301
+ readSharedSection,
302
+ sharedConfigPath,
303
+ writeSharedSection
304
+ } from "./chunk-QHA33ZS6.js";
307
305
  import {
308
306
  storePath,
309
307
  wirecatDirectory
310
- } from "./chunk-5E5R65CA.js";
308
+ } from "./chunk-KTLCQ7GC.js";
311
309
  import {
312
310
  Credentials,
313
311
  pathsAreOverridden,
314
312
  resolvePaths
315
- } from "./chunk-DJD7TBYG.js";
313
+ } from "./chunk-ELJGALVX.js";
316
314
  import {
317
315
  array,
318
- boolean,
319
316
  check,
320
317
  getDotPath,
321
318
  integer,
@@ -330,7 +327,6 @@ import {
330
327
  parse,
331
328
  picklist,
332
329
  pipe,
333
- record,
334
330
  regex,
335
331
  safeInteger,
336
332
  safeParse,
@@ -340,7 +336,7 @@ import {
340
336
  trim,
341
337
  union,
342
338
  unknown
343
- } from "./chunk-AUBB72VF.js";
339
+ } from "./chunk-BKTLAXUK.js";
344
340
  import {
345
341
  importFrom,
346
342
  resolveFrom
@@ -349,7 +345,7 @@ import {
349
345
  CliError,
350
346
  isCliError,
351
347
  singleLine
352
- } from "./chunk-SZ2V62HB.js";
348
+ } from "./chunk-GCUFGDKE.js";
353
349
  import {
354
350
  __commonJS,
355
351
  __name,
@@ -2258,24 +2254,24 @@ var require_dom = __commonJS({
2258
2254
  function walkDOM(node, context2, callbacks) {
2259
2255
  var stack = [{ node, context: context2, phase: walkDOM.ENTER }];
2260
2256
  while (stack.length > 0) {
2261
- var frame2 = stack.pop();
2262
- if (frame2.phase === walkDOM.ENTER) {
2263
- var childContext = callbacks.enter(frame2.node, frame2.context);
2257
+ var frame = stack.pop();
2258
+ if (frame.phase === walkDOM.ENTER) {
2259
+ var childContext = callbacks.enter(frame.node, frame.context);
2264
2260
  if (childContext === walkDOM.STOP) {
2265
2261
  return walkDOM.STOP;
2266
2262
  }
2267
- stack.push({ node: frame2.node, context: childContext, phase: walkDOM.EXIT });
2263
+ stack.push({ node: frame.node, context: childContext, phase: walkDOM.EXIT });
2268
2264
  if (childContext === null || childContext === void 0) {
2269
2265
  continue;
2270
2266
  }
2271
- var child = frame2.node.lastChild;
2267
+ var child = frame.node.lastChild;
2272
2268
  while (child) {
2273
2269
  stack.push({ node: child, context: childContext, phase: walkDOM.ENTER });
2274
2270
  child = child.previousSibling;
2275
2271
  }
2276
2272
  } else {
2277
2273
  if (callbacks.exit) {
2278
- callbacks.exit(frame2.node, frame2.context);
2274
+ callbacks.exit(frame.node, frame.context);
2279
2275
  }
2280
2276
  }
2281
2277
  }
@@ -16965,10 +16961,10 @@ var require_lib3 = __commonJS({
16965
16961
  }
16966
16962
  });
16967
16963
 
16968
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/ports/traits.js
16964
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/ports/traits.js
16969
16965
  var syncsOneChat = /* @__PURE__ */ __name((messenger) => messenger.history !== "store" || messenger.historyOnDemand === true, "syncsOneChat");
16970
16966
 
16971
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/questions.js
16967
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/questions.js
16972
16968
  var LINKS = /https?:\/\/\S+/g;
16973
16969
  var unanswered = /* @__PURE__ */ __name((messages, { answerers: answerers2, before }) => questions(messages, { answerers: answerers2 }).filter(({ question, answer }) => answer === void 0 && Date.parse(question.timestamp) < before).map(({ question }) => question), "unanswered");
16974
16970
  var questions = /* @__PURE__ */ __name((messages, { answerers: answerers2, asker = "others" }) => {
@@ -16998,7 +16994,7 @@ var questions = /* @__PURE__ */ __name((messages, { answerers: answerers2, asker
16998
16994
  });
16999
16995
  }, "questions");
17000
16996
 
17001
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/task-categories.js
16997
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/task-categories.js
17002
16998
  var names = /* @__PURE__ */ __name((categories) => categories.map(({ name }) => name).join(", "), "names");
17003
16999
  var taskCategoryOf = /* @__PURE__ */ __name((categories = DEFAULT_TASK_CATEGORIES, flag = "--category") => (typed) => {
17004
17000
  const name = typed.trim().toLowerCase();
@@ -17055,7 +17051,7 @@ var categorize = /* @__PURE__ */ __name((text2, categories = DEFAULT_TASK_CATEGO
17055
17051
  return best.name;
17056
17052
  }, "categorize");
17057
17053
 
17058
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/task-rules.js
17054
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/task-rules.js
17059
17055
  var taskAccount = /* @__PURE__ */ __name(({ provider, account }) => `${provider}:${account}`, "taskAccount");
17060
17056
  var RULES_IN = {
17061
17057
  dialog: "all",
@@ -17261,8 +17257,8 @@ var applyTaskRulesToChats = /* @__PURE__ */ __name(async (store, account, chatId
17261
17257
  return passes;
17262
17258
  }, "applyTaskRulesToChats");
17263
17259
 
17264
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/conversations/link.js
17265
- var RULES_VERSION = 5;
17260
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/conversations/link.js
17261
+ var RULES_VERSION = 6;
17266
17262
  var LOOK_BACK = 50;
17267
17263
  var SAME_SENDER_WITHIN = 10;
17268
17264
  var SAME_SENDER_MS = 5 * 6e4;
@@ -17270,31 +17266,39 @@ var linkMessages = /* @__PURE__ */ __name((messages, { handles = /* @__PURE__ */
17270
17266
  const links = [];
17271
17267
  const parents = /* @__PURE__ */ new Map();
17272
17268
  const conversationOf = /* @__PURE__ */ new Map();
17269
+ const held = /* @__PURE__ */ new Map();
17273
17270
  const conversations = [];
17274
- const window3 = [];
17271
+ const window2 = [];
17275
17272
  for (const message of messages) {
17276
17273
  check2?.();
17277
17274
  const found = [
17278
- ...replyLink(message, conversationOf),
17279
- ...mentionLinks(message, window3, handles),
17280
- ...sameSenderLink(message, window3)
17275
+ ...replyLink(message, held),
17276
+ ...mentionLinks(message, window2, handles),
17277
+ ...sameSenderLink(message, window2)
17281
17278
  ];
17282
17279
  links.push(...found);
17283
- const parent = choose(found, answers, message.id, conversationOf);
17280
+ const parent = choose(found, answers, message, held);
17284
17281
  parents.set(message.id, parent);
17285
17282
  const conversation2 = parent === null ? conversations.length : conversationOf.get(parent);
17286
17283
  if (conversation2 === conversations.length)
17287
17284
  conversations.push([]);
17288
17285
  conversations[conversation2]?.push(message.id);
17289
17286
  conversationOf.set(message.id, conversation2);
17290
- window3.push(message);
17291
- if (window3.length > LOOK_BACK)
17292
- window3.shift();
17287
+ held.set(message.id, { threadId: message.threadId, text: message.text.trim() !== "" });
17288
+ window2.push(message);
17289
+ if (window2.length > LOOK_BACK)
17290
+ window2.shift();
17293
17291
  }
17294
17292
  return { links, parents, conversations };
17295
17293
  }, "linkMessages");
17296
- var replyLink = /* @__PURE__ */ __name((message, held) => message.replyToId !== void 0 && held.has(message.replyToId) ? [link(message, message.replyToId, "provider", "reply", 1, "reply")] : [], "replyLink");
17297
- var mentionLinks = /* @__PURE__ */ __name((message, window3, handles) => {
17294
+ var replyLink = /* @__PURE__ */ __name((message, held) => message.replyToId !== void 0 && inThread(held, message.replyToId, message) ? [link(message, message.replyToId, "provider", "reply", 1, "reply")] : [], "replyLink");
17295
+ var inThread = /* @__PURE__ */ __name((held, id2, message) => {
17296
+ const parent = held.get(id2);
17297
+ if (!parent)
17298
+ return false;
17299
+ return parent.threadId === message.threadId || id2 === message.threadId && parent.text;
17300
+ }, "inThread");
17301
+ var mentionLinks = /* @__PURE__ */ __name((message, window2, handles) => {
17298
17302
  const links = [];
17299
17303
  const people = new Set([...mentioned(message.text, handles)].flatMap((handle) => handles.get(handle) ?? []));
17300
17304
  for (const id2 of message.mentions ?? [])
@@ -17302,17 +17306,17 @@ var mentionLinks = /* @__PURE__ */ __name((message, window3, handles) => {
17302
17306
  for (const sender of people) {
17303
17307
  if (sender === message.senderId)
17304
17308
  continue;
17305
- const target2 = latest(window3, (candidate) => candidate.senderId === sender && sameThread(candidate, message));
17309
+ const target2 = latest(window2, (candidate) => candidate.senderId === sender && sameThread(candidate, message));
17306
17310
  if (target2)
17307
17311
  links.push(link(message, target2.id, "rule", "mention", 0.8, "mention-v1"));
17308
17312
  }
17309
17313
  return links;
17310
17314
  }, "mentionLinks");
17311
- var sameSenderLink = /* @__PURE__ */ __name((message, window3) => {
17315
+ var sameSenderLink = /* @__PURE__ */ __name((message, window2) => {
17312
17316
  if (message.senderId === null)
17313
17317
  return [];
17314
17318
  const at = Date.parse(message.timestamp);
17315
- const target2 = latest(window3.slice(-SAME_SENDER_WITHIN), (candidate) => candidate.senderId === message.senderId && sameThread(candidate, message) && at - Date.parse(candidate.timestamp) <= SAME_SENDER_MS);
17319
+ const target2 = latest(window2.slice(-SAME_SENDER_WITHIN), (candidate) => candidate.senderId === message.senderId && sameThread(candidate, message) && at - Date.parse(candidate.timestamp) <= SAME_SENDER_MS);
17316
17320
  return target2 ? [link(message, target2.id, "rule", "same_sender", 0.5, "same-sender-v2")] : [];
17317
17321
  }, "sameSenderLink");
17318
17322
  var mentioned = /* @__PURE__ */ __name((text2, handles) => {
@@ -17325,14 +17329,14 @@ var mentioned = /* @__PURE__ */ __name((text2, handles) => {
17325
17329
  found.add(opening);
17326
17330
  return found;
17327
17331
  }, "mentioned");
17328
- var choose = /* @__PURE__ */ __name((links, answers, id2, held) => {
17332
+ var choose = /* @__PURE__ */ __name((links, answers, message, held) => {
17329
17333
  const provider = links.find((one) => one.source === "provider");
17330
17334
  if (provider)
17331
17335
  return provider.parentId;
17332
- const answer = answers.get(id2);
17336
+ const answer = answers.get(message.id);
17333
17337
  if (answer === null)
17334
17338
  return null;
17335
- if (answer !== void 0 && held.has(answer))
17339
+ if (answer !== void 0 && inThread(held, answer, message))
17336
17340
  return answer;
17337
17341
  let best;
17338
17342
  for (const one of links)
@@ -17340,9 +17344,9 @@ var choose = /* @__PURE__ */ __name((links, answers, id2, held) => {
17340
17344
  best = one;
17341
17345
  return best?.parentId ?? null;
17342
17346
  }, "choose");
17343
- var latest = /* @__PURE__ */ __name((window3, matches) => {
17344
- for (let index = window3.length - 1; index >= 0; index--) {
17345
- const candidate = window3[index];
17347
+ var latest = /* @__PURE__ */ __name((window2, matches) => {
17348
+ for (let index = window2.length - 1; index >= 0; index--) {
17349
+ const candidate = window2[index];
17346
17350
  if (candidate && matches(candidate))
17347
17351
  return candidate;
17348
17352
  }
@@ -17351,7 +17355,7 @@ var latest = /* @__PURE__ */ __name((window3, matches) => {
17351
17355
  var sameThread = /* @__PURE__ */ __name((a, b) => a.threadId === b.threadId, "sameThread");
17352
17356
  var link = /* @__PURE__ */ __name((message, parentId, source, kind, confidence, method) => ({ messageId: message.id, parentId, source, kind, confidence, method }), "link");
17353
17357
 
17354
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/sends/upload.js
17358
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/sends/upload.js
17355
17359
  import { openAsBlob, realpathSync } from "node:fs";
17356
17360
  import { open, stat } from "node:fs/promises";
17357
17361
  import { basename, dirname, extname, isAbsolute, relative, resolve, sep } from "node:path";
@@ -17433,7 +17437,6 @@ var CREDENTIAL_RUNS = [
17433
17437
  ];
17434
17438
  var WIRECAT_APPS = [
17435
17439
  ...WIRECAT_TOOLS.map(({ appName, envPrefix }) => ({ appName, prefix: envPrefix })),
17436
- { appName: "amo-cli", prefix: "AMO" },
17437
17440
  { appName: "beeline-cli", prefix: "BEELINE" },
17438
17441
  { appName: "zm", prefix: "ZM" },
17439
17442
  { appName: "cli-messaging", prefix: "MESSAGING" },
@@ -17532,10 +17535,10 @@ var checkFilename = /* @__PURE__ */ __name((filename, files) => {
17532
17535
  if (filename.trim() === "" || /[/\\\0]/.test(filename) || filename.length > 255)
17533
17536
  throw new CliError("validation_error", "--filename is a name, not a path: no / or \\, at most 255 characters");
17534
17537
  }, "checkFilename");
17535
- var listOf2 = /* @__PURE__ */ __name((value) => value === void 0 ? [] : typeof value === "string" ? [value] : value, "listOf");
17538
+ var listOf = /* @__PURE__ */ __name((value) => value === void 0 ? [] : typeof value === "string" ? [value] : value, "listOf");
17536
17539
  var readAttachments = /* @__PURE__ */ __name(async ({ photo, file, voice, asFile, filename, text: text2 }, read) => {
17537
- const photos = listOf2(photo);
17538
- const files = listOf2(file);
17540
+ const photos = listOf(photo);
17541
+ const files = listOf(file);
17539
17542
  if (voice !== void 0 && (photos.length > 0 || files.length > 0 || (text2 ?? "").trim() !== "")) {
17540
17543
  throw new CliError("validation_error", "a voice message goes alone \u2014 no text, no file, no photo beside it");
17541
17544
  }
@@ -17568,24 +17571,7 @@ var readStickerFile = /* @__PURE__ */ __name(async (path, maxBytes, read) => {
17568
17571
  return { name, source };
17569
17572
  }, "readStickerFile");
17570
17573
 
17571
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/ports/messenger.js
17572
- var throughWrapper = /* @__PURE__ */ __name((inner, handled, wrap = (_, call) => call) => new Proxy(handled, {
17573
- get: /* @__PURE__ */ __name((own, key) => {
17574
- if (key in own)
17575
- return own[key];
17576
- const value = inner[key];
17577
- return typeof value === "function" ? wrap(String(key), (...args) => value.apply(inner, args)) : value;
17578
- }, "get"),
17579
- has: /* @__PURE__ */ __name((own, key) => key in own || key in inner, "has")
17580
- }), "throughWrapper");
17581
- var capability = /* @__PURE__ */ __name((adapter, method, what) => {
17582
- const found = adapter[method];
17583
- if (typeof found !== "function")
17584
- throw new CliError("validation_error", `this messenger cannot ${what}`);
17585
- return found.bind(adapter);
17586
- }, "capability");
17587
-
17588
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/deps.js
17574
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/deps.js
17589
17575
  var accountStore = /* @__PURE__ */ __name(async (deps) => (await deps.store()).forAccount(await deps.account()), "accountStore");
17590
17576
  var crossAccount = /* @__PURE__ */ __name((deps, _reason) => deps.store(), "crossAccount");
17591
17577
  var NO_LOCAL_STORE = "this answer comes from the messenger, not from the local store";
@@ -17647,7 +17633,7 @@ var storedDeps = /* @__PURE__ */ __name((messenger, store, account, guard) => ({
17647
17633
  }), "storedDeps");
17648
17634
  var storeModeDeps = /* @__PURE__ */ __name((messenger, store, account, guard) => ({ ...storedDeps(messenger, store, account, guard), offline: false, reads: "store" }), "storeModeDeps");
17649
17635
 
17650
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/botcheck/check.js
17636
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/botcheck/check.js
17651
17637
  var DAY_MS = 864e5;
17652
17638
  var NEW_DAYS = 30;
17653
17639
  var SAME_TEXT_MIN = 20;
@@ -17724,7 +17710,7 @@ var scorePerson = /* @__PURE__ */ __name(({ subject, provider, activity, photos,
17724
17710
  };
17725
17711
  }, "scorePerson");
17726
17712
 
17727
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/http/time-limit.js
17713
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/http/time-limit.js
17728
17714
  var timeLimit = /* @__PURE__ */ __name((ms) => {
17729
17715
  const controller = new AbortController();
17730
17716
  const timer = setTimeout(() => controller.abort(new DOMException("The operation timed out.", "TimeoutError")), ms);
@@ -17740,7 +17726,7 @@ var withTimeLimit = /* @__PURE__ */ __name(async (ms, run2) => {
17740
17726
  }
17741
17727
  }, "withTimeLimit");
17742
17728
 
17743
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/botcheck/registries.js
17729
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/botcheck/registries.js
17744
17730
  var REGISTRIES = {
17745
17731
  cas: { title: "Combot Anti-Spam (CAS)", docs: "https://cas.chat/api" },
17746
17732
  lols: { title: "lols.bot", docs: "https://api.lols.bot/lols-bot.json" }
@@ -17827,7 +17813,7 @@ var notCovered = /* @__PURE__ */ __name((messenger, now = /* @__PURE__ */ new Da
17827
17813
  detail: `lists Telegram accounts only, not ${messenger} ones`
17828
17814
  })), "notCovered");
17829
17815
 
17830
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/botcheck/service.js
17816
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/botcheck/service.js
17831
17817
  var ACTIVITY_MESSAGES = 1e3;
17832
17818
  var botCheckService = /* @__PURE__ */ __name((deps) => {
17833
17819
  const subjectOf = /* @__PURE__ */ __name(async (reference) => {
@@ -17915,7 +17901,7 @@ var botCheckService = /* @__PURE__ */ __name((deps) => {
17915
17901
  };
17916
17902
  }, "botCheckService");
17917
17903
 
17918
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/domain/thread.js
17904
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/domain/thread.js
17919
17905
  var threadIdOf = /* @__PURE__ */ __name((value) => {
17920
17906
  if (value === void 0)
17921
17907
  return void 0;
@@ -17925,7 +17911,7 @@ var threadIdOf = /* @__PURE__ */ __name((value) => {
17925
17911
  return id2;
17926
17912
  }, "threadIdOf");
17927
17913
 
17928
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/chat-stats.js
17914
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/chat-stats.js
17929
17915
  var TOP_POSTS = 5;
17930
17916
  var JOINS = /* @__PURE__ */ new Set(["join", "add"]);
17931
17917
  var LEAVES = /* @__PURE__ */ new Set(["leave", "remove"]);
@@ -18042,7 +18028,7 @@ var median = /* @__PURE__ */ __name((values) => {
18042
18028
  return Math.round(sorted.length % 2 === 0 ? ((sorted[middle - 1] ?? upper) + upper) / 2 : upper);
18043
18029
  }, "median");
18044
18030
 
18045
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/member-history.js
18031
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/member-history.js
18046
18032
  var memberEvents = /* @__PURE__ */ __name((stays, revisions, since = 0) => {
18047
18033
  const events = [];
18048
18034
  for (const stay of stays) {
@@ -18074,7 +18060,7 @@ var memberEvents = /* @__PURE__ */ __name((stays, revisions, since = 0) => {
18074
18060
  return events.filter(({ at }) => Date.parse(at) >= since).sort((a, b) => Date.parse(a.at) - Date.parse(b.at) || a.id.localeCompare(b.id));
18075
18061
  }, "memberEvents");
18076
18062
 
18077
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/members-audit.js
18063
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/members-audit.js
18078
18064
  var AUDIT_PAGE = 200;
18079
18065
  var AUDIT_BUDGET = 10;
18080
18066
  var AUDIT_PAUSE_MS = 1e3;
@@ -18154,7 +18140,7 @@ var burstJoins = /* @__PURE__ */ __name((members) => {
18154
18140
  return found;
18155
18141
  }, "burstJoins");
18156
18142
 
18157
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/message-resolution.js
18143
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/message-resolution.js
18158
18144
  var readChatId = /* @__PURE__ */ __name(async (deps, reference, store, account) => {
18159
18145
  if (deps.reads !== "store")
18160
18146
  return keptChatId(deps.messenger, reference, store, account);
@@ -18255,9 +18241,9 @@ var chatIdAmong = /* @__PURE__ */ __name(async (messenger, reference, account, {
18255
18241
  }, "chatIdAmong");
18256
18242
  var ambiguousAcross = /* @__PURE__ */ __name((reference, what, candidates) => {
18257
18243
  const width = Math.max(...candidates.map(({ provider, id: id2 }) => `${provider} ${id2}`.length));
18258
- const lines3 = candidates.map(({ provider, id: id2, label }) => ` ${`${provider} ${id2}`.padEnd(width)} ${label}`);
18244
+ const lines = candidates.map(({ provider, id: id2, label }) => ` ${`${provider} ${id2}`.padEnd(width)} ${label}`);
18259
18245
  return new CliError("validation_error", `"${singleLine(reference)}" matches ${candidates.length} ${what} in different accounts \u2014 name one by its id, or narrow the search with in:<messenger>:
18260
- ${lines3.join("\n")}`, { candidates: candidates.map(({ provider, id: id2 }) => ({ provider, id: id2 })) });
18246
+ ${lines.join("\n")}`, { candidates: candidates.map(({ provider, id: id2 }) => ({ provider, id: id2 })) });
18261
18247
  }, "ambiguousAcross");
18262
18248
  var missing = /* @__PURE__ */ __name((error) => {
18263
18249
  if (codeOf(error) === "not_found")
@@ -18355,7 +18341,7 @@ var chatsMatchingIn = /* @__PURE__ */ __name(async (store, accounts, pattern) =>
18355
18341
  }, "chatsMatchingIn");
18356
18342
  var isText = /* @__PURE__ */ __name((value) => typeof value === "string" && value !== "", "isText");
18357
18343
 
18358
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/chats.js
18344
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/chats.js
18359
18345
  var EVENTS_DAYS = 7;
18360
18346
  var TRACKED_DAYS = 30;
18361
18347
  var STATS_PAGE = 1e3;
@@ -18389,15 +18375,15 @@ var deepChecks = /* @__PURE__ */ __name(async (deps, items, deep, pauseMs, regis
18389
18375
  return checked2;
18390
18376
  }, "deepChecks");
18391
18377
  var chatsService = /* @__PURE__ */ __name((deps) => ({
18392
- list: /* @__PURE__ */ __name(async (window3, query) => {
18378
+ list: /* @__PURE__ */ __name(async (window2, query) => {
18393
18379
  if (fromStore(deps)) {
18394
18380
  const where = query ? queryFilter(query, CHAT_COLUMNS, { command: "chats list", zone: timezoneOf() }) : void 0;
18395
- return (await accountStore(deps)).chats.chats({ ...window3, ...where ? { where } : {} });
18381
+ return (await accountStore(deps)).chats.chats({ ...window2, ...where ? { where } : {} });
18396
18382
  }
18397
18383
  const [term] = query ? walkQuery(query.root) : [];
18398
18384
  if (term)
18399
18385
  queryError("query.unsupported-field", term.span, "the messenger cannot filter its chat list; the fields answer from the local store, with --offline", { command: "chats list" }, { supported: [] });
18400
- return capability(await deps.connection(), "chats", "list chats")(window3);
18386
+ return capability(await deps.connection(), "chats", "list chats")(window2);
18401
18387
  }, "list"),
18402
18388
  account: /* @__PURE__ */ __name(() => deps.account(), "account"),
18403
18389
  show: /* @__PURE__ */ __name(async (chat) => {
@@ -18421,17 +18407,17 @@ var chatsService = /* @__PURE__ */ __name((deps) => ({
18421
18407
  const held = await accountStoreIfOpen(deps);
18422
18408
  return held ? { ...card, members: await storedMembers(held, card.id) } : card;
18423
18409
  }, "show"),
18424
- members: /* @__PURE__ */ __name(async (chat, window3) => {
18410
+ members: /* @__PURE__ */ __name(async (chat, window2) => {
18425
18411
  if (!deps.offline) {
18426
18412
  const connection = await deps.connection();
18427
18413
  if (!fromStore(deps) || connection.members)
18428
- return capability(connection, "members", "list a group's members")(chat, window3);
18414
+ return capability(connection, "members", "list a group's members")(chat, window2);
18429
18415
  }
18430
18416
  const store = await accountStore(deps);
18431
18417
  const chatId = await chatIdIn(deps.messenger, chat, store, { includeLeft: true });
18432
18418
  const everyone = await store.roster.members(chatId);
18433
- const end = window3.limit === void 0 ? everyone.length : window3.offset + window3.limit;
18434
- return { chatId, items: everyone.slice(window3.offset, end), hasMore: everyone.length > end };
18419
+ const end = window2.limit === void 0 ? everyone.length : window2.offset + window2.limit;
18420
+ return { chatId, items: everyone.slice(window2.offset, end), hasMore: everyone.length > end };
18435
18421
  }, "members"),
18436
18422
  events: /* @__PURE__ */ __name(async (chat, { since }) => {
18437
18423
  const from = since ?? Date.now() - EVENTS_DAYS * 864e5;
@@ -18650,7 +18636,7 @@ var storedMembers = /* @__PURE__ */ __name(async (store, chatId) => {
18650
18636
  return members.length === 0 ? null : members;
18651
18637
  }, "storedMembers");
18652
18638
 
18653
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/inbox.js
18639
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/inbox.js
18654
18640
  var INBOX_CHATS = 20;
18655
18641
  var REVIEW_DAYS = 3;
18656
18642
  var UNANSWERED_HOURS = 24;
@@ -18670,7 +18656,7 @@ var storeReader = /* @__PURE__ */ __name((deps, store, account) => ({
18670
18656
  const end = limit === void 0 ? all.length : offset + limit;
18671
18657
  return { items: all.slice(offset, end), hasMore: all.length > end };
18672
18658
  }, "chats"),
18673
- history: /* @__PURE__ */ __name((chat, window3) => store.messages.messages(account, chat, window3), "history"),
18659
+ history: /* @__PURE__ */ __name((chat, window2) => store.messages.messages(account, chat, window2), "history"),
18674
18660
  resolve: /* @__PURE__ */ __name(async (reference) => {
18675
18661
  const id2 = await readChatId(deps, reference, store, account);
18676
18662
  const found = (await store.chats.chats(account, {})).items.find((one) => one.id === id2);
@@ -18858,7 +18844,7 @@ var inboxService = /* @__PURE__ */ __name((deps) => {
18858
18844
  };
18859
18845
  }, "inboxService");
18860
18846
 
18861
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/excerpt.js
18847
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/excerpt.js
18862
18848
  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");
18863
18849
  var excerpt = /* @__PURE__ */ __name((text2, query, size2 = 240, options2 = {}) => {
18864
18850
  const flat = text2.replace(/\s+/g, " ").trim();
@@ -18874,7 +18860,7 @@ var excerpt = /* @__PURE__ */ __name((text2, query, size2 = 240, options2 = {})
18874
18860
  }, "excerpt");
18875
18861
  var withExcerpt = /* @__PURE__ */ __name(({ matchedText, ...hit }, query) => ({ ...hit, excerpt: excerpt(matchedText ?? hit.text, query) }), "withExcerpt");
18876
18862
 
18877
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/person-meetings.js
18863
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/person-meetings.js
18878
18864
  var SCAN = 1e3;
18879
18865
  var SNIPPET = 200;
18880
18866
  var SNIPPET_ROWS = 6;
@@ -18939,7 +18925,7 @@ var personMeetings = /* @__PURE__ */ __name(async (store, people, accounts, { li
18939
18925
  return { items, total: newest.length, hasMore: cut || newest.length > limit };
18940
18926
  }, "personMeetings");
18941
18927
 
18942
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/person-context.js
18928
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/person-context.js
18943
18929
  var CONTEXT_MESSAGES = 10;
18944
18930
  var CONTEXT_BYTES = 64 * 1024;
18945
18931
  var toContext = /* @__PURE__ */ __name((key, message, chatTitle2) => ({
@@ -19028,25 +19014,25 @@ var readableAccounts = /* @__PURE__ */ __name(async (store, asked, scopes) => {
19028
19014
  return stored.filter((one) => allowed.includes(one.scope));
19029
19015
  }, "readableAccounts");
19030
19016
  var readableScopes = /* @__PURE__ */ __name(async (store, asked, scopes) => (await allowedOf(store, asked, scopes)).allowed, "readableScopes");
19031
- var readsOf = /* @__PURE__ */ __name((record2, asked, readable) => {
19017
+ var readsOf = /* @__PURE__ */ __name((record, asked, readable) => {
19032
19018
  const scopeOf5 = new Map(readable.map((one) => [nameOf(one), one.scope]));
19033
- return record2.identities.flatMap((identity) => (identity.provider === asked.provider ? [asked.account] : identity.accounts).flatMap((account) => {
19019
+ return record.identities.flatMap((identity) => (identity.provider === asked.provider ? [asked.account] : identity.accounts).flatMap((account) => {
19034
19020
  const scope = scopeOf5.get(nameOf({ provider: identity.provider, account }));
19035
19021
  return identity.accounts.includes(account) && scope !== void 0 ? [{ key: { provider: identity.provider, account }, scope, identity }] : [];
19036
19022
  }));
19037
19023
  }, "readsOf");
19038
19024
  var personContext = /* @__PURE__ */ __name(async (store, asked, reference, options2 = {}) => {
19039
19025
  const found = pickPerson(reference, await store.people.people(asked.provider, { account: asked.account }));
19040
- const record2 = await store.people.personOf({ provider: asked.provider, id: found.id });
19041
- if (!record2)
19026
+ const record = await store.people.personOf({ provider: asked.provider, id: found.id });
19027
+ if (!record)
19042
19028
  throw new CliError("not_found", `no person ${found.id} in the store`);
19043
19029
  const readable = await readableAccounts(store, asked, options2.scopes);
19044
19030
  return {
19045
- person: { ...record2, provider: asked.provider, id: found.id },
19046
- ...await recordContext(store, record2, readsOf(record2, asked, readable), readable, options2)
19031
+ person: { ...record, provider: asked.provider, id: found.id },
19032
+ ...await recordContext(store, record, readsOf(record, asked, readable), readable, options2)
19047
19033
  };
19048
19034
  }, "personContext");
19049
- var recordContext = /* @__PURE__ */ __name(async (store, record2, reads, readable, { messages = CONTEXT_MESSAGES, bytes: bytes2 = CONTEXT_BYTES, since, now = Date.now(), calendarIds, scopes } = {}) => {
19035
+ var recordContext = /* @__PURE__ */ __name(async (store, record, reads, readable, { messages = CONTEXT_MESSAGES, bytes: bytes2 = CONTEXT_BYTES, since, now = Date.now(), calendarIds, scopes } = {}) => {
19050
19036
  const recent = /* @__PURE__ */ __name((message) => since === void 0 || Date.parse(message.timestamp) >= since, "recent");
19051
19037
  const allowed = new Set(scopes ?? readable.map((one) => one.scope));
19052
19038
  const inScope = /* @__PURE__ */ __name(async (key, scope, hits) => {
@@ -19108,7 +19094,7 @@ var recordContext = /* @__PURE__ */ __name(async (store, record2, reads, readabl
19108
19094
  mentions.push(...(await inScope(key, scope, named2.items)).filter((hit) => hit.senderId !== identity.id).map((hit) => toContext(key, hit, hit.chatTitle ?? null)).filter(recent));
19109
19095
  cut ||= named2.hasMore;
19110
19096
  }
19111
- const personId = Number(record2.uid);
19097
+ const personId = Number(record.uid);
19112
19098
  const calendars = [];
19113
19099
  for (const one of readable)
19114
19100
  if ((await store.calendar.calendars(one.id)).length)
@@ -19120,7 +19106,7 @@ var recordContext = /* @__PURE__ */ __name(async (store, record2, reads, readabl
19120
19106
  const upcomingIds = new Set(upcoming.items.map(({ id: id2 }) => id2));
19121
19107
  const past = accountIds.length ? await eventsOnce(store, { personId, accountIds, to: now, newest: true, ...since === void 0 ? {} : { from: since } }, messages) : nothing;
19122
19108
  cut ||= upcoming.cut || past.cut;
19123
- const recorded = await personMeetings(store, [record2.uid], readable, {
19109
+ const recorded = await personMeetings(store, [record.uid], readable, {
19124
19110
  limit: messages,
19125
19111
  ...since === void 0 ? {} : { since }
19126
19112
  });
@@ -19222,8 +19208,8 @@ var lean = /* @__PURE__ */ __name((key, message, detail) => {
19222
19208
  var kindOf2 = /* @__PURE__ */ __name((chat, chatId, person) => chat && chat.kind !== "unknown" ? chat.kind : chatId === person ? "dialog" : chat?.kind ?? "unknown", "kindOf");
19223
19209
  var personMessages = /* @__PURE__ */ __name(async (store, asked, reference, { chats, limit = CHAT_MESSAGES, detail = 0 }) => {
19224
19210
  const found = pickPerson(reference, await store.people.people(asked.provider, { account: asked.account }));
19225
- const record2 = await store.people.personOf({ provider: asked.provider, id: found.id });
19226
- if (!record2)
19211
+ const record = await store.people.personOf({ provider: asked.provider, id: found.id });
19212
+ if (!record)
19227
19213
  throw new CliError("not_found", `no person ${found.id} in the store`);
19228
19214
  const stored = (await store.chats.chats(asked, {})).items;
19229
19215
  const held = new Map((await store.chats.chatCompleteness(asked, chats)).map((one) => [one.chatId, one.state]));
@@ -19239,16 +19225,16 @@ var personMessages = /* @__PURE__ */ __name(async (store, asked, reference, { ch
19239
19225
  });
19240
19226
  }
19241
19227
  return {
19242
- person: { uid: record2.uid, provider: asked.provider, id: found.id, name: found.name ?? record2.name },
19228
+ person: { uid: record.uid, provider: asked.provider, id: found.id, name: found.name ?? record.name },
19243
19229
  chats: answer,
19244
19230
  limits: { messages: limit }
19245
19231
  };
19246
19232
  }, "personMessages");
19247
19233
 
19248
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
19234
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
19249
19235
  import { createHash } from "node:crypto";
19250
19236
 
19251
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/meeting-reference.js
19237
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/meeting-reference.js
19252
19238
  var missing2 = /* @__PURE__ */ __name(() => new CliError("not_found", "the meeting evidence is unavailable for this account"), "missing");
19253
19239
  var authorizedMeetingMetadata = /* @__PURE__ */ __name(async (store, accountId, reference, options2 = {}) => {
19254
19240
  const parsed = parseMeetingReference(reference);
@@ -19266,7 +19252,7 @@ var authorizedMeetingMetadata = /* @__PURE__ */ __name(async (store, accountId,
19266
19252
  return { parsed, meeting };
19267
19253
  }, "authorizedMeetingMetadata");
19268
19254
 
19269
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
19255
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
19270
19256
  var hash = /* @__PURE__ */ __name((value) => createHash("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
19271
19257
  var checkMeetingCancelled = /* @__PURE__ */ __name((signal) => {
19272
19258
  if (signal?.aborted)
@@ -19465,7 +19451,7 @@ var readMeetingEvidence = /* @__PURE__ */ __name(async (store, accountId, refere
19465
19451
  return { ...packet, fingerprint: hash(packet) };
19466
19452
  }, "readMeetingEvidence");
19467
19453
 
19468
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/person-meeting-context.js
19454
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/person-meeting-context.js
19469
19455
  var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference, options2) => {
19470
19456
  const { meetings = 10, cues = 5, bytes: bytes2 = 64 * 1024, scanLimit = 1e3, since, signal } = options2;
19471
19457
  const requestedAccounts = options2.accountIds;
@@ -19564,7 +19550,7 @@ var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference,
19564
19550
  };
19565
19551
  }, "personMeetingContext");
19566
19552
 
19567
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/person-preparation.js
19553
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/person-preparation.js
19568
19554
  var PREPARE_BYTES = 96 * 1024;
19569
19555
  var MEETINGS = 5;
19570
19556
  var CUES = 3;
@@ -19687,7 +19673,7 @@ var meetingsOf = /* @__PURE__ */ __name(async (store, uid, stored, since, left)
19687
19673
  }
19688
19674
  }, "meetingsOf");
19689
19675
 
19690
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/person-profile.js
19676
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/person-profile.js
19691
19677
  var personProfile = /* @__PURE__ */ __name(async (deps, person, known2) => {
19692
19678
  const online = deps.offline ? void 0 : await deps.connection();
19693
19679
  const held = await storeIfOpen(deps);
@@ -19757,7 +19743,7 @@ var quiet = /* @__PURE__ */ __name((facts) => facts.chats.map(({ id: id2, title,
19757
19743
  complete: false
19758
19744
  })), "quiet");
19759
19745
 
19760
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/person-timeline.js
19746
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/person-timeline.js
19761
19747
  var TIMELINE_ITEMS = 50;
19762
19748
  var TIMELINE_MAX = 500;
19763
19749
  var SCOPES = ["personal", "work"];
@@ -19781,10 +19767,10 @@ var personTimeline = /* @__PURE__ */ __name(async (store, asked, reference, { sc
19781
19767
  });
19782
19768
  const read = scope === void 0 ? [...allowed] : [scope];
19783
19769
  const found = pickPerson(reference, await store.people.people(asked.provider, { account: asked.account }));
19784
- const record2 = await store.people.personOf({ provider: asked.provider, id: found.id });
19785
- if (!record2)
19770
+ const record = await store.people.personOf({ provider: asked.provider, id: found.id });
19771
+ if (!record)
19786
19772
  throw new CliError("not_found", `no person ${found.id} in the store`);
19787
- const personId = Number(record2.uid);
19773
+ const personId = Number(record.uid);
19788
19774
  const pending = store.involvements.pending();
19789
19775
  const rows = store.involvements.forPerson(personId, {
19790
19776
  scopes: read,
@@ -19798,7 +19784,7 @@ var personTimeline = /* @__PURE__ */ __name(async (store, asked, reference, { sc
19798
19784
  const last = shown.at(-1);
19799
19785
  const hasMore = rows.length > limit;
19800
19786
  return {
19801
- person: { uid: record2.uid, name: record2.name },
19787
+ person: { uid: record.uid, name: record.name },
19802
19788
  scopes: read,
19803
19789
  items: shown.map((row) => ({
19804
19790
  at: new Date(row.occurredAt).toISOString(),
@@ -19819,7 +19805,7 @@ var personTimeline = /* @__PURE__ */ __name(async (store, asked, reference, { sc
19819
19805
  };
19820
19806
  }, "personTimeline");
19821
19807
 
19822
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/chat-coverage.js
19808
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/chat-coverage.js
19823
19809
  var chatCoverage = /* @__PURE__ */ __name(async (store, account, chatIds) => {
19824
19810
  const ids = [...new Set(chatIds)];
19825
19811
  if (ids.length === 0)
@@ -19845,7 +19831,7 @@ var chatCoverage = /* @__PURE__ */ __name(async (store, account, chatIds) => {
19845
19831
  }));
19846
19832
  }, "chatCoverage");
19847
19833
 
19848
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/context/evidence-response.js
19834
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/context/evidence-response.js
19849
19835
  var contextSourceKey = /* @__PURE__ */ __name((source) => JSON.stringify([source.kind, source.accountId, source.provider, source.account]), "contextSourceKey");
19850
19836
  var validateContextEvidencePage = /* @__PURE__ */ __name((page, request) => {
19851
19837
  const fail2 = /* @__PURE__ */ __name(() => {
@@ -19909,7 +19895,7 @@ var validateContextEvidencePage = /* @__PURE__ */ __name((page, request) => {
19909
19895
  }
19910
19896
  }, "validateContextEvidencePage");
19911
19897
 
19912
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/context/read-budget.js
19898
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/context/read-budget.js
19913
19899
  var contextReadBudget = /* @__PURE__ */ __name((limits = {}) => {
19914
19900
  if (!limits || typeof limits !== "object" || Array.isArray(limits))
19915
19901
  throw new CliError("validation_error", "limits needs a context read allowance");
@@ -19962,7 +19948,7 @@ var contextReadBudget = /* @__PURE__ */ __name((limits = {}) => {
19962
19948
  };
19963
19949
  }, "contextReadBudget");
19964
19950
 
19965
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/context-evidence.js
19951
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/context-evidence.js
19966
19952
  var createContextEvidenceReader = /* @__PURE__ */ __name((port, allowed, limits) => {
19967
19953
  if (!port || typeof port.read !== "function")
19968
19954
  throw new CliError("configuration_error", "context evidence reader is unavailable");
@@ -20006,13 +19992,13 @@ var createContextEvidenceReader = /* @__PURE__ */ __name((port, allowed, limits)
20006
19992
  };
20007
19993
  }, "createContextEvidenceReader");
20008
19994
 
20009
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/project-gathering-around.js
19995
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/project-gathering-around.js
20010
19996
  var storedMessageNeighbours = /* @__PURE__ */ __name((messages) => ({
20011
- async around(ref, window3) {
19997
+ async around(ref, window2) {
20012
19998
  const at = parseLocator(ref);
20013
19999
  if (at.provider === "email")
20014
20000
  return [];
20015
- const rows = await messages.around({ provider: at.provider, account: at.account }, at.chat, at.message, window3);
20001
+ const rows = await messages.around({ provider: at.provider, account: at.account }, at.chat, at.message, window2);
20016
20002
  return rows.filter((row) => !row.anchor).map((row) => ({
20017
20003
  ref: formatLocator({ ...at, message: row.id }),
20018
20004
  at: Date.parse(row.timestamp),
@@ -20022,7 +20008,7 @@ var storedMessageNeighbours = /* @__PURE__ */ __name((messages) => ({
20022
20008
  }
20023
20009
  }), "storedMessageNeighbours");
20024
20010
  var wordsOf = /* @__PURE__ */ __name((text2) => (text2.match(/[\p{L}\p{N}\p{M}]+/gu) ?? []).map(fold), "wordsOf");
20025
- var documentMatches = /* @__PURE__ */ __name((text2, queries, window3) => {
20011
+ var documentMatches = /* @__PURE__ */ __name((text2, queries, window2) => {
20026
20012
  const paragraphs = text2.split(/\n\s*\n/).map((part) => part.replace(/\s+/g, " ").trim()).filter(Boolean);
20027
20013
  const query = queries.join(" ");
20028
20014
  const words3 = new Set(wordsOf(query));
@@ -20030,15 +20016,15 @@ var documentMatches = /* @__PURE__ */ __name((text2, queries, window3) => {
20030
20016
  const hit = matching2[0];
20031
20017
  if (hit === void 0 || paragraphs.length < 2)
20032
20018
  return { around: [], moreMatches: 0 };
20033
- const from = Math.max(0, hit - window3.before);
20034
- const around = paragraphs.slice(from, hit + window3.after + 1).map((part, index) => ({
20019
+ const from = Math.max(0, hit - window2.before);
20020
+ const around = paragraphs.slice(from, hit + window2.after + 1).map((part, index) => ({
20035
20021
  text: excerpt(part, query, 200, { literal: true }),
20036
20022
  found: from + index === hit
20037
20023
  }));
20038
20024
  return { around, moreMatches: matching2.length - 1 };
20039
20025
  }, "documentMatches");
20040
- var attachNeighbours = /* @__PURE__ */ __name(async (items, reader, window3, budget, known2, signal) => {
20041
- if (!reader || window3.before + window3.after === 0)
20026
+ var attachNeighbours = /* @__PURE__ */ __name(async (items, reader, window2, budget, known2, signal) => {
20027
+ if (!reader || window2.before + window2.after === 0)
20042
20028
  return;
20043
20029
  for (const item2 of items) {
20044
20030
  if (item2.kind !== "message" && item2.kind !== "mail")
@@ -20050,9 +20036,9 @@ var attachNeighbours = /* @__PURE__ */ __name(async (items, reader, window3, bud
20050
20036
  }
20051
20037
  signal?.throwIfAborted();
20052
20038
  try {
20053
- const rows = await reader.around(item2.ref, window3);
20039
+ const rows = await reader.around(item2.ref, window2);
20054
20040
  const around = [];
20055
- for (const row of rows.slice(0, window3.before + window3.after)) {
20041
+ for (const row of rows.slice(0, window2.before + window2.after)) {
20056
20042
  const text2 = excerpt(row.text, "", 200);
20057
20043
  const bytes2 = Buffer.byteLength(text2);
20058
20044
  if (bytes2 > budget.remaining()) {
@@ -20075,10 +20061,10 @@ var attachNeighbours = /* @__PURE__ */ __name(async (items, reader, window3, bud
20075
20061
  var storedNeighbours = /* @__PURE__ */ __name((store) => {
20076
20062
  const messages = storedMessageNeighbours(store.messages);
20077
20063
  return {
20078
- async around(ref, window3) {
20064
+ async around(ref, window2) {
20079
20065
  const at = parseLocator(ref);
20080
20066
  if (at.provider !== "email")
20081
- return messages.around(ref, window3);
20067
+ return messages.around(ref, window2);
20082
20068
  const account = await store.accounts.storedAccount({ provider: at.provider, account: at.account });
20083
20069
  const email = await store.mail.email(account.id, at.message);
20084
20070
  if (!email)
@@ -20089,8 +20075,8 @@ var storedNeighbours = /* @__PURE__ */ __name((store) => {
20089
20075
  if (index < 0)
20090
20076
  return [];
20091
20077
  return [
20092
- ...emails.slice(Math.max(0, index - window3.before), index),
20093
- ...emails.slice(index + 1, index + 1 + window3.after)
20078
+ ...emails.slice(Math.max(0, index - window2.before), index),
20079
+ ...emails.slice(index + 1, index + 1 + window2.after)
20094
20080
  ].map((one) => ({
20095
20081
  ref: formatLocator({ ...at, message: one.externalId }),
20096
20082
  at: one.sentAt ?? one.receivedAt ?? 0,
@@ -20101,7 +20087,7 @@ var storedNeighbours = /* @__PURE__ */ __name((store) => {
20101
20087
  };
20102
20088
  }, "storedNeighbours");
20103
20089
 
20104
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/project-gathering-request.js
20090
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/project-gathering-request.js
20105
20091
  import { createHash as createHash2 } from "node:crypto";
20106
20092
  var DAY = 864e5;
20107
20093
  var MAX_TIME = 864e13;
@@ -20301,7 +20287,7 @@ var projectGatheringRequest = /* @__PURE__ */ __name((input, now) => {
20301
20287
  fail("an explicit window needs after; before defaults to asOf", "after");
20302
20288
  const asOf = input.asOf === void 0 ? null : whole(input.asOf, "asOf", 1, MAX_TIME);
20303
20289
  const lookbackDays = explicit ? null : whole(input.lookbackDays ?? 60, "lookbackDays", 1, LIMITS.lookbackDays);
20304
- const window3 = explicit ? (() => {
20290
+ const window2 = explicit ? (() => {
20305
20291
  const after = whole(input.after, "after", 0, MAX_TIME);
20306
20292
  const before = whole(input.before ?? asOf ?? now, "before", after + 1, MAX_TIME);
20307
20293
  if (before - after > LIMITS.lookbackDays * DAY)
@@ -20326,7 +20312,7 @@ var projectGatheringRequest = /* @__PURE__ */ __name((input, now) => {
20326
20312
  sources.map(contextSourceKey),
20327
20313
  input.scope,
20328
20314
  lookbackDays,
20329
- explicit ? [window3.after, input.before ?? null] : null,
20315
+ explicit ? [window2.after, input.before ?? null] : null,
20330
20316
  asOf,
20331
20317
  fetch2
20332
20318
  ])).digest("hex");
@@ -20344,7 +20330,7 @@ var projectGatheringRequest = /* @__PURE__ */ __name((input, now) => {
20344
20330
  linkedKey,
20345
20331
  scope: input.scope,
20346
20332
  lookbackDays,
20347
- window: window3,
20333
+ window: window2,
20348
20334
  fetch: fetch2,
20349
20335
  index,
20350
20336
  around,
@@ -20361,8 +20347,8 @@ var contextChunks = /* @__PURE__ */ __name((after, before) => {
20361
20347
  chunks.push({ after: Math.max(after, end - CONTEXT_CHUNK_DAYS * DAY), before: end });
20362
20348
  return chunks;
20363
20349
  }, "contextChunks");
20364
- var projectUnits = /* @__PURE__ */ __name((plan, window3) => {
20365
- const chunks = contextChunks(window3.after, window3.before);
20350
+ var projectUnits = /* @__PURE__ */ __name((plan, window2) => {
20351
+ const chunks = contextChunks(window2.after, window2.before);
20366
20352
  const literal = chunks.flatMap((chunk) => plan.lanes.filter((lane) => lane.query !== null).flatMap((lane) => plan.sources.map((source, sourceIndex) => ({
20367
20353
  lane,
20368
20354
  source,
@@ -20417,7 +20403,7 @@ var decodeCheckpoint = /* @__PURE__ */ __name((text2, plan) => {
20417
20403
  return value;
20418
20404
  }, "decodeCheckpoint");
20419
20405
 
20420
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/project-gathering.js
20406
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/project-gathering.js
20421
20407
  var terminal = /* @__PURE__ */ new Set(["done", "unavailable", "failed"]);
20422
20408
  var PAGE = 20;
20423
20409
  var PEOPLE = 20;
@@ -20432,14 +20418,14 @@ var heldForWindow = /* @__PURE__ */ __name((row, after) => {
20432
20418
  const oldest = row.held.oldestAt === null ? Number.NaN : Date.parse(row.held.oldestAt);
20433
20419
  return upToDate === true && !gaps && oldest <= after;
20434
20420
  }, "heldForWindow");
20435
- var fetchLinkedChats = /* @__PURE__ */ __name(async (ports, plan, window3, now, signal) => {
20421
+ var fetchLinkedChats = /* @__PURE__ */ __name(async (ports, plan, window2, now, signal) => {
20436
20422
  const wanted = [];
20437
20423
  for (const linked of plan.linkedChats) {
20438
20424
  if (linked.source === null)
20439
20425
  continue;
20440
20426
  const account = { provider: linked.provider, account: linked.account };
20441
20427
  const [row] = await ports.coverage(account, [linked.chat]);
20442
- if (!heldForWindow(row, window3.after))
20428
+ if (!heldForWindow(row, window2.after))
20443
20429
  wanted.push({ ...linked, account });
20444
20430
  }
20445
20431
  const deadline = now() + plan.budgets.maxFetchMs;
@@ -20459,8 +20445,8 @@ var fetchLinkedChats = /* @__PURE__ */ __name(async (ports, plan, window3, now,
20459
20445
  const answer = await ports.fetcher.fetch({
20460
20446
  account: linked.account,
20461
20447
  chatId: linked.chat,
20462
- after: window3.after,
20463
- before: window3.before,
20448
+ after: window2.after,
20449
+ before: window2.before,
20464
20450
  until: deadline,
20465
20451
  signal: signal ? AbortSignal.any([signal, budget.signal]) : budget.signal,
20466
20452
  ...onProgress ? { onProgress: /* @__PURE__ */ __name((progress) => onProgress({ ...progress, chat: linked.ref, index, of: wanted.length }), "onProgress") } : {}
@@ -20498,8 +20484,8 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
20498
20484
  const started = now();
20499
20485
  const plan = projectGatheringRequest(request, started);
20500
20486
  const previous = plan.checkpoint === void 0 ? null : decodeCheckpoint(plan.checkpoint, plan);
20501
- const window3 = previous ?? plan.window;
20502
- const units2 = projectUnits(plan, window3);
20487
+ const window2 = previous ?? plan.window;
20488
+ const units2 = projectUnits(plan, window2);
20503
20489
  if (request.budgets?.maxReads === void 0)
20504
20490
  plan.budgets.maxReads = Math.min(512, Math.max(48, units2.length));
20505
20491
  if (previous && previous.units.length !== units2.length)
@@ -20514,7 +20500,7 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
20514
20500
  param: "fetch"
20515
20501
  });
20516
20502
  if (plan.fetch === "before-read" && ports.fetcher && ports.coverage && previous === null)
20517
- fetched = await fetchLinkedChats(ports, plan, window3, now, signal);
20503
+ fetched = await fetchLinkedChats(ports, plan, window2, now, signal);
20518
20504
  const readFrom = now();
20519
20505
  const indexed = { state: "as-is", mail: 0, documents: 0, code: null };
20520
20506
  const kinds = [...new Set(plan.sources.map((source) => source.kind))].filter((kind) => kind !== "message");
@@ -20727,9 +20713,9 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
20727
20713
  version: 1,
20728
20714
  runKey: plan.runKey,
20729
20715
  fingerprint: plan.fingerprint,
20730
- after: window3.after,
20731
- before: window3.before,
20732
- asOf: window3.asOf,
20716
+ after: window2.after,
20717
+ before: window2.before,
20718
+ asOf: window2.asOf,
20733
20719
  fetched,
20734
20720
  units: progress.map((u) => u.state === "read-limited" ? { ...u, state: "partial" } : u),
20735
20721
  ...plan.linkedKey === void 0 ? {} : { linkedChats: plan.linkedKey },
@@ -20764,9 +20750,9 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
20764
20750
  resumed: previous !== null,
20765
20751
  project: plan.project,
20766
20752
  window: {
20767
- after: window3.after,
20768
- before: window3.before,
20769
- asOf: window3.asOf,
20753
+ after: window2.after,
20754
+ before: window2.before,
20755
+ asOf: window2.asOf,
20770
20756
  lookbackDays: plan.lookbackDays,
20771
20757
  basis: plan.lookbackDays === null ? "explicit" : "lookback",
20772
20758
  timeBasis: "per-item-time-kind"
@@ -20821,7 +20807,7 @@ var peopleOf = /* @__PURE__ */ __name((items, senderOf) => {
20821
20807
  return [...byKey.values()].sort((a, b) => b.items - a.items || a.name.localeCompare(b.name));
20822
20808
  }, "peopleOf");
20823
20809
 
20824
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidate-matching.js
20810
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidate-matching.js
20825
20811
  var normalizedText = /* @__PURE__ */ __name((text2) => text2.normalize("NFKC").toLowerCase().replace(/\s+/gu, " "), "normalizedText");
20826
20812
  var termsOf = /* @__PURE__ */ __name((entry) => [
20827
20813
  { name: entry.name, kind: "canonical" },
@@ -20865,7 +20851,7 @@ var matchVocabularyTerms = /* @__PURE__ */ __name((catalog, texts) => {
20865
20851
  return result.sort((a, b) => Number(a.entry.id) - Number(b.entry.id));
20866
20852
  }, "matchVocabularyTerms");
20867
20853
 
20868
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/project-gathering-mentions.js
20854
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/project-gathering-mentions.js
20869
20855
  var KINDS = ["project", "tag", "topic"];
20870
20856
  var findEvidenceMentions = /* @__PURE__ */ __name(async (vocabulary, gathering, options2 = {}) => {
20871
20857
  if (typeof vocabulary?.vocabulary !== "function")
@@ -20920,7 +20906,7 @@ var findEvidenceMentions = /* @__PURE__ */ __name(async (vocabulary, gathering,
20920
20906
  };
20921
20907
  }, "findEvidenceMentions");
20922
20908
 
20923
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/project-purposes.js
20909
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/project-purposes.js
20924
20910
  var BUILT_IN_PURPOSES = ["work", "sales", "support", "other"];
20925
20911
  var DEFAULT_PURPOSES = ["work"];
20926
20912
  var LINK_PURPOSE = "work";
@@ -20950,12 +20936,12 @@ var purposeList = /* @__PURE__ */ __name((value, previous = []) => [
20950
20936
  ...value.split(",").map((one) => one.trim()).filter(Boolean)
20951
20937
  ], "purposeList");
20952
20938
 
20953
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/stored-project-gathering.js
20939
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/stored-project-gathering.js
20954
20940
  var storedChatCount = /* @__PURE__ */ __name((store) => async (account, chatId, { since, until }) => {
20955
- const window3 = { since: new Date(since).toISOString(), until: new Date(until - 1).toISOString() };
20941
+ const window2 = { since: new Date(since).toISOString(), until: new Date(until - 1).toISOString() };
20956
20942
  const [messages, newest, oldest] = await Promise.all([
20957
- store.messages.countMessages(account, chatId, window3),
20958
- store.messages.messages(account, chatId, { limit: 1, since: window3.since, until: until - 1 }),
20943
+ store.messages.countMessages(account, chatId, window2),
20944
+ store.messages.messages(account, chatId, { limit: 1, since: window2.since, until: until - 1 }),
20959
20945
  store.messages.messages(account, chatId, { limit: 1, after: { time: since - 1 }, until: until - 1 })
20960
20946
  ]);
20961
20947
  return {
@@ -21261,7 +21247,7 @@ var purposeHintOf = /* @__PURE__ */ __name((linked, rows, of) => {
21261
21247
  return { chat: top.ref, relationship: link4.relationship, items, of };
21262
21248
  }, "purposeHintOf");
21263
21249
 
21264
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/people.js
21250
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/people.js
21265
21251
  var peopleService = /* @__PURE__ */ __name((deps) => {
21266
21252
  const localCard = /* @__PURE__ */ __name(async (card, includeNotes = false) => {
21267
21253
  const held = await storeIfOpen(deps);
@@ -21462,9 +21448,9 @@ var linkPeople = /* @__PURE__ */ __name(async (store, account, person, other, {
21462
21448
  throw new CliError("validation_error", "an agent proposing a link gives a reason: --reason <why they are one>", {
21463
21449
  reason: "proposal.reason-required"
21464
21450
  });
21465
- const record2 = await store.people.personOf(one);
21466
- if (record2.identities.some(({ provider, id: id2 }) => provider === two.provider && id2 === two.id))
21467
- return record2;
21451
+ const record = await store.people.personOf(one);
21452
+ if (record.identities.some(({ provider, id: id2 }) => provider === two.provider && id2 === two.id))
21453
+ return record;
21468
21454
  const proposed = await store.people.proposeLink({
21469
21455
  identity: two,
21470
21456
  with: one,
@@ -21472,7 +21458,7 @@ var linkPeople = /* @__PURE__ */ __name(async (store, account, person, other, {
21472
21458
  by: { bot: by },
21473
21459
  reason: why
21474
21460
  });
21475
- return { ...record2, proposal: proposed.id };
21461
+ return { ...record, proposal: proposed.id };
21476
21462
  }, "linkPeople");
21477
21463
  var phoneOf = /* @__PURE__ */ __name((typed) => {
21478
21464
  const digits = typed.replace(/[\s()+-]/g, "");
@@ -21526,7 +21512,7 @@ var withoutPhone = /* @__PURE__ */ __name((answer) => {
21526
21512
  return rest;
21527
21513
  }, "withoutPhone");
21528
21514
 
21529
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/task-stats.js
21515
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/task-stats.js
21530
21516
  var TASK_STATS_BY = ["chat", "meeting", "project"];
21531
21517
  var PERIOD_FIELD = "created";
21532
21518
  var refuseNestedPeriod = /* @__PURE__ */ __name((node, top = true) => {
@@ -21657,7 +21643,7 @@ var meetingNames = /* @__PURE__ */ __name(async (store, groups) => {
21657
21643
  }));
21658
21644
  }, "meetingNames");
21659
21645
 
21660
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/task-tag-filters.js
21646
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/task-tag-filters.js
21661
21647
  var taskTagFilters = /* @__PURE__ */ __name(async (store, query) => {
21662
21648
  const tags = /* @__PURE__ */ new Map();
21663
21649
  for (const node of query ? walkQuery(query.root) : [])
@@ -21666,7 +21652,7 @@ var taskTagFilters = /* @__PURE__ */ __name(async (store, query) => {
21666
21652
  return tags;
21667
21653
  }, "taskTagFilters");
21668
21654
 
21669
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/tasks.js
21655
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/tasks.js
21670
21656
  var TASK_QUERY = {
21671
21657
  entity: "task",
21672
21658
  backend: "sql",
@@ -21793,8 +21779,8 @@ var taskStateOf = oneOf(TASK_STATES, "task state", "--state");
21793
21779
  var closedStateOf = oneOf(["done", "dismissed"], "way to close a task", "--as");
21794
21780
  var taskLinkKindOf = oneOf(TASK_LINK_OPTION_KINDS, "link kind", "--kind");
21795
21781
  var tasksService = /* @__PURE__ */ __name((deps, categories) => {
21796
- const listOf3 = /* @__PURE__ */ __name(async (store) => categories ?? await store.tasks.categories(), "listOf");
21797
- const categoryOf = /* @__PURE__ */ __name(async (store, name) => taskCategoryOf(await listOf3(store))(name), "categoryOf");
21782
+ const listOf2 = /* @__PURE__ */ __name(async (store) => categories ?? await store.tasks.categories(), "listOf");
21783
+ const categoryOf = /* @__PURE__ */ __name(async (store, name) => taskCategoryOf(await listOf2(store))(name), "categoryOf");
21798
21784
  const inStore = /* @__PURE__ */ __name(async (work) => work(await deps.store(), await deps.account()), "inStore");
21799
21785
  const service = /* @__PURE__ */ __name((store) => createTaskService({ store: store.tasks }), "service");
21800
21786
  const groupOf = /* @__PURE__ */ __name(async (store, account, chat) => chat === void 0 ? void 0 : storedChatId(deps.messenger, chat, store, account, { includeLeft: true }), "groupOf");
@@ -21946,7 +21932,7 @@ var tasksService = /* @__PURE__ */ __name((deps, categories) => {
21946
21932
  kind: type,
21947
21933
  origin,
21948
21934
  ...plan.dueAt ? { dueAt: plan.dueAt } : {},
21949
- category: chosen ?? categorize(await sourceText(), await listOf3(store))
21935
+ category: chosen ?? categorize(await sourceText(), await listOf2(store))
21950
21936
  });
21951
21937
  const task2 = await store.tasks.get(added.id) ?? added;
21952
21938
  if (created && choice.new)
@@ -21959,7 +21945,7 @@ var tasksService = /* @__PURE__ */ __name((deps, categories) => {
21959
21945
  const card = await planOf(store, task2.id, plan, origin);
21960
21946
  return { task: await taskView(store, account, task2), created, ...followed, card };
21961
21947
  }), "add"),
21962
- categories: /* @__PURE__ */ __name(() => inStore(async (store) => listOf3(store)), "categories"),
21948
+ categories: /* @__PURE__ */ __name(() => inStore(async (store) => listOf2(store)), "categories"),
21963
21949
  unlistedCategories: /* @__PURE__ */ __name(() => inStore(async (store) => store.tasks.unlistedCategories()), "unlistedCategories"),
21964
21950
  categoriesFile: /* @__PURE__ */ __name(() => inStore(async (store) => store.tasks.categoriesFile()), "categoriesFile"),
21965
21951
  duplicates: /* @__PURE__ */ __name(({ decision, limit, offset }) => inStore(async (store, account) => store.tasks.pairs(taskAccount(account), { decision, limit, offset })), "duplicates"),
@@ -22166,7 +22152,7 @@ var taskView = /* @__PURE__ */ __name(async (store, account, task2) => {
22166
22152
  };
22167
22153
  }, "taskView");
22168
22154
 
22169
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/cli/messenger/lacks.js
22155
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/cli/messenger/lacks.js
22170
22156
  var COMMAND_NEEDS = {
22171
22157
  "account update": ["updateProfile", "change the profile"],
22172
22158
  "account sessions list": ["sessions", "list the account's sessions"],
@@ -22184,7 +22170,10 @@ var COMMAND_NEEDS = {
22184
22170
  "contacts import": ["importContacts", "import contacts"],
22185
22171
  "messages comments": ["comments", "read comments on a channel post"],
22186
22172
  "messages pin": ["pin", "pin a message"],
22187
- "messages unpin": ["unpin", "unpin a message"]
22173
+ "messages unpin": ["unpin", "unpin a message"],
22174
+ "messages scheduled cancel": ["cancelScheduled", "cancel a scheduled message"],
22175
+ "messages scheduled edit": ["editScheduled", "edit a scheduled message"],
22176
+ "messages scheduled send": ["sendScheduled", "send a scheduled message now"]
22188
22177
  };
22189
22178
  var STORE_ANSWERS = /* @__PURE__ */ new Set(["chats events"]);
22190
22179
  var lackedNeed = /* @__PURE__ */ __name((messenger, path) => {
@@ -22216,296 +22205,7 @@ var hideNever = /* @__PURE__ */ __name((messenger, group) => {
22216
22205
  return group;
22217
22206
  }, "hideNever");
22218
22207
 
22219
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/cli/paging.js
22220
- var positiveCount = /* @__PURE__ */ __name((flag) => (value) => {
22221
- if (!/^\d+$/.test(value.trim()) || Number(value) < 1)
22222
- throw new CliError("validation_error", `${flag} takes a whole number from 1 upwards, not "${value}"`);
22223
- return Number(value);
22224
- }, "positiveCount");
22225
- var configuredLimit = /* @__PURE__ */ __name((command, most = Number.POSITIVE_INFINITY) => {
22226
- const { resolveSettings, env } = environmentOf(command);
22227
- const { limit: _typed, ...flags } = command.optsWithGlobals();
22228
- const configured = resolveSettings?.(flags, { needsProfile: false, ...env ? { env } : {} }).limit ?? DEFAULT_CONFIG.defaults.limit;
22229
- return Math.min(configured, most);
22230
- }, "configuredLimit");
22231
- 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");
22232
- var window2 = /* @__PURE__ */ __name(({ limit, page, all }) => all ? { offset: 0 } : { limit, offset: (page - 1) * limit }, "window");
22233
- var pagingOf = /* @__PURE__ */ __name((command) => {
22234
- const environment = environmentOf(command);
22235
- const flags = command.optsWithGlobals();
22236
- if (!environment.resolveSettings)
22237
- return { limit: flags.limit ?? DEFAULT_CONFIG.defaults.limit, page: flags.page ?? 1 };
22238
- const { limit, page } = environment.resolveSettings(withAgentLevels(command, command.optsWithGlobals()), {
22239
- env: environment.env ?? process.env,
22240
- needsProfile: false,
22241
- readOnly: true
22242
- });
22243
- return { limit: limit ?? DEFAULT_CONFIG.defaults.limit, page: page ?? 1 };
22244
- }, "pagingOf");
22245
-
22246
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/cli/messenger/chat-answers.js
22247
- var defined = /* @__PURE__ */ __name((record2) => Object.fromEntries(Object.entries(record2).filter(([, value]) => value !== void 0)), "defined");
22248
- var chatRef = /* @__PURE__ */ __name((account, chat) => formatReference({ type: "chat", provider: account.provider, account: account.account, chat }), "chatRef");
22249
- var settingsOf = /* @__PURE__ */ __name((settings) => defined({
22250
- all_can_pin: settings.allCanPin,
22251
- only_admins_add: settings.onlyAdminsAdd,
22252
- only_admins_call: settings.onlyAdminsCall,
22253
- only_owner_edits_info: settings.onlyOwnerEditsInfo,
22254
- members_see_link: settings.membersSeeLink,
22255
- join_approval: settings.joinApproval,
22256
- only_admins_send: settings.onlyAdminsSend,
22257
- only_admins_edit_info: settings.onlyAdminsEditInfo,
22258
- disappearing_seconds: settings.disappearingSeconds
22259
- }), "settingsOf");
22260
- var chatAnswer = /* @__PURE__ */ __name((account, chat) => defined({
22261
- ref: chatRef(account, chat.id),
22262
- id: chat.id,
22263
- title: chat.title,
22264
- kind: chat.kind,
22265
- unread_count: chat.unreadCount,
22266
- unread_mentions: chat.unreadMentions,
22267
- last_message_at: chat.lastMessageAt,
22268
- participants_count: chat.participantsCount,
22269
- muted: chat.muted,
22270
- muted_until: chat.mutedUntil ?? void 0,
22271
- archived: chat.archived,
22272
- marked_unread: chat.markedUnread,
22273
- membership_state: chat.membershipState,
22274
- parent_chat_id: chat.parentChatId ?? void 0,
22275
- scope: chat.scope,
22276
- provider_metadata: chat.providerMetadata,
22277
- description: chat.description,
22278
- invite_link: chat.link,
22279
- settings: chat.settings ? settingsOf(chat.settings) : void 0,
22280
- members: chat.members?.map(memberAnswer)
22281
- }), "chatAnswer");
22282
- var memberAnswer = /* @__PURE__ */ __name((member) => {
22283
- const group = member;
22284
- return defined({
22285
- id: member.id,
22286
- name: member.name,
22287
- username: member.username,
22288
- role: group.role,
22289
- last_seen_at: group.lastSeenAt,
22290
- registered_at: group.registeredAt,
22291
- joined_at: group.joinedAt,
22292
- invited_by: group.invitedBy,
22293
- is_bot: group.isBot,
22294
- deleted: group.deleted,
22295
- flagged: group.flagged,
22296
- has_photo: group.hasPhoto,
22297
- score: group.score,
22298
- reasons: group.reasons,
22299
- check: group.check ? snakeKeys(group.check) : void 0
22300
- });
22301
- }, "memberAnswer");
22302
- var contactRef = /* @__PURE__ */ __name((provider, id2) => formatReference({ type: "contact", provider, id: id2 }), "contactRef");
22303
- var contactAnswer = /* @__PURE__ */ __name((account, contact) => {
22304
- const card = contact;
22305
- return defined({
22306
- ref: contactRef(account.provider, contact.id),
22307
- id: contact.id,
22308
- name: contact.name,
22309
- username: contact.username,
22310
- alias: contact.alias,
22311
- display_name: contact.displayName,
22312
- description: contact.description,
22313
- last_messaged_at: contact.lastMessagedAt,
22314
- chats: card.chats?.map((chat) => ({
22315
- ref: chatRef(account, chat.id),
22316
- id: chat.id,
22317
- title: chat.title,
22318
- kind: chat.kind,
22319
- last_message_at: chat.lastMessageAt
22320
- })),
22321
- notes: card.notes?.map(({ id: id2, text: text2, revision, createdAt, updatedAt }) => ({
22322
- id: id2,
22323
- text: text2,
22324
- revision,
22325
- created_at: createdAt,
22326
- updated_at: updatedAt
22327
- }))
22328
- });
22329
- }, "contactAnswer");
22330
- var contactShown = /* @__PURE__ */ __name((account, card, profile) => {
22331
- const { id: _id, name: _name, bio, chats, ...facts } = profile;
22332
- const listed2 = new Map(card.chats.map((chat) => [chat.id, chat]));
22333
- const active = new Set(chats.map(({ id: id2 }) => id2));
22334
- const shared2 = [
22335
- ...chats.map((chat) => ({
22336
- ref: chatRef(account, chat.id),
22337
- id: chat.id,
22338
- title: chat.title,
22339
- kind: chat.kind,
22340
- last_message_at: listed2.get(chat.id)?.lastMessageAt ?? chat.lastAt,
22341
- their_messages: chat.theirMessages,
22342
- first_at: chat.firstAt,
22343
- last_at: chat.lastAt,
22344
- complete: chat.complete
22345
- })),
22346
- ...card.chats.filter(({ id: id2 }) => !active.has(id2)).map((chat) => ({
22347
- ref: chatRef(account, chat.id),
22348
- id: chat.id,
22349
- title: chat.title,
22350
- kind: chat.kind,
22351
- last_message_at: chat.lastMessageAt
22352
- }))
22353
- ];
22354
- const answer = contactAnswer(account, card);
22355
- return {
22356
- ...answer,
22357
- ...snakeKeys(facts),
22358
- description: answer.description ?? bio,
22359
- chats: shared2
22360
- };
22361
- }, "contactShown");
22362
- var chatEventAnswer = /* @__PURE__ */ __name((chatId, event2) => defined({
22363
- chat_id: chatId,
22364
- time: event2.timestamp,
22365
- type: event2.event,
22366
- message_id: event2.messageId,
22367
- by: event2.by,
22368
- people: event2.people,
22369
- title: event2.title
22370
- }), "chatEventAnswer");
22371
- var HISTORY_TYPES = { joined: "join", left: "leave", changed: "profile" };
22372
- var memberEventAnswer = /* @__PURE__ */ __name((chatId, event2) => defined({
22373
- chat_id: chatId,
22374
- time: event2.at,
22375
- type: HISTORY_TYPES[event2.event],
22376
- by: event2.invitedBy === void 0 ? void 0 : { id: event2.invitedBy, name: null },
22377
- people: [{ id: event2.id, name: event2.name, username: event2.username }],
22378
- before: event2.before ? { name: event2.before.name, username: event2.before.username } : void 0
22379
- }), "memberEventAnswer");
22380
- var inviteLinkAnswer = /* @__PURE__ */ __name((link4) => defined({
22381
- link: link4.link,
22382
- approval: link4.approval,
22383
- expires_at: link4.expiresAt,
22384
- max_uses: link4.maxUses,
22385
- primary: link4.primary,
22386
- revoked: link4.revoked,
22387
- pending_count: link4.pending,
22388
- joined_count: link4.joined
22389
- }), "inviteLinkAnswer");
22390
- var joinRequestAnswer = /* @__PURE__ */ __name((request) => defined({
22391
- person_id: request.person.id,
22392
- name: request.person.name,
22393
- username: request.person.username,
22394
- requested_at: request.requestedAt,
22395
- about: request.about
22396
- }), "joinRequestAnswer");
22397
- var pollVoteAnswer = /* @__PURE__ */ __name((vote) => ({
22398
- person_id: vote.person.id,
22399
- name: vote.person.name,
22400
- username: vote.person.username,
22401
- answers: vote.answers,
22402
- voted_at: vote.votedAt
22403
- }), "pollVoteAnswer");
22404
- var reactorAnswer = /* @__PURE__ */ __name((reactor) => ({
22405
- person: { id: reactor.person.id, name: reactor.person.name, username: reactor.person.username },
22406
- reaction: reactor.reaction,
22407
- reacted_at: reactor.reactedAt
22408
- }), "reactorAnswer");
22409
- var topicAnswer = /* @__PURE__ */ __name((topic) => defined({
22410
- id: topic.id,
22411
- title: topic.title,
22412
- closed: topic.closed,
22413
- pinned: topic.pinned,
22414
- hidden: topic.hidden,
22415
- unread_count: topic.unreadCount,
22416
- last_message_at: topic.lastMessageAt,
22417
- created_at: topic.createdAt,
22418
- untrusted: ["title"]
22419
- }), "topicAnswer");
22420
- var folderAnswer = /* @__PURE__ */ __name((folder) => {
22421
- const shown = "chats" in folder ? folder : void 0;
22422
- const listed2 = shown ? void 0 : folder;
22423
- return defined({
22424
- id: folder.id,
22425
- title: folder.title,
22426
- chat_ids: listed2 ? listed2.chatIds : shown?.chats.map((chat) => chat.id) ?? [],
22427
- emoji: folder.emoji,
22428
- include: folder.include,
22429
- skip: folder.skip,
22430
- excluded_chat_ids: listed2?.excludedChatIds ?? shown?.excluded.map((chat) => chat.id),
22431
- pinned_chat_ids: listed2?.pinnedChatIds ?? shown?.pinned.map((chat) => chat.id),
22432
- chats: shown?.chats,
22433
- pinned_chats: shown?.pinned,
22434
- excluded_chats: shown?.excluded
22435
- });
22436
- }, "folderAnswer");
22437
- var lines = /* @__PURE__ */ __name((line3) => (body) => (body.items ?? (body.item === void 0 ? [] : [body.item])).map((item2) => `${line3(item2).trimEnd()}
22438
- `).join(""), "lines");
22439
- var pageOf = /* @__PURE__ */ __name(({ limit, page, all }, { items, hasMore }) => all ? { limit: Math.max(1, items.length), has_more: false, page: 1 } : { limit, has_more: hasMore, page }, "pageOf");
22440
- var wholeList = /* @__PURE__ */ __name((command, items, extra = {}) => listOf(command, { items, limit: Math.max(1, items.length), has_more: false, ...extra }), "wholeList");
22441
- var chatShown = /* @__PURE__ */ __name((account, card) => {
22442
- const listed2 = card.members?.length;
22443
- const short = listed2 !== void 0 && card.participantsCount !== null && listed2 < card.participantsCount;
22444
- return itemOf(chatAnswer(account, card), short ? {
22445
- missing: [
22446
- {
22447
- field: "members",
22448
- why: `${listed2} listed; the chat reports ${card.participantsCount} \u2014 the list may omit your account or be partial`,
22449
- step: "chats.members"
22450
- }
22451
- ],
22452
- next: [nextStep("chats.members", { args: { chat: card.id } })]
22453
- } : {});
22454
- }, "chatShown");
22455
- var scoreFloor = /* @__PURE__ */ __name((ast) => {
22456
- const term = nativeTerms(ast, "chats members check").get("score");
22457
- if (!term)
22458
- return AUDIT_MIN_SCORE;
22459
- const upper = term.operator === "range" ? term.upper ?? "*" : term.value;
22460
- if (term.operator !== "range" || upper !== "*")
22461
- queryError("query.unsupported-operator", term.span, "score takes a lower bound: score>=3", {
22462
- command: "chats members check",
22463
- guide: LIST_QUERY_GUIDE
22464
- });
22465
- const floor = Number(term.value);
22466
- return Math.ceil(term.lower_inclusive === false ? floor + 1 : floor);
22467
- }, "scoreFloor");
22468
- var auditAnswer = /* @__PURE__ */ __name((audit) => wholeList("chats members check", audit.items.map(memberAnswer), {
22469
- ...audit.more ? { meta: { truncated: true } } : {},
22470
- ...audit.completeness && audit.completeness.state !== "complete" ? {
22471
- missing: [
22472
- {
22473
- field: "reasons",
22474
- why: "never_wrote counts only stored messages, and the store does not hold the chat whole",
22475
- ...audit.fetch ? { step: "messages.sync" } : {}
22476
- }
22477
- ],
22478
- ...audit.fetch ? { next: [nextStep("messages.sync", { args: { chat: audit.chatId } })] } : {}
22479
- } : {}
22480
- }), "auditAnswer");
22481
- var renderItem = /* @__PURE__ */ __name((command, output, value, next = []) => renderAnswer(command, output, itemOf(snakeKeys(value), { next })), "renderItem");
22482
- var withPage = /* @__PURE__ */ __name((command) => command.option("--limit <n>", "how many to show", positiveCount("--limit")).option("--page <n>", "which page, starting at 1", positiveCount("--page")), "withPage");
22483
- var documentLinkAnswer = /* @__PURE__ */ __name(({ url, documentId, title, inStore, locator, sentAt, sender }) => ({
22484
- url,
22485
- document_id: documentId,
22486
- title,
22487
- in_store: inStore,
22488
- ref: locator,
22489
- sent_at: sentAt,
22490
- sender
22491
- }), "documentLinkAnswer");
22492
- var accountAnswer = /* @__PURE__ */ __name((provider, { id: id2, name, username, phone }) => ({
22493
- provider,
22494
- id: id2,
22495
- name,
22496
- username,
22497
- ...phone === void 0 ? {} : { phone }
22498
- }), "accountAnswer");
22499
- var sessionAnswer = /* @__PURE__ */ __name(({ current, client, device, location, lastActiveAt, createdAt }) => ({
22500
- current,
22501
- client,
22502
- device,
22503
- location,
22504
- last_active_at: lastActiveAt,
22505
- ...createdAt === void 0 ? {} : { created_at: createdAt }
22506
- }), "sessionAnswer");
22507
-
22508
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/context/communication-selection.js
22208
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/context/communication-selection.js
22509
22209
  var communicationFields = {
22510
22210
  sources: pipe(array(strictObject({
22511
22211
  id: pipe(string(), regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/)),
@@ -22537,7 +22237,7 @@ var communicationRequest = /* @__PURE__ */ __name((value, preparationAfter) => {
22537
22237
  return { ...input, after, before };
22538
22238
  }, "communicationRequest");
22539
22239
 
22540
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/mail/owed.js
22240
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/mail/owed.js
22541
22241
  var mailTurn = /* @__PURE__ */ __name((newest) => {
22542
22242
  if (newest === null)
22543
22243
  return null;
@@ -22546,7 +22246,7 @@ var mailTurn = /* @__PURE__ */ __name((newest) => {
22546
22246
  return newest.addressed ? "owed" : null;
22547
22247
  }, "mailTurn");
22548
22248
 
22549
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/agenda-mail.js
22249
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/agenda-mail.js
22550
22250
  var absent = /* @__PURE__ */ __name((error) => {
22551
22251
  if (error instanceof CliError && error.code === "not_found")
22552
22252
  return void 0;
@@ -22559,7 +22259,7 @@ var mailActivity = /* @__PURE__ */ __name(async (store, account, since, chats) =
22559
22259
  const where = chats ? queryFilter(chats, MAIL_AGENDA_COLUMNS, { command: "tasks agenda", zone: timezoneOf() }) : void 0;
22560
22260
  const threads = await store.mail.threadActivity(stored.id, since, where);
22561
22261
  const synced = await store.sync.syncState(account, "mail_coverage");
22562
- const window3 = (() => {
22262
+ const window2 = (() => {
22563
22263
  try {
22564
22264
  return JSON.parse(synced?.value ?? "{}");
22565
22265
  } catch {
@@ -22581,7 +22281,7 @@ var mailActivity = /* @__PURE__ */ __name(async (store, account, since, chats) =
22581
22281
  coverage: /* @__PURE__ */ __name((ids) => ids.map((chatId) => {
22582
22282
  const thread = byId2.get(chatId);
22583
22283
  const newest = thread?.newest?.at ?? thread?.lastEmailAt;
22584
- const until = window3.until === void 0 ? Number.NaN : Date.parse(window3.until);
22284
+ const until = window2.until === void 0 ? Number.NaN : Date.parse(window2.until);
22585
22285
  return {
22586
22286
  chatId,
22587
22287
  title: thread?.subject ?? null,
@@ -22589,7 +22289,7 @@ var mailActivity = /* @__PURE__ */ __name(async (store, account, since, chats) =
22589
22289
  chatId,
22590
22290
  // Sync holds a window of the mailbox, never a thread's whole history.
22591
22291
  state: synced ? "partial" : "unknown",
22592
- upToDate: window3.state === "window" && newest !== void 0 && !Number.isNaN(until) ? newest <= until : null,
22292
+ upToDate: window2.state === "window" && newest !== void 0 && !Number.isNaN(until) ? newest <= until : null,
22593
22293
  gaps: false,
22594
22294
  reachesStart: false,
22595
22295
  fetchedAt: synced?.at ?? null
@@ -22604,7 +22304,7 @@ var mailActivity = /* @__PURE__ */ __name(async (store, account, since, chats) =
22604
22304
  };
22605
22305
  }, "mailActivity");
22606
22306
 
22607
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/agenda.js
22307
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/agenda.js
22608
22308
  var DAY2 = 864e5;
22609
22309
  var AGENDA_DEFAULTS = { unanswered: DAY2, waiting: 7 * DAY2 };
22610
22310
  var CLAIMS = ["none", "mine", "others", "any"];
@@ -22858,7 +22558,7 @@ var agendaItem = /* @__PURE__ */ __name((shown) => {
22858
22558
  };
22859
22559
  }, "agendaItem");
22860
22560
 
22861
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/model-downloads.js
22561
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/model-downloads.js
22862
22562
  import { writeFileSync } from "node:fs";
22863
22563
  import { join } from "node:path";
22864
22564
  var bytesOf = /* @__PURE__ */ __name((model) => model.files.reduce((sum2, file) => sum2 + file.bytes, 0), "bytesOf");
@@ -22883,7 +22583,7 @@ var downloadTextModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
22883
22583
  `);
22884
22584
  await nativeRuntime({ env, progress });
22885
22585
  progress(`${model.id}: loading it once to check it works`);
22886
- const { openEmbedder: openEmbedder2 } = await import("./embed-BNOTNXMA.js");
22586
+ const { openEmbedder: openEmbedder2 } = await import("./embed-RVSUV54Z.js");
22887
22587
  const embedder = await openEmbedder2(model, directory2);
22888
22588
  try {
22889
22589
  const [vector] = await embedder.embed(["check"], "query");
@@ -22904,7 +22604,7 @@ var downloadRerankModel = /* @__PURE__ */ __name(async (id2, { env, progress = /
22904
22604
  }
22905
22605
  await nativeRuntime({ env, progress });
22906
22606
  progress(`${model.id}: loading it once to check it works`);
22907
- const { openReranker } = await import("./rerank-LJ3TWRNV.js");
22607
+ const { openReranker } = await import("./rerank-QWM3DQMU.js");
22908
22608
  const reranker = await openReranker(model, directory2);
22909
22609
  try {
22910
22610
  await reranker.score("check", ["check"]);
@@ -22922,7 +22622,7 @@ var downloadImageModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
22922
22622
  await installFiles(placedImage(model, directory2), { progress, ...bytes2 ? { bytes: bytes2 } : {} });
22923
22623
  }
22924
22624
  progress(`${model.id}: loading it once to check it works`);
22925
- const { openPictureEmbedder } = await import("./embedder-BCUT7KKV.js");
22625
+ const { openPictureEmbedder } = await import("./embedder-GRZXZUXR.js");
22926
22626
  const embedder = await openPictureEmbedder(model, directory2);
22927
22627
  try {
22928
22628
  const vector = await embedder.embedQuery("check");
@@ -22934,7 +22634,7 @@ var downloadImageModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
22934
22634
  return { model, directory: directory2 };
22935
22635
  }, "downloadImageModel");
22936
22636
 
22937
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/rankings-selection.js
22637
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/rankings-selection.js
22938
22638
  var RANKING_SELECTION_BYTES = 64 * 1024;
22939
22639
  var object2 = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0, "object");
22940
22640
  function invalid(message = "ranking selection is invalid \u2014 obtain a new drilldown from stats top") {
@@ -23103,7 +22803,7 @@ var readRankingSelection = /* @__PURE__ */ __name(async (store, input) => {
23103
22803
  };
23104
22804
  }, "readRankingSelection");
23105
22805
 
23106
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/mail-search.js
22806
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/mail-search.js
23107
22807
  var THREADS_PAGE = 500;
23108
22808
  var threadsOf = /* @__PURE__ */ __name(async (store, key) => {
23109
22809
  const account = await store.accounts.storedAccount(key).catch(() => void 0);
@@ -23127,9 +22827,9 @@ var threadsOf = /* @__PURE__ */ __name(async (store, key) => {
23127
22827
  var withMailThreads = /* @__PURE__ */ __name((store) => {
23128
22828
  const chats = {
23129
22829
  ...store.chats,
23130
- chats: /* @__PURE__ */ __name(async (account, window3) => {
23131
- const held = await store.chats.chats(account, window3);
23132
- if (window3.limit !== void 0 || window3.offset !== void 0)
22830
+ chats: /* @__PURE__ */ __name(async (account, window2) => {
22831
+ const held = await store.chats.chats(account, window2);
22832
+ if (window2.limit !== void 0 || window2.offset !== void 0)
23133
22833
  return held;
23134
22834
  const known2 = new Set(held.items.map(({ id: id2 }) => id2));
23135
22835
  const threads = (await threadsOf(store, account)).filter(({ id: id2 }) => !known2.has(id2));
@@ -23178,7 +22878,7 @@ var readMail = /* @__PURE__ */ __name(async (store, locator, { before = 0, after
23178
22878
  return thread.slice(Math.max(0, at - before), at + after + 1).map((hit) => hit.id === message ? { ...hit, anchor: true } : hit);
23179
22879
  }, "readMail");
23180
22880
 
23181
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/messages-search.js
22881
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/messages-search.js
23182
22882
  var PERSON_FIELDS = /* @__PURE__ */ new Set(["from", "to", "cc", "bcc"]);
23183
22883
  var MAIL_FIELDS = /* @__PURE__ */ new Set(["to", "cc", "bcc", "subject", "mailbox", "label", "is", "list"]);
23184
22884
  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");
@@ -23551,7 +23251,7 @@ var statsLucene = /* @__PURE__ */ __name(async (store, account, request, messeng
23551
23251
  };
23552
23252
  }, "statsLucene");
23553
23253
 
23554
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/search-record.js
23254
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/search-record.js
23555
23255
  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");
23556
23256
  var searchRecordOf = /* @__PURE__ */ __name((command, params) => ({
23557
23257
  command,
@@ -23561,7 +23261,7 @@ var searchRecordOf = /* @__PURE__ */ __name((command, params) => ({
23561
23261
  fieldsVersion: FIELD_VERSION
23562
23262
  }), "searchRecordOf");
23563
23263
 
23564
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/admin-statistics.js
23264
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/admin-statistics.js
23565
23265
  function invalid2(message) {
23566
23266
  throw new CliError("validation_error", message);
23567
23267
  }
@@ -23745,7 +23445,7 @@ var adminStatisticsService = /* @__PURE__ */ __name((deps) => ({
23745
23445
  }
23746
23446
  if (pinned && (query.source || query.ast || query.exact || query.timezone && query.timezone !== prepared.timezone))
23747
23447
  invalid2("a saved report keeps its resolved query, accounts and timezone");
23748
- const window3 = dateWindow({
23448
+ const window2 = dateWindow({
23749
23449
  ...query.sinceTime ? { sinceTime: query.sinceTime } : {},
23750
23450
  ...query.untilTime ? { untilTime: query.untilTime } : {},
23751
23451
  zone: prepared.timezone,
@@ -23756,8 +23456,8 @@ var adminStatisticsService = /* @__PURE__ */ __name((deps) => ({
23756
23456
  cutoff,
23757
23457
  olderThan: query.olderThan === void 0 && pinned ? pinned.options.olderThan : duration(query.olderThan ?? "24h", "older_than"),
23758
23458
  within: query.within === void 0 && pinned ? pinned.options.within : duration(query.within ?? "7d", "--within"),
23759
- joinSince: window3.since ?? pinned?.options.joinSince ?? cutoff - 30 * 864e5,
23760
- joinUntil: window3.until ?? pinned?.options.joinUntil ?? cutoff,
23459
+ joinSince: window2.since ?? pinned?.options.joinSince ?? cutoff - 30 * 864e5,
23460
+ joinUntil: window2.until ?? pinned?.options.joinUntil ?? cutoff,
23761
23461
  minViews: count(query.minViews ?? pinned?.options.minViews ?? 1, "min_views"),
23762
23462
  maxReplies: count(query.maxReplies ?? pinned?.options.maxReplies ?? 0, "max_replies"),
23763
23463
  answerers: query.answerers === void 0 && pinned ? pinned.options.answerers : await answerers(store, query.answerers ?? [], prepared.execution.accounts)
@@ -23790,7 +23490,7 @@ var adminStatisticsService = /* @__PURE__ */ __name((deps) => ({
23790
23490
  return {
23791
23491
  ...result,
23792
23492
  report,
23793
- timeMeta: window3.meta,
23493
+ timeMeta: window2.meta,
23794
23494
  detectorVersion: 1,
23795
23495
  items: result.items.map((original) => {
23796
23496
  const identityKnown = known2.has(JSON.stringify([original.account.provider, original.account.account, original.id]));
@@ -23855,7 +23555,7 @@ var adminStatisticsService = /* @__PURE__ */ __name((deps) => ({
23855
23555
  }, "evidence")
23856
23556
  }), "adminStatisticsService");
23857
23557
 
23858
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/patience.js
23558
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/patience.js
23859
23559
  import { setTimeout as sleep } from "node:timers/promises";
23860
23560
  var LONGEST_WAIT_MS = 5 * 60 * 1e3;
23861
23561
  var patiently = /* @__PURE__ */ __name(async (request, note, stop) => {
@@ -23878,10 +23578,10 @@ var patiently = /* @__PURE__ */ __name(async (request, note, stop) => {
23878
23578
  }
23879
23579
  }, "patiently");
23880
23580
 
23881
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/archive.js
23581
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/archive.js
23882
23582
  import { setTimeout as sleep2 } from "node:timers/promises";
23883
23583
 
23884
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/backfill-estimate.js
23584
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/backfill-estimate.js
23885
23585
  var REQUEST_MS = 400;
23886
23586
  var estimateBackfill = /* @__PURE__ */ __name(({ ranges, held, newest, page, maxPages, pauseMs }) => {
23887
23587
  const lowest = ranges[0];
@@ -23904,13 +23604,13 @@ var estimateBackfill = /* @__PURE__ */ __name(({ ranges, held, newest, page, max
23904
23604
  };
23905
23605
  }, "estimateBackfill");
23906
23606
 
23907
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/domain/recovery.js
23607
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/domain/recovery.js
23908
23608
  var withRecovery = /* @__PURE__ */ __name((error) => ({
23909
23609
  ...error,
23910
23610
  retryable: typeof error.retryable === "boolean" ? error.retryable : error.code === "rate_limited" || error.status === 429
23911
23611
  }), "withRecovery");
23912
23612
 
23913
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/batch.js
23613
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/batch.js
23914
23614
  var actionable = /* @__PURE__ */ __name((error) => {
23915
23615
  if (isCliFailure(error))
23916
23616
  return withRecovery({ code: error.code, message: error.message, ...error.details });
@@ -23993,7 +23693,7 @@ var mergeBatches = /* @__PURE__ */ __name((a, b) => {
23993
23693
  };
23994
23694
  }, "mergeBatches");
23995
23695
 
23996
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/images/context/index.js
23696
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/images/context/index.js
23997
23697
  var CONTEXT_MESSAGES2 = 3;
23998
23698
  var CONTEXT_MINUTES = 10;
23999
23699
  var MAX_CHARS = 1200;
@@ -24005,8 +23705,8 @@ var contextText = /* @__PURE__ */ __name(({ chatTitle: chatTitle2, sender, capti
24005
23705
  if (!caption.trim() && earlier.length === 0 && later.length === 0)
24006
23706
  return void 0;
24007
23707
  const own = line({ sender, text: `[photo] ${caption}`, sentAt });
24008
- const lines3 = [...chatTitle2?.trim() ? [chatTitle2.trim()] : [], ...earlier.map(line), own, ...later.map(line)];
24009
- return lines3.join("\n").slice(0, MAX_CHARS);
23708
+ const lines = [...chatTitle2?.trim() ? [chatTitle2.trim()] : [], ...earlier.map(line), own, ...later.map(line)];
23709
+ return lines.join("\n").slice(0, MAX_CHARS);
24010
23710
  }, "contextText");
24011
23711
  var context = {
24012
23712
  id: "context",
@@ -24017,12 +23717,12 @@ var context = {
24017
23717
  }, "describe")
24018
23718
  };
24019
23719
 
24020
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/images/registry.js
23720
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/images/registry.js
24021
23721
  var BUILT_INS = [context];
24022
23722
  var providers = [...BUILT_INS];
24023
23723
  var registeredImageProviders = /* @__PURE__ */ __name(() => providers, "registeredImageProviders");
24024
23724
 
24025
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/conversations.js
23725
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/conversations.js
24026
23726
  var READ_PAGE = 5e3;
24027
23727
  var CHAIN = 50;
24028
23728
  var CONVERSATION_QUERY = {
@@ -24174,7 +23874,7 @@ var sized = /* @__PURE__ */ __name((size2) => {
24174
23874
  return size2;
24175
23875
  }, "sized");
24176
23876
 
24177
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/embeddings-maintenance.js
23877
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/embeddings-maintenance.js
24178
23878
  var REFRESH_BOUNDS = { maxChats: 20, maxChunks: 2e3 };
24179
23879
  var MESSAGE_PAGE = 5e3;
24180
23880
  var PER_SESSION = 8;
@@ -24193,7 +23893,7 @@ var embeddingTarget = /* @__PURE__ */ __name((deps, choice = chosenTextModel(dep
24193
23893
  price: remote.price,
24194
23894
  installed: true,
24195
23895
  perBatch: PER_REQUEST * concurrency,
24196
- open: /* @__PURE__ */ __name(async () => (await import("./remote-4BTFOLFY.js")).openRemote(remote, apiKey, {
23896
+ open: /* @__PURE__ */ __name(async () => (await import("./remote-X4SVEMHS.js")).openRemote(remote, apiKey, {
24197
23897
  concurrency,
24198
23898
  env: deps.env ?? process.env
24199
23899
  }), "open")
@@ -24213,7 +23913,7 @@ var embeddingTarget = /* @__PURE__ */ __name((deps, choice = chosenTextModel(dep
24213
23913
  if (!isTextModelInstalled(model, directory2))
24214
23914
  throw notDownloaded(model.id);
24215
23915
  if (apart) {
24216
- const { openProcess } = await import("./process-I2QKOMM7.js");
23916
+ const { openProcess } = await import("./process-PTUCNLZ7.js");
24217
23917
  return openProcess(model, directory2, { threads: threads ?? defaultThreads() });
24218
23918
  }
24219
23919
  return openEmbedder(model, directory2, { threads: threads ?? defaultThreads() });
@@ -24260,8 +23960,8 @@ var embeddingsMaintenance = /* @__PURE__ */ __name((deps) => {
24260
23960
  if (batch.length === 0)
24261
23961
  break;
24262
23962
  after = batch.at(-1)?.hash;
24263
- const ready = batch.flatMap(({ hash: hash3, lines: lines3 }) => {
24264
- const text2 = chunkTextOf(lines3);
23963
+ const ready = batch.flatMap(({ hash: hash3, lines }) => {
23964
+ const text2 = chunkTextOf(lines);
24265
23965
  return chunkHash(text2) === hash3 ? [{ hash: hash3, text: text2 }] : [];
24266
23966
  });
24267
23967
  skipped += batch.length - ready.length;
@@ -24502,7 +24202,7 @@ var shaped = /* @__PURE__ */ __name(({ chatId, builtAt, algorithmVersion, pendin
24502
24202
  return { ...one, state };
24503
24203
  }, "shaped");
24504
24204
 
24505
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/search-catchup.js
24205
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/search-catchup.js
24506
24206
  var CATCH_UP_BOUNDS = { maxChunks: 500, maxMessages: 1e4, timeMs: 3e4 };
24507
24207
  var validateCatchUpBounds = /* @__PURE__ */ __name((options2) => {
24508
24208
  for (const [key, value, maximum] of [
@@ -24555,7 +24255,7 @@ var catchUpSearch = /* @__PURE__ */ __name(async (deps, chat, options2, signal,
24555
24255
  }
24556
24256
  }, "catchUpSearch");
24557
24257
 
24558
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/archive.js
24258
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/archive.js
24559
24259
  var pushed = /* @__PURE__ */ __name((deps, what) => {
24560
24260
  if (deps.reads === "store") {
24561
24261
  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`);
@@ -24583,11 +24283,11 @@ var archiveService = /* @__PURE__ */ __name((deps) => {
24583
24283
  left: /* @__PURE__ */ __name(async (options2) => (await deps.store()).chats.leftChats(await deps.account(), options2), "left"),
24584
24284
  export: /* @__PURE__ */ __name(async (chat, { since } = {}) => {
24585
24285
  const { store, account, chatId } = await found(chat);
24586
- const window3 = { limit: Number.MAX_SAFE_INTEGER, ...since === void 0 ? {} : { since } };
24286
+ const window2 = { limit: Number.MAX_SAFE_INTEGER, ...since === void 0 ? {} : { since } };
24587
24287
  return {
24588
24288
  account,
24589
24289
  title: (await store.chats.chatStats(account, chatId))[0]?.title ?? chatId,
24590
- messages: (await store.messages.messages(account, chatId, window3)).items
24290
+ messages: (await store.messages.messages(account, chatId, window2)).items
24591
24291
  };
24592
24292
  }, "export"),
24593
24293
  exportable: /* @__PURE__ */ __name(async ({ chats, kinds }) => {
@@ -24661,14 +24361,16 @@ var archiveService = /* @__PURE__ */ __name((deps) => {
24661
24361
  }
24662
24362
  const windowed = limit?.keepFrom !== void 0 && !(limit.keepFrom <= (options2.sinceMs ?? Number.NEGATIVE_INFINITY));
24663
24363
  const fetched = await fetchInto({
24664
- history: /* @__PURE__ */ __name((window3) => history(chat, { ...window3, reactions: false }), "history"),
24364
+ history: /* @__PURE__ */ __name((window2) => history(chat, { ...window2, reactions: false }), "history"),
24665
24365
  store,
24666
24366
  account,
24667
24367
  fetching: deps.messenger.fetching ?? FETCHING,
24668
24368
  ...options2,
24669
24369
  ...windowed ? { sinceMs: limit.keepFrom } : {}
24670
24370
  });
24671
- const result = windowed && fetched.reachedSince ? { ...fetched, limited: "older_than_window" } : fetched;
24371
+ const replies = fetched.chat && !options2.window ? await savedReplies(connection, store, account, fetched.chat, options2.stop) : 0;
24372
+ const read = replies > 0 ? { ...fetched, fetched: fetched.fetched + replies } : fetched;
24373
+ const result = windowed && read.reachedSince ? { ...read, limited: "older_than_window" } : read;
24672
24374
  if (result.limited && limit?.keepFrom !== void 0)
24673
24375
  await recordSkip(store, account, result.chat ?? limit.chatId, {
24674
24376
  reason: "older_than_window",
@@ -24701,7 +24403,8 @@ var archiveService = /* @__PURE__ */ __name((deps) => {
24701
24403
  const catchingUp = Boolean(options2.catchUp ?? deps.searchCatchUp);
24702
24404
  const upToDate = heldToNewest(await deps.store(), await deps.account(), deps.messenger.fetching ?? FETCHING, {
24703
24405
  ...options2,
24704
- catchUp: catchingUp ? options2.catchUp ?? {} : false
24406
+ catchUp: catchingUp ? options2.catchUp ?? {} : false,
24407
+ threads: connection.threadReplies !== void 0
24705
24408
  });
24706
24409
  const finished = /* @__PURE__ */ __name(() => options2.onChat?.({ chats: chats.length, done: answer.items.length, fetched: answer.fetched }), "finished");
24707
24410
  finished();
@@ -24777,10 +24480,10 @@ var limitOf = /* @__PURE__ */ __name(async (deps, store, account, chat, options2
24777
24480
  const stored = chatId === void 0 ? void 0 : (await store.chats.historyShapes(account, [chatId])).get(chatId);
24778
24481
  if (stored?.included)
24779
24482
  return void 0;
24780
- const window3 = historyWindow(stored ?? options2.shape, deps.historyLimits, Date.now());
24483
+ const window2 = historyWindow(stored ?? options2.shape, deps.historyLimits, Date.now());
24781
24484
  return {
24782
24485
  ...chatId === void 0 ? {} : { chatId },
24783
- ..."skip" in window3 ? { skip: { members: window3.members } } : { keepFrom: window3.keepFrom }
24486
+ ..."skip" in window2 ? { skip: { members: window2.members } } : { keepFrom: window2.keepFrom }
24784
24487
  };
24785
24488
  }, "limitOf");
24786
24489
  var recordSkip = /* @__PURE__ */ __name(async (store, account, chatId, skip) => {
@@ -24803,12 +24506,12 @@ var abortable = /* @__PURE__ */ __name(async (read, signal) => {
24803
24506
  signal.removeEventListener("abort", listener);
24804
24507
  }
24805
24508
  }, "abortable");
24806
- var fetchInto = /* @__PURE__ */ __name(async ({ history, store, account, fetching, limit, pageSize, pauseMs, sinceMs, last, note, stop, onPage, window: window3, onRequest }) => {
24807
- if (window3 && (!Number.isSafeInteger(window3.from) || !Number.isSafeInteger(window3.to + 1) || window3.from > window3.to))
24509
+ var fetchInto = /* @__PURE__ */ __name(async ({ history, store, account, fetching, limit, pageSize, pauseMs, sinceMs, last, note, stop, onPage, window: window2, onRequest }) => {
24510
+ if (window2 && (!Number.isSafeInteger(window2.from) || !Number.isSafeInteger(window2.to + 1) || window2.from > window2.to))
24808
24511
  throw new CliError("validation_error", "invalid history window");
24809
24512
  const byTime = fetching.orderBy === "time";
24810
24513
  const keyed = keyOf(fetching);
24811
- let before = window3 === void 0 ? void 0 : byTime ? new Date(window3.to + (fetching.beforeInclusive ? 0 : 1)).toISOString() : String(window3.to + 1);
24514
+ let before = window2 === void 0 ? void 0 : byTime ? new Date(window2.to + (fetching.beforeInclusive ? 0 : 1)).toISOString() : String(window2.to + 1);
24812
24515
  let requests = 0;
24813
24516
  let windowComplete = false;
24814
24517
  let chatId;
@@ -24827,7 +24530,7 @@ var fetchInto = /* @__PURE__ */ __name(async ({ history, store, account, fetchin
24827
24530
  requests += 1;
24828
24531
  onRequest?.();
24829
24532
  const read = /* @__PURE__ */ __name(() => history({ limit: Math.min(pageSize, limit - fetched), ...before ? { before } : {} }), "read");
24830
- return window3 ? abortable(read, stop) : read();
24533
+ return window2 ? abortable(read, stop) : read();
24831
24534
  }, note, stop);
24832
24535
  } catch (error) {
24833
24536
  if (stop.aborted)
@@ -24841,7 +24544,7 @@ var fetchInto = /* @__PURE__ */ __name(async ({ history, store, account, fetchin
24841
24544
  break;
24842
24545
  const first2 = page.items[0];
24843
24546
  if (!first2) {
24844
- if (window3 === void 0)
24547
+ if (window2 === void 0)
24845
24548
  reachedStart = true;
24846
24549
  break;
24847
24550
  }
@@ -24851,27 +24554,27 @@ var fetchInto = /* @__PURE__ */ __name(async ({ history, store, account, fetchin
24851
24554
  throw new CliError("validation_error", "this messenger's message ids do not order a chat, so it cannot fetch its history");
24852
24555
  }
24853
24556
  const low = Math.min(...keys);
24854
- top ??= window3?.to ?? Math.max(...keys);
24557
+ top ??= window2?.to ?? Math.max(...keys);
24855
24558
  const fresh = page.items.filter((message) => !seen.has(message.id)).length;
24856
24559
  for (const message of page.items)
24857
24560
  seen.add(message.id);
24858
24561
  fetched += fresh;
24859
- const coveredFrom = window3 === void 0 ? low : Math.max(window3.from, low + (byTime && page.hasMore ? 1 : 0));
24562
+ const coveredFrom = window2 === void 0 ? low : Math.max(window2.from, low + (byTime && page.hasMore ? 1 : 0));
24860
24563
  const held = coveredFrom <= top ? await store.sync.markRange(account, chatId, coveredFrom, top) : { from: low, to: top };
24861
- if (window3 !== void 0 && (low < window3.from || !byTime && low === window3.from)) {
24862
- await store.sync.markRange(account, chatId, window3.from, window3.to);
24564
+ if (window2 !== void 0 && (low < window2.from || !byTime && low === window2.from)) {
24565
+ await store.sync.markRange(account, chatId, window2.from, window2.to);
24863
24566
  windowComplete = true;
24864
- onPage({ fetched, chatId, oldest: window3.from });
24567
+ onPage({ fetched, chatId, oldest: window2.from });
24865
24568
  break;
24866
24569
  }
24867
- if (window3 === void 0 && before === void 0)
24570
+ if (window2 === void 0 && before === void 0)
24868
24571
  await store.sync.setSyncState(account, fetchedKey(chatId), String(top));
24869
24572
  onPage({ fetched, chatId, oldest: held.from });
24870
24573
  idle = fresh === 0 ? idle + 1 : 0;
24871
- if (idle > (byTime ? 1 : 0) || window3 !== void 0 && byTime && fresh === 0)
24574
+ if (idle > (byTime ? 1 : 0) || window2 !== void 0 && byTime && fresh === 0)
24872
24575
  break;
24873
24576
  if (!page.hasMore) {
24874
- if (window3 === void 0)
24577
+ if (window2 === void 0)
24875
24578
  reachedStart = true;
24876
24579
  break;
24877
24580
  }
@@ -24885,8 +24588,8 @@ var fetchInto = /* @__PURE__ */ __name(async ({ history, store, account, fetchin
24885
24588
  reachedLast = true;
24886
24589
  break;
24887
24590
  }
24888
- const boundary = window3 === void 0 ? held.from : low;
24889
- before = byTime ? new Date(boundary + (fresh > 0 && !(window3 && fetching.beforeInclusive) ? 1 : 0)).toISOString() : String(boundary);
24591
+ const boundary = window2 === void 0 ? held.from : low;
24592
+ before = byTime ? new Date(boundary + (fresh > 0 && !(window2 && fetching.beforeInclusive) ? 1 : 0)).toISOString() : String(boundary);
24890
24593
  note(`${fetched} messages so far, back to ${fromAt.slice(0, 10)}`);
24891
24594
  const wait = fetching.jitter ? pauseMs * (1 + Math.random()) : pauseMs;
24892
24595
  await sleep2(wait, void 0, { signal: stop }).catch(() => {
@@ -24902,14 +24605,14 @@ var fetchInto = /* @__PURE__ */ __name(async ({ history, store, account, fetchin
24902
24605
  complete: reachedStart && ranges.length === 1,
24903
24606
  ranges,
24904
24607
  ...issue ? { issue, resume: { ...before === void 0 ? {} : { before } } } : {},
24905
- ...window3 === void 0 ? {} : { windowComplete, requests },
24608
+ ...window2 === void 0 ? {} : { windowComplete, requests },
24906
24609
  ...reachedSince ? { reachedSince: true } : {},
24907
24610
  ...reachedLast ? { reachedLast: true } : {},
24908
24611
  ...stop.aborted ? { stopped: true } : {}
24909
24612
  };
24910
24613
  }, "fetchInto");
24911
24614
  var heldToNewest = /* @__PURE__ */ __name((store, account, fetching, options2) => async (chat) => {
24912
- if (options2.window || options2.catchUp || options2.last !== void 0)
24615
+ if (options2.threads || options2.window || options2.catchUp || options2.last !== void 0)
24913
24616
  return false;
24914
24617
  const lastAt = Date.parse(chat.lastMessageAt ?? "");
24915
24618
  if (Number.isNaN(lastAt))
@@ -24929,6 +24632,18 @@ var heldToNewest = /* @__PURE__ */ __name((store, account, fetching, options2) =
24929
24632
  const startedAt = Date.parse(await timeOfKey(store, account, chat.id, top.from, fetching.orderBy === "time", ""));
24930
24633
  return !Number.isNaN(startedAt) && startedAt < options2.sinceMs;
24931
24634
  }, "heldToNewest");
24635
+ var threadsKey = /* @__PURE__ */ __name((chatId) => `threads:${chatId}`, "threadsKey");
24636
+ var savedReplies = /* @__PURE__ */ __name(async (connection, store, account, chatId, stop) => {
24637
+ if (!connection.threadReplies || stop.aborted)
24638
+ return 0;
24639
+ const startedAt = Date.now();
24640
+ const point = Number((await store.sync.syncState(account, threadsKey(chatId)))?.value);
24641
+ const replies = await connection.threadReplies(chatId, Number.isFinite(point) ? { since: point } : {});
24642
+ if (replies.length > 0)
24643
+ await store.messages.saveMessages(account, chatId, replies, { via: "history", seenAt: startedAt });
24644
+ await store.sync.setSyncState(account, threadsKey(chatId), String(startedAt));
24645
+ return replies.length;
24646
+ }, "savedReplies");
24932
24647
  var timeOfKey = /* @__PURE__ */ __name(async (store, account, chatId, key, byTime, fallback) => {
24933
24648
  if (byTime)
24934
24649
  return new Date(key).toISOString();
@@ -24936,20 +24651,20 @@ var timeOfKey = /* @__PURE__ */ __name(async (store, account, chatId, key, byTim
24936
24651
  return message?.timestamp ?? fallback;
24937
24652
  }, "timeOfKey");
24938
24653
 
24939
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/attachments/extract.js
24654
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/attachments/extract.js
24940
24655
  import { extname as extname3 } from "node:path";
24941
24656
 
24942
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/readers/engine.js
24657
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/readers/engine.js
24943
24658
  import { readFileSync } from "node:fs";
24944
24659
  import { dirname as dirname2, extname as extname2, join as join2 } from "node:path";
24945
24660
  import { fileURLToPath } from "node:url";
24946
24661
 
24947
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/attachments/container.js
24662
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/attachments/container.js
24948
24663
  import { setImmediate as tick } from "node:timers/promises";
24949
24664
  import { crc32 } from "node:zlib";
24950
24665
  var import_xmldom = __toESM(require_lib(), 1);
24951
24666
 
24952
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/attachments/encoding.js
24667
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/attachments/encoding.js
24953
24668
  var import_chardet = __toESM(require_lib2(), 1);
24954
24669
  var import_iconv_lite = __toESM(require_lib3(), 1);
24955
24670
  var SAMPLE = 65536;
@@ -25051,7 +24766,7 @@ var decodeXml = /* @__PURE__ */ __name((bytes2) => {
25051
24766
  return result.text;
25052
24767
  }, "decodeXml");
25053
24768
 
25054
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/attachments/container.js
24769
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/attachments/container.js
25055
24770
  var MAX_PART = 10 * 1024 * 1024;
25056
24771
  var MAX_ENTRIES = 1e3;
25057
24772
  var decoder = new TextDecoder("utf-8", { fatal: true });
@@ -25266,7 +24981,7 @@ var elements = /* @__PURE__ */ __name((node, name, namespace) => {
25266
24981
  return found;
25267
24982
  }, "elements");
25268
24983
 
25269
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/readers/engine.js
24984
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/readers/engine.js
25270
24985
  var BUILT_IN = ["unpdf", "mammoth", "word-extractor", "linkedom", "defuddle/node"];
25271
24986
  var ENGINES = [...BUILT_IN, "@napi-rs/canvas"];
25272
24987
  var isMissing = /* @__PURE__ */ __name((error, name) => error?.code === "ERR_MODULE_NOT_FOUND" && String(error.message).includes(name), "isMissing");
@@ -25324,7 +25039,7 @@ var derived = /* @__PURE__ */ __name((bytes2, extractor, read) => {
25324
25039
  }
25325
25040
  }, "derived");
25326
25041
 
25327
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/readers/image/index.js
25042
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/readers/image/index.js
25328
25043
  var IMAGES = /* @__PURE__ */ new Set([".jpg", ".jpeg", ".png", ".webp", ".gif", ".heic", ".tif", ".tiff", ".bmp"]);
25329
25044
  var image = {
25330
25045
  id: "image",
@@ -25333,7 +25048,7 @@ var image = {
25333
25048
  read: /* @__PURE__ */ __name(async () => ({ status: "needs-agent" }), "read")
25334
25049
  };
25335
25050
 
25336
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/readers/doc/index.js
25051
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/readers/doc/index.js
25337
25052
  var OLE = "\xD0\xCF\xE0\xA1\xB1\xE1";
25338
25053
  var doc = {
25339
25054
  id: "doc",
@@ -25345,7 +25060,7 @@ var doc = {
25345
25060
  }), "read")
25346
25061
  };
25347
25062
 
25348
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/readers/docx/index.js
25063
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/readers/docx/index.js
25349
25064
  var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
25350
25065
  var docx = {
25351
25066
  id: "docx",
@@ -25358,10 +25073,10 @@ var docx = {
25358
25073
  }), "read")
25359
25074
  };
25360
25075
 
25361
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/attachments/markup.js
25076
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/attachments/markup.js
25362
25077
  var import_iconv_lite2 = __toESM(require_lib3(), 1);
25363
25078
 
25364
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/domain/html-entities.js
25079
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/domain/html-entities.js
25365
25080
  var NAMED = {
25366
25081
  amp: "&",
25367
25082
  lt: "<",
@@ -25413,7 +25128,7 @@ var decodeEntities = /* @__PURE__ */ __name((text2) => text2.replace(/&(#x[0-9a-
25413
25128
  return body[1] === "x" || body[1] === "X" ? character(Number.parseInt(body.slice(2), 16), entity) : character(Number(body.slice(1)), entity);
25414
25129
  }), "decodeEntities");
25415
25130
 
25416
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/attachments/markup.js
25131
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/attachments/markup.js
25417
25132
  var RTF_SKIPPED = /* @__PURE__ */ new Set([
25418
25133
  "fonttbl",
25419
25134
  "colortbl",
@@ -25579,7 +25294,7 @@ var htmlText = /* @__PURE__ */ __name((source) => {
25579
25294
  return decodeEntities(replaceTags(blocks, /<[^>]*>/g, "")).replace(/(?<![ \t\u00a0])[ \t\u00a0]+\n/g, "\n").replace(/\n{3,}/g, "\n\n").trim();
25580
25295
  }, "htmlText");
25581
25296
 
25582
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/readers/html/page.js
25297
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/readers/html/page.js
25583
25298
  var clean = /* @__PURE__ */ __name((value) => typeof value === "string" ? value.replace(/\s+/g, " ").trim() : "", "clean");
25584
25299
  var namesIn = /* @__PURE__ */ __name((value) => [value].flat().map((entry) => typeof entry === "string" ? clean(entry) : clean(entry?.name)).filter(Boolean).join(", "), "namesIn");
25585
25300
  var jsonLdNodes = /* @__PURE__ */ __name((document) => {
@@ -25635,7 +25350,7 @@ var markdownSections = /* @__PURE__ */ __name((text2) => {
25635
25350
  return found.map((section, index) => ({ ...section, end: found[index + 1]?.start ?? text2.length }));
25636
25351
  }, "markdownSections");
25637
25352
 
25638
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/readers/html/index.js
25353
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/readers/html/index.js
25639
25354
  var HTML = /* @__PURE__ */ new Set([".html", ".htm", ".xhtml"]);
25640
25355
  var first = /* @__PURE__ */ __name((...values) => values.find((value) => typeof value === "string" && value !== ""), "first");
25641
25356
  var loaded = /* @__PURE__ */ __name(async (load, name) => {
@@ -25706,10 +25421,10 @@ var html = {
25706
25421
  }, "read")
25707
25422
  };
25708
25423
 
25709
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/attachments/documents.js
25424
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/attachments/documents.js
25710
25425
  import { posix } from "node:path";
25711
25426
 
25712
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/attachments/sheets.js
25427
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/attachments/sheets.js
25713
25428
  var columnName = /* @__PURE__ */ __name((column) => {
25714
25429
  let name = "";
25715
25430
  for (let rest = column; rest > 0; rest = Math.floor((rest - 1) / 26))
@@ -25764,7 +25479,7 @@ var sheetText = /* @__PURE__ */ __name((sheets2, maxChars = MAX_TEXT_CHARS) => {
25764
25479
  return { text: parts.join("").trim(), truncated: false };
25765
25480
  }, "sheetText");
25766
25481
 
25767
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/attachments/documents.js
25482
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/attachments/documents.js
25768
25483
  var OFFICE = "urn:oasis:names:tc:opendocument:xmlns:office:1.0";
25769
25484
  var TEXT = "urn:oasis:names:tc:opendocument:xmlns:text:1.0";
25770
25485
  var TABLE = "urn:oasis:names:tc:opendocument:xmlns:table:1.0";
@@ -26164,7 +25879,7 @@ var readDocument = /* @__PURE__ */ __name(async (bytes2, kind, signal) => {
26164
25879
  }
26165
25880
  }, "readDocument");
26166
25881
 
26167
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/readers/office/index.js
25882
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/readers/office/index.js
26168
25883
  var office = {
26169
25884
  id: "office",
26170
25885
  version: documentExtractor("odt"),
@@ -26175,7 +25890,7 @@ var office = {
26175
25890
  }, "read")
26176
25891
  };
26177
25892
 
26178
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/readers/pdf/index.js
25893
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/readers/pdf/index.js
26179
25894
  var pdf = {
26180
25895
  id: "pdf",
26181
25896
  version: "unpdf",
@@ -26242,7 +25957,7 @@ var pdf = {
26242
25957
  }), "read")
26243
25958
  };
26244
25959
 
26245
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/readers/plain/index.js
25960
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/readers/plain/index.js
26246
25961
  var PLAIN = /* @__PURE__ */ new Set([".txt", ".md", ".markdown", ".csv", ".tsv", ".json", ".log"]);
26247
25962
  var isPlain = /* @__PURE__ */ __name((hint) => PLAIN.has(extensionOf(hint)) || hint.mime?.startsWith("text/") || hint.mime === "application/json", "isPlain");
26248
25963
  var readPlain = /* @__PURE__ */ __name((bytes2) => {
@@ -26262,7 +25977,7 @@ var plain = {
26262
25977
  read: /* @__PURE__ */ __name(async (bytes2) => readPlain(bytes2), "read")
26263
25978
  };
26264
25979
 
26265
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/readers/rtf/index.js
25980
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/readers/rtf/index.js
26266
25981
  var rtf = {
26267
25982
  id: "rtf",
26268
25983
  version: "v1",
@@ -26270,10 +25985,10 @@ var rtf = {
26270
25985
  read: /* @__PURE__ */ __name(async (bytes2) => derived(bytes2, "rtf:v1", rtfText), "read")
26271
25986
  };
26272
25987
 
26273
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
25988
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
26274
25989
  import { basename as basename2 } from "node:path";
26275
25990
 
26276
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/attachments/csv-spans.js
25991
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/attachments/csv-spans.js
26277
25992
  var delimitedSpans = /* @__PURE__ */ __name((text2, delimiter, maxCells = 1e4) => {
26278
25993
  const cells = [];
26279
25994
  let row = 1, column = 1, start = 0, quoted = false, truncated = false;
@@ -26311,7 +26026,7 @@ var delimitedSpans = /* @__PURE__ */ __name((text2, delimiter, maxCells = 1e4) =
26311
26026
  return { cells, truncated };
26312
26027
  }, "delimitedSpans");
26313
26028
 
26314
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
26029
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/readers/sheets/index.js
26315
26030
  var DELIMITED = {
26316
26031
  ".csv": ",",
26317
26032
  ".tsv": " ",
@@ -26350,7 +26065,7 @@ var sheets = {
26350
26065
  }, "read")
26351
26066
  };
26352
26067
 
26353
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/readers/registry.js
26068
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/readers/registry.js
26354
26069
  var BUILT_INS2 = [office, pdf, docx, doc, rtf, html, sheets, plain, image];
26355
26070
  var HEAD_BYTES = 1024;
26356
26071
  var readers = [...BUILT_INS2];
@@ -26360,7 +26075,7 @@ var readWithRegistry = /* @__PURE__ */ __name(async (bytes2, hint, context2) =>
26360
26075
  return reader ? reader.read(bytes2, hint, context2) : { status: "unsupported" };
26361
26076
  }, "readWithRegistry");
26362
26077
 
26363
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/attachments/extract.js
26078
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/attachments/extract.js
26364
26079
  var importEngine = /* @__PURE__ */ __name((name) => importFrom(new URL("attachments/extract.js", import.meta.resolve("@wirecat/cli-core")).href, name), "importEngine");
26365
26080
  var extensionOf2 = /* @__PURE__ */ __name(({ name, path }) => extname3(name ?? path).toLowerCase(), "extensionOf");
26366
26081
  var extractText = /* @__PURE__ */ __name(async (bytes2, hint, load, signal, env = process.env) => {
@@ -26398,7 +26113,7 @@ var engineStates = /* @__PURE__ */ __name((resolve7 = (name) => resolveFrom(new
26398
26113
  }
26399
26114
  })), "engineStates");
26400
26115
 
26401
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/domain/models.js
26116
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/domain/models.js
26402
26117
  var GROUP_SETTINGS = [
26403
26118
  "allCanPin",
26404
26119
  "onlyAdminsAdd",
@@ -26412,7 +26127,7 @@ var ADMIN_RIGHTS = ["read", "members", "admins", "info", "pin", "link", "post",
26412
26127
  var senderIsMe = /* @__PURE__ */ __name((message, account) => message.outgoing === true || message.senderId !== null && String(message.senderId) === account, "senderIsMe");
26413
26128
  var MEDIA_KINDS = ["photo", "video", "file", "audio", "link"];
26414
26129
 
26415
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/sends/send-as.js
26130
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/sends/send-as.js
26416
26131
  var sendAsCheck = /* @__PURE__ */ __name((connection, sendAs) => {
26417
26132
  if (sendAs === void 0) {
26418
26133
  const saved = connection.savedSender?.bind(connection);
@@ -26437,7 +26152,7 @@ var typedSendAs = /* @__PURE__ */ __name((typed) => {
26437
26152
  return sendAs;
26438
26153
  }, "typedSendAs");
26439
26154
 
26440
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/search/respell.js
26155
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/search/respell.js
26441
26156
  var LATIN = {
26442
26157
  \u0430: "a",
26443
26158
  \u0431: "b",
@@ -26492,7 +26207,7 @@ var respelled = /* @__PURE__ */ __name(async (vocabulary, words3) => {
26492
26207
  return found;
26493
26208
  }, "respelled");
26494
26209
 
26495
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/search/total.js
26210
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/search/total.js
26496
26211
  var TOTAL_CAP = 1e4;
26497
26212
  var totalOf = /* @__PURE__ */ __name((count3, shown, hasMore, exact = true) => {
26498
26213
  const least = shown + (hasMore ? 1 : 0);
@@ -26503,7 +26218,7 @@ var totalOf = /* @__PURE__ */ __name((count3, shown, hasMore, exact = true) => {
26503
26218
  return { value: count3, relation: exact ? "eq" : "gte" };
26504
26219
  }, "totalOf");
26505
26220
 
26506
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/search/lucene/meaning-parts.js
26221
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/search/lucene/meaning-parts.js
26507
26222
  var WORD_FIELDS = /* @__PURE__ */ new Set(["text", "exact"]);
26508
26223
  var fieldsOfQuery = /* @__PURE__ */ __name((root, everything) => {
26509
26224
  let narrows = false;
@@ -26532,7 +26247,7 @@ var meaningWords = /* @__PURE__ */ __name((root) => {
26532
26247
  return wanted(root).join(" ").trim();
26533
26248
  }, "meaningWords");
26534
26249
 
26535
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/messages-combined.js
26250
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/messages-combined.js
26536
26251
  var COMBINED_DEFAULTS = { candidateDepth: 300, rrfK: 60, rerank: "all", chatCap: 0 };
26537
26252
  var tokensOf = /* @__PURE__ */ __name((text2) => normalize(text2).match(/[\p{L}\p{N}\p{Co}\p{M}]+/gu) ?? [], "tokensOf");
26538
26253
  var searchCombined = /* @__PURE__ */ __name(async (store, account, request, messenger = {}, options2 = COMBINED_DEFAULTS) => {
@@ -26733,7 +26448,7 @@ var signals = /* @__PURE__ */ __name((hit, terms, corrections, execution, mode,
26733
26448
  return mode === "coverage" ? coverage2 * 4 : mode === "proximity" ? proximity : mode === "phrase" ? phrase2 : coverage2 * 4 + proximity + phrase2;
26734
26449
  }, "signals");
26735
26450
 
26736
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/messages-discovery.js
26451
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/messages-discovery.js
26737
26452
  var MEANING_DEPTH = 100;
26738
26453
  var RRF_K2 = 60;
26739
26454
  var RERANK_DEPTH = 50;
@@ -27059,10 +26774,11 @@ var mixedWithReranker = /* @__PURE__ */ __name((head, scores) => {
27059
26774
  })).sort((a, b) => b.mixed - a.mixed).map(({ hit }) => hit);
27060
26775
  }, "mixedWithReranker");
27061
26776
 
27062
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/named-chat.js
26777
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/named-chat.js
27063
26778
  var LEAST_USES = 3;
27064
26779
  var SAMPLE2 = 50;
27065
26780
  var CAPITALISED = 0.8;
26781
+ var NAMED_SHARE = 0.05;
27066
26782
  var namedChat = /* @__PURE__ */ __name(async (store, account, messenger, accounts, words3) => {
27067
26783
  for (const word of words3) {
27068
26784
  if (word.length < 3 || new RegExp("^\\p{N}+$", "u").test(word))
@@ -27075,6 +26791,7 @@ var namedChat = /* @__PURE__ */ __name(async (store, account, messenger, account
27075
26791
  messenger
27076
26792
  );
27077
26793
  const groups = (await store.queries.countQuery(execution, "chat")).sort((a, b) => b.count - a.count);
26794
+ const total = groups.reduce((sum2, { count: count3 }) => sum2 + count3, 0);
27078
26795
  const dialogs = [];
27079
26796
  for (const group of groups) {
27080
26797
  if (dialogs.length === 2)
@@ -27087,6 +26804,8 @@ var namedChat = /* @__PURE__ */ __name(async (store, account, messenger, account
27087
26804
  const [best, next] = dialogs;
27088
26805
  if (!best || best.count < LEAST_USES || next && next.count * 2 > best.count)
27089
26806
  continue;
26807
+ if (best.count < total * NAMED_SHARE)
26808
+ continue;
27090
26809
  const { items } = await store.queries.matchQuery({
27091
26810
  ...execution,
27092
26811
  chat: { account: best.source, chatId: best.chatId }
@@ -27109,7 +26828,7 @@ var queryWords2 = /* @__PURE__ */ __name((query) => {
27109
26828
  }, "queryWords");
27110
26829
  var without = /* @__PURE__ */ __name((query, word) => query.replace(new RegExp(`(?<![\\p{L}\\p{N}])${word}(?![\\p{L}\\p{N}])`, "giu"), " ").replace(/\s+/gu, " ").trim(), "without");
27111
26830
 
27112
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/thread-context.js
26831
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/thread-context.js
27113
26832
  var THREAD_BOUNDS = { maxHops: 8, maxMessages: 50, maxBytes: 65536, withinMs: 864e5 };
27114
26833
  var bytes = /* @__PURE__ */ __name((items, links) => Buffer.byteLength(JSON.stringify({ items, links }), "utf8"), "bytes");
27115
26834
  var threadBounds = /* @__PURE__ */ __name((options2 = {}) => {
@@ -27308,7 +27027,7 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account, chat, mess
27308
27027
  return result;
27309
27028
  }, "readThreadContext");
27310
27029
 
27311
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/messages-archive-search.js
27030
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/messages-archive-search.js
27312
27031
  var SEARCH_FILL_MS = 200;
27313
27032
  var statsStore = /* @__PURE__ */ __name(async (store, account, request, messenger = {}) => {
27314
27033
  const stop = Date.now() + SEARCH_FILL_MS;
@@ -27416,7 +27135,7 @@ var accountOf2 = /* @__PURE__ */ __name((hit) => {
27416
27135
  }, "accountOf");
27417
27136
  var keyOf2 = /* @__PURE__ */ __name(({ provider, account }) => `${provider}/${account}`, "keyOf");
27418
27137
 
27419
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/embeddings/keys.js
27138
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/embeddings/keys.js
27420
27139
  var endpointKeyName = /* @__PURE__ */ __name((baseUrl) => {
27421
27140
  const host = new URL(baseUrl).host;
27422
27141
  return ["openai", "anthropic"].includes(host) ? `endpoint:${host}` : host;
@@ -27449,7 +27168,7 @@ var embeddingKeys = /* @__PURE__ */ __name((app, env = process.env, keyring) =>
27449
27168
  };
27450
27169
  }, "embeddingKeys");
27451
27170
 
27452
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/models/openai.js
27171
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/models/openai.js
27453
27172
  var options = strictObject({
27454
27173
  temperature: range(0, 2),
27455
27174
  top_p: range(0, 1),
@@ -27516,7 +27235,7 @@ var openai = {
27516
27235
  }), "complete")
27517
27236
  };
27518
27237
 
27519
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/models/index.js
27238
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/models/index.js
27520
27239
  var modelGateway = /* @__PURE__ */ __name((deps) => ({
27521
27240
  complete: /* @__PURE__ */ __name(async (request) => {
27522
27241
  if (deps.signal?.aborted)
@@ -27531,7 +27250,7 @@ var modelGateway = /* @__PURE__ */ __name((deps) => ({
27531
27250
  if (!adapter && target2.provider === "openai")
27532
27251
  adapter = openai;
27533
27252
  if (!adapter && target2.provider === "anthropic")
27534
- adapter = (await import("./anthropic-N5NOX7K7.js")).anthropic;
27253
+ adapter = (await import("./anthropic-RDNDT6ZP.js")).anthropic;
27535
27254
  if (!adapter)
27536
27255
  throw new CliError("validation_error", `no model adapter for ${target2.provider}`);
27537
27256
  if (request.images !== void 0 && adapter.images !== true)
@@ -27591,7 +27310,7 @@ var modelGateway = /* @__PURE__ */ __name((deps) => ({
27591
27310
  }, "complete")
27592
27311
  }), "modelGateway");
27593
27312
 
27594
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/searches.js
27313
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/searches.js
27595
27314
  var savedSearchItem = /* @__PURE__ */ __name((one) => ({
27596
27315
  id: one.id,
27597
27316
  name: one.name,
@@ -27717,7 +27436,7 @@ var searchesService = /* @__PURE__ */ __name((deps) => {
27717
27436
  };
27718
27437
  }, "searchesService");
27719
27438
 
27720
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/text-model-choice.js
27439
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/text-model-choice.js
27721
27440
  import { createHash as createHash3 } from "node:crypto";
27722
27441
  import { existsSync } from "node:fs";
27723
27442
  var useTextModel = /* @__PURE__ */ __name(async (id2, { env, command }) => {
@@ -27848,11 +27567,11 @@ var addCustomTextModel = /* @__PURE__ */ __name(async (id2, payload, { env, fetc
27848
27567
  return { ...checked2.output, custom: true };
27849
27568
  }, "addCustomTextModel");
27850
27569
 
27851
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/calendar/sync.js
27570
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/calendar/sync.js
27852
27571
  var DAY3 = 864e5;
27853
27572
  var SLOTS_EVERY = 7 * DAY3;
27854
27573
 
27855
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/calendar/reads.js
27574
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/calendar/reads.js
27856
27575
  var localDate = /* @__PURE__ */ __name((at, zone) => new Intl.DateTimeFormat("en-CA", { timeZone: zone, year: "numeric", month: "2-digit", day: "2-digit" }).format(at), "localDate");
27857
27576
  var plusDays = /* @__PURE__ */ __name((date, days) => {
27858
27577
  const [year, month, day2] = date.split("-").map(Number);
@@ -27916,10 +27635,10 @@ var EVENTS_QUERY = {
27916
27635
  } : field)
27917
27636
  };
27918
27637
 
27919
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/calendar/feeds.js
27638
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/calendar/feeds.js
27920
27639
  var FEED_LIMITS = { maxBytes: 10 * 1024 * 1024, timeoutMs: 3e4, redirects: 5 };
27921
27640
 
27922
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/calendar/writer.js
27641
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/calendar/writer.js
27923
27642
  var EVENTS_NOTIFY_KEY = "events.notify";
27924
27643
  var EVENTS_DELETE_SERIES_KEY = "events.delete.series";
27925
27644
  var EVENTS_REMIND_HOOK_KEY = "events.remind.hook";
@@ -27937,7 +27656,7 @@ var CALENDAR_WRITE_DEFAULTS = {
27937
27656
  [EVENTS_REMIND_HOOK_KEY]: "deny"
27938
27657
  };
27939
27658
 
27940
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/meeting-passage-format.js
27659
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/meeting-passage-format.js
27941
27660
  var visible = /* @__PURE__ */ __name((text2) => text2.replace(/[\p{Cc}\p{Cf}]/gu, (value) => value === "\n" || value === " " ? value : `\\u{${value.codePointAt(0)?.toString(16)}}`), "visible");
27942
27661
  var markdown = /* @__PURE__ */ __name((text2) => visible(text2).replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replace(/[\\`*_[\]#|~]/g, "\\$&"), "markdown");
27943
27662
  var timestamp = /* @__PURE__ */ __name((ms) => {
@@ -27957,22 +27676,22 @@ var formatMeetingPassage = /* @__PURE__ */ __name((packet, format = "text", maxB
27957
27676
  const source = ref(packet.source);
27958
27677
  const context2 = packet.kind === "meeting_context";
27959
27678
  const coverage2 = context2 ? `Cues: ${packet.coverage.included}; before: ${packet.coverage.before}/${packet.limits.before}; after: ${packet.coverage.after}/${packet.limits.after}; more before: ${packet.coverage.has_before}; more after: ${packet.coverage.has_after}; clipped: ${packet.coverage.truncated_by ?? "none"}; archive: ${packet.coverage.archive_completeness}.` : `Cues: ${packet.coverage.included}; more: ${packet.coverage.hasMore}; clipped: ${packet.coverage.truncatedBy ?? "none"}; unavailable revisions: ${packet.coverage.skippedUnavailable}; archive: ${packet.coverage.archiveCompleteness}.`;
27960
- const lines3 = [`Source: ${source}`, coverage2];
27679
+ const lines = [`Source: ${source}`, coverage2];
27961
27680
  if (context2) {
27962
- lines3.push(`Target: ${ref(packet.target_ref)}; revision: ${packet.revision}.`);
27681
+ lines.push(`Target: ${ref(packet.target_ref)}; revision: ${packet.revision}.`);
27963
27682
  if (packet.coverage.before_ref)
27964
- lines3.push(`Before anchor (inclusive): ${ref(packet.coverage.before_ref)}`);
27683
+ lines.push(`Before anchor (inclusive): ${ref(packet.coverage.before_ref)}`);
27965
27684
  if (packet.coverage.after_ref)
27966
- lines3.push(`After anchor (inclusive): ${ref(packet.coverage.after_ref)}`);
27685
+ lines.push(`After anchor (inclusive): ${ref(packet.coverage.after_ref)}`);
27967
27686
  } else {
27968
27687
  if (packet.coverage.nextReference)
27969
- lines3.push(`Continue after: ${ref(packet.coverage.nextReference)}`);
27688
+ lines.push(`Continue after: ${ref(packet.coverage.nextReference)}`);
27970
27689
  if (packet.coverage.nextTranscriptId !== null)
27971
- lines3.push(`Continue after transcript: ${packet.coverage.nextTranscriptId}`);
27690
+ lines.push(`Continue after transcript: ${packet.coverage.nextTranscriptId}`);
27972
27691
  }
27973
27692
  if (!packet.items.length)
27974
- lines3.push("No cues included; check coverage and limits before concluding content is absent.");
27975
- let bytes2 = Buffer.byteLength(lines3.join("\n"), "utf8") + 1;
27693
+ lines.push("No cues included; check coverage and limits before concluding content is absent.");
27694
+ let bytes2 = Buffer.byteLength(lines.join("\n"), "utf8") + 1;
27976
27695
  if (bytes2 > maxBytes)
27977
27696
  throw new CliError("validation_error", "compact passage exceeds its output byte budget");
27978
27697
  for (const item2 of packet.items) {
@@ -28000,13 +27719,13 @@ ${body}`;
28000
27719
  bytes2 += Buffer.byteLength(part, "utf8") + 1;
28001
27720
  if (bytes2 > maxBytes)
28002
27721
  throw new CliError("validation_error", "compact passage exceeds its output byte budget");
28003
- lines3.push(part);
27722
+ lines.push(part);
28004
27723
  }
28005
- return `${lines3.join("\n")}
27724
+ return `${lines.join("\n")}
28006
27725
  `;
28007
27726
  }, "formatMeetingPassage");
28008
27727
 
28009
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/meeting-preparation-validation.js
27728
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/meeting-preparation-validation.js
28010
27729
  var MEETING_PREPARATION_LIMITS = {
28011
27730
  meetings: { min: 1, max: 20, default: 5 },
28012
27731
  cues: { min: 1, max: 100, default: 10 },
@@ -28079,7 +27798,7 @@ var validateMeetingPreparationRequest = /* @__PURE__ */ __name((externalId, orig
28079
27798
  };
28080
27799
  }, "validateMeetingPreparationRequest");
28081
27800
 
28082
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/meeting-communications-selection.js
27801
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/meeting-communications-selection.js
28083
27802
  var validatePreparationCommunications = /* @__PURE__ */ __name((section, request, after) => {
28084
27803
  const fail2 = /* @__PURE__ */ __name(() => {
28085
27804
  throw new CliError("invalid_response", "Preparation communications returned another selection or invalid evidence");
@@ -28127,7 +27846,7 @@ var validatePreparationCommunications = /* @__PURE__ */ __name((section, request
28127
27846
  }
28128
27847
  }, "validatePreparationCommunications");
28129
27848
 
28130
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/package-upgrade.js
27849
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/package-upgrade.js
28131
27850
  var upgradePackage = /* @__PURE__ */ __name(async ({ current, command, packageName, check: check2 }, ports) => {
28132
27851
  const installer = ports.installer();
28133
27852
  const argv = updateCommand(installer, packageName);
@@ -28192,18 +27911,18 @@ var dayAfter = /* @__PURE__ */ __name((published) => {
28192
27911
  return Number.isNaN(time) ? null : new Date(time + 24 * 60 * 60 * 1e3).toISOString();
28193
27912
  }, "dayAfter");
28194
27913
 
28195
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/media-archive.js
27914
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/media-archive.js
28196
27915
  import { setTimeout as sleep3 } from "node:timers/promises";
28197
27916
 
28198
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
27917
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
28199
27918
  import { lstat } from "node:fs/promises";
28200
27919
 
28201
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
27920
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
28202
27921
  import { createHash as createHash5, randomUUID as randomUUID2 } from "node:crypto";
28203
27922
  import { open as open3, rename as rename2, unlink as unlink2 } from "node:fs/promises";
28204
27923
  import { join as join4 } from "node:path";
28205
27924
 
28206
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-metadata.js
27925
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-metadata.js
28207
27926
  import { createHash as createHash4 } from "node:crypto";
28208
27927
  var metadataLimit = 16384;
28209
27928
  var partialIdentity = /* @__PURE__ */ __name((locator) => JSON.stringify([locator.provider, locator.account, locator.occurrenceId, locator.assetId]), "partialIdentity");
@@ -28263,7 +27982,7 @@ var readPartialMetadata = /* @__PURE__ */ __name(async (path, locator, maxBytes,
28263
27982
  }
28264
27983
  }, "readPartialMetadata");
28265
27984
 
28266
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-writer.js
27985
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-writer.js
28267
27986
  import { randomUUID } from "node:crypto";
28268
27987
  import { open as open2, rename, unlink } from "node:fs/promises";
28269
27988
  import { join as join3 } from "node:path";
@@ -28355,7 +28074,7 @@ var partialWriter = /* @__PURE__ */ __name(async (input) => {
28355
28074
  };
28356
28075
  }, "partialWriter");
28357
28076
 
28358
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
28077
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
28359
28078
  var NativeRecordingPartialStore = class {
28360
28079
  static {
28361
28080
  __name(this, "NativeRecordingPartialStore");
@@ -28462,12 +28181,12 @@ var NativeRecordingPartialStore = class {
28462
28181
  }
28463
28182
  };
28464
28183
 
28465
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
28184
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
28466
28185
  import { createHash as createHash6 } from "node:crypto";
28467
28186
  import { link as link2 } from "node:fs/promises";
28468
28187
  import { basename as basename3, dirname as dirname3, join as join6, resolve as resolve2 } from "node:path";
28469
28188
 
28470
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-files.js
28189
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-files.js
28471
28190
  import { unlink as unlink3 } from "node:fs/promises";
28472
28191
  var verifiedPublicationFile = /* @__PURE__ */ __name(async (path, expected2, signal, writable = false) => {
28473
28192
  signal?.throwIfAborted();
@@ -28502,7 +28221,7 @@ var commitPublication = /* @__PURE__ */ __name(async (root, partialPath, finalPa
28502
28221
  signal?.throwIfAborted();
28503
28222
  }, "commitPublication");
28504
28223
 
28505
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-journal.js
28224
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-journal.js
28506
28225
  import { randomUUID as randomUUID3 } from "node:crypto";
28507
28226
  import { open as open4, rename as rename3, unlink as unlink4 } from "node:fs/promises";
28508
28227
  import { join as join5 } from "node:path";
@@ -28575,7 +28294,7 @@ var writePublicationJournal = /* @__PURE__ */ __name(async (root, path, prefix,
28575
28294
  }
28576
28295
  }, "writePublicationJournal");
28577
28296
 
28578
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
28297
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
28579
28298
  var NativeRecordingPublication = class {
28580
28299
  static {
28581
28300
  __name(this, "NativeRecordingPublication");
@@ -28648,7 +28367,7 @@ var NativeRecordingPublication = class {
28648
28367
  }
28649
28368
  };
28650
28369
 
28651
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/media-archive-manifest.js
28370
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/media-archive-manifest.js
28652
28371
  import { createHash as createHash7 } from "node:crypto";
28653
28372
  import { readdir } from "node:fs/promises";
28654
28373
  import { isAbsolute as isAbsolute2, join as join7, resolve as resolve3 } from "node:path";
@@ -28735,7 +28454,7 @@ var commitMediaEntry = /* @__PURE__ */ __name((root, one, beforePublish) => writ
28735
28454
  beforePublish
28736
28455
  }), "commitMediaEntry");
28737
28456
 
28738
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
28457
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
28739
28458
  var validator = '"media-completed-v1"';
28740
28459
  var maximumFileBytes = 64 * 1024 * 1024 * 1024;
28741
28460
  var archiveMediaFile = /* @__PURE__ */ __name(async (root, identity, kind, file, beforeWrite, signal, metadata = {}) => {
@@ -28836,7 +28555,7 @@ var archiveMediaFile = /* @__PURE__ */ __name(async (root, identity, kind, file,
28836
28555
  return entry;
28837
28556
  }, "archiveMediaFile");
28838
28557
 
28839
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/media-archive-locks.js
28558
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/media-archive-locks.js
28840
28559
  import { mkdir, realpath } from "node:fs/promises";
28841
28560
  import { join as join8, resolve as resolve4 } from "node:path";
28842
28561
  var archiveLocations = /* @__PURE__ */ __name(async (initial, signal) => {
@@ -28903,7 +28622,7 @@ var withMediaArchiveLocks = /* @__PURE__ */ __name(async (directory2, signal, ru
28903
28622
  throw new CliError("validation_error", "archive locations changed during locking; run the command again");
28904
28623
  }, "withMediaArchiveLocks");
28905
28624
 
28906
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/media-archive.js
28625
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/media-archive.js
28907
28626
  var checkMediaArchive = /* @__PURE__ */ __name((directory2, signal) => withMediaArchiveLocks(directory2, signal, async (root) => {
28908
28627
  const entries = await readMediaManifests(root, signal);
28909
28628
  if (!entries.length)
@@ -29046,7 +28765,7 @@ var archiveMedia = /* @__PURE__ */ __name(async (ports, options2) => {
29046
28765
  }, { create: true });
29047
28766
  }, "archiveMedia");
29048
28767
 
29049
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/media-archive-move.js
28768
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/media-archive-move.js
29050
28769
  import { realpath as realpath2, unlink as unlink5 } from "node:fs/promises";
29051
28770
  import { basename as basename4, dirname as dirname4, join as join9, resolve as resolve5 } from "node:path";
29052
28771
  var canonicalDestination = /* @__PURE__ */ __name(async (directory2) => {
@@ -29197,7 +28916,7 @@ var moveMediaArchive = /* @__PURE__ */ __name(async (options2) => {
29197
28916
  }, { additional: [target2], createAdditional: !options2.dryRun });
29198
28917
  }, "moveMediaArchive");
29199
28918
 
29200
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/domain/money-words.js
28919
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/domain/money-words.js
29201
28920
  var MONEY_REQUEST = "money-request";
29202
28921
  var MONEY_DONE = "money-done";
29203
28922
  var PROMISE = "promise";
@@ -29231,10 +28950,10 @@ var MONEY_WORDS = [
29231
28950
  }
29232
28951
  ];
29233
28952
 
29234
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/money-words.js
28953
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/money-words.js
29235
28954
  var moneyClassesOf = /* @__PURE__ */ __name((text2) => listsHit(text2, MONEY_WORDS), "moneyClassesOf");
29236
28955
 
29237
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/domain/status-words.js
28956
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/domain/status-words.js
29238
28957
  var words2 = /* @__PURE__ */ __name((forms) => new RegExp(`(?<![\\p{L}\\p{N}])(?:${forms.join("|")})(?![\\p{L}\\p{N}])`, "iu"), "words");
29239
28958
  var MONEY_DONE_FORMS = words2([
29240
28959
  "\u043E\u043F\u043B\u0430\u0442\u0438\u043B[\u0430\u0438]?",
@@ -29274,7 +28993,7 @@ var PROMISE_FORMS = words2([
29274
28993
  "estar\xE1 listo"
29275
28994
  ]);
29276
28995
 
29277
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/project-status/items.js
28996
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/project-status/items.js
29278
28997
  var EXCERPT_CHARS = 80;
29279
28998
  var excerpt2 = /* @__PURE__ */ __name((text2) => {
29280
28999
  const flat = text2.replace(/\s+/g, " ").trim();
@@ -29296,7 +29015,7 @@ var whoOf = /* @__PURE__ */ __name((message) => ({
29296
29015
  var fromOwner = /* @__PURE__ */ __name((message) => message.outgoing === true, "fromOwner");
29297
29016
  var day = /* @__PURE__ */ __name((at) => new Date(at).toISOString().slice(0, 10), "day");
29298
29017
 
29299
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/project-status/signals/amounts.js
29018
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/project-status/signals/amounts.js
29300
29019
  var MONEY = DEFAULT_TASK_CATEGORIES.filter((category) => category.name === "money");
29301
29020
  var verbOf = /* @__PURE__ */ __name((text2) => {
29302
29021
  if (MONEY_DONE_FORMS.test(text2))
@@ -29377,7 +29096,7 @@ var amounts = {
29377
29096
  attention: /* @__PURE__ */ __name((items) => items.flatMap((item2) => item2.chat !== null && item2.data.state === "asked" ? [{ chat: item2.chat, weight: 2, why: "money asked" }] : []), "attention")
29378
29097
  };
29379
29098
 
29380
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/project-status/signals/children.js
29099
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/project-status/signals/children.js
29381
29100
  var children = {
29382
29101
  id: "children",
29383
29102
  version: 1,
@@ -29406,7 +29125,7 @@ var children = {
29406
29125
  }, "read")
29407
29126
  };
29408
29127
 
29409
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/project-status/signals/coverage.js
29128
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/project-status/signals/coverage.js
29410
29129
  var coverage = {
29411
29130
  id: "coverage",
29412
29131
  version: 1,
@@ -29435,7 +29154,7 @@ var coverage = {
29435
29154
  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")
29436
29155
  };
29437
29156
 
29438
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/project-status/signals/payments.js
29157
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/project-status/signals/payments.js
29439
29158
  var holding = /* @__PURE__ */ __name((row) => row.review !== "rejected", "holding");
29440
29159
  var item = /* @__PURE__ */ __name((row, at, data) => ({
29441
29160
  signal: "payments",
@@ -29485,7 +29204,7 @@ var payments = {
29485
29204
  }, "read")
29486
29205
  };
29487
29206
 
29488
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/project-status/signals/promises.js
29207
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/project-status/signals/promises.js
29489
29208
  var PATTERNS_PER_CHAT = 3;
29490
29209
  var DAY4 = 864e5;
29491
29210
  var KINDS2 = /* @__PURE__ */ new Set(["promise", "request"]);
@@ -29574,7 +29293,7 @@ var promises = {
29574
29293
  }, "read")
29575
29294
  };
29576
29295
 
29577
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/project-status/signals/questions.js
29296
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/project-status/signals/questions.js
29578
29297
  var PER_SIDE = 5;
29579
29298
  var WEEK = 7 * 864e5;
29580
29299
  var NOBODY = /* @__PURE__ */ new Set();
@@ -29605,7 +29324,7 @@ var questions2 = {
29605
29324
  }, "attention")
29606
29325
  };
29607
29326
 
29608
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/project-status/signals/reply-next.js
29327
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/project-status/signals/reply-next.js
29609
29328
  var targetOf = /* @__PURE__ */ __name((message, chat, owners) => {
29610
29329
  const byId2 = /* @__PURE__ */ __name((id2) => chat.messages.find((one) => one.id === id2), "byId");
29611
29330
  const quoted = message.replyTo ?? (message.replyToId === void 0 ? void 0 : byId2(message.replyToId));
@@ -29673,7 +29392,7 @@ var replyNext = {
29673
29392
  attention: /* @__PURE__ */ __name((items) => items.flatMap((item2) => item2.chat !== null && item2.data.next === "owner" ? [{ chat: item2.chat, weight: 2, why: "your move" }] : []), "attention")
29674
29393
  };
29675
29394
 
29676
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/project-status/signals/topics.js
29395
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/project-status/signals/topics.js
29677
29396
  var escaped = /* @__PURE__ */ __name((text2) => text2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
29678
29397
  var wholeWord = /* @__PURE__ */ __name((word) => new RegExp(`(?<![\\p{L}\\p{N}])${escaped(word)}(?![\\p{L}\\p{N}])`, "u"), "wholeWord");
29679
29398
  var matcherOf = /* @__PURE__ */ __name((query) => {
@@ -29719,7 +29438,7 @@ var topics = {
29719
29438
  }, "read")
29720
29439
  };
29721
29440
 
29722
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/project-status/signals/index.js
29441
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/project-status/signals/index.js
29723
29442
  var STATUS_SIGNALS = [
29724
29443
  replyNext,
29725
29444
  questions2,
@@ -29731,7 +29450,7 @@ var STATUS_SIGNALS = [
29731
29450
  children
29732
29451
  ];
29733
29452
 
29734
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/project-status/index.js
29453
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/project-status/index.js
29735
29454
  var DAY5 = 864e5;
29736
29455
  var STATUS_WINDOW = 300;
29737
29456
  var STATUS_CHATS = 16;
@@ -29920,7 +29639,7 @@ var projectStatus = /* @__PURE__ */ __name(async (store, input) => {
29920
29639
  };
29921
29640
  }, "projectStatus");
29922
29641
 
29923
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/account.js
29642
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/account.js
29924
29643
  var accountService = /* @__PURE__ */ __name((deps) => {
29925
29644
  const online = /* @__PURE__ */ __name(async (command) => {
29926
29645
  if (deps.offline)
@@ -29992,7 +29711,7 @@ var accountService = /* @__PURE__ */ __name((deps) => {
29992
29711
  };
29993
29712
  }, "accountService");
29994
29713
 
29995
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/domain/send-time.js
29714
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/domain/send-time.js
29996
29715
  var sendTime = /* @__PURE__ */ __name((value, now = Date.now(), flag = "--at-time", zone) => {
29997
29716
  const at = aheadOf(value, flag, now, {
29998
29717
  ...zone === void 0 ? {} : { zone },
@@ -30003,7 +29722,7 @@ var sendTime = /* @__PURE__ */ __name((value, now = Date.now(), flag = "--at-tim
30003
29722
  return new Date(at - at % MINUTE).toISOString();
30004
29723
  }, "sendTime");
30005
29724
 
30006
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/admin.js
29725
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/admin.js
30007
29726
  var recordMembership = /* @__PURE__ */ __name(async (deps, operationId, done2, change, fix, write) => {
30008
29727
  try {
30009
29728
  const held = await accountStoreIfOpen(deps);
@@ -30034,9 +29753,9 @@ var adminService = /* @__PURE__ */ __name((deps) => {
30034
29753
  }, "create"),
30035
29754
  join: /* @__PURE__ */ __name(async (link4) => {
30036
29755
  const connection = await online("chats join");
30037
- const join14 = capability(connection, "join", "join a chat by its link");
29756
+ const join13 = capability(connection, "join", "join a chat by its link");
30038
29757
  const operationId = newOperationId();
30039
- const joined = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "chat", action: "join" }, () => join14(link4.trim()), (answer) => "requested" in answer ? {} : { chatId: answer.id });
29758
+ const joined = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "chat", action: "join" }, () => join13(link4.trim()), (answer) => "requested" in answer ? {} : { chatId: answer.id });
30040
29759
  if ("requested" in joined)
30041
29760
  return { operationId, requested: true };
30042
29761
  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`;
@@ -30122,17 +29841,17 @@ var adminService = /* @__PURE__ */ __name((deps) => {
30122
29841
  }));
30123
29842
  return { operationId, chatId, ...made };
30124
29843
  }, "createLink"),
30125
- requests: /* @__PURE__ */ __name(async (chat, window3) => {
29844
+ requests: /* @__PURE__ */ __name(async (chat, window2) => {
30126
29845
  if (deps.offline)
30127
29846
  throw new CliError("validation_error", "join requests are read from the messenger; not with --offline");
30128
- if (window3.search !== void 0 && window3.link !== void 0)
29847
+ if (window2.search !== void 0 && window2.link !== void 0)
30129
29848
  throw new CliError("validation_error", "a name and a link narrow the list two ways; use one");
30130
- if (window3.search?.trim() === "" || window3.link?.trim() === "")
29849
+ if (window2.search?.trim() === "" || window2.link?.trim() === "")
30131
29850
  throw new CliError("validation_error", "a name or a link needs a value");
30132
29851
  const connection = await deps.connection();
30133
29852
  const list2 = capability(connection, "joinRequests", "read join requests");
30134
29853
  const { id: chatId } = await connection.resolve(chat);
30135
- return { chatId, ...await list2(chatId, window3) };
29854
+ return { chatId, ...await list2(chatId, window2) };
30136
29855
  }, "requests"),
30137
29856
  answerRequest: /* @__PURE__ */ __name(async (chat, person, accept) => {
30138
29857
  const connection = await online(`chats requests ${accept ? "accept" : "decline"}`);
@@ -30165,13 +29884,13 @@ var adminService = /* @__PURE__ */ __name((deps) => {
30165
29884
  }, () => answerAll(chatId, accept, link4));
30166
29885
  return { operationId, chatId, accepted: accept, counted: counted2 };
30167
29886
  }, "answerAllRequests"),
30168
- links: /* @__PURE__ */ __name(async (chat, window3) => {
29887
+ links: /* @__PURE__ */ __name(async (chat, window2) => {
30169
29888
  if (deps.offline)
30170
29889
  throw new CliError("validation_error", "invite links are read from the messenger; not with --offline");
30171
29890
  const connection = await deps.connection();
30172
29891
  const list2 = capability(connection, "inviteLinks", "list invite links");
30173
29892
  const { id: chatId } = await connection.resolve(chat);
30174
- return { chatId, ...await list2(chatId, window3) };
29893
+ return { chatId, ...await list2(chatId, window2) };
30175
29894
  }, "links"),
30176
29895
  revokeLink: /* @__PURE__ */ __name(async (chat, link4) => {
30177
29896
  if (link4.trim() === "")
@@ -30250,7 +29969,7 @@ var linkLimits = /* @__PURE__ */ __name(({ approval, expires, maxUses }) => {
30250
29969
  return expires === void 0 ? void 0 : sendTime(expires, Date.now(), "--expire-time");
30251
29970
  }, "linkLimits");
30252
29971
 
30253
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/archive-gaps.js
29972
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/archive-gaps.js
30254
29973
  import { createHash as createHash8, randomUUID as randomUUID4 } from "node:crypto";
30255
29974
  var GAP_BOUNDS = { maxGaps: 5, limit: 500, timeMs: 3e4 };
30256
29975
  var validateRepair = /* @__PURE__ */ __name((messenger, options2) => {
@@ -30387,12 +30106,12 @@ var gapsService = /* @__PURE__ */ __name((deps) => {
30387
30106
  return { plan, repair };
30388
30107
  }, "gapsService");
30389
30108
 
30390
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/attachments.js
30109
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/attachments.js
30391
30110
  import { createHash as createHash11 } from "node:crypto";
30392
30111
  import { constants as constants2, mkdirSync as mkdirSync2 } from "node:fs";
30393
30112
  import { lstat as lstat5, open as open6, readFile as readFile2, stat as stat2 } from "node:fs/promises";
30394
30113
 
30395
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/attachments/directory.js
30114
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/attachments/directory.js
30396
30115
  import { lstat as lstat2, readdir as readdir2, realpath as realpath3 } from "node:fs/promises";
30397
30116
  import { basename as basename5, join as join10, relative as relative2, sep as sep2 } from "node:path";
30398
30117
  var MAX_FILES = 1e4;
@@ -31089,10 +30808,10 @@ var PNMTypes = {
31089
30808
  PF: "pfm"
31090
30809
  };
31091
30810
  var handlers = {
31092
- default: /* @__PURE__ */ __name((lines3) => {
30811
+ default: /* @__PURE__ */ __name((lines) => {
31093
30812
  let dimensions = [];
31094
- while (lines3.length > 0) {
31095
- const line3 = lines3.shift();
30813
+ while (lines.length > 0) {
30814
+ const line3 = lines.shift();
31096
30815
  if (line3[0] === "#") {
31097
30816
  continue;
31098
30817
  }
@@ -31107,10 +30826,10 @@ var handlers = {
31107
30826
  }
31108
30827
  throw new TypeError("Invalid PNM");
31109
30828
  }, "default"),
31110
- pam: /* @__PURE__ */ __name((lines3) => {
30829
+ pam: /* @__PURE__ */ __name((lines) => {
31111
30830
  const size2 = {};
31112
- while (lines3.length > 0) {
31113
- const line3 = lines3.shift();
30831
+ while (lines.length > 0) {
30832
+ const line3 = lines.shift();
31114
30833
  if (line3.length > 16 || line3.charCodeAt(0) > 128) {
31115
30834
  continue;
31116
30835
  }
@@ -31136,9 +30855,9 @@ var PNM = {
31136
30855
  calculate(input) {
31137
30856
  const signature = toUTF8String(input, 0, 2);
31138
30857
  const type = PNMTypes[signature];
31139
- const lines3 = toUTF8String(input, 3).split(/[\r\n]+/);
30858
+ const lines = toUTF8String(input, 3).split(/[\r\n]+/);
31140
30859
  const handler = handlers[type] || handlers.default;
31141
- return handler(lines3);
30860
+ return handler(lines);
31142
30861
  }
31143
30862
  };
31144
30863
 
@@ -31504,7 +31223,7 @@ function imageSize(input) {
31504
31223
  }
31505
31224
  __name(imageSize, "imageSize");
31506
31225
 
31507
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/attachments/ocr.js
31226
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/attachments/ocr.js
31508
31227
  var MAX_PAGES = 20;
31509
31228
  var MAX_PIXELS = 2e7;
31510
31229
  var cancelled2 = /* @__PURE__ */ __name((signal) => {
@@ -31664,7 +31383,7 @@ var ocrPdf = /* @__PURE__ */ __name(async (bytes2, pipeline2, load, signal) => {
31664
31383
  }
31665
31384
  }, "ocrPdf");
31666
31385
 
31667
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/attachments/pdf-preview.js
31386
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/attachments/pdf-preview.js
31668
31387
  var pdfPreview = /* @__PURE__ */ __name(async (bytes2, page, signal, load = importEngine, env = process.env) => {
31669
31388
  const limits = pdfPreviewLimits(env);
31670
31389
  const cancelled3 = /* @__PURE__ */ __name(() => {
@@ -31741,7 +31460,7 @@ var pdfPreview = /* @__PURE__ */ __name(async (bytes2, page, signal, load = impo
31741
31460
  }
31742
31461
  }, "pdfPreview");
31743
31462
 
31744
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/attachments/picture-reading.js
31463
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/attachments/picture-reading.js
31745
31464
  import { spawn } from "node:child_process";
31746
31465
  import { mkdtempSync, readFileSync as readFileSync2, rmSync, writeFileSync as writeFileSync2 } from "node:fs";
31747
31466
  import { tmpdir } from "node:os";
@@ -31904,7 +31623,7 @@ Read the attached picture.`,
31904
31623
  }
31905
31624
  }, "readPictureWithAgent");
31906
31625
 
31907
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/attachments/transfer.js
31626
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/attachments/transfer.js
31908
31627
  import { createHash as createHash9 } from "node:crypto";
31909
31628
  import { constants } from "node:fs";
31910
31629
  import { lstat as lstat3, open as open5 } from "node:fs/promises";
@@ -32012,7 +31731,7 @@ var transferMime = /* @__PURE__ */ __name((head, hint, name = null) => {
32012
31731
  return hint !== null && /^[a-z0-9.+-]+\/[a-z0-9.+-]+$/i.test(hint) ? hint : "application/octet-stream";
32013
31732
  }, "transferMime");
32014
31733
 
32015
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/file-download.js
31734
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/file-download.js
32016
31735
  import { createWriteStream, mkdirSync } from "node:fs";
32017
31736
  import { link as link3, rm } from "node:fs/promises";
32018
31737
  import { join as join12, resolve as resolve6 } from "node:path";
@@ -32126,7 +31845,7 @@ var save = /* @__PURE__ */ __name(async (file, directory2, fallbackName, { uniqu
32126
31845
  }
32127
31846
  }, "save");
32128
31847
 
32129
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/pictures.js
31848
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/pictures.js
32130
31849
  import { createHash as createHash10 } from "node:crypto";
32131
31850
  import { lstat as lstat4, readFile } from "node:fs/promises";
32132
31851
  import { setTimeout as sleep4 } from "node:timers/promises";
@@ -32170,7 +31889,7 @@ var picturesService = /* @__PURE__ */ __name((deps) => {
32170
31889
  const directory2 = imageModelsDirectory(deps.env);
32171
31890
  if (!isImageModelInstalled(model2, directory2))
32172
31891
  throw new CliError("not_found", missingModel(model2.id), { reason: "model.not-downloaded", model: model2.id });
32173
- const { openPictureEmbedder } = await import("./embedder-BCUT7KKV.js");
31892
+ const { openPictureEmbedder } = await import("./embedder-GRZXZUXR.js");
32174
31893
  return openPictureEmbedder(model2, directory2);
32175
31894
  }, "open");
32176
31895
  const embedder = /* @__PURE__ */ __name(() => {
@@ -32344,7 +32063,7 @@ var withPictures = /* @__PURE__ */ __name((messages, pictures) => ({
32344
32063
  }, "search")
32345
32064
  }), "withPictures");
32346
32065
 
32347
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/attachments.js
32066
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/attachments.js
32348
32067
  var ATTACHMENT_QUERY = {
32349
32068
  entity: "attachment",
32350
32069
  backend: "sql",
@@ -32433,7 +32152,7 @@ var keep = /* @__PURE__ */ __name(async (store, file, extraction, bytes2, sha) =
32433
32152
  });
32434
32153
  }
32435
32154
  }, "keep");
32436
- var itemOf2 = /* @__PURE__ */ __name((account, view) => ({
32155
+ var itemOf = /* @__PURE__ */ __name((account, view) => ({
32437
32156
  message: formatLocator({ ...account, chat: view.chatId, message: view.messageId }),
32438
32157
  kind: view.kind,
32439
32158
  position: view.position + 1,
@@ -32655,13 +32374,13 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
32655
32374
  }
32656
32375
  const where = query ? queryFilter(query, attachmentColumns(chats), { command: "attachments list", zone: timezoneOf() }) : void 0;
32657
32376
  const views = await store.attachments.attachments({ ...where ? { where } : {}, offset, limit: limit + 1 });
32658
- return { items: views.slice(0, limit).map((view) => itemOf2(account, view)), hasMore: views.length > limit };
32377
+ return { items: views.slice(0, limit).map((view) => itemOf(account, view)), hasMore: views.length > limit };
32659
32378
  }, "list"),
32660
- show: /* @__PURE__ */ __name(async ({ chat, message, attachment: attachment2, page, load, ...window3 }) => {
32661
- validateWindow(window3);
32379
+ show: /* @__PURE__ */ __name(async ({ chat, message, attachment: attachment2, page, load, ...window2 }) => {
32380
+ validateWindow(window2);
32662
32381
  if (page !== void 0 && (!Number.isSafeInteger(page) || page < 1))
32663
32382
  throw new CliError("validation_error", "PDF page must be a position from 1");
32664
- if (page !== void 0 && (window3.offsetBytes !== void 0 || window3.chunkBytes !== void 0))
32383
+ if (page !== void 0 && (window2.offsetBytes !== void 0 || window2.chunkBytes !== void 0))
32665
32384
  throw new CliError("validation_error", "PDF page cannot be combined with byte offset or chunk size");
32666
32385
  if (attachment2 !== void 0 && (!Number.isSafeInteger(attachment2) || attachment2 < 1))
32667
32386
  throw new CliError("validation_error", "attachment must be a position from 1");
@@ -32676,13 +32395,13 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
32676
32395
  throw new CliError("not_found", "download this attachment before transferring it");
32677
32396
  if (refusedPlace(chosen.localPath, deps.messenger.app, deps.env ?? process.env))
32678
32397
  throw new CliError("validation_error", "cannot transfer known credential files, the WireCat apps' own files or the message store");
32679
- const { head, capturedFile, ...bytes2 } = await retainedBytes(chosen.localPath, window3, page !== void 0, deps.env);
32398
+ const { head, capturedFile, ...bytes2 } = await retainedBytes(chosen.localPath, window2, page !== void 0, deps.env);
32680
32399
  const mimeType = transferMime(head, null, chosen.name);
32681
32400
  let preview = {};
32682
32401
  if (page !== void 0) {
32683
32402
  if (mimeType !== "application/pdf" || !capturedFile)
32684
32403
  throw new CliError("validation_error", "page preview requires a retained PDF");
32685
- const rendered = await pdfPreview(capturedFile, page, window3.signal, load, deps.env);
32404
+ const rendered = await pdfPreview(capturedFile, page, window2.signal, load, deps.env);
32686
32405
  preview = {
32687
32406
  mimeType: "image/png",
32688
32407
  totalBytes: rendered.bytes.length,
@@ -32815,7 +32534,7 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
32815
32534
  }, "readPicture")
32816
32535
  }), "attachmentsService");
32817
32536
 
32818
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/chat-documents.js
32537
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/chat-documents.js
32819
32538
  var chatDocumentsService = /* @__PURE__ */ __name((deps) => ({
32820
32539
  list: /* @__PURE__ */ __name(async (chat, { limit, offset, ref }) => {
32821
32540
  const store = await accountStore(deps);
@@ -32845,7 +32564,7 @@ var chatDocumentsService = /* @__PURE__ */ __name((deps) => ({
32845
32564
  }, "list")
32846
32565
  }), "chatDocumentsService");
32847
32566
 
32848
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/retention.js
32567
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/retention.js
32849
32568
  var observationDuration = /* @__PURE__ */ __name((text2, flag) => {
32850
32569
  const match = /^(\d+(?:\.\d+)?)([smhdw])$/.exec(text2);
32851
32570
  const units2 = { s: 1e3, m: 6e4, h: 36e5, d: 864e5, w: 6048e5 };
@@ -32858,15 +32577,15 @@ var retentionService = /* @__PURE__ */ __name((deps) => ({
32858
32577
  report: /* @__PURE__ */ __name(async (chat, query = {}) => {
32859
32578
  const cutoff = Date.now();
32860
32579
  const zone = timezoneOf(query.timezone);
32861
- const window3 = dateWindow({
32580
+ const window2 = dateWindow({
32862
32581
  ...query.sinceTime === void 0 ? {} : { sinceTime: query.sinceTime },
32863
32582
  ...query.untilTime === void 0 ? {} : { untilTime: query.untilTime },
32864
32583
  zone,
32865
32584
  now: cutoff
32866
32585
  });
32867
32586
  const options2 = {
32868
- since: window3.since ?? cutoff - 90 * 864e5,
32869
- until: window3.until ?? cutoff,
32587
+ since: window2.since ?? cutoff - 90 * 864e5,
32588
+ until: window2.until ?? cutoff,
32870
32589
  cutoff,
32871
32590
  checkpoints: (query.checkpoints ?? "1d,7d,30d").split(",").map((one) => observationDuration(one.trim(), "--checkpoints")),
32872
32591
  within: observationDuration(query.within ?? "7d", "--within"),
@@ -32892,7 +32611,7 @@ var retentionService = /* @__PURE__ */ __name((deps) => ({
32892
32611
  })),
32893
32612
  account,
32894
32613
  report: "retention",
32895
- timeMeta: window3.meta
32614
+ timeMeta: window2.meta
32896
32615
  };
32897
32616
  }, "report"),
32898
32617
  evidence: /* @__PURE__ */ __name(async (target2, reference, selection, query) => {
@@ -32932,7 +32651,7 @@ var isRetentionSelection = /* @__PURE__ */ __name((selection) => {
32932
32651
  }
32933
32652
  }, "isRetentionSelection");
32934
32653
 
32935
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/counters.js
32654
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/counters.js
32936
32655
  var counterFields = /* @__PURE__ */ __name((text2 = "views,reactions,comments") => {
32937
32656
  const fields = text2.split(",").map((one) => one.trim());
32938
32657
  if (!fields.length || fields.some((one) => !COUNTER_FIELDS.includes(one)) || new Set(fields).size !== fields.length)
@@ -33139,7 +32858,7 @@ var countersService = /* @__PURE__ */ __name((deps) => {
33139
32858
  };
33140
32859
  }, "countersService");
33141
32860
 
33142
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/search-refresh.js
32861
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/search-refresh.js
33143
32862
  var SYNC_KEY = "messages.sync-first";
33144
32863
  var SYNC_BOUNDS = { maxChats: 5, timeMs: 3e4, maxMessages: 500 };
33145
32864
  var keyOf3 = /* @__PURE__ */ __name((chat) => JSON.stringify([chat.account.provider, chat.account.account, chat.chatId]), "keyOf");
@@ -33271,11 +32990,18 @@ var withRefresh = /* @__PURE__ */ __name((found, refreshed) => ({
33271
32990
  ...!refreshed || refreshed.complete ? {} : { coverage: { ...found.coverage, state: "stale" } }
33272
32991
  }), "withRefresh");
33273
32992
 
33274
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/embeddings-search.js
32993
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/embeddings-search.js
33275
32994
  var CANDIDATES = 50;
33276
32995
  var ACROSS_CHATS = 500;
32996
+ var OWN_BLOCK = 5;
33277
32997
  var PER_CHAT = 20;
32998
+ var BIG_CHAT = 100;
33278
32999
  var WORD_HITS = 200;
33000
+ var SHOWN_LINES = 3;
33001
+ var SHOWN_CHARS = 200;
33002
+ var SHOWN_HEAD = 80;
33003
+ var CHUNK_READ = 60;
33004
+ var REPLIES_READ = 60;
33279
33005
  var RRF_K3 = 60;
33280
33006
  var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
33281
33007
  const command = deps.messenger.app.command;
@@ -33294,6 +33020,7 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
33294
33020
  }, deps.messenger);
33295
33021
  const { items } = await store.queries.matchQuery({
33296
33022
  ...lexical.execution,
33023
+ rareWordsFirst: true,
33297
33024
  ...prepared.selectedChat ? {} : { perChat: PER_CHAT },
33298
33025
  ...prepared.selectedChat ? { chat: prepared.selectedChat } : {},
33299
33026
  ...conversations === void 0 ? {} : { conversationIds: conversations },
@@ -33376,11 +33103,13 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
33376
33103
  });
33377
33104
  return { hits, outside, sources, respellings };
33378
33105
  }, "byWords");
33379
- const search = /* @__PURE__ */ __name(async (query, { chat, model: choice, since, limit, filter, source, timezone, syncFirst, signal, refresh, timeLimitMs }) => {
33106
+ const search = /* @__PURE__ */ __name(async (query, { chat, model: choice, since, limit, filter, source, timezone, syncFirst, signal, refresh, timeLimitMs, like }) => {
33380
33107
  if (!query.trim())
33381
33108
  searchError("query.invalid-syntax", { start: 0, end: query.length }, "give words to search for");
33382
33109
  if (new TextEncoder().encode(query).length > QUERY_LIMITS.bytes)
33383
33110
  searchError("query.too-large", { start: 0, end: query.length }, "query is longer than 8 KiB");
33111
+ if (like !== void 0 && new TextEncoder().encode(like).length > QUERY_LIMITS.bytes)
33112
+ throw new CliError("validation_error", "--like is longer than 8 KiB: one sentence is enough");
33384
33113
  const refreshed = await refreshSearch(deps, {
33385
33114
  chat,
33386
33115
  limit,
@@ -33419,42 +33148,59 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
33419
33148
  respellings: /* @__PURE__ */ new Map()
33420
33149
  };
33421
33150
  });
33422
- const meaning = [];
33151
+ const texts = like?.trim() ? [query, like] : [query];
33152
+ const meaning = texts.map(() => []);
33153
+ const own = [];
33423
33154
  const sources = words3.sources;
33424
33155
  if (target2.installed && prepared.scopeAccounts.length && eligibility?.conversations.length !== 0) {
33425
33156
  await withEmbedder(deps, target2, choice, {}, async (embedder) => {
33426
- const [vector] = await embedder.embed([query], "query");
33427
- for (const one of prepared.scopeAccounts) {
33428
- const scope = scopeOf5(one);
33429
- if (scope === null)
33430
- continue;
33431
- const whole2 = "chatId" in scope || one.provider === MAIL;
33432
- const hits = await store.vectors.nearestConversations(one, {
33433
- ...scope,
33434
- ...since === void 0 ? {} : { since },
33435
- model: target2.key,
33436
- limit: whole2 ? Math.max(limit, CANDIDATES) : Math.max(limit, ACROSS_CHATS),
33437
- query: vector,
33438
- ...eligibility ? { conversations: eligibility.conversations } : {}
33439
- });
33440
- const images = await store.vectors.nearestImages(one, {
33441
- ...scope,
33442
- ...since === void 0 ? {} : { since },
33443
- model: target2.key,
33444
- limit: Math.max(limit, CANDIDATES),
33445
- query: vector
33446
- });
33447
- const found = [
33448
- ...hits,
33449
- ...images.filter((hit) => !eligibility || eligibility.conversations.includes(hit.summary.id))
33450
- ].sort((a, b) => b.score - a.score);
33451
- for (const hit of found)
33452
- sources.set(hit.summary.id, one);
33453
- meaning.push(...whole2 ? found.map((hit) => ({ hit, lead: hit.score })) : shared(found, limit));
33454
- }
33157
+ const vectors = await embedder.embed(texts, "query");
33158
+ for (const [at, vector] of vectors.entries())
33159
+ for (const one of prepared.scopeAccounts) {
33160
+ const scope = scopeOf5(one);
33161
+ if (scope === null)
33162
+ continue;
33163
+ const whole2 = "chatId" in scope || one.provider === MAIL;
33164
+ const hits2 = await store.vectors.nearestConversations(one, {
33165
+ ...scope,
33166
+ ...since === void 0 ? {} : { since },
33167
+ model: target2.key,
33168
+ limit: whole2 ? Math.max(limit, CANDIDATES) : Math.max(limit, ACROSS_CHATS),
33169
+ query: vector,
33170
+ ...eligibility ? { conversations: eligibility.conversations } : {}
33171
+ });
33172
+ const images = at > 0 ? [] : await store.vectors.nearestImages(one, {
33173
+ ...scope,
33174
+ ...since === void 0 ? {} : { since },
33175
+ model: target2.key,
33176
+ limit: Math.max(limit, CANDIDATES),
33177
+ query: vector
33178
+ });
33179
+ const found = [
33180
+ ...hits2,
33181
+ ...images.filter((hit) => !eligibility || eligibility.conversations.includes(hit.summary.id))
33182
+ ].sort((a, b) => b.score - a.score);
33183
+ const mine = at > 0 ? [] : await store.vectors.nearestConversations(one, {
33184
+ ...scope,
33185
+ ...since === void 0 ? {} : { since },
33186
+ model: target2.key,
33187
+ limit: OWN_BLOCK,
33188
+ query: vector,
33189
+ fromOwner: true,
33190
+ ...eligibility ? { conversations: eligibility.conversations } : {}
33191
+ });
33192
+ for (const hit of found)
33193
+ sources.set(hit.summary.id, one);
33194
+ for (const hit of mine) {
33195
+ sources.set(hit.summary.id, one);
33196
+ own.push(hit);
33197
+ }
33198
+ meaning[at]?.push(...whole2 ? found.map((hit) => ({ hit, lead: hit.score })) : shared(found, limit));
33199
+ }
33455
33200
  });
33456
33201
  }
33457
- meaning.sort((a, b) => b.lead - a.lead);
33202
+ for (const list2 of meaning)
33203
+ list2.sort((a, b) => b.lead - a.lead);
33458
33204
  const scoped = [];
33459
33205
  const elsewhere = [];
33460
33206
  for (const one of prepared.scopeAccounts) {
@@ -33475,20 +33221,54 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
33475
33221
  ].sort();
33476
33222
  if (scoped.length > 1)
33477
33223
  readiness.scopes = scoped;
33224
+ const located = /* @__PURE__ */ __name((hit) => {
33225
+ const source2 = sources.get(hit.summary.id);
33226
+ return {
33227
+ ...hit,
33228
+ source: source2,
33229
+ locator: formatLocator({ ...source2, chat: hit.summary.chatId, message: hit.chunk.firstMessageId })
33230
+ };
33231
+ }, "located");
33232
+ const hits = fused(meaning.map((list2) => list2.map(({ hit }) => hit)), words3.hits, meaningFloor(target2.key)).slice(0, limit).map(located);
33233
+ const shown = new Set(hits.map((hit) => hit.summary.id));
33234
+ const ownOf = /* @__PURE__ */ __name((keep2) => own.filter(keep2).sort((a, b) => b.score - a.score).slice(0, OWN_BLOCK).map((hit) => located({ ...hit, by: ["meaning"] })), "ownOf");
33235
+ const ownHits = ownOf((hit) => !shown.has(hit.summary.id));
33236
+ const ownSpare = ownOf((hit) => shown.has(hit.summary.id));
33237
+ const asked = wordStems(query);
33238
+ const stems = [...asked, ...wordStems(texts.join(" "))];
33239
+ const replies = (async () => {
33240
+ const found = /* @__PURE__ */ new Map();
33241
+ const bySource = /* @__PURE__ */ new Map();
33242
+ for (const hit of [...hits, ...ownHits, ...ownSpare]) {
33243
+ const source2 = hit.source ?? account;
33244
+ const group = bySource.get(JSON.stringify(source2)) ?? { source: source2, hits: [] };
33245
+ group.hits.push(hit);
33246
+ bySource.set(JSON.stringify(source2), group);
33247
+ }
33248
+ for (const { source: source2, hits: group } of bySource.values()) {
33249
+ const read = await store.conversations.chunkReplies(source2, group.map(({ summary, chunk }) => ({ conversationId: summary.id, ...chunk })), REPLIES_READ);
33250
+ for (const [index, hit] of group.entries())
33251
+ found.set(hit, read[index] ?? []);
33252
+ }
33253
+ return found;
33254
+ })();
33255
+ const withLines = /* @__PURE__ */ __name(async (hit, ownFirst) => {
33256
+ const read = await store.conversations.chunkMessages(hit.source ?? account, hit.summary.id, hit.chunk, CHUNK_READ);
33257
+ const lines = [
33258
+ ...shownLines(read, stems, ownFirst, asked),
33259
+ ...shownLines((await replies).get(hit) ?? [], stems, false, [], 1)
33260
+ ];
33261
+ return lines.length ? { ...hit, lines } : hit;
33262
+ }, "withLines");
33478
33263
  return {
33479
33264
  accounts: prepared.scopeAccounts,
33480
33265
  model: target2.id,
33481
33266
  meaning: target2.installed ? "searched" : "unavailable",
33482
33267
  ...wordsOutOfTime ? { words: "out-of-time" } : {},
33483
33268
  ...words3.respellings.size ? { respelled: Object.fromEntries(words3.respellings) } : {},
33484
- hits: fused(meaning.map(({ hit }) => hit), words3.hits, meaningFloor(target2.key)).slice(0, limit).map((hit) => {
33485
- const source2 = sources.get(hit.summary.id);
33486
- return {
33487
- ...hit,
33488
- source: source2,
33489
- locator: formatLocator({ ...source2, chat: hit.summary.chatId, message: hit.chunk.firstMessageId })
33490
- };
33491
- }),
33269
+ hits: await Promise.all(hits.map((hit) => withLines(hit, false))),
33270
+ ...ownHits.length ? { own: await Promise.all(ownHits.map((hit) => withLines(hit, true))) } : {},
33271
+ ...ownSpare.length ? { ownSpare: await Promise.all(ownSpare.map((hit) => withLines(hit, true))) } : {},
33492
33272
  readiness,
33493
33273
  ...locallyRefreshed ? { prepared: locallyRefreshed } : {},
33494
33274
  ...refreshed ? { refreshed, coverage: { state: refreshed.complete ? "partial" : "stale" } } : {},
@@ -33498,7 +33278,7 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
33498
33278
  return {
33499
33279
  /** Over every chat, a query that names someone by a name their private chat uses has that chat's hits first. */
33500
33280
  search: /* @__PURE__ */ __name(async (query, options2) => {
33501
- const found = await search(query, options2);
33281
+ const { ownSpare, ...found } = await search(query, options2);
33502
33282
  if (options2.chat !== void 0 || options2.filter !== void 0 || found.accounts?.length !== 1)
33503
33283
  return found;
33504
33284
  const named2 = await namedChat(await deps.store(), await deps.account(), deps.messenger, found.accounts, queryWords2(query)).catch((error) => {
@@ -33512,10 +33292,15 @@ var embeddingsSearch = /* @__PURE__ */ __name((deps) => {
33512
33292
  const { syncFirst: _, refresh: __, ...plain2 } = options2;
33513
33293
  const inside2 = await search(rest || query, { ...plain2, chat: named2.chatId });
33514
33294
  const shown = new Set(inside2.hits.map(({ summary }) => summary.id));
33295
+ const hits = [...inside2.hits, ...found.hits.filter(({ summary }) => !shown.has(summary.id))].slice(0, options2.limit);
33296
+ const kept2 = new Set(hits.map(({ summary }) => summary.id));
33297
+ const own = [...found.own ?? [], ...(ownSpare ?? []).filter(({ summary }) => !kept2.has(summary.id))].sort((a, b) => (b.score ?? 0) - (a.score ?? 0)).slice(0, OWN_BLOCK);
33298
+ const { own: _shown, ...plainFound } = found;
33515
33299
  return {
33516
- ...found,
33300
+ ...plainFound,
33301
+ ...own.length ? { own } : {},
33517
33302
  named: { word: named2.word, chatId: named2.chatId, title: named2.title },
33518
- hits: [...inside2.hits, ...found.hits.filter(({ summary }) => !shown.has(summary.id))].slice(0, options2.limit)
33303
+ hits
33519
33304
  };
33520
33305
  }, "search"),
33521
33306
  related: /* @__PURE__ */ __name(async (chat, message, { model: choice, limit }) => {
@@ -33555,23 +33340,32 @@ var shared = /* @__PURE__ */ __name((hits, limit) => {
33555
33340
  for (const hit of hits)
33556
33341
  chats.set(hit.summary.chatId, [...chats.get(hit.summary.chatId) ?? [], hit]);
33557
33342
  return [...chats.values()].flatMap((own) => {
33558
- const level = own[Math.min(PER_CHAT, own.length) - 1]?.score ?? 0;
33559
- return own.slice(0, Math.max(limit, PER_CHAT)).map((hit) => ({ hit, lead: hit.score - level }));
33343
+ const share = own.length >= BIG_CHAT ? BIG_CHAT : PER_CHAT;
33344
+ const level = own[Math.min(share, own.length) - 1]?.score ?? 0;
33345
+ return own.slice(0, Math.max(limit, share)).map((hit, at) => ({ hit, lead: share > PER_CHAT && at >= PER_CHAT ? hit.score - 10 : hit.score - level }));
33560
33346
  });
33561
33347
  }, "shared");
33562
33348
  var fused = /* @__PURE__ */ __name((meaning, words3, minimumCosine) => {
33563
33349
  const merged2 = /* @__PURE__ */ new Map();
33564
- meaning.filter(({ score }) => score > minimumCosine).forEach(({ summary, chunk, score, stale, matchedIn }, index) => {
33565
- merged2.set(matchedIn ? `${summary.id}#${chunk.firstMessageId}` : summary.id, {
33566
- summary,
33567
- chunk,
33568
- score,
33569
- by: ["meaning"],
33570
- stale,
33571
- ...matchedIn ? { matchedIn } : {},
33572
- fused: 1 / (RRF_K3 + index + 1)
33350
+ for (const list2 of meaning)
33351
+ list2.filter(({ score }) => score > minimumCosine).forEach(({ summary, chunk, score, stale, matchedIn }, index) => {
33352
+ const key = matchedIn ? `${summary.id}#${chunk.firstMessageId}` : summary.id;
33353
+ const share = 1 / (RRF_K3 + index + 1);
33354
+ const held = merged2.get(key);
33355
+ if (!held) {
33356
+ merged2.set(key, {
33357
+ summary,
33358
+ chunk,
33359
+ score,
33360
+ by: ["meaning"],
33361
+ stale,
33362
+ ...matchedIn ? { matchedIn } : {},
33363
+ fused: share
33364
+ });
33365
+ return;
33366
+ }
33367
+ held.fused += share;
33573
33368
  });
33574
- });
33575
33369
  words3.forEach(({ summary, chunk }, index) => {
33576
33370
  const share = 1 / (RRF_K3 + index + 1);
33577
33371
  const held = merged2.get(summary.id);
@@ -33583,6 +33377,35 @@ var fused = /* @__PURE__ */ __name((meaning, words3, minimumCosine) => {
33583
33377
  });
33584
33378
  return [...merged2.values()].sort((a, b) => b.fused - a.fused || (b.score ?? -2) - (a.score ?? -2)).map(({ fused: _, ...hit }) => hit);
33585
33379
  }, "fused");
33380
+ var wordStems = /* @__PURE__ */ __name((text2) => [...new Set(queryWords2(text2).map((word) => word.slice(0, 5)))], "wordStems");
33381
+ var shownLines = /* @__PURE__ */ __name((read, stems, ownFirst, asked, count3 = SHOWN_LINES) => {
33382
+ const scored = read.map(({ text: text2, ...line3 }, at) => {
33383
+ const flat = text2.replace(/\s+/g, " ").trim();
33384
+ const lower = flat.toLowerCase();
33385
+ const found = stems.filter((stem) => lower.includes(stem));
33386
+ const first2 = found.reduce((least, stem) => Math.min(least, lower.indexOf(stem)), Number.POSITIVE_INFINITY);
33387
+ return { ...line3, flat, at, score: found.length + (ownFirst && line3.outgoing ? 100 : 0), first: first2 };
33388
+ });
33389
+ const picked = [...scored].sort((a, b) => b.score - a.score || a.at - b.at).slice(0, count3);
33390
+ const matches = /* @__PURE__ */ __name((flat) => asked.filter((stem) => flat.toLowerCase().includes(stem)).length, "matches");
33391
+ const asking = scored.reduce((best, line3) => matches(line3.flat) > (best ? matches(best.flat) : 0) ? line3 : best, void 0);
33392
+ const reply = asking && scored[asking.at + 1];
33393
+ if (reply && !picked.includes(reply))
33394
+ picked.push(reply);
33395
+ return picked.sort((a, b) => a.at - b.at).map(({ sender, flat, outgoing, first: first2 }) => {
33396
+ const who = outgoing ? `${sender ?? "you"}${sender ? " (you)" : ""}: ` : sender ? `${sender}: ` : "";
33397
+ return `${who}${cutAround(flat, first2)}`;
33398
+ });
33399
+ }, "shownLines");
33400
+ var cutAround = /* @__PURE__ */ __name((flat, first2) => {
33401
+ if (flat.length <= SHOWN_CHARS)
33402
+ return flat;
33403
+ if (!Number.isFinite(first2) || first2 < SHOWN_CHARS - 25)
33404
+ return `${flat.slice(0, SHOWN_CHARS)}\u2026`;
33405
+ const tail = SHOWN_CHARS - SHOWN_HEAD;
33406
+ const from = Math.min(first2 - 30, flat.length - tail);
33407
+ return `${flat.slice(0, SHOWN_HEAD)}\u2026${flat.slice(from, from + tail)}${from + tail < flat.length ? "\u2026" : ""}`;
33408
+ }, "cutAround");
33586
33409
  var searchReadiness = /* @__PURE__ */ __name((chats, meaning, outside) => {
33587
33410
  const built = new Set(chats.filter(({ state }) => state !== "not-built").map(({ chat }) => chat));
33588
33411
  const ids = /* @__PURE__ */ __name((keep2) => chats.filter(keep2).map(({ chat }) => chat), "ids");
@@ -33607,13 +33430,13 @@ var meanOf = /* @__PURE__ */ __name((vectors) => {
33607
33430
  return mean2.map((value) => value / length);
33608
33431
  }, "meanOf");
33609
33432
 
33610
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/embeddings.js
33433
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/embeddings.js
33611
33434
  var embeddingsService = /* @__PURE__ */ __name((deps) => ({
33612
33435
  ...embeddingsMaintenance(deps),
33613
33436
  ...embeddingsSearch(deps)
33614
33437
  }), "embeddingsService");
33615
33438
 
33616
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/folders.js
33439
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/folders.js
33617
33440
  var foldersService = /* @__PURE__ */ __name((deps) => {
33618
33441
  const online = /* @__PURE__ */ __name(async (command) => {
33619
33442
  if (deps.offline)
@@ -33746,15 +33569,15 @@ var foldersService = /* @__PURE__ */ __name((deps) => {
33746
33569
  if (link4.trim() === "")
33747
33570
  throw new CliError("validation_error", "give the folder's link");
33748
33571
  const connection = await online("chats folders join");
33749
- const join14 = capability(connection, "joinFolder", "join a shared folder");
33572
+ const join13 = capability(connection, "joinFolder", "join a shared folder");
33750
33573
  const operationId = newOperationId();
33751
- const folder = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "account", action: "folder-join" }, () => join14(link4.trim()));
33574
+ const folder = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "account", action: "folder-join" }, () => join13(link4.trim()));
33752
33575
  return { operationId, folder };
33753
33576
  }, "join")
33754
33577
  };
33755
33578
  }, "foldersService");
33756
33579
 
33757
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/mentions.js
33580
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/mentions.js
33758
33581
  var REVIEW_COUNT = 500;
33759
33582
  var mentionsService = /* @__PURE__ */ __name((deps) => {
33760
33583
  const located = /* @__PURE__ */ __name(async () => {
@@ -33768,7 +33591,7 @@ var mentionsService = /* @__PURE__ */ __name((deps) => {
33768
33591
  };
33769
33592
  }, "located");
33770
33593
  return {
33771
- domains: /* @__PURE__ */ __name(async (query, window3) => {
33594
+ domains: /* @__PURE__ */ __name(async (query, window2) => {
33772
33595
  const asked = `kind:url NOT status:dismissed${query.trim() ? ` AND (${query})` : ""}`;
33773
33596
  const ast = validateQuery(parseLucene(asked, { ...MENTION_QUERY, defaultField: "value" }), MENTION_QUERY);
33774
33597
  const links = (await (await accountStore(deps)).mentions.mentions(ast, { offset: 0 })).items;
@@ -33793,23 +33616,23 @@ var mentionsService = /* @__PURE__ */ __name((deps) => {
33793
33616
  sites.set(domain, site);
33794
33617
  }
33795
33618
  const ranked = [...sites.values()].map(({ chatIds, ...site }) => ({ ...site, chats: chatIds.size })).sort((a, b) => b.links - a.links || a.domain.localeCompare(b.domain));
33796
- const end = window3.limit === void 0 ? void 0 : window3.offset + window3.limit;
33797
- return { items: ranked.slice(window3.offset, end), hasMore: end !== void 0 && ranked.length > end };
33619
+ const end = window2.limit === void 0 ? void 0 : window2.offset + window2.limit;
33620
+ return { items: ranked.slice(window2.offset, end), hasMore: end !== void 0 && ranked.length > end };
33798
33621
  }, "domains"),
33799
- list: /* @__PURE__ */ __name(async (query, window3) => {
33622
+ list: /* @__PURE__ */ __name(async (query, window2) => {
33800
33623
  const ast = query.trim() ? validateQuery(parseLucene(query, { ...MENTION_QUERY, defaultField: "value" }), MENTION_QUERY) : void 0;
33801
33624
  const { store, mention } = await located();
33802
- const page = await store.mentions.mentions(ast, window3);
33625
+ const page = await store.mentions.mentions(ast, window2);
33803
33626
  const state = await (await deps.store()).mentions.mentionsState();
33804
33627
  return { items: page.items.map(mention), hasMore: page.hasMore, state };
33805
33628
  }, "list"),
33806
33629
  newCount: /* @__PURE__ */ __name(async (foundAfter) => {
33807
33630
  const found = parseLucene("status:found", { ...MENTION_QUERY, defaultField: "value" });
33808
- const window3 = { offset: 0, limit: REVIEW_COUNT, ...foundAfter === void 0 ? {} : { foundAfter } };
33809
- const page = await (await accountStore(deps)).mentions.mentions(found, window3);
33631
+ const window2 = { offset: 0, limit: REVIEW_COUNT, ...foundAfter === void 0 ? {} : { foundAfter } };
33632
+ const page = await (await accountStore(deps)).mentions.mentions(found, window2);
33810
33633
  return { count: page.items.length, more: page.hasMore };
33811
33634
  }, "newCount"),
33812
- places: /* @__PURE__ */ __name(async (window3) => (await deps.store()).mentions.places(window3), "places"),
33635
+ places: /* @__PURE__ */ __name(async (window2) => (await deps.store()).mentions.places(window2), "places"),
33813
33636
  show: /* @__PURE__ */ __name(async (id2) => {
33814
33637
  const { store, mention } = await located();
33815
33638
  const found = await store.mentions.mention(id2);
@@ -33833,7 +33656,7 @@ var mentionsService = /* @__PURE__ */ __name((deps) => {
33833
33656
  };
33834
33657
  }, "mentionsService");
33835
33658
 
33836
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/domain/message-link.js
33659
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/domain/message-link.js
33837
33660
  var fileLinks = /* @__PURE__ */ __name((attachments) => hitFiles(attachments).map(({ position, kind, name }) => ({
33838
33661
  position,
33839
33662
  kind,
@@ -33882,7 +33705,7 @@ var validatePermalink = /* @__PURE__ */ __name((link4) => {
33882
33705
  return { url: link4.url, access: link4.access, reason: link4.reason };
33883
33706
  }, "validatePermalink");
33884
33707
 
33885
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/domain/pin-duration.js
33708
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/domain/pin-duration.js
33886
33709
  var spokenSeconds = /* @__PURE__ */ __name((seconds) => {
33887
33710
  if (seconds % 86400 === 0 && seconds > 86400)
33888
33711
  return `${seconds / 86400}d`;
@@ -33914,7 +33737,7 @@ var pinDurationOf = /* @__PURE__ */ __name((value, allowed, flag = "--expire-tim
33914
33737
  return seconds;
33915
33738
  }, "pinDurationOf");
33916
33739
 
33917
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/meaning-model.js
33740
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/meaning-model.js
33918
33741
  var meaningModel = /* @__PURE__ */ __name(async (store, env = process.env) => {
33919
33742
  const chosen = chosenTextModel(env);
33920
33743
  if (chosen.from === "chosen" || chosen.id !== DEFAULT_TEXT_MODEL)
@@ -33929,7 +33752,7 @@ var meaningModel = /* @__PURE__ */ __name(async (store, env = process.env) => {
33929
33752
  return (counts.get(before) ?? 0) > (counts.get(now) ?? 0) ? previous.id : current.id;
33930
33753
  }, "meaningModel");
33931
33754
 
33932
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/messages-meaning.js
33755
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/messages-meaning.js
33933
33756
  var meaningText = /* @__PURE__ */ __name((question) => {
33934
33757
  try {
33935
33758
  const text2 = questionLookup(question) === void 0 ? question : questionText(question);
@@ -34008,7 +33831,7 @@ var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, sh
34008
33831
  }
34009
33832
  }, "meaningLane");
34010
33833
 
34011
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/messages-rerank.js
33834
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/messages-rerank.js
34012
33835
  var rerankLane = /* @__PURE__ */ __name((deps) => {
34013
33836
  const choice = deps.reranker ?? DEFAULT_RERANK_MODEL;
34014
33837
  if (choice === "off")
@@ -34020,9 +33843,9 @@ var rerankLane = /* @__PURE__ */ __name((deps) => {
34020
33843
  return { skipped: { reason: `${model.id} is not downloaded`, step: "models.download", model: model.id } };
34021
33844
  try {
34022
33845
  const warm = deps.embedders;
34023
- const reranker = warm ? await warm.reranker(`rerank:${model.id}`, async () => (await import("./process-I2QKOMM7.js")).openRerankerProcess(model, directory2, {
33846
+ const reranker = warm ? await warm.reranker(`rerank:${model.id}`, async () => (await import("./process-PTUCNLZ7.js")).openRerankerProcess(model, directory2, {
34024
33847
  threads: defaultThreads()
34025
- })) : await (await import("./rerank-LJ3TWRNV.js")).openReranker(model, directory2);
33848
+ })) : await (await import("./rerank-QWM3DQMU.js")).openReranker(model, directory2);
34026
33849
  return {
34027
33850
  model: model.id,
34028
33851
  score: /* @__PURE__ */ __name((question, passages) => reranker.score(plainWords(question), passages), "score"),
@@ -34042,7 +33865,7 @@ var rerankLane = /* @__PURE__ */ __name((deps) => {
34042
33865
  };
34043
33866
  }, "rerankLane");
34044
33867
 
34045
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/search/question-period.js
33868
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/search/question-period.js
34046
33869
  var DAY6 = 864e5;
34047
33870
  var SPAN = { start: 0, end: 0 };
34048
33871
  var phrase = /* @__PURE__ */ __name((source) => new RegExp(`(?<![\\p{L}\\p{N}])(?:${source})(?![\\p{L}\\p{N}])`, "giu"), "phrase");
@@ -34167,17 +33990,17 @@ var questionPeriod = /* @__PURE__ */ __name((text2, now, zone) => {
34167
33990
  };
34168
33991
  }, "questionPeriod");
34169
33992
 
34170
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/document-pictures.js
33993
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/document-pictures.js
34171
33994
  var openPictureEmbedderFor = /* @__PURE__ */ __name(async ({ env, command } = {}) => {
34172
33995
  const model = imageModel(DEFAULT_IMAGE_MODEL);
34173
33996
  const directory2 = imageModelsDirectory(env);
34174
33997
  if (!isImageModelInstalled(model, directory2))
34175
33998
  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 });
34176
- const { openPictureEmbedder } = await import("./embedder-BCUT7KKV.js");
33999
+ const { openPictureEmbedder } = await import("./embedder-GRZXZUXR.js");
34177
34000
  return openPictureEmbedder(model, directory2);
34178
34001
  }, "openPictureEmbedderFor");
34179
34002
 
34180
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/document-source.js
34003
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/document-source.js
34181
34004
  var documentSource = /* @__PURE__ */ __name((note, accounts, profiles, file) => {
34182
34005
  const metadata = note.frontMatter;
34183
34006
  const account = accounts.find(({ id: id2 }) => String(id2) === note.folderId);
@@ -34199,7 +34022,7 @@ var documentSource = /* @__PURE__ */ __name((note, accounts, profiles, file) =>
34199
34022
  };
34200
34023
  }, "documentSource");
34201
34024
 
34202
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/enrichment-setting.js
34025
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/enrichment-setting.js
34203
34026
  var SECTION2 = "enrichment";
34204
34027
  var ENRICHMENT_PROVIDERS = ["openai", "anthropic"];
34205
34028
  var DEFAULT_BASE_URLS = {
@@ -34274,7 +34097,7 @@ var costOf = /* @__PURE__ */ __name((usage, setting) => {
34274
34097
  return price ? Math.round((usage.input * price.input + usage.output * price.output) * 1e6) / 1e6 : null;
34275
34098
  }, "costOf");
34276
34099
 
34277
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/enrichment.js
34100
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/enrichment.js
34278
34101
  var ENRICH_PER_RUN = 600;
34279
34102
  var MAX_LINE = 400;
34280
34103
  var line2 = pipe(unknown(), transform((value) => typeof value === "string" ? value.replace(/\s+/g, " ").trim().slice(0, MAX_LINE) : ""));
@@ -34350,7 +34173,7 @@ var enrichmentState = /* @__PURE__ */ __name(async (store, env, estimateFor, key
34350
34173
  };
34351
34174
  }, "enrichmentState");
34352
34175
 
34353
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/notes-title-tier.js
34176
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/notes-title-tier.js
34354
34177
  var plainQueryWords = /* @__PURE__ */ __name((query) => {
34355
34178
  let root;
34356
34179
  try {
@@ -34377,7 +34200,7 @@ var titleTiers = /* @__PURE__ */ __name((hits, words3) => {
34377
34200
  return [...hits].sort((a, b) => rank(a) - rank(b));
34378
34201
  }, "titleTiers");
34379
34202
 
34380
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/notes-search.js
34203
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/notes-search.js
34381
34204
  var storeQuery = /* @__PURE__ */ __name(async (store, text2, { exact, timezone } = {}) => resolvedQuery(store, parsedQuery(text2, exact), timezone), "storeQuery");
34382
34205
  var parsedQuery = /* @__PURE__ */ __name((text2, exact) => validateFields(parseLucene(text2, { ...SEARCH_QUERY, defaultField: exact ? "exact" : "text" })).root, "parsedQuery");
34383
34206
  var resolvedQuery = /* @__PURE__ */ __name(async (store, root, timezone) => {
@@ -34473,9 +34296,9 @@ var MAX_NOTES_OFFSET = 1e3;
34473
34296
  var CANDIDATES2 = 50;
34474
34297
  var firstLine2 = /* @__PURE__ */ __name((text2, query) => {
34475
34298
  const words3 = query.toLowerCase().split(/\s+/).map((word) => word.replace(/^[^\p{L}\p{N}]+|[^\p{L}\p{N}]+$/gu, "")).filter((word) => word.length > 2 && !["and", "or", "not"].includes(word));
34476
- const lines3 = text2.split("\n");
34477
- const found = lines3.find((line3) => words3.some((word) => line3.toLowerCase().includes(word)));
34478
- return (found ?? lines3.find((line3) => line3.trim() !== "") ?? "").trim().slice(0, MAX_LINE2);
34299
+ const lines = text2.split("\n");
34300
+ const found = lines.find((line3) => words3.some((word) => line3.toLowerCase().includes(word)));
34301
+ return (found ?? lines.find((line3) => line3.trim() !== "") ?? "").trim().slice(0, MAX_LINE2);
34479
34302
  }, "firstLine");
34480
34303
  var pictureLane = /* @__PURE__ */ __name(async (store, query, { folderIds, source, limit, env, command, embedder }) => {
34481
34304
  const words3 = plainWords(query);
@@ -34607,7 +34430,7 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
34607
34430
  ]);
34608
34431
  const asked = lookup ?? query;
34609
34432
  const text2 = [asked.trim() ? `(${asked})` : "", filter ?? ""].filter(Boolean).join(" AND ");
34610
- const window3 = offset + limit;
34433
+ const window2 = offset + limit;
34611
34434
  const scope = {
34612
34435
  ...folderIds === void 0 ? {} : { folderIds },
34613
34436
  ...withInternal ? { withInternal: true } : {},
@@ -34630,7 +34453,7 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
34630
34453
  ...withInternal ? { withInternal: true } : {},
34631
34454
  ...source === void 0 ? {} : { source }
34632
34455
  };
34633
- const depth = Math.max(window3, CANDIDATES2);
34456
+ const depth = Math.max(window2, CANDIDATES2);
34634
34457
  try {
34635
34458
  const within = narrowing === void 0 ? void 0 : await filterRefs(store, narrowing, scope);
34636
34459
  let nearest2;
@@ -34659,7 +34482,7 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
34659
34482
  const titleWords3 = plainQueryWords(rest);
34660
34483
  const titled = titleWords3 === void 0 ? { items: [], hasMore: false } : await searchNotesQuery(store, {
34661
34484
  text: [titleQuery(titleWords3), filter ?? ""].filter(Boolean).join(" AND "),
34662
- limit: Math.max(window3, CANDIDATES2),
34485
+ limit: Math.max(window2, CANDIDATES2),
34663
34486
  ...scope
34664
34487
  });
34665
34488
  const tier = titleWords3 === void 0 ? [] : titleTiers(titled.items, titleWords3);
@@ -34667,7 +34490,7 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
34667
34490
  const slice = meaning === void 0 && tier.length === 0;
34668
34491
  const matched = await searchNotesQuery(store, {
34669
34492
  text: text2,
34670
- limit: slice ? limit : Math.max(window3, CANDIDATES2) + tier.length,
34493
+ limit: slice ? limit : Math.max(window2, CANDIDATES2) + tier.length,
34671
34494
  offset: slice ? offset : 0,
34672
34495
  exact,
34673
34496
  ...scope
@@ -34692,8 +34515,8 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
34692
34515
  ...tier.map(({ ref, note, at }) => [ref, { note, at, score: 0, foundBy: ["title"] }]),
34693
34516
  ...[...ranked.entries()].sort(([, a], [, b]) => b.score - a.score)
34694
34517
  ];
34695
- const page = slice ? ordered : ordered.slice(offset, window3);
34696
- const hasMore = slice ? matched.hasMore : ordered.length > window3 || matched.hasMore || titled.hasMore;
34518
+ const page = slice ? ordered : ordered.slice(offset, window2);
34519
+ const hasMore = slice ? matched.hasMore : ordered.length > window2 || matched.hasMore || titled.hasMore;
34697
34520
  const total = await notesTotal(store, text2, { exact, scope, shown: offset + page.length, hasMore }, [...tier.map(({ ref }) => ref), ...meaningRefs ?? []], meaningComplete);
34698
34521
  const hits = [];
34699
34522
  const counts = /* @__PURE__ */ new Map();
@@ -34730,13 +34553,13 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
34730
34553
  ref,
34731
34554
  name
34732
34555
  ]));
34733
- for (const record2 of counts.values()) {
34734
- if (record2.ref && names2.has(record2.ref))
34735
- record2.name = names2.get(record2.ref) ?? record2.name;
34736
- if (record2.ref?.startsWith("person:"))
34737
- record2.name = (await store.people.personByUid(record2.ref.slice("person:".length)))?.name ?? record2.name;
34738
- if (record2.ref?.startsWith("note:") || record2.ref?.startsWith("document:"))
34739
- record2.name = (await store.notes.note(record2.ref).catch(() => void 0))?.title ?? record2.name;
34556
+ for (const record of counts.values()) {
34557
+ if (record.ref && names2.has(record.ref))
34558
+ record.name = names2.get(record.ref) ?? record.name;
34559
+ if (record.ref?.startsWith("person:"))
34560
+ record.name = (await store.people.personByUid(record.ref.slice("person:".length)))?.name ?? record.name;
34561
+ if (record.ref?.startsWith("note:") || record.ref?.startsWith("document:"))
34562
+ record.name = (await store.notes.note(record.ref).catch(() => void 0))?.title ?? record.name;
34740
34563
  }
34741
34564
  const lane = withPictures2 ? await pictureLane(store, words3, {
34742
34565
  folderIds,
@@ -34759,7 +34582,7 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
34759
34582
  items: hits,
34760
34583
  total,
34761
34584
  hasMore,
34762
- ...hasMore && window3 <= MAX_NOTES_OFFSET ? { nextOffset: window3 } : {},
34585
+ ...hasMore && window2 <= MAX_NOTES_OFFSET ? { nextOffset: window2 } : {},
34763
34586
  linked: [...counts.values()].sort((a, b) => b.notes - a.notes || (a.name ?? a.ref ?? "").localeCompare(b.name ?? b.ref ?? "")),
34764
34587
  ...lane
34765
34588
  };
@@ -34805,7 +34628,7 @@ var searchNotesOf = /* @__PURE__ */ __name(async (store, account, text2, { accou
34805
34628
  };
34806
34629
  }, "searchNotesOf");
34807
34630
 
34808
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/events-search.js
34631
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/events-search.js
34809
34632
  var MAX_EVENTS_OFFSET = 1e3;
34810
34633
  var iso3 = /* @__PURE__ */ __name((at) => at === null ? null : new Date(at).toISOString(), "iso");
34811
34634
  var accountIdsOf = /* @__PURE__ */ __name(async (store, accounts) => {
@@ -34852,7 +34675,7 @@ var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, off
34852
34675
  if (accountIds?.length === 0)
34853
34676
  return { query, by: "words", items: [], hasMore: false };
34854
34677
  const words3 = plainQueryWords(asked === void 0 ? query : questionText(query));
34855
- const window3 = offset + limit;
34678
+ const window2 = offset + limit;
34856
34679
  let meaningSkipped;
34857
34680
  let meaning;
34858
34681
  if (exact)
@@ -34864,7 +34687,7 @@ var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, off
34864
34687
  else
34865
34688
  try {
34866
34689
  meaning = await nearestEvents(store, words3, {
34867
- limit: Math.max(window3, CANDIDATES3),
34690
+ limit: Math.max(window2, CANDIDATES3),
34868
34691
  ...accountIds ? { accountIds } : {},
34869
34692
  ...env === void 0 ? {} : { env },
34870
34693
  ...command === void 0 ? {} : { command },
@@ -34877,7 +34700,7 @@ var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, off
34877
34700
  }
34878
34701
  const found = await store.calendar.search({
34879
34702
  root,
34880
- limit: meaning === void 0 ? limit : Math.max(window3, CANDIDATES3),
34703
+ limit: meaning === void 0 ? limit : Math.max(window2, CANDIDATES3),
34881
34704
  offset: meaning === void 0 ? offset : 0,
34882
34705
  ...accountIds === void 0 ? {} : { accountIds },
34883
34706
  ...newest ? { newest: true } : {},
@@ -34895,7 +34718,7 @@ var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, off
34895
34718
  ...skipped,
34896
34719
  items: found.items.map((hit) => foundEvent(hit, query, ["words"])),
34897
34720
  hasMore: found.hasMore,
34898
- ...found.hasMore && window3 <= MAX_EVENTS_OFFSET ? { nextOffset: window3 } : {},
34721
+ ...found.hasMore && window2 <= MAX_EVENTS_OFFSET ? { nextOffset: window2 } : {},
34899
34722
  ...truncated
34900
34723
  };
34901
34724
  const ranked = /* @__PURE__ */ new Map();
@@ -34909,29 +34732,29 @@ var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, off
34909
34732
  add(meaning, "meaning");
34910
34733
  const cosines = new Map(meaning.map((hit) => [keyOf4(hit), hit.score]));
34911
34734
  const ordered = [...ranked.values()].sort((a, b) => b.score - a.score);
34912
- const hasMore = ordered.length > window3 || found.hasMore;
34735
+ const hasMore = ordered.length > window2 || found.hasMore;
34913
34736
  return {
34914
34737
  query,
34915
34738
  by,
34916
- items: ordered.slice(offset, window3).map(({ hit, by: halves }) => {
34739
+ items: ordered.slice(offset, window2).map(({ hit, by: halves }) => {
34917
34740
  const cosine = cosines.get(keyOf4(hit));
34918
34741
  return { ...foundEvent(hit, query, halves), ...cosine === void 0 ? {} : { meaning_score: cosine } };
34919
34742
  }),
34920
34743
  hasMore,
34921
- ...hasMore && window3 <= MAX_EVENTS_OFFSET ? { nextOffset: window3 } : {},
34744
+ ...hasMore && window2 <= MAX_EVENTS_OFFSET ? { nextOffset: window2 } : {},
34922
34745
  ...truncated
34923
34746
  };
34924
34747
  }, "searchEvents");
34925
34748
 
34926
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/search-all-business.js
34749
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/search-all-business.js
34927
34750
  var OWN_BUSINESS = { provider: "business", account: INTERNAL_NOTES };
34928
34751
  var BUSINESS_WORDS_ONLY = "invoices, payments, orders, contracts, subscriptions, products and wallets are found by the words of their numbers and names only";
34929
34752
  var placeOf = /* @__PURE__ */ __name(({ source, imported }) => source ?? (imported === void 0 ? OWN_BUSINESS : { provider: imported, account: "" }), "placeOf");
34930
- var searchBusiness = /* @__PURE__ */ __name(async (store, { words: words3, anyWord, window: window3, accounts }) => {
34753
+ var searchBusiness = /* @__PURE__ */ __name(async (store, { words: words3, anyWord, window: window2, accounts }) => {
34931
34754
  const found = await store.business.find({
34932
34755
  words: words3,
34933
34756
  anyWord,
34934
- limit: Math.min(window3, BUSINESS_FIND_MAX),
34757
+ limit: Math.min(window2, BUSINESS_FIND_MAX),
34935
34758
  ...accounts === void 0 ? {} : { accounts }
34936
34759
  });
34937
34760
  const page = found.items;
@@ -34953,7 +34776,7 @@ var searchBusiness = /* @__PURE__ */ __name(async (store, { words: words3, anyWo
34953
34776
  };
34954
34777
  }, "searchBusiness");
34955
34778
 
34956
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/search-all-meetings.js
34779
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/search-all-meetings.js
34957
34780
  var MOST_HITS_PER_MEETING = 3;
34958
34781
  var PAGE_ROWS = 200;
34959
34782
  var MOST_PAGES = 25;
@@ -35075,7 +34898,7 @@ var merged = /* @__PURE__ */ __name((lists) => {
35075
34898
  best.at++;
35076
34899
  }
35077
34900
  }, "merged");
35078
- var accountHits = /* @__PURE__ */ __name(async (store, account, query, input, { text: text2, window: window3, signal, question, exact }) => {
34901
+ var accountHits = /* @__PURE__ */ __name(async (store, account, query, input, { text: text2, window: window2, signal, question, exact }) => {
35079
34902
  const ranked = [];
35080
34903
  const perMeeting = /* @__PURE__ */ new Map();
35081
34904
  const keep2 = /* @__PURE__ */ __name((one) => {
@@ -35096,13 +34919,13 @@ var accountHits = /* @__PURE__ */ __name(async (store, account, query, input, {
35096
34919
  query: titles,
35097
34920
  ...input.since === void 0 ? {} : { since: input.since },
35098
34921
  ...input.until === void 0 ? {} : { until: input.until },
35099
- limit: window3 + 1
34922
+ limit: window2 + 1
35100
34923
  }))
35101
34924
  if (!exact || holdsExactly(query.root, titleWords(meeting.title ?? "")))
35102
34925
  keep2({ item: titleItem(account, meeting, text2), tier: 1, started: meeting.startedAt ?? 0 });
35103
34926
  }
35104
34927
  let after;
35105
- let rows = Math.min(PAGE_ROWS, window3 + 1);
34928
+ let rows = Math.min(PAGE_ROWS, window2 + 1);
35106
34929
  for (let page = 1; ; page++) {
35107
34930
  let found;
35108
34931
  try {
@@ -35128,7 +34951,7 @@ var accountHits = /* @__PURE__ */ __name(async (store, account, query, input, {
35128
34951
  started: hit.source?.startedAt ?? 0
35129
34952
  }))
35130
34953
  passages++;
35131
- if (passages > window3 || !found.hasMore || found.nextCursor === null)
34954
+ if (passages > window2 || !found.hasMore || found.nextCursor === null)
35132
34955
  break;
35133
34956
  if (page === MOST_PAGES) {
35134
34957
  hasMore = true;
@@ -35138,8 +34961,8 @@ var accountHits = /* @__PURE__ */ __name(async (store, account, query, input, {
35138
34961
  }
35139
34962
  ranked.sort((one, other) => one.tier - other.tier || other.started - one.started);
35140
34963
  return {
35141
- ranked: ranked.slice(0, window3),
35142
- coverage: { indexing, hasMore: hasMore || ranked.length > window3 }
34964
+ ranked: ranked.slice(0, window2),
34965
+ coverage: { indexing, hasMore: hasMore || ranked.length > window2 }
35143
34966
  };
35144
34967
  }, "accountHits");
35145
34968
  var meetingItem = /* @__PURE__ */ __name((account, hit, query) => ({
@@ -35181,7 +35004,7 @@ var titleItem = /* @__PURE__ */ __name((account, meeting, query) => ({
35181
35004
  foundBy: ["title"]
35182
35005
  }), "titleItem");
35183
35006
 
35184
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/search-harder.js
35007
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/search-harder.js
35185
35008
  var SECTION3 = "search_harder";
35186
35009
  var HARDER_MODELS = {
35187
35010
  anthropic: "claude-haiku-5-5",
@@ -35427,7 +35250,7 @@ var reorderHarder = /* @__PURE__ */ __name(async (question, hits, { laterPage, a
35427
35250
  };
35428
35251
  }, "reorderHarder");
35429
35252
 
35430
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/search-all.js
35253
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/search-all.js
35431
35254
  var RESOURCES_SEARCHED = ["messages", "mail", "notes", "events", "crm", "business", "meetings"];
35432
35255
  var refusal = /* @__PURE__ */ __name((error, text2) => {
35433
35256
  const { reason, span } = error.details ?? {};
@@ -35498,8 +35321,8 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, asked, messenger =
35498
35321
  if (!Number.isInteger(offset) || offset < 0 || offset > MAX_SEARCH_OFFSET)
35499
35322
  throw new CliError("validation_error", `offset takes a whole number from 0 to ${MAX_SEARCH_OFFSET}`);
35500
35323
  const period = questionPeriod(request.text, request.now ?? Date.now(), timezoneOf(request.timezone));
35501
- const window3 = offset + request.limit;
35502
- const depth = Math.max(window3, period ? PERIOD_DEPTH : 0, request.harder ? HARDER_CANDIDATES : 0);
35324
+ const window2 = offset + request.limit;
35325
+ const depth = Math.max(window2, period ? PERIOD_DEPTH : 0, request.harder ? HARDER_CANDIDATES : 0);
35503
35326
  const chosen = request.source === void 0 ? { only: request.only ?? RESOURCES_SEARCHED, scope: request.scope, skipped: [] } : await sourceScope(store, account, request.source, request.only ?? RESOURCES_SEARCHED, messenger);
35504
35327
  const { only, scope } = chosen;
35505
35328
  const command = messenger.hintCommand === void 0 ? messenger.app?.command : messenger.hintCommand ?? void 0;
@@ -35547,7 +35370,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, asked, messenger =
35547
35370
  if (!skipped.some(({ source }) => source === one.source))
35548
35371
  skipped.push(one);
35549
35372
  accounts.push(...read.map(({ provider, account: account2 }) => ({ resource: kind, provider, account: account2 })));
35550
- const itemOf3 = /* @__PURE__ */ __name((hit, foundBy) => {
35373
+ const itemOf2 = /* @__PURE__ */ __name((hit, foundBy) => {
35551
35374
  const at = parseLocator(hit.locator);
35552
35375
  return {
35553
35376
  kind: kind === "mail" ? "mail" : "message",
@@ -35564,7 +35387,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, asked, messenger =
35564
35387
  foundBy
35565
35388
  };
35566
35389
  }, "itemOf");
35567
- const byWords = found.items.map((hit) => itemOf3(hit, ["words"]));
35390
+ const byWords = found.items.map((hit) => itemOf2(hit, ["words"]));
35568
35391
  if (!meaning || request.exact || kind === "messages" && request.backend === "server")
35569
35392
  return byWords;
35570
35393
  const filters = filtersBeside(request.text);
@@ -35593,7 +35416,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, asked, messenger =
35593
35416
  if (held && discovers)
35594
35417
  held.score = Math.max(held.score, vote);
35595
35418
  else
35596
- fused2.set(hit.locator, { item: held?.item ?? itemOf3(hit, ["meaning"]), score: (held?.score ?? 0) + vote });
35419
+ fused2.set(hit.locator, { item: held?.item ?? itemOf2(hit, ["meaning"]), score: (held?.score ?? 0) + vote });
35597
35420
  });
35598
35421
  return [...fused2.values()].sort((a, b) => b.score - a.score).map(({ item: item2 }) => item2);
35599
35422
  }, "messagesOf");
@@ -35788,7 +35611,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, asked, messenger =
35788
35611
  ordered = done2.items;
35789
35612
  harder = done2.harder;
35790
35613
  }
35791
- const more = hasMore || ordered.length > window3;
35614
+ const more = hasMore || ordered.length > window2;
35792
35615
  const { backend: _backend, server: _server, harder: _harder, ...local } = asked;
35793
35616
  const unmatched = [];
35794
35617
  if (!ordered.length && !offset && !discover)
@@ -35799,9 +35622,9 @@ var searchAll = /* @__PURE__ */ __name(async (store, account, asked, messenger =
35799
35622
  }
35800
35623
  return {
35801
35624
  query: asked.text,
35802
- items: ordered.slice(offset, window3),
35625
+ items: ordered.slice(offset, window2),
35803
35626
  hasMore: more,
35804
- ...more && window3 <= MAX_SEARCH_OFFSET ? { nextOffset: window3 } : {},
35627
+ ...more && window2 <= MAX_SEARCH_OFFSET ? { nextOffset: window2 } : {},
35805
35628
  searched,
35806
35629
  accounts,
35807
35630
  skipped,
@@ -35872,7 +35695,7 @@ var insidePeriodFirst = /* @__PURE__ */ __name((ordered, period) => {
35872
35695
  return ordered.map((item2, rank) => ({ item: item2, score: 1 - rank / PERIOD_DEPTH + (inside2(item2) ? PERIOD_BOOST : 0) })).sort((a, b) => b.score - a.score).map(({ item: item2 }) => item2);
35873
35696
  }, "insidePeriodFirst");
35874
35697
 
35875
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/server-search.js
35698
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/server-search.js
35876
35699
  var SERVER_SEARCH_KEY = "messages.server-search";
35877
35700
  var SERVER_BOUNDS = { timeMs: 5e3, perCall: 100, maxCalls: 3, textBytes: 262144 };
35878
35701
  var DEFAULT_BACKEND = "both";
@@ -36063,8 +35886,12 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
36063
35886
  return { report, sources };
36064
35887
  }, "searchServer");
36065
35888
 
36066
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/messages.js
35889
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/messages.js
36067
35890
  var DELETE_AT_ONCE = 10;
35891
+ var atOnce = /* @__PURE__ */ __name((ids) => {
35892
+ if (ids.length > DELETE_AT_ONCE)
35893
+ throw new CliError("validation_error", `at most ${DELETE_AT_ONCE} messages at once, got ${ids.length}`);
35894
+ }, "atOnce");
36068
35895
  var filesOf = /* @__PURE__ */ __name(({ attachments }) => {
36069
35896
  const files = fileLinks(attachments);
36070
35897
  return files.length > 0 ? { files } : {};
@@ -36100,6 +35927,15 @@ var messagesService = /* @__PURE__ */ __name((deps) => {
36100
35927
  ...query.saved === void 0 ? {} : { saved: query.saved }
36101
35928
  }).catch(() => void 0);
36102
35929
  }, "remember");
35930
+ const waiting = /* @__PURE__ */ __name(async (connection, chat, ids) => {
35931
+ const list2 = capability(connection, "scheduled", "list scheduled messages");
35932
+ const { id: chatId } = await connection.resolve(chat);
35933
+ const queued = await list2(chatId);
35934
+ const unknown3 = ids.filter((id2) => !queued.some((message) => message.id === id2));
35935
+ if (unknown3.length > 0)
35936
+ throw new CliError("not_found", `nothing scheduled in this chat has the id ${unknown3.join(", ")} \u2014 a scheduled message has an id of its own, not the one of a sent message; \`messages scheduled ${chat}\` lists them`, { sent: false });
35937
+ return { chatId, found: ids.map((id2) => queued.find((message) => message.id === id2)) };
35938
+ }, "waiting");
36103
35939
  const pinning = /* @__PURE__ */ __name(async ({ chat, message }, pinned, asked, requested) => {
36104
35940
  const allowed = deps.messenger.pinDurations;
36105
35941
  if (requested !== void 0 && !allowed?.includes(requested))
@@ -36118,11 +35954,11 @@ var messagesService = /* @__PURE__ */ __name((deps) => {
36118
35954
  throw new CliError("validation_error", "a topic is read back from its newest message, or from --before-id");
36119
35955
  if (threadId === "1")
36120
35956
  throw new CliError("validation_error", "the General topic's messages carry no topic id \u2014 read the whole chat without --topic");
36121
- const window3 = { limit, ...before === void 0 ? {} : { before } };
35957
+ const window2 = { limit, ...before === void 0 ? {} : { before } };
36122
35958
  if (fromStore(deps)) {
36123
- return inStore(async (store, account) => store.messages.messages(account, await readChatId(deps, chat, store, account), { ...window3, threadId }));
35959
+ return inStore(async (store, account) => store.messages.messages(account, await readChatId(deps, chat, store, account), { ...window2, threadId }));
36124
35960
  }
36125
- return capability(await deps.connection(), "topicHistory", "read one forum topic")(chat, threadId, window3);
35961
+ return capability(await deps.connection(), "topicHistory", "read one forum topic")(chat, threadId, window2);
36126
35962
  }, "topicPage");
36127
35963
  const listPage = /* @__PURE__ */ __name(async (chat, { limit, before, beforeTime, after, until, threadId: typedThread, starred }) => {
36128
35964
  if (starred !== void 0) {
@@ -36140,13 +35976,13 @@ var messagesService = /* @__PURE__ */ __name((deps) => {
36140
35976
  if (threadId !== void 0)
36141
35977
  return topicPage(chat, threadId, { limit, before, beforeTime, after, until });
36142
35978
  if (fromStore(deps)) {
36143
- const window4 = after ? { limit, after, ...until === void 0 ? {} : { until } } : {
35979
+ const window3 = after ? { limit, after, ...until === void 0 ? {} : { until } } : {
36144
35980
  limit,
36145
35981
  ...before === void 0 ? {} : { before },
36146
35982
  // historyBefore reads strictly before its moment; the store's end is inclusive.
36147
35983
  ...beforeTime === void 0 ? {} : { until: beforeTime - 1 }
36148
35984
  };
36149
- return inStore(async (store, account) => store.messages.messages(account, await readChatId(deps, chat, store, account), window4));
35985
+ return inStore(async (store, account) => store.messages.messages(account, await readChatId(deps, chat, store, account), window3));
36150
35986
  }
36151
35987
  const connection = await deps.connection();
36152
35988
  if (beforeTime !== void 0)
@@ -36158,24 +35994,24 @@ var messagesService = /* @__PURE__ */ __name((deps) => {
36158
35994
  const items = page.items.filter((one) => Date.parse(one.timestamp) <= until);
36159
35995
  return { items, hasMore: page.hasMore && items.length === page.items.length };
36160
35996
  }
36161
- const window3 = { limit, ...before === void 0 ? {} : { before } };
36162
- return capability(connection, "history", "read a chat's history")(chat, window3);
35997
+ const window2 = { limit, ...before === void 0 ? {} : { before } };
35998
+ return capability(connection, "history", "read a chat's history")(chat, window2);
36163
35999
  }, "listPage");
36164
36000
  return {
36165
36001
  // A provider caps its pages (Telegram at 100), so a larger --limit reads on from the last page's edge.
36166
36002
  // Only by id: where `before` is a send time (MAX), messages sharing the edge moment would be skipped.
36167
36003
  reader: /* @__PURE__ */ __name(() => deps.account(), "reader"),
36168
- list: /* @__PURE__ */ __name(async (chat, window3) => {
36169
- const forward = window3.after !== void 0;
36170
- let page = await listPage(chat, window3);
36004
+ list: /* @__PURE__ */ __name(async (chat, window2) => {
36005
+ const forward = window2.after !== void 0;
36006
+ let page = await listPage(chat, window2);
36171
36007
  let items = page.items;
36172
36008
  const byId2 = (deps.messenger.fetching?.orderBy ?? "id") === "id";
36173
- while (byId2 && page.hasMore && items.length < window3.limit) {
36009
+ while (byId2 && page.hasMore && items.length < window2.limit) {
36174
36010
  const edge = forward ? items.at(-1) : items[0];
36175
36011
  if (!edge)
36176
36012
  break;
36177
- const { beforeTime: _first, ...rest } = window3;
36178
- const next = forward ? { ...rest, limit: window3.limit - items.length, after: { id: edge.id } } : { ...rest, limit: window3.limit - items.length, before: edge.id };
36013
+ const { beforeTime: _first, ...rest } = window2;
36014
+ const next = forward ? { ...rest, limit: window2.limit - items.length, after: { id: edge.id } } : { ...rest, limit: window2.limit - items.length, before: edge.id };
36179
36015
  page = await listPage(chat, next);
36180
36016
  const seen = new Set(items.map((one) => one.id));
36181
36017
  const fresh = page.items.filter((one) => !seen.has(one.id));
@@ -36185,21 +36021,21 @@ var messagesService = /* @__PURE__ */ __name((deps) => {
36185
36021
  }
36186
36022
  return { items, hasMore: page.hasMore };
36187
36023
  }, "list"),
36188
- around: /* @__PURE__ */ __name(async (reference, message, window3) => {
36024
+ around: /* @__PURE__ */ __name(async (reference, message, window2) => {
36189
36025
  const target2 = messageLinkTarget(reference, message, deps.messenger.provider);
36190
36026
  if (target2.account !== void 0)
36191
36027
  await ownTarget(target2, await deps.account());
36192
36028
  if (fromStore(deps)) {
36193
- return inStore(async (store, account) => store.messages.around(account, await readChatId(deps, target2.chat, store, account), target2.message, window3));
36029
+ return inStore(async (store, account) => store.messages.around(account, await readChatId(deps, target2.chat, store, account), target2.message, window2));
36194
36030
  }
36195
- return capability(await deps.connection(), "around", "read the messages around one")(target2.chat, target2.message, window3);
36031
+ return capability(await deps.connection(), "around", "read the messages around one")(target2.chat, target2.message, window2);
36196
36032
  }, "around"),
36197
36033
  thread: /* @__PURE__ */ __name((reference, message, options2) => inStore(async (store, account) => {
36198
36034
  const target2 = messageLinkTarget(reference, message, deps.messenger.provider);
36199
36035
  await ownTarget(target2, account);
36200
36036
  return readThreadContext(store, account, await storedChatId(deps.messenger, target2.chat, store, account, { includeLeft: true }), target2.message, options2);
36201
36037
  }), "thread"),
36202
- comments: /* @__PURE__ */ __name(async (chat, typedPost, window3) => {
36038
+ comments: /* @__PURE__ */ __name(async (chat, typedPost, window2) => {
36203
36039
  const post = typedPost.trim();
36204
36040
  if (post === "")
36205
36041
  throw new CliError("validation_error", "which post? give its message id in the channel");
@@ -36210,7 +36046,7 @@ var messagesService = /* @__PURE__ */ __name((deps) => {
36210
36046
  const comments = capability(connection, "comments", "read comments on a channel post");
36211
36047
  const { id: channelId } = await connection.resolve(chat);
36212
36048
  const discussion = await discussionOf(channelId, post);
36213
- return { discussion, ...await comments(channelId, post, window3) };
36049
+ return { discussion, ...await comments(channelId, post, window2) };
36214
36050
  }, "comments"),
36215
36051
  link: /* @__PURE__ */ __name(async (reference, message) => {
36216
36052
  const target2 = messageLinkTarget(reference, message, deps.messenger.provider);
@@ -36405,6 +36241,53 @@ var messagesService = /* @__PURE__ */ __name((deps) => {
36405
36241
  await guardedWrite(guard, { operationId, chatId, kind: "delete", count: messages.length, forEveryone }, () => remove(chatId, messages, { forEveryone }));
36406
36242
  return { operationId, chatId, deleted: messages, forEveryone };
36407
36243
  }, "delete"),
36244
+ cancelScheduled: /* @__PURE__ */ __name(async ({ chat, ids }) => {
36245
+ atOnce(ids);
36246
+ const connection = await deps.connection();
36247
+ const cancel = capability(connection, "cancelScheduled", "cancel a scheduled message");
36248
+ const { chatId } = await waiting(connection, chat, ids);
36249
+ const operationId = newOperationId();
36250
+ await guardedWrite(guard, { operationId, chatId, kind: "delete", key: "messages.scheduled.cancel", count: ids.length }, () => cancel(chatId, ids));
36251
+ return { operationId, chatId, cancelled: ids };
36252
+ }, "cancelScheduled"),
36253
+ editScheduled: /* @__PURE__ */ __name(async ({ chat, id: id2, text: typed, markdown: markdown2, html: html2, at }) => {
36254
+ if (typed === void 0 && at === void 0)
36255
+ throw new CliError("validation_error", "nothing to change \u2014 give the new text, --at-time, or both");
36256
+ const connection = await deps.connection();
36257
+ const edit = capability(connection, "editScheduled", "edit a scheduled message");
36258
+ const prepared = typed === void 0 ? void 0 : await formatted(connection, typed, { markdown: markdown2, html: html2 });
36259
+ const change = prepared && (deps.agentText ? visibleFormattedText(prepared) : prepared);
36260
+ if (change !== void 0 && change.text.trim() === "")
36261
+ throw new CliError("validation_error", "no new text \u2014 the marks leave nothing");
36262
+ const { chatId, found: [current] } = await waiting(connection, chat, [id2]);
36263
+ const scheduledFor = at ?? current?.scheduledFor ?? current?.timestamp;
36264
+ if (scheduledFor === void 0)
36265
+ throw new CliError("invalid_response", "the scheduled message has no time");
36266
+ const operationId = newOperationId();
36267
+ const message = await guardedWrite(guard, {
36268
+ operationId,
36269
+ chatId,
36270
+ kind: "edit",
36271
+ key: "messages.scheduled.edit",
36272
+ messageId: id2,
36273
+ scheduledFor,
36274
+ ...change === void 0 ? {} : { length: change.text.length }
36275
+ }, () => edit(chatId, id2, {
36276
+ at: scheduledFor,
36277
+ ...change === void 0 ? {} : { text: change.text },
36278
+ ...change === void 0 || change.spans.length === 0 ? {} : { formatting: change.spans }
36279
+ }));
36280
+ return { operationId, message, scheduledFor };
36281
+ }, "editScheduled"),
36282
+ sendScheduled: /* @__PURE__ */ __name(async ({ chat, ids }) => {
36283
+ atOnce(ids);
36284
+ const connection = await deps.connection();
36285
+ const send = capability(connection, "sendScheduled", "send a scheduled message now");
36286
+ const { chatId } = await waiting(connection, chat, ids);
36287
+ const operationId = newOperationId();
36288
+ const messages = await guardedWrite(guard, { operationId, chatId, kind: "message", key: "messages.scheduled.send", count: ids.length }, () => send(chatId, ids));
36289
+ return { operationId, chatId, sent: ids, messages };
36290
+ }, "sendScheduled"),
36408
36291
  forward: /* @__PURE__ */ __name(async ({ chat, message, to, silent, sendId, sendAs, threadId: typedThread }) => {
36409
36292
  const connection = await deps.connection();
36410
36293
  const forward = capability(connection, "forward", "forward a message");
@@ -36503,7 +36386,7 @@ var checkMediaOptions = /* @__PURE__ */ __name((messenger, asked, attachments) =
36503
36386
  throw new CliError("validation_error", `${MEDIA_FLAGS[first2]} needs a --photo or --file`);
36504
36387
  }, "checkMediaOptions");
36505
36388
 
36506
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/domain/channel-tags.js
36389
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/domain/channel-tags.js
36507
36390
  var CHANNEL_TAG_RULES_VERSION = "keywords-v1";
36508
36391
  var RULES2 = {
36509
36392
  ai: [/\b(ai|gpt|llm|machine learning|artificial intelligence)\b/iu, /нейросет|искусственн/iu],
@@ -36518,7 +36401,7 @@ var classifyChannel = /* @__PURE__ */ __name((metadata) => Object.entries(RULES2
36518
36401
  return fields.length ? [{ tag, score: fields.length / 3, fields }] : [];
36519
36402
  }), "classifyChannel");
36520
36403
 
36521
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/metadata.js
36404
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/metadata.js
36522
36405
  var metadataService = /* @__PURE__ */ __name((deps) => {
36523
36406
  const held = /* @__PURE__ */ __name(async (reference, { includeLeft = false } = {}) => {
36524
36407
  const store = await deps.store();
@@ -36604,7 +36487,7 @@ var metadataService = /* @__PURE__ */ __name((deps) => {
36604
36487
  };
36605
36488
  }, "metadataService");
36606
36489
 
36607
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/moderation/run.js
36490
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/moderation/run.js
36608
36491
  var FIRST_LOOK_MS = 24 * 36e5;
36609
36492
  var moderateWith = /* @__PURE__ */ __name(async (run2) => {
36610
36493
  const { chatId, title, rules, point, since, dryRun } = run2;
@@ -36641,7 +36524,7 @@ var moderateWith = /* @__PURE__ */ __name(async (run2) => {
36641
36524
  return { chatId, rows, notes };
36642
36525
  }, "moderateWith");
36643
36526
 
36644
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/moderation.js
36527
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/moderation.js
36645
36528
  var moderationService = /* @__PURE__ */ __name((deps) => {
36646
36529
  const file = /* @__PURE__ */ __name(() => {
36647
36530
  const env = deps.env ?? process.env;
@@ -36726,7 +36609,7 @@ var moderatorOf = /* @__PURE__ */ __name((adapter, deps) => ({
36726
36609
  }, "removePerson")
36727
36610
  }), "moderatorOf");
36728
36611
 
36729
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/private-people.js
36612
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/private-people.js
36730
36613
  var noteItem = /* @__PURE__ */ __name((provider, note) => ({
36731
36614
  id: note.id,
36732
36615
  contact: formatReference({ type: "contact", provider, id: note.personId }),
@@ -36770,7 +36653,7 @@ var privatePeopleService = /* @__PURE__ */ __name((deps) => {
36770
36653
  };
36771
36654
  }, "privatePeopleService");
36772
36655
 
36773
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/rankings.js
36656
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/rankings.js
36774
36657
  var empty = /* @__PURE__ */ __name(() => ({
36775
36658
  total: 0,
36776
36659
  population: 0,
@@ -37026,7 +36909,7 @@ var rankingsService = /* @__PURE__ */ __name((deps) => ({
37026
36909
  }, "evidence")
37027
36910
  }), "rankingsService");
37028
36911
 
37029
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/reply-stats.js
36912
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/reply-stats.js
37030
36913
  var FIELDS = ["date", "chat", "kind", "muted"];
37031
36914
  var WAITING_TAIL = 100;
37032
36915
  var plainOnly = /* @__PURE__ */ __name((text2, command) => {
@@ -37160,7 +37043,7 @@ var replyStatsService = /* @__PURE__ */ __name((deps) => {
37160
37043
  };
37161
37044
  }, "replyStatsService");
37162
37045
 
37163
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/tags.js
37046
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/tags.js
37164
37047
  var TAGGING_QUERY = {
37165
37048
  entity: "tagging",
37166
37049
  backend: "sql",
@@ -37244,7 +37127,7 @@ var tagsService = /* @__PURE__ */ __name((deps) => {
37244
37127
  };
37245
37128
  }, "tagsService");
37246
37129
 
37247
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/topics.js
37130
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/topics.js
37248
37131
  var actionOf = /* @__PURE__ */ __name(({ title, closed, pinned, hidden, icon }) => {
37249
37132
  const set = [closed, pinned, hidden].filter((one) => one !== void 0).length;
37250
37133
  if (title !== void 0 || icon !== void 0 || set !== 1)
@@ -37443,7 +37326,7 @@ var topicsService = /* @__PURE__ */ __name((deps) => {
37443
37326
  };
37444
37327
  }, "topicsService");
37445
37328
 
37446
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/evidence.js
37329
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/evidence.js
37447
37330
  import { createHash as createHash12, randomUUID as randomUUID5 } from "node:crypto";
37448
37331
  var hash2 = /* @__PURE__ */ __name((value) => createHash12("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
37449
37332
  var positive2 = /* @__PURE__ */ __name((value, name, minimum = 1) => {
@@ -37517,7 +37400,7 @@ var prepareEvidencePacket = /* @__PURE__ */ __name(({ kind, source, page, limits
37517
37400
  return { ...content, id: randomUUID5(), fingerprint: hash2(content) };
37518
37401
  }, "prepareEvidencePacket");
37519
37402
 
37520
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/evidence-read.js
37403
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/evidence-read.js
37521
37404
  var readEvidencePacket = /* @__PURE__ */ __name(async (store, account, { chat, limit, before }, messenger = {}) => {
37522
37405
  if (!Number.isSafeInteger(limit) || limit < 1 || limit > 100)
37523
37406
  throw new CliError("validation_error", "evidence message limit must be an integer from 1 to 100");
@@ -37537,7 +37420,7 @@ var readEvidencePacket = /* @__PURE__ */ __name(async (store, account, { chat, l
37537
37420
  return { ...packet, nextBeforeId: older && last ? last.id : null };
37538
37421
  }, "readEvidencePacket");
37539
37422
 
37540
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/meeting-project-discovery.js
37423
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/meeting-project-discovery.js
37541
37424
  var scopeKeys = [
37542
37425
  "accountId",
37543
37426
  "meetingId",
@@ -37559,7 +37442,7 @@ var optionKeys = /* @__PURE__ */ new Set([
37559
37442
  "maxVocabularyReadBytes"
37560
37443
  ]);
37561
37444
 
37562
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/services/index.js
37445
+ // node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/services/index.js
37563
37446
  var servicesFor = /* @__PURE__ */ __name((deps) => {
37564
37447
  const pictures = picturesService(deps);
37565
37448
  const base = {
@@ -37596,312 +37479,6 @@ var servicesFor = /* @__PURE__ */ __name((deps) => {
37596
37479
  return deps.messenger.services ? { ...base, ...deps.messenger.services(base, deps) } : base;
37597
37480
  }, "servicesFor");
37598
37481
 
37599
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/background/relay.js
37600
- import { createHash as createHash13 } from "node:crypto";
37601
- import { chmodSync, lstatSync, mkdirSync as mkdirSync3, rmSync as rmSync2 } from "node:fs";
37602
- import { createConnection, createServer } from "node:net";
37603
- import { tmpdir as tmpdir2 } from "node:os";
37604
- import { dirname as dirname5, isAbsolute as isAbsolute3, join as join13 } from "node:path";
37605
- import { PassThrough, Writable } from "node:stream";
37606
- var RELAY_PROTOCOL = 1;
37607
- var requestSchema = strictObject({
37608
- argv: array(string()),
37609
- env: record(string(), string()),
37610
- cwd: pipe(string(), check((path) => isAbsolute3(path))),
37611
- tty: boolean(),
37612
- stdinTty: boolean()
37613
- });
37614
- var MAX_CLIENT_LINE = 1024 * 1024;
37615
- var MAX_SERVE_LINE = 64 * 1024 * 1024;
37616
- var MAX_SOCKET_PATH = 100;
37617
- var relayPath = /* @__PURE__ */ __name((lockPath) => {
37618
- const beside = lockPath.replace(/\.lock$/, ".sock");
37619
- if (beside.length <= MAX_SOCKET_PATH)
37620
- return beside;
37621
- const hash3 = createHash13("sha256").update(beside).digest("hex").slice(0, 16);
37622
- const name = join13(`wirecat-relay-${process.getuid?.() ?? "user"}`, `${hash3}.sock`);
37623
- const temporary = join13(tmpdir2(), name);
37624
- if (temporary.length <= MAX_SOCKET_PATH || process.platform === "win32")
37625
- return temporary;
37626
- return join13("/tmp", name);
37627
- }, "relayPath");
37628
- var privateDirectory = /* @__PURE__ */ __name((dir) => {
37629
- mkdirSync3(dir, { recursive: true, mode: 448 });
37630
- const stat3 = lstatSync(dir);
37631
- const mine = process.getuid === void 0 || stat3.uid === process.getuid();
37632
- if (!stat3.isDirectory() || !mine || (stat3.mode & 63) !== 0) {
37633
- throw new CliError("permission_error", `${dir} is not a private directory, so serve does not listen there`);
37634
- }
37635
- }, "privateDirectory");
37636
- var lines2 = /* @__PURE__ */ __name((socket, max, onLine, onTooLong) => {
37637
- let buffered = "";
37638
- socket.setEncoding("utf8");
37639
- socket.on("data", (chunk) => {
37640
- buffered += chunk;
37641
- for (let end = buffered.indexOf("\n"); end >= 0; end = buffered.indexOf("\n")) {
37642
- const line3 = buffered.slice(0, end);
37643
- buffered = buffered.slice(end + 1);
37644
- if (line3)
37645
- onLine(line3);
37646
- }
37647
- if (buffered.length > max)
37648
- onTooLong();
37649
- });
37650
- }, "lines");
37651
- var frame = /* @__PURE__ */ __name((socket, value) => {
37652
- if (!socket.destroyed)
37653
- socket.write(`${JSON.stringify(value)}
37654
- `);
37655
- }, "frame");
37656
- var listenRelay = /* @__PURE__ */ __name(async (path, run2) => {
37657
- privateDirectory(dirname5(path));
37658
- rmSync2(path, { force: true });
37659
- const open7 = /* @__PURE__ */ new Set();
37660
- const running = /* @__PURE__ */ new Set();
37661
- const server = createServer((socket) => {
37662
- open7.add(socket);
37663
- const stop = new AbortController();
37664
- const stdin = new PassThrough();
37665
- let started = false;
37666
- socket.on("error", () => {
37667
- });
37668
- socket.on("close", () => {
37669
- open7.delete(socket);
37670
- stop.abort(new CliError("cancelled", "the client went away", { retryable: false }));
37671
- if (!stdin.writableEnded)
37672
- stdin.end();
37673
- });
37674
- lines2(socket, MAX_CLIENT_LINE, (line3) => {
37675
- let message;
37676
- try {
37677
- message = JSON.parse(line3);
37678
- } catch {
37679
- socket.destroy();
37680
- return;
37681
- }
37682
- if (!started) {
37683
- started = true;
37684
- if (message.v !== RELAY_PROTOCOL) {
37685
- frame(socket, { diagnostic: `serve speaks relay protocol ${RELAY_PROTOCOL}; restart it`, exit: 1 });
37686
- socket.end();
37687
- return;
37688
- }
37689
- const parsed = safeParse(requestSchema, message.run);
37690
- if (!parsed.success) {
37691
- socket.destroy();
37692
- return;
37693
- }
37694
- stdin.isTTY = parsed.output.stdinTty;
37695
- if (parsed.output.stdinTty)
37696
- stdin.end();
37697
- const job = serve(socket, parsed.output, stdin, stop.signal, run2);
37698
- running.add(job);
37699
- void job.then(() => running.delete(job), () => running.delete(job));
37700
- return;
37701
- }
37702
- if (typeof message.stdin === "string" && !stdin.writableEnded)
37703
- stdin.write(Buffer.from(message.stdin, "base64"));
37704
- if (message.stdinEnd === true && !stdin.writableEnded)
37705
- stdin.end();
37706
- }, () => socket.destroy());
37707
- });
37708
- await new Promise((resolve7, reject) => {
37709
- server.once("error", reject);
37710
- server.listen(path, () => {
37711
- server.off("error", reject);
37712
- resolve7();
37713
- });
37714
- });
37715
- chmodSync(path, 384);
37716
- return {
37717
- close: /* @__PURE__ */ __name(async () => {
37718
- for (const socket of open7)
37719
- socket.destroy();
37720
- await new Promise((resolve7) => server.close(() => resolve7()));
37721
- await Promise.allSettled(running);
37722
- rmSync2(path, { force: true });
37723
- }, "close")
37724
- };
37725
- }, "listenRelay");
37726
- var serve = /* @__PURE__ */ __name(async (socket, request, stdin, signal, run2) => {
37727
- const streams = {
37728
- data: /* @__PURE__ */ __name((text2) => frame(socket, { data: text2 }), "data"),
37729
- diagnostic: /* @__PURE__ */ __name((text2) => frame(socket, { diagnostic: text2 }), "diagnostic"),
37730
- progress: /* @__PURE__ */ __name((text2) => frame(socket, { progress: text2 }), "progress")
37731
- };
37732
- const stdout = new Writable({
37733
- write: /* @__PURE__ */ __name((chunk, _encoding, done2) => {
37734
- frame(socket, { raw: Buffer.from(chunk).toString("base64") });
37735
- done2();
37736
- }, "write")
37737
- });
37738
- let code = 1;
37739
- try {
37740
- code = await run2(request, { streams, stdin, stdout, signal });
37741
- } finally {
37742
- frame(socket, { exit: code });
37743
- socket.end();
37744
- }
37745
- }, "serve");
37746
- var relayCommand = /* @__PURE__ */ __name((path, request, options2) => new Promise((resolve7, reject) => {
37747
- const { streams, stdin, stdout, signal, deadlineMs, writes, holder, listens = false } = options2;
37748
- const socket = createConnection(path);
37749
- let connected = false;
37750
- let settled = false;
37751
- let timer;
37752
- const forward = /* @__PURE__ */ __name((chunk) => frame(socket, { stdin: Buffer.from(chunk).toString("base64") }), "forward");
37753
- const ended = /* @__PURE__ */ __name(() => frame(socket, { stdinEnd: true }), "ended");
37754
- const brokenPipe = /* @__PURE__ */ __name((error) => {
37755
- if (error.code === "EPIPE")
37756
- finish({ code: 0 });
37757
- }, "brokenPipe");
37758
- const finish = /* @__PURE__ */ __name((outcome2) => {
37759
- if (settled)
37760
- return;
37761
- settled = true;
37762
- if (timer)
37763
- clearTimeout(timer);
37764
- stdout.off("error", brokenPipe);
37765
- signal.removeEventListener("abort", aborted);
37766
- stdin.off("data", forward).off("end", ended);
37767
- stdin.pause();
37768
- socket.destroy();
37769
- if ("code" in outcome2)
37770
- resolve7(outcome2.code);
37771
- else
37772
- reject(outcome2.error);
37773
- }, "finish");
37774
- const stopped = /* @__PURE__ */ __name(() => writes ? new CliError("outcome_unknown", `${holder} stopped before the command finished; it may have run \u2014 check before repeating it`, { retryable: false }) : new CliError("provider_unavailable", `${holder} stopped before the command finished`, { retryable: true }), "stopped");
37775
- const aborted = /* @__PURE__ */ __name(() => finish(listens ? { code: 0 } : { error: signal.reason }), "aborted");
37776
- if (signal.aborted)
37777
- return aborted();
37778
- signal.addEventListener("abort", aborted, { once: true });
37779
- stdout.on("error", brokenPipe);
37780
- if (deadlineMs !== void 0)
37781
- timer = setTimeout(() => finish({ error: stopped() }), deadlineMs);
37782
- socket.on("connect", () => {
37783
- connected = true;
37784
- frame(socket, { v: RELAY_PROTOCOL, run: request });
37785
- if (request.stdinTty)
37786
- ended();
37787
- else {
37788
- stdin.on("data", forward).once("end", ended);
37789
- stdin.resume();
37790
- }
37791
- });
37792
- socket.on("error", (error) => {
37793
- if (connected)
37794
- return finish({ error: stopped() });
37795
- finish({
37796
- error: new CliError("provider_unavailable", `${holder} holds the connection but does not answer its relay (${error.code ?? error.message}) \u2014 restart it`, { retryable: false, sent: false })
37797
- });
37798
- });
37799
- socket.on("close", () => finish({ error: stopped() }));
37800
- lines2(socket, MAX_SERVE_LINE, (line3) => {
37801
- let message;
37802
- try {
37803
- message = JSON.parse(line3);
37804
- } catch {
37805
- return finish({ error: stopped() });
37806
- }
37807
- if (typeof message.data === "string")
37808
- streams.data(message.data);
37809
- if (typeof message.diagnostic === "string")
37810
- streams.diagnostic(message.diagnostic);
37811
- if (typeof message.progress === "string")
37812
- streams.progress?.(message.progress);
37813
- if (typeof message.raw === "string")
37814
- stdout.write(Buffer.from(message.raw, "base64"));
37815
- if (typeof message.exit === "number")
37816
- finish({ code: message.exit });
37817
- }, () => finish({ error: stopped() }));
37818
- }), "relayCommand");
37819
-
37820
- // node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-relay.js
37821
- var lentConnection = /* @__PURE__ */ __name((connection, watchers) => throughWrapper(connection, {
37822
- close: /* @__PURE__ */ __name(async () => {
37823
- }, "close"),
37824
- feed: void 0,
37825
- storedChats: void 0,
37826
- listen: void 0,
37827
- listenHistory: void 0,
37828
- ...connection.watch && watchers ? {
37829
- // A watcher that throws (its output limit, a closed reader) ends its own watch, never serve's.
37830
- watch: /* @__PURE__ */ __name(async (onEvent, signal, onReady) => {
37831
- let watcher;
37832
- try {
37833
- await new Promise((resolve7, reject) => {
37834
- watcher = /* @__PURE__ */ __name((event2) => {
37835
- try {
37836
- onEvent(event2);
37837
- } catch (error) {
37838
- reject(error);
37839
- }
37840
- }, "watcher");
37841
- watchers.add(watcher);
37842
- signal.addEventListener("abort", () => resolve7(), { once: true });
37843
- onReady?.();
37844
- if (signal.aborted)
37845
- resolve7();
37846
- });
37847
- } finally {
37848
- if (watcher)
37849
- watchers.delete(watcher);
37850
- }
37851
- }, "watch")
37852
- } : { watch: void 0 }
37853
- }), "lentConnection");
37854
- var serveRelay = /* @__PURE__ */ __name((command, messenger) => {
37855
- let held;
37856
- let relay;
37857
- const watchers = /* @__PURE__ */ new Set();
37858
- const borrowed = /* @__PURE__ */ __name(() => {
37859
- const connection = held;
37860
- if (!connection)
37861
- throw new CliError("provider_unavailable", "serve is not connected yet", { retryable: true });
37862
- return lentConnection(connection, watchers);
37863
- }, "borrowed");
37864
- return {
37865
- messenger: {
37866
- ...messenger,
37867
- connect: /* @__PURE__ */ __name(async (...args) => {
37868
- held = await messenger.connect(...args);
37869
- return held;
37870
- }, "connect")
37871
- },
37872
- arrived: /* @__PURE__ */ __name((event2) => {
37873
- for (const watcher of watchers)
37874
- watcher(event2);
37875
- }, "arrived"),
37876
- /** Listens beside the lock; the address goes into it, which is how a client finds it. */
37877
- open: /* @__PURE__ */ __name(async (lockPath, profile) => {
37878
- const environment = environmentOf(command);
37879
- const runCommand = environment.runCommand;
37880
- if (!runCommand)
37881
- return void 0;
37882
- const readOnly = readOnlyLockOf(messenger.app, environment.env ?? process.env);
37883
- const path = relayPath(lockPath);
37884
- relay = await listenRelay(path, (request, io) => runCommand(request.argv, {
37885
- env: {
37886
- ...request.env,
37887
- ...readOnly ? { [`${messenger.app.envPrefix}_READ_ONLY`]: "1" } : {}
37888
- },
37889
- streams: io.streams,
37890
- stdin: io.stdin,
37891
- stdout: io.stdout,
37892
- tty: request.tty,
37893
- signal: io.signal,
37894
- answer: /* @__PURE__ */ __name(() => null, "answer"),
37895
- relayed: { profile, cwd: request.cwd, connection: borrowed }
37896
- }));
37897
- return { path, protocol: RELAY_PROTOCOL };
37898
- }, "open"),
37899
- close: /* @__PURE__ */ __name(async () => {
37900
- await relay?.close();
37901
- }, "close")
37902
- };
37903
- }, "serveRelay");
37904
-
37905
37482
  export {
37906
37483
  communicationFields,
37907
37484
  OFFLINE,
@@ -37913,8 +37490,6 @@ export {
37913
37490
  registriesCover,
37914
37491
  chatCoverage,
37915
37492
  threadIdOf,
37916
- throughWrapper,
37917
- capability,
37918
37493
  syncsOneChat,
37919
37494
  unanswered,
37920
37495
  AUDIT_PAGE,
@@ -38068,42 +37643,8 @@ export {
38068
37643
  validatePreparationCommunications,
38069
37644
  upgradePackage,
38070
37645
  servicesFor,
38071
- RELAY_PROTOCOL,
38072
- relayCommand,
38073
37646
  COMMAND_NEEDS,
38074
37647
  lackedNeed,
38075
37648
  refuseLacking,
38076
- hideNever,
38077
- lentConnection,
38078
- serveRelay,
38079
- positiveCount,
38080
- configuredLimit,
38081
- withPaging,
38082
- window2 as window,
38083
- pagingOf,
38084
- chatRef,
38085
- chatAnswer,
38086
- memberAnswer,
38087
- contactRef,
38088
- contactAnswer,
38089
- contactShown,
38090
- chatEventAnswer,
38091
- memberEventAnswer,
38092
- inviteLinkAnswer,
38093
- joinRequestAnswer,
38094
- pollVoteAnswer,
38095
- reactorAnswer,
38096
- topicAnswer,
38097
- folderAnswer,
38098
- lines,
38099
- pageOf,
38100
- wholeList,
38101
- chatShown,
38102
- scoreFloor,
38103
- auditAnswer,
38104
- renderItem,
38105
- withPage,
38106
- documentLinkAnswer,
38107
- accountAnswer,
38108
- sessionAnswer
37649
+ hideNever
38109
37650
  };