@storyteller-platform/ghost-story 0.0.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/LICENSE.md +611 -0
- package/README.md +18 -0
- package/dist/api/APIOptions.cjs +16 -0
- package/dist/api/APIOptions.d.cts +18 -0
- package/dist/api/APIOptions.d.ts +18 -0
- package/dist/api/APIOptions.js +0 -0
- package/dist/api/Recognition.cjs +263 -0
- package/dist/api/Recognition.d.cts +77 -0
- package/dist/api/Recognition.d.ts +77 -0
- package/dist/api/Recognition.js +233 -0
- package/dist/api/VoiceActivityDetection.cjs +77 -0
- package/dist/api/VoiceActivityDetection.d.cts +24 -0
- package/dist/api/VoiceActivityDetection.d.ts +24 -0
- package/dist/api/VoiceActivityDetection.js +43 -0
- package/dist/audio/AudioConverter.cjs +331 -0
- package/dist/audio/AudioConverter.d.cts +53 -0
- package/dist/audio/AudioConverter.d.ts +53 -0
- package/dist/audio/AudioConverter.js +310 -0
- package/dist/audio/AudioFormat.cjs +151 -0
- package/dist/audio/AudioFormat.d.cts +25 -0
- package/dist/audio/AudioFormat.d.ts +25 -0
- package/dist/audio/AudioFormat.js +123 -0
- package/dist/audio/AudioSource.cjs +119 -0
- package/dist/audio/AudioSource.d.cts +33 -0
- package/dist/audio/AudioSource.d.ts +33 -0
- package/dist/audio/AudioSource.js +88 -0
- package/dist/audio/index.cjs +74 -0
- package/dist/audio/index.d.cts +6 -0
- package/dist/audio/index.d.ts +6 -0
- package/dist/audio/index.js +54 -0
- package/dist/cli/bin.cjs +277 -0
- package/dist/cli/bin.d.cts +1 -0
- package/dist/cli/bin.d.ts +1 -0
- package/dist/cli/bin.js +275 -0
- package/dist/cli/config.cjs +347 -0
- package/dist/cli/config.d.cts +33 -0
- package/dist/cli/config.d.ts +33 -0
- package/dist/cli/config.js +285 -0
- package/dist/cli/install.cjs +334 -0
- package/dist/cli/install.d.cts +62 -0
- package/dist/cli/install.d.ts +62 -0
- package/dist/cli/install.js +316 -0
- package/dist/cli/whisper-server.cjs +172 -0
- package/dist/cli/whisper-server.d.cts +24 -0
- package/dist/cli/whisper-server.d.ts +24 -0
- package/dist/cli/whisper-server.js +152 -0
- package/dist/config.cjs +60 -0
- package/dist/config.d.cts +12 -0
- package/dist/config.d.ts +12 -0
- package/dist/config.js +32 -0
- package/dist/convert.cjs +88 -0
- package/dist/convert.d.cts +12 -0
- package/dist/convert.d.ts +12 -0
- package/dist/convert.js +63 -0
- package/dist/encodings/Ascii.cjs +75 -0
- package/dist/encodings/Ascii.d.cts +13 -0
- package/dist/encodings/Ascii.d.ts +13 -0
- package/dist/encodings/Ascii.js +48 -0
- package/dist/encodings/Base64.cjs +155 -0
- package/dist/encodings/Base64.d.cts +5 -0
- package/dist/encodings/Base64.d.ts +5 -0
- package/dist/encodings/Base64.js +129 -0
- package/dist/encodings/TextEncodingsCommon.cjs +16 -0
- package/dist/encodings/TextEncodingsCommon.d.cts +6 -0
- package/dist/encodings/TextEncodingsCommon.d.ts +6 -0
- package/dist/encodings/TextEncodingsCommon.js +0 -0
- package/dist/index.cjs +153 -0
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +140 -0
- package/dist/recognition/AmazonTranscribeSTT.cjs +188 -0
- package/dist/recognition/AmazonTranscribeSTT.d.cts +21 -0
- package/dist/recognition/AmazonTranscribeSTT.d.ts +21 -0
- package/dist/recognition/AmazonTranscribeSTT.js +160 -0
- package/dist/recognition/AzureCognitiveServicesSTT.cjs +124 -0
- package/dist/recognition/AzureCognitiveServicesSTT.d.cts +21 -0
- package/dist/recognition/AzureCognitiveServicesSTT.d.ts +21 -0
- package/dist/recognition/AzureCognitiveServicesSTT.js +95 -0
- package/dist/recognition/DeepgramSTT.cjs +172 -0
- package/dist/recognition/DeepgramSTT.d.cts +23 -0
- package/dist/recognition/DeepgramSTT.d.ts +23 -0
- package/dist/recognition/DeepgramSTT.js +153 -0
- package/dist/recognition/GoogleCloudSTT.cjs +125 -0
- package/dist/recognition/GoogleCloudSTT.d.cts +35 -0
- package/dist/recognition/GoogleCloudSTT.d.ts +35 -0
- package/dist/recognition/GoogleCloudSTT.js +107 -0
- package/dist/recognition/OpenAICloudSTT.cjs +180 -0
- package/dist/recognition/OpenAICloudSTT.d.cts +29 -0
- package/dist/recognition/OpenAICloudSTT.d.ts +29 -0
- package/dist/recognition/OpenAICloudSTT.js +150 -0
- package/dist/recognition/WhisperCppSTT.cjs +296 -0
- package/dist/recognition/WhisperCppSTT.d.cts +40 -0
- package/dist/recognition/WhisperCppSTT.d.ts +40 -0
- package/dist/recognition/WhisperCppSTT.js +275 -0
- package/dist/recognition/WhisperServerSTT.cjs +119 -0
- package/dist/recognition/WhisperServerSTT.d.cts +24 -0
- package/dist/recognition/WhisperServerSTT.d.ts +24 -0
- package/dist/recognition/WhisperServerSTT.js +105 -0
- package/dist/utilities/FileSystem.cjs +54 -0
- package/dist/utilities/FileSystem.d.cts +3 -0
- package/dist/utilities/FileSystem.d.ts +3 -0
- package/dist/utilities/FileSystem.js +20 -0
- package/dist/utilities/Locale.cjs +46 -0
- package/dist/utilities/Locale.d.cts +9 -0
- package/dist/utilities/Locale.d.ts +9 -0
- package/dist/utilities/Locale.js +20 -0
- package/dist/utilities/ObjectUtilities.cjs +41 -0
- package/dist/utilities/ObjectUtilities.d.cts +3 -0
- package/dist/utilities/ObjectUtilities.d.ts +3 -0
- package/dist/utilities/ObjectUtilities.js +7 -0
- package/dist/utilities/Timeline.cjs +120 -0
- package/dist/utilities/Timeline.d.cts +23 -0
- package/dist/utilities/Timeline.d.ts +23 -0
- package/dist/utilities/Timeline.js +94 -0
- package/dist/utilities/Timing.cjs +287 -0
- package/dist/utilities/Timing.d.cts +64 -0
- package/dist/utilities/Timing.d.ts +64 -0
- package/dist/utilities/Timing.js +256 -0
- package/dist/utilities/WhisperTimeline.cjs +344 -0
- package/dist/utilities/WhisperTimeline.d.cts +86 -0
- package/dist/utilities/WhisperTimeline.d.ts +86 -0
- package/dist/utilities/WhisperTimeline.js +313 -0
- package/dist/vad/ActiveGate.cjs +357 -0
- package/dist/vad/ActiveGate.d.cts +53 -0
- package/dist/vad/ActiveGate.d.ts +53 -0
- package/dist/vad/ActiveGate.js +329 -0
- package/dist/vad/ActiveGateOg.cjs +1366 -0
- package/dist/vad/ActiveGateOg.d.cts +33 -0
- package/dist/vad/ActiveGateOg.d.ts +33 -0
- package/dist/vad/ActiveGateOg.js +1341 -0
- package/dist/vad/Silero.cjs +174 -0
- package/dist/vad/Silero.d.cts +25 -0
- package/dist/vad/Silero.d.ts +25 -0
- package/dist/vad/Silero.js +153 -0
- package/package.json +125 -0
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var config_exports = {};
|
|
30
|
+
__export(config_exports, {
|
|
31
|
+
BUILD_VARIANTS: () => BUILD_VARIANTS,
|
|
32
|
+
GITLAB_PROJECT_ID: () => GITLAB_PROJECT_ID,
|
|
33
|
+
GITLAB_PROJECT_PATH: () => GITLAB_PROJECT_PATH,
|
|
34
|
+
GITLAB_WHIPSER_ML_ID: () => GITLAB_WHIPSER_ML_ID,
|
|
35
|
+
MODEL_SIZES: () => MODEL_SIZES,
|
|
36
|
+
SILERO_VAD_VERSION: () => SILERO_VAD_VERSION,
|
|
37
|
+
WHISPER_CPP_VERSION: () => WHISPER_CPP_VERSION,
|
|
38
|
+
WHISPER_MODELS: () => WHISPER_MODELS,
|
|
39
|
+
WHISPER_MODEL_VERSION: () => WHISPER_MODEL_VERSION,
|
|
40
|
+
detectPlatform: () => detectPlatform,
|
|
41
|
+
getBinaryDownloadUrl: () => getBinaryDownloadUrl,
|
|
42
|
+
getCompatibleVariants: () => getCompatibleVariants,
|
|
43
|
+
getCoremlModelDownloadUrl: () => getCoremlModelDownloadUrl,
|
|
44
|
+
getCoremlModelPath: () => getCoremlModelPath,
|
|
45
|
+
getInstallDir: () => getInstallDir,
|
|
46
|
+
getInstalledVariant: () => getInstalledVariant,
|
|
47
|
+
getModelDir: () => getModelDir,
|
|
48
|
+
getModelDownloadUrl: () => getModelDownloadUrl,
|
|
49
|
+
getModelPath: () => getModelPath,
|
|
50
|
+
getVadExecutablePath: () => getVadExecutablePath,
|
|
51
|
+
getVadModelDownloadUrl: () => getVadModelDownloadUrl,
|
|
52
|
+
getVadModelPath: () => getVadModelPath,
|
|
53
|
+
getWhisperBaseDir: () => getWhisperBaseDir,
|
|
54
|
+
getWhisperExecutablePath: () => getWhisperExecutablePath,
|
|
55
|
+
getWhisperServerExecutablePath: () => getWhisperServerExecutablePath,
|
|
56
|
+
isValidModel: () => isValidModel,
|
|
57
|
+
isValidVariant: () => isValidVariant,
|
|
58
|
+
isVariantCompatibleWithCurrentPlatform: () => isVariantCompatibleWithCurrentPlatform,
|
|
59
|
+
needsCoremlModel: () => needsCoremlModel
|
|
60
|
+
});
|
|
61
|
+
module.exports = __toCommonJS(config_exports);
|
|
62
|
+
var import_node_child_process = require("node:child_process");
|
|
63
|
+
var import_node_fs = require("node:fs");
|
|
64
|
+
var import_node_os = __toESM(require("node:os"), 1);
|
|
65
|
+
var import_node_path = __toESM(require("node:path"), 1);
|
|
66
|
+
var import_FileSystem = require("../utilities/FileSystem.cjs");
|
|
67
|
+
const WHISPER_CPP_VERSION = "1.8.2";
|
|
68
|
+
const WHISPER_MODEL_VERSION = "1.0.0";
|
|
69
|
+
const SILERO_VAD_VERSION = "6.2.0";
|
|
70
|
+
const GITLAB_PROJECT_PATH = "storyteller-platform/storyteller";
|
|
71
|
+
const GITLAB_PROJECT_ID = "67994333";
|
|
72
|
+
const GITLAB_WHIPSER_ML_ID = "2007349";
|
|
73
|
+
const BUILD_VARIANTS = [
|
|
74
|
+
"darwin-arm64-coreml",
|
|
75
|
+
"darwin-arm64-cpu",
|
|
76
|
+
"darwin-x64-cpu",
|
|
77
|
+
"linux-x64-cuda-12.4.0",
|
|
78
|
+
"linux-x64-cuda-11.8.0",
|
|
79
|
+
"linux-x64-vulkan",
|
|
80
|
+
"linux-x64-rocm",
|
|
81
|
+
"linux-x64-cpu",
|
|
82
|
+
"linux-arm64-cpu",
|
|
83
|
+
"windows-x64-cpu",
|
|
84
|
+
"windows-x64-cuda-12.4.0",
|
|
85
|
+
"windows-x64-cuda-11.8.0",
|
|
86
|
+
"windows-x64-vulkan"
|
|
87
|
+
];
|
|
88
|
+
function getVariantPlatformInfo(variant) {
|
|
89
|
+
if (variant.startsWith("darwin-arm64")) {
|
|
90
|
+
return { platform: "darwin", arch: "arm64" };
|
|
91
|
+
}
|
|
92
|
+
if (variant.startsWith("darwin-x64")) {
|
|
93
|
+
return { platform: "darwin", arch: "x64" };
|
|
94
|
+
}
|
|
95
|
+
if (variant.startsWith("linux-arm64")) {
|
|
96
|
+
return { platform: "linux", arch: "arm64" };
|
|
97
|
+
}
|
|
98
|
+
if (variant.startsWith("linux-x64")) {
|
|
99
|
+
return { platform: "linux", arch: "x64" };
|
|
100
|
+
}
|
|
101
|
+
if (variant.startsWith("windows-arm64")) {
|
|
102
|
+
return { platform: "win32", arch: "arm64" };
|
|
103
|
+
}
|
|
104
|
+
if (variant.startsWith("windows-x64")) {
|
|
105
|
+
return { platform: "win32", arch: "x64" };
|
|
106
|
+
}
|
|
107
|
+
throw new Error(`Unknown variant: ${variant}`);
|
|
108
|
+
}
|
|
109
|
+
function isVariantCompatibleWithCurrentPlatform(variant) {
|
|
110
|
+
const currentPlatform = process.platform;
|
|
111
|
+
const currentArch = process.arch;
|
|
112
|
+
const variantInfo = getVariantPlatformInfo(variant);
|
|
113
|
+
return variantInfo.platform === currentPlatform && variantInfo.arch === currentArch;
|
|
114
|
+
}
|
|
115
|
+
function getCompatibleVariants() {
|
|
116
|
+
return BUILD_VARIANTS.filter(isVariantCompatibleWithCurrentPlatform);
|
|
117
|
+
}
|
|
118
|
+
const WHISPER_MODELS = [
|
|
119
|
+
"tiny",
|
|
120
|
+
"tiny.en",
|
|
121
|
+
"tiny-q5_1",
|
|
122
|
+
"tiny.en-q5_1",
|
|
123
|
+
"tiny-q8_0",
|
|
124
|
+
"base",
|
|
125
|
+
"base.en",
|
|
126
|
+
"base-q5_1",
|
|
127
|
+
"base.en-q5_1",
|
|
128
|
+
"base-q8_0",
|
|
129
|
+
"small",
|
|
130
|
+
"small.en",
|
|
131
|
+
"small-q5_1",
|
|
132
|
+
"small.en-q5_1",
|
|
133
|
+
"small-q8_0",
|
|
134
|
+
"medium",
|
|
135
|
+
"medium.en",
|
|
136
|
+
"medium-q5_0",
|
|
137
|
+
"medium.en-q5_0",
|
|
138
|
+
"medium-q8_0",
|
|
139
|
+
"large-v1",
|
|
140
|
+
"large-v2",
|
|
141
|
+
"large-v2-q5_0",
|
|
142
|
+
"large-v2-q8_0",
|
|
143
|
+
"large-v3",
|
|
144
|
+
"large-v3-q5_0",
|
|
145
|
+
"large-v3-turbo",
|
|
146
|
+
"large-v3-turbo-q5_0",
|
|
147
|
+
"large-v3-turbo-q8_0"
|
|
148
|
+
];
|
|
149
|
+
const MODEL_SIZES = {
|
|
150
|
+
tiny: 77691713,
|
|
151
|
+
"tiny-q5_1": 32152673,
|
|
152
|
+
"tiny.en": 77704715,
|
|
153
|
+
"tiny.en-q5_1": 32166155,
|
|
154
|
+
"tiny-q8_0": 43537433,
|
|
155
|
+
base: 147951465,
|
|
156
|
+
"base.en": 147964211,
|
|
157
|
+
"base-q5_1": 59707625,
|
|
158
|
+
"base.en-q5_1": 59721011,
|
|
159
|
+
"base-q8_0": 81768585,
|
|
160
|
+
small: 487601967,
|
|
161
|
+
"small.en": 487614201,
|
|
162
|
+
"small-q5_1": 190085487,
|
|
163
|
+
"small.en-q5_1": 190098681,
|
|
164
|
+
"small-q8_0": 264464607,
|
|
165
|
+
medium: 1533763059,
|
|
166
|
+
"medium.en": 1533774781,
|
|
167
|
+
"medium-q5_0": 539212467,
|
|
168
|
+
"medium.en-q5_0": 539225533,
|
|
169
|
+
"medium-q8_0": 823369779,
|
|
170
|
+
"large-v1": 3094623691,
|
|
171
|
+
"large-v2": 3094623691,
|
|
172
|
+
"large-v2-q5_0": 1080732091,
|
|
173
|
+
"large-v2-q8_0": 1656129691,
|
|
174
|
+
"large-v3": 3095033483,
|
|
175
|
+
"large-v3-q5_0": 1081140203,
|
|
176
|
+
"large-v3-turbo": 1624555275,
|
|
177
|
+
"large-v3-turbo-q5_0": 574041195,
|
|
178
|
+
"large-v3-turbo-q8_0": 874188075,
|
|
179
|
+
"silero-vad": 884595
|
|
180
|
+
};
|
|
181
|
+
function getBinaryDownloadUrl(variant) {
|
|
182
|
+
const filename = `whisper-cpp-${variant}.tar.gz`;
|
|
183
|
+
return `https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_ID}/packages/generic/whisper-cpp/${WHISPER_CPP_VERSION}/${filename}`;
|
|
184
|
+
}
|
|
185
|
+
function getModelDownloadUrl(model) {
|
|
186
|
+
const filename = `ggml-${model}.bin`;
|
|
187
|
+
return `https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_ID}/packages/ml_models/${GITLAB_WHIPSER_ML_ID}/files/${filename}`;
|
|
188
|
+
}
|
|
189
|
+
function getCoremlModelDownloadUrl(model) {
|
|
190
|
+
const filename = `ggml-${model}-encoder.mlmodelc.tar.gz`;
|
|
191
|
+
return `https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_ID}/packages/ml_models/${GITLAB_WHIPSER_ML_ID}/files/coreml/${filename}`;
|
|
192
|
+
}
|
|
193
|
+
function getVadModelDownloadUrl() {
|
|
194
|
+
return `https://huggingface.co/ggml-org/whisper-vad/resolve/main/ggml-silero-v${SILERO_VAD_VERSION}.bin`;
|
|
195
|
+
}
|
|
196
|
+
function getWhisperBaseDir() {
|
|
197
|
+
return import_node_path.default.join(
|
|
198
|
+
(0, import_FileSystem.getAppDataDir)("ghost-story"),
|
|
199
|
+
"whisper-cpp",
|
|
200
|
+
WHISPER_CPP_VERSION
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
function getInstallDir(variant) {
|
|
204
|
+
const baseDir = getWhisperBaseDir();
|
|
205
|
+
if (variant) {
|
|
206
|
+
return import_node_path.default.join(baseDir, variant);
|
|
207
|
+
}
|
|
208
|
+
const installed = getInstalledVariant();
|
|
209
|
+
if (installed) {
|
|
210
|
+
return import_node_path.default.join(baseDir, installed);
|
|
211
|
+
}
|
|
212
|
+
return import_node_path.default.join(baseDir, detectPlatform());
|
|
213
|
+
}
|
|
214
|
+
function getInstalledVariant() {
|
|
215
|
+
const baseDir = getWhisperBaseDir();
|
|
216
|
+
if (!(0, import_node_fs.existsSync)(baseDir)) {
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
const entries = (0, import_node_fs.readdirSync)(baseDir, { withFileTypes: true });
|
|
220
|
+
for (const entry of entries) {
|
|
221
|
+
if (!entry.isDirectory()) continue;
|
|
222
|
+
const variant = entry.name;
|
|
223
|
+
if (!BUILD_VARIANTS.includes(variant)) continue;
|
|
224
|
+
const execPath = getWhisperExecutablePath(import_node_path.default.join(baseDir, variant));
|
|
225
|
+
if ((0, import_node_fs.existsSync)(execPath)) {
|
|
226
|
+
return variant;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
function getModelDir() {
|
|
232
|
+
return import_node_path.default.join((0, import_FileSystem.getAppDataDir)("ghost-story"), "models");
|
|
233
|
+
}
|
|
234
|
+
function getWhisperExecutablePath(installDir) {
|
|
235
|
+
const dir = installDir ?? getInstallDir();
|
|
236
|
+
const isWindows = import_node_os.default.platform() === "win32";
|
|
237
|
+
const executable = isWindows ? "whisper-cli.exe" : "whisper-cli";
|
|
238
|
+
return import_node_path.default.join(dir, "bin", executable);
|
|
239
|
+
}
|
|
240
|
+
function getVadExecutablePath(installDir) {
|
|
241
|
+
const dir = installDir ?? getInstallDir();
|
|
242
|
+
const isWindows = import_node_os.default.platform() === "win32";
|
|
243
|
+
const executable = isWindows ? "vad-speech-segments.exe" : "vad-speech-segments";
|
|
244
|
+
return import_node_path.default.join(dir, "bin", executable);
|
|
245
|
+
}
|
|
246
|
+
function getWhisperServerExecutablePath(installDir) {
|
|
247
|
+
const dir = installDir ?? getInstallDir();
|
|
248
|
+
const isWindows = import_node_os.default.platform() === "win32";
|
|
249
|
+
const executable = isWindows ? "whisper-server.exe" : "whisper-server";
|
|
250
|
+
return import_node_path.default.join(dir, "bin", executable);
|
|
251
|
+
}
|
|
252
|
+
function getModelPath(model, modelDir) {
|
|
253
|
+
const dir = modelDir ?? getModelDir();
|
|
254
|
+
return import_node_path.default.join(dir, `ggml-${model}.bin`);
|
|
255
|
+
}
|
|
256
|
+
function getCoremlModelPath(model, modelDir) {
|
|
257
|
+
const dir = modelDir ?? getModelDir();
|
|
258
|
+
return import_node_path.default.join(dir, `ggml-${model}-encoder.mlmodelc`);
|
|
259
|
+
}
|
|
260
|
+
function needsCoremlModel(variant) {
|
|
261
|
+
const v = variant ?? getInstalledVariant() ?? detectPlatform();
|
|
262
|
+
return v.includes("coreml");
|
|
263
|
+
}
|
|
264
|
+
function getVadModelPath(modelDir) {
|
|
265
|
+
const dir = modelDir ?? getModelDir();
|
|
266
|
+
return import_node_path.default.join(dir, `ggml-silero-v${SILERO_VAD_VERSION}.bin`);
|
|
267
|
+
}
|
|
268
|
+
function hasCuda() {
|
|
269
|
+
try {
|
|
270
|
+
(0, import_node_child_process.execSync)("nvidia-smi", { stdio: "ignore" });
|
|
271
|
+
return true;
|
|
272
|
+
} catch {
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
function hasVulkan() {
|
|
277
|
+
try {
|
|
278
|
+
(0, import_node_child_process.execSync)("vulkaninfo --summary", { stdio: "ignore" });
|
|
279
|
+
return true;
|
|
280
|
+
} catch {
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
function detectPlatform() {
|
|
285
|
+
const platform = process.platform;
|
|
286
|
+
const arch = process.arch;
|
|
287
|
+
if (platform === "darwin") {
|
|
288
|
+
return arch === "arm64" ? "darwin-arm64-coreml" : "darwin-x64-cpu";
|
|
289
|
+
}
|
|
290
|
+
if (platform === "linux") {
|
|
291
|
+
if (hasCuda()) {
|
|
292
|
+
return "linux-x64-cuda-12.4.0";
|
|
293
|
+
}
|
|
294
|
+
if (hasVulkan()) {
|
|
295
|
+
return "linux-x64-vulkan";
|
|
296
|
+
}
|
|
297
|
+
return arch === "arm64" ? "linux-arm64-cpu" : "linux-x64-cpu";
|
|
298
|
+
}
|
|
299
|
+
if (platform === "win32") {
|
|
300
|
+
if (hasCuda()) {
|
|
301
|
+
return "windows-x64-cuda-12.4.0";
|
|
302
|
+
}
|
|
303
|
+
if (hasVulkan()) {
|
|
304
|
+
return "windows-x64-vulkan";
|
|
305
|
+
}
|
|
306
|
+
return "windows-x64-cpu";
|
|
307
|
+
}
|
|
308
|
+
throw new Error(`Unsupported platform: ${platform}-${arch}`);
|
|
309
|
+
}
|
|
310
|
+
function isValidModel(model) {
|
|
311
|
+
return WHISPER_MODELS.includes(model);
|
|
312
|
+
}
|
|
313
|
+
function isValidVariant(variant) {
|
|
314
|
+
return BUILD_VARIANTS.includes(variant);
|
|
315
|
+
}
|
|
316
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
317
|
+
0 && (module.exports = {
|
|
318
|
+
BUILD_VARIANTS,
|
|
319
|
+
GITLAB_PROJECT_ID,
|
|
320
|
+
GITLAB_PROJECT_PATH,
|
|
321
|
+
GITLAB_WHIPSER_ML_ID,
|
|
322
|
+
MODEL_SIZES,
|
|
323
|
+
SILERO_VAD_VERSION,
|
|
324
|
+
WHISPER_CPP_VERSION,
|
|
325
|
+
WHISPER_MODELS,
|
|
326
|
+
WHISPER_MODEL_VERSION,
|
|
327
|
+
detectPlatform,
|
|
328
|
+
getBinaryDownloadUrl,
|
|
329
|
+
getCompatibleVariants,
|
|
330
|
+
getCoremlModelDownloadUrl,
|
|
331
|
+
getCoremlModelPath,
|
|
332
|
+
getInstallDir,
|
|
333
|
+
getInstalledVariant,
|
|
334
|
+
getModelDir,
|
|
335
|
+
getModelDownloadUrl,
|
|
336
|
+
getModelPath,
|
|
337
|
+
getVadExecutablePath,
|
|
338
|
+
getVadModelDownloadUrl,
|
|
339
|
+
getVadModelPath,
|
|
340
|
+
getWhisperBaseDir,
|
|
341
|
+
getWhisperExecutablePath,
|
|
342
|
+
getWhisperServerExecutablePath,
|
|
343
|
+
isValidModel,
|
|
344
|
+
isValidVariant,
|
|
345
|
+
isVariantCompatibleWithCurrentPlatform,
|
|
346
|
+
needsCoremlModel
|
|
347
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
declare const WHISPER_CPP_VERSION = "1.8.2";
|
|
2
|
+
declare const WHISPER_MODEL_VERSION = "1.0.0";
|
|
3
|
+
declare const SILERO_VAD_VERSION = "6.2.0";
|
|
4
|
+
declare const GITLAB_PROJECT_PATH = "storyteller-platform/storyteller";
|
|
5
|
+
declare const GITLAB_PROJECT_ID = "67994333";
|
|
6
|
+
declare const GITLAB_WHIPSER_ML_ID = "2007349";
|
|
7
|
+
declare const BUILD_VARIANTS: readonly ["darwin-arm64-coreml", "darwin-arm64-cpu", "darwin-x64-cpu", "linux-x64-cuda-12.4.0", "linux-x64-cuda-11.8.0", "linux-x64-vulkan", "linux-x64-rocm", "linux-x64-cpu", "linux-arm64-cpu", "windows-x64-cpu", "windows-x64-cuda-12.4.0", "windows-x64-cuda-11.8.0", "windows-x64-vulkan"];
|
|
8
|
+
type BuildVariant = (typeof BUILD_VARIANTS)[number];
|
|
9
|
+
declare function isVariantCompatibleWithCurrentPlatform(variant: BuildVariant): boolean;
|
|
10
|
+
declare function getCompatibleVariants(): BuildVariant[];
|
|
11
|
+
declare const WHISPER_MODELS: readonly ["tiny", "tiny.en", "tiny-q5_1", "tiny.en-q5_1", "tiny-q8_0", "base", "base.en", "base-q5_1", "base.en-q5_1", "base-q8_0", "small", "small.en", "small-q5_1", "small.en-q5_1", "small-q8_0", "medium", "medium.en", "medium-q5_0", "medium.en-q5_0", "medium-q8_0", "large-v1", "large-v2", "large-v2-q5_0", "large-v2-q8_0", "large-v3", "large-v3-q5_0", "large-v3-turbo", "large-v3-turbo-q5_0", "large-v3-turbo-q8_0"];
|
|
12
|
+
type WhisperModel = (typeof WHISPER_MODELS)[number];
|
|
13
|
+
declare const MODEL_SIZES: Record<WhisperModel | "silero-vad", number>;
|
|
14
|
+
declare function getBinaryDownloadUrl(variant: BuildVariant): string;
|
|
15
|
+
declare function getModelDownloadUrl(model: WhisperModel): string;
|
|
16
|
+
declare function getCoremlModelDownloadUrl(model: WhisperModel): string;
|
|
17
|
+
declare function getVadModelDownloadUrl(): string;
|
|
18
|
+
declare function getWhisperBaseDir(): string;
|
|
19
|
+
declare function getInstallDir(variant?: BuildVariant): string;
|
|
20
|
+
declare function getInstalledVariant(): BuildVariant | null;
|
|
21
|
+
declare function getModelDir(): string;
|
|
22
|
+
declare function getWhisperExecutablePath(installDir?: string): string;
|
|
23
|
+
declare function getVadExecutablePath(installDir?: string): string;
|
|
24
|
+
declare function getWhisperServerExecutablePath(installDir?: string): string;
|
|
25
|
+
declare function getModelPath(model: WhisperModel, modelDir?: string): string;
|
|
26
|
+
declare function getCoremlModelPath(model: WhisperModel, modelDir?: string): string;
|
|
27
|
+
declare function needsCoremlModel(variant?: BuildVariant): boolean;
|
|
28
|
+
declare function getVadModelPath(modelDir?: string): string;
|
|
29
|
+
declare function detectPlatform(): BuildVariant;
|
|
30
|
+
declare function isValidModel(model: string): model is WhisperModel;
|
|
31
|
+
declare function isValidVariant(variant: string): variant is BuildVariant;
|
|
32
|
+
|
|
33
|
+
export { BUILD_VARIANTS, type BuildVariant, GITLAB_PROJECT_ID, GITLAB_PROJECT_PATH, GITLAB_WHIPSER_ML_ID, MODEL_SIZES, SILERO_VAD_VERSION, WHISPER_CPP_VERSION, WHISPER_MODELS, WHISPER_MODEL_VERSION, type WhisperModel, detectPlatform, getBinaryDownloadUrl, getCompatibleVariants, getCoremlModelDownloadUrl, getCoremlModelPath, getInstallDir, getInstalledVariant, getModelDir, getModelDownloadUrl, getModelPath, getVadExecutablePath, getVadModelDownloadUrl, getVadModelPath, getWhisperBaseDir, getWhisperExecutablePath, getWhisperServerExecutablePath, isValidModel, isValidVariant, isVariantCompatibleWithCurrentPlatform, needsCoremlModel };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
declare const WHISPER_CPP_VERSION = "1.8.2";
|
|
2
|
+
declare const WHISPER_MODEL_VERSION = "1.0.0";
|
|
3
|
+
declare const SILERO_VAD_VERSION = "6.2.0";
|
|
4
|
+
declare const GITLAB_PROJECT_PATH = "storyteller-platform/storyteller";
|
|
5
|
+
declare const GITLAB_PROJECT_ID = "67994333";
|
|
6
|
+
declare const GITLAB_WHIPSER_ML_ID = "2007349";
|
|
7
|
+
declare const BUILD_VARIANTS: readonly ["darwin-arm64-coreml", "darwin-arm64-cpu", "darwin-x64-cpu", "linux-x64-cuda-12.4.0", "linux-x64-cuda-11.8.0", "linux-x64-vulkan", "linux-x64-rocm", "linux-x64-cpu", "linux-arm64-cpu", "windows-x64-cpu", "windows-x64-cuda-12.4.0", "windows-x64-cuda-11.8.0", "windows-x64-vulkan"];
|
|
8
|
+
type BuildVariant = (typeof BUILD_VARIANTS)[number];
|
|
9
|
+
declare function isVariantCompatibleWithCurrentPlatform(variant: BuildVariant): boolean;
|
|
10
|
+
declare function getCompatibleVariants(): BuildVariant[];
|
|
11
|
+
declare const WHISPER_MODELS: readonly ["tiny", "tiny.en", "tiny-q5_1", "tiny.en-q5_1", "tiny-q8_0", "base", "base.en", "base-q5_1", "base.en-q5_1", "base-q8_0", "small", "small.en", "small-q5_1", "small.en-q5_1", "small-q8_0", "medium", "medium.en", "medium-q5_0", "medium.en-q5_0", "medium-q8_0", "large-v1", "large-v2", "large-v2-q5_0", "large-v2-q8_0", "large-v3", "large-v3-q5_0", "large-v3-turbo", "large-v3-turbo-q5_0", "large-v3-turbo-q8_0"];
|
|
12
|
+
type WhisperModel = (typeof WHISPER_MODELS)[number];
|
|
13
|
+
declare const MODEL_SIZES: Record<WhisperModel | "silero-vad", number>;
|
|
14
|
+
declare function getBinaryDownloadUrl(variant: BuildVariant): string;
|
|
15
|
+
declare function getModelDownloadUrl(model: WhisperModel): string;
|
|
16
|
+
declare function getCoremlModelDownloadUrl(model: WhisperModel): string;
|
|
17
|
+
declare function getVadModelDownloadUrl(): string;
|
|
18
|
+
declare function getWhisperBaseDir(): string;
|
|
19
|
+
declare function getInstallDir(variant?: BuildVariant): string;
|
|
20
|
+
declare function getInstalledVariant(): BuildVariant | null;
|
|
21
|
+
declare function getModelDir(): string;
|
|
22
|
+
declare function getWhisperExecutablePath(installDir?: string): string;
|
|
23
|
+
declare function getVadExecutablePath(installDir?: string): string;
|
|
24
|
+
declare function getWhisperServerExecutablePath(installDir?: string): string;
|
|
25
|
+
declare function getModelPath(model: WhisperModel, modelDir?: string): string;
|
|
26
|
+
declare function getCoremlModelPath(model: WhisperModel, modelDir?: string): string;
|
|
27
|
+
declare function needsCoremlModel(variant?: BuildVariant): boolean;
|
|
28
|
+
declare function getVadModelPath(modelDir?: string): string;
|
|
29
|
+
declare function detectPlatform(): BuildVariant;
|
|
30
|
+
declare function isValidModel(model: string): model is WhisperModel;
|
|
31
|
+
declare function isValidVariant(variant: string): variant is BuildVariant;
|
|
32
|
+
|
|
33
|
+
export { BUILD_VARIANTS, type BuildVariant, GITLAB_PROJECT_ID, GITLAB_PROJECT_PATH, GITLAB_WHIPSER_ML_ID, MODEL_SIZES, SILERO_VAD_VERSION, WHISPER_CPP_VERSION, WHISPER_MODELS, WHISPER_MODEL_VERSION, type WhisperModel, detectPlatform, getBinaryDownloadUrl, getCompatibleVariants, getCoremlModelDownloadUrl, getCoremlModelPath, getInstallDir, getInstalledVariant, getModelDir, getModelDownloadUrl, getModelPath, getVadExecutablePath, getVadModelDownloadUrl, getVadModelPath, getWhisperBaseDir, getWhisperExecutablePath, getWhisperServerExecutablePath, isValidModel, isValidVariant, isVariantCompatibleWithCurrentPlatform, needsCoremlModel };
|