@wirecat/tg-cli 0.108.0 → 0.110.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 (104) hide show
  1. package/dist/bin/tg.js +2 -2
  2. package/dist/bundle/{adapter-YFWRJWL5.js → adapter-JWUCHTXU.js} +45 -44
  3. package/dist/bundle/{all-profiles-GQIZSF4W.js → all-profiles-OMRCKP54.js} +8 -8
  4. package/dist/bundle/{anthropic-BKWEDKPU.js → anthropic-WXFHH74P.js} +5 -5
  5. package/dist/bundle/{app-server-RJV7ICLH.js → app-server-ILIPNO6T.js} +40 -39
  6. package/dist/bundle/{bot-api-2PAH2JZ3.js → bot-api-KV765AZK.js} +46 -45
  7. package/dist/bundle/{bot-history-DPPZ43F4.js → bot-history-3P6EIM5L.js} +15 -15
  8. package/dist/bundle/{bun-Q7COX3Z5.js → bun-MJOYPPEN.js} +2 -2
  9. package/dist/bundle/{bun-sqlite-YI4AYZXO.js → bun-sqlite-GFRVRRDZ.js} +4 -4
  10. package/dist/bundle/{chunk-BOSMBW4I.js → chunk-2YWQEG2P.js} +11 -11
  11. package/dist/bundle/{chunk-4RDMNNVO.js → chunk-32HEOKI2.js} +27 -14
  12. package/dist/bundle/{chunk-3GXKJKIC.js → chunk-3KOF5T4N.js} +4 -4
  13. package/dist/bundle/{chunk-AOUB2QFP.js → chunk-3L2JTAVD.js} +2 -2
  14. package/dist/bundle/{chunk-26PWIQPP.js → chunk-3XTMVGTS.js} +2338 -1174
  15. package/dist/bundle/{chunk-5P27JGGA.js → chunk-4BMXELWN.js} +5 -5
  16. package/dist/bundle/{chunk-VK2YLSK7.js → chunk-4GOF43MW.js} +1 -1
  17. package/dist/bundle/{chunk-5HPXENE5.js → chunk-4I6HTOCM.js} +1 -1
  18. package/dist/bundle/{chunk-LY2LFJMU.js → chunk-4YOPRYEY.js} +117 -94
  19. package/dist/bundle/{chunk-ON67U6WV.js → chunk-54CWOD7V.js} +6 -6
  20. package/dist/bundle/chunk-5ASW5BNM.js +379 -0
  21. package/dist/bundle/{chunk-OB5PPPXH.js → chunk-5CMOXHQS.js} +7 -7
  22. package/dist/bundle/{chunk-WEDWIXIC.js → chunk-6KESAYMZ.js} +2 -2
  23. package/dist/bundle/{chunk-3562DVQ7.js → chunk-6WTLP2SI.js} +8 -8
  24. package/dist/bundle/{chunk-BT6PWDM6.js → chunk-7ABA4EXC.js} +3 -3
  25. package/dist/bundle/{chunk-WKSLGPZQ.js → chunk-7LZBMZQM.js} +16 -4
  26. package/dist/bundle/{chunk-VMU4SGCE.js → chunk-ABVHA4K6.js} +8 -6
  27. package/dist/bundle/{chunk-YJ6GFFEE.js → chunk-AXNBGLO5.js} +1 -1
  28. package/dist/bundle/{chunk-LYLGLFWY.js → chunk-AZYVTDAE.js} +3 -3
  29. package/dist/bundle/{chunk-T4SDOYPY.js → chunk-BWRCPMMC.js} +138 -81
  30. package/dist/bundle/{chunk-DNOJKQXQ.js → chunk-BYOEVYY2.js} +678 -325
  31. package/dist/bundle/{chunk-FG2QTYEF.js → chunk-EB44Z44U.js} +1 -1
  32. package/dist/bundle/{chunk-67SRVSPU.js → chunk-EO563SUX.js} +26 -9
  33. package/dist/bundle/{chunk-F67VPIJL.js → chunk-F24EAGOU.js} +32 -31
  34. package/dist/bundle/{chunk-ZHHVNTBJ.js → chunk-F7RWNBC2.js} +2 -2
  35. package/dist/bundle/{chunk-REI5TPS3.js → chunk-FYAHTTOB.js} +11 -11
  36. package/dist/bundle/{chunk-CZANI3DM.js → chunk-GPIORQAD.js} +22 -22
  37. package/dist/bundle/{chunk-76OSISA3.js → chunk-HCAYTAJN.js} +2 -2
  38. package/dist/bundle/{chunk-SONKULUF.js → chunk-JDOSIWPN.js} +3 -3
  39. package/dist/bundle/{chunk-KZPZFPGB.js → chunk-KLOFBUXA.js} +81 -30
  40. package/dist/bundle/{chunk-6MZ2ZBX4.js → chunk-L3YDXUDK.js} +12 -3
  41. package/dist/bundle/{chunk-AS2BVZU3.js → chunk-M3XIME74.js} +49 -24
  42. package/dist/bundle/{chunk-WUF64WOG.js → chunk-MXIBRT6W.js} +4 -4
  43. package/dist/bundle/{chunk-D6DBVPES.js → chunk-MZRD776E.js} +3 -3
  44. package/dist/bundle/{chunk-6QTUYMGX.js → chunk-NDT22GBK.js} +2 -2
  45. package/dist/bundle/{chunk-3HYDKCXB.js → chunk-NFBOZT7H.js} +12 -12
  46. package/dist/bundle/{chunk-WAGDZB62.js → chunk-ONHHBPV3.js} +2 -2
  47. package/dist/bundle/{chunk-DUWTG2GE.js → chunk-Q35J5LCO.js} +8 -8
  48. package/dist/bundle/{chunk-77OOX2OE.js → chunk-QRH2AWBZ.js} +81 -57
  49. package/dist/bundle/{chunk-PQHYM2XC.js → chunk-RARYRHQA.js} +1 -1
  50. package/dist/bundle/{chunk-ZYBDAZFO.js → chunk-RSZEEWOW.js} +2 -2
  51. package/dist/bundle/{chunk-QVIT6SQ5.js → chunk-RXWG7OWT.js} +705 -425
  52. package/dist/bundle/{chunk-R5YOKYTE.js → chunk-SD5J5T7M.js} +11 -11
  53. package/dist/bundle/{chunk-NCXCBVHO.js → chunk-SLAPUEMZ.js} +6 -6
  54. package/dist/bundle/{chunk-KQFR7ZAA.js → chunk-TDQVVXPF.js} +43 -25
  55. package/dist/bundle/{chunk-BL72ZIBV.js → chunk-TJA3BWY3.js} +1 -1
  56. package/dist/bundle/{chunk-MFS52LTZ.js → chunk-UIPT6IAU.js} +1 -1
  57. package/dist/bundle/{chunk-EBB7RFCW.js → chunk-VM7I5VKX.js} +2 -2
  58. package/dist/bundle/{chunk-CVWF3BFK.js → chunk-VOBMR7E5.js} +45 -45
  59. package/dist/bundle/{chunk-B7TFWNKJ.js → chunk-W3B6EEZU.js} +1 -1
  60. package/dist/bundle/{chunk-PCMW3PW6.js → chunk-XLNYDJKG.js} +2 -2
  61. package/dist/bundle/{chunk-TVA3NXXO.js → chunk-YPEAEEHF.js} +2 -2
  62. package/dist/bundle/{chunk-XZXOGHU5.js → chunk-YPLL3Q3M.js} +71 -60
  63. package/dist/bundle/{chunk-EWL3ZFOI.js → chunk-YWSNUUW5.js} +6 -6
  64. package/dist/bundle/command-contract-TNSW7W6G.js +32 -0
  65. package/dist/bundle/{decode-ZFAFVFWX.js → decode-3KBXZCFM.js} +19 -17
  66. package/dist/bundle/{echarts-SVXNTKGV.js → echarts-24TVPFGC.js} +2 -2
  67. package/dist/bundle/{embed-V755YE7O.js → embed-3BDPZ4Q7.js} +5 -5
  68. package/dist/bundle/{embedder-MQAPNQBH.js → embedder-EMVDEZFR.js} +8 -8
  69. package/dist/bundle/{entry-ULQ3VOMQ.js → entry-NQD6Z2BM.js} +5 -5
  70. package/dist/bundle/{first-run-64BTWXDR.js → first-run-ZBIO6C67.js} +9 -9
  71. package/dist/bundle/first-screen-4HRCG7OX.js +30 -0
  72. package/dist/bundle/{identity-PW45VBUU.js → identity-EDGOOTOM.js} +3 -3
  73. package/dist/bundle/{instructions-G3ZUIRRH.js → instructions-N2WVMNFZ.js} +1 -1
  74. package/dist/bundle/{mcp-OQBZXELQ.js → mcp-EMNFFY4N.js} +2 -2
  75. package/dist/bundle/{node-IDJXLZSX.js → node-VBZAZHUS.js} +2 -2
  76. package/dist/bundle/{node-sqlite-W22J37MG.js → node-sqlite-C3V64OAL.js} +4 -4
  77. package/dist/bundle/{oauth-Q52LBXDE.js → oauth-NZXELYDA.js} +6 -6
  78. package/dist/bundle/{open-YLD7VHEC.js → open-2XRUGMV7.js} +3 -3
  79. package/dist/bundle/openai-OLGTN3ZB.js +250 -0
  80. package/dist/bundle/{process-OBESF2XG.js → process-CASPZ2DH.js} +1 -1
  81. package/dist/bundle/{program-EBMWHOKQ.js → program-QPQDSGYA.js} +50 -47
  82. package/dist/bundle/{prompt-FHHQF3MG.js → prompt-ESZL7SGX.js} +4 -4
  83. package/dist/bundle/{proxy-transport-YSBYG26I.js → proxy-transport-OROEVBCG.js} +4 -4
  84. package/dist/bundle/{recognize-QNHKHGKM.js → recognize-LQ7QOG4T.js} +5 -3
  85. package/dist/bundle/{remote-RVZWRCCT.js → remote-34XP4EDN.js} +6 -6
  86. package/dist/bundle/{rerank-KG2USEME.js → rerank-7F6NLBCW.js} +6 -6
  87. package/dist/bundle/{serve-I4MJKEQ4.js → serve-M6TTKXI4.js} +8 -8
  88. package/dist/bundle/{server-GV7SV3L6.js → server-GLZ5M7PE.js} +32 -31
  89. package/dist/bundle/server-KOW7OKE2.js +56 -0
  90. package/dist/bundle/{state-AJKHWFBU.js → state-UKKPLMHS.js} +5 -5
  91. package/dist/bundle/{store-L3HFSSGJ.js → store-J2MBIDJK.js} +10 -10
  92. package/dist/bundle/store-maintenance-command-64B57C3U.js +45 -0
  93. package/dist/bundle/tg.js +4 -4
  94. package/dist/program.d.ts.map +1 -1
  95. package/dist/program.js +2 -1
  96. package/dist/program.js.map +1 -1
  97. package/dist/version.d.ts +1 -1
  98. package/dist/version.js +1 -1
  99. package/package.json +3 -3
  100. package/dist/bundle/command-contract-5GJV6EHG.js +0 -32
  101. package/dist/bundle/first-screen-YZCH4TEV.js +0 -30
  102. package/dist/bundle/server-AXMWFPNT.js +0 -55
  103. package/dist/bundle/store-maintenance-command-Y22ARSDR.js +0 -44
  104. /package/dist/bundle/{chunk-O5EHUB2V.js → chunk-NPGVOZVK.js} +0 -0
@@ -3,11 +3,11 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  SAMPLE_RATE,
5
5
  decodeOgg
6
- } from "./chunk-AS2BVZU3.js";
7
- import "./chunk-T4SDOYPY.js";
6
+ } from "./chunk-M3XIME74.js";
7
+ import "./chunk-BWRCPMMC.js";
8
8
  import {
9
9
  CliError
10
- } from "./chunk-67SRVSPU.js";
10
+ } from "./chunk-EO563SUX.js";
11
11
  import {
12
12
  importFrom
13
13
  } from "./chunk-Y5E2WNWB.js";
@@ -15,7 +15,7 @@ import {
15
15
  __name
16
16
  } from "./chunk-ZVVMGPBJ.js";
17
17
 
18
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._95f40a748301e48ce1af109feea5b293/node_modules/@wirecat/cli-core/dist/speech/decode.js
18
+ // node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/speech/decode.js
19
19
  import { spawn } from "node:child_process";
20
20
  import { mkdtemp, rm, writeFile } from "node:fs/promises";
21
21
  import { createRequire } from "node:module";
@@ -42,19 +42,18 @@ var formatOf = /* @__PURE__ */ __name((bytes) => {
42
42
  return "mp3";
43
43
  return "other";
44
44
  }, "formatOf");
45
- var firstChannel = /* @__PURE__ */ __name((decoded) => {
46
- const samples = decoded.channelData[0];
47
- if (!samples || decoded.samplesDecoded === 0)
45
+ var everyChannel = /* @__PURE__ */ __name((decoded) => {
46
+ if (!decoded.channelData[0] || decoded.samplesDecoded === 0)
48
47
  throw new CliError("validation_error", "no audio in that file");
49
- return { samples, rate: decoded.sampleRate };
50
- }, "firstChannel");
48
+ return decoded.channelData.map((samples) => ({ samples, rate: decoded.sampleRate }));
49
+ }, "everyChannel");
51
50
  var load = /* @__PURE__ */ __name((name) => importFrom(new URL("speech/decode.js", import.meta.resolve("@wirecat/cli-core")).href, pathToFileURL(createRequire(new URL("speech/decode.js", import.meta.resolve("@wirecat/cli-core")).href).resolve(name)).href), "load");
52
51
  var decodeVorbis = /* @__PURE__ */ __name(async (bytes) => {
53
52
  const { OggVorbisDecoder } = await load("@wasm-audio-decoders/ogg-vorbis");
54
53
  const decoder = new OggVorbisDecoder();
55
54
  await decoder.ready;
56
55
  try {
57
- return firstChannel(await decoder.decodeFile(bytes));
56
+ return everyChannel(await decoder.decodeFile(bytes));
58
57
  } finally {
59
58
  decoder.free();
60
59
  }
@@ -64,7 +63,7 @@ var decodeFlac = /* @__PURE__ */ __name(async (bytes) => {
64
63
  const decoder = new FLACDecoder();
65
64
  await decoder.ready;
66
65
  try {
67
- return firstChannel(await decoder.decodeFile(bytes));
66
+ return everyChannel(await decoder.decodeFile(bytes));
68
67
  } finally {
69
68
  decoder.free();
70
69
  }
@@ -74,7 +73,7 @@ var decodeMp3 = /* @__PURE__ */ __name(async (bytes) => {
74
73
  const decoder = new MPEGDecoder();
75
74
  await decoder.ready;
76
75
  try {
77
- return firstChannel(decoder.decode(bytes));
76
+ return everyChannel(decoder.decode(bytes));
78
77
  } finally {
79
78
  decoder.free();
80
79
  }
@@ -142,18 +141,21 @@ var BUNDLED = {
142
141
  flac: decodeFlac,
143
142
  mp3: decodeMp3
144
143
  };
145
- var decodeAudio = /* @__PURE__ */ __name(async (bytes, ffmpeg = runFfmpeg) => {
144
+ var tooLong = /* @__PURE__ */ __name((pcm) => pcm.samples.length / pcm.rate > LONGEST_AUDIO_SECONDS, "tooLong");
145
+ var decodeChannels = /* @__PURE__ */ __name(async (bytes, ffmpeg = runFfmpeg) => {
146
146
  const format = formatOf(bytes);
147
- const pcm = format === "other" ? await ffmpeg(bytes) : await BUNDLED[format](bytes).catch((error) => ffmpeg(bytes).catch(() => {
147
+ const decoded = format === "other" ? { channels: [await ffmpeg(bytes)], mixed: true } : await BUNDLED[format](bytes).then((channels) => ({ channels, mixed: false }), (error) => ffmpeg(bytes).then((pcm) => ({ channels: [pcm], mixed: true }), () => {
148
148
  throw error;
149
149
  }));
150
- if (pcm.samples.length / pcm.rate > LONGEST_AUDIO_SECONDS)
150
+ if (decoded.channels.some(tooLong))
151
151
  throw new CliError("validation_error", `the audio is longer than ${LONGEST_AUDIO_SECONDS / 60} minutes`);
152
- return pcm;
153
- }, "decodeAudio");
152
+ return decoded;
153
+ }, "decodeChannels");
154
+ var decodeAudio = /* @__PURE__ */ __name(async (bytes, ffmpeg = runFfmpeg) => (await decodeChannels(bytes, ffmpeg)).channels[0], "decodeAudio");
154
155
  export {
155
156
  LONGEST_AUDIO_SECONDS,
156
157
  decodeAudio,
158
+ decodeChannels,
157
159
  formatOf,
158
160
  runFfmpeg
159
161
  };
@@ -42399,7 +42399,7 @@ function install11(registers) {
42399
42399
  }
42400
42400
  __name(install11, "install");
42401
42401
 
42402
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._95f40a748301e48ce1af109feea5b293/node_modules/@wirecat/cli-core/dist/charts/echarts-option.js
42402
+ // node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/charts/echarts-option.js
42403
42403
  var echartsOption = /* @__PURE__ */ __name((chart) => ({
42404
42404
  animation: false,
42405
42405
  backgroundColor: "#111827",
@@ -42447,7 +42447,7 @@ var echartsOption = /* @__PURE__ */ __name((chart) => ({
42447
42447
  } : {}
42448
42448
  }), "echartsOption");
42449
42449
 
42450
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._95f40a748301e48ce1af109feea5b293/node_modules/@wirecat/cli-core/dist/charts/echarts.js
42450
+ // node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/charts/echarts.js
42451
42451
  use([install2, install, install6, install5, install10, install7, install11]);
42452
42452
  var echartsRenderer = {
42453
42453
  render: /* @__PURE__ */ __name(async (chart, size) => {
@@ -13,11 +13,11 @@ import {
13
13
  truncated,
14
14
  unit,
15
15
  warmEmbedders
16
- } from "./chunk-EWL3ZFOI.js";
17
- import "./chunk-3HYDKCXB.js";
18
- import "./chunk-EBB7RFCW.js";
19
- import "./chunk-T4SDOYPY.js";
20
- import "./chunk-67SRVSPU.js";
16
+ } from "./chunk-YWSNUUW5.js";
17
+ import "./chunk-NFBOZT7H.js";
18
+ import "./chunk-VM7I5VKX.js";
19
+ import "./chunk-BWRCPMMC.js";
20
+ import "./chunk-EO563SUX.js";
21
21
  import "./chunk-Y5E2WNWB.js";
22
22
  import "./chunk-ZVVMGPBJ.js";
23
23
  export {
@@ -4,13 +4,13 @@ import {
4
4
  openSession,
5
5
  truncated,
6
6
  unit
7
- } from "./chunk-EWL3ZFOI.js";
8
- import "./chunk-3HYDKCXB.js";
9
- import "./chunk-EBB7RFCW.js";
10
- import "./chunk-T4SDOYPY.js";
7
+ } from "./chunk-YWSNUUW5.js";
8
+ import "./chunk-NFBOZT7H.js";
9
+ import "./chunk-VM7I5VKX.js";
10
+ import "./chunk-BWRCPMMC.js";
11
11
  import {
12
12
  CliError
13
- } from "./chunk-67SRVSPU.js";
13
+ } from "./chunk-EO563SUX.js";
14
14
  import {
15
15
  importFrom
16
16
  } from "./chunk-Y5E2WNWB.js";
@@ -18,11 +18,11 @@ import {
18
18
  __name
19
19
  } from "./chunk-ZVVMGPBJ.js";
20
20
 
21
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._95f40a748301e48ce1af109feea5b293/node_modules/@wirecat/cli-core/dist/images/picture/embedder.js
21
+ // node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/images/picture/embedder.js
22
22
  import { readFileSync } from "node:fs";
23
23
  import { join } from "node:path";
24
24
 
25
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._95f40a748301e48ce1af109feea5b293/node_modules/@wirecat/cli-core/dist/images/picture/preprocess.js
25
+ // node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/images/picture/preprocess.js
26
26
  var SIZE = 224;
27
27
  var MEAN = [0.48145466, 0.4578275, 0.40821073];
28
28
  var STD = [0.26862954, 0.26130258, 0.27577711];
@@ -61,7 +61,7 @@ var preprocess = /* @__PURE__ */ __name(async (bytes, load = importCanvas) => {
61
61
  return pixels;
62
62
  }, "preprocess");
63
63
 
64
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._95f40a748301e48ce1af109feea5b293/node_modules/@wirecat/cli-core/dist/images/picture/embedder.js
64
+ // node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/images/picture/embedder.js
65
65
  var openPictureEmbedder = /* @__PURE__ */ __name(async (model, directory, { threads = 4, canvas } = {}) => {
66
66
  const { Tokenizer } = await importFrom(new URL("images/picture/embedder.js", import.meta.resolve("@wirecat/cli-core")).href, "@huggingface/tokenizers");
67
67
  const path = /* @__PURE__ */ __name((name) => join(directory, model.id, name), "path");
@@ -2,11 +2,11 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  startCli
5
- } from "./chunk-R5YOKYTE.js";
6
- import "./chunk-PCMW3PW6.js";
7
- import "./chunk-NCXCBVHO.js";
8
- import "./chunk-T4SDOYPY.js";
9
- import "./chunk-67SRVSPU.js";
5
+ } from "./chunk-SD5J5T7M.js";
6
+ import "./chunk-XLNYDJKG.js";
7
+ import "./chunk-SLAPUEMZ.js";
8
+ import "./chunk-BWRCPMMC.js";
9
+ import "./chunk-EO563SUX.js";
10
10
  import "./chunk-Y5E2WNWB.js";
11
11
  import "./chunk-ZVVMGPBJ.js";
12
12
  export {
@@ -5,15 +5,15 @@ import {
5
5
  asksAtStart,
6
6
  setupAtStart,
7
7
  systemLanguage
8
- } from "./chunk-BOSMBW4I.js";
9
- import "./chunk-VMU4SGCE.js";
10
- import "./chunk-MFS52LTZ.js";
11
- import "./chunk-SONKULUF.js";
12
- import "./chunk-3562DVQ7.js";
13
- import "./chunk-ON67U6WV.js";
14
- import "./chunk-EBB7RFCW.js";
15
- import "./chunk-T4SDOYPY.js";
16
- import "./chunk-67SRVSPU.js";
8
+ } from "./chunk-2YWQEG2P.js";
9
+ import "./chunk-ABVHA4K6.js";
10
+ import "./chunk-UIPT6IAU.js";
11
+ import "./chunk-JDOSIWPN.js";
12
+ import "./chunk-6WTLP2SI.js";
13
+ import "./chunk-54CWOD7V.js";
14
+ import "./chunk-VM7I5VKX.js";
15
+ import "./chunk-BWRCPMMC.js";
16
+ import "./chunk-EO563SUX.js";
17
17
  import "./chunk-Y5E2WNWB.js";
18
18
  import "./chunk-ZVVMGPBJ.js";
19
19
  export {
@@ -0,0 +1,30 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ WIRECAT_TOOLS,
5
+ firstScreen,
6
+ installHelp
7
+ } from "./chunk-5CMOXHQS.js";
8
+ import "./chunk-2ABQZVK4.js";
9
+ import "./chunk-4BMXELWN.js";
10
+ import "./chunk-4YOPRYEY.js";
11
+ import "./chunk-QRH2AWBZ.js";
12
+ import "./chunk-7LZBMZQM.js";
13
+ import "./chunk-Q35J5LCO.js";
14
+ import "./chunk-JDOSIWPN.js";
15
+ import "./chunk-XLNYDJKG.js";
16
+ import "./chunk-RARYRHQA.js";
17
+ import "./chunk-NFBOZT7H.js";
18
+ import "./chunk-YPLL3Q3M.js";
19
+ import "./chunk-54CWOD7V.js";
20
+ import "./chunk-NPGVOZVK.js";
21
+ import "./chunk-VM7I5VKX.js";
22
+ import "./chunk-BWRCPMMC.js";
23
+ import "./chunk-EO563SUX.js";
24
+ import "./chunk-Y5E2WNWB.js";
25
+ import "./chunk-ZVVMGPBJ.js";
26
+ export {
27
+ WIRECAT_TOOLS,
28
+ firstScreen,
29
+ installHelp
30
+ };
@@ -2,9 +2,9 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  TG
5
- } from "./chunk-TVA3NXXO.js";
6
- import "./chunk-O5EHUB2V.js";
7
- import "./chunk-67SRVSPU.js";
5
+ } from "./chunk-YPEAEEHF.js";
6
+ import "./chunk-NPGVOZVK.js";
7
+ import "./chunk-EO563SUX.js";
8
8
  import "./chunk-ZVVMGPBJ.js";
9
9
  export {
10
10
  TG
@@ -3,7 +3,7 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  appInstructions,
5
5
  instructions
6
- } from "./chunk-BL72ZIBV.js";
6
+ } from "./chunk-TJA3BWY3.js";
7
7
  import "./chunk-ZVVMGPBJ.js";
8
8
  export {
9
9
  appInstructions,
@@ -4,13 +4,13 @@ import {
4
4
  executableEnvironment,
5
5
  executableOnPath,
6
6
  require_cross_spawn
7
- } from "./chunk-MFS52LTZ.js";
7
+ } from "./chunk-UIPT6IAU.js";
8
8
  import {
9
9
  __name,
10
10
  __toESM
11
11
  } from "./chunk-ZVVMGPBJ.js";
12
12
 
13
- // 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/mcp/index.js
13
+ // node_modules/.pnpm/@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/mcp/index.js
14
14
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
15
15
  var realRun = /* @__PURE__ */ __name((file, args) => {
16
16
  const result = import_cross_spawn.default.sync(executableOnPath(file, process.env), args, {
@@ -18,12 +18,12 @@ import {
18
18
  jitCompatCheck,
19
19
  refineSqliteCodecs,
20
20
  sql
21
- } from "./chunk-VK2YLSK7.js";
21
+ } from "./chunk-4GOF43MW.js";
22
22
  import {
23
23
  __name
24
24
  } from "./chunk-ZVVMGPBJ.js";
25
25
 
26
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._95f40a748301e48ce1af109feea5b293/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/node.js
26
+ // node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/node.js
27
27
  import { DatabaseSync } from "node:sqlite";
28
28
  var nodeSQLiteCodecs = refineSqliteCodecs({
29
29
  "integer:boolean": { normalize: booleanFromInteger },
@@ -3,15 +3,15 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  loadVectorExtension,
5
5
  vectorExtension
6
- } from "./chunk-76OSISA3.js";
7
- import "./chunk-T4SDOYPY.js";
8
- import "./chunk-67SRVSPU.js";
6
+ } from "./chunk-HCAYTAJN.js";
7
+ import "./chunk-BWRCPMMC.js";
8
+ import "./chunk-EO563SUX.js";
9
9
  import "./chunk-Y5E2WNWB.js";
10
10
  import {
11
11
  __name
12
12
  } from "./chunk-ZVVMGPBJ.js";
13
13
 
14
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._95f40a748301e48ce1af109feea5b293/node_modules/@wirecat/cli-core/dist/store/drivers/node-sqlite.js
14
+ // node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/store/drivers/node-sqlite.js
15
15
  import { DatabaseSync } from "node:sqlite";
16
16
  var openWithNodeSqlite = /* @__PURE__ */ __name(async (path) => cacheOverNodeSqlite(await nodeClient(path)), "openWithNodeSqlite");
17
17
  var nodeClient = /* @__PURE__ */ __name(async (path, { readOnly = false } = {}) => {
@@ -3,13 +3,13 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  ownerLogin,
5
5
  revokeAll
6
- } from "./chunk-WEDWIXIC.js";
6
+ } from "./chunk-6KESAYMZ.js";
7
7
  import "./chunk-5D4AEUVA.js";
8
- import "./chunk-WUF64WOG.js";
9
- import "./chunk-BT6PWDM6.js";
10
- import "./chunk-PQHYM2XC.js";
11
- import "./chunk-T4SDOYPY.js";
12
- import "./chunk-67SRVSPU.js";
8
+ import "./chunk-MXIBRT6W.js";
9
+ import "./chunk-7ABA4EXC.js";
10
+ import "./chunk-RARYRHQA.js";
11
+ import "./chunk-BWRCPMMC.js";
12
+ import "./chunk-EO563SUX.js";
13
13
  import "./chunk-Y5E2WNWB.js";
14
14
  import "./chunk-ZVVMGPBJ.js";
15
15
  export {
@@ -6,9 +6,9 @@ import {
6
6
  openCache,
7
7
  openFile,
8
8
  storeCapable
9
- } from "./chunk-NCXCBVHO.js";
10
- import "./chunk-T4SDOYPY.js";
11
- import "./chunk-67SRVSPU.js";
9
+ } from "./chunk-SLAPUEMZ.js";
10
+ import "./chunk-BWRCPMMC.js";
11
+ import "./chunk-EO563SUX.js";
12
12
  import "./chunk-Y5E2WNWB.js";
13
13
  import "./chunk-ZVVMGPBJ.js";
14
14
  export {
@@ -0,0 +1,250 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ SAMPLE_RATE,
5
+ toModelRate
6
+ } from "./chunk-M3XIME74.js";
7
+ import "./chunk-5ASW5BNM.js";
8
+ import {
9
+ OPENAI_URL
10
+ } from "./chunk-AZYVTDAE.js";
11
+ import "./chunk-YWSNUUW5.js";
12
+ import {
13
+ OPENAI_TRANSCRIBE_MODEL,
14
+ VAD,
15
+ filesPresent,
16
+ modelsDirectory,
17
+ vadPath
18
+ } from "./chunk-NFBOZT7H.js";
19
+ import "./chunk-VM7I5VKX.js";
20
+ import {
21
+ DEFAULT_RETRY,
22
+ backoffMs
23
+ } from "./chunk-BWRCPMMC.js";
24
+ import {
25
+ CliError
26
+ } from "./chunk-EO563SUX.js";
27
+ import "./chunk-Y5E2WNWB.js";
28
+ import {
29
+ __name
30
+ } from "./chunk-ZVVMGPBJ.js";
31
+
32
+ // node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/speech/openai.js
33
+ import { setTimeout as wait } from "node:timers/promises";
34
+
35
+ // node_modules/.pnpm/@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/http/index.js
36
+ var parseRetryAfter = /* @__PURE__ */ __name((header, now) => {
37
+ if (!header)
38
+ return void 0;
39
+ const trimmed = header.trim();
40
+ if (/^\d+$/.test(trimmed))
41
+ return Number(trimmed) * 1e3;
42
+ const at = Date.parse(trimmed);
43
+ if (Number.isNaN(at))
44
+ return void 0;
45
+ const delta = at - now().getTime();
46
+ return delta > 0 ? delta : void 0;
47
+ }, "parseRetryAfter");
48
+ var parseRateLimitReset = /* @__PURE__ */ __name((header, now) => {
49
+ if (!header)
50
+ return void 0;
51
+ const seconds = Number(header.trim());
52
+ if (!Number.isFinite(seconds))
53
+ return void 0;
54
+ const delta = seconds * 1e3 - now().getTime();
55
+ return delta > 0 ? delta : void 0;
56
+ }, "parseRateLimitReset");
57
+ var providerWaitMs = /* @__PURE__ */ __name((headers, now) => parseRetryAfter(headers.get("retry-after"), now) ?? parseRateLimitReset(headers.get("x-ratelimit-reset"), now), "providerWaitMs");
58
+
59
+ // node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/speech/wav.js
60
+ var encodeWav = /* @__PURE__ */ __name((samples, sampleRate = 16e3) => {
61
+ const bytes = Buffer.alloc(44 + samples.length * 2);
62
+ bytes.write("RIFF", 0, "ascii");
63
+ bytes.writeUInt32LE(bytes.length - 8, 4);
64
+ bytes.write("WAVEfmt ", 8, "ascii");
65
+ bytes.writeUInt32LE(16, 16);
66
+ bytes.writeUInt16LE(1, 20);
67
+ bytes.writeUInt16LE(1, 22);
68
+ bytes.writeUInt32LE(sampleRate, 24);
69
+ bytes.writeUInt32LE(sampleRate * 2, 28);
70
+ bytes.writeUInt16LE(2, 32);
71
+ bytes.writeUInt16LE(16, 34);
72
+ bytes.write("data", 36, "ascii");
73
+ bytes.writeUInt32LE(samples.length * 2, 40);
74
+ samples.forEach((sample, index) => {
75
+ bytes.writeInt16LE(Math.round(Math.max(-1, Math.min(1, sample || 0)) * 32767), 44 + index * 2);
76
+ });
77
+ return new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.length);
78
+ }, "encodeWav");
79
+
80
+ // node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/speech/openai.js
81
+ var LONGEST_REQUEST_SECONDS = 600;
82
+ var JOINED_SECONDS = 0.2;
83
+ var PAD_SECONDS = 0.2;
84
+ var LEAD = SAMPLE_RATE / 2;
85
+ var EXHAUSTED = /* @__PURE__ */ new Set([
86
+ "insufficient_quota",
87
+ "credit_balance_exhausted",
88
+ "organization_spend_limit_exceeded",
89
+ "project_spend_limit_exceeded",
90
+ "organization_usage_limit_exceeded"
91
+ ]);
92
+ var RETRY = { ...DEFAULT_RETRY, retries: 4 };
93
+ var interrupted = /* @__PURE__ */ __name((signal) => {
94
+ if (!signal?.aborted)
95
+ return;
96
+ if (signal.reason instanceof CliError)
97
+ throw signal.reason;
98
+ const timeout = signal.reason instanceof Error && signal.reason.name === "TimeoutError";
99
+ throw new CliError(timeout ? "timeout" : "cancelled", "the transcription was interrupted");
100
+ }, "interrupted");
101
+ var sleeping = /* @__PURE__ */ __name((ms, signal) => wait(ms, void 0, signal ? { signal } : {}).then(() => void 0, (error) => {
102
+ interrupted(signal);
103
+ throw error;
104
+ }), "sleeping");
105
+ var formOf = /* @__PURE__ */ __name((wav, options) => {
106
+ const form = new FormData();
107
+ form.append("file", new Blob([wav], { type: "audio/wav" }), "audio.wav");
108
+ form.append("model", options.model ?? OPENAI_TRANSCRIBE_MODEL);
109
+ for (const language of options.languages ?? [])
110
+ form.append("languages[]", language);
111
+ for (const keyword of options.keywords ?? [])
112
+ form.append("keywords[]", keyword);
113
+ if (options.prompt)
114
+ form.append("prompt", options.prompt);
115
+ return form;
116
+ }, "formOf");
117
+ var safe = /* @__PURE__ */ __name((value) => typeof value === "string" && /^[\w.-]{1,64}$/.test(value) ? value : void 0, "safe");
118
+ var failureOf = /* @__PURE__ */ __name(async (response) => {
119
+ try {
120
+ const body = await response.json();
121
+ const code = safe(body.error?.code);
122
+ const type = safe(body.error?.type);
123
+ return { ...code ? { code } : {}, ...type ? { type } : {} };
124
+ } catch {
125
+ return {};
126
+ }
127
+ }, "failureOf");
128
+ var send = /* @__PURE__ */ __name(async (wav, options) => {
129
+ const post = options.fetch ?? fetch;
130
+ const retry = options.retry ?? RETRY;
131
+ const sleep = options.sleep ?? sleeping;
132
+ const random = options.random ?? Math.random;
133
+ const url = `${(options.baseUrl ?? OPENAI_URL).replace(/\/+$/, "")}/audio/transcriptions`;
134
+ for (let attempt = 1; ; attempt++) {
135
+ interrupted(options.signal);
136
+ let response;
137
+ try {
138
+ response = await post(url, {
139
+ method: "POST",
140
+ headers: { authorization: `Bearer ${options.apiKey}` },
141
+ body: formOf(wav, options),
142
+ ...options.signal ? { signal: options.signal } : {}
143
+ });
144
+ } catch {
145
+ interrupted(options.signal);
146
+ if (attempt > retry.retries)
147
+ throw new CliError("network_error", "OpenAI could not be reached", { reason: "network.failed" });
148
+ await sleep(backoffMs(attempt, retry, random), options.signal);
149
+ continue;
150
+ }
151
+ if (response.ok) {
152
+ const body = await response.json().catch(() => interrupted(options.signal));
153
+ if (typeof body?.text !== "string")
154
+ throw new CliError("invalid_response", "OpenAI answered without a transcript", {
155
+ reason: "provider.invalid-response"
156
+ });
157
+ return body.text.trim();
158
+ }
159
+ const { code, type } = await failureOf(response);
160
+ const status = response.status;
161
+ const said = `HTTP ${status}${code ? `, ${code}` : type ? `, ${type}` : ""}`;
162
+ if (status === 401)
163
+ throw new CliError("authentication_error", `OpenAI refused the key (${said}) \u2014 set it again with \`models keys set openai\``, { reason: "auth.failed" });
164
+ if (status === 403)
165
+ throw new CliError("permission_error", `OpenAI refused the request (${said}) \u2014 it answers this when the country or region is not supported, or the key's project may not use the model`, { reason: "access.denied" });
166
+ if (status === 413)
167
+ throw new CliError("validation_error", `OpenAI refused the audio as too large (${said})`, {
168
+ reason: "transcription.too-large"
169
+ });
170
+ if (EXHAUSTED.has(code ?? "") || EXHAUSTED.has(type ?? ""))
171
+ throw new CliError("permission_error", `OpenAI refused: the account's credit, spend limit or usage limit is used up (${said}) \u2014 see the billing page`, { reason: "transcription.quota-exhausted" });
172
+ const again = status === 408 || status === 429 || status >= 500;
173
+ const asked = providerWaitMs(response.headers, () => /* @__PURE__ */ new Date());
174
+ if (again && attempt <= retry.retries && (asked === void 0 || asked <= retry.maxRetryAfterMs)) {
175
+ await sleep(asked ?? backoffMs(attempt, retry, random), options.signal);
176
+ continue;
177
+ }
178
+ if (status === 429)
179
+ throw new CliError("rate_limited", `OpenAI answered ${said}`, {
180
+ reason: "provider.rate-limited",
181
+ ...asked === void 0 ? {} : { retry_after_ms: asked }
182
+ });
183
+ if (status >= 500)
184
+ throw new CliError([502, 503, 504].includes(status) ? "provider_unavailable" : "provider_error", `OpenAI answered ${said}`, { reason: [502, 503, 504].includes(status) ? "provider.unavailable" : "provider.refused" });
185
+ throw new CliError("provider_error", `OpenAI answered ${said}`, { reason: "provider.refused" });
186
+ }
187
+ }, "send");
188
+ var piecesOf = /* @__PURE__ */ __name((spans, limit) => {
189
+ const pieces = [];
190
+ for (const span of spans) {
191
+ const last = pieces.at(-1);
192
+ const joined = last !== void 0 && span.start - last.end < JOINED_SECONDS;
193
+ const fits = last !== void 0 && limit !== void 0 && span.end - last.start <= limit;
194
+ if (last && (fits || joined && span.end - last.start <= LONGEST_REQUEST_SECONDS))
195
+ last.end = span.end;
196
+ else
197
+ pieces.push({ start: span.start, end: span.end });
198
+ }
199
+ return pieces;
200
+ }, "piecesOf");
201
+ var openCutter = /* @__PURE__ */ __name(async (vadModel) => {
202
+ const { openSpeechCutter } = await import("./recognize-LQ7QOG4T.js");
203
+ return openSpeechCutter(vadModel);
204
+ }, "openCutter");
205
+ var checkKeywords = /* @__PURE__ */ __name((keywords = []) => {
206
+ const bad = keywords.find((keyword) => typeof keyword !== "string" || !keyword.trim() || /[<>\r\n]/.test(keyword));
207
+ if (bad !== void 0)
208
+ throw new CliError("validation_error", "a keyword must be a non-empty single line without < or > \u2014 OpenAI refuses the whole request otherwise");
209
+ }, "checkKeywords");
210
+ var transcribeOpenAI = /* @__PURE__ */ __name(async (audio, options) => {
211
+ if (!options.apiKey)
212
+ throw new CliError("authentication_error", "no OpenAI key \u2014 `models keys set openai`, or OPENAI_API_KEY", {
213
+ reason: "transcription.no-key"
214
+ });
215
+ checkKeywords(options.keywords);
216
+ interrupted(options.signal);
217
+ const pcm = toModelRate(audio.samples, audio.rate);
218
+ const duration = (pcm.length - LEAD) / SAMPLE_RATE;
219
+ if (options.bundle && duration <= LONGEST_REQUEST_SECONDS) {
220
+ const text = await send(encodeWav(pcm.subarray(LEAD)), options);
221
+ return text ? [{ start: 0, end: duration, text }] : [];
222
+ }
223
+ const vadModel = options.vadModel ?? vadPath(modelsDirectory(options.env));
224
+ if (!options.cutter && !filesPresent([[VAD, vadModel]]))
225
+ throw new CliError("not_found", "the voice detector that finds the speech is not on this machine \u2014 it comes with any speech model: `models download`", { reason: "model.not-downloaded", model: "silero_vad" });
226
+ const cutter = await (options.cutter ?? openCutter)(vadModel);
227
+ let spans;
228
+ try {
229
+ spans = cutter.cut(pcm);
230
+ } finally {
231
+ cutter.free();
232
+ }
233
+ const pieces = piecesOf(spans, options.bundle ? LONGEST_REQUEST_SECONDS : void 0);
234
+ const heard = [];
235
+ for (const [index, piece] of pieces.entries()) {
236
+ const end = Math.min(piece.end, duration);
237
+ const from = Math.max(piece.start - PAD_SECONDS, pieces[index - 1]?.end ?? 0);
238
+ const to = Math.min(end + PAD_SECONDS, pieces[index + 1]?.start ?? duration);
239
+ const samples = pcm.subarray(LEAD + Math.floor(from * SAMPLE_RATE), LEAD + Math.ceil(to * SAMPLE_RATE));
240
+ const text = await send(encodeWav(samples), options);
241
+ if (text)
242
+ heard.push({ start: Math.min(piece.start, end), end, text });
243
+ }
244
+ return heard;
245
+ }, "transcribeOpenAI");
246
+ export {
247
+ LONGEST_REQUEST_SECONDS,
248
+ piecesOf,
249
+ transcribeOpenAI
250
+ };
@@ -5,7 +5,7 @@ import {
5
5
  __name
6
6
  } from "./chunk-ZVVMGPBJ.js";
7
7
 
8
- // node_modules/.pnpm/@wirecat+cli-core@0.491.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.65.0_commander@15._95f40a748301e48ce1af109feea5b293/node_modules/@wirecat/cli-core/dist/embeddings/process.js
8
+ // node_modules/.pnpm/@wirecat+cli-core@0.511.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.68.1_commander@15._5c8fd69a9fdf1e5f27f7a7a8cfa45e82/node_modules/@wirecat/cli-core/dist/embeddings/process.js
9
9
  import { spawn } from "node:child_process";
10
10
  import { createInterface } from "node:readline";
11
11
  import { fileURLToPath } from "node:url";