@wirecat/tg-cli 0.101.0 → 0.103.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.
Files changed (126) hide show
  1. package/dist/bin/tg.js +31 -19
  2. package/dist/bot/transport.d.ts.map +1 -1
  3. package/dist/bot/transport.js +14 -17
  4. package/dist/bot/transport.js.map +1 -1
  5. package/dist/bundle/{adapter-A3VD4Y6Z.js → adapter-QG3YFFOY.js} +101 -38
  6. package/dist/bundle/{all-profiles-UPVNHXB2.js → all-profiles-ECXH3TBF.js} +32 -11
  7. package/dist/bundle/{anthropic-IRKNWPIB.js → anthropic-5MKO3QX7.js} +10 -10
  8. package/dist/bundle/{bot-api-UNTQG2M5.js → bot-api-4DQPIOMK.js} +55 -58
  9. package/dist/bundle/{bot-history-V4RTY5K7.js → bot-history-UN74XXLU.js} +19 -19
  10. package/dist/bundle/{bun-2JZPG2NL.js → bun-PS73VF2C.js} +5 -5
  11. package/dist/bundle/{bun-sqlite-TZHKM225.js → bun-sqlite-RAWGPH23.js} +8 -8
  12. package/dist/bundle/{chunk-ZZLKX62Z.js → chunk-2ABQZVK4.js} +3 -3
  13. package/dist/bundle/{chunk-MLLJ74LM.js → chunk-3CP7RK5R.js} +4 -4
  14. package/dist/bundle/{chunk-BXQS5RCE.js → chunk-3IXKDIPH.js} +258 -83
  15. package/dist/bundle/{chunk-W2336E7Y.js → chunk-3QX6SOEO.js} +9 -9
  16. package/dist/bundle/{chunk-F7TDFWXY.js → chunk-537O7OVE.js} +6 -6
  17. package/dist/bundle/{chunk-N5UFBWDM.js → chunk-57XGUIXA.js} +9 -11
  18. package/dist/bundle/{chunk-3KHKYYCR.js → chunk-5D4AEUVA.js} +4 -3
  19. package/dist/bundle/{chunk-ODSVNH3H.js → chunk-5HPAPVCB.js} +2415 -1292
  20. package/dist/bundle/{chunk-OEJ5DMCX.js → chunk-67SRVSPU.js} +10 -10
  21. package/dist/bundle/{chunk-XCKD54TN.js → chunk-6N25NZOE.js} +9 -9
  22. package/dist/bundle/chunk-AAMJZJYC.js +922 -0
  23. package/dist/bundle/{chunk-AVWK4NCW.js → chunk-ADLS6FVG.js} +13 -13
  24. package/dist/bundle/{chunk-ZV24I2UJ.js → chunk-AUKAZRF6.js} +5 -5
  25. package/dist/bundle/{chunk-S7ZNLLY5.js → chunk-BV4N333Y.js} +6 -6
  26. package/dist/bundle/{chunk-UN6CKIBN.js → chunk-BYYSVINK.js} +11 -8
  27. package/dist/bundle/{chunk-54R2GDQ3.js → chunk-CMQ34EZL.js} +6 -6
  28. package/dist/bundle/{chunk-G2US6LJB.js → chunk-COZ74WW4.js} +4 -4
  29. package/dist/bundle/{chunk-7BFO3DY6.js → chunk-DFDN6AUB.js} +2 -2
  30. package/dist/bundle/{chunk-VA5YEJS3.js → chunk-DLF3H6NP.js} +7 -7
  31. package/dist/bundle/{chunk-QOWSVDPZ.js → chunk-DWQ4QT6X.js} +111 -100
  32. package/dist/bundle/chunk-EMC57SOZ.js +440 -0
  33. package/dist/bundle/{chunk-RVCS7Q3A.js → chunk-EQHQ2AX3.js} +1390 -522
  34. package/dist/bundle/{chunk-64DK7S4F.js → chunk-F27OI4J2.js} +4 -4
  35. package/dist/bundle/{chunk-2XBSVRT2.js → chunk-FG2QTYEF.js} +4 -4
  36. package/dist/bundle/{chunk-BX6HH4F6.js → chunk-FSPDODVT.js} +14 -14
  37. package/dist/bundle/{chunk-4ZS73HTJ.js → chunk-G5IMOOPB.js} +4 -4
  38. package/dist/bundle/{chunk-VCGL2ETF.js → chunk-GO354DJ5.js} +4 -4
  39. package/dist/bundle/{chunk-5TPT2S2Z.js → chunk-H2UTBYFC.js} +4 -4
  40. package/dist/bundle/{chunk-U46UNBMT.js → chunk-HCDZWFXO.js} +244 -21
  41. package/dist/bundle/{chunk-TGREFJVA.js → chunk-KCVDWZWS.js} +11 -11
  42. package/dist/bundle/{chunk-PUBS2F5J.js → chunk-KQ5BUI5T.js} +248 -248
  43. package/dist/bundle/{chunk-ACGTFLEB.js → chunk-LAYPLF7G.js} +35 -282
  44. package/dist/bundle/{chunk-5KU4UQBM.js → chunk-MFS52LTZ.js} +4 -4
  45. package/dist/bundle/{chunk-DYNSP6FW.js → chunk-MHHDVR4G.js} +1449 -832
  46. package/dist/bundle/{chunk-S2JSZWEC.js → chunk-NIVZHTN4.js} +15 -15
  47. package/dist/bundle/{chunk-A5JSTZZZ.js → chunk-NKN54EDN.js} +6 -6
  48. package/dist/bundle/chunk-O5EHUB2V.js +2 -0
  49. package/dist/bundle/{chunk-5GKXETRP.js → chunk-OGVBRRWY.js} +615 -56
  50. package/dist/bundle/{chunk-VYDTI254.js → chunk-Q2LBOPKO.js} +99 -50
  51. package/dist/bundle/{chunk-LPB2MDUW.js → chunk-QF7VVIF4.js} +11 -11
  52. package/dist/bundle/{chunk-VRSN7VLO.js → chunk-RD7SSY7H.js} +4 -4
  53. package/dist/bundle/{chunk-ZEOCU24Z.js → chunk-RKQIEJFR.js} +5 -5
  54. package/dist/bundle/chunk-RMC2S3F4.js +264 -0
  55. package/dist/bundle/{chunk-2DGOFLDA.js → chunk-S5M4HFOZ.js} +6 -6
  56. package/dist/bundle/{chunk-X4Y2ROJI.js → chunk-SSALGKMJ.js} +94 -5
  57. package/dist/bundle/{chunk-G3ZRY436.js → chunk-SSV37M5T.js} +59 -59
  58. package/dist/bundle/{chunk-DG62L57H.js → chunk-T4SDOYPY.js} +20 -20
  59. package/dist/bundle/{chunk-6IPY2QRG.js → chunk-TEO2KP52.js} +5 -5
  60. package/dist/bundle/{chunk-G77QOTXE.js → chunk-TPFLD4OM.js} +5 -5
  61. package/dist/bundle/{chunk-PYTOIDSM.js → chunk-VMU4SGCE.js} +7 -7
  62. package/dist/bundle/{chunk-QYVVRQTN.js → chunk-VZN5LD26.js} +6 -6
  63. package/dist/bundle/{chunk-ZJVZXJOG.js → chunk-WAGDZB62.js} +5 -5
  64. package/dist/bundle/{chunk-7CBUCTB6.js → chunk-WULARSC4.js} +33 -39
  65. package/dist/bundle/{chunk-BJG6JA5U.js → chunk-Y5E2WNWB.js} +4 -4
  66. package/dist/bundle/{chunk-H6OXALTJ.js → chunk-YI72UVTJ.js} +5 -5
  67. package/dist/bundle/{chunk-NC5WS7OP.js → chunk-Z2DPNTSU.js} +5 -5
  68. package/dist/bundle/{chunk-RF54YDBB.js → chunk-ZHXSRYJ5.js} +6 -6
  69. package/dist/bundle/{chunk-AFV74GK3.js → chunk-ZVVMGPBJ.js} +2 -2
  70. package/dist/bundle/command-contract-ZGFJTLB2.js +32 -0
  71. package/dist/bundle/{dist-RJMT44PL.js → dist-I7OZPHAZ.js} +3 -3
  72. package/dist/bundle/{echarts-QZ6PR3VC.js → echarts-UEQDIHVQ.js} +5 -5
  73. package/dist/bundle/{embed-UBXCXSRD.js → embed-5DPZKRW5.js} +9 -8
  74. package/dist/bundle/{embedder-B4ZTKC23.js → embedder-NBQXDXAO.js} +12 -11
  75. package/dist/bundle/entry-EE6YRAP4.js +14 -0
  76. package/dist/bundle/first-run-OSEVVWNT.js +24 -0
  77. package/dist/bundle/first-screen-753THOU6.js +30 -0
  78. package/dist/bundle/identity-LNH33PN3.js +11 -0
  79. package/dist/bundle/instructions-PYGVIT7I.js +9 -0
  80. package/dist/bundle/{mcp-4Y37G2UY.js → mcp-OQBZXELQ.js} +5 -5
  81. package/dist/bundle/{node-LZZX22VR.js → node-3OBKCX6M.js} +5 -5
  82. package/dist/bundle/{node-IUL5HSYI.js → node-P4E63KXA.js} +5 -5
  83. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  84. package/dist/bundle/{node-sqlite-BPGT6T5U.js → node-sqlite-DMMTDRFB.js} +8 -8
  85. package/dist/bundle/oauth-FX5DDCRS.js +18 -0
  86. package/dist/bundle/open-G6QRQAAL.js +20 -0
  87. package/dist/bundle/{process-GPUXC4PG.js → process-47MMIFIJ.js} +5 -5
  88. package/dist/bundle/{program-NEXEAL7T.js → program-LBHBWRK5.js} +67 -71
  89. package/dist/bundle/prompt-CJ6Y4JYC.js +13 -0
  90. package/dist/bundle/proxy-transport-YSBYG26I.js +17 -0
  91. package/dist/bundle/{recognize-UJBXORVD.js → recognize-7BLTOI45.js} +9 -9
  92. package/dist/bundle/remote-Q4A4JY6U.js +27 -0
  93. package/dist/bundle/{rerank-3Y2VZM3J.js → rerank-CQAR46L3.js} +10 -9
  94. package/dist/bundle/{serve-VDZIVOPR.js → serve-2UO2YMMG.js} +13 -13
  95. package/dist/bundle/{server-BERXP4GW.js → server-6XYURULQ.js} +80 -68
  96. package/dist/bundle/{server-ZFHN4GUF.js → server-FMKC4RLL.js} +46 -41
  97. package/dist/bundle/{state-DGR4EE3E.js → state-RNWN2RDY.js} +9 -9
  98. package/dist/bundle/{store-MRCFSCZD.js → store-BBHTR477.js} +14 -14
  99. package/dist/bundle/store-maintenance-command-GD6OLRXH.js +44 -0
  100. package/dist/bundle/tg.js +8 -8
  101. package/dist/telegram/sending.d.ts.map +1 -1
  102. package/dist/telegram/sending.js +52 -3
  103. package/dist/telegram/sending.js.map +1 -1
  104. package/dist/version.d.ts +1 -1
  105. package/dist/version.js +1 -1
  106. package/package.json +4 -4
  107. package/dist/bundle/chunk-22PQUX72.js +0 -190
  108. package/dist/bundle/chunk-2SJOUK6J.js +0 -2
  109. package/dist/bundle/chunk-CJ6IYCYP.js +0 -583
  110. package/dist/bundle/chunk-NKJJJAIJ.js +0 -237
  111. package/dist/bundle/chunk-NMGO6LW6.js +0 -1950
  112. package/dist/bundle/chunk-OILBDLWL.js +0 -724
  113. package/dist/bundle/chunk-OPBTNQ35.js +0 -1007
  114. package/dist/bundle/command-contract-TKDI7E56.js +0 -31
  115. package/dist/bundle/entry-BTUTHO5M.js +0 -14
  116. package/dist/bundle/first-run-UC4HRIFV.js +0 -24
  117. package/dist/bundle/first-screen-SMCX6YKY.js +0 -29
  118. package/dist/bundle/identity-QSDEGDH7.js +0 -11
  119. package/dist/bundle/instructions-BBGLZKO3.js +0 -9
  120. package/dist/bundle/node-UPPL626U.js +0 -21
  121. package/dist/bundle/oauth-XNE2KPKJ.js +0 -18
  122. package/dist/bundle/open-SXGYZLB5.js +0 -20
  123. package/dist/bundle/prompt-SORGLEYI.js +0 -13
  124. package/dist/bundle/proxy-transport-G4MA6BGU.js +0 -17
  125. package/dist/bundle/remote-W72AR7KH.js +0 -26
  126. package/dist/bundle/store-maintenance-command-DCMZDMYS.js +0 -46
@@ -0,0 +1,264 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ wirecatDirectory
5
+ } from "./chunk-TPFLD4OM.js";
6
+ import {
7
+ CliError
8
+ } from "./chunk-67SRVSPU.js";
9
+ import {
10
+ __name
11
+ } from "./chunk-ZVVMGPBJ.js";
12
+
13
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/speech/install.js
14
+ import { createHash, randomUUID } from "node:crypto";
15
+ import { createReadStream, createWriteStream, mkdirSync, statSync } from "node:fs";
16
+ import { rename, rm } from "node:fs/promises";
17
+ import { dirname, join } from "node:path";
18
+ import { Readable, Transform } from "node:stream";
19
+ import { pipeline } from "node:stream/promises";
20
+
21
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/speech/models.js
22
+ var huggingFace = /* @__PURE__ */ __name((repository, commit) => (name) => `https://huggingface.co/csukuangfj/${repository}/resolve/${commit}/${name}`, "huggingFace");
23
+ var gigaam = huggingFace("sherpa-onnx-nemo-transducer-punct-giga-am-v3-russian-2025-12-16", "a6039be7cee829a9044a69ac0ebaf1c191217c97");
24
+ var gigaamCtc = huggingFace("sherpa-onnx-nemo-ctc-punct-giga-am-v3-russian-2025-12-16", "4fb5407ff028a69fec516cdf4c10fac9ddea7c16");
25
+ var parakeet = huggingFace("sherpa-onnx-nemo-parakeet-tdt-0.6b-v3-int8", "2bda32ec70b097a55adaa07d9a7173915b43cc78");
26
+ var MODELS = [
27
+ {
28
+ id: "gigaam-v3",
29
+ title: "GigaAM v3, with punctuation",
30
+ languages: "Russian \u2014 the best of the three for Russian",
31
+ featureDim: 64,
32
+ files: [
33
+ {
34
+ name: "encoder.int8.onnx",
35
+ url: gigaam("encoder.int8.onnx"),
36
+ sha256: "369f35a71bf288d3b8e0391fabd8dba5f2314088d440bca474056b7b4b6e66bf",
37
+ bytes: 224570820
38
+ },
39
+ {
40
+ name: "decoder.onnx",
41
+ url: gigaam("decoder.onnx"),
42
+ sha256: "38fc7475443ea2a26f63211ca350f73ac50fff824ab7a3876ee2bd610c53bbc4",
43
+ bytes: 4600132
44
+ },
45
+ {
46
+ name: "joiner.onnx",
47
+ url: gigaam("joiner.onnx"),
48
+ sha256: "602ff7017a93311aad34df1437c8d7f49911353c13d6eae7a6ee7b041339465c",
49
+ bytes: 2712896
50
+ },
51
+ {
52
+ name: "tokens.txt",
53
+ url: gigaam("tokens.txt"),
54
+ sha256: "39abae20e692998290c574e606f11a9edef2902a1995463fcff63d1490cf22b7",
55
+ bytes: 13354
56
+ }
57
+ ],
58
+ config: /* @__PURE__ */ __name((path) => ({
59
+ transducer: { encoder: path("encoder.int8.onnx"), decoder: path("decoder.onnx"), joiner: path("joiner.onnx") },
60
+ tokens: path("tokens.txt"),
61
+ modelType: "nemo_transducer"
62
+ }), "config")
63
+ },
64
+ {
65
+ id: "gigaam-v3-ctc",
66
+ title: "GigaAM v3 CTC, with punctuation \u2014 a little faster",
67
+ languages: "Russian \u2014 a little faster, rougher with capital letters",
68
+ featureDim: 64,
69
+ files: [
70
+ {
71
+ name: "model.int8.onnx",
72
+ url: gigaamCtc("model.int8.onnx"),
73
+ sha256: "d5fea8df94263c285e54b21e5774b707c707192d3bdbeffd7b1eb07fb6743b35",
74
+ bytes: 224893661
75
+ },
76
+ {
77
+ name: "tokens.txt",
78
+ url: gigaamCtc("tokens.txt"),
79
+ sha256: "142de7570b3de5b3035ce111a89c228e80e6085273731d944093ddf24fa539cd",
80
+ bytes: 2007
81
+ }
82
+ ],
83
+ config: /* @__PURE__ */ __name((path) => ({ nemoCtc: { model: path("model.int8.onnx") }, tokens: path("tokens.txt") }), "config")
84
+ },
85
+ {
86
+ id: "parakeet-v3",
87
+ title: "NVIDIA Parakeet TDT 0.6B v3",
88
+ /** The model card's list: huggingface.co/nvidia/parakeet-tdt-0.6b-v3, read 2026-09-24. */
89
+ languages: "25: bg cs da de el en es et fi fr hr hu it lt lv mt nl pl pt ro ru sk sl sv uk",
90
+ featureDim: 80,
91
+ files: [
92
+ {
93
+ name: "encoder.int8.onnx",
94
+ url: parakeet("encoder.int8.onnx"),
95
+ sha256: "acfc2b4456377e15d04f0243af540b7fe7c992f8d898d751cf134c3a55fd2247",
96
+ bytes: 652184281
97
+ },
98
+ {
99
+ name: "decoder.int8.onnx",
100
+ url: parakeet("decoder.int8.onnx"),
101
+ sha256: "179e50c43d1a9de79c8a24149a2f9bac6eb5981823f2a2ed88d655b24248db4e",
102
+ bytes: 11845275
103
+ },
104
+ {
105
+ name: "joiner.int8.onnx",
106
+ url: parakeet("joiner.int8.onnx"),
107
+ sha256: "3164c13fc2821009440d20fcb5fdc78bff28b4db2f8d0f0b329101719c0948b3",
108
+ bytes: 6355277
109
+ },
110
+ {
111
+ name: "tokens.txt",
112
+ url: parakeet("tokens.txt"),
113
+ sha256: "d58544679ea4bc6ac563d1f545eb7d474bd6cfa467f0a6e2c1dc1c7d37e3c35d",
114
+ bytes: 93939
115
+ }
116
+ ],
117
+ config: /* @__PURE__ */ __name((path) => ({
118
+ transducer: {
119
+ encoder: path("encoder.int8.onnx"),
120
+ decoder: path("decoder.int8.onnx"),
121
+ joiner: path("joiner.int8.onnx")
122
+ },
123
+ tokens: path("tokens.txt"),
124
+ modelType: "nemo_transducer"
125
+ }), "config")
126
+ }
127
+ ];
128
+ var VAD = {
129
+ name: "silero_vad.onnx",
130
+ url: "https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/silero_vad.onnx",
131
+ sha256: "9e2449e1087496d8d4caba907f23e0bd3f78d91fa552479bb9c23ac09cbb1fd6",
132
+ bytes: 643854
133
+ };
134
+ var DEFAULT_ORDER = ["parakeet-v3", "gigaam-v3", "gigaam-v3-ctc"];
135
+ var orderedModels = /* @__PURE__ */ __name((order = DEFAULT_ORDER) => [.../* @__PURE__ */ new Set([...order, ...DEFAULT_ORDER])].map(speechModel), "orderedModels");
136
+ var findModel = /* @__PURE__ */ __name((id) => MODELS.find((model) => model.id === id), "findModel");
137
+ var speechModel = /* @__PURE__ */ __name((id) => {
138
+ const model = findModel(id);
139
+ if (!model) {
140
+ throw new CliError("validation_error", `no speech model "${id}" \u2014 one of ${MODELS.map((known) => known.id).join(", ")}`);
141
+ }
142
+ return model;
143
+ }, "speechModel");
144
+
145
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/speech/install.js
146
+ var sharedModelsDirectory = /* @__PURE__ */ __name((kind, env = process.env) => join(wirecatDirectory(env), "models", kind), "sharedModelsDirectory");
147
+ var modelsDirectory = /* @__PURE__ */ __name((env = process.env) => sharedModelsDirectory("audio", env), "modelsDirectory");
148
+ var STALL_MS = 6e4;
149
+ var watchdog = /* @__PURE__ */ __name((ms) => {
150
+ const controller = new AbortController();
151
+ let timer = setTimeout(() => controller.abort(), ms);
152
+ return {
153
+ signal: controller.signal,
154
+ poke: /* @__PURE__ */ __name(() => {
155
+ clearTimeout(timer);
156
+ timer = setTimeout(() => controller.abort(), ms);
157
+ }, "poke"),
158
+ stop: /* @__PURE__ */ __name(() => clearTimeout(timer), "stop")
159
+ };
160
+ }, "watchdog");
161
+ var modelPath = /* @__PURE__ */ __name((directory, model) => (name) => join(directory, model.id, name), "modelPath");
162
+ var vadPath = /* @__PURE__ */ __name((directory) => join(directory, VAD.name), "vadPath");
163
+ var placed = /* @__PURE__ */ __name((model, directory) => [
164
+ ...model.files.map((file) => [file, modelPath(directory, model)(file.name)]),
165
+ [VAD, vadPath(directory)]
166
+ ], "placed");
167
+ var isInstalled = /* @__PURE__ */ __name((model, directory) => filesPresent(placed(model, directory)), "isInstalled");
168
+ var filesPresent = /* @__PURE__ */ __name((files) => files.every(([file, path]) => sizeOf(path) === file.bytes), "filesPresent");
169
+ var sizeOf = /* @__PURE__ */ __name((path) => {
170
+ try {
171
+ return statSync(path).size;
172
+ } catch {
173
+ return void 0;
174
+ }
175
+ }, "sizeOf");
176
+ var installedBytes = /* @__PURE__ */ __name((model) => model.files.reduce((sum, file) => sum + file.bytes, 0), "installedBytes");
177
+ var install = /* @__PURE__ */ __name(async (model, directory, { fetch: get = fetch, progress, verifyExisting } = {}) => {
178
+ mkdirSync(join(directory, model.id), { recursive: true, mode: 448 });
179
+ await installFiles(placed(model, directory), { fetch: get, progress, verifyExisting });
180
+ }, "install");
181
+ var installFiles = /* @__PURE__ */ __name(async (files, { fetch: get = fetch, progress, verifyExisting } = {}) => {
182
+ if (verifyExisting)
183
+ for (const [file, path] of files) {
184
+ if (sizeOf(path) !== void 0) {
185
+ const hash = createHash("sha256");
186
+ for await (const chunk of createReadStream(path))
187
+ hash.update(chunk);
188
+ if (hash.digest("hex") !== file.sha256) {
189
+ progress?.(`${path}: not the file this version expects, downloading it again`);
190
+ await rm(path, { force: true });
191
+ }
192
+ }
193
+ }
194
+ for (const [file, path] of files) {
195
+ if (sizeOf(path) === file.bytes)
196
+ continue;
197
+ mkdirSync(dirname(path), { recursive: true, mode: 448 });
198
+ progress?.(`downloading ${file.name} (${megabytes(file.bytes)})`);
199
+ await fetchVerified(file, path, get);
200
+ }
201
+ }, "installFiles");
202
+ var fetchVerified = /* @__PURE__ */ __name(async (file, path, get) => {
203
+ const stalled = watchdog(STALL_MS);
204
+ try {
205
+ await fetchInto(file, path, get, stalled);
206
+ } catch (error) {
207
+ if (stalled.signal.aborted) {
208
+ throw new CliError("timeout", `${file.name} stopped downloading for ${STALL_MS / 1e3} s \u2014 nothing was installed`);
209
+ }
210
+ throw error;
211
+ } finally {
212
+ stalled.stop();
213
+ }
214
+ }, "fetchVerified");
215
+ var fetchInto = /* @__PURE__ */ __name(async (file, path, get, stalled) => {
216
+ const response = await get(file.url, { signal: stalled.signal });
217
+ if (!response.ok || !response.body) {
218
+ await response.body?.cancel();
219
+ throw new CliError("network_error", `${file.name} could not be downloaded: HTTP ${response.status}`);
220
+ }
221
+ const partial = `${path}.${randomUUID()}.part`;
222
+ const hash = createHash("sha256");
223
+ let bytes = 0;
224
+ const hashing = new Transform({
225
+ transform(chunk, _encoding, done) {
226
+ stalled.poke();
227
+ bytes += chunk.length;
228
+ if (bytes > file.bytes) {
229
+ done(new CliError("invalid_response", `${file.name} is larger than this version expects \u2014 nothing was installed`));
230
+ return;
231
+ }
232
+ hash.update(chunk);
233
+ done(null, chunk);
234
+ }
235
+ });
236
+ try {
237
+ await pipeline(Readable.fromWeb(response.body), hashing, createWriteStream(partial, { flags: "wx", mode: 384 }));
238
+ const actual = hash.digest("hex");
239
+ if (actual !== file.sha256) {
240
+ throw new CliError("invalid_response", `${file.name} is not the file this version expects (sha256 ${actual}) \u2014 nothing was installed`);
241
+ }
242
+ await rename(partial, path);
243
+ } finally {
244
+ await rm(partial, { force: true });
245
+ }
246
+ }, "fetchInto");
247
+ var megabytes = /* @__PURE__ */ __name((bytes) => bytes < 1e6 ? "under 1 MB" : `${Math.round(bytes / 1e6)} MB`, "megabytes");
248
+
249
+ export {
250
+ VAD,
251
+ DEFAULT_ORDER,
252
+ orderedModels,
253
+ speechModel,
254
+ sharedModelsDirectory,
255
+ modelsDirectory,
256
+ modelPath,
257
+ vadPath,
258
+ isInstalled,
259
+ filesPresent,
260
+ installedBytes,
261
+ install,
262
+ installFiles,
263
+ megabytes
264
+ };
@@ -1,16 +1,16 @@
1
- import { createRequire as __tgRequire } from "node:module";
2
- const require = __tgRequire(import.meta.url);
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  CliError
5
- } from "./chunk-OEJ5DMCX.js";
5
+ } from "./chunk-67SRVSPU.js";
6
6
  import {
7
7
  importFrom
8
- } from "./chunk-BJG6JA5U.js";
8
+ } from "./chunk-Y5E2WNWB.js";
9
9
  import {
10
10
  __name
11
- } from "./chunk-AFV74GK3.js";
11
+ } from "./chunk-ZVVMGPBJ.js";
12
12
 
13
- // node_modules/.pnpm/@wirecat+cli-core@0.466.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._f7e4048410ccbe1e801fd184c043d197/node_modules/@wirecat/cli-core/dist/store/vector-extension.js
13
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/store/vector-extension.js
14
14
  import { readFileSync } from "node:fs";
15
15
  var musl = /* @__PURE__ */ __name(() => {
16
16
  if (process.platform !== "linux")
@@ -1,6 +1,7 @@
1
- import { createRequire as __tgRequire } from "node:module";
2
- const require = __tgRequire(import.meta.url);
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
+ CLIENT_INFO_META_KEY,
4
5
  DEFAULT_MAX_SUBSCRIPTIONS,
5
6
  McpServer,
6
7
  ProtocolErrorCode,
@@ -23,10 +24,14 @@ import {
23
24
  serverIdentityOf,
24
25
  setNegotiatedProtocolVersion,
25
26
  validateEnvelopeMeta
26
- } from "./chunk-3KHKYYCR.js";
27
+ } from "./chunk-5D4AEUVA.js";
28
+ import {
29
+ agentOf,
30
+ clientHash
31
+ } from "./chunk-EMC57SOZ.js";
27
32
  import {
28
33
  __name
29
- } from "./chunk-AFV74GK3.js";
34
+ } from "./chunk-ZVVMGPBJ.js";
30
35
 
31
36
  // node_modules/.pnpm/@modelcontextprotocol+server@2.4.0/node_modules/@modelcontextprotocol/server/dist/stdio.mjs
32
37
  var swallowsErrorsAfterClose = /* @__PURE__ */ Symbol("swallowsErrorsAfterClose");
@@ -535,7 +540,91 @@ function toError(value) {
535
540
  }
536
541
  __name(toError, "toError");
537
542
 
543
+ // node_modules/.pnpm/@wirecat+cli-core@0.469.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._2a6ca8de460e41c79b470c9aa59440d5/node_modules/@wirecat/cli-core/dist/mcp/caller.js
544
+ var CALLER_META_KEY = "wirecat.dev/caller";
545
+ var PROXY_CLIENT_NAME = "all-profiles";
546
+ var NAME = /^[\w .@()/+-]{1,64}$/;
547
+ var plain = /* @__PURE__ */ __name((value) => typeof value === "string" && NAME.test(value.trim()) ? value.trim() : void 0, "plain");
548
+ var clientFrom = /* @__PURE__ */ __name((value) => {
549
+ if (!value || typeof value !== "object")
550
+ return void 0;
551
+ const { name, version } = value;
552
+ const named = plain(name);
553
+ if (!named)
554
+ return void 0;
555
+ const versioned = plain(version);
556
+ return { name: named, ...versioned ? { version: versioned } : {} };
557
+ }, "clientFrom");
558
+ var callerOf = /* @__PURE__ */ __name((ctx, tool, source) => {
559
+ const meta = ctx?.mcpReq?._meta;
560
+ const requestId = ctx?.mcpReq?.id;
561
+ const initialized = source.client?.();
562
+ const proxied = initialized?.name === PROXY_CLIENT_NAME ? passedOn(meta?.[CALLER_META_KEY], tool) : void 0;
563
+ if (proxied)
564
+ return proxied;
565
+ const client = clientFrom(meta?.[CLIENT_INFO_META_KEY]) ?? clientFrom(initialized);
566
+ const mcp = /* @__PURE__ */ __name((connection) => ({
567
+ tool,
568
+ ...requestId === void 0 ? {} : { request_id: String(requestId) },
569
+ ...connection ? { connection_id: connection } : {}
570
+ }), "mcp");
571
+ const auth = ctx?.http?.authInfo;
572
+ if (auth) {
573
+ const registered = plain(auth.extra?.clientName);
574
+ return {
575
+ via: "mcp-http",
576
+ agent: {
577
+ kind: "mcp-client",
578
+ session_id: ctx?.sessionId ?? null,
579
+ client: {
580
+ name: registered ?? client?.name ?? "unknown",
581
+ ...client?.version ? { version: client.version } : {},
582
+ id: clientHash(auth.clientId)
583
+ }
584
+ },
585
+ mcp: mcp(ctx?.sessionId)
586
+ };
587
+ }
588
+ const agent = agentOf(source.env) ?? { kind: "mcp-client", session_id: null };
589
+ return { via: "mcp-stdio", agent: { ...agent, ...client ? { client } : {} }, mcp: mcp(source.connectionId) };
590
+ }, "callerOf");
591
+ var passedOn = /* @__PURE__ */ __name((value, tool) => {
592
+ if (!value || typeof value !== "object")
593
+ return void 0;
594
+ const { via, agent, mcp } = value;
595
+ if (via !== "mcp-stdio" && via !== "mcp-http")
596
+ return void 0;
597
+ const a = agent && typeof agent === "object" ? agent : void 0;
598
+ const kind = plain(a?.kind);
599
+ const session = typeof a?.session_id === "string" && /^[A-Za-z0-9._:-]{1,128}$/.test(a.session_id) ? a.session_id : null;
600
+ const client = clientFrom(a?.client);
601
+ const id = a?.client && typeof a.client === "object" ? a.client.id : void 0;
602
+ const m = mcp && typeof mcp === "object" ? mcp : {};
603
+ const request = plain(m.request_id);
604
+ const connection = typeof m.connection_id === "string" && /^[\w-]{1,128}$/.test(m.connection_id) ? m.connection_id : void 0;
605
+ return {
606
+ via,
607
+ ...kind ? {
608
+ agent: {
609
+ kind,
610
+ session_id: session,
611
+ ...a?.from_chat === true ? { from_chat: true } : {},
612
+ ...client ? { client: { ...client, ...typeof id === "string" && /^[0-9a-f]{8}$/.test(id) ? { id } : {} } } : {}
613
+ }
614
+ } : {},
615
+ mcp: {
616
+ tool,
617
+ ...request ? { request_id: request } : {},
618
+ ...connection ? { connection_id: connection } : {},
619
+ proxied: true
620
+ }
621
+ };
622
+ }, "passedOn");
623
+
538
624
  export {
539
625
  StdioServerTransport,
540
- serveStdio
626
+ serveStdio,
627
+ CALLER_META_KEY,
628
+ PROXY_CLIENT_NAME,
629
+ callerOf
541
630
  };