opencode-voice-dictation 0.6.0 → 0.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-voice-dictation",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Offline voice dictation and read-aloud for OpenCode Desktop on Windows",
5
5
  "license": "MIT",
6
6
  "author": "Fran Carlos <francarlos803@gmail.com>",
@@ -42,7 +42,10 @@ function toWslPath(path: string): string {
42
42
 
43
43
  function spawnWorker(python: string, model: string): ChildProcess {
44
44
  const env = { ...process.env, WHISPER_MODEL: model, WHISPER_DEVICE: "cuda" }
45
- const command = `"${python}" "${toWslPath(workerPath())}"`
45
+
46
+ // Inside `bash -lc`, a quoted `~` does not expand. Use $HOME instead.
47
+ const pythonArg = python.startsWith("~/") ? `"$HOME/${python.slice(2)}"` : `"${python}"`
48
+ const command = `${pythonArg} "${toWslPath(workerPath())}"`
46
49
 
47
50
  if (process.platform === "win32") {
48
51
  return spawn("wsl.exe", ["-d", "Ubuntu-22.04", "-e", "bash", "-lc", command], {
@@ -119,14 +122,25 @@ export class WhisperEngine {
119
122
 
120
123
  child.on("close", (code) => {
121
124
  clearTimeout(timer)
122
- if (this.status.ready) {
125
+ const detail = this.stderr.trim()
126
+
127
+ if (!this.status.ready) {
128
+ this.status = {
129
+ ready: false,
130
+ model: this.model,
131
+ device: "cuda",
132
+ error: detail || `Whisper worker exited with code ${code ?? "unknown"}`,
133
+ }
134
+ this.readyReject?.(new Error(this.status.error))
135
+ } else {
123
136
  this.status = {
124
137
  ready: false,
125
138
  model: this.model,
126
139
  device: "cuda",
127
- error: this.stderr.trim() || `Whisper worker exited with code ${code ?? "unknown"}`,
140
+ error: detail || `Whisper worker exited with code ${code ?? "unknown"}`,
128
141
  }
129
142
  }
143
+
130
144
  this.failWaiters(new Error(this.status.error || "Whisper worker stopped"))
131
145
  this.child = undefined
132
146
  this.readyPromise = undefined