@wirecat/drive-cli 0.62.0 → 0.64.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 +2 -1
- package/dist/bin/drive.js +2 -2
- package/dist/bundle/{all-profiles-CKD2DWUK.js → all-profiles-BPPT2AK5.js} +13 -14
- package/dist/bundle/{anthropic-E3T4USLA.js → anthropic-JW6GOJUD.js} +13 -11
- package/dist/bundle/{app-server-JB2AEWWL.js → app-server-KAQIOJMZ.js} +53 -54
- package/dist/bundle/{bun-CC44AAND.js → bun-UT7GNTPV.js} +2 -2
- package/dist/bundle/{bun-sqlite-AUMFKYVR.js → bun-sqlite-2OIVV3LS.js} +8 -8
- package/dist/bundle/{chunk-EOOGWUTP.js → chunk-2FEZ24DK.js} +10 -10
- package/dist/bundle/{chunk-N7OZPKU7.js → chunk-2W464HAE.js} +4 -4
- package/dist/bundle/{chunk-UGXN5D7U.js → chunk-34BIDKF4.js} +332 -430
- package/dist/bundle/{chunk-WZKEU7WR.js → chunk-36GPBPWM.js} +1 -1
- package/dist/bundle/{chunk-LQKD257P.js → chunk-3J5KAFNA.js} +2255 -1125
- package/dist/bundle/{chunk-7W5HYGVW.js → chunk-3NULZGQU.js} +2 -2
- package/dist/bundle/{chunk-XFRRKZHQ.js → chunk-46CD64J2.js} +155 -36
- package/dist/bundle/{chunk-DWJHL6DV.js → chunk-4CNTID2X.js} +4 -4
- package/dist/bundle/{chunk-LWE4JGRN.js → chunk-4YRENUB5.js} +2 -2
- package/dist/bundle/{chunk-SW4I5BR7.js → chunk-5HSRQ53R.js} +2 -2
- package/dist/bundle/{chunk-IR4SQLBR.js → chunk-5OFA5EXE.js} +2 -2
- package/dist/bundle/{chunk-R347FPYU.js → chunk-5ZBR55US.js} +1 -1
- package/dist/bundle/{chunk-Q2LRPOKL.js → chunk-66AF4FBW.js} +4 -4
- package/dist/bundle/{chunk-RWSXVCSG.js → chunk-6B37XO6B.js} +23 -5
- package/dist/bundle/{chunk-ZMOUUOT2.js → chunk-6G53ZFUT.js} +1 -1
- package/dist/bundle/{chunk-HCNQT3QE.js → chunk-AHB4OJCI.js} +1951 -580
- package/dist/bundle/{chunk-JK3U25QZ.js → chunk-B67BLRAI.js} +59 -1
- package/dist/bundle/{chunk-7ZXIWZQ6.js → chunk-B7XBIOMR.js} +12 -12
- package/dist/bundle/{chunk-FEZF3TII.js → chunk-BDYWZ7JE.js} +50 -6
- package/dist/bundle/{chunk-SVPCHFKI.js → chunk-BEUAICUD.js} +2 -2
- package/dist/bundle/{chunk-TDX4GZFO.js → chunk-BEZJA44H.js} +7 -7
- package/dist/bundle/{chunk-RIDQNVZM.js → chunk-BZ2ZKILM.js} +3 -3
- package/dist/bundle/{chunk-FUITWY7O.js → chunk-C7WBNOYW.js} +1 -1
- package/dist/bundle/{chunk-CJHY5YIF.js → chunk-CPMRM3GQ.js} +489 -210
- package/dist/bundle/{chunk-FNWIJ6EJ.js → chunk-DD7EFG6B.js} +2 -2
- package/dist/bundle/{chunk-W4RTIL7S.js → chunk-E2LBCCTG.js} +5 -5
- package/dist/bundle/{chunk-O2XOX4HB.js → chunk-EC2XGDKJ.js} +50 -34
- package/dist/bundle/{chunk-4OSSOWDM.js → chunk-EJ4PNHPP.js} +1 -1
- package/dist/bundle/{chunk-XS5POQST.js → chunk-EQEGJVO2.js} +1 -1
- package/dist/bundle/{chunk-U2BFYSQV.js → chunk-EWGVDFPT.js} +8983 -3343
- package/dist/bundle/{chunk-OBH5BA62.js → chunk-EZ6O3ST3.js} +3 -3
- package/dist/bundle/{chunk-HG6CAYJH.js → chunk-F2VDAG32.js} +3 -3
- package/dist/bundle/{chunk-RPMKG63Z.js → chunk-G3NULXOM.js} +4 -4
- package/dist/bundle/{chunk-OD4U7GUY.js → chunk-G4KEKKDE.js} +20 -20
- package/dist/bundle/{chunk-OTROVC4E.js → chunk-GSMYXGFR.js} +1 -1
- package/dist/bundle/{chunk-XZUS7XRO.js → chunk-GW3U6OLD.js} +1 -1
- package/dist/bundle/{chunk-6EY46GAN.js → chunk-HW4UPST2.js} +2 -2
- package/dist/bundle/{chunk-2HF2MRXI.js → chunk-IDAK4DDK.js} +1 -1
- package/dist/bundle/{chunk-27YUUGXQ.js → chunk-IK6KH3RE.js} +1 -1
- package/dist/bundle/{chunk-QTI6IVHZ.js → chunk-IX7NQJLY.js} +8 -8
- package/dist/bundle/{chunk-YMWENGKH.js → chunk-J62DI53V.js} +1 -1
- package/dist/bundle/{chunk-AH5C3D3D.js → chunk-JRXFW7HE.js} +5 -5
- package/dist/bundle/{chunk-KLFSRKHB.js → chunk-K6BSB53R.js} +1 -1
- package/dist/bundle/{chunk-ONP2IBHY.js → chunk-KE4XPPRQ.js} +98 -81
- package/dist/bundle/{chunk-UQLWMGSD.js → chunk-KG2XKEHL.js} +5 -5
- package/dist/bundle/{chunk-T5NWWXS2.js → chunk-KIN6PDFE.js} +24 -2
- package/dist/bundle/{chunk-QH7DOVO3.js → chunk-KVW4XNKB.js} +45 -29
- package/dist/bundle/{chunk-PEQA6LA5.js → chunk-LOMW6F2E.js} +230 -236
- package/dist/bundle/{chunk-4SIZEJ3M.js → chunk-M73NNJ3X.js} +2 -2
- package/dist/bundle/{chunk-QCKZ3GAA.js → chunk-N622LRPM.js} +4 -4
- package/dist/bundle/{chunk-YPFUYQDP.js → chunk-O2QO5UZC.js} +13 -13
- package/dist/bundle/{chunk-QCX6XZLA.js → chunk-OEVHZOHC.js} +12 -12
- package/dist/bundle/{chunk-VAYB52HF.js → chunk-OH3K2E7X.js} +402 -184
- package/dist/bundle/{chunk-YXYTY4GF.js → chunk-P7DEGRZA.js} +21 -21
- package/dist/bundle/{chunk-YUWPNG7B.js → chunk-PBMSBCVB.js} +1 -1
- package/dist/bundle/{chunk-67ZQCWBV.js → chunk-QEAD2LF4.js} +3 -3
- package/dist/bundle/{chunk-JN5TVEEL.js → chunk-QXCKJUZY.js} +124 -22
- package/dist/bundle/{chunk-T7X53FCJ.js → chunk-SIOIMO62.js} +37 -37
- package/dist/bundle/{chunk-O7ALBI2I.js → chunk-TNV2FXVK.js} +5 -5
- package/dist/bundle/chunk-UD55VB2N.js +87 -0
- package/dist/bundle/{chunk-L7K2MOIC.js → chunk-UIEA6FIV.js} +22 -22
- package/dist/bundle/{chunk-EW7PKB4M.js → chunk-UJR272CP.js} +29 -29
- package/dist/bundle/{chunk-YALI4C7C.js → chunk-USLZE36C.js} +6 -6
- package/dist/bundle/{chunk-YOJDGAPT.js → chunk-VIJ6ACYB.js} +8 -8
- package/dist/bundle/{chunk-MN4VXU3M.js → chunk-VPLFD5RJ.js} +4 -4
- package/dist/bundle/{chunk-VQDD64A4.js → chunk-VT2UFYPJ.js} +8 -10
- package/dist/bundle/{chunk-CZ2GJHLL.js → chunk-WWCYTMAV.js} +2 -2
- package/dist/bundle/{chunk-DJOAMGF4.js → chunk-XPXKD63J.js} +13 -13
- package/dist/bundle/{chunk-E43ENLJJ.js → chunk-ZF6GUZCE.js} +1 -1
- package/dist/bundle/{chunk-XEW2EN6F.js → chunk-ZRZ4HTCK.js} +60 -34
- package/dist/bundle/{chunk-2KN35F32.js → chunk-ZSZJLJIA.js} +10 -10
- package/dist/bundle/command-contract-H5OYJOPF.js +38 -0
- package/dist/bundle/{decode-WIIX3Y2X.js → decode-HTOQ6S3V.js} +8 -8
- package/dist/bundle/{dispatch-GEFIXA6X.js → dispatch-SH5SP6LA.js} +11 -11
- package/dist/bundle/drive.js +11 -11
- package/dist/bundle/{echarts-OYINM4C4.js → echarts-KFHB6SLX.js} +2 -2
- package/dist/bundle/{embed-DWZIYMBX.js → embed-YATFB2PN.js} +9 -9
- package/dist/bundle/{embedder-ILWH7ZRM.js → embedder-MQPDFGTJ.js} +12 -12
- package/dist/bundle/entry-YZBB647C.js +22 -0
- package/dist/bundle/{failure-GV77W3CD.js → failure-4FQL4XJI.js} +4 -4
- package/dist/bundle/first-run-5JT3UQZB.js +30 -0
- package/dist/bundle/first-screen-BEMDEWO7.js +36 -0
- package/dist/bundle/{google-KLZSUAVY.js → google-DVADVICN.js} +13 -13
- package/dist/bundle/{google-api-HZQ5R4ZO.js → google-api-QMFGCXBM.js} +55 -57
- package/dist/bundle/grants-WKB2E4TA.js +103 -0
- package/dist/bundle/{identity-J2DON4IO.js → identity-FYVDK4M2.js} +6 -6
- package/dist/bundle/{instructions-HGOJ23AJ.js → instructions-D3GF3B7M.js} +1 -1
- package/dist/bundle/{login-BD2TS4GY.js → login-COFZ2IWP.js} +61 -63
- package/dist/bundle/{mcp-GWDA3HOA.js → mcp-RKJG22KM.js} +2 -2
- package/dist/bundle/{node-CPKTDPH7.js → node-OFICOKX3.js} +2 -2
- package/dist/bundle/{node-sqlite-IXDCRLSX.js → node-sqlite-DNBTDOXD.js} +9 -9
- package/dist/bundle/oauth-PDQHWFBF.js +22 -0
- package/dist/bundle/{open-O7P3ZV3Y.js → open-PTPR2YWX.js} +8 -8
- package/dist/bundle/{openai-RCFQKCXC.js → openai-2KV5LUW4.js} +17 -17
- package/dist/bundle/{process-KXDRJO22.js → process-EAW6NST2.js} +1 -1
- package/dist/bundle/{program-UCHFC7JQ.js → program-6UV5Q5YN.js} +310 -279
- package/dist/bundle/prompt-634TPMJK.js +19 -0
- package/dist/bundle/{reasons-57J2D77K.js → reasons-DDWCEYSQ.js} +5 -5
- package/dist/bundle/{recognize-MRCYGP2J.js → recognize-SJO6QUDW.js} +7 -7
- package/dist/bundle/{remote-L3L4PHKF.js → remote-6JXZITKF.js} +10 -10
- package/dist/bundle/{rerank-PSOE6XFT.js → rerank-MD5VOPQ6.js} +10 -10
- package/dist/bundle/{serve-72OGS3BF.js → serve-LZTROA2M.js} +12 -12
- package/dist/bundle/server-GT7X666D.js +69 -0
- package/dist/bundle/{server-SCXKYHBO.js → server-NSA3UAFY.js} +43 -44
- package/dist/bundle/{services-YAFTELBI.js → services-F5A6XQCV.js} +69 -34
- package/dist/bundle/{sqlite-runtime-DLK4SU33.js → sqlite-runtime-7YF6REKS.js} +9 -9
- package/dist/bundle/{start-AFFA3LKM.js → start-MUFLE6FA.js} +30 -8
- package/dist/bundle/{state-T5VNAJSZ.js → state-UC54F3YZ.js} +9 -9
- package/dist/bundle/{store-4OFK7PKQ.js → store-F5FJGWMR.js} +58 -20
- package/dist/bundle/{store-R6MSY2IM.js → store-J53YNAH6.js} +43 -18
- package/dist/bundle/store-maintenance-command-GJVXLBAB.js +58 -0
- package/dist/bundle/tokens-H2EJKGA5.js +101 -0
- package/dist/commands/account.d.ts +4 -0
- package/dist/commands/account.d.ts.map +1 -0
- package/dist/commands/account.js +33 -0
- package/dist/commands/account.js.map +1 -0
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +5 -1
- package/dist/commands/config.js.map +1 -1
- package/dist/profile-lock.d.ts +1 -0
- package/dist/profile-lock.d.ts.map +1 -1
- package/dist/profile-lock.js +1 -0
- package/dist/profile-lock.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +2 -0
- package/dist/program.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/dist/bundle/chunk-AQVUEZEP.js +0 -22
- package/dist/bundle/chunk-DRZZBN3V.js +0 -33
- package/dist/bundle/chunk-UOXOLGNG.js +0 -42
- package/dist/bundle/command-contract-OB5BRABN.js +0 -39
- package/dist/bundle/entry-V5V3TOTY.js +0 -22
- package/dist/bundle/first-run-V3VVLQF4.js +0 -30
- package/dist/bundle/first-screen-Y3RIN7FU.js +0 -37
- package/dist/bundle/grants-L7XLHLUT.js +0 -105
- package/dist/bundle/oauth-HOGY4YBB.js +0 -22
- package/dist/bundle/prompt-EVPPBN5W.js +0 -17
- package/dist/bundle/server-C5TGNFXW.js +0 -70
- package/dist/bundle/store-maintenance-command-QDMCXGV6.js +0 -60
- package/dist/bundle/tokens-HIG36RNS.js +0 -103
- /package/dist/bundle/{chunk-ZQ3GWKDQ.js → chunk-SW6C6WH5.js} +0 -0
|
@@ -3,7 +3,7 @@ const require = __bundleRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
answerOf,
|
|
5
5
|
messengerContext
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UJR272CP.js";
|
|
7
7
|
import {
|
|
8
8
|
chatEventAnswer,
|
|
9
9
|
memberAnswer,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
serveRelay,
|
|
13
13
|
typedQuery,
|
|
14
14
|
withQuery
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-P7DEGRZA.js";
|
|
16
16
|
import {
|
|
17
17
|
stringWidth,
|
|
18
18
|
wrapAnsi
|
|
@@ -25,13 +25,11 @@ import {
|
|
|
25
25
|
REMOTE_WRITE,
|
|
26
26
|
annotate,
|
|
27
27
|
destroysNothing,
|
|
28
|
-
endpoint,
|
|
29
28
|
environmentOf,
|
|
30
29
|
itemOf,
|
|
31
30
|
jsonlRecords,
|
|
32
31
|
lineOf,
|
|
33
32
|
listOf,
|
|
34
|
-
modelTarget,
|
|
35
33
|
nextStep,
|
|
36
34
|
outputFor,
|
|
37
35
|
recalledAccount,
|
|
@@ -40,59 +38,50 @@ import {
|
|
|
40
38
|
snakeKeys,
|
|
41
39
|
storeTable,
|
|
42
40
|
withoutProviderRefs
|
|
43
|
-
} from "./chunk-
|
|
44
|
-
import {
|
|
45
|
-
envName
|
|
46
|
-
} from "./chunk-7W5HYGVW.js";
|
|
41
|
+
} from "./chunk-LOMW6F2E.js";
|
|
47
42
|
import {
|
|
48
43
|
holdLock,
|
|
49
44
|
lockPath,
|
|
50
45
|
releaseLock,
|
|
51
46
|
servingProfiles,
|
|
52
47
|
takeLock
|
|
53
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-F2VDAG32.js";
|
|
54
49
|
import {
|
|
55
50
|
holdersOf
|
|
56
|
-
} from "./chunk-
|
|
57
|
-
import {
|
|
58
|
-
checkedOptions,
|
|
59
|
-
range
|
|
60
|
-
} from "./chunk-DRZZBN3V.js";
|
|
51
|
+
} from "./chunk-J62DI53V.js";
|
|
61
52
|
import {
|
|
62
53
|
FETCHING,
|
|
63
54
|
RULES_VERSION,
|
|
64
55
|
applyTaskRulesOnArrival,
|
|
65
56
|
capability,
|
|
57
|
+
embeddingKeys,
|
|
58
|
+
endpointKeyName,
|
|
59
|
+
modelGateway,
|
|
66
60
|
newSendId,
|
|
67
61
|
onlineDeps,
|
|
68
62
|
openRequestTask,
|
|
69
63
|
patiently,
|
|
70
64
|
senderIsMe,
|
|
71
65
|
servicesFor,
|
|
72
|
-
syncsOneChat
|
|
66
|
+
syncsOneChat
|
|
67
|
+
} from "./chunk-3J5KAFNA.js";
|
|
68
|
+
import {
|
|
73
69
|
withTimeLimit
|
|
74
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-KE4XPPRQ.js";
|
|
75
71
|
import {
|
|
76
72
|
codeOf,
|
|
77
73
|
currentRun,
|
|
78
74
|
levelFor,
|
|
75
|
+
modelTarget,
|
|
79
76
|
parseDuration
|
|
80
|
-
} from "./chunk-
|
|
81
|
-
import {
|
|
82
|
-
failureKey
|
|
83
|
-
} from "./chunk-AQVUEZEP.js";
|
|
84
|
-
import {
|
|
85
|
-
messagesFor,
|
|
86
|
-
systemFor,
|
|
87
|
-
validateImages
|
|
88
|
-
} from "./chunk-T5NWWXS2.js";
|
|
77
|
+
} from "./chunk-OH3K2E7X.js";
|
|
89
78
|
import {
|
|
90
79
|
QUICK_HEALTH_CHECKS,
|
|
91
80
|
explainDamage,
|
|
92
81
|
fts5Tables,
|
|
93
82
|
invalidJson,
|
|
94
83
|
storeHealth
|
|
95
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-KVW4XNKB.js";
|
|
96
85
|
import {
|
|
97
86
|
CORPORA,
|
|
98
87
|
MIGRATIONS,
|
|
@@ -128,39 +117,44 @@ import {
|
|
|
128
117
|
storeClients,
|
|
129
118
|
storeContents,
|
|
130
119
|
vectorIndexCounts
|
|
131
|
-
} from "./chunk-
|
|
120
|
+
} from "./chunk-EWGVDFPT.js";
|
|
121
|
+
import {
|
|
122
|
+
readDamageMark,
|
|
123
|
+
readHealthMark,
|
|
124
|
+
recordDeepCheck
|
|
125
|
+
} from "./chunk-CPMRM3GQ.js";
|
|
132
126
|
import {
|
|
133
127
|
queryFieldsOf
|
|
134
|
-
} from "./chunk-
|
|
128
|
+
} from "./chunk-2FEZ24DK.js";
|
|
129
|
+
import {
|
|
130
|
+
failureKey,
|
|
131
|
+
isStoreDamage
|
|
132
|
+
} from "./chunk-B67BLRAI.js";
|
|
135
133
|
import {
|
|
136
134
|
storePath
|
|
137
|
-
} from "./chunk-
|
|
135
|
+
} from "./chunk-DD7EFG6B.js";
|
|
138
136
|
import {
|
|
139
137
|
openCache
|
|
140
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-USLZE36C.js";
|
|
141
139
|
import {
|
|
142
140
|
readSecret
|
|
143
|
-
} from "./chunk-
|
|
141
|
+
} from "./chunk-6B37XO6B.js";
|
|
144
142
|
import {
|
|
145
|
-
Credentials,
|
|
146
|
-
pathsAreOverridden,
|
|
147
143
|
resolvePaths,
|
|
148
144
|
writeSecurely
|
|
149
|
-
} from "./chunk-
|
|
145
|
+
} from "./chunk-G4KEKKDE.js";
|
|
150
146
|
import {
|
|
151
147
|
singleLine,
|
|
152
148
|
visibleControls
|
|
153
|
-
} from "./chunk-
|
|
149
|
+
} from "./chunk-IDAK4DDK.js";
|
|
154
150
|
import {
|
|
155
151
|
array,
|
|
156
152
|
boolean,
|
|
157
153
|
check,
|
|
158
154
|
forward,
|
|
159
155
|
getDotPath,
|
|
160
|
-
integer,
|
|
161
156
|
minLength,
|
|
162
157
|
nullable,
|
|
163
|
-
number,
|
|
164
158
|
object,
|
|
165
159
|
optional,
|
|
166
160
|
parse,
|
|
@@ -172,12 +166,11 @@ import {
|
|
|
172
166
|
strictObject,
|
|
173
167
|
string,
|
|
174
168
|
transform,
|
|
175
|
-
trim
|
|
176
|
-
|
|
177
|
-
} from "./chunk-FEZF3TII.js";
|
|
169
|
+
trim
|
|
170
|
+
} from "./chunk-BDYWZ7JE.js";
|
|
178
171
|
import {
|
|
179
172
|
CliError
|
|
180
|
-
} from "./chunk-
|
|
173
|
+
} from "./chunk-EJ4PNHPP.js";
|
|
181
174
|
import {
|
|
182
175
|
__commonJS,
|
|
183
176
|
__name,
|
|
@@ -355,14 +348,14 @@ var require_liquid_node = __commonJS({
|
|
|
355
348
|
return value !== null && (type === "object" || type === "function");
|
|
356
349
|
}
|
|
357
350
|
__name(isObject, "isObject");
|
|
358
|
-
function
|
|
351
|
+
function range(start, stop, step = 1) {
|
|
359
352
|
const arr = [];
|
|
360
353
|
for (let i = start; i < stop; i += step) {
|
|
361
354
|
arr.push(i);
|
|
362
355
|
}
|
|
363
356
|
return arr;
|
|
364
357
|
}
|
|
365
|
-
__name(
|
|
358
|
+
__name(range, "range");
|
|
366
359
|
function padStart(str, length, ch = " ") {
|
|
367
360
|
return pad(str, length, ch, (str2, ch2) => ch2 + str2);
|
|
368
361
|
}
|
|
@@ -556,7 +549,7 @@ var require_liquid_node = __commonJS({
|
|
|
556
549
|
const lines = token.input.split("\n");
|
|
557
550
|
const begin = Math.max(line - 2, 1);
|
|
558
551
|
const end = Math.min(line + 3, lines.length);
|
|
559
|
-
const context =
|
|
552
|
+
const context = range(begin, end + 1).map((lineNumber) => {
|
|
560
553
|
const rowIndicator = lineNumber === line ? ">> " : " ";
|
|
561
554
|
const num = padStart(String(lineNumber), String(end).length);
|
|
562
555
|
let text = `${rowIndicator}${num}| `;
|
|
@@ -1134,8 +1127,8 @@ var require_liquid_node = __commonJS({
|
|
|
1134
1127
|
valid() {
|
|
1135
1128
|
return !isNaN(this.getTime());
|
|
1136
1129
|
}
|
|
1137
|
-
format(
|
|
1138
|
-
return this.DateTimeFormat && this.DateTimeFormat(this.locale,
|
|
1130
|
+
format(options) {
|
|
1131
|
+
return this.DateTimeFormat && this.DateTimeFormat(this.locale, options).format(this.displayDate);
|
|
1139
1132
|
}
|
|
1140
1133
|
/**
|
|
1141
1134
|
* Create a Date object fixed to it's declared Timezone. Both
|
|
@@ -1219,11 +1212,11 @@ var require_liquid_node = __commonJS({
|
|
|
1219
1212
|
static {
|
|
1220
1213
|
__name(this, "TagToken");
|
|
1221
1214
|
}
|
|
1222
|
-
constructor(input, begin, end,
|
|
1223
|
-
const { trimTagLeft, trimTagRight, tagDelimiterLeft, tagDelimiterRight } =
|
|
1215
|
+
constructor(input, begin, end, options, file2) {
|
|
1216
|
+
const { trimTagLeft, trimTagRight, tagDelimiterLeft, tagDelimiterRight } = options;
|
|
1224
1217
|
const [valueBegin, valueEnd] = [begin + tagDelimiterLeft.length, end - tagDelimiterRight.length];
|
|
1225
1218
|
super(exports.TokenKind.Tag, [valueBegin, valueEnd], input, begin, end, trimTagLeft, trimTagRight, file2);
|
|
1226
|
-
this.tokenizer = new Tokenizer(input,
|
|
1219
|
+
this.tokenizer = new Tokenizer(input, options.operators, file2, this.contentRange, options.groupedExpressions);
|
|
1227
1220
|
this.name = this.tokenizer.readTagName();
|
|
1228
1221
|
this.tokenizer.assert(this.name, `illegal tag syntax, tag name expected`);
|
|
1229
1222
|
this.tokenizer.skipBlank();
|
|
@@ -1234,8 +1227,8 @@ var require_liquid_node = __commonJS({
|
|
|
1234
1227
|
static {
|
|
1235
1228
|
__name(this, "OutputToken");
|
|
1236
1229
|
}
|
|
1237
|
-
constructor(input, begin, end,
|
|
1238
|
-
const { trimOutputLeft, trimOutputRight, outputDelimiterLeft, outputDelimiterRight } =
|
|
1230
|
+
constructor(input, begin, end, options, file2) {
|
|
1231
|
+
const { trimOutputLeft, trimOutputRight, outputDelimiterLeft, outputDelimiterRight } = options;
|
|
1239
1232
|
const valueRange = [begin + outputDelimiterLeft.length, end - outputDelimiterRight.length];
|
|
1240
1233
|
super(exports.TokenKind.Output, valueRange, input, begin, end, trimOutputLeft, trimOutputRight, file2);
|
|
1241
1234
|
}
|
|
@@ -1454,9 +1447,9 @@ var require_liquid_node = __commonJS({
|
|
|
1454
1447
|
static {
|
|
1455
1448
|
__name(this, "LiquidTagToken");
|
|
1456
1449
|
}
|
|
1457
|
-
constructor(input, begin, end,
|
|
1450
|
+
constructor(input, begin, end, options, file2) {
|
|
1458
1451
|
super(exports.TokenKind.Tag, [begin, end], input, begin, end, false, false, file2);
|
|
1459
|
-
this.tokenizer = new Tokenizer(input,
|
|
1452
|
+
this.tokenizer = new Tokenizer(input, options.operators, file2, this.contentRange, options.groupedExpressions);
|
|
1460
1453
|
this.name = this.tokenizer.readTagName();
|
|
1461
1454
|
this.tokenizer.assert(this.name, "illegal liquid tag syntax");
|
|
1462
1455
|
this.tokenizer.skipBlank();
|
|
@@ -1530,11 +1523,11 @@ var require_liquid_node = __commonJS({
|
|
|
1530
1523
|
static {
|
|
1531
1524
|
__name(this, "Filter");
|
|
1532
1525
|
}
|
|
1533
|
-
constructor(token,
|
|
1526
|
+
constructor(token, options, liquid) {
|
|
1534
1527
|
this.token = token;
|
|
1535
1528
|
this.name = token.name;
|
|
1536
|
-
this.handler = isFunction(
|
|
1537
|
-
this.raw = !isFunction(
|
|
1529
|
+
this.handler = isFunction(options) ? options : isFunction(options?.handler) ? options.handler : identify;
|
|
1530
|
+
this.raw = !isFunction(options) && !!options?.raw;
|
|
1538
1531
|
this.args = token.args;
|
|
1539
1532
|
this.liquid = liquid;
|
|
1540
1533
|
}
|
|
@@ -1637,7 +1630,7 @@ var require_liquid_node = __commonJS({
|
|
|
1637
1630
|
const low = yield evalTokenValue(token.lhs, ctx);
|
|
1638
1631
|
const high = yield evalTokenValue(token.rhs, ctx);
|
|
1639
1632
|
ctx.memoryLimit.use(high - low + 1);
|
|
1640
|
-
return
|
|
1633
|
+
return range(+low, +high + 1);
|
|
1641
1634
|
}
|
|
1642
1635
|
__name(evalRangeToken, "evalRangeToken");
|
|
1643
1636
|
function* toPostfix(tokens) {
|
|
@@ -2118,41 +2111,41 @@ var require_liquid_node = __commonJS({
|
|
|
2118
2111
|
parseLimit: Infinity,
|
|
2119
2112
|
renderLimit: Infinity
|
|
2120
2113
|
};
|
|
2121
|
-
function normalize(
|
|
2122
|
-
if (
|
|
2123
|
-
if (!
|
|
2124
|
-
|
|
2125
|
-
if (!
|
|
2126
|
-
|
|
2127
|
-
}
|
|
2128
|
-
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")) {
|
|
2129
2122
|
let cache;
|
|
2130
|
-
if (typeof
|
|
2131
|
-
cache =
|
|
2132
|
-
else if (typeof
|
|
2133
|
-
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;
|
|
2134
2127
|
else
|
|
2135
|
-
cache =
|
|
2136
|
-
|
|
2128
|
+
cache = options.cache ? new LRU(1024) : void 0;
|
|
2129
|
+
options.cache = cache;
|
|
2137
2130
|
}
|
|
2138
|
-
|
|
2139
|
-
if ((!
|
|
2131
|
+
options = { ...defaultOptions, ...options.jekyllInclude ? { dynamicPartials: false } : {}, ...options };
|
|
2132
|
+
if ((!options.fs.dirname || !options.fs.sep) && options.relativeReference) {
|
|
2140
2133
|
console.warn("[LiquidJS] `fs.dirname` and `fs.sep` are required for relativeReference, set relativeReference to `false` to suppress this warning");
|
|
2141
|
-
|
|
2134
|
+
options.relativeReference = false;
|
|
2142
2135
|
}
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
if (!
|
|
2148
|
-
|
|
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";
|
|
2149
2142
|
}
|
|
2150
|
-
if (
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2143
|
+
if (options.templates) {
|
|
2144
|
+
options.fs = new MapFS(options.templates);
|
|
2145
|
+
options.relativeReference = true;
|
|
2146
|
+
options.root = options.partials = options.layouts = ".";
|
|
2154
2147
|
}
|
|
2155
|
-
return
|
|
2148
|
+
return options;
|
|
2156
2149
|
}
|
|
2157
2150
|
__name(normalize, "normalize");
|
|
2158
2151
|
function getOutputEscapeFunction(nameOrFunction) {
|
|
@@ -2173,14 +2166,14 @@ var require_liquid_node = __commonJS({
|
|
|
2173
2166
|
return list;
|
|
2174
2167
|
}
|
|
2175
2168
|
__name(normalizeDirectoryList, "normalizeDirectoryList");
|
|
2176
|
-
function whiteSpaceCtrl(tokens,
|
|
2169
|
+
function whiteSpaceCtrl(tokens, options) {
|
|
2177
2170
|
let inRaw = false;
|
|
2178
2171
|
for (let i = 0; i < tokens.length; i++) {
|
|
2179
2172
|
const token = tokens[i];
|
|
2180
2173
|
if (!isDelimitedToken(token))
|
|
2181
2174
|
continue;
|
|
2182
2175
|
if (!inRaw && token.trimLeft) {
|
|
2183
|
-
trimLeft(tokens[i - 1],
|
|
2176
|
+
trimLeft(tokens[i - 1], options.greedy);
|
|
2184
2177
|
}
|
|
2185
2178
|
if (isTagToken(token)) {
|
|
2186
2179
|
if (token.name === "raw")
|
|
@@ -2189,7 +2182,7 @@ var require_liquid_node = __commonJS({
|
|
|
2189
2182
|
inRaw = false;
|
|
2190
2183
|
}
|
|
2191
2184
|
if (!inRaw && token.trimRight) {
|
|
2192
|
-
trimRight(tokens[i + 1],
|
|
2185
|
+
trimRight(tokens[i + 1], options.greedy);
|
|
2193
2186
|
}
|
|
2194
2187
|
}
|
|
2195
2188
|
}
|
|
@@ -2216,12 +2209,12 @@ var require_liquid_node = __commonJS({
|
|
|
2216
2209
|
static {
|
|
2217
2210
|
__name(this, "Tokenizer");
|
|
2218
2211
|
}
|
|
2219
|
-
constructor(input, operators = defaultOptions.operators, file2,
|
|
2212
|
+
constructor(input, operators = defaultOptions.operators, file2, range2, groupedExpressions = false) {
|
|
2220
2213
|
this.input = input;
|
|
2221
2214
|
this.file = file2;
|
|
2222
2215
|
this.rawBeginAt = -1;
|
|
2223
|
-
this.p =
|
|
2224
|
-
this.N =
|
|
2216
|
+
this.p = range2 ? range2[0] : 0;
|
|
2217
|
+
this.N = range2 ? range2[1] : input.length;
|
|
2225
2218
|
this.opTrie = createTrie(operators);
|
|
2226
2219
|
this.literalTrie = createTrie(literalValues);
|
|
2227
2220
|
this.groupedExpressions = groupedExpressions;
|
|
@@ -2321,23 +2314,23 @@ var require_liquid_node = __commonJS({
|
|
|
2321
2314
|
const value = this.readValue();
|
|
2322
2315
|
return [key.getText(), value];
|
|
2323
2316
|
}
|
|
2324
|
-
readTopLevelTokens(
|
|
2317
|
+
readTopLevelTokens(options = defaultOptions) {
|
|
2325
2318
|
const tokens = [];
|
|
2326
2319
|
while (this.p < this.N) {
|
|
2327
|
-
const token = this.readTopLevelToken(
|
|
2320
|
+
const token = this.readTopLevelToken(options);
|
|
2328
2321
|
tokens.push(token);
|
|
2329
2322
|
}
|
|
2330
|
-
whiteSpaceCtrl(tokens,
|
|
2323
|
+
whiteSpaceCtrl(tokens, options);
|
|
2331
2324
|
return tokens;
|
|
2332
2325
|
}
|
|
2333
|
-
readTopLevelToken(
|
|
2334
|
-
const { tagDelimiterLeft, outputDelimiterLeft } =
|
|
2326
|
+
readTopLevelToken(options) {
|
|
2327
|
+
const { tagDelimiterLeft, outputDelimiterLeft } = options;
|
|
2335
2328
|
if (this.rawBeginAt > -1)
|
|
2336
|
-
return this.readEndrawOrRawContent(
|
|
2329
|
+
return this.readEndrawOrRawContent(options);
|
|
2337
2330
|
if (this.match(tagDelimiterLeft))
|
|
2338
|
-
return this.readTagToken(
|
|
2331
|
+
return this.readTagToken(options);
|
|
2339
2332
|
if (this.match(outputDelimiterLeft))
|
|
2340
|
-
return this.readOutputToken(
|
|
2333
|
+
return this.readOutputToken(options);
|
|
2341
2334
|
return this.readHTMLToken([tagDelimiterLeft, outputDelimiterLeft]);
|
|
2342
2335
|
}
|
|
2343
2336
|
readHTMLToken(stopStrings) {
|
|
@@ -2349,13 +2342,13 @@ var require_liquid_node = __commonJS({
|
|
|
2349
2342
|
}
|
|
2350
2343
|
return new HTMLToken(this.input, begin, this.p, this.file);
|
|
2351
2344
|
}
|
|
2352
|
-
readTagToken(
|
|
2345
|
+
readTagToken(options) {
|
|
2353
2346
|
const { file: file2, input } = this;
|
|
2354
2347
|
const begin = this.p;
|
|
2355
|
-
if (this.readToDelimiter(
|
|
2348
|
+
if (this.readToDelimiter(options.tagDelimiterRight) === -1) {
|
|
2356
2349
|
throw this.error(`tag ${this.snapshot(begin)} not closed`, begin);
|
|
2357
2350
|
}
|
|
2358
|
-
const token = new TagToken(input, begin, this.p,
|
|
2351
|
+
const token = new TagToken(input, begin, this.p, options, file2);
|
|
2359
2352
|
if (token.name === "raw")
|
|
2360
2353
|
this.rawBeginAt = begin;
|
|
2361
2354
|
return token;
|
|
@@ -2373,17 +2366,17 @@ var require_liquid_node = __commonJS({
|
|
|
2373
2366
|
}
|
|
2374
2367
|
return -1;
|
|
2375
2368
|
}
|
|
2376
|
-
readOutputToken(
|
|
2369
|
+
readOutputToken(options = defaultOptions) {
|
|
2377
2370
|
const { file: file2, input } = this;
|
|
2378
|
-
const { outputDelimiterRight } =
|
|
2371
|
+
const { outputDelimiterRight } = options;
|
|
2379
2372
|
const begin = this.p;
|
|
2380
2373
|
if (this.readToDelimiter(outputDelimiterRight, true) === -1) {
|
|
2381
2374
|
throw this.error(`output ${this.snapshot(begin)} not closed`, begin);
|
|
2382
2375
|
}
|
|
2383
|
-
return new OutputToken(input, begin, this.p,
|
|
2376
|
+
return new OutputToken(input, begin, this.p, options, file2);
|
|
2384
2377
|
}
|
|
2385
|
-
readEndrawOrRawContent(
|
|
2386
|
-
const { tagDelimiterLeft, tagDelimiterRight } =
|
|
2378
|
+
readEndrawOrRawContent(options) {
|
|
2379
|
+
const { tagDelimiterLeft, tagDelimiterRight } = options;
|
|
2387
2380
|
const begin = this.p;
|
|
2388
2381
|
let leftPos = this.readTo(tagDelimiterLeft) - tagDelimiterLeft.length;
|
|
2389
2382
|
while (this.p < this.N) {
|
|
@@ -2396,7 +2389,7 @@ var require_liquid_node = __commonJS({
|
|
|
2396
2389
|
const end = this.p;
|
|
2397
2390
|
if (begin === leftPos) {
|
|
2398
2391
|
this.rawBeginAt = -1;
|
|
2399
|
-
return new TagToken(this.input, begin, end,
|
|
2392
|
+
return new TagToken(this.input, begin, end, options, this.file);
|
|
2400
2393
|
} else {
|
|
2401
2394
|
this.p = leftPos;
|
|
2402
2395
|
return new HTMLToken(this.input, begin, leftPos, this.file);
|
|
@@ -2409,22 +2402,22 @@ var require_liquid_node = __commonJS({
|
|
|
2409
2402
|
}
|
|
2410
2403
|
throw this.error(`raw ${this.snapshot(this.rawBeginAt)} not closed`, begin);
|
|
2411
2404
|
}
|
|
2412
|
-
readLiquidTagTokens(
|
|
2405
|
+
readLiquidTagTokens(options = defaultOptions) {
|
|
2413
2406
|
const tokens = [];
|
|
2414
2407
|
while (this.p < this.N) {
|
|
2415
|
-
const token = this.readLiquidTagToken(
|
|
2408
|
+
const token = this.readLiquidTagToken(options);
|
|
2416
2409
|
token && tokens.push(token);
|
|
2417
2410
|
}
|
|
2418
2411
|
return tokens;
|
|
2419
2412
|
}
|
|
2420
|
-
readLiquidTagToken(
|
|
2413
|
+
readLiquidTagToken(options) {
|
|
2421
2414
|
this.skipBlank();
|
|
2422
2415
|
if (this.end())
|
|
2423
2416
|
return;
|
|
2424
2417
|
const begin = this.p;
|
|
2425
2418
|
this.readToDelimiter("\n");
|
|
2426
2419
|
const end = this.p;
|
|
2427
|
-
return new LiquidTagToken(this.input, begin, end,
|
|
2420
|
+
return new LiquidTagToken(this.input, begin, end, options, this.file);
|
|
2428
2421
|
}
|
|
2429
2422
|
error(msg, pos = this.p) {
|
|
2430
2423
|
return new TokenizationError(msg, new IdentifierToken(this.input, pos, this.N, this.file));
|
|
@@ -2636,12 +2629,12 @@ var require_liquid_node = __commonJS({
|
|
|
2636
2629
|
}
|
|
2637
2630
|
return new QuotedToken(this.input, begin, this.p, this.file);
|
|
2638
2631
|
}
|
|
2639
|
-
*readFileNameTemplate(
|
|
2640
|
-
const { outputDelimiterLeft } =
|
|
2632
|
+
*readFileNameTemplate(options) {
|
|
2633
|
+
const { outputDelimiterLeft } = options;
|
|
2641
2634
|
const htmlStopStrings = [",", " ", "\r", "\n", " ", outputDelimiterLeft];
|
|
2642
2635
|
const htmlStopStringSet = new Set(htmlStopStrings);
|
|
2643
2636
|
while (this.p < this.N && !htmlStopStringSet.has(this.peek())) {
|
|
2644
|
-
yield this.match(outputDelimiterLeft) ? this.readOutputToken(
|
|
2637
|
+
yield this.match(outputDelimiterLeft) ? this.readOutputToken(options) : this.readHTMLToken(htmlStopStrings);
|
|
2645
2638
|
}
|
|
2646
2639
|
}
|
|
2647
2640
|
match(word) {
|
|
@@ -2716,7 +2709,7 @@ var require_liquid_node = __commonJS({
|
|
|
2716
2709
|
this.token = token;
|
|
2717
2710
|
}
|
|
2718
2711
|
};
|
|
2719
|
-
var
|
|
2712
|
+
var Tag3 = class extends TemplateImpl {
|
|
2720
2713
|
static {
|
|
2721
2714
|
__name(this, "Tag");
|
|
2722
2715
|
}
|
|
@@ -2746,17 +2739,17 @@ var require_liquid_node = __commonJS({
|
|
|
2746
2739
|
return hash2;
|
|
2747
2740
|
}
|
|
2748
2741
|
};
|
|
2749
|
-
function createTagClass(
|
|
2750
|
-
return class extends
|
|
2742
|
+
function createTagClass(options) {
|
|
2743
|
+
return class extends Tag3 {
|
|
2751
2744
|
constructor(token, tokens, liquid) {
|
|
2752
2745
|
super(token, tokens, liquid);
|
|
2753
|
-
if (isFunction(
|
|
2754
|
-
|
|
2746
|
+
if (isFunction(options.parse)) {
|
|
2747
|
+
options.parse.call(this, token, tokens);
|
|
2755
2748
|
}
|
|
2756
2749
|
}
|
|
2757
2750
|
*render(ctx, emitter) {
|
|
2758
2751
|
const hash2 = yield new Hash(this.token.args, ctx.opts.keyValueSeparator).render(ctx);
|
|
2759
|
-
return yield
|
|
2752
|
+
return yield options.render.call(this, ctx, emitter, hash2);
|
|
2760
2753
|
}
|
|
2761
2754
|
};
|
|
2762
2755
|
}
|
|
@@ -2973,13 +2966,13 @@ var require_liquid_node = __commonJS({
|
|
|
2973
2966
|
};
|
|
2974
2967
|
}
|
|
2975
2968
|
__name(_analyze, "_analyze");
|
|
2976
|
-
function analyze(template2,
|
|
2977
|
-
const opts = { ...defaultStaticAnalysisOptions, ...
|
|
2969
|
+
function analyze(template2, options = {}) {
|
|
2970
|
+
const opts = { ...defaultStaticAnalysisOptions, ...options };
|
|
2978
2971
|
return toPromise(_analyze(template2, opts.partials, false));
|
|
2979
2972
|
}
|
|
2980
2973
|
__name(analyze, "analyze");
|
|
2981
|
-
function analyzeSync(template2,
|
|
2982
|
-
const opts = { ...defaultStaticAnalysisOptions, ...
|
|
2974
|
+
function analyzeSync(template2, options = {}) {
|
|
2975
|
+
const opts = { ...defaultStaticAnalysisOptions, ...options };
|
|
2983
2976
|
return toValueSync(_analyze(template2, opts.partials, true));
|
|
2984
2977
|
}
|
|
2985
2978
|
__name(analyzeSync, "analyzeSync");
|
|
@@ -3155,17 +3148,17 @@ var require_liquid_node = __commonJS({
|
|
|
3155
3148
|
static {
|
|
3156
3149
|
__name(this, "Loader");
|
|
3157
3150
|
}
|
|
3158
|
-
constructor(
|
|
3159
|
-
this.options =
|
|
3160
|
-
if (
|
|
3161
|
-
const sep =
|
|
3151
|
+
constructor(options) {
|
|
3152
|
+
this.options = options;
|
|
3153
|
+
if (options.relativeReference) {
|
|
3154
|
+
const sep = options.fs.sep;
|
|
3162
3155
|
assert(sep, "`fs.sep` is required for relative reference");
|
|
3163
3156
|
const prefixes = ["." + sep, ".." + sep, "./", "../"];
|
|
3164
3157
|
this.shouldLoadRelative = (referencedFile) => prefixes.some((prefix) => referencedFile.startsWith(prefix));
|
|
3165
3158
|
} else {
|
|
3166
3159
|
this.shouldLoadRelative = (_referencedFile) => false;
|
|
3167
3160
|
}
|
|
3168
|
-
const fs2 =
|
|
3161
|
+
const fs2 = options.fs;
|
|
3169
3162
|
this.contains = toLiquidAsync(fs2.contains?.bind(fs2) || (async () => true), fs2.containsSync?.bind(fs2) || (() => true));
|
|
3170
3163
|
this.exists = toLiquidAsync(fs2.exists?.bind(fs2) || (async () => false), fs2.existsSync?.bind(fs2));
|
|
3171
3164
|
}
|
|
@@ -4315,7 +4308,7 @@ var require_liquid_node = __commonJS({
|
|
|
4315
4308
|
...cryptoFilters,
|
|
4316
4309
|
...misc
|
|
4317
4310
|
};
|
|
4318
|
-
var AssignTag = class extends
|
|
4311
|
+
var AssignTag = class extends Tag3 {
|
|
4319
4312
|
static {
|
|
4320
4313
|
__name(this, "AssignTag");
|
|
4321
4314
|
}
|
|
@@ -4340,7 +4333,7 @@ var require_liquid_node = __commonJS({
|
|
|
4340
4333
|
}
|
|
4341
4334
|
};
|
|
4342
4335
|
var MODIFIERS = ["offset", "limit", "reversed"];
|
|
4343
|
-
var ForTag = class extends
|
|
4336
|
+
var ForTag = class extends Tag3 {
|
|
4344
4337
|
static {
|
|
4345
4338
|
__name(this, "ForTag");
|
|
4346
4339
|
}
|
|
@@ -4433,7 +4426,7 @@ var require_liquid_node = __commonJS({
|
|
|
4433
4426
|
return arr.slice(0, count3);
|
|
4434
4427
|
}
|
|
4435
4428
|
__name(limit2, "limit");
|
|
4436
|
-
var CaptureTag = class extends
|
|
4429
|
+
var CaptureTag = class extends Tag3 {
|
|
4437
4430
|
static {
|
|
4438
4431
|
__name(this, "CaptureTag");
|
|
4439
4432
|
}
|
|
@@ -4471,7 +4464,7 @@ var require_liquid_node = __commonJS({
|
|
|
4471
4464
|
yield this.identifier;
|
|
4472
4465
|
}
|
|
4473
4466
|
};
|
|
4474
|
-
var CaseTag = class extends
|
|
4467
|
+
var CaseTag = class extends Tag3 {
|
|
4475
4468
|
static {
|
|
4476
4469
|
__name(this, "CaseTag");
|
|
4477
4470
|
}
|
|
@@ -4544,7 +4537,7 @@ var require_liquid_node = __commonJS({
|
|
|
4544
4537
|
return templates;
|
|
4545
4538
|
}
|
|
4546
4539
|
};
|
|
4547
|
-
var CommentTag = class extends
|
|
4540
|
+
var CommentTag = class extends Tag3 {
|
|
4548
4541
|
static {
|
|
4549
4542
|
__name(this, "CommentTag");
|
|
4550
4543
|
}
|
|
@@ -4560,7 +4553,7 @@ var require_liquid_node = __commonJS({
|
|
|
4560
4553
|
render() {
|
|
4561
4554
|
}
|
|
4562
4555
|
};
|
|
4563
|
-
var RenderTag = class extends
|
|
4556
|
+
var RenderTag = class extends Tag3 {
|
|
4564
4557
|
static {
|
|
4565
4558
|
__name(this, "RenderTag");
|
|
4566
4559
|
}
|
|
@@ -4707,7 +4700,7 @@ var require_liquid_node = __commonJS({
|
|
|
4707
4700
|
return yield evalToken(file2, ctx);
|
|
4708
4701
|
}
|
|
4709
4702
|
__name(renderFilePath, "renderFilePath");
|
|
4710
|
-
var IncludeTag = class extends
|
|
4703
|
+
var IncludeTag = class extends Tag3 {
|
|
4711
4704
|
static {
|
|
4712
4705
|
__name(this, "IncludeTag");
|
|
4713
4706
|
}
|
|
@@ -4775,7 +4768,7 @@ var require_liquid_node = __commonJS({
|
|
|
4775
4768
|
}
|
|
4776
4769
|
}
|
|
4777
4770
|
};
|
|
4778
|
-
var DecrementTag = class extends
|
|
4771
|
+
var DecrementTag = class extends Tag3 {
|
|
4779
4772
|
static {
|
|
4780
4773
|
__name(this, "DecrementTag");
|
|
4781
4774
|
}
|
|
@@ -4795,7 +4788,7 @@ var require_liquid_node = __commonJS({
|
|
|
4795
4788
|
yield this.identifier;
|
|
4796
4789
|
}
|
|
4797
4790
|
};
|
|
4798
|
-
var CycleTag = class extends
|
|
4791
|
+
var CycleTag = class extends Tag3 {
|
|
4799
4792
|
static {
|
|
4800
4793
|
__name(this, "CycleTag");
|
|
4801
4794
|
}
|
|
@@ -4839,7 +4832,7 @@ var require_liquid_node = __commonJS({
|
|
|
4839
4832
|
}
|
|
4840
4833
|
}
|
|
4841
4834
|
};
|
|
4842
|
-
var IfTag = class extends
|
|
4835
|
+
var IfTag = class extends Tag3 {
|
|
4843
4836
|
static {
|
|
4844
4837
|
__name(this, "IfTag");
|
|
4845
4838
|
}
|
|
@@ -4889,7 +4882,7 @@ var require_liquid_node = __commonJS({
|
|
|
4889
4882
|
return this.branches.map((b) => b.value);
|
|
4890
4883
|
}
|
|
4891
4884
|
};
|
|
4892
|
-
var IncrementTag = class extends
|
|
4885
|
+
var IncrementTag = class extends Tag3 {
|
|
4893
4886
|
static {
|
|
4894
4887
|
__name(this, "IncrementTag");
|
|
4895
4888
|
}
|
|
@@ -4911,7 +4904,7 @@ var require_liquid_node = __commonJS({
|
|
|
4911
4904
|
yield this.identifier;
|
|
4912
4905
|
}
|
|
4913
4906
|
};
|
|
4914
|
-
var LayoutTag = class extends
|
|
4907
|
+
var LayoutTag = class extends Tag3 {
|
|
4915
4908
|
static {
|
|
4916
4909
|
__name(this, "LayoutTag");
|
|
4917
4910
|
}
|
|
@@ -4966,7 +4959,7 @@ var require_liquid_node = __commonJS({
|
|
|
4966
4959
|
}
|
|
4967
4960
|
}
|
|
4968
4961
|
};
|
|
4969
|
-
var BlockTag = class extends
|
|
4962
|
+
var BlockTag = class extends Tag3 {
|
|
4970
4963
|
static {
|
|
4971
4964
|
__name(this, "BlockTag");
|
|
4972
4965
|
}
|
|
@@ -5015,7 +5008,7 @@ var require_liquid_node = __commonJS({
|
|
|
5015
5008
|
return ["block"];
|
|
5016
5009
|
}
|
|
5017
5010
|
};
|
|
5018
|
-
var RawTag = class extends
|
|
5011
|
+
var RawTag = class extends Tag3 {
|
|
5019
5012
|
static {
|
|
5020
5013
|
__name(this, "RawTag");
|
|
5021
5014
|
}
|
|
@@ -5059,7 +5052,7 @@ var require_liquid_node = __commonJS({
|
|
|
5059
5052
|
return this.col() === this.cols;
|
|
5060
5053
|
}
|
|
5061
5054
|
};
|
|
5062
|
-
var TablerowTag = class extends
|
|
5055
|
+
var TablerowTag = class extends Tag3 {
|
|
5063
5056
|
static {
|
|
5064
5057
|
__name(this, "TablerowTag");
|
|
5065
5058
|
}
|
|
@@ -5123,7 +5116,7 @@ var require_liquid_node = __commonJS({
|
|
|
5123
5116
|
return [this.variable, "tablerowloop"];
|
|
5124
5117
|
}
|
|
5125
5118
|
};
|
|
5126
|
-
var UnlessTag = class extends
|
|
5119
|
+
var UnlessTag = class extends Tag3 {
|
|
5127
5120
|
static {
|
|
5128
5121
|
__name(this, "UnlessTag");
|
|
5129
5122
|
}
|
|
@@ -5182,7 +5175,7 @@ var require_liquid_node = __commonJS({
|
|
|
5182
5175
|
return this.branches.map((b) => b.value);
|
|
5183
5176
|
}
|
|
5184
5177
|
};
|
|
5185
|
-
var BreakTag = class extends
|
|
5178
|
+
var BreakTag = class extends Tag3 {
|
|
5186
5179
|
static {
|
|
5187
5180
|
__name(this, "BreakTag");
|
|
5188
5181
|
}
|
|
@@ -5190,7 +5183,7 @@ var require_liquid_node = __commonJS({
|
|
|
5190
5183
|
ctx.breakCalled = true;
|
|
5191
5184
|
}
|
|
5192
5185
|
};
|
|
5193
|
-
var ContinueTag = class extends
|
|
5186
|
+
var ContinueTag = class extends Tag3 {
|
|
5194
5187
|
static {
|
|
5195
5188
|
__name(this, "ContinueTag");
|
|
5196
5189
|
}
|
|
@@ -5198,7 +5191,7 @@ var require_liquid_node = __commonJS({
|
|
|
5198
5191
|
ctx.continueCalled = true;
|
|
5199
5192
|
}
|
|
5200
5193
|
};
|
|
5201
|
-
var EchoTag = class extends
|
|
5194
|
+
var EchoTag = class extends Tag3 {
|
|
5202
5195
|
static {
|
|
5203
5196
|
__name(this, "EchoTag");
|
|
5204
5197
|
}
|
|
@@ -5221,7 +5214,7 @@ var require_liquid_node = __commonJS({
|
|
|
5221
5214
|
}
|
|
5222
5215
|
}
|
|
5223
5216
|
};
|
|
5224
|
-
var LiquidTag = class extends
|
|
5217
|
+
var LiquidTag = class extends Tag3 {
|
|
5225
5218
|
static {
|
|
5226
5219
|
__name(this, "LiquidTag");
|
|
5227
5220
|
}
|
|
@@ -5237,7 +5230,7 @@ var require_liquid_node = __commonJS({
|
|
|
5237
5230
|
return this.templates;
|
|
5238
5231
|
}
|
|
5239
5232
|
};
|
|
5240
|
-
var InlineCommentTag = class extends
|
|
5233
|
+
var InlineCommentTag = class extends Tag3 {
|
|
5241
5234
|
static {
|
|
5242
5235
|
__name(this, "InlineCommentTag");
|
|
5243
5236
|
}
|
|
@@ -5380,76 +5373,76 @@ var require_liquid_node = __commonJS({
|
|
|
5380
5373
|
self.renderFile(filePath, ctx).then((html) => callback(null, html), callback);
|
|
5381
5374
|
};
|
|
5382
5375
|
}
|
|
5383
|
-
async analyze(template2,
|
|
5384
|
-
return analyze(template2,
|
|
5376
|
+
async analyze(template2, options = {}) {
|
|
5377
|
+
return analyze(template2, options);
|
|
5385
5378
|
}
|
|
5386
|
-
analyzeSync(template2,
|
|
5387
|
-
return analyzeSync(template2,
|
|
5379
|
+
analyzeSync(template2, options = {}) {
|
|
5380
|
+
return analyzeSync(template2, options);
|
|
5388
5381
|
}
|
|
5389
|
-
async parseAndAnalyze(html, filename,
|
|
5390
|
-
return analyze(this.parse(html, filename),
|
|
5382
|
+
async parseAndAnalyze(html, filename, options = {}) {
|
|
5383
|
+
return analyze(this.parse(html, filename), options);
|
|
5391
5384
|
}
|
|
5392
|
-
parseAndAnalyzeSync(html, filename,
|
|
5393
|
-
return analyzeSync(this.parse(html, filename),
|
|
5385
|
+
parseAndAnalyzeSync(html, filename, options = {}) {
|
|
5386
|
+
return analyzeSync(this.parse(html, filename), options);
|
|
5394
5387
|
}
|
|
5395
5388
|
/** Return an array of all variables without their properties. */
|
|
5396
|
-
async variables(template2,
|
|
5397
|
-
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);
|
|
5398
5391
|
return Object.keys(analysis.variables);
|
|
5399
5392
|
}
|
|
5400
5393
|
/** Return an array of all variables without their properties. */
|
|
5401
|
-
variablesSync(template2,
|
|
5402
|
-
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2,
|
|
5394
|
+
variablesSync(template2, options = {}) {
|
|
5395
|
+
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2, options);
|
|
5403
5396
|
return Object.keys(analysis.variables);
|
|
5404
5397
|
}
|
|
5405
5398
|
/** Return an array of all variables including their properties/paths. */
|
|
5406
|
-
async fullVariables(template2,
|
|
5407
|
-
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);
|
|
5408
5401
|
return Array.from(new Set(Object.values(analysis.variables).flatMap((a) => a.map((v) => String(v)))));
|
|
5409
5402
|
}
|
|
5410
5403
|
/** Return an array of all variables including their properties/paths. */
|
|
5411
|
-
fullVariablesSync(template2,
|
|
5412
|
-
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2,
|
|
5404
|
+
fullVariablesSync(template2, options = {}) {
|
|
5405
|
+
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2, options);
|
|
5413
5406
|
return Array.from(new Set(Object.values(analysis.variables).flatMap((a) => a.map((v) => String(v)))));
|
|
5414
5407
|
}
|
|
5415
5408
|
/** Return an array of all variables, each as an array of properties/segments. */
|
|
5416
|
-
async variableSegments(template2,
|
|
5417
|
-
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);
|
|
5418
5411
|
return Array.from(strictUniq(Object.values(analysis.variables).flatMap((a) => a.map((v) => v.toArray()))));
|
|
5419
5412
|
}
|
|
5420
5413
|
/** Return an array of all variables, each as an array of properties/segments. */
|
|
5421
|
-
variableSegmentsSync(template2,
|
|
5422
|
-
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2,
|
|
5414
|
+
variableSegmentsSync(template2, options = {}) {
|
|
5415
|
+
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2, options);
|
|
5423
5416
|
return Array.from(strictUniq(Object.values(analysis.variables).flatMap((a) => a.map((v) => v.toArray()))));
|
|
5424
5417
|
}
|
|
5425
5418
|
/** Return an array of all expected context variables without their properties. */
|
|
5426
|
-
async globalVariables(template2,
|
|
5427
|
-
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);
|
|
5428
5421
|
return Object.keys(analysis.globals);
|
|
5429
5422
|
}
|
|
5430
5423
|
/** Return an array of all expected context variables without their properties. */
|
|
5431
|
-
globalVariablesSync(template2,
|
|
5432
|
-
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2,
|
|
5424
|
+
globalVariablesSync(template2, options = {}) {
|
|
5425
|
+
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2, options);
|
|
5433
5426
|
return Object.keys(analysis.globals);
|
|
5434
5427
|
}
|
|
5435
5428
|
/** Return an array of all expected context variables including their properties/paths. */
|
|
5436
|
-
async globalFullVariables(template2,
|
|
5437
|
-
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);
|
|
5438
5431
|
return Array.from(new Set(Object.values(analysis.globals).flatMap((a) => a.map((v) => String(v)))));
|
|
5439
5432
|
}
|
|
5440
5433
|
/** Return an array of all expected context variables including their properties/paths. */
|
|
5441
|
-
globalFullVariablesSync(template2,
|
|
5442
|
-
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2,
|
|
5434
|
+
globalFullVariablesSync(template2, options = {}) {
|
|
5435
|
+
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2, options);
|
|
5443
5436
|
return Array.from(new Set(Object.values(analysis.globals).flatMap((a) => a.map((v) => String(v)))));
|
|
5444
5437
|
}
|
|
5445
5438
|
/** Return an array of all expected context variables, each as an array of properties/segments. */
|
|
5446
|
-
async globalVariableSegments(template2,
|
|
5447
|
-
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);
|
|
5448
5441
|
return Array.from(strictUniq(Object.values(analysis.globals).flatMap((a) => a.map((v) => v.toArray()))));
|
|
5449
5442
|
}
|
|
5450
5443
|
/** Return an array of all expected context variables, each as an array of properties/segments. */
|
|
5451
|
-
globalVariableSegmentsSync(template2,
|
|
5452
|
-
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2,
|
|
5444
|
+
globalVariableSegmentsSync(template2, options = {}) {
|
|
5445
|
+
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2, options);
|
|
5453
5446
|
return Array.from(strictUniq(Object.values(analysis.globals).flatMap((a) => a.map((v) => v.toArray()))));
|
|
5454
5447
|
}
|
|
5455
5448
|
};
|
|
@@ -5487,7 +5480,7 @@ var require_liquid_node = __commonJS({
|
|
|
5487
5480
|
exports.RenderError = RenderError;
|
|
5488
5481
|
exports.RenderTag = RenderTag;
|
|
5489
5482
|
exports.TablerowTag = TablerowTag;
|
|
5490
|
-
exports.Tag =
|
|
5483
|
+
exports.Tag = Tag3;
|
|
5491
5484
|
exports.TagToken = TagToken;
|
|
5492
5485
|
exports.Token = Token;
|
|
5493
5486
|
exports.TokenizationError = TokenizationError;
|
|
@@ -5517,11 +5510,11 @@ var require_liquid_node = __commonJS({
|
|
|
5517
5510
|
}
|
|
5518
5511
|
});
|
|
5519
5512
|
|
|
5520
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5513
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
|
|
5521
5514
|
import { chmodSync, constants, copyFileSync, existsSync as existsSync9, mkdirSync, realpathSync as realpathSync2, renameSync as renameSync3, rmSync as rmSync3, statfsSync as statfsSync2, statSync as statSync4, writeFileSync as writeFileSync2 } from "node:fs";
|
|
5522
5515
|
import { dirname as dirname2, resolve } from "node:path";
|
|
5523
5516
|
|
|
5524
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5517
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/sealed.js
|
|
5525
5518
|
import { createCipheriv, createDecipheriv, createHash, randomBytes, scrypt, timingSafeEqual } from "node:crypto";
|
|
5526
5519
|
import { closeSync, createReadStream, createWriteStream, existsSync, openSync, readSync, renameSync, rmSync, statSync } from "node:fs";
|
|
5527
5520
|
import { Transform } from "node:stream";
|
|
@@ -5628,7 +5621,7 @@ var unsealFile = /* @__PURE__ */ __name(async (from, to, password) => {
|
|
|
5628
5621
|
renameSync(pending, to);
|
|
5629
5622
|
}, "unsealFile");
|
|
5630
5623
|
|
|
5631
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5624
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/compatibility.js
|
|
5632
5625
|
var SPEAKS = MIGRATIONS.at(-1)?.version ?? 0;
|
|
5633
5626
|
var fileSchemaOf = /* @__PURE__ */ __name((database) => {
|
|
5634
5627
|
const tracked = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'schema_migrations'").get();
|
|
@@ -5652,7 +5645,7 @@ var compatibilityOf = /* @__PURE__ */ __name((file2, migrations = MIGRATIONS) =>
|
|
|
5652
5645
|
};
|
|
5653
5646
|
}, "compatibilityOf");
|
|
5654
5647
|
|
|
5655
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5648
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/repair.js
|
|
5656
5649
|
import { createHash as createHash2 } from "node:crypto";
|
|
5657
5650
|
var COPY_MARK = "__repair_";
|
|
5658
5651
|
var COPY_NAME = /__repair_[0-9a-f]{8}(_\d+)?$/;
|
|
@@ -5906,13 +5899,13 @@ var deleteCopy = /* @__PURE__ */ __name((database, name) => {
|
|
|
5906
5899
|
return found;
|
|
5907
5900
|
}, "deleteCopy");
|
|
5908
5901
|
|
|
5909
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5902
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/cli/store-info.js
|
|
5910
5903
|
import { existsSync as existsSync4, statSync as statSync3 } from "node:fs";
|
|
5911
5904
|
|
|
5912
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5905
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
|
|
5913
5906
|
import { existsSync as existsSync3 } from "node:fs";
|
|
5914
5907
|
|
|
5915
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5908
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/store/recover.js
|
|
5916
5909
|
import { execFileSync, spawn } from "node:child_process";
|
|
5917
5910
|
import { existsSync as existsSync2, readFileSync, realpathSync, renameSync as renameSync2, rmSync as rmSync2, statfsSync, statSync as statSync2, writeFileSync } from "node:fs";
|
|
5918
5911
|
import { basename, dirname, join } from "node:path";
|
|
@@ -6210,7 +6203,14 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
|
|
|
6210
6203
|
}, "stopWatching");
|
|
6211
6204
|
try {
|
|
6212
6205
|
const dataVersion = /* @__PURE__ */ __name(() => Number(watch.prepare("PRAGMA data_version").get()?.data_version), "dataVersion");
|
|
6213
|
-
|
|
6206
|
+
let rowsBefore;
|
|
6207
|
+
try {
|
|
6208
|
+
rowsBefore = tableRows(watch);
|
|
6209
|
+
} catch (error) {
|
|
6210
|
+
if (!isStoreDamage(error))
|
|
6211
|
+
throw error;
|
|
6212
|
+
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" });
|
|
6213
|
+
}
|
|
6214
6214
|
const before = { data: dataVersion(), inode: statSync2(path).ino };
|
|
6215
6215
|
const stamp = new Date(now()).toISOString().replace(/[:.]/g, "-");
|
|
6216
6216
|
const target = `${path}.recovering-${stamp}`;
|
|
@@ -6237,7 +6237,8 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
|
|
|
6237
6237
|
let kept;
|
|
6238
6238
|
let dangling;
|
|
6239
6239
|
let json;
|
|
6240
|
-
let
|
|
6240
|
+
let fetch;
|
|
6241
|
+
let schema;
|
|
6241
6242
|
try {
|
|
6242
6243
|
kept = tableRows(opened.database);
|
|
6243
6244
|
migrate(opened.database, { command, ...version ? { version } : {} });
|
|
@@ -6246,7 +6247,8 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
|
|
|
6246
6247
|
rebuilt = rebuildDerived(opened.database, { now, note });
|
|
6247
6248
|
note("looking for rows that point at rows that were lost");
|
|
6248
6249
|
dangling = danglingRows(opened.database);
|
|
6249
|
-
|
|
6250
|
+
fetch = mailToFetch(opened.database);
|
|
6251
|
+
schema = fileSchemaOf(opened.database).version;
|
|
6250
6252
|
opened.database.exec("PRAGMA wal_checkpoint(TRUNCATE)");
|
|
6251
6253
|
} catch (error) {
|
|
6252
6254
|
opened.database.close();
|
|
@@ -6274,6 +6276,7 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
|
|
|
6274
6276
|
for (const suffix of STORE_PARTS)
|
|
6275
6277
|
if (existsSync2(`${target}${suffix}`))
|
|
6276
6278
|
renameSync2(`${target}${suffix}`, `${path}${suffix}`);
|
|
6279
|
+
recordDeepCheck(path, health, { cli: command, ...version ? { version } : {}, schema, now });
|
|
6277
6280
|
const lost = Object.entries(rowsBefore).map(([table, before2]) => ({ table, before: before2, read: read[table] ?? 0, kept: kept[table] ?? 0 })).filter(({ before: before2, read: read2, kept: kept2 }) => before2 === null || before2 > kept2 || read2 > kept2);
|
|
6278
6281
|
const seconds = /* @__PURE__ */ __name((from, to) => Math.round((to - from) / 100) / 10, "seconds");
|
|
6279
6282
|
return {
|
|
@@ -6283,7 +6286,7 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
|
|
|
6283
6286
|
lost,
|
|
6284
6287
|
dangling,
|
|
6285
6288
|
invalidJson: json,
|
|
6286
|
-
mailToFetch:
|
|
6289
|
+
mailToFetch: fetch,
|
|
6287
6290
|
rebuilt,
|
|
6288
6291
|
copyErrors,
|
|
6289
6292
|
health,
|
|
@@ -6299,7 +6302,7 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
|
|
|
6299
6302
|
}
|
|
6300
6303
|
}, "recoverLocked");
|
|
6301
6304
|
|
|
6302
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6305
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
|
|
6303
6306
|
var COUNTED = [
|
|
6304
6307
|
"accounts",
|
|
6305
6308
|
"chats",
|
|
@@ -6314,15 +6317,17 @@ var COUNTED = [
|
|
|
6314
6317
|
"mentions"
|
|
6315
6318
|
];
|
|
6316
6319
|
var stopTimers = /* @__PURE__ */ __name((timers) => `systemctl --user stop ${timers.join(" ")}`, "stopTimers");
|
|
6317
|
-
var storeRecoveryCheck = /* @__PURE__ */ __name(async (env, command) => {
|
|
6320
|
+
var storeRecoveryCheck = /* @__PURE__ */ __name(async (env, command, version) => {
|
|
6318
6321
|
const path = storePath(env);
|
|
6319
6322
|
if (!existsSync3(path))
|
|
6320
6323
|
return { path, exists: false, ok: true, next: [] };
|
|
6321
6324
|
const health = await storeHealth(path, { deep: true });
|
|
6322
6325
|
let rows = {};
|
|
6326
|
+
let schema = null;
|
|
6323
6327
|
try {
|
|
6324
6328
|
const { database } = await openSqlite(path, { readOnly: true });
|
|
6325
6329
|
try {
|
|
6330
|
+
schema = fileSchemaOf(database).version;
|
|
6326
6331
|
const all = tableRows(database);
|
|
6327
6332
|
rows = Object.fromEntries(COUNTED.filter((table) => table in all).map((table) => [table, all[table] ?? null]));
|
|
6328
6333
|
} finally {
|
|
@@ -6330,7 +6335,9 @@ var storeRecoveryCheck = /* @__PURE__ */ __name(async (env, command) => {
|
|
|
6330
6335
|
}
|
|
6331
6336
|
} catch {
|
|
6332
6337
|
}
|
|
6333
|
-
|
|
6338
|
+
recordDeepCheck(path, health, { cli: command, ...version ? { version } : {}, schema });
|
|
6339
|
+
const mark = readDamageMark(path);
|
|
6340
|
+
const explanation = explainDamage(health, command, mark);
|
|
6334
6341
|
const inUse = storeHolders(path) ?? null;
|
|
6335
6342
|
const timers = activeTimers() ?? null;
|
|
6336
6343
|
const sqlite3 = sqlite3Program();
|
|
@@ -6351,6 +6358,8 @@ var storeRecoveryCheck = /* @__PURE__ */ __name(async (env, command) => {
|
|
|
6351
6358
|
invalidJson: health.invalidJson ?? [],
|
|
6352
6359
|
rows,
|
|
6353
6360
|
explanation,
|
|
6361
|
+
damageMark: mark ? (({ inode: _, ...seen }) => seen)(mark) : null,
|
|
6362
|
+
lastKnownGood: readHealthMark(path)?.last_ok_at ?? null,
|
|
6354
6363
|
inUse,
|
|
6355
6364
|
timers,
|
|
6356
6365
|
sqlite3: { version: sqlite3.version, usable: sqlite3.usable },
|
|
@@ -6398,13 +6407,14 @@ var recoveryNotes = /* @__PURE__ */ __name((answer) => {
|
|
|
6398
6407
|
const why = answer.explanation;
|
|
6399
6408
|
return [
|
|
6400
6409
|
...why ? [why.what, ...why.impact, why.externalUnaffected] : [],
|
|
6410
|
+
answer.lastKnownGood ? `the store last passed a deep check at ${answer.lastKnownGood}` : "no deep check that passed is on record for this store",
|
|
6401
6411
|
...answer.next.map((line) => `next: ${line}`)
|
|
6402
6412
|
];
|
|
6403
6413
|
}, "recoveryNotes");
|
|
6404
6414
|
var storeRecoverCommand = /* @__PURE__ */ __name(({ command, version }) => {
|
|
6405
6415
|
const recover = annotate(new Command("recover"), { effects: LOCAL_READ, examples: [`${command} store recover`] }).summary("what is damaged in the store and how to recover it").description("check every page and search index of the store, say what is damaged, what it means and the commands that recover it; changes nothing").action(async function() {
|
|
6406
6416
|
const output = outputFor(this);
|
|
6407
|
-
const answer = await storeRecoveryCheck(environmentOf(this).env ?? process.env, command);
|
|
6417
|
+
const answer = await storeRecoveryCheck(environmentOf(this).env ?? process.env, command, version);
|
|
6408
6418
|
renderAnswer(this, output, itemOf(snakeKeys(answer)));
|
|
6409
6419
|
if (output.format === "pretty")
|
|
6410
6420
|
for (const line of recoveryNotes(answer))
|
|
@@ -6425,7 +6435,7 @@ var storeRecoverCommand = /* @__PURE__ */ __name(({ command, version }) => {
|
|
|
6425
6435
|
return recover;
|
|
6426
6436
|
}, "storeRecoverCommand");
|
|
6427
6437
|
|
|
6428
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6438
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/cli/store-info.js
|
|
6429
6439
|
var pendingIfKnown = /* @__PURE__ */ __name((database) => database.prepare("SELECT 1 FROM pragma_table_info('messages') WHERE name = 'normalized_text'").get() ? pendingNormalization(database) : null, "pendingIfKnown");
|
|
6430
6440
|
var bytesOf = /* @__PURE__ */ __name((path) => existsSync4(path) ? statSync3(path).size : 0, "bytesOf");
|
|
6431
6441
|
var messageOf = /* @__PURE__ */ __name((error) => error instanceof Error ? error.message : String(error), "messageOf");
|
|
@@ -6471,7 +6481,7 @@ var storeInfoCommand = /* @__PURE__ */ __name(() => annotate(new Command("info")
|
|
|
6471
6481
|
renderAnswer(this, outputFor(this), itemOf(answer));
|
|
6472
6482
|
}), "storeInfoCommand");
|
|
6473
6483
|
|
|
6474
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6484
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/cli/messenger/password.js
|
|
6475
6485
|
var ENCRYPT_OPTION = [
|
|
6476
6486
|
"--encrypt",
|
|
6477
6487
|
"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"
|
|
@@ -6490,7 +6500,7 @@ var passwordOf = /* @__PURE__ */ __name(async (command, { twice }) => {
|
|
|
6490
6500
|
return password;
|
|
6491
6501
|
}, "passwordOf");
|
|
6492
6502
|
|
|
6493
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6503
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/replies/rules.js
|
|
6494
6504
|
import { existsSync as existsSync5, readFileSync as readFileSync2 } from "node:fs";
|
|
6495
6505
|
import { join as join2 } from "node:path";
|
|
6496
6506
|
var REPLY_ACTIONS = ["reply", "task"];
|
|
@@ -6661,7 +6671,7 @@ var problem = /* @__PURE__ */ __name((issue) => {
|
|
|
6661
6671
|
}, "problem");
|
|
6662
6672
|
var broken = /* @__PURE__ */ __name((path, why) => new CliError("configuration_error", `the reply rules ${path} cannot be read (${why}) \u2014 fix the file`), "broken");
|
|
6663
6673
|
|
|
6664
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6674
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/replies/state.js
|
|
6665
6675
|
import { existsSync as existsSync6, readFileSync as readFileSync3 } from "node:fs";
|
|
6666
6676
|
import { join as join3 } from "node:path";
|
|
6667
6677
|
var ANSWERED_KEPT = 1e3;
|
|
@@ -6714,7 +6724,7 @@ var recordReply = /* @__PURE__ */ __name((state, rule2, message, now) => {
|
|
|
6714
6724
|
}, "recordReply");
|
|
6715
6725
|
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");
|
|
6716
6726
|
|
|
6717
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6727
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/replies/decide.js
|
|
6718
6728
|
var skip = /* @__PURE__ */ __name((why) => ({ skip: why }), "skip");
|
|
6719
6729
|
var decide = /* @__PURE__ */ __name((rule2, incoming, state, now) => {
|
|
6720
6730
|
const { message, chat, owner, sender } = incoming;
|
|
@@ -6820,8 +6830,37 @@ var filled = /* @__PURE__ */ __name((template2, senderName) => {
|
|
|
6820
6830
|
return template2.replaceAll("{firstName}", name.split(/\s+/)[0] ?? name).replaceAll("{name}", name);
|
|
6821
6831
|
}, "filled");
|
|
6822
6832
|
|
|
6823
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6833
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/replies/template.js
|
|
6834
|
+
var import_liquidjs2 = __toESM(require_liquid_node(), 1);
|
|
6835
|
+
|
|
6836
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/render/liquid.js
|
|
6824
6837
|
var import_liquidjs = __toESM(require_liquid_node(), 1);
|
|
6838
|
+
var safeLiquid = /* @__PURE__ */ __name((limits) => {
|
|
6839
|
+
const engine = new import_liquidjs.Liquid({
|
|
6840
|
+
ownPropertyOnly: true,
|
|
6841
|
+
strictVariables: true,
|
|
6842
|
+
strictFilters: true,
|
|
6843
|
+
lenientIf: false,
|
|
6844
|
+
parseLimit: limits.parse,
|
|
6845
|
+
renderLimit: limits.milliseconds,
|
|
6846
|
+
memoryLimit: limits.memory,
|
|
6847
|
+
preserveTimezones: true
|
|
6848
|
+
});
|
|
6849
|
+
for (const name of ["include", "render", "layout"]) {
|
|
6850
|
+
engine.registerTag(name, class extends import_liquidjs.Tag {
|
|
6851
|
+
constructor(token, tokens, liquid) {
|
|
6852
|
+
super(token, tokens, liquid);
|
|
6853
|
+
throw new Error("templates cannot read files");
|
|
6854
|
+
}
|
|
6855
|
+
render() {
|
|
6856
|
+
return "";
|
|
6857
|
+
}
|
|
6858
|
+
});
|
|
6859
|
+
}
|
|
6860
|
+
return engine;
|
|
6861
|
+
}, "safeLiquid");
|
|
6862
|
+
|
|
6863
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/replies/template.js
|
|
6825
6864
|
var TEMPLATE_LIMITS = {
|
|
6826
6865
|
parse: 32768,
|
|
6827
6866
|
renders: 2e3,
|
|
@@ -6875,28 +6914,8 @@ var renderReplyTemplate = /* @__PURE__ */ __name(async (reply, input) => {
|
|
|
6875
6914
|
hourCycle: "h23"
|
|
6876
6915
|
}).formatToParts(input.now).map(({ type, value }) => [type, value]));
|
|
6877
6916
|
const localTime = `${parts2.year}-${parts2.month}-${parts2.day}T${parts2.hour}:${parts2.minute}:${parts2.second}${parts2.timeZoneName?.replace("GMT", "") || "+00:00"}`;
|
|
6878
|
-
const engine =
|
|
6879
|
-
|
|
6880
|
-
strictVariables: true,
|
|
6881
|
-
strictFilters: true,
|
|
6882
|
-
lenientIf: false,
|
|
6883
|
-
parseLimit: limits.parse,
|
|
6884
|
-
renderLimit: limits.milliseconds,
|
|
6885
|
-
memoryLimit: limits.memory,
|
|
6886
|
-
preserveTimezones: true
|
|
6887
|
-
});
|
|
6888
|
-
for (const name2 of ["include", "render", "layout"]) {
|
|
6889
|
-
engine.registerTag(name2, class extends import_liquidjs.Tag {
|
|
6890
|
-
constructor(token, tokens, liquid) {
|
|
6891
|
-
super(token, tokens, liquid);
|
|
6892
|
-
throw new Error("reply templates cannot read files");
|
|
6893
|
-
}
|
|
6894
|
-
render() {
|
|
6895
|
-
return "";
|
|
6896
|
-
}
|
|
6897
|
-
});
|
|
6898
|
-
}
|
|
6899
|
-
engine.registerTag("ai", class extends import_liquidjs.Tag {
|
|
6917
|
+
const engine = safeLiquid({ parse: limits.parse, memory: limits.memory, milliseconds: limits.milliseconds });
|
|
6918
|
+
engine.registerTag("ai", class extends import_liquidjs2.Tag {
|
|
6900
6919
|
body = [];
|
|
6901
6920
|
fallback = null;
|
|
6902
6921
|
constructor(token, tokens, liquid, parser) {
|
|
@@ -6957,7 +6976,7 @@ var renderReplyTemplate = /* @__PURE__ */ __name(async (reply, input) => {
|
|
|
6957
6976
|
});
|
|
6958
6977
|
const templates = engine.parse(source);
|
|
6959
6978
|
const name = input.senderName?.trim() ?? "";
|
|
6960
|
-
const context = new
|
|
6979
|
+
const context = new import_liquidjs2.Context({
|
|
6961
6980
|
sender: { firstName: name.split(/\s+/)[0] ?? "", name },
|
|
6962
6981
|
chat: { title: input.chat.title ?? "", kind: input.chat.kind },
|
|
6963
6982
|
now: localTime
|
|
@@ -6980,7 +6999,7 @@ var renderReplyTemplate = /* @__PURE__ */ __name(async (reply, input) => {
|
|
|
6980
6999
|
}
|
|
6981
7000
|
}, "renderReplyTemplate");
|
|
6982
7001
|
|
|
6983
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7002
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/replies/dry-run.js
|
|
6984
7003
|
var DRY_RUN_DAYS = 7;
|
|
6985
7004
|
var PAGE = 500;
|
|
6986
7005
|
var dryRun = /* @__PURE__ */ __name(async (store, account, rules, { since, until = Date.now(), only, audience, render }) => {
|
|
@@ -7094,143 +7113,7 @@ var storedSince = /* @__PURE__ */ __name(async (store, account, chat, since) =>
|
|
|
7094
7113
|
}
|
|
7095
7114
|
}, "storedSince");
|
|
7096
7115
|
|
|
7097
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7098
|
-
var endpointKeyName = /* @__PURE__ */ __name((baseUrl) => {
|
|
7099
|
-
const host = new URL(baseUrl).host;
|
|
7100
|
-
return ["openai", "anthropic"].includes(host) ? `endpoint:${host}` : host;
|
|
7101
|
-
}, "endpointKeyName");
|
|
7102
|
-
var embeddingKeys = /* @__PURE__ */ __name((app, env = process.env, keyring) => {
|
|
7103
|
-
const where = { appName: app.appName, prefix: app.envPrefix, env };
|
|
7104
|
-
const credentials = /* @__PURE__ */ __name((provider) => new Credentials({
|
|
7105
|
-
configDir: resolvePaths(where).config,
|
|
7106
|
-
service: app.appName,
|
|
7107
|
-
...["openai", "anthropic"].includes(provider) ? { envVar: envName(app, `${provider.toUpperCase()}_API_KEY`) } : {},
|
|
7108
|
-
isolated: pathsAreOverridden(where),
|
|
7109
|
-
env,
|
|
7110
|
-
...keyring ? { keyring } : {},
|
|
7111
|
-
warn: /* @__PURE__ */ __name((message) => process.stderr.write(`${message}
|
|
7112
|
-
`), "warn")
|
|
7113
|
-
}), "credentials");
|
|
7114
|
-
const account = /* @__PURE__ */ __name((provider) => `embeddings:${provider}`, "account");
|
|
7115
|
-
return {
|
|
7116
|
-
read: /* @__PURE__ */ __name((provider) => {
|
|
7117
|
-
const stored = credentials(provider).read(account(provider));
|
|
7118
|
-
if (stored)
|
|
7119
|
-
return { key: stored.secret, source: stored.source };
|
|
7120
|
-
const shared = ["openai", "anthropic"].includes(provider) ? env[`${provider.toUpperCase()}_API_KEY`]?.trim() : void 0;
|
|
7121
|
-
return shared ? { key: shared, source: "env" } : void 0;
|
|
7122
|
-
}, "read"),
|
|
7123
|
-
write: /* @__PURE__ */ __name((provider, key) => credentials(provider).write(account(provider), key, { signIn: true }), "write"),
|
|
7124
|
-
remove: /* @__PURE__ */ __name((provider) => credentials(provider).remove(account(provider)), "remove")
|
|
7125
|
-
};
|
|
7126
|
-
}, "embeddingKeys");
|
|
7127
|
-
|
|
7128
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/models/openai.js
|
|
7129
|
-
var options = strictObject({
|
|
7130
|
-
temperature: range(0, 2),
|
|
7131
|
-
top_p: range(0, 1),
|
|
7132
|
-
presence_penalty: range(-2, 2),
|
|
7133
|
-
frequency_penalty: range(-2, 2),
|
|
7134
|
-
seed: optional(pipe(number(), integer())),
|
|
7135
|
-
stop: optional(union([string(), array(string())])),
|
|
7136
|
-
response_format: optional(strictObject({ type: picklist(["text", "json_object"]) }))
|
|
7137
|
-
});
|
|
7138
|
-
var openai = {
|
|
7139
|
-
images: true,
|
|
7140
|
-
baseUrl: "https://api.openai.com/v1",
|
|
7141
|
-
validate: /* @__PURE__ */ __name((given) => checkedOptions("openai", options, given), "validate"),
|
|
7142
|
-
complete: /* @__PURE__ */ __name((target, request, checked, apiKey, fetcher) => withTimeLimit(12e4, async (deadline) => {
|
|
7143
|
-
const response = await fetcher(`${target.baseUrl.replace(/\/+$/, "")}/chat/completions`, {
|
|
7144
|
-
method: "POST",
|
|
7145
|
-
headers: { "Content-Type": "application/json", ...apiKey ? { Authorization: `Bearer ${apiKey}` } : {} },
|
|
7146
|
-
body: JSON.stringify({
|
|
7147
|
-
...checked,
|
|
7148
|
-
model: target.model,
|
|
7149
|
-
messages: [
|
|
7150
|
-
{ role: "system", content: systemFor(request) },
|
|
7151
|
-
...messagesFor(request),
|
|
7152
|
-
...request.images === void 0 ? [] : [
|
|
7153
|
-
{
|
|
7154
|
-
role: "user",
|
|
7155
|
-
content: request.images.map((image) => ({
|
|
7156
|
-
type: "image_url",
|
|
7157
|
-
image_url: { url: `data:${image.mimeType};base64,${image.data}`, detail: "high" }
|
|
7158
|
-
}))
|
|
7159
|
-
}
|
|
7160
|
-
]
|
|
7161
|
-
],
|
|
7162
|
-
...new URL(target.baseUrl).hostname === "api.openai.com" ? { max_completion_tokens: request.maxTokens } : { max_tokens: request.maxTokens }
|
|
7163
|
-
}),
|
|
7164
|
-
signal: deadline,
|
|
7165
|
-
redirect: "error"
|
|
7166
|
-
});
|
|
7167
|
-
if (!response.ok)
|
|
7168
|
-
throw new Error("provider rejected request");
|
|
7169
|
-
const body = await response.json();
|
|
7170
|
-
const choice = body.choices?.[0];
|
|
7171
|
-
if (choice?.finish_reason !== "stop" || typeof choice.message?.content !== "string" || !Number.isInteger(body.usage?.total_tokens) || (body.usage?.total_tokens ?? 0) < 1)
|
|
7172
|
-
throw new Error("incomplete response");
|
|
7173
|
-
return { text: choice.message.content, tokens: body.usage?.total_tokens };
|
|
7174
|
-
}), "complete")
|
|
7175
|
-
};
|
|
7176
|
-
|
|
7177
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/models/index.js
|
|
7178
|
-
var modelGateway = /* @__PURE__ */ __name((deps) => ({
|
|
7179
|
-
complete: /* @__PURE__ */ __name(async (request) => {
|
|
7180
|
-
if (deps.signal?.aborted)
|
|
7181
|
-
throw new CliError("cancelled", "model request cancelled");
|
|
7182
|
-
const target = deps.resolve(request.purpose);
|
|
7183
|
-
if (!target || target.provider === "off")
|
|
7184
|
-
throw new CliError("configuration_error", `models.${request.purpose}.provider is not configured; no model was called`);
|
|
7185
|
-
if (!request.purpose || !Number.isSafeInteger(request.maxTokens) || request.maxTokens < 1 || typeof request.prompt !== "string")
|
|
7186
|
-
throw new CliError("validation_error", "a model request needs a purpose, prompt and positive whole maxTokens");
|
|
7187
|
-
validateImages(request.images);
|
|
7188
|
-
let adapter = deps.adapters?.[target.provider];
|
|
7189
|
-
if (!adapter && target.provider === "openai")
|
|
7190
|
-
adapter = openai;
|
|
7191
|
-
if (!adapter && target.provider === "anthropic")
|
|
7192
|
-
adapter = (await import("./anthropic-E3T4USLA.js")).anthropic;
|
|
7193
|
-
if (!adapter)
|
|
7194
|
-
throw new CliError("validation_error", `no model adapter for ${target.provider}`);
|
|
7195
|
-
if (request.images !== void 0 && adapter.images !== true)
|
|
7196
|
-
throw new CliError("validation_error", "the model adapter does not support image inputs");
|
|
7197
|
-
const options2 = adapter.validate(request.options ?? {});
|
|
7198
|
-
const baseUrl = target.baseUrl ?? adapter.baseUrl;
|
|
7199
|
-
if (!target.model.trim() || !endpoint(baseUrl))
|
|
7200
|
-
throw new CliError("validation_error", "a model target needs a model and an HTTP/S endpoint without credentials, query or fragment");
|
|
7201
|
-
if (!await deps.consent(request, { ...target, baseUrl }))
|
|
7202
|
-
throw new CliError("permission_error", `model consent for ${request.purpose} is missing; no data was sent`);
|
|
7203
|
-
const apiKey = await deps.key?.(target.provider, target);
|
|
7204
|
-
if (deps.signal?.aborted)
|
|
7205
|
-
throw new CliError("cancelled", "model request cancelled");
|
|
7206
|
-
const fetcher = deps.fetch ?? fetch;
|
|
7207
|
-
let limited = false;
|
|
7208
|
-
const cancellable = /* @__PURE__ */ __name(async (input, init) => {
|
|
7209
|
-
const signal = init?.signal ?? (input instanceof Request ? input.signal : void 0);
|
|
7210
|
-
const response = await fetcher(input, {
|
|
7211
|
-
...init,
|
|
7212
|
-
signal: deps.signal ? AbortSignal.any([deps.signal, ...signal ? [signal] : []]) : signal
|
|
7213
|
-
});
|
|
7214
|
-
if (response.status === 429)
|
|
7215
|
-
limited = true;
|
|
7216
|
-
return response;
|
|
7217
|
-
}, "cancellable");
|
|
7218
|
-
try {
|
|
7219
|
-
const answer = await adapter.complete({ ...target, baseUrl }, request, options2, apiKey, cancellable);
|
|
7220
|
-
if (deps.signal?.aborted)
|
|
7221
|
-
throw new Error("cancelled");
|
|
7222
|
-
if (typeof answer.text !== "string" || !Number.isSafeInteger(answer.tokens) || answer.tokens < 1)
|
|
7223
|
-
throw new Error("incomplete");
|
|
7224
|
-
return { ...answer, provider: target.provider, model: target.model };
|
|
7225
|
-
} catch {
|
|
7226
|
-
if (limited)
|
|
7227
|
-
throw new CliError("rate_limited", `${request.purpose} provider rate limit reached; no result was stored`);
|
|
7228
|
-
throw new CliError("invalid_response", `${request.purpose} provider failed or returned an incomplete response; no result was stored`);
|
|
7229
|
-
}
|
|
7230
|
-
}, "complete")
|
|
7231
|
-
}), "modelGateway");
|
|
7232
|
-
|
|
7233
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/replies/consents.js
|
|
7116
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/replies/consents.js
|
|
7234
7117
|
import { existsSync as existsSync7, readFileSync as readFileSync4 } from "node:fs";
|
|
7235
7118
|
import { join as join4 } from "node:path";
|
|
7236
7119
|
var shape = strictObject({
|
|
@@ -7255,21 +7138,21 @@ var mayModelReply = /* @__PURE__ */ __name((path, provider, chat) => {
|
|
|
7255
7138
|
return consent.provider === provider && !consent.deniedChats.includes(chat);
|
|
7256
7139
|
}, "mayModelReply");
|
|
7257
7140
|
|
|
7258
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7259
|
-
var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn,
|
|
7141
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/replies/rendering.js
|
|
7142
|
+
var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, options = {
|
|
7260
7143
|
ai: true
|
|
7261
7144
|
}) => async (rule2, message, chat, now) => {
|
|
7262
7145
|
let called;
|
|
7263
7146
|
const gateway = modelGateway({
|
|
7264
|
-
signal:
|
|
7147
|
+
signal: options.signal,
|
|
7265
7148
|
resolve: /* @__PURE__ */ __name((purpose) => {
|
|
7266
7149
|
called = modelTarget(settings(), purpose);
|
|
7267
7150
|
return called;
|
|
7268
7151
|
}, "resolve"),
|
|
7269
7152
|
consent: /* @__PURE__ */ __name((_request, target) => mayModelReply(replyConsentPathFor(app, profile, env), replyModelIdentity(target.provider, target.baseUrl ?? ""), message.chatId), "consent"),
|
|
7270
|
-
key: /* @__PURE__ */ __name((provider, target) => embeddingKeys(app, env,
|
|
7153
|
+
key: /* @__PURE__ */ __name((provider, target) => embeddingKeys(app, env, options.keyring).read(target.baseUrl === void 0 ? provider : endpointKeyName(target.baseUrl))?.key, "key")
|
|
7271
7154
|
});
|
|
7272
|
-
if (
|
|
7155
|
+
if (options.signal?.aborted)
|
|
7273
7156
|
throw new CliError("cancelled", "reply rendering cancelled");
|
|
7274
7157
|
const result2 = await renderReplyTemplate(rule2.reply, {
|
|
7275
7158
|
senderName: message.senderName,
|
|
@@ -7277,8 +7160,8 @@ var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, o
|
|
|
7277
7160
|
now,
|
|
7278
7161
|
timezone: rule2.when.hours?.timezone,
|
|
7279
7162
|
data: message.text,
|
|
7280
|
-
allowAI:
|
|
7281
|
-
preview:
|
|
7163
|
+
allowAI: options.ai === true,
|
|
7164
|
+
preview: options.preview === true,
|
|
7282
7165
|
complete: /* @__PURE__ */ __name(async (prompt, data) => {
|
|
7283
7166
|
const result3 = await gateway.complete({
|
|
7284
7167
|
purpose: "replies",
|
|
@@ -7287,7 +7170,7 @@ var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, o
|
|
|
7287
7170
|
data,
|
|
7288
7171
|
maxTokens: 512
|
|
7289
7172
|
});
|
|
7290
|
-
if (
|
|
7173
|
+
if (options.signal?.aborted)
|
|
7291
7174
|
throw new CliError("cancelled", "reply rendering cancelled");
|
|
7292
7175
|
const current = modelTarget(settings(), "replies");
|
|
7293
7176
|
const baseUrl = called?.baseUrl ?? (called?.provider === "anthropic" ? "https://api.anthropic.com" : "https://api.openai.com/v1");
|
|
@@ -7302,7 +7185,7 @@ var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, o
|
|
|
7302
7185
|
return result2;
|
|
7303
7186
|
}, "replyRenderer");
|
|
7304
7187
|
|
|
7305
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7188
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/replies/serve.js
|
|
7306
7189
|
var NOT_ALLOWED = "replies.send is not allow";
|
|
7307
7190
|
var NO_RULES = "no rules";
|
|
7308
7191
|
var ONLY_TASK = "opened a task, sent nothing";
|
|
@@ -7395,12 +7278,12 @@ var replyTo = /* @__PURE__ */ __name(async (deps, message) => {
|
|
|
7395
7278
|
return { skip: why };
|
|
7396
7279
|
}, "replyTo");
|
|
7397
7280
|
|
|
7398
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7281
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-catch-up.js
|
|
7399
7282
|
var START_SYNC_DELAY_MS = 3e4;
|
|
7400
7283
|
var START_SYNC_BUDGET_MS = 5 * 6e4;
|
|
7401
7284
|
var START_SYNC_WINDOW_MS = 7 * 864e5;
|
|
7402
7285
|
var START_SYNC_PER_CHAT = 500;
|
|
7403
|
-
var startSync = /* @__PURE__ */ __name(({ chats, newestHeld, fetch
|
|
7286
|
+
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 }) => {
|
|
7404
7287
|
const controller = new AbortController();
|
|
7405
7288
|
let timer;
|
|
7406
7289
|
let pass = Promise.resolve();
|
|
@@ -7428,7 +7311,7 @@ var startSync = /* @__PURE__ */ __name(({ chats, newestHeld, fetch: fetch2, note
|
|
|
7428
7311
|
if (stop.aborted)
|
|
7429
7312
|
break;
|
|
7430
7313
|
try {
|
|
7431
|
-
summary.fetched += (await
|
|
7314
|
+
summary.fetched += (await fetch(chat.id, Math.max(held ?? anywhere, floor), stop)).fetched;
|
|
7432
7315
|
summary.chats += 1;
|
|
7433
7316
|
} catch (error) {
|
|
7434
7317
|
if (stop.aborted)
|
|
@@ -7472,10 +7355,10 @@ var startSync = /* @__PURE__ */ __name(({ chats, newestHeld, fetch: fetch2, note
|
|
|
7472
7355
|
};
|
|
7473
7356
|
}, "startSync");
|
|
7474
7357
|
|
|
7475
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7358
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-members.js
|
|
7476
7359
|
var FIRST_FETCH_MS = 6e4;
|
|
7477
7360
|
var DAY_MS = 864e5;
|
|
7478
|
-
var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch
|
|
7361
|
+
var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch, warn, firstMs = FIRST_FETCH_MS, everyMs = DAY_MS }) => {
|
|
7479
7362
|
let timer;
|
|
7480
7363
|
let round = Promise.resolve();
|
|
7481
7364
|
let stopped = false;
|
|
@@ -7488,7 +7371,7 @@ var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch: fetch2, warn, fi
|
|
|
7488
7371
|
if (lastCount?.day === today)
|
|
7489
7372
|
continue;
|
|
7490
7373
|
try {
|
|
7491
|
-
await
|
|
7374
|
+
await fetch(store, account, chatId);
|
|
7492
7375
|
done.fetched += 1;
|
|
7493
7376
|
} catch (error) {
|
|
7494
7377
|
done.failed += 1;
|
|
@@ -7526,7 +7409,7 @@ var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch: fetch2, warn, fi
|
|
|
7526
7409
|
};
|
|
7527
7410
|
}, "memberFetches");
|
|
7528
7411
|
|
|
7529
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7412
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-notice.js
|
|
7530
7413
|
var record2 = /* @__PURE__ */ __name((context, app, severity, attributes) => recordLogFor(context.streams.diagnostic, app, { command: currentRun().command || "serve" })[severity](attributes), "record");
|
|
7531
7414
|
var noticeFor = /* @__PURE__ */ __name((context, app, severity = "warn") => ({ text, ...attributes }) => {
|
|
7532
7415
|
if (context.format === "pretty") {
|
|
@@ -7559,7 +7442,7 @@ var recordDiagnostics = /* @__PURE__ */ __name((context, app) => {
|
|
|
7559
7442
|
return context;
|
|
7560
7443
|
}, "recordDiagnostics");
|
|
7561
7444
|
|
|
7562
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7445
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-stems.js
|
|
7563
7446
|
var STEMS_EVERY_MS = 3e4;
|
|
7564
7447
|
var STEMS_SLICE_MS = 2e3;
|
|
7565
7448
|
var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY_MS, sliceMs = STEMS_SLICE_MS }) => {
|
|
@@ -7599,17 +7482,17 @@ var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY
|
|
|
7599
7482
|
};
|
|
7600
7483
|
}, "stemFills");
|
|
7601
7484
|
|
|
7602
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7485
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/render/messages.js
|
|
7603
7486
|
import { styleText } from "node:util";
|
|
7604
7487
|
var TIME_WIDTH = 8;
|
|
7605
7488
|
var INDENT = " ".repeat(TIME_WIDTH + 2);
|
|
7606
7489
|
var MIN_WIDTH = 40;
|
|
7607
7490
|
var SENDER_COLOURS = ["green", "yellow", "magenta", "blue", "red"];
|
|
7608
|
-
var renderMessages = /* @__PURE__ */ __name((messages,
|
|
7491
|
+
var renderMessages = /* @__PURE__ */ __name((messages, options = {}) => {
|
|
7609
7492
|
if (messages.length === 0)
|
|
7610
7493
|
return "(nothing)";
|
|
7611
|
-
const day = dayFormatter(
|
|
7612
|
-
const paint = painter(
|
|
7494
|
+
const day = dayFormatter(options);
|
|
7495
|
+
const paint = painter(options);
|
|
7613
7496
|
let previous;
|
|
7614
7497
|
const blocks = [];
|
|
7615
7498
|
for (const message of messages) {
|
|
@@ -7617,40 +7500,40 @@ var renderMessages = /* @__PURE__ */ __name((messages, options2 = {}) => {
|
|
|
7617
7500
|
if (date !== previous)
|
|
7618
7501
|
blocks.push(paint("dim", `\u2500\u2500 ${date} \u2500\u2500`));
|
|
7619
7502
|
previous = date;
|
|
7620
|
-
blocks.push(renderMessage(message,
|
|
7503
|
+
blocks.push(renderMessage(message, options));
|
|
7621
7504
|
}
|
|
7622
7505
|
return blocks.join("\n\n");
|
|
7623
7506
|
}, "renderMessages");
|
|
7624
|
-
var renderMessage = /* @__PURE__ */ __name((message,
|
|
7625
|
-
const paint = painter(
|
|
7626
|
-
const width = Math.max(MIN_WIDTH,
|
|
7507
|
+
var renderMessage = /* @__PURE__ */ __name((message, options = {}) => {
|
|
7508
|
+
const paint = painter(options);
|
|
7509
|
+
const width = Math.max(MIN_WIDTH, options.width ?? 80);
|
|
7627
7510
|
const room = width - INDENT.length;
|
|
7628
|
-
const time = timeFormatter(
|
|
7629
|
-
const verbosity =
|
|
7511
|
+
const time = timeFormatter(options);
|
|
7512
|
+
const verbosity = options.verbosity ?? 0;
|
|
7630
7513
|
const chat = "chatTitle" in message ? paint("dim", ` \xB7 ${singleLine(message.chatTitle ?? message.chatId)}`) : "";
|
|
7631
7514
|
const mark = "anchor" in message && message.anchor ? paint("bold", " \u25C0") : "";
|
|
7632
|
-
const lines = [`${paint("dim", time(message.timestamp))} ${senderOf(message,
|
|
7515
|
+
const lines = [`${paint("dim", time(message.timestamp))} ${senderOf(message, options)}${chat}${mark}`];
|
|
7633
7516
|
const body = /* @__PURE__ */ __name((text) => wrapAnsi(visibleControls(text), room, { hard: true }).split("\n"), "body");
|
|
7634
7517
|
const email = message.email;
|
|
7635
7518
|
if (email)
|
|
7636
7519
|
lines.push(paint("dim", mailLine(email)));
|
|
7637
7520
|
if (message.replyTo)
|
|
7638
|
-
lines.push(paint("dim", preview("\u21B3", message.replyTo, room,
|
|
7521
|
+
lines.push(paint("dim", preview("\u21B3", message.replyTo, room, options)));
|
|
7639
7522
|
if (message.forwardedFrom) {
|
|
7640
|
-
lines.push(paint("dim", `\u21AA ${nameOf(message.forwardedFrom,
|
|
7523
|
+
lines.push(paint("dim", `\u21AA ${nameOf(message.forwardedFrom, options)}`));
|
|
7641
7524
|
if (message.forwardedFrom.text)
|
|
7642
7525
|
for (const line of body(message.forwardedFrom.text))
|
|
7643
7526
|
lines.push(line);
|
|
7644
|
-
lines.push(...attachmentLines(message.forwardedFrom.attachments, paint,
|
|
7527
|
+
lines.push(...attachmentLines(message.forwardedFrom.attachments, paint, options));
|
|
7645
7528
|
}
|
|
7646
7529
|
if (message.text)
|
|
7647
7530
|
for (const line of body(message.text))
|
|
7648
7531
|
lines.push(line);
|
|
7649
|
-
lines.push(...attachmentLines(message.attachments, paint,
|
|
7532
|
+
lines.push(...attachmentLines(message.attachments, paint, options));
|
|
7650
7533
|
if (message.reactions && message.reactions.total > 0)
|
|
7651
7534
|
lines.push(paint("dim", reactionLine(message.reactions)));
|
|
7652
7535
|
if (message.editedAt)
|
|
7653
|
-
lines.push(paint("dim", `edited ${editedAt(message,
|
|
7536
|
+
lines.push(paint("dim", `edited ${editedAt(message, options)}`));
|
|
7654
7537
|
if (verbosity >= 1) {
|
|
7655
7538
|
const fields = [
|
|
7656
7539
|
["message", message.id],
|
|
@@ -7662,7 +7545,7 @@ var renderMessage = /* @__PURE__ */ __name((message, options2 = {}) => {
|
|
|
7662
7545
|
...message.attachments.map((a) => ["link", a.url])
|
|
7663
7546
|
];
|
|
7664
7547
|
if (verbosity >= 2) {
|
|
7665
|
-
fields.push(["provider",
|
|
7548
|
+
fields.push(["provider", options.provider], ["profile", options.profile], ["sent", message.timestamp], ["edited", message.editedAt], ["outgoing", message.outgoing === null ? "unknown" : String(message.outgoing)], ...message.attachments.map((a) => ["attachment", JSON.stringify(a)]), ["metadata", message.providerMetadata && JSON.stringify(message.providerMetadata)]);
|
|
7666
7549
|
}
|
|
7667
7550
|
const shown = fields.filter((field) => typeof field[1] === "string");
|
|
7668
7551
|
const label = Math.max(...shown.map(([key]) => key.length));
|
|
@@ -7675,36 +7558,36 @@ var mailLine = /* @__PURE__ */ __name(({ to, cc, labels }) => {
|
|
|
7675
7558
|
return [to.length ? `to ${names(to)}` : "", cc.length ? `cc ${names(cc)}` : "", labels.join(", ")].filter(Boolean).join(" \xB7 ");
|
|
7676
7559
|
}, "mailLine");
|
|
7677
7560
|
var painter = /* @__PURE__ */ __name(({ color = false }) => (style, text) => color ? styleText(style, text, { validateStream: false }) : text, "painter");
|
|
7678
|
-
var senderOf = /* @__PURE__ */ __name((message,
|
|
7679
|
-
const paint = painter(
|
|
7561
|
+
var senderOf = /* @__PURE__ */ __name((message, options) => {
|
|
7562
|
+
const paint = painter(options);
|
|
7680
7563
|
if (message.outgoing === true)
|
|
7681
|
-
return paint(["bold", "cyan"], you(
|
|
7682
|
-
const name = nameOf(message,
|
|
7683
|
-
if (!
|
|
7564
|
+
return paint(["bold", "cyan"], you(options));
|
|
7565
|
+
const name = nameOf(message, options);
|
|
7566
|
+
if (!options.senderColors)
|
|
7684
7567
|
return paint("bold", name);
|
|
7685
7568
|
const colour = SENDER_COLOURS[hash(message.senderId ?? name) % SENDER_COLOURS.length] ?? "green";
|
|
7686
7569
|
return paint(["bold", colour], name);
|
|
7687
7570
|
}, "senderOf");
|
|
7688
|
-
var nameOf = /* @__PURE__ */ __name(({ senderName, senderId, outgoing },
|
|
7571
|
+
var nameOf = /* @__PURE__ */ __name(({ senderName, senderId, outgoing }, options) => outgoing === true ? you(options) : singleLine(senderName ?? senderId ?? "unknown"), "nameOf");
|
|
7689
7572
|
var DEFAULT_LOCALE = "ru-RU";
|
|
7690
7573
|
var you = /* @__PURE__ */ __name(({ locale = DEFAULT_LOCALE }) => locale.startsWith("ru") ? "\u0432\u044B" : "you", "you");
|
|
7691
7574
|
var hash = /* @__PURE__ */ __name((value) => [...value].reduce((sum, char) => sum * 31 + char.charCodeAt(0) >>> 0, 7), "hash");
|
|
7692
|
-
var preview = /* @__PURE__ */ __name((mark, quoted, room,
|
|
7575
|
+
var preview = /* @__PURE__ */ __name((mark, quoted, room, options) => {
|
|
7693
7576
|
const text = singleLine(quoted.text.split("\n")[0] ?? "") || (quoted.attachments[0] ? `\u{1F4CE} ${quoted.attachments[0].kind}` : "");
|
|
7694
|
-
const line = text ? `${mark} ${nameOf(quoted,
|
|
7577
|
+
const line = text ? `${mark} ${nameOf(quoted, options)}: ${text}` : `${mark} message ${quoted.id}`;
|
|
7695
7578
|
if (stringWidth(line) <= room)
|
|
7696
7579
|
return line;
|
|
7697
7580
|
return `${wrapAnsi(line, room - 1, { hard: true }).split("\n")[0]}\u2026`;
|
|
7698
7581
|
}, "preview");
|
|
7699
|
-
var attachmentLines = /* @__PURE__ */ __name((attachments, paint,
|
|
7582
|
+
var attachmentLines = /* @__PURE__ */ __name((attachments, paint, options) => {
|
|
7700
7583
|
const link = /* @__PURE__ */ __name((label, raw) => {
|
|
7701
7584
|
if (raw === void 0)
|
|
7702
7585
|
return label;
|
|
7703
7586
|
const url = singleLine(raw);
|
|
7704
|
-
return
|
|
7587
|
+
return options.color ? `\x1B]8;;${url}\x07${label}\x1B]8;;\x07` : `${label} ${url}`;
|
|
7705
7588
|
}, "link");
|
|
7706
|
-
let
|
|
7707
|
-
const keyboard = attachments.flatMap((attachment) => attachment.buttons ?? []).map((row) => paint("dim", row.map((button) => link(`[${++
|
|
7589
|
+
let number = 0;
|
|
7590
|
+
const keyboard = attachments.flatMap((attachment) => attachment.buttons ?? []).map((row) => paint("dim", row.map((button) => link(`[${++number} ${singleLine(button.text)}]`, button.url)).join(" ")));
|
|
7708
7591
|
const polls = attachments.flatMap((attachment) => attachment.poll ? pollLines(attachment.poll) : []);
|
|
7709
7592
|
const cards = attachments.flatMap(({ contact }) => contact ? [
|
|
7710
7593
|
paint("dim", `\u{1F464} ${[contact.name, contact.phone].flatMap((part) => part ? [singleLine(part)] : []).join(" \xB7 ")}`)
|
|
@@ -7768,14 +7651,14 @@ var reactionLine = /* @__PURE__ */ __name(({ counts, mine }) => {
|
|
|
7768
7651
|
const shown = counts.map(({ reaction, count: count3 }) => `${singleLine(reaction)} ${count3}`).join(" ");
|
|
7769
7652
|
return mine ? `${shown} (you: ${singleLine(mine)})` : shown;
|
|
7770
7653
|
}, "reactionLine");
|
|
7771
|
-
var editedAt = /* @__PURE__ */ __name((message,
|
|
7654
|
+
var editedAt = /* @__PURE__ */ __name((message, options) => {
|
|
7772
7655
|
const edited = message.editedAt ?? message.timestamp;
|
|
7773
|
-
const time = timeFormatter(
|
|
7774
|
-
const day = dayFormatter(
|
|
7656
|
+
const time = timeFormatter(options)(edited);
|
|
7657
|
+
const day = dayFormatter(options);
|
|
7775
7658
|
return day(edited) === day(message.timestamp) ? time : `${day(edited)} ${time}`;
|
|
7776
7659
|
}, "editedAt");
|
|
7777
7660
|
|
|
7778
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7661
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/cli/messenger/message-items.js
|
|
7779
7662
|
var defined = /* @__PURE__ */ __name((value) => Object.fromEntries(Object.entries(value).filter(([, one]) => one !== void 0)), "defined");
|
|
7780
7663
|
var attachmentItem = /* @__PURE__ */ __name((attachment) => defined({
|
|
7781
7664
|
kind: attachment.kind,
|
|
@@ -7870,7 +7753,7 @@ var viewOf = /* @__PURE__ */ __name((context, messenger) => ({
|
|
|
7870
7753
|
locale: messenger.app.locale
|
|
7871
7754
|
}), "viewOf");
|
|
7872
7755
|
|
|
7873
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7756
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-answers.js
|
|
7874
7757
|
var observed = /* @__PURE__ */ __name((value) => ({
|
|
7875
7758
|
value: value.value,
|
|
7876
7759
|
observed_at: value.observedAt,
|
|
@@ -7937,7 +7820,7 @@ var watchEventItem = /* @__PURE__ */ __name((value, account) => {
|
|
|
7937
7820
|
}
|
|
7938
7821
|
}, "watchEventItem");
|
|
7939
7822
|
|
|
7940
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7823
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-command.js
|
|
7941
7824
|
var watchCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("watch"), {
|
|
7942
7825
|
output: { entity: "watch_item" },
|
|
7943
7826
|
effects: REMOTE_READ,
|
|
@@ -8092,7 +7975,7 @@ var describe = /* @__PURE__ */ __name((event, render) => {
|
|
|
8092
7975
|
}
|
|
8093
7976
|
}, "describe");
|
|
8094
7977
|
|
|
8095
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7978
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-command.js
|
|
8096
7979
|
var serveCommand = /* @__PURE__ */ __name((messenger) => {
|
|
8097
7980
|
const command = annotate(new Command("serve"), {
|
|
8098
7981
|
output: { entity: "serve_summary" },
|
|
@@ -8356,7 +8239,7 @@ var tasking = /* @__PURE__ */ __name((context, warn) => {
|
|
|
8356
8239
|
};
|
|
8357
8240
|
}, "tasking");
|
|
8358
8241
|
|
|
8359
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
8242
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/cli/messenger/store-tables-command.js
|
|
8360
8243
|
import { existsSync as existsSync8 } from "node:fs";
|
|
8361
8244
|
var PATH = "store tables list";
|
|
8362
8245
|
var STORE_TABLES_QUERY = {
|
|
@@ -8399,7 +8282,7 @@ var storeTablesCommand = /* @__PURE__ */ __name((messenger) => {
|
|
|
8399
8282
|
return tables;
|
|
8400
8283
|
}, "storeTablesCommand");
|
|
8401
8284
|
|
|
8402
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
8285
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_e0755e4bb52a6ea6d9033617574418d1/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
|
|
8403
8286
|
var SEARCH_INDEXES = ["messages_fts", "chats_fts", "identities_fts"];
|
|
8404
8287
|
var WORD_INDEX = "message_words";
|
|
8405
8288
|
var schemaOf = /* @__PURE__ */ __name((database) => {
|
|
@@ -8425,11 +8308,26 @@ var readingOnly = /* @__PURE__ */ __name(async (path, read) => {
|
|
|
8425
8308
|
database.close();
|
|
8426
8309
|
}
|
|
8427
8310
|
}, "readingOnly");
|
|
8428
|
-
var
|
|
8311
|
+
var withoutInode = /* @__PURE__ */ __name(({ inode: _, ...mark }) => mark, "withoutInode");
|
|
8312
|
+
var fileSchema = /* @__PURE__ */ __name(async (path) => {
|
|
8313
|
+
try {
|
|
8314
|
+
return await readingOnly(path, (database) => fileSchemaOf(database).version);
|
|
8315
|
+
} catch {
|
|
8316
|
+
return null;
|
|
8317
|
+
}
|
|
8318
|
+
}, "fileSchema");
|
|
8319
|
+
var storeSummary = /* @__PURE__ */ __name(async (env, { deep = false, command, version } = {}) => {
|
|
8429
8320
|
const path = storePath(env);
|
|
8430
8321
|
if (!existsSync9(path))
|
|
8431
8322
|
return { path, exists: false };
|
|
8432
8323
|
const checked = await storeHealth(path, { deep });
|
|
8324
|
+
const recorded = deep ? recordDeepCheck(path, checked, {
|
|
8325
|
+
cli: command ?? "unknown",
|
|
8326
|
+
...version ? { version } : {},
|
|
8327
|
+
schema: await fileSchema(path)
|
|
8328
|
+
}) : null;
|
|
8329
|
+
const mark = readDamageMark(path);
|
|
8330
|
+
const lastKnownGood = readHealthMark(path)?.last_ok_at ?? null;
|
|
8433
8331
|
const health = {
|
|
8434
8332
|
checked: checked.checked,
|
|
8435
8333
|
covers: deep ? "every page and every search index" : QUICK_HEALTH_CHECKS,
|
|
@@ -8440,18 +8338,24 @@ var storeSummary = /* @__PURE__ */ __name(async (env, { deep = false, command }
|
|
|
8440
8338
|
...checked.invalidJson?.length ? { invalidJson: checked.invalidJson } : {},
|
|
8441
8339
|
...checked.searchIndexes?.some((index) => !index.ok) ? { damagedSearchIndexes: checked.searchIndexes.filter((index) => !index.ok).map((index) => index.name) } : {}
|
|
8442
8340
|
};
|
|
8443
|
-
const damage = command ? explainDamage(checked, command) : null;
|
|
8444
|
-
const healthOf = {
|
|
8341
|
+
const damage = command ? explainDamage(checked, command, mark) : null;
|
|
8342
|
+
const healthOf = {
|
|
8343
|
+
health,
|
|
8344
|
+
lastKnownGood,
|
|
8345
|
+
...mark ? { damageMark: withoutInode(mark) } : {},
|
|
8346
|
+
...recorded?.cleared ? { damageMarkCleared: withoutInode(recorded.cleared) } : {},
|
|
8347
|
+
...damage ? { damage } : {}
|
|
8348
|
+
};
|
|
8445
8349
|
try {
|
|
8446
8350
|
return await reading(path, (database) => {
|
|
8447
|
-
const { version, writable } = schemaOf(database);
|
|
8351
|
+
const { version: version2, writable } = schemaOf(database);
|
|
8448
8352
|
return {
|
|
8449
8353
|
path,
|
|
8450
8354
|
exists: true,
|
|
8451
|
-
schema:
|
|
8355
|
+
schema: version2,
|
|
8452
8356
|
speaks: SPEAKS,
|
|
8453
8357
|
writable,
|
|
8454
|
-
...
|
|
8358
|
+
...version2 > 0 ? { chats: count2(database, "chats"), messages: count2(database, "messages") } : {},
|
|
8455
8359
|
...healthOf
|
|
8456
8360
|
};
|
|
8457
8361
|
});
|
|
@@ -9063,11 +8967,9 @@ export {
|
|
|
9063
8967
|
readRepliesState,
|
|
9064
8968
|
writeRepliesState,
|
|
9065
8969
|
paused,
|
|
8970
|
+
safeLiquid,
|
|
9066
8971
|
DRY_RUN_DAYS,
|
|
9067
8972
|
dryRun,
|
|
9068
|
-
endpointKeyName,
|
|
9069
|
-
embeddingKeys,
|
|
9070
|
-
modelGateway,
|
|
9071
8973
|
replyConsentPathFor,
|
|
9072
8974
|
readReplyConsent,
|
|
9073
8975
|
writeReplyConsent,
|