@wirecat/drive-cli 0.65.0 → 0.66.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/contracts/wirecat.json +2871 -0
- package/dist/bin/drive.js +2 -2
- package/dist/bin/drive.js.map +1 -1
- package/dist/browse.d.ts +1 -1
- package/dist/browse.d.ts.map +1 -1
- package/dist/browse.js +1 -1
- package/dist/bundle/{all-profiles-PD7GJHFA.js → all-profiles-WCQLIHUG.js} +14 -14
- package/dist/bundle/{anthropic-PJKFON5H.js → anthropic-5RJMB6O7.js} +20 -13
- package/dist/bundle/{app-server-6ELQA6FJ.js → app-server-3RGYXPKG.js} +67 -56
- package/dist/bundle/{bun-P54TGES2.js → bun-L34VEKGG.js} +2 -2
- package/dist/bundle/{bun-sqlite-TND5ZRJH.js → bun-sqlite-H6IAXQXI.js} +9 -9
- package/dist/bundle/{chunk-VHQYWFWV.js → chunk-2AF77WMH.js} +1 -1
- package/dist/bundle/{chunk-CWLL63JD.js → chunk-2S3E2HVV.js} +17 -17
- package/dist/bundle/{chunk-I272E6UR.js → chunk-3NYH756U.js} +49 -117
- package/dist/bundle/{chunk-UTNRBOEN.js → chunk-3QFUDXMQ.js} +2 -2
- package/dist/bundle/{chunk-RNHGQ35R.js → chunk-3SDJIMZB.js} +1 -1
- package/dist/bundle/{chunk-NQ5XMSLA.js → chunk-4UHBJSMI.js} +22086 -29123
- package/dist/bundle/{chunk-OWMZUWCM.js → chunk-5HVJK3ZJ.js} +6 -14
- package/dist/bundle/chunk-5K54RZBK.js +70 -0
- package/dist/bundle/{chunk-SIWXYB4E.js → chunk-5PLINHEY.js} +2987 -2717
- package/dist/bundle/{chunk-O7ZDCOZE.js → chunk-5VDVGDOC.js} +1 -1
- package/dist/bundle/{chunk-B2LPCHQN.js → chunk-5XLU4NN6.js} +4 -4
- package/dist/bundle/{chunk-5XSBCMAF.js → chunk-6UJCCOZC.js} +4 -4
- package/dist/bundle/{chunk-7AQGVX5O.js → chunk-6X3KUFRQ.js} +60 -29
- package/dist/bundle/{chunk-WRMJN6UQ.js → chunk-7EP4AU6A.js} +3 -3
- package/dist/bundle/{chunk-GW3LBY3T.js → chunk-7LT2G5BC.js} +146 -133
- package/dist/bundle/{chunk-ZILALBYQ.js → chunk-7ZGJRVBH.js} +7 -5
- package/dist/bundle/{chunk-PLP5527C.js → chunk-ALE67WRR.js} +5 -5
- package/dist/bundle/{chunk-EHU6EYGO.js → chunk-AP4MX247.js} +12 -12
- package/dist/bundle/{chunk-NI5PD5KM.js → chunk-BIJW6AYA.js} +14124 -12049
- package/dist/bundle/{chunk-54V4H6PM.js → chunk-BQXSE645.js} +12 -12
- package/dist/bundle/{chunk-EM7NL5ES.js → chunk-COGWKO2T.js} +3 -3
- package/dist/bundle/{chunk-II4S2DBJ.js → chunk-D4MIMH2N.js} +12 -6
- package/dist/bundle/{chunk-42G2XNPN.js → chunk-D7KOAPG6.js} +2 -2
- package/dist/bundle/{chunk-NQRTKYJB.js → chunk-E2F2XIX6.js} +47 -80
- package/dist/bundle/{chunk-VDZY3L7U.js → chunk-FA2TNA5X.js} +1 -1
- package/dist/bundle/{chunk-A4QNADEX.js → chunk-FHBTQPA3.js} +49 -49
- package/dist/bundle/{chunk-7TAP7Y2E.js → chunk-FKKPVPZR.js} +196 -112
- package/dist/bundle/{chunk-2AFI4KGI.js → chunk-G4TNKBDX.js} +7 -7
- package/dist/bundle/{chunk-ECEP4SO3.js → chunk-GVA3KTCD.js} +10 -10
- package/dist/bundle/{chunk-PHOL2DZM.js → chunk-GY4DAJSK.js} +34 -5
- package/dist/bundle/{chunk-Z2ADO6UA.js → chunk-H7XL6WTW.js} +2 -2
- package/dist/bundle/{chunk-SE352DBY.js → chunk-HHRJPLFO.js} +1 -1
- package/dist/bundle/{chunk-WRAUO5EJ.js → chunk-HPKE2GDP.js} +45 -22
- package/dist/bundle/{chunk-D7WB54P7.js → chunk-HPSHQVJU.js} +540 -456
- package/dist/bundle/{chunk-4Y5YBFMS.js → chunk-HQBLJLYH.js} +7 -7
- package/dist/bundle/{chunk-IMHW7VIV.js → chunk-I5R5CMQR.js} +5 -5
- package/dist/bundle/{chunk-ELJUBPY4.js → chunk-IIHZTV6V.js} +1 -1
- package/dist/bundle/{chunk-M7ELUGU6.js → chunk-IRNDYNQX.js} +4 -4
- package/dist/bundle/{chunk-TTP4NOP3.js → chunk-JCHF7LZT.js} +4 -4
- package/dist/bundle/{chunk-3HXNDF6Q.js → chunk-JHMEETXI.js} +2 -2
- package/dist/bundle/{chunk-4EDWLR22.js → chunk-JLCR24UM.js} +1 -1
- package/dist/bundle/{chunk-6DCLZLGX.js → chunk-JQXK3M5M.js} +1 -1
- package/dist/bundle/{chunk-EZ2OLYEK.js → chunk-KOY5HUBY.js} +14 -5
- package/dist/bundle/{chunk-IBO23OID.js → chunk-KRG5X5PH.js} +2 -2
- package/dist/bundle/{chunk-FA6JNXCC.js → chunk-LVAPSAHF.js} +8 -8
- package/dist/bundle/{chunk-ZR2EJPMQ.js → chunk-M7543RUJ.js} +18 -15
- package/dist/bundle/{chunk-A27UVLPK.js → chunk-MZWXTJ4O.js} +3 -3
- package/dist/bundle/{chunk-XPWZSW6Y.js → chunk-NK4GVFJH.js} +4 -4
- package/dist/bundle/chunk-NYECVHFH.js +10283 -0
- package/dist/bundle/{chunk-W2XY6C5S.js → chunk-NYZS2LKF.js} +2 -2
- package/dist/bundle/{chunk-4AOINPN2.js → chunk-O53WLYX3.js} +8 -2
- package/dist/bundle/{chunk-RX5CJ55S.js → chunk-OIF4B526.js} +1 -1
- package/dist/bundle/{chunk-SS4LKLD7.js → chunk-OT7SQQJK.js} +371 -362
- package/dist/bundle/chunk-OZOQLAWK.js +72 -0
- package/dist/bundle/{chunk-DA63E2UM.js → chunk-P7HQFII6.js} +18 -15
- package/dist/bundle/{chunk-MCPOZNWG.js → chunk-PJGOQSE5.js} +1 -1
- package/dist/bundle/{chunk-F56DRBGY.js → chunk-PKM55ZRR.js} +75 -20
- package/dist/bundle/{chunk-SNLSEYJO.js → chunk-PUMDOCAF.js} +1 -1
- package/dist/bundle/{chunk-LMKPP2JP.js → chunk-QF7VL4C3.js} +1 -1
- package/dist/bundle/{chunk-D6Z43SOG.js → chunk-QJ57PV55.js} +383 -361
- package/dist/bundle/{chunk-EU5MD24W.js → chunk-QSELSDWE.js} +13 -13
- package/dist/bundle/{chunk-TMHF4BCL.js → chunk-SOOU5WO6.js} +2 -2
- package/dist/bundle/{chunk-3ONWN3IA.js → chunk-SZ6JFOL4.js} +137 -45
- package/dist/bundle/{chunk-WVJHZIDH.js → chunk-T3ULDA7C.js} +3 -3
- package/dist/bundle/{chunk-XYE7XZPB.js → chunk-TAHISPDE.js} +5 -5
- package/dist/bundle/{chunk-HP3NT6JJ.js → chunk-TYLEICTX.js} +3 -3
- package/dist/bundle/{chunk-Y5PKRITX.js → chunk-UAKX6DP4.js} +5 -5
- package/dist/bundle/{chunk-VLXWAH5E.js → chunk-UG3GHFGY.js} +4 -4
- package/dist/bundle/{chunk-X7YGGWXI.js → chunk-ULXEW6FT.js} +3 -2
- package/dist/bundle/{chunk-JPPPLKAO.js → chunk-UNTIVT47.js} +1 -2
- package/dist/bundle/{chunk-SEQWBZYH.js → chunk-UQPW42HF.js} +1 -1
- package/dist/bundle/{chunk-JMJIH6JH.js → chunk-V2WXTILT.js} +6 -6
- package/dist/bundle/{chunk-TOVWMURV.js → chunk-VQKNKJYL.js} +22 -7
- package/dist/bundle/{chunk-OFJXHEFT.js → chunk-VR3YKXHL.js} +93 -31
- package/dist/bundle/{chunk-VMAMRFFC.js → chunk-VUUPFDRU.js} +26 -27
- package/dist/bundle/{chunk-FBHSWQU7.js → chunk-WYTYHUFH.js} +319 -102
- package/dist/bundle/{chunk-ZD4MB7NH.js → chunk-XLGDNI4S.js} +1 -1
- package/dist/bundle/{chunk-O6K2E7OA.js → chunk-XVZNFA2P.js} +1507 -1107
- package/dist/bundle/chunk-Y5U4HIZS.js +71 -0
- package/dist/bundle/chunk-YTIPTHEE.js +47 -0
- package/dist/bundle/cli-KW6QQVS5.js +1101 -0
- package/dist/bundle/command-contract-CE543JBN.js +41 -0
- package/dist/bundle/{command-server-entry-36JXYIJB.js → command-server-entry-OC4E4DED.js} +31 -30
- package/dist/bundle/{decode-T5ZW57WZ.js → decode-AH5ZLLDK.js} +8 -8
- package/dist/bundle/{dispatch-RMA2XFYA.js → dispatch-CDWZZ54Q.js} +9 -9
- package/dist/bundle/drive.js +13 -13
- package/dist/bundle/{echarts-KQ44LPSF.js → echarts-VC7MTXWY.js} +2 -2
- package/dist/bundle/{embed-Q7XST53J.js → embed-EPSQY6QG.js} +9 -9
- package/dist/bundle/{embedder-RWZSBVW2.js → embedder-TK4U4TJR.js} +12 -12
- package/dist/bundle/entry-3VN23M7M.js +25 -0
- package/dist/bundle/{failure-7NP4QPIN.js → failure-WSVZOPFE.js} +4 -4
- package/dist/bundle/first-run-7ZYJ7EB3.js +30 -0
- package/dist/bundle/first-screen-CZDH7QY3.js +39 -0
- package/dist/bundle/google-OBZMWA7J.js +45 -0
- package/dist/bundle/{google-api-P5DRHD7L.js → google-api-AV4X2JH3.js} +68 -63
- package/dist/bundle/grants-WTRLN4ZI.js +111 -0
- package/dist/bundle/{identity-VDV6CHRW.js → identity-CGHHF7AK.js} +8 -6
- package/dist/bundle/{instructions-Q45FVY6H.js → instructions-24PHDBBE.js} +1 -1
- package/dist/bundle/{login-XKN3NI6X.js → login-XHFESAFM.js} +73 -70
- package/dist/bundle/{mcp-7KQUJNFN.js → mcp-M5YCSWJJ.js} +2 -2
- package/dist/bundle/{node-MSW565D3.js → node-GIDULTV5.js} +2 -2
- package/dist/bundle/{node-sqlite-S74XVVHL.js → node-sqlite-LINBOAWK.js} +10 -10
- package/dist/bundle/oauth-JHUX3KE3.js +22 -0
- package/dist/bundle/{open-P7UQG7XJ.js → open-RYFKPNCJ.js} +8 -8
- package/dist/bundle/{openai-DDHJ57KZ.js → openai-Q7YYUHJF.js} +28 -21
- package/dist/bundle/{process-NMUB5SHK.js → process-VPIZTIJR.js} +1 -1
- package/dist/bundle/{program-PJNWP6JW.js → program-IUXFRBZA.js} +213 -555
- package/dist/bundle/{prompt-VOSMK4C2.js → prompt-LF4KX3XL.js} +8 -8
- package/dist/bundle/{reasons-KDAXOC5S.js → reasons-JPYOU5GV.js} +5 -5
- package/dist/bundle/{recognize-GZIY63HS.js → recognize-KEWTJXFH.js} +7 -7
- package/dist/bundle/{remote-V3YGN7LN.js → remote-HGGLB76S.js} +13 -10
- package/dist/bundle/{rerank-XRU6AVN7.js → rerank-TDUKETFT.js} +10 -10
- package/dist/bundle/{serve-NDOAFA57.js → serve-XFYMKW5W.js} +12 -12
- package/dist/bundle/server-BDEV3CZJ.js +74 -0
- package/dist/bundle/{server-BKGWJYMC.js → server-PXIPSGFP.js} +47 -45
- package/dist/bundle/{services-TYDMFQCA.js → services-2BOCGMJU.js} +44 -34
- package/dist/bundle/{sqlite-runtime-UAFJKSJR.js → sqlite-runtime-R7M5XUMW.js} +9 -9
- package/dist/bundle/{start-2ZLDP2OE.js → start-YRLT4MQZ.js} +7 -7
- package/dist/bundle/{state-6SP27J2K.js → state-NZ7WRJWH.js} +9 -9
- package/dist/bundle/{store-EJN27MXI.js → store-7LCVDO7G.js} +23 -21
- package/dist/bundle/{store-4UUY545Q.js → store-ICDGPSEN.js} +21 -19
- package/dist/bundle/store-maintenance-command-SJPLY6IH.js +65 -0
- package/dist/bundle/tokens-FGTBE7VW.js +111 -0
- package/dist/commands/discovery.d.ts +0 -1
- package/dist/commands/discovery.d.ts.map +1 -1
- package/dist/commands/discovery.js +6 -26
- package/dist/commands/discovery.js.map +1 -1
- package/dist/commands/knowledge.d.ts.map +1 -1
- package/dist/commands/knowledge.js +7 -6
- package/dist/commands/knowledge.js.map +1 -1
- package/dist/commands/search.d.ts.map +1 -1
- package/dist/commands/search.js +11 -8
- package/dist/commands/search.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +3 -2
- package/dist/config.js.map +1 -1
- package/dist/contract-overrides.d.ts +16 -4
- package/dist/contract-overrides.d.ts.map +1 -1
- package/dist/contract-overrides.js +86 -410
- package/dist/contract-overrides.js.map +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +4 -0
- package/dist/errors.js.map +1 -1
- package/dist/google-api.d.ts.map +1 -1
- package/dist/google-api.js +4 -1
- package/dist/google-api.js.map +1 -1
- package/dist/identity.d.ts +4 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +22 -0
- package/dist/identity.js.map +1 -1
- package/dist/knowledge.js +2 -2
- package/dist/knowledge.js.map +1 -1
- package/dist/login.d.ts.map +1 -1
- package/dist/login.js +2 -2
- package/dist/login.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +8 -6
- package/dist/program.js.map +1 -1
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +0 -1
- package/dist/reasons.js.map +1 -1
- package/dist/store-transition.js +2 -2
- package/dist/store-transition.js.map +1 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +7 -7
- package/dist/store.js.map +1 -1
- package/dist/tokens.d.ts +9 -2
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +18 -15
- package/dist/tokens.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wcat.d.ts +3 -0
- package/dist/wcat.d.ts.map +1 -0
- package/dist/wcat.js +4 -0
- package/dist/wcat.js.map +1 -0
- package/package.json +7 -7
- package/dist/bundle/chunk-CGQRZRTH.js +0 -26
- package/dist/bundle/chunk-IKHOIXJR.js +0 -27
- package/dist/bundle/chunk-SBZB7HMU.js +0 -1055
- package/dist/bundle/command-contract-25E4PYMD.js +0 -40
- package/dist/bundle/dist-PY3MVR3G.js +0 -21
- package/dist/bundle/entry-HPLW4QL2.js +0 -25
- package/dist/bundle/first-run-RL3RKYZW.js +0 -30
- package/dist/bundle/first-screen-NX3TM2VJ.js +0 -38
- package/dist/bundle/google-DPD5N6AQ.js +0 -42
- package/dist/bundle/grants-TX4MHLI4.js +0 -109
- package/dist/bundle/oauth-6R7AWAES.js +0 -22
- package/dist/bundle/server-QD2MUJJZ.js +0 -72
- package/dist/bundle/store-maintenance-command-LETURZDC.js +0 -60
- package/dist/bundle/tokens-MTFJPTYT.js +0 -107
- /package/dist/bundle/{chunk-YVNHQFLC.js → chunk-HVJJWJYQ.js} +0 -0
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { createRequire as __bundleRequire } from "node:module";
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
sharedModel
|
|
5
|
+
} from "./chunk-E2F2XIX6.js";
|
|
3
6
|
import {
|
|
4
7
|
answerOf,
|
|
5
8
|
messengerContext
|
|
6
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-OT7SQQJK.js";
|
|
7
10
|
import {
|
|
8
11
|
chatEventAnswer,
|
|
9
12
|
memberAnswer,
|
|
@@ -12,7 +15,7 @@ import {
|
|
|
12
15
|
serveRelay,
|
|
13
16
|
typedQuery,
|
|
14
17
|
withQuery
|
|
15
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-HPKE2GDP.js";
|
|
16
19
|
import {
|
|
17
20
|
FETCHING,
|
|
18
21
|
RULES_VERSION,
|
|
@@ -22,16 +25,17 @@ import {
|
|
|
22
25
|
onlineDeps,
|
|
23
26
|
openRequestTask,
|
|
24
27
|
patiently,
|
|
28
|
+
refuseLockedOutput,
|
|
25
29
|
senderIsMe,
|
|
26
30
|
servicesFor,
|
|
27
31
|
syncsOneChat
|
|
28
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-XVZNFA2P.js";
|
|
29
33
|
import {
|
|
30
34
|
embeddingKeys,
|
|
31
35
|
endpointKeyName,
|
|
32
36
|
modelGateway,
|
|
33
37
|
withTimeLimit
|
|
34
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-WYTYHUFH.js";
|
|
35
39
|
import {
|
|
36
40
|
stringWidth,
|
|
37
41
|
wrapAnsi
|
|
@@ -42,7 +46,7 @@ import {
|
|
|
42
46
|
releaseLock,
|
|
43
47
|
servingProfiles,
|
|
44
48
|
takeLock
|
|
45
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-COGWKO2T.js";
|
|
46
50
|
import {
|
|
47
51
|
QUICK_HEALTH_CHECKS,
|
|
48
52
|
fts5Tables,
|
|
@@ -50,7 +54,7 @@ import {
|
|
|
50
54
|
lossUnknown,
|
|
51
55
|
storeDamageReport,
|
|
52
56
|
storeHealth
|
|
53
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-2S3E2HVV.js";
|
|
54
58
|
import {
|
|
55
59
|
Command,
|
|
56
60
|
LOCAL_READ,
|
|
@@ -58,8 +62,10 @@ import {
|
|
|
58
62
|
REMOTE_READ,
|
|
59
63
|
REMOTE_WRITE,
|
|
60
64
|
annotate,
|
|
65
|
+
commandAt,
|
|
61
66
|
destroysNothing,
|
|
62
67
|
environmentOf,
|
|
68
|
+
grantsAuthority,
|
|
63
69
|
itemOf,
|
|
64
70
|
jsonlRecords,
|
|
65
71
|
lineOf,
|
|
@@ -72,21 +78,21 @@ import {
|
|
|
72
78
|
snakeKeys,
|
|
73
79
|
storeTable,
|
|
74
80
|
withoutProviderRefs
|
|
75
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-5PLINHEY.js";
|
|
76
82
|
import {
|
|
77
83
|
codeOf,
|
|
78
84
|
levelFor,
|
|
79
85
|
parseDuration
|
|
80
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-PKM55ZRR.js";
|
|
81
87
|
import {
|
|
82
88
|
modelTarget
|
|
83
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-5HVJK3ZJ.js";
|
|
84
90
|
import {
|
|
85
91
|
holdersOf
|
|
86
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-5VDVGDOC.js";
|
|
87
93
|
import {
|
|
88
94
|
readSecret
|
|
89
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-TYLEICTX.js";
|
|
90
96
|
import {
|
|
91
97
|
CORPORA,
|
|
92
98
|
MIGRATIONS,
|
|
@@ -121,10 +127,10 @@ import {
|
|
|
121
127
|
storeClients,
|
|
122
128
|
storeContents,
|
|
123
129
|
vectorIndexCounts
|
|
124
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-BIJW6AYA.js";
|
|
125
131
|
import {
|
|
126
132
|
openCache
|
|
127
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-V2WXTILT.js";
|
|
128
134
|
import {
|
|
129
135
|
currentRun,
|
|
130
136
|
formatLocator,
|
|
@@ -133,25 +139,25 @@ import {
|
|
|
133
139
|
readHealthMark,
|
|
134
140
|
readJournalMark,
|
|
135
141
|
recordDeepCheck
|
|
136
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-QJ57PV55.js";
|
|
137
143
|
import {
|
|
138
144
|
queryFieldsOf
|
|
139
|
-
} from "./chunk-
|
|
145
|
+
} from "./chunk-GVA3KTCD.js";
|
|
140
146
|
import {
|
|
141
147
|
failureKey,
|
|
142
148
|
isStoreDamage
|
|
143
|
-
} from "./chunk-
|
|
149
|
+
} from "./chunk-O53WLYX3.js";
|
|
144
150
|
import {
|
|
145
151
|
storePath
|
|
146
|
-
} from "./chunk-
|
|
152
|
+
} from "./chunk-3QFUDXMQ.js";
|
|
147
153
|
import {
|
|
148
154
|
resolvePaths,
|
|
149
155
|
writeSecurely
|
|
150
|
-
} from "./chunk-
|
|
156
|
+
} from "./chunk-6X3KUFRQ.js";
|
|
151
157
|
import {
|
|
152
158
|
singleLine,
|
|
153
159
|
visibleControls
|
|
154
|
-
} from "./chunk-
|
|
160
|
+
} from "./chunk-JQXK3M5M.js";
|
|
155
161
|
import {
|
|
156
162
|
array,
|
|
157
163
|
boolean,
|
|
@@ -172,10 +178,10 @@ import {
|
|
|
172
178
|
string,
|
|
173
179
|
transform,
|
|
174
180
|
trim
|
|
175
|
-
} from "./chunk-
|
|
181
|
+
} from "./chunk-VQKNKJYL.js";
|
|
176
182
|
import {
|
|
177
183
|
CliError
|
|
178
|
-
} from "./chunk-
|
|
184
|
+
} from "./chunk-IIHZTV6V.js";
|
|
179
185
|
import {
|
|
180
186
|
__commonJS,
|
|
181
187
|
__name,
|
|
@@ -5515,11 +5521,11 @@ var require_liquid_node = __commonJS({
|
|
|
5515
5521
|
}
|
|
5516
5522
|
});
|
|
5517
5523
|
|
|
5518
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5524
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
|
|
5519
5525
|
import { chmodSync, constants, copyFileSync, existsSync as existsSync10, mkdirSync, realpathSync as realpathSync3, renameSync as renameSync3, rmSync as rmSync3, statfsSync as statfsSync2, statSync as statSync4, writeFileSync as writeFileSync2 } from "node:fs";
|
|
5520
5526
|
import { dirname as dirname3, resolve } from "node:path";
|
|
5521
5527
|
|
|
5522
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5528
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/sealed.js
|
|
5523
5529
|
import { createCipheriv, createDecipheriv, createHash, randomBytes, scrypt, timingSafeEqual } from "node:crypto";
|
|
5524
5530
|
import { closeSync, createReadStream, createWriteStream, existsSync, openSync, readSync, renameSync, rmSync, statSync } from "node:fs";
|
|
5525
5531
|
import { Transform } from "node:stream";
|
|
@@ -5626,7 +5632,7 @@ var unsealFile = /* @__PURE__ */ __name(async (from, to, password) => {
|
|
|
5626
5632
|
renameSync(pending, to);
|
|
5627
5633
|
}, "unsealFile");
|
|
5628
5634
|
|
|
5629
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5635
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/store/compatibility.js
|
|
5630
5636
|
var SPEAKS = MIGRATIONS.at(-1)?.version ?? 0;
|
|
5631
5637
|
var fileSchemaOf = /* @__PURE__ */ __name((database) => {
|
|
5632
5638
|
const tracked = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'schema_migrations'").get();
|
|
@@ -5650,7 +5656,7 @@ var compatibilityOf = /* @__PURE__ */ __name((file2, migrations = MIGRATIONS) =>
|
|
|
5650
5656
|
};
|
|
5651
5657
|
}, "compatibilityOf");
|
|
5652
5658
|
|
|
5653
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5659
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/store/repair.js
|
|
5654
5660
|
import { createHash as createHash2 } from "node:crypto";
|
|
5655
5661
|
var COPY_MARK = "__repair_";
|
|
5656
5662
|
var COPY_NAME = /__repair_[0-9a-f]{8}(_\d+)?$/;
|
|
@@ -5904,19 +5910,19 @@ var deleteCopy = /* @__PURE__ */ __name((database, name) => {
|
|
|
5904
5910
|
return found;
|
|
5905
5911
|
}, "deleteCopy");
|
|
5906
5912
|
|
|
5907
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5913
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/cli/store-info.js
|
|
5908
5914
|
import { existsSync as existsSync4, statSync as statSync3 } from "node:fs";
|
|
5909
5915
|
|
|
5910
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5916
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
|
|
5911
5917
|
import { existsSync as existsSync3 } from "node:fs";
|
|
5912
5918
|
|
|
5913
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5919
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/store/recover.js
|
|
5914
5920
|
import { execFileSync, spawn } from "node:child_process";
|
|
5915
5921
|
import { existsSync as existsSync2, readFileSync, realpathSync, renameSync as renameSync2, rmSync as rmSync2, statfsSync, statSync as statSync2, writeFileSync } from "node:fs";
|
|
5916
5922
|
import { basename, dirname, join } from "node:path";
|
|
5917
5923
|
import { Transform as Transform2 } from "node:stream";
|
|
5918
5924
|
|
|
5919
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
5925
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/store/refill.js
|
|
5920
5926
|
var REFILL_MARGIN_MS = 864e5;
|
|
5921
5927
|
var TIME_KEYS = 1e12;
|
|
5922
5928
|
var integerId = `external_id GLOB '[0-9]*' AND NOT external_id GLOB '*[^0-9]*'`;
|
|
@@ -5996,7 +6002,7 @@ var forgetMail = /* @__PURE__ */ __name((database, cutoff, now) => {
|
|
|
5996
6002
|
return [...folders].map(([account, count3]) => ({ account, folders: count3 }));
|
|
5997
6003
|
}, "forgetMail");
|
|
5998
6004
|
|
|
5999
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6005
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/store/recover.js
|
|
6000
6006
|
var SQLITE3_MINIMUM = [3, 43, 0];
|
|
6001
6007
|
var STORE_PARTS = ["", "-wal", "-shm"];
|
|
6002
6008
|
var RECOVER_LOCK = ".recover-lock";
|
|
@@ -6524,7 +6530,7 @@ var recoverLocked = /* @__PURE__ */ __name(async ({ path, command, version, sqli
|
|
|
6524
6530
|
}
|
|
6525
6531
|
}, "recoverLocked");
|
|
6526
6532
|
|
|
6527
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6533
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/cli/store-recover.js
|
|
6528
6534
|
var COUNTED = [
|
|
6529
6535
|
"accounts",
|
|
6530
6536
|
"chats",
|
|
@@ -6665,7 +6671,7 @@ var storeRecoverCommand = /* @__PURE__ */ __name(({ command, version }) => {
|
|
|
6665
6671
|
for (const line of recoveryNotes(answer))
|
|
6666
6672
|
output.renderer.note(line);
|
|
6667
6673
|
});
|
|
6668
|
-
recover.addCommand(annotate(new Command("run"), { effects: LOCAL_WRITE, examples: [`${command} store recover run`] }).summary("rebuild a damaged store from every row it can read").description("copy every readable row into a new file with the sqlite3 program, rebuild the search indexes, mentions and vector index, check it, and put it in place of the store; the damaged file is kept beside it. Refuses while a WireCat timer or process has the store").action(async function() {
|
|
6674
|
+
recover.addCommand(grantsAuthority(annotate(new Command("run"), { effects: LOCAL_WRITE, examples: [`${command} store recover run`] })).summary("rebuild a damaged store from every row it can read").description("copy every readable row into a new file with the sqlite3 program, rebuild the search indexes, mentions and vector index, check it, and put it in place of the store; the damaged file is kept beside it. Refuses while a WireCat timer or process has the store").action(async function() {
|
|
6669
6675
|
const output = outputFor(this);
|
|
6670
6676
|
const answer = await storeRecoveryRun(environmentOf(this).env ?? process.env, {
|
|
6671
6677
|
command,
|
|
@@ -6680,7 +6686,7 @@ var storeRecoverCommand = /* @__PURE__ */ __name(({ command, version }) => {
|
|
|
6680
6686
|
return recover;
|
|
6681
6687
|
}, "storeRecoverCommand");
|
|
6682
6688
|
|
|
6683
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6689
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/cli/store-info.js
|
|
6684
6690
|
var pendingIfKnown = /* @__PURE__ */ __name((database) => database.prepare("SELECT 1 FROM pragma_table_info('messages') WHERE name = 'normalized_text'").get() ? pendingNormalization(database) : null, "pendingIfKnown");
|
|
6685
6691
|
var bytesOf = /* @__PURE__ */ __name((path) => existsSync4(path) ? statSync3(path).size : 0, "bytesOf");
|
|
6686
6692
|
var messageOf = /* @__PURE__ */ __name((error) => error instanceof Error ? error.message : String(error), "messageOf");
|
|
@@ -6725,8 +6731,12 @@ var storeInfoCommand = /* @__PURE__ */ __name(() => annotate(new Command("info")
|
|
|
6725
6731
|
const answer = await storeInfo(environmentOf(this).env ?? process.env);
|
|
6726
6732
|
renderAnswer(this, outputFor(this), itemOf(answer));
|
|
6727
6733
|
}), "storeInfoCommand");
|
|
6734
|
+
var sharedStoreCommand = /* @__PURE__ */ __name((app) => {
|
|
6735
|
+
const store = annotate(new Command("store"), { effects: LOCAL_READ }).description("the shared local store every WireCat tool reads").addCommand(storeInfoCommand());
|
|
6736
|
+
return app ? store.addCommand(storeRecoverCommand(app)) : store;
|
|
6737
|
+
}, "sharedStoreCommand");
|
|
6728
6738
|
|
|
6729
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6739
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/cli/messenger/password.js
|
|
6730
6740
|
var ENCRYPT_OPTION = [
|
|
6731
6741
|
"--encrypt",
|
|
6732
6742
|
"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"
|
|
@@ -6745,7 +6755,7 @@ var passwordOf = /* @__PURE__ */ __name(async (command, { twice }) => {
|
|
|
6745
6755
|
return password;
|
|
6746
6756
|
}, "passwordOf");
|
|
6747
6757
|
|
|
6748
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6758
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/replies/rules.js
|
|
6749
6759
|
import { existsSync as existsSync5, readFileSync as readFileSync2 } from "node:fs";
|
|
6750
6760
|
import { join as join2 } from "node:path";
|
|
6751
6761
|
var REPLY_ACTIONS = ["reply", "task"];
|
|
@@ -6916,7 +6926,7 @@ var problem = /* @__PURE__ */ __name((issue) => {
|
|
|
6916
6926
|
}, "problem");
|
|
6917
6927
|
var broken = /* @__PURE__ */ __name((path, why) => new CliError("configuration_error", `the reply rules ${path} cannot be read (${why}) \u2014 fix the file`), "broken");
|
|
6918
6928
|
|
|
6919
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6929
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/replies/state.js
|
|
6920
6930
|
import { existsSync as existsSync6, readFileSync as readFileSync3 } from "node:fs";
|
|
6921
6931
|
import { join as join3 } from "node:path";
|
|
6922
6932
|
var ANSWERED_KEPT = 1e3;
|
|
@@ -6969,7 +6979,7 @@ var recordReply = /* @__PURE__ */ __name((state, rule2, message, now) => {
|
|
|
6969
6979
|
}, "recordReply");
|
|
6970
6980
|
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");
|
|
6971
6981
|
|
|
6972
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
6982
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/replies/decide.js
|
|
6973
6983
|
var skip = /* @__PURE__ */ __name((why) => ({ skip: why }), "skip");
|
|
6974
6984
|
var decide = /* @__PURE__ */ __name((rule2, incoming, state, now) => {
|
|
6975
6985
|
const { message, chat, owner, sender } = incoming;
|
|
@@ -7075,10 +7085,10 @@ var filled = /* @__PURE__ */ __name((template2, senderName) => {
|
|
|
7075
7085
|
return template2.replaceAll("{firstName}", name.split(/\s+/)[0] ?? name).replaceAll("{name}", name);
|
|
7076
7086
|
}, "filled");
|
|
7077
7087
|
|
|
7078
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7088
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/replies/template.js
|
|
7079
7089
|
var import_liquidjs2 = __toESM(require_liquid_node(), 1);
|
|
7080
7090
|
|
|
7081
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7091
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/render/liquid.js
|
|
7082
7092
|
var import_liquidjs = __toESM(require_liquid_node(), 1);
|
|
7083
7093
|
var safeLiquid = /* @__PURE__ */ __name((limits) => {
|
|
7084
7094
|
const engine = new import_liquidjs.Liquid({
|
|
@@ -7105,7 +7115,7 @@ var safeLiquid = /* @__PURE__ */ __name((limits) => {
|
|
|
7105
7115
|
return engine;
|
|
7106
7116
|
}, "safeLiquid");
|
|
7107
7117
|
|
|
7108
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7118
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/replies/template.js
|
|
7109
7119
|
var TEMPLATE_LIMITS = {
|
|
7110
7120
|
parse: 32768,
|
|
7111
7121
|
renders: 2e3,
|
|
@@ -7244,7 +7254,7 @@ var renderReplyTemplate = /* @__PURE__ */ __name(async (reply, input) => {
|
|
|
7244
7254
|
}
|
|
7245
7255
|
}, "renderReplyTemplate");
|
|
7246
7256
|
|
|
7247
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7257
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/replies/dry-run.js
|
|
7248
7258
|
var DRY_RUN_DAYS = 7;
|
|
7249
7259
|
var PAGE = 500;
|
|
7250
7260
|
var dryRun = /* @__PURE__ */ __name(async (store, account, rules, { since, until = Date.now(), only, audience, render }) => {
|
|
@@ -7358,7 +7368,28 @@ var storedSince = /* @__PURE__ */ __name(async (store, account, chat, since) =>
|
|
|
7358
7368
|
}
|
|
7359
7369
|
}, "storedSince");
|
|
7360
7370
|
|
|
7361
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7371
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/models/purpose.js
|
|
7372
|
+
var HOSTED = {
|
|
7373
|
+
openai: "https://api.openai.com/v1",
|
|
7374
|
+
anthropic: "https://api.anthropic.com"
|
|
7375
|
+
};
|
|
7376
|
+
var purposeModel = /* @__PURE__ */ __name((settings, purpose, deps) => {
|
|
7377
|
+
const configured = modelTarget(settings, purpose);
|
|
7378
|
+
if (configured) {
|
|
7379
|
+
const baseUrl = configured.baseUrl ?? HOSTED[configured.provider] ?? "";
|
|
7380
|
+
return {
|
|
7381
|
+
target: { ...configured, baseUrl },
|
|
7382
|
+
key: /* @__PURE__ */ __name(() => embeddingKeys(deps.app, deps.env, deps.keyring).read(configured.baseUrl === void 0 ? configured.provider : endpointKeyName(configured.baseUrl))?.key, "key")
|
|
7383
|
+
};
|
|
7384
|
+
}
|
|
7385
|
+
const provider = settings.models?.[purpose]?.provider ?? settings.models?.default?.provider;
|
|
7386
|
+
if (provider === "off")
|
|
7387
|
+
return void 0;
|
|
7388
|
+
const shared = sharedModel(deps);
|
|
7389
|
+
return shared ? { target: shared.target, key: /* @__PURE__ */ __name(() => shared.key, "key"), shared: shared.setting } : void 0;
|
|
7390
|
+
}, "purposeModel");
|
|
7391
|
+
|
|
7392
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/replies/consents.js
|
|
7362
7393
|
import { existsSync as existsSync7, readFileSync as readFileSync4 } from "node:fs";
|
|
7363
7394
|
import { join as join4 } from "node:path";
|
|
7364
7395
|
var shape = strictObject({
|
|
@@ -7383,19 +7414,21 @@ var mayModelReply = /* @__PURE__ */ __name((path, provider, chat) => {
|
|
|
7383
7414
|
return consent.provider === provider && !consent.deniedChats.includes(chat);
|
|
7384
7415
|
}, "mayModelReply");
|
|
7385
7416
|
|
|
7386
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7417
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/replies/rendering.js
|
|
7387
7418
|
var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, options = {
|
|
7388
7419
|
ai: true
|
|
7389
7420
|
}) => async (rule2, message, chat, now) => {
|
|
7421
|
+
const deps = { app, env, keyring: options.keyring };
|
|
7390
7422
|
let called;
|
|
7391
7423
|
const gateway = modelGateway({
|
|
7392
7424
|
signal: options.signal,
|
|
7425
|
+
env,
|
|
7393
7426
|
resolve: /* @__PURE__ */ __name((purpose) => {
|
|
7394
|
-
called =
|
|
7395
|
-
return called;
|
|
7427
|
+
called = purposeModel(settings(), purpose, deps);
|
|
7428
|
+
return called?.target;
|
|
7396
7429
|
}, "resolve"),
|
|
7397
7430
|
consent: /* @__PURE__ */ __name((_request, target) => mayModelReply(replyConsentPathFor(app, profile, env), replyModelIdentity(target.provider, target.baseUrl ?? ""), message.chatId), "consent"),
|
|
7398
|
-
key: /* @__PURE__ */ __name((
|
|
7431
|
+
key: /* @__PURE__ */ __name(() => called?.key(), "key")
|
|
7399
7432
|
});
|
|
7400
7433
|
if (options.signal?.aborted)
|
|
7401
7434
|
throw new CliError("cancelled", "reply rendering cancelled");
|
|
@@ -7417,9 +7450,8 @@ var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, o
|
|
|
7417
7450
|
});
|
|
7418
7451
|
if (options.signal?.aborted)
|
|
7419
7452
|
throw new CliError("cancelled", "reply rendering cancelled");
|
|
7420
|
-
const current =
|
|
7421
|
-
|
|
7422
|
-
if (!called || JSON.stringify(current) !== JSON.stringify(called) || !mayModelReply(replyConsentPathFor(app, profile, env), replyModelIdentity(called.provider, baseUrl), message.chatId)) {
|
|
7453
|
+
const current = purposeModel(settings(), "replies", deps)?.target;
|
|
7454
|
+
if (!called || JSON.stringify(current) !== JSON.stringify(called.target) || !mayModelReply(replyConsentPathFor(app, profile, env), replyModelIdentity(called.target.provider, called.target.baseUrl), message.chatId)) {
|
|
7423
7455
|
throw new CliError("permission_error", "reply model consent or configuration changed during rendering");
|
|
7424
7456
|
}
|
|
7425
7457
|
return result3;
|
|
@@ -7430,7 +7462,7 @@ var replyRenderer = /* @__PURE__ */ __name((app, profile, settings, env, warn, o
|
|
|
7430
7462
|
return result2;
|
|
7431
7463
|
}, "replyRenderer");
|
|
7432
7464
|
|
|
7433
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7465
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/replies/serve.js
|
|
7434
7466
|
var NOT_ALLOWED = "replies.send is not allow";
|
|
7435
7467
|
var NO_RULES = "no rules";
|
|
7436
7468
|
var ONLY_TASK = "opened a task, sent nothing";
|
|
@@ -7523,7 +7555,7 @@ var replyTo = /* @__PURE__ */ __name(async (deps, message) => {
|
|
|
7523
7555
|
return { skip: why };
|
|
7524
7556
|
}, "replyTo");
|
|
7525
7557
|
|
|
7526
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7558
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-catch-up.js
|
|
7527
7559
|
var START_SYNC_DELAY_MS = 3e4;
|
|
7528
7560
|
var START_SYNC_BUDGET_MS = 5 * 6e4;
|
|
7529
7561
|
var START_SYNC_WINDOW_MS = 7 * 864e5;
|
|
@@ -7600,7 +7632,7 @@ var startSync = /* @__PURE__ */ __name(({ chats, newestHeld, fetch, note, warn,
|
|
|
7600
7632
|
};
|
|
7601
7633
|
}, "startSync");
|
|
7602
7634
|
|
|
7603
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7635
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-members.js
|
|
7604
7636
|
var FIRST_FETCH_MS = 6e4;
|
|
7605
7637
|
var DAY_MS = 864e5;
|
|
7606
7638
|
var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch, warn, firstMs = FIRST_FETCH_MS, everyMs = DAY_MS }) => {
|
|
@@ -7654,7 +7686,7 @@ var memberFetches = /* @__PURE__ */ __name(({ withStore, fetch, warn, firstMs =
|
|
|
7654
7686
|
};
|
|
7655
7687
|
}, "memberFetches");
|
|
7656
7688
|
|
|
7657
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7689
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-notice.js
|
|
7658
7690
|
var record2 = /* @__PURE__ */ __name((context, app, severity, attributes) => recordLogFor(context.streams.diagnostic, app, { command: currentRun().command || "serve" })[severity](attributes), "record");
|
|
7659
7691
|
var noticeFor = /* @__PURE__ */ __name((context, app, severity = "warn") => ({ text, ...attributes }) => {
|
|
7660
7692
|
if (context.format === "pretty") {
|
|
@@ -7687,7 +7719,7 @@ var recordDiagnostics = /* @__PURE__ */ __name((context, app) => {
|
|
|
7687
7719
|
return context;
|
|
7688
7720
|
}, "recordDiagnostics");
|
|
7689
7721
|
|
|
7690
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7722
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-outdated.js
|
|
7691
7723
|
import { existsSync as existsSync8, readFileSync as readFileSync5, realpathSync as realpathSync2 } from "node:fs";
|
|
7692
7724
|
import { dirname as dirname2, join as join5 } from "node:path";
|
|
7693
7725
|
var OUTDATED_CHECK_MS = 6e4;
|
|
@@ -7773,7 +7805,7 @@ var watchOutdated = /* @__PURE__ */ __name(({ check: check2, onOutdated, everyMs
|
|
|
7773
7805
|
};
|
|
7774
7806
|
}, "watchOutdated");
|
|
7775
7807
|
|
|
7776
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7808
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-stems.js
|
|
7777
7809
|
var STEMS_EVERY_MS = 3e4;
|
|
7778
7810
|
var STEMS_SLICE_MS = 2e3;
|
|
7779
7811
|
var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY_MS, sliceMs = STEMS_SLICE_MS }) => {
|
|
@@ -7813,7 +7845,7 @@ var stemFills = /* @__PURE__ */ __name(({ withStore, warn, everyMs = STEMS_EVERY
|
|
|
7813
7845
|
};
|
|
7814
7846
|
}, "stemFills");
|
|
7815
7847
|
|
|
7816
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7848
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/render/messages.js
|
|
7817
7849
|
import { styleText } from "node:util";
|
|
7818
7850
|
var TIME_WIDTH = 8;
|
|
7819
7851
|
var INDENT = " ".repeat(TIME_WIDTH + 2);
|
|
@@ -7989,7 +8021,7 @@ var editedAt = /* @__PURE__ */ __name((message, options) => {
|
|
|
7989
8021
|
return day(edited) === day(message.timestamp) ? time : `${day(edited)} ${time}`;
|
|
7990
8022
|
}, "editedAt");
|
|
7991
8023
|
|
|
7992
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
8024
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/cli/messenger/message-items.js
|
|
7993
8025
|
var defined = /* @__PURE__ */ __name((value) => Object.fromEntries(Object.entries(value).filter(([, one]) => one !== void 0)), "defined");
|
|
7994
8026
|
var attachmentItem = /* @__PURE__ */ __name((attachment) => defined({
|
|
7995
8027
|
kind: attachment.kind,
|
|
@@ -8001,6 +8033,7 @@ var attachmentItem = /* @__PURE__ */ __name((attachment) => defined({
|
|
|
8001
8033
|
width: attachment.width,
|
|
8002
8034
|
height: attachment.height,
|
|
8003
8035
|
duration: attachment.duration,
|
|
8036
|
+
local_path: attachment.localPath,
|
|
8004
8037
|
contact: attachment.contact && defined({
|
|
8005
8038
|
name: attachment.contact.name,
|
|
8006
8039
|
first_name: attachment.contact.firstName,
|
|
@@ -8084,7 +8117,7 @@ var viewOf = /* @__PURE__ */ __name((context, messenger) => ({
|
|
|
8084
8117
|
locale: messenger.app.locale
|
|
8085
8118
|
}), "viewOf");
|
|
8086
8119
|
|
|
8087
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
8120
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-answers.js
|
|
8088
8121
|
var observed = /* @__PURE__ */ __name((value) => ({
|
|
8089
8122
|
value: value.value,
|
|
8090
8123
|
observed_at: value.observedAt,
|
|
@@ -8151,7 +8184,7 @@ var watchEventItem = /* @__PURE__ */ __name((value, account) => {
|
|
|
8151
8184
|
}
|
|
8152
8185
|
}, "watchEventItem");
|
|
8153
8186
|
|
|
8154
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
8187
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/cli/messenger/watch-command.js
|
|
8155
8188
|
var watchCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("watch"), {
|
|
8156
8189
|
output: { entity: "watch_item" },
|
|
8157
8190
|
effects: REMOTE_READ,
|
|
@@ -8306,7 +8339,7 @@ var describe = /* @__PURE__ */ __name((event, render) => {
|
|
|
8306
8339
|
}
|
|
8307
8340
|
}, "describe");
|
|
8308
8341
|
|
|
8309
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
8342
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/cli/messenger/serve-command.js
|
|
8310
8343
|
var serveCommand = /* @__PURE__ */ __name((messenger) => {
|
|
8311
8344
|
const command = annotate(new Command("serve"), {
|
|
8312
8345
|
output: { entity: "serve_summary" },
|
|
@@ -8589,7 +8622,7 @@ var tasking = /* @__PURE__ */ __name((context, warn) => {
|
|
|
8589
8622
|
};
|
|
8590
8623
|
}, "tasking");
|
|
8591
8624
|
|
|
8592
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
8625
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/cli/messenger/store-tables-command.js
|
|
8593
8626
|
import { existsSync as existsSync9 } from "node:fs";
|
|
8594
8627
|
var PATH = "store tables list";
|
|
8595
8628
|
var STORE_TABLES_QUERY = {
|
|
@@ -8606,14 +8639,14 @@ var filterOf = /* @__PURE__ */ __name((words) => {
|
|
|
8606
8639
|
const kind = terms.get("kind");
|
|
8607
8640
|
return { ...name === void 0 ? {} : { name }, ...kind === void 0 ? {} : { kind } };
|
|
8608
8641
|
}, "filterOf");
|
|
8609
|
-
var storeTablesCommand = /* @__PURE__ */ __name((
|
|
8610
|
-
const tables = new Command("tables").description("the tables of the local
|
|
8642
|
+
var storeTablesCommand = /* @__PURE__ */ __name((owner) => {
|
|
8643
|
+
const tables = new Command("tables").description("the tables of the local store");
|
|
8611
8644
|
withQuery(annotate(tables.command("list"), {
|
|
8612
8645
|
effects: LOCAL_READ,
|
|
8613
8646
|
examples: [
|
|
8614
|
-
`${
|
|
8615
|
-
`${
|
|
8616
|
-
`${
|
|
8647
|
+
`${owner.app.command} store tables list`,
|
|
8648
|
+
`${owner.app.command} store tables list kind:data`,
|
|
8649
|
+
`${owner.app.command} store tables list --full --json`
|
|
8617
8650
|
]
|
|
8618
8651
|
}), STORE_TABLES_QUERY).summary("every table of the local archive, with its kind and row count").description("every table of the local archive: its kind (data, search index, part of a search index, internal) and its rows, a search index's rows not counted; --full adds each table's size on disk, which reads the whole file (about ten seconds for 3 GB); changes nothing").action(async function(words) {
|
|
8619
8652
|
const filter = filterOf(words);
|
|
@@ -8632,7 +8665,7 @@ var storeTablesCommand = /* @__PURE__ */ __name((messenger) => {
|
|
|
8632
8665
|
return tables;
|
|
8633
8666
|
}, "storeTablesCommand");
|
|
8634
8667
|
|
|
8635
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
8668
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@wirecat+cli-base@0.98.0_commander@15.0.0_esbuild@0.28.2_type_7618ae642a1b316105e0e055c769f604/node_modules/@wirecat/cli-core/dist/cli/messenger/store-maintenance-command.js
|
|
8636
8669
|
var SEARCH_INDEXES = ["messages_fts", "chats_fts", "identities_fts"];
|
|
8637
8670
|
var WORD_INDEX = "message_words";
|
|
8638
8671
|
var schemaOf = /* @__PURE__ */ __name((database) => {
|
|
@@ -8717,27 +8750,52 @@ var storeSummary = /* @__PURE__ */ __name(async (env, { deep = false, command, v
|
|
|
8717
8750
|
}
|
|
8718
8751
|
}, "storeSummary");
|
|
8719
8752
|
var result = /* @__PURE__ */ __name((command, value, next = []) => renderAnswer(command, outputFor(command), itemOf(snakeKeys(value), { next })), "result");
|
|
8720
|
-
var
|
|
8753
|
+
var chatty = /* @__PURE__ */ __name((owner) => owner.provider !== void 0, "chatty");
|
|
8754
|
+
var archive = /* @__PURE__ */ __name((owner) => chatty(owner) ? "local archive" : "local store", "archive");
|
|
8755
|
+
var createdBy = /* @__PURE__ */ __name((owner) => chatty(owner) ? `the first \`${owner.app.command}\` command that reads a chat creates it` : `the first \`${owner.app.command}\` command that saves anything creates it`, "createdBy");
|
|
8756
|
+
var storeMaintenanceCommands = /* @__PURE__ */ __name((owner) => [
|
|
8721
8757
|
storeInfoCommand(),
|
|
8722
|
-
checkCommand(
|
|
8723
|
-
migrateCommand(
|
|
8724
|
-
reindexCommand(
|
|
8758
|
+
checkCommand(owner),
|
|
8759
|
+
migrateCommand(owner),
|
|
8760
|
+
reindexCommand(owner),
|
|
8725
8761
|
backupCommand(),
|
|
8726
|
-
restoreCommand(
|
|
8762
|
+
restoreCommand(owner),
|
|
8727
8763
|
decryptCommand(),
|
|
8728
|
-
repairCommand(
|
|
8729
|
-
resetCommand(
|
|
8764
|
+
repairCommand(owner),
|
|
8765
|
+
resetCommand(owner),
|
|
8730
8766
|
copiesCommand(),
|
|
8731
|
-
storeTablesCommand(
|
|
8732
|
-
storeRecoverCommand({ command:
|
|
8767
|
+
storeTablesCommand(owner),
|
|
8768
|
+
storeRecoverCommand({ command: owner.app.command, version: owner.app.version })
|
|
8733
8769
|
], "storeMaintenanceCommands");
|
|
8734
|
-
var
|
|
8735
|
-
|
|
8770
|
+
var EXAMPLES = {
|
|
8771
|
+
backup: "./backup.db",
|
|
8772
|
+
check: "",
|
|
8773
|
+
"copies delete": "messages_copy_1",
|
|
8774
|
+
decrypt: "./backup.enc --output ./restored.db",
|
|
8775
|
+
info: "",
|
|
8776
|
+
migrate: "",
|
|
8777
|
+
rebuild: "",
|
|
8778
|
+
repair: "--dry-run",
|
|
8779
|
+
reset: "",
|
|
8780
|
+
restore: "./backup.db"
|
|
8781
|
+
};
|
|
8782
|
+
var addStoreMaintenanceCommands = /* @__PURE__ */ __name((store, owner, profile) => {
|
|
8783
|
+
for (const command of storeMaintenanceCommands(owner))
|
|
8784
|
+
store.addCommand(command);
|
|
8785
|
+
for (const [path, args] of Object.entries(EXAMPLES)) {
|
|
8786
|
+
const command = commandAt(store, path);
|
|
8787
|
+
if (command)
|
|
8788
|
+
annotate(command, { examples: [`${owner.app.command} ${profile} store ${path} ${args}`.trimEnd()] });
|
|
8789
|
+
}
|
|
8790
|
+
return store;
|
|
8791
|
+
}, "addStoreMaintenanceCommands");
|
|
8792
|
+
var refuseWhileServing = /* @__PURE__ */ __name((command, owner) => {
|
|
8793
|
+
const serving = servingProfiles(owner.app, environmentOf(command).env ?? process.env);
|
|
8736
8794
|
if (serving.length > 0) {
|
|
8737
|
-
throw new CliError("validation_error", `${
|
|
8795
|
+
throw new CliError("validation_error", `${owner.app.command} serve is running for ${serving.join(", ")} \u2014 ${serving.map((profile) => `\`${owner.app.command} ${profile} server stop\``).join(", ")} first`);
|
|
8738
8796
|
}
|
|
8739
8797
|
}, "refuseWhileServing");
|
|
8740
|
-
var repairCommand = /* @__PURE__ */ __name((
|
|
8798
|
+
var repairCommand = /* @__PURE__ */ __name((owner) => annotate(new Command("repair"), { output: { entity: "store_repair" }, effects: LOCAL_WRITE }).summary("repair table shapes while keeping the old tables").description("bring every table to this build's shape, deleting nothing: a table of the wrong shape is kept as a copy beside a new one").option("--dry-run", "say what it would do, and change nothing").action(async function() {
|
|
8741
8799
|
const { renderer, format } = outputFor(this);
|
|
8742
8800
|
const { dryRun: dryRun2 } = this.opts();
|
|
8743
8801
|
const path = storePath(environmentOf(this).env ?? process.env);
|
|
@@ -8746,13 +8804,13 @@ var repairCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("
|
|
|
8746
8804
|
return;
|
|
8747
8805
|
}
|
|
8748
8806
|
if (!dryRun2)
|
|
8749
|
-
refuseWhileServing(this,
|
|
8807
|
+
refuseWhileServing(this, owner);
|
|
8750
8808
|
const fresh = await openCache(":memory:");
|
|
8751
8809
|
try {
|
|
8752
8810
|
const report = await reading(path, (database) => repairStore(database, fresh, { dryRun: dryRun2 === true }));
|
|
8753
8811
|
result(this, { path, ...report });
|
|
8754
8812
|
if (format === "pretty")
|
|
8755
|
-
for (const note of notesOf(report,
|
|
8813
|
+
for (const note of notesOf(report, owner.app.command))
|
|
8756
8814
|
renderer.note(note);
|
|
8757
8815
|
} finally {
|
|
8758
8816
|
fresh.close();
|
|
@@ -8786,7 +8844,7 @@ var copiesCommand = /* @__PURE__ */ __name(() => new Command("copies").descripti
|
|
|
8786
8844
|
const deleted = await reading(path, (database) => deleteCopy(database, name));
|
|
8787
8845
|
result(this, { path, deleted });
|
|
8788
8846
|
})), "copiesCommand");
|
|
8789
|
-
var checkCommand = /* @__PURE__ */ __name((
|
|
8847
|
+
var checkCommand = /* @__PURE__ */ __name((owner) => annotate(new Command("check"), { output: { entity: "store_check" }, effects: LOCAL_READ }).summary(`check the ${archive(owner)} for problems`).description(`whether the store is healthy \u2014 integrity, search indexes, disk${chatty(owner) ? ", and which chats are behind" : ""}`).action(async function() {
|
|
8790
8848
|
const { renderer } = outputFor(this);
|
|
8791
8849
|
const path = storePath(environmentOf(this).env ?? process.env);
|
|
8792
8850
|
if (!existsSync10(path)) {
|
|
@@ -8800,7 +8858,7 @@ var checkCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("c
|
|
|
8800
8858
|
result(this, { path, exists: true, ok: false, opens: false, error: messageOf2(error) });
|
|
8801
8859
|
return;
|
|
8802
8860
|
}
|
|
8803
|
-
const { command } =
|
|
8861
|
+
const { command } = owner.app;
|
|
8804
8862
|
const next = /* @__PURE__ */ new Map();
|
|
8805
8863
|
const step = /* @__PURE__ */ __name((id, args = {}) => {
|
|
8806
8864
|
if (!next.has(id))
|
|
@@ -8816,10 +8874,10 @@ var checkCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("c
|
|
|
8816
8874
|
step("store.reindex");
|
|
8817
8875
|
else if (stems && !stems.ready)
|
|
8818
8876
|
step("store.migrate");
|
|
8819
|
-
const behind = answer.chatsBehind.find((chat) => chat.provider ===
|
|
8820
|
-
if (behind &&
|
|
8877
|
+
const behind = answer.chatsBehind.find((chat) => chat.provider === owner.provider);
|
|
8878
|
+
if (behind && owner.history !== "store")
|
|
8821
8879
|
step("messages.sync");
|
|
8822
|
-
else if (behind && syncsOneChat(
|
|
8880
|
+
else if (behind && syncsOneChat(owner))
|
|
8823
8881
|
step("messages.sync", { chat: behind.chat });
|
|
8824
8882
|
result(this, answer, [...next.values()]);
|
|
8825
8883
|
if (answer.schema.version < SPEAKS) {
|
|
@@ -8834,7 +8892,7 @@ var checkCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("c
|
|
|
8834
8892
|
renderer.note(`${orphans} pointers name a row that is gone or a type the store does not know \u2014 see orphan_pointers`);
|
|
8835
8893
|
if (answer.vectors && answer.vectors.unused > 0)
|
|
8836
8894
|
renderer.note(`${answer.vectors.unused} vectors belong to no text the store still holds \u2014 \`${command} store rebuild\` drops them`);
|
|
8837
|
-
const older = answer.conversations.filter((chat) => chat.provider ===
|
|
8895
|
+
const older = answer.conversations.filter((chat) => chat.provider === owner.provider && !chat.current).length;
|
|
8838
8896
|
if (older > 0) {
|
|
8839
8897
|
renderer.note(`${older} chats' conversations were built by older rules \u2014 \`${command} conversations links rebuild --chat <chat>\``);
|
|
8840
8898
|
}
|
|
@@ -8937,19 +8995,19 @@ var chatsBehind = /* @__PURE__ */ __name((database) => database.prepare(`SELECT
|
|
|
8937
8995
|
held: row.held === null ? null : isoOf(row.held),
|
|
8938
8996
|
refreshed: isoOf(row.refreshed)
|
|
8939
8997
|
})), "chatsBehind");
|
|
8940
|
-
var migrateCommand = /* @__PURE__ */ __name((
|
|
8998
|
+
var migrateCommand = /* @__PURE__ */ __name((owner) => annotate(new Command("migrate"), { output: { entity: "store_migration" }, effects: LOCAL_WRITE }).summary(`migrate an older ${archive(owner)}`).description("bring the store up to this build's schema, then normalize, index and stem the messages and notes stored before it").action(async function() {
|
|
8941
8999
|
const { renderer } = outputFor(this);
|
|
8942
9000
|
const path = storePath(environmentOf(this).env ?? process.env);
|
|
8943
9001
|
if (!existsSync10(path)) {
|
|
8944
9002
|
result(this, { path, exists: false });
|
|
8945
|
-
renderer.note(`no store yet \u2014
|
|
9003
|
+
renderer.note(`no store yet \u2014 ${createdBy(owner)}`);
|
|
8946
9004
|
return;
|
|
8947
9005
|
}
|
|
8948
9006
|
const answer = await reading(path, (database) => {
|
|
8949
9007
|
const from = schemaOf(database).version;
|
|
8950
9008
|
migrate(database, {
|
|
8951
|
-
command:
|
|
8952
|
-
version:
|
|
9009
|
+
command: owner.app.command,
|
|
9010
|
+
version: owner.app.version,
|
|
8953
9011
|
rollback: { store: path, warn: /* @__PURE__ */ __name((line) => renderer.warn(line), "warn") }
|
|
8954
9012
|
});
|
|
8955
9013
|
const { normalized, indexed, terms } = buildWordIndex(database, (note) => renderer.note(note));
|
|
@@ -9001,7 +9059,7 @@ var buildNoteIndex = /* @__PURE__ */ __name((database, note, { reset = false } =
|
|
|
9001
9059
|
note(`indexing ${pending} notes`);
|
|
9002
9060
|
return { notesIndexed: drainNoteIndex(database, stemmerCache()) };
|
|
9003
9061
|
}, "buildNoteIndex");
|
|
9004
|
-
var reindexCommand = /* @__PURE__ */ __name((
|
|
9062
|
+
var reindexCommand = /* @__PURE__ */ __name((owner) => destroysNothing(annotate(new Command("rebuild"), { output: { entity: "store_reindex" }, effects: LOCAL_WRITE })).summary(`rebuild the ${archive(owner)}'s search indexes`).description("rebuild the word index, its typo vocabulary, the stems, the files' word index, the notes' indexes and who took part in what, from what is stored, and drop the vectors no stored text uses; loses nothing").action(async function() {
|
|
9005
9063
|
const { renderer } = outputFor(this);
|
|
9006
9064
|
const path = storePath(environmentOf(this).env ?? process.env);
|
|
9007
9065
|
if (!existsSync10(path)) {
|
|
@@ -9046,6 +9104,9 @@ var backupCommand = /* @__PURE__ */ __name(() => destroysNothing(annotate(new Co
|
|
|
9046
9104
|
const { encrypt } = this.opts();
|
|
9047
9105
|
const path = storePath(environmentOf(this).env ?? process.env);
|
|
9048
9106
|
const target = resolve(file2);
|
|
9107
|
+
const { app, env } = environmentOf(this);
|
|
9108
|
+
if (app)
|
|
9109
|
+
refuseLockedOutput(target, app, env ?? process.env, "<file>");
|
|
9049
9110
|
if (!existsSync10(path))
|
|
9050
9111
|
throw new CliError("not_found", `no store at ${path} to back up`);
|
|
9051
9112
|
if (existsSync10(target))
|
|
@@ -9090,37 +9151,37 @@ var decryptCommand = /* @__PURE__ */ __name(() => annotate(new Command("decrypt"
|
|
|
9090
9151
|
await unsealFile(from, to, await passwordOf(this, { twice: false }));
|
|
9091
9152
|
result(this, { path: to, from, bytes: bytesOf2(to) });
|
|
9092
9153
|
}), "decryptCommand");
|
|
9093
|
-
var restoreCommand = /* @__PURE__ */ __name((
|
|
9154
|
+
var restoreCommand = /* @__PURE__ */ __name((owner) => grantsAuthority(annotate(new Command("restore"), { output: { entity: "store_restore" }, effects: LOCAL_WRITE })).summary("restore a backup and keep the current store, or roll back a breaking upgrade").description("put a backup in place of the store; the store it replaces is kept beside it, never deleted. Given a rollback copy (backups/<store>-rollback-schema-<version>-<time>.db, kept for a day before an upgrade older tools cannot open), put its tables back in the store and return it to that version instead").argument("<file>", "a file `store backup` wrote, or a rollback copy; one written with --encrypt asks for its password").action(async function(file2) {
|
|
9094
9155
|
const path = storePath(environmentOf(this).env ?? process.env);
|
|
9095
9156
|
const given = resolve(file2);
|
|
9096
9157
|
if (!existsSync10(given))
|
|
9097
9158
|
throw new CliError("not_found", `no file at ${given}`);
|
|
9098
|
-
refuseWhileServing(this,
|
|
9159
|
+
refuseWhileServing(this, owner);
|
|
9099
9160
|
if (!isSealed(given))
|
|
9100
|
-
return restoreFrom(this,
|
|
9161
|
+
return restoreFrom(this, owner, given, given);
|
|
9101
9162
|
const opened = `${path}.unsealing-${process.pid}`;
|
|
9102
9163
|
mkdirSync(dirname3(path), { recursive: true, mode: 448 });
|
|
9103
9164
|
try {
|
|
9104
9165
|
await unsealFile(given, opened, await passwordOf(this, { twice: false }));
|
|
9105
|
-
await restoreFrom(this,
|
|
9166
|
+
await restoreFrom(this, owner, opened, given);
|
|
9106
9167
|
} finally {
|
|
9107
9168
|
rmSync3(opened, { force: true });
|
|
9108
9169
|
}
|
|
9109
9170
|
}), "restoreCommand");
|
|
9110
|
-
var restoreFrom = /* @__PURE__ */ __name(async (command,
|
|
9171
|
+
var restoreFrom = /* @__PURE__ */ __name(async (command, owner, backup, given) => {
|
|
9111
9172
|
const { renderer } = outputFor(command);
|
|
9112
9173
|
const path = storePath(environmentOf(command).env ?? process.env);
|
|
9113
9174
|
if (existsSync10(path) && realpathSync3(backup) === realpathSync3(path)) {
|
|
9114
9175
|
throw new CliError("validation_error", `${backup} is the store itself`);
|
|
9115
9176
|
}
|
|
9116
9177
|
if (await isRollbackCopy(backup))
|
|
9117
|
-
return rollBackFrom(command,
|
|
9178
|
+
return rollBackFrom(command, owner, backup);
|
|
9118
9179
|
const schema = await backupSchema(backup);
|
|
9119
9180
|
const stamp = stampNow();
|
|
9120
9181
|
const kept = existsSync10(path) ? `${path}.before-restore-${stamp}` : null;
|
|
9121
9182
|
if (kept) {
|
|
9122
9183
|
const waitMs = environmentOf(command).storeLockWaitMs;
|
|
9123
|
-
await quiesce(path,
|
|
9184
|
+
await quiesce(path, owner, "restore", (message) => renderer.warn(message), waitMs);
|
|
9124
9185
|
} else
|
|
9125
9186
|
mkdirSync(dirname3(path), { recursive: true, mode: 448 });
|
|
9126
9187
|
const incoming = `${path}.restoring-${stamp}`;
|
|
@@ -9148,13 +9209,13 @@ var isRollbackCopy = /* @__PURE__ */ __name(async (file2) => {
|
|
|
9148
9209
|
return false;
|
|
9149
9210
|
}
|
|
9150
9211
|
}, "isRollbackCopy");
|
|
9151
|
-
var rollBackFrom = /* @__PURE__ */ __name(async (command,
|
|
9212
|
+
var rollBackFrom = /* @__PURE__ */ __name(async (command, owner, copy) => {
|
|
9152
9213
|
const { renderer } = outputFor(command);
|
|
9153
9214
|
const path = storePath(environmentOf(command).env ?? process.env);
|
|
9154
9215
|
if (!existsSync10(path))
|
|
9155
9216
|
throw new CliError("not_found", `no store at ${path} to roll back`);
|
|
9156
9217
|
const waitMs = environmentOf(command).storeLockWaitMs;
|
|
9157
|
-
await quiesce(path,
|
|
9218
|
+
await quiesce(path, owner, "restore", (message) => renderer.warn(message), waitMs);
|
|
9158
9219
|
const { database } = await openSqlite(path);
|
|
9159
9220
|
let rolled;
|
|
9160
9221
|
try {
|
|
@@ -9199,8 +9260,8 @@ var backupSchema = /* @__PURE__ */ __name(async (backup) => {
|
|
|
9199
9260
|
return schema;
|
|
9200
9261
|
}, "backupSchema");
|
|
9201
9262
|
var STORE_LOCK_WAIT_MS = 1e3;
|
|
9202
|
-
var quiesce = /* @__PURE__ */ __name(async (path,
|
|
9203
|
-
const { command } =
|
|
9263
|
+
var quiesce = /* @__PURE__ */ __name(async (path, owner, then, warn, waitMs = STORE_LOCK_WAIT_MS) => {
|
|
9264
|
+
const { command } = owner.app;
|
|
9204
9265
|
const files = [path, `${path}-wal`, `${path}-shm`].filter((file2) => existsSync10(file2)).map((file2) => realpathSync3(file2));
|
|
9205
9266
|
const holders = holdersOf(files);
|
|
9206
9267
|
if (holders === void 0) {
|
|
@@ -9222,21 +9283,21 @@ var quiesce = /* @__PURE__ */ __name(async (path, messenger, then, warn, waitMs
|
|
|
9222
9283
|
database.close();
|
|
9223
9284
|
}
|
|
9224
9285
|
}, "quiesce");
|
|
9225
|
-
var resetCommand = /* @__PURE__ */ __name((
|
|
9286
|
+
var resetCommand = /* @__PURE__ */ __name((owner) => annotate(new Command("reset"), { output: { entity: "store_reset" }, effects: LOCAL_WRITE, mcp: false }).summary(`back up the ${archive(owner)} and replace it with an empty one`).description("back the store up beside itself, then delete it and start an empty one at this build's schema; asks first, or --yes").option("--no-backup", "delete the store without backing it up first").option("--dry-run", "list every table it would empty, with its rows, and delete nothing").action(async function({ backup: keep, dryRun: dryRun2 }) {
|
|
9226
9287
|
const { renderer } = outputFor(this);
|
|
9227
|
-
const { command } =
|
|
9288
|
+
const { command } = owner.app;
|
|
9228
9289
|
const env = environmentOf(this).env ?? process.env;
|
|
9229
9290
|
const path = storePath(env);
|
|
9230
9291
|
if (!existsSync10(path)) {
|
|
9231
9292
|
result(this, { path, exists: false, reset: false });
|
|
9232
|
-
renderer.note(`no store at ${path} \u2014 nothing to reset;
|
|
9293
|
+
renderer.note(`no store at ${path} \u2014 nothing to reset; ${createdBy(owner)}`);
|
|
9233
9294
|
return;
|
|
9234
9295
|
}
|
|
9235
9296
|
if (dryRun2) {
|
|
9236
|
-
result(this, await resetPreview(path,
|
|
9297
|
+
result(this, await resetPreview(path, owner, env, keep));
|
|
9237
9298
|
return;
|
|
9238
9299
|
}
|
|
9239
|
-
refuseWhileServing(this,
|
|
9300
|
+
refuseWhileServing(this, owner);
|
|
9240
9301
|
if (this.optsWithGlobals().yes !== true) {
|
|
9241
9302
|
const what = `this deletes the store at ${path} and starts an empty one, ${keep ? "after a backup beside it" : "with no backup"}`;
|
|
9242
9303
|
const answer = await answerOf(this, `${what}. Go ahead? [y/N] `);
|
|
@@ -9245,7 +9306,7 @@ var resetCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("r
|
|
|
9245
9306
|
if (!/^\s*y(es)?\s*$/i.test(answer))
|
|
9246
9307
|
throw new CliError("cancelled", "cancelled \u2014 the store is unchanged");
|
|
9247
9308
|
}
|
|
9248
|
-
await quiesce(path,
|
|
9309
|
+
await quiesce(path, owner, "reset", (message) => renderer.warn(message), environmentOf(this).storeLockWaitMs);
|
|
9249
9310
|
const backup = keep ? `${path}.backup-${stampNow()}` : null;
|
|
9250
9311
|
let backedUp = null;
|
|
9251
9312
|
if (backup) {
|
|
@@ -9271,10 +9332,10 @@ var resetCommand = /* @__PURE__ */ __name((messenger) => annotate(new Command("r
|
|
|
9271
9332
|
renderer.note(backup ? `the store is empty at schema ${schema}; \`${command} store restore ${backup}\` puts the old one back once a build can read it` : `the store is empty at schema ${schema}; there is no backup`);
|
|
9272
9333
|
}), "resetCommand");
|
|
9273
9334
|
var STORE_PARTS2 = ["", "-wal", "-shm"];
|
|
9274
|
-
var resetPreview = /* @__PURE__ */ __name(async (path,
|
|
9335
|
+
var resetPreview = /* @__PURE__ */ __name(async (path, owner, env, keep) => {
|
|
9275
9336
|
const files = STORE_PARTS2.map((suffix) => `${path}${suffix}`).filter((file2) => existsSync10(file2));
|
|
9276
9337
|
const holders = holdersOf(files.map((file2) => realpathSync3(file2)));
|
|
9277
|
-
const serving = servingProfiles(
|
|
9338
|
+
const serving = servingProfiles(owner.app, env).length > 0;
|
|
9278
9339
|
const read = await readingOnly(path, (database) => ({
|
|
9279
9340
|
schema: schemaOf(database).version,
|
|
9280
9341
|
tables: emptiedTables(database)
|
|
@@ -9304,7 +9365,13 @@ export {
|
|
|
9304
9365
|
checkFor,
|
|
9305
9366
|
passes,
|
|
9306
9367
|
seal,
|
|
9368
|
+
storeRecoveryCheck,
|
|
9369
|
+
storeRecoveryRun,
|
|
9370
|
+
recoveryNotes,
|
|
9371
|
+
storeRecoverCommand,
|
|
9307
9372
|
storeInfo,
|
|
9373
|
+
storeInfoCommand,
|
|
9374
|
+
sharedStoreCommand,
|
|
9308
9375
|
ENCRYPT_OPTION,
|
|
9309
9376
|
passwordOf,
|
|
9310
9377
|
REPLY_ACTIONS,
|
|
@@ -9323,12 +9390,28 @@ export {
|
|
|
9323
9390
|
safeLiquid,
|
|
9324
9391
|
DRY_RUN_DAYS,
|
|
9325
9392
|
dryRun,
|
|
9393
|
+
senderFacts,
|
|
9394
|
+
purposeModel,
|
|
9326
9395
|
replyConsentPathFor,
|
|
9327
9396
|
readReplyConsent,
|
|
9328
9397
|
writeReplyConsent,
|
|
9329
9398
|
replyModelIdentity,
|
|
9330
9399
|
replyRenderer,
|
|
9400
|
+
NOT_ALLOWED,
|
|
9401
|
+
NO_RULES,
|
|
9402
|
+
ONLY_TASK,
|
|
9403
|
+
NO_TASKS,
|
|
9404
|
+
replyTo,
|
|
9405
|
+
FIRST_FETCH_MS,
|
|
9331
9406
|
DAY_MS,
|
|
9407
|
+
memberFetches,
|
|
9408
|
+
OUTDATED_CHECK_MS,
|
|
9409
|
+
ownPackageRoot,
|
|
9410
|
+
outdatedReason,
|
|
9411
|
+
watchOutdated,
|
|
9412
|
+
STEMS_EVERY_MS,
|
|
9413
|
+
STEMS_SLICE_MS,
|
|
9414
|
+
stemFills,
|
|
9332
9415
|
renderMessages,
|
|
9333
9416
|
messageItem,
|
|
9334
9417
|
messageItems,
|
|
@@ -9338,5 +9421,6 @@ export {
|
|
|
9338
9421
|
serveCommand,
|
|
9339
9422
|
storeSummary,
|
|
9340
9423
|
storeMaintenanceCommands,
|
|
9424
|
+
addStoreMaintenanceCommands,
|
|
9341
9425
|
buildStems
|
|
9342
9426
|
};
|