@wirecat/zoom-cli 0.69.0 → 0.71.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/README.md +1 -1
- package/dist/account-removal.d.ts +6 -0
- package/dist/account-removal.d.ts.map +1 -0
- package/dist/account-removal.js +43 -0
- package/dist/account-removal.js.map +1 -0
- package/dist/answer-entities.d.ts +2 -0
- package/dist/answer-entities.d.ts.map +1 -1
- package/dist/bin/zm.js +2 -2
- package/dist/bundle/{all-profiles-ZQWPCJEK.js → all-profiles-O4YNVPZX.js} +9 -9
- package/dist/bundle/answer-policy-PPSPMCLH.js +104 -0
- package/dist/bundle/{anthropic-7FUQ2HYJ.js → anthropic-7GGRX3RX.js} +20 -9
- package/dist/bundle/{app-server-DNPE2EQB.js → app-server-CPMKM3HI.js} +50 -50
- package/dist/bundle/{bun-ZVQFCFCC.js → bun-POHZKEPV.js} +2 -2
- package/dist/bundle/{bun-sqlite-EB2UMUPJ.js → bun-sqlite-PGYMBPEL.js} +4 -4
- package/dist/bundle/{chunk-R2ULMWB4.js → chunk-2FV5JUQU.js} +39 -593
- package/dist/bundle/{chunk-R3JYPY3J.js → chunk-2KESWII5.js} +2 -2
- package/dist/bundle/{chunk-S2EAGDS7.js → chunk-2RUAMDVV.js} +11 -11
- package/dist/bundle/{chunk-H3MFBYTQ.js → chunk-2U27KIKU.js} +5 -5
- package/dist/bundle/{chunk-KAPJQGHE.js → chunk-2U6SER67.js} +1 -1
- package/dist/bundle/chunk-4LAQDZXU.js +1635 -0
- package/dist/bundle/{chunk-SQT47CFW.js → chunk-4QPQ7MDA.js} +1 -1
- package/dist/bundle/{chunk-MNOVYS43.js → chunk-4QUFFB2U.js} +3 -3
- package/dist/bundle/{chunk-V74QFMSL.js → chunk-54YDWBYG.js} +1 -1
- package/dist/bundle/{chunk-MSDCZ6GT.js → chunk-5J4AMBMM.js} +4 -4
- package/dist/bundle/{chunk-GR3QDHBU.js → chunk-5K7OGPGA.js} +5 -5
- package/dist/bundle/{chunk-WY4NYPPS.js → chunk-5LJTU4LY.js} +12 -12
- package/dist/bundle/{chunk-MJMVIFSC.js → chunk-633QXP57.js} +10 -8
- package/dist/bundle/{chunk-EPPSMCEV.js → chunk-64ZHF6PJ.js} +1 -1
- package/dist/bundle/{chunk-ZRHMB3LQ.js → chunk-77TCCHMP.js} +1 -1
- package/dist/bundle/{chunk-BOAMDYLY.js → chunk-7QC4M4HS.js} +2 -2
- package/dist/bundle/{chunk-O7L44JK2.js → chunk-7ROXXRGG.js} +3933 -1525
- package/dist/bundle/{chunk-MVDPZRFE.js → chunk-ALIT5QFT.js} +1 -1
- package/dist/bundle/{chunk-6N2D6JGX.js → chunk-BBTQIVFP.js} +1 -1
- package/dist/bundle/{chunk-QXM7S3Y3.js → chunk-BGTEVIW4.js} +5 -5
- package/dist/bundle/{chunk-JX5JJZC3.js → chunk-CFQF6IGY.js} +2 -2
- package/dist/bundle/{chunk-5GOE6PQK.js → chunk-CKPCVEXU.js} +5 -5
- package/dist/bundle/{chunk-6KMTQX3D.js → chunk-CRFOGYDG.js} +1 -1
- package/dist/bundle/{chunk-5H6VTEEC.js → chunk-CT4WVR4N.js} +2 -2
- package/dist/bundle/{chunk-3TPRYZUW.js → chunk-DHWBSXG3.js} +23 -23
- package/dist/bundle/{chunk-IPBZKUC3.js → chunk-DIQLXAAZ.js} +3 -3
- package/dist/bundle/{chunk-JZ4YOAHA.js → chunk-DK6ICIGL.js} +4558 -1670
- package/dist/bundle/{chunk-OSBHEM2A.js → chunk-DRBQDCDU.js} +10 -10
- package/dist/bundle/{chunk-G6IX2MD2.js → chunk-DSVZEXYJ.js} +1104 -948
- package/dist/bundle/{chunk-B6JMVB6R.js → chunk-EOSVN2ER.js} +1 -1
- package/dist/bundle/{chunk-MOTKS7XG.js → chunk-FSHCAWZS.js} +29354 -16490
- package/dist/bundle/{chunk-TKXLWFM2.js → chunk-GGS6D4W4.js} +3 -3
- package/dist/bundle/{chunk-4APZQYCH.js → chunk-GL3MYFMX.js} +4 -4
- package/dist/bundle/{chunk-LDRQ5NAP.js → chunk-GXF5HFFP.js} +3 -3
- package/dist/bundle/{chunk-5ZF6QVMC.js → chunk-HB6XJQ3Y.js} +4 -4
- package/dist/bundle/{chunk-QW5VPZEH.js → chunk-I4DFFR7F.js} +23 -1
- package/dist/bundle/{chunk-DHD25JII.js → chunk-IAV5BG3I.js} +1 -1
- package/dist/bundle/{chunk-52DCABMU.js → chunk-IED3NS7G.js} +30 -38
- package/dist/bundle/{chunk-LQX74VKG.js → chunk-INVTDIF6.js} +1 -1
- package/dist/bundle/{chunk-CKK6JOC4.js → chunk-KMV7GZB6.js} +2 -2
- package/dist/bundle/{chunk-XRZDYWF6.js → chunk-LE7MDAQG.js} +2 -2
- package/dist/bundle/{chunk-B5D7NZI7.js → chunk-M76MXMLY.js} +1 -1
- package/dist/bundle/{chunk-37B7A4RP.js → chunk-MEED7YFG.js} +1 -1
- package/dist/bundle/{chunk-LEA4BGK7.js → chunk-MRI6QMZ3.js} +11 -11
- package/dist/bundle/{chunk-6TICX3MN.js → chunk-MW4EGDDV.js} +2 -2
- package/dist/bundle/{chunk-SZ3Z4ZNO.js → chunk-N2FNMION.js} +1 -1
- package/dist/bundle/{chunk-CUZHKYC2.js → chunk-OHWMIUCT.js} +450 -641
- package/dist/bundle/{chunk-KNE6VFHZ.js → chunk-OORMSM6O.js} +1 -1
- package/dist/bundle/{chunk-Z6TTGTMU.js → chunk-OWEBWDHV.js} +76 -6
- package/dist/bundle/{chunk-5ZJXKASF.js → chunk-P3XC6EDU.js} +17 -21
- package/dist/bundle/chunk-Q2SUFGSH.js +136 -0
- package/dist/bundle/{chunk-TFFEFEG2.js → chunk-Q3XLZIY3.js} +18 -18
- package/dist/bundle/{chunk-IEC4E65G.js → chunk-Q5PI72CR.js} +5 -1
- package/dist/bundle/{chunk-V4MM6GST.js → chunk-QTHIU7CO.js} +1 -1
- package/dist/bundle/{chunk-JHFP3Z5S.js → chunk-QVSLSWAL.js} +8 -8
- package/dist/bundle/{chunk-QLGG7S6F.js → chunk-RN4EHCC5.js} +22 -4
- package/dist/bundle/{chunk-BL36NSV5.js → chunk-RQG5VOGH.js} +12 -2
- package/dist/bundle/{chunk-RPQ3JOD3.js → chunk-SELXER2Q.js} +5 -5
- package/dist/bundle/{chunk-KX5MZVPX.js → chunk-TM4JSVGQ.js} +60 -53
- package/dist/bundle/{chunk-TN77LX6W.js → chunk-UG447QY2.js} +1 -1
- package/dist/bundle/{chunk-HC56J5LB.js → chunk-ULDXZ6LH.js} +66 -59
- package/dist/bundle/chunk-USQ23X5V.js +1227 -0
- package/dist/bundle/{chunk-UEZ6URJR.js → chunk-VJXHIUFP.js} +19 -19
- package/dist/bundle/{chunk-TWIC6JJG.js → chunk-VRH7VRTK.js} +7 -7
- package/dist/bundle/{chunk-NRRI37NJ.js → chunk-WOIHSQAL.js} +44 -0
- package/dist/bundle/{chunk-L62EJDNZ.js → chunk-X277FBTF.js} +3 -3
- package/dist/bundle/{chunk-XITUFTON.js → chunk-X3ZDN3U7.js} +1 -1
- package/dist/bundle/{chunk-GXDOTUUO.js → chunk-X4GWR6GO.js} +9 -9
- package/dist/bundle/chunk-XI3VIQKW.js +756 -0
- package/dist/bundle/{chunk-FBLUKCIR.js → chunk-XRFHQGOD.js} +1 -1
- package/dist/bundle/{chunk-HW5QTRFF.js → chunk-YD2RYVMK.js} +36 -36
- package/dist/bundle/{chunk-XJBYGMZ4.js → chunk-YPO2U2YB.js} +669 -458
- package/dist/bundle/{chunk-C6TEYKXV.js → chunk-ZBFL5JPT.js} +8 -7
- package/dist/bundle/{chunk-7AUP2WT3.js → chunk-ZBKWRYRS.js} +2 -2
- package/dist/bundle/{chunk-HSI7YOYK.js → chunk-ZVI6TFQR.js} +100 -43
- package/dist/bundle/{cli-P3BZUE6S.js → cli-KHMEUXNG.js} +123 -68
- package/dist/bundle/command-contract-4K6XXZYE.js +41 -0
- package/dist/bundle/config-EEDB632I.js +90 -0
- package/dist/bundle/{decode-QWOQXM7M.js → decode-7RP4HSVE.js} +4 -4
- package/dist/bundle/{dispatch-5MGDLOK4.js → dispatch-IZCAK47P.js} +1 -1
- package/dist/bundle/{dist-OUE4MF37.js → dist-BFT2SUBV.js} +87 -51
- package/dist/bundle/{echarts-65IMPY43.js → echarts-T2BSQ2YV.js} +2 -2
- package/dist/bundle/{embed-4IULBCKL.js → embed-BAS6YPDT.js} +5 -5
- package/dist/bundle/{embedder-JW4W6IZI.js → embedder-5XD5FCAO.js} +8 -8
- package/dist/bundle/{failure-CR64C4XA.js → failure-R2OIHCE5.js} +1 -1
- package/dist/bundle/{first-run-CH6C674R.js → first-run-23WWZ2PW.js} +8 -8
- package/dist/bundle/first-screen-6HFUYVFR.js +39 -0
- package/dist/bundle/{folders-VU4IN35Y.js → folders-ZXTOFY4T.js} +3 -3
- package/dist/bundle/{instructions-G5QIH2TM.js → instructions-XZPROPKY.js} +1 -1
- package/dist/bundle/{main-O4ZJIEWP.js → main-TZXKGL3L.js} +18 -18
- package/dist/bundle/{meetings-77CCAVYD.js → meetings-JB2ISPND.js} +6 -4
- package/dist/bundle/{node-E6VQHU4Y.js → node-A3B3MJWX.js} +2 -2
- package/dist/bundle/{node-sqlite-RJZ4PGLD.js → node-sqlite-QVWDLGDX.js} +5 -5
- package/dist/bundle/{oauth-F4JKNRW4.js → oauth-YA6IYV4O.js} +6 -6
- package/dist/bundle/{open-NYOGMIAA.js → open-SY7TXJBS.js} +4 -4
- package/dist/bundle/{openai-5U6EQTFQ.js → openai-2AU24NRN.js} +10 -10
- package/dist/bundle/{output-file-6COFGPUL.js → output-file-YGQYZCBJ.js} +4 -4
- package/dist/bundle/{process-OBWUKBMX.js → process-6HNBTJIY.js} +1 -1
- package/dist/bundle/{program-MU7DEJTO.js → program-77BUCJ4H.js} +132 -100
- package/dist/bundle/{prompt-2QWQTHWT.js → prompt-YDG73YDS.js} +6 -4
- package/dist/bundle/{recognize-SNUNTUC3.js → recognize-ECXDGTB7.js} +3 -3
- package/dist/bundle/{remote-2CTCIQGF.js → remote-K4JHGBVJ.js} +6 -6
- package/dist/bundle/{rerank-XDA7NJNH.js → rerank-IU2YYD4T.js} +6 -6
- package/dist/bundle/{run-log-NSG3DJVX.js → run-log-LFEXNZ74.js} +54 -54
- package/dist/bundle/{serve-TWQFHOV2.js → serve-3XWIF3HI.js} +8 -8
- package/dist/bundle/{server-RIQ6HMH2.js → server-56VYOHWP.js} +42 -42
- package/dist/bundle/server-YSTMUZ22.js +72 -0
- package/dist/bundle/{services-NKZQJQIV.js → services-X7IPEGQ5.js} +118 -36
- package/dist/bundle/{speech-ZOB76SXA.js → speech-E2OBQWYA.js} +12 -12
- package/dist/bundle/{state-7YYEIXQ5.js → state-4GMJYK4H.js} +5 -5
- package/dist/bundle/{store-OX4HRBLO.js → store-KPI7GB5Y.js} +49 -22
- package/dist/bundle/{store-E6RTSSNR.js → store-LA4TV4DM.js} +39 -16
- package/dist/bundle/store-connection-AZTIF6IH.js +83 -0
- package/dist/bundle/store-maintenance-command-LR572PS4.js +61 -0
- package/dist/bundle/{streaming-O53PIORL.js → streaming-EJ3NM2C2.js} +5 -5
- package/dist/bundle/{tokens-QKNEP2GJ.js → tokens-BE6CJMR5.js} +5 -5
- package/dist/bundle/zm.js +3 -3
- package/dist/bundle/{zoom-app-TSI2MGVK.js → zoom-app-QEJBTIJ4.js} +6 -6
- package/dist/contract-overrides.d.ts.map +1 -1
- package/dist/contract-overrides.js +0 -6
- package/dist/contract-overrides.js.map +1 -1
- package/dist/first-screen.d.ts.map +1 -1
- package/dist/first-screen.js +1 -0
- package/dist/first-screen.js.map +1 -1
- package/dist/ingestion-search-commands.d.ts.map +1 -1
- package/dist/ingestion-search-commands.js +0 -10
- package/dist/ingestion-search-commands.js.map +1 -1
- package/dist/meeting-integration-commands.d.ts.map +1 -1
- package/dist/meeting-integration-commands.js +8 -6
- package/dist/meeting-integration-commands.js.map +1 -1
- package/dist/meeting-integration.d.ts +3 -1
- package/dist/meeting-integration.d.ts.map +1 -1
- package/dist/permissions.js +1 -1
- package/dist/permissions.js.map +1 -1
- package/dist/setup-commands.d.ts.map +1 -1
- package/dist/setup-commands.js +11 -0
- package/dist/setup-commands.js.map +1 -1
- package/dist/store-connection.d.ts.map +1 -1
- package/dist/store-connection.js +4 -3
- package/dist/store-connection.js.map +1 -1
- package/dist/tokens.d.ts +2 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +11 -0
- package/dist/tokens.js.map +1 -1
- package/dist/unified-search.d.ts +4 -4
- package/dist/unified-search.d.ts.map +1 -1
- package/dist/unified-search.js +1 -24
- package/dist/unified-search.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/skills/zoom-cli/SKILL.md +2 -2
- package/dist/bundle/answer-policy-VBDYLUXI.js +0 -104
- package/dist/bundle/chunk-2SYWVIQJ.js +0 -33
- package/dist/bundle/chunk-6AMMTXEA.js +0 -12473
- package/dist/bundle/chunk-F5DYBWH7.js +0 -299
- package/dist/bundle/chunk-T5X4LGXE.js +0 -380
- package/dist/bundle/command-contract-TOLB32NJ.js +0 -41
- package/dist/bundle/config-4KLLIADY.js +0 -90
- package/dist/bundle/first-screen-OCAW5ZN6.js +0 -39
- package/dist/bundle/server-XO6XQQTJ.js +0 -72
- package/dist/bundle/store-connection-55QPNUDS.js +0 -83
- package/dist/bundle/store-maintenance-command-Q5MSU6OK.js +0 -62
|
@@ -2,11 +2,11 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
renderMessages
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-X3ZDN3U7.js";
|
|
6
6
|
import {
|
|
7
7
|
answerOf,
|
|
8
8
|
messengerContext
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-2FV5JUQU.js";
|
|
10
10
|
import {
|
|
11
11
|
chatEventAnswer,
|
|
12
12
|
memberAnswer,
|
|
@@ -15,19 +15,22 @@ import {
|
|
|
15
15
|
serveRelay,
|
|
16
16
|
typedQuery,
|
|
17
17
|
withQuery
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-Q3XLZIY3.js";
|
|
19
19
|
import {
|
|
20
20
|
holdLock,
|
|
21
21
|
lockPath,
|
|
22
22
|
releaseLock,
|
|
23
23
|
servingProfiles,
|
|
24
24
|
takeLock
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-GGS6D4W4.js";
|
|
26
26
|
import {
|
|
27
27
|
FETCHING,
|
|
28
28
|
RULES_VERSION,
|
|
29
29
|
applyTaskRulesOnArrival,
|
|
30
30
|
capability,
|
|
31
|
+
embeddingKeys,
|
|
32
|
+
endpointKeyName,
|
|
33
|
+
modelGateway,
|
|
31
34
|
newSendId,
|
|
32
35
|
onlineDeps,
|
|
33
36
|
openRequestTask,
|
|
@@ -36,14 +39,15 @@ import {
|
|
|
36
39
|
servicesFor,
|
|
37
40
|
syncsOneChat,
|
|
38
41
|
withTimeLimit
|
|
39
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-DK6ICIGL.js";
|
|
40
43
|
import {
|
|
41
44
|
QUICK_HEALTH_CHECKS,
|
|
42
|
-
explainDamage,
|
|
43
45
|
fts5Tables,
|
|
44
46
|
invalidJson,
|
|
47
|
+
lossUnknown,
|
|
48
|
+
storeDamageReport,
|
|
45
49
|
storeHealth
|
|
46
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-ZVI6TFQR.js";
|
|
47
51
|
import {
|
|
48
52
|
Command,
|
|
49
53
|
LOCAL_READ,
|
|
@@ -52,13 +56,11 @@ import {
|
|
|
52
56
|
REMOTE_WRITE,
|
|
53
57
|
annotate,
|
|
54
58
|
destroysNothing,
|
|
55
|
-
endpoint,
|
|
56
59
|
environmentOf,
|
|
57
60
|
itemOf,
|
|
58
61
|
jsonlRecords,
|
|
59
62
|
lineOf,
|
|
60
63
|
listOf,
|
|
61
|
-
modelTarget,
|
|
62
64
|
nextStep,
|
|
63
65
|
outputFor,
|
|
64
66
|
recalledAccount,
|
|
@@ -67,21 +69,18 @@ import {
|
|
|
67
69
|
snakeKeys,
|
|
68
70
|
storeTable,
|
|
69
71
|
withoutProviderRefs
|
|
70
|
-
} from "./chunk-
|
|
71
|
-
import {
|
|
72
|
-
envName
|
|
73
|
-
} from "./chunk-TN77LX6W.js";
|
|
72
|
+
} from "./chunk-DSVZEXYJ.js";
|
|
74
73
|
import {
|
|
75
74
|
holdersOf
|
|
76
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-ALIT5QFT.js";
|
|
77
76
|
import {
|
|
78
77
|
codeOf,
|
|
79
|
-
|
|
78
|
+
modelTarget,
|
|
80
79
|
parseDuration
|
|
81
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-OHWMIUCT.js";
|
|
82
81
|
import {
|
|
83
82
|
levelFor
|
|
84
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-Q5PI72CR.js";
|
|
85
84
|
import {
|
|
86
85
|
CORPORA,
|
|
87
86
|
MIGRATIONS,
|
|
@@ -95,6 +94,7 @@ import {
|
|
|
95
94
|
fillTrigrams,
|
|
96
95
|
fillVectorIndexes,
|
|
97
96
|
involvementStoreOver,
|
|
97
|
+
isDerivedTable,
|
|
98
98
|
migrate,
|
|
99
99
|
noteIndexState,
|
|
100
100
|
openSqlite,
|
|
@@ -115,57 +115,46 @@ import {
|
|
|
115
115
|
storeClients,
|
|
116
116
|
storeContents,
|
|
117
117
|
vectorIndexCounts
|
|
118
|
-
} from "./chunk-
|
|
119
|
-
import {
|
|
120
|
-
formatLocator,
|
|
121
|
-
parseLocator
|
|
122
|
-
} from "./chunk-6AMMTXEA.js";
|
|
118
|
+
} from "./chunk-FSHCAWZS.js";
|
|
123
119
|
import {
|
|
120
|
+
currentRun,
|
|
124
121
|
readDamageMark,
|
|
125
122
|
readHealthMark,
|
|
123
|
+
readJournalMark,
|
|
126
124
|
recordDeepCheck
|
|
127
|
-
} from "./chunk-
|
|
125
|
+
} from "./chunk-USQ23X5V.js";
|
|
128
126
|
import {
|
|
129
127
|
failureKey,
|
|
130
128
|
isStoreDamage
|
|
131
|
-
} from "./chunk-
|
|
129
|
+
} from "./chunk-MEED7YFG.js";
|
|
132
130
|
import {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
checkedOptions,
|
|
137
|
-
range
|
|
138
|
-
} from "./chunk-2SYWVIQJ.js";
|
|
131
|
+
formatLocator,
|
|
132
|
+
parseLocator
|
|
133
|
+
} from "./chunk-XI3VIQKW.js";
|
|
139
134
|
import {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
validateImages
|
|
143
|
-
} from "./chunk-QW5VPZEH.js";
|
|
135
|
+
readSecret
|
|
136
|
+
} from "./chunk-RN4EHCC5.js";
|
|
144
137
|
import {
|
|
145
138
|
storePath
|
|
146
|
-
} from "./chunk-
|
|
139
|
+
} from "./chunk-KMV7GZB6.js";
|
|
147
140
|
import {
|
|
148
141
|
openCache
|
|
149
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-BGTEVIW4.js";
|
|
150
143
|
import {
|
|
151
144
|
queryFieldsOf
|
|
152
|
-
} from "./chunk-
|
|
145
|
+
} from "./chunk-EOSVN2ER.js";
|
|
153
146
|
import {
|
|
154
|
-
Credentials,
|
|
155
|
-
pathsAreOverridden,
|
|
156
147
|
resolvePaths,
|
|
157
148
|
writeSecurely
|
|
158
|
-
} from "./chunk-
|
|
149
|
+
} from "./chunk-OORMSM6O.js";
|
|
159
150
|
import {
|
|
160
151
|
array,
|
|
161
152
|
boolean,
|
|
162
153
|
check,
|
|
163
154
|
forward,
|
|
164
155
|
getDotPath,
|
|
165
|
-
integer,
|
|
166
156
|
minLength,
|
|
167
157
|
nullable,
|
|
168
|
-
number,
|
|
169
158
|
object,
|
|
170
159
|
optional,
|
|
171
160
|
parse,
|
|
@@ -177,9 +166,8 @@ import {
|
|
|
177
166
|
strictObject,
|
|
178
167
|
string,
|
|
179
168
|
transform,
|
|
180
|
-
trim
|
|
181
|
-
|
|
182
|
-
} from "./chunk-NRRI37NJ.js";
|
|
169
|
+
trim
|
|
170
|
+
} from "./chunk-WOIHSQAL.js";
|
|
183
171
|
import {
|
|
184
172
|
CliError
|
|
185
173
|
} from "./chunk-FEM2JQN2.js";
|
|
@@ -360,14 +348,14 @@ var require_liquid_node = __commonJS({
|
|
|
360
348
|
return value !== null && (type === "object" || type === "function");
|
|
361
349
|
}
|
|
362
350
|
__name(isObject, "isObject");
|
|
363
|
-
function
|
|
351
|
+
function range(start, stop, step = 1) {
|
|
364
352
|
const arr = [];
|
|
365
353
|
for (let i = start; i < stop; i += step) {
|
|
366
354
|
arr.push(i);
|
|
367
355
|
}
|
|
368
356
|
return arr;
|
|
369
357
|
}
|
|
370
|
-
__name(
|
|
358
|
+
__name(range, "range");
|
|
371
359
|
function padStart(str, length, ch = " ") {
|
|
372
360
|
return pad(str, length, ch, (str2, ch2) => ch2 + str2);
|
|
373
361
|
}
|
|
@@ -561,7 +549,7 @@ var require_liquid_node = __commonJS({
|
|
|
561
549
|
const lines = token.input.split("\n");
|
|
562
550
|
const begin = Math.max(line - 2, 1);
|
|
563
551
|
const end = Math.min(line + 3, lines.length);
|
|
564
|
-
const context =
|
|
552
|
+
const context = range(begin, end + 1).map((lineNumber) => {
|
|
565
553
|
const rowIndicator = lineNumber === line ? ">> " : " ";
|
|
566
554
|
const num = padStart(String(lineNumber), String(end).length);
|
|
567
555
|
let text = `${rowIndicator}${num}| `;
|
|
@@ -1139,8 +1127,8 @@ var require_liquid_node = __commonJS({
|
|
|
1139
1127
|
valid() {
|
|
1140
1128
|
return !isNaN(this.getTime());
|
|
1141
1129
|
}
|
|
1142
|
-
format(
|
|
1143
|
-
return this.DateTimeFormat && this.DateTimeFormat(this.locale,
|
|
1130
|
+
format(options) {
|
|
1131
|
+
return this.DateTimeFormat && this.DateTimeFormat(this.locale, options).format(this.displayDate);
|
|
1144
1132
|
}
|
|
1145
1133
|
/**
|
|
1146
1134
|
* Create a Date object fixed to it's declared Timezone. Both
|
|
@@ -1224,11 +1212,11 @@ var require_liquid_node = __commonJS({
|
|
|
1224
1212
|
static {
|
|
1225
1213
|
__name(this, "TagToken");
|
|
1226
1214
|
}
|
|
1227
|
-
constructor(input, begin, end,
|
|
1228
|
-
const { trimTagLeft, trimTagRight, tagDelimiterLeft, tagDelimiterRight } =
|
|
1215
|
+
constructor(input, begin, end, options, file2) {
|
|
1216
|
+
const { trimTagLeft, trimTagRight, tagDelimiterLeft, tagDelimiterRight } = options;
|
|
1229
1217
|
const [valueBegin, valueEnd] = [begin + tagDelimiterLeft.length, end - tagDelimiterRight.length];
|
|
1230
1218
|
super(exports.TokenKind.Tag, [valueBegin, valueEnd], input, begin, end, trimTagLeft, trimTagRight, file2);
|
|
1231
|
-
this.tokenizer = new Tokenizer(input,
|
|
1219
|
+
this.tokenizer = new Tokenizer(input, options.operators, file2, this.contentRange, options.groupedExpressions);
|
|
1232
1220
|
this.name = this.tokenizer.readTagName();
|
|
1233
1221
|
this.tokenizer.assert(this.name, `illegal tag syntax, tag name expected`);
|
|
1234
1222
|
this.tokenizer.skipBlank();
|
|
@@ -1239,8 +1227,8 @@ var require_liquid_node = __commonJS({
|
|
|
1239
1227
|
static {
|
|
1240
1228
|
__name(this, "OutputToken");
|
|
1241
1229
|
}
|
|
1242
|
-
constructor(input, begin, end,
|
|
1243
|
-
const { trimOutputLeft, trimOutputRight, outputDelimiterLeft, outputDelimiterRight } =
|
|
1230
|
+
constructor(input, begin, end, options, file2) {
|
|
1231
|
+
const { trimOutputLeft, trimOutputRight, outputDelimiterLeft, outputDelimiterRight } = options;
|
|
1244
1232
|
const valueRange = [begin + outputDelimiterLeft.length, end - outputDelimiterRight.length];
|
|
1245
1233
|
super(exports.TokenKind.Output, valueRange, input, begin, end, trimOutputLeft, trimOutputRight, file2);
|
|
1246
1234
|
}
|
|
@@ -1459,9 +1447,9 @@ var require_liquid_node = __commonJS({
|
|
|
1459
1447
|
static {
|
|
1460
1448
|
__name(this, "LiquidTagToken");
|
|
1461
1449
|
}
|
|
1462
|
-
constructor(input, begin, end,
|
|
1450
|
+
constructor(input, begin, end, options, file2) {
|
|
1463
1451
|
super(exports.TokenKind.Tag, [begin, end], input, begin, end, false, false, file2);
|
|
1464
|
-
this.tokenizer = new Tokenizer(input,
|
|
1452
|
+
this.tokenizer = new Tokenizer(input, options.operators, file2, this.contentRange, options.groupedExpressions);
|
|
1465
1453
|
this.name = this.tokenizer.readTagName();
|
|
1466
1454
|
this.tokenizer.assert(this.name, "illegal liquid tag syntax");
|
|
1467
1455
|
this.tokenizer.skipBlank();
|
|
@@ -1535,11 +1523,11 @@ var require_liquid_node = __commonJS({
|
|
|
1535
1523
|
static {
|
|
1536
1524
|
__name(this, "Filter");
|
|
1537
1525
|
}
|
|
1538
|
-
constructor(token,
|
|
1526
|
+
constructor(token, options, liquid) {
|
|
1539
1527
|
this.token = token;
|
|
1540
1528
|
this.name = token.name;
|
|
1541
|
-
this.handler = isFunction(
|
|
1542
|
-
this.raw = !isFunction(
|
|
1529
|
+
this.handler = isFunction(options) ? options : isFunction(options?.handler) ? options.handler : identify;
|
|
1530
|
+
this.raw = !isFunction(options) && !!options?.raw;
|
|
1543
1531
|
this.args = token.args;
|
|
1544
1532
|
this.liquid = liquid;
|
|
1545
1533
|
}
|
|
@@ -1642,7 +1630,7 @@ var require_liquid_node = __commonJS({
|
|
|
1642
1630
|
const low = yield evalTokenValue(token.lhs, ctx);
|
|
1643
1631
|
const high = yield evalTokenValue(token.rhs, ctx);
|
|
1644
1632
|
ctx.memoryLimit.use(high - low + 1);
|
|
1645
|
-
return
|
|
1633
|
+
return range(+low, +high + 1);
|
|
1646
1634
|
}
|
|
1647
1635
|
__name(evalRangeToken, "evalRangeToken");
|
|
1648
1636
|
function* toPostfix(tokens) {
|
|
@@ -1836,7 +1824,7 @@ var require_liquid_node = __commonJS({
|
|
|
1836
1824
|
return readFileAsync(filepath, "utf8");
|
|
1837
1825
|
}
|
|
1838
1826
|
__name(readFile, "readFile");
|
|
1839
|
-
function
|
|
1827
|
+
function existsSync11(filepath) {
|
|
1840
1828
|
try {
|
|
1841
1829
|
fs$1.statSync(filepath);
|
|
1842
1830
|
return true;
|
|
@@ -1844,11 +1832,11 @@ var require_liquid_node = __commonJS({
|
|
|
1844
1832
|
return false;
|
|
1845
1833
|
}
|
|
1846
1834
|
}
|
|
1847
|
-
__name(
|
|
1848
|
-
function
|
|
1835
|
+
__name(existsSync11, "existsSync");
|
|
1836
|
+
function readFileSync6(filepath) {
|
|
1849
1837
|
return fs$1.readFileSync(filepath, "utf8");
|
|
1850
1838
|
}
|
|
1851
|
-
__name(
|
|
1839
|
+
__name(readFileSync6, "readFileSync");
|
|
1852
1840
|
function resolve2(root, file2, ext) {
|
|
1853
1841
|
if (!path.extname(file2))
|
|
1854
1842
|
file2 += ext;
|
|
@@ -1862,10 +1850,10 @@ var require_liquid_node = __commonJS({
|
|
|
1862
1850
|
}
|
|
1863
1851
|
}
|
|
1864
1852
|
__name(fallback, "fallback");
|
|
1865
|
-
function
|
|
1853
|
+
function dirname4(filepath) {
|
|
1866
1854
|
return path.dirname(filepath);
|
|
1867
1855
|
}
|
|
1868
|
-
__name(
|
|
1856
|
+
__name(dirname4, "dirname");
|
|
1869
1857
|
var realpathAsync = promisify(fs$1.realpath);
|
|
1870
1858
|
async function contains(root, file2) {
|
|
1871
1859
|
try {
|
|
@@ -1893,11 +1881,11 @@ var require_liquid_node = __commonJS({
|
|
|
1893
1881
|
__proto__: null,
|
|
1894
1882
|
exists,
|
|
1895
1883
|
readFile,
|
|
1896
|
-
existsSync:
|
|
1897
|
-
readFileSync:
|
|
1884
|
+
existsSync: existsSync11,
|
|
1885
|
+
readFileSync: readFileSync6,
|
|
1898
1886
|
resolve: resolve2,
|
|
1899
1887
|
fallback,
|
|
1900
|
-
dirname:
|
|
1888
|
+
dirname: dirname4,
|
|
1901
1889
|
contains,
|
|
1902
1890
|
containsSync,
|
|
1903
1891
|
sep: path.sep
|
|
@@ -2123,41 +2111,41 @@ var require_liquid_node = __commonJS({
|
|
|
2123
2111
|
parseLimit: Infinity,
|
|
2124
2112
|
renderLimit: Infinity
|
|
2125
2113
|
};
|
|
2126
|
-
function normalize(
|
|
2127
|
-
if (
|
|
2128
|
-
if (!
|
|
2129
|
-
|
|
2130
|
-
if (!
|
|
2131
|
-
|
|
2132
|
-
}
|
|
2133
|
-
if (
|
|
2114
|
+
function normalize(options) {
|
|
2115
|
+
if (options.hasOwnProperty("root")) {
|
|
2116
|
+
if (!options.hasOwnProperty("partials"))
|
|
2117
|
+
options.partials = options.root;
|
|
2118
|
+
if (!options.hasOwnProperty("layouts"))
|
|
2119
|
+
options.layouts = options.root;
|
|
2120
|
+
}
|
|
2121
|
+
if (options.hasOwnProperty("cache")) {
|
|
2134
2122
|
let cache;
|
|
2135
|
-
if (typeof
|
|
2136
|
-
cache =
|
|
2137
|
-
else if (typeof
|
|
2138
|
-
cache =
|
|
2123
|
+
if (typeof options.cache === "number")
|
|
2124
|
+
cache = options.cache > 0 ? new LRU(options.cache) : void 0;
|
|
2125
|
+
else if (typeof options.cache === "object")
|
|
2126
|
+
cache = options.cache;
|
|
2139
2127
|
else
|
|
2140
|
-
cache =
|
|
2141
|
-
|
|
2128
|
+
cache = options.cache ? new LRU(1024) : void 0;
|
|
2129
|
+
options.cache = cache;
|
|
2142
2130
|
}
|
|
2143
|
-
|
|
2144
|
-
if ((!
|
|
2131
|
+
options = { ...defaultOptions, ...options.jekyllInclude ? { dynamicPartials: false } : {}, ...options };
|
|
2132
|
+
if ((!options.fs.dirname || !options.fs.sep) && options.relativeReference) {
|
|
2145
2133
|
console.warn("[LiquidJS] `fs.dirname` and `fs.sep` are required for relativeReference, set relativeReference to `false` to suppress this warning");
|
|
2146
|
-
|
|
2134
|
+
options.relativeReference = false;
|
|
2147
2135
|
}
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
if (!
|
|
2153
|
-
|
|
2136
|
+
options.root = normalizeDirectoryList(options.root);
|
|
2137
|
+
options.partials = normalizeDirectoryList(options.partials);
|
|
2138
|
+
options.layouts = normalizeDirectoryList(options.layouts);
|
|
2139
|
+
options.outputEscape = options.outputEscape && getOutputEscapeFunction(options.outputEscape);
|
|
2140
|
+
if (!options.locale) {
|
|
2141
|
+
options.locale = getDateTimeFormat()?.().resolvedOptions().locale ?? "en-US";
|
|
2154
2142
|
}
|
|
2155
|
-
if (
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2143
|
+
if (options.templates) {
|
|
2144
|
+
options.fs = new MapFS(options.templates);
|
|
2145
|
+
options.relativeReference = true;
|
|
2146
|
+
options.root = options.partials = options.layouts = ".";
|
|
2159
2147
|
}
|
|
2160
|
-
return
|
|
2148
|
+
return options;
|
|
2161
2149
|
}
|
|
2162
2150
|
__name(normalize, "normalize");
|
|
2163
2151
|
function getOutputEscapeFunction(nameOrFunction) {
|
|
@@ -2178,14 +2166,14 @@ var require_liquid_node = __commonJS({
|
|
|
2178
2166
|
return list;
|
|
2179
2167
|
}
|
|
2180
2168
|
__name(normalizeDirectoryList, "normalizeDirectoryList");
|
|
2181
|
-
function whiteSpaceCtrl(tokens,
|
|
2169
|
+
function whiteSpaceCtrl(tokens, options) {
|
|
2182
2170
|
let inRaw = false;
|
|
2183
2171
|
for (let i = 0; i < tokens.length; i++) {
|
|
2184
2172
|
const token = tokens[i];
|
|
2185
2173
|
if (!isDelimitedToken(token))
|
|
2186
2174
|
continue;
|
|
2187
2175
|
if (!inRaw && token.trimLeft) {
|
|
2188
|
-
trimLeft(tokens[i - 1],
|
|
2176
|
+
trimLeft(tokens[i - 1], options.greedy);
|
|
2189
2177
|
}
|
|
2190
2178
|
if (isTagToken(token)) {
|
|
2191
2179
|
if (token.name === "raw")
|
|
@@ -2194,7 +2182,7 @@ var require_liquid_node = __commonJS({
|
|
|
2194
2182
|
inRaw = false;
|
|
2195
2183
|
}
|
|
2196
2184
|
if (!inRaw && token.trimRight) {
|
|
2197
|
-
trimRight(tokens[i + 1],
|
|
2185
|
+
trimRight(tokens[i + 1], options.greedy);
|
|
2198
2186
|
}
|
|
2199
2187
|
}
|
|
2200
2188
|
}
|
|
@@ -2221,12 +2209,12 @@ var require_liquid_node = __commonJS({
|
|
|
2221
2209
|
static {
|
|
2222
2210
|
__name(this, "Tokenizer");
|
|
2223
2211
|
}
|
|
2224
|
-
constructor(input, operators = defaultOptions.operators, file2,
|
|
2212
|
+
constructor(input, operators = defaultOptions.operators, file2, range2, groupedExpressions = false) {
|
|
2225
2213
|
this.input = input;
|
|
2226
2214
|
this.file = file2;
|
|
2227
2215
|
this.rawBeginAt = -1;
|
|
2228
|
-
this.p =
|
|
2229
|
-
this.N =
|
|
2216
|
+
this.p = range2 ? range2[0] : 0;
|
|
2217
|
+
this.N = range2 ? range2[1] : input.length;
|
|
2230
2218
|
this.opTrie = createTrie(operators);
|
|
2231
2219
|
this.literalTrie = createTrie(literalValues);
|
|
2232
2220
|
this.groupedExpressions = groupedExpressions;
|
|
@@ -2326,23 +2314,23 @@ var require_liquid_node = __commonJS({
|
|
|
2326
2314
|
const value = this.readValue();
|
|
2327
2315
|
return [key.getText(), value];
|
|
2328
2316
|
}
|
|
2329
|
-
readTopLevelTokens(
|
|
2317
|
+
readTopLevelTokens(options = defaultOptions) {
|
|
2330
2318
|
const tokens = [];
|
|
2331
2319
|
while (this.p < this.N) {
|
|
2332
|
-
const token = this.readTopLevelToken(
|
|
2320
|
+
const token = this.readTopLevelToken(options);
|
|
2333
2321
|
tokens.push(token);
|
|
2334
2322
|
}
|
|
2335
|
-
whiteSpaceCtrl(tokens,
|
|
2323
|
+
whiteSpaceCtrl(tokens, options);
|
|
2336
2324
|
return tokens;
|
|
2337
2325
|
}
|
|
2338
|
-
readTopLevelToken(
|
|
2339
|
-
const { tagDelimiterLeft, outputDelimiterLeft } =
|
|
2326
|
+
readTopLevelToken(options) {
|
|
2327
|
+
const { tagDelimiterLeft, outputDelimiterLeft } = options;
|
|
2340
2328
|
if (this.rawBeginAt > -1)
|
|
2341
|
-
return this.readEndrawOrRawContent(
|
|
2329
|
+
return this.readEndrawOrRawContent(options);
|
|
2342
2330
|
if (this.match(tagDelimiterLeft))
|
|
2343
|
-
return this.readTagToken(
|
|
2331
|
+
return this.readTagToken(options);
|
|
2344
2332
|
if (this.match(outputDelimiterLeft))
|
|
2345
|
-
return this.readOutputToken(
|
|
2333
|
+
return this.readOutputToken(options);
|
|
2346
2334
|
return this.readHTMLToken([tagDelimiterLeft, outputDelimiterLeft]);
|
|
2347
2335
|
}
|
|
2348
2336
|
readHTMLToken(stopStrings) {
|
|
@@ -2354,13 +2342,13 @@ var require_liquid_node = __commonJS({
|
|
|
2354
2342
|
}
|
|
2355
2343
|
return new HTMLToken(this.input, begin, this.p, this.file);
|
|
2356
2344
|
}
|
|
2357
|
-
readTagToken(
|
|
2345
|
+
readTagToken(options) {
|
|
2358
2346
|
const { file: file2, input } = this;
|
|
2359
2347
|
const begin = this.p;
|
|
2360
|
-
if (this.readToDelimiter(
|
|
2348
|
+
if (this.readToDelimiter(options.tagDelimiterRight) === -1) {
|
|
2361
2349
|
throw this.error(`tag ${this.snapshot(begin)} not closed`, begin);
|
|
2362
2350
|
}
|
|
2363
|
-
const token = new TagToken(input, begin, this.p,
|
|
2351
|
+
const token = new TagToken(input, begin, this.p, options, file2);
|
|
2364
2352
|
if (token.name === "raw")
|
|
2365
2353
|
this.rawBeginAt = begin;
|
|
2366
2354
|
return token;
|
|
@@ -2378,17 +2366,17 @@ var require_liquid_node = __commonJS({
|
|
|
2378
2366
|
}
|
|
2379
2367
|
return -1;
|
|
2380
2368
|
}
|
|
2381
|
-
readOutputToken(
|
|
2369
|
+
readOutputToken(options = defaultOptions) {
|
|
2382
2370
|
const { file: file2, input } = this;
|
|
2383
|
-
const { outputDelimiterRight } =
|
|
2371
|
+
const { outputDelimiterRight } = options;
|
|
2384
2372
|
const begin = this.p;
|
|
2385
2373
|
if (this.readToDelimiter(outputDelimiterRight, true) === -1) {
|
|
2386
2374
|
throw this.error(`output ${this.snapshot(begin)} not closed`, begin);
|
|
2387
2375
|
}
|
|
2388
|
-
return new OutputToken(input, begin, this.p,
|
|
2376
|
+
return new OutputToken(input, begin, this.p, options, file2);
|
|
2389
2377
|
}
|
|
2390
|
-
readEndrawOrRawContent(
|
|
2391
|
-
const { tagDelimiterLeft, tagDelimiterRight } =
|
|
2378
|
+
readEndrawOrRawContent(options) {
|
|
2379
|
+
const { tagDelimiterLeft, tagDelimiterRight } = options;
|
|
2392
2380
|
const begin = this.p;
|
|
2393
2381
|
let leftPos = this.readTo(tagDelimiterLeft) - tagDelimiterLeft.length;
|
|
2394
2382
|
while (this.p < this.N) {
|
|
@@ -2401,7 +2389,7 @@ var require_liquid_node = __commonJS({
|
|
|
2401
2389
|
const end = this.p;
|
|
2402
2390
|
if (begin === leftPos) {
|
|
2403
2391
|
this.rawBeginAt = -1;
|
|
2404
|
-
return new TagToken(this.input, begin, end,
|
|
2392
|
+
return new TagToken(this.input, begin, end, options, this.file);
|
|
2405
2393
|
} else {
|
|
2406
2394
|
this.p = leftPos;
|
|
2407
2395
|
return new HTMLToken(this.input, begin, leftPos, this.file);
|
|
@@ -2414,22 +2402,22 @@ var require_liquid_node = __commonJS({
|
|
|
2414
2402
|
}
|
|
2415
2403
|
throw this.error(`raw ${this.snapshot(this.rawBeginAt)} not closed`, begin);
|
|
2416
2404
|
}
|
|
2417
|
-
readLiquidTagTokens(
|
|
2405
|
+
readLiquidTagTokens(options = defaultOptions) {
|
|
2418
2406
|
const tokens = [];
|
|
2419
2407
|
while (this.p < this.N) {
|
|
2420
|
-
const token = this.readLiquidTagToken(
|
|
2408
|
+
const token = this.readLiquidTagToken(options);
|
|
2421
2409
|
token && tokens.push(token);
|
|
2422
2410
|
}
|
|
2423
2411
|
return tokens;
|
|
2424
2412
|
}
|
|
2425
|
-
readLiquidTagToken(
|
|
2413
|
+
readLiquidTagToken(options) {
|
|
2426
2414
|
this.skipBlank();
|
|
2427
2415
|
if (this.end())
|
|
2428
2416
|
return;
|
|
2429
2417
|
const begin = this.p;
|
|
2430
2418
|
this.readToDelimiter("\n");
|
|
2431
2419
|
const end = this.p;
|
|
2432
|
-
return new LiquidTagToken(this.input, begin, end,
|
|
2420
|
+
return new LiquidTagToken(this.input, begin, end, options, this.file);
|
|
2433
2421
|
}
|
|
2434
2422
|
error(msg, pos = this.p) {
|
|
2435
2423
|
return new TokenizationError(msg, new IdentifierToken(this.input, pos, this.N, this.file));
|
|
@@ -2641,12 +2629,12 @@ var require_liquid_node = __commonJS({
|
|
|
2641
2629
|
}
|
|
2642
2630
|
return new QuotedToken(this.input, begin, this.p, this.file);
|
|
2643
2631
|
}
|
|
2644
|
-
*readFileNameTemplate(
|
|
2645
|
-
const { outputDelimiterLeft } =
|
|
2632
|
+
*readFileNameTemplate(options) {
|
|
2633
|
+
const { outputDelimiterLeft } = options;
|
|
2646
2634
|
const htmlStopStrings = [",", " ", "\r", "\n", " ", outputDelimiterLeft];
|
|
2647
2635
|
const htmlStopStringSet = new Set(htmlStopStrings);
|
|
2648
2636
|
while (this.p < this.N && !htmlStopStringSet.has(this.peek())) {
|
|
2649
|
-
yield this.match(outputDelimiterLeft) ? this.readOutputToken(
|
|
2637
|
+
yield this.match(outputDelimiterLeft) ? this.readOutputToken(options) : this.readHTMLToken(htmlStopStrings);
|
|
2650
2638
|
}
|
|
2651
2639
|
}
|
|
2652
2640
|
match(word) {
|
|
@@ -2721,7 +2709,7 @@ var require_liquid_node = __commonJS({
|
|
|
2721
2709
|
this.token = token;
|
|
2722
2710
|
}
|
|
2723
2711
|
};
|
|
2724
|
-
var
|
|
2712
|
+
var Tag3 = class extends TemplateImpl {
|
|
2725
2713
|
static {
|
|
2726
2714
|
__name(this, "Tag");
|
|
2727
2715
|
}
|
|
@@ -2751,17 +2739,17 @@ var require_liquid_node = __commonJS({
|
|
|
2751
2739
|
return hash;
|
|
2752
2740
|
}
|
|
2753
2741
|
};
|
|
2754
|
-
function createTagClass(
|
|
2755
|
-
return class extends
|
|
2742
|
+
function createTagClass(options) {
|
|
2743
|
+
return class extends Tag3 {
|
|
2756
2744
|
constructor(token, tokens, liquid) {
|
|
2757
2745
|
super(token, tokens, liquid);
|
|
2758
|
-
if (isFunction(
|
|
2759
|
-
|
|
2746
|
+
if (isFunction(options.parse)) {
|
|
2747
|
+
options.parse.call(this, token, tokens);
|
|
2760
2748
|
}
|
|
2761
2749
|
}
|
|
2762
2750
|
*render(ctx, emitter) {
|
|
2763
2751
|
const hash = yield new Hash(this.token.args, ctx.opts.keyValueSeparator).render(ctx);
|
|
2764
|
-
return yield
|
|
2752
|
+
return yield options.render.call(this, ctx, emitter, hash);
|
|
2765
2753
|
}
|
|
2766
2754
|
};
|
|
2767
2755
|
}
|
|
@@ -2978,13 +2966,13 @@ var require_liquid_node = __commonJS({
|
|
|
2978
2966
|
};
|
|
2979
2967
|
}
|
|
2980
2968
|
__name(_analyze, "_analyze");
|
|
2981
|
-
function analyze(template2,
|
|
2982
|
-
const opts = { ...defaultStaticAnalysisOptions, ...
|
|
2969
|
+
function analyze(template2, options = {}) {
|
|
2970
|
+
const opts = { ...defaultStaticAnalysisOptions, ...options };
|
|
2983
2971
|
return toPromise(_analyze(template2, opts.partials, false));
|
|
2984
2972
|
}
|
|
2985
2973
|
__name(analyze, "analyze");
|
|
2986
|
-
function analyzeSync(template2,
|
|
2987
|
-
const opts = { ...defaultStaticAnalysisOptions, ...
|
|
2974
|
+
function analyzeSync(template2, options = {}) {
|
|
2975
|
+
const opts = { ...defaultStaticAnalysisOptions, ...options };
|
|
2988
2976
|
return toValueSync(_analyze(template2, opts.partials, true));
|
|
2989
2977
|
}
|
|
2990
2978
|
__name(analyzeSync, "analyzeSync");
|
|
@@ -3160,17 +3148,17 @@ var require_liquid_node = __commonJS({
|
|
|
3160
3148
|
static {
|
|
3161
3149
|
__name(this, "Loader");
|
|
3162
3150
|
}
|
|
3163
|
-
constructor(
|
|
3164
|
-
this.options =
|
|
3165
|
-
if (
|
|
3166
|
-
const sep =
|
|
3151
|
+
constructor(options) {
|
|
3152
|
+
this.options = options;
|
|
3153
|
+
if (options.relativeReference) {
|
|
3154
|
+
const sep = options.fs.sep;
|
|
3167
3155
|
assert(sep, "`fs.sep` is required for relative reference");
|
|
3168
3156
|
const prefixes = ["." + sep, ".." + sep, "./", "../"];
|
|
3169
3157
|
this.shouldLoadRelative = (referencedFile) => prefixes.some((prefix) => referencedFile.startsWith(prefix));
|
|
3170
3158
|
} else {
|
|
3171
3159
|
this.shouldLoadRelative = (_referencedFile) => false;
|
|
3172
3160
|
}
|
|
3173
|
-
const fs2 =
|
|
3161
|
+
const fs2 = options.fs;
|
|
3174
3162
|
this.contains = toLiquidAsync(fs2.contains?.bind(fs2) || (async () => true), fs2.containsSync?.bind(fs2) || (() => true));
|
|
3175
3163
|
this.exists = toLiquidAsync(fs2.exists?.bind(fs2) || (async () => false), fs2.existsSync?.bind(fs2));
|
|
3176
3164
|
}
|
|
@@ -3622,7 +3610,7 @@ var require_liquid_node = __commonJS({
|
|
|
3622
3610
|
uri_escape,
|
|
3623
3611
|
slugify
|
|
3624
3612
|
});
|
|
3625
|
-
var
|
|
3613
|
+
var join6 = argumentsToValue(function(v, arg) {
|
|
3626
3614
|
const array2 = toArray(v);
|
|
3627
3615
|
const sep = isNil(arg) ? " " : stringify(arg);
|
|
3628
3616
|
let outputSize = sep.length * Math.max(array2.length - 1, 0);
|
|
@@ -3898,7 +3886,7 @@ var require_liquid_node = __commonJS({
|
|
|
3898
3886
|
__name(sample, "sample");
|
|
3899
3887
|
var arrayFilters = /* @__PURE__ */ Object.freeze({
|
|
3900
3888
|
__proto__: null,
|
|
3901
|
-
join:
|
|
3889
|
+
join: join6,
|
|
3902
3890
|
last,
|
|
3903
3891
|
first,
|
|
3904
3892
|
reverse,
|
|
@@ -4320,7 +4308,7 @@ var require_liquid_node = __commonJS({
|
|
|
4320
4308
|
...cryptoFilters,
|
|
4321
4309
|
...misc
|
|
4322
4310
|
};
|
|
4323
|
-
var AssignTag = class extends
|
|
4311
|
+
var AssignTag = class extends Tag3 {
|
|
4324
4312
|
static {
|
|
4325
4313
|
__name(this, "AssignTag");
|
|
4326
4314
|
}
|
|
@@ -4345,7 +4333,7 @@ var require_liquid_node = __commonJS({
|
|
|
4345
4333
|
}
|
|
4346
4334
|
};
|
|
4347
4335
|
var MODIFIERS = ["offset", "limit", "reversed"];
|
|
4348
|
-
var ForTag = class extends
|
|
4336
|
+
var ForTag = class extends Tag3 {
|
|
4349
4337
|
static {
|
|
4350
4338
|
__name(this, "ForTag");
|
|
4351
4339
|
}
|
|
@@ -4438,7 +4426,7 @@ var require_liquid_node = __commonJS({
|
|
|
4438
4426
|
return arr.slice(0, count3);
|
|
4439
4427
|
}
|
|
4440
4428
|
__name(limit2, "limit");
|
|
4441
|
-
var CaptureTag = class extends
|
|
4429
|
+
var CaptureTag = class extends Tag3 {
|
|
4442
4430
|
static {
|
|
4443
4431
|
__name(this, "CaptureTag");
|
|
4444
4432
|
}
|
|
@@ -4476,7 +4464,7 @@ var require_liquid_node = __commonJS({
|
|
|
4476
4464
|
yield this.identifier;
|
|
4477
4465
|
}
|
|
4478
4466
|
};
|
|
4479
|
-
var CaseTag = class extends
|
|
4467
|
+
var CaseTag = class extends Tag3 {
|
|
4480
4468
|
static {
|
|
4481
4469
|
__name(this, "CaseTag");
|
|
4482
4470
|
}
|
|
@@ -4549,7 +4537,7 @@ var require_liquid_node = __commonJS({
|
|
|
4549
4537
|
return templates;
|
|
4550
4538
|
}
|
|
4551
4539
|
};
|
|
4552
|
-
var CommentTag = class extends
|
|
4540
|
+
var CommentTag = class extends Tag3 {
|
|
4553
4541
|
static {
|
|
4554
4542
|
__name(this, "CommentTag");
|
|
4555
4543
|
}
|
|
@@ -4565,7 +4553,7 @@ var require_liquid_node = __commonJS({
|
|
|
4565
4553
|
render() {
|
|
4566
4554
|
}
|
|
4567
4555
|
};
|
|
4568
|
-
var RenderTag = class extends
|
|
4556
|
+
var RenderTag = class extends Tag3 {
|
|
4569
4557
|
static {
|
|
4570
4558
|
__name(this, "RenderTag");
|
|
4571
4559
|
}
|
|
@@ -4712,7 +4700,7 @@ var require_liquid_node = __commonJS({
|
|
|
4712
4700
|
return yield evalToken(file2, ctx);
|
|
4713
4701
|
}
|
|
4714
4702
|
__name(renderFilePath, "renderFilePath");
|
|
4715
|
-
var IncludeTag = class extends
|
|
4703
|
+
var IncludeTag = class extends Tag3 {
|
|
4716
4704
|
static {
|
|
4717
4705
|
__name(this, "IncludeTag");
|
|
4718
4706
|
}
|
|
@@ -4780,7 +4768,7 @@ var require_liquid_node = __commonJS({
|
|
|
4780
4768
|
}
|
|
4781
4769
|
}
|
|
4782
4770
|
};
|
|
4783
|
-
var DecrementTag = class extends
|
|
4771
|
+
var DecrementTag = class extends Tag3 {
|
|
4784
4772
|
static {
|
|
4785
4773
|
__name(this, "DecrementTag");
|
|
4786
4774
|
}
|
|
@@ -4800,7 +4788,7 @@ var require_liquid_node = __commonJS({
|
|
|
4800
4788
|
yield this.identifier;
|
|
4801
4789
|
}
|
|
4802
4790
|
};
|
|
4803
|
-
var CycleTag = class extends
|
|
4791
|
+
var CycleTag = class extends Tag3 {
|
|
4804
4792
|
static {
|
|
4805
4793
|
__name(this, "CycleTag");
|
|
4806
4794
|
}
|
|
@@ -4844,7 +4832,7 @@ var require_liquid_node = __commonJS({
|
|
|
4844
4832
|
}
|
|
4845
4833
|
}
|
|
4846
4834
|
};
|
|
4847
|
-
var IfTag = class extends
|
|
4835
|
+
var IfTag = class extends Tag3 {
|
|
4848
4836
|
static {
|
|
4849
4837
|
__name(this, "IfTag");
|
|
4850
4838
|
}
|
|
@@ -4894,7 +4882,7 @@ var require_liquid_node = __commonJS({
|
|
|
4894
4882
|
return this.branches.map((b) => b.value);
|
|
4895
4883
|
}
|
|
4896
4884
|
};
|
|
4897
|
-
var IncrementTag = class extends
|
|
4885
|
+
var IncrementTag = class extends Tag3 {
|
|
4898
4886
|
static {
|
|
4899
4887
|
__name(this, "IncrementTag");
|
|
4900
4888
|
}
|
|
@@ -4916,7 +4904,7 @@ var require_liquid_node = __commonJS({
|
|
|
4916
4904
|
yield this.identifier;
|
|
4917
4905
|
}
|
|
4918
4906
|
};
|
|
4919
|
-
var LayoutTag = class extends
|
|
4907
|
+
var LayoutTag = class extends Tag3 {
|
|
4920
4908
|
static {
|
|
4921
4909
|
__name(this, "LayoutTag");
|
|
4922
4910
|
}
|
|
@@ -4971,7 +4959,7 @@ var require_liquid_node = __commonJS({
|
|
|
4971
4959
|
}
|
|
4972
4960
|
}
|
|
4973
4961
|
};
|
|
4974
|
-
var BlockTag = class extends
|
|
4962
|
+
var BlockTag = class extends Tag3 {
|
|
4975
4963
|
static {
|
|
4976
4964
|
__name(this, "BlockTag");
|
|
4977
4965
|
}
|
|
@@ -5020,7 +5008,7 @@ var require_liquid_node = __commonJS({
|
|
|
5020
5008
|
return ["block"];
|
|
5021
5009
|
}
|
|
5022
5010
|
};
|
|
5023
|
-
var RawTag = class extends
|
|
5011
|
+
var RawTag = class extends Tag3 {
|
|
5024
5012
|
static {
|
|
5025
5013
|
__name(this, "RawTag");
|
|
5026
5014
|
}
|
|
@@ -5064,7 +5052,7 @@ var require_liquid_node = __commonJS({
|
|
|
5064
5052
|
return this.col() === this.cols;
|
|
5065
5053
|
}
|
|
5066
5054
|
};
|
|
5067
|
-
var TablerowTag = class extends
|
|
5055
|
+
var TablerowTag = class extends Tag3 {
|
|
5068
5056
|
static {
|
|
5069
5057
|
__name(this, "TablerowTag");
|
|
5070
5058
|
}
|
|
@@ -5128,7 +5116,7 @@ var require_liquid_node = __commonJS({
|
|
|
5128
5116
|
return [this.variable, "tablerowloop"];
|
|
5129
5117
|
}
|
|
5130
5118
|
};
|
|
5131
|
-
var UnlessTag = class extends
|
|
5119
|
+
var UnlessTag = class extends Tag3 {
|
|
5132
5120
|
static {
|
|
5133
5121
|
__name(this, "UnlessTag");
|
|
5134
5122
|
}
|
|
@@ -5187,7 +5175,7 @@ var require_liquid_node = __commonJS({
|
|
|
5187
5175
|
return this.branches.map((b) => b.value);
|
|
5188
5176
|
}
|
|
5189
5177
|
};
|
|
5190
|
-
var BreakTag = class extends
|
|
5178
|
+
var BreakTag = class extends Tag3 {
|
|
5191
5179
|
static {
|
|
5192
5180
|
__name(this, "BreakTag");
|
|
5193
5181
|
}
|
|
@@ -5195,7 +5183,7 @@ var require_liquid_node = __commonJS({
|
|
|
5195
5183
|
ctx.breakCalled = true;
|
|
5196
5184
|
}
|
|
5197
5185
|
};
|
|
5198
|
-
var ContinueTag = class extends
|
|
5186
|
+
var ContinueTag = class extends Tag3 {
|
|
5199
5187
|
static {
|
|
5200
5188
|
__name(this, "ContinueTag");
|
|
5201
5189
|
}
|
|
@@ -5203,7 +5191,7 @@ var require_liquid_node = __commonJS({
|
|
|
5203
5191
|
ctx.continueCalled = true;
|
|
5204
5192
|
}
|
|
5205
5193
|
};
|
|
5206
|
-
var EchoTag = class extends
|
|
5194
|
+
var EchoTag = class extends Tag3 {
|
|
5207
5195
|
static {
|
|
5208
5196
|
__name(this, "EchoTag");
|
|
5209
5197
|
}
|
|
@@ -5226,7 +5214,7 @@ var require_liquid_node = __commonJS({
|
|
|
5226
5214
|
}
|
|
5227
5215
|
}
|
|
5228
5216
|
};
|
|
5229
|
-
var LiquidTag = class extends
|
|
5217
|
+
var LiquidTag = class extends Tag3 {
|
|
5230
5218
|
static {
|
|
5231
5219
|
__name(this, "LiquidTag");
|
|
5232
5220
|
}
|
|
@@ -5242,7 +5230,7 @@ var require_liquid_node = __commonJS({
|
|
|
5242
5230
|
return this.templates;
|
|
5243
5231
|
}
|
|
5244
5232
|
};
|
|
5245
|
-
var InlineCommentTag = class extends
|
|
5233
|
+
var InlineCommentTag = class extends Tag3 {
|
|
5246
5234
|
static {
|
|
5247
5235
|
__name(this, "InlineCommentTag");
|
|
5248
5236
|
}
|
|
@@ -5385,76 +5373,76 @@ var require_liquid_node = __commonJS({
|
|
|
5385
5373
|
self.renderFile(filePath, ctx).then((html) => callback(null, html), callback);
|
|
5386
5374
|
};
|
|
5387
5375
|
}
|
|
5388
|
-
async analyze(template2,
|
|
5389
|
-
return analyze(template2,
|
|
5376
|
+
async analyze(template2, options = {}) {
|
|
5377
|
+
return analyze(template2, options);
|
|
5390
5378
|
}
|
|
5391
|
-
analyzeSync(template2,
|
|
5392
|
-
return analyzeSync(template2,
|
|
5379
|
+
analyzeSync(template2, options = {}) {
|
|
5380
|
+
return analyzeSync(template2, options);
|
|
5393
5381
|
}
|
|
5394
|
-
async parseAndAnalyze(html, filename,
|
|
5395
|
-
return analyze(this.parse(html, filename),
|
|
5382
|
+
async parseAndAnalyze(html, filename, options = {}) {
|
|
5383
|
+
return analyze(this.parse(html, filename), options);
|
|
5396
5384
|
}
|
|
5397
|
-
parseAndAnalyzeSync(html, filename,
|
|
5398
|
-
return analyzeSync(this.parse(html, filename),
|
|
5385
|
+
parseAndAnalyzeSync(html, filename, options = {}) {
|
|
5386
|
+
return analyzeSync(this.parse(html, filename), options);
|
|
5399
5387
|
}
|
|
5400
5388
|
/** Return an array of all variables without their properties. */
|
|
5401
|
-
async variables(template2,
|
|
5402
|
-
const analysis = await analyze(isString(template2) ? this.parse(template2) : template2,
|
|
5389
|
+
async variables(template2, options = {}) {
|
|
5390
|
+
const analysis = await analyze(isString(template2) ? this.parse(template2) : template2, options);
|
|
5403
5391
|
return Object.keys(analysis.variables);
|
|
5404
5392
|
}
|
|
5405
5393
|
/** Return an array of all variables without their properties. */
|
|
5406
|
-
variablesSync(template2,
|
|
5407
|
-
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2,
|
|
5394
|
+
variablesSync(template2, options = {}) {
|
|
5395
|
+
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2, options);
|
|
5408
5396
|
return Object.keys(analysis.variables);
|
|
5409
5397
|
}
|
|
5410
5398
|
/** Return an array of all variables including their properties/paths. */
|
|
5411
|
-
async fullVariables(template2,
|
|
5412
|
-
const analysis = await analyze(isString(template2) ? this.parse(template2) : template2,
|
|
5399
|
+
async fullVariables(template2, options = {}) {
|
|
5400
|
+
const analysis = await analyze(isString(template2) ? this.parse(template2) : template2, options);
|
|
5413
5401
|
return Array.from(new Set(Object.values(analysis.variables).flatMap((a) => a.map((v) => String(v)))));
|
|
5414
5402
|
}
|
|
5415
5403
|
/** Return an array of all variables including their properties/paths. */
|
|
5416
|
-
fullVariablesSync(template2,
|
|
5417
|
-
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2,
|
|
5404
|
+
fullVariablesSync(template2, options = {}) {
|
|
5405
|
+
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2, options);
|
|
5418
5406
|
return Array.from(new Set(Object.values(analysis.variables).flatMap((a) => a.map((v) => String(v)))));
|
|
5419
5407
|
}
|
|
5420
5408
|
/** Return an array of all variables, each as an array of properties/segments. */
|
|
5421
|
-
async variableSegments(template2,
|
|
5422
|
-
const analysis = await analyze(isString(template2) ? this.parse(template2) : template2,
|
|
5409
|
+
async variableSegments(template2, options = {}) {
|
|
5410
|
+
const analysis = await analyze(isString(template2) ? this.parse(template2) : template2, options);
|
|
5423
5411
|
return Array.from(strictUniq(Object.values(analysis.variables).flatMap((a) => a.map((v) => v.toArray()))));
|
|
5424
5412
|
}
|
|
5425
5413
|
/** Return an array of all variables, each as an array of properties/segments. */
|
|
5426
|
-
variableSegmentsSync(template2,
|
|
5427
|
-
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2,
|
|
5414
|
+
variableSegmentsSync(template2, options = {}) {
|
|
5415
|
+
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2, options);
|
|
5428
5416
|
return Array.from(strictUniq(Object.values(analysis.variables).flatMap((a) => a.map((v) => v.toArray()))));
|
|
5429
5417
|
}
|
|
5430
5418
|
/** Return an array of all expected context variables without their properties. */
|
|
5431
|
-
async globalVariables(template2,
|
|
5432
|
-
const analysis = await analyze(isString(template2) ? this.parse(template2) : template2,
|
|
5419
|
+
async globalVariables(template2, options = {}) {
|
|
5420
|
+
const analysis = await analyze(isString(template2) ? this.parse(template2) : template2, options);
|
|
5433
5421
|
return Object.keys(analysis.globals);
|
|
5434
5422
|
}
|
|
5435
5423
|
/** Return an array of all expected context variables without their properties. */
|
|
5436
|
-
globalVariablesSync(template2,
|
|
5437
|
-
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2,
|
|
5424
|
+
globalVariablesSync(template2, options = {}) {
|
|
5425
|
+
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2, options);
|
|
5438
5426
|
return Object.keys(analysis.globals);
|
|
5439
5427
|
}
|
|
5440
5428
|
/** Return an array of all expected context variables including their properties/paths. */
|
|
5441
|
-
async globalFullVariables(template2,
|
|
5442
|
-
const analysis = await analyze(isString(template2) ? this.parse(template2) : template2,
|
|
5429
|
+
async globalFullVariables(template2, options = {}) {
|
|
5430
|
+
const analysis = await analyze(isString(template2) ? this.parse(template2) : template2, options);
|
|
5443
5431
|
return Array.from(new Set(Object.values(analysis.globals).flatMap((a) => a.map((v) => String(v)))));
|
|
5444
5432
|
}
|
|
5445
5433
|
/** Return an array of all expected context variables including their properties/paths. */
|
|
5446
|
-
globalFullVariablesSync(template2,
|
|
5447
|
-
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2,
|
|
5434
|
+
globalFullVariablesSync(template2, options = {}) {
|
|
5435
|
+
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2, options);
|
|
5448
5436
|
return Array.from(new Set(Object.values(analysis.globals).flatMap((a) => a.map((v) => String(v)))));
|
|
5449
5437
|
}
|
|
5450
5438
|
/** Return an array of all expected context variables, each as an array of properties/segments. */
|
|
5451
|
-
async globalVariableSegments(template2,
|
|
5452
|
-
const analysis = await analyze(isString(template2) ? this.parse(template2) : template2,
|
|
5439
|
+
async globalVariableSegments(template2, options = {}) {
|
|
5440
|
+
const analysis = await analyze(isString(template2) ? this.parse(template2) : template2, options);
|
|
5453
5441
|
return Array.from(strictUniq(Object.values(analysis.globals).flatMap((a) => a.map((v) => v.toArray()))));
|
|
5454
5442
|
}
|
|
5455
5443
|
/** Return an array of all expected context variables, each as an array of properties/segments. */
|
|
5456
|
-
globalVariableSegmentsSync(template2,
|
|
5457
|
-
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2,
|
|
5444
|
+
globalVariableSegmentsSync(template2, options = {}) {
|
|
5445
|
+
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2, options);
|
|
5458
5446
|
return Array.from(strictUniq(Object.values(analysis.globals).flatMap((a) => a.map((v) => v.toArray()))));
|
|
5459
5447
|
}
|
|
5460
5448
|
};
|
|
@@ -5492,7 +5480,7 @@ var require_liquid_node = __commonJS({
|
|
|
5492
5480
|
exports.RenderError = RenderError;
|
|
5493
5481
|
exports.RenderTag = RenderTag;
|
|
5494
5482
|
exports.TablerowTag = TablerowTag;
|
|
5495
|
-
exports.Tag =
|
|
5483
|
+
exports.Tag = Tag3;
|
|
5496
5484
|
exports.TagToken = TagToken;
|
|
5497
5485
|
exports.Token = Token;
|
|
5498
5486
|
exports.TokenizationError = TokenizationError;
|
|
@@ -5522,11 +5510,11 @@ var require_liquid_node = __commonJS({
|
|
|
5522
5510
|
}
|
|
5523
5511
|
});
|
|
5524
5512
|
|
|
5525
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5526
|
-
import { chmodSync, constants, copyFileSync, existsSync as
|
|
5527
|
-
import { dirname as
|
|
5513
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
|
|
5514
|
+
import { chmodSync, constants, copyFileSync, existsSync as existsSync10, mkdirSync, realpathSync as realpathSync3, renameSync as renameSync3, rmSync as rmSync3, statfsSync as statfsSync2, statSync as statSync4, writeFileSync as writeFileSync2 } from "node:fs";
|
|
5515
|
+
import { dirname as dirname3, resolve } from "node:path";
|
|
5528
5516
|
|
|
5529
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5517
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/sealed.js
|
|
5530
5518
|
import { createCipheriv, createDecipheriv, createHash, randomBytes, scrypt, timingSafeEqual } from "node:crypto";
|
|
5531
5519
|
import { closeSync, createReadStream, createWriteStream, existsSync, openSync, readSync, renameSync, rmSync, statSync } from "node:fs";
|
|
5532
5520
|
import { Transform } from "node:stream";
|
|
@@ -5633,7 +5621,7 @@ var unsealFile = /* @__PURE__ */ __name(async (from, to, password) => {
|
|
|
5633
5621
|
renameSync(pending, to);
|
|
5634
5622
|
}, "unsealFile");
|
|
5635
5623
|
|
|
5636
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5624
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/store/compatibility.js
|
|
5637
5625
|
var SPEAKS = MIGRATIONS.at(-1)?.version ?? 0;
|
|
5638
5626
|
var fileSchemaOf = /* @__PURE__ */ __name((database) => {
|
|
5639
5627
|
const tracked = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'schema_migrations'").get();
|
|
@@ -5657,7 +5645,7 @@ var compatibilityOf = /* @__PURE__ */ __name((file2, migrations = MIGRATIONS) =>
|
|
|
5657
5645
|
};
|
|
5658
5646
|
}, "compatibilityOf");
|
|
5659
5647
|
|
|
5660
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5648
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/store/repair.js
|
|
5661
5649
|
import { createHash as createHash2 } from "node:crypto";
|
|
5662
5650
|
var COPY_MARK = "__repair_";
|
|
5663
5651
|
var COPY_NAME = /__repair_[0-9a-f]{8}(_\d+)?$/;
|
|
@@ -5911,17 +5899,99 @@ var deleteCopy = /* @__PURE__ */ __name((database, name) => {
|
|
|
5911
5899
|
return found;
|
|
5912
5900
|
}, "deleteCopy");
|
|
5913
5901
|
|
|
5914
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5902
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/cli/store-info.js
|
|
5915
5903
|
import { existsSync as existsSync4, statSync as statSync3 } from "node:fs";
|
|
5916
5904
|
|
|
5917
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5905
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
|
|
5918
5906
|
import { existsSync as existsSync3 } from "node:fs";
|
|
5919
5907
|
|
|
5920
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5908
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/store/recover.js
|
|
5921
5909
|
import { execFileSync, spawn } from "node:child_process";
|
|
5922
5910
|
import { existsSync as existsSync2, readFileSync, realpathSync, renameSync as renameSync2, rmSync as rmSync2, statfsSync, statSync as statSync2, writeFileSync } from "node:fs";
|
|
5923
5911
|
import { basename, dirname, join } from "node:path";
|
|
5924
5912
|
import { Transform as Transform2 } from "node:stream";
|
|
5913
|
+
|
|
5914
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/store/refill.js
|
|
5915
|
+
var REFILL_MARGIN_MS = 864e5;
|
|
5916
|
+
var TIME_KEYS = 1e12;
|
|
5917
|
+
var integerId = `external_id GLOB '[0-9]*' AND NOT external_id GLOB '*[^0-9]*'`;
|
|
5918
|
+
var forgetCoverageSince = /* @__PURE__ */ __name((database, cutoff, now = Date.now()) => {
|
|
5919
|
+
database.exec("BEGIN");
|
|
5920
|
+
try {
|
|
5921
|
+
const refetch = forget(database, cutoff, now);
|
|
5922
|
+
database.exec("COMMIT");
|
|
5923
|
+
return refetch;
|
|
5924
|
+
} catch (error) {
|
|
5925
|
+
database.exec("ROLLBACK");
|
|
5926
|
+
throw error;
|
|
5927
|
+
}
|
|
5928
|
+
}, "forgetCoverageSince");
|
|
5929
|
+
var forget = /* @__PURE__ */ __name((database, cutoff, now) => {
|
|
5930
|
+
const chats = /* @__PURE__ */ new Map();
|
|
5931
|
+
const held = database.prepare(`SELECT c.id, c.account_id, c.external_id AS chat, a.provider, a.external_id AS account,
|
|
5932
|
+
max(r.to_key) AS top FROM sync_ranges r JOIN chats c ON c.id = r.chat_id JOIN accounts a ON a.id = c.account_id
|
|
5933
|
+
GROUP BY c.id`).all();
|
|
5934
|
+
for (const row of held) {
|
|
5935
|
+
const chat = Number(row.id);
|
|
5936
|
+
const top = Number(row.top);
|
|
5937
|
+
const keepTo = cutoff === null ? null : top >= TIME_KEYS ? cutoff : database.prepare(`SELECT max(CAST(external_id AS INTEGER)) AS k FROM messages WHERE chat_id = ? AND sent_at < ? AND ${integerId}`).get(chat, cutoff)?.k;
|
|
5938
|
+
if (keepTo !== null && top <= keepTo)
|
|
5939
|
+
continue;
|
|
5940
|
+
if (keepTo === null)
|
|
5941
|
+
database.prepare("DELETE FROM sync_ranges WHERE chat_id = ?").run(chat);
|
|
5942
|
+
else {
|
|
5943
|
+
database.prepare("DELETE FROM sync_ranges WHERE chat_id = ? AND from_key > ?").run(chat, keepTo);
|
|
5944
|
+
database.prepare("UPDATE sync_ranges SET to_key = ?, updated_at = ? WHERE chat_id = ? AND to_key > ?").run(keepTo, now, chat, keepTo);
|
|
5945
|
+
}
|
|
5946
|
+
const account = Number(row.account_id);
|
|
5947
|
+
const external = String(row.chat);
|
|
5948
|
+
database.prepare("DELETE FROM sync_cursors WHERE account_id = ? AND key = ?").run(account, `fetched:${external}`);
|
|
5949
|
+
database.prepare(`DELETE FROM sync_cursors WHERE account_id = ? AND key = ? AND NOT EXISTS
|
|
5950
|
+
(SELECT 1 FROM sync_ranges WHERE chat_id = ? AND from_key <= CAST(sync_cursors.value AS INTEGER))`).run(account, `history_start:${external}`, chat);
|
|
5951
|
+
const key = `${row.provider}\0${row.account}`;
|
|
5952
|
+
const one = chats.get(key) ?? { provider: String(row.provider), account: String(row.account), chats: 0 };
|
|
5953
|
+
one.chats += 1;
|
|
5954
|
+
chats.set(key, one);
|
|
5955
|
+
}
|
|
5956
|
+
return {
|
|
5957
|
+
since: cutoff === null ? null : new Date(cutoff).toISOString(),
|
|
5958
|
+
chats: [...chats.values()],
|
|
5959
|
+
mail: forgetMail(database, cutoff, now)
|
|
5960
|
+
};
|
|
5961
|
+
}, "forget");
|
|
5962
|
+
var forgetMail = /* @__PURE__ */ __name((database, cutoff, now) => {
|
|
5963
|
+
const folders = /* @__PURE__ */ new Map();
|
|
5964
|
+
const points = database.prepare(`SELECT s.account_id, s.key, s.value, a.external_id AS account FROM sync_cursors s
|
|
5965
|
+
JOIN accounts a ON a.id = s.account_id WHERE a.provider = 'email' AND s.key LIKE 'mail_resume:%'`).all();
|
|
5966
|
+
for (const row of points) {
|
|
5967
|
+
let point;
|
|
5968
|
+
try {
|
|
5969
|
+
point = JSON.parse(String(row.value));
|
|
5970
|
+
} catch {
|
|
5971
|
+
continue;
|
|
5972
|
+
}
|
|
5973
|
+
const account = String(row.account);
|
|
5974
|
+
if (!Array.isArray(point.done)) {
|
|
5975
|
+
if (cutoff !== null && Date.parse(point.updatedAt ?? "") < cutoff)
|
|
5976
|
+
continue;
|
|
5977
|
+
database.prepare("DELETE FROM sync_cursors WHERE account_id = ? AND key = ?").run(Number(row.account_id), String(row.key));
|
|
5978
|
+
folders.set(account, (folders.get(account) ?? 0) + 1);
|
|
5979
|
+
continue;
|
|
5980
|
+
}
|
|
5981
|
+
const folder = String(row.key).slice("mail_resume:".length);
|
|
5982
|
+
const last = cutoff === null ? null : database.prepare(`SELECT max(l.uid) AS uid FROM email_locations l JOIN emails e ON e.id = l.email_id
|
|
5983
|
+
WHERE l.mailbox_id = (SELECT id FROM mailboxes WHERE account_id = ? AND external_id = ?)
|
|
5984
|
+
AND l.uidvalidity = ? AND coalesce(e.received_at, e.sent_at) < ?`).get(Number(row.account_id), folder, point.validity ?? "", cutoff)?.uid;
|
|
5985
|
+
const done = last === null ? [] : point.done.filter(([from]) => from <= last).map(([from, to]) => [from, Math.min(to, last)]);
|
|
5986
|
+
if (JSON.stringify(done) === JSON.stringify(point.done))
|
|
5987
|
+
continue;
|
|
5988
|
+
database.prepare("UPDATE sync_cursors SET value = ?, updated_at = ? WHERE account_id = ? AND key = ?").run(JSON.stringify({ ...point, done }), now, Number(row.account_id), String(row.key));
|
|
5989
|
+
folders.set(account, (folders.get(account) ?? 0) + 1);
|
|
5990
|
+
}
|
|
5991
|
+
return [...folders].map(([account, count3]) => ({ account, folders: count3 }));
|
|
5992
|
+
}, "forgetMail");
|
|
5993
|
+
|
|
5994
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/store/recover.js
|
|
5925
5995
|
var SQLITE3_MINIMUM = [3, 43, 0];
|
|
5926
5996
|
var STORE_PARTS = ["", "-wal", "-shm"];
|
|
5927
5997
|
var RECOVER_LOCK = ".recover-lock";
|
|
@@ -6016,9 +6086,12 @@ var storeHolders = /* @__PURE__ */ __name((path) => {
|
|
|
6016
6086
|
return { pid, name };
|
|
6017
6087
|
});
|
|
6018
6088
|
}, "storeHolders");
|
|
6019
|
-
var
|
|
6089
|
+
var dataTables = /* @__PURE__ */ __name((database) => {
|
|
6020
6090
|
const indexes = fts5Tables(database).map((index) => index.name);
|
|
6021
|
-
|
|
6091
|
+
return database.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND rootpage > 0 AND name NOT LIKE 'sqlite_%' AND name NOT LIKE 'vector_index_%' ORDER BY name").all().map((row) => String(row.name)).filter((name) => !indexes.some((index) => name.startsWith(`${index}_`)));
|
|
6092
|
+
}, "dataTables");
|
|
6093
|
+
var tableRows = /* @__PURE__ */ __name((database) => {
|
|
6094
|
+
const tables = dataTables(database);
|
|
6022
6095
|
return Object.fromEntries(tables.map((table) => {
|
|
6023
6096
|
try {
|
|
6024
6097
|
return [table, Number(database.prepare(`SELECT count(*) AS n FROM "${table}"`).get()?.n)];
|
|
@@ -6027,6 +6100,117 @@ var tableRows = /* @__PURE__ */ __name((database) => {
|
|
|
6027
6100
|
}
|
|
6028
6101
|
}));
|
|
6029
6102
|
}, "tableRows");
|
|
6103
|
+
var sourceTables = /* @__PURE__ */ __name((database) => {
|
|
6104
|
+
const withoutRowid = new Set(database.prepare("SELECT name FROM pragma_table_list WHERE wr = 1").all().map((row) => String(row.name)));
|
|
6105
|
+
return dataTables(database).filter((table) => table !== LOST_AND_FOUND && !withoutRowid.has(table) && !isDerivedTable(table));
|
|
6106
|
+
}, "sourceTables");
|
|
6107
|
+
var indexedButGone = /* @__PURE__ */ __name((database) => {
|
|
6108
|
+
const found = {};
|
|
6109
|
+
for (const table of sourceTables(database)) {
|
|
6110
|
+
const indexes = database.prepare("SELECT name FROM pragma_index_list(?) WHERE partial = 0 ORDER BY name").all(table).map((row) => String(row.name));
|
|
6111
|
+
for (const index of indexes) {
|
|
6112
|
+
const columns = database.prepare("SELECT cid, name FROM pragma_index_xinfo(?) WHERE key = 1 ORDER BY seqno").all(index);
|
|
6113
|
+
if (columns.some((column) => Number(column.cid) < 0))
|
|
6114
|
+
continue;
|
|
6115
|
+
const keys = columns.map((column) => `"${String(column.name)}"`).join(", ");
|
|
6116
|
+
const grouped = `${keys}, row_id`;
|
|
6117
|
+
let rows;
|
|
6118
|
+
try {
|
|
6119
|
+
rows = Number(database.prepare(`SELECT count(*) AS n FROM (SELECT 1 FROM (SELECT ${keys}, rowid AS row_id, 1 AS side FROM "${table}" INDEXED BY "${index}" UNION ALL SELECT ${keys}, rowid, 2 FROM "${table}" NOT INDEXED) GROUP BY ${grouped} HAVING max(side) = 1)`).get()?.n);
|
|
6120
|
+
} catch {
|
|
6121
|
+
continue;
|
|
6122
|
+
}
|
|
6123
|
+
if (rows > (found[table]?.rows ?? 0))
|
|
6124
|
+
found[table] = { rows, index };
|
|
6125
|
+
}
|
|
6126
|
+
}
|
|
6127
|
+
return found;
|
|
6128
|
+
}, "indexedButGone");
|
|
6129
|
+
var storedAs = /* @__PURE__ */ __name((declared) => {
|
|
6130
|
+
const type = declared.toUpperCase();
|
|
6131
|
+
if (type.includes("INT"))
|
|
6132
|
+
return ["integer"];
|
|
6133
|
+
if (/CHAR|CLOB|TEXT/.test(type))
|
|
6134
|
+
return ["text"];
|
|
6135
|
+
if (type === "" || type.includes("BLOB"))
|
|
6136
|
+
return null;
|
|
6137
|
+
if (/REAL|FLOA|DOUB/.test(type))
|
|
6138
|
+
return ["real", "integer"];
|
|
6139
|
+
return null;
|
|
6140
|
+
}, "storedAs");
|
|
6141
|
+
var columnsOf = /* @__PURE__ */ __name((database, table) => {
|
|
6142
|
+
const all = database.prepare('SELECT name, type, "notnull" AS required, dflt_value, pk FROM pragma_table_info(?)').all(table);
|
|
6143
|
+
const keys = all.filter((column) => Number(column.pk) > 0);
|
|
6144
|
+
return all.map((column) => ({
|
|
6145
|
+
name: String(column.name),
|
|
6146
|
+
type: String(column.type),
|
|
6147
|
+
required: Number(column.required) === 1,
|
|
6148
|
+
hasDefault: column.dflt_value !== null,
|
|
6149
|
+
rowid: keys.length === 1 && Number(column.pk) === 1 && String(column.type).toUpperCase() === "INTEGER"
|
|
6150
|
+
}));
|
|
6151
|
+
}, "columnsOf");
|
|
6152
|
+
var fits = /* @__PURE__ */ __name((columns, fields, types) => fields <= columns.length && columns.every((column, at) => {
|
|
6153
|
+
if (at >= fields)
|
|
6154
|
+
return !column.required || column.hasDefault;
|
|
6155
|
+
const type = types[at];
|
|
6156
|
+
if (column.rowid)
|
|
6157
|
+
return type === "null" || type === "integer";
|
|
6158
|
+
if (type === "null")
|
|
6159
|
+
return !column.required;
|
|
6160
|
+
const allowed = storedAs(column.type);
|
|
6161
|
+
return allowed === null || allowed.includes(type);
|
|
6162
|
+
}), "fits");
|
|
6163
|
+
var placeLostRows = /* @__PURE__ */ __name((database) => {
|
|
6164
|
+
if (!database.prepare("SELECT 1 FROM sqlite_master WHERE name = ?").get(LOST_AND_FOUND))
|
|
6165
|
+
return {};
|
|
6166
|
+
const fields = database.prepare("SELECT name FROM pragma_table_info(?) WHERE name GLOB 'c[0-9]*'").all(LOST_AND_FOUND).map((row) => String(row.name));
|
|
6167
|
+
const tables = sourceTables(database).map((table) => ({ table, columns: columnsOf(database, table) }));
|
|
6168
|
+
const rows = database.prepare(`SELECT rowid AS at, nfield, ${fields.map((field) => `typeof(${field}) AS "${field}"`).join(", ")} FROM ${LOST_AND_FOUND} WHERE id IS NOT NULL`).all();
|
|
6169
|
+
const placed = {};
|
|
6170
|
+
const triggers = [];
|
|
6171
|
+
const quiet = /* @__PURE__ */ __name((table) => {
|
|
6172
|
+
if (table in placed)
|
|
6173
|
+
return;
|
|
6174
|
+
placed[table] = 0;
|
|
6175
|
+
for (const row of database.prepare("SELECT name, sql FROM sqlite_master WHERE type = 'trigger' AND tbl_name = ?").all(table)) {
|
|
6176
|
+
triggers.push(String(row.sql));
|
|
6177
|
+
database.exec(`DROP TRIGGER "${String(row.name)}"`);
|
|
6178
|
+
}
|
|
6179
|
+
}, "quiet");
|
|
6180
|
+
database.exec("PRAGMA foreign_keys = OFF");
|
|
6181
|
+
database.exec("BEGIN");
|
|
6182
|
+
try {
|
|
6183
|
+
for (const row of rows) {
|
|
6184
|
+
const count3 = Number(row.nfield);
|
|
6185
|
+
const types = fields.slice(0, count3).map((field) => String(row[field]));
|
|
6186
|
+
const fitting = tables.filter(({ columns: columns2 }) => fits(columns2, count3, types));
|
|
6187
|
+
if (fitting.length !== 1)
|
|
6188
|
+
continue;
|
|
6189
|
+
const { table, columns } = fitting[0];
|
|
6190
|
+
quiet(table);
|
|
6191
|
+
const given = columns.slice(0, count3);
|
|
6192
|
+
const names = [...given.some((column) => column.rowid) ? [] : ["rowid"], ...given.map((column) => column.name)];
|
|
6193
|
+
const values = [
|
|
6194
|
+
...given.some((column) => column.rowid) ? [] : ["id"],
|
|
6195
|
+
...given.map((column, at) => column.rowid ? "id" : `c${at}`)
|
|
6196
|
+
];
|
|
6197
|
+
const inserted = database.prepare(`INSERT OR IGNORE INTO "${table}" (${names.map((name) => `"${name}"`).join(", ")}) SELECT ${values.join(", ")} FROM ${LOST_AND_FOUND} WHERE rowid = ?`).run(Number(row.at));
|
|
6198
|
+
if (Number(inserted.changes) === 0)
|
|
6199
|
+
continue;
|
|
6200
|
+
placed[table] = (placed[table] ?? 0) + 1;
|
|
6201
|
+
database.prepare(`DELETE FROM ${LOST_AND_FOUND} WHERE rowid = ?`).run(Number(row.at));
|
|
6202
|
+
}
|
|
6203
|
+
for (const sql of triggers)
|
|
6204
|
+
database.exec(sql);
|
|
6205
|
+
database.exec("COMMIT");
|
|
6206
|
+
} catch (error) {
|
|
6207
|
+
database.exec("ROLLBACK");
|
|
6208
|
+
throw error;
|
|
6209
|
+
} finally {
|
|
6210
|
+
database.exec("PRAGMA foreign_keys = ON");
|
|
6211
|
+
}
|
|
6212
|
+
return Object.fromEntries(Object.entries(placed).filter(([, rows2]) => rows2 > 0));
|
|
6213
|
+
}, "placeLostRows");
|
|
6030
6214
|
var copyReadableRows = /* @__PURE__ */ __name((path, target, program = "sqlite3") => new Promise((resolve2, reject) => {
|
|
6031
6215
|
const reader = spawn(program, ["-readonly", path, `.recover --ignore-freelist --lost-and-found ${LOST_AND_FOUND}`], {
|
|
6032
6216
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -6223,6 +6407,9 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
|
|
|
6223
6407
|
throw error;
|
|
6224
6408
|
throw new CliError("configuration_error", "the store file's header or schema is damaged, so its tables cannot be listed and it cannot be recovered; the file was left as it was", { reason: "store.unreadable" });
|
|
6225
6409
|
}
|
|
6410
|
+
note("looking for rows the indexes list and the tables no longer hold");
|
|
6411
|
+
const gone = indexedButGone(watch);
|
|
6412
|
+
const lastKnownGood = readHealthMark(path)?.last_ok_at ?? null;
|
|
6226
6413
|
const before = { data: dataVersion(), inode: statSync2(path).ino };
|
|
6227
6414
|
const stamp = new Date(now()).toISOString().replace(/[:.]/g, "-");
|
|
6228
6415
|
const target = `${path}.recovering-${stamp}`;
|
|
@@ -6249,9 +6436,12 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
|
|
|
6249
6436
|
let kept;
|
|
6250
6437
|
let dangling;
|
|
6251
6438
|
let json;
|
|
6252
|
-
let
|
|
6439
|
+
let fetch;
|
|
6253
6440
|
let schema;
|
|
6441
|
+
let placed;
|
|
6442
|
+
let refetch;
|
|
6254
6443
|
try {
|
|
6444
|
+
placed = placeLostRows(opened.database);
|
|
6255
6445
|
kept = tableRows(opened.database);
|
|
6256
6446
|
migrate(opened.database, { command, ...version ? { version } : {} });
|
|
6257
6447
|
note("clearing values that are not valid JSON");
|
|
@@ -6259,7 +6449,9 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
|
|
|
6259
6449
|
rebuilt = rebuildDerived(opened.database, { now, note });
|
|
6260
6450
|
note("looking for rows that point at rows that were lost");
|
|
6261
6451
|
dangling = danglingRows(opened.database);
|
|
6262
|
-
|
|
6452
|
+
fetch = mailToFetch(opened.database);
|
|
6453
|
+
const good = lastKnownGood === null ? Number.NaN : Date.parse(lastKnownGood);
|
|
6454
|
+
refetch = forgetCoverageSince(opened.database, Number.isNaN(good) ? null : good - REFILL_MARGIN_MS, now());
|
|
6263
6455
|
schema = fileSchemaOf(opened.database).version;
|
|
6264
6456
|
opened.database.exec("PRAGMA wal_checkpoint(TRUNCATE)");
|
|
6265
6457
|
} catch (error) {
|
|
@@ -6289,16 +6481,29 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
|
|
|
6289
6481
|
if (existsSync2(`${target}${suffix}`))
|
|
6290
6482
|
renameSync2(`${target}${suffix}`, `${path}${suffix}`);
|
|
6291
6483
|
recordDeepCheck(path, health, { cli: command, ...version ? { version } : {}, schema, now });
|
|
6292
|
-
const lost = Object.entries(rowsBefore).map(([table, before2]) =>
|
|
6484
|
+
const lost = Object.entries(rowsBefore).map(([table, before2]) => {
|
|
6485
|
+
const goneAtLeast = Math.max(0, (gone[table]?.rows ?? 0) - (placed[table] ?? 0));
|
|
6486
|
+
return {
|
|
6487
|
+
table,
|
|
6488
|
+
before: before2,
|
|
6489
|
+
read: read[table] ?? 0,
|
|
6490
|
+
kept: kept[table] ?? 0,
|
|
6491
|
+
goneAtLeast,
|
|
6492
|
+
seenIn: goneAtLeast > 0 ? gone[table]?.index ?? null : null
|
|
6493
|
+
};
|
|
6494
|
+
}).filter(({ before: before2, read: read2, kept: kept2, goneAtLeast }) => before2 === null || before2 > kept2 || read2 > kept2 || goneAtLeast > 0);
|
|
6293
6495
|
const seconds = /* @__PURE__ */ __name((from, to) => Math.round((to - from) / 100) / 10, "seconds");
|
|
6294
6496
|
return {
|
|
6295
6497
|
path,
|
|
6296
6498
|
keptAt,
|
|
6297
6499
|
sqlite3: program.version,
|
|
6298
6500
|
lost,
|
|
6501
|
+
placed,
|
|
6502
|
+
lastKnownGood,
|
|
6299
6503
|
dangling,
|
|
6300
6504
|
invalidJson: json,
|
|
6301
|
-
mailToFetch:
|
|
6505
|
+
mailToFetch: fetch,
|
|
6506
|
+
refetch,
|
|
6302
6507
|
rebuilt,
|
|
6303
6508
|
copyErrors,
|
|
6304
6509
|
health,
|
|
@@ -6314,7 +6519,7 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
|
|
|
6314
6519
|
}
|
|
6315
6520
|
}, "recoverLocked");
|
|
6316
6521
|
|
|
6317
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6522
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
|
|
6318
6523
|
var COUNTED = [
|
|
6319
6524
|
"accounts",
|
|
6320
6525
|
"chats",
|
|
@@ -6347,18 +6552,23 @@ var storeRecoveryCheck = /* @__PURE__ */ __name(async (env, command, version) =>
|
|
|
6347
6552
|
}
|
|
6348
6553
|
} catch {
|
|
6349
6554
|
}
|
|
6555
|
+
const journal = readJournalMark(path);
|
|
6350
6556
|
recordDeepCheck(path, health, { cli: command, ...version ? { version } : {}, schema });
|
|
6351
6557
|
const mark = readDamageMark(path);
|
|
6352
|
-
const
|
|
6558
|
+
const lastKnownGood = readHealthMark(path)?.last_ok_at ?? null;
|
|
6353
6559
|
const inUse = storeHolders(path) ?? null;
|
|
6354
6560
|
const timers = activeTimers() ?? null;
|
|
6355
6561
|
const sqlite3 = sqlite3Program();
|
|
6356
|
-
const
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6562
|
+
const report = storeDamageReport({
|
|
6563
|
+
health,
|
|
6564
|
+
command,
|
|
6565
|
+
mark,
|
|
6566
|
+
journal,
|
|
6567
|
+
lastOkAt: lastKnownGood,
|
|
6568
|
+
holders: inUse,
|
|
6569
|
+
timers,
|
|
6570
|
+
sqlite3Usable: sqlite3.usable
|
|
6571
|
+
});
|
|
6362
6572
|
return {
|
|
6363
6573
|
path,
|
|
6364
6574
|
exists: true,
|
|
@@ -6369,13 +6579,13 @@ var storeRecoveryCheck = /* @__PURE__ */ __name(async (env, command, version) =>
|
|
|
6369
6579
|
damagedSearchIndexes: (health.searchIndexes ?? []).filter((index) => !index.ok).map(({ name, error }) => ({ name, ...error ? { error } : {} })),
|
|
6370
6580
|
invalidJson: health.invalidJson ?? [],
|
|
6371
6581
|
rows,
|
|
6372
|
-
|
|
6582
|
+
report,
|
|
6373
6583
|
damageMark: mark ? (({ inode: _, ...seen }) => seen)(mark) : null,
|
|
6374
|
-
lastKnownGood
|
|
6584
|
+
lastKnownGood,
|
|
6375
6585
|
inUse,
|
|
6376
6586
|
timers,
|
|
6377
6587
|
sqlite3: { version: sqlite3.version, usable: sqlite3.usable },
|
|
6378
|
-
next
|
|
6588
|
+
next: report?.steps.map((step) => step.command) ?? []
|
|
6379
6589
|
};
|
|
6380
6590
|
}, "storeRecoveryCheck");
|
|
6381
6591
|
var storeRecoveryRun = /* @__PURE__ */ __name(async (env, { command, version, note, timers: scheduled = activeTimers, copy }) => {
|
|
@@ -6401,12 +6611,27 @@ var storeRecoveryRun = /* @__PURE__ */ __name(async (env, { command, version, no
|
|
|
6401
6611
|
next: [...mail, ...lostMail, "systemctl --user start <the timers stopped before>"]
|
|
6402
6612
|
};
|
|
6403
6613
|
}, "storeRecoveryRun");
|
|
6614
|
+
var refetchNotes = /* @__PURE__ */ __name(({ since, chats, mail }) => {
|
|
6615
|
+
const from = since === null ? "from the start" : `from ${since} on`;
|
|
6616
|
+
const marked = [
|
|
6617
|
+
...chats.map(({ provider, account, chats: chats2 }) => `${chats2} chats of ${provider} ${account}`),
|
|
6618
|
+
...mail.map(({ account, folders }) => `${folders} mail folders of ${account}`)
|
|
6619
|
+
];
|
|
6620
|
+
return [
|
|
6621
|
+
marked.length > 0 ? `marked as not fetched ${from}, so the next sync or serve fetches it again: ${marked.join(", ")}` : `nothing held ${from} was marked as fetched, so there is nothing to fetch again`,
|
|
6622
|
+
...chats.filter(({ provider }) => provider === "whatsapp").map(({ account }) => `whatsapp ${account}: WhatsApp cannot be asked for its chats, so only what the phone pushes while serve runs comes back`),
|
|
6623
|
+
"notes, memories, tags and whatever else only this store held cannot be fetched again"
|
|
6624
|
+
];
|
|
6625
|
+
}, "refetchNotes");
|
|
6404
6626
|
var recoveryNotes = /* @__PURE__ */ __name((answer) => {
|
|
6405
6627
|
if ("keptAt" in answer) {
|
|
6406
|
-
const lost = answer.lost.map(({ table, before, read, kept }) => `${table}: ${kept} kept of ${before ?? "an uncountable number"}${read > kept ? `, ${read - kept} read but unusable` : ""}`);
|
|
6628
|
+
const lost = answer.lost.map(({ table, before, read, kept, goneAtLeast, seenIn }) => `${table}: ${kept} kept of ${before ?? "an uncountable number"}${read > kept ? `, ${read - kept} read but unusable` : ""}` + (goneAtLeast > 0 ? `; at least ${goneAtLeast} rows are gone (the index ${seenIn} lists them)` : ""));
|
|
6407
6629
|
return [
|
|
6408
6630
|
`recovered in ${answer.seconds.total} s; the damaged file is kept at ${answer.keptAt}`,
|
|
6409
|
-
...lost
|
|
6631
|
+
...lost,
|
|
6632
|
+
...Object.entries(answer.placed).map(([table, rows]) => `${table}: ${rows} rows found on pages no table claimed were put back`),
|
|
6633
|
+
...refetchNotes(answer.refetch),
|
|
6634
|
+
lossUnknown(answer.lastKnownGood, lost.some((line) => line.includes("are gone"))),
|
|
6410
6635
|
...answer.dangling.map(({ table, parent, rows }) => `${rows} rows of ${table} point at ${parent} rows the store does not hold`),
|
|
6411
6636
|
...answer.invalidJson.map(({ table, column, rows, required }) => `${table}.${column}: ${rows} values were not valid JSON \u2014 ${required ? "those rows were dropped" : "set to empty"}`),
|
|
6412
6637
|
...answer.next.map((line) => `next: ${line}`)
|
|
@@ -6414,13 +6639,16 @@ var recoveryNotes = /* @__PURE__ */ __name((answer) => {
|
|
|
6414
6639
|
}
|
|
6415
6640
|
if (!answer.exists)
|
|
6416
6641
|
return ["no store yet"];
|
|
6417
|
-
|
|
6642
|
+
const report = answer.report;
|
|
6643
|
+
if (!report)
|
|
6418
6644
|
return [`the store is healthy (checked every page and search index in ${answer.seconds} s)`];
|
|
6419
|
-
const why = answer.explanation;
|
|
6420
6645
|
return [
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6646
|
+
report.whatHappened,
|
|
6647
|
+
...report.impact,
|
|
6648
|
+
report.externalDataSafe,
|
|
6649
|
+
report.loss,
|
|
6650
|
+
...report.likelyCauses.map(({ cause, check: check2 }) => `maybe: ${cause} \u2014 check: ${check2}`),
|
|
6651
|
+
...report.steps.map(({ command, why, destructive }) => `next: ${command} # ${destructive ? "changes things: " : ""}${why}`)
|
|
6424
6652
|
];
|
|
6425
6653
|
}, "recoveryNotes");
|
|
6426
6654
|
var storeRecoverCommand = /* @__PURE__ */ __name(({ command, version }) => {
|
|
@@ -6447,7 +6675,7 @@ var storeRecoverCommand = /* @__PURE__ */ __name(({ command, version }) => {
|
|
|
6447
6675
|
return recover;
|
|
6448
6676
|
}, "storeRecoverCommand");
|
|
6449
6677
|
|
|
6450
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6678
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/cli/store-info.js
|
|
6451
6679
|
var pendingIfKnown = /* @__PURE__ */ __name((database) => database.prepare("SELECT 1 FROM pragma_table_info('messages') WHERE name = 'normalized_text'").get() ? pendingNormalization(database) : null, "pendingIfKnown");
|
|
6452
6680
|
var bytesOf = /* @__PURE__ */ __name((path) => existsSync4(path) ? statSync3(path).size : 0, "bytesOf");
|
|
6453
6681
|
var messageOf = /* @__PURE__ */ __name((error) => error instanceof Error ? error.message : String(error), "messageOf");
|
|
@@ -6497,7 +6725,7 @@ var sharedStoreCommand = /* @__PURE__ */ __name((app) => {
|
|
|
6497
6725
|
return app ? store.addCommand(storeRecoverCommand(app)) : store;
|
|
6498
6726
|
}, "sharedStoreCommand");
|
|
6499
6727
|
|
|
6500
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6728
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/cli/messenger/password.js
|
|
6501
6729
|
var ENCRYPT_OPTION = [
|
|
6502
6730
|
"--encrypt",
|
|
6503
6731
|
"compress and encrypt with a password, typed at a hidden prompt or piped on stdin; it is never kept \u2014 lose it and the file cannot be opened"
|
|
@@ -6516,7 +6744,7 @@ var passwordOf = /* @__PURE__ */ __name(async (command, { twice }) => {
|
|
|
6516
6744
|
return password;
|
|
6517
6745
|
}, "passwordOf");
|
|
6518
6746
|
|
|
6519
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6747
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/replies/rules.js
|
|
6520
6748
|
import { existsSync as existsSync5, readFileSync as readFileSync2 } from "node:fs";
|
|
6521
6749
|
import { join as join2 } from "node:path";
|
|
6522
6750
|
var REPLY_ACTIONS = ["reply", "task"];
|
|
@@ -6687,7 +6915,7 @@ var problem = /* @__PURE__ */ __name((issue) => {
|
|
|
6687
6915
|
}, "problem");
|
|
6688
6916
|
var broken = /* @__PURE__ */ __name((path, why) => new CliError("configuration_error", `the reply rules ${path} cannot be read (${why}) \u2014 fix the file`), "broken");
|
|
6689
6917
|
|
|
6690
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6918
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/replies/state.js
|
|
6691
6919
|
import { existsSync as existsSync6, readFileSync as readFileSync3 } from "node:fs";
|
|
6692
6920
|
import { join as join3 } from "node:path";
|
|
6693
6921
|
var ANSWERED_KEPT = 1e3;
|
|
@@ -6740,7 +6968,7 @@ var recordReply = /* @__PURE__ */ __name((state, rule2, message, now) => {
|
|
|
6740
6968
|
}, "recordReply");
|
|
6741
6969
|
var broken2 = /* @__PURE__ */ __name((path, why) => new CliError("configuration_error", `the reply state ${path} cannot be read (${why}) \u2014 fix or move the file`), "broken");
|
|
6742
6970
|
|
|
6743
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6971
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/replies/decide.js
|
|
6744
6972
|
var skip = /* @__PURE__ */ __name((why) => ({ skip: why }), "skip");
|
|
6745
6973
|
var decide = /* @__PURE__ */ __name((rule2, incoming, state, now) => {
|
|
6746
6974
|
const { message, chat, owner, sender } = incoming;
|
|
@@ -6846,8 +7074,37 @@ var filled = /* @__PURE__ */ __name((template2, senderName) => {
|
|
|
6846
7074
|
return template2.replaceAll("{firstName}", name.split(/\s+/)[0] ?? name).replaceAll("{name}", name);
|
|
6847
7075
|
}, "filled");
|
|
6848
7076
|
|
|
6849
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7077
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/replies/template.js
|
|
7078
|
+
var import_liquidjs2 = __toESM(require_liquid_node(), 1);
|
|
7079
|
+
|
|
7080
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/render/liquid.js
|
|
6850
7081
|
var import_liquidjs = __toESM(require_liquid_node(), 1);
|
|
7082
|
+
var safeLiquid = /* @__PURE__ */ __name((limits) => {
|
|
7083
|
+
const engine = new import_liquidjs.Liquid({
|
|
7084
|
+
ownPropertyOnly: true,
|
|
7085
|
+
strictVariables: true,
|
|
7086
|
+
strictFilters: true,
|
|
7087
|
+
lenientIf: false,
|
|
7088
|
+
parseLimit: limits.parse,
|
|
7089
|
+
renderLimit: limits.milliseconds,
|
|
7090
|
+
memoryLimit: limits.memory,
|
|
7091
|
+
preserveTimezones: true
|
|
7092
|
+
});
|
|
7093
|
+
for (const name of ["include", "render", "layout"]) {
|
|
7094
|
+
engine.registerTag(name, class extends import_liquidjs.Tag {
|
|
7095
|
+
constructor(token, tokens, liquid) {
|
|
7096
|
+
super(token, tokens, liquid);
|
|
7097
|
+
throw new Error("templates cannot read files");
|
|
7098
|
+
}
|
|
7099
|
+
render() {
|
|
7100
|
+
return "";
|
|
7101
|
+
}
|
|
7102
|
+
});
|
|
7103
|
+
}
|
|
7104
|
+
return engine;
|
|
7105
|
+
}, "safeLiquid");
|
|
7106
|
+
|
|
7107
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/replies/template.js
|
|
6851
7108
|
var TEMPLATE_LIMITS = {
|
|
6852
7109
|
parse: 32768,
|
|
6853
7110
|
renders: 2e3,
|
|
@@ -6901,28 +7158,8 @@ var renderReplyTemplate = /* @__PURE__ */ __name(async (reply, input) => {
|
|
|
6901
7158
|
hourCycle: "h23"
|
|
6902
7159
|
}).formatToParts(input.now).map(({ type, value }) => [type, value]));
|
|
6903
7160
|
const localTime = `${parts.year}-${parts.month}-${parts.day}T${parts.hour}:${parts.minute}:${parts.second}${parts.timeZoneName?.replace("GMT", "") || "+00:00"}`;
|
|
6904
|
-
const engine =
|
|
6905
|
-
|
|
6906
|
-
strictVariables: true,
|
|
6907
|
-
strictFilters: true,
|
|
6908
|
-
lenientIf: false,
|
|
6909
|
-
parseLimit: limits.parse,
|
|
6910
|
-
renderLimit: limits.milliseconds,
|
|
6911
|
-
memoryLimit: limits.memory,
|
|
6912
|
-
preserveTimezones: true
|
|
6913
|
-
});
|
|
6914
|
-
for (const name2 of ["include", "render", "layout"]) {
|
|
6915
|
-
engine.registerTag(name2, class extends import_liquidjs.Tag {
|
|
6916
|
-
constructor(token, tokens, liquid) {
|
|
6917
|
-
super(token, tokens, liquid);
|
|
6918
|
-
throw new Error("reply templates cannot read files");
|
|
6919
|
-
}
|
|
6920
|
-
render() {
|
|
6921
|
-
return "";
|
|
6922
|
-
}
|
|
6923
|
-
});
|
|
6924
|
-
}
|
|
6925
|
-
engine.registerTag("ai", class extends import_liquidjs.Tag {
|
|
7161
|
+
const engine = safeLiquid({ parse: limits.parse, memory: limits.memory, milliseconds: limits.milliseconds });
|
|
7162
|
+
engine.registerTag("ai", class extends import_liquidjs2.Tag {
|
|
6926
7163
|
body = [];
|
|
6927
7164
|
fallback = null;
|
|
6928
7165
|
constructor(token, tokens, liquid, parser) {
|
|
@@ -6983,7 +7220,7 @@ var renderReplyTemplate = /* @__PURE__ */ __name(async (reply, input) => {
|
|
|
6983
7220
|
});
|
|
6984
7221
|
const templates = engine.parse(source);
|
|
6985
7222
|
const name = input.senderName?.trim() ?? "";
|
|
6986
|
-
const context = new
|
|
7223
|
+
const context = new import_liquidjs2.Context({
|
|
6987
7224
|
sender: { firstName: name.split(/\s+/)[0] ?? "", name },
|
|
6988
7225
|
chat: { title: input.chat.title ?? "", kind: input.chat.kind },
|
|
6989
7226
|
now: localTime
|
|
@@ -7006,7 +7243,7 @@ var renderReplyTemplate = /* @__PURE__ */ __name(async (reply, input) => {
|
|
|
7006
7243
|
}
|
|
7007
7244
|
}, "renderReplyTemplate");
|
|
7008
7245
|
|
|
7009
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7246
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/replies/dry-run.js
|
|
7010
7247
|
var DRY_RUN_DAYS = 7;
|
|
7011
7248
|
var PAGE = 500;
|
|
7012
7249
|
var dryRun = /* @__PURE__ */ __name(async (store, account, rules, { since, until = Date.now(), only, audience, render }) => {
|
|
@@ -7120,143 +7357,7 @@ var storedSince = /* @__PURE__ */ __name(async (store, account, chat, since) =>
|
|
|
7120
7357
|
}
|
|
7121
7358
|
}, "storedSince");
|
|
7122
7359
|
|
|
7123
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7124
|
-
var endpointKeyName = /* @__PURE__ */ __name((baseUrl) => {
|
|
7125
|
-
const host = new URL(baseUrl).host;
|
|
7126
|
-
return ["openai", "anthropic"].includes(host) ? `endpoint:${host}` : host;
|
|
7127
|
-
}, "endpointKeyName");
|
|
7128
|
-
var embeddingKeys = /* @__PURE__ */ __name((app, env = process.env, keyring) => {
|
|
7129
|
-
const where = { appName: app.appName, prefix: app.envPrefix, env };
|
|
7130
|
-
const credentials = /* @__PURE__ */ __name((provider) => new Credentials({
|
|
7131
|
-
configDir: resolvePaths(where).config,
|
|
7132
|
-
service: app.appName,
|
|
7133
|
-
...["openai", "anthropic"].includes(provider) ? { envVar: envName(app, `${provider.toUpperCase()}_API_KEY`) } : {},
|
|
7134
|
-
isolated: pathsAreOverridden(where),
|
|
7135
|
-
env,
|
|
7136
|
-
...keyring ? { keyring } : {},
|
|
7137
|
-
warn: /* @__PURE__ */ __name((message) => process.stderr.write(`${message}
|
|
7138
|
-
`), "warn")
|
|
7139
|
-
}), "credentials");
|
|
7140
|
-
const account = /* @__PURE__ */ __name((provider) => `embeddings:${provider}`, "account");
|
|
7141
|
-
return {
|
|
7142
|
-
read: /* @__PURE__ */ __name((provider) => {
|
|
7143
|
-
const stored = credentials(provider).read(account(provider));
|
|
7144
|
-
if (stored)
|
|
7145
|
-
return { key: stored.secret, source: stored.source };
|
|
7146
|
-
const shared = ["openai", "anthropic"].includes(provider) ? env[`${provider.toUpperCase()}_API_KEY`]?.trim() : void 0;
|
|
7147
|
-
return shared ? { key: shared, source: "env" } : void 0;
|
|
7148
|
-
}, "read"),
|
|
7149
|
-
write: /* @__PURE__ */ __name((provider, key) => credentials(provider).write(account(provider), key, { signIn: true }), "write"),
|
|
7150
|
-
remove: /* @__PURE__ */ __name((provider) => credentials(provider).remove(account(provider)), "remove")
|
|
7151
|
-
};
|
|
7152
|
-
}, "embeddingKeys");
|
|
7153
|
-
|
|
7154
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3e7ac84c094d466aed903c683c124ab5/node_modules/@wirecat/cli-core/dist/models/openai.js
|
|
7155
|
-
var options = strictObject({
|
|
7156
|
-
temperature: range(0, 2),
|
|
7157
|
-
top_p: range(0, 1),
|
|
7158
|
-
presence_penalty: range(-2, 2),
|
|
7159
|
-
frequency_penalty: range(-2, 2),
|
|
7160
|
-
seed: optional(pipe(number(), integer())),
|
|
7161
|
-
stop: optional(union([string(), array(string())])),
|
|
7162
|
-
response_format: optional(strictObject({ type: picklist(["text", "json_object"]) }))
|
|
7163
|
-
});
|
|
7164
|
-
var openai = {
|
|
7165
|
-
images: true,
|
|
7166
|
-
baseUrl: "https://api.openai.com/v1",
|
|
7167
|
-
validate: /* @__PURE__ */ __name((given) => checkedOptions("openai", options, given), "validate"),
|
|
7168
|
-
complete: /* @__PURE__ */ __name((target, request, checked, apiKey, fetcher) => withTimeLimit(12e4, async (deadline) => {
|
|
7169
|
-
const response = await fetcher(`${target.baseUrl.replace(/\/+$/, "")}/chat/completions`, {
|
|
7170
|
-
method: "POST",
|
|
7171
|
-
headers: { "Content-Type": "application/json", ...apiKey ? { Authorization: `Bearer ${apiKey}` } : {} },
|
|
7172
|
-
body: JSON.stringify({
|
|
7173
|
-
...checked,
|
|
7174
|
-
model: target.model,
|
|
7175
|
-
messages: [
|
|
7176
|
-
{ role: "system", content: systemFor(request) },
|
|
7177
|
-
...messagesFor(request),
|
|
7178
|
-
...request.images === void 0 ? [] : [
|
|
7179
|
-
{
|
|
7180
|
-
role: "user",
|
|
7181
|
-
content: request.images.map((image) => ({
|
|
7182
|
-
type: "image_url",
|
|
7183
|
-
image_url: { url: `data:${image.mimeType};base64,${image.data}`, detail: "high" }
|
|
7184
|
-
}))
|
|
7185
|
-
}
|
|
7186
|
-
]
|
|
7187
|
-
],
|
|
7188
|
-
...new URL(target.baseUrl).hostname === "api.openai.com" ? { max_completion_tokens: request.maxTokens } : { max_tokens: request.maxTokens }
|
|
7189
|
-
}),
|
|
7190
|
-
signal: deadline,
|
|
7191
|
-
redirect: "error"
|
|
7192
|
-
});
|
|
7193
|
-
if (!response.ok)
|
|
7194
|
-
throw new Error("provider rejected request");
|
|
7195
|
-
const body = await response.json();
|
|
7196
|
-
const choice = body.choices?.[0];
|
|
7197
|
-
if (choice?.finish_reason !== "stop" || typeof choice.message?.content !== "string" || !Number.isInteger(body.usage?.total_tokens) || (body.usage?.total_tokens ?? 0) < 1)
|
|
7198
|
-
throw new Error("incomplete response");
|
|
7199
|
-
return { text: choice.message.content, tokens: body.usage?.total_tokens };
|
|
7200
|
-
}), "complete")
|
|
7201
|
-
};
|
|
7202
|
-
|
|
7203
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3e7ac84c094d466aed903c683c124ab5/node_modules/@wirecat/cli-core/dist/models/index.js
|
|
7204
|
-
var modelGateway = /* @__PURE__ */ __name((deps) => ({
|
|
7205
|
-
complete: /* @__PURE__ */ __name(async (request) => {
|
|
7206
|
-
if (deps.signal?.aborted)
|
|
7207
|
-
throw new CliError("cancelled", "model request cancelled");
|
|
7208
|
-
const target = deps.resolve(request.purpose);
|
|
7209
|
-
if (!target || target.provider === "off")
|
|
7210
|
-
throw new CliError("configuration_error", `models.${request.purpose}.provider is not configured; no model was called`);
|
|
7211
|
-
if (!request.purpose || !Number.isSafeInteger(request.maxTokens) || request.maxTokens < 1 || typeof request.prompt !== "string")
|
|
7212
|
-
throw new CliError("validation_error", "a model request needs a purpose, prompt and positive whole maxTokens");
|
|
7213
|
-
validateImages(request.images);
|
|
7214
|
-
let adapter = deps.adapters?.[target.provider];
|
|
7215
|
-
if (!adapter && target.provider === "openai")
|
|
7216
|
-
adapter = openai;
|
|
7217
|
-
if (!adapter && target.provider === "anthropic")
|
|
7218
|
-
adapter = (await import("./anthropic-7FUQ2HYJ.js")).anthropic;
|
|
7219
|
-
if (!adapter)
|
|
7220
|
-
throw new CliError("validation_error", `no model adapter for ${target.provider}`);
|
|
7221
|
-
if (request.images !== void 0 && adapter.images !== true)
|
|
7222
|
-
throw new CliError("validation_error", "the model adapter does not support image inputs");
|
|
7223
|
-
const options2 = adapter.validate(request.options ?? {});
|
|
7224
|
-
const baseUrl = target.baseUrl ?? adapter.baseUrl;
|
|
7225
|
-
if (!target.model.trim() || !endpoint(baseUrl))
|
|
7226
|
-
throw new CliError("validation_error", "a model target needs a model and an HTTP/S endpoint without credentials, query or fragment");
|
|
7227
|
-
if (!await deps.consent(request, { ...target, baseUrl }))
|
|
7228
|
-
throw new CliError("permission_error", `model consent for ${request.purpose} is missing; no data was sent`);
|
|
7229
|
-
const apiKey = await deps.key?.(target.provider, target);
|
|
7230
|
-
if (deps.signal?.aborted)
|
|
7231
|
-
throw new CliError("cancelled", "model request cancelled");
|
|
7232
|
-
const fetcher = deps.fetch ?? fetch;
|
|
7233
|
-
let limited = false;
|
|
7234
|
-
const cancellable = /* @__PURE__ */ __name(async (input, init) => {
|
|
7235
|
-
const signal = init?.signal ?? (input instanceof Request ? input.signal : void 0);
|
|
7236
|
-
const response = await fetcher(input, {
|
|
7237
|
-
...init,
|
|
7238
|
-
signal: deps.signal ? AbortSignal.any([deps.signal, ...signal ? [signal] : []]) : signal
|
|
7239
|
-
});
|
|
7240
|
-
if (response.status === 429)
|
|
7241
|
-
limited = true;
|
|
7242
|
-
return response;
|
|
7243
|
-
}, "cancellable");
|
|
7244
|
-
try {
|
|
7245
|
-
const answer = await adapter.complete({ ...target, baseUrl }, request, options2, apiKey, cancellable);
|
|
7246
|
-
if (deps.signal?.aborted)
|
|
7247
|
-
throw new Error("cancelled");
|
|
7248
|
-
if (typeof answer.text !== "string" || !Number.isSafeInteger(answer.tokens) || answer.tokens < 1)
|
|
7249
|
-
throw new Error("incomplete");
|
|
7250
|
-
return { ...answer, provider: target.provider, model: target.model };
|
|
7251
|
-
} catch {
|
|
7252
|
-
if (limited)
|
|
7253
|
-
throw new CliError("rate_limited", `${request.purpose} provider rate limit reached; no result was stored`);
|
|
7254
|
-
throw new CliError("invalid_response", `${request.purpose} provider failed or returned an incomplete response; no result was stored`);
|
|
7255
|
-
}
|
|
7256
|
-
}, "complete")
|
|
7257
|
-
}), "modelGateway");
|
|
7258
|
-
|
|
7259
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3e7ac84c094d466aed903c683c124ab5/node_modules/@wirecat/cli-core/dist/replies/consents.js
|
|
7360
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/replies/consents.js
|
|
7260
7361
|
import { existsSync as existsSync7, readFileSync as readFileSync4 } from "node:fs";
|
|
7261
7362
|
import { join as join4 } from "node:path";
|
|
7262
7363
|
var shape = strictObject({
|
|
@@ -7281,21 +7382,21 @@ var mayModelReply = /* @__PURE__ */ __name((path, provider, chat) => {
|
|
|
7281
7382
|
return consent.provider === provider && !consent.deniedChats.includes(chat);
|
|
7282
7383
|
}, "mayModelReply");
|
|
7283
7384
|
|
|
7284
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7285
|
-
var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn,
|
|
7385
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/replies/rendering.js
|
|
7386
|
+
var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, options = {
|
|
7286
7387
|
ai: true
|
|
7287
7388
|
}) => async (rule2, message, chat, now) => {
|
|
7288
7389
|
let called;
|
|
7289
7390
|
const gateway = modelGateway({
|
|
7290
|
-
signal:
|
|
7391
|
+
signal: options.signal,
|
|
7291
7392
|
resolve: /* @__PURE__ */ __name((purpose) => {
|
|
7292
7393
|
called = modelTarget(settings(), purpose);
|
|
7293
7394
|
return called;
|
|
7294
7395
|
}, "resolve"),
|
|
7295
7396
|
consent: /* @__PURE__ */ __name((_request, target) => mayModelReply(replyConsentPathFor(app, profile, env), replyModelIdentity(target.provider, target.baseUrl ?? ""), message.chatId), "consent"),
|
|
7296
|
-
key: /* @__PURE__ */ __name((provider, target) => embeddingKeys(app, env,
|
|
7397
|
+
key: /* @__PURE__ */ __name((provider, target) => embeddingKeys(app, env, options.keyring).read(target.baseUrl === void 0 ? provider : endpointKeyName(target.baseUrl))?.key, "key")
|
|
7297
7398
|
});
|
|
7298
|
-
if (
|
|
7399
|
+
if (options.signal?.aborted)
|
|
7299
7400
|
throw new CliError("cancelled", "reply rendering cancelled");
|
|
7300
7401
|
const result2 = await renderReplyTemplate(rule2.reply, {
|
|
7301
7402
|
senderName: message.senderName,
|
|
@@ -7303,8 +7404,8 @@ var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, o
|
|
|
7303
7404
|
now,
|
|
7304
7405
|
timezone: rule2.when.hours?.timezone,
|
|
7305
7406
|
data: message.text,
|
|
7306
|
-
allowAI:
|
|
7307
|
-
preview:
|
|
7407
|
+
allowAI: options.ai === true,
|
|
7408
|
+
preview: options.preview === true,
|
|
7308
7409
|
complete: /* @__PURE__ */ __name(async (prompt, data) => {
|
|
7309
7410
|
const result3 = await gateway.complete({
|
|
7310
7411
|
purpose: "replies",
|
|
@@ -7313,7 +7414,7 @@ var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, o
|
|
|
7313
7414
|
data,
|
|
7314
7415
|
maxTokens: 512
|
|
7315
7416
|
});
|
|
7316
|
-
if (
|
|
7417
|
+
if (options.signal?.aborted)
|
|
7317
7418
|
throw new CliError("cancelled", "reply rendering cancelled");
|
|
7318
7419
|
const current = modelTarget(settings(), "replies");
|
|
7319
7420
|
const baseUrl = called?.baseUrl ?? (called?.provider === "anthropic" ? "https://api.anthropic.com" : "https://api.openai.com/v1");
|
|
@@ -7328,7 +7429,7 @@ var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, o
|
|
|
7328
7429
|
return result2;
|
|
7329
7430
|
}, "replyRenderer");
|
|
7330
7431
|
|
|
7331
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7432
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/replies/serve.js
|
|
7332
7433
|
var NOT_ALLOWED = "replies.send is not allow";
|
|
7333
7434
|
var NO_RULES = "no rules";
|
|
7334
7435
|
var ONLY_TASK = "opened a task, sent nothing";
|
|
@@ -7421,12 +7522,12 @@ var replyTo = /* @__PURE__ */ __name(async (deps, message) => {
|
|
|
7421
7522
|
return { skip: why };
|
|
7422
7523
|
}, "replyTo");
|
|
7423
7524
|
|
|
7424
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7525
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-catch-up.js
|
|
7425
7526
|
var START_SYNC_DELAY_MS = 3e4;
|
|
7426
7527
|
var START_SYNC_BUDGET_MS = 5 * 6e4;
|
|
7427
7528
|
var START_SYNC_WINDOW_MS = 7 * 864e5;
|
|
7428
7529
|
var START_SYNC_PER_CHAT = 500;
|
|
7429
|
-
var startSync = /* @__PURE__ */ __name(({ chats, newestHeld, fetch
|
|
7530
|
+
var startSync = /* @__PURE__ */ __name(({ chats, newestHeld, fetch, note, warn, delayMs = START_SYNC_DELAY_MS, budgetMs = START_SYNC_BUDGET_MS, windowMs = START_SYNC_WINDOW_MS, now = Date.now }) => {
|
|
7430
7531
|
const controller = new AbortController();
|
|
7431
7532
|
let timer;
|
|
7432
7533
|
let pass = Promise.resolve();
|
|
@@ -7454,7 +7555,7 @@ var startSync = /* @__PURE__ */ __name(({ chats, newestHeld, fetch: fetch2, note
|
|
|
7454
7555
|
if (stop.aborted)
|
|
7455
7556
|
break;
|
|
7456
7557
|
try {
|
|
7457
|
-
summary.fetched += (await
|
|
7558
|
+
summary.fetched += (await fetch(chat.id, Math.max(held ?? anywhere, floor), stop)).fetched;
|
|
7458
7559
|
summary.chats += 1;
|
|
7459
7560
|
} catch (error) {
|
|
7460
7561
|
if (stop.aborted)
|
|
@@ -7498,10 +7599,10 @@ var startSync = /* @__PURE__ */ __name(({ chats, newestHeld, fetch: fetch2, note
|
|
|
7498
7599
|
};
|
|
7499
7600
|
}, "startSync");
|
|
7500
7601
|
|
|
7501
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7602
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-members.js
|
|
7502
7603
|
var FIRST_FETCH_MS = 6e4;
|
|
7503
7604
|
var DAY_MS = 864e5;
|
|
7504
|
-
var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch
|
|
7605
|
+
var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch, warn, firstMs = FIRST_FETCH_MS, everyMs = DAY_MS }) => {
|
|
7505
7606
|
let timer;
|
|
7506
7607
|
let round = Promise.resolve();
|
|
7507
7608
|
let stopped = false;
|
|
@@ -7514,7 +7615,7 @@ var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch: fetch2, warn, fi
|
|
|
7514
7615
|
if (lastCount?.day === today)
|
|
7515
7616
|
continue;
|
|
7516
7617
|
try {
|
|
7517
|
-
await
|
|
7618
|
+
await fetch(store, account, chatId);
|
|
7518
7619
|
done.fetched += 1;
|
|
7519
7620
|
} catch (error) {
|
|
7520
7621
|
done.failed += 1;
|
|
@@ -7552,7 +7653,7 @@ var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch: fetch2, warn, fi
|
|
|
7552
7653
|
};
|
|
7553
7654
|
}, "memberFetches");
|
|
7554
7655
|
|
|
7555
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7656
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-notice.js
|
|
7556
7657
|
var record2 = /* @__PURE__ */ __name((context, app, severity, attributes) => recordLogFor(context.streams.diagnostic, app, { command: currentRun().command || "serve" })[severity](attributes), "record");
|
|
7557
7658
|
var noticeFor = /* @__PURE__ */ __name((context, app, severity = "warn") => ({ text, ...attributes }) => {
|
|
7558
7659
|
if (context.format === "pretty") {
|
|
@@ -7585,7 +7686,93 @@ var recordDiagnostics = /* @__PURE__ */ __name((context, app) => {
|
|
|
7585
7686
|
return context;
|
|
7586
7687
|
}, "recordDiagnostics");
|
|
7587
7688
|
|
|
7588
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7689
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-outdated.js
|
|
7690
|
+
import { existsSync as existsSync8, readFileSync as readFileSync5, realpathSync as realpathSync2 } from "node:fs";
|
|
7691
|
+
import { dirname as dirname2, join as join5 } from "node:path";
|
|
7692
|
+
var OUTDATED_CHECK_MS = 6e4;
|
|
7693
|
+
var ownPackageRoot = /* @__PURE__ */ __name((running, script = process.argv[1]) => {
|
|
7694
|
+
let dir;
|
|
7695
|
+
try {
|
|
7696
|
+
dir = dirname2(realpathSync2(script ?? ""));
|
|
7697
|
+
} catch {
|
|
7698
|
+
return void 0;
|
|
7699
|
+
}
|
|
7700
|
+
for (let up = 0; up < 8; up++) {
|
|
7701
|
+
const manifest = join5(dir, "package.json");
|
|
7702
|
+
if (existsSync8(manifest))
|
|
7703
|
+
return installedVersion(dir) === running ? dir : void 0;
|
|
7704
|
+
const parent = dirname2(dir);
|
|
7705
|
+
if (parent === dir)
|
|
7706
|
+
return void 0;
|
|
7707
|
+
dir = parent;
|
|
7708
|
+
}
|
|
7709
|
+
return void 0;
|
|
7710
|
+
}, "ownPackageRoot");
|
|
7711
|
+
var installedVersion = /* @__PURE__ */ __name((root) => {
|
|
7712
|
+
try {
|
|
7713
|
+
const { version } = JSON.parse(readFileSync5(join5(root, "package.json"), "utf8"));
|
|
7714
|
+
return typeof version === "string" ? version : void 0;
|
|
7715
|
+
} catch {
|
|
7716
|
+
return void 0;
|
|
7717
|
+
}
|
|
7718
|
+
}, "installedVersion");
|
|
7719
|
+
var newer = /* @__PURE__ */ __name((one, other) => {
|
|
7720
|
+
const parts = /* @__PURE__ */ __name((version) => version.split(/[.+-]/, 3).map(Number), "parts");
|
|
7721
|
+
const [a, b] = [parts(one), parts(other)];
|
|
7722
|
+
for (let i = 0; i < 3; i++)
|
|
7723
|
+
if ((a[i] ?? 0) !== (b[i] ?? 0))
|
|
7724
|
+
return (a[i] ?? 0) > (b[i] ?? 0);
|
|
7725
|
+
return false;
|
|
7726
|
+
}, "newer");
|
|
7727
|
+
var outdatedReason = /* @__PURE__ */ __name(async ({ command, running, storePath: storePath2, packageRoot, speaks = SPEAKS }) => {
|
|
7728
|
+
const installed = packageRoot === void 0 ? void 0 : installedVersion(packageRoot);
|
|
7729
|
+
if (installed !== void 0 && newer(installed, running))
|
|
7730
|
+
return `${command} ${installed} is installed and this serve runs ${running}: stopping so it starts again on ${installed}`;
|
|
7731
|
+
if (!existsSync8(storePath2))
|
|
7732
|
+
return void 0;
|
|
7733
|
+
let schema;
|
|
7734
|
+
try {
|
|
7735
|
+
const { database } = await openSqlite(storePath2, { readOnly: true });
|
|
7736
|
+
try {
|
|
7737
|
+
schema = fileSchemaOf(database);
|
|
7738
|
+
} finally {
|
|
7739
|
+
database.close();
|
|
7740
|
+
}
|
|
7741
|
+
} catch {
|
|
7742
|
+
return void 0;
|
|
7743
|
+
}
|
|
7744
|
+
if (writableBy(schema, speaks))
|
|
7745
|
+
return void 0;
|
|
7746
|
+
return `the store is at format ${schema.version} and needs at least ${schema.minCompatible}; this serve (${command} ${running}) speaks ${speaks} and can no longer write it: stopping \u2014 \`${command} upgrade\` if it does not start again on a newer version`;
|
|
7747
|
+
}, "outdatedReason");
|
|
7748
|
+
var watchOutdated = /* @__PURE__ */ __name(({ check: check2, onOutdated, everyMs = OUTDATED_CHECK_MS }) => {
|
|
7749
|
+
let busy = false;
|
|
7750
|
+
let done = false;
|
|
7751
|
+
const timer = setInterval(() => {
|
|
7752
|
+
if (busy || done)
|
|
7753
|
+
return;
|
|
7754
|
+
busy = true;
|
|
7755
|
+
check2().then((reason) => {
|
|
7756
|
+
if (reason === void 0 || done)
|
|
7757
|
+
return;
|
|
7758
|
+
done = true;
|
|
7759
|
+
clearInterval(timer);
|
|
7760
|
+
onOutdated(reason);
|
|
7761
|
+
}).catch(() => {
|
|
7762
|
+
}).finally(() => {
|
|
7763
|
+
busy = false;
|
|
7764
|
+
});
|
|
7765
|
+
}, everyMs);
|
|
7766
|
+
timer.unref();
|
|
7767
|
+
return {
|
|
7768
|
+
stop: /* @__PURE__ */ __name(() => {
|
|
7769
|
+
done = true;
|
|
7770
|
+
clearInterval(timer);
|
|
7771
|
+
}, "stop")
|
|
7772
|
+
};
|
|
7773
|
+
}, "watchOutdated");
|
|
7774
|
+
|
|
7775
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-stems.js
|
|
7589
7776
|
var STEMS_EVERY_MS = 3e4;
|
|
7590
7777
|
var STEMS_SLICE_MS = 2e3;
|
|
7591
7778
|
var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY_MS, sliceMs = STEMS_SLICE_MS }) => {
|
|
@@ -7625,7 +7812,7 @@ var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY
|
|
|
7625
7812
|
};
|
|
7626
7813
|
}, "stemFills");
|
|
7627
7814
|
|
|
7628
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7815
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/cli/messenger/message-items.js
|
|
7629
7816
|
var defined = /* @__PURE__ */ __name((value) => Object.fromEntries(Object.entries(value).filter(([, one]) => one !== void 0)), "defined");
|
|
7630
7817
|
var attachmentItem = /* @__PURE__ */ __name((attachment) => defined({
|
|
7631
7818
|
kind: attachment.kind,
|
|
@@ -7644,7 +7831,7 @@ var attachmentItem = /* @__PURE__ */ __name((attachment) => defined({
|
|
|
7644
7831
|
phone: attachment.contact.phone,
|
|
7645
7832
|
user_id: attachment.contact.userId
|
|
7646
7833
|
}),
|
|
7647
|
-
buttons: attachment.buttons
|
|
7834
|
+
buttons: attachment.buttons?.map((row) => row.map(({ data: _data, ...button }) => button))
|
|
7648
7835
|
}), "attachmentItem");
|
|
7649
7836
|
var quotedItem = /* @__PURE__ */ __name((quoted) => quoted === null ? null : {
|
|
7650
7837
|
id: quoted.id,
|
|
@@ -7720,7 +7907,7 @@ var viewOf = /* @__PURE__ */ __name((context, messenger) => ({
|
|
|
7720
7907
|
locale: messenger.app.locale
|
|
7721
7908
|
}), "viewOf");
|
|
7722
7909
|
|
|
7723
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7910
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-answers.js
|
|
7724
7911
|
var observed = /* @__PURE__ */ __name((value) => ({
|
|
7725
7912
|
value: value.value,
|
|
7726
7913
|
observed_at: value.observedAt,
|
|
@@ -7787,7 +7974,7 @@ var watchEventItem = /* @__PURE__ */ __name((value, account) => {
|
|
|
7787
7974
|
}
|
|
7788
7975
|
}, "watchEventItem");
|
|
7789
7976
|
|
|
7790
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7977
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-command.js
|
|
7791
7978
|
var watchCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("watch"), {
|
|
7792
7979
|
output: { entity: "watch_item" },
|
|
7793
7980
|
effects: REMOTE_READ,
|
|
@@ -7942,7 +8129,7 @@ var describe = /* @__PURE__ */ __name((event, render) => {
|
|
|
7942
8129
|
}
|
|
7943
8130
|
}, "describe");
|
|
7944
8131
|
|
|
7945
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
8132
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-command.js
|
|
7946
8133
|
var serveCommand = /* @__PURE__ */ __name((messenger) => {
|
|
7947
8134
|
const command = annotate(new Command("serve"), {
|
|
7948
8135
|
output: { entity: "serve_summary" },
|
|
@@ -7966,8 +8153,8 @@ var serveCommand = /* @__PURE__ */ __name((messenger) => {
|
|
|
7966
8153
|
}
|
|
7967
8154
|
let relaying;
|
|
7968
8155
|
const onReady = /* @__PURE__ */ __name(() => {
|
|
7969
|
-
const
|
|
7970
|
-
holdLock(path,
|
|
8156
|
+
const listening2 = { pid: process.pid, startedAt, version, listeningAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
8157
|
+
holdLock(path, listening2);
|
|
7971
8158
|
note({
|
|
7972
8159
|
code: "listening",
|
|
7973
8160
|
text: `listening for profile ${context.profile}, catching up on what arrived while it was down`
|
|
@@ -7976,7 +8163,7 @@ var serveCommand = /* @__PURE__ */ __name((messenger) => {
|
|
|
7976
8163
|
return;
|
|
7977
8164
|
relaying = relay.open(path, context.profile).then((address) => {
|
|
7978
8165
|
if (address)
|
|
7979
|
-
holdLock(path, { ...
|
|
8166
|
+
holdLock(path, { ...listening2, relay: address });
|
|
7980
8167
|
}).catch((error) => {
|
|
7981
8168
|
const errorCode = failureKey(error);
|
|
7982
8169
|
warn({ code: "relay_failed", errorCode, text: `commands cannot run through this serve: ${errorCode}` });
|
|
@@ -7985,7 +8172,7 @@ var serveCommand = /* @__PURE__ */ __name((messenger) => {
|
|
|
7985
8172
|
const counts = {};
|
|
7986
8173
|
const rules = replying(context, messenger, Date.parse(startedAt));
|
|
7987
8174
|
const tasks = tasking(context, warn);
|
|
7988
|
-
const { handled, startSyncDelayMs } = environmentOf(this);
|
|
8175
|
+
const { handled, startSyncDelayMs, outdated: outdatedHook } = environmentOf(this);
|
|
7989
8176
|
const count3 = /* @__PURE__ */ __name((event) => {
|
|
7990
8177
|
counts[event.event] = (counts[event.event] ?? 0) + 1;
|
|
7991
8178
|
if (event.event === "message") {
|
|
@@ -8057,9 +8244,25 @@ var serveCommand = /* @__PURE__ */ __name((messenger) => {
|
|
|
8057
8244
|
withStore: /* @__PURE__ */ __name((work) => context.withStore((store) => work(store), { name: "serve stems" }), "withStore"),
|
|
8058
8245
|
warn
|
|
8059
8246
|
});
|
|
8247
|
+
const listening = new AbortController();
|
|
8248
|
+
let outdated;
|
|
8249
|
+
const packageRoot = outdatedHook?.packageRoot ?? ownPackageRoot(version);
|
|
8250
|
+
const watch = watchOutdated({
|
|
8251
|
+
check: /* @__PURE__ */ __name(() => outdatedReason({
|
|
8252
|
+
command: messenger.app.command,
|
|
8253
|
+
running: version,
|
|
8254
|
+
storePath: storePath(context.env),
|
|
8255
|
+
packageRoot
|
|
8256
|
+
}), "check"),
|
|
8257
|
+
onOutdated: /* @__PURE__ */ __name((reason) => {
|
|
8258
|
+
outdated = reason;
|
|
8259
|
+
listening.abort();
|
|
8260
|
+
}, "onOutdated"),
|
|
8261
|
+
...outdatedHook?.everyMs === void 0 ? {} : { everyMs: outdatedHook.everyMs }
|
|
8262
|
+
});
|
|
8060
8263
|
try {
|
|
8061
8264
|
await listenUntilStopped(this, context, relay?.messenger ?? messenger, count3, {
|
|
8062
|
-
stop:
|
|
8265
|
+
stop: listening,
|
|
8063
8266
|
catchUp: true,
|
|
8064
8267
|
onReady,
|
|
8065
8268
|
connected: /* @__PURE__ */ __name((open) => {
|
|
@@ -8072,6 +8275,7 @@ var serveCommand = /* @__PURE__ */ __name((messenger) => {
|
|
|
8072
8275
|
}, "connected")
|
|
8073
8276
|
});
|
|
8074
8277
|
} finally {
|
|
8278
|
+
watch.stop();
|
|
8075
8279
|
await relaying;
|
|
8076
8280
|
await relay?.close();
|
|
8077
8281
|
rules.stop();
|
|
@@ -8082,6 +8286,8 @@ var serveCommand = /* @__PURE__ */ __name((messenger) => {
|
|
|
8082
8286
|
await tasks.settled();
|
|
8083
8287
|
releaseLock(path);
|
|
8084
8288
|
}
|
|
8289
|
+
if (outdated !== void 0)
|
|
8290
|
+
throw new CliError("configuration_error", outdated, { reason: "serve.outdated" });
|
|
8085
8291
|
renderAnswer(this, context, itemOf({
|
|
8086
8292
|
profile: context.profile,
|
|
8087
8293
|
started_at: startedAt,
|
|
@@ -8206,8 +8412,8 @@ var tasking = /* @__PURE__ */ __name((context, warn) => {
|
|
|
8206
8412
|
};
|
|
8207
8413
|
}, "tasking");
|
|
8208
8414
|
|
|
8209
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
8210
|
-
import { existsSync as
|
|
8415
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/cli/messenger/store-tables-command.js
|
|
8416
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
8211
8417
|
var PATH = "store tables list";
|
|
8212
8418
|
var STORE_TABLES_QUERY = {
|
|
8213
8419
|
entity: "store_table",
|
|
@@ -8236,7 +8442,7 @@ var storeTablesCommand = /* @__PURE__ */ __name((messenger) => {
|
|
|
8236
8442
|
const filter = filterOf(words);
|
|
8237
8443
|
const { full } = this.optsWithGlobals();
|
|
8238
8444
|
const path = storePath(environmentOf(this).env ?? process.env);
|
|
8239
|
-
if (!
|
|
8445
|
+
if (!existsSync9(path))
|
|
8240
8446
|
throw new CliError("not_found", `no store at ${path}`);
|
|
8241
8447
|
const items = await readStoreTables(path, { filter, sizes: full === true });
|
|
8242
8448
|
renderAnswer(this, outputFor(this), listOf(PATH, {
|
|
@@ -8249,7 +8455,7 @@ var storeTablesCommand = /* @__PURE__ */ __name((messenger) => {
|
|
|
8249
8455
|
return tables;
|
|
8250
8456
|
}, "storeTablesCommand");
|
|
8251
8457
|
|
|
8252
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
8458
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.620.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_737712cd0065e7e21fd5896a79d0773d/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
|
|
8253
8459
|
var SEARCH_INDEXES = ["messages_fts", "chats_fts", "identities_fts"];
|
|
8254
8460
|
var WORD_INDEX = "message_words";
|
|
8255
8461
|
var schemaOf = /* @__PURE__ */ __name((database) => {
|
|
@@ -8258,7 +8464,7 @@ var schemaOf = /* @__PURE__ */ __name((database) => {
|
|
|
8258
8464
|
}, "schemaOf");
|
|
8259
8465
|
var count2 = /* @__PURE__ */ __name((database, table) => Number(database.prepare(`SELECT count(*) AS n FROM ${table}`).get()?.n ?? 0), "count");
|
|
8260
8466
|
var pendingIfKnown2 = /* @__PURE__ */ __name((database) => database.prepare("SELECT 1 FROM pragma_table_info('messages') WHERE name = 'normalized_text'").get() ? pendingNormalization(database) : null, "pendingIfKnown");
|
|
8261
|
-
var bytesOf2 = /* @__PURE__ */ __name((path) =>
|
|
8467
|
+
var bytesOf2 = /* @__PURE__ */ __name((path) => existsSync10(path) ? statSync4(path).size : 0, "bytesOf");
|
|
8262
8468
|
var reading = /* @__PURE__ */ __name(async (path, read) => {
|
|
8263
8469
|
const database = await openCache(path);
|
|
8264
8470
|
try {
|
|
@@ -8285,9 +8491,10 @@ var fileSchema = /* @__PURE__ */ __name(async (path) => {
|
|
|
8285
8491
|
}, "fileSchema");
|
|
8286
8492
|
var storeSummary = /* @__PURE__ */ __name(async (env, { deep = false, command, version } = {}) => {
|
|
8287
8493
|
const path = storePath(env);
|
|
8288
|
-
if (!
|
|
8494
|
+
if (!existsSync10(path))
|
|
8289
8495
|
return { path, exists: false };
|
|
8290
8496
|
const checked = await storeHealth(path, { deep });
|
|
8497
|
+
const journal = readJournalMark(path);
|
|
8291
8498
|
const recorded = deep ? recordDeepCheck(path, checked, {
|
|
8292
8499
|
cli: command ?? "unknown",
|
|
8293
8500
|
...version ? { version } : {},
|
|
@@ -8305,13 +8512,15 @@ var storeSummary = /* @__PURE__ */ __name(async (env, { deep = false, command, v
|
|
|
8305
8512
|
...checked.invalidJson?.length ? { invalidJson: checked.invalidJson } : {},
|
|
8306
8513
|
...checked.searchIndexes?.some((index) => !index.ok) ? { damagedSearchIndexes: checked.searchIndexes.filter((index) => !index.ok).map((index) => index.name) } : {}
|
|
8307
8514
|
};
|
|
8308
|
-
const damage = command ?
|
|
8515
|
+
const damage = command ? storeDamageReport({ health: checked, command, mark, journal, lastOkAt: lastKnownGood }) : null;
|
|
8309
8516
|
const healthOf = {
|
|
8310
8517
|
health,
|
|
8311
8518
|
lastKnownGood,
|
|
8312
8519
|
...mark ? { damageMark: withoutInode(mark) } : {},
|
|
8520
|
+
...journal ? { journalMark: journal } : {},
|
|
8313
8521
|
...recorded?.cleared ? { damageMarkCleared: withoutInode(recorded.cleared) } : {},
|
|
8314
|
-
|
|
8522
|
+
// `what` keeps memo's doctor, which reads it, compiling until it moves to `whatHappened`.
|
|
8523
|
+
...damage ? { damage: { what: damage.whatHappened, ...damage } } : {}
|
|
8315
8524
|
};
|
|
8316
8525
|
try {
|
|
8317
8526
|
return await reading(path, (database) => {
|
|
@@ -8355,7 +8564,7 @@ var repairCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("
|
|
|
8355
8564
|
const { renderer, format } = outputFor(this);
|
|
8356
8565
|
const { dryRun: dryRun2 } = this.opts();
|
|
8357
8566
|
const path = storePath(environmentOf(this).env ?? process.env);
|
|
8358
|
-
if (!
|
|
8567
|
+
if (!existsSync10(path)) {
|
|
8359
8568
|
result(this, { path, exists: false });
|
|
8360
8569
|
return;
|
|
8361
8570
|
}
|
|
@@ -8395,7 +8604,7 @@ var notesOf = /* @__PURE__ */ __name((report, command) => {
|
|
|
8395
8604
|
}, "notesOf");
|
|
8396
8605
|
var copiesCommand = /* @__PURE__ */ __name(() => new Command("copies").description("the tables `store repair` kept as copies").addCommand(annotate(new Command("delete"), { output: { entity: "store_copy_removal" }, effects: LOCAL_WRITE }).description("delete one copy `store repair` kept, named exactly; refuses any other table").argument("<name>", "the copy's name, as `store repair` printed it").action(async function(name) {
|
|
8397
8606
|
const path = storePath(environmentOf(this).env ?? process.env);
|
|
8398
|
-
if (!
|
|
8607
|
+
if (!existsSync10(path))
|
|
8399
8608
|
throw new CliError("not_found", `no store at ${path}`);
|
|
8400
8609
|
const deleted = await reading(path, (database) => deleteCopy(database, name));
|
|
8401
8610
|
result(this, { path, deleted });
|
|
@@ -8403,7 +8612,7 @@ var copiesCommand = /* @__PURE__ */ __name(() => new Command("copies").descripti
|
|
|
8403
8612
|
var checkCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("check"), { output: { entity: "store_check" }, effects: LOCAL_READ }).summary("check the local archive for problems").description("whether the store is healthy \u2014 integrity, search indexes, disk, and which chats are behind").action(async function() {
|
|
8404
8613
|
const { renderer } = outputFor(this);
|
|
8405
8614
|
const path = storePath(environmentOf(this).env ?? process.env);
|
|
8406
|
-
if (!
|
|
8615
|
+
if (!existsSync10(path)) {
|
|
8407
8616
|
result(this, { path, exists: false, ok: true });
|
|
8408
8617
|
return;
|
|
8409
8618
|
}
|
|
@@ -8466,7 +8675,7 @@ var inspect = /* @__PURE__ */ __name((path) => reading(path, (database) => {
|
|
|
8466
8675
|
...schema.version > 0 ? [["attachment_words", indexIntegrity(database, "attachment_words", 0)]] : []
|
|
8467
8676
|
]);
|
|
8468
8677
|
const size = bytesOf2(path) + bytesOf2(`${path}-wal`);
|
|
8469
|
-
const { bavail, bsize } = statfsSync2(
|
|
8678
|
+
const { bavail, bsize } = statfsSync2(dirname3(path));
|
|
8470
8679
|
const free = Number(bavail) * Number(bsize);
|
|
8471
8680
|
const behind = schema.version > 0 ? chatsBehind(database) : [];
|
|
8472
8681
|
const vectorIndexes = schema.version >= 34 ? vectorIndexCounts(database) : [];
|
|
@@ -8554,7 +8763,7 @@ var chatsBehind = /* @__PURE__ */ __name((database) => database.prepare(`SELECT
|
|
|
8554
8763
|
var migrateCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("migrate"), { output: { entity: "store_migration" }, effects: LOCAL_WRITE }).summary("migrate an older local archive").description("bring the store up to this build's schema, then normalize, index and stem the messages and notes stored before it").action(async function() {
|
|
8555
8764
|
const { renderer } = outputFor(this);
|
|
8556
8765
|
const path = storePath(environmentOf(this).env ?? process.env);
|
|
8557
|
-
if (!
|
|
8766
|
+
if (!existsSync10(path)) {
|
|
8558
8767
|
result(this, { path, exists: false });
|
|
8559
8768
|
renderer.note(`no store yet \u2014 the first \`${messenger.app.command}\` command that reads a chat creates it`);
|
|
8560
8769
|
return;
|
|
@@ -8618,7 +8827,7 @@ var buildNoteIndex = /* @__PURE__ */ __name((database, note, { reset = false } =
|
|
|
8618
8827
|
var reindexCommand = /* @__PURE__ */ __name((messenger) => destroysNothing(annotate(new Command("rebuild"), { output: { entity: "store_reindex" }, effects: LOCAL_WRITE })).summary("rebuild the local archive's search indexes").description("rebuild the word index, its typo vocabulary, the stems, the files' word index, the notes' indexes and who took part in what, from what is stored, and drop the vectors no stored text uses; loses nothing").action(async function() {
|
|
8619
8828
|
const { renderer } = outputFor(this);
|
|
8620
8829
|
const path = storePath(environmentOf(this).env ?? process.env);
|
|
8621
|
-
if (!
|
|
8830
|
+
if (!existsSync10(path)) {
|
|
8622
8831
|
result(this, { path, exists: false });
|
|
8623
8832
|
return;
|
|
8624
8833
|
}
|
|
@@ -8660,9 +8869,9 @@ var backupCommand = /* @__PURE__ */ __name(() => destroysNothing(annotate(new Co
|
|
|
8660
8869
|
const { encrypt } = this.opts();
|
|
8661
8870
|
const path = storePath(environmentOf(this).env ?? process.env);
|
|
8662
8871
|
const target = resolve(file2);
|
|
8663
|
-
if (!
|
|
8872
|
+
if (!existsSync10(path))
|
|
8664
8873
|
throw new CliError("not_found", `no store at ${path} to back up`);
|
|
8665
|
-
if (
|
|
8874
|
+
if (existsSync10(target))
|
|
8666
8875
|
throw new CliError("validation_error", `${target} exists \u2014 a backup never overwrites a file`);
|
|
8667
8876
|
const password = encrypt ? await passwordOf(this, { twice: true }) : void 0;
|
|
8668
8877
|
const copyAt = password === void 0 ? target : `${path}.backup-${process.pid}`;
|
|
@@ -8695,11 +8904,11 @@ var decryptCommand = /* @__PURE__ */ __name(() => annotate(new Command("decrypt"
|
|
|
8695
8904
|
const { output } = this.opts();
|
|
8696
8905
|
const from = resolve(file2);
|
|
8697
8906
|
const to = resolve(output);
|
|
8698
|
-
if (!
|
|
8907
|
+
if (!existsSync10(from))
|
|
8699
8908
|
throw new CliError("not_found", `no file at ${from}`);
|
|
8700
8909
|
if (!isSealed(from))
|
|
8701
8910
|
throw new CliError("validation_error", `${from} was not written with --encrypt`);
|
|
8702
|
-
if (
|
|
8911
|
+
if (existsSync10(to))
|
|
8703
8912
|
throw new CliError("validation_error", `${to} exists \u2014 never overwritten`);
|
|
8704
8913
|
await unsealFile(from, to, await passwordOf(this, { twice: false }));
|
|
8705
8914
|
result(this, { path: to, from, bytes: bytesOf2(to) });
|
|
@@ -8707,13 +8916,13 @@ var decryptCommand = /* @__PURE__ */ __name(() => annotate(new Command("decrypt"
|
|
|
8707
8916
|
var restoreCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("restore"), { output: { entity: "store_restore" }, effects: LOCAL_WRITE }).summary("restore a backup and keep the current store, or roll back a breaking upgrade").description("put a backup in place of the store; the store it replaces is kept beside it, never deleted. Given a rollback copy (backups/<store>-rollback-schema-<version>-<time>.db, kept for a day before an upgrade older tools cannot open), put its tables back in the store and return it to that version instead").argument("<file>", "a file `store backup` wrote, or a rollback copy; one written with --encrypt asks for its password").action(async function(file2) {
|
|
8708
8917
|
const path = storePath(environmentOf(this).env ?? process.env);
|
|
8709
8918
|
const given = resolve(file2);
|
|
8710
|
-
if (!
|
|
8919
|
+
if (!existsSync10(given))
|
|
8711
8920
|
throw new CliError("not_found", `no file at ${given}`);
|
|
8712
8921
|
refuseWhileServing(this, messenger);
|
|
8713
8922
|
if (!isSealed(given))
|
|
8714
8923
|
return restoreFrom(this, messenger, given, given);
|
|
8715
8924
|
const opened = `${path}.unsealing-${process.pid}`;
|
|
8716
|
-
mkdirSync(
|
|
8925
|
+
mkdirSync(dirname3(path), { recursive: true, mode: 448 });
|
|
8717
8926
|
try {
|
|
8718
8927
|
await unsealFile(given, opened, await passwordOf(this, { twice: false }));
|
|
8719
8928
|
await restoreFrom(this, messenger, opened, given);
|
|
@@ -8724,26 +8933,26 @@ var restoreCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command(
|
|
|
8724
8933
|
var restoreFrom = /* @__PURE__ */ __name(async (command, messenger, backup, given) => {
|
|
8725
8934
|
const { renderer } = outputFor(command);
|
|
8726
8935
|
const path = storePath(environmentOf(command).env ?? process.env);
|
|
8727
|
-
if (
|
|
8936
|
+
if (existsSync10(path) && realpathSync3(backup) === realpathSync3(path)) {
|
|
8728
8937
|
throw new CliError("validation_error", `${backup} is the store itself`);
|
|
8729
8938
|
}
|
|
8730
8939
|
if (await isRollbackCopy(backup))
|
|
8731
8940
|
return rollBackFrom(command, messenger, backup);
|
|
8732
8941
|
const schema = await backupSchema(backup);
|
|
8733
8942
|
const stamp = stampNow();
|
|
8734
|
-
const kept =
|
|
8943
|
+
const kept = existsSync10(path) ? `${path}.before-restore-${stamp}` : null;
|
|
8735
8944
|
if (kept) {
|
|
8736
8945
|
const waitMs = environmentOf(command).storeLockWaitMs;
|
|
8737
8946
|
await quiesce(path, messenger, "restore", (message) => renderer.warn(message), waitMs);
|
|
8738
8947
|
} else
|
|
8739
|
-
mkdirSync(
|
|
8948
|
+
mkdirSync(dirname3(path), { recursive: true, mode: 448 });
|
|
8740
8949
|
const incoming = `${path}.restoring-${stamp}`;
|
|
8741
8950
|
copyFileSync(backup, incoming, constants.COPYFILE_EXCL);
|
|
8742
8951
|
chmodSync(incoming, 384);
|
|
8743
8952
|
if (kept) {
|
|
8744
8953
|
renameSync3(path, kept);
|
|
8745
8954
|
for (const suffix of ["-wal", "-shm"])
|
|
8746
|
-
if (
|
|
8955
|
+
if (existsSync10(`${path}${suffix}`))
|
|
8747
8956
|
renameSync3(`${path}${suffix}`, `${kept}${suffix}`);
|
|
8748
8957
|
}
|
|
8749
8958
|
renameSync3(incoming, path);
|
|
@@ -8765,7 +8974,7 @@ var isRollbackCopy = /* @__PURE__ */ __name(async (file2) => {
|
|
|
8765
8974
|
var rollBackFrom = /* @__PURE__ */ __name(async (command, messenger, copy) => {
|
|
8766
8975
|
const { renderer } = outputFor(command);
|
|
8767
8976
|
const path = storePath(environmentOf(command).env ?? process.env);
|
|
8768
|
-
if (!
|
|
8977
|
+
if (!existsSync10(path))
|
|
8769
8978
|
throw new CliError("not_found", `no store at ${path} to roll back`);
|
|
8770
8979
|
const waitMs = environmentOf(command).storeLockWaitMs;
|
|
8771
8980
|
await quiesce(path, messenger, "restore", (message) => renderer.warn(message), waitMs);
|
|
@@ -8815,7 +9024,7 @@ var backupSchema = /* @__PURE__ */ __name(async (backup) => {
|
|
|
8815
9024
|
var STORE_LOCK_WAIT_MS = 1e3;
|
|
8816
9025
|
var quiesce = /* @__PURE__ */ __name(async (path, messenger, then, warn, waitMs = STORE_LOCK_WAIT_MS) => {
|
|
8817
9026
|
const { command } = messenger.app;
|
|
8818
|
-
const files = [path, `${path}-wal`, `${path}-shm`].filter((file2) =>
|
|
9027
|
+
const files = [path, `${path}-wal`, `${path}-shm`].filter((file2) => existsSync10(file2)).map((file2) => realpathSync3(file2));
|
|
8819
9028
|
const holders = holdersOf(files);
|
|
8820
9029
|
if (holders === void 0) {
|
|
8821
9030
|
warn(`this system cannot say which processes have the store open \u2014 restart every running serve and mcp after this`);
|
|
@@ -8841,7 +9050,7 @@ var resetCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("r
|
|
|
8841
9050
|
const { command } = messenger.app;
|
|
8842
9051
|
const env = environmentOf(this).env ?? process.env;
|
|
8843
9052
|
const path = storePath(env);
|
|
8844
|
-
if (!
|
|
9053
|
+
if (!existsSync10(path)) {
|
|
8845
9054
|
result(this, { path, exists: false, reset: false });
|
|
8846
9055
|
renderer.note(`no store at ${path} \u2014 nothing to reset; the first \`${command}\` command that reads a chat creates it`);
|
|
8847
9056
|
return;
|
|
@@ -8886,8 +9095,8 @@ var resetCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("r
|
|
|
8886
9095
|
}), "resetCommand");
|
|
8887
9096
|
var STORE_PARTS2 = ["", "-wal", "-shm"];
|
|
8888
9097
|
var resetPreview = /* @__PURE__ */ __name(async (path, messenger, env, keep) => {
|
|
8889
|
-
const files = STORE_PARTS2.map((suffix) => `${path}${suffix}`).filter((file2) =>
|
|
8890
|
-
const holders = holdersOf(files.map((file2) =>
|
|
9098
|
+
const files = STORE_PARTS2.map((suffix) => `${path}${suffix}`).filter((file2) => existsSync10(file2));
|
|
9099
|
+
const holders = holdersOf(files.map((file2) => realpathSync3(file2)));
|
|
8891
9100
|
const serving = servingProfiles(messenger.app, env).length > 0;
|
|
8892
9101
|
const read = await readingOnly(path, (database) => ({
|
|
8893
9102
|
schema: schemaOf(database).version,
|
|
@@ -8940,12 +9149,10 @@ export {
|
|
|
8940
9149
|
readRepliesState,
|
|
8941
9150
|
writeRepliesState,
|
|
8942
9151
|
paused,
|
|
9152
|
+
safeLiquid,
|
|
8943
9153
|
DRY_RUN_DAYS,
|
|
8944
9154
|
dryRun,
|
|
8945
9155
|
senderFacts,
|
|
8946
|
-
endpointKeyName,
|
|
8947
|
-
embeddingKeys,
|
|
8948
|
-
modelGateway,
|
|
8949
9156
|
replyConsentPathFor,
|
|
8950
9157
|
readReplyConsent,
|
|
8951
9158
|
writeReplyConsent,
|
|
@@ -8959,6 +9166,10 @@ export {
|
|
|
8959
9166
|
FIRST_FETCH_MS,
|
|
8960
9167
|
DAY_MS,
|
|
8961
9168
|
memberFetches,
|
|
9169
|
+
OUTDATED_CHECK_MS,
|
|
9170
|
+
ownPackageRoot,
|
|
9171
|
+
outdatedReason,
|
|
9172
|
+
watchOutdated,
|
|
8962
9173
|
STEMS_EVERY_MS,
|
|
8963
9174
|
STEMS_SLICE_MS,
|
|
8964
9175
|
stemFills,
|