@wirecat/tg-cli 0.126.0 → 0.127.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/tg.js +2 -2
- package/dist/bundle/{adapter-BXU3AVB7.js → adapter-EZFS2UR6.js} +43 -43
- package/dist/bundle/{all-profiles-G5A6IROO.js → all-profiles-TNIUBQK6.js} +6 -6
- package/dist/bundle/{anthropic-SINVEVEM.js → anthropic-NGIS5LTL.js} +2 -2
- package/dist/bundle/{app-server-IHIQXPJF.js → app-server-RPU76G7D.js} +38 -38
- package/dist/bundle/{bot-api-LGAVVYRM.js → bot-api-QJ6U6BLG.js} +44 -44
- package/dist/bundle/{bot-history-5C35FGCD.js → bot-history-THULK2C6.js} +12 -12
- package/dist/bundle/{bun-2GK3YOP3.js → bun-QLSLLP27.js} +2 -2
- package/dist/bundle/{bun-sqlite-7DGADK3E.js → bun-sqlite-SH5245ZY.js} +3 -3
- package/dist/bundle/{chunk-4GR5YYGA.js → chunk-2R6ZSE3O.js} +2 -2
- package/dist/bundle/{chunk-F34EE5Y2.js → chunk-3CV5TBBR.js} +2 -2
- package/dist/bundle/{chunk-MP47TE77.js → chunk-3I3TGKVG.js} +3 -3
- package/dist/bundle/{chunk-JQ2RKLPU.js → chunk-3WI53AA4.js} +76 -76
- package/dist/bundle/{chunk-AYEQMXRE.js → chunk-45URY64S.js} +1 -1
- package/dist/bundle/{chunk-Y5DGB7GP.js → chunk-4CQ3PV3V.js} +7 -7
- package/dist/bundle/{chunk-N2JSMP4N.js → chunk-4FFKCC7Y.js} +12 -12
- package/dist/bundle/{chunk-G4RCT5RH.js → chunk-4MKRKW6V.js} +12 -12
- package/dist/bundle/{chunk-GI2ZUNOH.js → chunk-5AOFOJQA.js} +4 -4
- package/dist/bundle/{chunk-QOINWAQD.js → chunk-5FDYMMEQ.js} +2 -2
- package/dist/bundle/{chunk-P2GNIWGG.js → chunk-5KZKVKWU.js} +6 -6
- package/dist/bundle/{chunk-QMEPKUG3.js → chunk-5SN6KFPC.js} +50 -50
- package/dist/bundle/{chunk-QYLYMOXN.js → chunk-7GE6KMLB.js} +11 -11
- package/dist/bundle/{chunk-PJ6FZXUR.js → chunk-APSMQIA4.js} +2 -2
- package/dist/bundle/{chunk-HPFB4Y7P.js → chunk-BNM6KNUQ.js} +1 -1
- package/dist/bundle/{chunk-63DSHUNP.js → chunk-BWHVHPAQ.js} +5 -5
- package/dist/bundle/{chunk-XGBXRDJP.js → chunk-CXWAKV2O.js} +5 -5
- package/dist/bundle/{chunk-FYOHGIQP.js → chunk-DNNYE6PS.js} +13 -13
- package/dist/bundle/{chunk-QGLB4D7J.js → chunk-EGNQSWPH.js} +1 -1
- package/dist/bundle/{chunk-CK7DSGIK.js → chunk-ERUB3KU3.js} +322 -11
- package/dist/bundle/{chunk-OXB5P37M.js → chunk-FD44T7HC.js} +1 -1
- package/dist/bundle/{chunk-2LN6OJUB.js → chunk-FSDLSEZA.js} +1 -1
- package/dist/bundle/{chunk-SL4S5GFR.js → chunk-GHVRCLJI.js} +1 -1
- package/dist/bundle/{chunk-KSLZEXRF.js → chunk-H7GAFD4N.js} +1 -1
- package/dist/bundle/{chunk-JAKP5RWM.js → chunk-HPM47WO3.js} +1537 -923
- package/dist/bundle/{chunk-L5PYWQDA.js → chunk-IWJ5OLU6.js} +2 -2
- package/dist/bundle/{chunk-ACLUVZ4I.js → chunk-J6FHZXNS.js} +28 -28
- package/dist/bundle/{chunk-7UACPXDC.js → chunk-JF7D2Y4K.js} +941 -749
- package/dist/bundle/{chunk-W35POPPX.js → chunk-JFQZ6BWI.js} +16 -16
- package/dist/bundle/{chunk-K4DXGJK4.js → chunk-JWEKUAVZ.js} +10 -10
- package/dist/bundle/{chunk-AKUBJHE5.js → chunk-K4VO7S6Q.js} +1 -1
- package/dist/bundle/{chunk-GIY56MIB.js → chunk-LOG65WHO.js} +1 -1
- package/dist/bundle/{chunk-AA2NZAUT.js → chunk-MTU3UP5U.js} +1 -1
- package/dist/bundle/{chunk-G4VVBR6U.js → chunk-NBN5OYXH.js} +3 -3
- package/dist/bundle/{chunk-MA2XHO4O.js → chunk-P5NJECXX.js} +379 -294
- package/dist/bundle/{chunk-QCLMP635.js → chunk-QPVCFSVU.js} +5 -5
- package/dist/bundle/{chunk-GOGGRLS6.js → chunk-R52ZZZKZ.js} +13 -9
- package/dist/bundle/{chunk-RFDPU4NO.js → chunk-S3XUJPPL.js} +4 -4
- package/dist/bundle/{chunk-Y4724JRR.js → chunk-SN52ZGFN.js} +2 -2
- package/dist/bundle/{chunk-2F2UMQMB.js → chunk-TGKTIDYS.js} +153 -396
- package/dist/bundle/{chunk-AZ7DSHQO.js → chunk-UIQMBOXU.js} +1 -1
- package/dist/bundle/{chunk-UIFQEXVP.js → chunk-UW34Z7J3.js} +1 -1
- package/dist/bundle/{chunk-ZXCQF6XV.js → chunk-UY2TRFYN.js} +10 -10
- package/dist/bundle/{chunk-5GINYFD4.js → chunk-VMV5CMLH.js} +1 -1
- package/dist/bundle/{chunk-J2BUWK5U.js → chunk-X4ECHJNG.js} +2 -2
- package/dist/bundle/{chunk-5NLAGTWU.js → chunk-XUAVZ6YX.js} +7 -7
- package/dist/bundle/{chunk-W725T2V7.js → chunk-Y62I2T36.js} +1 -1
- package/dist/bundle/{chunk-NJ3FSKSU.js → chunk-Y65BQJOY.js} +2 -2
- package/dist/bundle/{chunk-W75SKUY4.js → chunk-Y7UA7HGL.js} +2 -2
- package/dist/bundle/{chunk-7FL2N6DM.js → chunk-YIPOWJPN.js} +1 -1
- package/dist/bundle/{chunk-DGGAYHLN.js → chunk-YZGIQY2R.js} +21 -21
- package/dist/bundle/{chunk-BSKYPHLB.js → chunk-ZIPUVOGT.js} +1 -1
- package/dist/bundle/{chunk-SXVB2CVR.js → chunk-ZSS3BH6Z.js} +2 -2
- package/dist/bundle/{command-contract-ZEYY3ZXK.js → command-contract-DY6Y4TES.js} +13 -13
- package/dist/bundle/{command-server-entry-UWY6PQIV.js → command-server-entry-UG2CLYXI.js} +20 -20
- package/dist/bundle/{decode-QGMFQ6XX.js → decode-3NEUZJ2N.js} +2 -2
- package/dist/bundle/{echarts-GHU3GEWV.js → echarts-CN6ZVAJZ.js} +2 -2
- package/dist/bundle/{embed-6DMEWQDO.js → embed-M4EHIKA5.js} +3 -3
- package/dist/bundle/{embedder-W2L7YZPW.js → embedder-K2XL2UB4.js} +6 -6
- package/dist/bundle/{entry-LPEXVFQC.js → entry-6M55YL2H.js} +6 -6
- package/dist/bundle/{first-run-3UJ6SJF5.js → first-run-TLJILIOF.js} +5 -5
- package/dist/bundle/{first-screen-VCSY5QH5.js → first-screen-WME7ILW2.js} +14 -14
- package/dist/bundle/{instructions-RUVAH2IS.js → instructions-QLC2AXAB.js} +1 -1
- package/dist/bundle/{node-RYSNHVBX.js → node-BAA3T4CH.js} +2 -2
- package/dist/bundle/{node-sqlite-J6ZL4LUY.js → node-sqlite-FNYVHQCO.js} +4 -4
- package/dist/bundle/{oauth-B2QNZNSC.js → oauth-32T5KL5E.js} +4 -4
- package/dist/bundle/{open-OMUP5P6V.js → open-4VQ6FUEI.js} +2 -2
- package/dist/bundle/{openai-BT4BP4VQ.js → openai-HDOKCN3Z.js} +12 -12
- package/dist/bundle/{process-HG3QDD54.js → process-GOUBIWKC.js} +1 -1
- package/dist/bundle/{program-P2VATMKJ.js → program-QFXJL2R5.js} +46 -46
- package/dist/bundle/{prompt-BTIHH3Z4.js → prompt-YYODWYFO.js} +2 -2
- package/dist/bundle/{recognize-CTSJXPIG.js → recognize-7ZULX5HL.js} +1 -1
- package/dist/bundle/{remote-2FIGCMKL.js → remote-TUG7M5Y5.js} +6 -6
- package/dist/bundle/{rerank-TI5SLEF4.js → rerank-D2EZWG66.js} +4 -4
- package/dist/bundle/{serve-IO3IM5C7.js → serve-MP3GA2XX.js} +6 -6
- package/dist/bundle/{server-WEPFFTYA.js → server-D277L3H3.js} +29 -29
- package/dist/bundle/server-GEP7QXGI.js +62 -0
- package/dist/bundle/{sqlite-runtime-CTEYXX7L.js → sqlite-runtime-XHZXEOLY.js} +3 -3
- package/dist/bundle/{state-GFHVDGHM.js → state-YI3W6HGO.js} +3 -3
- package/dist/bundle/{store-RCK6HT4F.js → store-C4RFPYPK.js} +9 -9
- package/dist/bundle/{store-Y5XC4LEM.js → store-CIZPJFWE.js} +15 -11
- package/dist/bundle/store-maintenance-command-JNDYWFD2.js +52 -0
- package/dist/bundle/tg.js +3 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/dist/bundle/server-RIGXUTKZ.js +0 -62
- package/dist/bundle/store-maintenance-command-XH6VMCDU.js +0 -52
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
servicesFor,
|
|
17
17
|
throughWrapper,
|
|
18
18
|
withFileLockAsync
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-P5NJECXX.js";
|
|
20
20
|
import {
|
|
21
21
|
servingProfiles
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-SN52ZGFN.js";
|
|
23
23
|
import {
|
|
24
24
|
chatReferenceOf,
|
|
25
25
|
ensureAccount,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
isId,
|
|
28
28
|
openStore,
|
|
29
29
|
pickPerson
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-HPM47WO3.js";
|
|
31
31
|
import {
|
|
32
32
|
CEILING_KEY,
|
|
33
33
|
WRITE_KEYS,
|
|
@@ -47,13 +47,13 @@ import {
|
|
|
47
47
|
rememberAccount,
|
|
48
48
|
rootOf2 as rootOf,
|
|
49
49
|
skipFlagFor
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-TGKTIDYS.js";
|
|
51
51
|
import {
|
|
52
52
|
providerErrorKey
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-5KZKVKWU.js";
|
|
54
54
|
import {
|
|
55
55
|
isCliFailure
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-APSMQIA4.js";
|
|
57
57
|
import {
|
|
58
58
|
resolvePaths
|
|
59
59
|
} from "./chunk-NM5GBJME.js";
|
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
__name
|
|
65
65
|
} from "./chunk-ZVVMGPBJ.js";
|
|
66
66
|
|
|
67
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
67
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/cli/messenger/ask.js
|
|
68
68
|
import { openSync } from "node:fs";
|
|
69
69
|
import { createInterface } from "node:readline";
|
|
70
70
|
import { ReadStream } from "node:tty";
|
|
@@ -119,7 +119,7 @@ var terminalAsker = /* @__PURE__ */ __name((command) => async (key, request) =>
|
|
|
119
119
|
throw new CliError("cancelled", `${key}: not done \u2014 the answer was no`);
|
|
120
120
|
}, "terminalAsker");
|
|
121
121
|
|
|
122
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
122
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/sends/pace.js
|
|
123
123
|
import { readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
124
124
|
import { join } from "node:path";
|
|
125
125
|
var DEFAULT_PACE = { perMinute: 60, burst: 20 };
|
|
@@ -214,7 +214,7 @@ var waitForTurn = /* @__PURE__ */ __name(async (pacer, options) => {
|
|
|
214
214
|
await (options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms))))(waitMs);
|
|
215
215
|
}, "waitForTurn");
|
|
216
216
|
|
|
217
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
217
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/cli/permission-keys.js
|
|
218
218
|
var pathOf = /* @__PURE__ */ __name((command) => {
|
|
219
219
|
const words = [];
|
|
220
220
|
for (let at = command; at?.parent; at = at.parent)
|
|
@@ -274,7 +274,7 @@ var refuseUnknownPermissionKeys = /* @__PURE__ */ __name((command, settings, too
|
|
|
274
274
|
throw new CliError("validation_error", `--permission ${key} names no command`, { permission: key });
|
|
275
275
|
}, "refuseUnknownPermissionKeys");
|
|
276
276
|
|
|
277
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
277
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/cli/messenger/flooded.js
|
|
278
278
|
var LONG_LIVED = /* @__PURE__ */ new Set(["self", "newSendId", "close", "formatMarkdown", "formatHtml", "storedChats"]);
|
|
279
279
|
var LISTENING = /* @__PURE__ */ new Set(["watch", "feed", "listen", "listenHistory"]);
|
|
280
280
|
var BLOCKING = /* @__PURE__ */ new Set(["frozen", "limited", "banned"]);
|
|
@@ -371,7 +371,7 @@ var flooded = /* @__PURE__ */ __name((messenger, memory, { name, warn, pacer })
|
|
|
371
371
|
});
|
|
372
372
|
}, "flooded");
|
|
373
373
|
|
|
374
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
374
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/cli/messenger/observed.js
|
|
375
375
|
var observed = /* @__PURE__ */ __name((messenger, events) => {
|
|
376
376
|
const timed = /* @__PURE__ */ __name(async (operation, named, work, after) => {
|
|
377
377
|
const write = currentOperation();
|
|
@@ -470,7 +470,7 @@ var byPart = /* @__PURE__ */ __name((batch, counts) => {
|
|
|
470
470
|
counts[part] = (counts[part] ?? 0) + items.length;
|
|
471
471
|
}, "byPart");
|
|
472
472
|
|
|
473
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
473
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/cli/messenger/stored.js
|
|
474
474
|
var REKEY_PACING = { lockMs: 50, pauseMs: 25 };
|
|
475
475
|
var stored = /* @__PURE__ */ __name((messenger, { account, store, warn, events, pending, announcing, deletedWithoutChat, profile, rekeyed, rekeyPacing = REKEY_PACING, closing, namesFromStore, recipientIds, countsUnread = false, historyLimits, command = "cli" }) => {
|
|
476
476
|
let warned = false;
|
|
@@ -1046,7 +1046,7 @@ var keep = /* @__PURE__ */ __name(async (store, account, event, seenAt, among, c
|
|
|
1046
1046
|
}
|
|
1047
1047
|
}, "keep");
|
|
1048
1048
|
|
|
1049
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1049
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/cli/messenger/context.js
|
|
1050
1050
|
var lazyStore = /* @__PURE__ */ __name((env, command, version) => {
|
|
1051
1051
|
let opened;
|
|
1052
1052
|
return {
|
|
@@ -10,7 +10,7 @@ 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.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/store/vector-extension.js
|
|
14
14
|
import { readFileSync } from "node:fs";
|
|
15
15
|
var musl = /* @__PURE__ */ __name(() => {
|
|
16
16
|
if (process.platform !== "linux")
|
|
@@ -2,9 +2,10 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
storePath
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-Y62I2T36.js";
|
|
6
6
|
import {
|
|
7
|
-
resolvePaths
|
|
7
|
+
resolvePaths,
|
|
8
|
+
writeSecurely
|
|
8
9
|
} from "./chunk-NM5GBJME.js";
|
|
9
10
|
import {
|
|
10
11
|
CliError,
|
|
@@ -14,11 +15,295 @@ import {
|
|
|
14
15
|
__name
|
|
15
16
|
} from "./chunk-ZVVMGPBJ.js";
|
|
16
17
|
|
|
17
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18
|
-
import { mkdirSync, readFileSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
18
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/store/shared-config.js
|
|
19
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
19
20
|
import { dirname, join, resolve } from "node:path";
|
|
20
21
|
|
|
21
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/domain/config-repair.js
|
|
23
|
+
var REPAIR_WORDS = {
|
|
24
|
+
byte_order_mark: "an invisible byte-order mark at the start",
|
|
25
|
+
comment: "a comment, which JSON does not allow",
|
|
26
|
+
trailing_comma: "a comma before a closing bracket",
|
|
27
|
+
missing_comma: "a missing comma",
|
|
28
|
+
unquoted_key: "a key without double quotes",
|
|
29
|
+
single_quotes: "text in single quotes",
|
|
30
|
+
missing_closer: "the file stops before its closing brackets \u2014 whatever followed this line was already lost"
|
|
31
|
+
};
|
|
32
|
+
var GiveUp = class {
|
|
33
|
+
static {
|
|
34
|
+
__name(this, "GiveUp");
|
|
35
|
+
}
|
|
36
|
+
at;
|
|
37
|
+
why;
|
|
38
|
+
constructor(at, why) {
|
|
39
|
+
this.at = at;
|
|
40
|
+
this.why = why;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var NUMBER = /^-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?/;
|
|
44
|
+
var LITERAL = /^(true|false|null)/;
|
|
45
|
+
var KEY = /^[A-Za-z_$][\w$.-]*/;
|
|
46
|
+
var ENDS_VALUE = /^[\s,\]}/]?$/;
|
|
47
|
+
var repairConfigText = /* @__PURE__ */ __name((text) => {
|
|
48
|
+
try {
|
|
49
|
+
JSON.parse(text);
|
|
50
|
+
return { state: "valid" };
|
|
51
|
+
} catch {
|
|
52
|
+
}
|
|
53
|
+
const fixes = [];
|
|
54
|
+
const lineAt = /* @__PURE__ */ __name((offset) => text.slice(0, offset).split("\n").length, "lineAt");
|
|
55
|
+
const fix = /* @__PURE__ */ __name((kind, offset) => fixes.push({ kind, line: lineAt(offset) }), "fix");
|
|
56
|
+
const giveUp = /* @__PURE__ */ __name((why, offset = at) => {
|
|
57
|
+
throw new GiveUp(offset, why);
|
|
58
|
+
}, "giveUp");
|
|
59
|
+
let at = 0;
|
|
60
|
+
let truncated = false;
|
|
61
|
+
let last = "open";
|
|
62
|
+
let lastEnd = 0;
|
|
63
|
+
const previous = /* @__PURE__ */ __name(() => last, "previous");
|
|
64
|
+
const skip = /* @__PURE__ */ __name(() => {
|
|
65
|
+
for (; ; ) {
|
|
66
|
+
while (/\s/.test(text[at] ?? ""))
|
|
67
|
+
at++;
|
|
68
|
+
if (text.startsWith("//", at)) {
|
|
69
|
+
fix("comment", at);
|
|
70
|
+
while (at < text.length && text[at] !== "\n")
|
|
71
|
+
at++;
|
|
72
|
+
} else if (text.startsWith("/*", at)) {
|
|
73
|
+
const end = text.indexOf("*/", at + 2);
|
|
74
|
+
if (end < 0)
|
|
75
|
+
giveUp("a /* comment is never closed");
|
|
76
|
+
fix("comment", at);
|
|
77
|
+
at = end + 2;
|
|
78
|
+
} else
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
}, "skip");
|
|
82
|
+
const string = /* @__PURE__ */ __name(() => {
|
|
83
|
+
const quote = text[at];
|
|
84
|
+
const start = at;
|
|
85
|
+
if (quote === "'")
|
|
86
|
+
fix("single_quotes", at);
|
|
87
|
+
at++;
|
|
88
|
+
let body = "";
|
|
89
|
+
for (; ; ) {
|
|
90
|
+
if (at >= text.length)
|
|
91
|
+
giveUp("the file stops inside a quoted text", start);
|
|
92
|
+
const char = text[at];
|
|
93
|
+
if (char === quote)
|
|
94
|
+
break;
|
|
95
|
+
if (text.charCodeAt(at) < 32)
|
|
96
|
+
giveUp("a line break inside a quoted text");
|
|
97
|
+
if (char === "\\") {
|
|
98
|
+
const next = text[at + 1] ?? "";
|
|
99
|
+
if (quote === "'" && next === "'")
|
|
100
|
+
body += "'";
|
|
101
|
+
else if (/^["\\/bfnrt]$/.test(next))
|
|
102
|
+
body += `\\${next}`;
|
|
103
|
+
else if (next === "u" && /^[0-9a-fA-F]{4}$/.test(text.slice(at + 2, at + 6))) {
|
|
104
|
+
body += text.slice(at, at + 6);
|
|
105
|
+
at += 4;
|
|
106
|
+
} else
|
|
107
|
+
giveUp("an escape JSON has no meaning for");
|
|
108
|
+
at += 2;
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
body += char === '"' ? '\\"' : char;
|
|
112
|
+
at++;
|
|
113
|
+
}
|
|
114
|
+
at++;
|
|
115
|
+
return JSON.parse(`"${body}"`);
|
|
116
|
+
}, "string");
|
|
117
|
+
const key = /* @__PURE__ */ __name(() => {
|
|
118
|
+
const char = text[at] ?? "";
|
|
119
|
+
if (char === '"' || char === "'")
|
|
120
|
+
return string();
|
|
121
|
+
const word = KEY.exec(text.slice(at))?.[0];
|
|
122
|
+
if (!word)
|
|
123
|
+
return giveUp("something other than a key where a key should be");
|
|
124
|
+
fix("unquoted_key", at);
|
|
125
|
+
at += word.length;
|
|
126
|
+
return word;
|
|
127
|
+
}, "key");
|
|
128
|
+
const scalar = /* @__PURE__ */ __name(() => {
|
|
129
|
+
const char = text[at] ?? "";
|
|
130
|
+
if (char === '"' || char === "'")
|
|
131
|
+
return { json: JSON.stringify(string()) };
|
|
132
|
+
const word = (NUMBER.exec(text.slice(at)) ?? LITERAL.exec(text.slice(at)))?.[0];
|
|
133
|
+
if (!word || !ENDS_VALUE.test(text[at + word.length] ?? ""))
|
|
134
|
+
return giveUp("a value that is not JSON \u2014 text needs quotes, and only true, false and null go without");
|
|
135
|
+
if (at + word.length === text.length && NUMBER.test(word))
|
|
136
|
+
giveUp("the file stops inside a number");
|
|
137
|
+
at += word.length;
|
|
138
|
+
return { json: word };
|
|
139
|
+
}, "scalar");
|
|
140
|
+
const members = /* @__PURE__ */ __name((close, one) => {
|
|
141
|
+
const out = [];
|
|
142
|
+
at++;
|
|
143
|
+
last = "open";
|
|
144
|
+
let comma = -1;
|
|
145
|
+
for (; ; ) {
|
|
146
|
+
skip();
|
|
147
|
+
if (truncated)
|
|
148
|
+
return out;
|
|
149
|
+
if (at >= text.length) {
|
|
150
|
+
if (previous() === "close")
|
|
151
|
+
giveUp("the file stops after a closing bracket, so which brackets are missing has two readings");
|
|
152
|
+
if (previous() === "comma")
|
|
153
|
+
fix("trailing_comma", comma);
|
|
154
|
+
fix("missing_closer", text.length);
|
|
155
|
+
truncated = true;
|
|
156
|
+
return out;
|
|
157
|
+
}
|
|
158
|
+
const char = text[at];
|
|
159
|
+
if (char === close) {
|
|
160
|
+
if (previous() === "comma")
|
|
161
|
+
fix("trailing_comma", comma);
|
|
162
|
+
at++;
|
|
163
|
+
last = "close";
|
|
164
|
+
return out;
|
|
165
|
+
}
|
|
166
|
+
if (char === "}" || char === "]")
|
|
167
|
+
giveUp(`a ${char} where ${close} should close`);
|
|
168
|
+
if (char === ",") {
|
|
169
|
+
if (previous() !== "value" && previous() !== "close")
|
|
170
|
+
giveUp("a comma with nothing before it");
|
|
171
|
+
comma = at;
|
|
172
|
+
at++;
|
|
173
|
+
last = "comma";
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
if (previous() === "value" || previous() === "close") {
|
|
177
|
+
if (lineAt(at) === lineAt(lastEnd))
|
|
178
|
+
giveUp("two entries on one line with no comma between them");
|
|
179
|
+
fix("missing_comma", lastEnd);
|
|
180
|
+
}
|
|
181
|
+
out.push(one());
|
|
182
|
+
}
|
|
183
|
+
}, "members");
|
|
184
|
+
const value = /* @__PURE__ */ __name(() => {
|
|
185
|
+
const char = text[at] ?? "";
|
|
186
|
+
let node;
|
|
187
|
+
if (char === "{") {
|
|
188
|
+
const seen = /* @__PURE__ */ new Set();
|
|
189
|
+
node = {
|
|
190
|
+
object: members("}", () => {
|
|
191
|
+
const start = at;
|
|
192
|
+
const name = key();
|
|
193
|
+
if (seen.has(name))
|
|
194
|
+
giveUp("a key appears twice in one object", start);
|
|
195
|
+
seen.add(name);
|
|
196
|
+
skip();
|
|
197
|
+
if (at >= text.length)
|
|
198
|
+
giveUp("the file stops after a key, before its value");
|
|
199
|
+
if (text[at] !== ":")
|
|
200
|
+
giveUp("a key with no colon after it");
|
|
201
|
+
at++;
|
|
202
|
+
skip();
|
|
203
|
+
if (at >= text.length)
|
|
204
|
+
giveUp("the file stops after a key, before its value");
|
|
205
|
+
return [name, value()];
|
|
206
|
+
})
|
|
207
|
+
};
|
|
208
|
+
} else if (char === "[") {
|
|
209
|
+
node = {
|
|
210
|
+
array: members("]", () => {
|
|
211
|
+
return value();
|
|
212
|
+
})
|
|
213
|
+
};
|
|
214
|
+
} else
|
|
215
|
+
node = scalar();
|
|
216
|
+
if (!truncated) {
|
|
217
|
+
last = "json" in node ? "value" : "close";
|
|
218
|
+
lastEnd = at;
|
|
219
|
+
}
|
|
220
|
+
return node;
|
|
221
|
+
}, "value");
|
|
222
|
+
try {
|
|
223
|
+
if (text.includes("\0") || text.includes(String.fromCharCode(65533)))
|
|
224
|
+
giveUp("the file is not text", 0);
|
|
225
|
+
if (text.charCodeAt(0) === 65279) {
|
|
226
|
+
fix("byte_order_mark", 0);
|
|
227
|
+
at = 1;
|
|
228
|
+
}
|
|
229
|
+
skip();
|
|
230
|
+
if (text[at] !== "{")
|
|
231
|
+
giveUp(at >= text.length ? "the file is empty" : "the file does not start with {");
|
|
232
|
+
const root = value();
|
|
233
|
+
skip();
|
|
234
|
+
if (at < text.length)
|
|
235
|
+
giveUp("more text after the closing }");
|
|
236
|
+
const repaired = `${serialise(root, "")}
|
|
237
|
+
`;
|
|
238
|
+
JSON.parse(repaired);
|
|
239
|
+
return { state: "repaired", text: repaired, fixes };
|
|
240
|
+
} catch (error) {
|
|
241
|
+
if (!(error instanceof GiveUp))
|
|
242
|
+
throw error;
|
|
243
|
+
const before = text.slice(0, error.at).split("\n");
|
|
244
|
+
return {
|
|
245
|
+
state: "refused",
|
|
246
|
+
line: before.length,
|
|
247
|
+
column: (before.at(-1)?.length ?? 0) + 1,
|
|
248
|
+
why: error.why
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
}, "repairConfigText");
|
|
252
|
+
var serialise = /* @__PURE__ */ __name((node, indent) => {
|
|
253
|
+
if ("json" in node)
|
|
254
|
+
return node.json;
|
|
255
|
+
const inner = `${indent} `;
|
|
256
|
+
const parts = "object" in node ? node.object.map(([name, item]) => `${inner}${JSON.stringify(name)}: ${serialise(item, inner)}`) : node.array.map((item) => `${inner}${serialise(item, inner)}`);
|
|
257
|
+
const [open, close] = "object" in node ? ["{", "}"] : ["[", "]"];
|
|
258
|
+
return parts.length === 0 ? `${open}${close}` : `${open}
|
|
259
|
+
${parts.join(",\n")}
|
|
260
|
+
${indent}${close}`;
|
|
261
|
+
}, "serialise");
|
|
262
|
+
var SAFE_REPAIRS = /* @__PURE__ */ new Set([
|
|
263
|
+
"byte_order_mark",
|
|
264
|
+
"comment",
|
|
265
|
+
"trailing_comma",
|
|
266
|
+
"missing_comma"
|
|
267
|
+
]);
|
|
268
|
+
var FIX_FOR = {
|
|
269
|
+
unquoted_key: /* @__PURE__ */ __name((line) => `put the key on line ${line} in double quotes`, "unquoted_key"),
|
|
270
|
+
single_quotes: /* @__PURE__ */ __name((line) => `use double quotes for the text on line ${line}`, "single_quotes"),
|
|
271
|
+
missing_closer: /* @__PURE__ */ __name((line) => `add the closing } or ] the file lacks after line ${line}, and check that nothing after it was lost`, "missing_closer")
|
|
272
|
+
};
|
|
273
|
+
var FIX_FOR_REFUSAL = [
|
|
274
|
+
[/no comma between/, (line, before) => `add a comma after ${before} on line ${line}`],
|
|
275
|
+
[/no colon after/, (line) => `add a colon after the key on line ${line}`],
|
|
276
|
+
[/comma with nothing before/, (line) => `remove the extra comma on line ${line}`],
|
|
277
|
+
[/inside a quoted text/, (line) => `close the quotes on line ${line}`],
|
|
278
|
+
[/value that is not JSON/, (line) => `put the value on line ${line} in double quotes`],
|
|
279
|
+
[/key appears twice/, (line) => `keep one of the two keys named on line ${line}; the file holds both`]
|
|
280
|
+
];
|
|
281
|
+
var shown = /* @__PURE__ */ __name((line) => line.trim().replace(/("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|[^\s"',:{}[\]]+)(\s*:)?/g, (token, _value, key) => key || /^(true|false|null)$/.test(token) ? token : '"\u2026"'), "shown");
|
|
282
|
+
var explainBrokenJson = /* @__PURE__ */ __name((text, result) => {
|
|
283
|
+
const lines = text.replace(/^\uFEFF/u, "").split(/\r?\n/);
|
|
284
|
+
const around = /* @__PURE__ */ __name((line2) => {
|
|
285
|
+
const near = lines[line2 - 1]?.trim() ? lines[line2 - 1] : lines[line2 - 2];
|
|
286
|
+
return near ? ` \u2014 near \`${shown(near)}\`` : "";
|
|
287
|
+
}, "around");
|
|
288
|
+
if (result.state === "repaired") {
|
|
289
|
+
const asked = result.fixes.find((one) => !SAFE_REPAIRS.has(one.kind)) ?? result.fixes[0];
|
|
290
|
+
if (!asked)
|
|
291
|
+
return "it is not valid JSON";
|
|
292
|
+
const fix2 = FIX_FOR[asked.kind]?.(asked.line);
|
|
293
|
+
return `line ${asked.line} has ${REPAIR_WORDS[asked.kind]}${around(asked.line)}${fix2 ? `; likely fix: ${fix2}` : ""}`;
|
|
294
|
+
}
|
|
295
|
+
if (result.state === "valid")
|
|
296
|
+
return "it is valid JSON";
|
|
297
|
+
const { line, why } = result;
|
|
298
|
+
const column = line === 1 && text.charCodeAt(0) === 65279 ? result.column - 1 : result.column;
|
|
299
|
+
const head = (lines[line - 1] ?? "").slice(0, column - 1);
|
|
300
|
+
const entry = head.slice(Math.max(head.lastIndexOf(","), head.lastIndexOf("{"), head.lastIndexOf("[")) + 1);
|
|
301
|
+
const before = shown(entry) || shown(lines[line - 2] ?? "");
|
|
302
|
+
const fix = FIX_FOR_REFUSAL.find(([pattern]) => pattern.test(why))?.[1](line, `\`${before}\``);
|
|
303
|
+
return `line ${line}, column ${column}: ${why}${around(line)}; likely fix: ${fix ?? "correct that part by hand"}`;
|
|
304
|
+
}, "explainBrokenJson");
|
|
305
|
+
|
|
306
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/domain/task-categories.js
|
|
22
307
|
var DEFAULT_TASK_CATEGORIES = [
|
|
23
308
|
{
|
|
24
309
|
name: "taxes",
|
|
@@ -773,7 +1058,7 @@ var storedTaskCategories = /* @__PURE__ */ __name((json) => {
|
|
|
773
1058
|
}
|
|
774
1059
|
}, "storedTaskCategories");
|
|
775
1060
|
|
|
776
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1061
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/store/shared-config.js
|
|
777
1062
|
var SECTION = "task_categories";
|
|
778
1063
|
var sharedConfigPath = /* @__PURE__ */ __name((store, env = process.env) => {
|
|
779
1064
|
const paths = resolvePaths({ appName: "WireCat", prefix: "WIRECAT", env });
|
|
@@ -781,10 +1066,33 @@ var sharedConfigPath = /* @__PURE__ */ __name((store, env = process.env) => {
|
|
|
781
1066
|
return join(paths.config, "config.json");
|
|
782
1067
|
return resolve(store) === resolve(storePath({ ...env, MESSAGING_STORE: void 0 })) ? join(paths.config, "config.json") : join(dirname(store), "config.json");
|
|
783
1068
|
}, "sharedConfigPath");
|
|
1069
|
+
var backupPathFor = /* @__PURE__ */ __name((file) => {
|
|
1070
|
+
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
1071
|
+
let path = `${file}.bak-${stamp}`;
|
|
1072
|
+
for (let n = 2; existsSync(path); n++)
|
|
1073
|
+
path = `${file}.bak-${stamp}-${n}`;
|
|
1074
|
+
return path;
|
|
1075
|
+
}, "backupPathFor");
|
|
1076
|
+
var mended = /* @__PURE__ */ __name((path, bytes) => {
|
|
1077
|
+
const text = bytes.toString("utf8");
|
|
1078
|
+
const result = repairConfigText(text);
|
|
1079
|
+
if (result.state === "repaired" && result.fixes.every((one) => SAFE_REPAIRS.has(one.kind))) {
|
|
1080
|
+
try {
|
|
1081
|
+
writeSecurely(backupPathFor(path), bytes, statSync(path).mode & 511);
|
|
1082
|
+
writeSecurely(path, result.text, 384);
|
|
1083
|
+
} catch {
|
|
1084
|
+
}
|
|
1085
|
+
return JSON.parse(result.text);
|
|
1086
|
+
}
|
|
1087
|
+
throw new CliError("configuration_error", `${path} is not valid JSON, ${explainBrokenJson(text, result)}`, {
|
|
1088
|
+
reason: "config.invalid_json",
|
|
1089
|
+
file: path
|
|
1090
|
+
});
|
|
1091
|
+
}, "mended");
|
|
784
1092
|
var readJson = /* @__PURE__ */ __name((path) => {
|
|
785
|
-
let
|
|
1093
|
+
let bytes;
|
|
786
1094
|
try {
|
|
787
|
-
|
|
1095
|
+
bytes = readFileSync(path);
|
|
788
1096
|
} catch (error) {
|
|
789
1097
|
if (error.code === "ENOENT")
|
|
790
1098
|
return void 0;
|
|
@@ -792,9 +1100,9 @@ var readJson = /* @__PURE__ */ __name((path) => {
|
|
|
792
1100
|
}
|
|
793
1101
|
let parsed;
|
|
794
1102
|
try {
|
|
795
|
-
parsed = JSON.parse(
|
|
796
|
-
} catch
|
|
797
|
-
|
|
1103
|
+
parsed = JSON.parse(bytes.toString("utf8"));
|
|
1104
|
+
} catch {
|
|
1105
|
+
parsed = mended(path, bytes);
|
|
798
1106
|
}
|
|
799
1107
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
|
|
800
1108
|
throw new CliError("configuration_error", `${path} must hold a JSON object`);
|
|
@@ -869,6 +1177,8 @@ var taskCategoriesReader = /* @__PURE__ */ __name((path) => {
|
|
|
869
1177
|
}, "taskCategoriesReader");
|
|
870
1178
|
|
|
871
1179
|
export {
|
|
1180
|
+
REPAIR_WORDS,
|
|
1181
|
+
repairConfigText,
|
|
872
1182
|
DEFAULT_TASK_CATEGORIES,
|
|
873
1183
|
FALLBACK_CATEGORY,
|
|
874
1184
|
unlistedNote,
|
|
@@ -876,6 +1186,7 @@ export {
|
|
|
876
1186
|
taskCategoryValue,
|
|
877
1187
|
storedTaskCategories,
|
|
878
1188
|
sharedConfigPath,
|
|
1189
|
+
backupPathFor,
|
|
879
1190
|
readTaskCategoryEdits,
|
|
880
1191
|
applyTaskCategoryEdits,
|
|
881
1192
|
editsFrom,
|
|
@@ -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.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/background/processes.js
|
|
8
8
|
import { execFileSync } from "node:child_process";
|
|
9
9
|
import { readdirSync, readFileSync, readlinkSync } from "node:fs";
|
|
10
10
|
var alive = /* @__PURE__ */ __name((pid) => {
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
__name
|
|
8
8
|
} from "./chunk-ZVVMGPBJ.js";
|
|
9
9
|
|
|
10
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/cli/input-policy.js
|
|
11
11
|
var MAX_BUFFERED_INPUT = 16 * 1024 * 1024;
|
|
12
12
|
var MAX_SECRET_INPUT = 64 * 1024;
|
|
13
13
|
var policies = /* @__PURE__ */ new WeakMap();
|
|
@@ -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.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/cli/stdin-field.js
|
|
8
8
|
var fields = /* @__PURE__ */ new WeakMap();
|
|
9
9
|
var readsStdin = /* @__PURE__ */ __name((command, field) => {
|
|
10
10
|
fields.set(command, field);
|
|
@@ -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.659.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._7ae9f69690019eb17dc9f8442c19cb73/node_modules/@wirecat/cli-core/dist/http/listen.js
|
|
8
8
|
import { createServer } from "node:http";
|
|
9
9
|
import { Readable } from "node:stream";
|
|
10
10
|
var MAX_BODY = 4 * 1024 * 1024;
|