@wirecat/drive-cli 0.61.0 → 0.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/drive.js +2 -2
- package/dist/browse.d.ts +20 -0
- package/dist/browse.d.ts.map +1 -0
- package/dist/browse.js +146 -0
- package/dist/browse.js.map +1 -0
- package/dist/bundle/{all-profiles-H4L3Z5UM.js → all-profiles-CKD2DWUK.js} +14 -14
- package/dist/bundle/{anthropic-PPGFISVP.js → anthropic-E3T4USLA.js} +9 -9
- package/dist/bundle/{app-server-YXVK2FUZ.js → app-server-JB2AEWWL.js} +58 -55
- package/dist/bundle/{bun-DKZAL6ML.js → bun-CC44AAND.js} +2 -2
- package/dist/bundle/{bun-sqlite-MTZY36QK.js → bun-sqlite-AUMFKYVR.js} +8 -8
- package/dist/bundle/{chunk-KV4267S4.js → chunk-27YUUGXQ.js} +1 -1
- package/dist/bundle/{chunk-6IBM4Z3V.js → chunk-2HF2MRXI.js} +1 -1
- package/dist/bundle/{chunk-3I2D5TK2.js → chunk-2KN35F32.js} +10 -10
- package/dist/bundle/{chunk-WZ5XK74U.js → chunk-4OSSOWDM.js} +1 -1
- package/dist/bundle/{chunk-UO2IUDVK.js → chunk-4SIZEJ3M.js} +2 -2
- package/dist/bundle/{chunk-6Y2FWJZ4.js → chunk-67ZQCWBV.js} +3 -3
- package/dist/bundle/{chunk-OFFA54TW.js → chunk-6EY46GAN.js} +2 -2
- package/dist/bundle/{chunk-ECEYAQGN.js → chunk-7W5HYGVW.js} +4 -2
- package/dist/bundle/{chunk-67HS46KM.js → chunk-7ZXIWZQ6.js} +12 -12
- package/dist/bundle/{chunk-J5UDQD5S.js → chunk-AH5C3D3D.js} +5 -5
- package/dist/bundle/{chunk-BCWUDTYQ.js → chunk-AQVUEZEP.js} +2 -2
- package/dist/bundle/{chunk-K7LS3NGM.js → chunk-CJHY5YIF.js} +494 -227
- package/dist/bundle/{chunk-PY7LKNOS.js → chunk-CZ2GJHLL.js} +2 -2
- package/dist/bundle/{chunk-NIX2MWHZ.js → chunk-DJOAMGF4.js} +39 -25
- package/dist/bundle/{chunk-AWN22PJK.js → chunk-DRZZBN3V.js} +3 -3
- package/dist/bundle/{chunk-DEPMQHXQ.js → chunk-DWJHL6DV.js} +4 -4
- package/dist/bundle/{chunk-QSGT4ZH4.js → chunk-E43ENLJJ.js} +1 -1
- package/dist/bundle/{chunk-NZ2EIZLX.js → chunk-EOOGWUTP.js} +10 -10
- package/dist/bundle/{chunk-5W56YMQS.js → chunk-EW7PKB4M.js} +58 -49
- package/dist/bundle/{chunk-VYXVPYA3.js → chunk-FEZF3TII.js} +6 -6
- package/dist/bundle/{chunk-I26VL4W7.js → chunk-FNWIJ6EJ.js} +2 -2
- package/dist/bundle/{chunk-OLPJRD4S.js → chunk-FUITWY7O.js} +1 -1
- package/dist/bundle/{chunk-XZBR2O63.js → chunk-HCNQT3QE.js} +1439 -770
- package/dist/bundle/{chunk-Q4XVBKX4.js → chunk-HG6CAYJH.js} +3 -3
- package/dist/bundle/{chunk-O5CUFS7T.js → chunk-IR4SQLBR.js} +2 -2
- package/dist/bundle/{chunk-VPDAH7PJ.js → chunk-JK3U25QZ.js} +1 -1
- package/dist/bundle/{chunk-UKOYQC5O.js → chunk-JN5TVEEL.js} +94 -26
- package/dist/bundle/{chunk-5W7D5H2R.js → chunk-KLFSRKHB.js} +1 -1
- package/dist/bundle/{chunk-RFRCOAWS.js → chunk-L7K2MOIC.js} +22 -22
- package/dist/bundle/{chunk-XYCCGGKN.js → chunk-LQKD257P.js} +582 -424
- package/dist/bundle/{chunk-73WSULMI.js → chunk-LWE4JGRN.js} +2 -2
- package/dist/bundle/{chunk-XGMDWIUP.js → chunk-MN4VXU3M.js} +4 -4
- package/dist/bundle/{chunk-N2RLJTIW.js → chunk-N7OZPKU7.js} +4 -4
- package/dist/bundle/{chunk-OGNOQDWB.js → chunk-O2XOX4HB.js} +34 -10
- package/dist/bundle/{chunk-3SJQNS72.js → chunk-O7ALBI2I.js} +5 -5
- package/dist/bundle/{chunk-3WZH3WV3.js → chunk-OBH5BA62.js} +3 -3
- package/dist/bundle/{chunk-DCBFNBEB.js → chunk-OD4U7GUY.js} +20 -20
- package/dist/bundle/{chunk-PJTX2MOI.js → chunk-ONP2IBHY.js} +26 -26
- package/dist/bundle/{chunk-BXR7BKM3.js → chunk-OTROVC4E.js} +1 -1
- package/dist/bundle/{chunk-JVBLXSAA.js → chunk-PEQA6LA5.js} +617 -243
- package/dist/bundle/{chunk-XLFJLZJL.js → chunk-Q2LRPOKL.js} +22 -14
- package/dist/bundle/{chunk-E5EXJ2XS.js → chunk-QCKZ3GAA.js} +4 -4
- package/dist/bundle/{chunk-BQMIDYBA.js → chunk-QCX6XZLA.js} +12 -12
- package/dist/bundle/{chunk-TKGAYKXW.js → chunk-QH7DOVO3.js} +204 -58
- package/dist/bundle/{chunk-YMBFZA3H.js → chunk-QTI6IVHZ.js} +8 -8
- package/dist/bundle/{chunk-YWIU4HOT.js → chunk-R347FPYU.js} +1 -1
- package/dist/bundle/chunk-RIDQNVZM.js +64 -0
- package/dist/bundle/{chunk-AM4RIWOZ.js → chunk-RPMKG63Z.js} +18 -4
- package/dist/bundle/{chunk-EPCJUL6M.js → chunk-RWSXVCSG.js} +3 -3
- package/dist/bundle/{chunk-36CWGEVX.js → chunk-SVPCHFKI.js} +2 -2
- package/dist/bundle/{chunk-ZHYRHERD.js → chunk-SW4I5BR7.js} +2 -2
- package/dist/bundle/{chunk-FE5JJXKA.js → chunk-T5NWWXS2.js} +2 -2
- package/dist/bundle/{chunk-E6J5YH2N.js → chunk-T7X53FCJ.js} +34 -34
- package/dist/bundle/{chunk-X2CXW4HM.js → chunk-TDX4GZFO.js} +7 -7
- package/dist/bundle/{chunk-3UPIJ7DW.js → chunk-U2BFYSQV.js} +14158 -2039
- package/dist/bundle/{chunk-HFM653T3.js → chunk-UGXN5D7U.js} +719 -128
- package/dist/bundle/{chunk-WUP2MJDN.js → chunk-UOXOLGNG.js} +2 -2
- package/dist/bundle/{chunk-J4HQVHMN.js → chunk-UQLWMGSD.js} +5 -5
- package/dist/bundle/{chunk-6DN4VPA7.js → chunk-VAYB52HF.js} +33 -31
- package/dist/bundle/{chunk-BF6TQMNB.js → chunk-VQDD64A4.js} +8 -8
- package/dist/bundle/{chunk-ZMNYK3FC.js → chunk-W4RTIL7S.js} +5 -5
- package/dist/bundle/{chunk-HGOYQUT7.js → chunk-WZKEU7WR.js} +4 -2
- package/dist/bundle/{chunk-QR5VQXQ5.js → chunk-XEW2EN6F.js} +51 -37
- package/dist/bundle/{chunk-DXPOVLQC.js → chunk-XFRRKZHQ.js} +223 -89
- package/dist/bundle/{chunk-XGNC5OJG.js → chunk-XS5POQST.js} +1 -1
- package/dist/bundle/{chunk-LARQTWIL.js → chunk-XZUS7XRO.js} +1 -1
- package/dist/bundle/{chunk-6SUGANRJ.js → chunk-YALI4C7C.js} +6 -6
- package/dist/bundle/{chunk-WIU733D2.js → chunk-YMWENGKH.js} +1 -1
- package/dist/bundle/{chunk-CACYL36O.js → chunk-YOJDGAPT.js} +8 -8
- package/dist/bundle/{chunk-S4YK6TTG.js → chunk-YPFUYQDP.js} +13 -13
- package/dist/bundle/{chunk-3252WXOL.js → chunk-YUWPNG7B.js} +1 -1
- package/dist/bundle/{chunk-2RJA4BQB.js → chunk-YXYTY4GF.js} +39 -26
- package/dist/bundle/{chunk-YPF6OS37.js → chunk-ZMOUUOT2.js} +1 -1
- package/dist/bundle/command-contract-OB5BRABN.js +39 -0
- package/dist/bundle/{decode-62A3HGPW.js → decode-WIIX3Y2X.js} +8 -8
- package/dist/bundle/{dispatch-IE7PBEQC.js → dispatch-GEFIXA6X.js} +9 -9
- package/dist/bundle/drive.js +11 -11
- package/dist/bundle/{echarts-BGBPRGR5.js → echarts-OYINM4C4.js} +2 -2
- package/dist/bundle/{embed-J3IBVV2V.js → embed-DWZIYMBX.js} +9 -9
- package/dist/bundle/{embedder-QFPMDRT2.js → embedder-ILWH7ZRM.js} +12 -12
- package/dist/bundle/entry-V5V3TOTY.js +22 -0
- package/dist/bundle/{failure-BKOGBMIC.js → failure-GV77W3CD.js} +4 -4
- package/dist/bundle/first-run-V3VVLQF4.js +30 -0
- package/dist/bundle/first-screen-Y3RIN7FU.js +37 -0
- package/dist/bundle/{google-RXM2XEPD.js → google-KLZSUAVY.js} +13 -13
- package/dist/bundle/{google-api-NC65BZO4.js → google-api-HZQ5R4ZO.js} +57 -57
- package/dist/bundle/grants-L7XLHLUT.js +105 -0
- package/dist/bundle/{identity-PI6F2GWA.js → identity-J2DON4IO.js} +6 -6
- package/dist/bundle/{instructions-6LPDSKAD.js → instructions-HGOJ23AJ.js} +1 -1
- package/dist/bundle/{login-HTY7GT2S.js → login-BD2TS4GY.js} +63 -63
- package/dist/bundle/{mcp-PPVOM4SE.js → mcp-GWDA3HOA.js} +2 -2
- package/dist/bundle/{node-IB246NCQ.js → node-CPKTDPH7.js} +2 -2
- package/dist/bundle/{node-sqlite-G2Y5SFJM.js → node-sqlite-IXDCRLSX.js} +9 -9
- package/dist/bundle/oauth-HOGY4YBB.js +22 -0
- package/dist/bundle/{open-WD4GFSJD.js → open-O7P3ZV3Y.js} +8 -8
- package/dist/bundle/{openai-QVM4PMY7.js → openai-RCFQKCXC.js} +17 -17
- package/dist/bundle/{process-SWPJGPQC.js → process-KXDRJO22.js} +1 -1
- package/dist/bundle/{program-WHYFAMXR.js → program-UCHFC7JQ.js} +228 -85
- package/dist/bundle/prompt-EVPPBN5W.js +17 -0
- package/dist/bundle/{reasons-Q34DQWB6.js → reasons-57J2D77K.js} +5 -5
- package/dist/bundle/{recognize-DM3YWHSE.js → recognize-MRCYGP2J.js} +7 -7
- package/dist/bundle/{remote-KXVWRK7J.js → remote-L3L4PHKF.js} +10 -10
- package/dist/bundle/{rerank-TINXM3MY.js → rerank-PSOE6XFT.js} +10 -10
- package/dist/bundle/{serve-IY2WL656.js → serve-72OGS3BF.js} +12 -12
- package/dist/bundle/server-C5TGNFXW.js +70 -0
- package/dist/bundle/{server-VPY3OWPC.js → server-SCXKYHBO.js} +44 -44
- package/dist/bundle/{services-PXNBOCOC.js → services-YAFTELBI.js} +42 -32
- package/dist/bundle/{sqlite-runtime-5ZK2CV7Y.js → sqlite-runtime-DLK4SU33.js} +9 -9
- package/dist/bundle/{start-LDVCN3DK.js → start-AFFA3LKM.js} +9 -7
- package/dist/bundle/{state-3MKTT3VS.js → state-T5VNAJSZ.js} +9 -9
- package/dist/bundle/{store-7M4MSUJV.js → store-4OFK7PKQ.js} +48 -28
- package/dist/bundle/{store-4VQOT5IJ.js → store-R6MSY2IM.js} +20 -18
- package/dist/bundle/store-maintenance-command-QDMCXGV6.js +60 -0
- package/dist/bundle/tokens-HIG36RNS.js +103 -0
- package/dist/commands/folders.d.ts +2 -1
- package/dist/commands/folders.d.ts.map +1 -1
- package/dist/commands/folders.js +16 -3
- package/dist/commands/folders.js.map +1 -1
- package/dist/program.js +1 -1
- package/dist/program.js.map +1 -1
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +15 -6
- package/dist/tokens.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/dist/bundle/chunk-W767AUNR.js +0 -132
- package/dist/bundle/command-contract-T3EO5AYD.js +0 -39
- package/dist/bundle/entry-YQSYER66.js +0 -22
- package/dist/bundle/first-run-ZIFPVZAI.js +0 -30
- package/dist/bundle/first-screen-L5U26EY7.js +0 -37
- package/dist/bundle/grants-SEWUYYH3.js +0 -105
- package/dist/bundle/oauth-MWBKBI4T.js +0 -22
- package/dist/bundle/prompt-OVYCGZB7.js +0 -17
- package/dist/bundle/server-EMWVVT2C.js +0 -70
- package/dist/bundle/store-maintenance-command-NRATYBWD.js +0 -60
- package/dist/bundle/tokens-XUKLM3SL.js +0 -103
- /package/dist/bundle/{chunk-LU3WKZBA.js → chunk-ZQ3GWKDQ.js} +0 -0
|
@@ -2,15 +2,15 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
wirecatDirectory
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-FNWIJ6EJ.js";
|
|
6
6
|
import {
|
|
7
7
|
CliError
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-4OSSOWDM.js";
|
|
9
9
|
import {
|
|
10
10
|
__name
|
|
11
11
|
} from "./chunk-ZVVMGPBJ.js";
|
|
12
12
|
|
|
13
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/speech/models.js
|
|
14
14
|
var huggingFace = /* @__PURE__ */ __name((repository, commit) => (name) => `https://huggingface.co/csukuangfj/${repository}/resolve/${commit}/${name}`, "huggingFace");
|
|
15
15
|
var gigaam = huggingFace("sherpa-onnx-nemo-transducer-punct-giga-am-v3-russian-2025-12-16", "a6039be7cee829a9044a69ac0ebaf1c191217c97");
|
|
16
16
|
var gigaamCtc = huggingFace("sherpa-onnx-nemo-ctc-punct-giga-am-v3-russian-2025-12-16", "4fb5407ff028a69fec516cdf4c10fac9ddea7c16");
|
|
@@ -137,7 +137,7 @@ var speechModel = /* @__PURE__ */ __name((id) => {
|
|
|
137
137
|
return model;
|
|
138
138
|
}, "speechModel");
|
|
139
139
|
|
|
140
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
140
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/speech/install.js
|
|
141
141
|
import { createHash, randomUUID } from "node:crypto";
|
|
142
142
|
import { createReadStream, createWriteStream, mkdirSync, statSync } from "node:fs";
|
|
143
143
|
import { rename, rm } from "node:fs/promises";
|
|
@@ -175,11 +175,12 @@ var sizeOf = /* @__PURE__ */ __name((path) => {
|
|
|
175
175
|
}
|
|
176
176
|
}, "sizeOf");
|
|
177
177
|
var installedBytes = /* @__PURE__ */ __name((model) => model.files.reduce((sum, file) => sum + file.bytes, 0), "installedBytes");
|
|
178
|
-
var install = /* @__PURE__ */ __name(async (model, directory, { fetch: get = fetch, progress, verifyExisting } = {}) => {
|
|
178
|
+
var install = /* @__PURE__ */ __name(async (model, directory, { fetch: get = fetch, progress, bytes, verifyExisting } = {}) => {
|
|
179
179
|
mkdirSync(join(directory, model.id), { recursive: true, mode: 448 });
|
|
180
|
-
await installFiles(placed(model, directory), { fetch: get, progress, verifyExisting });
|
|
180
|
+
await installFiles(placed(model, directory), { fetch: get, progress, bytes, verifyExisting });
|
|
181
181
|
}, "install");
|
|
182
|
-
var installFiles = /* @__PURE__ */ __name(async (files, { fetch: get = fetch, progress,
|
|
182
|
+
var installFiles = /* @__PURE__ */ __name(async (files, { fetch: get = fetch, progress, bytes = /* @__PURE__ */ __name(() => {
|
|
183
|
+
}, "bytes"), verifyExisting } = {}) => {
|
|
183
184
|
if (verifyExisting)
|
|
184
185
|
for (const [file, path] of files) {
|
|
185
186
|
if (sizeOf(path) !== void 0) {
|
|
@@ -192,18 +193,24 @@ var installFiles = /* @__PURE__ */ __name(async (files, { fetch: get = fetch, pr
|
|
|
192
193
|
}
|
|
193
194
|
}
|
|
194
195
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
const total = files.reduce((sum, [file]) => sum + file.bytes, 0);
|
|
197
|
+
const missing = files.filter(([file, path]) => sizeOf(path) !== file.bytes);
|
|
198
|
+
let done = total - missing.reduce((sum, [file]) => sum + file.bytes, 0);
|
|
199
|
+
bytes(done, total);
|
|
200
|
+
for (const [file, path] of missing) {
|
|
198
201
|
mkdirSync(dirname(path), { recursive: true, mode: 448 });
|
|
199
202
|
progress?.(`downloading ${file.name} (${megabytes(file.bytes)})`);
|
|
200
|
-
|
|
203
|
+
const before = done;
|
|
204
|
+
await fetchVerified(file, path, get, (received) => {
|
|
205
|
+
done = before + received;
|
|
206
|
+
bytes(done, total);
|
|
207
|
+
});
|
|
201
208
|
}
|
|
202
209
|
}, "installFiles");
|
|
203
|
-
var fetchVerified = /* @__PURE__ */ __name(async (file, path, get) => {
|
|
210
|
+
var fetchVerified = /* @__PURE__ */ __name(async (file, path, get, received) => {
|
|
204
211
|
const stalled = watchdog(STALL_MS);
|
|
205
212
|
try {
|
|
206
|
-
await fetchInto(file, path, get, stalled);
|
|
213
|
+
await fetchInto(file, path, get, stalled, received);
|
|
207
214
|
} catch (error) {
|
|
208
215
|
if (stalled.signal.aborted) {
|
|
209
216
|
throw new CliError("timeout", `${file.name} stopped downloading for ${STALL_MS / 1e3} s \u2014 nothing was installed`);
|
|
@@ -213,7 +220,7 @@ var fetchVerified = /* @__PURE__ */ __name(async (file, path, get) => {
|
|
|
213
220
|
stalled.stop();
|
|
214
221
|
}
|
|
215
222
|
}, "fetchVerified");
|
|
216
|
-
var fetchInto = /* @__PURE__ */ __name(async (file, path, get, stalled) => {
|
|
223
|
+
var fetchInto = /* @__PURE__ */ __name(async (file, path, get, stalled, received) => {
|
|
217
224
|
const response = await get(file.url, { signal: stalled.signal });
|
|
218
225
|
if (!response.ok || !response.body) {
|
|
219
226
|
await response.body?.cancel();
|
|
@@ -231,6 +238,7 @@ var fetchInto = /* @__PURE__ */ __name(async (file, path, get, stalled) => {
|
|
|
231
238
|
return;
|
|
232
239
|
}
|
|
233
240
|
hash.update(chunk);
|
|
241
|
+
received(bytes);
|
|
234
242
|
done(null, chunk);
|
|
235
243
|
}
|
|
236
244
|
});
|
|
@@ -3,26 +3,26 @@ const require = __bundleRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
executableEnvironment,
|
|
5
5
|
executableOnPath
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ZMOUUOT2.js";
|
|
7
7
|
import {
|
|
8
8
|
require_cross_spawn
|
|
9
9
|
} from "./chunk-D72URWJE.js";
|
|
10
10
|
import {
|
|
11
11
|
loadConfigFile,
|
|
12
12
|
saveConfigFile
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-OD4U7GUY.js";
|
|
14
14
|
import {
|
|
15
15
|
number,
|
|
16
16
|
object,
|
|
17
17
|
optional,
|
|
18
18
|
string
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-FEZF3TII.js";
|
|
20
20
|
import {
|
|
21
21
|
__name,
|
|
22
22
|
__toESM
|
|
23
23
|
} from "./chunk-ZVVMGPBJ.js";
|
|
24
24
|
|
|
25
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
25
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/update/index.js
|
|
26
26
|
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
27
27
|
import { existsSync } from "node:fs";
|
|
28
28
|
var updateCommand = /* @__PURE__ */ __name((installer, packageName) => {
|
|
@@ -3,11 +3,11 @@ const require = __bundleRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
operations,
|
|
5
5
|
privateFiles
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HCNQT3QE.js";
|
|
7
7
|
import {
|
|
8
8
|
commandPathKey,
|
|
9
9
|
commandPermissions
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-EW7PKB4M.js";
|
|
11
11
|
import {
|
|
12
12
|
AI_ENTRIES,
|
|
13
13
|
checkConfigText,
|
|
@@ -15,23 +15,23 @@ import {
|
|
|
15
15
|
settingsFor,
|
|
16
16
|
usableProfileName,
|
|
17
17
|
withSettingDefaults
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-PEQA6LA5.js";
|
|
19
19
|
import {
|
|
20
20
|
LEVELS
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-VAYB52HF.js";
|
|
22
22
|
import {
|
|
23
23
|
MAX_TEXT_CHARS
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-UOXOLGNG.js";
|
|
25
25
|
import {
|
|
26
26
|
DRIVE_APP
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-4SIZEJ3M.js";
|
|
28
28
|
import {
|
|
29
29
|
BASE_CONSTANTS,
|
|
30
30
|
baseConstantsSchema,
|
|
31
31
|
loadConstants,
|
|
32
32
|
resolvePaths,
|
|
33
33
|
saveConfigFile
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-OD4U7GUY.js";
|
|
35
35
|
import {
|
|
36
36
|
array,
|
|
37
37
|
boolean,
|
|
@@ -54,15 +54,15 @@ import {
|
|
|
54
54
|
transform,
|
|
55
55
|
trim,
|
|
56
56
|
union
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-FEZF3TII.js";
|
|
58
58
|
import {
|
|
59
59
|
CliError
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-4OSSOWDM.js";
|
|
61
61
|
import {
|
|
62
62
|
__name
|
|
63
63
|
} from "./chunk-ZVVMGPBJ.js";
|
|
64
64
|
|
|
65
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
65
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/oauth/client-file.js
|
|
66
66
|
import { readFileSync } from "node:fs";
|
|
67
67
|
var readClientFile = /* @__PURE__ */ __name((location, options = {}) => {
|
|
68
68
|
if (!options.shipped && typeof location === "string") {
|
|
@@ -83,7 +83,7 @@ var readClientFile = /* @__PURE__ */ __name((location, options = {}) => {
|
|
|
83
83
|
}
|
|
84
84
|
}, "readClientFile");
|
|
85
85
|
|
|
86
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
86
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/constants/obscure.js
|
|
87
87
|
import { createDecipheriv } from "node:crypto";
|
|
88
88
|
var KEY = Buffer.from("d43012779aa2dded3e98092a3dbcf5d8980c564172f5ce0a5fd0574e5f740339", "hex");
|
|
89
89
|
var reveal = /* @__PURE__ */ __name((obscured) => {
|
|
@@ -92,7 +92,7 @@ var reveal = /* @__PURE__ */ __name((obscured) => {
|
|
|
92
92
|
return Buffer.concat([decipher.update(bytes.subarray(16)), decipher.final()]).toString("utf8");
|
|
93
93
|
}, "reveal");
|
|
94
94
|
|
|
95
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
95
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/constants/index.js
|
|
96
96
|
var CORE_CONSTANTS = new URL("../../constants.json", new URL("constants/index.js", import.meta.resolve("@wirecat/cli-core")).href);
|
|
97
97
|
var constantsSchema = object({
|
|
98
98
|
...baseConstantsSchema.entries,
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { createRequire as __bundleRequire } from "node:module";
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
organization,
|
|
5
|
-
project,
|
|
6
|
-
reminder
|
|
7
|
-
} from "./chunk-W767AUNR.js";
|
|
8
3
|
import {
|
|
9
4
|
MIGRATIONS,
|
|
10
5
|
SnapshotBudget,
|
|
@@ -32,25 +27,67 @@ import {
|
|
|
32
27
|
tagMemberIds,
|
|
33
28
|
thingOf,
|
|
34
29
|
write
|
|
35
|
-
} from "./chunk-
|
|
36
|
-
import {
|
|
37
|
-
queryFieldsOf
|
|
38
|
-
} from "./chunk-NZ2EIZLX.js";
|
|
30
|
+
} from "./chunk-U2BFYSQV.js";
|
|
39
31
|
import {
|
|
40
32
|
fold
|
|
41
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-YOJDGAPT.js";
|
|
42
34
|
import {
|
|
43
35
|
CliError
|
|
44
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-4OSSOWDM.js";
|
|
45
37
|
import {
|
|
46
38
|
__name
|
|
47
39
|
} from "./chunk-ZVVMGPBJ.js";
|
|
48
40
|
|
|
49
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
41
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/damage.js
|
|
42
|
+
var DERIVED = /* @__PURE__ */ new Set(["mentions", "involvements", "embeddings"]);
|
|
43
|
+
var named = /* @__PURE__ */ __name((tables) => tables.length <= 5 ? tables.join(", ") : `${tables.slice(0, 5).join(", ")} and ${tables.length - 5} more`, "named");
|
|
44
|
+
var isDerivedTable = /* @__PURE__ */ __name((table, searchIndexes) => DERIVED.has(table) || table.startsWith("vector_index_") || searchIndexes.some((index) => table === index || table.startsWith(`${index}_`)), "isDerivedTable");
|
|
45
|
+
var WIRECAT_UNITS = ["memo-*", "mail-*", "tg-*", "max-*", "wirecat-*"];
|
|
46
|
+
var explainDamage = /* @__PURE__ */ __name((health, command) => {
|
|
47
|
+
if (health.ok)
|
|
48
|
+
return null;
|
|
49
|
+
const indexNames = (health.searchIndexes ?? []).map((index) => index.name);
|
|
50
|
+
const badIndexes = (health.searchIndexes ?? []).filter((index) => !index.ok).map((index) => index.name);
|
|
51
|
+
const tables = (health.damagedTables ?? []).map((one) => one.table).filter((table) => table !== null);
|
|
52
|
+
const sources = tables.filter((table) => !isDerivedTable(table, indexNames));
|
|
53
|
+
const derived = [.../* @__PURE__ */ new Set([...tables.filter((table) => isDerivedTable(table, indexNames)), ...badIndexes])];
|
|
54
|
+
const unopened = health.error !== void 0;
|
|
55
|
+
const json = (health.invalidJson ?? []).map(({ table, column }) => `${table}.${column}`);
|
|
56
|
+
const what = unopened ? `the store file cannot be opened: ${health.error}` : health.checked === "quick" ? "the store file's header or schema is damaged" : `the store file is damaged: ${health.problems ?? 0} problems` + (sources.length ? ` in the data of ${named(sources)}` : "") + (derived.length ? `${sources.length ? ", and" : " in"} the search data of ${named(derived)}` : "") + (json.length ? `; values that are not valid JSON in ${named(json)}` : "");
|
|
57
|
+
const impact = [
|
|
58
|
+
...sources.length ? [`some rows of ${named(sources)} cannot be read; a recovery keeps every row it can read and names the rest`] : [],
|
|
59
|
+
...derived.length ? [`searches may miss results or fail; ${named(derived)} hold nothing that is not elsewhere, and are rebuilt`] : [],
|
|
60
|
+
...json.length ? [`a read of a row with a broken JSON value fails ("malformed JSON"); a recovery clears those values`] : [],
|
|
61
|
+
"reads that do not touch a damaged page work; a write that touches one fails until the store is recovered"
|
|
62
|
+
];
|
|
63
|
+
return {
|
|
64
|
+
what,
|
|
65
|
+
causes: [
|
|
66
|
+
"the computer lost power or crashed, or the disk filled up, while a tool was writing",
|
|
67
|
+
"the file was copied, restored or synced while a tool had it open, or it sits in a synced or network folder",
|
|
68
|
+
"a fault of the disk itself"
|
|
69
|
+
],
|
|
70
|
+
investigate: [
|
|
71
|
+
`journalctl --user ${WIRECAT_UNITS.map((unit) => `-u '${unit}'`).join(" ")} --since -14d | grep -i -e malformed -e corrupt -e 'disk full'`,
|
|
72
|
+
"journalctl -k --since -14d | grep -i -e 'I/O error' -e nvme -e ata",
|
|
73
|
+
`df -h ${health.path.replace(/\/[^/]*$/, "")}`,
|
|
74
|
+
...health.checked === "quick" ? [`${command} store recover`] : []
|
|
75
|
+
],
|
|
76
|
+
impact,
|
|
77
|
+
externalUnaffected: "only this computer's copy is damaged: Telegram, MAX, the mail servers and Google Drive keep their own data, so whatever is lost here can be fetched again by a sync",
|
|
78
|
+
steps: [
|
|
79
|
+
"stop every timer and server of the WireCat tools; `store recover run` lists the ones still running",
|
|
80
|
+
`${command} store recover run`,
|
|
81
|
+
"run the fetch commands it prints, then start the timers again"
|
|
82
|
+
]
|
|
83
|
+
};
|
|
84
|
+
}, "explainDamage");
|
|
85
|
+
|
|
86
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/document-transfer/index.js
|
|
50
87
|
import { realpathSync, statSync } from "node:fs";
|
|
51
88
|
import { resolve } from "node:path";
|
|
52
89
|
|
|
53
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
90
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/people.js
|
|
54
91
|
var planPeople = /* @__PURE__ */ __name((database, snapshot, mappings, bindings, conflicts) => {
|
|
55
92
|
const creatable = /* @__PURE__ */ new Set();
|
|
56
93
|
let people = 0, identities = 0;
|
|
@@ -113,11 +150,11 @@ var copyPeople = /* @__PURE__ */ __name((database, snapshot, mappings, now) => {
|
|
|
113
150
|
}
|
|
114
151
|
}, "copyPeople");
|
|
115
152
|
|
|
116
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
153
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/document-transfer/digest.js
|
|
117
154
|
import { createHash } from "node:crypto";
|
|
118
155
|
var digest = /* @__PURE__ */ __name((value) => createHash("sha256").update(JSON.stringify(value)).digest("hex"), "digest");
|
|
119
156
|
|
|
120
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
157
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/collection.js
|
|
121
158
|
var documentsKeyOf = /* @__PURE__ */ __name((collection) => {
|
|
122
159
|
const colon = collection.indexOf(":");
|
|
123
160
|
const provider = collection.slice(0, colon);
|
|
@@ -161,7 +198,7 @@ var currentCollection = /* @__PURE__ */ __name((row) => {
|
|
|
161
198
|
};
|
|
162
199
|
}, "currentCollection");
|
|
163
200
|
|
|
164
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
201
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/plan.js
|
|
165
202
|
var planTransfer = /* @__PURE__ */ __name((database, snapshot, sourceKey, bindings) => {
|
|
166
203
|
const mappings = /* @__PURE__ */ new Map();
|
|
167
204
|
const missing = /* @__PURE__ */ new Set(), conflicts = /* @__PURE__ */ new Set();
|
|
@@ -270,9 +307,9 @@ var planTransfer = /* @__PURE__ */ __name((database, snapshot, sourceKey, bindin
|
|
|
270
307
|
}
|
|
271
308
|
for (const alias of snapshot.aliases) {
|
|
272
309
|
const sourceTag = snapshot.taggings.find((tagging) => tagging.tag_id === alias.aliasable_id);
|
|
273
|
-
const
|
|
310
|
+
const named2 = canonicalTagNamed(database, String(alias.name));
|
|
274
311
|
const targetTag = sourceTag && canonicalTagNamed(database, String(sourceTag.tag_name));
|
|
275
|
-
if (
|
|
312
|
+
if (named2 && named2.id !== targetTag?.id)
|
|
276
313
|
conflicts.add(`destination alias conflicts with source tag ${String(alias.aliasable_id)}`);
|
|
277
314
|
if (targetTag && alias.display === 1) {
|
|
278
315
|
const displayed = database.prepare("SELECT name_folded FROM aliases WHERE aliasable_type='tag' AND aliasable_id=? AND account_id IS NULL AND display=1").get(targetTag.id);
|
|
@@ -328,7 +365,7 @@ var planTransfer = /* @__PURE__ */ __name((database, snapshot, sourceKey, bindin
|
|
|
328
365
|
};
|
|
329
366
|
}, "planTransfer");
|
|
330
367
|
|
|
331
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
368
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/snapshot.js
|
|
332
369
|
var TRANSFER_TABLES = { document: "documents", note: "notes", memory: "memories", fact: "facts" };
|
|
333
370
|
var MAX_ENTITIES = 1e3;
|
|
334
371
|
var MAX_AUXILIARY = 1e4;
|
|
@@ -490,7 +527,7 @@ var transferSnapshot = /* @__PURE__ */ __name((database, collection) => read(dat
|
|
|
490
527
|
};
|
|
491
528
|
}), "transferSnapshot");
|
|
492
529
|
|
|
493
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
530
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/apply.js
|
|
494
531
|
var providerHere = /* @__PURE__ */ __name(({ provider, name, settings }) => {
|
|
495
532
|
if (provider !== "folder" || String(name ?? "").startsWith("google-drive:"))
|
|
496
533
|
return provider ?? null;
|
|
@@ -662,7 +699,7 @@ var remapEntity = /* @__PURE__ */ __name((database, entity, id, mappings) => {
|
|
|
662
699
|
database.prepare(`UPDATE ${TRANSFER_TABLES[entity.kind]} SET ${columns.join(",")} WHERE id=?`).run(...values, id);
|
|
663
700
|
}, "remapEntity");
|
|
664
701
|
|
|
665
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
702
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/document-transfer/index.js
|
|
666
703
|
var locations = /* @__PURE__ */ __name((options) => {
|
|
667
704
|
for (const value of [options.source, options.destination, options.collection])
|
|
668
705
|
if (typeof value !== "string" || !value.trim())
|
|
@@ -758,42 +795,149 @@ var applyDocumentTransfer = /* @__PURE__ */ __name(async (options) => {
|
|
|
758
795
|
}
|
|
759
796
|
}, "applyDocumentTransfer");
|
|
760
797
|
|
|
761
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
798
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/health.js
|
|
799
|
+
import { existsSync, statSync as statSync2 } from "node:fs";
|
|
800
|
+
var JSON_COLUMNS = {
|
|
801
|
+
accounts: ["settings"],
|
|
802
|
+
account_identities: ["mail_signals"],
|
|
803
|
+
bot_updates: ["payload"],
|
|
804
|
+
documents: ["front_matter"],
|
|
805
|
+
emails: ["headers"],
|
|
806
|
+
meeting_participants: ["sessions"],
|
|
807
|
+
messages: ["mentions", "reply_to"],
|
|
808
|
+
proposed_actions: ["payload", "result"],
|
|
809
|
+
searches: ["params"],
|
|
810
|
+
tag_consolidations: ["source_member_ids", "survivor_member_ids"],
|
|
811
|
+
task_events: ["changes"]
|
|
769
812
|
};
|
|
770
|
-
var
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
813
|
+
var jsonColumns = /* @__PURE__ */ __name((database) => database.prepare(`SELECT m.name AS "table", c.name AS "column", c."notnull" AS required FROM sqlite_master m, pragma_table_info(m.name) c
|
|
814
|
+
WHERE m.type = 'table' AND m.sql NOT LIKE 'CREATE VIRTUAL%' ORDER BY 1, 2`).all().map((row) => ({ table: String(row.table), column: String(row.column), required: Number(row.required) === 1 })).filter(({ table, column }) => column === "metadata" || JSON_COLUMNS[table]?.includes(column)), "jsonColumns");
|
|
815
|
+
var invalidJson = /* @__PURE__ */ __name((database) => jsonColumns(database).map((one) => ({
|
|
816
|
+
...one,
|
|
817
|
+
rows: Number(database.prepare(`SELECT count(*) AS n FROM "${one.table}" WHERE "${one.column}" IS NOT NULL AND NOT json_valid("${one.column}")`).get()?.n)
|
|
818
|
+
})).filter(({ rows }) => rows > 0), "invalidJson");
|
|
819
|
+
var QUICK_CHECK_LIMIT = 1e4;
|
|
820
|
+
var QUICK_HEALTH_CHECKS = "the file header, its size against its page count, and the schema's own pages";
|
|
821
|
+
var FTS5 = /^\s*CREATE\s+VIRTUAL\s+TABLE\s+\S+\s+USING\s+fts5\s*\(/i;
|
|
822
|
+
var fts5Tables = /* @__PURE__ */ __name((database) => database.prepare("SELECT name, sql FROM sqlite_master WHERE type = 'table' AND sql LIKE 'CREATE VIRTUAL TABLE%' ORDER BY name").all().filter((row) => FTS5.test(String(row.sql))).map((row) => {
|
|
823
|
+
const sql = String(row.sql);
|
|
824
|
+
return { name: String(row.name), sql, external: /content\s*=\s*'[^']+'/i.test(sql) };
|
|
825
|
+
}), "fts5Tables");
|
|
826
|
+
var messageOf = /* @__PURE__ */ __name((error) => error instanceof Error ? error.message : String(error), "messageOf");
|
|
827
|
+
var bytesOf = /* @__PURE__ */ __name((path) => statSync2(path, { throwIfNoEntry: false })?.size ?? 0, "bytesOf");
|
|
828
|
+
var damagedTables = /* @__PURE__ */ __name((database, lines) => {
|
|
829
|
+
const roots = new Map(database.prepare("SELECT rootpage, tbl_name FROM sqlite_master WHERE rootpage > 0").all().map((row) => [Number(row.rootpage), String(row.tbl_name)]));
|
|
830
|
+
const owners = new Map(database.prepare("SELECT name, tbl_name FROM sqlite_master WHERE type = 'index'").all().map((row) => [String(row.name), String(row.tbl_name)]));
|
|
831
|
+
const virtual = database.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND sql LIKE 'CREATE VIRTUAL TABLE%'").all().map((row) => String(row.name));
|
|
832
|
+
const ownerOf = /* @__PURE__ */ __name((table) => table === null ? null : virtual.find((name) => table.startsWith(`${name}_`)) ?? table, "ownerOf");
|
|
833
|
+
const tables = /* @__PURE__ */ new Map();
|
|
834
|
+
for (const raw of lines) {
|
|
835
|
+
const line = raw.replace(/^\*\*\* in database \w+ \*\*\*\s*/, "");
|
|
836
|
+
const tree = /^Tree (\d+) /.exec(line);
|
|
837
|
+
const column = /value in (\w+)\.\w+/.exec(line) ?? /^table (\w+): /.exec(line);
|
|
838
|
+
const index = /index (\w+)/.exec(line)?.[1];
|
|
839
|
+
const table = ownerOf(tree ? roots.get(Number(tree[1])) ?? null : column ? column[1] ?? null : index ? owners.get(index) ?? null : null);
|
|
840
|
+
const known = tables.get(table);
|
|
841
|
+
if (known)
|
|
842
|
+
known.problems += 1;
|
|
843
|
+
else
|
|
844
|
+
tables.set(table, { table, problems: 1, sample: line.slice(0, 200) });
|
|
845
|
+
}
|
|
846
|
+
return [...tables.values()].sort((a, b) => b.problems - a.problems);
|
|
847
|
+
}, "damagedTables");
|
|
848
|
+
var searchIndexHealth = /* @__PURE__ */ __name((database) => fts5Tables(database).map(({ name }) => {
|
|
849
|
+
try {
|
|
850
|
+
database.exec("BEGIN");
|
|
851
|
+
try {
|
|
852
|
+
database.exec(`INSERT INTO "${name}" ("${name}", rank) VALUES ('integrity-check', 0)`);
|
|
853
|
+
} finally {
|
|
854
|
+
database.exec("ROLLBACK");
|
|
784
855
|
}
|
|
785
|
-
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
}
|
|
856
|
+
return { name, ok: true };
|
|
857
|
+
} catch (error) {
|
|
858
|
+
return { name, ok: false, error: messageOf(error) };
|
|
859
|
+
}
|
|
860
|
+
}), "searchIndexHealth");
|
|
861
|
+
var pragmaLines = /* @__PURE__ */ __name((database, sql) => database.prepare(sql).all().flatMap((row) => String(Object.values(row)[0]).split("\n")), "pragmaLines");
|
|
862
|
+
var checkLines = /* @__PURE__ */ __name((database) => {
|
|
863
|
+
try {
|
|
864
|
+
return pragmaLines(database, `PRAGMA quick_check(${QUICK_CHECK_LIMIT})`);
|
|
865
|
+
} catch {
|
|
866
|
+
const tables = database.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND rootpage > 0 ORDER BY name").all().map((row) => String(row.name));
|
|
867
|
+
return tables.flatMap((table) => {
|
|
868
|
+
try {
|
|
869
|
+
return pragmaLines(database, `PRAGMA quick_check("${table}")`).filter((line) => line !== "ok");
|
|
870
|
+
} catch (error) {
|
|
871
|
+
return [`table ${table}: ${messageOf(error)}`];
|
|
872
|
+
}
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
}, "checkLines");
|
|
876
|
+
var quickHealth = /* @__PURE__ */ __name((database, path) => {
|
|
877
|
+
const pragma = /* @__PURE__ */ __name((name) => Number(Object.values(database.prepare(`PRAGMA ${name}`).get() ?? {})[0] ?? 0), "pragma");
|
|
878
|
+
const file = {
|
|
879
|
+
bytes: bytesOf(path),
|
|
880
|
+
pages: pragma("page_count"),
|
|
881
|
+
pageSize: pragma("page_size"),
|
|
882
|
+
freePages: pragma("freelist_count")
|
|
883
|
+
};
|
|
884
|
+
const schema = database.prepare("PRAGMA quick_check('sqlite_schema')").all().map((row) => String(Object.values(row)[0]));
|
|
885
|
+
const walFrames = existsSync(`${path}-wal`) && bytesOf(`${path}-wal`) > 0;
|
|
886
|
+
const sized = walFrames || file.bytes === file.pages * file.pageSize;
|
|
887
|
+
const problems = [
|
|
888
|
+
...schema.length === 1 && schema[0] === "ok" ? [] : schema,
|
|
889
|
+
...sized ? [] : [`the file holds ${file.bytes} bytes, its header says ${file.pages * file.pageSize}`]
|
|
890
|
+
];
|
|
891
|
+
return { file, problems };
|
|
892
|
+
}, "quickHealth");
|
|
893
|
+
var storeHealth = /* @__PURE__ */ __name(async (path, { deep = false } = {}) => {
|
|
894
|
+
const started = Date.now();
|
|
895
|
+
const checked = deep ? "deep" : "quick";
|
|
896
|
+
const done = /* @__PURE__ */ __name((health) => ({
|
|
897
|
+
path,
|
|
898
|
+
checked,
|
|
899
|
+
...health,
|
|
900
|
+
ms: Date.now() - started
|
|
901
|
+
}), "done");
|
|
902
|
+
let database;
|
|
903
|
+
try {
|
|
904
|
+
database = (await openSqlite(path, { readOnly: !deep })).database;
|
|
905
|
+
} catch (error) {
|
|
906
|
+
return done({ ok: false, error: messageOf(error) });
|
|
907
|
+
}
|
|
908
|
+
try {
|
|
909
|
+
const { file, problems } = quickHealth(database, path);
|
|
910
|
+
if (!deep) {
|
|
911
|
+
return done({
|
|
912
|
+
ok: problems.length === 0,
|
|
913
|
+
file,
|
|
914
|
+
...problems.length ? {
|
|
915
|
+
problems: problems.length,
|
|
916
|
+
damagedTables: [{ table: null, problems: problems.length, sample: problems[0] }]
|
|
917
|
+
} : {}
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
database.exec("PRAGMA busy_timeout = 30000");
|
|
921
|
+
const lines = checkLines(database);
|
|
922
|
+
const pagesOk = lines.length === 1 && lines[0] === "ok";
|
|
923
|
+
const indexes = searchIndexHealth(database);
|
|
924
|
+
const json = pagesOk ? invalidJson(database) : [];
|
|
925
|
+
return done({
|
|
926
|
+
ok: pagesOk && problems.length === 0 && indexes.every((index) => index.ok) && json.length === 0,
|
|
927
|
+
file,
|
|
928
|
+
problems: pagesOk ? 0 : lines.length,
|
|
929
|
+
damagedTables: pagesOk ? [] : damagedTables(database, lines),
|
|
930
|
+
searchIndexes: indexes,
|
|
931
|
+
invalidJson: json
|
|
932
|
+
});
|
|
933
|
+
} catch (error) {
|
|
934
|
+
return done({ ok: false, error: messageOf(error) });
|
|
935
|
+
} finally {
|
|
936
|
+
database.close();
|
|
937
|
+
}
|
|
938
|
+
}, "storeHealth");
|
|
795
939
|
|
|
796
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
940
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/project-transfer/preview.js
|
|
797
941
|
var previewProjectAnnotationSnapshot = /* @__PURE__ */ __name(async (options) => {
|
|
798
942
|
if (!options || typeof options !== "object" || Array.isArray(options))
|
|
799
943
|
throw new CliError("validation_error", "project preview options are required");
|
|
@@ -815,7 +959,7 @@ var previewProjectAnnotationSnapshot = /* @__PURE__ */ __name(async (options) =>
|
|
|
815
959
|
}
|
|
816
960
|
}, "previewProjectAnnotationSnapshot");
|
|
817
961
|
|
|
818
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
962
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot.js
|
|
819
963
|
var snapshotProjectAnnotations = /* @__PURE__ */ __name(async (options) => {
|
|
820
964
|
if (!options || typeof options !== "object" || Array.isArray(options))
|
|
821
965
|
throw new CliError("validation_error", "snapshot options are required");
|
|
@@ -837,11 +981,13 @@ var snapshotProjectAnnotations = /* @__PURE__ */ __name(async (options) => {
|
|
|
837
981
|
}, "snapshotProjectAnnotations");
|
|
838
982
|
|
|
839
983
|
export {
|
|
984
|
+
explainDamage,
|
|
985
|
+
invalidJson,
|
|
986
|
+
QUICK_HEALTH_CHECKS,
|
|
987
|
+
fts5Tables,
|
|
988
|
+
storeHealth,
|
|
840
989
|
previewDocumentTransfer,
|
|
841
990
|
applyDocumentTransfer,
|
|
842
|
-
ORGANIZATIONS_QUERY,
|
|
843
|
-
PROJECTS_QUERY,
|
|
844
|
-
REMINDERS_QUERY,
|
|
845
991
|
previewProjectAnnotationSnapshot,
|
|
846
992
|
snapshotProjectAnnotations
|
|
847
993
|
};
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
commandPathOf,
|
|
8
8
|
findCommand,
|
|
9
9
|
outputOf
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-O7ALBI2I.js";
|
|
11
11
|
import {
|
|
12
12
|
Command,
|
|
13
13
|
Help,
|
|
@@ -18,18 +18,18 @@ import {
|
|
|
18
18
|
environmentOf,
|
|
19
19
|
metaOf,
|
|
20
20
|
takesProfile
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-PEQA6LA5.js";
|
|
22
22
|
import {
|
|
23
23
|
writes
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-FEZF3TII.js";
|
|
25
25
|
import {
|
|
26
26
|
CliError
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-4OSSOWDM.js";
|
|
28
28
|
import {
|
|
29
29
|
__name
|
|
30
30
|
} from "./chunk-ZVVMGPBJ.js";
|
|
31
31
|
|
|
32
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/cli/help/sections.js
|
|
33
33
|
var SECTIONS = {
|
|
34
34
|
read: "Read",
|
|
35
35
|
write: "Write",
|
|
@@ -94,7 +94,7 @@ var CORE_SECTIONS = {
|
|
|
94
94
|
upgrade: "setup"
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
97
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/cli/help/commands-text.js
|
|
98
98
|
var DESCRIPTION = 90;
|
|
99
99
|
var COLUMN = 52;
|
|
100
100
|
var short = /* @__PURE__ */ __name((text) => {
|
|
@@ -133,7 +133,7 @@ var commandsText = /* @__PURE__ */ __name((root, commands, scope) => {
|
|
|
133
133
|
`;
|
|
134
134
|
}, "commandsText");
|
|
135
135
|
|
|
136
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
136
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/cli/help/command-help.js
|
|
137
137
|
var ARGUMENT_KINDS = {
|
|
138
138
|
chat: "chat",
|
|
139
139
|
chats: "chat",
|
|
@@ -325,7 +325,7 @@ var installCommandHelp = /* @__PURE__ */ __name((program, { profile = true } = {
|
|
|
325
325
|
command.addHelpText("after", () => commandHelpText(command));
|
|
326
326
|
}, "installCommandHelp");
|
|
327
327
|
|
|
328
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
328
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/cli/help/first-screen.js
|
|
329
329
|
var WIRECAT_TOOLS = [
|
|
330
330
|
{
|
|
331
331
|
command: "tg",
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
__name
|
|
5
5
|
} from "./chunk-ZVVMGPBJ.js";
|
|
6
6
|
|
|
7
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.9_commander@15.0.0_esbuild@0.28.2_type_4b96f151b4ca40121094ad166c695991/node_modules/@wirecat/cli-core/dist/mcp/instructions.js
|
|
8
8
|
var instructions = /* @__PURE__ */ __name(({ command, name, profile, writes, skill }) => {
|
|
9
9
|
const all = typeof profile !== "string";
|
|
10
10
|
const offers = /* @__PURE__ */ __name((key) => all || writes.includes(key), "offers");
|