@emiyakatuz/crispasr-agent-transcriber 0.3.4 → 0.4.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/README.md CHANGED
@@ -13,14 +13,15 @@ checksum, installs Python/MCP dependencies with `uv`, installs the best
13
13
  available CrispASR binary (CUDA, then Vulkan, then CPU), and registers the
14
14
  plugin in the Codex Personal marketplace.
15
15
 
16
- Models are never downloaded automatically. The installer creates the plugin's
17
- `models/` directory and prints the exact model filenames and official source
18
- links before stopping.
16
+ Models are never downloaded during install/update. Run the explicit `models`
17
+ command to download the approved recommended bundle into the plugin's `models/`
18
+ directory.
19
19
 
20
20
  ## Commands
21
21
 
22
22
  ```powershell
23
23
  npx @emiyakatuz/crispasr-agent-transcriber@latest install
24
+ npx @emiyakatuz/crispasr-agent-transcriber@latest models
24
25
  npx @emiyakatuz/crispasr-agent-transcriber@latest update
25
26
  npx @emiyakatuz/crispasr-agent-transcriber@latest doctor
26
27
  npx @emiyakatuz/crispasr-agent-transcriber@latest --json doctor
@@ -30,12 +31,16 @@ npx @emiyakatuz/crispasr-agent-transcriber@latest uninstall
30
31
  `uninstall` preserves local models, CrispASR binaries, and outputs. Add
31
32
  `--purge-data` only when those files should also be removed.
32
33
 
34
+ Use `models --model-id english-q8` to choose a specific allowlisted quantization
35
+ instead of the default bundle. Use `models --dry-run --json` to inspect the
36
+ download plan without writing model files.
37
+
33
38
  ## Prerequisites
34
39
 
35
40
  - Node.js 20 or newer
36
41
  - [uv](https://docs.astral.sh/uv/)
37
42
  - [ffmpeg](https://ffmpeg.org/)
38
43
 
39
- Media remains local. This installer downloads code and CrispASR binaries from
40
- the project's documented GitHub sources, but never uploads media and never
41
- downloads ASR models.
44
+ Media remains local. This installer downloads code, CrispASR binaries, and only
45
+ explicitly requested allowlisted model files from the documented sources. It
46
+ never uploads media.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emiyakatuz/crispasr-agent-transcriber",
3
- "version": "0.3.4",
3
+ "version": "0.4.0",
4
4
  "description": "Installer and updater for the local-only CrispASR Codex plugin and MCP server.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.js CHANGED
@@ -1,18 +1,20 @@
1
1
  import { PACKAGE_NAME, PACKAGE_VERSION } from "./constants.js";
2
2
  import { InstallerError } from "./errors.js";
3
- import { doctor, installPlugin, uninstallPlugin } from "./installer.js";
3
+ import { doctor, downloadModels, installPlugin, uninstallPlugin } from "./installer.js";
4
4
 
5
5
  const HELP = `CrispASR Agent Transcriber installer
6
6
 
7
7
  Usage:
8
8
  crispasr-agent-transcriber [install] [options]
9
9
  crispasr-agent-transcriber update [options]
10
+ crispasr-agent-transcriber models [options]
10
11
  crispasr-agent-transcriber doctor [options]
11
12
  crispasr-agent-transcriber uninstall [options]
12
13
 
13
14
  Commands:
14
15
  install Install the Codex plugin, MCP dependencies, and CrispASR (default)
15
16
  update Update plugin files and the GPU-preferred CrispASR binary
17
+ models Download approved local GGUF models into the plugin models directory
16
18
  doctor Check prerequisites, plugin files, CrispASR, and local models
17
19
  uninstall Remove managed plugin files and Codex registration
18
20
 
@@ -22,6 +24,8 @@ Options:
22
24
  --release VERSION Install a matching GitHub Release version
23
25
  --json Print stable JSON to stdout
24
26
  --dry-run Show install/update actions without changing files
27
+ --model-id ID With models, download this model id; repeat for many
28
+ --overwrite-models With models, replace existing local model files
25
29
  --skip-crispasr Do not install or update the CrispASR binary
26
30
  --skip-deps Do not run uv sync
27
31
  --no-marketplace Do not modify the Personal Codex marketplace
@@ -29,8 +33,8 @@ Options:
29
33
  -v, --version Print installer version
30
34
  -h, --help Show this help
31
35
 
32
- Models are never downloaded automatically. When they are missing, installation
33
- stops after printing the exact filenames and source links.
36
+ Models are never downloaded during install/update. Run the models command to
37
+ download the recommended local English, Chinese, and language-detection bundle.
34
38
  `;
35
39
 
36
40
  function parseArgs(argv) {
@@ -38,7 +42,7 @@ function parseArgs(argv) {
38
42
  let command = null;
39
43
  for (let index = 0; index < argv.length; index += 1) {
40
44
  const value = argv[index];
41
- if (["install", "update", "doctor", "uninstall"].includes(value) && !command) {
45
+ if (["install", "update", "models", "doctor", "uninstall"].includes(value) && !command) {
42
46
  command = value;
43
47
  continue;
44
48
  }
@@ -48,9 +52,10 @@ function parseArgs(argv) {
48
52
  else if (value === "--skip-deps") options.skipDependencies = true;
49
53
  else if (value === "--no-marketplace") options.skipMarketplace = true;
50
54
  else if (value === "--purge-data") options.purgeData = true;
55
+ else if (value === "--overwrite-models") options.overwrite = true;
51
56
  else if (value === "--help" || value === "-h") options.help = true;
52
57
  else if (value === "--version" || value === "-v") options.version = true;
53
- else if (["--target-dir", "--marketplace-path", "--release"].includes(value)) {
58
+ else if (["--target-dir", "--marketplace-path", "--release", "--model-id"].includes(value)) {
54
59
  const next = argv[index + 1];
55
60
  if (!next || next.startsWith("--")) {
56
61
  throw new InstallerError(`${value} requires a value.`, "invalid_arguments");
@@ -59,6 +64,10 @@ function parseArgs(argv) {
59
64
  if (value === "--target-dir") options.targetDir = next;
60
65
  if (value === "--marketplace-path") options.marketplacePath = next;
61
66
  if (value === "--release") options.releaseVersion = next.replace(/^v/, "");
67
+ if (value === "--model-id") {
68
+ options.modelIds ||= [];
69
+ options.modelIds.push(next);
70
+ }
62
71
  } else {
63
72
  throw new InstallerError(`Unknown argument: ${value}`, "invalid_arguments");
64
73
  }
@@ -79,6 +88,22 @@ function printHumanResult(result) {
79
88
  }
80
89
  return;
81
90
  }
91
+ if (result.command === "models") {
92
+ process.stdout.write(`Models directory: ${result.modelsDir}\n`);
93
+ for (const item of result.results) {
94
+ process.stdout.write(
95
+ `${item.downloaded ? "[downloaded]" : "[skipped]"} ${item.id} -> ${item.path}\n`,
96
+ );
97
+ }
98
+ process.stdout.write(`Recommended bundle ready: ${result.ready ? "yes" : "no"}\n`);
99
+ if (!result.ready) {
100
+ process.stdout.write("Missing recommended models:\n");
101
+ for (const model of result.missingModels) {
102
+ process.stdout.write(`- ${model.id}: ${model.url}\n`);
103
+ }
104
+ }
105
+ return;
106
+ }
82
107
  if (result.command === "uninstall") {
83
108
  process.stdout.write(
84
109
  result.removed ? "Plugin registration and managed files removed.\n" : "Plugin was not installed.\n",
@@ -149,6 +174,8 @@ export async function main(argv = []) {
149
174
  let result;
150
175
  if (parsed.command === "doctor") {
151
176
  result = doctor(parsed.options);
177
+ } else if (parsed.command === "models") {
178
+ result = await downloadModels(parsed.options);
152
179
  } else if (parsed.command === "uninstall") {
153
180
  result = uninstallPlugin(parsed.options);
154
181
  } else {
package/src/constants.js CHANGED
@@ -16,21 +16,144 @@ export const PACKAGE_VERSION = packageJson.version;
16
16
 
17
17
  export const MODEL_SPECS = [
18
18
  {
19
+ id: "english-q4",
20
+ role: "english",
21
+ purpose: "English transcription",
22
+ filename: "cohere-transcribe-q4_k.gguf",
23
+ quantization: "q4_k",
24
+ recommended: true,
25
+ repo: "cstr/cohere-transcribe-03-2026-GGUF",
26
+ description: "Default English model with lower disk and memory use.",
27
+ },
28
+ {
29
+ id: "english-q5-0",
30
+ role: "english",
31
+ purpose: "English transcription",
32
+ filename: "cohere-transcribe-q5_0.gguf",
33
+ quantization: "q5_0",
34
+ recommended: false,
35
+ repo: "cstr/cohere-transcribe-03-2026-GGUF",
36
+ description: "Higher quality English option than q4_k.",
37
+ },
38
+ {
39
+ id: "english-q5-1",
40
+ role: "english",
41
+ purpose: "English transcription",
42
+ filename: "cohere-transcribe-q5_1.gguf",
43
+ quantization: "q5_1",
44
+ recommended: false,
45
+ repo: "cstr/cohere-transcribe-03-2026-GGUF",
46
+ description: "Alternate q5 English quantization.",
47
+ },
48
+ {
49
+ id: "english-q6",
50
+ role: "english",
51
+ purpose: "English transcription",
52
+ filename: "cohere-transcribe-q6_k.gguf",
53
+ quantization: "q6_k",
54
+ recommended: false,
55
+ repo: "cstr/cohere-transcribe-03-2026-GGUF",
56
+ description: "Larger English model for quality-focused local use.",
57
+ },
58
+ {
59
+ id: "english-q8",
60
+ role: "english",
61
+ purpose: "English transcription",
62
+ filename: "cohere-transcribe-q8_0.gguf",
63
+ quantization: "q8_0",
64
+ recommended: false,
65
+ repo: "cstr/cohere-transcribe-03-2026-GGUF",
66
+ description: "Large English model with less quantization.",
67
+ },
68
+ {
69
+ id: "english-f16",
70
+ role: "english",
19
71
  purpose: "English transcription",
20
72
  filename: "cohere-transcribe.gguf",
21
- url: "https://huggingface.co/cstr",
73
+ quantization: "f16",
74
+ recommended: false,
75
+ repo: "cstr/cohere-transcribe-03-2026-GGUF",
76
+ description: "Largest English option from the upstream GGUF repo.",
22
77
  },
23
78
  {
79
+ id: "chinese-q4",
80
+ role: "chinese",
24
81
  purpose: "Chinese transcription",
25
82
  filename: "qwen3-asr-1.7b-q4_k.gguf",
26
- url: "https://huggingface.co/cstr/qwen3-asr-1.7b-GGUF",
83
+ quantization: "q4_k",
84
+ recommended: true,
85
+ repo: "cstr/qwen3-asr-1.7b-GGUF",
86
+ description: "Default Chinese model with practical disk and memory use.",
27
87
  },
28
88
  {
89
+ id: "chinese-q8",
90
+ role: "chinese",
91
+ purpose: "Chinese transcription",
92
+ filename: "qwen3-asr-1.7b-q8_0.gguf",
93
+ quantization: "q8_0",
94
+ recommended: false,
95
+ repo: "cstr/qwen3-asr-1.7b-GGUF",
96
+ description: "Larger Chinese model with less quantization.",
97
+ },
98
+ {
99
+ id: "chinese-f16",
100
+ role: "chinese",
101
+ purpose: "Chinese transcription",
102
+ filename: "qwen3-asr-1.7b-f16.gguf",
103
+ quantization: "f16",
104
+ recommended: false,
105
+ repo: "cstr/qwen3-asr-1.7b-GGUF",
106
+ description: "Largest Chinese option from the upstream GGUF repo.",
107
+ },
108
+ {
109
+ id: "lid-q2",
110
+ role: "lid",
29
111
  purpose: "English/Chinese language detection",
30
112
  filename: "firered-lid-q2_k.gguf",
31
- url: "https://huggingface.co/cstr/firered-lid-GGUF",
113
+ quantization: "q2_k",
114
+ recommended: false,
115
+ repo: "cstr/firered-lid-GGUF",
116
+ description: "Smallest local language-detection option.",
32
117
  },
33
- ];
118
+ {
119
+ id: "lid-q4",
120
+ role: "lid",
121
+ purpose: "English/Chinese language detection",
122
+ filename: "firered-lid-q4_k.gguf",
123
+ quantization: "q4_k",
124
+ recommended: true,
125
+ repo: "cstr/firered-lid-GGUF",
126
+ description: "Default local language-detection model.",
127
+ },
128
+ {
129
+ id: "lid-q8",
130
+ role: "lid",
131
+ purpose: "English/Chinese language detection",
132
+ filename: "firered-lid-q8_0.gguf",
133
+ quantization: "q8_0",
134
+ recommended: false,
135
+ repo: "cstr/firered-lid-GGUF",
136
+ description: "Larger language-detection option with less quantization.",
137
+ },
138
+ {
139
+ id: "lid-f16",
140
+ role: "lid",
141
+ purpose: "English/Chinese language detection",
142
+ filename: "firered-lid-f16.gguf",
143
+ quantization: "f16",
144
+ recommended: false,
145
+ repo: "cstr/firered-lid-GGUF",
146
+ description: "Largest language-detection option from the upstream GGUF repo.",
147
+ },
148
+ ].map((model) => ({
149
+ ...model,
150
+ url: `https://huggingface.co/${model.repo}`,
151
+ downloadUrl: `https://huggingface.co/${model.repo}/resolve/main/${model.filename}`,
152
+ }));
153
+
154
+ export const RECOMMENDED_MODEL_IDS = MODEL_SPECS.filter((model) => model.recommended).map(
155
+ (model) => model.id,
156
+ );
34
157
 
35
158
  export const MANAGED_ENTRIES = [
36
159
  ".codex-plugin",
package/src/installer.js CHANGED
@@ -1,12 +1,15 @@
1
1
  import fs from "node:fs";
2
2
  import os from "node:os";
3
3
  import path from "node:path";
4
+ import { Readable } from "node:stream";
5
+ import { pipeline } from "node:stream/promises";
4
6
 
5
7
  import {
6
8
  MANAGED_ENTRIES,
7
9
  MODEL_SPECS,
8
10
  PACKAGE_VERSION,
9
11
  PLUGIN_NAME,
12
+ RECOMMENDED_MODEL_IDS,
10
13
  defaultMarketplacePath,
11
14
  defaultReleaseBase,
12
15
  defaultTargetDir,
@@ -21,6 +24,7 @@ import { extractZipSafely, fetchReleaseBundle } from "./release.js";
21
24
  import { crispasrExecutableName, findCommand, runCommand } from "./system.js";
22
25
 
23
26
  const MARKER_FILE = ".crispasr-installer.json";
27
+ const MODEL_MANIFEST = "model-manifest.json";
24
28
  const RELEASE_VERSION_RE = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
25
29
 
26
30
  function resolvedPath(value) {
@@ -170,6 +174,170 @@ export function inspectModels(targetDir) {
170
174
  }));
171
175
  }
172
176
 
177
+ function recommendedModels(targetDir) {
178
+ return inspectModels(targetDir).filter((model) => RECOMMENDED_MODEL_IDS.includes(model.id));
179
+ }
180
+
181
+ export function resolveModelPaths(targetDir) {
182
+ const recommended = recommendedModels(targetDir);
183
+ return {
184
+ targetDir,
185
+ modelsDir: path.join(targetDir, "models"),
186
+ ready: recommended.every((model) => model.installed),
187
+ recommendedModelIds: RECOMMENDED_MODEL_IDS,
188
+ englishModel: recommended.find((model) => model.role === "english")?.path || null,
189
+ chineseModel: recommended.find((model) => model.role === "chinese")?.path || null,
190
+ lidModel: recommended.find((model) => model.role === "lid")?.path || null,
191
+ missingModels: recommended.filter((model) => !model.installed),
192
+ };
193
+ }
194
+
195
+ function findModelSpec(modelId) {
196
+ const normalized = modelId.toLowerCase();
197
+ const match = MODEL_SPECS.find(
198
+ (model) => model.id === normalized || model.filename.toLowerCase() === normalized,
199
+ );
200
+ if (!match) {
201
+ throw new InstallerError("Unknown CrispASR model id.", "unknown_model", {
202
+ modelId,
203
+ knownIds: MODEL_SPECS.map((model) => model.id),
204
+ });
205
+ }
206
+ return match;
207
+ }
208
+
209
+ async function writeResponseBody(response, destination) {
210
+ if (response.body) {
211
+ await pipeline(Readable.fromWeb(response.body), fs.createWriteStream(destination));
212
+ return;
213
+ }
214
+ if (response.arrayBuffer) {
215
+ fs.writeFileSync(destination, Buffer.from(await response.arrayBuffer()));
216
+ return;
217
+ }
218
+ throw new InstallerError("The model download response did not include a body.", "empty_model_download");
219
+ }
220
+
221
+ function writeModelManifest(modelsDir, entries) {
222
+ const manifestPath = path.join(modelsDir, MODEL_MANIFEST);
223
+ let existing = { models: [] };
224
+ if (fs.existsSync(manifestPath)) {
225
+ try {
226
+ existing = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
227
+ } catch {
228
+ existing = { models: [] };
229
+ }
230
+ }
231
+ const byId = new Map(
232
+ (existing.models || []).filter((item) => item.id).map((item) => [item.id, item]),
233
+ );
234
+ for (const entry of entries) byId.set(entry.id, entry);
235
+ const manifest = {
236
+ updatedAt: new Date().toISOString(),
237
+ models: [...byId.values()].sort((a, b) => a.id.localeCompare(b.id)),
238
+ };
239
+ fs.writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`, "utf8");
240
+ return manifestPath;
241
+ }
242
+
243
+ async function downloadOneModel(spec, modelsDir, options) {
244
+ const destination = path.join(modelsDir, spec.filename);
245
+ if (fs.existsSync(destination) && !options.overwrite) {
246
+ return {
247
+ id: spec.id,
248
+ filename: spec.filename,
249
+ path: destination,
250
+ downloaded: false,
251
+ skipped: true,
252
+ reason: "already_exists",
253
+ url: spec.url,
254
+ };
255
+ }
256
+
257
+ const fetchImpl = options.fetchImpl || globalThis.fetch;
258
+ if (!fetchImpl) {
259
+ throw new InstallerError("This Node.js runtime does not provide fetch.", "fetch_unavailable");
260
+ }
261
+
262
+ const partial = `${destination}.part`;
263
+ try {
264
+ const response = await fetchImpl(spec.downloadUrl);
265
+ if (!response.ok) {
266
+ throw new InstallerError("Model download request failed.", "model_download_failed", {
267
+ modelId: spec.id,
268
+ status: response.status,
269
+ url: spec.downloadUrl,
270
+ });
271
+ }
272
+ await writeResponseBody(response, partial);
273
+ if (options.overwrite) fs.rmSync(destination, { force: true });
274
+ fs.renameSync(partial, destination);
275
+ } catch (error) {
276
+ fs.rmSync(partial, { force: true });
277
+ if (error instanceof InstallerError) throw error;
278
+ throw new InstallerError("Model download failed.", "model_download_failed", {
279
+ modelId: spec.id,
280
+ url: spec.downloadUrl,
281
+ message: error.message,
282
+ });
283
+ }
284
+
285
+ return {
286
+ id: spec.id,
287
+ role: spec.role,
288
+ filename: spec.filename,
289
+ path: destination,
290
+ downloaded: true,
291
+ skipped: false,
292
+ url: spec.url,
293
+ downloadUrl: spec.downloadUrl,
294
+ downloadedAt: new Date().toISOString(),
295
+ sizeBytes: fs.statSync(destination).size,
296
+ };
297
+ }
298
+
299
+ export async function downloadModels(options = {}) {
300
+ const homeDir = options.homeDir || os.homedir();
301
+ const targetDir = assertSafeTarget(options.targetDir || defaultTargetDir(homeDir), homeDir);
302
+ const modelsDir = path.join(targetDir, "models");
303
+ const requestedIds = options.modelIds?.length ? options.modelIds : RECOMMENDED_MODEL_IDS;
304
+ const specs = requestedIds.map((modelId) => findModelSpec(modelId));
305
+
306
+ if (options.dryRun) {
307
+ return {
308
+ command: "models",
309
+ dryRun: true,
310
+ targetDir,
311
+ plan: specs.map((spec) => `Download ${spec.id} (${spec.filename}) to ${modelsDir}`),
312
+ };
313
+ }
314
+
315
+ fs.mkdirSync(modelsDir, { recursive: true });
316
+ const results = [];
317
+ for (const spec of specs) {
318
+ results.push(await downloadOneModel(spec, modelsDir, options));
319
+ }
320
+ const downloaded = results.filter((item) => item.downloaded);
321
+ const manifestPath = downloaded.length > 0 ? writeModelManifest(modelsDir, downloaded) : null;
322
+ const paths = resolveModelPaths(targetDir);
323
+ return {
324
+ command: "models",
325
+ targetDir,
326
+ modelsDir,
327
+ modelIds: requestedIds,
328
+ results,
329
+ manifestPath,
330
+ ready: paths.ready,
331
+ recommendedModelIds: RECOMMENDED_MODEL_IDS,
332
+ recommendedPaths: {
333
+ englishModel: paths.englishModel,
334
+ chineseModel: paths.chineseModel,
335
+ lidModel: paths.lidModel,
336
+ },
337
+ missingModels: paths.missingModels,
338
+ };
339
+ }
340
+
173
341
  function installPlan({ targetDir, version, marketplacePath, update }) {
174
342
  return [
175
343
  `Download and verify GitHub Release v${version}`,
@@ -177,7 +345,7 @@ function installPlan({ targetDir, version, marketplacePath, update }) {
177
345
  "Install Python and MCP dependencies with uv",
178
346
  `${update ? "Update" : "Install"} the GPU-preferred CrispASR binary`,
179
347
  `Register the Codex Personal marketplace entry in ${marketplacePath}`,
180
- "Check for the three manually supplied local model files",
348
+ "Check for the three recommended local model files",
181
349
  ];
182
350
  }
183
351
 
@@ -197,7 +365,7 @@ export async function installPlugin(options = {}) {
197
365
 
198
366
  if (!RELEASE_VERSION_RE.test(version)) {
199
367
  throw new InstallerError(
200
- "Release versions must use semantic version syntax such as 0.3.4.",
368
+ "Release versions must use semantic version syntax such as 0.4.0.",
201
369
  "invalid_release_version",
202
370
  { version },
203
371
  );
@@ -277,7 +445,7 @@ export async function installPlugin(options = {}) {
277
445
  }
278
446
 
279
447
  const models = inspectModels(targetDir);
280
- const missingModels = models.filter((model) => !model.installed);
448
+ const missingModels = models.filter((model) => model.recommended && !model.installed);
281
449
  return {
282
450
  command: update ? "update" : "install",
283
451
  targetDir,
@@ -326,8 +494,9 @@ export function doctor(options = {}) {
326
494
  path: marketplacePath,
327
495
  },
328
496
  models: {
329
- ok: models.every((model) => model.installed),
497
+ ok: models.filter((model) => model.recommended).every((model) => model.installed),
330
498
  items: models,
499
+ recommendedModelIds: RECOMMENDED_MODEL_IDS,
331
500
  },
332
501
  };
333
502
  return {