@wirecat/tg-cli 0.102.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 (114) hide show
  1. package/dist/bin/tg.js +31 -19
  2. package/dist/bundle/{adapter-M2HRSFFL.js → adapter-QG3YFFOY.js} +49 -48
  3. package/dist/bundle/{all-profiles-GOD2QNTK.js → all-profiles-ECXH3TBF.js} +13 -13
  4. package/dist/bundle/{anthropic-LKU7RWMA.js → anthropic-5MKO3QX7.js} +10 -10
  5. package/dist/bundle/{bot-api-X3MPFVPL.js → bot-api-4DQPIOMK.js} +50 -49
  6. package/dist/bundle/{bot-history-OUMVVG22.js → bot-history-UN74XXLU.js} +19 -19
  7. package/dist/bundle/{bun-LIZ6MKFS.js → bun-PS73VF2C.js} +5 -5
  8. package/dist/bundle/{bun-sqlite-2IFQYQ44.js → bun-sqlite-RAWGPH23.js} +8 -8
  9. package/dist/bundle/{chunk-ZZLKX62Z.js → chunk-2ABQZVK4.js} +3 -3
  10. package/dist/bundle/{chunk-5D6OJREA.js → chunk-3CP7RK5R.js} +4 -4
  11. package/dist/bundle/{chunk-QL7CQ6VZ.js → chunk-3IXKDIPH.js} +48 -48
  12. package/dist/bundle/{chunk-F2TG3BA2.js → chunk-3QX6SOEO.js} +9 -9
  13. package/dist/bundle/{chunk-MGG7JSNO.js → chunk-537O7OVE.js} +6 -6
  14. package/dist/bundle/{chunk-M5UH5CF3.js → chunk-57XGUIXA.js} +8 -8
  15. package/dist/bundle/{chunk-WMOEOVWZ.js → chunk-5D4AEUVA.js} +3 -3
  16. package/dist/bundle/{chunk-ENE5CSVY.js → chunk-5HPAPVCB.js} +276 -260
  17. package/dist/bundle/{chunk-OEJ5DMCX.js → chunk-67SRVSPU.js} +10 -10
  18. package/dist/bundle/{chunk-CLWYQNSC.js → chunk-6N25NZOE.js} +9 -9
  19. package/dist/bundle/{chunk-4QB4WDLT.js → chunk-AAMJZJYC.js} +15 -15
  20. package/dist/bundle/{chunk-AVWK4NCW.js → chunk-ADLS6FVG.js} +13 -13
  21. package/dist/bundle/{chunk-2SUTCDGO.js → chunk-AUKAZRF6.js} +5 -5
  22. package/dist/bundle/{chunk-OHBHHBYL.js → chunk-BV4N333Y.js} +6 -6
  23. package/dist/bundle/{chunk-UR6ASUSG.js → chunk-BYYSVINK.js} +6 -6
  24. package/dist/bundle/{chunk-Y4XSWI22.js → chunk-CMQ34EZL.js} +6 -6
  25. package/dist/bundle/{chunk-ERQDBK5I.js → chunk-COZ74WW4.js} +4 -4
  26. package/dist/bundle/{chunk-7BFO3DY6.js → chunk-DFDN6AUB.js} +2 -2
  27. package/dist/bundle/{chunk-264DAFJV.js → chunk-DLF3H6NP.js} +7 -7
  28. package/dist/bundle/{chunk-BQYTIYGB.js → chunk-DWQ4QT6X.js} +96 -96
  29. package/dist/bundle/{chunk-DE7LFMY2.js → chunk-EMC57SOZ.js} +11 -11
  30. package/dist/bundle/{chunk-GSKFAE3I.js → chunk-EQHQ2AX3.js} +148 -55
  31. package/dist/bundle/{chunk-XXTJUZMB.js → chunk-F27OI4J2.js} +4 -4
  32. package/dist/bundle/{chunk-2XBSVRT2.js → chunk-FG2QTYEF.js} +4 -4
  33. package/dist/bundle/{chunk-334UBWOB.js → chunk-FSPDODVT.js} +14 -14
  34. package/dist/bundle/{chunk-YHB57PFN.js → chunk-G5IMOOPB.js} +4 -4
  35. package/dist/bundle/{chunk-AUOXTGTU.js → chunk-GO354DJ5.js} +4 -4
  36. package/dist/bundle/{chunk-FOUE7XLK.js → chunk-H2UTBYFC.js} +4 -4
  37. package/dist/bundle/{chunk-V52SBQYF.js → chunk-HCDZWFXO.js} +17 -17
  38. package/dist/bundle/{chunk-5VSR5ENL.js → chunk-KCVDWZWS.js} +11 -11
  39. package/dist/bundle/{chunk-TV5DGHBT.js → chunk-KQ5BUI5T.js} +248 -248
  40. package/dist/bundle/{chunk-U4RRZUNP.js → chunk-LAYPLF7G.js} +35 -282
  41. package/dist/bundle/{chunk-5KU4UQBM.js → chunk-MFS52LTZ.js} +4 -4
  42. package/dist/bundle/{chunk-FBWOQMPE.js → chunk-MHHDVR4G.js} +227 -283
  43. package/dist/bundle/{chunk-VUJ34PEQ.js → chunk-NIVZHTN4.js} +15 -15
  44. package/dist/bundle/{chunk-JFSVXMN6.js → chunk-NKN54EDN.js} +6 -6
  45. package/dist/bundle/chunk-O5EHUB2V.js +2 -0
  46. package/dist/bundle/{chunk-PSH7K6TL.js → chunk-OGVBRRWY.js} +25 -25
  47. package/dist/bundle/{chunk-Q2NYEX4A.js → chunk-Q2LBOPKO.js} +57 -27
  48. package/dist/bundle/{chunk-UK3GAN7Q.js → chunk-QF7VVIF4.js} +11 -11
  49. package/dist/bundle/{chunk-WVEHUKCZ.js → chunk-RD7SSY7H.js} +4 -4
  50. package/dist/bundle/{chunk-TXBUDJ3P.js → chunk-RKQIEJFR.js} +5 -5
  51. package/dist/bundle/chunk-RMC2S3F4.js +264 -0
  52. package/dist/bundle/{chunk-4PDEQL6T.js → chunk-S5M4HFOZ.js} +6 -6
  53. package/dist/bundle/{chunk-BBC546ZA.js → chunk-SSALGKMJ.js} +6 -6
  54. package/dist/bundle/{chunk-QEPZUFPL.js → chunk-SSV37M5T.js} +59 -59
  55. package/dist/bundle/{chunk-DG62L57H.js → chunk-T4SDOYPY.js} +20 -20
  56. package/dist/bundle/{chunk-HLAZ65AW.js → chunk-TEO2KP52.js} +5 -5
  57. package/dist/bundle/{chunk-ZRNRQFTF.js → chunk-TPFLD4OM.js} +5 -5
  58. package/dist/bundle/{chunk-PYTOIDSM.js → chunk-VMU4SGCE.js} +7 -7
  59. package/dist/bundle/{chunk-W5EB4JLV.js → chunk-VZN5LD26.js} +6 -6
  60. package/dist/bundle/{chunk-ZJVZXJOG.js → chunk-WAGDZB62.js} +5 -5
  61. package/dist/bundle/{chunk-CRZPQQHE.js → chunk-WULARSC4.js} +26 -26
  62. package/dist/bundle/{chunk-BJG6JA5U.js → chunk-Y5E2WNWB.js} +4 -4
  63. package/dist/bundle/{chunk-OCWARAFE.js → chunk-YI72UVTJ.js} +5 -5
  64. package/dist/bundle/{chunk-SRU3OF4R.js → chunk-Z2DPNTSU.js} +5 -5
  65. package/dist/bundle/{chunk-5DFGJPT6.js → chunk-ZHXSRYJ5.js} +6 -6
  66. package/dist/bundle/{chunk-AFV74GK3.js → chunk-ZVVMGPBJ.js} +2 -2
  67. package/dist/bundle/command-contract-ZGFJTLB2.js +32 -0
  68. package/dist/bundle/{dist-RJMT44PL.js → dist-I7OZPHAZ.js} +3 -3
  69. package/dist/bundle/{echarts-27W2CIBD.js → echarts-UEQDIHVQ.js} +5 -5
  70. package/dist/bundle/{embed-FGJ273X2.js → embed-5DPZKRW5.js} +9 -8
  71. package/dist/bundle/{embedder-7ELL3CQ3.js → embedder-NBQXDXAO.js} +12 -11
  72. package/dist/bundle/entry-EE6YRAP4.js +14 -0
  73. package/dist/bundle/first-run-OSEVVWNT.js +24 -0
  74. package/dist/bundle/first-screen-753THOU6.js +30 -0
  75. package/dist/bundle/identity-LNH33PN3.js +11 -0
  76. package/dist/bundle/instructions-PYGVIT7I.js +9 -0
  77. package/dist/bundle/{mcp-4Y37G2UY.js → mcp-OQBZXELQ.js} +5 -5
  78. package/dist/bundle/{node-RSL3HANO.js → node-3OBKCX6M.js} +5 -5
  79. package/dist/bundle/{node-IUL5HSYI.js → node-P4E63KXA.js} +5 -5
  80. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  81. package/dist/bundle/{node-sqlite-7R3PYQGJ.js → node-sqlite-DMMTDRFB.js} +8 -8
  82. package/dist/bundle/oauth-FX5DDCRS.js +18 -0
  83. package/dist/bundle/open-G6QRQAAL.js +20 -0
  84. package/dist/bundle/{process-RMV3AKLB.js → process-47MMIFIJ.js} +5 -5
  85. package/dist/bundle/{program-PIUYQHBF.js → program-LBHBWRK5.js} +52 -51
  86. package/dist/bundle/prompt-CJ6Y4JYC.js +13 -0
  87. package/dist/bundle/proxy-transport-YSBYG26I.js +17 -0
  88. package/dist/bundle/{recognize-3GMOLZF4.js → recognize-7BLTOI45.js} +9 -9
  89. package/dist/bundle/remote-Q4A4JY6U.js +27 -0
  90. package/dist/bundle/{rerank-W3OSXXBN.js → rerank-CQAR46L3.js} +10 -9
  91. package/dist/bundle/{serve-ZCPO44NO.js → serve-2UO2YMMG.js} +13 -13
  92. package/dist/bundle/{server-YWL4HDOP.js → server-6XYURULQ.js} +53 -50
  93. package/dist/bundle/{server-FXU4QFRB.js → server-FMKC4RLL.js} +37 -35
  94. package/dist/bundle/{state-MJPTDIB5.js → state-RNWN2RDY.js} +9 -9
  95. package/dist/bundle/{store-6VNQG56O.js → store-BBHTR477.js} +14 -14
  96. package/dist/bundle/store-maintenance-command-GD6OLRXH.js +44 -0
  97. package/dist/bundle/tg.js +8 -8
  98. package/dist/version.d.ts +1 -1
  99. package/dist/version.js +1 -1
  100. package/package.json +4 -4
  101. package/dist/bundle/chunk-2SJOUK6J.js +0 -2
  102. package/dist/bundle/command-contract-A6VZN3ZR.js +0 -31
  103. package/dist/bundle/entry-SEE5YWIX.js +0 -14
  104. package/dist/bundle/first-run-BD7FEC3W.js +0 -24
  105. package/dist/bundle/first-screen-ASZV6LSA.js +0 -29
  106. package/dist/bundle/identity-QR4F42T6.js +0 -11
  107. package/dist/bundle/instructions-L74K64PV.js +0 -9
  108. package/dist/bundle/node-UPPL626U.js +0 -21
  109. package/dist/bundle/oauth-4ESGXF6U.js +0 -18
  110. package/dist/bundle/open-DFYEUGTA.js +0 -20
  111. package/dist/bundle/prompt-H7GYQQLL.js +0 -13
  112. package/dist/bundle/proxy-transport-G4MA6BGU.js +0 -17
  113. package/dist/bundle/remote-IRWTCI2B.js +0 -26
  114. package/dist/bundle/store-maintenance-command-62TQTMER.js +0 -43
@@ -1,263 +1,30 @@
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
- wirecatDirectory
5
- } from "./chunk-ZRNRQFTF.js";
4
+ filesPresent,
5
+ installFiles,
6
+ megabytes,
7
+ sharedModelsDirectory
8
+ } from "./chunk-RMC2S3F4.js";
6
9
  import {
7
10
  CliError
8
- } from "./chunk-OEJ5DMCX.js";
11
+ } from "./chunk-67SRVSPU.js";
9
12
  import {
10
13
  importFrom
11
- } from "./chunk-BJG6JA5U.js";
14
+ } from "./chunk-Y5E2WNWB.js";
12
15
  import {
13
16
  __name
14
- } from "./chunk-AFV74GK3.js";
17
+ } from "./chunk-ZVVMGPBJ.js";
15
18
 
16
- // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/embeddings/embed.js
19
+ // 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/embeddings/embed.js
17
20
  import { readFileSync as readFileSync2 } from "node:fs";
18
21
  import { availableParallelism } from "node:os";
19
- import { basename, join as join3 } from "node:path";
20
-
21
- // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/speech/install.js
22
- import { createHash, randomUUID } from "node:crypto";
23
- import { createReadStream, createWriteStream, mkdirSync, statSync } from "node:fs";
24
- import { rename, rm } from "node:fs/promises";
25
- import { dirname, join } from "node:path";
26
- import { Readable, Transform } from "node:stream";
27
- import { pipeline } from "node:stream/promises";
28
-
29
- // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/speech/models.js
30
- var huggingFace = /* @__PURE__ */ __name((repository, commit) => (name) => `https://huggingface.co/csukuangfj/${repository}/resolve/${commit}/${name}`, "huggingFace");
31
- var gigaam = huggingFace("sherpa-onnx-nemo-transducer-punct-giga-am-v3-russian-2025-12-16", "a6039be7cee829a9044a69ac0ebaf1c191217c97");
32
- var gigaamCtc = huggingFace("sherpa-onnx-nemo-ctc-punct-giga-am-v3-russian-2025-12-16", "4fb5407ff028a69fec516cdf4c10fac9ddea7c16");
33
- var parakeet = huggingFace("sherpa-onnx-nemo-parakeet-tdt-0.6b-v3-int8", "2bda32ec70b097a55adaa07d9a7173915b43cc78");
34
- var MODELS = [
35
- {
36
- id: "gigaam-v3",
37
- title: "GigaAM v3, with punctuation",
38
- languages: "Russian \u2014 the best of the three for Russian",
39
- featureDim: 64,
40
- files: [
41
- {
42
- name: "encoder.int8.onnx",
43
- url: gigaam("encoder.int8.onnx"),
44
- sha256: "369f35a71bf288d3b8e0391fabd8dba5f2314088d440bca474056b7b4b6e66bf",
45
- bytes: 224570820
46
- },
47
- {
48
- name: "decoder.onnx",
49
- url: gigaam("decoder.onnx"),
50
- sha256: "38fc7475443ea2a26f63211ca350f73ac50fff824ab7a3876ee2bd610c53bbc4",
51
- bytes: 4600132
52
- },
53
- {
54
- name: "joiner.onnx",
55
- url: gigaam("joiner.onnx"),
56
- sha256: "602ff7017a93311aad34df1437c8d7f49911353c13d6eae7a6ee7b041339465c",
57
- bytes: 2712896
58
- },
59
- {
60
- name: "tokens.txt",
61
- url: gigaam("tokens.txt"),
62
- sha256: "39abae20e692998290c574e606f11a9edef2902a1995463fcff63d1490cf22b7",
63
- bytes: 13354
64
- }
65
- ],
66
- config: /* @__PURE__ */ __name((path) => ({
67
- transducer: { encoder: path("encoder.int8.onnx"), decoder: path("decoder.onnx"), joiner: path("joiner.onnx") },
68
- tokens: path("tokens.txt"),
69
- modelType: "nemo_transducer"
70
- }), "config")
71
- },
72
- {
73
- id: "gigaam-v3-ctc",
74
- title: "GigaAM v3 CTC, with punctuation \u2014 a little faster",
75
- languages: "Russian \u2014 a little faster, rougher with capital letters",
76
- featureDim: 64,
77
- files: [
78
- {
79
- name: "model.int8.onnx",
80
- url: gigaamCtc("model.int8.onnx"),
81
- sha256: "d5fea8df94263c285e54b21e5774b707c707192d3bdbeffd7b1eb07fb6743b35",
82
- bytes: 224893661
83
- },
84
- {
85
- name: "tokens.txt",
86
- url: gigaamCtc("tokens.txt"),
87
- sha256: "142de7570b3de5b3035ce111a89c228e80e6085273731d944093ddf24fa539cd",
88
- bytes: 2007
89
- }
90
- ],
91
- config: /* @__PURE__ */ __name((path) => ({ nemoCtc: { model: path("model.int8.onnx") }, tokens: path("tokens.txt") }), "config")
92
- },
93
- {
94
- id: "parakeet-v3",
95
- title: "NVIDIA Parakeet TDT 0.6B v3",
96
- /** The model card's list: huggingface.co/nvidia/parakeet-tdt-0.6b-v3, read 2026-09-24. */
97
- 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",
98
- featureDim: 80,
99
- files: [
100
- {
101
- name: "encoder.int8.onnx",
102
- url: parakeet("encoder.int8.onnx"),
103
- sha256: "acfc2b4456377e15d04f0243af540b7fe7c992f8d898d751cf134c3a55fd2247",
104
- bytes: 652184281
105
- },
106
- {
107
- name: "decoder.int8.onnx",
108
- url: parakeet("decoder.int8.onnx"),
109
- sha256: "179e50c43d1a9de79c8a24149a2f9bac6eb5981823f2a2ed88d655b24248db4e",
110
- bytes: 11845275
111
- },
112
- {
113
- name: "joiner.int8.onnx",
114
- url: parakeet("joiner.int8.onnx"),
115
- sha256: "3164c13fc2821009440d20fcb5fdc78bff28b4db2f8d0f0b329101719c0948b3",
116
- bytes: 6355277
117
- },
118
- {
119
- name: "tokens.txt",
120
- url: parakeet("tokens.txt"),
121
- sha256: "d58544679ea4bc6ac563d1f545eb7d474bd6cfa467f0a6e2c1dc1c7d37e3c35d",
122
- bytes: 93939
123
- }
124
- ],
125
- config: /* @__PURE__ */ __name((path) => ({
126
- transducer: {
127
- encoder: path("encoder.int8.onnx"),
128
- decoder: path("decoder.int8.onnx"),
129
- joiner: path("joiner.int8.onnx")
130
- },
131
- tokens: path("tokens.txt"),
132
- modelType: "nemo_transducer"
133
- }), "config")
134
- }
135
- ];
136
- var VAD = {
137
- name: "silero_vad.onnx",
138
- url: "https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/silero_vad.onnx",
139
- sha256: "9e2449e1087496d8d4caba907f23e0bd3f78d91fa552479bb9c23ac09cbb1fd6",
140
- bytes: 643854
141
- };
142
- var DEFAULT_ORDER = ["parakeet-v3", "gigaam-v3", "gigaam-v3-ctc"];
143
- var orderedModels = /* @__PURE__ */ __name((order = DEFAULT_ORDER) => [.../* @__PURE__ */ new Set([...order, ...DEFAULT_ORDER])].map(speechModel), "orderedModels");
144
- var findModel = /* @__PURE__ */ __name((id) => MODELS.find((model) => model.id === id), "findModel");
145
- var speechModel = /* @__PURE__ */ __name((id) => {
146
- const model = findModel(id);
147
- if (!model) {
148
- throw new CliError("validation_error", `no speech model "${id}" \u2014 one of ${MODELS.map((known) => known.id).join(", ")}`);
149
- }
150
- return model;
151
- }, "speechModel");
152
-
153
- // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/speech/install.js
154
- var sharedModelsDirectory = /* @__PURE__ */ __name((kind, env = process.env) => join(wirecatDirectory(env), "models", kind), "sharedModelsDirectory");
155
- var modelsDirectory = /* @__PURE__ */ __name((env = process.env) => sharedModelsDirectory("audio", env), "modelsDirectory");
156
- var STALL_MS = 6e4;
157
- var watchdog = /* @__PURE__ */ __name((ms) => {
158
- const controller = new AbortController();
159
- let timer = setTimeout(() => controller.abort(), ms);
160
- return {
161
- signal: controller.signal,
162
- poke: /* @__PURE__ */ __name(() => {
163
- clearTimeout(timer);
164
- timer = setTimeout(() => controller.abort(), ms);
165
- }, "poke"),
166
- stop: /* @__PURE__ */ __name(() => clearTimeout(timer), "stop")
167
- };
168
- }, "watchdog");
169
- var modelPath = /* @__PURE__ */ __name((directory, model) => (name) => join(directory, model.id, name), "modelPath");
170
- var vadPath = /* @__PURE__ */ __name((directory) => join(directory, VAD.name), "vadPath");
171
- var placed = /* @__PURE__ */ __name((model, directory) => [
172
- ...model.files.map((file) => [file, modelPath(directory, model)(file.name)]),
173
- [VAD, vadPath(directory)]
174
- ], "placed");
175
- var isInstalled = /* @__PURE__ */ __name((model, directory) => filesPresent(placed(model, directory)), "isInstalled");
176
- var filesPresent = /* @__PURE__ */ __name((files) => files.every(([file, path]) => sizeOf(path) === file.bytes), "filesPresent");
177
- var sizeOf = /* @__PURE__ */ __name((path) => {
178
- try {
179
- return statSync(path).size;
180
- } catch {
181
- return void 0;
182
- }
183
- }, "sizeOf");
184
- var installedBytes = /* @__PURE__ */ __name((model) => model.files.reduce((sum, file) => sum + file.bytes, 0), "installedBytes");
185
- var install = /* @__PURE__ */ __name(async (model, directory, { fetch: get = fetch, progress, verifyExisting } = {}) => {
186
- mkdirSync(join(directory, model.id), { recursive: true, mode: 448 });
187
- await installFiles(placed(model, directory), { fetch: get, progress, verifyExisting });
188
- }, "install");
189
- var installFiles = /* @__PURE__ */ __name(async (files, { fetch: get = fetch, progress, verifyExisting } = {}) => {
190
- if (verifyExisting)
191
- for (const [file, path] of files) {
192
- if (sizeOf(path) !== void 0) {
193
- const hash = createHash("sha256");
194
- for await (const chunk of createReadStream(path))
195
- hash.update(chunk);
196
- if (hash.digest("hex") !== file.sha256) {
197
- progress?.(`${path}: not the file this version expects, downloading it again`);
198
- await rm(path, { force: true });
199
- }
200
- }
201
- }
202
- for (const [file, path] of files) {
203
- if (sizeOf(path) === file.bytes)
204
- continue;
205
- mkdirSync(dirname(path), { recursive: true, mode: 448 });
206
- progress?.(`downloading ${file.name} (${megabytes(file.bytes)})`);
207
- await fetchVerified(file, path, get);
208
- }
209
- }, "installFiles");
210
- var fetchVerified = /* @__PURE__ */ __name(async (file, path, get) => {
211
- const stalled = watchdog(STALL_MS);
212
- try {
213
- await fetchInto(file, path, get, stalled);
214
- } catch (error) {
215
- if (stalled.signal.aborted) {
216
- throw new CliError("timeout", `${file.name} stopped downloading for ${STALL_MS / 1e3} s \u2014 nothing was installed`);
217
- }
218
- throw error;
219
- } finally {
220
- stalled.stop();
221
- }
222
- }, "fetchVerified");
223
- var fetchInto = /* @__PURE__ */ __name(async (file, path, get, stalled) => {
224
- const response = await get(file.url, { signal: stalled.signal });
225
- if (!response.ok || !response.body) {
226
- await response.body?.cancel();
227
- throw new CliError("network_error", `${file.name} could not be downloaded: HTTP ${response.status}`);
228
- }
229
- const partial = `${path}.${randomUUID()}.part`;
230
- const hash = createHash("sha256");
231
- let bytes = 0;
232
- const hashing = new Transform({
233
- transform(chunk, _encoding, done) {
234
- stalled.poke();
235
- bytes += chunk.length;
236
- if (bytes > file.bytes) {
237
- done(new CliError("invalid_response", `${file.name} is larger than this version expects \u2014 nothing was installed`));
238
- return;
239
- }
240
- hash.update(chunk);
241
- done(null, chunk);
242
- }
243
- });
244
- try {
245
- await pipeline(Readable.fromWeb(response.body), hashing, createWriteStream(partial, { flags: "wx", mode: 384 }));
246
- const actual = hash.digest("hex");
247
- if (actual !== file.sha256) {
248
- throw new CliError("invalid_response", `${file.name} is not the file this version expects (sha256 ${actual}) \u2014 nothing was installed`);
249
- }
250
- await rename(partial, path);
251
- } finally {
252
- await rm(partial, { force: true });
253
- }
254
- }, "fetchInto");
255
- var megabytes = /* @__PURE__ */ __name((bytes) => bytes < 1e6 ? "under 1 MB" : `${Math.round(bytes / 1e6)} MB`, "megabytes");
22
+ import { basename, join as join2 } from "node:path";
256
23
 
257
- // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/embeddings/onnx-runtime.js
258
- import { createHash as createHash2 } from "node:crypto";
259
- import { copyFileSync, mkdirSync as mkdirSync2, mkdtempSync, readFileSync, renameSync, rmSync, statSync as statSync2, writeFileSync } from "node:fs";
260
- import { join as join2 } from "node:path";
24
+ // 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/embeddings/onnx-runtime.js
25
+ import { createHash } from "node:crypto";
26
+ import { copyFileSync, mkdirSync, mkdtempSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
27
+ import { join } from "node:path";
261
28
 
262
29
  // node_modules/.pnpm/fflate@0.8.3/node_modules/fflate/esm/index.mjs
263
30
  import { createRequire } from "module";
@@ -911,7 +678,7 @@ var Unzip = /* @__PURE__ */ (function() {
911
678
  return Unzip2;
912
679
  })();
913
680
 
914
- // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/embeddings/onnx-runtime.js
681
+ // 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/embeddings/onnx-runtime.js
915
682
  var ONNX_RUNTIME_VERSION = "1.30.0";
916
683
  var release = /* @__PURE__ */ __name((name, sha256, bytes) => ({
917
684
  name,
@@ -984,40 +751,40 @@ var nativeRuntimeFor = /* @__PURE__ */ __name(({ platform = process.platform, ar
984
751
  const runtime = NATIVE[target];
985
752
  return runtime && !musl ? { target, ...runtime } : void 0;
986
753
  }, "nativeRuntimeFor");
987
- var runtimeFolder = /* @__PURE__ */ __name((runtime, env = process.env) => join2(sharedModelsDirectory("runtime", env), `onnxruntime-${ONNX_RUNTIME_VERSION}-${runtime.target}`), "runtimeFolder");
754
+ var runtimeFolder = /* @__PURE__ */ __name((runtime, env = process.env) => join(sharedModelsDirectory("runtime", env), `onnxruntime-${ONNX_RUNTIME_VERSION}-${runtime.target}`), "runtimeFolder");
988
755
  var BINDING = "onnxruntime_binding.node";
989
- var sizeOf2 = /* @__PURE__ */ __name((path) => {
756
+ var sizeOf = /* @__PURE__ */ __name((path) => {
990
757
  try {
991
- return statSync2(path).size;
758
+ return statSync(path).size;
992
759
  } catch {
993
760
  return void 0;
994
761
  }
995
762
  }, "sizeOf");
996
- var isInstalled2 = /* @__PURE__ */ __name((runtime, folder) => sizeOf2(join2(folder, runtime.library.name)) === runtime.library.bytes && sizeOf2(join2(folder, BINDING)) !== void 0, "isInstalled");
763
+ var isInstalled = /* @__PURE__ */ __name((runtime, folder) => sizeOf(join(folder, runtime.library.name)) === runtime.library.bytes && sizeOf(join(folder, BINDING)) !== void 0, "isInstalled");
997
764
  var installNativeRuntime = /* @__PURE__ */ __name(async ({ env = process.env, progress = /* @__PURE__ */ __name(() => {
998
- }, "progress"), fetch: fetch2, runtime = nativeRuntimeFor(), binding } = {}) => {
765
+ }, "progress"), fetch, runtime = nativeRuntimeFor(), binding } = {}) => {
999
766
  if (!runtime)
1000
767
  return void 0;
1001
768
  const source = binding ?? (await importFrom(new URL("embeddings/onnx-runtime.js", import.meta.resolve("@wirecat/cli-core")).href, "@wirecat/cli-core-onnx")).nativeBindingFor();
1002
769
  if (!source)
1003
770
  return void 0;
1004
771
  const folder = runtimeFolder(runtime, env);
1005
- if (isInstalled2(runtime, folder))
772
+ if (isInstalled(runtime, folder))
1006
773
  return folder;
1007
774
  progress(`ONNX Runtime ${ONNX_RUNTIME_VERSION} for ${runtime.target}: ${megabytes(runtime.archive.bytes)} from Microsoft`);
1008
775
  const parent = sharedModelsDirectory("runtime", env);
1009
- mkdirSync2(parent, { recursive: true, mode: 448 });
1010
- const staging = mkdtempSync(join2(parent, ".onnxruntime-"));
776
+ mkdirSync(parent, { recursive: true, mode: 448 });
777
+ const staging = mkdtempSync(join(parent, ".onnxruntime-"));
1011
778
  try {
1012
- const archive = join2(staging, runtime.archive.name);
1013
- await installFiles([[runtime.archive, archive]], { ...fetch2 ? { fetch: fetch2 } : {}, progress });
779
+ const archive = join(staging, runtime.archive.name);
780
+ await installFiles([[runtime.archive, archive]], { ...fetch ? { fetch } : {}, progress });
1014
781
  const library = tarMember(gunzipSync(readFileSync(archive)), runtime.member);
1015
782
  rmSync(archive);
1016
- const sha256 = library && createHash2("sha256").update(library).digest("hex");
783
+ const sha256 = library && createHash("sha256").update(library).digest("hex");
1017
784
  if (!library || library.length !== runtime.library.bytes || sha256 !== runtime.library.sha256)
1018
785
  throw new CliError("invalid_response", `${runtime.archive.name} does not hold the ${runtime.library.name} this version expects \u2014 nothing was installed`);
1019
- writeFileSync(join2(staging, runtime.library.name), library, { mode: 493 });
1020
- copyFileSync(source, join2(staging, BINDING));
786
+ writeFileSync(join(staging, runtime.library.name), library, { mode: 493 });
787
+ copyFileSync(source, join(staging, BINDING));
1021
788
  rmSync(folder, { recursive: true, force: true });
1022
789
  renameSync(staging, folder);
1023
790
  return folder;
@@ -1061,9 +828,9 @@ var onnxRuntime = /* @__PURE__ */ __name((env = process.env) => {
1061
828
  if (!found) {
1062
829
  found = (async () => {
1063
830
  const wasm = await importFrom(new URL("embeddings/onnx-runtime.js", import.meta.resolve("@wirecat/cli-core")).href, "@wirecat/cli-core-onnx");
1064
- if (runtime && isInstalled2(runtime, folder)) {
831
+ if (runtime && isInstalled(runtime, folder)) {
1065
832
  try {
1066
- return { ort: wasm.openNative(join2(folder, BINDING)), native: true };
833
+ return { ort: wasm.openNative(join(folder, BINDING)), native: true };
1067
834
  } catch {
1068
835
  }
1069
836
  }
@@ -1091,9 +858,9 @@ var openSession = /* @__PURE__ */ __name(async (bytes, threads, options = {}) =>
1091
858
  return { ort, session: await ort.InferenceSession.create(bytes, options) };
1092
859
  }, "openSession");
1093
860
 
1094
- // node_modules/.pnpm/@wirecat+cli-core@0.467.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.64.0_commander@15._7a700db966f96e9df6d3178e7072efc2/node_modules/@wirecat/cli-core/dist/embeddings/embed.js
861
+ // 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/embeddings/embed.js
1095
862
  var textModelsDirectory = /* @__PURE__ */ __name((env = process.env) => sharedModelsDirectory("text", env), "textModelsDirectory");
1096
- var placedText = /* @__PURE__ */ __name((model, directory) => model.files.map((file) => [file, join3(directory, model.id, file.name)]), "placedText");
863
+ var placedText = /* @__PURE__ */ __name((model, directory) => model.files.map((file) => [file, join2(directory, model.id, file.name)]), "placedText");
1097
864
  var isTextModelInstalled = /* @__PURE__ */ __name((model, directory) => filesPresent(placedText(model, directory)), "isTextModelInstalled");
1098
865
  var defaultThreads = /* @__PURE__ */ __name(() => Math.min(8, availableParallelism()), "defaultThreads");
1099
866
  var WARM_IDLE_MS = 10 * 6e4;
@@ -1203,7 +970,7 @@ var meanOf = /* @__PURE__ */ __name((data, tokens, dims) => {
1203
970
  }, "meanOf");
1204
971
  var loadModel = /* @__PURE__ */ __name(async (model, directory, threads) => {
1205
972
  const { Tokenizer } = await importFrom(new URL("embeddings/embed.js", import.meta.resolve("@wirecat/cli-core")).href, "@huggingface/tokenizers");
1206
- const path = /* @__PURE__ */ __name((name) => join3(directory, model.id, name), "path");
973
+ const path = /* @__PURE__ */ __name((name) => join2(directory, model.id, name), "path");
1207
974
  const tokenizer = new Tokenizer(JSON.parse(readFileSync2(path("tokenizer.json"), "utf8")), JSON.parse(readFileSync2(path("tokenizer_config.json"), "utf8")));
1208
975
  const { ort, session } = await openSession(readFileSync2(path(model.onnx)), threads, model.externalData ? { externalData: [{ path: basename(model.externalData), data: readFileSync2(path(model.externalData)) }] } : {});
1209
976
  return { ort, tokenizer, session };
@@ -1242,20 +1009,6 @@ var openEmbedder = /* @__PURE__ */ __name(async (model, directory, { threads = d
1242
1009
  }, "openEmbedder");
1243
1010
 
1244
1011
  export {
1245
- VAD,
1246
- DEFAULT_ORDER,
1247
- orderedModels,
1248
- speechModel,
1249
- sharedModelsDirectory,
1250
- modelsDirectory,
1251
- modelPath,
1252
- vadPath,
1253
- isInstalled,
1254
- filesPresent,
1255
- installedBytes,
1256
- install,
1257
- installFiles,
1258
- megabytes,
1259
1012
  UnzipInflate,
1260
1013
  Unzip,
1261
1014
  installNativeRuntime,
@@ -1,10 +1,10 @@
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
  __commonJS,
5
5
  __name,
6
6
  __require
7
- } from "./chunk-AFV74GK3.js";
7
+ } from "./chunk-ZVVMGPBJ.js";
8
8
 
9
9
  // node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
10
10
  var require_windows = __commonJS({
@@ -527,7 +527,7 @@ var require_cross_spawn = __commonJS({
527
527
  }
528
528
  });
529
529
 
530
- // node_modules/.pnpm/@wirecat+cli-base@0.64.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/executable.js
530
+ // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/executable.js
531
531
  import { existsSync } from "node:fs";
532
532
  import { win32 } from "node:path";
533
533
  var variable = /* @__PURE__ */ __name((env, name) => Object.entries(env).find(([key]) => key.toUpperCase() === name)?.[1], "variable");