@wirecat/tg-cli 0.115.0 → 0.117.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/bot/transport.d.ts +11 -9
- package/dist/bot/transport.d.ts.map +1 -1
- package/dist/bot/transport.js +58 -32
- package/dist/bot/transport.js.map +1 -1
- package/dist/bundle/{adapter-ODK7R4LY.js → adapter-VNQ72MBK.js} +98 -63
- package/dist/bundle/{all-profiles-AQYM65BS.js → all-profiles-3W2UQTCK.js} +10 -9
- package/dist/bundle/{anthropic-VBDSVNIM.js → anthropic-DFUW2KTG.js} +6 -6
- package/dist/bundle/{app-server-YOIHLBNS.js → app-server-5XJIMLHB.js} +49 -45
- package/dist/bundle/{bot-api-TRYLGQKK.js → bot-api-HRRBF3W6.js} +50 -49
- package/dist/bundle/{bot-history-7DTJLBBJ.js → bot-history-GBH5XE4N.js} +18 -17
- package/dist/bundle/{bun-XIMM6EHD.js → bun-ZMOYGG6F.js} +2 -2
- package/dist/bundle/{bun-sqlite-6B3BL5IV.js → bun-sqlite-6FZFMA7K.js} +5 -5
- package/dist/bundle/{chunk-DIABP7ZP.js → chunk-2452HCIV.js} +3 -3
- package/dist/bundle/{chunk-WMG4IGEB.js → chunk-2XLKZL6K.js} +77 -38
- package/dist/bundle/chunk-3GRX7WP6.js +35 -0
- package/dist/bundle/{chunk-WINKEV4F.js → chunk-3MQOLYAN.js} +4 -4
- package/dist/bundle/{chunk-KDOBY524.js → chunk-3RJYLN5V.js} +133 -27
- package/dist/bundle/{chunk-Y3AQHPAJ.js → chunk-4JDGN6OD.js} +1 -1
- package/dist/bundle/{chunk-JZXQZW2D.js → chunk-56Q5JV3Z.js} +2 -2
- package/dist/bundle/{chunk-XIYRHIBK.js → chunk-66FZBLRJ.js} +13 -13
- package/dist/bundle/{chunk-OUX3QMYI.js → chunk-6GFUL4OU.js} +228 -84
- package/dist/bundle/{chunk-O7CBGHI7.js → chunk-6HRN7BW6.js} +1 -1
- package/dist/bundle/{chunk-TQYMLXDS.js → chunk-7NBUT62O.js} +3 -3
- package/dist/bundle/{chunk-A4BQGSKI.js → chunk-7Y3RUEVY.js} +6 -6
- package/dist/bundle/chunk-AG6HWPQP.js +64 -0
- package/dist/bundle/{chunk-GCFU6WBE.js → chunk-AUBRELCM.js} +3 -3
- package/dist/bundle/{chunk-PEKTB3FQ.js → chunk-B2YPB5AE.js} +56 -27
- package/dist/bundle/{chunk-CCHHEMPM.js → chunk-BXTDAGM4.js} +3 -2
- package/dist/bundle/{chunk-QK6VLKG5.js → chunk-C6TUVV7E.js} +674 -316
- package/dist/bundle/{chunk-XY7IGVVS.js → chunk-EA2PGDER.js} +2 -2
- package/dist/bundle/{chunk-KIZT2MI6.js → chunk-EL6I4WTB.js} +1 -1
- package/dist/bundle/{chunk-77M3IAVU.js → chunk-EPCFXKTX.js} +27 -8
- package/dist/bundle/{chunk-L4CMCC3V.js → chunk-EZTYJ43A.js} +4 -2
- package/dist/bundle/{chunk-PEJHI7QO.js → chunk-F6KBVIJP.js} +4 -4
- package/dist/bundle/{chunk-UY7GJRGY.js → chunk-FAHHERJ7.js} +4 -4
- package/dist/bundle/{chunk-WOQGUIXE.js → chunk-FEKXHILZ.js} +1 -1
- package/dist/bundle/chunk-G7B5UIE7.js +182 -0
- package/dist/bundle/{chunk-RFRI2HFT.js → chunk-GFHNQBD2.js} +1 -1
- package/dist/bundle/{chunk-TMATSEP5.js → chunk-HORGORHK.js} +12 -12
- package/dist/bundle/{chunk-2TC76TLJ.js → chunk-HWYSRB64.js} +2 -2
- package/dist/bundle/{chunk-GX4DMI4H.js → chunk-HZZGOLGP.js} +15 -12
- package/dist/bundle/{chunk-MUZ4KYGY.js → chunk-JWIUK3SK.js} +2 -2
- package/dist/bundle/{chunk-WDNNN3J4.js → chunk-KVTLT4V7.js} +6 -6
- package/dist/bundle/{chunk-UBQ3LOF6.js → chunk-L5WNE4WS.js} +2 -2
- package/dist/bundle/{chunk-OMP6ALBT.js → chunk-M7V5XRM6.js} +3 -3
- package/dist/bundle/{chunk-LUIPXRKN.js → chunk-MLHKQDUN.js} +647 -129
- package/dist/bundle/{chunk-VQCWVZWG.js → chunk-MP7M6FFU.js} +6 -6
- package/dist/bundle/{chunk-5ROWSRK7.js → chunk-NUCDEOFC.js} +2 -2
- package/dist/bundle/{chunk-ILHTNOIV.js → chunk-P3ASN72F.js} +1 -1
- package/dist/bundle/{chunk-VVKEWWSO.js → chunk-PTIB7NEE.js} +1 -1
- package/dist/bundle/{chunk-D4E345BC.js → chunk-Q7O4CQDO.js} +4 -2
- package/dist/bundle/{chunk-EW3XTUPB.js → chunk-QOGYHU3Q.js} +4 -4
- package/dist/bundle/{chunk-BEQPZA3S.js → chunk-RDH2QBUE.js} +3 -3
- package/dist/bundle/{chunk-AVWPMJ6E.js → chunk-RDSLSV4M.js} +2 -2
- package/dist/bundle/{chunk-YCUQKFGD.js → chunk-SQXB5ZUZ.js} +3 -3
- package/dist/bundle/{chunk-RHUNMU4Q.js → chunk-TFBHDIGY.js} +4 -4
- package/dist/bundle/{chunk-OSP335AJ.js → chunk-TG6ZYL4B.js} +8 -8
- package/dist/bundle/{chunk-IUDIRZVU.js → chunk-UGPZCNYC.js} +991 -536
- package/dist/bundle/{chunk-AICS3TSF.js → chunk-UYK5AXSW.js} +4 -4
- package/dist/bundle/{chunk-PZAEI4NM.js → chunk-V2T7NYNU.js} +55 -46
- package/dist/bundle/{chunk-HZKWB6WS.js → chunk-V47NPSSV.js} +28 -28
- package/dist/bundle/{chunk-U67TSAAO.js → chunk-VMCQGZIA.js} +1893 -840
- package/dist/bundle/{chunk-CNO3R4O4.js → chunk-VRDVXXXD.js} +8 -8
- package/dist/bundle/{chunk-PQLBPYJR.js → chunk-VW6BF6M7.js} +1 -1
- package/dist/bundle/{chunk-M7B5IMH3.js → chunk-X3CD475M.js} +1336 -366
- package/dist/bundle/chunk-XW5C4TI7.js +91 -0
- package/dist/bundle/{chunk-NTW5ZE47.js → chunk-YHZFGUAP.js} +39 -33
- package/dist/bundle/{chunk-BIEBJLYO.js → chunk-YIXXH74F.js} +2 -2
- package/dist/bundle/{chunk-BPPRR7TV.js → chunk-Z4QKLHJW.js} +15587 -1637
- package/dist/bundle/{chunk-POKTQZOM.js → chunk-ZPILMEFY.js} +12 -89
- package/dist/bundle/command-contract-KMMHARMR.js +33 -0
- package/dist/bundle/{decode-2GATBZGH.js → decode-YMSOY2AY.js} +5 -5
- package/dist/bundle/{dispatch-MJMW7WDH.js → dispatch-OP27MWX5.js} +8 -8
- package/dist/bundle/{echarts-GKEZEAL7.js → echarts-7XS55TQY.js} +2 -2
- package/dist/bundle/{embed-TBQPLA4Y.js → embed-QTOE7NN3.js} +6 -6
- package/dist/bundle/{embedder-B5DTNCRO.js → embedder-KBBRYSNH.js} +9 -9
- package/dist/bundle/{entry-A6DEW2TD.js → entry-HGEUYYMX.js} +7 -7
- package/dist/bundle/{failure-TLF3SISS.js → failure-4JUQFXJT.js} +2 -2
- package/dist/bundle/{first-run-3N5AABEY.js → first-run-CSGMEJXY.js} +11 -11
- package/dist/bundle/first-screen-K2PBNJNE.js +31 -0
- package/dist/bundle/{instructions-P5E34PQR.js → instructions-S6ZXCTFH.js} +1 -1
- package/dist/bundle/{mcp-MNI62HHE.js → mcp-M4QN2E7R.js} +2 -2
- package/dist/bundle/{node-GKPRXS5Y.js → node-LCIUWXXG.js} +2 -2
- package/dist/bundle/{node-sqlite-GIDPALK3.js → node-sqlite-HL4WY4N2.js} +6 -6
- package/dist/bundle/{oauth-C57W4IMD.js → oauth-U4KIMDKG.js} +7 -7
- package/dist/bundle/{open-E6Q4WRPU.js → open-EH7OS7M7.js} +5 -5
- package/dist/bundle/{openai-5WMXY2KP.js → openai-W5TB3NA5.js} +14 -14
- package/dist/bundle/{process-U2P5Z6UF.js → process-3CVLTCTA.js} +1 -1
- package/dist/bundle/{program-FEUDU6GF.js → program-LOIZTK2P.js} +58 -50
- package/dist/bundle/{prompt-4NGAZGHE.js → prompt-IDNH7N3W.js} +5 -5
- package/dist/bundle/{proxy-transport-MGCJ7JAW.js → proxy-transport-4DPZB2W2.js} +5 -5
- package/dist/bundle/{recognize-EUHRBA7V.js → recognize-G5EWYXIF.js} +4 -4
- package/dist/bundle/{remote-3JHLB2FV.js → remote-4XTBZVZD.js} +7 -7
- package/dist/bundle/{rerank-ZZ45SZPC.js → rerank-OWSTDLZN.js} +7 -7
- package/dist/bundle/{serve-XOGX5FC5.js → serve-YCPSEWP3.js} +9 -9
- package/dist/bundle/server-KELKX6S3.js +60 -0
- package/dist/bundle/{server-I6O72XP5.js → server-ODG4A2KK.js} +35 -34
- package/dist/bundle/{state-BIUYTGH6.js → state-OL2235G5.js} +6 -6
- package/dist/bundle/{store-FOJFYOMR.js → store-5AACYNDM.js} +17 -12
- package/dist/bundle/store-maintenance-command-3J7WZYVN.js +50 -0
- package/dist/bundle/tg.js +13 -13
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +7 -0
- package/dist/commands/session.js.map +1 -1
- package/dist/telegram/account.d.ts.map +1 -1
- package/dist/telegram/account.js +4 -1
- package/dist/telegram/account.js.map +1 -1
- package/dist/telegram/errors.d.ts.map +1 -1
- package/dist/telegram/errors.js +2 -1
- package/dist/telegram/errors.js.map +1 -1
- package/dist/telegram/feature.d.ts +4 -1
- package/dist/telegram/feature.d.ts.map +1 -1
- package/dist/telegram/feature.js +5 -2
- package/dist/telegram/feature.js.map +1 -1
- package/dist/telegram/login.d.ts +2 -0
- package/dist/telegram/login.d.ts.map +1 -1
- package/dist/telegram/login.js +31 -2
- package/dist/telegram/login.js.map +1 -1
- package/dist/telegram/sending.d.ts.map +1 -1
- package/dist/telegram/sending.js +24 -10
- package/dist/telegram/sending.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-63YKD7YA.js +0 -18
- package/dist/bundle/chunk-GWDMKEDY.js +0 -48
- package/dist/bundle/chunk-WMRFAK5B.js +0 -132
- package/dist/bundle/command-contract-YF4KGFXC.js +0 -32
- package/dist/bundle/first-screen-HANARM67.js +0 -30
- package/dist/bundle/server-DRE5MJ76.js +0 -59
- package/dist/bundle/store-maintenance-command-YKV2C34N.js +0 -49
- /package/dist/bundle/{chunk-NUN6OGOV.js → chunk-VOXIGICJ.js} +0 -0
|
@@ -2,16 +2,16 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
alive
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-EL6I4WTB.js";
|
|
6
6
|
import {
|
|
7
7
|
resolvePaths,
|
|
8
8
|
writeSecurely
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-YHZFGUAP.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.600.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.80.8_commander@15._6a3165a3e9bffd3483d86046d9ef2956/node_modules/@wirecat/cli-core/dist/background/lock.js
|
|
15
15
|
import { existsSync, linkSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
16
16
|
import { dirname, join } from "node:path";
|
|
17
17
|
var lockPath = /* @__PURE__ */ __name((app, profile, env) => join(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "serve", `${profile}.lock`), "lockPath");
|
|
@@ -13,45 +13,45 @@ import {
|
|
|
13
13
|
privateFiles,
|
|
14
14
|
providerRequest,
|
|
15
15
|
withSqliteSidecars
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-VMCQGZIA.js";
|
|
17
17
|
import {
|
|
18
18
|
parseProxy,
|
|
19
19
|
proxyAddress,
|
|
20
20
|
proxyError,
|
|
21
21
|
proxyLabel,
|
|
22
22
|
proxySetting
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-JWIUK3SK.js";
|
|
24
24
|
import {
|
|
25
25
|
messengerContext
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-V2T7NYNU.js";
|
|
27
27
|
import {
|
|
28
28
|
uploadBlob
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-UGPZCNYC.js";
|
|
30
30
|
import {
|
|
31
31
|
asFirstWord,
|
|
32
32
|
currentAttempt,
|
|
33
33
|
environmentOf,
|
|
34
34
|
fromFile,
|
|
35
35
|
settingsFor
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-X3CD475M.js";
|
|
37
37
|
import {
|
|
38
38
|
TG
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-YIXXH74F.js";
|
|
40
40
|
import {
|
|
41
41
|
Credentials,
|
|
42
42
|
pathsAreOverridden,
|
|
43
43
|
resolvePaths
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-YHZFGUAP.js";
|
|
45
45
|
import {
|
|
46
46
|
optional
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-EPCFXKTX.js";
|
|
48
48
|
import {
|
|
49
49
|
importFrom
|
|
50
50
|
} from "./chunk-Y5E2WNWB.js";
|
|
51
51
|
import {
|
|
52
52
|
CliError,
|
|
53
53
|
isCliError
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-BXTDAGM4.js";
|
|
55
55
|
import {
|
|
56
56
|
__name
|
|
57
57
|
} from "./chunk-ZVVMGPBJ.js";
|
|
@@ -181,7 +181,7 @@ var telegramOf = /* @__PURE__ */ __name((command, base) => {
|
|
|
181
181
|
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" } : {});
|
|
182
182
|
}
|
|
183
183
|
const options = { credentials: resolved, sessionPath, ...connecting };
|
|
184
|
-
return environment.adapter ? await environment.adapter(options) : await (await import("./adapter-
|
|
184
|
+
return environment.adapter ? await environment.adapter(options) : await (await import("./adapter-VNQ72MBK.js")).TelegramAdapter.open({
|
|
185
185
|
...options,
|
|
186
186
|
...proxyOption(proxy()),
|
|
187
187
|
diagnostic: /* @__PURE__ */ __name((line) => base.streams.diagnostic(line), "diagnostic"),
|
|
@@ -718,7 +718,18 @@ var TelegramBotTransport = class {
|
|
|
718
718
|
* anyone. `file` goes up in the same request, as multipart: Telegram has no upload step of its own.
|
|
719
719
|
* `timeoutMs` replaces the transport's for one call — a long poll waits longer than any other request.
|
|
720
720
|
*/
|
|
721
|
-
async call(method, params = {},
|
|
721
|
+
async call(method, params = {}, options = {}) {
|
|
722
|
+
const timeoutMs = options.timeoutMs ?? this.#timeoutMs;
|
|
723
|
+
const deadline = new AbortController();
|
|
724
|
+
const timer = setTimeout(() => deadline.abort(new DOMException(`${method} timed out`, "TimeoutError")), timeoutMs);
|
|
725
|
+
timer.unref();
|
|
726
|
+
try {
|
|
727
|
+
return await this.#send(method, params, { ...options, timeoutMs }, deadline.signal);
|
|
728
|
+
} finally {
|
|
729
|
+
clearTimeout(timer);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
async #send(method, params, { reads = true, file, files = [], body, secrets = [], timeoutMs = this.#timeoutMs }, deadline) {
|
|
722
733
|
const end = providerRequest(method, this.#events ?? (() => {
|
|
723
734
|
}), {
|
|
724
735
|
method: "POST",
|
|
@@ -727,7 +738,7 @@ var TelegramBotTransport = class {
|
|
|
727
738
|
// A rate-limit retry is made above the transport (cli-core's `patiently`), which names the attempt itself.
|
|
728
739
|
...currentAttempt() ? {} : { attempt: 1 }
|
|
729
740
|
});
|
|
730
|
-
const signals = [
|
|
741
|
+
const signals = [deadline, ...this.#signal ? [this.#signal] : []];
|
|
731
742
|
let response;
|
|
732
743
|
try {
|
|
733
744
|
response = await this.#fetch(`${this.#baseUrl}/bot${this.#token}/${method}`, {
|
|
@@ -759,11 +770,12 @@ var TelegramBotTransport = class {
|
|
|
759
770
|
try {
|
|
760
771
|
answer = apiPlainJson(parseApiJson(text));
|
|
761
772
|
} catch {
|
|
762
|
-
|
|
763
|
-
throw new CliError("invalid_response", `Telegram answered ${method} with something that is not JSON`, {
|
|
773
|
+
const failure = response.status >= 500 ? this.#refused(method, refusalOf(method, {}, response.status), reads) : new CliError("invalid_response", `Telegram answered ${method} with something that is not JSON`, {
|
|
764
774
|
operation: method,
|
|
765
775
|
status: response.status
|
|
766
776
|
});
|
|
777
|
+
end({ ...answered, errorCode: failure.code });
|
|
778
|
+
throw failure;
|
|
767
779
|
}
|
|
768
780
|
if (answer.ok === true) {
|
|
769
781
|
end(answered);
|
|
@@ -776,20 +788,26 @@ var TelegramBotTransport = class {
|
|
|
776
788
|
answer.description = answer.description.split(secret).join("[redacted]");
|
|
777
789
|
answer.description = answer.description.replace(/\b\d+:[A-Za-z0-9_-]{20,}\b/g, "[redacted]");
|
|
778
790
|
}
|
|
779
|
-
const refusal = refusalOf(method, answer, response.status);
|
|
791
|
+
const refusal = this.#refused(method, refusalOf(method, answer, response.status), reads);
|
|
780
792
|
end({ ...answered, errorCode: refusal.code });
|
|
781
793
|
throw refusal;
|
|
782
794
|
}
|
|
795
|
+
/** A server failure may come after a write was made; only a refusal says it was not (WC-LIFE-9). */
|
|
796
|
+
#refused(method, refusal, reads) {
|
|
797
|
+
if (reads || refusal.code !== "provider_unavailable")
|
|
798
|
+
return refusal;
|
|
799
|
+
return new CliError("outcome_unknown", `Telegram failed on ${method}; it may or may not have carried it out \u2014 check before repeating it`, { ...refusal.details, retryable: false });
|
|
800
|
+
}
|
|
783
801
|
#unanswered(method, error, reads, timeoutMs) {
|
|
784
802
|
if (isCliError(error) && error.details.proxy !== void 0)
|
|
785
803
|
return error;
|
|
786
|
-
const timedOut = error?.name === "TimeoutError";
|
|
787
|
-
if (this.#signal?.aborted && this.#signal.reason?.name !== "TimeoutError") {
|
|
788
|
-
return new CliError("cancelled", `${method} was cancelled`, { operation: method });
|
|
789
|
-
}
|
|
790
804
|
if (!reads) {
|
|
791
805
|
return new CliError("outcome_unknown", `${method} got no answer; Telegram may or may not have carried it out \u2014 check before repeating it`, { operation: method, retryable: false });
|
|
792
806
|
}
|
|
807
|
+
if (this.#signal?.aborted && this.#signal.reason?.name !== "TimeoutError") {
|
|
808
|
+
return new CliError("cancelled", `${method} was cancelled`, { operation: method });
|
|
809
|
+
}
|
|
810
|
+
const timedOut = error?.name === "TimeoutError";
|
|
793
811
|
return new CliError(timedOut ? "timeout" : "network_error", timedOut ? `${method} got no answer within ${timeoutMs} ms` : `${method} could not reach Telegram`, { operation: method, retryable: true });
|
|
794
812
|
}
|
|
795
813
|
};
|
|
@@ -804,11 +822,10 @@ var multipart = /* @__PURE__ */ __name((params, files) => {
|
|
|
804
822
|
return form;
|
|
805
823
|
}, "multipart");
|
|
806
824
|
var refusalOf = /* @__PURE__ */ __name((method, answer, status) => {
|
|
807
|
-
const said = answer.description ?? `HTTP ${status}`;
|
|
808
825
|
const details = { operation: method, status };
|
|
809
826
|
const retryAfter = answer.parameters?.retry_after;
|
|
810
827
|
if (retryAfter !== void 0) {
|
|
811
|
-
return new CliError("rate_limited", `Telegram asks to wait ${retryAfter} s before ${method}
|
|
828
|
+
return new CliError("rate_limited", `Telegram asks to wait ${retryAfter} s before ${method}`, {
|
|
812
829
|
...details,
|
|
813
830
|
retry_after_ms: retryAfter * 1e3,
|
|
814
831
|
retryable: true
|
|
@@ -816,11 +833,23 @@ var refusalOf = /* @__PURE__ */ __name((method, answer, status) => {
|
|
|
816
833
|
}
|
|
817
834
|
const migrated = answer.parameters?.migrate_to_chat_id;
|
|
818
835
|
if (migrated !== void 0) {
|
|
819
|
-
return new CliError("not_found", `this group became a supergroup with id ${migrated} \u2014 use that id from now on
|
|
836
|
+
return new CliError("not_found", `this group became a supergroup with id ${migrated} \u2014 use that id from now on`, {
|
|
837
|
+
...details,
|
|
838
|
+
migrated_chat_id: String(migrated)
|
|
839
|
+
});
|
|
840
|
+
}
|
|
841
|
+
const refused = answer.error_code ?? status;
|
|
842
|
+
if (refused === 401 || refused === 404)
|
|
843
|
+
return new CliError("authentication_error", "Telegram did not accept this bot token", details);
|
|
844
|
+
if (refused === 403) {
|
|
845
|
+
return new CliError("permission_error", `Telegram does not let this bot ${method} there \u2014 it may be blocked, not in the chat, or without the right`, details);
|
|
846
|
+
}
|
|
847
|
+
if (refused >= 500)
|
|
848
|
+
return new CliError("provider_unavailable", `Telegram failed on ${method} (${refused})`, details);
|
|
849
|
+
if (refused === 400) {
|
|
850
|
+
return new CliError("validation_error", `Telegram refused ${method} (400): a chat, message or value in it is wrong, or the bot cannot see it`, details);
|
|
820
851
|
}
|
|
821
|
-
|
|
822
|
-
const message = code === "authentication_error" ? `Telegram did not accept this bot token (${said})` : `${method}: ${said}`;
|
|
823
|
-
return new CliError(code, message, details);
|
|
852
|
+
return new CliError("provider_error", `Telegram refused ${method} (${refused})`, details);
|
|
824
853
|
}, "refusalOf");
|
|
825
854
|
|
|
826
855
|
// dist/commands/bot.js
|
|
@@ -867,7 +896,7 @@ var TELEGRAM_BOT = {
|
|
|
867
896
|
const botId = token.split(":", 1)[0] ?? "";
|
|
868
897
|
if (!/^\d+$/.test(botId))
|
|
869
898
|
throw new CliError("authentication_error", "the bot token has no valid bot id");
|
|
870
|
-
const reader = await (environment.botHistory ?? (await import("./bot-history-
|
|
899
|
+
const reader = await (environment.botHistory ?? (await import("./bot-history-GBH5XE4N.js")).openBotHistory)({
|
|
871
900
|
credentials,
|
|
872
901
|
sessionPath: botSessionFile(profile, botId, env),
|
|
873
902
|
token,
|
|
@@ -887,7 +916,7 @@ var TELEGRAM_BOT = {
|
|
|
887
916
|
return void 0;
|
|
888
917
|
let personal;
|
|
889
918
|
try {
|
|
890
|
-
personal = environment.adapter ? await environment.adapter({ credentials, sessionPath: personalPath }) : await (await import("./adapter-
|
|
919
|
+
personal = environment.adapter ? await environment.adapter({ credentials, sessionPath: personalPath }) : await (await import("./adapter-VNQ72MBK.js")).TelegramAdapter.open({
|
|
891
920
|
credentials,
|
|
892
921
|
sessionPath: personalPath,
|
|
893
922
|
checks: words,
|
|
@@ -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.80.8_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",
|
|
@@ -19,6 +19,7 @@ var errorCodes = [
|
|
|
19
19
|
"provider_unavailable",
|
|
20
20
|
"invalid_response",
|
|
21
21
|
"outcome_unknown",
|
|
22
|
+
"conflict",
|
|
22
23
|
"cancelled"
|
|
23
24
|
];
|
|
24
25
|
var BRAND = /* @__PURE__ */ Symbol.for("@wirecat/cli-base/CliError");
|
|
@@ -38,7 +39,7 @@ var CliError = class extends Error {
|
|
|
38
39
|
};
|
|
39
40
|
var isCliError = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && value[BRAND] === true, "isCliError");
|
|
40
41
|
|
|
41
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
42
|
+
// node_modules/.pnpm/@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/sanitize.js
|
|
42
43
|
var CONTROL = (
|
|
43
44
|
// biome-ignore lint/suspicious/noControlCharactersInRegex: matching them is the whole point
|
|
44
45
|
/[\u0000-\u0008\u000B-\u001F\u007F-\u009F\u200B\u200E\u200F\u202A-\u202E\u2066-\u2069\uFEFF\u{E0000}-\u{E007F}]/gu
|