@wirecat/tg-cli 0.116.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 +1 -1
- package/dist/bot/transport.d.ts.map +1 -1
- package/dist/bot/transport.js +42 -30
- package/dist/bot/transport.js.map +1 -1
- package/dist/bundle/{adapter-6CLMTQOV.js → adapter-VNQ72MBK.js} +70 -61
- package/dist/bundle/{all-profiles-R2UZMH24.js → all-profiles-3W2UQTCK.js} +10 -10
- package/dist/bundle/{anthropic-QKIPHV2Z.js → anthropic-DFUW2KTG.js} +6 -6
- package/dist/bundle/{app-server-AZB2MFK6.js → app-server-5XJIMLHB.js} +49 -46
- package/dist/bundle/{bot-api-2IM243J4.js → bot-api-HRRBF3W6.js} +49 -49
- package/dist/bundle/{bot-history-G6CRVCL2.js → bot-history-GBH5XE4N.js} +18 -18
- package/dist/bundle/{bun-JDKPISPX.js → bun-ZMOYGG6F.js} +2 -2
- package/dist/bundle/{bun-sqlite-X5PY5IQT.js → bun-sqlite-6FZFMA7K.js} +5 -5
- package/dist/bundle/{chunk-577MFPCP.js → chunk-2452HCIV.js} +3 -3
- package/dist/bundle/{chunk-H72UEHNG.js → chunk-2XLKZL6K.js} +34 -28
- package/dist/bundle/{chunk-RSDIPQXP.js → chunk-3GRX7WP6.js} +2 -2
- package/dist/bundle/{chunk-PPLFOIYX.js → chunk-3MQOLYAN.js} +4 -4
- package/dist/bundle/{chunk-JFTCOV37.js → chunk-3RJYLN5V.js} +73 -21
- package/dist/bundle/{chunk-BGMV66FC.js → chunk-4JDGN6OD.js} +1 -1
- package/dist/bundle/{chunk-MQ7MCVZV.js → chunk-56Q5JV3Z.js} +2 -2
- package/dist/bundle/{chunk-4IQZRW4O.js → chunk-66FZBLRJ.js} +13 -13
- package/dist/bundle/{chunk-QHBVGKC3.js → chunk-6GFUL4OU.js} +206 -81
- package/dist/bundle/{chunk-5FCONCJO.js → chunk-6HRN7BW6.js} +1 -1
- package/dist/bundle/{chunk-I6JF43YP.js → chunk-7NBUT62O.js} +3 -3
- package/dist/bundle/{chunk-VQPLHOVQ.js → chunk-7Y3RUEVY.js} +6 -6
- package/dist/bundle/chunk-AG6HWPQP.js +64 -0
- package/dist/bundle/{chunk-HK6SIIGG.js → chunk-AUBRELCM.js} +3 -3
- package/dist/bundle/{chunk-4D5AUWAY.js → chunk-B2YPB5AE.js} +43 -25
- package/dist/bundle/{chunk-EB2IULWB.js → chunk-BXTDAGM4.js} +2 -2
- package/dist/bundle/{chunk-QGL2UGML.js → chunk-C6TUVV7E.js} +466 -224
- package/dist/bundle/{chunk-42GK3XRS.js → chunk-EA2PGDER.js} +2 -2
- package/dist/bundle/{chunk-N6TIFJHW.js → chunk-EL6I4WTB.js} +1 -1
- package/dist/bundle/{chunk-76CX2YPT.js → chunk-EPCFXKTX.js} +8 -8
- package/dist/bundle/{chunk-Y6VWGJ4Q.js → chunk-EZTYJ43A.js} +4 -2
- package/dist/bundle/{chunk-T7CDLV33.js → chunk-F6KBVIJP.js} +4 -4
- package/dist/bundle/{chunk-PXMHBTK3.js → chunk-FAHHERJ7.js} +4 -4
- package/dist/bundle/{chunk-DP5LRU7K.js → chunk-FEKXHILZ.js} +1 -1
- package/dist/bundle/chunk-G7B5UIE7.js +182 -0
- package/dist/bundle/{chunk-YLRTLZF6.js → chunk-GFHNQBD2.js} +1 -1
- package/dist/bundle/{chunk-SD5PUYKF.js → chunk-HORGORHK.js} +12 -12
- package/dist/bundle/{chunk-N42VUNTO.js → chunk-HWYSRB64.js} +2 -2
- package/dist/bundle/{chunk-5VFPUOJO.js → chunk-HZZGOLGP.js} +11 -11
- package/dist/bundle/{chunk-B4UOCWM4.js → chunk-JWIUK3SK.js} +2 -2
- package/dist/bundle/{chunk-NL3PAFAE.js → chunk-KVTLT4V7.js} +6 -6
- package/dist/bundle/{chunk-KA6EGOJY.js → chunk-L5WNE4WS.js} +2 -2
- package/dist/bundle/{chunk-PPSUA3IZ.js → chunk-M7V5XRM6.js} +3 -3
- package/dist/bundle/{chunk-XQUTJITP.js → chunk-MLHKQDUN.js} +647 -129
- package/dist/bundle/{chunk-RSNGMNU5.js → chunk-MP7M6FFU.js} +6 -6
- package/dist/bundle/{chunk-5ZIBAYIZ.js → chunk-NUCDEOFC.js} +2 -2
- package/dist/bundle/{chunk-KV4267S4.js → chunk-P3ASN72F.js} +1 -1
- package/dist/bundle/{chunk-QAKL3GXB.js → chunk-PTIB7NEE.js} +1 -1
- package/dist/bundle/{chunk-TZVL4U7U.js → chunk-Q7O4CQDO.js} +4 -2
- package/dist/bundle/{chunk-XBIPSSKI.js → chunk-QOGYHU3Q.js} +4 -4
- package/dist/bundle/{chunk-R52RMHWF.js → chunk-RDH2QBUE.js} +3 -3
- package/dist/bundle/{chunk-NUYRMU56.js → chunk-RDSLSV4M.js} +2 -2
- package/dist/bundle/{chunk-UCSFO5GW.js → chunk-SQXB5ZUZ.js} +3 -3
- package/dist/bundle/{chunk-K62YATVD.js → chunk-TFBHDIGY.js} +4 -4
- package/dist/bundle/{chunk-IR4S7POE.js → chunk-TG6ZYL4B.js} +8 -8
- package/dist/bundle/{chunk-FDI4GOIP.js → chunk-UGPZCNYC.js} +329 -291
- package/dist/bundle/{chunk-GV7ZJ33M.js → chunk-UYK5AXSW.js} +4 -4
- package/dist/bundle/{chunk-HUOXUI2M.js → chunk-V2T7NYNU.js} +55 -46
- package/dist/bundle/{chunk-HBUJNNZD.js → chunk-V47NPSSV.js} +28 -28
- package/dist/bundle/{chunk-YYKJN6H5.js → chunk-VMCQGZIA.js} +1390 -690
- package/dist/bundle/{chunk-LXH3SKY3.js → chunk-VRDVXXXD.js} +8 -8
- package/dist/bundle/{chunk-YPF6OS37.js → chunk-VW6BF6M7.js} +1 -1
- package/dist/bundle/{chunk-LFKEKSI5.js → chunk-X3CD475M.js} +470 -234
- package/dist/bundle/{chunk-SKZ2E3WC.js → chunk-XW5C4TI7.js} +1 -1
- package/dist/bundle/{chunk-OX6EWGSG.js → chunk-YHZFGUAP.js} +19 -19
- package/dist/bundle/{chunk-HLNYJPAB.js → chunk-YIXXH74F.js} +2 -2
- package/dist/bundle/{chunk-LSKGCJWD.js → chunk-Z4QKLHJW.js} +13617 -1795
- package/dist/bundle/{chunk-JJMQA272.js → chunk-ZPILMEFY.js} +9 -9
- package/dist/bundle/command-contract-KMMHARMR.js +33 -0
- package/dist/bundle/{decode-W6YPTGJA.js → decode-YMSOY2AY.js} +5 -5
- package/dist/bundle/{dispatch-H7EFNBEH.js → dispatch-OP27MWX5.js} +8 -8
- package/dist/bundle/{echarts-YAWDIC5D.js → echarts-7XS55TQY.js} +2 -2
- package/dist/bundle/{embed-EN4UTLV5.js → embed-QTOE7NN3.js} +6 -6
- package/dist/bundle/{embedder-HEKHRL7E.js → embedder-KBBRYSNH.js} +9 -9
- package/dist/bundle/{entry-2KB6MTCG.js → entry-HGEUYYMX.js} +7 -7
- package/dist/bundle/{failure-3DU3HLBQ.js → failure-4JUQFXJT.js} +2 -2
- package/dist/bundle/{first-run-LBG26WWO.js → first-run-CSGMEJXY.js} +11 -11
- package/dist/bundle/first-screen-K2PBNJNE.js +31 -0
- package/dist/bundle/{instructions-HA62QNPR.js → instructions-S6ZXCTFH.js} +1 -1
- package/dist/bundle/{mcp-PPVOM4SE.js → mcp-M4QN2E7R.js} +2 -2
- package/dist/bundle/{node-MZ2VWSQQ.js → node-LCIUWXXG.js} +2 -2
- package/dist/bundle/{node-sqlite-KNNS6DCM.js → node-sqlite-HL4WY4N2.js} +6 -6
- package/dist/bundle/{oauth-KWUABBSQ.js → oauth-U4KIMDKG.js} +7 -7
- package/dist/bundle/{open-JXMCYCIV.js → open-EH7OS7M7.js} +5 -5
- package/dist/bundle/{openai-HL3IR4VT.js → openai-W5TB3NA5.js} +14 -14
- package/dist/bundle/{process-K2FICLWY.js → process-3CVLTCTA.js} +1 -1
- package/dist/bundle/{program-IFOMT4JS.js → program-LOIZTK2P.js} +51 -51
- package/dist/bundle/{prompt-HVD3Q77P.js → prompt-IDNH7N3W.js} +5 -5
- package/dist/bundle/{proxy-transport-PA5SGMRY.js → proxy-transport-4DPZB2W2.js} +5 -5
- package/dist/bundle/{recognize-HHLVETKI.js → recognize-G5EWYXIF.js} +4 -4
- package/dist/bundle/{remote-HUAKXJCS.js → remote-4XTBZVZD.js} +7 -7
- package/dist/bundle/{rerank-NWFIV7OF.js → rerank-OWSTDLZN.js} +7 -7
- package/dist/bundle/{serve-ANUKAJJN.js → serve-YCPSEWP3.js} +9 -9
- package/dist/bundle/server-KELKX6S3.js +60 -0
- package/dist/bundle/{server-7Q7WAOHO.js → server-ODG4A2KK.js} +35 -35
- package/dist/bundle/{state-Y2AJ5XTP.js → state-OL2235G5.js} +6 -6
- package/dist/bundle/{store-S3IG5KWL.js → store-5AACYNDM.js} +15 -13
- package/dist/bundle/store-maintenance-command-3J7WZYVN.js +50 -0
- package/dist/bundle/tg.js +13 -13
- 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/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-K2RYCCTP.js +0 -48
- package/dist/bundle/chunk-ZDIAPICE.js +0 -132
- package/dist/bundle/command-contract-DPXM4SZT.js +0 -33
- package/dist/bundle/first-screen-TGTSLUI6.js +0 -31
- package/dist/bundle/server-HCQS4YDQ.js +0 -60
- package/dist/bundle/store-maintenance-command-V2WC4G6J.js +0 -50
- /package/dist/bundle/{chunk-LU3WKZBA.js → chunk-VOXIGICJ.js} +0 -0
package/dist/bin/tg.js
CHANGED
|
@@ -9,7 +9,7 @@ if (
|
|
|
9
9
|
(words[0] === "--version" || words[0] === "-V") &&
|
|
10
10
|
!Object.keys(process.env).some((key) => key.endsWith("_TEST_ARGV_LOG"))
|
|
11
11
|
) {
|
|
12
|
-
process.stdout.write("0.
|
|
12
|
+
process.stdout.write("0.117.0\n")
|
|
13
13
|
} else {
|
|
14
14
|
// Before the bundle compiles: the bundle's own call comes after its chunks.
|
|
15
15
|
module.enableCompileCache()
|
|
@@ -28,7 +28,7 @@ if (
|
|
|
28
28
|
: next(specifier, context),
|
|
29
29
|
})
|
|
30
30
|
}
|
|
31
|
-
const chunks = ["../bundle/adapter-
|
|
31
|
+
const chunks = ["../bundle/adapter-VNQ72MBK.js","../bundle/all-profiles-3W2UQTCK.js","../bundle/anthropic-DFUW2KTG.js","../bundle/app-server-5XJIMLHB.js","../bundle/bot-api-HRRBF3W6.js","../bundle/bot-history-GBH5XE4N.js","../bundle/bun-ZMOYGG6F.js","../bundle/bun-sqlite-6FZFMA7K.js","../bundle/command-contract-KMMHARMR.js","../bundle/decode-YMSOY2AY.js","../bundle/dispatch-OP27MWX5.js","../bundle/dist-I7OZPHAZ.js","../bundle/echarts-7XS55TQY.js","../bundle/embed-QTOE7NN3.js","../bundle/embedder-KBBRYSNH.js","../bundle/entry-HGEUYYMX.js","../bundle/failure-4JUQFXJT.js","../bundle/first-run-CSGMEJXY.js","../bundle/first-screen-K2PBNJNE.js","../bundle/instructions-S6ZXCTFH.js","../bundle/mcp-M4QN2E7R.js","../bundle/node-LCIUWXXG.js","../bundle/node-P4E63KXA.js","../bundle/node-TLZSIHIJ.js","../bundle/node-sqlite-HL4WY4N2.js","../bundle/oauth-U4KIMDKG.js","../bundle/open-EH7OS7M7.js","../bundle/openai-W5TB3NA5.js","../bundle/process-3CVLTCTA.js","../bundle/program-LOIZTK2P.js","../bundle/prompt-IDNH7N3W.js","../bundle/proxy-transport-4DPZB2W2.js","../bundle/recognize-G5EWYXIF.js","../bundle/remote-4XTBZVZD.js","../bundle/rerank-OWSTDLZN.js","../bundle/serve-YCPSEWP3.js","../bundle/server-KELKX6S3.js","../bundle/server-ODG4A2KK.js","../bundle/state-OL2235G5.js","../bundle/store-5AACYNDM.js","../bundle/store-maintenance-command-3J7WZYVN.js"]
|
|
32
32
|
if (((words) => words
|
|
33
33
|
.filter((word) => !word.startsWith("-"))
|
|
34
34
|
.slice(0, 2)
|
package/dist/bot/transport.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface BotTransportOptions {
|
|
|
14
14
|
*
|
|
15
15
|
* ⚠ **The token is part of every address** — `/bot<token>/<method>` — so the address never leaves
|
|
16
16
|
* this class: not in an error, not in a trace line, and never by passing on a failed request's own
|
|
17
|
-
* error, whose text may hold it. A failure keeps the method
|
|
17
|
+
* error, whose text may hold it. A failure keeps the method and Telegram's code, never Telegram's words.
|
|
18
18
|
*/
|
|
19
19
|
export declare class TelegramBotTransport {
|
|
20
20
|
#private;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/bot/transport.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAMtD,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;AAE7E,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,0GAA0G;IAC1G,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,MAAM,CAAC,EAAE,SAAS,CAAA;CACnB;AAWD;;;;;;GAMG;AACH,qBAAa,o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MAAM,CAAA;CACnB;AAED,8EAA8E;AAC9E,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,IAAI,CAAA;CACX"}
|
package/dist/bot/transport.js
CHANGED
|
@@ -7,7 +7,7 @@ const DEFAULT_TIMEOUT_MS = 30_000;
|
|
|
7
7
|
*
|
|
8
8
|
* ⚠ **The token is part of every address** — `/bot<token>/<method>` — so the address never leaves
|
|
9
9
|
* this class: not in an error, not in a trace line, and never by passing on a failed request's own
|
|
10
|
-
* error, whose text may hold it. A failure keeps the method
|
|
10
|
+
* error, whose text may hold it. A failure keeps the method and Telegram's code, never Telegram's words.
|
|
11
11
|
*/
|
|
12
12
|
export class TelegramBotTransport {
|
|
13
13
|
#token;
|
|
@@ -89,11 +89,15 @@ export class TelegramBotTransport {
|
|
|
89
89
|
answer = apiPlainJson(parseApiJson(text));
|
|
90
90
|
}
|
|
91
91
|
catch {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
// A gateway's 502 or 504 is an HTML page, and a write behind it may have gone through.
|
|
93
|
+
const failure = response.status >= 500
|
|
94
|
+
? this.#refused(method, refusalOf(method, {}, response.status), reads)
|
|
95
|
+
: new CliError("invalid_response", `Telegram answered ${method} with something that is not JSON`, {
|
|
96
|
+
operation: method,
|
|
97
|
+
status: response.status,
|
|
98
|
+
});
|
|
99
|
+
end({ ...answered, errorCode: failure.code });
|
|
100
|
+
throw failure;
|
|
97
101
|
}
|
|
98
102
|
if (answer.ok === true) {
|
|
99
103
|
end(answered);
|
|
@@ -106,21 +110,28 @@ export class TelegramBotTransport {
|
|
|
106
110
|
answer.description = answer.description.split(secret).join("[redacted]");
|
|
107
111
|
answer.description = answer.description.replace(/\b\d+:[A-Za-z0-9_-]{20,}\b/g, "[redacted]");
|
|
108
112
|
}
|
|
109
|
-
const refusal = refusalOf(method, answer, response.status);
|
|
113
|
+
const refusal = this.#refused(method, refusalOf(method, answer, response.status), reads);
|
|
110
114
|
end({ ...answered, errorCode: refusal.code });
|
|
111
115
|
throw refusal;
|
|
112
116
|
}
|
|
117
|
+
/** A server failure may come after a write was made; only a refusal says it was not (WC-LIFE-9). */
|
|
118
|
+
#refused(method, refusal, reads) {
|
|
119
|
+
if (reads || refusal.code !== "provider_unavailable")
|
|
120
|
+
return refusal;
|
|
121
|
+
return new CliError("outcome_unknown", `Telegram failed on ${method}; it may or may not have carried it out — check before repeating it`, { ...refusal.details, retryable: false });
|
|
122
|
+
}
|
|
113
123
|
#unanswered(method, error, reads, timeoutMs) {
|
|
114
124
|
// A proxy that refused, or was not there, never passed the request on — not an unknown outcome.
|
|
115
125
|
if (isCliError(error) && error.details.proxy !== undefined)
|
|
116
126
|
return error;
|
|
117
|
-
|
|
118
|
-
if (this.#signal?.aborted && this.#signal.reason?.name !== "TimeoutError") {
|
|
119
|
-
return new CliError("cancelled", `${method} was cancelled`, { operation: method });
|
|
120
|
-
}
|
|
127
|
+
// A cut write may have reached Telegram, and a caller told "cancelled" would send it again (WC-LIFE-9).
|
|
121
128
|
if (!reads) {
|
|
122
129
|
return new CliError("outcome_unknown", `${method} got no answer; Telegram may or may not have carried it out — check before repeating it`, { operation: method, retryable: false });
|
|
123
130
|
}
|
|
131
|
+
if (this.#signal?.aborted && this.#signal.reason?.name !== "TimeoutError") {
|
|
132
|
+
return new CliError("cancelled", `${method} was cancelled`, { operation: method });
|
|
133
|
+
}
|
|
134
|
+
const timedOut = error?.name === "TimeoutError";
|
|
124
135
|
return new CliError(timedOut ? "timeout" : "network_error", timedOut ? `${method} got no answer within ${timeoutMs} ms` : `${method} could not reach Telegram`, { operation: method, retryable: true });
|
|
125
136
|
}
|
|
126
137
|
}
|
|
@@ -136,15 +147,15 @@ const multipart = (params, files) => {
|
|
|
136
147
|
return form;
|
|
137
148
|
};
|
|
138
149
|
/**
|
|
139
|
-
*
|
|
140
|
-
*
|
|
150
|
+
* The message is ours, keyed by Telegram's code and its documented `parameters`: Telegram's `description` may quote
|
|
151
|
+
* a chat title or a user's text, so it never reaches a message (WC-SECR-6). A token Telegram cannot parse answers
|
|
152
|
+
* 404, a revoked one 401; the methods called are this code's own.
|
|
141
153
|
*/
|
|
142
154
|
const refusalOf = (method, answer, status) => {
|
|
143
|
-
const said = answer.description ?? `HTTP ${status}`;
|
|
144
155
|
const details = { operation: method, status };
|
|
145
156
|
const retryAfter = answer.parameters?.retry_after;
|
|
146
157
|
if (retryAfter !== undefined) {
|
|
147
|
-
return new CliError("rate_limited", `Telegram asks to wait ${retryAfter} s before ${method}
|
|
158
|
+
return new CliError("rate_limited", `Telegram asks to wait ${retryAfter} s before ${method}`, {
|
|
148
159
|
...details,
|
|
149
160
|
retry_after_ms: retryAfter * 1000,
|
|
150
161
|
retryable: true,
|
|
@@ -152,21 +163,22 @@ const refusalOf = (method, answer, status) => {
|
|
|
152
163
|
}
|
|
153
164
|
const migrated = answer.parameters?.migrate_to_chat_id;
|
|
154
165
|
if (migrated !== undefined) {
|
|
155
|
-
return new CliError("not_found", `this group became a supergroup with id ${migrated} — use that id from now on
|
|
166
|
+
return new CliError("not_found", `this group became a supergroup with id ${migrated} — use that id from now on`, {
|
|
167
|
+
...details,
|
|
168
|
+
migrated_chat_id: String(migrated),
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
const refused = answer.error_code ?? status;
|
|
172
|
+
if (refused === 401 || refused === 404)
|
|
173
|
+
return new CliError("authentication_error", "Telegram did not accept this bot token", details);
|
|
174
|
+
if (refused === 403) {
|
|
175
|
+
return new CliError("permission_error", `Telegram does not let this bot ${method} there — it may be blocked, not in the chat, or without the right`, details);
|
|
176
|
+
}
|
|
177
|
+
if (refused >= 500)
|
|
178
|
+
return new CliError("provider_unavailable", `Telegram failed on ${method} (${refused})`, details);
|
|
179
|
+
if (refused === 400) {
|
|
180
|
+
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);
|
|
156
181
|
}
|
|
157
|
-
|
|
158
|
-
const code = status === 401 || status === 404
|
|
159
|
-
? "authentication_error"
|
|
160
|
-
: status === 403
|
|
161
|
-
? "permission_error"
|
|
162
|
-
: status >= 500
|
|
163
|
-
? "provider_unavailable"
|
|
164
|
-
: /not found/i.test(said)
|
|
165
|
-
? "not_found"
|
|
166
|
-
: status === 400
|
|
167
|
-
? "validation_error"
|
|
168
|
-
: "provider_error";
|
|
169
|
-
const message = code === "authentication_error" ? `Telegram did not accept this bot token (${said})` : `${method}: ${said}`;
|
|
170
|
-
return new CliError(code, message, details);
|
|
182
|
+
return new CliError("provider_error", `Telegram refused ${method} (${refused})`, details);
|
|
171
183
|
};
|
|
172
184
|
//# sourceMappingURL=transport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../src/bot/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../src/bot/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAwB,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE9E,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAE5G,MAAM,GAAG,GAAG,0BAA0B,CAAA;AACtC,MAAM,kBAAkB,GAAG,MAAM,CAAA;AAuBjC;;;;;;GAMG;AACH,MAAM,OAAO,oBAAoB;IACtB,MAAM,CAAQ;IACd,QAAQ,CAAQ;IAChB,MAAM,CAAW;IACjB,UAAU,CAAQ;IAClB,OAAO,CAAyB;IAChC,OAAO,CAAuB;IAEvC,YAAY,OAA4B;QACtC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,CAAA;QAC3B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,OAAO,IAAI,GAAG,CAAA;QACtC,IAA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,wCAAwC,EAAE,OAAO,CAAC,CAAA;IAChG,IAAI,OAAO,KAAK,GAAG,EAAE,CAAC;QACpB,OAAO,IAAI,QAAQ,CACjB,kBAAkB,EAClB,kCAAkC,MAAM,mEAAmE,EAC3G,OAAO,CACR,CAAA;IACH,CAAC;IACD,IAAI,OAAO,IAAI,GAAG;QAAE,OAAO,IAAI,QAAQ,CAAC,sBAAsB,EAAE,sBAAsB,MAAM,KAAK,OAAO,GAAG,EAAE,OAAO,CAAC,CAAA;IACrH,IAAI,OAAO,KAAK,GAAG,EAAE,CAAC;QACpB,OAAO,IAAI,QAAQ,CACjB,kBAAkB,EAClB,oBAAoB,MAAM,2EAA2E,EACrG,OAAO,CACR,CAAA;IACH,CAAC;IACD,OAAO,IAAI,QAAQ,CAAC,gBAAgB,EAAE,oBAAoB,MAAM,KAAK,OAAO,GAAG,EAAE,OAAO,CAAC,CAAA;AAC3F,CAAC,CAAA"}
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
bareCheck,
|
|
8
8
|
formatMarkdown,
|
|
9
9
|
providerRequest
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-VMCQGZIA.js";
|
|
11
|
+
import "./chunk-FEKXHILZ.js";
|
|
12
12
|
import {
|
|
13
13
|
answerId,
|
|
14
14
|
attachmentsOf,
|
|
@@ -44,69 +44,69 @@ import {
|
|
|
44
44
|
toUploadParams,
|
|
45
45
|
videoMime,
|
|
46
46
|
withCause
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-RDH2QBUE.js";
|
|
48
48
|
import {
|
|
49
49
|
proxiedTransport
|
|
50
|
-
} from "./chunk-
|
|
51
|
-
import "./chunk-
|
|
52
|
-
import "./chunk-
|
|
53
|
-
import "./chunk-
|
|
54
|
-
import "./chunk-
|
|
55
|
-
import "./chunk-
|
|
56
|
-
import "./chunk-
|
|
50
|
+
} from "./chunk-NUCDEOFC.js";
|
|
51
|
+
import "./chunk-JWIUK3SK.js";
|
|
52
|
+
import "./chunk-4JDGN6OD.js";
|
|
53
|
+
import "./chunk-2XLKZL6K.js";
|
|
54
|
+
import "./chunk-3RJYLN5V.js";
|
|
55
|
+
import "./chunk-MLHKQDUN.js";
|
|
56
|
+
import "./chunk-V2T7NYNU.js";
|
|
57
57
|
import {
|
|
58
58
|
pickChat,
|
|
59
59
|
uploadBlob,
|
|
60
60
|
validateFormattedText
|
|
61
|
-
} from "./chunk-
|
|
62
|
-
import "./chunk-
|
|
63
|
-
import "./chunk-
|
|
64
|
-
import "./chunk-
|
|
61
|
+
} from "./chunk-UGPZCNYC.js";
|
|
62
|
+
import "./chunk-66FZBLRJ.js";
|
|
63
|
+
import "./chunk-G7B5UIE7.js";
|
|
64
|
+
import "./chunk-VRDVXXXD.js";
|
|
65
65
|
import "./chunk-2ABQZVK4.js";
|
|
66
|
-
import "./chunk-
|
|
66
|
+
import "./chunk-UYK5AXSW.js";
|
|
67
67
|
import {
|
|
68
68
|
currentAttempt,
|
|
69
69
|
runEvent
|
|
70
|
-
} from "./chunk-
|
|
71
|
-
import "./chunk-
|
|
72
|
-
import "./chunk-
|
|
73
|
-
import "./chunk-
|
|
74
|
-
import "./chunk-
|
|
75
|
-
import "./chunk-
|
|
76
|
-
import "./chunk-
|
|
77
|
-
import "./chunk-
|
|
78
|
-
import "./chunk-
|
|
79
|
-
import "./chunk-
|
|
80
|
-
import "./chunk-
|
|
81
|
-
import "./chunk-
|
|
70
|
+
} from "./chunk-X3CD475M.js";
|
|
71
|
+
import "./chunk-AG6HWPQP.js";
|
|
72
|
+
import "./chunk-ZPILMEFY.js";
|
|
73
|
+
import "./chunk-HORGORHK.js";
|
|
74
|
+
import "./chunk-3MQOLYAN.js";
|
|
75
|
+
import "./chunk-VW6BF6M7.js";
|
|
76
|
+
import "./chunk-M7V5XRM6.js";
|
|
77
|
+
import "./chunk-HZZGOLGP.js";
|
|
78
|
+
import "./chunk-Q7O4CQDO.js";
|
|
79
|
+
import "./chunk-FAHHERJ7.js";
|
|
80
|
+
import "./chunk-AUBRELCM.js";
|
|
81
|
+
import "./chunk-EL6I4WTB.js";
|
|
82
82
|
import {
|
|
83
83
|
observedCounters
|
|
84
|
-
} from "./chunk-
|
|
85
|
-
import "./chunk-
|
|
86
|
-
import "./chunk-
|
|
87
|
-
import "./chunk-
|
|
88
|
-
import "./chunk-
|
|
89
|
-
import "./chunk-
|
|
90
|
-
import "./chunk-
|
|
91
|
-
import "./chunk-
|
|
92
|
-
import "./chunk-
|
|
93
|
-
import "./chunk-
|
|
94
|
-
import "./chunk-
|
|
95
|
-
import "./chunk-
|
|
96
|
-
import "./chunk-
|
|
97
|
-
import "./chunk-
|
|
98
|
-
import "./chunk-
|
|
84
|
+
} from "./chunk-Z4QKLHJW.js";
|
|
85
|
+
import "./chunk-C6TUVV7E.js";
|
|
86
|
+
import "./chunk-XW5C4TI7.js";
|
|
87
|
+
import "./chunk-TG6ZYL4B.js";
|
|
88
|
+
import "./chunk-7Y3RUEVY.js";
|
|
89
|
+
import "./chunk-SQXB5ZUZ.js";
|
|
90
|
+
import "./chunk-RDSLSV4M.js";
|
|
91
|
+
import "./chunk-7NBUT62O.js";
|
|
92
|
+
import "./chunk-56Q5JV3Z.js";
|
|
93
|
+
import "./chunk-2452HCIV.js";
|
|
94
|
+
import "./chunk-KVTLT4V7.js";
|
|
95
|
+
import "./chunk-F6KBVIJP.js";
|
|
96
|
+
import "./chunk-3GRX7WP6.js";
|
|
97
|
+
import "./chunk-P3ASN72F.js";
|
|
98
|
+
import "./chunk-VOXIGICJ.js";
|
|
99
99
|
import "./chunk-D72URWJE.js";
|
|
100
|
-
import "./chunk-
|
|
101
|
-
import "./chunk-
|
|
102
|
-
import "./chunk-
|
|
103
|
-
import "./chunk-
|
|
100
|
+
import "./chunk-MP7M6FFU.js";
|
|
101
|
+
import "./chunk-EZTYJ43A.js";
|
|
102
|
+
import "./chunk-YHZFGUAP.js";
|
|
103
|
+
import "./chunk-EPCFXKTX.js";
|
|
104
104
|
import "./chunk-Y5E2WNWB.js";
|
|
105
105
|
import {
|
|
106
106
|
CliError,
|
|
107
107
|
isCliError
|
|
108
|
-
} from "./chunk-
|
|
109
|
-
import "./chunk-
|
|
108
|
+
} from "./chunk-BXTDAGM4.js";
|
|
109
|
+
import "./chunk-6HRN7BW6.js";
|
|
110
110
|
import {
|
|
111
111
|
__name
|
|
112
112
|
} from "./chunk-ZVVMGPBJ.js";
|
|
@@ -154,7 +154,8 @@ var health = /* @__PURE__ */ __name((feature) => {
|
|
|
154
154
|
});
|
|
155
155
|
}, "health");
|
|
156
156
|
var updateProfile = /* @__PURE__ */ __name((feature, { firstName, lastName, description, photo }) => {
|
|
157
|
-
|
|
157
|
+
const what = photo ? "the profile may have changed; repeating it is safe for the name and bio, but puts the photo up again" : "the profile may have changed \u2014 repeating it is safe";
|
|
158
|
+
return feature.write(what, async () => {
|
|
158
159
|
if (firstName !== void 0 || lastName !== void 0 || description !== void 0) {
|
|
159
160
|
await feature.client.updateProfile({
|
|
160
161
|
...firstName === void 0 ? {} : { firstName },
|
|
@@ -182,7 +183,7 @@ var retryDetails = /* @__PURE__ */ __name((sendId, sendAs) => ({
|
|
|
182
183
|
}), "retryDetails");
|
|
183
184
|
var unknownIfUnanswered = /* @__PURE__ */ __name((error, what, details = {}) => {
|
|
184
185
|
const known = toCliError(error, bareCheck);
|
|
185
|
-
if (known instanceof CliError && ["timeout", "network_error"].includes(known.code)) {
|
|
186
|
+
if (known instanceof CliError && ["timeout", "network_error", "provider_unavailable"].includes(known.code)) {
|
|
186
187
|
return withCause(new CliError("outcome_unknown", `no answer from Telegram \u2014 ${what}`, { ...details, reason: "write.unanswered" }), known);
|
|
187
188
|
}
|
|
188
189
|
return error;
|
|
@@ -1987,19 +1988,27 @@ var recordRequest = /* @__PURE__ */ __name(async (context, next) => {
|
|
|
1987
1988
|
end();
|
|
1988
1989
|
return answer;
|
|
1989
1990
|
}, "recordRequest");
|
|
1991
|
+
var READ = /^[a-z]+\.(get|search|check|resolve)[A-Z]/;
|
|
1992
|
+
var NOT_READ = /* @__PURE__ */ new Set(["messages.getBotCallbackAnswer", "messages.getMessagesViews"]);
|
|
1993
|
+
var isRead = /* @__PURE__ */ __name((method) => READ.test(method) && !NOT_READ.has(method), "isRead");
|
|
1994
|
+
var internalErrors = /* @__PURE__ */ __name(() => {
|
|
1995
|
+
const reads = networkMiddlewares.internalErrorsHandler({});
|
|
1996
|
+
const writes = networkMiddlewares.internalErrorsHandler({ maxRetries: 0 });
|
|
1997
|
+
return (context, next) => (isRead(context.request._) ? reads : writes)(context, next);
|
|
1998
|
+
}, "internalErrors");
|
|
1990
1999
|
var middlewaresOf = /* @__PURE__ */ __name(({ maxWait, maxRetries }, say) => [
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
}
|
|
2000
|
+
networkMiddlewares.mediaThrottle(),
|
|
2001
|
+
networkMiddlewares.floodWaiter({
|
|
2002
|
+
maxWait,
|
|
2003
|
+
maxRetries,
|
|
2004
|
+
onBeforeWait: /* @__PURE__ */ __name((context, seconds) => {
|
|
2005
|
+
const tried = tries.get(context);
|
|
2006
|
+
if (tried)
|
|
2007
|
+
tried.waitMs = seconds * 1e3;
|
|
2008
|
+
say(`Telegram asks to wait ${seconds} s before ${context.request._} \u2014 waiting, then going on`);
|
|
2009
|
+
}, "onBeforeWait")
|
|
2002
2010
|
}),
|
|
2011
|
+
internalErrors(),
|
|
2003
2012
|
// Inside the flood and internal-error waiters, so each retry they make is a line of its own.
|
|
2004
2013
|
recordRequest,
|
|
2005
2014
|
noteAcceptedSend
|
|
@@ -2,29 +2,29 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
answeredWire
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-PTIB7NEE.js";
|
|
6
6
|
import {
|
|
7
7
|
CALLER_META_KEY,
|
|
8
8
|
PROXY_CLIENT_NAME,
|
|
9
9
|
StdioServerTransport,
|
|
10
10
|
callerOf,
|
|
11
11
|
serveStdio
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-EA2PGDER.js";
|
|
13
13
|
import {
|
|
14
14
|
McpServer
|
|
15
15
|
} from "./chunk-5D4AEUVA.js";
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-ZPILMEFY.js";
|
|
17
|
+
import "./chunk-XW5C4TI7.js";
|
|
18
|
+
import "./chunk-VOXIGICJ.js";
|
|
19
|
+
import "./chunk-YHZFGUAP.js";
|
|
20
|
+
import "./chunk-EPCFXKTX.js";
|
|
21
21
|
import "./chunk-Y5E2WNWB.js";
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-BXTDAGM4.js";
|
|
23
23
|
import {
|
|
24
24
|
__name
|
|
25
25
|
} from "./chunk-ZVVMGPBJ.js";
|
|
26
26
|
|
|
27
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27
|
+
// 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/mcp/all-profiles.js
|
|
28
28
|
import { spawn } from "node:child_process";
|
|
29
29
|
import { randomUUID } from "node:crypto";
|
|
30
30
|
var PROTOCOL = "2025-06-18";
|
|
@@ -258,7 +258,7 @@ var serveAllProfilesOverStdio = /* @__PURE__ */ __name(async (options, io = {})
|
|
|
258
258
|
}, "serveAllProfilesOverStdio");
|
|
259
259
|
var serveAllProfilesOverHttp = /* @__PURE__ */ __name(async (options, http) => {
|
|
260
260
|
const { build, close } = allProfilesServer(options);
|
|
261
|
-
const { serveOverHttp } = await import("./serve-
|
|
261
|
+
const { serveOverHttp } = await import("./serve-YCPSEWP3.js");
|
|
262
262
|
const listening = await serveOverHttp(build, {
|
|
263
263
|
...http,
|
|
264
264
|
appName: options.command,
|
|
@@ -2,28 +2,28 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
checkedOptions
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-7NBUT62O.js";
|
|
6
6
|
import {
|
|
7
7
|
messagesFor,
|
|
8
8
|
systemFor
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-56Q5JV3Z.js";
|
|
10
10
|
import {
|
|
11
11
|
Anthropic
|
|
12
12
|
} from "./chunk-ADLS6FVG.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-YHZFGUAP.js";
|
|
14
14
|
import {
|
|
15
15
|
array,
|
|
16
16
|
optional,
|
|
17
17
|
strictObject,
|
|
18
18
|
string
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-EPCFXKTX.js";
|
|
20
20
|
import "./chunk-Y5E2WNWB.js";
|
|
21
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-BXTDAGM4.js";
|
|
22
22
|
import {
|
|
23
23
|
__name
|
|
24
24
|
} from "./chunk-ZVVMGPBJ.js";
|
|
25
25
|
|
|
26
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26
|
+
// 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/models/anthropic.js
|
|
27
27
|
var options = strictObject({
|
|
28
28
|
stop_sequences: optional(array(string()))
|
|
29
29
|
});
|
|
@@ -3,39 +3,39 @@ const require = __bundleRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
PER_RUN,
|
|
5
5
|
envelope
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-V47NPSSV.js";
|
|
7
7
|
import {
|
|
8
8
|
answered,
|
|
9
9
|
failed,
|
|
10
10
|
registerCommands,
|
|
11
11
|
runCommandForAgent,
|
|
12
12
|
toolsFromCommands
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-6GFUL4OU.js";
|
|
14
14
|
import {
|
|
15
15
|
mcpUrlOf
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-2XLKZL6K.js";
|
|
17
17
|
import {
|
|
18
18
|
agentJson,
|
|
19
19
|
skillResource
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-3RJYLN5V.js";
|
|
21
21
|
import {
|
|
22
22
|
appInstructions
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-GFHNQBD2.js";
|
|
24
24
|
import {
|
|
25
25
|
answeredWire
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-PTIB7NEE.js";
|
|
27
27
|
import {
|
|
28
28
|
StdioServerTransport,
|
|
29
29
|
serveStdio
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-EA2PGDER.js";
|
|
31
31
|
import {
|
|
32
32
|
McpServer
|
|
33
33
|
} from "./chunk-5D4AEUVA.js";
|
|
34
|
-
import "./chunk-
|
|
35
|
-
import "./chunk-
|
|
36
|
-
import "./chunk-
|
|
37
|
-
import "./chunk-
|
|
38
|
-
import "./chunk-
|
|
34
|
+
import "./chunk-V2T7NYNU.js";
|
|
35
|
+
import "./chunk-UGPZCNYC.js";
|
|
36
|
+
import "./chunk-66FZBLRJ.js";
|
|
37
|
+
import "./chunk-G7B5UIE7.js";
|
|
38
|
+
import "./chunk-UYK5AXSW.js";
|
|
39
39
|
import {
|
|
40
40
|
DEFAULT_OUTPUT_BYTES,
|
|
41
41
|
changesAuthorityAt,
|
|
@@ -44,50 +44,50 @@ import {
|
|
|
44
44
|
judgedTargets,
|
|
45
45
|
readsOverMcpAt,
|
|
46
46
|
rootOf2 as rootOf
|
|
47
|
-
} from "./chunk-
|
|
48
|
-
import "./chunk-
|
|
49
|
-
import "./chunk-
|
|
50
|
-
import "./chunk-
|
|
51
|
-
import "./chunk-
|
|
52
|
-
import "./chunk-
|
|
47
|
+
} from "./chunk-X3CD475M.js";
|
|
48
|
+
import "./chunk-AG6HWPQP.js";
|
|
49
|
+
import "./chunk-ZPILMEFY.js";
|
|
50
|
+
import "./chunk-3MQOLYAN.js";
|
|
51
|
+
import "./chunk-VW6BF6M7.js";
|
|
52
|
+
import "./chunk-M7V5XRM6.js";
|
|
53
53
|
import {
|
|
54
54
|
readOnlyLockOf
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-Q7O4CQDO.js";
|
|
56
56
|
import {
|
|
57
57
|
mcpHttpMarker
|
|
58
|
-
} from "./chunk-
|
|
59
|
-
import "./chunk-
|
|
60
|
-
import "./chunk-
|
|
61
|
-
import "./chunk-
|
|
62
|
-
import "./chunk-
|
|
63
|
-
import "./chunk-
|
|
64
|
-
import "./chunk-
|
|
65
|
-
import "./chunk-
|
|
66
|
-
import "./chunk-
|
|
67
|
-
import "./chunk-
|
|
68
|
-
import "./chunk-
|
|
69
|
-
import "./chunk-
|
|
70
|
-
import "./chunk-
|
|
71
|
-
import "./chunk-
|
|
72
|
-
import "./chunk-
|
|
73
|
-
import "./chunk-
|
|
58
|
+
} from "./chunk-FAHHERJ7.js";
|
|
59
|
+
import "./chunk-AUBRELCM.js";
|
|
60
|
+
import "./chunk-EL6I4WTB.js";
|
|
61
|
+
import "./chunk-Z4QKLHJW.js";
|
|
62
|
+
import "./chunk-C6TUVV7E.js";
|
|
63
|
+
import "./chunk-XW5C4TI7.js";
|
|
64
|
+
import "./chunk-TG6ZYL4B.js";
|
|
65
|
+
import "./chunk-7Y3RUEVY.js";
|
|
66
|
+
import "./chunk-RDSLSV4M.js";
|
|
67
|
+
import "./chunk-56Q5JV3Z.js";
|
|
68
|
+
import "./chunk-2452HCIV.js";
|
|
69
|
+
import "./chunk-KVTLT4V7.js";
|
|
70
|
+
import "./chunk-F6KBVIJP.js";
|
|
71
|
+
import "./chunk-3GRX7WP6.js";
|
|
72
|
+
import "./chunk-P3ASN72F.js";
|
|
73
|
+
import "./chunk-VOXIGICJ.js";
|
|
74
74
|
import "./chunk-D72URWJE.js";
|
|
75
|
-
import "./chunk-
|
|
76
|
-
import "./chunk-
|
|
77
|
-
import "./chunk-
|
|
75
|
+
import "./chunk-MP7M6FFU.js";
|
|
76
|
+
import "./chunk-EZTYJ43A.js";
|
|
77
|
+
import "./chunk-YHZFGUAP.js";
|
|
78
78
|
import {
|
|
79
79
|
mcpErrorResult
|
|
80
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-EPCFXKTX.js";
|
|
81
81
|
import "./chunk-Y5E2WNWB.js";
|
|
82
82
|
import {
|
|
83
83
|
CliError
|
|
84
|
-
} from "./chunk-
|
|
85
|
-
import "./chunk-
|
|
84
|
+
} from "./chunk-BXTDAGM4.js";
|
|
85
|
+
import "./chunk-6HRN7BW6.js";
|
|
86
86
|
import {
|
|
87
87
|
__name
|
|
88
88
|
} from "./chunk-ZVVMGPBJ.js";
|
|
89
89
|
|
|
90
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
90
|
+
// 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/mcp/app-server.js
|
|
91
91
|
var EXCLUDED = [["mcp"]];
|
|
92
92
|
var createAppServer = /* @__PURE__ */ __name((command, context, options) => {
|
|
93
93
|
const { app } = options;
|
|
@@ -187,9 +187,12 @@ var serveAppOverStdio = /* @__PURE__ */ __name(async (command, context, options)
|
|
|
187
187
|
});
|
|
188
188
|
const ended = await new Promise((resolve) => {
|
|
189
189
|
wire.ended.then(() => resolve("input"));
|
|
190
|
-
if (own)
|
|
191
|
-
signal?.
|
|
192
|
-
|
|
190
|
+
if (own) {
|
|
191
|
+
if (signal?.aborted)
|
|
192
|
+
resolve("stopped");
|
|
193
|
+
else
|
|
194
|
+
signal?.addEventListener("abort", () => resolve("stopped"), { once: true });
|
|
195
|
+
} else {
|
|
193
196
|
process.once("SIGINT", () => resolve("stopped"));
|
|
194
197
|
process.once("SIGTERM", () => resolve("stopped"));
|
|
195
198
|
}
|
|
@@ -202,7 +205,7 @@ var serveAppOverStdio = /* @__PURE__ */ __name(async (command, context, options)
|
|
|
202
205
|
var serveAppOverHttp = /* @__PURE__ */ __name(async (command, context, options, http) => {
|
|
203
206
|
const { app } = options;
|
|
204
207
|
const { build } = createAppServer(command, context, options);
|
|
205
|
-
const { serveOverHttp } = await import("./serve-
|
|
208
|
+
const { serveOverHttp } = await import("./serve-YCPSEWP3.js");
|
|
206
209
|
const listening = await serveOverHttp(build, {
|
|
207
210
|
...http,
|
|
208
211
|
appName: app.command,
|