@wirecat/drive-cli 0.50.0 → 0.52.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.
- package/dist/bin/drive.js +2 -2
- package/dist/bundle/{all-profiles-WQTVOCIS.js → all-profiles-CYW6XBBS.js} +8 -8
- package/dist/bundle/{anthropic-YCA2AWIJ.js → anthropic-KW6KU36Y.js} +5 -5
- package/dist/bundle/{app-server-ZQOYUQJH.js → app-server-TCJZ333E.js} +53 -52
- package/dist/bundle/{bun-5NFIDHGM.js → bun-7SYKSCLA.js} +2 -2
- package/dist/bundle/{bun-sqlite-OAQE4M2E.js → bun-sqlite-RI7DR6RZ.js} +4 -4
- package/dist/bundle/{chunk-KZEOWOZV.js → chunk-234MHU76.js} +7 -7
- package/dist/bundle/{chunk-IGG4RBIZ.js → chunk-2623YE5I.js} +109 -98
- package/dist/bundle/{chunk-POD2GHQB.js → chunk-2AUXBJRX.js} +19 -19
- package/dist/bundle/{chunk-KEQ35HQQ.js → chunk-2UIMEMWU.js} +3 -3
- package/dist/bundle/{chunk-LNWRRK2H.js → chunk-33NVQGUY.js} +6 -6
- package/dist/bundle/{chunk-ZXD2I5ZQ.js → chunk-43QVYW3K.js} +49 -49
- package/dist/bundle/{chunk-BUALWXBT.js → chunk-4A2PIGC6.js} +1 -1
- package/dist/bundle/{chunk-3HNUH632.js → chunk-4CPLOMRK.js} +6 -6
- package/dist/bundle/{chunk-E656DAZT.js → chunk-4Z6TCU5T.js} +1 -1
- package/dist/bundle/{chunk-INVF3GXW.js → chunk-54O62JWP.js} +10 -10
- package/dist/bundle/{chunk-JA2YY7D4.js → chunk-5PLJKSG4.js} +7 -7
- package/dist/bundle/{chunk-XEETGCOC.js → chunk-6DHQTUB2.js} +1 -1
- package/dist/bundle/{chunk-ZKGYW63J.js → chunk-725OHXKR.js} +9 -9
- package/dist/bundle/chunk-7SH4JHYW.js +379 -0
- package/dist/bundle/{chunk-AO3NCZNT.js → chunk-7XKAVMCF.js} +8 -8
- package/dist/bundle/{chunk-PNUS224S.js → chunk-7YMDL4JQ.js} +8 -6
- package/dist/bundle/{chunk-CEUEXMIR.js → chunk-A4UNTWAX.js} +31 -27
- package/dist/bundle/{chunk-KYMGVMOS.js → chunk-ALJWBGD5.js} +1 -1
- package/dist/bundle/{chunk-QY3LK3OT.js → chunk-BSSCTWWK.js} +12 -12
- package/dist/bundle/{chunk-CCEVICWU.js → chunk-C6Z25IBJ.js} +49 -24
- package/dist/bundle/{chunk-ZJBRKR42.js → chunk-CB7SBYLO.js} +27 -27
- package/dist/bundle/{chunk-4VLUX3V5.js → chunk-CITFEQ6S.js} +1 -1
- package/dist/bundle/{chunk-Y73IZWRI.js → chunk-CKBHR7QO.js} +1 -1
- package/dist/bundle/{chunk-M2D4FXKY.js → chunk-CM7GAXGD.js} +5 -5
- package/dist/bundle/{chunk-OKSS7YUN.js → chunk-DLAFGSTN.js} +1 -1
- package/dist/bundle/{chunk-T7UZHKAS.js → chunk-DO4PDQY5.js} +2 -2
- package/dist/bundle/{chunk-P3T2SZW2.js → chunk-DW46P2DY.js} +1 -1
- package/dist/bundle/{chunk-Q3VG3UYV.js → chunk-F7UUZATI.js} +11 -11
- package/dist/bundle/{chunk-7SYSC7KX.js → chunk-FCJAHD4R.js} +2 -2
- package/dist/bundle/{chunk-QBECV7NO.js → chunk-FDWYPONW.js} +46 -34
- package/dist/bundle/{chunk-4SSUKRO4.js → chunk-FG4XXZZE.js} +2 -2
- package/dist/bundle/{chunk-DTHWL5YU.js → chunk-FJW3DDCF.js} +5 -5
- package/dist/bundle/{chunk-JHBX53SK.js → chunk-G6QF5KWF.js} +35 -35
- package/dist/bundle/{chunk-4J7UGHPK.js → chunk-G7DCVJ4F.js} +5 -5
- package/dist/bundle/{chunk-ZP735UUT.js → chunk-GR5GGZKH.js} +3 -3
- package/dist/bundle/{chunk-OL22OOIW.js → chunk-GVCN3GLZ.js} +16 -4
- package/dist/bundle/{chunk-2M5XEGVE.js → chunk-H47W2J6S.js} +638 -809
- package/dist/bundle/{chunk-HGWMX7BM.js → chunk-HQVJK5E7.js} +44 -22
- package/dist/bundle/{chunk-M6FQOGUW.js → chunk-HX7Y2ASG.js} +351 -282
- package/dist/bundle/{chunk-FSAM4Y2S.js → chunk-I7UH5CTA.js} +8 -8
- package/dist/bundle/{chunk-FABKIQ24.js → chunk-IDUNJCFO.js} +2 -2
- package/dist/bundle/{chunk-652YTDT5.js → chunk-IWFBAWZK.js} +15 -15
- package/dist/bundle/{chunk-3XX52F42.js → chunk-JEOYFKUK.js} +2 -2
- package/dist/bundle/{chunk-RTIMGPLN.js → chunk-KYVXMEBC.js} +3 -3
- package/dist/bundle/{chunk-IFM2APQB.js → chunk-LJAX6YCF.js} +2 -2
- package/dist/bundle/{chunk-R7XMCREL.js → chunk-LONV6HIK.js} +20 -20
- package/dist/bundle/{chunk-G75FZQAZ.js → chunk-NHBUTCNR.js} +10 -10
- package/dist/bundle/{chunk-5ZJHQ4TN.js → chunk-NPSZPUK6.js} +2 -2
- package/dist/bundle/{chunk-53UWCVSU.js → chunk-NSIFQ5OP.js} +1 -1
- package/dist/bundle/{chunk-HURI56SB.js → chunk-O6IOL6RX.js} +21 -21
- package/dist/bundle/{chunk-IA6LNKCF.js → chunk-PAXKALHV.js} +5 -5
- package/dist/bundle/{chunk-Z54E5LKF.js → chunk-PDGECM5D.js} +7 -7
- package/dist/bundle/{chunk-5OMLYNYB.js → chunk-PEOCBV2Z.js} +8 -8
- package/dist/bundle/{chunk-TATRMMOG.js → chunk-PQJYM5ES.js} +3 -3
- package/dist/bundle/{chunk-XGJUEH5C.js → chunk-PQYVPCJ2.js} +26 -26
- package/dist/bundle/{chunk-3CQNJKJT.js → chunk-PSNHPFSK.js} +1 -1
- package/dist/bundle/{chunk-6DDXB5WB.js → chunk-Q765VPZY.js} +2 -2
- package/dist/bundle/{chunk-YOABRW2M.js → chunk-R276546S.js} +1 -1
- package/dist/bundle/{chunk-QSDXVUJG.js → chunk-RNSP57TC.js} +4 -4
- package/dist/bundle/{chunk-VAETCXRI.js → chunk-UC22Q5KU.js} +11 -11
- package/dist/bundle/{chunk-EXYEDKTX.js → chunk-UR32UWTQ.js} +2 -2
- package/dist/bundle/{chunk-YROVFHPJ.js → chunk-VJZST5RD.js} +2 -2
- package/dist/bundle/{chunk-MMOG7ZVF.js → chunk-VSOLLTYT.js} +2 -2
- package/dist/bundle/{chunk-IUZ4PT2V.js → chunk-VZ2I62HN.js} +2 -2
- package/dist/bundle/{chunk-CTIQ77AB.js → chunk-W7IK7E4B.js} +17 -17
- package/dist/bundle/{chunk-C4PNAHI4.js → chunk-WBTVGFXI.js} +11 -11
- package/dist/bundle/{chunk-P6VN5UB4.js → chunk-WLFUBNFX.js} +4 -4
- package/dist/bundle/{chunk-Q27HCATD.js → chunk-WQJBAWQP.js} +534 -348
- package/dist/bundle/{chunk-4OLWMHS6.js → chunk-WQRGA75U.js} +15 -3
- package/dist/bundle/{chunk-5WN7JHQE.js → chunk-WUX7AUOQ.js} +26 -26
- package/dist/bundle/{chunk-VAK2Q2XG.js → chunk-X6ID5EAR.js} +16 -16
- package/dist/bundle/{chunk-5Z63NTC7.js → chunk-XOLQSCMF.js} +6 -6
- package/dist/bundle/{chunk-EY4CUQW2.js → chunk-YKZ4IPLB.js} +26 -9
- package/dist/bundle/{chunk-24TOKSZE.js → chunk-YNFELLNQ.js} +2 -2
- package/dist/bundle/{chunk-JSMPSOEM.js → chunk-YVPHJHIL.js} +3 -3
- package/dist/bundle/{chunk-QNLD7Y6Z.js → chunk-Z47LOJUS.js} +7 -7
- package/dist/bundle/{chunk-NHRJW3PH.js → chunk-ZDLIO76S.js} +2 -2
- package/dist/bundle/{chunk-OQEBGY74.js → chunk-ZNZUZGSV.js} +54 -47
- package/dist/bundle/{chunk-6E4PFCQ4.js → chunk-ZSXRDF6I.js} +1 -1
- package/dist/bundle/{chunk-UVPKSZSC.js → chunk-ZWSG7OCA.js} +4 -4
- package/dist/bundle/command-contract-I2YB5IXI.js +38 -0
- package/dist/bundle/{decode-YZRTP54O.js → decode-EDN2ARXZ.js} +19 -17
- package/dist/bundle/drive.js +7 -7
- package/dist/bundle/{echarts-C6HUK2FL.js → echarts-GXY34GHA.js} +2 -2
- package/dist/bundle/{embed-QRQ7ITFC.js → embed-3GSQIQXE.js} +5 -5
- package/dist/bundle/{embedder-EZDB3JPA.js → embedder-6ULWRG3R.js} +8 -8
- package/dist/bundle/{entry-4WQQKSYG.js → entry-IPRJLFHO.js} +6 -6
- package/dist/bundle/failure-4CVEVY45.js +37 -0
- package/dist/bundle/{first-run-ZAS4OV3T.js → first-run-FGHGWHC2.js} +9 -9
- package/dist/bundle/first-screen-M62KTPZG.js +36 -0
- package/dist/bundle/{google-KNILTIDW.js → google-BD3ZNFVJ.js} +9 -9
- package/dist/bundle/google-api-BDUWZMRV.js +83 -0
- package/dist/bundle/{identity-VBCGUXT5.js → identity-QLBSASO5.js} +2 -2
- package/dist/bundle/{instructions-II4M2WL3.js → instructions-K5BEQM4C.js} +1 -1
- package/dist/bundle/{login-4JACQVMD.js → login-VNZKRSAD.js} +65 -64
- package/dist/bundle/{mcp-6ZIAWU3N.js → mcp-5SNSMI2M.js} +82 -81
- package/dist/bundle/mcp-JZSYPQA4.js +96 -0
- package/dist/bundle/{mcp-ZYZ4DFW2.js → mcp-WSGVVZWI.js} +2 -2
- package/dist/bundle/{node-LIN7L4VQ.js → node-ZYWB7IET.js} +2 -2
- package/dist/bundle/{node-sqlite-VAH4KZN3.js → node-sqlite-J3OODPYK.js} +4 -4
- package/dist/bundle/{oauth-QUE3VCTU.js → oauth-L4VTCBLF.js} +6 -6
- package/dist/bundle/{open-DQ3EVYPB.js → open-SGUN7ZVF.js} +3 -3
- package/dist/bundle/openai-RLVISEDH.js +251 -0
- package/dist/bundle/{process-46XDWPVW.js → process-ZXO2MWRJ.js} +1 -1
- package/dist/bundle/{program-X3CZ4XDN.js → program-6S5EH7BS.js} +105 -103
- package/dist/bundle/{prompt-SAZYCZV3.js → prompt-AUWTBLO7.js} +4 -4
- package/dist/bundle/{reasons-366PI7OV.js → reasons-M5AKCNCU.js} +3 -3
- package/dist/bundle/{recognize-SSBOHOTW.js → recognize-ORX2UBQW.js} +5 -3
- package/dist/bundle/{remote-EL3FWCQE.js → remote-AGIJY73X.js} +6 -6
- package/dist/bundle/{rerank-RPIQRJIW.js → rerank-R6PE44M5.js} +6 -6
- package/dist/bundle/{serve-AX44DIKK.js → serve-VOBAQHAQ.js} +8 -8
- package/dist/bundle/server-24PS4M7U.js +70 -0
- package/dist/bundle/server-G6HFZ2CK.js +57 -0
- package/dist/bundle/{services-K4UOEMQD.js → services-HZFTTZSF.js} +35 -28
- package/dist/bundle/{sqlite-runtime-N7N3EYGH.js → sqlite-runtime-DTGPR2T2.js} +4 -4
- package/dist/bundle/{state-C3S5FD7V.js → state-WG3JKJM3.js} +5 -5
- package/dist/bundle/{store-4N3NBUGX.js → store-33VHIMEO.js} +14 -14
- package/dist/bundle/{store-QV4ZNEQ3.js → store-EV72MT5U.js} +16 -16
- package/dist/bundle/store-maintenance-command-ZTUEI4EC.js +58 -0
- package/dist/bundle/tokens-XDQXUFDQ.js +104 -0
- package/dist/commands/search.js +1 -1
- package/dist/commands/search.js.map +1 -1
- package/dist/contract-overrides.js +1 -1
- package/dist/contract-overrides.js.map +1 -1
- package/dist/knowledge-query.d.ts +1 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +1 -0
- package/dist/store.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/dist/bundle/command-contract-TAWVO2G3.js +0 -38
- package/dist/bundle/failure-EEJGMWEP.js +0 -37
- package/dist/bundle/first-screen-6ICWD2N3.js +0 -36
- package/dist/bundle/google-api-CZACYX5T.js +0 -82
- package/dist/bundle/mcp-2BR2EX7L.js +0 -95
- package/dist/bundle/server-DCJIGUW2.js +0 -56
- package/dist/bundle/server-WWQSQBFT.js +0 -69
- package/dist/bundle/store-maintenance-command-QL4AECBD.js +0 -57
- package/dist/bundle/tokens-Y7HCOXOA.js +0 -103
- /package/dist/bundle/{chunk-2WNDZFGG.js → chunk-62EDJKGP.js} +0 -0
- /package/dist/bundle/{chunk-VDZZ46RT.js → chunk-FQRJWVEB.js} +0 -0
|
@@ -7,7 +7,15 @@ import {
|
|
|
7
7
|
engineMissing,
|
|
8
8
|
extractText,
|
|
9
9
|
importEngine
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-WUX7AUOQ.js";
|
|
11
|
+
import {
|
|
12
|
+
acquireLock,
|
|
13
|
+
openOrdinaryFile,
|
|
14
|
+
readBoundedUtf8File,
|
|
15
|
+
sameOrdinaryFile,
|
|
16
|
+
syncDirectory,
|
|
17
|
+
writeFileAtomic
|
|
18
|
+
} from "./chunk-7SH4JHYW.js";
|
|
11
19
|
import {
|
|
12
20
|
MAX_ACTIONS,
|
|
13
21
|
ModerationRules,
|
|
@@ -23,7 +31,7 @@ import {
|
|
|
23
31
|
someUndone,
|
|
24
32
|
validateFormattedText,
|
|
25
33
|
visibleFormattedText
|
|
26
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-Z47LOJUS.js";
|
|
27
35
|
import {
|
|
28
36
|
DEFAULT_IMAGE_MODEL,
|
|
29
37
|
DEFAULT_RERANK_MODEL,
|
|
@@ -50,23 +58,23 @@ import {
|
|
|
50
58
|
typedCommand,
|
|
51
59
|
vectorModelKey,
|
|
52
60
|
withAttempt
|
|
53
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-LONV6HIK.js";
|
|
54
62
|
import {
|
|
55
63
|
isCliFailure
|
|
56
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-VSOLLTYT.js";
|
|
57
65
|
import {
|
|
58
66
|
isNewer,
|
|
59
67
|
updateCommand
|
|
60
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-7YMDL4JQ.js";
|
|
61
69
|
import {
|
|
62
70
|
MAX_MODEL_IMAGE_BYTES
|
|
63
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-VZ2I62HN.js";
|
|
64
72
|
import {
|
|
65
73
|
OPENAI_URL,
|
|
66
74
|
openRemote,
|
|
67
75
|
remoteKey,
|
|
68
76
|
remoteModel
|
|
69
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-2UIMEMWU.js";
|
|
70
78
|
import {
|
|
71
79
|
defaultThreads,
|
|
72
80
|
installNativeRuntime,
|
|
@@ -75,11 +83,11 @@ import {
|
|
|
75
83
|
placedText,
|
|
76
84
|
runEmbedders,
|
|
77
85
|
textModelsDirectory
|
|
78
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-CM7GAXGD.js";
|
|
79
87
|
import {
|
|
80
88
|
installFiles,
|
|
81
89
|
megabytes
|
|
82
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-BSSCTWWK.js";
|
|
83
91
|
import {
|
|
84
92
|
AGENDA_COLUMNS,
|
|
85
93
|
CHAT_COLUMNS,
|
|
@@ -133,12 +141,12 @@ import {
|
|
|
133
141
|
threadConversation,
|
|
134
142
|
validateAst,
|
|
135
143
|
validateFields
|
|
136
|
-
} from "./chunk-
|
|
144
|
+
} from "./chunk-WQJBAWQP.js";
|
|
137
145
|
import {
|
|
138
146
|
MAX_TEXT_CHARS,
|
|
139
147
|
attachmentMaxBytes,
|
|
140
148
|
pdfPreviewLimits
|
|
141
|
-
} from "./chunk-
|
|
149
|
+
} from "./chunk-JEOYFKUK.js";
|
|
142
150
|
import {
|
|
143
151
|
COUNTER_FIELDS,
|
|
144
152
|
INTERNAL_NOTES,
|
|
@@ -157,13 +165,13 @@ import {
|
|
|
157
165
|
parseReference,
|
|
158
166
|
providerNamed,
|
|
159
167
|
rankingOptions
|
|
160
|
-
} from "./chunk-
|
|
168
|
+
} from "./chunk-234MHU76.js";
|
|
161
169
|
import {
|
|
162
170
|
TASK_KINDS,
|
|
163
171
|
TASK_ORIGINS,
|
|
164
172
|
TASK_STATES,
|
|
165
173
|
createTaskService
|
|
166
|
-
} from "./chunk-
|
|
174
|
+
} from "./chunk-PDGECM5D.js";
|
|
167
175
|
import {
|
|
168
176
|
MEETING_FINDINGS_KIND,
|
|
169
177
|
canonicalMeetingReference,
|
|
@@ -182,7 +190,7 @@ import {
|
|
|
182
190
|
validateMeetingHitSearch,
|
|
183
191
|
validateMeetingPassage,
|
|
184
192
|
validateMeetingSeriesHistory
|
|
185
|
-
} from "./chunk-
|
|
193
|
+
} from "./chunk-ZNZUZGSV.js";
|
|
186
194
|
import {
|
|
187
195
|
dateRange,
|
|
188
196
|
implicitTextTerms,
|
|
@@ -192,25 +200,25 @@ import {
|
|
|
192
200
|
timezoneOf,
|
|
193
201
|
validateQuery,
|
|
194
202
|
walkQuery
|
|
195
|
-
} from "./chunk-
|
|
203
|
+
} from "./chunk-NHBUTCNR.js";
|
|
196
204
|
import {
|
|
197
205
|
DEFAULT_STEMMERS,
|
|
198
206
|
createStemmer,
|
|
199
207
|
fold,
|
|
200
208
|
normalize
|
|
201
|
-
} from "./chunk-
|
|
209
|
+
} from "./chunk-7XKAVMCF.js";
|
|
202
210
|
import {
|
|
203
211
|
DEFAULT_TASK_CATEGORIES,
|
|
204
212
|
FALLBACK_CATEGORY
|
|
205
|
-
} from "./chunk-
|
|
213
|
+
} from "./chunk-XOLQSCMF.js";
|
|
206
214
|
import {
|
|
207
215
|
storePath,
|
|
208
216
|
wirecatDirectory
|
|
209
|
-
} from "./chunk-
|
|
217
|
+
} from "./chunk-VJZST5RD.js";
|
|
210
218
|
import {
|
|
211
219
|
resolvePaths,
|
|
212
220
|
singleLine
|
|
213
|
-
} from "./chunk-
|
|
221
|
+
} from "./chunk-HQVJK5E7.js";
|
|
214
222
|
import {
|
|
215
223
|
CliError,
|
|
216
224
|
array,
|
|
@@ -226,12 +234,12 @@ import {
|
|
|
226
234
|
safeParse,
|
|
227
235
|
strictObject,
|
|
228
236
|
string
|
|
229
|
-
} from "./chunk-
|
|
237
|
+
} from "./chunk-YKZ4IPLB.js";
|
|
230
238
|
import {
|
|
231
239
|
__name
|
|
232
240
|
} from "./chunk-ZVVMGPBJ.js";
|
|
233
241
|
|
|
234
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
242
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/deps.js
|
|
235
243
|
var accountStore = /* @__PURE__ */ __name(async (deps) => (await deps.store()).forAccount(await deps.account()), "accountStore");
|
|
236
244
|
var crossAccount = /* @__PURE__ */ __name((deps, _reason) => deps.store(), "crossAccount");
|
|
237
245
|
var NO_LOCAL_STORE = "this answer comes from the messenger, not from the local store";
|
|
@@ -309,7 +317,7 @@ var storeOnlyDeps = /* @__PURE__ */ __name((store, account2, { app, env }) => {
|
|
|
309
317
|
return { ...storedDeps(messenger, store, account2, guard), ...env === void 0 ? {} : { env } };
|
|
310
318
|
}, "storeOnlyDeps");
|
|
311
319
|
|
|
312
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
320
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/botcheck/check.js
|
|
313
321
|
var DAY_MS = 864e5;
|
|
314
322
|
var NEW_DAYS = 30;
|
|
315
323
|
var SAME_TEXT_MIN = 20;
|
|
@@ -386,7 +394,7 @@ var scorePerson = /* @__PURE__ */ __name(({ subject, provider, activity, photos,
|
|
|
386
394
|
};
|
|
387
395
|
}, "scorePerson");
|
|
388
396
|
|
|
389
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
397
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/botcheck/registries.js
|
|
390
398
|
var REGISTRIES = {
|
|
391
399
|
cas: { title: "Combot Anti-Spam (CAS)", docs: "https://cas.chat/api" },
|
|
392
400
|
lols: { title: "lols.bot", docs: "https://api.lols.bot/lols-bot.json" }
|
|
@@ -471,7 +479,7 @@ var notCovered = /* @__PURE__ */ __name((messenger, now = /* @__PURE__ */ new Da
|
|
|
471
479
|
detail: `lists Telegram accounts only, not ${messenger} ones`
|
|
472
480
|
})), "notCovered");
|
|
473
481
|
|
|
474
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
482
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/botcheck/service.js
|
|
475
483
|
var ACTIVITY_MESSAGES = 1e3;
|
|
476
484
|
var botCheckService = /* @__PURE__ */ __name((deps) => {
|
|
477
485
|
const subjectOf = /* @__PURE__ */ __name(async (reference) => {
|
|
@@ -559,7 +567,33 @@ var botCheckService = /* @__PURE__ */ __name((deps) => {
|
|
|
559
567
|
};
|
|
560
568
|
}, "botCheckService");
|
|
561
569
|
|
|
562
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
570
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/chat-coverage.js
|
|
571
|
+
var chatCoverage = /* @__PURE__ */ __name(async (store, account2, chatIds) => {
|
|
572
|
+
const ids = [...new Set(chatIds)];
|
|
573
|
+
if (ids.length === 0)
|
|
574
|
+
return [];
|
|
575
|
+
const found = new Map((await store.chats.chatCompleteness(account2, ids)).map((one) => [one.chatId, one]));
|
|
576
|
+
return Promise.all(ids.map(async (chatId) => {
|
|
577
|
+
const [stats] = await store.chats.chatStats(account2, chatId);
|
|
578
|
+
const title = stats?.title ?? await store.chats.chatTitle(account2, chatId);
|
|
579
|
+
const completeness = found.get(chatId) ?? {
|
|
580
|
+
chatId,
|
|
581
|
+
state: "unknown",
|
|
582
|
+
upToDate: null,
|
|
583
|
+
gaps: false,
|
|
584
|
+
reachesStart: false,
|
|
585
|
+
fetchedAt: null
|
|
586
|
+
};
|
|
587
|
+
return {
|
|
588
|
+
chatId,
|
|
589
|
+
title,
|
|
590
|
+
completeness,
|
|
591
|
+
held: { messages: stats?.messages ?? 0, oldestAt: stats?.oldestAt ?? null, newestAt: stats?.newestAt ?? null }
|
|
592
|
+
};
|
|
593
|
+
}));
|
|
594
|
+
}, "chatCoverage");
|
|
595
|
+
|
|
596
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/context/evidence-response.js
|
|
563
597
|
var contextSourceKey = /* @__PURE__ */ __name((source) => JSON.stringify([source.kind, source.accountId, source.provider, source.account]), "contextSourceKey");
|
|
564
598
|
var validateContextEvidencePage = /* @__PURE__ */ __name((page, request) => {
|
|
565
599
|
const fail3 = /* @__PURE__ */ __name(() => {
|
|
@@ -623,7 +657,7 @@ var validateContextEvidencePage = /* @__PURE__ */ __name((page, request) => {
|
|
|
623
657
|
}
|
|
624
658
|
}, "validateContextEvidencePage");
|
|
625
659
|
|
|
626
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
660
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/context/read-budget.js
|
|
627
661
|
var contextReadBudget = /* @__PURE__ */ __name((limits = {}) => {
|
|
628
662
|
if (!limits || typeof limits !== "object" || Array.isArray(limits))
|
|
629
663
|
throw new CliError("validation_error", "limits needs a context read allowance");
|
|
@@ -676,7 +710,7 @@ var contextReadBudget = /* @__PURE__ */ __name((limits = {}) => {
|
|
|
676
710
|
};
|
|
677
711
|
}, "contextReadBudget");
|
|
678
712
|
|
|
679
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
713
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/context-evidence.js
|
|
680
714
|
var createContextEvidenceReader = /* @__PURE__ */ __name((port, allowed, limits) => {
|
|
681
715
|
if (!port || typeof port.read !== "function")
|
|
682
716
|
throw new CliError("configuration_error", "context evidence reader is unavailable");
|
|
@@ -720,7 +754,7 @@ var createContextEvidenceReader = /* @__PURE__ */ __name((port, allowed, limits)
|
|
|
720
754
|
};
|
|
721
755
|
}, "createContextEvidenceReader");
|
|
722
756
|
|
|
723
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
757
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/excerpt.js
|
|
724
758
|
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");
|
|
725
759
|
var excerpt = /* @__PURE__ */ __name((text2, query, size4 = 240, options = {}) => {
|
|
726
760
|
const flat = text2.replace(/\s+/g, " ").trim();
|
|
@@ -736,380 +770,18 @@ var excerpt = /* @__PURE__ */ __name((text2, query, size4 = 240, options = {}) =
|
|
|
736
770
|
}, "excerpt");
|
|
737
771
|
var withExcerpt = /* @__PURE__ */ __name(({ matchedText, ...hit }, query) => ({ ...hit, excerpt: excerpt(matchedText ?? hit.text, query) }), "withExcerpt");
|
|
738
772
|
|
|
739
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
773
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/media-archive.js
|
|
740
774
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
741
775
|
|
|
742
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
743
|
-
import { lstat
|
|
744
|
-
|
|
745
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.494.0_@wirecat+cli-base@0.65.5_commander@15.0.0_esbuild@0.28.2_type_231e74d5ae3bca45b1b0de971f6f7b9a/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
|
|
746
|
-
import { createHash as createHash2, randomUUID as randomUUID4 } from "node:crypto";
|
|
747
|
-
import { open as open5, rename as rename3, unlink as unlink6 } from "node:fs/promises";
|
|
748
|
-
import { join as join5 } from "node:path";
|
|
749
|
-
|
|
750
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.494.0_@wirecat+cli-base@0.65.5_commander@15.0.0_esbuild@0.28.2_type_231e74d5ae3bca45b1b0de971f6f7b9a/node_modules/@wirecat/cli-core/dist/files/atomic-write.js
|
|
751
|
-
import { randomUUID } from "node:crypto";
|
|
752
|
-
import { constants } from "node:fs";
|
|
753
|
-
import { link, open, realpath, rename, unlink } from "node:fs/promises";
|
|
754
|
-
import { basename, dirname, join } from "node:path";
|
|
755
|
-
var openFolder = /* @__PURE__ */ __name((folder) => process.platform === "win32" ? Promise.resolve(void 0) : open(folder, constants.O_RDONLY | (constants.O_DIRECTORY ?? 0) | (constants.O_NOFOLLOW ?? 0)), "openFolder");
|
|
756
|
-
var writeFileAtomic = /* @__PURE__ */ __name(async (path, content, { mode = 384, overwrite = true, signal, beforePublish } = {}) => {
|
|
757
|
-
signal?.throwIfAborted();
|
|
758
|
-
const folder = await realpath(dirname(path));
|
|
759
|
-
const target = join(folder, basename(path));
|
|
760
|
-
const directory = await openFolder(folder);
|
|
761
|
-
try {
|
|
762
|
-
const temporary = join(folder, `.${basename(path)}.${randomUUID()}.tmp`);
|
|
763
|
-
let handle = await open(temporary, "wx", mode);
|
|
764
|
-
let published = false;
|
|
765
|
-
try {
|
|
766
|
-
await handle.writeFile(content);
|
|
767
|
-
await handle.sync();
|
|
768
|
-
await handle.close();
|
|
769
|
-
handle = void 0;
|
|
770
|
-
signal?.throwIfAborted();
|
|
771
|
-
await beforePublish?.();
|
|
772
|
-
if (overwrite)
|
|
773
|
-
await rename(temporary, target);
|
|
774
|
-
else
|
|
775
|
-
await link(temporary, target);
|
|
776
|
-
published = overwrite;
|
|
777
|
-
await directory?.sync();
|
|
778
|
-
} finally {
|
|
779
|
-
await handle?.close().catch(() => void 0);
|
|
780
|
-
if (!published)
|
|
781
|
-
await unlink(temporary).catch(() => void 0);
|
|
782
|
-
}
|
|
783
|
-
} finally {
|
|
784
|
-
await directory?.close().catch(() => void 0);
|
|
785
|
-
}
|
|
786
|
-
}, "writeFileAtomic");
|
|
787
|
-
|
|
788
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.494.0_@wirecat+cli-base@0.65.5_commander@15.0.0_esbuild@0.28.2_type_231e74d5ae3bca45b1b0de971f6f7b9a/node_modules/@wirecat/cli-core/dist/files/ordinary-file.js
|
|
789
|
-
import { constants as constants2 } from "node:fs";
|
|
790
|
-
import { lstat, open as open2 } from "node:fs/promises";
|
|
791
|
-
var deviceOf = /* @__PURE__ */ __name((dev) => process.platform === "win32" ? BigInt.asUintN(32, dev) : dev, "deviceOf");
|
|
792
|
-
var sameIdentity = /* @__PURE__ */ __name((left, right) => left.ino === right.ino && deviceOf(left.dev) === deviceOf(right.dev), "sameIdentity");
|
|
793
|
-
var openOrdinaryFile = /* @__PURE__ */ __name(async (path, options = {}) => {
|
|
794
|
-
const before2 = await lstat(path, { bigint: true });
|
|
795
|
-
if (before2.isSymbolicLink())
|
|
796
|
-
throw new CliError("validation_error", "archive path must be an ordinary file without a symlink");
|
|
797
|
-
if (!before2.isFile())
|
|
798
|
-
throw new CliError("validation_error", "archive path must be an ordinary file");
|
|
799
|
-
const access = options.writable ? constants2.O_RDWR : constants2.O_RDONLY;
|
|
800
|
-
const flags = process.platform === "win32" ? access : access | (constants2.O_NOFOLLOW ?? 0) | (constants2.O_NONBLOCK ?? 0);
|
|
801
|
-
const file = await open2(path, flags);
|
|
802
|
-
try {
|
|
803
|
-
const opened = await file.stat({ bigint: true });
|
|
804
|
-
const after = await lstat(path, { bigint: true });
|
|
805
|
-
if (!opened.isFile() || !after.isFile() || before2.ino !== opened.ino || before2.ino !== after.ino)
|
|
806
|
-
throw new CliError("validation_error", "archive file changed while opening");
|
|
807
|
-
if (process.platform === "win32" && before2.dev === 0n && after.dev === 0n) {
|
|
808
|
-
const witness = await open2(path, flags);
|
|
809
|
-
try {
|
|
810
|
-
const identified = await witness.stat({ bigint: true });
|
|
811
|
-
const final = await lstat(path, { bigint: true });
|
|
812
|
-
if (opened.dev === 0n || !identified.isFile() || !final.isFile() || !sameIdentity(identified, opened) || final.ino !== before2.ino || final.dev !== 0n && deviceOf(final.dev) !== deviceOf(opened.dev))
|
|
813
|
-
throw new CliError("validation_error", "archive file changed while opening");
|
|
814
|
-
} finally {
|
|
815
|
-
await witness.close();
|
|
816
|
-
}
|
|
817
|
-
} else if (deviceOf(before2.dev) !== deviceOf(opened.dev) || deviceOf(before2.dev) !== deviceOf(after.dev)) {
|
|
818
|
-
throw new CliError("validation_error", "archive file changed while opening");
|
|
819
|
-
}
|
|
820
|
-
return file;
|
|
821
|
-
} catch (error) {
|
|
822
|
-
await file.close();
|
|
823
|
-
throw error;
|
|
824
|
-
}
|
|
825
|
-
}, "openOrdinaryFile");
|
|
826
|
-
var sameOrdinaryFile = /* @__PURE__ */ __name(async (path, created) => {
|
|
827
|
-
let file;
|
|
828
|
-
try {
|
|
829
|
-
file = await openOrdinaryFile(path);
|
|
830
|
-
} catch (error) {
|
|
831
|
-
if (error instanceof CliError || typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
|
|
832
|
-
return false;
|
|
833
|
-
throw error;
|
|
834
|
-
}
|
|
835
|
-
try {
|
|
836
|
-
return sameIdentity(created, await file.stat({ bigint: true }));
|
|
837
|
-
} finally {
|
|
838
|
-
await file.close();
|
|
839
|
-
}
|
|
840
|
-
}, "sameOrdinaryFile");
|
|
841
|
-
var syncDirectory = /* @__PURE__ */ __name(async (path) => {
|
|
842
|
-
if (process.platform === "win32")
|
|
843
|
-
return;
|
|
844
|
-
const directory = await open2(path, constants2.O_RDONLY | (constants2.O_DIRECTORY ?? 0) | (constants2.O_NOFOLLOW ?? 0));
|
|
845
|
-
try {
|
|
846
|
-
if (!(await directory.stat()).isDirectory())
|
|
847
|
-
throw new CliError("validation_error", "archive publication directory must be ordinary");
|
|
848
|
-
await directory.sync();
|
|
849
|
-
} finally {
|
|
850
|
-
await directory.close();
|
|
851
|
-
}
|
|
852
|
-
}, "syncDirectory");
|
|
853
|
-
|
|
854
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.494.0_@wirecat+cli-base@0.65.5_commander@15.0.0_esbuild@0.28.2_type_231e74d5ae3bca45b1b0de971f6f7b9a/node_modules/@wirecat/cli-core/dist/files/bounded-utf8.js
|
|
855
|
-
var readBoundedUtf8File = /* @__PURE__ */ __name(async (path, { maxBytes }) => {
|
|
856
|
-
if (!Number.isSafeInteger(maxBytes) || maxBytes < 1 || maxBytes > 16 * 1024 * 1024)
|
|
857
|
-
throw new CliError("validation_error", "file maxBytes takes 1\u201316777216 bytes");
|
|
858
|
-
const file = await openOrdinaryFile(path);
|
|
859
|
-
try {
|
|
860
|
-
if ((await file.stat()).size > maxBytes)
|
|
861
|
-
throw new CliError("validation_error", "input file exceeds its byte budget");
|
|
862
|
-
const chunks = [], buffer = Buffer.alloc(Math.min(65536, maxBytes + 1));
|
|
863
|
-
let bytes2 = 0;
|
|
864
|
-
for (; ; ) {
|
|
865
|
-
const { bytesRead } = await file.read(buffer, 0, Math.min(buffer.length, maxBytes - bytes2 + 1), null);
|
|
866
|
-
if (bytesRead === 0)
|
|
867
|
-
break;
|
|
868
|
-
bytes2 += bytesRead;
|
|
869
|
-
if (bytes2 > maxBytes)
|
|
870
|
-
throw new CliError("validation_error", "input file exceeds its byte budget");
|
|
871
|
-
chunks.push(Buffer.from(buffer.subarray(0, bytesRead)));
|
|
872
|
-
}
|
|
873
|
-
try {
|
|
874
|
-
return new TextDecoder("utf-8", { fatal: true }).decode(Buffer.concat(chunks, bytes2));
|
|
875
|
-
} catch {
|
|
876
|
-
throw new CliError("validation_error", "input file must contain valid UTF-8");
|
|
877
|
-
}
|
|
878
|
-
} finally {
|
|
879
|
-
await file.close();
|
|
880
|
-
}
|
|
881
|
-
}, "readBoundedUtf8File");
|
|
882
|
-
|
|
883
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.494.0_@wirecat+cli-base@0.65.5_commander@15.0.0_esbuild@0.28.2_type_231e74d5ae3bca45b1b0de971f6f7b9a/node_modules/@wirecat/cli-core/dist/files/lock.js
|
|
884
|
-
import { mkdir as mkdir2 } from "node:fs/promises";
|
|
885
|
-
import { basename as basename2, dirname as dirname2 } from "node:path";
|
|
886
|
-
|
|
887
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.494.0_@wirecat+cli-base@0.65.5_commander@15.0.0_esbuild@0.28.2_type_231e74d5ae3bca45b1b0de971f6f7b9a/node_modules/@wirecat/cli-core/dist/files/native-writer-lease.js
|
|
888
|
-
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
889
|
-
import { lstat as lstat3, mkdir, open as open3, realpath as realpath3, rmdir as rmdir2, unlink as unlink4 } from "node:fs/promises";
|
|
890
|
-
import { hostname as hostname2 } from "node:os";
|
|
891
|
-
import { join as join3 } from "node:path";
|
|
776
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
|
|
777
|
+
import { lstat } from "node:fs/promises";
|
|
892
778
|
|
|
893
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
894
|
-
import {
|
|
779
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
|
|
780
|
+
import { createHash as createHash2, randomUUID as randomUUID2 } from "node:crypto";
|
|
781
|
+
import { open as open2, rename as rename2, unlink as unlink2 } from "node:fs/promises";
|
|
895
782
|
import { join as join2 } from "node:path";
|
|
896
783
|
|
|
897
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
898
|
-
import { hostname } from "node:os";
|
|
899
|
-
var missingLeaseFile = /* @__PURE__ */ __name((error) => typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT", "missingLeaseFile");
|
|
900
|
-
var readLeaseOwner = /* @__PURE__ */ __name(async (path, name, signal) => {
|
|
901
|
-
signal?.throwIfAborted();
|
|
902
|
-
try {
|
|
903
|
-
const file = await openOrdinaryFile(path);
|
|
904
|
-
try {
|
|
905
|
-
if ((await file.stat()).size > 4096)
|
|
906
|
-
return null;
|
|
907
|
-
const buffer = Buffer.alloc(4097);
|
|
908
|
-
let size4 = 0;
|
|
909
|
-
while (size4 < buffer.length) {
|
|
910
|
-
signal?.throwIfAborted();
|
|
911
|
-
const { bytesRead } = await file.read(buffer, size4, buffer.length - size4, size4);
|
|
912
|
-
if (bytesRead === 0)
|
|
913
|
-
break;
|
|
914
|
-
size4 += bytesRead;
|
|
915
|
-
}
|
|
916
|
-
signal?.throwIfAborted();
|
|
917
|
-
if (size4 > 4096)
|
|
918
|
-
return null;
|
|
919
|
-
const owner = JSON.parse(buffer.subarray(0, size4).toString("utf8"));
|
|
920
|
-
if (owner?.version !== 1 || !Number.isSafeInteger(owner.pid) || owner.pid <= 0 || typeof owner.host !== "string" || !owner.host.trim() || !/^[a-f0-9-]{36}$/.test(owner.nonce) || name !== `${owner.pid}-${owner.nonce}.json`)
|
|
921
|
-
return null;
|
|
922
|
-
return owner;
|
|
923
|
-
} finally {
|
|
924
|
-
await file.close();
|
|
925
|
-
}
|
|
926
|
-
} catch {
|
|
927
|
-
signal?.throwIfAborted();
|
|
928
|
-
return null;
|
|
929
|
-
}
|
|
930
|
-
}, "readLeaseOwner");
|
|
931
|
-
var leaseOwnerStatus = /* @__PURE__ */ __name((owner) => {
|
|
932
|
-
if (owner.host !== hostname())
|
|
933
|
-
return "foreign";
|
|
934
|
-
try {
|
|
935
|
-
process.kill(owner.pid, 0);
|
|
936
|
-
return "active";
|
|
937
|
-
} catch (error) {
|
|
938
|
-
return typeof error === "object" && error !== null && "code" in error && error.code === "ESRCH" ? "stale" : "active";
|
|
939
|
-
}
|
|
940
|
-
}, "leaseOwnerStatus");
|
|
941
|
-
|
|
942
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.494.0_@wirecat+cli-base@0.65.5_commander@15.0.0_esbuild@0.28.2_type_231e74d5ae3bca45b1b0de971f6f7b9a/node_modules/@wirecat/cli-core/dist/files/native-lease-inspection.js
|
|
943
|
-
var leaseInspection = /* @__PURE__ */ __name((markerDirectory) => {
|
|
944
|
-
const inspect = /* @__PURE__ */ __name(async (destination, options = {}) => {
|
|
945
|
-
options.signal?.throwIfAborted();
|
|
946
|
-
const root = await realpath2(destination);
|
|
947
|
-
options.signal?.throwIfAborted();
|
|
948
|
-
const folder = join2(root, markerDirectory);
|
|
949
|
-
let names2;
|
|
950
|
-
try {
|
|
951
|
-
if ((await lstat2(folder)).isSymbolicLink())
|
|
952
|
-
throw new Error("symlink");
|
|
953
|
-
names2 = await readdir(folder);
|
|
954
|
-
} catch (error) {
|
|
955
|
-
options.signal?.throwIfAborted();
|
|
956
|
-
if (missingLeaseFile(error))
|
|
957
|
-
return [];
|
|
958
|
-
throw new CliError("configuration_error", "archive lock directory could not be read");
|
|
959
|
-
}
|
|
960
|
-
options.signal?.throwIfAborted();
|
|
961
|
-
const result = [];
|
|
962
|
-
for (const name of names2.sort()) {
|
|
963
|
-
options.signal?.throwIfAborted();
|
|
964
|
-
const owner = await readLeaseOwner(join2(folder, name), name, options.signal);
|
|
965
|
-
result.push({
|
|
966
|
-
name,
|
|
967
|
-
status: owner ? leaseOwnerStatus(owner) : "unrecognized",
|
|
968
|
-
pid: owner?.pid ?? null,
|
|
969
|
-
host: owner?.host ?? null
|
|
970
|
-
});
|
|
971
|
-
}
|
|
972
|
-
return result;
|
|
973
|
-
}, "inspect");
|
|
974
|
-
const recover = /* @__PURE__ */ __name(async (destination, options = {}) => {
|
|
975
|
-
options.signal?.throwIfAborted();
|
|
976
|
-
const root = await realpath2(destination);
|
|
977
|
-
const locks = await inspect(root, options);
|
|
978
|
-
const removed = [];
|
|
979
|
-
if (options.apply)
|
|
980
|
-
for (const lock of locks) {
|
|
981
|
-
options.signal?.throwIfAborted();
|
|
982
|
-
if (lock.status !== "stale")
|
|
983
|
-
continue;
|
|
984
|
-
const path = join2(root, markerDirectory, lock.name);
|
|
985
|
-
const owner = await readLeaseOwner(path, lock.name, options.signal);
|
|
986
|
-
if (!owner || leaseOwnerStatus(owner) !== "stale")
|
|
987
|
-
continue;
|
|
988
|
-
try {
|
|
989
|
-
await unlink2(path);
|
|
990
|
-
removed.push(lock.name);
|
|
991
|
-
} catch (error) {
|
|
992
|
-
if (!missingLeaseFile(error))
|
|
993
|
-
throw new CliError("configuration_error", "stale archive lock could not be removed");
|
|
994
|
-
}
|
|
995
|
-
}
|
|
996
|
-
return { locks, removed };
|
|
997
|
-
}, "recover");
|
|
998
|
-
return { inspect, recover };
|
|
999
|
-
}, "leaseInspection");
|
|
1000
|
-
|
|
1001
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.494.0_@wirecat+cli-base@0.65.5_commander@15.0.0_esbuild@0.28.2_type_231e74d5ae3bca45b1b0de971f6f7b9a/node_modules/@wirecat/cli-core/dist/files/native-lease-release.js
|
|
1002
|
-
import { rmdir, unlink as unlink3 } from "node:fs/promises";
|
|
1003
|
-
var ownedNativeLease = /* @__PURE__ */ __name((path, name, owner, folder, identity) => {
|
|
1004
|
-
let releasing;
|
|
1005
|
-
const held = /* @__PURE__ */ __name(async () => {
|
|
1006
|
-
if (!await sameOrdinaryFile(path, identity))
|
|
1007
|
-
return false;
|
|
1008
|
-
const current = await readLeaseOwner(path, name);
|
|
1009
|
-
return current?.host === owner.host && current.pid === owner.pid && current.nonce === owner.nonce;
|
|
1010
|
-
}, "held");
|
|
1011
|
-
const release = /* @__PURE__ */ __name(async () => {
|
|
1012
|
-
if (!await held())
|
|
1013
|
-
throw new CliError("configuration_error", "owned archive lock changed before release");
|
|
1014
|
-
await unlink3(path);
|
|
1015
|
-
await rmdir(folder).catch(() => void 0);
|
|
1016
|
-
}, "release");
|
|
1017
|
-
return {
|
|
1018
|
-
held,
|
|
1019
|
-
release: /* @__PURE__ */ __name(() => releasing ??= release().catch((error) => {
|
|
1020
|
-
releasing = void 0;
|
|
1021
|
-
throw error;
|
|
1022
|
-
}), "release")
|
|
1023
|
-
};
|
|
1024
|
-
}, "ownedNativeLease");
|
|
1025
|
-
|
|
1026
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.494.0_@wirecat+cli-base@0.65.5_commander@15.0.0_esbuild@0.28.2_type_231e74d5ae3bca45b1b0de971f6f7b9a/node_modules/@wirecat/cli-core/dist/files/native-writer-lease.js
|
|
1027
|
-
var validName = /* @__PURE__ */ __name((value) => typeof value === "string" && value.length > 0 && value !== "." && value !== ".." && !/[\\/\0:]/.test(value), "validName");
|
|
1028
|
-
var nativeWriterLeaseStore = /* @__PURE__ */ __name((layout) => {
|
|
1029
|
-
const { markerDirectory, legacyMarker } = layout;
|
|
1030
|
-
if (!validName(markerDirectory) || legacyMarker !== void 0 && (!validName(legacyMarker) || legacyMarker === markerDirectory))
|
|
1031
|
-
throw new CliError("validation_error", "archive lock layout requires distinct ordinary entry names");
|
|
1032
|
-
const inspection = leaseInspection(markerDirectory);
|
|
1033
|
-
return {
|
|
1034
|
-
...inspection,
|
|
1035
|
-
acquire: /* @__PURE__ */ __name(async (destination, { signal } = {}) => {
|
|
1036
|
-
signal?.throwIfAborted();
|
|
1037
|
-
const root = await realpath3(destination);
|
|
1038
|
-
signal?.throwIfAborted();
|
|
1039
|
-
const folder = join3(root, markerDirectory);
|
|
1040
|
-
const owner = { version: 1, pid: process.pid, host: hostname2(), nonce: randomUUID2() };
|
|
1041
|
-
const name = `${owner.pid}-${owner.nonce}.json`;
|
|
1042
|
-
const path = join3(folder, name);
|
|
1043
|
-
const marker = /* @__PURE__ */ __name(async (attempt = 1) => {
|
|
1044
|
-
await mkdir(folder, { recursive: true });
|
|
1045
|
-
try {
|
|
1046
|
-
if ((await lstat3(folder)).isSymbolicLink())
|
|
1047
|
-
throw new CliError("validation_error", "archive lock directory must not be a symlink");
|
|
1048
|
-
await inspection.recover(root, { apply: true, signal });
|
|
1049
|
-
signal?.throwIfAborted();
|
|
1050
|
-
return await open3(path, "wx", 384);
|
|
1051
|
-
} catch (error) {
|
|
1052
|
-
if (attempt < 5 && missingLeaseFile(error))
|
|
1053
|
-
return marker(attempt + 1);
|
|
1054
|
-
throw error;
|
|
1055
|
-
}
|
|
1056
|
-
}, "marker");
|
|
1057
|
-
const file = await marker();
|
|
1058
|
-
let retained = false;
|
|
1059
|
-
let identity;
|
|
1060
|
-
try {
|
|
1061
|
-
identity = await file.stat({ bigint: true });
|
|
1062
|
-
await file.writeFile(JSON.stringify(owner));
|
|
1063
|
-
await file.sync();
|
|
1064
|
-
await file.close();
|
|
1065
|
-
signal?.throwIfAborted();
|
|
1066
|
-
const inspected = await inspection.inspect(root, { signal });
|
|
1067
|
-
const own = inspected.find((lock) => lock.name === name);
|
|
1068
|
-
if (own?.status !== "active" || own.pid !== owner.pid || own.host !== owner.host)
|
|
1069
|
-
throw new CliError("configuration_error", "archive writer lost its lock before acquisition");
|
|
1070
|
-
const locks = inspected.filter((lock) => lock.name !== name);
|
|
1071
|
-
if (locks.length)
|
|
1072
|
-
return { status: "busy", locks };
|
|
1073
|
-
if (legacyMarker) {
|
|
1074
|
-
try {
|
|
1075
|
-
await lstat3(join3(root, legacyMarker));
|
|
1076
|
-
return { status: "legacy" };
|
|
1077
|
-
} catch (error) {
|
|
1078
|
-
if (!missingLeaseFile(error))
|
|
1079
|
-
throw error;
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
signal?.throwIfAborted();
|
|
1083
|
-
retained = true;
|
|
1084
|
-
return { status: "acquired", lease: ownedNativeLease(path, name, owner, folder, identity) };
|
|
1085
|
-
} finally {
|
|
1086
|
-
await file.close().catch(() => void 0);
|
|
1087
|
-
if (!retained) {
|
|
1088
|
-
if (identity && await sameOrdinaryFile(path, identity))
|
|
1089
|
-
await unlink4(path).catch(() => void 0);
|
|
1090
|
-
await rmdir2(folder).catch(() => void 0);
|
|
1091
|
-
}
|
|
1092
|
-
}
|
|
1093
|
-
}, "acquire")
|
|
1094
|
-
};
|
|
1095
|
-
}, "nativeWriterLeaseStore");
|
|
1096
|
-
|
|
1097
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.494.0_@wirecat+cli-base@0.65.5_commander@15.0.0_esbuild@0.28.2_type_231e74d5ae3bca45b1b0de971f6f7b9a/node_modules/@wirecat/cli-core/dist/files/lock.js
|
|
1098
|
-
var acquireLock = /* @__PURE__ */ __name(async (path, { signal } = {}) => {
|
|
1099
|
-
const folder = dirname2(path);
|
|
1100
|
-
await mkdir2(folder, { recursive: true, mode: 448 });
|
|
1101
|
-
const acquired = await nativeWriterLeaseStore({ markerDirectory: basename2(path) }).acquire(folder, {
|
|
1102
|
-
...signal ? { signal } : {}
|
|
1103
|
-
});
|
|
1104
|
-
if (acquired.status === "acquired")
|
|
1105
|
-
return acquired.lease;
|
|
1106
|
-
throw new CliError("validation_error", `${basename2(path)} is locked by another process`, {
|
|
1107
|
-
reason: "file.locked",
|
|
1108
|
-
...acquired.status === "busy" ? { holders: acquired.locks } : {}
|
|
1109
|
-
});
|
|
1110
|
-
}, "acquireLock");
|
|
1111
|
-
|
|
1112
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.494.0_@wirecat+cli-base@0.65.5_commander@15.0.0_esbuild@0.28.2_type_231e74d5ae3bca45b1b0de971f6f7b9a/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-metadata.js
|
|
784
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-metadata.js
|
|
1113
785
|
import { createHash } from "node:crypto";
|
|
1114
786
|
var metadataLimit = 16384;
|
|
1115
787
|
var partialIdentity = /* @__PURE__ */ __name((locator) => JSON.stringify([locator.provider, locator.account, locator.occurrenceId, locator.assetId]), "partialIdentity");
|
|
@@ -1169,10 +841,10 @@ var readPartialMetadata = /* @__PURE__ */ __name(async (path, locator, maxBytes,
|
|
|
1169
841
|
}
|
|
1170
842
|
}, "readPartialMetadata");
|
|
1171
843
|
|
|
1172
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1173
|
-
import { randomUUID
|
|
1174
|
-
import { open
|
|
1175
|
-
import { join
|
|
844
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-writer.js
|
|
845
|
+
import { randomUUID } from "node:crypto";
|
|
846
|
+
import { open, rename, unlink } from "node:fs/promises";
|
|
847
|
+
import { join } from "node:path";
|
|
1176
848
|
var partialWriter = /* @__PURE__ */ __name(async (input) => {
|
|
1177
849
|
const { file, signal, partial } = input;
|
|
1178
850
|
const owned = await file.stat({ bigint: true });
|
|
@@ -1198,8 +870,8 @@ var partialWriter = /* @__PURE__ */ __name(async (input) => {
|
|
|
1198
870
|
const content = JSON.stringify({ ...partial, offset: size4, sha256: hash3.copy().digest("hex") });
|
|
1199
871
|
if (Buffer.byteLength(content) > metadataLimit)
|
|
1200
872
|
throw new CliError("validation_error", "recording partial metadata exceeds its byte limit");
|
|
1201
|
-
const temp =
|
|
1202
|
-
const metadata = await
|
|
873
|
+
const temp = join(input.root, `${input.prefix}${randomUUID()}.tmp`);
|
|
874
|
+
const metadata = await open(temp, "wx", 384);
|
|
1203
875
|
try {
|
|
1204
876
|
try {
|
|
1205
877
|
await metadata.writeFile(content);
|
|
@@ -1208,11 +880,11 @@ var partialWriter = /* @__PURE__ */ __name(async (input) => {
|
|
|
1208
880
|
await metadata.close();
|
|
1209
881
|
}
|
|
1210
882
|
await usable();
|
|
1211
|
-
await
|
|
883
|
+
await rename(temp, input.metadataPath);
|
|
1212
884
|
await syncDirectory(input.root);
|
|
1213
885
|
signal?.throwIfAborted();
|
|
1214
886
|
} finally {
|
|
1215
|
-
await
|
|
887
|
+
await unlink(temp).catch((error) => {
|
|
1216
888
|
if (!missing(error))
|
|
1217
889
|
throw error;
|
|
1218
890
|
});
|
|
@@ -1261,7 +933,7 @@ var partialWriter = /* @__PURE__ */ __name(async (input) => {
|
|
|
1261
933
|
};
|
|
1262
934
|
}, "partialWriter");
|
|
1263
935
|
|
|
1264
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
936
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/persistence/native/recording-partial-store.js
|
|
1265
937
|
var NativeRecordingPartialStore = class {
|
|
1266
938
|
static {
|
|
1267
939
|
__name(this, "NativeRecordingPartialStore");
|
|
@@ -1283,9 +955,9 @@ var NativeRecordingPartialStore = class {
|
|
|
1283
955
|
this.options = Object.freeze({ ...options });
|
|
1284
956
|
if (typeof root !== "string" || !root || root.includes("\0") || !/^\.[a-zA-Z0-9][a-zA-Z0-9._-]{0,95}-$/.test(options.prefix) || typeof options.persistent !== "boolean" || !Number.isSafeInteger(options.maxBytes) || options.maxBytes <= 0 || Object.values(this.locator).some((value) => typeof value !== "string" || !value.trim() || /[\0\r\n]/.test(value)))
|
|
1285
957
|
throw new CliError("validation_error", "invalid native recording partial options");
|
|
1286
|
-
const key = options.persistent ? createHash2("sha256").update(partialIdentity(this.locator)).digest("hex") :
|
|
1287
|
-
this.path =
|
|
1288
|
-
this.metadataPath =
|
|
958
|
+
const key = options.persistent ? createHash2("sha256").update(partialIdentity(this.locator)).digest("hex") : randomUUID2();
|
|
959
|
+
this.path = join2(root, `${options.prefix}${key}.part`);
|
|
960
|
+
this.metadataPath = join2(root, `${options.prefix}${key}.json`);
|
|
1289
961
|
}
|
|
1290
962
|
scope(locator) {
|
|
1291
963
|
if (partialIdentity(locator) !== partialIdentity(this.locator))
|
|
@@ -1326,17 +998,17 @@ var NativeRecordingPartialStore = class {
|
|
|
1326
998
|
if (resume) {
|
|
1327
999
|
file = await openOrdinaryFile(this.path, { writable: true });
|
|
1328
1000
|
} else {
|
|
1329
|
-
const temp =
|
|
1330
|
-
file = await
|
|
1001
|
+
const temp = join2(this.root, `${this.options.prefix}${randomUUID2()}.tmp`);
|
|
1002
|
+
file = await open2(temp, "wx+", 384);
|
|
1331
1003
|
try {
|
|
1332
|
-
await
|
|
1333
|
-
await
|
|
1004
|
+
await rename2(temp, this.path);
|
|
1005
|
+
await unlink2(this.metadataPath).catch((error) => {
|
|
1334
1006
|
if (!missing(error))
|
|
1335
1007
|
throw error;
|
|
1336
1008
|
});
|
|
1337
1009
|
} catch (error) {
|
|
1338
1010
|
await file.close();
|
|
1339
|
-
await
|
|
1011
|
+
await unlink2(temp).catch(() => void 0);
|
|
1340
1012
|
throw error;
|
|
1341
1013
|
}
|
|
1342
1014
|
}
|
|
@@ -1368,13 +1040,13 @@ var NativeRecordingPartialStore = class {
|
|
|
1368
1040
|
}
|
|
1369
1041
|
};
|
|
1370
1042
|
|
|
1371
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1043
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
|
|
1372
1044
|
import { createHash as createHash3 } from "node:crypto";
|
|
1373
|
-
import { link
|
|
1374
|
-
import { basename
|
|
1045
|
+
import { link } from "node:fs/promises";
|
|
1046
|
+
import { basename, dirname, join as join4, resolve } from "node:path";
|
|
1375
1047
|
|
|
1376
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1377
|
-
import { unlink as
|
|
1048
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-files.js
|
|
1049
|
+
import { unlink as unlink3 } from "node:fs/promises";
|
|
1378
1050
|
var verifiedPublicationFile = /* @__PURE__ */ __name(async (path, expected, signal, writable = false) => {
|
|
1379
1051
|
signal?.throwIfAborted();
|
|
1380
1052
|
const file = await openOrdinaryFile(path, { writable });
|
|
@@ -1403,15 +1075,15 @@ var commitPublication = /* @__PURE__ */ __name(async (root, partialPath, finalPa
|
|
|
1403
1075
|
signal?.throwIfAborted();
|
|
1404
1076
|
await assertPublicationIdentity(finalPath, final);
|
|
1405
1077
|
await assertPublicationIdentity(partialPath, partial);
|
|
1406
|
-
await
|
|
1078
|
+
await unlink3(partialPath);
|
|
1407
1079
|
await syncDirectory(root);
|
|
1408
1080
|
signal?.throwIfAborted();
|
|
1409
1081
|
}, "commitPublication");
|
|
1410
1082
|
|
|
1411
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1412
|
-
import { randomUUID as
|
|
1413
|
-
import { open as
|
|
1414
|
-
import { join as
|
|
1083
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication-journal.js
|
|
1084
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
1085
|
+
import { open as open3, rename as rename3, unlink as unlink4 } from "node:fs/promises";
|
|
1086
|
+
import { join as join3 } from "node:path";
|
|
1415
1087
|
var readPublicationJournal = /* @__PURE__ */ __name(async (path, codec, limit, signal) => {
|
|
1416
1088
|
signal?.throwIfAborted();
|
|
1417
1089
|
let file;
|
|
@@ -1455,8 +1127,8 @@ var writePublicationJournal = /* @__PURE__ */ __name(async (root, path, prefix,
|
|
|
1455
1127
|
if (Buffer.byteLength(content) > limit)
|
|
1456
1128
|
throw new CliError("validation_error", "recording recovery record exceeds its metadata limit");
|
|
1457
1129
|
codec.decode(JSON.parse(content));
|
|
1458
|
-
const temp =
|
|
1459
|
-
const handle = await
|
|
1130
|
+
const temp = join3(root, `${prefix}${randomUUID3()}.tmp`);
|
|
1131
|
+
const handle = await open3(temp, "wx", 384);
|
|
1460
1132
|
let identity;
|
|
1461
1133
|
try {
|
|
1462
1134
|
try {
|
|
@@ -1469,19 +1141,19 @@ var writePublicationJournal = /* @__PURE__ */ __name(async (root, path, prefix,
|
|
|
1469
1141
|
signal?.throwIfAborted();
|
|
1470
1142
|
if (!identity || !await sameOrdinaryFile(temp, identity))
|
|
1471
1143
|
throw new CliError("validation_error", "recording publication journal changed");
|
|
1472
|
-
await
|
|
1144
|
+
await rename3(temp, path);
|
|
1473
1145
|
await syncDirectory(root);
|
|
1474
1146
|
signal?.throwIfAborted();
|
|
1475
1147
|
} finally {
|
|
1476
1148
|
if (identity && await sameOrdinaryFile(temp, identity))
|
|
1477
|
-
await
|
|
1149
|
+
await unlink4(temp).catch((error) => {
|
|
1478
1150
|
if (!missing(error))
|
|
1479
1151
|
throw error;
|
|
1480
1152
|
});
|
|
1481
1153
|
}
|
|
1482
1154
|
}, "writePublicationJournal");
|
|
1483
1155
|
|
|
1484
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1156
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/persistence/native/recording-publication.js
|
|
1485
1157
|
var NativeRecordingPublication = class {
|
|
1486
1158
|
static {
|
|
1487
1159
|
__name(this, "NativeRecordingPublication");
|
|
@@ -1493,12 +1165,12 @@ var NativeRecordingPublication = class {
|
|
|
1493
1165
|
options;
|
|
1494
1166
|
constructor(root, locator, options) {
|
|
1495
1167
|
this.root = root;
|
|
1496
|
-
if (!root || root.includes("\0") || !/^\.[a-zA-Z0-9][a-zA-Z0-9._-]{0,95}-$/.test(options.prefix) || !options.filename ||
|
|
1168
|
+
if (!root || root.includes("\0") || !/^\.[a-zA-Z0-9][a-zA-Z0-9._-]{0,95}-$/.test(options.prefix) || !options.filename || basename(options.filename) !== options.filename || /[\\/\0]/.test(options.filename) || [".", ".."].includes(options.filename) || !Number.isSafeInteger(options.maxBytes) || options.maxBytes <= 0 || !Number.isSafeInteger(options.metadataLimit) || options.metadataLimit <= 0 || options.metadataLimit > 1048576 || [locator.provider, locator.account, locator.occurrenceId, locator.assetId].some((value) => typeof value !== "string" || !value.trim() || /[\0\r\n]/.test(value)))
|
|
1497
1169
|
throw new CliError("validation_error", "invalid native recording publication options");
|
|
1498
1170
|
this.scope = partialIdentity(locator);
|
|
1499
1171
|
this.options = Object.freeze({ ...options, codec: Object.freeze({ ...options.codec }) });
|
|
1500
|
-
this.journalPath =
|
|
1501
|
-
this.finalPath =
|
|
1172
|
+
this.journalPath = join4(root, `${options.prefix}${createHash3("sha256").update(this.scope).digest("hex")}.json`);
|
|
1173
|
+
this.finalPath = join4(root, options.filename);
|
|
1502
1174
|
if (this.finalPath === this.journalPath)
|
|
1503
1175
|
throw new CliError("validation_error", "recording publication paths must be distinct");
|
|
1504
1176
|
}
|
|
@@ -1509,7 +1181,7 @@ var NativeRecordingPublication = class {
|
|
|
1509
1181
|
return writePublicationJournal(this.root, this.journalPath, this.options.prefix, value, this.options.codec, this.options.metadataLimit, this.options.signal);
|
|
1510
1182
|
}
|
|
1511
1183
|
validate(partialPath, expected) {
|
|
1512
|
-
if (resolve(
|
|
1184
|
+
if (resolve(dirname(partialPath)) !== resolve(this.root) || resolve(partialPath) === resolve(this.finalPath) || resolve(partialPath) === resolve(this.journalPath) || !Number.isSafeInteger(expected.size) || expected.size < 0 || expected.size > this.options.maxBytes || typeof expected.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(expected.sha256))
|
|
1513
1185
|
throw new CliError("validation_error", "invalid recording publication evidence");
|
|
1514
1186
|
this.options.signal?.throwIfAborted();
|
|
1515
1187
|
}
|
|
@@ -1521,7 +1193,7 @@ var NativeRecordingPublication = class {
|
|
|
1521
1193
|
await partial.sync();
|
|
1522
1194
|
this.options.signal?.throwIfAborted();
|
|
1523
1195
|
await assertPublicationIdentity(partialPath, partial);
|
|
1524
|
-
await
|
|
1196
|
+
await link(partialPath, this.finalPath);
|
|
1525
1197
|
await assertPublicationIdentity(this.finalPath, partial);
|
|
1526
1198
|
await commitPublication(this.root, partialPath, this.finalPath, partial, partial, commit, this.options.signal);
|
|
1527
1199
|
} finally {
|
|
@@ -1554,10 +1226,10 @@ var NativeRecordingPublication = class {
|
|
|
1554
1226
|
}
|
|
1555
1227
|
};
|
|
1556
1228
|
|
|
1557
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1229
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/media-archive-manifest.js
|
|
1558
1230
|
import { createHash as createHash4 } from "node:crypto";
|
|
1559
|
-
import { readdir
|
|
1560
|
-
import { isAbsolute, join as
|
|
1231
|
+
import { readdir } from "node:fs/promises";
|
|
1232
|
+
import { isAbsolute, join as join5, resolve as resolve2 } from "node:path";
|
|
1561
1233
|
var mediaKey = /* @__PURE__ */ __name((one) => createHash4("sha256").update(JSON.stringify([one.provider, one.account, one.chat, one.message, one.position])).digest("hex"), "mediaKey");
|
|
1562
1234
|
var mediaManifestName = /* @__PURE__ */ __name((one) => `.media-archive-${mediaKey(one)}.json`, "mediaManifestName");
|
|
1563
1235
|
var missingMediaFile = /* @__PURE__ */ __name((error) => typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT", "missingMediaFile");
|
|
@@ -1599,13 +1271,13 @@ var mediaFingerprint = /* @__PURE__ */ __name(async (path, signal) => {
|
|
|
1599
1271
|
}, "mediaFingerprint");
|
|
1600
1272
|
var readMediaManifests = /* @__PURE__ */ __name(async (root, signal) => {
|
|
1601
1273
|
const entries = [];
|
|
1602
|
-
for (const name of await
|
|
1274
|
+
for (const name of await readdir(root)) {
|
|
1603
1275
|
signal?.throwIfAborted();
|
|
1604
1276
|
if (!name.startsWith(".media-archive-") || !name.endsWith(".json"))
|
|
1605
1277
|
continue;
|
|
1606
1278
|
let one;
|
|
1607
1279
|
try {
|
|
1608
|
-
one = parseMediaEntry(JSON.parse(await readBoundedUtf8File(
|
|
1280
|
+
one = parseMediaEntry(JSON.parse(await readBoundedUtf8File(join5(root, name), { maxBytes: 16384 })));
|
|
1609
1281
|
} catch {
|
|
1610
1282
|
throw new CliError("validation_error", "invalid media archive manifest");
|
|
1611
1283
|
}
|
|
@@ -1625,23 +1297,23 @@ var verifyMediaEntry = /* @__PURE__ */ __name(async (root, one, signal) => {
|
|
|
1625
1297
|
throw new CliError("validation_error", "media archive relocation cycle or excessive depth");
|
|
1626
1298
|
visited.add(location);
|
|
1627
1299
|
location = resolve2(entry.relocatedTo);
|
|
1628
|
-
const target = parseMediaEntry(JSON.parse(await readBoundedUtf8File(
|
|
1300
|
+
const target = parseMediaEntry(JSON.parse(await readBoundedUtf8File(join5(location, mediaManifestName(one)), { maxBytes: 16384 })));
|
|
1629
1301
|
if (!sameMediaCopy(one, target))
|
|
1630
1302
|
return false;
|
|
1631
1303
|
entry = target;
|
|
1632
1304
|
}
|
|
1633
1305
|
if (visited.has(location))
|
|
1634
1306
|
return false;
|
|
1635
|
-
const actual = await mediaFingerprint(
|
|
1307
|
+
const actual = await mediaFingerprint(join5(location, one.path), signal);
|
|
1636
1308
|
return actual.size === one.size && actual.sha256 === one.sha256;
|
|
1637
1309
|
}, "verifyMediaEntry");
|
|
1638
1310
|
var sameMediaCopy = /* @__PURE__ */ __name((a, b) => mediaKey(a) === mediaKey(b) && a.size === b.size && a.sha256 === b.sha256 && a.kind === b.kind && a.messageTime === b.messageTime && a.mime === b.mime, "sameMediaCopy");
|
|
1639
|
-
var commitMediaEntry = /* @__PURE__ */ __name((root, one, beforePublish) => writeFileAtomic(
|
|
1311
|
+
var commitMediaEntry = /* @__PURE__ */ __name((root, one, beforePublish) => writeFileAtomic(join5(root, mediaManifestName(one)), JSON.stringify(parseMediaEntry(one)), {
|
|
1640
1312
|
overwrite: false,
|
|
1641
1313
|
beforePublish
|
|
1642
1314
|
}), "commitMediaEntry");
|
|
1643
1315
|
|
|
1644
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1316
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/media-archive-files.js
|
|
1645
1317
|
var validator = '"media-completed-v1"';
|
|
1646
1318
|
var maximumFileBytes = 64 * 1024 * 1024 * 1024;
|
|
1647
1319
|
var archiveMediaFile = /* @__PURE__ */ __name(async (root, identity, kind, file, beforeWrite, signal, metadata = {}) => {
|
|
@@ -1685,7 +1357,7 @@ var archiveMediaFile = /* @__PURE__ */ __name(async (root, identity, kind, file,
|
|
|
1685
1357
|
}, "commit");
|
|
1686
1358
|
let exists = false;
|
|
1687
1359
|
try {
|
|
1688
|
-
await
|
|
1360
|
+
await lstat(publication.finalPath);
|
|
1689
1361
|
exists = true;
|
|
1690
1362
|
} catch (error) {
|
|
1691
1363
|
if (!missingMediaFile(error))
|
|
@@ -1742,9 +1414,9 @@ var archiveMediaFile = /* @__PURE__ */ __name(async (root, identity, kind, file,
|
|
|
1742
1414
|
return entry;
|
|
1743
1415
|
}, "archiveMediaFile");
|
|
1744
1416
|
|
|
1745
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1746
|
-
import { mkdir
|
|
1747
|
-
import { join as
|
|
1417
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/media-archive-locks.js
|
|
1418
|
+
import { mkdir, realpath } from "node:fs/promises";
|
|
1419
|
+
import { join as join6, resolve as resolve3 } from "node:path";
|
|
1748
1420
|
var archiveLocations = /* @__PURE__ */ __name(async (initial, signal) => {
|
|
1749
1421
|
const roots = /* @__PURE__ */ new Set();
|
|
1750
1422
|
const queued = new Set(initial.map((directory) => resolve3(directory)));
|
|
@@ -1753,7 +1425,7 @@ var archiveLocations = /* @__PURE__ */ __name(async (initial, signal) => {
|
|
|
1753
1425
|
signal?.throwIfAborted();
|
|
1754
1426
|
let root;
|
|
1755
1427
|
try {
|
|
1756
|
-
root = await
|
|
1428
|
+
root = await realpath(pending[at]);
|
|
1757
1429
|
} catch (error) {
|
|
1758
1430
|
if (missingMediaFile(error))
|
|
1759
1431
|
continue;
|
|
@@ -1778,18 +1450,18 @@ var archiveLocations = /* @__PURE__ */ __name(async (initial, signal) => {
|
|
|
1778
1450
|
var withMediaArchiveLocks = /* @__PURE__ */ __name(async (directory, signal, run, options = {}) => {
|
|
1779
1451
|
signal?.throwIfAborted();
|
|
1780
1452
|
if (options.create)
|
|
1781
|
-
await
|
|
1782
|
-
const root = await
|
|
1453
|
+
await mkdir(directory, { recursive: true, mode: 448 });
|
|
1454
|
+
const root = await realpath(directory);
|
|
1783
1455
|
if (options.createAdditional)
|
|
1784
1456
|
for (const other of options.additional ?? [])
|
|
1785
|
-
await
|
|
1457
|
+
await mkdir(other, { recursive: true, mode: 448 });
|
|
1786
1458
|
const initial = [root, ...options.additional ?? []];
|
|
1787
1459
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
1788
1460
|
const locations = await archiveLocations(initial, signal);
|
|
1789
1461
|
const leases = [];
|
|
1790
1462
|
try {
|
|
1791
1463
|
for (const location of locations)
|
|
1792
|
-
leases.push(await acquireLock(
|
|
1464
|
+
leases.push(await acquireLock(join6(location, ".media-writers"), { signal }));
|
|
1793
1465
|
const current = await archiveLocations(initial, signal);
|
|
1794
1466
|
if (current.some((location) => !locations.includes(location)))
|
|
1795
1467
|
continue;
|
|
@@ -1809,7 +1481,7 @@ var withMediaArchiveLocks = /* @__PURE__ */ __name(async (directory, signal, run
|
|
|
1809
1481
|
throw new CliError("validation_error", "archive locations changed during locking; run the command again");
|
|
1810
1482
|
}, "withMediaArchiveLocks");
|
|
1811
1483
|
|
|
1812
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1484
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/media-archive.js
|
|
1813
1485
|
var validateMediaSince = /* @__PURE__ */ __name((value, flag = "--since-time") => {
|
|
1814
1486
|
if (value === void 0)
|
|
1815
1487
|
return void 0;
|
|
@@ -1962,22 +1634,22 @@ var archiveMedia = /* @__PURE__ */ __name(async (ports, options) => {
|
|
|
1962
1634
|
}, { create: true });
|
|
1963
1635
|
}, "archiveMedia");
|
|
1964
1636
|
|
|
1965
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1966
|
-
import { realpath as
|
|
1967
|
-
import { basename as
|
|
1637
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/media-archive-move.js
|
|
1638
|
+
import { realpath as realpath2, unlink as unlink5 } from "node:fs/promises";
|
|
1639
|
+
import { basename as basename2, dirname as dirname2, join as join7, resolve as resolve4 } from "node:path";
|
|
1968
1640
|
var canonicalDestination = /* @__PURE__ */ __name(async (directory) => {
|
|
1969
1641
|
const path = resolve4(directory);
|
|
1970
1642
|
try {
|
|
1971
|
-
return await
|
|
1643
|
+
return await realpath2(path);
|
|
1972
1644
|
} catch (error) {
|
|
1973
|
-
if (!missingMediaFile(error) ||
|
|
1645
|
+
if (!missingMediaFile(error) || dirname2(path) === path)
|
|
1974
1646
|
throw error;
|
|
1975
|
-
return
|
|
1647
|
+
return join7(await canonicalDestination(dirname2(path)), basename2(path));
|
|
1976
1648
|
}
|
|
1977
1649
|
}, "canonicalDestination");
|
|
1978
1650
|
var image = /* @__PURE__ */ __name((entry) => ["photo", "image"].includes(entry.kind) || entry.mime?.startsWith("image/"), "image");
|
|
1979
1651
|
var removeLocalCopy = /* @__PURE__ */ __name(async (root, entry, beforeWrite, signal) => {
|
|
1980
|
-
const path =
|
|
1652
|
+
const path = join7(root, entry.path);
|
|
1981
1653
|
let file;
|
|
1982
1654
|
try {
|
|
1983
1655
|
file = await openOrdinaryFile(path);
|
|
@@ -1996,7 +1668,7 @@ var removeLocalCopy = /* @__PURE__ */ __name(async (root, entry, beforeWrite, si
|
|
|
1996
1668
|
await beforeWrite();
|
|
1997
1669
|
if (!await sameOrdinaryFile(path, identity))
|
|
1998
1670
|
throw new CliError("validation_error", "local image was replaced; it was preserved");
|
|
1999
|
-
await
|
|
1671
|
+
await unlink5(path);
|
|
2000
1672
|
await syncDirectory(root);
|
|
2001
1673
|
} finally {
|
|
2002
1674
|
await file.close();
|
|
@@ -2007,7 +1679,7 @@ var moveMediaArchive = /* @__PURE__ */ __name(async (options) => {
|
|
|
2007
1679
|
if (cutoff === void 0)
|
|
2008
1680
|
throw new CliError("validation_error", "--before-time is required");
|
|
2009
1681
|
const target = await canonicalDestination(options.archiveDirectory);
|
|
2010
|
-
const source = await
|
|
1682
|
+
const source = await realpath2(options.directory);
|
|
2011
1683
|
if (source === target)
|
|
2012
1684
|
throw new CliError("validation_error", "choose a different archive destination");
|
|
2013
1685
|
return withMediaArchiveLocks(source, options.signal, async (root, beforeWrite) => {
|
|
@@ -2064,7 +1736,7 @@ var moveMediaArchive = /* @__PURE__ */ __name(async (options) => {
|
|
|
2064
1736
|
for (const entry of candidates) {
|
|
2065
1737
|
await beforeWrite();
|
|
2066
1738
|
if (!known2.has(mediaKey(entry))) {
|
|
2067
|
-
const file = await openOrdinaryFile(
|
|
1739
|
+
const file = await openOrdinaryFile(join7(root, entry.path));
|
|
2068
1740
|
try {
|
|
2069
1741
|
const identity = {
|
|
2070
1742
|
provider: entry.provider,
|
|
@@ -2091,7 +1763,7 @@ var moveMediaArchive = /* @__PURE__ */ __name(async (options) => {
|
|
|
2091
1763
|
if (!await verifyMediaEntry(root, receipt, options.signal))
|
|
2092
1764
|
throw new CliError("validation_error", "archive destination changed before rotation; the original was preserved");
|
|
2093
1765
|
await beforeWrite();
|
|
2094
|
-
await writeFileAtomic(
|
|
1766
|
+
await writeFileAtomic(join7(root, mediaManifestName(entry)), JSON.stringify(receipt), {
|
|
2095
1767
|
beforePublish: beforeWrite,
|
|
2096
1768
|
signal: options.signal
|
|
2097
1769
|
});
|
|
@@ -2115,7 +1787,7 @@ var moveMediaArchive = /* @__PURE__ */ __name(async (options) => {
|
|
|
2115
1787
|
}, { additional: [target], createAdditional: !options.dryRun });
|
|
2116
1788
|
}, "moveMediaArchive");
|
|
2117
1789
|
|
|
2118
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1790
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/model-downloads.js
|
|
2119
1791
|
var bytesOf = /* @__PURE__ */ __name((model) => model.files.reduce((sum2, file) => sum2 + file.bytes, 0), "bytesOf");
|
|
2120
1792
|
var nativeRuntime = /* @__PURE__ */ __name(async ({ env, progress = /* @__PURE__ */ __name(() => {
|
|
2121
1793
|
}, "progress") }) => {
|
|
@@ -2138,7 +1810,7 @@ var downloadTextModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
|
|
|
2138
1810
|
}
|
|
2139
1811
|
await nativeRuntime({ env, progress });
|
|
2140
1812
|
progress(`${model.id}: loading it once to check it works`);
|
|
2141
|
-
const { openEmbedder: openEmbedder2 } = await import("./embed-
|
|
1813
|
+
const { openEmbedder: openEmbedder2 } = await import("./embed-3GSQIQXE.js");
|
|
2142
1814
|
const embedder = await openEmbedder2(model, directory);
|
|
2143
1815
|
try {
|
|
2144
1816
|
const [vector] = await embedder.embed(["check"], "query");
|
|
@@ -2159,7 +1831,7 @@ var downloadRerankModel = /* @__PURE__ */ __name(async (id2, { env, progress = /
|
|
|
2159
1831
|
}
|
|
2160
1832
|
await nativeRuntime({ env, progress });
|
|
2161
1833
|
progress(`${model.id}: loading it once to check it works`);
|
|
2162
|
-
const { openReranker } = await import("./rerank-
|
|
1834
|
+
const { openReranker } = await import("./rerank-R6PE44M5.js");
|
|
2163
1835
|
const reranker = await openReranker(model, directory);
|
|
2164
1836
|
try {
|
|
2165
1837
|
await reranker.score("check", ["check"]);
|
|
@@ -2177,7 +1849,7 @@ var downloadImageModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
|
|
|
2177
1849
|
await installFiles(placedImage(model, directory), { progress });
|
|
2178
1850
|
}
|
|
2179
1851
|
progress(`${model.id}: loading it once to check it works`);
|
|
2180
|
-
const { openPictureEmbedder } = await import("./embedder-
|
|
1852
|
+
const { openPictureEmbedder } = await import("./embedder-6ULWRG3R.js");
|
|
2181
1853
|
const embedder = await openPictureEmbedder(model, directory);
|
|
2182
1854
|
try {
|
|
2183
1855
|
const vector = await embedder.embedQuery("check");
|
|
@@ -2189,7 +1861,7 @@ var downloadImageModel = /* @__PURE__ */ __name(async (id2, { env, progress = /*
|
|
|
2189
1861
|
return { model, directory };
|
|
2190
1862
|
}, "downloadImageModel");
|
|
2191
1863
|
|
|
2192
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1864
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/project-gathering-around.js
|
|
2193
1865
|
var storedMessageNeighbours = /* @__PURE__ */ __name((messages) => ({
|
|
2194
1866
|
async around(ref, window2) {
|
|
2195
1867
|
const at = parseLocator(ref);
|
|
@@ -2209,8 +1881,8 @@ var documentMatches = /* @__PURE__ */ __name((text2, queries, window2) => {
|
|
|
2209
1881
|
const paragraphs = text2.split(/\n\s*\n/).map((part) => part.replace(/\s+/g, " ").trim()).filter(Boolean);
|
|
2210
1882
|
const query = queries.join(" ");
|
|
2211
1883
|
const words2 = new Set(wordsOf(query));
|
|
2212
|
-
const
|
|
2213
|
-
const hit =
|
|
1884
|
+
const matching2 = paragraphs.flatMap((part, index) => wordsOf(part).some((word) => words2.has(word)) ? [index] : []);
|
|
1885
|
+
const hit = matching2[0];
|
|
2214
1886
|
if (hit === void 0 || paragraphs.length < 2)
|
|
2215
1887
|
return { around: [], moreMatches: 0 };
|
|
2216
1888
|
const from = Math.max(0, hit - window2.before);
|
|
@@ -2218,7 +1890,7 @@ var documentMatches = /* @__PURE__ */ __name((text2, queries, window2) => {
|
|
|
2218
1890
|
text: excerpt(part, query, 200, { literal: true }),
|
|
2219
1891
|
found: from + index === hit
|
|
2220
1892
|
}));
|
|
2221
|
-
return { around, moreMatches:
|
|
1893
|
+
return { around, moreMatches: matching2.length - 1 };
|
|
2222
1894
|
}, "documentMatches");
|
|
2223
1895
|
var documentPassage = /* @__PURE__ */ __name((text2, query, window2) => documentMatches(text2, [query], window2).around, "documentPassage");
|
|
2224
1896
|
var attachNeighbours = /* @__PURE__ */ __name(async (items, reader, window2, budget, known2, signal) => {
|
|
@@ -2285,7 +1957,7 @@ var storedNeighbours = /* @__PURE__ */ __name((store) => {
|
|
|
2285
1957
|
};
|
|
2286
1958
|
}, "storedNeighbours");
|
|
2287
1959
|
|
|
2288
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1960
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/project-gathering-request.js
|
|
2289
1961
|
import { createHash as createHash5 } from "node:crypto";
|
|
2290
1962
|
var DAY = 864e5;
|
|
2291
1963
|
var MAX_TIME = 864e13;
|
|
@@ -2600,7 +2272,7 @@ var decodeCheckpoint = /* @__PURE__ */ __name((text2, plan) => {
|
|
|
2600
2272
|
return value;
|
|
2601
2273
|
}, "decodeCheckpoint");
|
|
2602
2274
|
|
|
2603
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
2275
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/project-gathering.js
|
|
2604
2276
|
var terminal = /* @__PURE__ */ new Set(["done", "unavailable", "failed"]);
|
|
2605
2277
|
var PAGE = 20;
|
|
2606
2278
|
var PEOPLE = 20;
|
|
@@ -2671,9 +2343,9 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
|
|
|
2671
2343
|
const matchedAgain = /* @__PURE__ */ new Map();
|
|
2672
2344
|
const oversized = /* @__PURE__ */ new Map();
|
|
2673
2345
|
let stopped = null;
|
|
2674
|
-
const
|
|
2346
|
+
const open7 = /* @__PURE__ */ __name((u) => !terminal.has(u.state) && u.state !== "read-limited", "open");
|
|
2675
2347
|
const linkedLanes = new Set(plan.linkedChats.flatMap((c) => c.lane === null ? [] : [c.lane]));
|
|
2676
|
-
const openLanes = new Set(progress.flatMap((u, index) =>
|
|
2348
|
+
const openLanes = new Set(progress.flatMap((u, index) => open7(u) ? [units2[index]?.lane.id] : []));
|
|
2677
2349
|
const shares = [...linkedLanes].filter((id2) => openLanes.has(id2)).length + ([...openLanes].some((id2) => id2 !== void 0 && !linkedLanes.has(id2)) ? 1 : 0);
|
|
2678
2350
|
const linkedLimit = Math.max(PAGE, Math.floor(plan.budgets.maxItems / Math.max(1, shares)));
|
|
2679
2351
|
const linkedTaken = /* @__PURE__ */ new Map();
|
|
@@ -2732,9 +2404,9 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
|
|
|
2732
2404
|
if (linkedLanes.has(lane.id))
|
|
2733
2405
|
linkedTaken.set(lane.id, (linkedTaken.get(lane.id) ?? 0) + 1);
|
|
2734
2406
|
}, "take");
|
|
2735
|
-
const shallowest = progress.reduce((low, u) =>
|
|
2407
|
+
const shallowest = progress.reduce((low, u) => open7(u) ? Math.min(low, u.pages) : low, Number.POSITIVE_INFINITY);
|
|
2736
2408
|
for (let round = shallowest; !stopped; round++) {
|
|
2737
|
-
const due = progress.flatMap((u, index) =>
|
|
2409
|
+
const due = progress.flatMap((u, index) => open7(u) && u.pages <= round && !capped2.has(units2[index]?.lane.id ?? "") ? [index] : []);
|
|
2738
2410
|
if (!due.length)
|
|
2739
2411
|
break;
|
|
2740
2412
|
for (const index of due) {
|
|
@@ -2831,6 +2503,20 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
|
|
|
2831
2503
|
signal
|
|
2832
2504
|
);
|
|
2833
2505
|
const people = peopleOf(items, senderOf);
|
|
2506
|
+
const coverageOf2 = /* @__PURE__ */ new Map();
|
|
2507
|
+
if (ports.coverage) {
|
|
2508
|
+
const byAccount = /* @__PURE__ */ new Map();
|
|
2509
|
+
for (const { provider, account: account2, chat, source } of plan.linkedChats) {
|
|
2510
|
+
if (source === null)
|
|
2511
|
+
continue;
|
|
2512
|
+
const group = byAccount.get(JSON.stringify([provider, account2])) ?? { account: { provider, account: account2 }, chats: [] };
|
|
2513
|
+
group.chats.push(chat);
|
|
2514
|
+
byAccount.set(JSON.stringify([provider, account2]), group);
|
|
2515
|
+
}
|
|
2516
|
+
for (const [key, { account: account2, chats }] of byAccount)
|
|
2517
|
+
for (const row of await ports.coverage(account2, chats))
|
|
2518
|
+
coverageOf2.set(`${key}${row.chatId}`, row);
|
|
2519
|
+
}
|
|
2834
2520
|
const totals = {
|
|
2835
2521
|
reads: (previous?.totals.reads ?? 0) + usage.reads,
|
|
2836
2522
|
readBytes: (previous?.totals.readBytes ?? 0) + usage.readBytes,
|
|
@@ -2851,6 +2537,27 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
|
|
|
2851
2537
|
seen: [...seen],
|
|
2852
2538
|
totals
|
|
2853
2539
|
};
|
|
2540
|
+
const linkedRows = plan.linkedChats.map(({ provider, account: account2, chat, ref, source, lane }) => {
|
|
2541
|
+
const laneUnits = units2.flatMap((unit, index) => unit.lane.id === lane ? [progress[index]] : []);
|
|
2542
|
+
const state = source === null ? "out-of-scope" : laneUnits.every((u) => u?.state === "unavailable") ? "unavailable" : laneUnits.every((u) => u?.state === "pending") ? "pending" : "in-scope";
|
|
2543
|
+
const row = coverageOf2.get(`${JSON.stringify([provider, account2])}${chat}`);
|
|
2544
|
+
return {
|
|
2545
|
+
provider,
|
|
2546
|
+
account: account2,
|
|
2547
|
+
chat,
|
|
2548
|
+
ref,
|
|
2549
|
+
source,
|
|
2550
|
+
lane,
|
|
2551
|
+
state,
|
|
2552
|
+
title: row?.title ?? null,
|
|
2553
|
+
completeness: row?.completeness ?? null,
|
|
2554
|
+
held: row?.held ?? null,
|
|
2555
|
+
...state === "pending" ? {} : { items: lane === null ? 0 : linkedTaken.get(lane) ?? 0 },
|
|
2556
|
+
...state === "pending" ? {} : { capped: lane !== null && capped2.has(lane) }
|
|
2557
|
+
};
|
|
2558
|
+
});
|
|
2559
|
+
const states = linkedRows.flatMap((row) => row.completeness ? [row.completeness.state] : []);
|
|
2560
|
+
const completeness = !states.length ? "unknown" : states.includes("partial") ? "partial" : states.includes("unknown") || states.length < linkedRows.filter((row) => row.source !== null).length ? "unknown" : "complete";
|
|
2854
2561
|
return {
|
|
2855
2562
|
schemaVersion: 1,
|
|
2856
2563
|
runKey: plan.runKey,
|
|
@@ -2867,17 +2574,7 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
|
|
|
2867
2574
|
},
|
|
2868
2575
|
scope: { origin: plan.scope, sources: plan.sources },
|
|
2869
2576
|
lanes: plan.lanes,
|
|
2870
|
-
linkedChats:
|
|
2871
|
-
provider,
|
|
2872
|
-
account: account2,
|
|
2873
|
-
chat,
|
|
2874
|
-
ref,
|
|
2875
|
-
source,
|
|
2876
|
-
lane,
|
|
2877
|
-
state: source === null ? "out-of-scope" : units2.every((unit, index) => unit.lane.id !== lane || progress[index]?.state === "unavailable") ? "unavailable" : "in-scope",
|
|
2878
|
-
items: lane === null ? 0 : linkedTaken.get(lane) ?? 0,
|
|
2879
|
-
capped: lane !== null && capped2.has(lane)
|
|
2880
|
-
})),
|
|
2577
|
+
linkedChats: linkedRows,
|
|
2881
2578
|
fetch: fetched.map((f, index) => ({ source: index, ...f })),
|
|
2882
2579
|
index: indexed,
|
|
2883
2580
|
units: units2.map((unit, index) => ({
|
|
@@ -2898,7 +2595,7 @@ var gatherProjectEvidence = /* @__PURE__ */ __name(async (ports, request) => {
|
|
|
2898
2595
|
totals,
|
|
2899
2596
|
stopped,
|
|
2900
2597
|
complete: !resumable,
|
|
2901
|
-
completeness
|
|
2598
|
+
completeness,
|
|
2902
2599
|
checkpoint: resumable ? encodeCheckpoint(checkpoint) : null
|
|
2903
2600
|
};
|
|
2904
2601
|
}, "gatherProjectEvidence");
|
|
@@ -2925,7 +2622,7 @@ var peopleOf = /* @__PURE__ */ __name((items, senderOf) => {
|
|
|
2925
2622
|
return [...byKey.values()].sort((a, b) => b.items - a.items || a.name.localeCompare(b.name));
|
|
2926
2623
|
}, "peopleOf");
|
|
2927
2624
|
|
|
2928
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
2625
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidate-matching.js
|
|
2929
2626
|
var normalizedText = /* @__PURE__ */ __name((text2) => text2.normalize("NFKC").toLowerCase().replace(/\s+/gu, " "), "normalizedText");
|
|
2930
2627
|
var termsOf = /* @__PURE__ */ __name((entry) => [
|
|
2931
2628
|
{ name: entry.name, kind: "canonical" },
|
|
@@ -2990,7 +2687,7 @@ var matchProjectCandidates = /* @__PURE__ */ __name((catalog, input) => matchVoc
|
|
|
2990
2687
|
omittedMatches: omitted
|
|
2991
2688
|
})), "matchProjectCandidates");
|
|
2992
2689
|
|
|
2993
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
2690
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/project-gathering-mentions.js
|
|
2994
2691
|
var KINDS = ["project", "tag", "topic"];
|
|
2995
2692
|
var findEvidenceMentions = /* @__PURE__ */ __name(async (vocabulary, gathering, options = {}) => {
|
|
2996
2693
|
if (typeof vocabulary?.vocabulary !== "function")
|
|
@@ -3045,7 +2742,7 @@ var findEvidenceMentions = /* @__PURE__ */ __name(async (vocabulary, gathering,
|
|
|
3045
2742
|
};
|
|
3046
2743
|
}, "findEvidenceMentions");
|
|
3047
2744
|
|
|
3048
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
2745
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/ports/messenger.js
|
|
3049
2746
|
var throughWrapper = /* @__PURE__ */ __name((inner, handled, wrap = (_, call) => call) => new Proxy(handled, {
|
|
3050
2747
|
get: /* @__PURE__ */ __name((own, key) => {
|
|
3051
2748
|
if (key in own)
|
|
@@ -3062,12 +2759,12 @@ var capability = /* @__PURE__ */ __name((adapter, method, what) => {
|
|
|
3062
2759
|
return found.bind(adapter);
|
|
3063
2760
|
}, "capability");
|
|
3064
2761
|
|
|
3065
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
2762
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/sends/send-id.js
|
|
3066
2763
|
import { randomBytes } from "node:crypto";
|
|
3067
2764
|
var newSendId = /* @__PURE__ */ __name(() => randomBytes(8).readBigInt64BE().toString(), "newSendId");
|
|
3068
2765
|
var newOperationId = newSendId;
|
|
3069
2766
|
|
|
3070
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
2767
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/account.js
|
|
3071
2768
|
var accountService = /* @__PURE__ */ __name((deps) => {
|
|
3072
2769
|
const online = /* @__PURE__ */ __name(async (command) => {
|
|
3073
2770
|
if (deps.offline)
|
|
@@ -3139,7 +2836,7 @@ var accountService = /* @__PURE__ */ __name((deps) => {
|
|
|
3139
2836
|
};
|
|
3140
2837
|
}, "accountService");
|
|
3141
2838
|
|
|
3142
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
2839
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/send-time.js
|
|
3143
2840
|
var MINUTE = 6e4;
|
|
3144
2841
|
var YEAR = 365 * 24 * 60 * MINUTE;
|
|
3145
2842
|
var DELAY = /^(\d+)(m|h|d)$/;
|
|
@@ -3158,7 +2855,7 @@ var sendTime = /* @__PURE__ */ __name((value, now = Date.now(), flag = "--at-tim
|
|
|
3158
2855
|
return new Date(at - at % MINUTE).toISOString();
|
|
3159
2856
|
}, "sendTime");
|
|
3160
2857
|
|
|
3161
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
2858
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/admin.js
|
|
3162
2859
|
var recordMembership = /* @__PURE__ */ __name(async (deps, operationId, done2, change, fix, write) => {
|
|
3163
2860
|
try {
|
|
3164
2861
|
const held = await accountStoreIfOpen(deps);
|
|
@@ -3187,11 +2884,11 @@ var adminService = /* @__PURE__ */ __name((deps) => {
|
|
|
3187
2884
|
const chat = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "chat", action: "create", personIds, people: personIds.length }, () => create(title.trim(), personIds, { channel }), (made) => ({ chatId: made.id }));
|
|
3188
2885
|
return { operationId, chat };
|
|
3189
2886
|
}, "create"),
|
|
3190
|
-
join: /* @__PURE__ */ __name(async (
|
|
2887
|
+
join: /* @__PURE__ */ __name(async (link4) => {
|
|
3191
2888
|
const connection = await online("chats join");
|
|
3192
|
-
const
|
|
2889
|
+
const join10 = capability(connection, "join", "join a chat by its link");
|
|
3193
2890
|
const operationId = newOperationId();
|
|
3194
|
-
const joined = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "chat", action: "join" }, () =>
|
|
2891
|
+
const joined = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "chat", action: "join" }, () => join10(link4.trim()), (answer) => "requested" in answer ? {} : { chatId: answer.id });
|
|
3195
2892
|
if ("requested" in joined)
|
|
3196
2893
|
return { operationId, requested: true };
|
|
3197
2894
|
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`;
|
|
@@ -3298,12 +2995,12 @@ var adminService = /* @__PURE__ */ __name((deps) => {
|
|
|
3298
2995
|
const { already } = await guardedWrite(deps.guard, { operationId, chatId, kind: "chat", action: accept ? "requests.accept" : "requests.decline", people: 1 }, () => answer(chatId, personId, accept));
|
|
3299
2996
|
return { operationId, chatId, personId, accepted: accept, already };
|
|
3300
2997
|
}, "answerRequest"),
|
|
3301
|
-
answerAllRequests: /* @__PURE__ */ __name(async (chat, accept, { link:
|
|
2998
|
+
answerAllRequests: /* @__PURE__ */ __name(async (chat, accept, { link: link4 }) => {
|
|
3302
2999
|
const connection = await online(`chats requests ${accept ? "accept" : "decline"} --all`);
|
|
3303
3000
|
const list2 = capability(connection, "joinRequests", "read join requests");
|
|
3304
3001
|
const answerAll = capability(connection, "answerAllJoinRequests", "answer every join request at once");
|
|
3305
3002
|
const { id: chatId } = await connection.resolve(chat);
|
|
3306
|
-
const page = await list2(chatId, { limit: 100, ...
|
|
3003
|
+
const page = await list2(chatId, { limit: 100, ...link4 === void 0 ? {} : { link: link4 } });
|
|
3307
3004
|
const counted2 = page.total ?? page.items.length;
|
|
3308
3005
|
if (page.total === void 0 && page.hasMore)
|
|
3309
3006
|
throw new CliError("validation_error", "too many requests to count; answer them by person, or by --link");
|
|
@@ -3317,7 +3014,7 @@ var adminService = /* @__PURE__ */ __name((deps) => {
|
|
|
3317
3014
|
action: accept ? "requests.accept" : "requests.decline",
|
|
3318
3015
|
count: counted2,
|
|
3319
3016
|
people: counted2
|
|
3320
|
-
}, () => answerAll(chatId, accept,
|
|
3017
|
+
}, () => answerAll(chatId, accept, link4));
|
|
3321
3018
|
return { operationId, chatId, accepted: accept, counted: counted2 };
|
|
3322
3019
|
}, "answerAllRequests"),
|
|
3323
3020
|
links: /* @__PURE__ */ __name(async (chat, window2) => {
|
|
@@ -3328,18 +3025,18 @@ var adminService = /* @__PURE__ */ __name((deps) => {
|
|
|
3328
3025
|
const { id: chatId } = await connection.resolve(chat);
|
|
3329
3026
|
return { chatId, ...await list2(chatId, window2) };
|
|
3330
3027
|
}, "links"),
|
|
3331
|
-
revokeLink: /* @__PURE__ */ __name(async (chat,
|
|
3332
|
-
if (
|
|
3028
|
+
revokeLink: /* @__PURE__ */ __name(async (chat, link4) => {
|
|
3029
|
+
if (link4.trim() === "")
|
|
3333
3030
|
throw new CliError("validation_error", "which link? give it as `chats links list` shows it");
|
|
3334
3031
|
const connection = await online("chats links remove");
|
|
3335
3032
|
const revoke = capability(connection, "revokeInviteLink", "revoke an invite link");
|
|
3336
3033
|
const { id: chatId } = await connection.resolve(chat);
|
|
3337
3034
|
const operationId = newOperationId();
|
|
3338
|
-
const answer = await guardedWrite(deps.guard, { operationId, chatId, kind: "chat", action: "link.revoke" }, () => revoke(chatId,
|
|
3035
|
+
const answer = await guardedWrite(deps.guard, { operationId, chatId, kind: "chat", action: "link.revoke" }, () => revoke(chatId, link4.trim()));
|
|
3339
3036
|
return { operationId, chatId, ...answer };
|
|
3340
3037
|
}, "revokeLink"),
|
|
3341
|
-
updateLink: /* @__PURE__ */ __name(async (chat,
|
|
3342
|
-
if (
|
|
3038
|
+
updateLink: /* @__PURE__ */ __name(async (chat, link4, { approval, expires, maxUses }) => {
|
|
3039
|
+
if (link4.trim() === "")
|
|
3343
3040
|
throw new CliError("validation_error", "which link? give it as `chats links list` shows it");
|
|
3344
3041
|
if (approval === void 0 && expires === void 0 && maxUses === void 0)
|
|
3345
3042
|
throw new CliError("validation_error", "nothing to change: give --approval, --no-approval, --expire-time or --max-uses");
|
|
@@ -3354,7 +3051,7 @@ var adminService = /* @__PURE__ */ __name((deps) => {
|
|
|
3354
3051
|
...maxUses === void 0 ? {} : { maxUses }
|
|
3355
3052
|
};
|
|
3356
3053
|
const operationId = newOperationId();
|
|
3357
|
-
const answer = await guardedWrite(deps.guard, { operationId, chatId, kind: "chat", action: "link.update" }, () => update(chatId,
|
|
3054
|
+
const answer = await guardedWrite(deps.guard, { operationId, chatId, kind: "chat", action: "link.update" }, () => update(chatId, link4.trim(), change));
|
|
3358
3055
|
return { operationId, chatId, ...answer };
|
|
3359
3056
|
}, "updateLink"),
|
|
3360
3057
|
addMembers: /* @__PURE__ */ __name(async (chat, people, options) => {
|
|
@@ -3405,10 +3102,10 @@ var linkLimits = /* @__PURE__ */ __name(({ approval, expires, maxUses }) => {
|
|
|
3405
3102
|
return expires === void 0 ? void 0 : sendTime(expires, Date.now(), "--expire-time");
|
|
3406
3103
|
}, "linkLimits");
|
|
3407
3104
|
|
|
3408
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
3105
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/ports/traits.js
|
|
3409
3106
|
var syncsOneChat = /* @__PURE__ */ __name((messenger) => messenger.history !== "store" || messenger.historyOnDemand === true, "syncsOneChat");
|
|
3410
3107
|
|
|
3411
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
3108
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/mail-search.js
|
|
3412
3109
|
var THREADS_PAGE = 500;
|
|
3413
3110
|
var threadsOf = /* @__PURE__ */ __name(async (store, key) => {
|
|
3414
3111
|
const account2 = await store.accounts.storedAccount(key).catch(() => void 0);
|
|
@@ -3487,7 +3184,7 @@ var readMail = /* @__PURE__ */ __name(async (store, locator, { before: before2 =
|
|
|
3487
3184
|
return thread.slice(Math.max(0, at - before2), at + after + 1).map((hit) => hit.id === message ? { ...hit, anchor: true } : hit);
|
|
3488
3185
|
}, "readMail");
|
|
3489
3186
|
|
|
3490
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
3187
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/message-resolution.js
|
|
3491
3188
|
var readChatId = /* @__PURE__ */ __name(async (deps, reference, store, account2) => {
|
|
3492
3189
|
if (deps.reads !== "store")
|
|
3493
3190
|
return keptChatId(deps.messenger, reference, store, account2);
|
|
@@ -3634,7 +3331,7 @@ var senderAmong = /* @__PURE__ */ __name(async (store, accounts, reference) => {
|
|
|
3634
3331
|
}
|
|
3635
3332
|
}, "senderAmong");
|
|
3636
3333
|
|
|
3637
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
3334
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/search-kind.js
|
|
3638
3335
|
var NO_MAIL = "no_mail";
|
|
3639
3336
|
var MAIL = "email";
|
|
3640
3337
|
var listContextOf = /* @__PURE__ */ __name(async (store, account2, app, stored) => {
|
|
@@ -3681,7 +3378,7 @@ var accountsOfKind = /* @__PURE__ */ __name((kind, chosen, held, explicit, comma
|
|
|
3681
3378
|
return chosenMail.map(({ provider, account: account2 }) => ({ provider, account: account2 }));
|
|
3682
3379
|
}, "accountsOfKind");
|
|
3683
3380
|
|
|
3684
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
3381
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/messages-search.js
|
|
3685
3382
|
var MAIL_FIELDS = /* @__PURE__ */ new Set(["to", "cc", "bcc", "subject", "mailbox", "label", "is"]);
|
|
3686
3383
|
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");
|
|
3687
3384
|
var prepareLucene = /* @__PURE__ */ __name(async (store, account2, request, messenger) => {
|
|
@@ -3967,6 +3664,23 @@ var searchLucene = /* @__PURE__ */ __name(async (store, account2, request, messe
|
|
|
3967
3664
|
...request.kind === "mail" ? { accounts: mailAccounts.map(({ provider, account: account3 }) => ({ resource: "mail", provider, account: account3 })) } : {}
|
|
3968
3665
|
};
|
|
3969
3666
|
}, "searchLucene");
|
|
3667
|
+
var countLucene = /* @__PURE__ */ __name(async (store, account2, request, messenger, cap) => {
|
|
3668
|
+
const prepared = await prepareLucene(store, account2, request, messenger);
|
|
3669
|
+
if (!prepared.scopeAccounts.length)
|
|
3670
|
+
return 0;
|
|
3671
|
+
const count2 = /* @__PURE__ */ __name((execution) => store.queries.countMatches(execution, cap), "count");
|
|
3672
|
+
const mailAccounts = prepared.scopeAccounts.filter(({ provider }) => provider === MAIL);
|
|
3673
|
+
const messages = await count2(prepared.execution);
|
|
3674
|
+
let mail = 0;
|
|
3675
|
+
if (mailAccounts.length)
|
|
3676
|
+
try {
|
|
3677
|
+
mail = await count2({ ...prepared.execution, accounts: mailAccounts, corpus: "mail" });
|
|
3678
|
+
} catch (error) {
|
|
3679
|
+
if (!(request.kind !== "mail" && error instanceof CliError && error.code === "validation_error"))
|
|
3680
|
+
throw error;
|
|
3681
|
+
}
|
|
3682
|
+
return messages === void 0 || mail === void 0 ? void 0 : messages + mail;
|
|
3683
|
+
}, "countLucene");
|
|
3970
3684
|
var correctionsOf = /* @__PURE__ */ __name((items) => {
|
|
3971
3685
|
const found = /* @__PURE__ */ new Map();
|
|
3972
3686
|
for (const { corrections = [] } of items)
|
|
@@ -4012,7 +3726,7 @@ var statsLucene = /* @__PURE__ */ __name(async (store, account2, request, messen
|
|
|
4012
3726
|
};
|
|
4013
3727
|
}, "statsLucene");
|
|
4014
3728
|
|
|
4015
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
3729
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/moment.js
|
|
4016
3730
|
var AGO = /^(\d+)(m|h|d)$/;
|
|
4017
3731
|
var AGO_MS = { m: 6e4, h: 36e5, d: 864e5 };
|
|
4018
3732
|
var DATE = /^\d{4}-\d{2}-\d{2}/;
|
|
@@ -4052,7 +3766,7 @@ var dateWindow = /* @__PURE__ */ __name(({ sinceTime, untilTime, zone, now = Dat
|
|
|
4052
3766
|
};
|
|
4053
3767
|
}, "dateWindow");
|
|
4054
3768
|
|
|
4055
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
3769
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/rankings-selection.js
|
|
4056
3770
|
var RANKING_SELECTION_BYTES = 64 * 1024;
|
|
4057
3771
|
var object = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0, "object");
|
|
4058
3772
|
function invalid(message = "ranking selection is invalid \u2014 obtain a new drilldown from stats top") {
|
|
@@ -4221,7 +3935,7 @@ var readRankingSelection = /* @__PURE__ */ __name(async (store, input) => {
|
|
|
4221
3935
|
};
|
|
4222
3936
|
}, "readRankingSelection");
|
|
4223
3937
|
|
|
4224
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
3938
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/search-record.js
|
|
4225
3939
|
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");
|
|
4226
3940
|
var searchRecordOf = /* @__PURE__ */ __name((command, params) => ({
|
|
4227
3941
|
command,
|
|
@@ -4231,7 +3945,7 @@ var searchRecordOf = /* @__PURE__ */ __name((command, params) => ({
|
|
|
4231
3945
|
fieldsVersion: FIELD_VERSION
|
|
4232
3946
|
}), "searchRecordOf");
|
|
4233
3947
|
|
|
4234
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
3948
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/admin-statistics.js
|
|
4235
3949
|
function invalid2(message) {
|
|
4236
3950
|
throw new CliError("validation_error", message);
|
|
4237
3951
|
}
|
|
@@ -4525,32 +4239,7 @@ var adminStatisticsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
4525
4239
|
}, "evidence")
|
|
4526
4240
|
}), "adminStatisticsService");
|
|
4527
4241
|
|
|
4528
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
4529
|
-
var chatCoverage = /* @__PURE__ */ __name(async (store, account2, chatIds) => {
|
|
4530
|
-
const ids = [...new Set(chatIds)];
|
|
4531
|
-
if (ids.length === 0)
|
|
4532
|
-
return [];
|
|
4533
|
-
const found = new Map((await store.chats.chatCompleteness(account2, ids)).map((one) => [one.chatId, one]));
|
|
4534
|
-
return Promise.all(ids.map(async (chatId) => {
|
|
4535
|
-
const [stats] = await store.chats.chatStats(account2, chatId);
|
|
4536
|
-
const completeness = found.get(chatId) ?? {
|
|
4537
|
-
chatId,
|
|
4538
|
-
state: "unknown",
|
|
4539
|
-
upToDate: null,
|
|
4540
|
-
gaps: false,
|
|
4541
|
-
reachesStart: false,
|
|
4542
|
-
fetchedAt: null
|
|
4543
|
-
};
|
|
4544
|
-
return {
|
|
4545
|
-
chatId,
|
|
4546
|
-
title: stats?.title ?? null,
|
|
4547
|
-
completeness,
|
|
4548
|
-
held: { messages: stats?.messages ?? 0, oldestAt: stats?.oldestAt ?? null, newestAt: stats?.newestAt ?? null }
|
|
4549
|
-
};
|
|
4550
|
-
}));
|
|
4551
|
-
}, "chatCoverage");
|
|
4552
|
-
|
|
4553
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.494.0_@wirecat+cli-base@0.65.5_commander@15.0.0_esbuild@0.28.2_type_231e74d5ae3bca45b1b0de971f6f7b9a/node_modules/@wirecat/cli-core/dist/domain/thread.js
|
|
4242
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/thread.js
|
|
4554
4243
|
var threadIdOf = /* @__PURE__ */ __name((value) => {
|
|
4555
4244
|
if (value === void 0)
|
|
4556
4245
|
return void 0;
|
|
@@ -4560,7 +4249,7 @@ var threadIdOf = /* @__PURE__ */ __name((value) => {
|
|
|
4560
4249
|
return id2;
|
|
4561
4250
|
}, "threadIdOf");
|
|
4562
4251
|
|
|
4563
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
4252
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/questions.js
|
|
4564
4253
|
var LINKS = /https?:\/\/\S+/g;
|
|
4565
4254
|
var unanswered = /* @__PURE__ */ __name((messages, { answerers: answerers2, before: before2 }) => questions(messages, { answerers: answerers2 }).filter(({ question, answer }) => answer === void 0 && Date.parse(question.timestamp) < before2).map(({ question }) => question), "unanswered");
|
|
4566
4255
|
var questions = /* @__PURE__ */ __name((messages, { answerers: answerers2 }) => {
|
|
@@ -4587,7 +4276,7 @@ var questions = /* @__PURE__ */ __name((messages, { answerers: answerers2 }) =>
|
|
|
4587
4276
|
});
|
|
4588
4277
|
}, "questions");
|
|
4589
4278
|
|
|
4590
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
4279
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/chat-stats.js
|
|
4591
4280
|
var TOP_POSTS = 5;
|
|
4592
4281
|
var JOINS = /* @__PURE__ */ new Set(["join", "add"]);
|
|
4593
4282
|
var LEAVES = /* @__PURE__ */ new Set(["leave", "remove"]);
|
|
@@ -4704,7 +4393,7 @@ var median = /* @__PURE__ */ __name((values) => {
|
|
|
4704
4393
|
return Math.round(sorted.length % 2 === 0 ? ((sorted[middle - 1] ?? upper) + upper) / 2 : upper);
|
|
4705
4394
|
}, "median");
|
|
4706
4395
|
|
|
4707
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
4396
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/member-history.js
|
|
4708
4397
|
var memberEvents = /* @__PURE__ */ __name((stays, revisions, since = 0) => {
|
|
4709
4398
|
const events = [];
|
|
4710
4399
|
for (const stay of stays) {
|
|
@@ -4736,7 +4425,7 @@ var memberEvents = /* @__PURE__ */ __name((stays, revisions, since = 0) => {
|
|
|
4736
4425
|
return events.filter(({ at }) => Date.parse(at) >= since).sort((a, b) => Date.parse(a.at) - Date.parse(b.at) || a.id.localeCompare(b.id));
|
|
4737
4426
|
}, "memberEvents");
|
|
4738
4427
|
|
|
4739
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
4428
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/members-audit.js
|
|
4740
4429
|
var AUDIT_PAGE = 200;
|
|
4741
4430
|
var AUDIT_BUDGET = 10;
|
|
4742
4431
|
var AUDIT_PAUSE_MS = 1e3;
|
|
@@ -4816,7 +4505,7 @@ var burstJoins = /* @__PURE__ */ __name((members) => {
|
|
|
4816
4505
|
return found;
|
|
4817
4506
|
}, "burstJoins");
|
|
4818
4507
|
|
|
4819
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
4508
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/chats.js
|
|
4820
4509
|
var EVENTS_DAYS = 7;
|
|
4821
4510
|
var TRACKED_DAYS = 30;
|
|
4822
4511
|
var STATS_PAGE = 1e3;
|
|
@@ -4876,7 +4565,7 @@ var chatsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
4876
4565
|
}
|
|
4877
4566
|
const connection = await deps.connection();
|
|
4878
4567
|
const shown = await connection.chat(chat);
|
|
4879
|
-
const card = connection.group && (shown.kind === "group" || shown.kind === "channel") ? (({ description, link:
|
|
4568
|
+
const card = connection.group && (shown.kind === "group" || shown.kind === "channel") ? (({ description, link: link4, settings }) => ({ ...shown, description, link: link4, settings }))(await connection.group(shown.id)) : shown;
|
|
4880
4569
|
if (card.members !== null || card.kind === "channel")
|
|
4881
4570
|
return card;
|
|
4882
4571
|
const held = await accountStoreIfOpen(deps);
|
|
@@ -4903,11 +4592,11 @@ var chatsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
4903
4592
|
}
|
|
4904
4593
|
return capability(await deps.connection(), "chatEvents", "read who joined or left")(chat, { since: from });
|
|
4905
4594
|
}, "events"),
|
|
4906
|
-
inspect: /* @__PURE__ */ __name(async (
|
|
4595
|
+
inspect: /* @__PURE__ */ __name(async (link4) => {
|
|
4907
4596
|
if (deps.offline) {
|
|
4908
4597
|
throw new CliError("validation_error", "`chats inspect` asks the messenger about the link; not with --offline");
|
|
4909
4598
|
}
|
|
4910
|
-
return capability(await deps.connection(), "inspect", "read a link")(
|
|
4599
|
+
return capability(await deps.connection(), "inspect", "read a link")(link4);
|
|
4911
4600
|
}, "inspect"),
|
|
4912
4601
|
stats: /* @__PURE__ */ __name(async (chat, { since, by, timezone }) => {
|
|
4913
4602
|
const store = await accountStore(deps);
|
|
@@ -5111,7 +4800,7 @@ var storedMembers = /* @__PURE__ */ __name(async (store, chatId) => {
|
|
|
5111
4800
|
return members.length === 0 ? null : members;
|
|
5112
4801
|
}, "storedMembers");
|
|
5113
4802
|
|
|
5114
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
4803
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/task-categories.js
|
|
5115
4804
|
var names = /* @__PURE__ */ __name((categories) => categories.map(({ name }) => name).join(", "), "names");
|
|
5116
4805
|
var taskCategoryOf = /* @__PURE__ */ __name((categories = DEFAULT_TASK_CATEGORIES, flag = "--category") => (typed) => {
|
|
5117
4806
|
const name = typed.trim().toLowerCase();
|
|
@@ -5161,7 +4850,7 @@ var categorize = /* @__PURE__ */ __name((text2, categories = DEFAULT_TASK_CATEGO
|
|
|
5161
4850
|
return best.name;
|
|
5162
4851
|
}, "categorize");
|
|
5163
4852
|
|
|
5164
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
4853
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/task-rules.js
|
|
5165
4854
|
var taskAccount = /* @__PURE__ */ __name(({ provider, account: account2 }) => `${provider}:${account2}`, "taskAccount");
|
|
5166
4855
|
var RULES_IN = {
|
|
5167
4856
|
dialog: "all",
|
|
@@ -5187,7 +4876,7 @@ var applyTaskRules = /* @__PURE__ */ __name(async (review, { store, account: acc
|
|
|
5187
4876
|
const owner = taskAccount(account2);
|
|
5188
4877
|
const result = { added: 0, closed: 0, review: 0 };
|
|
5189
4878
|
const sourceOf2 = /* @__PURE__ */ __name((message) => formatLocator({ provider: account2.provider, account: account2.account, chat: message.chatId, message: message.id }), "sourceOf");
|
|
5190
|
-
const
|
|
4879
|
+
const open7 = /* @__PURE__ */ __name(async (message, group, kind) => {
|
|
5191
4880
|
const { created, review: review2 = 0 } = await tasks.add({
|
|
5192
4881
|
source: sourceOf2(message),
|
|
5193
4882
|
sourceKind: "message",
|
|
@@ -5244,7 +4933,7 @@ var applyTaskRules = /* @__PURE__ */ __name(async (review, { store, account: acc
|
|
|
5244
4933
|
let held = 0;
|
|
5245
4934
|
for (const [index, { message, kind }] of opens.entries()) {
|
|
5246
4935
|
if (index >= opens.length - keep2)
|
|
5247
|
-
await
|
|
4936
|
+
await open7(message, chat.id, kind);
|
|
5248
4937
|
else if (!await hasTask(message)) {
|
|
5249
4938
|
held += 1;
|
|
5250
4939
|
onHeld?.({ source: sourceOf2(message), kind, category: categorize(message.text, categories) });
|
|
@@ -5367,7 +5056,7 @@ var applyTaskRulesToChats = /* @__PURE__ */ __name(async (store, account2, chatI
|
|
|
5367
5056
|
return passes;
|
|
5368
5057
|
}, "applyTaskRulesToChats");
|
|
5369
5058
|
|
|
5370
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5059
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/task-tag-filters.js
|
|
5371
5060
|
var taskTagFilters = /* @__PURE__ */ __name(async (store, query) => {
|
|
5372
5061
|
const tags = /* @__PURE__ */ new Map();
|
|
5373
5062
|
for (const node of query ? walkQuery(query.root) : [])
|
|
@@ -5376,7 +5065,7 @@ var taskTagFilters = /* @__PURE__ */ __name(async (store, query) => {
|
|
|
5376
5065
|
return tags;
|
|
5377
5066
|
}, "taskTagFilters");
|
|
5378
5067
|
|
|
5379
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5068
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/agenda.js
|
|
5380
5069
|
var DAY2 = 864e5;
|
|
5381
5070
|
var CLAIMS = ["none", "mine", "others", "any"];
|
|
5382
5071
|
var TASK_FIELDS = /* @__PURE__ */ new Set(["tag", "category", "claimed"]);
|
|
@@ -5414,9 +5103,9 @@ var agendaService = /* @__PURE__ */ __name((deps, now = Date.now) => ({
|
|
|
5414
5103
|
return [];
|
|
5415
5104
|
throw error;
|
|
5416
5105
|
}), "find");
|
|
5417
|
-
const
|
|
5106
|
+
const open7 = await find();
|
|
5418
5107
|
const tags = await taskTagFilters(store, parts.tasks);
|
|
5419
|
-
const listed = parts.tasks ? await find(queryFilter(parts.tasks, taskColumns(holder, at, tags), { command: "tasks agenda" })) :
|
|
5108
|
+
const listed = parts.tasks ? await find(queryFilter(parts.tasks, taskColumns(holder, at, tags), { command: "tasks agenda" })) : open7;
|
|
5420
5109
|
const tasks = listed.map((task2) => ({ task: task2, reasons: reasonsOf(task2, at, dueWithin) })).filter(({ reasons }) => reasons.length > 0).sort((a, b) => urgency(a.task) - urgency(b.task)).map(({ task: task2, reasons }) => ({
|
|
5421
5110
|
id: task2.id,
|
|
5422
5111
|
key: task2.key,
|
|
@@ -5456,7 +5145,7 @@ var agendaService = /* @__PURE__ */ __name((deps, now = Date.now) => ({
|
|
|
5456
5145
|
chat: chat.chatId,
|
|
5457
5146
|
message: lastMessageId
|
|
5458
5147
|
}),
|
|
5459
|
-
openTasks:
|
|
5148
|
+
openTasks: open7.filter((task2) => chatOf(task2.source) === chat.chatId).map((task2) => task2.id)
|
|
5460
5149
|
}));
|
|
5461
5150
|
const silentFor = /* @__PURE__ */ __name((chat) => at - Date.parse(chat.lastMessageAt), "silentFor");
|
|
5462
5151
|
const shown = {
|
|
@@ -5468,7 +5157,7 @@ var agendaService = /* @__PURE__ */ __name((deps, now = Date.now) => ({
|
|
|
5468
5157
|
const withCoverage = /* @__PURE__ */ __name((list2) => list2.map((chat) => ({ ...chat, coverage: covered.get(chat.chatId) })), "withCoverage");
|
|
5469
5158
|
const inList = new Set((await store.tasks.categories()).map(({ name }) => name));
|
|
5470
5159
|
const unlisted = /* @__PURE__ */ new Map();
|
|
5471
|
-
for (const { category } of
|
|
5160
|
+
for (const { category } of open7)
|
|
5472
5161
|
if (category && !inList.has(category))
|
|
5473
5162
|
unlisted.set(category, (unlisted.get(category) ?? 0) + 1);
|
|
5474
5163
|
return {
|
|
@@ -5618,10 +5307,10 @@ var agendaItem = /* @__PURE__ */ __name((shown) => {
|
|
|
5618
5307
|
};
|
|
5619
5308
|
}, "agendaItem");
|
|
5620
5309
|
|
|
5621
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5310
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/archive.js
|
|
5622
5311
|
import { setTimeout as sleep3 } from "node:timers/promises";
|
|
5623
5312
|
|
|
5624
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5313
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/backfill-estimate.js
|
|
5625
5314
|
var REQUEST_MS = 400;
|
|
5626
5315
|
var estimateBackfill = /* @__PURE__ */ __name(({ ranges, held, newest, page, maxPages, pauseMs }) => {
|
|
5627
5316
|
const lowest = ranges[0];
|
|
@@ -5644,13 +5333,13 @@ var estimateBackfill = /* @__PURE__ */ __name(({ ranges, held, newest, page, max
|
|
|
5644
5333
|
};
|
|
5645
5334
|
}, "estimateBackfill");
|
|
5646
5335
|
|
|
5647
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5336
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/recovery.js
|
|
5648
5337
|
var withRecovery = /* @__PURE__ */ __name((error) => ({
|
|
5649
5338
|
...error,
|
|
5650
5339
|
retryable: typeof error.retryable === "boolean" ? error.retryable : error.code === "rate_limited" || error.status === 429
|
|
5651
5340
|
}), "withRecovery");
|
|
5652
5341
|
|
|
5653
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5342
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/batch.js
|
|
5654
5343
|
var actionable = /* @__PURE__ */ __name((error) => {
|
|
5655
5344
|
if (isCliFailure(error))
|
|
5656
5345
|
return withRecovery({ code: error.code, message: error.message, ...error.details });
|
|
@@ -5733,7 +5422,7 @@ var mergeBatches = /* @__PURE__ */ __name((a, b) => {
|
|
|
5733
5422
|
};
|
|
5734
5423
|
}, "mergeBatches");
|
|
5735
5424
|
|
|
5736
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5425
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/patience.js
|
|
5737
5426
|
import { setTimeout as sleep2 } from "node:timers/promises";
|
|
5738
5427
|
var LONGEST_WAIT_MS = 5 * 60 * 1e3;
|
|
5739
5428
|
var patiently = /* @__PURE__ */ __name(async (request, note, stop) => {
|
|
@@ -5756,7 +5445,7 @@ var patiently = /* @__PURE__ */ __name(async (request, note, stop) => {
|
|
|
5756
5445
|
}
|
|
5757
5446
|
}, "patiently");
|
|
5758
5447
|
|
|
5759
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5448
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/conversations/link.js
|
|
5760
5449
|
var RULES_VERSION = 5;
|
|
5761
5450
|
var LOOK_BACK = 50;
|
|
5762
5451
|
var SAME_SENDER_WITHIN = 10;
|
|
@@ -5788,7 +5477,7 @@ var linkMessages = /* @__PURE__ */ __name((messages, { handles = /* @__PURE__ */
|
|
|
5788
5477
|
}
|
|
5789
5478
|
return { links, parents, conversations };
|
|
5790
5479
|
}, "linkMessages");
|
|
5791
|
-
var replyLink = /* @__PURE__ */ __name((message, held) => message.replyToId !== void 0 && held.has(message.replyToId) ? [
|
|
5480
|
+
var replyLink = /* @__PURE__ */ __name((message, held) => message.replyToId !== void 0 && held.has(message.replyToId) ? [link2(message, message.replyToId, "provider", "reply", 1, "reply")] : [], "replyLink");
|
|
5792
5481
|
var mentionLinks = /* @__PURE__ */ __name((message, window2, handles) => {
|
|
5793
5482
|
const links = [];
|
|
5794
5483
|
const people = new Set([...mentioned(message.text, handles)].flatMap((handle) => handles.get(handle) ?? []));
|
|
@@ -5799,7 +5488,7 @@ var mentionLinks = /* @__PURE__ */ __name((message, window2, handles) => {
|
|
|
5799
5488
|
continue;
|
|
5800
5489
|
const target = latest(window2, (candidate) => candidate.senderId === sender && sameThread(candidate, message));
|
|
5801
5490
|
if (target)
|
|
5802
|
-
links.push(
|
|
5491
|
+
links.push(link2(message, target.id, "rule", "mention", 0.8, "mention-v1"));
|
|
5803
5492
|
}
|
|
5804
5493
|
return links;
|
|
5805
5494
|
}, "mentionLinks");
|
|
@@ -5808,7 +5497,7 @@ var sameSenderLink = /* @__PURE__ */ __name((message, window2) => {
|
|
|
5808
5497
|
return [];
|
|
5809
5498
|
const at = Date.parse(message.timestamp);
|
|
5810
5499
|
const target = latest(window2.slice(-SAME_SENDER_WITHIN), (candidate) => candidate.senderId === message.senderId && sameThread(candidate, message) && at - Date.parse(candidate.timestamp) <= SAME_SENDER_MS);
|
|
5811
|
-
return target ? [
|
|
5500
|
+
return target ? [link2(message, target.id, "rule", "same_sender", 0.5, "same-sender-v2")] : [];
|
|
5812
5501
|
}, "sameSenderLink");
|
|
5813
5502
|
var mentioned = /* @__PURE__ */ __name((text2, handles) => {
|
|
5814
5503
|
const found = /* @__PURE__ */ new Set();
|
|
@@ -5844,9 +5533,9 @@ var latest = /* @__PURE__ */ __name((window2, matches) => {
|
|
|
5844
5533
|
return void 0;
|
|
5845
5534
|
}, "latest");
|
|
5846
5535
|
var sameThread = /* @__PURE__ */ __name((a, b) => a.threadId === b.threadId, "sameThread");
|
|
5847
|
-
var
|
|
5536
|
+
var link2 = /* @__PURE__ */ __name((message, parentId, source, kind, confidence, method) => ({ messageId: message.id, parentId, source, kind, confidence, method }), "link");
|
|
5848
5537
|
|
|
5849
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5538
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/images/context/index.js
|
|
5850
5539
|
var CONTEXT_MESSAGES = 3;
|
|
5851
5540
|
var CONTEXT_MINUTES = 10;
|
|
5852
5541
|
var MAX_CHARS = 1200;
|
|
@@ -5870,12 +5559,12 @@ var context = {
|
|
|
5870
5559
|
}, "describe")
|
|
5871
5560
|
};
|
|
5872
5561
|
|
|
5873
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5562
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/images/registry.js
|
|
5874
5563
|
var BUILT_INS = [context];
|
|
5875
5564
|
var providers = [...BUILT_INS];
|
|
5876
5565
|
var registeredImageProviders = /* @__PURE__ */ __name(() => providers, "registeredImageProviders");
|
|
5877
5566
|
|
|
5878
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5567
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/conversations.js
|
|
5879
5568
|
var READ_PAGE = 5e3;
|
|
5880
5569
|
var CHAIN = 50;
|
|
5881
5570
|
var CONVERSATION_QUERY = {
|
|
@@ -6006,7 +5695,7 @@ var conversationsService = /* @__PURE__ */ __name((deps) => {
|
|
|
6006
5695
|
}, "clearAnswers"),
|
|
6007
5696
|
links: /* @__PURE__ */ __name(async (chat, message) => {
|
|
6008
5697
|
const { store, chatId } = await found(chat);
|
|
6009
|
-
const chosenOf = /* @__PURE__ */ __name((links) => links.find((
|
|
5698
|
+
const chosenOf = /* @__PURE__ */ __name((links) => links.find((link4) => !link4.stale), "chosenOf");
|
|
6010
5699
|
const own = await store.conversations.links(chatId, message);
|
|
6011
5700
|
const chosen = chosenOf(own);
|
|
6012
5701
|
const chain = [];
|
|
@@ -6016,7 +5705,7 @@ var conversationsService = /* @__PURE__ */ __name((deps) => {
|
|
|
6016
5705
|
chain.push(parent);
|
|
6017
5706
|
parent = chosenOf(await store.conversations.links(chatId, parent))?.parentId ?? null;
|
|
6018
5707
|
}
|
|
6019
|
-
return { chat: chatId, message, links: own.map((
|
|
5708
|
+
return { chat: chatId, message, links: own.map((link4) => ({ ...link4, chosen: link4 === chosen })), chain };
|
|
6020
5709
|
}, "links")
|
|
6021
5710
|
};
|
|
6022
5711
|
}, "conversationsService");
|
|
@@ -6027,7 +5716,7 @@ var sized = /* @__PURE__ */ __name((size4) => {
|
|
|
6027
5716
|
return size4;
|
|
6028
5717
|
}, "sized");
|
|
6029
5718
|
|
|
6030
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5719
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/embeddings-maintenance.js
|
|
6031
5720
|
var REFRESH_BOUNDS = { maxChats: 20, maxChunks: 2e3 };
|
|
6032
5721
|
var MESSAGE_PAGE = 5e3;
|
|
6033
5722
|
var PER_SESSION = 8;
|
|
@@ -6046,7 +5735,7 @@ var embeddingTarget = /* @__PURE__ */ __name((deps, choice = DEFAULT_TEXT_MODEL)
|
|
|
6046
5735
|
price: remote.price,
|
|
6047
5736
|
installed: true,
|
|
6048
5737
|
perBatch: PER_REQUEST * concurrency,
|
|
6049
|
-
open: /* @__PURE__ */ __name(async () => (await import("./remote-
|
|
5738
|
+
open: /* @__PURE__ */ __name(async () => (await import("./remote-AGIJY73X.js")).openRemote(remote, apiKey, { concurrency }), "open")
|
|
6050
5739
|
};
|
|
6051
5740
|
}
|
|
6052
5741
|
const model = textModel(choice);
|
|
@@ -6063,7 +5752,7 @@ var embeddingTarget = /* @__PURE__ */ __name((deps, choice = DEFAULT_TEXT_MODEL)
|
|
|
6063
5752
|
if (!isTextModelInstalled(model, directory))
|
|
6064
5753
|
throw notDownloaded(model.id);
|
|
6065
5754
|
if (apart) {
|
|
6066
|
-
const { openProcess } = await import("./process-
|
|
5755
|
+
const { openProcess } = await import("./process-ZXO2MWRJ.js");
|
|
6067
5756
|
return openProcess(model, directory, { threads: threads ?? defaultThreads() });
|
|
6068
5757
|
}
|
|
6069
5758
|
return openEmbedder(model, directory, { threads: threads ?? defaultThreads() });
|
|
@@ -6352,7 +6041,7 @@ var shaped = /* @__PURE__ */ __name(({ chatId, builtAt, algorithmVersion, pendin
|
|
|
6352
6041
|
return { ...one, state };
|
|
6353
6042
|
}, "shaped");
|
|
6354
6043
|
|
|
6355
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6044
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/search-catchup.js
|
|
6356
6045
|
var CATCH_UP_BOUNDS = { maxChunks: 500, maxMessages: 1e4, timeMs: 3e4 };
|
|
6357
6046
|
var validateCatchUpBounds = /* @__PURE__ */ __name((options) => {
|
|
6358
6047
|
for (const [key, value, maximum] of [
|
|
@@ -6405,7 +6094,7 @@ var catchUpSearch = /* @__PURE__ */ __name(async (deps, chat, options, signal, c
|
|
|
6405
6094
|
}
|
|
6406
6095
|
}, "catchUpSearch");
|
|
6407
6096
|
|
|
6408
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6097
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/archive.js
|
|
6409
6098
|
var pushed = /* @__PURE__ */ __name((deps, what) => {
|
|
6410
6099
|
if (deps.reads === "store") {
|
|
6411
6100
|
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`);
|
|
@@ -6722,8 +6411,8 @@ var timeOfKey = /* @__PURE__ */ __name(async (store, account2, chatId, key, byTi
|
|
|
6722
6411
|
return message?.timestamp ?? fallback;
|
|
6723
6412
|
}, "timeOfKey");
|
|
6724
6413
|
|
|
6725
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6726
|
-
import { createHash as createHash6, randomUUID as
|
|
6414
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/archive-gaps.js
|
|
6415
|
+
import { createHash as createHash6, randomUUID as randomUUID4 } from "node:crypto";
|
|
6727
6416
|
var GAP_BOUNDS = { maxGaps: 5, limit: 500, timeMs: 3e4 };
|
|
6728
6417
|
var validateRepair = /* @__PURE__ */ __name((messenger, options) => {
|
|
6729
6418
|
const maxGaps = options.maxGaps ?? GAP_BOUNDS.maxGaps;
|
|
@@ -6782,7 +6471,7 @@ var gapsService = /* @__PURE__ */ __name((deps) => {
|
|
|
6782
6471
|
if (options.fingerprint !== void 0 && options.fingerprint !== before2.fingerprint)
|
|
6783
6472
|
throw new CliError("validation_error", "the gap plan changed; inspect it again before repairing");
|
|
6784
6473
|
const store = await deps.store();
|
|
6785
|
-
const holder =
|
|
6474
|
+
const holder = randomUUID4();
|
|
6786
6475
|
if (!await store.sync.claim(before2.account, before2.chat, "gaps", holder, timeMs + 5e3))
|
|
6787
6476
|
throw new CliError("validation_error", "another gap repair holds this chat; retry after it finishes");
|
|
6788
6477
|
const started = Date.now();
|
|
@@ -6859,19 +6548,19 @@ var gapsService = /* @__PURE__ */ __name((deps) => {
|
|
|
6859
6548
|
return { plan, repair };
|
|
6860
6549
|
}, "gapsService");
|
|
6861
6550
|
|
|
6862
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6551
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/attachments.js
|
|
6863
6552
|
import { createHash as createHash8 } from "node:crypto";
|
|
6864
|
-
import { constants as
|
|
6865
|
-
import { open as
|
|
6553
|
+
import { constants as constants2 } from "node:fs";
|
|
6554
|
+
import { open as open6, readFile, stat as stat2 } from "node:fs/promises";
|
|
6866
6555
|
|
|
6867
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6868
|
-
import { lstat as
|
|
6869
|
-
import { basename as
|
|
6556
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/attachments/directory.js
|
|
6557
|
+
import { lstat as lstat2, readdir as readdir2, realpath as realpath3 } from "node:fs/promises";
|
|
6558
|
+
import { basename as basename4, join as join8, relative as relative2, sep as sep2 } from "node:path";
|
|
6870
6559
|
|
|
6871
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6560
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/sends/upload.js
|
|
6872
6561
|
import { openAsBlob, realpathSync } from "node:fs";
|
|
6873
|
-
import { open as
|
|
6874
|
-
import { basename as
|
|
6562
|
+
import { open as open4, stat } from "node:fs/promises";
|
|
6563
|
+
import { basename as basename3, dirname as dirname3, extname, isAbsolute as isAbsolute2, relative, resolve as resolve5, sep } from "node:path";
|
|
6875
6564
|
var MAX_BUFFERED_UPLOAD_BYTES = 256 * 1024 * 1024;
|
|
6876
6565
|
var uploadSize = /* @__PURE__ */ __name((source) => source.kind === "file" ? source.size : source.bytes.byteLength, "uploadSize");
|
|
6877
6566
|
var PHOTO = /* @__PURE__ */ new Set([".jpg", ".jpeg", ".png", ".webp"]);
|
|
@@ -6887,7 +6576,7 @@ var SIGNATURES = {
|
|
|
6887
6576
|
}, ".webp")
|
|
6888
6577
|
};
|
|
6889
6578
|
var fileHead = /* @__PURE__ */ __name(async (path) => {
|
|
6890
|
-
const file = await
|
|
6579
|
+
const file = await open4(path, "r");
|
|
6891
6580
|
try {
|
|
6892
6581
|
const head = new Uint8Array(12);
|
|
6893
6582
|
const { bytesRead } = await file.read(head, 0, head.length, 0);
|
|
@@ -6972,7 +6661,7 @@ var refusedPlace = /* @__PURE__ */ __name((path, app, env, platform = process.pl
|
|
|
6972
6661
|
real = resolve5(realpathSync(ancestor), relative(ancestor, resolve5(path)));
|
|
6973
6662
|
break;
|
|
6974
6663
|
} catch {
|
|
6975
|
-
const parent =
|
|
6664
|
+
const parent = dirname3(ancestor);
|
|
6976
6665
|
if (parent === ancestor)
|
|
6977
6666
|
break;
|
|
6978
6667
|
ancestor = parent;
|
|
@@ -7024,7 +6713,7 @@ var readUpload = /* @__PURE__ */ __name(async (kind, path, { app, env = process.
|
|
|
7024
6713
|
if (head !== void 0 && SIGNATURES[extension]?.(head) !== true) {
|
|
7025
6714
|
throw new CliError("validation_error", `${path} is not a ${typesText(photoTypes ?? [])} image inside`);
|
|
7026
6715
|
}
|
|
7027
|
-
return { kind, name:
|
|
6716
|
+
return { kind, name: basename3(path), source: { kind: "file", path: resolve5(path), size: size4 } };
|
|
7028
6717
|
}, "readUpload");
|
|
7029
6718
|
var checkFilename = /* @__PURE__ */ __name((filename, files) => {
|
|
7030
6719
|
if (files.length === 0)
|
|
@@ -7070,28 +6759,28 @@ var readStickerFile = /* @__PURE__ */ __name(async (path, maxBytes, read) => {
|
|
|
7070
6759
|
return { name, source };
|
|
7071
6760
|
}, "readStickerFile");
|
|
7072
6761
|
|
|
7073
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6762
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/attachments/directory.js
|
|
7074
6763
|
var MAX_FILES = 1e4;
|
|
7075
6764
|
var directoryPaths = /* @__PURE__ */ __name(async (store, chat, directory, app, env) => {
|
|
7076
6765
|
if (refusedPlace(directory, app, env))
|
|
7077
6766
|
throw new CliError("validation_error", "--from-dir cannot read credential folders, the CLI's own folders or the message store");
|
|
7078
|
-
const root = await
|
|
6767
|
+
const root = await realpath3(directory).catch(() => {
|
|
7079
6768
|
throw new CliError("validation_error", "--from-dir must name an existing directory");
|
|
7080
6769
|
});
|
|
7081
|
-
const names2 = await
|
|
6770
|
+
const names2 = await readdir2(root).catch(() => {
|
|
7082
6771
|
throw new CliError("validation_error", "--from-dir must name a readable directory");
|
|
7083
6772
|
});
|
|
7084
6773
|
if (names2.length > MAX_FILES)
|
|
7085
6774
|
throw new CliError("validation_error", "--from-dir holds too many files; use a smaller directory");
|
|
7086
6775
|
const files = /* @__PURE__ */ new Map();
|
|
7087
6776
|
for (const name of names2) {
|
|
7088
|
-
const path =
|
|
7089
|
-
const info = await
|
|
6777
|
+
const path = join8(root, name);
|
|
6778
|
+
const info = await lstat2(path);
|
|
7090
6779
|
if (info.isSymbolicLink())
|
|
7091
6780
|
throw new CliError("validation_error", "--from-dir cannot read symbolic links");
|
|
7092
6781
|
if (!info.isFile())
|
|
7093
6782
|
continue;
|
|
7094
|
-
const canonical2 = await
|
|
6783
|
+
const canonical2 = await realpath3(path);
|
|
7095
6784
|
if (refusedPlace(canonical2, app, env))
|
|
7096
6785
|
throw new CliError("validation_error", "--from-dir cannot read credential files, the CLI's own files or the message store");
|
|
7097
6786
|
const inside2 = relative2(root, canonical2);
|
|
@@ -7109,20 +6798,20 @@ var directoryPaths = /* @__PURE__ */ __name(async (store, chat, directory, app,
|
|
|
7109
6798
|
group.push(file);
|
|
7110
6799
|
groups.set(file.messageId, group);
|
|
7111
6800
|
if (file.name)
|
|
7112
|
-
counts.set(
|
|
6801
|
+
counts.set(basename4(file.name), (counts.get(basename4(file.name)) ?? 0) + 1);
|
|
7113
6802
|
}
|
|
7114
6803
|
const choices = /* @__PURE__ */ new Map();
|
|
7115
6804
|
for (const group of groups.values()) {
|
|
7116
6805
|
group.sort((a, b) => a.position - b.position);
|
|
7117
6806
|
const candidates = group.map((file, index) => {
|
|
7118
6807
|
const prefix = `${file.messageId}-${index + 1}`;
|
|
7119
|
-
return [...files].filter(([name]) => name === prefix || name.startsWith(`${prefix}.`) || file.name !== null && name === `${prefix}-${
|
|
6808
|
+
return [...files].filter(([name]) => name === prefix || name.startsWith(`${prefix}.`) || file.name !== null && name === `${prefix}-${basename4(file.name)}`).map(([, path]) => path);
|
|
7120
6809
|
});
|
|
7121
6810
|
if (candidates.some((paths) => paths.length > 1))
|
|
7122
6811
|
throw new CliError("validation_error", "more than one directory file matches a download ordinal");
|
|
7123
6812
|
const complete = candidates.every((paths) => paths.length === 1);
|
|
7124
6813
|
group.forEach((file, index) => {
|
|
7125
|
-
const own = file.name === null ? void 0 :
|
|
6814
|
+
const own = file.name === null ? void 0 : basename4(file.name);
|
|
7126
6815
|
const named2 = own && counts.get(own) === 1 ? files.get(own) : void 0;
|
|
7127
6816
|
const canonical2 = complete ? candidates[index]?.[0] : void 0;
|
|
7128
6817
|
if (named2 && canonical2 && named2 !== canonical2 || !complete && own && files.has(own) && (counts.get(own) ?? 0) > 1)
|
|
@@ -8180,7 +7869,7 @@ function imageSize(input) {
|
|
|
8180
7869
|
}
|
|
8181
7870
|
__name(imageSize, "imageSize");
|
|
8182
7871
|
|
|
8183
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7872
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/attachments/ocr.js
|
|
8184
7873
|
var MAX_PAGES = 20;
|
|
8185
7874
|
var MAX_PIXELS = 2e7;
|
|
8186
7875
|
var cancelled = /* @__PURE__ */ __name((signal) => {
|
|
@@ -8331,7 +8020,7 @@ var ocrPdf = /* @__PURE__ */ __name(async (bytes2, pipeline2, load, signal) => {
|
|
|
8331
8020
|
}
|
|
8332
8021
|
}, "ocrPdf");
|
|
8333
8022
|
|
|
8334
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
8023
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/attachments/pdf-preview.js
|
|
8335
8024
|
var pdfPreview = /* @__PURE__ */ __name(async (bytes2, page, signal, load = importEngine, env = process.env) => {
|
|
8336
8025
|
const limits = pdfPreviewLimits(env);
|
|
8337
8026
|
const cancelled4 = /* @__PURE__ */ __name(() => {
|
|
@@ -8408,10 +8097,10 @@ var pdfPreview = /* @__PURE__ */ __name(async (bytes2, page, signal, load = impo
|
|
|
8408
8097
|
}
|
|
8409
8098
|
}, "pdfPreview");
|
|
8410
8099
|
|
|
8411
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
8100
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/attachments/transfer.js
|
|
8412
8101
|
import { createHash as createHash7 } from "node:crypto";
|
|
8413
|
-
import { constants
|
|
8414
|
-
import { lstat as
|
|
8102
|
+
import { constants } from "node:fs";
|
|
8103
|
+
import { lstat as lstat3, open as open5 } from "node:fs/promises";
|
|
8415
8104
|
var MAX_CHUNK_BYTES = 1024 * 1024;
|
|
8416
8105
|
var validateWindow = /* @__PURE__ */ __name(({ offsetBytes = 0, chunkBytes = 524288, ifSha256 }) => {
|
|
8417
8106
|
if (!Number.isSafeInteger(offsetBytes) || offsetBytes < 0 || !Number.isSafeInteger(chunkBytes) || chunkBytes < 1 || chunkBytes > MAX_CHUNK_BYTES || ifSha256 !== void 0 && !/^[a-f0-9]{64}$/i.test(ifSha256))
|
|
@@ -8427,14 +8116,14 @@ var retainedBytes = /* @__PURE__ */ __name(async (path, options, captureFile = f
|
|
|
8427
8116
|
}, "cancelled");
|
|
8428
8117
|
cancelled4();
|
|
8429
8118
|
try {
|
|
8430
|
-
const before2 = await
|
|
8119
|
+
const before2 = await lstat3(path);
|
|
8431
8120
|
if (!before2.isFile() || before2.isSymbolicLink())
|
|
8432
8121
|
throw new CliError("validation_error", "the retained attachment must be a regular file");
|
|
8433
8122
|
if (before2.size > maxBytes)
|
|
8434
8123
|
throw new CliError("validation_error", `the retained attachment exceeds ${maxBytes / 1024 / 1024} MiB; configure MESSAGING_ATTACHMENT_MAX_MIB`);
|
|
8435
8124
|
if (offsetBytes > before2.size)
|
|
8436
8125
|
throw new CliError("validation_error", "the byte offset is past the end of this attachment");
|
|
8437
|
-
const handle = await
|
|
8126
|
+
const handle = await open5(path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0));
|
|
8438
8127
|
try {
|
|
8439
8128
|
const opened = await handle.stat();
|
|
8440
8129
|
if (!opened.isFile() || opened.ino !== before2.ino || opened.dev !== before2.dev || opened.size !== before2.size)
|
|
@@ -8516,7 +8205,7 @@ var transferMime = /* @__PURE__ */ __name((head, hint, name = null) => {
|
|
|
8516
8205
|
return hint !== null && /^[a-z0-9.+-]+\/[a-z0-9.+-]+$/i.test(hint) ? hint : "application/octet-stream";
|
|
8517
8206
|
}, "transferMime");
|
|
8518
8207
|
|
|
8519
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
8208
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/attachments.js
|
|
8520
8209
|
var ATTACHMENT_QUERY = {
|
|
8521
8210
|
entity: "attachment",
|
|
8522
8211
|
backend: "sql",
|
|
@@ -8537,7 +8226,7 @@ var ATTACHMENT_QUERY = {
|
|
|
8537
8226
|
var PAGE3 = 200;
|
|
8538
8227
|
var outcome = /* @__PURE__ */ __name(async (file, path, load, signal, noFollow = false, ocr, env = process.env) => {
|
|
8539
8228
|
const maxBytes = attachmentMaxBytes(env);
|
|
8540
|
-
const
|
|
8229
|
+
const tooLarge2 = /* @__PURE__ */ __name(() => ({
|
|
8541
8230
|
status: "too-large",
|
|
8542
8231
|
issue: withRecovery({
|
|
8543
8232
|
code: "validation_error",
|
|
@@ -8553,15 +8242,15 @@ var outcome = /* @__PURE__ */ __name(async (file, path, load, signal, noFollow =
|
|
|
8553
8242
|
if (known2 === "unsupported")
|
|
8554
8243
|
return { status: "unsupported" };
|
|
8555
8244
|
if (size4 > maxBytes)
|
|
8556
|
-
return
|
|
8557
|
-
const handle = await
|
|
8245
|
+
return tooLarge2();
|
|
8246
|
+
const handle = await open6(path, constants2.O_RDONLY | (noFollow ? constants2.O_NOFOLLOW : 0));
|
|
8558
8247
|
let bytes2;
|
|
8559
8248
|
try {
|
|
8560
8249
|
const opened = await handle.stat();
|
|
8561
8250
|
if (!opened.isFile())
|
|
8562
8251
|
return { status: "missing" };
|
|
8563
8252
|
if (opened.size > maxBytes)
|
|
8564
|
-
return
|
|
8253
|
+
return tooLarge2();
|
|
8565
8254
|
bytes2 = new Uint8Array(await readFile(handle, { signal }));
|
|
8566
8255
|
} finally {
|
|
8567
8256
|
await handle.close();
|
|
@@ -8897,7 +8586,7 @@ var attachmentsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
8897
8586
|
}, "setText")
|
|
8898
8587
|
}), "attachmentsService");
|
|
8899
8588
|
|
|
8900
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
8589
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/chat-documents.js
|
|
8901
8590
|
var chatDocumentsService = /* @__PURE__ */ __name((deps) => ({
|
|
8902
8591
|
list: /* @__PURE__ */ __name(async (chat, { limit, offset, ref }) => {
|
|
8903
8592
|
const store = await accountStore(deps);
|
|
@@ -8927,7 +8616,7 @@ var chatDocumentsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
8927
8616
|
}, "list")
|
|
8928
8617
|
}), "chatDocumentsService");
|
|
8929
8618
|
|
|
8930
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
8619
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/retention.js
|
|
8931
8620
|
var observationDuration = /* @__PURE__ */ __name((text2, flag) => {
|
|
8932
8621
|
const match = /^(\d+(?:\.\d+)?)([smhdw])$/.exec(text2);
|
|
8933
8622
|
const units2 = { s: 1e3, m: 6e4, h: 36e5, d: 864e5, w: 6048e5 };
|
|
@@ -9014,7 +8703,7 @@ var isRetentionSelection = /* @__PURE__ */ __name((selection) => {
|
|
|
9014
8703
|
}
|
|
9015
8704
|
}, "isRetentionSelection");
|
|
9016
8705
|
|
|
9017
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
8706
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/counters.js
|
|
9018
8707
|
var counterFields = /* @__PURE__ */ __name((text2 = "views,reactions,comments") => {
|
|
9019
8708
|
const fields = text2.split(",").map((one) => one.trim());
|
|
9020
8709
|
if (!fields.length || fields.some((one) => !COUNTER_FIELDS.includes(one)) || new Set(fields).size !== fields.length)
|
|
@@ -9221,7 +8910,7 @@ var countersService = /* @__PURE__ */ __name((deps) => {
|
|
|
9221
8910
|
};
|
|
9222
8911
|
}, "countersService");
|
|
9223
8912
|
|
|
9224
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
8913
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/search-refresh.js
|
|
9225
8914
|
var SYNC_KEY = "messages.sync-first";
|
|
9226
8915
|
var SYNC_BOUNDS = { maxChats: 5, timeMs: 3e4, maxMessages: 500 };
|
|
9227
8916
|
var keyOf2 = /* @__PURE__ */ __name((chat) => JSON.stringify([chat.account.provider, chat.account.account, chat.chatId]), "keyOf");
|
|
@@ -9353,7 +9042,7 @@ var withRefresh = /* @__PURE__ */ __name((found, refreshed) => ({
|
|
|
9353
9042
|
...!refreshed || refreshed.complete ? {} : { coverage: { ...found.coverage, state: "stale" } }
|
|
9354
9043
|
}), "withRefresh");
|
|
9355
9044
|
|
|
9356
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
9045
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/embeddings-search.js
|
|
9357
9046
|
var CANDIDATES = 50;
|
|
9358
9047
|
var WORD_HITS = 200;
|
|
9359
9048
|
var RRF_K = 60;
|
|
@@ -9628,13 +9317,13 @@ var meanOf = /* @__PURE__ */ __name((vectors) => {
|
|
|
9628
9317
|
return mean.map((value) => value / length);
|
|
9629
9318
|
}, "meanOf");
|
|
9630
9319
|
|
|
9631
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
9320
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/embeddings.js
|
|
9632
9321
|
var embeddingsService = /* @__PURE__ */ __name((deps) => ({
|
|
9633
9322
|
...embeddingsMaintenance(deps),
|
|
9634
9323
|
...embeddingsSearch(deps)
|
|
9635
9324
|
}), "embeddingsService");
|
|
9636
9325
|
|
|
9637
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
9326
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/folders.js
|
|
9638
9327
|
var foldersService = /* @__PURE__ */ __name((deps) => {
|
|
9639
9328
|
const online = /* @__PURE__ */ __name(async (command) => {
|
|
9640
9329
|
if (deps.offline)
|
|
@@ -9763,19 +9452,19 @@ var foldersService = /* @__PURE__ */ __name((deps) => {
|
|
|
9763
9452
|
await guardedWrite(deps.guard, { operationId, chatId: null, kind: "account", action: "folder-order" }, () => reorder(folders.map((one) => one.id)));
|
|
9764
9453
|
return { operationId, folders: folders.map(({ id: id2, title }) => ({ id: id2, title })) };
|
|
9765
9454
|
}, "order"),
|
|
9766
|
-
join: /* @__PURE__ */ __name(async (
|
|
9767
|
-
if (
|
|
9455
|
+
join: /* @__PURE__ */ __name(async (link4) => {
|
|
9456
|
+
if (link4.trim() === "")
|
|
9768
9457
|
throw new CliError("validation_error", "give the folder's link");
|
|
9769
9458
|
const connection = await online("chats folders join");
|
|
9770
|
-
const
|
|
9459
|
+
const join10 = capability(connection, "joinFolder", "join a shared folder");
|
|
9771
9460
|
const operationId = newOperationId();
|
|
9772
|
-
const folder = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "account", action: "folder-join" }, () =>
|
|
9461
|
+
const folder = await guardedWrite(deps.guard, { operationId, chatId: null, kind: "account", action: "folder-join" }, () => join10(link4.trim()));
|
|
9773
9462
|
return { operationId, folder };
|
|
9774
9463
|
}, "join")
|
|
9775
9464
|
};
|
|
9776
9465
|
}, "foldersService");
|
|
9777
9466
|
|
|
9778
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
9467
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/inbox.js
|
|
9779
9468
|
var INBOX_CHATS = 20;
|
|
9780
9469
|
var REVIEW_DAYS = 3;
|
|
9781
9470
|
var UNANSWERED_HOURS = 24;
|
|
@@ -9928,7 +9617,7 @@ var reviewIn = /* @__PURE__ */ __name(async (adapter, { since, points, chat, kin
|
|
|
9928
9617
|
await onReviewed?.(reviewed);
|
|
9929
9618
|
if (unansweredAfterHours === void 0)
|
|
9930
9619
|
return reviewed;
|
|
9931
|
-
const
|
|
9620
|
+
const open7 = [];
|
|
9932
9621
|
for (const one of reviewed.chats) {
|
|
9933
9622
|
const admins = answerers2.get(one.id);
|
|
9934
9623
|
const questions2 = unanswered(one.messages, {
|
|
@@ -9936,10 +9625,10 @@ var reviewIn = /* @__PURE__ */ __name(async (adapter, { since, points, chat, kin
|
|
|
9936
9625
|
before: now - unansweredAfterHours * 36e5
|
|
9937
9626
|
});
|
|
9938
9627
|
if (questions2.length > 0) {
|
|
9939
|
-
|
|
9628
|
+
open7.push({ ...one, messages: questions2, answeredBy: admins === void 0 ? "owner" : "owner-and-admins" });
|
|
9940
9629
|
}
|
|
9941
9630
|
}
|
|
9942
|
-
return { ...reviewed, chats:
|
|
9631
|
+
return { ...reviewed, chats: open7, unanswered: { olderThanHours: unansweredAfterHours } };
|
|
9943
9632
|
}, "reviewIn");
|
|
9944
9633
|
var inboxService = /* @__PURE__ */ __name((deps) => {
|
|
9945
9634
|
const reader = /* @__PURE__ */ __name(async () => {
|
|
@@ -9983,7 +9672,7 @@ var inboxService = /* @__PURE__ */ __name((deps) => {
|
|
|
9983
9672
|
};
|
|
9984
9673
|
}, "inboxService");
|
|
9985
9674
|
|
|
9986
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
9675
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/mentions.js
|
|
9987
9676
|
var REVIEW_COUNT = 500;
|
|
9988
9677
|
var mentionsService = /* @__PURE__ */ __name((deps) => {
|
|
9989
9678
|
const located = /* @__PURE__ */ __name(async () => {
|
|
@@ -10062,7 +9751,7 @@ var mentionsService = /* @__PURE__ */ __name((deps) => {
|
|
|
10062
9751
|
};
|
|
10063
9752
|
}, "mentionsService");
|
|
10064
9753
|
|
|
10065
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
9754
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/message-link.js
|
|
10066
9755
|
var messageLinkTarget = /* @__PURE__ */ __name((reference, message, provider) => {
|
|
10067
9756
|
if (isLocator(reference)) {
|
|
10068
9757
|
if (message !== void 0)
|
|
@@ -10092,24 +9781,24 @@ var validMessageId = /* @__PURE__ */ __name((id2) => {
|
|
|
10092
9781
|
}))
|
|
10093
9782
|
throw new CliError("validation_error", "a message id must be nonempty, at most 256 characters, without spaces or controls");
|
|
10094
9783
|
}, "validMessageId");
|
|
10095
|
-
var validatePermalink = /* @__PURE__ */ __name((
|
|
10096
|
-
if (
|
|
10097
|
-
if (
|
|
9784
|
+
var validatePermalink = /* @__PURE__ */ __name((link4) => {
|
|
9785
|
+
if (link4.url === null) {
|
|
9786
|
+
if (link4.access !== "unavailable" || !["unsupported_chat", "unsupported_provider", "offline"].includes(link4.reason))
|
|
10098
9787
|
throw new CliError("validation_error", "the messenger returned invalid permalink metadata");
|
|
10099
|
-
return { url:
|
|
9788
|
+
return { url: link4.url, access: link4.access, reason: link4.reason };
|
|
10100
9789
|
}
|
|
10101
9790
|
let url;
|
|
10102
9791
|
try {
|
|
10103
|
-
url = new URL(
|
|
9792
|
+
url = new URL(link4.url);
|
|
10104
9793
|
} catch {
|
|
10105
9794
|
throw new CliError("validation_error", "the messenger returned an invalid permalink");
|
|
10106
9795
|
}
|
|
10107
|
-
if (url.protocol !== "https:" || url.username || url.password || /\s/u.test(
|
|
9796
|
+
if (url.protocol !== "https:" || url.username || url.password || /\s/u.test(link4.url) || link4.reason !== null || !["public", "restricted", "unknown"].includes(link4.access))
|
|
10108
9797
|
throw new CliError("validation_error", "the messenger returned an invalid permalink");
|
|
10109
|
-
return { url:
|
|
9798
|
+
return { url: link4.url, access: link4.access, reason: link4.reason };
|
|
10110
9799
|
}, "validatePermalink");
|
|
10111
9800
|
|
|
10112
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
9801
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/pin-duration.js
|
|
10113
9802
|
var spokenSeconds = /* @__PURE__ */ __name((seconds) => {
|
|
10114
9803
|
if (seconds % 86400 === 0 && seconds > 86400)
|
|
10115
9804
|
return `${seconds / 86400}d`;
|
|
@@ -10141,7 +9830,7 @@ var pinDurationOf = /* @__PURE__ */ __name((value, allowed, flag = "--expire-tim
|
|
|
10141
9830
|
return seconds;
|
|
10142
9831
|
}, "pinDurationOf");
|
|
10143
9832
|
|
|
10144
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
9833
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/sends/send-as.js
|
|
10145
9834
|
var sendAsCheck = /* @__PURE__ */ __name((connection, sendAs) => {
|
|
10146
9835
|
if (sendAs === void 0) {
|
|
10147
9836
|
const saved = connection.savedSender?.bind(connection);
|
|
@@ -10166,7 +9855,18 @@ var typedSendAs = /* @__PURE__ */ __name((typed) => {
|
|
|
10166
9855
|
return sendAs;
|
|
10167
9856
|
}, "typedSendAs");
|
|
10168
9857
|
|
|
10169
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
9858
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/search/total.js
|
|
9859
|
+
var TOTAL_CAP = 1e4;
|
|
9860
|
+
var totalOf = /* @__PURE__ */ __name((count2, shown, hasMore, exact = true) => {
|
|
9861
|
+
const least = shown + (hasMore ? 1 : 0);
|
|
9862
|
+
if (count2 === void 0 || count2 < least)
|
|
9863
|
+
return { value: least, relation: "gte" };
|
|
9864
|
+
if (count2 > TOTAL_CAP)
|
|
9865
|
+
return { value: TOTAL_CAP, relation: "gte" };
|
|
9866
|
+
return { value: count2, relation: exact ? "eq" : "gte" };
|
|
9867
|
+
}, "totalOf");
|
|
9868
|
+
|
|
9869
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/search/question-plan.js
|
|
10170
9870
|
var words = /* @__PURE__ */ __name((text2) => normalize(text2).match(/[\p{L}\p{N}]+/gu) ?? [], "words");
|
|
10171
9871
|
var scaffolding = new Set(words("what which how many much who where when is are was were do does did can could should we the a an for of to under from in on at has have \u0441\u043A\u043E\u043B\u044C\u043A\u043E \u043A\u0430\u043A\u043E\u0439 \u043A\u0430\u043A\u0430\u044F \u043A\u0430\u043A\u0438\u0435 \u043A\u0430\u043A\u043E\u0435 \u043A\u0442\u043E \u043A\u043E\u043C\u0443 \u043A\u0435\u043C \u0433\u0434\u0435 \u043A\u043E\u0433\u0434\u0430 \u043A\u0430\u043A \u0447\u0442\u043E \u0432\u043E \u043F\u043E \u043D\u0430 \u0432 \u043A \u0441 \u0443 \u0447\u0435\u0440\u0435\u0437 \u043B\u0438 \u0434\u043E\u043B\u0436\u0435\u043D \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0443\u0436\u043D\u043E \u0438\u0434\u0451\u0442 \u0438\u0434\u0435\u0442 \u043C\u043E\u0436\u043D\u043E \u043C\u043E\u0436\u0435\u0442 \u043C\u043E\u0433\u0443\u0442"));
|
|
10172
9872
|
var questionWord = /\b(?:what|which|how|who|where|when|can|could|should)\b|(?:^|\s)(?:сколько|какой|какая|какие|какое|кто|кому|кем|где|когда|как|что|можно|может|могут|ли)(?:\s|$)/iu;
|
|
@@ -10282,7 +9982,7 @@ function planQuestion(text2, strict = false) {
|
|
|
10282
9982
|
}
|
|
10283
9983
|
__name(planQuestion, "planQuestion");
|
|
10284
9984
|
|
|
10285
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
9985
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/messages-combined.js
|
|
10286
9986
|
var COMBINED_DEFAULTS = { candidateDepth: 300, rrfK: 60, rerank: "all", chatCap: 0 };
|
|
10287
9987
|
var tokensOf = /* @__PURE__ */ __name((text2) => normalize(text2).match(/[\p{L}\p{N}\p{Co}\p{M}]+/gu) ?? [], "tokensOf");
|
|
10288
9988
|
var searchCombined = /* @__PURE__ */ __name(async (store, account2, request, messenger = {}, options = COMBINED_DEFAULTS) => {
|
|
@@ -10475,7 +10175,7 @@ var signals = /* @__PURE__ */ __name((hit, terms, corrections, execution, mode,
|
|
|
10475
10175
|
return mode === "coverage" ? coverage * 4 : mode === "proximity" ? proximity : mode === "phrase" ? phrase : coverage * 4 + proximity + phrase;
|
|
10476
10176
|
}, "signals");
|
|
10477
10177
|
|
|
10478
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10178
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/messages-discovery.js
|
|
10479
10179
|
var MEANING_DEPTH = 100;
|
|
10480
10180
|
var RRF_K2 = 60;
|
|
10481
10181
|
var RERANK_DEPTH = 50;
|
|
@@ -10486,8 +10186,12 @@ var FOLLOW_UP_HITS = 5;
|
|
|
10486
10186
|
var FOLLOW_UPS_PER_HIT = 2;
|
|
10487
10187
|
var RARE_AT = 3;
|
|
10488
10188
|
var FOLLOW_UP_CANDIDATES = 20;
|
|
10189
|
+
var discoveryRequest = /* @__PURE__ */ __name((asked) => asked.ast !== void 0 || asked.exact || !asked.text ? asked : {
|
|
10190
|
+
...asked,
|
|
10191
|
+
text: asked.text.replace(new RegExp("(?<=\\p{L})\\?(?=\\s|$)", "gu"), "").replace(/"(?:[^"\\]|\\.)*"|(?<=\d):(?=\d)/gu, (found) => found === ":" ? " " : found)
|
|
10192
|
+
}, "discoveryRequest");
|
|
10489
10193
|
var searchDiscovery = /* @__PURE__ */ __name(async (store, account2, asked, messenger = {}, meaning, rerank) => {
|
|
10490
|
-
const request = asked
|
|
10194
|
+
const request = discoveryRequest(asked);
|
|
10491
10195
|
const original = await prepareLucene(store, account2, request, messenger);
|
|
10492
10196
|
const text2 = request.text ?? "";
|
|
10493
10197
|
const plan = planQuestion(text2, request.ast !== void 0 || !!request.exact || !!request.newest);
|
|
@@ -10776,7 +10480,7 @@ var mixedWithReranker = /* @__PURE__ */ __name((head, scores) => {
|
|
|
10776
10480
|
})).sort((a, b) => b.mixed - a.mixed).map(({ hit }) => hit);
|
|
10777
10481
|
}, "mixedWithReranker");
|
|
10778
10482
|
|
|
10779
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10483
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/thread-context.js
|
|
10780
10484
|
var THREAD_BOUNDS = { maxHops: 8, maxMessages: 50, maxBytes: 65536, withinMs: 864e5 };
|
|
10781
10485
|
var bytes = /* @__PURE__ */ __name((items, links) => Buffer.byteLength(JSON.stringify({ items, links }), "utf8"), "bytes");
|
|
10782
10486
|
var threadBounds = /* @__PURE__ */ __name((options = {}) => {
|
|
@@ -10876,14 +10580,14 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account2, chat, mes
|
|
|
10876
10580
|
const rows = await store.conversations.links(account2, chat, id2, { limit: bounds.maxMessages + 1 });
|
|
10877
10581
|
if (rows.length > bounds.maxMessages)
|
|
10878
10582
|
stopped("links");
|
|
10879
|
-
cache.set(id2, rows.slice(0, bounds.maxMessages).map((
|
|
10880
|
-
...
|
|
10881
|
-
stale:
|
|
10583
|
+
cache.set(id2, rows.slice(0, bounds.maxMessages).map((link4) => ({
|
|
10584
|
+
...link4,
|
|
10585
|
+
stale: link4.stale || link4.source !== "agent" && state.algorithmVersion !== RULES_VERSION
|
|
10882
10586
|
})));
|
|
10883
10587
|
}
|
|
10884
10588
|
return cache.get(id2);
|
|
10885
10589
|
}, "linksOf");
|
|
10886
|
-
const chosen = /* @__PURE__ */ __name((links) => links.find((
|
|
10590
|
+
const chosen = /* @__PURE__ */ __name((links) => links.find((link4) => !link4.stale), "chosen");
|
|
10887
10591
|
const queue = [{ id: message, hops: 0 }];
|
|
10888
10592
|
const queued = /* @__PURE__ */ new Set([message]);
|
|
10889
10593
|
const parents = /* @__PURE__ */ new Map();
|
|
@@ -10914,8 +10618,8 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account2, chat, mes
|
|
|
10914
10618
|
const displayed = node.id === message ? { ...body, anchor: true } : body;
|
|
10915
10619
|
const own = await linksOf(node.id);
|
|
10916
10620
|
const parent = chosen(own);
|
|
10917
|
-
const evidence = own.filter((
|
|
10918
|
-
result.stale ||= evidence.some((
|
|
10621
|
+
const evidence = own.filter((link4) => link4 === parent || link4.stale).map((link4) => ({ ...link4, messageId: node.id, chosen: link4 === parent })).filter((link4) => !result.links.some((old) => old.messageId === link4.messageId && old.parentId === link4.parentId && old.source === link4.source && old.kind === link4.kind && old.method === link4.method));
|
|
10622
|
+
result.stale ||= evidence.some((link4) => link4.stale);
|
|
10919
10623
|
if (bytes([...result.items, displayed], [...result.links, ...evidence]) > bounds.maxBytes) {
|
|
10920
10624
|
stopped("bytes");
|
|
10921
10625
|
break;
|
|
@@ -10951,9 +10655,9 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account2, chat, mes
|
|
|
10951
10655
|
const childLinks = await linksOf(child.messageId);
|
|
10952
10656
|
if (chosen(childLinks)?.parentId === node.id)
|
|
10953
10657
|
add(child.messageId);
|
|
10954
|
-
else if (childLinks.some((
|
|
10658
|
+
else if (childLinks.some((link4) => link4.stale && link4.parentId === node.id)) {
|
|
10955
10659
|
result.stale = true;
|
|
10956
|
-
const stale = childLinks.filter((
|
|
10660
|
+
const stale = childLinks.filter((link4) => link4.stale && link4.parentId === node.id).map((link4) => ({ ...link4, messageId: child.messageId, chosen: false })).filter((link4) => !result.links.some((old) => old.messageId === link4.messageId && old.parentId === link4.parentId && old.source === link4.source && old.kind === link4.kind && old.method === link4.method));
|
|
10957
10661
|
if (bytes(result.items, [...result.links, ...stale]) <= bounds.maxBytes)
|
|
10958
10662
|
result.links.push(...stale);
|
|
10959
10663
|
else
|
|
@@ -10975,7 +10679,7 @@ var readThreadContext = /* @__PURE__ */ __name(async (store, account2, chat, mes
|
|
|
10975
10679
|
return result;
|
|
10976
10680
|
}, "readThreadContext");
|
|
10977
10681
|
|
|
10978
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10682
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/messages-archive-search.js
|
|
10979
10683
|
var SEARCH_FILL_MS = 200;
|
|
10980
10684
|
var statsStore = /* @__PURE__ */ __name(async (store, account2, request, messenger = {}) => {
|
|
10981
10685
|
const stop = Date.now() + SEARCH_FILL_MS;
|
|
@@ -11010,8 +10714,15 @@ var searchStore = /* @__PURE__ */ __name(async (store, account2, request, messen
|
|
|
11010
10714
|
if (!Number.isInteger(offset) || offset < 0 || offset > MAX_SEARCH_OFFSET)
|
|
11011
10715
|
throw new CliError("validation_error", `offset takes a whole number from 0 to ${MAX_SEARCH_OFFSET}`);
|
|
11012
10716
|
const found = await searchPage(store, account2, { ...request, limit: request.limit + offset }, messenger, meaning, rerank);
|
|
10717
|
+
const discovery = found.query?.discovery;
|
|
10718
|
+
const total = discovery ? totalOf(discovery.candidates, found.items.length, found.hasMore, !discovery.truncated) : totalOf(await countLucene(store, account2, { ...request.discover ? discoveryRequest(request) : request, limit: request.limit + offset }, messenger, TOTAL_CAP).catch((error) => {
|
|
10719
|
+
if (isCliError(error) && error.details.reason === "query.too-large")
|
|
10720
|
+
return void 0;
|
|
10721
|
+
throw error;
|
|
10722
|
+
}), found.items.length, found.hasMore);
|
|
11013
10723
|
return {
|
|
11014
10724
|
...found,
|
|
10725
|
+
total,
|
|
11015
10726
|
items: found.items.slice(offset),
|
|
11016
10727
|
...found.hasMore && offset + request.limit <= MAX_SEARCH_OFFSET ? { nextOffset: offset + request.limit } : {}
|
|
11017
10728
|
};
|
|
@@ -11035,12 +10746,12 @@ var accountOf2 = /* @__PURE__ */ __name((hit) => {
|
|
|
11035
10746
|
}, "accountOf");
|
|
11036
10747
|
var keyOf3 = /* @__PURE__ */ __name(({ provider, account: account2 }) => `${provider}/${account2}`, "keyOf");
|
|
11037
10748
|
|
|
11038
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10749
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/pictures.js
|
|
11039
10750
|
import { createHash as createHash9 } from "node:crypto";
|
|
11040
10751
|
import { readFile as readFile2, stat as stat3 } from "node:fs/promises";
|
|
11041
10752
|
import { setTimeout as sleep4 } from "node:timers/promises";
|
|
11042
10753
|
|
|
11043
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10754
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/models.js
|
|
11044
10755
|
var GROUP_SETTINGS = [
|
|
11045
10756
|
"allCanPin",
|
|
11046
10757
|
"onlyAdminsAdd",
|
|
@@ -11054,10 +10765,10 @@ var ADMIN_RIGHTS = ["read", "members", "admins", "info", "pin", "link", "post",
|
|
|
11054
10765
|
var senderIsMe = /* @__PURE__ */ __name((message, account2) => message.outgoing === true || message.senderId !== null && String(message.senderId) === account2, "senderIsMe");
|
|
11055
10766
|
var MEDIA_KINDS = ["photo", "video", "file", "audio", "link"];
|
|
11056
10767
|
|
|
11057
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10768
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/file-download.js
|
|
11058
10769
|
import { createWriteStream, mkdirSync } from "node:fs";
|
|
11059
|
-
import { link as
|
|
11060
|
-
import { basename as
|
|
10770
|
+
import { link as link3, rm } from "node:fs/promises";
|
|
10771
|
+
import { basename as basename5, join as join9, resolve as resolve6 } from "node:path";
|
|
11061
10772
|
import { Readable, Transform } from "node:stream";
|
|
11062
10773
|
import { pipeline } from "node:stream/promises";
|
|
11063
10774
|
var refreshedFiles = /* @__PURE__ */ __name((files) => files.flatMap(({ kind, name, position, providerRef }) => providerRef === void 0 || Object.keys(providerRef).length === 0 ? [] : [
|
|
@@ -11132,7 +10843,7 @@ var EXTENSIONS = {
|
|
|
11132
10843
|
};
|
|
11133
10844
|
var BY_KIND = { photo: "jpg" };
|
|
11134
10845
|
var safeName = /* @__PURE__ */ __name((name, platform = process.platform) => {
|
|
11135
|
-
let plain = name === void 0 ? "" :
|
|
10846
|
+
let plain = name === void 0 ? "" : basename5(name.replaceAll("\\", "/")).replace(/[\p{Cc}---]/gu, "").replace(/^\.+/, "");
|
|
11136
10847
|
if (platform === "win32") {
|
|
11137
10848
|
plain = plain.replace(/[<>:"|?*]/g, "_").replace(/[. ]+$/, "");
|
|
11138
10849
|
if (/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(plain))
|
|
@@ -11146,7 +10857,7 @@ var save = /* @__PURE__ */ __name(async (file, directory, fallbackName, { unique
|
|
|
11146
10857
|
const extension = EXTENSIONS[file.mime ?? ""] ?? BY_KIND[file.kind];
|
|
11147
10858
|
return own ?? (extension ? `${fallbackName}.${extension}` : fallbackName);
|
|
11148
10859
|
}, "fileName");
|
|
11149
|
-
const partial =
|
|
10860
|
+
const partial = join9(directory, `.${fileName()}.${process.pid}.part`);
|
|
11150
10861
|
let bytes2 = 0;
|
|
11151
10862
|
const counting = new Transform({
|
|
11152
10863
|
transform(chunk, _encoding, done2) {
|
|
@@ -11159,8 +10870,8 @@ var save = /* @__PURE__ */ __name(async (file, directory, fallbackName, { unique
|
|
|
11159
10870
|
const name = fileName();
|
|
11160
10871
|
const names2 = unique && own ? [name, `${fallbackName}-${own}`] : [name];
|
|
11161
10872
|
for (const candidate of names2) {
|
|
11162
|
-
const path2 = resolve6(
|
|
11163
|
-
const taken = await
|
|
10873
|
+
const path2 = resolve6(join9(directory, candidate));
|
|
10874
|
+
const taken = await link3(partial, path2).then(() => false, (error) => {
|
|
11164
10875
|
if (error.code === "EEXIST")
|
|
11165
10876
|
return true;
|
|
11166
10877
|
throw error;
|
|
@@ -11168,7 +10879,7 @@ var save = /* @__PURE__ */ __name(async (file, directory, fallbackName, { unique
|
|
|
11168
10879
|
if (!taken)
|
|
11169
10880
|
return { kind: file.kind, path: path2, bytes: bytes2 };
|
|
11170
10881
|
}
|
|
11171
|
-
const path = resolve6(
|
|
10882
|
+
const path = resolve6(join9(directory, names2.at(-1) ?? name));
|
|
11172
10883
|
if (unique)
|
|
11173
10884
|
return { kind: file.kind, path, bytes: bytes2, existing: true };
|
|
11174
10885
|
throw new CliError("validation_error", `${path} already exists \u2014 nothing was overwritten; choose --output-dir`);
|
|
@@ -11177,7 +10888,7 @@ var save = /* @__PURE__ */ __name(async (file, directory, fallbackName, { unique
|
|
|
11177
10888
|
}
|
|
11178
10889
|
}, "save");
|
|
11179
10890
|
|
|
11180
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10891
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/pictures.js
|
|
11181
10892
|
var PICTURE_MAX_BYTES = 25 * 1024 * 1024;
|
|
11182
10893
|
var PICTURE_FLOOR = 0.25;
|
|
11183
10894
|
var PAGE4 = 50;
|
|
@@ -11187,18 +10898,18 @@ var missingModel = /* @__PURE__ */ __name((id2) => `the picture model is not dow
|
|
|
11187
10898
|
var plainWords = /* @__PURE__ */ __name((query) => query.replace(/\b(?:text|content|transcript|filename):("[^"]*"|\S+)/gi, "$1").replace(/\b[a-z_]+:("[^"]*"|\[[^\]]*\]|\{[^}]*\}|\([^)]*\)|\S+)/gi, " ").replace(/\b(?:AND|OR|NOT)\b/g, " ").replace(/[()"+\-~^*?\\[\]{}!|&]/g, " ").replace(/\s+/g, " ").trim(), "plainWords");
|
|
11188
10899
|
var picturesService = /* @__PURE__ */ __name((deps) => {
|
|
11189
10900
|
let opened;
|
|
11190
|
-
const
|
|
10901
|
+
const open7 = /* @__PURE__ */ __name(async () => {
|
|
11191
10902
|
if (deps.pictureEmbedder)
|
|
11192
10903
|
return deps.pictureEmbedder();
|
|
11193
10904
|
const model2 = imageModel(DEFAULT_IMAGE_MODEL);
|
|
11194
10905
|
const directory = imageModelsDirectory(deps.env);
|
|
11195
10906
|
if (!isImageModelInstalled(model2, directory))
|
|
11196
10907
|
throw new CliError("not_found", missingModel(model2.id), { reason: "model.not-downloaded", model: model2.id });
|
|
11197
|
-
const { openPictureEmbedder } = await import("./embedder-
|
|
10908
|
+
const { openPictureEmbedder } = await import("./embedder-6ULWRG3R.js");
|
|
11198
10909
|
return openPictureEmbedder(model2, directory);
|
|
11199
10910
|
}, "open");
|
|
11200
10911
|
const embedder = /* @__PURE__ */ __name(() => {
|
|
11201
|
-
opened ??=
|
|
10912
|
+
opened ??= open7().catch((error) => {
|
|
11202
10913
|
opened = void 0;
|
|
11203
10914
|
throw error;
|
|
11204
10915
|
});
|
|
@@ -11391,7 +11102,7 @@ var withPictures = /* @__PURE__ */ __name((messages, pictures) => ({
|
|
|
11391
11102
|
}, "search")
|
|
11392
11103
|
}), "withPictures");
|
|
11393
11104
|
|
|
11394
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
11105
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/messages-meaning.js
|
|
11395
11106
|
var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, shared) => {
|
|
11396
11107
|
const target = embeddingTarget(deps, DEFAULT_TEXT_MODEL);
|
|
11397
11108
|
const skipped = /* @__PURE__ */ __name((reason, step) => ({
|
|
@@ -11439,7 +11150,7 @@ var meaningLane = /* @__PURE__ */ __name((deps) => async (question, accounts, sh
|
|
|
11439
11150
|
}
|
|
11440
11151
|
}, "meaningLane");
|
|
11441
11152
|
|
|
11442
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
11153
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/messages-rerank.js
|
|
11443
11154
|
var rerankLane = /* @__PURE__ */ __name((deps) => {
|
|
11444
11155
|
const choice = deps.reranker ?? DEFAULT_RERANK_MODEL;
|
|
11445
11156
|
if (choice === "off")
|
|
@@ -11451,9 +11162,9 @@ var rerankLane = /* @__PURE__ */ __name((deps) => {
|
|
|
11451
11162
|
return { skipped: { reason: `${model.id} is not downloaded`, step: "models.download", model: model.id } };
|
|
11452
11163
|
try {
|
|
11453
11164
|
const warm = deps.embedders;
|
|
11454
|
-
const reranker = warm ? await warm.reranker(`rerank:${model.id}`, async () => (await import("./process-
|
|
11165
|
+
const reranker = warm ? await warm.reranker(`rerank:${model.id}`, async () => (await import("./process-ZXO2MWRJ.js")).openRerankerProcess(model, directory, {
|
|
11455
11166
|
threads: defaultThreads()
|
|
11456
|
-
})) : await (await import("./rerank-
|
|
11167
|
+
})) : await (await import("./rerank-R6PE44M5.js")).openReranker(model, directory);
|
|
11457
11168
|
return {
|
|
11458
11169
|
model: model.id,
|
|
11459
11170
|
score: /* @__PURE__ */ __name((question, passages) => reranker.score(plainWords(question), passages), "score"),
|
|
@@ -11473,7 +11184,7 @@ var rerankLane = /* @__PURE__ */ __name((deps) => {
|
|
|
11473
11184
|
};
|
|
11474
11185
|
}, "rerankLane");
|
|
11475
11186
|
|
|
11476
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
11187
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/document-pictures.js
|
|
11477
11188
|
import { createHash as createHash10 } from "node:crypto";
|
|
11478
11189
|
var refOf = /* @__PURE__ */ __name((target) => target.ref ?? `document:${target.documentId}`, "refOf");
|
|
11479
11190
|
var openPictureEmbedderFor = /* @__PURE__ */ __name(async ({ env, command } = {}) => {
|
|
@@ -11481,7 +11192,7 @@ var openPictureEmbedderFor = /* @__PURE__ */ __name(async ({ env, command } = {}
|
|
|
11481
11192
|
const directory = imageModelsDirectory(env);
|
|
11482
11193
|
if (!isImageModelInstalled(model, directory))
|
|
11483
11194
|
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 });
|
|
11484
|
-
const { openPictureEmbedder } = await import("./embedder-
|
|
11195
|
+
const { openPictureEmbedder } = await import("./embedder-6ULWRG3R.js");
|
|
11485
11196
|
return openPictureEmbedder(model, directory);
|
|
11486
11197
|
}, "openPictureEmbedderFor");
|
|
11487
11198
|
var savePicture = /* @__PURE__ */ __name(async (store, target, bytes2, options = {}) => {
|
|
@@ -11502,24 +11213,22 @@ var savePicture = /* @__PURE__ */ __name(async (store, target, bytes2, options =
|
|
|
11502
11213
|
}, "savePicture");
|
|
11503
11214
|
var removePicture = /* @__PURE__ */ __name((store, target) => store.notes.removePicture(refOf(target)), "removePicture");
|
|
11504
11215
|
|
|
11505
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
11216
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/document-source.js
|
|
11506
11217
|
var documentSource = /* @__PURE__ */ __name((note, accounts, profiles, file) => {
|
|
11507
11218
|
const metadata = note.frontMatter;
|
|
11508
11219
|
const account2 = accounts.find(({ id: id2 }) => String(id2) === note.folderId);
|
|
11509
11220
|
const remote = note.source === "file" && (account2 !== void 0 && kindIn(account2.provider) === "documents" || metadata?.source === "google-drive");
|
|
11510
11221
|
const profile = remote && account2 ? Object.entries(profiles).flatMap(([command, named2]) => Object.entries(named2).map(([name, key]) => ({ command, name, key }))).find(({ key }) => key.provider === account2.provider && key.account === account2.account || isFolderProvider(key.provider) && key.account === account2.name) : void 0;
|
|
11511
11222
|
const url = file?.url ?? (remote && typeof metadata?.sourceUrl === "string" ? metadata.sourceUrl : void 0);
|
|
11512
|
-
const modified = file?.externalUpdatedAt ?? (remote && typeof metadata?.modifiedAt === "string" && Number.isFinite(Date.parse(metadata.modifiedAt)) ? metadata.modifiedAt : void 0);
|
|
11513
11223
|
return {
|
|
11514
11224
|
kind: remote ? "document" : "note",
|
|
11515
11225
|
provider: profile ? profile.command : "notes",
|
|
11516
11226
|
account: profile?.name ?? note.folderId ?? "internal",
|
|
11517
|
-
...remote && url !== void 0 ? { url } : {}
|
|
11518
|
-
updated_at: remote && modified !== void 0 ? modified : note.updatedAt
|
|
11227
|
+
...remote && url !== void 0 ? { url } : {}
|
|
11519
11228
|
};
|
|
11520
11229
|
}, "documentSource");
|
|
11521
11230
|
|
|
11522
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
11231
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/notes-title-tier.js
|
|
11523
11232
|
var plainQueryWords = /* @__PURE__ */ __name((query) => {
|
|
11524
11233
|
let root;
|
|
11525
11234
|
try {
|
|
@@ -11546,9 +11255,11 @@ var titleTiers = /* @__PURE__ */ __name((hits, words2) => {
|
|
|
11546
11255
|
return [...hits].sort((a, b) => rank(a) - rank(b));
|
|
11547
11256
|
}, "titleTiers");
|
|
11548
11257
|
|
|
11549
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
11550
|
-
var storeQuery = /* @__PURE__ */ __name(async (store, text2, { exact, timezone } = {}) =>
|
|
11551
|
-
|
|
11258
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/notes-search.js
|
|
11259
|
+
var storeQuery = /* @__PURE__ */ __name(async (store, text2, { exact, timezone } = {}) => resolvedQuery(store, parsedQuery(text2, exact), timezone), "storeQuery");
|
|
11260
|
+
var parsedQuery = /* @__PURE__ */ __name((text2, exact) => validateFields(parseLucene(text2, { ...SEARCH_QUERY, defaultField: exact ? "exact" : "text" })).root, "parsedQuery");
|
|
11261
|
+
var resolvedQuery = /* @__PURE__ */ __name(async (store, root, timezone) => {
|
|
11262
|
+
const ast = { root };
|
|
11552
11263
|
const zone = timezoneOf(timezone);
|
|
11553
11264
|
const resolve7 = /* @__PURE__ */ __name((node) => {
|
|
11554
11265
|
if (node.kind === "boolean")
|
|
@@ -11569,7 +11280,7 @@ var storeQuery = /* @__PURE__ */ __name(async (store, text2, { exact, timezone }
|
|
|
11569
11280
|
root: resolve7(ast.root),
|
|
11570
11281
|
...hasStems(ast.root) ? { stemmer: createStemmer(stemmers2 ?? DEFAULT_STEMMERS) } : {}
|
|
11571
11282
|
};
|
|
11572
|
-
}, "
|
|
11283
|
+
}, "resolvedQuery");
|
|
11573
11284
|
var searchNotesQuery = /* @__PURE__ */ __name(async (store, request) => {
|
|
11574
11285
|
if (!request.text.trim())
|
|
11575
11286
|
throw new CliError("validation_error", "say what to find in the notes");
|
|
@@ -11634,7 +11345,17 @@ var embedChunks = /* @__PURE__ */ __name(async (store, source, { model: choice,
|
|
|
11634
11345
|
var embedNotes = /* @__PURE__ */ __name((store, options = {}) => embedChunks(store, store.notes, options), "embedNotes");
|
|
11635
11346
|
var embedEvents = /* @__PURE__ */ __name((store, options = {}) => embedChunks(store, store.calendar, options), "embedEvents");
|
|
11636
11347
|
var embedMail = /* @__PURE__ */ __name((store, options = {}) => embedChunks(store, store.mail, options), "embedMail");
|
|
11637
|
-
var nearestNotes = /* @__PURE__ */ __name(async (store, query,
|
|
11348
|
+
var nearestNotes = /* @__PURE__ */ __name(async (store, query, options) => {
|
|
11349
|
+
const { key, vector, floor } = await queryVector(store, query, options);
|
|
11350
|
+
const nearest = await store.notes.nearest(key, vector, {
|
|
11351
|
+
limit: options.limit,
|
|
11352
|
+
...options.folderIds ? { folderIds: options.folderIds } : {},
|
|
11353
|
+
...options.withInternal ? { withInternal: true } : {},
|
|
11354
|
+
...options.source ? { source: options.source } : {}
|
|
11355
|
+
});
|
|
11356
|
+
return nearest.filter(({ score }) => score > floor);
|
|
11357
|
+
}, "nearestNotes");
|
|
11358
|
+
var queryVector = /* @__PURE__ */ __name(async (store, query, { model: choice, folderIds, withInternal, source, env, threads, command, embedders }) => {
|
|
11638
11359
|
if (!query.trim())
|
|
11639
11360
|
throw new CliError("validation_error", "say what to find in the notes");
|
|
11640
11361
|
const { model, directory, key } = localModel(choice, env, command);
|
|
@@ -11646,19 +11367,15 @@ var nearestNotes = /* @__PURE__ */ __name(async (store, query, { model: choice,
|
|
|
11646
11367
|
if (!await store.notes.embedded(key, scope))
|
|
11647
11368
|
throw new CliError("not_found", `nothing searched here has vectors of ${model.id} yet, so only words were matched`);
|
|
11648
11369
|
const [vector] = await withLocal(model, directory, threads, (embedder) => embedder.embed([query], "query"), embedders);
|
|
11649
|
-
|
|
11650
|
-
|
|
11651
|
-
|
|
11652
|
-
|
|
11653
|
-
|
|
11654
|
-
|
|
11655
|
-
});
|
|
11656
|
-
return nearest.filter(({ score }) => score > floor);
|
|
11657
|
-
}, "nearestNotes");
|
|
11370
|
+
return { key, vector, floor: meaningFloor(key) };
|
|
11371
|
+
}, "queryVector");
|
|
11372
|
+
var nearestAmong = /* @__PURE__ */ __name(async (store, query, refs, options) => {
|
|
11373
|
+
const { key, vector, floor } = await queryVector(store, query, options);
|
|
11374
|
+
return (await store.notes.scoreNotes(key, vector, refs)).filter(({ score }) => score > floor);
|
|
11375
|
+
}, "nearestAmong");
|
|
11658
11376
|
var MAX_LINE = 200;
|
|
11659
11377
|
var MAX_NOTES_OFFSET = 1e3;
|
|
11660
11378
|
var CANDIDATES2 = 50;
|
|
11661
|
-
var FILTERED = 500;
|
|
11662
11379
|
var RRF_K3 = 60;
|
|
11663
11380
|
var firstLine = /* @__PURE__ */ __name((text2, query) => {
|
|
11664
11381
|
const words2 = query.toLowerCase().split(/\s+/).map((word) => word.replace(/^[^\p{L}\p{N}]+|[^\p{L}\p{N}]+$/gu, "")).filter((word) => word.length > 2 && !["and", "or", "not"].includes(word));
|
|
@@ -11716,12 +11433,108 @@ var noteSourceOfQuery = /* @__PURE__ */ __name((query) => {
|
|
|
11716
11433
|
}
|
|
11717
11434
|
return { source, rest };
|
|
11718
11435
|
}, "noteSourceOfQuery");
|
|
11436
|
+
var WORD_FIELDS = /* @__PURE__ */ new Set(["text", "exact"]);
|
|
11437
|
+
var fieldsOfQuery = /* @__PURE__ */ __name((root) => {
|
|
11438
|
+
let narrows = false;
|
|
11439
|
+
const kept = /* @__PURE__ */ __name((node) => {
|
|
11440
|
+
if (node.kind === "boolean")
|
|
11441
|
+
return {
|
|
11442
|
+
...node,
|
|
11443
|
+
clauses: node.clauses.map(({ occur, node: node2 }) => {
|
|
11444
|
+
if (occur !== "must_not")
|
|
11445
|
+
return { occur, node: kept(node2) };
|
|
11446
|
+
narrows = true;
|
|
11447
|
+
return { occur, node: node2 };
|
|
11448
|
+
})
|
|
11449
|
+
};
|
|
11450
|
+
if (!WORD_FIELDS.has(node.field)) {
|
|
11451
|
+
narrows = true;
|
|
11452
|
+
return node;
|
|
11453
|
+
}
|
|
11454
|
+
return { kind: "predicate", field: "in", operator: "term", value: "notes", span: node.span };
|
|
11455
|
+
}, "kept");
|
|
11456
|
+
const fields = kept(root);
|
|
11457
|
+
return narrows ? fields : void 0;
|
|
11458
|
+
}, "fieldsOfQuery");
|
|
11459
|
+
var meaningWords = /* @__PURE__ */ __name((root) => {
|
|
11460
|
+
const wanted = /* @__PURE__ */ __name((node) => node.kind === "boolean" ? node.clauses.flatMap(({ occur, node: node2 }) => occur === "must_not" ? [] : wanted(node2)) : WORD_FIELDS.has(node.field) && (node.operator === "term" || node.operator === "phrase") ? [node.value] : [], "wanted");
|
|
11461
|
+
return wanted(root).join(" ").trim();
|
|
11462
|
+
}, "meaningWords");
|
|
11463
|
+
var allOf = /* @__PURE__ */ __name((nodes) => nodes.length <= 1 ? nodes[0] : {
|
|
11464
|
+
kind: "boolean",
|
|
11465
|
+
clauses: nodes.map((node) => ({ occur: "must", node })),
|
|
11466
|
+
span: { start: 0, end: 0 }
|
|
11467
|
+
}, "allOf");
|
|
11468
|
+
var matching = /* @__PURE__ */ __name(async (store, refs, root, scope) => {
|
|
11469
|
+
if (refs.length === 0)
|
|
11470
|
+
return /* @__PURE__ */ new Map();
|
|
11471
|
+
const resolved = await resolvedQuery(store, root ?? { kind: "predicate", field: "in", operator: "term", value: "notes", span: { start: 0, end: 0 } }, scope.timezone);
|
|
11472
|
+
const found = await store.notes.search({
|
|
11473
|
+
root: resolved.root,
|
|
11474
|
+
refs,
|
|
11475
|
+
limit: refs.length,
|
|
11476
|
+
...scope.folderIds ? { folderIds: scope.folderIds } : {},
|
|
11477
|
+
...scope.withInternal ? { withInternal: true } : {},
|
|
11478
|
+
...scope.source ? { source: scope.source } : {},
|
|
11479
|
+
...resolved.stemmer ? { stemmer: resolved.stemmer } : {}
|
|
11480
|
+
});
|
|
11481
|
+
return new Map(found.items.map(({ ref, note, at }) => [ref, { note, at }]));
|
|
11482
|
+
}, "matching");
|
|
11483
|
+
var RANK_WITHIN = 2e3;
|
|
11484
|
+
var filterRefs = /* @__PURE__ */ __name(async (store, narrowing, scope) => {
|
|
11485
|
+
const resolved = await resolvedQuery(store, narrowing, scope.timezone);
|
|
11486
|
+
try {
|
|
11487
|
+
const found = await store.notes.matchingRefs({
|
|
11488
|
+
root: resolved.root,
|
|
11489
|
+
limit: RANK_WITHIN,
|
|
11490
|
+
...scope.folderIds ? { folderIds: scope.folderIds } : {},
|
|
11491
|
+
...scope.withInternal ? { withInternal: true } : {},
|
|
11492
|
+
...scope.source ? { source: scope.source } : {},
|
|
11493
|
+
...resolved.stemmer ? { stemmer: resolved.stemmer } : {}
|
|
11494
|
+
});
|
|
11495
|
+
return found.hasMore ? void 0 : found.refs;
|
|
11496
|
+
} catch (error) {
|
|
11497
|
+
if (tooLarge(error))
|
|
11498
|
+
return void 0;
|
|
11499
|
+
throw error;
|
|
11500
|
+
}
|
|
11501
|
+
}, "filterRefs");
|
|
11502
|
+
var tooLarge = /* @__PURE__ */ __name((error) => isCliError(error) && error.details.reason === "query.too-large", "tooLarge");
|
|
11503
|
+
var notesTotal = /* @__PURE__ */ __name(async (store, text2, { exact, scope, shown, hasMore }, others, othersComplete) => {
|
|
11504
|
+
let words2;
|
|
11505
|
+
try {
|
|
11506
|
+
const { root, stemmer } = await storeQuery(store, text2, {
|
|
11507
|
+
exact,
|
|
11508
|
+
...scope.timezone ? { timezone: scope.timezone } : {}
|
|
11509
|
+
});
|
|
11510
|
+
words2 = await store.notes.matchingRefs({
|
|
11511
|
+
root,
|
|
11512
|
+
limit: TOTAL_CAP,
|
|
11513
|
+
...scope.folderIds ? { folderIds: scope.folderIds } : {},
|
|
11514
|
+
...scope.withInternal ? { withInternal: true } : {},
|
|
11515
|
+
...scope.source ? { source: scope.source } : {},
|
|
11516
|
+
...stemmer ? { stemmer } : {}
|
|
11517
|
+
});
|
|
11518
|
+
} catch (error) {
|
|
11519
|
+
if (tooLarge(error))
|
|
11520
|
+
return totalOf(void 0, shown, hasMore);
|
|
11521
|
+
throw error;
|
|
11522
|
+
}
|
|
11523
|
+
const count2 = (/* @__PURE__ */ new Set([...words2.refs, ...others])).size + (words2.hasMore ? 1 : 0);
|
|
11524
|
+
return totalOf(count2, shown, hasMore, othersComplete);
|
|
11525
|
+
}, "notesTotal");
|
|
11719
11526
|
var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offset = 0, tag, filter: expression, folderIds, withInternal, source: given, exact = false, timezone, env, command, embedders, pictures: withPictures2 = false, pictureLimit = 5, pictureEmbedder } = {}) => {
|
|
11720
11527
|
const typed = noteSourceOfQuery(query);
|
|
11721
11528
|
const source = given ?? typed.source;
|
|
11722
|
-
const
|
|
11529
|
+
const rest = typed.source !== void 0 && typed.source === source ? typed.rest : query;
|
|
11723
11530
|
const label = tag === void 0 ? void 0 : normalizeTag(tag);
|
|
11724
11531
|
const filter = [expression ? `(${expression})` : "", label === void 0 ? "" : `tag:${label}`].filter(Boolean).join(" AND ") || void 0;
|
|
11532
|
+
const parsed = query.trim() ? parsedQuery(query, exact) : void 0;
|
|
11533
|
+
const words2 = parsed === void 0 ? "" : meaningWords(parsed);
|
|
11534
|
+
const narrowing = allOf([
|
|
11535
|
+
...parsed === void 0 ? [] : [fieldsOfQuery(parsed)].filter((node) => node !== void 0),
|
|
11536
|
+
...filter === void 0 ? [] : [parsedQuery(filter)]
|
|
11537
|
+
]);
|
|
11725
11538
|
const text2 = [query.trim() ? `(${query})` : "", filter ?? ""].filter(Boolean).join(" AND ");
|
|
11726
11539
|
const window2 = offset + limit;
|
|
11727
11540
|
const scope = {
|
|
@@ -11732,33 +11545,44 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
|
|
|
11732
11545
|
};
|
|
11733
11546
|
let meaningSkipped;
|
|
11734
11547
|
let meaning;
|
|
11548
|
+
let meaningRefs;
|
|
11549
|
+
let meaningComplete = true;
|
|
11735
11550
|
if (exact)
|
|
11736
11551
|
meaningSkipped = "--exact searches words as written";
|
|
11737
|
-
else if (words2
|
|
11552
|
+
else if (words2) {
|
|
11553
|
+
const lane2 = {
|
|
11554
|
+
command,
|
|
11555
|
+
...env === void 0 ? {} : { env },
|
|
11556
|
+
...embedders === void 0 ? {} : { embedders },
|
|
11557
|
+
...folderIds === void 0 ? {} : { folderIds },
|
|
11558
|
+
...withInternal ? { withInternal: true } : {},
|
|
11559
|
+
...source === void 0 ? {} : { source }
|
|
11560
|
+
};
|
|
11561
|
+
const depth = Math.max(window2, CANDIDATES2);
|
|
11738
11562
|
try {
|
|
11739
|
-
const
|
|
11740
|
-
|
|
11741
|
-
|
|
11742
|
-
|
|
11743
|
-
|
|
11744
|
-
|
|
11745
|
-
|
|
11746
|
-
|
|
11747
|
-
|
|
11748
|
-
if (filter === void 0)
|
|
11749
|
-
meaning = nearest;
|
|
11750
|
-
else {
|
|
11751
|
-
const allowed = await searchNotesQuery(store, { text: filter, limit: FILTERED, ...scope });
|
|
11752
|
-
const refs = new Set(allowed.items.map(({ ref }) => ref));
|
|
11753
|
-
meaning = nearest.filter(({ ref }) => refs.has(ref));
|
|
11563
|
+
const within = narrowing === void 0 ? void 0 : await filterRefs(store, narrowing, scope);
|
|
11564
|
+
let nearest;
|
|
11565
|
+
if (within === void 0) {
|
|
11566
|
+
nearest = await nearestNotes(store, words2, { ...lane2, limit: depth });
|
|
11567
|
+
meaningComplete = nearest.length < depth;
|
|
11568
|
+
} else {
|
|
11569
|
+
const ranked2 = within.length ? await nearestAmong(store, words2, within, lane2) : [];
|
|
11570
|
+
meaningRefs = new Set(ranked2.map(({ ref }) => ref));
|
|
11571
|
+
nearest = ranked2.slice(0, depth);
|
|
11754
11572
|
}
|
|
11573
|
+
const allowed = await matching(store, nearest.map(({ ref }) => ref), narrowing, scope);
|
|
11574
|
+
meaning = nearest.flatMap(({ ref }) => {
|
|
11575
|
+
const found = allowed.get(ref);
|
|
11576
|
+
return found ? [{ ref, ...found }] : [];
|
|
11577
|
+
});
|
|
11578
|
+
meaningRefs ??= new Set(meaning.map(({ ref }) => ref));
|
|
11755
11579
|
} catch (error) {
|
|
11756
11580
|
if (!(error instanceof CliError && error.code === "not_found"))
|
|
11757
11581
|
throw error;
|
|
11758
11582
|
meaningSkipped = error.message;
|
|
11759
11583
|
}
|
|
11760
11584
|
}
|
|
11761
|
-
const titleWords = plainQueryWords(
|
|
11585
|
+
const titleWords = plainQueryWords(rest);
|
|
11762
11586
|
const titled = titleWords === void 0 ? { items: [], hasMore: false } : await searchNotesQuery(store, {
|
|
11763
11587
|
text: [titleQuery(titleWords), filter ?? ""].filter(Boolean).join(" AND "),
|
|
11764
11588
|
limit: Math.max(window2, CANDIDATES2),
|
|
@@ -11775,10 +11599,10 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
|
|
|
11775
11599
|
...scope
|
|
11776
11600
|
});
|
|
11777
11601
|
const ranked = /* @__PURE__ */ new Map();
|
|
11778
|
-
const add = /* @__PURE__ */ __name((list2, by) => list2.forEach(({ ref, note }, rank) => {
|
|
11602
|
+
const add = /* @__PURE__ */ __name((list2, by) => list2.forEach(({ ref, note, at }, rank) => {
|
|
11779
11603
|
if (tierRefs.has(ref))
|
|
11780
11604
|
return;
|
|
11781
|
-
const held = ranked.get(ref) ?? { note, score: 0, foundBy: [] };
|
|
11605
|
+
const held = ranked.get(ref) ?? { note, at, score: 0, foundBy: [] };
|
|
11782
11606
|
held.score += 1 / (RRF_K3 + rank + 1);
|
|
11783
11607
|
held.foundBy.push(by);
|
|
11784
11608
|
ranked.set(ref, held);
|
|
@@ -11787,16 +11611,17 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
|
|
|
11787
11611
|
if (meaning !== void 0)
|
|
11788
11612
|
add(meaning, "meaning");
|
|
11789
11613
|
const ordered = [
|
|
11790
|
-
...tier.map(({ ref, note }) => [ref, { note, score: 0, foundBy: ["title"] }]),
|
|
11614
|
+
...tier.map(({ ref, note, at }) => [ref, { note, at, score: 0, foundBy: ["title"] }]),
|
|
11791
11615
|
...[...ranked.entries()].sort(([, a], [, b]) => b.score - a.score)
|
|
11792
11616
|
];
|
|
11793
11617
|
const page = slice ? ordered : ordered.slice(offset, window2);
|
|
11794
11618
|
const hasMore = slice ? matched.hasMore : ordered.length > window2 || matched.hasMore || titled.hasMore;
|
|
11619
|
+
const total = await notesTotal(store, text2, { exact, scope, shown: offset + page.length, hasMore }, [...tier.map(({ ref }) => ref), ...meaningRefs ?? []], meaningComplete);
|
|
11795
11620
|
const hits = [];
|
|
11796
11621
|
const counts = /* @__PURE__ */ new Map();
|
|
11797
11622
|
const accounts = await store.accounts.storedAccounts();
|
|
11798
11623
|
const profiles = await store.accounts.profiles();
|
|
11799
|
-
for (const [ref, { note, foundBy }] of page) {
|
|
11624
|
+
for (const [ref, { note, at, foundBy }] of page) {
|
|
11800
11625
|
const links = (await store.notes.links({ from: ref })).map(({ to, targetText, kind, anchor }) => ({
|
|
11801
11626
|
to,
|
|
11802
11627
|
target_text: targetText,
|
|
@@ -11810,13 +11635,14 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
|
|
|
11810
11635
|
path: note.path,
|
|
11811
11636
|
title: note.title,
|
|
11812
11637
|
...documentSource(note, accounts, profiles, note.source === "file" ? (await store.files.ofDocument(note.ref))[0] : void 0),
|
|
11638
|
+
updated_at: at,
|
|
11813
11639
|
excerpt: firstLine(note.text, words2),
|
|
11814
11640
|
links,
|
|
11815
11641
|
found_by: foundBy
|
|
11816
11642
|
});
|
|
11817
|
-
for (const
|
|
11818
|
-
const key =
|
|
11819
|
-
const known2 = counts.get(key) ?? { ref:
|
|
11643
|
+
for (const link4 of new Map(links.map((link5) => [link5.to ?? `?${link5.target_text}`, link5])).values()) {
|
|
11644
|
+
const key = link4.to ?? `?${link4.target_text}`;
|
|
11645
|
+
const known2 = counts.get(key) ?? { ref: link4.to, name: link4.target_text, notes: 0 };
|
|
11820
11646
|
known2.notes++;
|
|
11821
11647
|
counts.set(key, known2);
|
|
11822
11648
|
}
|
|
@@ -11841,6 +11667,10 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
|
|
|
11841
11667
|
command,
|
|
11842
11668
|
embedder: pictureEmbedder
|
|
11843
11669
|
}) : {};
|
|
11670
|
+
if (lane.pictures && narrowing !== void 0) {
|
|
11671
|
+
const allowed = await matching(store, lane.pictures.map(({ ref }) => ref), narrowing, scope);
|
|
11672
|
+
lane.pictures = lane.pictures.filter(({ ref }) => allowed.has(ref));
|
|
11673
|
+
}
|
|
11844
11674
|
return {
|
|
11845
11675
|
query,
|
|
11846
11676
|
...label === void 0 ? {} : { tag: label },
|
|
@@ -11848,6 +11678,7 @@ var searchNotes = /* @__PURE__ */ __name(async (store, query, { limit = 20, offs
|
|
|
11848
11678
|
by: meaning === void 0 ? "words" : "words and meaning",
|
|
11849
11679
|
...meaningSkipped === void 0 ? {} : { meaning_skipped: meaningSkipped },
|
|
11850
11680
|
hits,
|
|
11681
|
+
total,
|
|
11851
11682
|
has_more: hasMore,
|
|
11852
11683
|
...hasMore && window2 <= MAX_NOTES_OFFSET ? { next_offset: window2 } : {},
|
|
11853
11684
|
linked: [...counts.values()].sort((a, b) => b.notes - a.notes || (a.name ?? a.ref ?? "").localeCompare(b.name ?? b.ref ?? "")),
|
|
@@ -11886,7 +11717,7 @@ var searchNotesOf = /* @__PURE__ */ __name(async (store, account2, text2, { acco
|
|
|
11886
11717
|
};
|
|
11887
11718
|
}, "searchNotesOf");
|
|
11888
11719
|
|
|
11889
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
11720
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/events-search.js
|
|
11890
11721
|
var MAX_EVENTS_OFFSET = 1e3;
|
|
11891
11722
|
var iso = /* @__PURE__ */ __name((at) => at === null ? null : new Date(at).toISOString(), "iso");
|
|
11892
11723
|
var accountIdsOf = /* @__PURE__ */ __name(async (store, accounts) => {
|
|
@@ -11998,7 +11829,7 @@ var searchEvents = /* @__PURE__ */ __name(async (store, query, { limit = 20, off
|
|
|
11998
11829
|
};
|
|
11999
11830
|
}, "searchEvents");
|
|
12000
11831
|
|
|
12001
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
11832
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/search-all.js
|
|
12002
11833
|
var RESOURCES_SEARCHED = ["messages", "mail", "notes", "events"];
|
|
12003
11834
|
var skippable = /* @__PURE__ */ __name((error) => error instanceof CliError && (error.code === "validation_error" || error.code === "not_found"), "skippable");
|
|
12004
11835
|
var filtersBeside = /* @__PURE__ */ __name((text2) => {
|
|
@@ -12206,7 +12037,7 @@ var searchAll = /* @__PURE__ */ __name(async (store, account2, request, messenge
|
|
|
12206
12037
|
};
|
|
12207
12038
|
}, "searchAll");
|
|
12208
12039
|
|
|
12209
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
12040
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/search-all-meetings.js
|
|
12210
12041
|
var RESOURCES_SEARCHED_WITH_MEETINGS = [...RESOURCES_SEARCHED, "meetings"];
|
|
12211
12042
|
var whole2 = /* @__PURE__ */ __name((value, minimum, maximum, label) => {
|
|
12212
12043
|
if (!Number.isSafeInteger(value) || value < minimum || value > maximum)
|
|
@@ -12453,7 +12284,7 @@ var searchAllOfSource = /* @__PURE__ */ __name(async (store, account2, source, r
|
|
|
12453
12284
|
return { ...found, skipped: [...skipped, ...empty2, ...unnamed, ...found.skipped] };
|
|
12454
12285
|
}, "searchAllOfSource");
|
|
12455
12286
|
|
|
12456
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
12287
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/server-search.js
|
|
12457
12288
|
var SERVER_SEARCH_KEY = "messages.server-search";
|
|
12458
12289
|
var SERVER_BOUNDS = { timeMs: 5e3, perCall: 100, maxCalls: 3 };
|
|
12459
12290
|
var DEFAULT_BACKEND = "both";
|
|
@@ -12578,7 +12409,7 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
|
|
|
12578
12409
|
const calls = unique.slice(0, SERVER_BOUNDS.maxCalls);
|
|
12579
12410
|
const pending = new Set(calls);
|
|
12580
12411
|
const found = [];
|
|
12581
|
-
let
|
|
12412
|
+
let open7 = true;
|
|
12582
12413
|
const fail3 = /* @__PURE__ */ __name((branch, reason) => {
|
|
12583
12414
|
pending.delete(branch);
|
|
12584
12415
|
report.complete = false;
|
|
@@ -12587,19 +12418,19 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
|
|
|
12587
12418
|
const ask = /* @__PURE__ */ __name(async (adapter) => {
|
|
12588
12419
|
const search = capability(adapter, "searchMessages", "search messages on its server");
|
|
12589
12420
|
await Promise.all(calls.map(async (branch) => {
|
|
12590
|
-
if (!
|
|
12421
|
+
if (!open7)
|
|
12591
12422
|
return;
|
|
12592
12423
|
report.calls += 1;
|
|
12593
12424
|
try {
|
|
12594
12425
|
const page = await search(asQuery(branch), { limit: SERVER_BOUNDS.perCall, signal: stop });
|
|
12595
|
-
if (!
|
|
12426
|
+
if (!open7)
|
|
12596
12427
|
return;
|
|
12597
12428
|
pending.delete(branch);
|
|
12598
12429
|
if (page.hasMore)
|
|
12599
12430
|
report.complete = false;
|
|
12600
12431
|
found.push(page);
|
|
12601
12432
|
} catch (error) {
|
|
12602
|
-
if (!
|
|
12433
|
+
if (!open7)
|
|
12603
12434
|
return;
|
|
12604
12435
|
fail3(branch, error instanceof CliError && error.code === "rate_limited" ? "rate_limited" : "search_failed");
|
|
12605
12436
|
}
|
|
@@ -12611,11 +12442,11 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
|
|
|
12611
12442
|
run.then(() => "done", () => "failed"),
|
|
12612
12443
|
bound2
|
|
12613
12444
|
]);
|
|
12614
|
-
|
|
12445
|
+
open7 = false;
|
|
12615
12446
|
for (const branch of [...pending])
|
|
12616
12447
|
fail3(branch, outcome2 === "failed" ? "search_failed" : "time_or_abort_bound");
|
|
12617
12448
|
} finally {
|
|
12618
|
-
|
|
12449
|
+
open7 = false;
|
|
12619
12450
|
clearTimeout(timer);
|
|
12620
12451
|
}
|
|
12621
12452
|
const chats = new Map(found.flatMap(({ chats: chats2 }) => chats2).map((chat) => [chat.id, chat]));
|
|
@@ -12642,7 +12473,7 @@ var searchServer = /* @__PURE__ */ __name(async (deps, request) => {
|
|
|
12642
12473
|
return { report, sources };
|
|
12643
12474
|
}, "searchServer");
|
|
12644
12475
|
|
|
12645
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
12476
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/messages.js
|
|
12646
12477
|
var DELETE_AT_ONCE = 10;
|
|
12647
12478
|
var messagesService = /* @__PURE__ */ __name((deps) => {
|
|
12648
12479
|
const { guard } = deps;
|
|
@@ -13068,7 +12899,7 @@ var checkMediaOptions = /* @__PURE__ */ __name((messenger, asked, attachments) =
|
|
|
13068
12899
|
throw new CliError("validation_error", `${MEDIA_FLAGS[first]} needs a --photo or --file`);
|
|
13069
12900
|
}, "checkMediaOptions");
|
|
13070
12901
|
|
|
13071
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
12902
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/domain/channel-tags.js
|
|
13072
12903
|
var CHANNEL_TAG_RULES_VERSION = "keywords-v1";
|
|
13073
12904
|
var RULES = {
|
|
13074
12905
|
ai: [/\b(ai|gpt|llm|machine learning|artificial intelligence)\b/iu, /нейросет|искусственн/iu],
|
|
@@ -13083,7 +12914,7 @@ var classifyChannel = /* @__PURE__ */ __name((metadata) => Object.entries(RULES)
|
|
|
13083
12914
|
return fields.length ? [{ tag, score: fields.length / 3, fields }] : [];
|
|
13084
12915
|
}), "classifyChannel");
|
|
13085
12916
|
|
|
13086
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
12917
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/metadata.js
|
|
13087
12918
|
var metadataService = /* @__PURE__ */ __name((deps) => {
|
|
13088
12919
|
const held = /* @__PURE__ */ __name(async (reference, { includeLeft = false } = {}) => {
|
|
13089
12920
|
const store = await deps.store();
|
|
@@ -13169,7 +13000,7 @@ var metadataService = /* @__PURE__ */ __name((deps) => {
|
|
|
13169
13000
|
};
|
|
13170
13001
|
}, "metadataService");
|
|
13171
13002
|
|
|
13172
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13003
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/moderation/run.js
|
|
13173
13004
|
var FIRST_LOOK_MS = 24 * 36e5;
|
|
13174
13005
|
var moderateWith = /* @__PURE__ */ __name(async (run) => {
|
|
13175
13006
|
const { chatId, title, rules, point, since, dryRun } = run;
|
|
@@ -13206,7 +13037,7 @@ var moderateWith = /* @__PURE__ */ __name(async (run) => {
|
|
|
13206
13037
|
return { chatId, rows, notes };
|
|
13207
13038
|
}, "moderateWith");
|
|
13208
13039
|
|
|
13209
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13040
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/moderation.js
|
|
13210
13041
|
var moderationService = /* @__PURE__ */ __name((deps) => {
|
|
13211
13042
|
const file = /* @__PURE__ */ __name(() => new ModerationRules(moderationPathFor(deps.messenger.app, deps.profile ?? "default", deps.env ?? process.env)), "file");
|
|
13212
13043
|
const group = /* @__PURE__ */ __name(async (chat) => {
|
|
@@ -13284,7 +13115,7 @@ var moderatorOf = /* @__PURE__ */ __name((adapter, deps) => ({
|
|
|
13284
13115
|
}, "removePerson")
|
|
13285
13116
|
}), "moderatorOf");
|
|
13286
13117
|
|
|
13287
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13118
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/person-context.js
|
|
13288
13119
|
var CONTEXT_MESSAGES2 = 10;
|
|
13289
13120
|
var CONTEXT_BYTES = 64 * 1024;
|
|
13290
13121
|
var toContext = /* @__PURE__ */ __name((key, message, chatTitle) => ({
|
|
@@ -13540,10 +13371,10 @@ var personMessages = /* @__PURE__ */ __name(async (store, asked, reference, { ch
|
|
|
13540
13371
|
};
|
|
13541
13372
|
}, "personMessages");
|
|
13542
13373
|
|
|
13543
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13374
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
|
|
13544
13375
|
import { createHash as createHash11 } from "node:crypto";
|
|
13545
13376
|
|
|
13546
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13377
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-reference.js
|
|
13547
13378
|
var missing3 = /* @__PURE__ */ __name(() => new CliError("not_found", "the meeting evidence is unavailable for this account"), "missing");
|
|
13548
13379
|
var authorizedMeetingMetadata = /* @__PURE__ */ __name(async (store, accountId, reference, options = {}) => {
|
|
13549
13380
|
const parsed = parseMeetingReference(reference);
|
|
@@ -13591,7 +13422,7 @@ var resolveMeetingReference = /* @__PURE__ */ __name(async (store, accountId, re
|
|
|
13591
13422
|
};
|
|
13592
13423
|
}, "resolveMeetingReference");
|
|
13593
13424
|
|
|
13594
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13425
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-evidence.js
|
|
13595
13426
|
var hash = /* @__PURE__ */ __name((value) => createHash11("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
|
|
13596
13427
|
var checkMeetingCancelled = /* @__PURE__ */ __name((signal) => {
|
|
13597
13428
|
if (signal?.aborted)
|
|
@@ -13790,7 +13621,7 @@ var readMeetingEvidence = /* @__PURE__ */ __name(async (store, accountId, refere
|
|
|
13790
13621
|
return { ...packet, fingerprint: hash(packet) };
|
|
13791
13622
|
}, "readMeetingEvidence");
|
|
13792
13623
|
|
|
13793
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13624
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/person-meeting-context.js
|
|
13794
13625
|
var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference, options) => {
|
|
13795
13626
|
const { meetings = 10, cues = 5, bytes: bytes2 = 64 * 1024, scanLimit = 1e3, since, signal } = options;
|
|
13796
13627
|
const requestedAccounts = options.accountIds;
|
|
@@ -13889,7 +13720,7 @@ var personMeetingContext = /* @__PURE__ */ __name(async (store, personReference,
|
|
|
13889
13720
|
};
|
|
13890
13721
|
}, "personMeetingContext");
|
|
13891
13722
|
|
|
13892
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13723
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/person-preparation.js
|
|
13893
13724
|
var PREPARE_BYTES = 96 * 1024;
|
|
13894
13725
|
var MEETINGS = 5;
|
|
13895
13726
|
var CUES = 3;
|
|
@@ -14006,7 +13837,7 @@ var meetingsOf = /* @__PURE__ */ __name(async (store, uid, stored, since, left)
|
|
|
14006
13837
|
}
|
|
14007
13838
|
}, "meetingsOf");
|
|
14008
13839
|
|
|
14009
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13840
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/person-profile.js
|
|
14010
13841
|
var personProfile = /* @__PURE__ */ __name(async (deps, person, known2) => {
|
|
14011
13842
|
const online = deps.offline ? void 0 : await deps.connection();
|
|
14012
13843
|
const held = await storeIfOpen(deps);
|
|
@@ -14076,7 +13907,7 @@ var quiet = /* @__PURE__ */ __name((facts) => facts.chats.map(({ id: id2, title,
|
|
|
14076
13907
|
complete: false
|
|
14077
13908
|
})), "quiet");
|
|
14078
13909
|
|
|
14079
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13910
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/person-timeline.js
|
|
14080
13911
|
var TIMELINE_ITEMS = 50;
|
|
14081
13912
|
var TIMELINE_MAX = 500;
|
|
14082
13913
|
var SCOPES = ["personal", "work"];
|
|
@@ -14131,7 +13962,7 @@ var personTimeline = /* @__PURE__ */ __name(async (store, asked, reference, { sc
|
|
|
14131
13962
|
};
|
|
14132
13963
|
}, "personTimeline");
|
|
14133
13964
|
|
|
14134
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13965
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/people.js
|
|
14135
13966
|
var peopleService = /* @__PURE__ */ __name((deps) => {
|
|
14136
13967
|
const localCard = /* @__PURE__ */ __name(async (card, includeNotes = false) => {
|
|
14137
13968
|
const held = await storeIfOpen(deps);
|
|
@@ -14358,7 +14189,7 @@ var withoutPhone = /* @__PURE__ */ __name((answer) => {
|
|
|
14358
14189
|
return rest;
|
|
14359
14190
|
}, "withoutPhone");
|
|
14360
14191
|
|
|
14361
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14192
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/private-people.js
|
|
14362
14193
|
var noteItem = /* @__PURE__ */ __name((provider, note) => ({
|
|
14363
14194
|
id: note.id,
|
|
14364
14195
|
contact: formatReference({ type: "contact", provider, id: note.personId }),
|
|
@@ -14402,7 +14233,7 @@ var privatePeopleService = /* @__PURE__ */ __name((deps) => {
|
|
|
14402
14233
|
};
|
|
14403
14234
|
}, "privatePeopleService");
|
|
14404
14235
|
|
|
14405
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14236
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/rankings.js
|
|
14406
14237
|
var empty = /* @__PURE__ */ __name(() => ({
|
|
14407
14238
|
total: 0,
|
|
14408
14239
|
population: 0,
|
|
@@ -14658,7 +14489,7 @@ var rankingsService = /* @__PURE__ */ __name((deps) => ({
|
|
|
14658
14489
|
}, "evidence")
|
|
14659
14490
|
}), "rankingsService");
|
|
14660
14491
|
|
|
14661
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14492
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/searches.js
|
|
14662
14493
|
var savedSearchItem = /* @__PURE__ */ __name((one) => ({
|
|
14663
14494
|
id: one.id,
|
|
14664
14495
|
name: one.name,
|
|
@@ -14787,7 +14618,7 @@ var searchesService = /* @__PURE__ */ __name((deps) => {
|
|
|
14787
14618
|
};
|
|
14788
14619
|
}, "searchesService");
|
|
14789
14620
|
|
|
14790
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14621
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/tags.js
|
|
14791
14622
|
var TAGGING_QUERY = {
|
|
14792
14623
|
entity: "tagging",
|
|
14793
14624
|
backend: "sql",
|
|
@@ -14871,7 +14702,7 @@ var tagsService = /* @__PURE__ */ __name((deps) => {
|
|
|
14871
14702
|
};
|
|
14872
14703
|
}, "tagsService");
|
|
14873
14704
|
|
|
14874
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14705
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/tasks.js
|
|
14875
14706
|
var TASK_QUERY = {
|
|
14876
14707
|
entity: "task",
|
|
14877
14708
|
backend: "sql",
|
|
@@ -15003,13 +14834,13 @@ var tasksService = /* @__PURE__ */ __name((deps, categories) => {
|
|
|
15003
14834
|
store.notes.links({ from: details.ref }),
|
|
15004
14835
|
store.notes.links({ to: details.ref })
|
|
15005
14836
|
]);
|
|
15006
|
-
return { ...details, links, linkedFrom: incoming.filter((
|
|
14837
|
+
return { ...details, links, linkedFrom: incoming.filter((link4) => link4.from.startsWith("task:")) };
|
|
15007
14838
|
}, "cardOf");
|
|
15008
14839
|
const planOf = /* @__PURE__ */ __name(async (store, id2, plan, by) => {
|
|
15009
14840
|
if (plan.category !== void 0)
|
|
15010
14841
|
plan = { ...plan, category: await categoryOf(store, plan.category) };
|
|
15011
|
-
const
|
|
15012
|
-
if (!
|
|
14842
|
+
const open7 = (await store.tasks.details(id2)).status === "open";
|
|
14843
|
+
if (!open7 && (plan.dueAt != null || plan.nextCheckAt != null))
|
|
15013
14844
|
throw new CliError("validation_error", "a closed task takes no due date or next check; it stays closed");
|
|
15014
14845
|
const { assignees, ...fields } = plan;
|
|
15015
14846
|
const author = by === "owner" ? "owner" : { bot: by };
|
|
@@ -15095,17 +14926,17 @@ var tasksService = /* @__PURE__ */ __name((deps, categories) => {
|
|
|
15095
14926
|
if (choice.attach !== void 0) {
|
|
15096
14927
|
const target = await owned(store, account2, choice.attach);
|
|
15097
14928
|
const similarity = await store.tasks.compare(subject, target.id);
|
|
15098
|
-
const
|
|
14929
|
+
const link4 = {
|
|
15099
14930
|
from: (await store.tasks.details(target.id)).ref,
|
|
15100
14931
|
kind: "evidence",
|
|
15101
14932
|
origin: origin === "owner" ? "owner" : "suggested"
|
|
15102
14933
|
};
|
|
15103
14934
|
try {
|
|
15104
|
-
await store.notes.addLink({ ...
|
|
14935
|
+
await store.notes.addLink({ ...link4, to: note ? note.ref : source });
|
|
15105
14936
|
} catch (error) {
|
|
15106
14937
|
if (!(error instanceof CliError && error.code === "not_found" && !note))
|
|
15107
14938
|
throw error;
|
|
15108
|
-
await store.notes.addLink({ ...
|
|
14939
|
+
await store.notes.addLink({ ...link4, targetText: source });
|
|
15109
14940
|
}
|
|
15110
14941
|
await store.tasks.recordPair({ source, other: target.id, decision: "attached", similarity, by });
|
|
15111
14942
|
const review = await reviewAfterLink(store, target.id);
|
|
@@ -15351,7 +15182,7 @@ var taskView = /* @__PURE__ */ __name(async (store, account2, task2) => {
|
|
|
15351
15182
|
};
|
|
15352
15183
|
}, "taskView");
|
|
15353
15184
|
|
|
15354
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15185
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/topics.js
|
|
15355
15186
|
var actionOf = /* @__PURE__ */ __name(({ title, closed, pinned, hidden }) => {
|
|
15356
15187
|
const set = [closed, pinned, hidden].filter((one) => one !== void 0).length;
|
|
15357
15188
|
if (title !== void 0 || set !== 1)
|
|
@@ -15536,8 +15367,8 @@ var topicsService = /* @__PURE__ */ __name((deps) => {
|
|
|
15536
15367
|
};
|
|
15537
15368
|
}, "topicsService");
|
|
15538
15369
|
|
|
15539
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15540
|
-
import { createHash as createHash12, randomUUID as
|
|
15370
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/evidence.js
|
|
15371
|
+
import { createHash as createHash12, randomUUID as randomUUID5 } from "node:crypto";
|
|
15541
15372
|
var hash2 = /* @__PURE__ */ __name((value) => createHash12("sha256").update(JSON.stringify(value)).digest("hex"), "hash");
|
|
15542
15373
|
var positive = /* @__PURE__ */ __name((value, name, minimum = 1) => {
|
|
15543
15374
|
if (!Number.isSafeInteger(value) || value < minimum)
|
|
@@ -15607,10 +15438,10 @@ var prepareEvidencePacket = /* @__PURE__ */ __name(({ kind, source, page, limits
|
|
|
15607
15438
|
},
|
|
15608
15439
|
items
|
|
15609
15440
|
};
|
|
15610
|
-
return { ...content, id:
|
|
15441
|
+
return { ...content, id: randomUUID5(), fingerprint: hash2(content) };
|
|
15611
15442
|
}, "prepareEvidencePacket");
|
|
15612
15443
|
|
|
15613
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15444
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/evidence-read.js
|
|
15614
15445
|
var readEvidencePacket = /* @__PURE__ */ __name(async (store, account2, { chat, limit, before: before2 }, messenger = {}) => {
|
|
15615
15446
|
if (!Number.isSafeInteger(limit) || limit < 1 || limit > 100)
|
|
15616
15447
|
throw new CliError("validation_error", "evidence message limit must be an integer from 1 to 100");
|
|
@@ -15630,7 +15461,7 @@ var readEvidencePacket = /* @__PURE__ */ __name(async (store, account2, { chat,
|
|
|
15630
15461
|
return { ...packet, nextBeforeId: older && last ? last.id : null };
|
|
15631
15462
|
}, "readEvidencePacket");
|
|
15632
15463
|
|
|
15633
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15464
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-hit-search.js
|
|
15634
15465
|
var refreshMeetingIndex = /* @__PURE__ */ __name(async (meetings, accountId, signal) => {
|
|
15635
15466
|
let before2 = Number.POSITIVE_INFINITY;
|
|
15636
15467
|
for (; ; ) {
|
|
@@ -15692,7 +15523,7 @@ var searchMeetingHits = /* @__PURE__ */ __name(async (store, query, request, opt
|
|
|
15692
15523
|
return { ...result, selection };
|
|
15693
15524
|
}, "searchMeetingHits");
|
|
15694
15525
|
|
|
15695
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15526
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-links.js
|
|
15696
15527
|
var readMeetingLinks = /* @__PURE__ */ __name(async (store, request) => {
|
|
15697
15528
|
const { maxMessages, url, ...selecting } = request;
|
|
15698
15529
|
const { input, selection } = await resolveMeetingSelection(store, selecting);
|
|
@@ -15705,7 +15536,7 @@ var readMeetingLinks = /* @__PURE__ */ __name(async (store, request) => {
|
|
|
15705
15536
|
for (const found of findMentions(line2.text)) {
|
|
15706
15537
|
if (found.kind !== "url" || url !== void 0 && found.value !== url)
|
|
15707
15538
|
continue;
|
|
15708
|
-
const
|
|
15539
|
+
const link4 = links.get(found.value) ?? {
|
|
15709
15540
|
url: found.value,
|
|
15710
15541
|
domain: found.domain,
|
|
15711
15542
|
documentId: googleDocumentId(found.value),
|
|
@@ -15715,13 +15546,13 @@ var readMeetingLinks = /* @__PURE__ */ __name(async (store, request) => {
|
|
|
15715
15546
|
senders: [],
|
|
15716
15547
|
meetings: []
|
|
15717
15548
|
};
|
|
15718
|
-
|
|
15719
|
-
|
|
15720
|
-
if (line2.sender !== null && !
|
|
15721
|
-
|
|
15722
|
-
if (!
|
|
15723
|
-
|
|
15724
|
-
links.set(found.value,
|
|
15549
|
+
link4.count += 1;
|
|
15550
|
+
link4.lastAt = line2.sentAt;
|
|
15551
|
+
if (line2.sender !== null && !link4.senders.includes(line2.sender))
|
|
15552
|
+
link4.senders.push(line2.sender);
|
|
15553
|
+
if (!link4.meetings.some((one) => one.meetingId === line2.meetingId))
|
|
15554
|
+
link4.meetings.push({ meetingId: line2.meetingId, accountId: line2.accountId, title: line2.title });
|
|
15555
|
+
links.set(found.value, link4);
|
|
15725
15556
|
}
|
|
15726
15557
|
return {
|
|
15727
15558
|
items: [...links.values()].sort((a, b) => b.count - a.count || b.lastAt - a.lastAt),
|
|
@@ -15731,10 +15562,10 @@ var readMeetingLinks = /* @__PURE__ */ __name(async (store, request) => {
|
|
|
15731
15562
|
};
|
|
15732
15563
|
}, "readMeetingLinks");
|
|
15733
15564
|
|
|
15734
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15565
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidates.js
|
|
15735
15566
|
import { createHash as createHash13 } from "node:crypto";
|
|
15736
15567
|
|
|
15737
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15568
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidate-validation.js
|
|
15738
15569
|
function invalid3(field, response = false) {
|
|
15739
15570
|
throw new CliError(response ? "invalid_response" : "validation_error", `invalid project candidate ${field}`);
|
|
15740
15571
|
}
|
|
@@ -15853,7 +15684,7 @@ var candidateCatalog = /* @__PURE__ */ __name((catalog, limits) => {
|
|
|
15853
15684
|
}
|
|
15854
15685
|
}, "candidateCatalog");
|
|
15855
15686
|
|
|
15856
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15687
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-project-candidates.js
|
|
15857
15688
|
var createMeetingProjectCandidateReader = /* @__PURE__ */ __name((scope, accountId, ports) => {
|
|
15858
15689
|
const fixed = snapshotMeetingScope(scope);
|
|
15859
15690
|
if (!Number.isSafeInteger(accountId) || accountId < 1 || typeof ports?.vocabulary?.vocabulary !== "function")
|
|
@@ -15906,7 +15737,7 @@ var createMeetingProjectCandidateReader = /* @__PURE__ */ __name((scope, account
|
|
|
15906
15737
|
};
|
|
15907
15738
|
}, "createMeetingProjectCandidateReader");
|
|
15908
15739
|
|
|
15909
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15740
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-project-discovery.js
|
|
15910
15741
|
import { createHash as createHash14 } from "node:crypto";
|
|
15911
15742
|
var scopeKeys = [
|
|
15912
15743
|
"accountId",
|
|
@@ -16041,7 +15872,7 @@ var readMeetingProjectDiscovery = /* @__PURE__ */ __name(async (ports, projectNa
|
|
|
16041
15872
|
};
|
|
16042
15873
|
}, "readMeetingProjectDiscovery");
|
|
16043
15874
|
|
|
16044
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15875
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-review.js
|
|
16045
15876
|
var readMeetingReview = /* @__PURE__ */ __name(async (store, request) => {
|
|
16046
15877
|
const { limit, ...selecting } = request;
|
|
16047
15878
|
const { input, selection } = await resolveMeetingSelection(store, selecting);
|
|
@@ -16049,7 +15880,7 @@ var readMeetingReview = /* @__PURE__ */ __name(async (store, request) => {
|
|
|
16049
15880
|
return { ...review, selection };
|
|
16050
15881
|
}, "readMeetingReview");
|
|
16051
15882
|
|
|
16052
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15883
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-searches.js
|
|
16053
15884
|
var KIND = ["meetings-search"];
|
|
16054
15885
|
var meetingSearchesService = /* @__PURE__ */ __name((searches) => {
|
|
16055
15886
|
const found = /* @__PURE__ */ __name(async (reference) => {
|
|
@@ -16079,7 +15910,7 @@ var meetingSearchesService = /* @__PURE__ */ __name((searches) => {
|
|
|
16079
15910
|
};
|
|
16080
15911
|
}, "meetingSearchesService");
|
|
16081
15912
|
|
|
16082
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15913
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-stats.js
|
|
16083
15914
|
var readMeetingStats = /* @__PURE__ */ __name(async (store, request) => {
|
|
16084
15915
|
const { timeZone, maxRows, ...selecting } = request;
|
|
16085
15916
|
const { input, selection } = await resolveMeetingSelection(store, selecting);
|
|
@@ -16091,7 +15922,7 @@ var readMeetingStats = /* @__PURE__ */ __name(async (store, request) => {
|
|
|
16091
15922
|
return { ...stats, selection };
|
|
16092
15923
|
}, "readMeetingStats");
|
|
16093
15924
|
|
|
16094
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15925
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-hit-context.js
|
|
16095
15926
|
import { createHash as createHash15 } from "node:crypto";
|
|
16096
15927
|
var contextCue = /* @__PURE__ */ __name((cue) => ({
|
|
16097
15928
|
ref: cue.reference,
|
|
@@ -16209,7 +16040,7 @@ var readMeetingHitContext = /* @__PURE__ */ __name(async (store, accountId, refe
|
|
|
16209
16040
|
return { ...packet, fingerprint: createHash15("sha256").update(JSON.stringify(packet)).digest("hex") };
|
|
16210
16041
|
}, "readMeetingHitContext");
|
|
16211
16042
|
|
|
16212
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16043
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-passage-format.js
|
|
16213
16044
|
var visible = /* @__PURE__ */ __name((text2) => text2.replace(/[\p{Cc}\p{Cf}]/gu, (value) => value === "\n" || value === " " ? value : `\\u{${value.codePointAt(0)?.toString(16)}}`), "visible");
|
|
16214
16045
|
var markdown = /* @__PURE__ */ __name((text2) => visible(text2).replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replace(/[\\`*_[\]#|~]/g, "\\$&"), "markdown");
|
|
16215
16046
|
var timestamp = /* @__PURE__ */ __name((ms) => {
|
|
@@ -16285,7 +16116,7 @@ var readMeetingPassage = /* @__PURE__ */ __name(async (store, accountId, referen
|
|
|
16285
16116
|
return { packet, content };
|
|
16286
16117
|
}, "readMeetingPassage");
|
|
16287
16118
|
|
|
16288
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16119
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-batch.js
|
|
16289
16120
|
var createMeetingBatchReader = /* @__PURE__ */ __name((store, accountId) => {
|
|
16290
16121
|
if (!Number.isSafeInteger(accountId) || accountId < 1)
|
|
16291
16122
|
throw new CliError("validation_error", "choose a positive meeting account");
|
|
@@ -16299,10 +16130,10 @@ var createMeetingBatchReader = /* @__PURE__ */ __name((store, accountId) => {
|
|
|
16299
16130
|
};
|
|
16300
16131
|
}, "createMeetingBatchReader");
|
|
16301
16132
|
|
|
16302
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16133
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-combined.js
|
|
16303
16134
|
import { createHash as createHash16 } from "node:crypto";
|
|
16304
16135
|
|
|
16305
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16136
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-semantic.js
|
|
16306
16137
|
var positive2 = /* @__PURE__ */ __name((value, name, max) => {
|
|
16307
16138
|
if (!Number.isSafeInteger(value) || value < 1 || value > max)
|
|
16308
16139
|
throw new CliError("validation_error", `Invalid ${name}`);
|
|
@@ -16454,7 +16285,7 @@ var applyMeetingEmbedding = /* @__PURE__ */ __name(async (store, accountId, embe
|
|
|
16454
16285
|
};
|
|
16455
16286
|
}, "applyMeetingEmbedding");
|
|
16456
16287
|
|
|
16457
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16288
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-combined.js
|
|
16458
16289
|
var DEPTH = 200;
|
|
16459
16290
|
var cursorOf3 = /* @__PURE__ */ __name((value, key) => {
|
|
16460
16291
|
if (value === void 0)
|
|
@@ -16591,7 +16422,7 @@ var searchMeetingsCombined = /* @__PURE__ */ __name(async (store, embedder, type
|
|
|
16591
16422
|
};
|
|
16592
16423
|
}, "searchMeetingsCombined");
|
|
16593
16424
|
|
|
16594
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16425
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-context.js
|
|
16595
16426
|
var meetingReferences = /* @__PURE__ */ __name((values) => values.map((value) => formatMeetingReference(parseMeetingReference(value))), "meetingReferences");
|
|
16596
16427
|
var checkCancelled = /* @__PURE__ */ __name((signal) => {
|
|
16597
16428
|
if (!signal?.aborted)
|
|
@@ -16696,7 +16527,7 @@ var createMeetingContextService = /* @__PURE__ */ __name(async (store, input, op
|
|
|
16696
16527
|
};
|
|
16697
16528
|
}, "createMeetingContextService");
|
|
16698
16529
|
|
|
16699
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16530
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-model.js
|
|
16700
16531
|
var integer = /* @__PURE__ */ __name((value, name, max) => {
|
|
16701
16532
|
if (!Number.isSafeInteger(value) || value < 1 || value > max)
|
|
16702
16533
|
throw new CliError("validation_error", `Invalid ${name}`);
|
|
@@ -16923,7 +16754,7 @@ var openMeetingEmbedder = /* @__PURE__ */ __name(async (choice, options = {}) =>
|
|
|
16923
16754
|
};
|
|
16924
16755
|
}, "openMeetingEmbedder");
|
|
16925
16756
|
|
|
16926
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16757
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/context/communication-selection.js
|
|
16927
16758
|
var communicationFields = {
|
|
16928
16759
|
sources: pipe(array(strictObject({
|
|
16929
16760
|
id: pipe(string(), regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/)),
|
|
@@ -16955,7 +16786,7 @@ var communicationRequest = /* @__PURE__ */ __name((value, preparationAfter) => {
|
|
|
16955
16786
|
return { ...input, after, before: before2 };
|
|
16956
16787
|
}, "communicationRequest");
|
|
16957
16788
|
|
|
16958
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16789
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-preparation-validation.js
|
|
16959
16790
|
var MEETING_PREPARATION_LIMITS = {
|
|
16960
16791
|
meetings: { min: 1, max: 20, default: 5 },
|
|
16961
16792
|
cues: { min: 1, max: 100, default: 10 },
|
|
@@ -17041,7 +16872,7 @@ var preparationRequest = /* @__PURE__ */ __name((accountId, externalId, original
|
|
|
17041
16872
|
return { ...input, history };
|
|
17042
16873
|
}, "preparationRequest");
|
|
17043
16874
|
|
|
17044
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16875
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-communications-preparation.js
|
|
17045
16876
|
var readPreparationCommunications = /* @__PURE__ */ __name(async (plan, signal) => {
|
|
17046
16877
|
const section = {
|
|
17047
16878
|
readUsage: plan.reader.usage(),
|
|
@@ -17146,7 +16977,7 @@ var appendPreparationCommunications = /* @__PURE__ */ __name((result, read) => {
|
|
|
17146
16977
|
result.knowledge.coverage.otherSources = "see-communications";
|
|
17147
16978
|
}, "appendPreparationCommunications");
|
|
17148
16979
|
|
|
17149
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16980
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-communications-selection.js
|
|
17150
16981
|
var captureCommunicationSelections = /* @__PURE__ */ __name((port) => {
|
|
17151
16982
|
if (port === void 0)
|
|
17152
16983
|
return void 0;
|
|
@@ -17251,7 +17082,7 @@ var validatePreparationCommunications = /* @__PURE__ */ __name((section, request
|
|
|
17251
17082
|
}
|
|
17252
17083
|
}, "validatePreparationCommunications");
|
|
17253
17084
|
|
|
17254
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17085
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-knowledge-preparation.js
|
|
17255
17086
|
var invalid4 = /* @__PURE__ */ __name(() => {
|
|
17256
17087
|
throw new CliError("invalid_response", "Preparation knowledge returned an invalid selection");
|
|
17257
17088
|
}, "invalid");
|
|
@@ -17320,7 +17151,7 @@ var appendKnowledgePreparation = /* @__PURE__ */ __name(async (store, result, in
|
|
|
17320
17151
|
}
|
|
17321
17152
|
}, "appendKnowledgePreparation");
|
|
17322
17153
|
|
|
17323
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17154
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-notes-preparation.js
|
|
17324
17155
|
var invalid5 = /* @__PURE__ */ __name(() => {
|
|
17325
17156
|
throw new CliError("invalid_response", "Preparation notes returned an invalid selection");
|
|
17326
17157
|
}, "invalid");
|
|
@@ -17394,7 +17225,7 @@ var appendNotesPreparation = /* @__PURE__ */ __name(async (store, result, input)
|
|
|
17394
17225
|
}
|
|
17395
17226
|
}, "appendNotesPreparation");
|
|
17396
17227
|
|
|
17397
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17228
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-project-preparation.js
|
|
17398
17229
|
var PAGE_LIMIT = 4;
|
|
17399
17230
|
var size2 = /* @__PURE__ */ __name((value) => Buffer.byteLength(JSON.stringify(value), "utf8"), "size");
|
|
17400
17231
|
var appendProjectPreparation = /* @__PURE__ */ __name(async (ports, result, input) => {
|
|
@@ -17444,7 +17275,7 @@ var appendProjectPreparation = /* @__PURE__ */ __name(async (ports, result, inpu
|
|
|
17444
17275
|
}
|
|
17445
17276
|
}, "appendProjectPreparation");
|
|
17446
17277
|
|
|
17447
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17278
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-related-preparation.js
|
|
17448
17279
|
var appendRelatedPreparation = /* @__PURE__ */ __name(async (store, result, input) => {
|
|
17449
17280
|
if (!result.series || !result.items.length || result.coverage.outputLimited)
|
|
17450
17281
|
return;
|
|
@@ -17516,7 +17347,7 @@ var appendRelatedPreparation = /* @__PURE__ */ __name(async (store, result, inpu
|
|
|
17516
17347
|
}
|
|
17517
17348
|
}, "appendRelatedPreparation");
|
|
17518
17349
|
|
|
17519
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17350
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-preparation.js
|
|
17520
17351
|
var size3 = /* @__PURE__ */ __name((value) => Buffer.byteLength(JSON.stringify(value), "utf8"), "size");
|
|
17521
17352
|
var createMeetingPreparationService = /* @__PURE__ */ __name((scope, accountId, ports) => {
|
|
17522
17353
|
const fixed = snapshotMeetingScope(scope);
|
|
@@ -17654,7 +17485,7 @@ var createMeetingPreparationService = /* @__PURE__ */ __name((scope, accountId,
|
|
|
17654
17485
|
};
|
|
17655
17486
|
}, "createMeetingPreparationService");
|
|
17656
17487
|
|
|
17657
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17488
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-task-proposal.js
|
|
17658
17489
|
import { createHash as createHash17 } from "node:crypto";
|
|
17659
17490
|
var proposeMeetingTask = /* @__PURE__ */ __name(async (store, accountId, reference, kind) => {
|
|
17660
17491
|
if (!TASK_KINDS.includes(kind))
|
|
@@ -17674,7 +17505,7 @@ var proposeMeetingTask = /* @__PURE__ */ __name(async (store, accountId, referen
|
|
|
17674
17505
|
};
|
|
17675
17506
|
}, "proposeMeetingTask");
|
|
17676
17507
|
|
|
17677
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17508
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/meeting-tasks.js
|
|
17678
17509
|
var accountSnapshot = /* @__PURE__ */ __name((key) => {
|
|
17679
17510
|
const { provider, account: account2, scope } = key;
|
|
17680
17511
|
if (!provider.trim() || provider.includes(":") || !account2.trim())
|
|
@@ -17737,7 +17568,7 @@ var readMeetingTask = /* @__PURE__ */ __name(async (store, account2, id2) => {
|
|
|
17737
17568
|
}
|
|
17738
17569
|
}, "readMeetingTask");
|
|
17739
17570
|
|
|
17740
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17571
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/package-upgrade.js
|
|
17741
17572
|
var upgradePackage = /* @__PURE__ */ __name(async ({ current, command, packageName, check }, ports) => {
|
|
17742
17573
|
const installer = ports.installer();
|
|
17743
17574
|
const argv = updateCommand(installer, packageName);
|
|
@@ -17802,7 +17633,7 @@ var dayAfter = /* @__PURE__ */ __name((published) => {
|
|
|
17802
17633
|
return Number.isNaN(time) ? null : new Date(time + 24 * 60 * 60 * 1e3).toISOString();
|
|
17803
17634
|
}, "dayAfter");
|
|
17804
17635
|
|
|
17805
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17636
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/proposal-tasks.js
|
|
17806
17637
|
var proposalSource = /* @__PURE__ */ __name((id2) => `proposed-action:${id2}`, "proposalSource");
|
|
17807
17638
|
var approveAsTask = /* @__PURE__ */ __name(async (store, id2) => {
|
|
17808
17639
|
const proposal = await store.proposedActions.get(id2);
|
|
@@ -17831,7 +17662,7 @@ var approveAsTask = /* @__PURE__ */ __name(async (store, id2) => {
|
|
|
17831
17662
|
return { proposal: await store.proposedActions.approve(proposal.id, { task: task2.id }), task: task2 };
|
|
17832
17663
|
}, "approveAsTask");
|
|
17833
17664
|
|
|
17834
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17665
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/stored-meeting-project-candidate-validation.js
|
|
17835
17666
|
var storedCandidateRequest = /* @__PURE__ */ __name((reference, accountId, options) => {
|
|
17836
17667
|
const invalid6 = /* @__PURE__ */ __name((field) => {
|
|
17837
17668
|
throw new CliError("validation_error", `invalid stored project candidate ${field}`);
|
|
@@ -17873,7 +17704,7 @@ var storedCandidateRequest = /* @__PURE__ */ __name((reference, accountId, optio
|
|
|
17873
17704
|
return { reference, limits, after, afterTranscriptId, signal };
|
|
17874
17705
|
}, "storedCandidateRequest");
|
|
17875
17706
|
|
|
17876
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17707
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/stored-meeting-project-candidates.js
|
|
17877
17708
|
var createStoredMeetingProjectCandidateReader = /* @__PURE__ */ __name((scope, accountId, ports) => {
|
|
17878
17709
|
const fixed = snapshotMeetingScope(scope);
|
|
17879
17710
|
const store = ports?.meetings;
|
|
@@ -17965,7 +17796,7 @@ var createStoredMeetingProjectCandidateReader = /* @__PURE__ */ __name((scope, a
|
|
|
17965
17796
|
};
|
|
17966
17797
|
}, "createStoredMeetingProjectCandidateReader");
|
|
17967
17798
|
|
|
17968
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17799
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.501.0_@wirecat+cli-base@0.67.0_commander@15.0.0_esbuild@0.28.2_type_e6af10c98f87b1454255e560646d3ddf/node_modules/@wirecat/cli-core/dist/services/index.js
|
|
17969
17800
|
var servicesFor = /* @__PURE__ */ __name((deps) => {
|
|
17970
17801
|
const pictures = picturesService(deps);
|
|
17971
17802
|
const base = {
|
|
@@ -18015,12 +17846,9 @@ export {
|
|
|
18015
17846
|
storeOnlyDeps,
|
|
18016
17847
|
REGISTRIES,
|
|
18017
17848
|
registriesCover,
|
|
17849
|
+
chatCoverage,
|
|
18018
17850
|
createContextEvidenceReader,
|
|
18019
17851
|
excerpt,
|
|
18020
|
-
writeFileAtomic,
|
|
18021
|
-
syncDirectory,
|
|
18022
|
-
readBoundedUtf8File,
|
|
18023
|
-
acquireLock,
|
|
18024
17852
|
validateMediaSince,
|
|
18025
17853
|
checkMediaArchive,
|
|
18026
17854
|
archiveMedia,
|
|
@@ -18051,7 +17879,6 @@ export {
|
|
|
18051
17879
|
searchRecordOf,
|
|
18052
17880
|
isAdminSelection,
|
|
18053
17881
|
adminStatisticsService,
|
|
18054
|
-
chatCoverage,
|
|
18055
17882
|
threadIdOf,
|
|
18056
17883
|
AUDIT_PAGE,
|
|
18057
17884
|
AUDIT_BUDGET,
|
|
@@ -18110,6 +17937,7 @@ export {
|
|
|
18110
17937
|
pinDurationOf,
|
|
18111
17938
|
sendAsCheck,
|
|
18112
17939
|
typedSendAs,
|
|
17940
|
+
TOTAL_CAP,
|
|
18113
17941
|
THREAD_BOUNDS,
|
|
18114
17942
|
readThreadContext,
|
|
18115
17943
|
MAX_SEARCH_OFFSET,
|
|
@@ -18133,6 +17961,7 @@ export {
|
|
|
18133
17961
|
embedEvents,
|
|
18134
17962
|
embedMail,
|
|
18135
17963
|
nearestNotes,
|
|
17964
|
+
RANK_WITHIN,
|
|
18136
17965
|
searchNotes,
|
|
18137
17966
|
searchNotesOf,
|
|
18138
17967
|
calendarAccounts,
|