@wirecat/mail-cli 0.0.0-stage → 0.1.1
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/CHANGELOG.md +60 -0
- package/LICENSE +204 -0
- package/README.md +166 -2
- package/dist/bin/mail.d.ts +3 -0
- package/dist/bin/mail.d.ts.map +1 -0
- package/dist/bin/mail.js +36 -0
- package/dist/bin/mail.js.map +1 -0
- package/dist/bundle/all-profiles-TKMBELRZ.js +286 -0
- package/dist/bundle/anthropic-7LMUAEIZ.js +72 -0
- package/dist/bundle/app-server-JGMIJDD4.js +229 -0
- package/dist/bundle/bun-XRO6XJHQ.js +169 -0
- package/dist/bundle/bun-sqlite-Z54LEHVM.js +71 -0
- package/dist/bundle/chunk-2LLNPNMB.js +24 -0
- package/dist/bundle/chunk-3E3WA2L6.js +1932 -0
- package/dist/bundle/chunk-3KEVLSNN.js +138 -0
- package/dist/bundle/chunk-3KOA73LS.js +3416 -0
- package/dist/bundle/chunk-4E7BN3TC.js +122 -0
- package/dist/bundle/chunk-4FEMINO2.js +409 -0
- package/dist/bundle/chunk-52F5DWS5.js +27 -0
- package/dist/bundle/chunk-5BVIWP3S.js +71 -0
- package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
- package/dist/bundle/chunk-5NYMNSSO.js +264 -0
- package/dist/bundle/chunk-6MAZWSC3.js +132 -0
- package/dist/bundle/chunk-75CWWETH.js +379 -0
- package/dist/bundle/chunk-7SXGLT6T.js +444 -0
- package/dist/bundle/chunk-BTQX2ZSZ.js +288 -0
- package/dist/bundle/chunk-CEW6KIFA.js +1193 -0
- package/dist/bundle/chunk-CH6RXYAX.js +82 -0
- package/dist/bundle/chunk-D72URWJE.js +532 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-EOEDICIE.js +6848 -0
- package/dist/bundle/chunk-F6D6PJ34.js +100 -0
- package/dist/bundle/chunk-FDCGTODC.js +78 -0
- package/dist/bundle/chunk-FZ5FXIG6.js +18 -0
- package/dist/bundle/chunk-GAH7N7HO.js +8181 -0
- package/dist/bundle/chunk-GK4M2SUP.js +195 -0
- package/dist/bundle/chunk-GN62YOT5.js +161 -0
- package/dist/bundle/chunk-GQQJOH7A.js +7050 -0
- package/dist/bundle/chunk-GWDCKUBI.js +781 -0
- package/dist/bundle/chunk-HTQTIKWP.js +928 -0
- package/dist/bundle/chunk-IK5TH3O7.js +217 -0
- package/dist/bundle/chunk-J3QXTBD2.js +2742 -0
- package/dist/bundle/chunk-J6MSJLIW.js +45 -0
- package/dist/bundle/chunk-JBBZCTTF.js +76 -0
- package/dist/bundle/chunk-JVMVLITS.js +260 -0
- package/dist/bundle/chunk-K4FVKPDQ.js +525 -0
- package/dist/bundle/chunk-KHTO2Q6E.js +886 -0
- package/dist/bundle/chunk-KM7Q67Z3.js +63 -0
- package/dist/bundle/chunk-LQ37ALDJ.js +2416 -0
- package/dist/bundle/chunk-MNOIRJEO.js +2315 -0
- package/dist/bundle/chunk-MS53RALV.js +168 -0
- package/dist/bundle/chunk-NK7EB63L.js +36225 -0
- package/dist/bundle/chunk-NPGVOZVK.js +2 -0
- package/dist/bundle/chunk-OTUOZ33L.js +82 -0
- package/dist/bundle/chunk-P7P5MNAU.js +46 -0
- package/dist/bundle/chunk-QLEUNU6G.js +537 -0
- package/dist/bundle/chunk-QQB7WT7R.js +216 -0
- package/dist/bundle/chunk-QX7RCLRS.js +23 -0
- package/dist/bundle/chunk-T6464KYA.js +35130 -0
- package/dist/bundle/chunk-TE5U5OAM.js +73 -0
- package/dist/bundle/chunk-TI6VBZKJ.js +166 -0
- package/dist/bundle/chunk-TQFCPUIM.js +53 -0
- package/dist/bundle/chunk-TVREDYX4.js +3574 -0
- package/dist/bundle/chunk-TWPDVUBR.js +106 -0
- package/dist/bundle/chunk-TWTATDM7.js +461 -0
- package/dist/bundle/chunk-UH4DDRHA.js +2989 -0
- package/dist/bundle/chunk-VEIZZRQ5.js +630 -0
- package/dist/bundle/chunk-WLFLBWNH.js +54 -0
- package/dist/bundle/chunk-WXAXYJJ7.js +486 -0
- package/dist/bundle/chunk-XQUUANA2.js +24600 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-YO4CUH5E.js +33 -0
- package/dist/bundle/chunk-YPQQ5J4X.js +849 -0
- package/dist/bundle/chunk-Z34ICZA3.js +1028 -0
- package/dist/bundle/chunk-ZANYM66S.js +58 -0
- package/dist/bundle/chunk-ZD3WUGR2.js +142 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/command-contract-WU434ZUL.js +34 -0
- package/dist/bundle/decode-YB3ZDTES.js +162 -0
- package/dist/bundle/dispatch-EUKKT3PD.js +411 -0
- package/dist/bundle/dist-A6GKSKFC.js +2072 -0
- package/dist/bundle/dist-HFUVURJG.js +7577 -0
- package/dist/bundle/echarts-YNGCOYHW.js +42501 -0
- package/dist/bundle/embed-LWNHIRBQ.js +37 -0
- package/dist/bundle/embedder-2LYD3U37.js +110 -0
- package/dist/bundle/failure-OAIC5VAP.js +24 -0
- package/dist/bundle/first-run-N3HJKGU7.js +27 -0
- package/dist/bundle/first-screen-4U2DMV3G.js +32 -0
- package/dist/bundle/instructions-GJHHFV64.js +11 -0
- package/dist/bundle/mail.js +166 -0
- package/dist/bundle/mcp-L7SRVDRN.js +167 -0
- package/dist/bundle/node-GFOH6FKP.js +176 -0
- package/dist/bundle/node-KM3CUABH.js +2340 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-sqlite-NBXQXBIU.js +63 -0
- package/dist/bundle/oauth-56EFO5AQ.js +19 -0
- package/dist/bundle/open-2V7QZQJP.js +21 -0
- package/dist/bundle/openai-V3SVACVL.js +251 -0
- package/dist/bundle/process-XVDX4SPD.js +91 -0
- package/dist/bundle/program-JTJB26P3.js +35542 -0
- package/dist/bundle/prompt-YKWAI222.js +14 -0
- package/dist/bundle/recognize-PAR66KVM.js +25 -0
- package/dist/bundle/remote-CE43TKXC.js +28 -0
- package/dist/bundle/rerank-M7S7P2TW.js +51 -0
- package/dist/bundle/serve-ENPMIV6J.js +197 -0
- package/dist/bundle/server-JRTHUCVY.js +63 -0
- package/dist/bundle/server-MBEZLVKZ.js +189 -0
- package/dist/bundle/sqlite-runtime-HVGDHBJJ.js +18 -0
- package/dist/bundle/state-QZSOSKBD.js +35 -0
- package/dist/bundle/store-2BUX6LVX.js +124 -0
- package/dist/bundle/store-UJ7SNKXI.js +141 -0
- package/dist/bundle/store-maintenance-command-I7V5C44K.js +52 -0
- package/dist/commands/account.d.ts +3 -0
- package/dist/commands/account.d.ts.map +1 -0
- package/dist/commands/account.js +47 -0
- package/dist/commands/account.js.map +1 -0
- package/dist/commands/context.d.ts +41 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +52 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/folders.d.ts +3 -0
- package/dist/commands/folders.d.ts.map +1 -0
- package/dist/commands/folders.js +36 -0
- package/dist/commands/folders.js.map +1 -0
- package/dist/commands/login.d.ts +5 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +21 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/mailbox.d.ts +16 -0
- package/dist/commands/mailbox.d.ts.map +1 -0
- package/dist/commands/mailbox.js +54 -0
- package/dist/commands/mailbox.js.map +1 -0
- package/dist/commands/session.d.ts +3 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +211 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +89 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/sync.d.ts +3 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +190 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/config.d.ts +190 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +46 -0
- package/dist/config.js.map +1 -0
- package/dist/discovery.d.ts +42 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +179 -0
- package/dist/discovery.js.map +1 -0
- package/dist/identity.d.ts +5 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +16 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/mail/imap-errors.d.ts +4 -0
- package/dist/mail/imap-errors.d.ts.map +1 -0
- package/dist/mail/imap-errors.js +41 -0
- package/dist/mail/imap-errors.js.map +1 -0
- package/dist/mail/imap-messages.d.ts +18 -0
- package/dist/mail/imap-messages.d.ts.map +1 -0
- package/dist/mail/imap-messages.js +66 -0
- package/dist/mail/imap-messages.js.map +1 -0
- package/dist/mail/imap.d.ts +67 -0
- package/dist/mail/imap.d.ts.map +1 -0
- package/dist/mail/imap.js +348 -0
- package/dist/mail/imap.js.map +1 -0
- package/dist/profile.d.ts +16 -0
- package/dist/profile.d.ts.map +1 -0
- package/dist/profile.js +31 -0
- package/dist/profile.js.map +1 -0
- package/dist/program.d.ts +6 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +52 -0
- package/dist/program.js.map +1 -0
- package/dist/providers.d.ts +53 -0
- package/dist/providers.d.ts.map +1 -0
- package/dist/providers.js +106 -0
- package/dist/providers.js.map +1 -0
- package/dist/secret.d.ts +30 -0
- package/dist/secret.d.ts.map +1 -0
- package/dist/secret.js +68 -0
- package/dist/secret.js.map +1 -0
- package/dist/store.d.ts +12 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +25 -0
- package/dist/store.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/package.json +83 -4
- package/skills/mail-cli/SKILL.md +27 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
importFrom
|
|
5
|
+
} from "./chunk-Y5E2WNWB.js";
|
|
6
|
+
import {
|
|
7
|
+
CliError
|
|
8
|
+
} from "./chunk-5BVIWP3S.js";
|
|
9
|
+
import {
|
|
10
|
+
__name
|
|
11
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
12
|
+
|
|
13
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/speech/recognize.js
|
|
14
|
+
import { createRequire } from "node:module";
|
|
15
|
+
|
|
16
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/speech/ogg-limit.js
|
|
17
|
+
var invalid = /* @__PURE__ */ __name(() => new CliError("validation_error", "local transcription needs a complete mono or stereo Ogg Opus recording"), "invalid");
|
|
18
|
+
var checkOggDuration = /* @__PURE__ */ __name((bytes) => {
|
|
19
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
20
|
+
let offset = 0;
|
|
21
|
+
let serial;
|
|
22
|
+
let packet = 0;
|
|
23
|
+
let length = 0;
|
|
24
|
+
const prefix = [];
|
|
25
|
+
while (offset < bytes.length) {
|
|
26
|
+
if (offset + 27 > bytes.length || view.getUint32(offset, false) !== 1332176723 || bytes[offset + 4] !== 0)
|
|
27
|
+
throw invalid();
|
|
28
|
+
const stream = view.getUint32(offset + 14, true);
|
|
29
|
+
if (serial !== void 0 && serial !== stream)
|
|
30
|
+
throw invalid();
|
|
31
|
+
serial = stream;
|
|
32
|
+
const segments = bytes[offset + 26] ?? 0;
|
|
33
|
+
let data = offset + 27 + segments;
|
|
34
|
+
if (data > bytes.length || Boolean((bytes[offset + 5] ?? 0) & 1) !== length > 0)
|
|
35
|
+
throw invalid();
|
|
36
|
+
for (let index = 0; index < segments; index++) {
|
|
37
|
+
const size = bytes[offset + 27 + index] ?? 0;
|
|
38
|
+
if (data + size > bytes.length)
|
|
39
|
+
throw invalid();
|
|
40
|
+
const take = Math.min(size, 19 - prefix.length);
|
|
41
|
+
for (let i = 0; i < take; i++)
|
|
42
|
+
prefix.push(bytes[data + i] ?? 0);
|
|
43
|
+
length += size;
|
|
44
|
+
data += size;
|
|
45
|
+
if (size === 255)
|
|
46
|
+
continue;
|
|
47
|
+
if (packet === 0) {
|
|
48
|
+
if (length < 19 || String.fromCharCode(...prefix.slice(0, 8)) !== "OpusHead" || ![1, 2].includes(prefix[9] ?? 0) || prefix[18] !== 0)
|
|
49
|
+
throw invalid();
|
|
50
|
+
} else if (packet === 1) {
|
|
51
|
+
if (length < 8 || String.fromCharCode(...prefix.slice(0, 8)) !== "OpusTags")
|
|
52
|
+
throw invalid();
|
|
53
|
+
} else {
|
|
54
|
+
if (length < 1)
|
|
55
|
+
throw invalid();
|
|
56
|
+
const toc = prefix[0] ?? 0;
|
|
57
|
+
const config = toc >> 3;
|
|
58
|
+
const frame = config >= 16 ? 120 << (config & 3) : config >= 12 ? 480 << (config & 1) : (config & 3) === 3 ? 2880 : 480 << (config & 3);
|
|
59
|
+
const count = (toc & 3) === 0 ? 1 : (toc & 3) === 3 ? length >= 2 ? (prefix[1] ?? 0) & 63 : 0 : 2;
|
|
60
|
+
if (count < 1 || frame * count > 5760)
|
|
61
|
+
throw invalid();
|
|
62
|
+
}
|
|
63
|
+
packet++;
|
|
64
|
+
length = 0;
|
|
65
|
+
prefix.length = 0;
|
|
66
|
+
}
|
|
67
|
+
offset = data;
|
|
68
|
+
}
|
|
69
|
+
if (length !== 0 || packet < 3)
|
|
70
|
+
throw invalid();
|
|
71
|
+
}, "checkOggDuration");
|
|
72
|
+
|
|
73
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.507.0_@wirecat+cli-base@0.68.1_commander@15.0.0_esbuild@0.28.2_type_d5beb0101c7a90701cc33879a5be8d28/node_modules/@wirecat/cli-core/dist/speech/recognize.js
|
|
74
|
+
var SAMPLE_RATE = 16e3;
|
|
75
|
+
var LEAD = SAMPLE_RATE / 2;
|
|
76
|
+
var toModelRate = /* @__PURE__ */ __name((samples, rate) => {
|
|
77
|
+
const step = rate / SAMPLE_RATE;
|
|
78
|
+
const length = Math.floor(samples.length / step);
|
|
79
|
+
const pcm = new Float32Array(LEAD + length);
|
|
80
|
+
for (let i = 0; i < length; i++) {
|
|
81
|
+
const from = Math.floor(i * step);
|
|
82
|
+
const to = Math.max(from + 1, Math.floor((i + 1) * step));
|
|
83
|
+
let sum = 0;
|
|
84
|
+
for (let j = from; j < to; j++)
|
|
85
|
+
sum += samples[j] ?? 0;
|
|
86
|
+
pcm[LEAD + i] = sum / (to - from);
|
|
87
|
+
}
|
|
88
|
+
return pcm;
|
|
89
|
+
}, "toModelRate");
|
|
90
|
+
var decodeOgg = /* @__PURE__ */ __name(async (bytes) => {
|
|
91
|
+
checkOggDuration(bytes);
|
|
92
|
+
const { OggOpusDecoder } = await importFrom(new URL("speech/recognize.js", import.meta.resolve("@wirecat/cli-core")).href, "ogg-opus-decoder");
|
|
93
|
+
const decoder = new OggOpusDecoder();
|
|
94
|
+
await decoder.ready;
|
|
95
|
+
try {
|
|
96
|
+
const { channelData, sampleRate, samplesDecoded } = await decoder.decodeFile(bytes);
|
|
97
|
+
if (!channelData[0] || samplesDecoded === 0)
|
|
98
|
+
throw new Error("no Ogg Opus audio in it");
|
|
99
|
+
return channelData.map((samples) => ({ samples, rate: sampleRate }));
|
|
100
|
+
} finally {
|
|
101
|
+
decoder.free();
|
|
102
|
+
}
|
|
103
|
+
}, "decodeOgg");
|
|
104
|
+
var WINDOW = 512;
|
|
105
|
+
var detector = /* @__PURE__ */ __name((vadModel) => ({
|
|
106
|
+
sileroVad: {
|
|
107
|
+
model: vadModel,
|
|
108
|
+
// At the default 0.5 a quietly spoken stretch in the middle of a voice message never counted as
|
|
109
|
+
// speech and was lost; 0.3 keeps it for both models and changes nothing on clear speech (126508, 2026-09-30).
|
|
110
|
+
threshold: 0.3,
|
|
111
|
+
minSilenceDuration: 0.5,
|
|
112
|
+
minSpeechDuration: 0.25,
|
|
113
|
+
maxSpeechDuration: 20,
|
|
114
|
+
windowSize: WINDOW
|
|
115
|
+
},
|
|
116
|
+
sampleRate: SAMPLE_RATE,
|
|
117
|
+
numThreads: 1,
|
|
118
|
+
provider: "cpu",
|
|
119
|
+
debug: 0,
|
|
120
|
+
bufferSizeInSeconds: 30
|
|
121
|
+
}), "detector");
|
|
122
|
+
var cut = /* @__PURE__ */ __name((vad, pcm, each) => {
|
|
123
|
+
vad.reset();
|
|
124
|
+
const last = Math.max(0, pcm.length - LEAD);
|
|
125
|
+
const drain = /* @__PURE__ */ __name(() => {
|
|
126
|
+
for (; !vad.isEmpty(); vad.pop()) {
|
|
127
|
+
const { start, samples } = vad.front();
|
|
128
|
+
each({
|
|
129
|
+
start: Math.min(last, Math.max(0, start - LEAD)) / SAMPLE_RATE,
|
|
130
|
+
end: Math.min(last, Math.max(0, start + samples.length - LEAD)) / SAMPLE_RATE,
|
|
131
|
+
samples
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}, "drain");
|
|
135
|
+
for (let i = 0; i + WINDOW <= pcm.length; i += WINDOW) {
|
|
136
|
+
vad.acceptWaveform(pcm.subarray(i, i + WINDOW));
|
|
137
|
+
drain();
|
|
138
|
+
}
|
|
139
|
+
vad.flush();
|
|
140
|
+
drain();
|
|
141
|
+
}, "cut");
|
|
142
|
+
var openSpeechCutter = /* @__PURE__ */ __name((vadModel) => {
|
|
143
|
+
const vad = loadSherpa().createVad(detector(vadModel));
|
|
144
|
+
return {
|
|
145
|
+
cut: /* @__PURE__ */ __name((pcm) => {
|
|
146
|
+
const spans = [];
|
|
147
|
+
cut(vad, pcm, ({ start, end }) => spans.push({ start, end }));
|
|
148
|
+
return spans;
|
|
149
|
+
}, "cut"),
|
|
150
|
+
free: /* @__PURE__ */ __name(() => vad.free(), "free")
|
|
151
|
+
};
|
|
152
|
+
}, "openSpeechCutter");
|
|
153
|
+
var loaded;
|
|
154
|
+
var loadSherpa = /* @__PURE__ */ __name(() => {
|
|
155
|
+
if (loaded)
|
|
156
|
+
return loaded;
|
|
157
|
+
const load = createRequire(new URL("speech/recognize.js", import.meta.resolve("@wirecat/cli-core")).href);
|
|
158
|
+
const wasm = {};
|
|
159
|
+
load("sherpa-onnx/sherpa-onnx-wasm-nodejs.js")(wasm);
|
|
160
|
+
const stdout = wasm.FS?.getStream(1);
|
|
161
|
+
if (stdout)
|
|
162
|
+
stdout.nfd = 2;
|
|
163
|
+
const asr = load("sherpa-onnx/sherpa-onnx-asr.js");
|
|
164
|
+
const vad = load("sherpa-onnx/sherpa-onnx-vad.js");
|
|
165
|
+
loaded = {
|
|
166
|
+
createOfflineRecognizer: /* @__PURE__ */ __name((config) => new asr.OfflineRecognizer(config, wasm), "createOfflineRecognizer"),
|
|
167
|
+
createVad: /* @__PURE__ */ __name((config) => vad.createVad(wasm, config), "createVad")
|
|
168
|
+
};
|
|
169
|
+
return loaded;
|
|
170
|
+
}, "loadSherpa");
|
|
171
|
+
var openRecognizer = /* @__PURE__ */ __name((model, path, vadModel) => {
|
|
172
|
+
const sherpa = loadSherpa();
|
|
173
|
+
const engine = sherpa.createOfflineRecognizer({
|
|
174
|
+
featConfig: { sampleRate: SAMPLE_RATE, featureDim: model.featureDim },
|
|
175
|
+
modelConfig: { ...model.config(path), numThreads: 1, provider: "cpu", debug: 0 },
|
|
176
|
+
decodingMethod: "greedy_search"
|
|
177
|
+
});
|
|
178
|
+
const vad = sherpa.createVad(detector(vadModel));
|
|
179
|
+
const piece = /* @__PURE__ */ __name((samples) => {
|
|
180
|
+
const stream = engine.createStream();
|
|
181
|
+
try {
|
|
182
|
+
stream.acceptWaveform(SAMPLE_RATE, samples);
|
|
183
|
+
engine.decode(stream);
|
|
184
|
+
return engine.getResult(stream).text.trim();
|
|
185
|
+
} finally {
|
|
186
|
+
stream.free();
|
|
187
|
+
}
|
|
188
|
+
}, "piece");
|
|
189
|
+
const pieces = /* @__PURE__ */ __name((pcm) => {
|
|
190
|
+
const heard = [];
|
|
191
|
+
cut(vad, pcm, ({ start, end, samples }) => {
|
|
192
|
+
const text = piece(samples);
|
|
193
|
+
if (text)
|
|
194
|
+
heard.push({ start, end, text });
|
|
195
|
+
});
|
|
196
|
+
return heard;
|
|
197
|
+
}, "pieces");
|
|
198
|
+
return {
|
|
199
|
+
recognize: /* @__PURE__ */ __name((pcm) => pieces(pcm).map(({ text }) => text).join(" "), "recognize"),
|
|
200
|
+
pieces,
|
|
201
|
+
free: /* @__PURE__ */ __name(() => {
|
|
202
|
+
vad.free();
|
|
203
|
+
engine.free();
|
|
204
|
+
}, "free")
|
|
205
|
+
};
|
|
206
|
+
}, "openRecognizer");
|
|
207
|
+
|
|
208
|
+
export {
|
|
209
|
+
SAMPLE_RATE,
|
|
210
|
+
toModelRate,
|
|
211
|
+
decodeOgg,
|
|
212
|
+
detector,
|
|
213
|
+
openSpeechCutter,
|
|
214
|
+
loadSherpa,
|
|
215
|
+
openRecognizer
|
|
216
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
__name
|
|
5
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
6
|
+
|
|
7
|
+
// 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/installer.js
|
|
8
|
+
var installerOf = /* @__PURE__ */ __name((scriptPath) => {
|
|
9
|
+
const path = scriptPath.replaceAll("\\", "/");
|
|
10
|
+
if (path.includes("/_npx/"))
|
|
11
|
+
return "npx";
|
|
12
|
+
if (path.includes("/install/global/node_modules/"))
|
|
13
|
+
return "bun";
|
|
14
|
+
if (/\/\.?pnpm\//.test(path))
|
|
15
|
+
return "pnpm";
|
|
16
|
+
if (path.includes("/node_modules/"))
|
|
17
|
+
return "npm";
|
|
18
|
+
return path.includes("/dist/") ? "checkout" : "unknown";
|
|
19
|
+
}, "installerOf");
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
installerOf
|
|
23
|
+
};
|