Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(speech): read model.cc once instead of checking then reading

Dev Goswami1d8eb3f92fed
diff --git a/scripts/patch-smart-whisper.mjs b/scripts/patch-smart-whisper.mjs
index 2bea88354..d4a5cd582 100644
--- a/scripts/patch-smart-whisper.mjs
+++ b/scripts/patch-smart-whisper.mjs
@@ -93,8 +93,7 @@ export function patchSmartWhisper(dir) {
const gyp = fs.readFileSync(gypPath, 'utf8')
const js = fs.readFileSync(jsPath, 'utf8')
const modelPath = path.join(dir, 'src', 'binding', 'model.cc')
- if (!fs.existsSync(modelPath)) fail('src/binding/model.cc', 'not found')
- const model = fs.readFileSync(modelPath, 'utf8')
+ const model = readOrFail(modelPath, 'src/binding/model.cc')
const gypDone = gyp.includes(PATCH_MARKER)
const jsDone = js.includes(PATCH_MARKER)
const modelDone = model.includes(CTX_PARAMS_MARKER)
@@ -139,6 +138,16 @@ export function patchSmartWhisper(dir) {
return 'patched'
}
+/** Reads a file the patch needs; a missing one is an anchor failure, not a crash. */
+function readOrFail(file, name) {
+ try {
+ return fs.readFileSync(file, 'utf8')
+ } catch (err) {
+ if (err && err.code === 'ENOENT') fail(name, 'not found')
+ throw err
+ }
+}
+
function expectOnce(text, needle, name) {
const n = text.split(needle).length - 1
if (n !== 1) fail(name, `expected exactly 1 match, found ${n}`)