@wirecat/tg-cli 0.128.0 → 0.130.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/contracts/wirecat.json +26 -0
- package/dist/bin/tg.js +2 -2
- package/dist/bundle/{adapter-JOI34QLS.js → adapter-2XFPXBTA.js} +60 -52
- package/dist/bundle/{all-profiles-2BZEE7J2.js → all-profiles-GXFPZLYU.js} +9 -9
- package/dist/bundle/{anthropic-NW7DL3S3.js → anthropic-FHS5XNK5.js} +5 -5
- package/dist/bundle/{app-server-RUTYKELF.js → app-server-IZMFSFP2.js} +54 -46
- package/dist/bundle/{bot-api-DW6NAZAQ.js → bot-api-V3ZJ75KE.js} +61 -53
- package/dist/bundle/{bot-history-FAJ2W42U.js → bot-history-EJQOD4AQ.js} +22 -18
- package/dist/bundle/{bun-IVP5LSVI.js → bun-GBAZFRCV.js} +2 -2
- package/dist/bundle/{bun-sqlite-ATPCJ4CT.js → bun-sqlite-JB4BX6X7.js} +6 -6
- package/dist/bundle/chunk-2JZJPVBH.js +334 -0
- package/dist/bundle/{chunk-FHGAJK4I.js → chunk-2LPODKIF.js} +15 -15
- package/dist/bundle/chunk-3KZG63EH.js +170 -0
- package/dist/bundle/chunk-3XMUP55N.js +372 -0
- package/dist/bundle/{chunk-OX6574YV.js → chunk-42LRWOTT.js} +15 -15
- package/dist/bundle/{chunk-MDGLKMLD.js → chunk-4BJAQNJ5.js} +9 -9
- package/dist/bundle/{chunk-M4OP5ASJ.js → chunk-66PL7P4C.js} +1 -1
- package/dist/bundle/{chunk-MOUPWPNL.js → chunk-66UG67CE.js} +12 -12
- package/dist/bundle/{chunk-R4QVV3LN.js → chunk-6JBRQ6PM.js} +41 -19
- package/dist/bundle/{chunk-GYO4WXLG.js → chunk-6M3FAHPS.js} +3 -3
- package/dist/bundle/{chunk-WMF6SL5D.js → chunk-6WGAWISN.js} +2 -2
- package/dist/bundle/{chunk-2QHIOPSA.js → chunk-7F3LOHRB.js} +261 -501
- package/dist/bundle/{chunk-XS5C5TQ7.js → chunk-AUNNJDVD.js} +25 -8
- package/dist/bundle/{chunk-7D6LI2N7.js → chunk-B5RGPZDZ.js} +7 -7
- package/dist/bundle/{chunk-YRZXOQOB.js → chunk-B6NQJAUC.js} +2 -2
- package/dist/bundle/{chunk-IV2KJQ5F.js → chunk-BMSS3PCY.js} +58 -33
- package/dist/bundle/{chunk-LTADKMP5.js → chunk-C4ALE7CH.js} +1 -1
- package/dist/bundle/{chunk-WG3BF7SA.js → chunk-CKJ73EF3.js} +1 -1
- package/dist/bundle/{chunk-IX3GUNGV.js → chunk-CLG2ISQH.js} +4 -4
- package/dist/bundle/{chunk-G3PL3R45.js → chunk-EB2JE722.js} +1 -1
- package/dist/bundle/{chunk-J3SX36NE.js → chunk-EUL7HMUL.js} +2 -2
- package/dist/bundle/{chunk-PJA43HVE.js → chunk-F6CV4KUN.js} +2 -2
- package/dist/bundle/{chunk-7KCBPAQS.js → chunk-F6MLJ3V5.js} +2 -2
- package/dist/bundle/{chunk-3UGRMFWK.js → chunk-FH4YIBBH.js} +4 -4
- package/dist/bundle/chunk-FIO5NMK3.js +771 -0
- package/dist/bundle/{chunk-7I5NMVX7.js → chunk-G2SMVYBU.js} +2 -2
- package/dist/bundle/{chunk-FIVFP53N.js → chunk-GA3URWIF.js} +1 -1
- package/dist/bundle/{chunk-2A3TC52A.js → chunk-GGGBPWUS.js} +10 -15
- package/dist/bundle/{chunk-KKZQK6IK.js → chunk-GSHTLLCJ.js} +2 -2
- package/dist/bundle/{chunk-F4UIBEQK.js → chunk-GYCKRIRK.js} +3 -3
- package/dist/bundle/{chunk-WPMJQIEU.js → chunk-HHUK3XO5.js} +1 -1
- package/dist/bundle/{chunk-NM5GBJME.js → chunk-HT6OFANN.js} +19 -19
- package/dist/bundle/{chunk-ODBK56ZR.js → chunk-I5PILOTU.js} +1 -1
- package/dist/bundle/chunk-IBSHQWIJ.js +29 -0
- package/dist/bundle/{chunk-RZFIQMOA.js → chunk-IRWSZJYL.js} +60 -58
- package/dist/bundle/{chunk-BVCRDHI2.js → chunk-IV6SIKVH.js} +4 -4
- package/dist/bundle/{chunk-URFBZNLU.js → chunk-JUFLELQ7.js} +2 -2
- package/dist/bundle/{chunk-XYAH6QQO.js → chunk-KY3JLXW2.js} +4 -4
- package/dist/bundle/{chunk-YSXDCSBP.js → chunk-LPT5T6PU.js} +29 -30
- package/dist/bundle/chunk-LQPZDDDP.js +259 -0
- package/dist/bundle/{chunk-JI2PFQFL.js → chunk-M327UNS6.js} +6 -6
- package/dist/bundle/{chunk-SDLJJF7E.js → chunk-MS6YEIG5.js} +13 -13
- package/dist/bundle/{chunk-WMUPZ3IY.js → chunk-MVFSWKTM.js} +12 -12
- package/dist/bundle/{chunk-YVV5S2QA.js → chunk-NRCY3WBC.js} +2 -2
- package/dist/bundle/{chunk-2IL4YDGG.js → chunk-O2ULG7OO.js} +3 -3
- package/dist/bundle/{chunk-E56QE3UC.js → chunk-OJMDKWWL.js} +627 -503
- package/dist/bundle/{chunk-UURJO46N.js → chunk-OKTRB4ZQ.js} +1 -1
- package/dist/bundle/{chunk-IIHCSJV2.js → chunk-OWVQMK7G.js} +700 -837
- package/dist/bundle/{chunk-LD42OGKK.js → chunk-PS7ZS5HD.js} +4 -4
- package/dist/bundle/{chunk-EAUHYQUK.js → chunk-PWQKGFS2.js} +36 -34
- package/dist/bundle/{chunk-MGBVVQTU.js → chunk-QBNEWEJC.js} +3 -3
- package/dist/bundle/{chunk-QYN5RDTZ.js → chunk-QDEP2QOA.js} +3 -3
- package/dist/bundle/{chunk-QO4ON2X7.js → chunk-QFVIHBLD.js} +1 -1
- package/dist/bundle/{chunk-ZVLYK6CZ.js → chunk-QJDHRBXL.js} +7 -7
- package/dist/bundle/{chunk-IHLNXL2D.js → chunk-QJLCEOAP.js} +1 -1
- package/dist/bundle/{chunk-KF2Q776U.js → chunk-RAFK5KXU.js} +9 -9
- package/dist/bundle/{chunk-RIGNCUZD.js → chunk-RPWYTOLI.js} +5 -5
- package/dist/bundle/{chunk-4DSIGS2E.js → chunk-RZPMFVWM.js} +6 -6
- package/dist/bundle/chunk-S5UTBEV3.js +1974 -0
- package/dist/bundle/{chunk-MC6FOTCV.js → chunk-SYZXOEHY.js} +3 -3
- package/dist/bundle/{chunk-5AP25FMW.js → chunk-SZB5WRMI.js} +2 -2
- package/dist/bundle/{chunk-Q3ZO6Q3M.js → chunk-TGRB4SSZ.js} +4 -4
- package/dist/bundle/{chunk-TQFUAKU6.js → chunk-VSPSHBAC.js} +2 -2
- package/dist/bundle/{chunk-TGUXKG4B.js → chunk-VTJ3AOTT.js} +17 -17
- package/dist/bundle/{chunk-T2CWSFGY.js → chunk-VXWDQDRU.js} +6341 -6902
- package/dist/bundle/{chunk-JJGPU24U.js → chunk-X5H5NERR.js} +6 -6
- package/dist/bundle/{chunk-AF2XVV5P.js → chunk-XHX5D5VE.js} +727 -2598
- package/dist/bundle/chunk-XXW6PFAX.js +16 -0
- package/dist/bundle/{chunk-NXDQXDRN.js → chunk-ZRQQOGAZ.js} +4 -4
- package/dist/bundle/command-contract-G752BLKA.js +37 -0
- package/dist/bundle/{command-server-entry-BU3X4XNL.js → command-server-entry-YR6ONDWO.js} +27 -24
- package/dist/bundle/decode-VUKGWFSW.js +296 -0
- package/dist/bundle/{dispatch-PRAIGIFS.js → dispatch-ST5FK2KI.js} +8 -8
- package/dist/bundle/{echarts-NAXLKJLA.js → echarts-GOV5M733.js} +2 -2
- package/dist/bundle/{embed-LB6ONWHX.js → embed-2IVIYNAJ.js} +6 -6
- package/dist/bundle/{embedder-WE7B2RU5.js → embedder-2HU7JYZK.js} +9 -9
- package/dist/bundle/{entry-W6Y52ZRN.js → entry-CSTCXYI5.js} +9 -9
- package/dist/bundle/{failure-7Y34AUJT.js → failure-GMUQKQ5K.js} +2 -2
- package/dist/bundle/{first-run-NVYNZZA6.js → first-run-3IZGXZT5.js} +12 -11
- package/dist/bundle/first-screen-7QSNCZIK.js +35 -0
- package/dist/bundle/{instructions-MRUC57NS.js → instructions-YSXV6FAC.js} +1 -1
- package/dist/bundle/{mcp-TDKGDB4V.js → mcp-VFIOZDVY.js} +2 -2
- package/dist/bundle/meeting-combined-X4E3LSIJ.js +23 -0
- package/dist/bundle/meeting-model-FQBDHGRU.js +24 -0
- package/dist/bundle/meeting-semantic-ONNEOJX5.js +21 -0
- package/dist/bundle/{node-G7PMDYQV.js → node-FMQWCZRS.js} +2 -2
- package/dist/bundle/{node-sqlite-RXWQ3SES.js → node-sqlite-YN5OKOC6.js} +7 -7
- package/dist/bundle/{oauth-6ZWOL6KX.js → oauth-EW7PTZVT.js} +7 -7
- package/dist/bundle/{open-V7LMZCFI.js → open-Q2RDY344.js} +5 -5
- package/dist/bundle/{openai-P472V4ZM.js → openai-STON6G3O.js} +28 -26
- package/dist/bundle/{process-GSNPENHL.js → process-OQUC2TW3.js} +1 -1
- package/dist/bundle/{program-IELITPKT.js → program-N5BT75OC.js} +66 -57
- package/dist/bundle/{prompt-2CP6CQ5N.js → prompt-WHVF7UTW.js} +5 -5
- package/dist/bundle/{proxy-transport-DP7SIMIC.js → proxy-transport-A4MRO3PF.js} +5 -5
- package/dist/bundle/{recognize-R2DEQ5TC.js → recognize-YDQWMXNI.js} +4 -4
- package/dist/bundle/{remote-JG3POFES.js → remote-477LQHP6.js} +9 -9
- package/dist/bundle/{rerank-TVMR3OLL.js → rerank-4YPB26FG.js} +7 -7
- package/dist/bundle/{serve-DBWSMLPH.js → serve-FXJNUOTS.js} +9 -9
- package/dist/bundle/{server-EXJ2WNZY.js → server-2S6HFBGR.js} +44 -36
- package/dist/bundle/server-UOSUTZNE.js +69 -0
- package/dist/bundle/{sqlite-runtime-AWMY7W4Q.js → sqlite-runtime-RXYNJYMC.js} +6 -6
- package/dist/bundle/{state-HN44BWNQ.js → state-I2GGYGRL.js} +6 -6
- package/dist/bundle/{store-LOVKYQDC.js → store-KX3AAQZH.js} +25 -20
- package/dist/bundle/{store-GIYS3LHV.js → store-VQXIB6KV.js} +17 -13
- package/dist/bundle/store-maintenance-command-LW2MMDLY.js +60 -0
- package/dist/bundle/tg.js +13 -13
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/skills/tg-cli/SKILL.md +11 -4
- package/dist/bundle/command-contract-3BSXDYBC.js +0 -34
- package/dist/bundle/decode-NXB7E46F.js +0 -162
- package/dist/bundle/first-screen-Z6TVHK6I.js +0 -32
- package/dist/bundle/server-SXNFFAIR.js +0 -61
- package/dist/bundle/store-maintenance-command-X3VOYNCG.js +0 -52
- /package/dist/bundle/{chunk-XWBPP2HX.js → chunk-ZI3YTXSF.js} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirecat/tg-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.130.0",
|
|
4
4
|
"description": "A local command line interface for a personal Telegram account, built for agents and scripts",
|
|
5
5
|
"mcpName": "dev.wirecat/tg-cli",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
74
|
"@mtcute/node": "0.32.7",
|
|
75
|
-
"@wirecat/cli-base": "0.
|
|
76
|
-
"@wirecat/cli-core": "0.
|
|
75
|
+
"@wirecat/cli-base": "0.101.0",
|
|
76
|
+
"@wirecat/cli-core": "0.665.0",
|
|
77
77
|
"commander": "15.0.0",
|
|
78
78
|
"undici": "8.12.3",
|
|
79
79
|
"valibot": "1.5.0"
|
package/skills/tg-cli/SKILL.md
CHANGED
|
@@ -179,8 +179,14 @@ summary; news digests remain separate future work. Permission: `messages.evidenc
|
|
|
179
179
|
only when the owner asks to include their notes or imported Drive documents**: it adds both to the messages, in one
|
|
180
180
|
answer, each hit typed (`message`, `note`, `document`). Imported Drive documents retain their Google link and edit time; `--source drive:<profile>` selects a registered Drive profile. `tg personal chats documents list CHAT_ID` shows documents linked in stored messages. Mail is memo's (`memo search mail`). Narrow with `tg personal search messages`, `search notes`,
|
|
181
181
|
`search conversations` (by meaning) or `search topics`; every search lives under `tg personal search`.
|
|
182
|
-
For a
|
|
183
|
-
|
|
182
|
+
**For a question in the owner's own words** (a sentence, unsure wording, a name that may be misspelled, no chat
|
|
183
|
+
named), search in this order: `tg personal search conversations '<question>'` (by meaning and words; `conversations
|
|
184
|
+
status` shows which chats have vectors), then `tg personal search messages '<question>' --discover`, then key words.
|
|
185
|
+
Pass the question as the owner wrote it; do not cut it to one word first. Never filter the results yourself
|
|
186
|
+
(`grep -v`, `jq select`) by chat or sender: a hit in a chat you did not expect is often the answer. When the owner
|
|
187
|
+
says "I advised / I wrote", add `from:me`. A search that stops at its time limit answers `query.time-limit`: run it
|
|
188
|
+
again with `--timeout 60s` before trying other words.
|
|
189
|
+
For `--discover` (MCP `discover: true`): it searches the local archive without model downloads, keeps hard filters
|
|
184
190
|
and includes eligible direct replies. Inspect missing terms, parent links and the messages;
|
|
185
191
|
the first result and its score do not establish an answer. Explicit syntax remains strict.
|
|
186
192
|
**Without `--discover`, `tg personal search messages` also asks Telegram's search** (`--backend both`; `archive`
|
|
@@ -261,7 +267,8 @@ summary; news digests remain separate future work. Permission: `messages.evidenc
|
|
|
261
267
|
22. **Nothing relevant: search again in other words before saying it is not there.** A search finds the words
|
|
262
268
|
it is given, and a paraphrase misses. Try the words the answer itself would contain (a document's title, the
|
|
263
269
|
term the sender would use), one or two key words instead of a sentence, a synonym, the other language; for a
|
|
264
|
-
question, `--discover
|
|
270
|
+
question, `search conversations` and `--discover` first (trap 5). After two or three tries, say what you searched
|
|
271
|
+
for.
|
|
265
272
|
|
|
266
273
|
## The usual path
|
|
267
274
|
|
|
@@ -337,7 +344,7 @@ tg personal search messages "invoice march" --backend archive --json # this mac
|
|
|
337
344
|
tg personal search all "invoice march" --json # only when the owner asks: adds their notes and Drive documents
|
|
338
345
|
tg personal conversations links rebuild --chat -1001234567890 --json # the threads inside a group, from what was kept; then list | show
|
|
339
346
|
tg skill show link-conversations # only when the owner asks you to untangle a chat's threads yourself
|
|
340
|
-
tg personal search conversations "<question>" --json # by meaning
|
|
347
|
+
tg personal search conversations "<question>" --json # by meaning and words: the first search for a question in the owner's words
|
|
341
348
|
tg personal watch --jsonl # new messages as {"type":"item","data"} lines, then a {"type":"end"} line
|
|
342
349
|
```
|
|
343
350
|
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
SCHEMA_DIALECT,
|
|
5
|
-
commandContract,
|
|
6
|
-
commandPathOf,
|
|
7
|
-
findCommand,
|
|
8
|
-
outputOf
|
|
9
|
-
} from "./chunk-XYAH6QQO.js";
|
|
10
|
-
import "./chunk-2QHIOPSA.js";
|
|
11
|
-
import "./chunk-ZVLYK6CZ.js";
|
|
12
|
-
import "./chunk-QYN5RDTZ.js";
|
|
13
|
-
import "./chunk-YVV5S2QA.js";
|
|
14
|
-
import "./chunk-QO4ON2X7.js";
|
|
15
|
-
import "./chunk-RIGNCUZD.js";
|
|
16
|
-
import "./chunk-F4UIBEQK.js";
|
|
17
|
-
import "./chunk-BVCRDHI2.js";
|
|
18
|
-
import "./chunk-AF2XVV5P.js";
|
|
19
|
-
import "./chunk-MGBVVQTU.js";
|
|
20
|
-
import "./chunk-7D6LI2N7.js";
|
|
21
|
-
import "./chunk-XWBPP2HX.js";
|
|
22
|
-
import "./chunk-TQFUAKU6.js";
|
|
23
|
-
import "./chunk-NM5GBJME.js";
|
|
24
|
-
import "./chunk-XS5C5TQ7.js";
|
|
25
|
-
import "./chunk-Y5E2WNWB.js";
|
|
26
|
-
import "./chunk-7KCBPAQS.js";
|
|
27
|
-
import "./chunk-ZVVMGPBJ.js";
|
|
28
|
-
export {
|
|
29
|
-
SCHEMA_DIALECT,
|
|
30
|
-
commandContract,
|
|
31
|
-
commandPathOf,
|
|
32
|
-
findCommand,
|
|
33
|
-
outputOf
|
|
34
|
-
};
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
SAMPLE_RATE,
|
|
5
|
-
decodeOgg
|
|
6
|
-
} from "./chunk-NXDQXDRN.js";
|
|
7
|
-
import "./chunk-NM5GBJME.js";
|
|
8
|
-
import "./chunk-XS5C5TQ7.js";
|
|
9
|
-
import {
|
|
10
|
-
importFrom
|
|
11
|
-
} from "./chunk-Y5E2WNWB.js";
|
|
12
|
-
import {
|
|
13
|
-
CliError
|
|
14
|
-
} from "./chunk-7KCBPAQS.js";
|
|
15
|
-
import {
|
|
16
|
-
__name
|
|
17
|
-
} from "./chunk-ZVVMGPBJ.js";
|
|
18
|
-
|
|
19
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.662.0_@napi-rs+canvas@1.0.13_@wirecat+cli-base@0.99.0_commander@15._e11817b5a9b273e1a17561462f2db6c9/node_modules/@wirecat/cli-core/dist/speech/decode.js
|
|
20
|
-
import { spawn } from "node:child_process";
|
|
21
|
-
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
22
|
-
import { createRequire } from "node:module";
|
|
23
|
-
import { tmpdir } from "node:os";
|
|
24
|
-
import { join } from "node:path";
|
|
25
|
-
import { pathToFileURL } from "node:url";
|
|
26
|
-
var LONGEST_AUDIO_SECONDS = 3600;
|
|
27
|
-
var FFMPEG_TIMEOUT_MS = 12e4;
|
|
28
|
-
var FFMPEG_FORMATS = "mov,mp4,m4a,3gp,3g2,mj2,aac,mp3,wav,amr,caf,aiff,flac,ogg,matroska,webm,asf";
|
|
29
|
-
var text = /* @__PURE__ */ __name((bytes, from, length) => String.fromCharCode(...bytes.subarray(from, from + length)), "text");
|
|
30
|
-
var contains = /* @__PURE__ */ __name((bytes, needle, within) => Buffer.from(bytes.buffer, bytes.byteOffset, Math.min(bytes.length, within)).includes(needle, 0, "latin1"), "contains");
|
|
31
|
-
var formatOf = /* @__PURE__ */ __name((bytes) => {
|
|
32
|
-
if (text(bytes, 0, 4) === "OggS") {
|
|
33
|
-
if (contains(bytes, "OpusHead", 128))
|
|
34
|
-
return "opus";
|
|
35
|
-
if (contains(bytes, "vorbis", 128))
|
|
36
|
-
return "vorbis";
|
|
37
|
-
return "other";
|
|
38
|
-
}
|
|
39
|
-
if (text(bytes, 0, 4) === "fLaC")
|
|
40
|
-
return "flac";
|
|
41
|
-
const frame = bytes[0] === 255 && ((bytes[1] ?? 0) & 224) === 224 && ((bytes[1] ?? 0) >> 1 & 3) !== 0;
|
|
42
|
-
if (text(bytes, 0, 3) === "ID3" || frame)
|
|
43
|
-
return "mp3";
|
|
44
|
-
return "other";
|
|
45
|
-
}, "formatOf");
|
|
46
|
-
var everyChannel = /* @__PURE__ */ __name((decoded) => {
|
|
47
|
-
if (!decoded.channelData[0] || decoded.samplesDecoded === 0)
|
|
48
|
-
throw new CliError("validation_error", "no audio in that file");
|
|
49
|
-
return decoded.channelData.map((samples) => ({ samples, rate: decoded.sampleRate }));
|
|
50
|
-
}, "everyChannel");
|
|
51
|
-
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
|
-
var decodeVorbis = /* @__PURE__ */ __name(async (bytes) => {
|
|
53
|
-
const { OggVorbisDecoder } = await load("@wasm-audio-decoders/ogg-vorbis");
|
|
54
|
-
const decoder = new OggVorbisDecoder();
|
|
55
|
-
await decoder.ready;
|
|
56
|
-
try {
|
|
57
|
-
return everyChannel(await decoder.decodeFile(bytes));
|
|
58
|
-
} finally {
|
|
59
|
-
decoder.free();
|
|
60
|
-
}
|
|
61
|
-
}, "decodeVorbis");
|
|
62
|
-
var decodeFlac = /* @__PURE__ */ __name(async (bytes) => {
|
|
63
|
-
const { FLACDecoder } = await load("@wasm-audio-decoders/flac");
|
|
64
|
-
const decoder = new FLACDecoder();
|
|
65
|
-
await decoder.ready;
|
|
66
|
-
try {
|
|
67
|
-
return everyChannel(await decoder.decodeFile(bytes));
|
|
68
|
-
} finally {
|
|
69
|
-
decoder.free();
|
|
70
|
-
}
|
|
71
|
-
}, "decodeFlac");
|
|
72
|
-
var decodeMp3 = /* @__PURE__ */ __name(async (bytes) => {
|
|
73
|
-
const { MPEGDecoder } = await load("mpg123-decoder");
|
|
74
|
-
const decoder = new MPEGDecoder();
|
|
75
|
-
await decoder.ready;
|
|
76
|
-
try {
|
|
77
|
-
return everyChannel(decoder.decode(bytes));
|
|
78
|
-
} finally {
|
|
79
|
-
decoder.free();
|
|
80
|
-
}
|
|
81
|
-
}, "decodeMp3");
|
|
82
|
-
var runFfmpeg = /* @__PURE__ */ __name(async (bytes) => {
|
|
83
|
-
const directory = await mkdtemp(join(tmpdir(), "wirecat-audio-"));
|
|
84
|
-
try {
|
|
85
|
-
const input = join(directory, "audio");
|
|
86
|
-
await writeFile(input, bytes, { mode: 384 });
|
|
87
|
-
const largest = LONGEST_AUDIO_SECONDS * SAMPLE_RATE * 4;
|
|
88
|
-
const output = await new Promise((resolve, reject) => {
|
|
89
|
-
const child = spawn("ffmpeg", [
|
|
90
|
-
"-nostdin",
|
|
91
|
-
"-hide_banner",
|
|
92
|
-
"-loglevel",
|
|
93
|
-
"error",
|
|
94
|
-
"-protocol_whitelist",
|
|
95
|
-
"file",
|
|
96
|
-
"-format_whitelist",
|
|
97
|
-
FFMPEG_FORMATS,
|
|
98
|
-
"-i",
|
|
99
|
-
input,
|
|
100
|
-
"-vn",
|
|
101
|
-
"-ac",
|
|
102
|
-
"1",
|
|
103
|
-
"-ar",
|
|
104
|
-
String(SAMPLE_RATE),
|
|
105
|
-
"-f",
|
|
106
|
-
"f32le",
|
|
107
|
-
"pipe:1"
|
|
108
|
-
], { stdio: ["ignore", "pipe", "pipe"], timeout: FFMPEG_TIMEOUT_MS });
|
|
109
|
-
const chunks = [];
|
|
110
|
-
let size = 0;
|
|
111
|
-
let errors = "";
|
|
112
|
-
child.stdout.on("data", (chunk) => {
|
|
113
|
-
size += chunk.length;
|
|
114
|
-
if (size > largest)
|
|
115
|
-
child.kill();
|
|
116
|
-
else
|
|
117
|
-
chunks.push(chunk);
|
|
118
|
-
});
|
|
119
|
-
child.stderr.on("data", (chunk) => {
|
|
120
|
-
errors = (errors + chunk.toString()).slice(-500);
|
|
121
|
-
});
|
|
122
|
-
child.on("error", (error) => reject(error.code === "ENOENT" ? new CliError("validation_error", "only ffmpeg reads this audio format, and ffmpeg is not installed") : error));
|
|
123
|
-
child.on("close", (code) => {
|
|
124
|
-
if (size > largest)
|
|
125
|
-
reject(new CliError("validation_error", `the audio is longer than ${LONGEST_AUDIO_SECONDS / 60} minutes`));
|
|
126
|
-
else if (code === 0)
|
|
127
|
-
resolve(Buffer.concat(chunks));
|
|
128
|
-
else
|
|
129
|
-
reject(new CliError("validation_error", `ffmpeg could not read the audio: ${errors.trim() || code}`));
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
const samples = new Float32Array(Math.floor(output.length / 4));
|
|
133
|
-
Buffer.from(samples.buffer).set(output.subarray(0, samples.length * 4));
|
|
134
|
-
return { samples, rate: SAMPLE_RATE };
|
|
135
|
-
} finally {
|
|
136
|
-
await rm(directory, { recursive: true, force: true });
|
|
137
|
-
}
|
|
138
|
-
}, "runFfmpeg");
|
|
139
|
-
var BUNDLED = {
|
|
140
|
-
opus: decodeOgg,
|
|
141
|
-
vorbis: decodeVorbis,
|
|
142
|
-
flac: decodeFlac,
|
|
143
|
-
mp3: decodeMp3
|
|
144
|
-
};
|
|
145
|
-
var tooLong = /* @__PURE__ */ __name((pcm) => pcm.samples.length / pcm.rate > LONGEST_AUDIO_SECONDS, "tooLong");
|
|
146
|
-
var decodeChannels = /* @__PURE__ */ __name(async (bytes, ffmpeg = runFfmpeg) => {
|
|
147
|
-
const format = formatOf(bytes);
|
|
148
|
-
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 }), () => {
|
|
149
|
-
throw error;
|
|
150
|
-
}));
|
|
151
|
-
if (decoded.channels.some(tooLong))
|
|
152
|
-
throw new CliError("validation_error", `the audio is longer than ${LONGEST_AUDIO_SECONDS / 60} minutes`);
|
|
153
|
-
return decoded;
|
|
154
|
-
}, "decodeChannels");
|
|
155
|
-
var decodeAudio = /* @__PURE__ */ __name(async (bytes, ffmpeg = runFfmpeg) => (await decodeChannels(bytes, ffmpeg)).channels[0], "decodeAudio");
|
|
156
|
-
export {
|
|
157
|
-
LONGEST_AUDIO_SECONDS,
|
|
158
|
-
decodeAudio,
|
|
159
|
-
decodeChannels,
|
|
160
|
-
formatOf,
|
|
161
|
-
runFfmpeg
|
|
162
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
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-JJGPU24U.js";
|
|
8
|
-
import "./chunk-2ABQZVK4.js";
|
|
9
|
-
import "./chunk-XYAH6QQO.js";
|
|
10
|
-
import "./chunk-2QHIOPSA.js";
|
|
11
|
-
import "./chunk-ZVLYK6CZ.js";
|
|
12
|
-
import "./chunk-QYN5RDTZ.js";
|
|
13
|
-
import "./chunk-YVV5S2QA.js";
|
|
14
|
-
import "./chunk-QO4ON2X7.js";
|
|
15
|
-
import "./chunk-RIGNCUZD.js";
|
|
16
|
-
import "./chunk-F4UIBEQK.js";
|
|
17
|
-
import "./chunk-BVCRDHI2.js";
|
|
18
|
-
import "./chunk-AF2XVV5P.js";
|
|
19
|
-
import "./chunk-MGBVVQTU.js";
|
|
20
|
-
import "./chunk-7D6LI2N7.js";
|
|
21
|
-
import "./chunk-XWBPP2HX.js";
|
|
22
|
-
import "./chunk-TQFUAKU6.js";
|
|
23
|
-
import "./chunk-NM5GBJME.js";
|
|
24
|
-
import "./chunk-XS5C5TQ7.js";
|
|
25
|
-
import "./chunk-Y5E2WNWB.js";
|
|
26
|
-
import "./chunk-7KCBPAQS.js";
|
|
27
|
-
import "./chunk-ZVVMGPBJ.js";
|
|
28
|
-
export {
|
|
29
|
-
WIRECAT_TOOLS,
|
|
30
|
-
firstScreen,
|
|
31
|
-
installHelp
|
|
32
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
PER_RUN,
|
|
5
|
-
createServer,
|
|
6
|
-
envelope,
|
|
7
|
-
serveOverHttpUntilStopped,
|
|
8
|
-
serveOverStdio
|
|
9
|
-
} from "./chunk-EAUHYQUK.js";
|
|
10
|
-
import "./chunk-YSXDCSBP.js";
|
|
11
|
-
import "./chunk-IV2KJQ5F.js";
|
|
12
|
-
import "./chunk-R4QVV3LN.js";
|
|
13
|
-
import "./chunk-MC6FOTCV.js";
|
|
14
|
-
import "./chunk-IHLNXL2D.js";
|
|
15
|
-
import "./chunk-5D4AEUVA.js";
|
|
16
|
-
import "./chunk-Q3ZO6Q3M.js";
|
|
17
|
-
import "./chunk-FHGAJK4I.js";
|
|
18
|
-
import "./chunk-IIHCSJV2.js";
|
|
19
|
-
import "./chunk-SDLJJF7E.js";
|
|
20
|
-
import "./chunk-LD42OGKK.js";
|
|
21
|
-
import "./chunk-FIVFP53N.js";
|
|
22
|
-
import "./chunk-2IL4YDGG.js";
|
|
23
|
-
import "./chunk-KF2Q776U.js";
|
|
24
|
-
import "./chunk-TGUXKG4B.js";
|
|
25
|
-
import "./chunk-4DSIGS2E.js";
|
|
26
|
-
import "./chunk-ODBK56ZR.js";
|
|
27
|
-
import "./chunk-7I5NMVX7.js";
|
|
28
|
-
import "./chunk-T2CWSFGY.js";
|
|
29
|
-
import "./chunk-2A3TC52A.js";
|
|
30
|
-
import "./chunk-WG3BF7SA.js";
|
|
31
|
-
import "./chunk-3UGRMFWK.js";
|
|
32
|
-
import "./chunk-M4OP5ASJ.js";
|
|
33
|
-
import "./chunk-D72URWJE.js";
|
|
34
|
-
import "./chunk-JI2PFQFL.js";
|
|
35
|
-
import "./chunk-LTADKMP5.js";
|
|
36
|
-
import "./chunk-XYAH6QQO.js";
|
|
37
|
-
import "./chunk-2QHIOPSA.js";
|
|
38
|
-
import "./chunk-ZVLYK6CZ.js";
|
|
39
|
-
import "./chunk-QYN5RDTZ.js";
|
|
40
|
-
import "./chunk-YVV5S2QA.js";
|
|
41
|
-
import "./chunk-QO4ON2X7.js";
|
|
42
|
-
import "./chunk-RIGNCUZD.js";
|
|
43
|
-
import "./chunk-F4UIBEQK.js";
|
|
44
|
-
import "./chunk-BVCRDHI2.js";
|
|
45
|
-
import "./chunk-AF2XVV5P.js";
|
|
46
|
-
import "./chunk-MGBVVQTU.js";
|
|
47
|
-
import "./chunk-7D6LI2N7.js";
|
|
48
|
-
import "./chunk-XWBPP2HX.js";
|
|
49
|
-
import "./chunk-TQFUAKU6.js";
|
|
50
|
-
import "./chunk-NM5GBJME.js";
|
|
51
|
-
import "./chunk-XS5C5TQ7.js";
|
|
52
|
-
import "./chunk-Y5E2WNWB.js";
|
|
53
|
-
import "./chunk-7KCBPAQS.js";
|
|
54
|
-
import "./chunk-ZVVMGPBJ.js";
|
|
55
|
-
export {
|
|
56
|
-
PER_RUN,
|
|
57
|
-
createServer,
|
|
58
|
-
envelope,
|
|
59
|
-
serveOverHttpUntilStopped,
|
|
60
|
-
serveOverStdio
|
|
61
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
addStoreMaintenanceCommands,
|
|
5
|
-
buildStems,
|
|
6
|
-
storeMaintenanceCommands,
|
|
7
|
-
storeSummary
|
|
8
|
-
} from "./chunk-RZFIQMOA.js";
|
|
9
|
-
import "./chunk-FHGAJK4I.js";
|
|
10
|
-
import "./chunk-IIHCSJV2.js";
|
|
11
|
-
import "./chunk-SDLJJF7E.js";
|
|
12
|
-
import "./chunk-LD42OGKK.js";
|
|
13
|
-
import "./chunk-FIVFP53N.js";
|
|
14
|
-
import "./chunk-2IL4YDGG.js";
|
|
15
|
-
import "./chunk-KF2Q776U.js";
|
|
16
|
-
import "./chunk-TGUXKG4B.js";
|
|
17
|
-
import "./chunk-4DSIGS2E.js";
|
|
18
|
-
import "./chunk-2ABQZVK4.js";
|
|
19
|
-
import "./chunk-GYO4WXLG.js";
|
|
20
|
-
import "./chunk-7I5NMVX7.js";
|
|
21
|
-
import "./chunk-T2CWSFGY.js";
|
|
22
|
-
import "./chunk-2A3TC52A.js";
|
|
23
|
-
import "./chunk-WG3BF7SA.js";
|
|
24
|
-
import "./chunk-3UGRMFWK.js";
|
|
25
|
-
import "./chunk-M4OP5ASJ.js";
|
|
26
|
-
import "./chunk-D72URWJE.js";
|
|
27
|
-
import "./chunk-JI2PFQFL.js";
|
|
28
|
-
import "./chunk-LTADKMP5.js";
|
|
29
|
-
import "./chunk-2QHIOPSA.js";
|
|
30
|
-
import "./chunk-ZVLYK6CZ.js";
|
|
31
|
-
import "./chunk-QYN5RDTZ.js";
|
|
32
|
-
import "./chunk-YVV5S2QA.js";
|
|
33
|
-
import "./chunk-QO4ON2X7.js";
|
|
34
|
-
import "./chunk-RIGNCUZD.js";
|
|
35
|
-
import "./chunk-F4UIBEQK.js";
|
|
36
|
-
import "./chunk-BVCRDHI2.js";
|
|
37
|
-
import "./chunk-AF2XVV5P.js";
|
|
38
|
-
import "./chunk-MGBVVQTU.js";
|
|
39
|
-
import "./chunk-7D6LI2N7.js";
|
|
40
|
-
import "./chunk-XWBPP2HX.js";
|
|
41
|
-
import "./chunk-TQFUAKU6.js";
|
|
42
|
-
import "./chunk-NM5GBJME.js";
|
|
43
|
-
import "./chunk-XS5C5TQ7.js";
|
|
44
|
-
import "./chunk-Y5E2WNWB.js";
|
|
45
|
-
import "./chunk-7KCBPAQS.js";
|
|
46
|
-
import "./chunk-ZVVMGPBJ.js";
|
|
47
|
-
export {
|
|
48
|
-
addStoreMaintenanceCommands,
|
|
49
|
-
buildStems,
|
|
50
|
-
storeMaintenanceCommands,
|
|
51
|
-
storeSummary
|
|
52
|
-
};
|
|
File without changes
|