@wirecat/tg-cli 0.123.0 → 0.125.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 +54 -5
- package/dist/bin/tg.js +2 -2
- package/dist/bundle/{adapter-GAOG65O2.js → adapter-H2LTOLOA.js} +54 -53
- package/dist/bundle/{all-profiles-HLE6PHNI.js → all-profiles-75HGEFL7.js} +10 -10
- package/dist/bundle/{anthropic-FZC4BS7T.js → anthropic-N54MKE4C.js} +17 -10
- package/dist/bundle/{app-server-SHZNMV27.js → app-server-3N5INKKI.js} +62 -52
- package/dist/bundle/{bot-api-LRS2KMDE.js → bot-api-V65KTEAH.js} +53 -52
- package/dist/bundle/{bot-history-IJ7ZZKW5.js → bot-history-TT2EAHEE.js} +18 -18
- package/dist/bundle/{bun-FACL53HM.js → bun-LN4J7PA7.js} +2 -2
- package/dist/bundle/{bun-sqlite-B2MD7RTL.js → bun-sqlite-6PDBFBUI.js} +6 -6
- package/dist/bundle/{chunk-BGUYYKS3.js → chunk-37SZHAEA.js} +343 -112
- package/dist/bundle/{chunk-UB6J5HRW.js → chunk-3GILMKQ2.js} +3 -3
- package/dist/bundle/{chunk-WSLTW6MI.js → chunk-4KIOWSDL.js} +3 -3
- package/dist/bundle/{chunk-VVRWH5VH.js → chunk-4TCBRKWQ.js} +14 -9
- package/dist/bundle/{chunk-MFN5MSIL.js → chunk-6HLB73UN.js} +3 -3
- package/dist/bundle/{chunk-DEMGDKCX.js → chunk-6Y6SSZ34.js} +2406 -2371
- package/dist/bundle/{chunk-Z5HHBTS5.js → chunk-77Z3OGAT.js} +23 -4
- package/dist/bundle/{chunk-VUBZFMGP.js → chunk-7KCBPAQS.js} +2 -2
- package/dist/bundle/{chunk-ZJPXRW65.js → chunk-7OBSIDBJ.js} +4 -4
- package/dist/bundle/{chunk-OOWE2O5U.js → chunk-AI2J3WJT.js} +1 -1
- package/dist/bundle/{chunk-EABZ2CUG.js → chunk-AMPHPP4P.js} +34 -29
- package/dist/bundle/{chunk-STPYSD6W.js → chunk-B252D7V4.js} +3 -3
- package/dist/bundle/{chunk-V4722KYX.js → chunk-BLNMM3AX.js} +2 -2
- package/dist/bundle/{chunk-SWGGYBCW.js → chunk-CNEJQQMD.js} +40 -21
- package/dist/bundle/{chunk-4DCFLHLN.js → chunk-DI3RJ3MJ.js} +4 -4
- package/dist/bundle/{chunk-7EFJHLKW.js → chunk-DNCOELTM.js} +1 -1
- package/dist/bundle/chunk-DYOZ7CUV.js +71 -0
- package/dist/bundle/{chunk-E2Z4C6CQ.js → chunk-E4HDE5DN.js} +6 -6
- package/dist/bundle/chunk-EIGV2JKX.js +13 -0
- package/dist/bundle/{chunk-6KT5BTWL.js → chunk-FHPEUAHQ.js} +367 -184
- package/dist/bundle/{chunk-MCPOZNWG.js → chunk-FIVFP53N.js} +1 -1
- package/dist/bundle/{chunk-SNEJK4SN.js → chunk-FSP74THJ.js} +4 -4
- package/dist/bundle/{chunk-PAHSIORC.js → chunk-FUYCAROL.js} +6 -6
- package/dist/bundle/{chunk-WA7YED3Y.js → chunk-GRDVBJCR.js} +1 -1
- package/dist/bundle/{chunk-OE5JMZSM.js → chunk-GUPMDMFM.js} +9 -9
- package/dist/bundle/{chunk-6FK2Z75N.js → chunk-HHG5FR5H.js} +2 -2
- package/dist/bundle/{chunk-U5FILNK6.js → chunk-IN3NAFUN.js} +69 -6
- package/dist/bundle/{chunk-3BUQXB7B.js → chunk-INZAZMUF.js} +15 -117
- package/dist/bundle/{chunk-4W4EVVL4.js → chunk-IX3GUNGV.js} +4 -4
- package/dist/bundle/{chunk-SCGCDLI7.js → chunk-JB4BO5XZ.js} +1 -1
- package/dist/bundle/{chunk-XDL4L3OI.js → chunk-JC6HMPL7.js} +14229 -12041
- package/dist/bundle/chunk-JCNKGZQG.js +1068 -0
- package/dist/bundle/{chunk-PZQ2MQFX.js → chunk-JKF7LZBU.js} +6 -6
- package/dist/bundle/{chunk-5R5HGV2J.js → chunk-LD42OGKK.js} +4 -4
- package/dist/bundle/{chunk-3P7HWXDJ.js → chunk-LU2CHHPC.js} +14 -5
- package/dist/bundle/{chunk-RX5CJ55S.js → chunk-M4OP5ASJ.js} +1 -1
- package/dist/bundle/{chunk-3JISIGLP.js → chunk-MK4IKICN.js} +2 -2
- package/dist/bundle/{chunk-3S6KZCZ7.js → chunk-NM5GBJME.js} +57 -28
- package/dist/bundle/{chunk-KKMNMQMW.js → chunk-NTHALPDT.js} +2 -2
- package/dist/bundle/{chunk-B6G3TNN4.js → chunk-OG2ONSH6.js} +156 -43
- package/dist/bundle/{chunk-EOUUI5FI.js → chunk-PCC7GWOS.js} +4 -4
- package/dist/bundle/{chunk-ADI5R2MM.js → chunk-QVK7NF3A.js} +51 -51
- package/dist/bundle/{chunk-Q74XVJFT.js → chunk-QYT6HDCL.js} +1 -1
- package/dist/bundle/{chunk-EISV5YWD.js → chunk-RX5GU7GQ.js} +6994 -6232
- package/dist/bundle/{chunk-NYRAW4M5.js → chunk-RZ7KBWDQ.js} +4 -7
- package/dist/bundle/{chunk-V23X3W2W.js → chunk-S4SOS27T.js} +8 -8
- package/dist/bundle/{chunk-V4JEZFW5.js → chunk-SGHF75RQ.js} +2 -2
- package/dist/bundle/{chunk-T5OO7VDT.js → chunk-TAFH5K5D.js} +3900 -3425
- package/dist/bundle/{chunk-QLB3BFSN.js → chunk-TVQBOIWC.js} +1 -1
- package/dist/bundle/{chunk-QLXKWAET.js → chunk-UG66U2T7.js} +88 -21
- package/dist/bundle/{chunk-ZOBRYIUG.js → chunk-URFBZNLU.js} +2 -2
- package/dist/bundle/{chunk-ZQ3WGGKK.js → chunk-UTNK2PFE.js} +13 -13
- package/dist/bundle/{chunk-LVGX7VTD.js → chunk-VG3EQJYV.js} +34 -5
- package/dist/bundle/{chunk-FFHX7VKP.js → chunk-VHD4V64E.js} +1 -1
- package/dist/bundle/{chunk-BAB3ALHZ.js → chunk-VUBSGQ2O.js} +30 -26
- package/dist/bundle/{chunk-UBFDPLFQ.js → chunk-VZDAVZYX.js} +6 -6
- package/dist/bundle/{chunk-QVMAZVSN.js → chunk-WH4T44L3.js} +1 -1
- package/dist/bundle/{chunk-RDKPKS2P.js → chunk-X6436BYW.js} +2 -2
- package/dist/bundle/{chunk-SMFUKHG2.js → chunk-XS5C5TQ7.js} +24 -9
- package/dist/bundle/{chunk-ENEMZAIJ.js → chunk-XTNOBJRP.js} +14 -12
- package/dist/bundle/{chunk-HJLTWT52.js → chunk-YRZXOQOB.js} +2 -2
- package/dist/bundle/{chunk-5IHYZ6ED.js → chunk-ZX5OSZHH.js} +12 -12
- package/dist/bundle/command-contract-JP6SCP7U.js +34 -0
- package/dist/bundle/{command-server-entry-5LKDRLEX.js → command-server-entry-BLSFT3T6.js} +24 -22
- package/dist/bundle/{decode-L4DQDHXA.js → decode-NNLEQU7B.js} +5 -5
- package/dist/bundle/{dispatch-PQSCFHEX.js → dispatch-PRAIGIFS.js} +8 -8
- package/dist/bundle/{echarts-6LES2JIV.js → echarts-XAZHGDOM.js} +2 -2
- package/dist/bundle/{embed-T5MLKX75.js → embed-Q7ZCVSCO.js} +6 -6
- package/dist/bundle/{embedder-56NMRLC5.js → embedder-MVS3PVWQ.js} +9 -9
- package/dist/bundle/{entry-U5GV6Y46.js → entry-XN3ZZAOK.js} +9 -8
- package/dist/bundle/{failure-BX5HJAQE.js → failure-7Y34AUJT.js} +2 -2
- package/dist/bundle/{first-run-ISQ52V3I.js → first-run-G4EFTONI.js} +11 -11
- package/dist/bundle/first-screen-RIDJEPC3.js +32 -0
- package/dist/bundle/{instructions-CJEXDI7E.js → instructions-QDHYYZBU.js} +1 -1
- package/dist/bundle/{mcp-7KQUJNFN.js → mcp-TDKGDB4V.js} +2 -2
- package/dist/bundle/{node-QLWTGZW7.js → node-3Y7OVY2U.js} +2 -2
- package/dist/bundle/{node-sqlite-X2C3RR2Q.js → node-sqlite-R2SBROJM.js} +7 -7
- package/dist/bundle/{oauth-VP3KMHLX.js → oauth-WSPWMWTV.js} +7 -7
- package/dist/bundle/{open-GLR5EUZS.js → open-VFLF4HRQ.js} +5 -5
- package/dist/bundle/{openai-6CDCJ5LQ.js → openai-DFCKZZDV.js} +23 -18
- package/dist/bundle/{process-7FABZ3T2.js → process-VZKFAGNP.js} +1 -1
- package/dist/bundle/{program-KUIAHJDX.js → program-2LB3CUZX.js} +86 -67
- package/dist/bundle/{prompt-XPHIZMD2.js → prompt-RVLA2PEY.js} +5 -5
- package/dist/bundle/{proxy-transport-IIB7ZXIS.js → proxy-transport-DP7SIMIC.js} +5 -5
- package/dist/bundle/{recognize-FVFYI3XX.js → recognize-LEKNA3G5.js} +4 -4
- package/dist/bundle/{remote-3AMCG2P4.js → remote-WG5V2I2G.js} +9 -7
- package/dist/bundle/{rerank-XV4E25ML.js → rerank-ONAEQVJ6.js} +7 -7
- package/dist/bundle/{serve-NVSZA4UN.js → serve-BL2X6FZG.js} +14 -14
- package/dist/bundle/{server-MBMPHRJE.js → server-3LSC4BMK.js} +36 -35
- package/dist/bundle/server-7EYEEGJT.js +62 -0
- package/dist/bundle/sqlite-runtime-RQXPRH6C.js +19 -0
- package/dist/bundle/{state-JBMB2QUR.js → state-O7LRA526.js} +6 -6
- package/dist/bundle/store-7C4UAND2.js +276 -0
- package/dist/bundle/{store-T4SCYTY2.js → store-HMJUPK45.js} +15 -13
- package/dist/bundle/store-maintenance-command-I7PSA3SZ.js +52 -0
- package/dist/bundle/tg.js +13 -13
- package/dist/commands/account-removal.d.ts.map +1 -1
- package/dist/commands/account-removal.js +5 -3
- package/dist/commands/account-removal.js.map +1 -1
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +21 -3
- package/dist/commands/session.js.map +1 -1
- package/dist/paths.d.ts +6 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +23 -2
- package/dist/paths.js.map +1 -1
- package/dist/program.d.ts +4 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +5 -2
- package/dist/program.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/skills/tg-cli/SKILL.md +6 -2
- package/dist/bundle/chunk-I7K4OR5Q.js +0 -265
- package/dist/bundle/chunk-PZJXQMSZ.js +0 -27
- package/dist/bundle/command-contract-HWSWHMO4.js +0 -33
- package/dist/bundle/first-screen-7L4AMZDO.js +0 -31
- package/dist/bundle/server-MHVGYRQZ.js +0 -61
- package/dist/bundle/store-maintenance-command-F7WQMTMP.js +0 -49
- /package/dist/bundle/{chunk-YVNHQFLC.js → chunk-XWBPP2HX.js} +0 -0
|
@@ -3,17 +3,22 @@ const require = __bundleRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
CliError,
|
|
5
5
|
errorCodes
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7KCBPAQS.js";
|
|
7
7
|
import {
|
|
8
8
|
__name
|
|
9
9
|
} from "./chunk-ZVVMGPBJ.js";
|
|
10
10
|
|
|
11
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
11
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._f55ccfac747d9da64edfb69ea8dcc45a/node_modules/@wirecat/cli-core/dist/errors/failures.js
|
|
12
12
|
var isCliFailure = /* @__PURE__ */ __name((value) => value instanceof Error && value.name === "CliError" && errorCodes.includes(value.code), "isCliFailure");
|
|
13
13
|
var isCommanderFailure = /* @__PURE__ */ __name((value) => {
|
|
14
14
|
const { code, exitCode } = value ?? {};
|
|
15
15
|
return value instanceof Error && typeof code === "string" && code.startsWith("commander.") && typeof exitCode === "number";
|
|
16
16
|
}, "isCommanderFailure");
|
|
17
|
+
var USAGE_REASONS = {
|
|
18
|
+
"commander.unknownCommand": "usage.unknown-command",
|
|
19
|
+
"commander.unknownOption": "usage.unknown-option"
|
|
20
|
+
};
|
|
21
|
+
var usageReason = /* @__PURE__ */ __name((code) => USAGE_REASONS[code], "usageReason");
|
|
17
22
|
var failureKey = /* @__PURE__ */ __name((error) => isCliFailure(error) ? error.code : error instanceof Error ? error.name : "error", "failureKey");
|
|
18
23
|
var SQLITE_CORRUPT = 11;
|
|
19
24
|
var SQLITE_NOTADB = 26;
|
|
@@ -42,9 +47,20 @@ var wrapping = /* @__PURE__ */ __name((error, original) => {
|
|
|
42
47
|
return error;
|
|
43
48
|
}, "wrapping");
|
|
44
49
|
var storeDamaged = /* @__PURE__ */ __name((error, next) => damageIn(error) ? wrapping(new CliError("configuration_error", `the store file is damaged${next ? `; \`${next}\` says what is damaged and what to do` : ""}`, { reason: "store.damaged" }), error) : error, "storeDamaged");
|
|
50
|
+
var damagedFile = /* @__PURE__ */ __name(async (files, work) => {
|
|
51
|
+
try {
|
|
52
|
+
return await work();
|
|
53
|
+
} catch (error) {
|
|
54
|
+
if (!damageIn(error))
|
|
55
|
+
throw error;
|
|
56
|
+
throw wrapping(new CliError("validation_error", `${files.join(" or ")} is damaged or not a database`, {
|
|
57
|
+
reason: "store.file-damaged"
|
|
58
|
+
}), error);
|
|
59
|
+
}
|
|
60
|
+
}, "damagedFile");
|
|
45
61
|
var isStoreDamage = /* @__PURE__ */ __name((error) => damageIn(error) !== void 0, "isStoreDamage");
|
|
46
62
|
|
|
47
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
63
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._f55ccfac747d9da64edfb69ea8dcc45a/node_modules/@wirecat/cli-core/dist/runs/secrets.js
|
|
48
64
|
var SECRET_WORDS = /* @__PURE__ */ new Set([
|
|
49
65
|
"authorization",
|
|
50
66
|
"cookie",
|
|
@@ -87,6 +103,7 @@ var KNOWN_TOKENS = new RegExp(`${[
|
|
|
87
103
|
"npm_[A-Za-z0-9]{36}",
|
|
88
104
|
"eyJ[A-Za-z0-9_-]{5,}\\.eyJ[A-Za-z0-9_-]{5,}\\.[A-Za-z0-9_-]*"
|
|
89
105
|
].map((pattern) => `${START}${pattern}${END}`).join("|")}|(?<!\\d)\\d{8,10}:[A-Za-z0-9_-]{35}${END}`, "g");
|
|
106
|
+
var WEBHOOK_PATH = /(\/rest\/\d+\/)[^/\s?#"']+/g;
|
|
90
107
|
var PRIVATE_KEY = /-----BEGIN[A-Z ]* PRIVATE KEY-----[\s\S]*?(?:-----END[A-Z ]* PRIVATE KEY-----|$)/g;
|
|
91
108
|
var SCHEME = /(?<![A-Za-z])(Bearer|Basic)(\s+)(?![A-Z]?[a-z]+(?![A-Za-z0-9]))[A-Za-z0-9._~+/=-]{8,}/g;
|
|
92
109
|
var NAMED_PAIR = /(?<![\p{L}\p{N}])([\p{L}\p{N}_.-]*(?:token|pass|pwd|pin|otp|2fa|secret|credential|cookie|authorization|key|contrase|clave|пароль|пин|код)[\p{L}\p{N}_.-]*)(["']?\s*(?:=>|[:=])\s*["']?|\s+(?![\p{L}]+(?![\p{L}\p{N}])))((?:Bearer\s+|Basic\s+)?)([^\s"'&,;]+)/giu;
|
|
@@ -118,7 +135,7 @@ var entropy = /* @__PURE__ */ __name((text) => {
|
|
|
118
135
|
bits -= count / text.length * Math.log2(count / text.length);
|
|
119
136
|
return bits;
|
|
120
137
|
}, "entropy");
|
|
121
|
-
var withoutSecrets = /* @__PURE__ */ __name((text, mark = "[redacted]") => text.replace(PRIVATE_KEY, mark).replace(KNOWN_TOKENS, mark).replace(SCHEME, `$1$2${mark}`).replace(NAMED_PAIR, (whole, name, separator, scheme) => secretNamed(name) ? `${name}${separator}${scheme}${mark}` : whole).replace(/[!-~]{20,}/g, (token) => (
|
|
138
|
+
var withoutSecrets = /* @__PURE__ */ __name((text, mark = "[redacted]") => text.replace(WEBHOOK_PATH, `$1${mark}`).replace(PRIVATE_KEY, mark).replace(KNOWN_TOKENS, mark).replace(SCHEME, `$1$2${mark}`).replace(NAMED_PAIR, (whole, name, separator, scheme) => secretNamed(name) ? `${name}${separator}${scheme}${mark}` : whole).replace(/[!-~]{20,}/g, (token) => (
|
|
122
139
|
// A URL or a path is somebody's address, not a key; a credential in one is caught by the rules above.
|
|
123
140
|
token.includes("://") || /^(?:\/|~\/|\.\.?\/)/.test(token) ? token : token.replace(RUN, (run) => looksRandom(run) ? mark : run.replace(HEX, (hex) => entropy(hex) >= 3 ? mark : hex))
|
|
124
141
|
)), "withoutSecrets");
|
|
@@ -128,9 +145,11 @@ var HEX = /(?<![A-Za-z0-9])(?=[0-9]*[a-f])[0-9a-f]{20,}(?![A-Za-z0-9])/g;
|
|
|
128
145
|
export {
|
|
129
146
|
isCliFailure,
|
|
130
147
|
isCommanderFailure,
|
|
148
|
+
usageReason,
|
|
131
149
|
failureKey,
|
|
132
150
|
sqliteCode,
|
|
133
151
|
storeDamaged,
|
|
152
|
+
damagedFile,
|
|
134
153
|
isStoreDamage,
|
|
135
154
|
secretNamed,
|
|
136
155
|
withoutSecrets
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
__name
|
|
5
5
|
} from "./chunk-ZVVMGPBJ.js";
|
|
6
6
|
|
|
7
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
7
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/errors.js
|
|
8
8
|
var errorCodes = [
|
|
9
9
|
"validation_error",
|
|
10
10
|
"configuration_error",
|
|
@@ -39,7 +39,7 @@ var CliError = class extends Error {
|
|
|
39
39
|
};
|
|
40
40
|
var isCliError = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && value[BRAND] === true, "isCliError");
|
|
41
41
|
|
|
42
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
42
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/sanitize.js
|
|
43
43
|
var CONTROL = (
|
|
44
44
|
// biome-ignore lint/suspicious/noControlCharactersInRegex: matching them is the whole point
|
|
45
45
|
/[\u0000-\u0008\u000B-\u001F\u007F-\u009F\u200B\u200E\u200F\u202A-\u202E\u2066-\u2069\uFEFF\u{E0000}-\u{E007F}]/gu
|
|
@@ -7,18 +7,18 @@ import {
|
|
|
7
7
|
describeOptions,
|
|
8
8
|
keyForCommand,
|
|
9
9
|
metaOf
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-FHPEUAHQ.js";
|
|
11
11
|
import {
|
|
12
12
|
jsonSchemaOf
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-XS5C5TQ7.js";
|
|
14
14
|
import {
|
|
15
15
|
CliError
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-7KCBPAQS.js";
|
|
17
17
|
import {
|
|
18
18
|
__name
|
|
19
19
|
} from "./chunk-ZVVMGPBJ.js";
|
|
20
20
|
|
|
21
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._f55ccfac747d9da64edfb69ea8dcc45a/node_modules/@wirecat/cli-core/dist/cli/command-contract.js
|
|
22
22
|
var SCHEMA_DIALECT = "https://json-schema.org/draft/2020-12/schema";
|
|
23
23
|
var outputOf = /* @__PURE__ */ __name((command) => {
|
|
24
24
|
const entity = answerEntitySchema(command);
|
|
@@ -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.650.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._f55ccfac747d9da64edfb69ea8dcc45a/node_modules/@wirecat/cli-core/dist/mcp/stdio-wire.js
|
|
8
8
|
import { PassThrough, Writable } from "node:stream";
|
|
9
9
|
var lineReader = /* @__PURE__ */ __name((onMessage) => {
|
|
10
10
|
let rest = "";
|
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
servicesFor,
|
|
17
17
|
throughWrapper,
|
|
18
18
|
withFileLockAsync
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-TAFH5K5D.js";
|
|
20
20
|
import {
|
|
21
21
|
servingProfiles
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-6HLB73UN.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-JC6HMPL7.js";
|
|
31
31
|
import {
|
|
32
32
|
CEILING_KEY,
|
|
33
33
|
WRITE_KEYS,
|
|
@@ -47,24 +47,24 @@ import {
|
|
|
47
47
|
rememberAccount,
|
|
48
48
|
rootOf2 as rootOf,
|
|
49
49
|
skipFlagFor
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-FHPEUAHQ.js";
|
|
51
51
|
import {
|
|
52
52
|
providerErrorKey
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-4TCBRKWQ.js";
|
|
54
54
|
import {
|
|
55
55
|
isCliFailure
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-77Z3OGAT.js";
|
|
57
57
|
import {
|
|
58
58
|
resolvePaths
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-NM5GBJME.js";
|
|
60
60
|
import {
|
|
61
61
|
CliError
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-7KCBPAQS.js";
|
|
63
63
|
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.650.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._f55ccfac747d9da64edfb69ea8dcc45a/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.650.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._f55ccfac747d9da64edfb69ea8dcc45a/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 };
|
|
@@ -141,12 +141,12 @@ var Pacer = class {
|
|
|
141
141
|
}
|
|
142
142
|
/** When this call may go; reserved at once, so the next caller in any process lines up behind it. */
|
|
143
143
|
async reserve() {
|
|
144
|
-
const now = this.now();
|
|
145
144
|
if (this.interval === 0)
|
|
146
|
-
return now;
|
|
145
|
+
return this.now();
|
|
147
146
|
return withFileLockAsync(this.path, "the request pace", () => {
|
|
148
|
-
const
|
|
149
|
-
|
|
147
|
+
const now = this.now();
|
|
148
|
+
const tat = Math.max(this.read(now), now);
|
|
149
|
+
this.write(tat + this.interval, now);
|
|
150
150
|
return Math.max(now, tat - this.rate.burst * this.interval);
|
|
151
151
|
});
|
|
152
152
|
}
|
|
@@ -155,25 +155,30 @@ var Pacer = class {
|
|
|
155
155
|
if (this.interval === 0)
|
|
156
156
|
return;
|
|
157
157
|
await withFileLockAsync(this.path, "the request pace", () => {
|
|
158
|
-
const
|
|
159
|
-
this.
|
|
158
|
+
const now = this.now();
|
|
159
|
+
const hold = now + waitMs + this.rate.burst * this.interval;
|
|
160
|
+
this.write(Math.max(this.read(now), hold), now);
|
|
160
161
|
});
|
|
161
162
|
}
|
|
162
163
|
/** The owner's `flood clear`: every process may go again at once. */
|
|
163
164
|
async reset() {
|
|
164
|
-
await withFileLockAsync(this.path, "the request pace", () => this.write(0));
|
|
165
|
+
await withFileLockAsync(this.path, "the request pace", () => this.write(0, this.now()));
|
|
165
166
|
}
|
|
166
|
-
read() {
|
|
167
|
+
read(now) {
|
|
167
168
|
try {
|
|
168
|
-
const
|
|
169
|
-
|
|
169
|
+
const file = JSON.parse(readFileSync(this.path, "utf8"));
|
|
170
|
+
const tat = Number(file.tat);
|
|
171
|
+
if (!Number.isFinite(tat))
|
|
172
|
+
return 0;
|
|
173
|
+
const at = Number(file.at);
|
|
174
|
+
return Number.isFinite(at) && at > now ? now + Math.max(0, tat - at) : tat;
|
|
170
175
|
} catch {
|
|
171
176
|
return 0;
|
|
172
177
|
}
|
|
173
178
|
}
|
|
174
|
-
write(tat) {
|
|
179
|
+
write(tat, at) {
|
|
175
180
|
const temporary = `${this.path}.${process.pid}.tmp`;
|
|
176
|
-
writeFileSync(temporary, JSON.stringify({ tat }), { mode: 384 });
|
|
181
|
+
writeFileSync(temporary, JSON.stringify({ tat, at }), { mode: 384 });
|
|
177
182
|
renameSync(temporary, this.path);
|
|
178
183
|
}
|
|
179
184
|
};
|
|
@@ -195,8 +200,8 @@ var waitForTurn = /* @__PURE__ */ __name(async (pacer, options) => {
|
|
|
195
200
|
const waitMs = at - now();
|
|
196
201
|
if (waitMs <= 0)
|
|
197
202
|
return;
|
|
198
|
-
if (waitMs > LONGEST_PACE_WAIT_MS)
|
|
199
|
-
throw new CliError("rate_limited",
|
|
203
|
+
if (waitMs > (options.longestWaitMs ?? LONGEST_PACE_WAIT_MS))
|
|
204
|
+
throw new CliError("rate_limited", `this profile's next request to ${name} has to wait ${Math.ceil(waitMs / 1e3)} s more \u2014 nothing was sent to ${name}`, { retry_after_ms: waitMs, retry_at: new Date(at).toISOString(), remembered: true });
|
|
200
205
|
if (waitMs >= ANNOUNCE_WAIT_MS) {
|
|
201
206
|
const seconds = Math.ceil(waitMs / 1e3);
|
|
202
207
|
warn?.(`waiting ${seconds} s to keep this profile's pace with ${name}`, {
|
|
@@ -209,7 +214,7 @@ var waitForTurn = /* @__PURE__ */ __name(async (pacer, options) => {
|
|
|
209
214
|
await (options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms))))(waitMs);
|
|
210
215
|
}, "waitForTurn");
|
|
211
216
|
|
|
212
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
217
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._f55ccfac747d9da64edfb69ea8dcc45a/node_modules/@wirecat/cli-core/dist/cli/permission-keys.js
|
|
213
218
|
var pathOf = /* @__PURE__ */ __name((command) => {
|
|
214
219
|
const words = [];
|
|
215
220
|
for (let at = command; at?.parent; at = at.parent)
|
|
@@ -269,7 +274,7 @@ var refuseUnknownPermissionKeys = /* @__PURE__ */ __name((command, settings, too
|
|
|
269
274
|
throw new CliError("validation_error", `--permission ${key} names no command`, { permission: key });
|
|
270
275
|
}, "refuseUnknownPermissionKeys");
|
|
271
276
|
|
|
272
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
277
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._f55ccfac747d9da64edfb69ea8dcc45a/node_modules/@wirecat/cli-core/dist/cli/messenger/flooded.js
|
|
273
278
|
var LONG_LIVED = /* @__PURE__ */ new Set(["self", "newSendId", "close", "formatMarkdown", "formatHtml", "storedChats"]);
|
|
274
279
|
var LISTENING = /* @__PURE__ */ new Set(["watch", "feed", "listen", "listenHistory"]);
|
|
275
280
|
var BLOCKING = /* @__PURE__ */ new Set(["frozen", "limited", "banned"]);
|
|
@@ -366,7 +371,7 @@ var flooded = /* @__PURE__ */ __name((messenger, memory, { name, warn, pacer })
|
|
|
366
371
|
});
|
|
367
372
|
}, "flooded");
|
|
368
373
|
|
|
369
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
374
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._f55ccfac747d9da64edfb69ea8dcc45a/node_modules/@wirecat/cli-core/dist/cli/messenger/observed.js
|
|
370
375
|
var observed = /* @__PURE__ */ __name((messenger, events) => {
|
|
371
376
|
const timed = /* @__PURE__ */ __name(async (operation, named, work, after) => {
|
|
372
377
|
const write = currentOperation();
|
|
@@ -465,7 +470,7 @@ var byPart = /* @__PURE__ */ __name((batch, counts) => {
|
|
|
465
470
|
counts[part] = (counts[part] ?? 0) + items.length;
|
|
466
471
|
}, "byPart");
|
|
467
472
|
|
|
468
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
473
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._f55ccfac747d9da64edfb69ea8dcc45a/node_modules/@wirecat/cli-core/dist/cli/messenger/stored.js
|
|
469
474
|
var REKEY_PACING = { lockMs: 50, pauseMs: 25 };
|
|
470
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" }) => {
|
|
471
476
|
let warned = false;
|
|
@@ -1041,7 +1046,7 @@ var keep = /* @__PURE__ */ __name(async (store, account, event, seenAt, among, c
|
|
|
1041
1046
|
}
|
|
1042
1047
|
}, "keep");
|
|
1043
1048
|
|
|
1044
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1049
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._f55ccfac747d9da64edfb69ea8dcc45a/node_modules/@wirecat/cli-core/dist/cli/messenger/context.js
|
|
1045
1050
|
var lazyStore = /* @__PURE__ */ __name((env, command, version) => {
|
|
1046
1051
|
let opened;
|
|
1047
1052
|
return {
|
|
@@ -3,15 +3,15 @@ const require = __bundleRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
readSharedSection,
|
|
5
5
|
writeSharedSection
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FUYCAROL.js";
|
|
7
7
|
import {
|
|
8
8
|
CliError
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-7KCBPAQS.js";
|
|
10
10
|
import {
|
|
11
11
|
__name
|
|
12
12
|
} from "./chunk-ZVVMGPBJ.js";
|
|
13
13
|
|
|
14
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._f55ccfac747d9da64edfb69ea8dcc45a/node_modules/@wirecat/cli-core/dist/cli/setup-answers.js
|
|
15
15
|
var PERMISSION_ANSWERS = ["readonly", "allow"];
|
|
16
16
|
var QUESTIONS = ["languages", "tools", "permissions"];
|
|
17
17
|
var SECTION = "setup";
|
|
@@ -2,11 +2,11 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
openCache
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-VZDAVZYX.js";
|
|
6
6
|
import {
|
|
7
7
|
CliError,
|
|
8
8
|
isCliError
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-7KCBPAQS.js";
|
|
10
10
|
import {
|
|
11
11
|
__name
|
|
12
12
|
} from "./chunk-ZVVMGPBJ.js";
|
|
@@ -13,51 +13,52 @@ import {
|
|
|
13
13
|
privateFiles,
|
|
14
14
|
providerRequest,
|
|
15
15
|
withSqliteSidecars
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import {
|
|
18
|
-
hostFetch
|
|
19
|
-
} from "./chunk-LVGX7VTD.js";
|
|
16
|
+
} from "./chunk-RX5GU7GQ.js";
|
|
20
17
|
import {
|
|
21
18
|
parseProxy,
|
|
22
19
|
proxyAddress,
|
|
23
20
|
proxyError,
|
|
24
21
|
proxyLabel,
|
|
25
22
|
proxySetting
|
|
26
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-URFBZNLU.js";
|
|
27
24
|
import {
|
|
28
25
|
messengerContext
|
|
29
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-AMPHPP4P.js";
|
|
30
27
|
import {
|
|
31
28
|
uploadBlob
|
|
32
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-TAFH5K5D.js";
|
|
33
30
|
import {
|
|
34
31
|
DESKTOP,
|
|
35
32
|
TG
|
|
36
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-HHG5FR5H.js";
|
|
37
34
|
import {
|
|
38
35
|
asFirstWord,
|
|
39
36
|
environmentOf,
|
|
40
37
|
fromFile,
|
|
41
38
|
settingsFor
|
|
42
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-FHPEUAHQ.js";
|
|
40
|
+
import {
|
|
41
|
+
hostFetch
|
|
42
|
+
} from "./chunk-VG3EQJYV.js";
|
|
43
43
|
import {
|
|
44
44
|
currentAttempt
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-6Y6SSZ34.js";
|
|
46
46
|
import {
|
|
47
47
|
Credentials,
|
|
48
|
+
isMovedRun,
|
|
48
49
|
pathsAreOverridden,
|
|
49
50
|
resolvePaths
|
|
50
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-NM5GBJME.js";
|
|
51
52
|
import {
|
|
52
53
|
optional
|
|
53
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-XS5C5TQ7.js";
|
|
54
55
|
import {
|
|
55
56
|
importFrom
|
|
56
57
|
} from "./chunk-Y5E2WNWB.js";
|
|
57
58
|
import {
|
|
58
59
|
CliError,
|
|
59
60
|
isCliError
|
|
60
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-7KCBPAQS.js";
|
|
61
62
|
import {
|
|
62
63
|
__name
|
|
63
64
|
} from "./chunk-ZVVMGPBJ.js";
|
|
@@ -71,11 +72,26 @@ import { existsSync as existsSync2 } from "node:fs";
|
|
|
71
72
|
import { dirname } from "node:path";
|
|
72
73
|
|
|
73
74
|
// dist/paths.js
|
|
74
|
-
import {
|
|
75
|
+
import { userInfo } from "node:os";
|
|
76
|
+
import { join, resolve } from "node:path";
|
|
75
77
|
var APP = TG.appName;
|
|
76
78
|
var pathsFor = /* @__PURE__ */ __name((env = process.env) => resolvePaths({ appName: TG.appName, prefix: TG.envPrefix, env }), "pathsFor");
|
|
77
79
|
var isolated = /* @__PURE__ */ __name((env = process.env) => pathsAreOverridden({ appName: TG.appName, prefix: TG.envPrefix, env }), "isolated");
|
|
78
80
|
var sessionFile = /* @__PURE__ */ __name((profile, env = process.env) => join(pathsFor(env).state, "sessions", `${profile}.session`), "sessionFile");
|
|
81
|
+
var accountHome = /* @__PURE__ */ __name(() => {
|
|
82
|
+
try {
|
|
83
|
+
return userInfo().homedir;
|
|
84
|
+
} catch {
|
|
85
|
+
return void 0;
|
|
86
|
+
}
|
|
87
|
+
}, "accountHome");
|
|
88
|
+
var usesOwnersSession = /* @__PURE__ */ __name((profile, env = process.env, home = accountHome()) => {
|
|
89
|
+
if (!isMovedRun({ appName: TG.appName, prefix: TG.envPrefix, env, home }))
|
|
90
|
+
return false;
|
|
91
|
+
if (home === void 0)
|
|
92
|
+
return true;
|
|
93
|
+
return resolve(sessionFile(profile, env)) === resolve(sessionFile(profile, { HOME: home, USERPROFILE: home }));
|
|
94
|
+
}, "usesOwnersSession");
|
|
79
95
|
var botSessionFile = /* @__PURE__ */ __name((profile, botId, env = process.env) => join(pathsFor(env).state, "bots", profile, `mtproto-${botId}.session`), "botSessionFile");
|
|
80
96
|
|
|
81
97
|
// dist/telegram/credentials.js
|
|
@@ -173,7 +189,7 @@ var logOut = /* @__PURE__ */ __name(async (profile, sessionPath, context) => {
|
|
|
173
189
|
checks: checkWords("tg", profile),
|
|
174
190
|
...keyring ? { keyring } : {}
|
|
175
191
|
});
|
|
176
|
-
const { TelegramAdapter } = await import("./adapter-
|
|
192
|
+
const { TelegramAdapter } = await import("./adapter-H2LTOLOA.js");
|
|
177
193
|
const adapter = await TelegramAdapter.open({ credentials, sessionPath, ...through ? { proxy: through.proxy } : {} });
|
|
178
194
|
try {
|
|
179
195
|
await adapter.logout();
|
|
@@ -192,6 +208,8 @@ var TELEGRAM_REMOVAL = {
|
|
|
192
208
|
const sessionPath = sessionFile(profile, context.env);
|
|
193
209
|
if (!existsSync(sessionPath))
|
|
194
210
|
return { revoked: null, removed: [] };
|
|
211
|
+
if (usesOwnersSession(profile, context.env))
|
|
212
|
+
return { revoked: false, removed: [] };
|
|
195
213
|
const revoked = context.mayRevoke ? await logOut(profile, sessionPath, context) : false;
|
|
196
214
|
for (const suffix of SUFFIXES)
|
|
197
215
|
rmSync(`${sessionPath}${suffix}`, { force: true });
|
|
@@ -203,7 +221,7 @@ var TELEGRAM_REMOVAL = {
|
|
|
203
221
|
accounts: [`${profile}:api`, `proxy:profile:${profile}`]
|
|
204
222
|
}
|
|
205
223
|
], "secrets"),
|
|
206
|
-
stateFiles: /* @__PURE__ */ __name((profile, { env }) => [join2(pathsFor(env).state, "bots", profile)], "stateFiles")
|
|
224
|
+
stateFiles: /* @__PURE__ */ __name((profile, { env }) => usesOwnersSession(profile, env) ? [] : [join2(pathsFor(env).state, "bots", profile)], "stateFiles")
|
|
207
225
|
};
|
|
208
226
|
|
|
209
227
|
// dist/commands/context.js
|
|
@@ -236,7 +254,7 @@ var telegramOf = /* @__PURE__ */ __name((command, base) => {
|
|
|
236
254
|
throw new CliError(temporary ? "provider_unavailable" : "authentication_error", loggedIn ? `no Telegram app credentials found for profile "${profile}", although it has logged in on this machine \u2014 the keyring is probably out of reach (cron, ssh, an MCP client that trims the environment: set XDG_RUNTIME_DIR); \`tg ${asFirstWord(profile)}doctor\` shows it. Log in again only if they were removed` : `no Telegram app credentials for profile "${profile}" \u2014 run ${setup} in a local terminal first, or sign in from ${desktop}; agents: read \`tg skill show\``, temporary ? { reason: "credentials.unreachable" } : {});
|
|
237
255
|
}
|
|
238
256
|
const options = { credentials: resolved, sessionPath, ...connecting };
|
|
239
|
-
return environment.adapter ? await environment.adapter(options) : await (await import("./adapter-
|
|
257
|
+
return environment.adapter ? await environment.adapter(options) : await (await import("./adapter-H2LTOLOA.js")).TelegramAdapter.open({
|
|
240
258
|
...options,
|
|
241
259
|
...proxyOption(proxy()),
|
|
242
260
|
diagnostic: /* @__PURE__ */ __name((line) => base.streams.diagnostic(line), "diagnostic"),
|
|
@@ -331,9 +349,9 @@ var appCredentialsState = /* @__PURE__ */ __name((read, env) => {
|
|
|
331
349
|
}
|
|
332
350
|
}, "appCredentialsState");
|
|
333
351
|
var proxyOption = /* @__PURE__ */ __name((through) => through ? { proxy: through.proxy } : {}, "proxyOption");
|
|
334
|
-
var proxyState = /* @__PURE__ */ __name((
|
|
352
|
+
var proxyState = /* @__PURE__ */ __name((resolve2) => {
|
|
335
353
|
try {
|
|
336
|
-
const through =
|
|
354
|
+
const through = resolve2();
|
|
337
355
|
if (!through)
|
|
338
356
|
return null;
|
|
339
357
|
return {
|
|
@@ -961,7 +979,7 @@ var TELEGRAM_BOT = {
|
|
|
961
979
|
const botId = token.split(":", 1)[0] ?? "";
|
|
962
980
|
if (!/^\d+$/.test(botId))
|
|
963
981
|
throw new CliError("authentication_error", "the bot token has no valid bot id");
|
|
964
|
-
const reader = await (environment.botHistory ?? (await import("./bot-history-
|
|
982
|
+
const reader = await (environment.botHistory ?? (await import("./bot-history-TT2EAHEE.js")).openBotHistory)({
|
|
965
983
|
credentials,
|
|
966
984
|
sessionPath: botSessionFile(profile, botId, env),
|
|
967
985
|
token,
|
|
@@ -981,7 +999,7 @@ var TELEGRAM_BOT = {
|
|
|
981
999
|
return void 0;
|
|
982
1000
|
let personal;
|
|
983
1001
|
try {
|
|
984
|
-
personal = environment.adapter ? await environment.adapter({ credentials, sessionPath: personalPath }) : await (await import("./adapter-
|
|
1002
|
+
personal = environment.adapter ? await environment.adapter({ credentials, sessionPath: personalPath }) : await (await import("./adapter-H2LTOLOA.js")).TelegramAdapter.open({
|
|
985
1003
|
credentials,
|
|
986
1004
|
sessionPath: personalPath,
|
|
987
1005
|
checks: words,
|
|
@@ -1010,6 +1028,7 @@ export {
|
|
|
1010
1028
|
proxiedFetch,
|
|
1011
1029
|
guardedFetch,
|
|
1012
1030
|
pathsFor,
|
|
1031
|
+
usesOwnersSession,
|
|
1013
1032
|
parseApiId,
|
|
1014
1033
|
parseApiHash,
|
|
1015
1034
|
proxySecrets,
|
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
} from "./chunk-Y5E2WNWB.js";
|
|
6
6
|
import {
|
|
7
7
|
CliError
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-7KCBPAQS.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.650.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._f55ccfac747d9da64edfb69ea8dcc45a/node_modules/@wirecat/cli-core/dist/speech/recognize.js
|
|
14
14
|
import { createRequire } from "node:module";
|
|
15
15
|
|
|
16
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._f55ccfac747d9da64edfb69ea8dcc45a/node_modules/@wirecat/cli-core/dist/speech/ogg-limit.js
|
|
17
17
|
var invalid = /* @__PURE__ */ __name(() => new CliError("validation_error", "local transcription needs a complete mono or stereo Ogg Opus recording"), "invalid");
|
|
18
18
|
var checkOggDuration = /* @__PURE__ */ __name((bytes) => {
|
|
19
19
|
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
@@ -70,7 +70,7 @@ var checkOggDuration = /* @__PURE__ */ __name((bytes) => {
|
|
|
70
70
|
throw invalid();
|
|
71
71
|
}, "checkOggDuration");
|
|
72
72
|
|
|
73
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
73
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._f55ccfac747d9da64edfb69ea8dcc45a/node_modules/@wirecat/cli-core/dist/speech/recognize.js
|
|
74
74
|
var SAMPLE_RATE = 16e3;
|
|
75
75
|
var LEAD = SAMPLE_RATE / 2;
|
|
76
76
|
var toModelRate = /* @__PURE__ */ __name((samples, rate) => {
|
|
@@ -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.650.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._f55ccfac747d9da64edfb69ea8dcc45a/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");
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
CliError
|
|
5
|
+
} from "./chunk-7KCBPAQS.js";
|
|
6
|
+
import {
|
|
7
|
+
__name
|
|
8
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
9
|
+
|
|
10
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._f55ccfac747d9da64edfb69ea8dcc45a/node_modules/@wirecat/cli-core/dist/ports/app.js
|
|
11
|
+
import { readFileSync } from "node:fs";
|
|
12
|
+
var envName = /* @__PURE__ */ __name((app, name) => `${app.envPrefix}_${name}`, "envName");
|
|
13
|
+
var locking = /* @__PURE__ */ __name((value) => value !== void 0 && value.trim() !== "" && value !== "0", "locking");
|
|
14
|
+
var ancestries = /* @__PURE__ */ new Map();
|
|
15
|
+
var readable = /* @__PURE__ */ __name((read, path) => {
|
|
16
|
+
try {
|
|
17
|
+
return read(path);
|
|
18
|
+
} catch (error) {
|
|
19
|
+
if (error.code === "EACCES")
|
|
20
|
+
return void 0;
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
}, "readable");
|
|
24
|
+
var ancestorEnvironments = /* @__PURE__ */ __name(({ read = /* @__PURE__ */ __name((path) => readFileSync(path, "utf8"), "read"), from = process.ppid, uid = process.getuid?.() ?? -1, cache = ancestries } = {}) => {
|
|
25
|
+
if (process.platform !== "linux")
|
|
26
|
+
return [];
|
|
27
|
+
const key = `${from}:${uid}`;
|
|
28
|
+
const known = cache.get(key);
|
|
29
|
+
if (known !== void 0)
|
|
30
|
+
return known;
|
|
31
|
+
let found = [];
|
|
32
|
+
try {
|
|
33
|
+
for (let pid = from, depth = 0; pid >= 1 && depth < 64; depth++) {
|
|
34
|
+
const status = read(`/proc/${pid}/status`);
|
|
35
|
+
const field = /* @__PURE__ */ __name((name) => new RegExp(`^${name}:\\s*(\\d+)`, "m").exec(status)?.[1], "field");
|
|
36
|
+
if (Number(field("Uid")) !== uid)
|
|
37
|
+
break;
|
|
38
|
+
const environ = readable(read, `/proc/${pid}/environ`);
|
|
39
|
+
if (environ === void 0)
|
|
40
|
+
break;
|
|
41
|
+
found.push(environ.split("\0"));
|
|
42
|
+
pid = Number(field("PPid"));
|
|
43
|
+
}
|
|
44
|
+
} catch {
|
|
45
|
+
found = null;
|
|
46
|
+
}
|
|
47
|
+
cache.set(key, found);
|
|
48
|
+
return found;
|
|
49
|
+
}, "ancestorEnvironments");
|
|
50
|
+
var valuesOf = /* @__PURE__ */ __name((environments, name) => environments.flatMap((environ) => environ.filter((entry) => entry.startsWith(`${name}=`)).map((entry) => entry.slice(name.length + 1))), "valuesOf");
|
|
51
|
+
var lockedByAncestor = /* @__PURE__ */ __name((name, ancestry = {}) => {
|
|
52
|
+
const environments = ancestorEnvironments(ancestry);
|
|
53
|
+
return environments === null || valuesOf(environments, name).some(locking);
|
|
54
|
+
}, "lockedByAncestor");
|
|
55
|
+
var ancestorValue = /* @__PURE__ */ __name((name, env, ancestry = {}) => valuesOf(ancestorEnvironments(ancestry) ?? [], name).at(-1) ?? env[name], "ancestorValue");
|
|
56
|
+
var readOnlyLockOf = /* @__PURE__ */ __name((app, env) => {
|
|
57
|
+
const name = envName(app, "READ_ONLY");
|
|
58
|
+
return locking(env[name]) || lockedByAncestor(name) ? name : void 0;
|
|
59
|
+
}, "readOnlyLockOf");
|
|
60
|
+
var mailHolderVariable = /* @__PURE__ */ __name((app) => envName(app, "MAIL_HOLDER"), "mailHolderVariable");
|
|
61
|
+
var MESSENGER_CHANGE_REFUSAL = "send, react, change chats or change the account";
|
|
62
|
+
var readOnlyRefusal = /* @__PURE__ */ __name((lock, what) => new CliError("permission_error", `this process is read-only (${lock}) \u2014 it cannot ${what}`), "readOnlyRefusal");
|
|
63
|
+
|
|
64
|
+
export {
|
|
65
|
+
envName,
|
|
66
|
+
ancestorValue,
|
|
67
|
+
readOnlyLockOf,
|
|
68
|
+
mailHolderVariable,
|
|
69
|
+
MESSENGER_CHANGE_REFUSAL,
|
|
70
|
+
readOnlyRefusal
|
|
71
|
+
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { createRequire as __bundleRequire } from "node:module";
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
ACCESS_SECONDS,
|
|
5
|
-
REFRESH_SECONDS,
|
|
6
|
-
readStored
|
|
7
|
-
} from "./chunk-SNEJK4SN.js";
|
|
8
3
|
import {
|
|
9
4
|
OAuthError,
|
|
10
5
|
OAuthErrorCode
|
|
11
6
|
} from "./chunk-5D4AEUVA.js";
|
|
7
|
+
import {
|
|
8
|
+
ACCESS_SECONDS,
|
|
9
|
+
REFRESH_SECONDS,
|
|
10
|
+
readStored
|
|
11
|
+
} from "./chunk-FSP74THJ.js";
|
|
12
12
|
import {
|
|
13
13
|
__name
|
|
14
14
|
} from "./chunk-ZVVMGPBJ.js";
|
|
15
15
|
|
|
16
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.650.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._f55ccfac747d9da64edfb69ea8dcc45a/node_modules/@wirecat/cli-core/dist/mcp/http/oauth.js
|
|
17
17
|
import { createHash, randomBytes, randomInt, timingSafeEqual } from "node:crypto";
|
|
18
18
|
import { chmodSync, mkdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
19
19
|
import { dirname } from "node:path";
|