@senad-d/micme 0.1.2 → 0.2.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 +1 -0
- package/README.md +33 -6
- package/SECURITY.md +2 -2
- package/micme.example.json +3 -1
- package/micme.schema.json +35 -2
- package/package.json +3 -2
- package/scripts/doctor.mjs +92 -0
- package/src/audio.ts +539 -34
- package/src/backends.ts +249 -0
- package/src/config.ts +25 -5
- package/src/constants.ts +5 -1
- package/src/extension.ts +25 -16
- package/src/models.ts +100 -9
- package/src/settings.ts +139 -85
- package/src/streaming.ts +229 -34
- package/src/transcription.ts +32 -48
- package/src/types.ts +29 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,7 @@ All notable changes to Micme will be documented in this file.
|
|
|
9
9
|
- Document the scoped npm package name, `@senad-d/micme`, in install, diagnostics, update, and uninstall commands.
|
|
10
10
|
- Add an interactive npm publishing script that prompts for a version, validates the package, creates the release commit/tag, and publishes with public scoped-package access.
|
|
11
11
|
- Keep publication on hold until package name, metadata, security review, validation, and smoke tests are complete.
|
|
12
|
+
- Add explicit transcription backend selection with backend-specific `/micme conf` model rows, doctor diagnostics, schema, and docs.
|
|
12
13
|
|
|
13
14
|
## 0.1.0 - 2026-06-18
|
|
14
15
|
|
package/README.md
CHANGED
|
@@ -17,6 +17,17 @@
|
|
|
17
17
|
|
|
18
18
|
Micme is a pi extension for short coding prompts. It records your microphone with `ffmpeg`, transcribes locally with `whisper.cpp` or another local backend, and inserts the transcript into pi.
|
|
19
19
|
|
|
20
|
+
<table align="center">
|
|
21
|
+
<tr>
|
|
22
|
+
<th>Micme demo</th>
|
|
23
|
+
</tr>
|
|
24
|
+
<tr>
|
|
25
|
+
<td align="center">
|
|
26
|
+
<img src="img/demo.gif" alt="Micme demo: record voice and paste the transcript into pi" title="Micme demo" width="760">
|
|
27
|
+
</td>
|
|
28
|
+
</tr>
|
|
29
|
+
</table>
|
|
30
|
+
|
|
20
31
|
- **Local-first:** no telemetry and no cloud STT service by default.
|
|
21
32
|
- **Review-first:** transcripts paste into the editor unless you enable auto-submit.
|
|
22
33
|
- **Pi-native:** install globally, project-locally, from git, or from a source checkout.
|
|
@@ -150,6 +161,7 @@ You can also edit the JSON manually. Minimal `~/.pi/agent/micme.json`:
|
|
|
150
161
|
{
|
|
151
162
|
"$schema": "https://raw.githubusercontent.com/senad-d/micme/main/micme.schema.json",
|
|
152
163
|
"MICME_LANGUAGE": "en",
|
|
164
|
+
"MICME_TRANSCRIBE_BACKEND": "auto",
|
|
153
165
|
"MICME_AUTO_DOWNLOAD_MODEL": "1",
|
|
154
166
|
"MICME_DEFAULT_WHISPER_CPP_MODEL": "small.en",
|
|
155
167
|
"MICME_AUTO_SUBMIT": "0",
|
|
@@ -163,8 +175,12 @@ Common settings:
|
|
|
163
175
|
|
|
164
176
|
| Variable | Meaning |
|
|
165
177
|
| --- | --- |
|
|
178
|
+
| `MICME_TRANSCRIBE_BACKEND=auto` | Backend selector. `auto` preserves priority: custom command, whisper.cpp, then Python Whisper. |
|
|
166
179
|
| `MICME_TRANSCRIPTION_MODE=clip` | Stable default: transcribe after recording stops. |
|
|
167
|
-
| `MICME_TRANSCRIPTION_MODE=stream` | Experimental live
|
|
180
|
+
| `MICME_TRANSCRIPTION_MODE=stream` | Experimental append-only live dictation with `whisper-stream`; requires whisper.cpp. |
|
|
181
|
+
| `MICME_STREAM_KEEP_CONTEXT=0` | Stream default: avoid Whisper prompt carry-over so live chunks are less likely to rewrite each other. |
|
|
182
|
+
| `MICME_STREAM_FLUSH_MS=650` | Stream profile quiet interval before tentative words are committed append-only. |
|
|
183
|
+
| `MICME_STREAM_FINALIZE_WITH_CLIP=0` | Keep the append-only live transcript on stop. Set `1` to opt in to final clip replacement. |
|
|
168
184
|
| `MICME_AUTO_SUBMIT=0` | Paste for review. Set `1` to send automatically. |
|
|
169
185
|
| `MICME_SHORTCUT=alt+m` | Toggle shortcut. Restart or `/reload` after changing. |
|
|
170
186
|
| `MICME_PRINTABLE_SHORTCUTS=§` | macOS Option-key fallback. |
|
|
@@ -174,6 +190,8 @@ Common settings:
|
|
|
174
190
|
|
|
175
191
|
See [`micme.example.json`](micme.example.json) for the full JSON template.
|
|
176
192
|
|
|
193
|
+
Streaming mode treats `whisper-stream` output as repeated, overlapping hypotheses rather than committed word deltas. Micme only appends committed words to the editor during live streaming; tentative words are held internally and committed after agreement, overlap, stop, or the quiet interval configured by `MICME_STREAM_FLUSH_MS`. If `MICME_STREAM_FINALIZE_WITH_CLIP=1`, the stop-time clip transcript can intentionally replace the live append-only text.
|
|
194
|
+
|
|
177
195
|
---
|
|
178
196
|
|
|
179
197
|
## Commands
|
|
@@ -182,7 +200,7 @@ See [`micme.example.json`](micme.example.json) for the full JSON template.
|
|
|
182
200
|
| --- | --- |
|
|
183
201
|
| `/micme` | Toggle recording. |
|
|
184
202
|
| `/micme conf` | Open the TUI configuration screen. |
|
|
185
|
-
| `/micme devices` |
|
|
203
|
+
| `/micme devices` | Show compact audio/video capture device inventory. |
|
|
186
204
|
| `/micme last` | Paste the previous transcript again. |
|
|
187
205
|
| `/micme audio` | Show the last kept audio directory. |
|
|
188
206
|
| `/micme help` | Show short help. |
|
|
@@ -191,9 +209,16 @@ See [`micme.example.json`](micme.example.json) for the full JSON template.
|
|
|
191
209
|
|
|
192
210
|
## Models and Backends
|
|
193
211
|
|
|
194
|
-
|
|
212
|
+
Micme supports these backend values in JSON/env config:
|
|
213
|
+
|
|
214
|
+
- `auto` (default): custom command when configured, otherwise whisper.cpp, otherwise Python Whisper.
|
|
215
|
+
- `whisper.cpp`: uses `whisper-cli`/`whisper-cpp` and a ggml/gguf model path.
|
|
216
|
+
- `python`: uses the OpenAI Whisper `whisper` CLI and a Python model name.
|
|
217
|
+
- `custom`: runs `MICME_TRANSCRIBE_COMMAND`; Micme treats the model as unknown.
|
|
195
218
|
|
|
196
|
-
|
|
219
|
+
`/micme conf` keeps the interactive backend picker focused on `whisper.cpp` and `Python Whisper`, then shows only the model/binary fields for the selected backend. For whisper.cpp, `MICME_WHISPER_CPP_MODEL` is the selected ggml/gguf model path; if it is unset, Micme falls back to `${MICME_MODEL_DIR}/ggml-${MICME_DEFAULT_WHISPER_CPP_MODEL}.bin`. For Python Whisper, `MICME_WHISPER_MODEL` is passed as the CLI model name.
|
|
220
|
+
|
|
221
|
+
With `MICME_AUTO_DOWNLOAD_MODEL=1`, Micme downloads missing standard whisper.cpp models into `MICME_MODEL_DIR`. Disable downloads with:
|
|
197
222
|
|
|
198
223
|
```env
|
|
199
224
|
MICME_AUTO_DOWNLOAD_MODEL=0
|
|
@@ -216,7 +241,7 @@ MICME_TRANSCRIBE_COMMAND=whisper-cli -m /path/to/model.bin -f {audio} -otxt -of
|
|
|
216
241
|
|
|
217
242
|
| Problem | Try |
|
|
218
243
|
| --- | --- |
|
|
219
|
-
| No backend found |
|
|
244
|
+
| No backend found | Use `/micme conf` to choose `whisper.cpp` or Python Whisper, install the selected backend, or configure a trusted custom command manually. |
|
|
220
245
|
| Wrong microphone | Run `/micme devices`, then set the OS-specific device variable. |
|
|
221
246
|
| Unrelated transcript | You probably recorded silence. Set `MICME_KEEP_AUDIO=1` and check `/micme audio`. |
|
|
222
247
|
| Slow transcription | Use `whisper.cpp`, a smaller model, and shorter recordings. |
|
|
@@ -237,7 +262,9 @@ From a source checkout:
|
|
|
237
262
|
npm run doctor
|
|
238
263
|
```
|
|
239
264
|
|
|
240
|
-
The doctor checks Node, pi, `ffmpeg`, whisper.cpp, optional `whisper-stream`, model paths, and macOS devices when available. Custom command values are redacted.
|
|
265
|
+
The doctor checks Node, pi, `ffmpeg`, requested/effective backend, effective model, whisper.cpp, optional `whisper-stream`, model paths, and macOS devices when available. Custom command values are redacted.
|
|
266
|
+
|
|
267
|
+
For stream state investigation, start pi with `MICME_STREAM_DIAGNOSTICS=1`. Diagnostics are opt-in and include sanitized frames, extraction mode, committed words, and tentative candidate words.
|
|
241
268
|
|
|
242
269
|
---
|
|
243
270
|
|
package/SECURITY.md
CHANGED
|
@@ -39,7 +39,7 @@ The default process output is capped before it is shown to users or errors. Diag
|
|
|
39
39
|
|
|
40
40
|
## Custom command risks
|
|
41
41
|
|
|
42
|
-
`MICME_RECORD_COMMAND` and `MICME_TRANSCRIBE_COMMAND` are advanced escape hatches. They run through the local shell (`sh -lc` on Unix-like systems and `cmd.exe` on Windows). Only use commands you wrote or fully trust.
|
|
42
|
+
`MICME_RECORD_COMMAND` and `MICME_TRANSCRIBE_COMMAND` are advanced escape hatches. They run through the local shell (`sh -lc` on Unix-like systems and `cmd.exe` on Windows). Only use commands you wrote or fully trust. When `MICME_TRANSCRIBE_BACKEND=custom`, Micme does not try to inspect, parse, or rewrite the command to infer which model it uses.
|
|
43
43
|
|
|
44
44
|
Micme replaces these placeholders in custom commands:
|
|
45
45
|
|
|
@@ -59,7 +59,7 @@ Disable model downloads with:
|
|
|
59
59
|
MICME_AUTO_DOWNLOAD_MODEL=0
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
You can also download models manually and set `MICME_WHISPER_CPP_MODEL=/path/to/model.bin`.
|
|
62
|
+
You can also download models manually and set `MICME_WHISPER_CPP_MODEL=/path/to/model.bin`. Micme only auto-downloads standard, inferable whisper.cpp model files and does not treat arbitrary custom-command model references as downloadable assets.
|
|
63
63
|
|
|
64
64
|
## Micme config handling
|
|
65
65
|
|
package/micme.example.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"MICME_SHORTCUT": "alt+m",
|
|
4
4
|
"MICME_PRINTABLE_SHORTCUTS": "§",
|
|
5
5
|
"MICME_TRANSCRIPTION_MODE": "clip",
|
|
6
|
+
"MICME_TRANSCRIBE_BACKEND": "auto",
|
|
6
7
|
"MICME_AUTO_SUBMIT": "0",
|
|
7
8
|
"MICME_LANGUAGE": "en",
|
|
8
9
|
"MICME_TRANSCRIBE_TIMEOUT_MS": "120000",
|
|
@@ -19,11 +20,12 @@
|
|
|
19
20
|
"MICME_METER_GAIN": "1",
|
|
20
21
|
"MICME_STREAM_CAPTURE": "-1",
|
|
21
22
|
"MICME_STREAM_WORDS_PER_CHUNK": "5",
|
|
23
|
+
"MICME_STREAM_FLUSH_MS": "650",
|
|
22
24
|
"MICME_STREAM_STEP_MS": "500",
|
|
23
25
|
"MICME_STREAM_LENGTH_MS": "3000",
|
|
24
26
|
"MICME_STREAM_KEEP_MS": "300",
|
|
25
27
|
"MICME_STREAM_MAX_TOKENS": "32",
|
|
26
|
-
"MICME_STREAM_KEEP_CONTEXT": "
|
|
28
|
+
"MICME_STREAM_KEEP_CONTEXT": "0",
|
|
27
29
|
"MICME_STREAM_FINALIZE_WITH_CLIP": "0",
|
|
28
30
|
"MICME_STREAM_VAD_THRESHOLD": "0.35",
|
|
29
31
|
"MICME_STREAM_DIAGNOSTICS": "0"
|
package/micme.schema.json
CHANGED
|
@@ -21,6 +21,12 @@
|
|
|
21
21
|
"enum": ["clip", "stream"],
|
|
22
22
|
"default": "clip"
|
|
23
23
|
},
|
|
24
|
+
"MICME_TRANSCRIBE_BACKEND": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"enum": ["auto", "whisper.cpp", "python", "custom"],
|
|
27
|
+
"default": "auto",
|
|
28
|
+
"description": "Select transcription backend. auto preserves priority: custom command, whisper.cpp, then Python Whisper."
|
|
29
|
+
},
|
|
24
30
|
"MICME_AUTO_SUBMIT": {
|
|
25
31
|
"$ref": "#/$defs/stringFlag"
|
|
26
32
|
},
|
|
@@ -33,7 +39,21 @@
|
|
|
33
39
|
},
|
|
34
40
|
"MICME_DEFAULT_WHISPER_CPP_MODEL": {
|
|
35
41
|
"type": "string",
|
|
36
|
-
"default": "small.en"
|
|
42
|
+
"default": "small.en",
|
|
43
|
+
"description": "whisper.cpp model name mapped to MICME_MODEL_DIR/ggml-<name>.bin unless MICME_WHISPER_CPP_MODEL is set."
|
|
44
|
+
},
|
|
45
|
+
"MICME_WHISPER_CPP_MODEL": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"description": "Advanced whisper.cpp exact ggml/gguf model path override. When set, it wins over MICME_DEFAULT_WHISPER_CPP_MODEL."
|
|
48
|
+
},
|
|
49
|
+
"MICME_WHISPER_CPP_BIN": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"description": "Command or path for whisper.cpp clip transcription. Leave unset to find whisper-cli/whisper-cpp on PATH."
|
|
52
|
+
},
|
|
53
|
+
"MICME_WHISPER_MODEL": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"default": "base.en",
|
|
56
|
+
"description": "Model name passed to the OpenAI Whisper Python CLI when the Python backend is used."
|
|
37
57
|
},
|
|
38
58
|
"MICME_MODEL_DIR": {
|
|
39
59
|
"type": "string",
|
|
@@ -46,13 +66,26 @@
|
|
|
46
66
|
"MICME_KEEP_AUDIO": {
|
|
47
67
|
"$ref": "#/$defs/stringFlag"
|
|
48
68
|
},
|
|
69
|
+
"MICME_STREAM_KEEP_CONTEXT": {
|
|
70
|
+
"$ref": "#/$defs/stringFlag",
|
|
71
|
+
"description": "Pass --keep-context to whisper-stream. Defaults to off for append-only dictation."
|
|
72
|
+
},
|
|
73
|
+
"MICME_STREAM_FINALIZE_WITH_CLIP": {
|
|
74
|
+
"$ref": "#/$defs/stringFlag",
|
|
75
|
+
"description": "When enabled, stop-time clip transcription may replace the append-only live stream transcript."
|
|
76
|
+
},
|
|
77
|
+
"MICME_STREAM_FLUSH_MS": {
|
|
78
|
+
"type": ["string", "number"],
|
|
79
|
+
"default": "700",
|
|
80
|
+
"description": "Quiet interval in milliseconds before tentative stream words are committed append-only."
|
|
81
|
+
},
|
|
49
82
|
"MICME_RECORD_COMMAND": {
|
|
50
83
|
"type": "string",
|
|
51
84
|
"description": "Advanced shell command hook. Use only trusted commands."
|
|
52
85
|
},
|
|
53
86
|
"MICME_TRANSCRIBE_COMMAND": {
|
|
54
87
|
"type": "string",
|
|
55
|
-
"description": "Advanced shell command
|
|
88
|
+
"description": "Advanced custom transcription shell command. Use only trusted commands; Micme cannot inspect which model it uses."
|
|
56
89
|
}
|
|
57
90
|
},
|
|
58
91
|
"patternProperties": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@senad-d/micme",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Local voice-to-text for pi, optimized for fast Whisper-style backends.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,10 +45,11 @@
|
|
|
45
45
|
"scripts": {
|
|
46
46
|
"doctor": "node scripts/doctor.mjs",
|
|
47
47
|
"check": "node --check scripts/doctor.mjs && node --check scripts/check-package-contents.mjs && node --check scripts/publish-npm.mjs",
|
|
48
|
+
"test": "node --test test/*.test.mjs",
|
|
48
49
|
"typecheck": "tsc --noEmit",
|
|
49
50
|
"pack:dry-run": "npm pack --dry-run --json",
|
|
50
51
|
"check:pack": "node scripts/check-package-contents.mjs",
|
|
51
|
-
"validate": "npm run typecheck && npm run check && npm run check:pack",
|
|
52
|
+
"validate": "npm run typecheck && npm run test && npm run check && npm run check:pack",
|
|
52
53
|
"publish:npm": "node scripts/publish-npm.mjs",
|
|
53
54
|
"prepublishOnly": "npm run validate"
|
|
54
55
|
},
|
package/scripts/doctor.mjs
CHANGED
|
@@ -7,6 +7,8 @@ import { execFileSync, spawnSync } from "node:child_process";
|
|
|
7
7
|
|
|
8
8
|
const isWin = process.platform === "win32";
|
|
9
9
|
const micmeConfig = loadMicmeConfig();
|
|
10
|
+
const DEFAULT_TRANSCRIBE_BACKEND = "auto";
|
|
11
|
+
const TRANSCRIBE_BACKENDS = new Set(["auto", "whisper.cpp", "python", "custom"]);
|
|
10
12
|
|
|
11
13
|
function getMicmeConfigPath() {
|
|
12
14
|
const agentDir = process.env.PI_CODING_AGENT_DIR ? resolve(process.env.PI_CODING_AGENT_DIR) : join(homedir(), ".pi", "agent");
|
|
@@ -91,6 +93,94 @@ function summarizeConfiguredCommand(value) {
|
|
|
91
93
|
return `configured (${trimmed.length} chars${placeholderText}; full value redacted)`;
|
|
92
94
|
}
|
|
93
95
|
|
|
96
|
+
function getTranscribeBackend() {
|
|
97
|
+
const raw = env("MICME_TRANSCRIBE_BACKEND")?.trim();
|
|
98
|
+
return TRANSCRIBE_BACKENDS.has(raw) ? raw : DEFAULT_TRANSCRIBE_BACKEND;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function getTranscriptionMode() {
|
|
102
|
+
return env("MICME_TRANSCRIPTION_MODE") === "stream" ? "stream" : "clip";
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function resolveWhisperCppModelSummary() {
|
|
106
|
+
const explicit = envPath("MICME_WHISPER_CPP_MODEL");
|
|
107
|
+
if (explicit) {
|
|
108
|
+
return {
|
|
109
|
+
path: explicit,
|
|
110
|
+
source: "MICME_WHISPER_CPP_MODEL explicit path",
|
|
111
|
+
exists: existsSync(explicit),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
const defaultModel = env("MICME_DEFAULT_WHISPER_CPP_MODEL") || "small.en";
|
|
115
|
+
const modelDir = expandConfigValue(env("MICME_MODEL_DIR") || join(homedir(), ".cache", "whisper.cpp"));
|
|
116
|
+
const path = join(modelDir, `ggml-${defaultModel}.bin`);
|
|
117
|
+
return {
|
|
118
|
+
path,
|
|
119
|
+
modelName: defaultModel,
|
|
120
|
+
source: env("MICME_DEFAULT_WHISPER_CPP_MODEL") ? "MICME_DEFAULT_WHISPER_CPP_MODEL" : "default whisper.cpp model name",
|
|
121
|
+
exists: existsSync(path),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function resolveBackendPlan({ whisperCpp, whisperStream, whisper, transcribeCommand }) {
|
|
126
|
+
const requestedBackend = getTranscribeBackend();
|
|
127
|
+
const mode = getTranscriptionMode();
|
|
128
|
+
const whisperCppAvailable = Boolean(whisperCpp && existsSync(whisperCpp));
|
|
129
|
+
const whisperStreamAvailable = Boolean(whisperStream && existsSync(whisperStream));
|
|
130
|
+
const pythonAvailable = Boolean(whisper && existsSync(whisper));
|
|
131
|
+
const model = resolveWhisperCppModelSummary();
|
|
132
|
+
const warnings = [];
|
|
133
|
+
|
|
134
|
+
const invalidBackend = env("MICME_TRANSCRIBE_BACKEND")?.trim();
|
|
135
|
+
if (invalidBackend && !TRANSCRIBE_BACKENDS.has(invalidBackend)) warnings.push(`Invalid MICME_TRANSCRIBE_BACKEND=${invalidBackend}; using auto.`);
|
|
136
|
+
|
|
137
|
+
if (mode === "stream") {
|
|
138
|
+
if (requestedBackend === "python") {
|
|
139
|
+
return { requestedBackend, effectiveBackend: "none", effectiveModel: "unavailable", reason: "Streaming mode requires whisper.cpp; Python Whisper only supports clip transcription.", warnings };
|
|
140
|
+
}
|
|
141
|
+
if (requestedBackend === "custom") {
|
|
142
|
+
return { requestedBackend, effectiveBackend: "none", effectiveModel: "unavailable", reason: "Streaming mode requires whisper.cpp; custom transcribe commands only support clip transcription.", warnings };
|
|
143
|
+
}
|
|
144
|
+
if (whisperStreamAvailable) {
|
|
145
|
+
return { requestedBackend, effectiveBackend: "whisper.cpp", binary: whisperStream, model, effectiveModel: model.path, reason: "streaming uses whisper-stream", warnings };
|
|
146
|
+
}
|
|
147
|
+
return { requestedBackend, effectiveBackend: "none", effectiveModel: "unavailable", reason: "MICME_TRANSCRIPTION_MODE=stream but whisper-stream was not found.", warnings };
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (requestedBackend === "custom") {
|
|
151
|
+
if (transcribeCommand?.trim()) return { requestedBackend, effectiveBackend: "custom", effectiveModel: "unknown", reason: "MICME_TRANSCRIBE_BACKEND=custom", warnings };
|
|
152
|
+
return { requestedBackend, effectiveBackend: "none", effectiveModel: "unavailable", reason: "MICME_TRANSCRIBE_BACKEND=custom but MICME_TRANSCRIBE_COMMAND is not set.", warnings };
|
|
153
|
+
}
|
|
154
|
+
if (requestedBackend === "whisper.cpp") {
|
|
155
|
+
if (whisperCppAvailable) return { requestedBackend, effectiveBackend: "whisper.cpp", binary: whisperCpp, model, effectiveModel: model.path, reason: "MICME_TRANSCRIBE_BACKEND=whisper.cpp", warnings };
|
|
156
|
+
return { requestedBackend, effectiveBackend: "none", effectiveModel: "unavailable", reason: "MICME_TRANSCRIBE_BACKEND=whisper.cpp but whisper.cpp was not found.", warnings };
|
|
157
|
+
}
|
|
158
|
+
if (requestedBackend === "python") {
|
|
159
|
+
if (pythonAvailable) return { requestedBackend, effectiveBackend: "python", binary: whisper, effectiveModel: env("MICME_WHISPER_MODEL") || "base.en", reason: "MICME_TRANSCRIBE_BACKEND=python", warnings };
|
|
160
|
+
return { requestedBackend, effectiveBackend: "none", effectiveModel: "unavailable", reason: "MICME_TRANSCRIBE_BACKEND=python but the `whisper` CLI was not found.", warnings };
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (transcribeCommand?.trim()) return { requestedBackend, effectiveBackend: "custom", effectiveModel: "unknown", reason: "auto selected custom command because MICME_TRANSCRIBE_COMMAND is configured", warnings };
|
|
164
|
+
if (whisperCppAvailable) return { requestedBackend, effectiveBackend: "whisper.cpp", binary: whisperCpp, model, effectiveModel: model.path, reason: "auto selected whisper.cpp because a whisper.cpp binary is available", warnings };
|
|
165
|
+
if (pythonAvailable) return { requestedBackend, effectiveBackend: "python", binary: whisper, effectiveModel: env("MICME_WHISPER_MODEL") || "base.en", reason: "auto selected Python Whisper because whisper.cpp is unavailable", warnings };
|
|
166
|
+
return { requestedBackend, effectiveBackend: "none", effectiveModel: "unavailable", reason: "No Micme transcription backend found.", warnings };
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function printBackendPlanDiagnostics(plan) {
|
|
170
|
+
info("requested backend", plan.requestedBackend);
|
|
171
|
+
if (plan.effectiveBackend === "none") warn("effective backend", plan.reason);
|
|
172
|
+
else ok("effective backend", `${plan.effectiveBackend} (${plan.reason})`);
|
|
173
|
+
|
|
174
|
+
if (plan.effectiveBackend === "custom") info("effective model", "unknown; controlled by MICME_TRANSCRIBE_COMMAND");
|
|
175
|
+
else if (plan.effectiveBackend === "whisper.cpp") {
|
|
176
|
+
info("effective model", `${plan.effectiveModel} (${plan.model?.source || "whisper.cpp model"})`);
|
|
177
|
+
if (plan.model && !plan.model.exists) warn("effective whisper.cpp model is missing", plan.effectiveModel);
|
|
178
|
+
} else if (plan.effectiveBackend === "python") info("effective model", plan.effectiveModel);
|
|
179
|
+
else info("effective model", "unavailable");
|
|
180
|
+
|
|
181
|
+
for (const warning of plan.warnings) warn("backend warning", warning);
|
|
182
|
+
}
|
|
183
|
+
|
|
94
184
|
function printConfigDiagnostics() {
|
|
95
185
|
if (micmeConfig.error) warn("micme.json invalid", `${micmeConfig.path}: ${micmeConfig.error}`);
|
|
96
186
|
else if (micmeConfig.found) ok("micme.json loaded", `${micmeConfig.path} (${Object.keys(micmeConfig.values).length} MICME_* key(s))`);
|
|
@@ -152,6 +242,8 @@ async function main() {
|
|
|
152
242
|
if (transcribeCommand) ok("custom transcribe command", summarizeConfiguredCommand(transcribeCommand));
|
|
153
243
|
else info("custom transcribe command", "not set");
|
|
154
244
|
|
|
245
|
+
printBackendPlanDiagnostics(resolveBackendPlan({ whisperCpp, whisperStream, whisper, transcribeCommand }));
|
|
246
|
+
|
|
155
247
|
const recordCommand = env("MICME_RECORD_COMMAND");
|
|
156
248
|
if (recordCommand) ok("custom record command", summarizeConfiguredCommand(recordCommand));
|
|
157
249
|
else info("custom record command", "not set");
|