@wirecat/cli-memo 0.131.60 → 0.131.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/memo.js +2 -2
- package/dist/bundle/{all-profiles-NUBT2FJI.js → all-profiles-L6EBORCV.js} +5 -5
- package/dist/bundle/{anthropic-QNTKWSQT.js → anthropic-42PADP4V.js} +7 -5
- package/dist/bundle/{app-server-6TXXVCSE.js → app-server-QBJG7OGQ.js} +35 -35
- package/dist/bundle/auto-Z4MEU5OY.js +85 -0
- package/dist/bundle/{bun-3NYKD7YB.js → bun-NYSNYHAD.js} +2 -2
- package/dist/bundle/{bun-sqlite-IIJSZ5I2.js → bun-sqlite-B46U7KI7.js} +2 -2
- package/dist/bundle/{chunk-XBSLZQY4.js → chunk-2UCLF4AO.js} +1284 -797
- package/dist/bundle/{chunk-3M237SBK.js → chunk-2VDRVJCR.js} +5 -5
- package/dist/bundle/{chunk-4VAKZH56.js → chunk-2XVXF4RW.js} +2 -2
- package/dist/bundle/{chunk-MYVP4IFW.js → chunk-347UBASY.js} +3 -3
- package/dist/bundle/{chunk-LZQ7QENQ.js → chunk-37E74SKW.js} +62 -62
- package/dist/bundle/{chunk-NX4XCS64.js → chunk-3ZXWLFUG.js} +21 -21
- package/dist/bundle/{chunk-ND2PQA4X.js → chunk-4GTZSCUE.js} +2 -2
- package/dist/bundle/{chunk-MCPHBBJL.js → chunk-4SUROBD4.js} +23 -1
- package/dist/bundle/{chunk-RU34XFKL.js → chunk-5D7BPC33.js} +1 -1
- package/dist/bundle/{chunk-S2VXXF4H.js → chunk-6OZ2WI7Y.js} +2 -2
- package/dist/bundle/{chunk-67CIUJO6.js → chunk-724DPWN6.js} +1 -1
- package/dist/bundle/{chunk-O55ELCFO.js → chunk-A524HPDV.js} +1 -1
- package/dist/bundle/{chunk-25N2ZCXV.js → chunk-ACG5QN77.js} +2 -2
- package/dist/bundle/{chunk-XW4NE2NW.js → chunk-B3SERZMP.js} +1 -1
- package/dist/bundle/{chunk-G6P5NWIZ.js → chunk-DKO7WEXJ.js} +1 -1
- package/dist/bundle/{chunk-KOBVPWMU.js → chunk-E5JQFEIQ.js} +210 -364
- package/dist/bundle/{chunk-MV6M3VR3.js → chunk-EGI6JHIA.js} +9 -9
- package/dist/bundle/{chunk-RC2NAT7T.js → chunk-FC5PK6M6.js} +12 -12
- package/dist/bundle/{chunk-67L6BQOD.js → chunk-FD3OQYFL.js} +4 -4
- package/dist/bundle/{chunk-CZUMANL4.js → chunk-FG4Q6T72.js} +4 -4
- package/dist/bundle/{chunk-NXV3USUU.js → chunk-FH4P5UQA.js} +3 -3
- package/dist/bundle/{chunk-SYJMQIIJ.js → chunk-FWRBJAQZ.js} +2 -2
- package/dist/bundle/{chunk-DZKTPOTJ.js → chunk-H3COKFXP.js} +98 -32
- package/dist/bundle/{chunk-PNIAEDGJ.js → chunk-HGNWJJDT.js} +516 -356
- package/dist/bundle/{chunk-KMA63WO5.js → chunk-HKC7GDJD.js} +4 -4
- package/dist/bundle/{chunk-L3G5UY2P.js → chunk-HMJ3D7XE.js} +5 -4
- package/dist/bundle/{chunk-636FK3A6.js → chunk-I5L7MLZ6.js} +1 -1
- package/dist/bundle/{chunk-TLZEAHCB.js → chunk-K5VF47E2.js} +5 -5
- package/dist/bundle/{chunk-FXXXBLZD.js → chunk-KREN56SX.js} +5 -5
- package/dist/bundle/{chunk-AEATD5XH.js → chunk-LK6D26RK.js} +21 -21
- package/dist/bundle/{chunk-NSEX4YST.js → chunk-MWAXS4BX.js} +7 -7
- package/dist/bundle/{chunk-4RSPI6OR.js → chunk-NZJUMLTD.js} +1 -1
- package/dist/bundle/{chunk-BZZRBJ2C.js → chunk-O2NQCWRM.js} +28 -28
- package/dist/bundle/{chunk-LXQ56N66.js → chunk-OXBETHGN.js} +8 -8
- package/dist/bundle/{chunk-GGGIUXKD.js → chunk-PKUBC2ME.js} +3 -3
- package/dist/bundle/{chunk-SU2EPGGH.js → chunk-Q3VEUHC7.js} +12 -12
- package/dist/bundle/{chunk-S56CC44R.js → chunk-RGZUDHAQ.js} +7 -7
- package/dist/bundle/{chunk-CZPAYIQR.js → chunk-RLX5SC2X.js} +1 -1
- package/dist/bundle/{chunk-PMGGNQHL.js → chunk-RP6VV35S.js} +1 -1
- package/dist/bundle/{chunk-HF2W6622.js → chunk-RTLQHLHG.js} +4 -4
- package/dist/bundle/{chunk-B6R7O3U5.js → chunk-SIBQ34LX.js} +1 -1
- package/dist/bundle/{chunk-FH56EHWA.js → chunk-SIJA2UYC.js} +6 -6
- package/dist/bundle/{chunk-GLPSPFTP.js → chunk-SJ36WSEI.js} +4 -4
- package/dist/bundle/{chunk-SSKSRETJ.js → chunk-SJ55SMBE.js} +10 -9
- package/dist/bundle/{chunk-VGLDBSGN.js → chunk-SOQGV3ZM.js} +5 -5
- package/dist/bundle/{chunk-LZFQZOAL.js → chunk-TBSWOVM3.js} +667 -301
- package/dist/bundle/{chunk-NMWIWQ7J.js → chunk-TKPIS4G2.js} +1 -1
- package/dist/bundle/{chunk-4II6DM7L.js → chunk-TSKGEK2S.js} +10 -10
- package/dist/bundle/{chunk-EMU7UIUA.js → chunk-V7TJSYFK.js} +2 -2
- package/dist/bundle/{chunk-WUOQ7CQU.js → chunk-VTKLHYCZ.js} +4 -4
- package/dist/bundle/{chunk-BYIKFYRY.js → chunk-VX4HNQLN.js} +2 -2
- package/dist/bundle/{chunk-XXZ3WQSW.js → chunk-WDWKG7FJ.js} +150 -150
- package/dist/bundle/{chunk-VUJANY4X.js → chunk-WDZOEBTE.js} +6 -6
- package/dist/bundle/{chunk-6NYZ32K5.js → chunk-XVREIQ2N.js} +2 -2
- package/dist/bundle/{chunk-Z3SASH3J.js → chunk-XX37LSNV.js} +1 -1
- package/dist/bundle/{chunk-IJKXX7LB.js → chunk-ZUQXDJ7A.js} +1 -1
- package/dist/bundle/{command-contract-KE77NBYG.js → command-contract-SIXWLKAS.js} +11 -11
- package/dist/bundle/{decode-AD352TI2.js → decode-2Z4GCIGA.js} +2 -2
- package/dist/bundle/{echarts-VCQEG6RB.js → echarts-JADCSUD7.js} +2 -2
- package/dist/bundle/{embed-A2YCI5TM.js → embed-ZLEPINEK.js} +3 -3
- package/dist/bundle/{embedder-G35OKUR5.js → embedder-E3DHPZCK.js} +6 -6
- package/dist/bundle/{entry-3Y2C4AAL.js → entry-SFLEGFSN.js} +4 -4
- package/dist/bundle/failure-B33C3BFU.js +65 -0
- package/dist/bundle/{first-run-RDQFQ5MD.js → first-run-ZKDGFY6P.js} +5 -5
- package/dist/bundle/{first-screen-XWHL4AEK.js → first-screen-IQEU7XF2.js} +12 -12
- package/dist/bundle/{instructions-VWX5TPRM.js → instructions-ECXOBMWS.js} +1 -1
- package/dist/bundle/{mcp-JHDRZPSO.js → mcp-Y4XMDC5Q.js} +35 -35
- package/dist/bundle/memo.js +6 -6
- package/dist/bundle/{node-OCRAUHTJ.js → node-A6363DJ4.js} +2 -2
- package/dist/bundle/{node-sqlite-UIZIEENG.js → node-sqlite-FA2P77PW.js} +3 -3
- package/dist/bundle/{oauth-WZOYRQA4.js → oauth-DBGARGR7.js} +4 -4
- package/dist/bundle/{open-ITE5EG22.js → open-5YYG2VWH.js} +2 -2
- package/dist/bundle/{openai-S4TD7H5G.js → openai-BPVP7TZ7.js} +7 -7
- package/dist/bundle/{process-Z7OS65OQ.js → process-DGPZRHQA.js} +1 -1
- package/dist/bundle/{program-PYCRRMXK.js → program-DSQWICNB.js} +688 -298
- package/dist/bundle/{prompt-NW2KOEQS.js → prompt-NTAZWPWA.js} +2 -2
- package/dist/bundle/{recognize-65IM7MS4.js → recognize-OGEP5VD3.js} +1 -1
- package/dist/bundle/{remote-4EOO533Z.js → remote-DER2PFH6.js} +4 -4
- package/dist/bundle/{rerank-LKRFHRN6.js → rerank-PB5ACFHS.js} +4 -4
- package/dist/bundle/{serve-SIB2TBOF.js → serve-KNEY4BXK.js} +6 -6
- package/dist/bundle/server-IQILK5YP.js +61 -0
- package/dist/bundle/server-NKI7SVK5.js +48 -0
- package/dist/bundle/{server-JZAL3SRH.js → server-ZHFC3PIP.js} +55 -53
- package/dist/bundle/{state-245GTWCO.js → state-JMCWHHZM.js} +3 -3
- package/dist/bundle/{store-2QSJI77T.js → store-6H4FPFTX.js} +11 -9
- package/dist/bundle/store-maintenance-command-IFVWSQMJ.js +47 -0
- package/dist/bundle/update-LR5BVLBD.js +68 -0
- package/dist/config-issues.d.ts +4 -1
- package/dist/config-issues.d.ts.map +1 -1
- package/dist/config-issues.js +6 -2
- package/dist/config-issues.js.map +1 -1
- package/dist/digest/command.d.ts.map +1 -1
- package/dist/digest/command.js +11 -7
- package/dist/digest/command.js.map +1 -1
- package/dist/digest/digest.d.ts +29 -4
- package/dist/digest/digest.d.ts.map +1 -1
- package/dist/digest/digest.js +124 -39
- package/dist/digest/digest.js.map +1 -1
- package/dist/digest/sync-health.d.ts +51 -0
- package/dist/digest/sync-health.d.ts.map +1 -0
- package/dist/digest/sync-health.js +116 -0
- package/dist/digest/sync-health.js.map +1 -0
- package/dist/digest/tasks.d.ts +38 -0
- package/dist/digest/tasks.d.ts.map +1 -0
- package/dist/digest/tasks.js +108 -0
- package/dist/digest/tasks.js.map +1 -0
- package/dist/digest/text.d.ts.map +1 -1
- package/dist/digest/text.js +9 -2
- package/dist/digest/text.js.map +1 -1
- package/dist/examples.d.ts.map +1 -1
- package/dist/examples.js +6 -0
- package/dist/examples.js.map +1 -1
- package/dist/knowledge/messenger-sync.d.ts +5 -0
- package/dist/knowledge/messenger-sync.d.ts.map +1 -1
- package/dist/knowledge/messenger-sync.js +12 -9
- package/dist/knowledge/messenger-sync.js.map +1 -1
- package/dist/mcp/catalogue.d.ts.map +1 -1
- package/dist/mcp/catalogue.js +5 -3
- package/dist/mcp/catalogue.js.map +1 -1
- package/dist/mcp/granted.d.ts +13 -0
- package/dist/mcp/granted.d.ts.map +1 -0
- package/dist/mcp/granted.js +19 -0
- package/dist/mcp/granted.js.map +1 -0
- package/dist/models/command.d.ts +2 -2
- package/dist/models/command.d.ts.map +1 -1
- package/dist/models/command.js +4 -1
- package/dist/models/command.js.map +1 -1
- package/dist/notes/embed.d.ts +25 -2
- package/dist/notes/embed.d.ts.map +1 -1
- package/dist/notes/embed.js +80 -6
- package/dist/notes/embed.js.map +1 -1
- package/dist/program.d.ts +4 -2
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +3 -3
- package/dist/program.js.map +1 -1
- package/dist/run/import.d.ts +5 -3
- package/dist/run/import.d.ts.map +1 -1
- package/dist/run/import.js +17 -4
- package/dist/run/import.js.map +1 -1
- package/dist/search/command.d.ts.map +1 -1
- package/dist/search/command.js +10 -3
- package/dist/search/command.js.map +1 -1
- package/dist/search/lane-gates.d.ts +30 -0
- package/dist/search/lane-gates.d.ts.map +1 -0
- package/dist/search/lane-gates.js +59 -0
- package/dist/search/lane-gates.js.map +1 -0
- package/dist/search/search.d.ts +3 -2
- package/dist/search/search.d.ts.map +1 -1
- package/dist/search/search.js +23 -2
- package/dist/search/search.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/skills/morning-digest/SKILL.md +24 -10
- package/dist/bundle/auto-4VLWHDG7.js +0 -86
- package/dist/bundle/chunk-YXBMP74S.js +0 -33
- package/dist/bundle/failure-GHNN2IIX.js +0 -66
- package/dist/bundle/server-DO3J7CR5.js +0 -48
- package/dist/bundle/server-NQLMHLMU.js +0 -61
- package/dist/bundle/store-maintenance-command-F7FSHWHW.js +0 -48
- package/dist/bundle/update-NENHRNFS.js +0 -69
- /package/dist/bundle/{chunk-GK2FRFM6.js → chunk-C3XNJQD7.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-3ZXWLFUG.js";
|
|
7
7
|
import {
|
|
8
8
|
FETCHING,
|
|
9
9
|
QUICK_HEALTH_CHECKS,
|
|
@@ -11,10 +11,13 @@ import {
|
|
|
11
11
|
applyTaskRulesOnArrival,
|
|
12
12
|
capability,
|
|
13
13
|
chatEventAnswer,
|
|
14
|
+
embeddingKeys,
|
|
15
|
+
endpointKeyName,
|
|
14
16
|
explainDamage,
|
|
15
17
|
fts5Tables,
|
|
16
18
|
invalidJson,
|
|
17
19
|
memberAnswer,
|
|
20
|
+
modelGateway,
|
|
18
21
|
newSendId,
|
|
19
22
|
onlineDeps,
|
|
20
23
|
openRequestTask,
|
|
@@ -29,7 +32,7 @@ import {
|
|
|
29
32
|
typedQuery,
|
|
30
33
|
withQuery,
|
|
31
34
|
withTimeLimit
|
|
32
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-2UCLF4AO.js";
|
|
33
36
|
import {
|
|
34
37
|
stringWidth,
|
|
35
38
|
wrapAnsi
|
|
@@ -44,7 +47,6 @@ import {
|
|
|
44
47
|
codeOf,
|
|
45
48
|
currentRun,
|
|
46
49
|
destroysNothing,
|
|
47
|
-
endpoint,
|
|
48
50
|
environmentOf,
|
|
49
51
|
itemOf,
|
|
50
52
|
jsonlRecords,
|
|
@@ -61,20 +63,17 @@ import {
|
|
|
61
63
|
snakeKeys,
|
|
62
64
|
storeTable,
|
|
63
65
|
withoutProviderRefs
|
|
64
|
-
} from "./chunk-
|
|
65
|
-
import {
|
|
66
|
-
envName
|
|
67
|
-
} from "./chunk-PMGGNQHL.js";
|
|
66
|
+
} from "./chunk-WDWKG7FJ.js";
|
|
68
67
|
import {
|
|
69
68
|
holdLock,
|
|
70
69
|
lockPath,
|
|
71
70
|
releaseLock,
|
|
72
71
|
servingProfiles,
|
|
73
72
|
takeLock
|
|
74
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-ACG5QN77.js";
|
|
75
74
|
import {
|
|
76
75
|
holdersOf
|
|
77
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-ZUQXDJ7A.js";
|
|
78
77
|
import {
|
|
79
78
|
CORPORA,
|
|
80
79
|
MIGRATIONS,
|
|
@@ -110,38 +109,27 @@ import {
|
|
|
110
109
|
storeClients,
|
|
111
110
|
storeContents,
|
|
112
111
|
vectorIndexCounts
|
|
113
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-HGNWJJDT.js";
|
|
114
113
|
import {
|
|
115
114
|
queryFieldsOf,
|
|
116
115
|
readDamageMark,
|
|
117
116
|
readHealthMark,
|
|
118
117
|
recordDeepCheck
|
|
119
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-37E74SKW.js";
|
|
120
119
|
import {
|
|
121
120
|
failureKey,
|
|
122
121
|
isStoreDamage
|
|
123
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-2XVXF4RW.js";
|
|
124
123
|
import {
|
|
125
124
|
readSecret
|
|
126
|
-
} from "./chunk-
|
|
127
|
-
import {
|
|
128
|
-
checkedOptions,
|
|
129
|
-
range
|
|
130
|
-
} from "./chunk-YXBMP74S.js";
|
|
131
|
-
import {
|
|
132
|
-
messagesFor,
|
|
133
|
-
systemFor,
|
|
134
|
-
validateImages
|
|
135
|
-
} from "./chunk-MCPHBBJL.js";
|
|
125
|
+
} from "./chunk-4GTZSCUE.js";
|
|
136
126
|
import {
|
|
137
127
|
storePath
|
|
138
|
-
} from "./chunk-
|
|
128
|
+
} from "./chunk-NZJUMLTD.js";
|
|
139
129
|
import {
|
|
140
130
|
openCache
|
|
141
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-SOQGV3ZM.js";
|
|
142
132
|
import {
|
|
143
|
-
Credentials,
|
|
144
|
-
pathsAreOverridden,
|
|
145
133
|
resolvePaths,
|
|
146
134
|
writeSecurely
|
|
147
135
|
} from "./chunk-EMNQPMZO.js";
|
|
@@ -151,10 +139,8 @@ import {
|
|
|
151
139
|
check,
|
|
152
140
|
forward,
|
|
153
141
|
getDotPath,
|
|
154
|
-
integer,
|
|
155
142
|
minLength,
|
|
156
143
|
nullable,
|
|
157
|
-
number,
|
|
158
144
|
object,
|
|
159
145
|
optional,
|
|
160
146
|
parse,
|
|
@@ -166,8 +152,7 @@ import {
|
|
|
166
152
|
strictObject,
|
|
167
153
|
string,
|
|
168
154
|
transform,
|
|
169
|
-
trim
|
|
170
|
-
union
|
|
155
|
+
trim
|
|
171
156
|
} from "./chunk-RCGFSWZE.js";
|
|
172
157
|
import {
|
|
173
158
|
CliError,
|
|
@@ -351,14 +336,14 @@ var require_liquid_node = __commonJS({
|
|
|
351
336
|
return value !== null && (type === "object" || type === "function");
|
|
352
337
|
}
|
|
353
338
|
__name(isObject, "isObject");
|
|
354
|
-
function
|
|
339
|
+
function range(start, stop, step = 1) {
|
|
355
340
|
const arr = [];
|
|
356
341
|
for (let i = start; i < stop; i += step) {
|
|
357
342
|
arr.push(i);
|
|
358
343
|
}
|
|
359
344
|
return arr;
|
|
360
345
|
}
|
|
361
|
-
__name(
|
|
346
|
+
__name(range, "range");
|
|
362
347
|
function padStart(str, length, ch = " ") {
|
|
363
348
|
return pad(str, length, ch, (str2, ch2) => ch2 + str2);
|
|
364
349
|
}
|
|
@@ -552,7 +537,7 @@ var require_liquid_node = __commonJS({
|
|
|
552
537
|
const lines = token.input.split("\n");
|
|
553
538
|
const begin = Math.max(line - 2, 1);
|
|
554
539
|
const end = Math.min(line + 3, lines.length);
|
|
555
|
-
const context =
|
|
540
|
+
const context = range(begin, end + 1).map((lineNumber) => {
|
|
556
541
|
const rowIndicator = lineNumber === line ? ">> " : " ";
|
|
557
542
|
const num = padStart(String(lineNumber), String(end).length);
|
|
558
543
|
let text = `${rowIndicator}${num}| `;
|
|
@@ -1130,8 +1115,8 @@ var require_liquid_node = __commonJS({
|
|
|
1130
1115
|
valid() {
|
|
1131
1116
|
return !isNaN(this.getTime());
|
|
1132
1117
|
}
|
|
1133
|
-
format(
|
|
1134
|
-
return this.DateTimeFormat && this.DateTimeFormat(this.locale,
|
|
1118
|
+
format(options) {
|
|
1119
|
+
return this.DateTimeFormat && this.DateTimeFormat(this.locale, options).format(this.displayDate);
|
|
1135
1120
|
}
|
|
1136
1121
|
/**
|
|
1137
1122
|
* Create a Date object fixed to it's declared Timezone. Both
|
|
@@ -1215,11 +1200,11 @@ var require_liquid_node = __commonJS({
|
|
|
1215
1200
|
static {
|
|
1216
1201
|
__name(this, "TagToken");
|
|
1217
1202
|
}
|
|
1218
|
-
constructor(input, begin, end,
|
|
1219
|
-
const { trimTagLeft, trimTagRight, tagDelimiterLeft, tagDelimiterRight } =
|
|
1203
|
+
constructor(input, begin, end, options, file2) {
|
|
1204
|
+
const { trimTagLeft, trimTagRight, tagDelimiterLeft, tagDelimiterRight } = options;
|
|
1220
1205
|
const [valueBegin, valueEnd] = [begin + tagDelimiterLeft.length, end - tagDelimiterRight.length];
|
|
1221
1206
|
super(exports.TokenKind.Tag, [valueBegin, valueEnd], input, begin, end, trimTagLeft, trimTagRight, file2);
|
|
1222
|
-
this.tokenizer = new Tokenizer(input,
|
|
1207
|
+
this.tokenizer = new Tokenizer(input, options.operators, file2, this.contentRange, options.groupedExpressions);
|
|
1223
1208
|
this.name = this.tokenizer.readTagName();
|
|
1224
1209
|
this.tokenizer.assert(this.name, `illegal tag syntax, tag name expected`);
|
|
1225
1210
|
this.tokenizer.skipBlank();
|
|
@@ -1230,8 +1215,8 @@ var require_liquid_node = __commonJS({
|
|
|
1230
1215
|
static {
|
|
1231
1216
|
__name(this, "OutputToken");
|
|
1232
1217
|
}
|
|
1233
|
-
constructor(input, begin, end,
|
|
1234
|
-
const { trimOutputLeft, trimOutputRight, outputDelimiterLeft, outputDelimiterRight } =
|
|
1218
|
+
constructor(input, begin, end, options, file2) {
|
|
1219
|
+
const { trimOutputLeft, trimOutputRight, outputDelimiterLeft, outputDelimiterRight } = options;
|
|
1235
1220
|
const valueRange = [begin + outputDelimiterLeft.length, end - outputDelimiterRight.length];
|
|
1236
1221
|
super(exports.TokenKind.Output, valueRange, input, begin, end, trimOutputLeft, trimOutputRight, file2);
|
|
1237
1222
|
}
|
|
@@ -1450,9 +1435,9 @@ var require_liquid_node = __commonJS({
|
|
|
1450
1435
|
static {
|
|
1451
1436
|
__name(this, "LiquidTagToken");
|
|
1452
1437
|
}
|
|
1453
|
-
constructor(input, begin, end,
|
|
1438
|
+
constructor(input, begin, end, options, file2) {
|
|
1454
1439
|
super(exports.TokenKind.Tag, [begin, end], input, begin, end, false, false, file2);
|
|
1455
|
-
this.tokenizer = new Tokenizer(input,
|
|
1440
|
+
this.tokenizer = new Tokenizer(input, options.operators, file2, this.contentRange, options.groupedExpressions);
|
|
1456
1441
|
this.name = this.tokenizer.readTagName();
|
|
1457
1442
|
this.tokenizer.assert(this.name, "illegal liquid tag syntax");
|
|
1458
1443
|
this.tokenizer.skipBlank();
|
|
@@ -1526,11 +1511,11 @@ var require_liquid_node = __commonJS({
|
|
|
1526
1511
|
static {
|
|
1527
1512
|
__name(this, "Filter");
|
|
1528
1513
|
}
|
|
1529
|
-
constructor(token,
|
|
1514
|
+
constructor(token, options, liquid) {
|
|
1530
1515
|
this.token = token;
|
|
1531
1516
|
this.name = token.name;
|
|
1532
|
-
this.handler = isFunction(
|
|
1533
|
-
this.raw = !isFunction(
|
|
1517
|
+
this.handler = isFunction(options) ? options : isFunction(options?.handler) ? options.handler : identify;
|
|
1518
|
+
this.raw = !isFunction(options) && !!options?.raw;
|
|
1534
1519
|
this.args = token.args;
|
|
1535
1520
|
this.liquid = liquid;
|
|
1536
1521
|
}
|
|
@@ -1633,7 +1618,7 @@ var require_liquid_node = __commonJS({
|
|
|
1633
1618
|
const low = yield evalTokenValue(token.lhs, ctx);
|
|
1634
1619
|
const high = yield evalTokenValue(token.rhs, ctx);
|
|
1635
1620
|
ctx.memoryLimit.use(high - low + 1);
|
|
1636
|
-
return
|
|
1621
|
+
return range(+low, +high + 1);
|
|
1637
1622
|
}
|
|
1638
1623
|
__name(evalRangeToken, "evalRangeToken");
|
|
1639
1624
|
function* toPostfix(tokens) {
|
|
@@ -2114,41 +2099,41 @@ var require_liquid_node = __commonJS({
|
|
|
2114
2099
|
parseLimit: Infinity,
|
|
2115
2100
|
renderLimit: Infinity
|
|
2116
2101
|
};
|
|
2117
|
-
function normalize(
|
|
2118
|
-
if (
|
|
2119
|
-
if (!
|
|
2120
|
-
|
|
2121
|
-
if (!
|
|
2122
|
-
|
|
2123
|
-
}
|
|
2124
|
-
if (
|
|
2102
|
+
function normalize(options) {
|
|
2103
|
+
if (options.hasOwnProperty("root")) {
|
|
2104
|
+
if (!options.hasOwnProperty("partials"))
|
|
2105
|
+
options.partials = options.root;
|
|
2106
|
+
if (!options.hasOwnProperty("layouts"))
|
|
2107
|
+
options.layouts = options.root;
|
|
2108
|
+
}
|
|
2109
|
+
if (options.hasOwnProperty("cache")) {
|
|
2125
2110
|
let cache;
|
|
2126
|
-
if (typeof
|
|
2127
|
-
cache =
|
|
2128
|
-
else if (typeof
|
|
2129
|
-
cache =
|
|
2111
|
+
if (typeof options.cache === "number")
|
|
2112
|
+
cache = options.cache > 0 ? new LRU(options.cache) : void 0;
|
|
2113
|
+
else if (typeof options.cache === "object")
|
|
2114
|
+
cache = options.cache;
|
|
2130
2115
|
else
|
|
2131
|
-
cache =
|
|
2132
|
-
|
|
2116
|
+
cache = options.cache ? new LRU(1024) : void 0;
|
|
2117
|
+
options.cache = cache;
|
|
2133
2118
|
}
|
|
2134
|
-
|
|
2135
|
-
if ((!
|
|
2119
|
+
options = { ...defaultOptions, ...options.jekyllInclude ? { dynamicPartials: false } : {}, ...options };
|
|
2120
|
+
if ((!options.fs.dirname || !options.fs.sep) && options.relativeReference) {
|
|
2136
2121
|
console.warn("[LiquidJS] `fs.dirname` and `fs.sep` are required for relativeReference, set relativeReference to `false` to suppress this warning");
|
|
2137
|
-
|
|
2122
|
+
options.relativeReference = false;
|
|
2138
2123
|
}
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
if (!
|
|
2144
|
-
|
|
2124
|
+
options.root = normalizeDirectoryList(options.root);
|
|
2125
|
+
options.partials = normalizeDirectoryList(options.partials);
|
|
2126
|
+
options.layouts = normalizeDirectoryList(options.layouts);
|
|
2127
|
+
options.outputEscape = options.outputEscape && getOutputEscapeFunction(options.outputEscape);
|
|
2128
|
+
if (!options.locale) {
|
|
2129
|
+
options.locale = getDateTimeFormat()?.().resolvedOptions().locale ?? "en-US";
|
|
2145
2130
|
}
|
|
2146
|
-
if (
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2131
|
+
if (options.templates) {
|
|
2132
|
+
options.fs = new MapFS(options.templates);
|
|
2133
|
+
options.relativeReference = true;
|
|
2134
|
+
options.root = options.partials = options.layouts = ".";
|
|
2150
2135
|
}
|
|
2151
|
-
return
|
|
2136
|
+
return options;
|
|
2152
2137
|
}
|
|
2153
2138
|
__name(normalize, "normalize");
|
|
2154
2139
|
function getOutputEscapeFunction(nameOrFunction) {
|
|
@@ -2169,14 +2154,14 @@ var require_liquid_node = __commonJS({
|
|
|
2169
2154
|
return list;
|
|
2170
2155
|
}
|
|
2171
2156
|
__name(normalizeDirectoryList, "normalizeDirectoryList");
|
|
2172
|
-
function whiteSpaceCtrl(tokens,
|
|
2157
|
+
function whiteSpaceCtrl(tokens, options) {
|
|
2173
2158
|
let inRaw = false;
|
|
2174
2159
|
for (let i = 0; i < tokens.length; i++) {
|
|
2175
2160
|
const token = tokens[i];
|
|
2176
2161
|
if (!isDelimitedToken(token))
|
|
2177
2162
|
continue;
|
|
2178
2163
|
if (!inRaw && token.trimLeft) {
|
|
2179
|
-
trimLeft(tokens[i - 1],
|
|
2164
|
+
trimLeft(tokens[i - 1], options.greedy);
|
|
2180
2165
|
}
|
|
2181
2166
|
if (isTagToken(token)) {
|
|
2182
2167
|
if (token.name === "raw")
|
|
@@ -2185,7 +2170,7 @@ var require_liquid_node = __commonJS({
|
|
|
2185
2170
|
inRaw = false;
|
|
2186
2171
|
}
|
|
2187
2172
|
if (!inRaw && token.trimRight) {
|
|
2188
|
-
trimRight(tokens[i + 1],
|
|
2173
|
+
trimRight(tokens[i + 1], options.greedy);
|
|
2189
2174
|
}
|
|
2190
2175
|
}
|
|
2191
2176
|
}
|
|
@@ -2212,12 +2197,12 @@ var require_liquid_node = __commonJS({
|
|
|
2212
2197
|
static {
|
|
2213
2198
|
__name(this, "Tokenizer");
|
|
2214
2199
|
}
|
|
2215
|
-
constructor(input, operators = defaultOptions.operators, file2,
|
|
2200
|
+
constructor(input, operators = defaultOptions.operators, file2, range2, groupedExpressions = false) {
|
|
2216
2201
|
this.input = input;
|
|
2217
2202
|
this.file = file2;
|
|
2218
2203
|
this.rawBeginAt = -1;
|
|
2219
|
-
this.p =
|
|
2220
|
-
this.N =
|
|
2204
|
+
this.p = range2 ? range2[0] : 0;
|
|
2205
|
+
this.N = range2 ? range2[1] : input.length;
|
|
2221
2206
|
this.opTrie = createTrie(operators);
|
|
2222
2207
|
this.literalTrie = createTrie(literalValues);
|
|
2223
2208
|
this.groupedExpressions = groupedExpressions;
|
|
@@ -2317,23 +2302,23 @@ var require_liquid_node = __commonJS({
|
|
|
2317
2302
|
const value = this.readValue();
|
|
2318
2303
|
return [key.getText(), value];
|
|
2319
2304
|
}
|
|
2320
|
-
readTopLevelTokens(
|
|
2305
|
+
readTopLevelTokens(options = defaultOptions) {
|
|
2321
2306
|
const tokens = [];
|
|
2322
2307
|
while (this.p < this.N) {
|
|
2323
|
-
const token = this.readTopLevelToken(
|
|
2308
|
+
const token = this.readTopLevelToken(options);
|
|
2324
2309
|
tokens.push(token);
|
|
2325
2310
|
}
|
|
2326
|
-
whiteSpaceCtrl(tokens,
|
|
2311
|
+
whiteSpaceCtrl(tokens, options);
|
|
2327
2312
|
return tokens;
|
|
2328
2313
|
}
|
|
2329
|
-
readTopLevelToken(
|
|
2330
|
-
const { tagDelimiterLeft, outputDelimiterLeft } =
|
|
2314
|
+
readTopLevelToken(options) {
|
|
2315
|
+
const { tagDelimiterLeft, outputDelimiterLeft } = options;
|
|
2331
2316
|
if (this.rawBeginAt > -1)
|
|
2332
|
-
return this.readEndrawOrRawContent(
|
|
2317
|
+
return this.readEndrawOrRawContent(options);
|
|
2333
2318
|
if (this.match(tagDelimiterLeft))
|
|
2334
|
-
return this.readTagToken(
|
|
2319
|
+
return this.readTagToken(options);
|
|
2335
2320
|
if (this.match(outputDelimiterLeft))
|
|
2336
|
-
return this.readOutputToken(
|
|
2321
|
+
return this.readOutputToken(options);
|
|
2337
2322
|
return this.readHTMLToken([tagDelimiterLeft, outputDelimiterLeft]);
|
|
2338
2323
|
}
|
|
2339
2324
|
readHTMLToken(stopStrings) {
|
|
@@ -2345,13 +2330,13 @@ var require_liquid_node = __commonJS({
|
|
|
2345
2330
|
}
|
|
2346
2331
|
return new HTMLToken(this.input, begin, this.p, this.file);
|
|
2347
2332
|
}
|
|
2348
|
-
readTagToken(
|
|
2333
|
+
readTagToken(options) {
|
|
2349
2334
|
const { file: file2, input } = this;
|
|
2350
2335
|
const begin = this.p;
|
|
2351
|
-
if (this.readToDelimiter(
|
|
2336
|
+
if (this.readToDelimiter(options.tagDelimiterRight) === -1) {
|
|
2352
2337
|
throw this.error(`tag ${this.snapshot(begin)} not closed`, begin);
|
|
2353
2338
|
}
|
|
2354
|
-
const token = new TagToken(input, begin, this.p,
|
|
2339
|
+
const token = new TagToken(input, begin, this.p, options, file2);
|
|
2355
2340
|
if (token.name === "raw")
|
|
2356
2341
|
this.rawBeginAt = begin;
|
|
2357
2342
|
return token;
|
|
@@ -2369,17 +2354,17 @@ var require_liquid_node = __commonJS({
|
|
|
2369
2354
|
}
|
|
2370
2355
|
return -1;
|
|
2371
2356
|
}
|
|
2372
|
-
readOutputToken(
|
|
2357
|
+
readOutputToken(options = defaultOptions) {
|
|
2373
2358
|
const { file: file2, input } = this;
|
|
2374
|
-
const { outputDelimiterRight } =
|
|
2359
|
+
const { outputDelimiterRight } = options;
|
|
2375
2360
|
const begin = this.p;
|
|
2376
2361
|
if (this.readToDelimiter(outputDelimiterRight, true) === -1) {
|
|
2377
2362
|
throw this.error(`output ${this.snapshot(begin)} not closed`, begin);
|
|
2378
2363
|
}
|
|
2379
|
-
return new OutputToken(input, begin, this.p,
|
|
2364
|
+
return new OutputToken(input, begin, this.p, options, file2);
|
|
2380
2365
|
}
|
|
2381
|
-
readEndrawOrRawContent(
|
|
2382
|
-
const { tagDelimiterLeft, tagDelimiterRight } =
|
|
2366
|
+
readEndrawOrRawContent(options) {
|
|
2367
|
+
const { tagDelimiterLeft, tagDelimiterRight } = options;
|
|
2383
2368
|
const begin = this.p;
|
|
2384
2369
|
let leftPos = this.readTo(tagDelimiterLeft) - tagDelimiterLeft.length;
|
|
2385
2370
|
while (this.p < this.N) {
|
|
@@ -2392,7 +2377,7 @@ var require_liquid_node = __commonJS({
|
|
|
2392
2377
|
const end = this.p;
|
|
2393
2378
|
if (begin === leftPos) {
|
|
2394
2379
|
this.rawBeginAt = -1;
|
|
2395
|
-
return new TagToken(this.input, begin, end,
|
|
2380
|
+
return new TagToken(this.input, begin, end, options, this.file);
|
|
2396
2381
|
} else {
|
|
2397
2382
|
this.p = leftPos;
|
|
2398
2383
|
return new HTMLToken(this.input, begin, leftPos, this.file);
|
|
@@ -2405,22 +2390,22 @@ var require_liquid_node = __commonJS({
|
|
|
2405
2390
|
}
|
|
2406
2391
|
throw this.error(`raw ${this.snapshot(this.rawBeginAt)} not closed`, begin);
|
|
2407
2392
|
}
|
|
2408
|
-
readLiquidTagTokens(
|
|
2393
|
+
readLiquidTagTokens(options = defaultOptions) {
|
|
2409
2394
|
const tokens = [];
|
|
2410
2395
|
while (this.p < this.N) {
|
|
2411
|
-
const token = this.readLiquidTagToken(
|
|
2396
|
+
const token = this.readLiquidTagToken(options);
|
|
2412
2397
|
token && tokens.push(token);
|
|
2413
2398
|
}
|
|
2414
2399
|
return tokens;
|
|
2415
2400
|
}
|
|
2416
|
-
readLiquidTagToken(
|
|
2401
|
+
readLiquidTagToken(options) {
|
|
2417
2402
|
this.skipBlank();
|
|
2418
2403
|
if (this.end())
|
|
2419
2404
|
return;
|
|
2420
2405
|
const begin = this.p;
|
|
2421
2406
|
this.readToDelimiter("\n");
|
|
2422
2407
|
const end = this.p;
|
|
2423
|
-
return new LiquidTagToken(this.input, begin, end,
|
|
2408
|
+
return new LiquidTagToken(this.input, begin, end, options, this.file);
|
|
2424
2409
|
}
|
|
2425
2410
|
error(msg, pos = this.p) {
|
|
2426
2411
|
return new TokenizationError(msg, new IdentifierToken(this.input, pos, this.N, this.file));
|
|
@@ -2632,12 +2617,12 @@ var require_liquid_node = __commonJS({
|
|
|
2632
2617
|
}
|
|
2633
2618
|
return new QuotedToken(this.input, begin, this.p, this.file);
|
|
2634
2619
|
}
|
|
2635
|
-
*readFileNameTemplate(
|
|
2636
|
-
const { outputDelimiterLeft } =
|
|
2620
|
+
*readFileNameTemplate(options) {
|
|
2621
|
+
const { outputDelimiterLeft } = options;
|
|
2637
2622
|
const htmlStopStrings = [",", " ", "\r", "\n", " ", outputDelimiterLeft];
|
|
2638
2623
|
const htmlStopStringSet = new Set(htmlStopStrings);
|
|
2639
2624
|
while (this.p < this.N && !htmlStopStringSet.has(this.peek())) {
|
|
2640
|
-
yield this.match(outputDelimiterLeft) ? this.readOutputToken(
|
|
2625
|
+
yield this.match(outputDelimiterLeft) ? this.readOutputToken(options) : this.readHTMLToken(htmlStopStrings);
|
|
2641
2626
|
}
|
|
2642
2627
|
}
|
|
2643
2628
|
match(word) {
|
|
@@ -2742,17 +2727,17 @@ var require_liquid_node = __commonJS({
|
|
|
2742
2727
|
return hash2;
|
|
2743
2728
|
}
|
|
2744
2729
|
};
|
|
2745
|
-
function createTagClass(
|
|
2730
|
+
function createTagClass(options) {
|
|
2746
2731
|
return class extends Tag3 {
|
|
2747
2732
|
constructor(token, tokens, liquid) {
|
|
2748
2733
|
super(token, tokens, liquid);
|
|
2749
|
-
if (isFunction(
|
|
2750
|
-
|
|
2734
|
+
if (isFunction(options.parse)) {
|
|
2735
|
+
options.parse.call(this, token, tokens);
|
|
2751
2736
|
}
|
|
2752
2737
|
}
|
|
2753
2738
|
*render(ctx, emitter) {
|
|
2754
2739
|
const hash2 = yield new Hash(this.token.args, ctx.opts.keyValueSeparator).render(ctx);
|
|
2755
|
-
return yield
|
|
2740
|
+
return yield options.render.call(this, ctx, emitter, hash2);
|
|
2756
2741
|
}
|
|
2757
2742
|
};
|
|
2758
2743
|
}
|
|
@@ -2969,13 +2954,13 @@ var require_liquid_node = __commonJS({
|
|
|
2969
2954
|
};
|
|
2970
2955
|
}
|
|
2971
2956
|
__name(_analyze, "_analyze");
|
|
2972
|
-
function analyze(template2,
|
|
2973
|
-
const opts = { ...defaultStaticAnalysisOptions, ...
|
|
2957
|
+
function analyze(template2, options = {}) {
|
|
2958
|
+
const opts = { ...defaultStaticAnalysisOptions, ...options };
|
|
2974
2959
|
return toPromise(_analyze(template2, opts.partials, false));
|
|
2975
2960
|
}
|
|
2976
2961
|
__name(analyze, "analyze");
|
|
2977
|
-
function analyzeSync(template2,
|
|
2978
|
-
const opts = { ...defaultStaticAnalysisOptions, ...
|
|
2962
|
+
function analyzeSync(template2, options = {}) {
|
|
2963
|
+
const opts = { ...defaultStaticAnalysisOptions, ...options };
|
|
2979
2964
|
return toValueSync(_analyze(template2, opts.partials, true));
|
|
2980
2965
|
}
|
|
2981
2966
|
__name(analyzeSync, "analyzeSync");
|
|
@@ -3151,17 +3136,17 @@ var require_liquid_node = __commonJS({
|
|
|
3151
3136
|
static {
|
|
3152
3137
|
__name(this, "Loader");
|
|
3153
3138
|
}
|
|
3154
|
-
constructor(
|
|
3155
|
-
this.options =
|
|
3156
|
-
if (
|
|
3157
|
-
const sep =
|
|
3139
|
+
constructor(options) {
|
|
3140
|
+
this.options = options;
|
|
3141
|
+
if (options.relativeReference) {
|
|
3142
|
+
const sep = options.fs.sep;
|
|
3158
3143
|
assert(sep, "`fs.sep` is required for relative reference");
|
|
3159
3144
|
const prefixes = ["." + sep, ".." + sep, "./", "../"];
|
|
3160
3145
|
this.shouldLoadRelative = (referencedFile) => prefixes.some((prefix) => referencedFile.startsWith(prefix));
|
|
3161
3146
|
} else {
|
|
3162
3147
|
this.shouldLoadRelative = (_referencedFile) => false;
|
|
3163
3148
|
}
|
|
3164
|
-
const fs2 =
|
|
3149
|
+
const fs2 = options.fs;
|
|
3165
3150
|
this.contains = toLiquidAsync(fs2.contains?.bind(fs2) || (async () => true), fs2.containsSync?.bind(fs2) || (() => true));
|
|
3166
3151
|
this.exists = toLiquidAsync(fs2.exists?.bind(fs2) || (async () => false), fs2.existsSync?.bind(fs2));
|
|
3167
3152
|
}
|
|
@@ -5376,76 +5361,76 @@ var require_liquid_node = __commonJS({
|
|
|
5376
5361
|
self.renderFile(filePath, ctx).then((html) => callback(null, html), callback);
|
|
5377
5362
|
};
|
|
5378
5363
|
}
|
|
5379
|
-
async analyze(template2,
|
|
5380
|
-
return analyze(template2,
|
|
5364
|
+
async analyze(template2, options = {}) {
|
|
5365
|
+
return analyze(template2, options);
|
|
5381
5366
|
}
|
|
5382
|
-
analyzeSync(template2,
|
|
5383
|
-
return analyzeSync(template2,
|
|
5367
|
+
analyzeSync(template2, options = {}) {
|
|
5368
|
+
return analyzeSync(template2, options);
|
|
5384
5369
|
}
|
|
5385
|
-
async parseAndAnalyze(html, filename,
|
|
5386
|
-
return analyze(this.parse(html, filename),
|
|
5370
|
+
async parseAndAnalyze(html, filename, options = {}) {
|
|
5371
|
+
return analyze(this.parse(html, filename), options);
|
|
5387
5372
|
}
|
|
5388
|
-
parseAndAnalyzeSync(html, filename,
|
|
5389
|
-
return analyzeSync(this.parse(html, filename),
|
|
5373
|
+
parseAndAnalyzeSync(html, filename, options = {}) {
|
|
5374
|
+
return analyzeSync(this.parse(html, filename), options);
|
|
5390
5375
|
}
|
|
5391
5376
|
/** Return an array of all variables without their properties. */
|
|
5392
|
-
async variables(template2,
|
|
5393
|
-
const analysis = await analyze(isString(template2) ? this.parse(template2) : template2,
|
|
5377
|
+
async variables(template2, options = {}) {
|
|
5378
|
+
const analysis = await analyze(isString(template2) ? this.parse(template2) : template2, options);
|
|
5394
5379
|
return Object.keys(analysis.variables);
|
|
5395
5380
|
}
|
|
5396
5381
|
/** Return an array of all variables without their properties. */
|
|
5397
|
-
variablesSync(template2,
|
|
5398
|
-
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2,
|
|
5382
|
+
variablesSync(template2, options = {}) {
|
|
5383
|
+
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2, options);
|
|
5399
5384
|
return Object.keys(analysis.variables);
|
|
5400
5385
|
}
|
|
5401
5386
|
/** Return an array of all variables including their properties/paths. */
|
|
5402
|
-
async fullVariables(template2,
|
|
5403
|
-
const analysis = await analyze(isString(template2) ? this.parse(template2) : template2,
|
|
5387
|
+
async fullVariables(template2, options = {}) {
|
|
5388
|
+
const analysis = await analyze(isString(template2) ? this.parse(template2) : template2, options);
|
|
5404
5389
|
return Array.from(new Set(Object.values(analysis.variables).flatMap((a) => a.map((v) => String(v)))));
|
|
5405
5390
|
}
|
|
5406
5391
|
/** Return an array of all variables including their properties/paths. */
|
|
5407
|
-
fullVariablesSync(template2,
|
|
5408
|
-
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2,
|
|
5392
|
+
fullVariablesSync(template2, options = {}) {
|
|
5393
|
+
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2, options);
|
|
5409
5394
|
return Array.from(new Set(Object.values(analysis.variables).flatMap((a) => a.map((v) => String(v)))));
|
|
5410
5395
|
}
|
|
5411
5396
|
/** Return an array of all variables, each as an array of properties/segments. */
|
|
5412
|
-
async variableSegments(template2,
|
|
5413
|
-
const analysis = await analyze(isString(template2) ? this.parse(template2) : template2,
|
|
5397
|
+
async variableSegments(template2, options = {}) {
|
|
5398
|
+
const analysis = await analyze(isString(template2) ? this.parse(template2) : template2, options);
|
|
5414
5399
|
return Array.from(strictUniq(Object.values(analysis.variables).flatMap((a) => a.map((v) => v.toArray()))));
|
|
5415
5400
|
}
|
|
5416
5401
|
/** Return an array of all variables, each as an array of properties/segments. */
|
|
5417
|
-
variableSegmentsSync(template2,
|
|
5418
|
-
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2,
|
|
5402
|
+
variableSegmentsSync(template2, options = {}) {
|
|
5403
|
+
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2, options);
|
|
5419
5404
|
return Array.from(strictUniq(Object.values(analysis.variables).flatMap((a) => a.map((v) => v.toArray()))));
|
|
5420
5405
|
}
|
|
5421
5406
|
/** Return an array of all expected context variables without their properties. */
|
|
5422
|
-
async globalVariables(template2,
|
|
5423
|
-
const analysis = await analyze(isString(template2) ? this.parse(template2) : template2,
|
|
5407
|
+
async globalVariables(template2, options = {}) {
|
|
5408
|
+
const analysis = await analyze(isString(template2) ? this.parse(template2) : template2, options);
|
|
5424
5409
|
return Object.keys(analysis.globals);
|
|
5425
5410
|
}
|
|
5426
5411
|
/** Return an array of all expected context variables without their properties. */
|
|
5427
|
-
globalVariablesSync(template2,
|
|
5428
|
-
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2,
|
|
5412
|
+
globalVariablesSync(template2, options = {}) {
|
|
5413
|
+
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2, options);
|
|
5429
5414
|
return Object.keys(analysis.globals);
|
|
5430
5415
|
}
|
|
5431
5416
|
/** Return an array of all expected context variables including their properties/paths. */
|
|
5432
|
-
async globalFullVariables(template2,
|
|
5433
|
-
const analysis = await analyze(isString(template2) ? this.parse(template2) : template2,
|
|
5417
|
+
async globalFullVariables(template2, options = {}) {
|
|
5418
|
+
const analysis = await analyze(isString(template2) ? this.parse(template2) : template2, options);
|
|
5434
5419
|
return Array.from(new Set(Object.values(analysis.globals).flatMap((a) => a.map((v) => String(v)))));
|
|
5435
5420
|
}
|
|
5436
5421
|
/** Return an array of all expected context variables including their properties/paths. */
|
|
5437
|
-
globalFullVariablesSync(template2,
|
|
5438
|
-
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2,
|
|
5422
|
+
globalFullVariablesSync(template2, options = {}) {
|
|
5423
|
+
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2, options);
|
|
5439
5424
|
return Array.from(new Set(Object.values(analysis.globals).flatMap((a) => a.map((v) => String(v)))));
|
|
5440
5425
|
}
|
|
5441
5426
|
/** Return an array of all expected context variables, each as an array of properties/segments. */
|
|
5442
|
-
async globalVariableSegments(template2,
|
|
5443
|
-
const analysis = await analyze(isString(template2) ? this.parse(template2) : template2,
|
|
5427
|
+
async globalVariableSegments(template2, options = {}) {
|
|
5428
|
+
const analysis = await analyze(isString(template2) ? this.parse(template2) : template2, options);
|
|
5444
5429
|
return Array.from(strictUniq(Object.values(analysis.globals).flatMap((a) => a.map((v) => v.toArray()))));
|
|
5445
5430
|
}
|
|
5446
5431
|
/** Return an array of all expected context variables, each as an array of properties/segments. */
|
|
5447
|
-
globalVariableSegmentsSync(template2,
|
|
5448
|
-
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2,
|
|
5432
|
+
globalVariableSegmentsSync(template2, options = {}) {
|
|
5433
|
+
const analysis = analyzeSync(isString(template2) ? this.parse(template2) : template2, options);
|
|
5449
5434
|
return Array.from(strictUniq(Object.values(analysis.globals).flatMap((a) => a.map((v) => v.toArray()))));
|
|
5450
5435
|
}
|
|
5451
5436
|
};
|
|
@@ -5513,11 +5498,11 @@ var require_liquid_node = __commonJS({
|
|
|
5513
5498
|
}
|
|
5514
5499
|
});
|
|
5515
5500
|
|
|
5516
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5501
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
|
|
5517
5502
|
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";
|
|
5518
5503
|
import { dirname as dirname2, resolve } from "node:path";
|
|
5519
5504
|
|
|
5520
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5505
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/sealed.js
|
|
5521
5506
|
import { createCipheriv, createDecipheriv, createHash, randomBytes, scrypt, timingSafeEqual } from "node:crypto";
|
|
5522
5507
|
import { closeSync, createReadStream, createWriteStream, existsSync, openSync, readSync, renameSync, rmSync, statSync } from "node:fs";
|
|
5523
5508
|
import { Transform } from "node:stream";
|
|
@@ -5624,7 +5609,7 @@ var unsealFile = /* @__PURE__ */ __name(async (from, to, password) => {
|
|
|
5624
5609
|
renameSync(pending, to);
|
|
5625
5610
|
}, "unsealFile");
|
|
5626
5611
|
|
|
5627
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5612
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/store/compatibility.js
|
|
5628
5613
|
var SPEAKS = MIGRATIONS.at(-1)?.version ?? 0;
|
|
5629
5614
|
var fileSchemaOf = /* @__PURE__ */ __name((database) => {
|
|
5630
5615
|
const tracked = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'schema_migrations'").get();
|
|
@@ -5648,7 +5633,7 @@ var compatibilityOf = /* @__PURE__ */ __name((file2, migrations = MIGRATIONS) =>
|
|
|
5648
5633
|
};
|
|
5649
5634
|
}, "compatibilityOf");
|
|
5650
5635
|
|
|
5651
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5636
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/store/repair.js
|
|
5652
5637
|
import { createHash as createHash2 } from "node:crypto";
|
|
5653
5638
|
var COPY_MARK = "__repair_";
|
|
5654
5639
|
var COPY_NAME = /__repair_[0-9a-f]{8}(_\d+)?$/;
|
|
@@ -5902,13 +5887,13 @@ var deleteCopy = /* @__PURE__ */ __name((database, name) => {
|
|
|
5902
5887
|
return found;
|
|
5903
5888
|
}, "deleteCopy");
|
|
5904
5889
|
|
|
5905
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5890
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/cli/store-info.js
|
|
5906
5891
|
import { existsSync as existsSync4, statSync as statSync3 } from "node:fs";
|
|
5907
5892
|
|
|
5908
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5893
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
|
|
5909
5894
|
import { existsSync as existsSync3 } from "node:fs";
|
|
5910
5895
|
|
|
5911
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5896
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/store/recover.js
|
|
5912
5897
|
import { execFileSync, spawn } from "node:child_process";
|
|
5913
5898
|
import { existsSync as existsSync2, readFileSync, realpathSync, renameSync as renameSync2, rmSync as rmSync2, statfsSync, statSync as statSync2, writeFileSync } from "node:fs";
|
|
5914
5899
|
import { basename, dirname, join } from "node:path";
|
|
@@ -6240,7 +6225,7 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
|
|
|
6240
6225
|
let kept;
|
|
6241
6226
|
let dangling;
|
|
6242
6227
|
let json;
|
|
6243
|
-
let
|
|
6228
|
+
let fetch;
|
|
6244
6229
|
let schema;
|
|
6245
6230
|
try {
|
|
6246
6231
|
kept = tableRows(opened.database);
|
|
@@ -6250,7 +6235,7 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
|
|
|
6250
6235
|
rebuilt = rebuildDerived(opened.database, { now, note });
|
|
6251
6236
|
note("looking for rows that point at rows that were lost");
|
|
6252
6237
|
dangling = danglingRows(opened.database);
|
|
6253
|
-
|
|
6238
|
+
fetch = mailToFetch(opened.database);
|
|
6254
6239
|
schema = fileSchemaOf(opened.database).version;
|
|
6255
6240
|
opened.database.exec("PRAGMA wal_checkpoint(TRUNCATE)");
|
|
6256
6241
|
} catch (error) {
|
|
@@ -6289,7 +6274,7 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
|
|
|
6289
6274
|
lost,
|
|
6290
6275
|
dangling,
|
|
6291
6276
|
invalidJson: json,
|
|
6292
|
-
mailToFetch:
|
|
6277
|
+
mailToFetch: fetch,
|
|
6293
6278
|
rebuilt,
|
|
6294
6279
|
copyErrors,
|
|
6295
6280
|
health,
|
|
@@ -6305,7 +6290,7 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
|
|
|
6305
6290
|
}
|
|
6306
6291
|
}, "recoverLocked");
|
|
6307
6292
|
|
|
6308
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6293
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
|
|
6309
6294
|
var COUNTED = [
|
|
6310
6295
|
"accounts",
|
|
6311
6296
|
"chats",
|
|
@@ -6438,7 +6423,7 @@ var storeRecoverCommand = /* @__PURE__ */ __name(({ command, version }) => {
|
|
|
6438
6423
|
return recover;
|
|
6439
6424
|
}, "storeRecoverCommand");
|
|
6440
6425
|
|
|
6441
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6426
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/cli/store-info.js
|
|
6442
6427
|
var pendingIfKnown = /* @__PURE__ */ __name((database) => database.prepare("SELECT 1 FROM pragma_table_info('messages') WHERE name = 'normalized_text'").get() ? pendingNormalization(database) : null, "pendingIfKnown");
|
|
6443
6428
|
var bytesOf = /* @__PURE__ */ __name((path) => existsSync4(path) ? statSync3(path).size : 0, "bytesOf");
|
|
6444
6429
|
var messageOf = /* @__PURE__ */ __name((error) => error instanceof Error ? error.message : String(error), "messageOf");
|
|
@@ -6484,7 +6469,7 @@ var storeInfoCommand = /* @__PURE__ */ __name(() => annotate(new Command("info")
|
|
|
6484
6469
|
renderAnswer(this, outputFor(this), itemOf(answer));
|
|
6485
6470
|
}), "storeInfoCommand");
|
|
6486
6471
|
|
|
6487
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6472
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/cli/messenger/password.js
|
|
6488
6473
|
var ENCRYPT_OPTION = [
|
|
6489
6474
|
"--encrypt",
|
|
6490
6475
|
"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"
|
|
@@ -6503,7 +6488,7 @@ var passwordOf = /* @__PURE__ */ __name(async (command, { twice }) => {
|
|
|
6503
6488
|
return password;
|
|
6504
6489
|
}, "passwordOf");
|
|
6505
6490
|
|
|
6506
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6491
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/replies/rules.js
|
|
6507
6492
|
import { existsSync as existsSync5, readFileSync as readFileSync2 } from "node:fs";
|
|
6508
6493
|
import { join as join2 } from "node:path";
|
|
6509
6494
|
var REPLY_ACTIONS = ["reply", "task"];
|
|
@@ -6674,7 +6659,7 @@ var problem = /* @__PURE__ */ __name((issue) => {
|
|
|
6674
6659
|
}, "problem");
|
|
6675
6660
|
var broken = /* @__PURE__ */ __name((path, why) => new CliError("configuration_error", `the reply rules ${path} cannot be read (${why}) \u2014 fix the file`), "broken");
|
|
6676
6661
|
|
|
6677
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6662
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/replies/state.js
|
|
6678
6663
|
import { existsSync as existsSync6, readFileSync as readFileSync3 } from "node:fs";
|
|
6679
6664
|
import { join as join3 } from "node:path";
|
|
6680
6665
|
var ANSWERED_KEPT = 1e3;
|
|
@@ -6727,7 +6712,7 @@ var recordReply = /* @__PURE__ */ __name((state, rule2, message, now) => {
|
|
|
6727
6712
|
}, "recordReply");
|
|
6728
6713
|
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");
|
|
6729
6714
|
|
|
6730
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6715
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/replies/decide.js
|
|
6731
6716
|
var skip = /* @__PURE__ */ __name((why) => ({ skip: why }), "skip");
|
|
6732
6717
|
var decide = /* @__PURE__ */ __name((rule2, incoming, state, now) => {
|
|
6733
6718
|
const { message, chat, owner, sender } = incoming;
|
|
@@ -6833,10 +6818,10 @@ var filled = /* @__PURE__ */ __name((template2, senderName) => {
|
|
|
6833
6818
|
return template2.replaceAll("{firstName}", name.split(/\s+/)[0] ?? name).replaceAll("{name}", name);
|
|
6834
6819
|
}, "filled");
|
|
6835
6820
|
|
|
6836
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6821
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/replies/template.js
|
|
6837
6822
|
var import_liquidjs2 = __toESM(require_liquid_node(), 1);
|
|
6838
6823
|
|
|
6839
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6824
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/render/liquid.js
|
|
6840
6825
|
var import_liquidjs = __toESM(require_liquid_node(), 1);
|
|
6841
6826
|
var safeLiquid = /* @__PURE__ */ __name((limits) => {
|
|
6842
6827
|
const engine = new import_liquidjs.Liquid({
|
|
@@ -6863,7 +6848,7 @@ var safeLiquid = /* @__PURE__ */ __name((limits) => {
|
|
|
6863
6848
|
return engine;
|
|
6864
6849
|
}, "safeLiquid");
|
|
6865
6850
|
|
|
6866
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6851
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/replies/template.js
|
|
6867
6852
|
var TEMPLATE_LIMITS = {
|
|
6868
6853
|
parse: 32768,
|
|
6869
6854
|
renders: 2e3,
|
|
@@ -7002,7 +6987,7 @@ var renderReplyTemplate = /* @__PURE__ */ __name(async (reply, input) => {
|
|
|
7002
6987
|
}
|
|
7003
6988
|
}, "renderReplyTemplate");
|
|
7004
6989
|
|
|
7005
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6990
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/replies/dry-run.js
|
|
7006
6991
|
var DRY_RUN_DAYS = 7;
|
|
7007
6992
|
var PAGE = 500;
|
|
7008
6993
|
var dryRun = /* @__PURE__ */ __name(async (store, account, rules, { since, until = Date.now(), only, audience, render }) => {
|
|
@@ -7116,143 +7101,7 @@ var storedSince = /* @__PURE__ */ __name(async (store, account, chat, since) =>
|
|
|
7116
7101
|
}
|
|
7117
7102
|
}, "storedSince");
|
|
7118
7103
|
|
|
7119
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7120
|
-
var endpointKeyName = /* @__PURE__ */ __name((baseUrl) => {
|
|
7121
|
-
const host = new URL(baseUrl).host;
|
|
7122
|
-
return ["openai", "anthropic"].includes(host) ? `endpoint:${host}` : host;
|
|
7123
|
-
}, "endpointKeyName");
|
|
7124
|
-
var embeddingKeys = /* @__PURE__ */ __name((app, env = process.env, keyring) => {
|
|
7125
|
-
const where = { appName: app.appName, prefix: app.envPrefix, env };
|
|
7126
|
-
const credentials = /* @__PURE__ */ __name((provider) => new Credentials({
|
|
7127
|
-
configDir: resolvePaths(where).config,
|
|
7128
|
-
service: app.appName,
|
|
7129
|
-
...["openai", "anthropic"].includes(provider) ? { envVar: envName(app, `${provider.toUpperCase()}_API_KEY`) } : {},
|
|
7130
|
-
isolated: pathsAreOverridden(where),
|
|
7131
|
-
env,
|
|
7132
|
-
...keyring ? { keyring } : {},
|
|
7133
|
-
warn: /* @__PURE__ */ __name((message) => process.stderr.write(`${message}
|
|
7134
|
-
`), "warn")
|
|
7135
|
-
}), "credentials");
|
|
7136
|
-
const account = /* @__PURE__ */ __name((provider) => `embeddings:${provider}`, "account");
|
|
7137
|
-
return {
|
|
7138
|
-
read: /* @__PURE__ */ __name((provider) => {
|
|
7139
|
-
const stored = credentials(provider).read(account(provider));
|
|
7140
|
-
if (stored)
|
|
7141
|
-
return { key: stored.secret, source: stored.source };
|
|
7142
|
-
const shared = ["openai", "anthropic"].includes(provider) ? env[`${provider.toUpperCase()}_API_KEY`]?.trim() : void 0;
|
|
7143
|
-
return shared ? { key: shared, source: "env" } : void 0;
|
|
7144
|
-
}, "read"),
|
|
7145
|
-
write: /* @__PURE__ */ __name((provider, key) => credentials(provider).write(account(provider), key, { signIn: true }), "write"),
|
|
7146
|
-
remove: /* @__PURE__ */ __name((provider) => credentials(provider).remove(account(provider)), "remove")
|
|
7147
|
-
};
|
|
7148
|
-
}, "embeddingKeys");
|
|
7149
|
-
|
|
7150
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/models/openai.js
|
|
7151
|
-
var options = strictObject({
|
|
7152
|
-
temperature: range(0, 2),
|
|
7153
|
-
top_p: range(0, 1),
|
|
7154
|
-
presence_penalty: range(-2, 2),
|
|
7155
|
-
frequency_penalty: range(-2, 2),
|
|
7156
|
-
seed: optional(pipe(number(), integer())),
|
|
7157
|
-
stop: optional(union([string(), array(string())])),
|
|
7158
|
-
response_format: optional(strictObject({ type: picklist(["text", "json_object"]) }))
|
|
7159
|
-
});
|
|
7160
|
-
var openai = {
|
|
7161
|
-
images: true,
|
|
7162
|
-
baseUrl: "https://api.openai.com/v1",
|
|
7163
|
-
validate: /* @__PURE__ */ __name((given) => checkedOptions("openai", options, given), "validate"),
|
|
7164
|
-
complete: /* @__PURE__ */ __name((target, request, checked, apiKey, fetcher) => withTimeLimit(12e4, async (deadline) => {
|
|
7165
|
-
const response = await fetcher(`${target.baseUrl.replace(/\/+$/, "")}/chat/completions`, {
|
|
7166
|
-
method: "POST",
|
|
7167
|
-
headers: { "Content-Type": "application/json", ...apiKey ? { Authorization: `Bearer ${apiKey}` } : {} },
|
|
7168
|
-
body: JSON.stringify({
|
|
7169
|
-
...checked,
|
|
7170
|
-
model: target.model,
|
|
7171
|
-
messages: [
|
|
7172
|
-
{ role: "system", content: systemFor(request) },
|
|
7173
|
-
...messagesFor(request),
|
|
7174
|
-
...request.images === void 0 ? [] : [
|
|
7175
|
-
{
|
|
7176
|
-
role: "user",
|
|
7177
|
-
content: request.images.map((image) => ({
|
|
7178
|
-
type: "image_url",
|
|
7179
|
-
image_url: { url: `data:${image.mimeType};base64,${image.data}`, detail: "high" }
|
|
7180
|
-
}))
|
|
7181
|
-
}
|
|
7182
|
-
]
|
|
7183
|
-
],
|
|
7184
|
-
...new URL(target.baseUrl).hostname === "api.openai.com" ? { max_completion_tokens: request.maxTokens } : { max_tokens: request.maxTokens }
|
|
7185
|
-
}),
|
|
7186
|
-
signal: deadline,
|
|
7187
|
-
redirect: "error"
|
|
7188
|
-
});
|
|
7189
|
-
if (!response.ok)
|
|
7190
|
-
throw new Error("provider rejected request");
|
|
7191
|
-
const body = await response.json();
|
|
7192
|
-
const choice = body.choices?.[0];
|
|
7193
|
-
if (choice?.finish_reason !== "stop" || typeof choice.message?.content !== "string" || !Number.isInteger(body.usage?.total_tokens) || (body.usage?.total_tokens ?? 0) < 1)
|
|
7194
|
-
throw new Error("incomplete response");
|
|
7195
|
-
return { text: choice.message.content, tokens: body.usage?.total_tokens };
|
|
7196
|
-
}), "complete")
|
|
7197
|
-
};
|
|
7198
|
-
|
|
7199
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/models/index.js
|
|
7200
|
-
var modelGateway = /* @__PURE__ */ __name((deps) => ({
|
|
7201
|
-
complete: /* @__PURE__ */ __name(async (request) => {
|
|
7202
|
-
if (deps.signal?.aborted)
|
|
7203
|
-
throw new CliError("cancelled", "model request cancelled");
|
|
7204
|
-
const target = deps.resolve(request.purpose);
|
|
7205
|
-
if (!target || target.provider === "off")
|
|
7206
|
-
throw new CliError("configuration_error", `models.${request.purpose}.provider is not configured; no model was called`);
|
|
7207
|
-
if (!request.purpose || !Number.isSafeInteger(request.maxTokens) || request.maxTokens < 1 || typeof request.prompt !== "string")
|
|
7208
|
-
throw new CliError("validation_error", "a model request needs a purpose, prompt and positive whole maxTokens");
|
|
7209
|
-
validateImages(request.images);
|
|
7210
|
-
let adapter = deps.adapters?.[target.provider];
|
|
7211
|
-
if (!adapter && target.provider === "openai")
|
|
7212
|
-
adapter = openai;
|
|
7213
|
-
if (!adapter && target.provider === "anthropic")
|
|
7214
|
-
adapter = (await import("./anthropic-QNTKWSQT.js")).anthropic;
|
|
7215
|
-
if (!adapter)
|
|
7216
|
-
throw new CliError("validation_error", `no model adapter for ${target.provider}`);
|
|
7217
|
-
if (request.images !== void 0 && adapter.images !== true)
|
|
7218
|
-
throw new CliError("validation_error", "the model adapter does not support image inputs");
|
|
7219
|
-
const options2 = adapter.validate(request.options ?? {});
|
|
7220
|
-
const baseUrl = target.baseUrl ?? adapter.baseUrl;
|
|
7221
|
-
if (!target.model.trim() || !endpoint(baseUrl))
|
|
7222
|
-
throw new CliError("validation_error", "a model target needs a model and an HTTP/S endpoint without credentials, query or fragment");
|
|
7223
|
-
if (!await deps.consent(request, { ...target, baseUrl }))
|
|
7224
|
-
throw new CliError("permission_error", `model consent for ${request.purpose} is missing; no data was sent`);
|
|
7225
|
-
const apiKey = await deps.key?.(target.provider, target);
|
|
7226
|
-
if (deps.signal?.aborted)
|
|
7227
|
-
throw new CliError("cancelled", "model request cancelled");
|
|
7228
|
-
const fetcher = deps.fetch ?? fetch;
|
|
7229
|
-
let limited = false;
|
|
7230
|
-
const cancellable = /* @__PURE__ */ __name(async (input, init) => {
|
|
7231
|
-
const signal = init?.signal ?? (input instanceof Request ? input.signal : void 0);
|
|
7232
|
-
const response = await fetcher(input, {
|
|
7233
|
-
...init,
|
|
7234
|
-
signal: deps.signal ? AbortSignal.any([deps.signal, ...signal ? [signal] : []]) : signal
|
|
7235
|
-
});
|
|
7236
|
-
if (response.status === 429)
|
|
7237
|
-
limited = true;
|
|
7238
|
-
return response;
|
|
7239
|
-
}, "cancellable");
|
|
7240
|
-
try {
|
|
7241
|
-
const answer = await adapter.complete({ ...target, baseUrl }, request, options2, apiKey, cancellable);
|
|
7242
|
-
if (deps.signal?.aborted)
|
|
7243
|
-
throw new Error("cancelled");
|
|
7244
|
-
if (typeof answer.text !== "string" || !Number.isSafeInteger(answer.tokens) || answer.tokens < 1)
|
|
7245
|
-
throw new Error("incomplete");
|
|
7246
|
-
return { ...answer, provider: target.provider, model: target.model };
|
|
7247
|
-
} catch {
|
|
7248
|
-
if (limited)
|
|
7249
|
-
throw new CliError("rate_limited", `${request.purpose} provider rate limit reached; no result was stored`);
|
|
7250
|
-
throw new CliError("invalid_response", `${request.purpose} provider failed or returned an incomplete response; no result was stored`);
|
|
7251
|
-
}
|
|
7252
|
-
}, "complete")
|
|
7253
|
-
}), "modelGateway");
|
|
7254
|
-
|
|
7255
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.611.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_019e5129f390ba1047db736f75b19440/node_modules/@wirecat/cli-core/dist/replies/consents.js
|
|
7104
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/replies/consents.js
|
|
7256
7105
|
import { existsSync as existsSync7, readFileSync as readFileSync4 } from "node:fs";
|
|
7257
7106
|
import { join as join4 } from "node:path";
|
|
7258
7107
|
var shape = strictObject({
|
|
@@ -7277,21 +7126,21 @@ var mayModelReply = /* @__PURE__ */ __name((path, provider, chat) => {
|
|
|
7277
7126
|
return consent.provider === provider && !consent.deniedChats.includes(chat);
|
|
7278
7127
|
}, "mayModelReply");
|
|
7279
7128
|
|
|
7280
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7281
|
-
var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn,
|
|
7129
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/replies/rendering.js
|
|
7130
|
+
var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, options = {
|
|
7282
7131
|
ai: true
|
|
7283
7132
|
}) => async (rule2, message, chat, now) => {
|
|
7284
7133
|
let called;
|
|
7285
7134
|
const gateway = modelGateway({
|
|
7286
|
-
signal:
|
|
7135
|
+
signal: options.signal,
|
|
7287
7136
|
resolve: /* @__PURE__ */ __name((purpose) => {
|
|
7288
7137
|
called = modelTarget(settings(), purpose);
|
|
7289
7138
|
return called;
|
|
7290
7139
|
}, "resolve"),
|
|
7291
7140
|
consent: /* @__PURE__ */ __name((_request, target) => mayModelReply(replyConsentPathFor(app, profile, env), replyModelIdentity(target.provider, target.baseUrl ?? ""), message.chatId), "consent"),
|
|
7292
|
-
key: /* @__PURE__ */ __name((provider, target) => embeddingKeys(app, env,
|
|
7141
|
+
key: /* @__PURE__ */ __name((provider, target) => embeddingKeys(app, env, options.keyring).read(target.baseUrl === void 0 ? provider : endpointKeyName(target.baseUrl))?.key, "key")
|
|
7293
7142
|
});
|
|
7294
|
-
if (
|
|
7143
|
+
if (options.signal?.aborted)
|
|
7295
7144
|
throw new CliError("cancelled", "reply rendering cancelled");
|
|
7296
7145
|
const result2 = await renderReplyTemplate(rule2.reply, {
|
|
7297
7146
|
senderName: message.senderName,
|
|
@@ -7299,8 +7148,8 @@ var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, o
|
|
|
7299
7148
|
now,
|
|
7300
7149
|
timezone: rule2.when.hours?.timezone,
|
|
7301
7150
|
data: message.text,
|
|
7302
|
-
allowAI:
|
|
7303
|
-
preview:
|
|
7151
|
+
allowAI: options.ai === true,
|
|
7152
|
+
preview: options.preview === true,
|
|
7304
7153
|
complete: /* @__PURE__ */ __name(async (prompt, data) => {
|
|
7305
7154
|
const result3 = await gateway.complete({
|
|
7306
7155
|
purpose: "replies",
|
|
@@ -7309,7 +7158,7 @@ var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, o
|
|
|
7309
7158
|
data,
|
|
7310
7159
|
maxTokens: 512
|
|
7311
7160
|
});
|
|
7312
|
-
if (
|
|
7161
|
+
if (options.signal?.aborted)
|
|
7313
7162
|
throw new CliError("cancelled", "reply rendering cancelled");
|
|
7314
7163
|
const current = modelTarget(settings(), "replies");
|
|
7315
7164
|
const baseUrl = called?.baseUrl ?? (called?.provider === "anthropic" ? "https://api.anthropic.com" : "https://api.openai.com/v1");
|
|
@@ -7324,7 +7173,7 @@ var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, o
|
|
|
7324
7173
|
return result2;
|
|
7325
7174
|
}, "replyRenderer");
|
|
7326
7175
|
|
|
7327
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7176
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/replies/serve.js
|
|
7328
7177
|
var NOT_ALLOWED = "replies.send is not allow";
|
|
7329
7178
|
var NO_RULES = "no rules";
|
|
7330
7179
|
var ONLY_TASK = "opened a task, sent nothing";
|
|
@@ -7417,12 +7266,12 @@ var replyTo = /* @__PURE__ */ __name(async (deps, message) => {
|
|
|
7417
7266
|
return { skip: why };
|
|
7418
7267
|
}, "replyTo");
|
|
7419
7268
|
|
|
7420
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7269
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-catch-up.js
|
|
7421
7270
|
var START_SYNC_DELAY_MS = 3e4;
|
|
7422
7271
|
var START_SYNC_BUDGET_MS = 5 * 6e4;
|
|
7423
7272
|
var START_SYNC_WINDOW_MS = 7 * 864e5;
|
|
7424
7273
|
var START_SYNC_PER_CHAT = 500;
|
|
7425
|
-
var startSync = /* @__PURE__ */ __name(({ chats, newestHeld, fetch
|
|
7274
|
+
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 }) => {
|
|
7426
7275
|
const controller = new AbortController();
|
|
7427
7276
|
let timer;
|
|
7428
7277
|
let pass = Promise.resolve();
|
|
@@ -7450,7 +7299,7 @@ var startSync = /* @__PURE__ */ __name(({ chats, newestHeld, fetch: fetch2, note
|
|
|
7450
7299
|
if (stop.aborted)
|
|
7451
7300
|
break;
|
|
7452
7301
|
try {
|
|
7453
|
-
summary.fetched += (await
|
|
7302
|
+
summary.fetched += (await fetch(chat.id, Math.max(held ?? anywhere, floor), stop)).fetched;
|
|
7454
7303
|
summary.chats += 1;
|
|
7455
7304
|
} catch (error) {
|
|
7456
7305
|
if (stop.aborted)
|
|
@@ -7494,10 +7343,10 @@ var startSync = /* @__PURE__ */ __name(({ chats, newestHeld, fetch: fetch2, note
|
|
|
7494
7343
|
};
|
|
7495
7344
|
}, "startSync");
|
|
7496
7345
|
|
|
7497
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7346
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-members.js
|
|
7498
7347
|
var FIRST_FETCH_MS = 6e4;
|
|
7499
7348
|
var DAY_MS = 864e5;
|
|
7500
|
-
var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch
|
|
7349
|
+
var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch, warn, firstMs = FIRST_FETCH_MS, everyMs = DAY_MS }) => {
|
|
7501
7350
|
let timer;
|
|
7502
7351
|
let round = Promise.resolve();
|
|
7503
7352
|
let stopped = false;
|
|
@@ -7510,7 +7359,7 @@ var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch: fetch2, warn, fi
|
|
|
7510
7359
|
if (lastCount?.day === today)
|
|
7511
7360
|
continue;
|
|
7512
7361
|
try {
|
|
7513
|
-
await
|
|
7362
|
+
await fetch(store, account, chatId);
|
|
7514
7363
|
done.fetched += 1;
|
|
7515
7364
|
} catch (error) {
|
|
7516
7365
|
done.failed += 1;
|
|
@@ -7548,7 +7397,7 @@ var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch: fetch2, warn, fi
|
|
|
7548
7397
|
};
|
|
7549
7398
|
}, "memberFetches");
|
|
7550
7399
|
|
|
7551
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7400
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-notice.js
|
|
7552
7401
|
var record2 = /* @__PURE__ */ __name((context, app, severity, attributes) => recordLogFor(context.streams.diagnostic, app, { command: currentRun().command || "serve" })[severity](attributes), "record");
|
|
7553
7402
|
var noticeFor = /* @__PURE__ */ __name((context, app, severity = "warn") => ({ text, ...attributes }) => {
|
|
7554
7403
|
if (context.format === "pretty") {
|
|
@@ -7581,7 +7430,7 @@ var recordDiagnostics = /* @__PURE__ */ __name((context, app) => {
|
|
|
7581
7430
|
return context;
|
|
7582
7431
|
}, "recordDiagnostics");
|
|
7583
7432
|
|
|
7584
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7433
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-stems.js
|
|
7585
7434
|
var STEMS_EVERY_MS = 3e4;
|
|
7586
7435
|
var STEMS_SLICE_MS = 2e3;
|
|
7587
7436
|
var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY_MS, sliceMs = STEMS_SLICE_MS }) => {
|
|
@@ -7621,17 +7470,17 @@ var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY
|
|
|
7621
7470
|
};
|
|
7622
7471
|
}, "stemFills");
|
|
7623
7472
|
|
|
7624
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7473
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/render/messages.js
|
|
7625
7474
|
import { styleText } from "node:util";
|
|
7626
7475
|
var TIME_WIDTH = 8;
|
|
7627
7476
|
var INDENT = " ".repeat(TIME_WIDTH + 2);
|
|
7628
7477
|
var MIN_WIDTH = 40;
|
|
7629
7478
|
var SENDER_COLOURS = ["green", "yellow", "magenta", "blue", "red"];
|
|
7630
|
-
var renderMessages = /* @__PURE__ */ __name((messages,
|
|
7479
|
+
var renderMessages = /* @__PURE__ */ __name((messages, options = {}) => {
|
|
7631
7480
|
if (messages.length === 0)
|
|
7632
7481
|
return "(nothing)";
|
|
7633
|
-
const day = dayFormatter(
|
|
7634
|
-
const paint = painter(
|
|
7482
|
+
const day = dayFormatter(options);
|
|
7483
|
+
const paint = painter(options);
|
|
7635
7484
|
let previous;
|
|
7636
7485
|
const blocks = [];
|
|
7637
7486
|
for (const message of messages) {
|
|
@@ -7639,40 +7488,40 @@ var renderMessages = /* @__PURE__ */ __name((messages, options2 = {}) => {
|
|
|
7639
7488
|
if (date !== previous)
|
|
7640
7489
|
blocks.push(paint("dim", `\u2500\u2500 ${date} \u2500\u2500`));
|
|
7641
7490
|
previous = date;
|
|
7642
|
-
blocks.push(renderMessage(message,
|
|
7491
|
+
blocks.push(renderMessage(message, options));
|
|
7643
7492
|
}
|
|
7644
7493
|
return blocks.join("\n\n");
|
|
7645
7494
|
}, "renderMessages");
|
|
7646
|
-
var renderMessage = /* @__PURE__ */ __name((message,
|
|
7647
|
-
const paint = painter(
|
|
7648
|
-
const width = Math.max(MIN_WIDTH,
|
|
7495
|
+
var renderMessage = /* @__PURE__ */ __name((message, options = {}) => {
|
|
7496
|
+
const paint = painter(options);
|
|
7497
|
+
const width = Math.max(MIN_WIDTH, options.width ?? 80);
|
|
7649
7498
|
const room = width - INDENT.length;
|
|
7650
|
-
const time = timeFormatter(
|
|
7651
|
-
const verbosity =
|
|
7499
|
+
const time = timeFormatter(options);
|
|
7500
|
+
const verbosity = options.verbosity ?? 0;
|
|
7652
7501
|
const chat = "chatTitle" in message ? paint("dim", ` \xB7 ${singleLine(message.chatTitle ?? message.chatId)}`) : "";
|
|
7653
7502
|
const mark = "anchor" in message && message.anchor ? paint("bold", " \u25C0") : "";
|
|
7654
|
-
const lines = [`${paint("dim", time(message.timestamp))} ${senderOf(message,
|
|
7503
|
+
const lines = [`${paint("dim", time(message.timestamp))} ${senderOf(message, options)}${chat}${mark}`];
|
|
7655
7504
|
const body = /* @__PURE__ */ __name((text) => wrapAnsi(visibleControls(text), room, { hard: true }).split("\n"), "body");
|
|
7656
7505
|
const email = message.email;
|
|
7657
7506
|
if (email)
|
|
7658
7507
|
lines.push(paint("dim", mailLine(email)));
|
|
7659
7508
|
if (message.replyTo)
|
|
7660
|
-
lines.push(paint("dim", preview("\u21B3", message.replyTo, room,
|
|
7509
|
+
lines.push(paint("dim", preview("\u21B3", message.replyTo, room, options)));
|
|
7661
7510
|
if (message.forwardedFrom) {
|
|
7662
|
-
lines.push(paint("dim", `\u21AA ${nameOf(message.forwardedFrom,
|
|
7511
|
+
lines.push(paint("dim", `\u21AA ${nameOf(message.forwardedFrom, options)}`));
|
|
7663
7512
|
if (message.forwardedFrom.text)
|
|
7664
7513
|
for (const line of body(message.forwardedFrom.text))
|
|
7665
7514
|
lines.push(line);
|
|
7666
|
-
lines.push(...attachmentLines(message.forwardedFrom.attachments, paint,
|
|
7515
|
+
lines.push(...attachmentLines(message.forwardedFrom.attachments, paint, options));
|
|
7667
7516
|
}
|
|
7668
7517
|
if (message.text)
|
|
7669
7518
|
for (const line of body(message.text))
|
|
7670
7519
|
lines.push(line);
|
|
7671
|
-
lines.push(...attachmentLines(message.attachments, paint,
|
|
7520
|
+
lines.push(...attachmentLines(message.attachments, paint, options));
|
|
7672
7521
|
if (message.reactions && message.reactions.total > 0)
|
|
7673
7522
|
lines.push(paint("dim", reactionLine(message.reactions)));
|
|
7674
7523
|
if (message.editedAt)
|
|
7675
|
-
lines.push(paint("dim", `edited ${editedAt(message,
|
|
7524
|
+
lines.push(paint("dim", `edited ${editedAt(message, options)}`));
|
|
7676
7525
|
if (verbosity >= 1) {
|
|
7677
7526
|
const fields = [
|
|
7678
7527
|
["message", message.id],
|
|
@@ -7684,7 +7533,7 @@ var renderMessage = /* @__PURE__ */ __name((message, options2 = {}) => {
|
|
|
7684
7533
|
...message.attachments.map((a) => ["link", a.url])
|
|
7685
7534
|
];
|
|
7686
7535
|
if (verbosity >= 2) {
|
|
7687
|
-
fields.push(["provider",
|
|
7536
|
+
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)]);
|
|
7688
7537
|
}
|
|
7689
7538
|
const shown = fields.filter((field) => typeof field[1] === "string");
|
|
7690
7539
|
const label = Math.max(...shown.map(([key]) => key.length));
|
|
@@ -7697,36 +7546,36 @@ var mailLine = /* @__PURE__ */ __name(({ to, cc, labels }) => {
|
|
|
7697
7546
|
return [to.length ? `to ${names(to)}` : "", cc.length ? `cc ${names(cc)}` : "", labels.join(", ")].filter(Boolean).join(" \xB7 ");
|
|
7698
7547
|
}, "mailLine");
|
|
7699
7548
|
var painter = /* @__PURE__ */ __name(({ color = false }) => (style, text) => color ? styleText(style, text, { validateStream: false }) : text, "painter");
|
|
7700
|
-
var senderOf = /* @__PURE__ */ __name((message,
|
|
7701
|
-
const paint = painter(
|
|
7549
|
+
var senderOf = /* @__PURE__ */ __name((message, options) => {
|
|
7550
|
+
const paint = painter(options);
|
|
7702
7551
|
if (message.outgoing === true)
|
|
7703
|
-
return paint(["bold", "cyan"], you(
|
|
7704
|
-
const name = nameOf(message,
|
|
7705
|
-
if (!
|
|
7552
|
+
return paint(["bold", "cyan"], you(options));
|
|
7553
|
+
const name = nameOf(message, options);
|
|
7554
|
+
if (!options.senderColors)
|
|
7706
7555
|
return paint("bold", name);
|
|
7707
7556
|
const colour = SENDER_COLOURS[hash(message.senderId ?? name) % SENDER_COLOURS.length] ?? "green";
|
|
7708
7557
|
return paint(["bold", colour], name);
|
|
7709
7558
|
}, "senderOf");
|
|
7710
|
-
var nameOf = /* @__PURE__ */ __name(({ senderName, senderId, outgoing },
|
|
7559
|
+
var nameOf = /* @__PURE__ */ __name(({ senderName, senderId, outgoing }, options) => outgoing === true ? you(options) : singleLine(senderName ?? senderId ?? "unknown"), "nameOf");
|
|
7711
7560
|
var DEFAULT_LOCALE = "ru-RU";
|
|
7712
7561
|
var you = /* @__PURE__ */ __name(({ locale = DEFAULT_LOCALE }) => locale.startsWith("ru") ? "\u0432\u044B" : "you", "you");
|
|
7713
7562
|
var hash = /* @__PURE__ */ __name((value) => [...value].reduce((sum, char) => sum * 31 + char.charCodeAt(0) >>> 0, 7), "hash");
|
|
7714
|
-
var preview = /* @__PURE__ */ __name((mark, quoted, room,
|
|
7563
|
+
var preview = /* @__PURE__ */ __name((mark, quoted, room, options) => {
|
|
7715
7564
|
const text = singleLine(quoted.text.split("\n")[0] ?? "") || (quoted.attachments[0] ? `\u{1F4CE} ${quoted.attachments[0].kind}` : "");
|
|
7716
|
-
const line = text ? `${mark} ${nameOf(quoted,
|
|
7565
|
+
const line = text ? `${mark} ${nameOf(quoted, options)}: ${text}` : `${mark} message ${quoted.id}`;
|
|
7717
7566
|
if (stringWidth(line) <= room)
|
|
7718
7567
|
return line;
|
|
7719
7568
|
return `${wrapAnsi(line, room - 1, { hard: true }).split("\n")[0]}\u2026`;
|
|
7720
7569
|
}, "preview");
|
|
7721
|
-
var attachmentLines = /* @__PURE__ */ __name((attachments, paint,
|
|
7570
|
+
var attachmentLines = /* @__PURE__ */ __name((attachments, paint, options) => {
|
|
7722
7571
|
const link = /* @__PURE__ */ __name((label, raw) => {
|
|
7723
7572
|
if (raw === void 0)
|
|
7724
7573
|
return label;
|
|
7725
7574
|
const url = singleLine(raw);
|
|
7726
|
-
return
|
|
7575
|
+
return options.color ? `\x1B]8;;${url}\x07${label}\x1B]8;;\x07` : `${label} ${url}`;
|
|
7727
7576
|
}, "link");
|
|
7728
|
-
let
|
|
7729
|
-
const keyboard = attachments.flatMap((attachment) => attachment.buttons ?? []).map((row) => paint("dim", row.map((button) => link(`[${++
|
|
7577
|
+
let number = 0;
|
|
7578
|
+
const keyboard = attachments.flatMap((attachment) => attachment.buttons ?? []).map((row) => paint("dim", row.map((button) => link(`[${++number} ${singleLine(button.text)}]`, button.url)).join(" ")));
|
|
7730
7579
|
const polls = attachments.flatMap((attachment) => attachment.poll ? pollLines(attachment.poll) : []);
|
|
7731
7580
|
const cards = attachments.flatMap(({ contact }) => contact ? [
|
|
7732
7581
|
paint("dim", `\u{1F464} ${[contact.name, contact.phone].flatMap((part) => part ? [singleLine(part)] : []).join(" \xB7 ")}`)
|
|
@@ -7790,14 +7639,14 @@ var reactionLine = /* @__PURE__ */ __name(({ counts, mine }) => {
|
|
|
7790
7639
|
const shown = counts.map(({ reaction, count: count3 }) => `${singleLine(reaction)} ${count3}`).join(" ");
|
|
7791
7640
|
return mine ? `${shown} (you: ${singleLine(mine)})` : shown;
|
|
7792
7641
|
}, "reactionLine");
|
|
7793
|
-
var editedAt = /* @__PURE__ */ __name((message,
|
|
7642
|
+
var editedAt = /* @__PURE__ */ __name((message, options) => {
|
|
7794
7643
|
const edited = message.editedAt ?? message.timestamp;
|
|
7795
|
-
const time = timeFormatter(
|
|
7796
|
-
const day = dayFormatter(
|
|
7644
|
+
const time = timeFormatter(options)(edited);
|
|
7645
|
+
const day = dayFormatter(options);
|
|
7797
7646
|
return day(edited) === day(message.timestamp) ? time : `${day(edited)} ${time}`;
|
|
7798
7647
|
}, "editedAt");
|
|
7799
7648
|
|
|
7800
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7649
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/cli/messenger/message-items.js
|
|
7801
7650
|
var defined = /* @__PURE__ */ __name((value) => Object.fromEntries(Object.entries(value).filter(([, one]) => one !== void 0)), "defined");
|
|
7802
7651
|
var attachmentItem = /* @__PURE__ */ __name((attachment) => defined({
|
|
7803
7652
|
kind: attachment.kind,
|
|
@@ -7892,7 +7741,7 @@ var viewOf = /* @__PURE__ */ __name((context, messenger) => ({
|
|
|
7892
7741
|
locale: messenger.app.locale
|
|
7893
7742
|
}), "viewOf");
|
|
7894
7743
|
|
|
7895
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7744
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-answers.js
|
|
7896
7745
|
var observed = /* @__PURE__ */ __name((value) => ({
|
|
7897
7746
|
value: value.value,
|
|
7898
7747
|
observed_at: value.observedAt,
|
|
@@ -7959,7 +7808,7 @@ var watchEventItem = /* @__PURE__ */ __name((value, account) => {
|
|
|
7959
7808
|
}
|
|
7960
7809
|
}, "watchEventItem");
|
|
7961
7810
|
|
|
7962
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7811
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-command.js
|
|
7963
7812
|
var watchCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("watch"), {
|
|
7964
7813
|
output: { entity: "watch_item" },
|
|
7965
7814
|
effects: REMOTE_READ,
|
|
@@ -8114,7 +7963,7 @@ var describe = /* @__PURE__ */ __name((event, render) => {
|
|
|
8114
7963
|
}
|
|
8115
7964
|
}, "describe");
|
|
8116
7965
|
|
|
8117
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7966
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-command.js
|
|
8118
7967
|
var serveCommand = /* @__PURE__ */ __name((messenger) => {
|
|
8119
7968
|
const command = annotate(new Command("serve"), {
|
|
8120
7969
|
output: { entity: "serve_summary" },
|
|
@@ -8378,7 +8227,7 @@ var tasking = /* @__PURE__ */ __name((context, warn) => {
|
|
|
8378
8227
|
};
|
|
8379
8228
|
}, "tasking");
|
|
8380
8229
|
|
|
8381
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
8230
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/cli/messenger/store-tables-command.js
|
|
8382
8231
|
import { existsSync as existsSync8 } from "node:fs";
|
|
8383
8232
|
var PATH = "store tables list";
|
|
8384
8233
|
var STORE_TABLES_QUERY = {
|
|
@@ -8421,7 +8270,7 @@ var storeTablesCommand = /* @__PURE__ */ __name((messenger) => {
|
|
|
8421
8270
|
return tables;
|
|
8422
8271
|
}, "storeTablesCommand");
|
|
8423
8272
|
|
|
8424
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
8273
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.613.0_@wirecat+cli-base@0.82.0_commander@15.0.0_esbuild@0.28.2_type_562287bbc40b862fa82b63f307e02b11/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
|
|
8425
8274
|
var SEARCH_INDEXES = ["messages_fts", "chats_fts", "identities_fts"];
|
|
8426
8275
|
var WORD_INDEX = "message_words";
|
|
8427
8276
|
var schemaOf = /* @__PURE__ */ __name((database) => {
|
|
@@ -9112,9 +8961,6 @@ export {
|
|
|
9112
8961
|
safeLiquid,
|
|
9113
8962
|
DRY_RUN_DAYS,
|
|
9114
8963
|
dryRun,
|
|
9115
|
-
endpointKeyName,
|
|
9116
|
-
embeddingKeys,
|
|
9117
|
-
modelGateway,
|
|
9118
8964
|
replyConsentPathFor,
|
|
9119
8965
|
readReplyConsent,
|
|
9120
8966
|
writeReplyConsent,
|