Skip to content

Private AI meeting notes that stay on your computer. No meeting bot. Free and open source for Mac, Windows and Linux. An alternative to Granola, Otter and Fireflies.

The speech engine loads in plain Node again: its text joining moved out of a file that pulls in the translations, which stopped the Windows and Linux release builds

christianmate823bc7cc001
diff --git a/app/src/main/asr/transcribe.ts b/app/src/main/asr/transcribe.ts
index c964853a..fb1684d1 100644
--- a/app/src/main/asr/transcribe.ts
+++ b/app/src/main/asr/transcribe.ts
@@ -3,7 +3,7 @@ import type { Track } from '../capture'
import type { Chunk } from './chunker'
import { languageName } from './appleSpeech'
import { tokens } from './echo'
-import { joinSaid, unspaced } from '../../shared/transcript'
+import { joinSaid, unspaced } from '../../shared/said'
import { isPromptEcho, isSilenceGuess, isSubtitleCredit, withoutPromptLabel } from './hallucination'
/** What a chunk turns into: lines on meeting time. The meeting and the speaker are added where they are saved. */
diff --git a/app/src/shared/said.ts b/app/src/shared/said.ts
new file mode 100644
index 00000000..3f184efb
--- /dev/null
+++ b/app/src/shared/said.ts
@@ -0,0 +1,20 @@
+// Kept free of imports: the speech engine loads this in plain Node (scripts/whisper-smoke.mjs),
+// where the app's translations (import.meta.glob, a bundler feature) can't load.
+
+/** writing with no spaces between words (Japanese, Chinese, Thai…), and its punctuation */
+const NO_SPACE = /[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Thai}\p{Script=Lao}\p{Script=Khmer}\p{Script=Myanmar}\u3000-\u303f\uff01-\uff65]/u
+/** written without spaces between words */
+export const unspaced = (ch: string | undefined): boolean => !!ch && NO_SPACE.test(ch)
+
+/** Lines read as one text: a space between them, except where neither side is written with spaces */
+export function joinSaid(texts: string[]): string {
+ let out = ''
+ for (const raw of texts) {
+ const text = raw.trim()
+ if (!text) continue
+ const last = [...out].at(-1), first = [...text][0]
+ const none = !out || (unspaced(last) && (unspaced(first) || /\p{P}/u.test(first))) || (unspaced(first) && /\p{P}/u.test(last!) && [...out].some(unspaced))
+ out += (none ? '' : ' ') + text
+ }
+ return out
+}
diff --git a/app/src/shared/transcript.ts b/app/src/shared/transcript.ts
index 2f91c24a..fbf1c5f2 100644
--- a/app/src/shared/transcript.ts
+++ b/app/src/shared/transcript.ts
@@ -1,6 +1,7 @@
import { AUDIO_SPEAKER } from './audioUpload'
import { t } from './i18n'
import type { LiveWord } from './liveWords'
+export { joinSaid, unspaced } from './said'
/** A transcript line as the view needs it */
type Said = { track: 'me' | 'them'; startMs: number; endMs: number; speaker: string | null; speakerColor?: number }
@@ -17,24 +18,6 @@ export function echoRuns<L extends { track: string; hidden?: boolean; echoConfid
}
-/** writing with no spaces between words (Japanese, Chinese, Thai…), and its punctuation */
-const NO_SPACE = /[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Thai}\p{Script=Lao}\p{Script=Khmer}\p{Script=Myanmar}\u3000-\u303f\uff01-\uff65]/u
-/** written without spaces between words */
-export const unspaced = (ch: string | undefined): boolean => !!ch && NO_SPACE.test(ch)
-
-/** Lines read as one text: a space between them, except where neither side is written with spaces */
-export function joinSaid(texts: string[]): string {
- let out = ''
- for (const raw of texts) {
- const text = raw.trim()
- if (!text) continue
- const last = [...out].at(-1), first = [...text][0]
- const none = !out || (unspaced(last) && (unspaced(first) || /\p{P}/u.test(first))) || (unspaced(first) && /\p{P}/u.test(last!) && [...out].some(unspaced))
- out += (none ? '' : ' ') + text
- }
- return out
-}
-
/** a pause this long starts a new turn, so the time shows again */
const NEW_TURN_AFTER_MS = 30_000
diff --git a/app/test/plainNodeSpeech.test.ts b/app/test/plainNodeSpeech.test.ts
new file mode 100644
index 00000000..a20bf987
--- /dev/null
+++ b/app/test/plainNodeSpeech.test.ts
@@ -0,0 +1,25 @@
+import { execFileSync } from 'node:child_process'
+import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join, resolve } from 'node:path'
+import { pathToFileURL } from 'node:url'
+import { expect, it } from 'vitest'
+
+// The release build runs the speech engine's sources in plain Node (scripts/whisper-smoke.mjs,
+// scripts/speed-check-smoke.mjs). Anything they import must load without the bundler: one import of the
+// translations (import.meta.glob) there stopped the 0.3.85 Windows and Linux builds.
+const LOADED_BY_SMOKE = ['src/main/asr/server.ts', 'src/main/asr/speedCheck.ts']
+
+it.each(LOADED_BY_SMOKE)('%s loads in plain Node, as the release smoke tests load it', (file) => {
+ const dir = mkdtempSync(join(tmpdir(), 'yogurt-plain-node-'))
+ try {
+ const script = join(dir, 'load.mjs')
+ writeFileSync(script, `import { registerHooks } from 'node:module'
+registerHooks({ resolve(spec, ctx, next) { try { return next(spec, ctx) } catch (e) { if (spec.startsWith('.')) return next(spec + '.ts', ctx); throw e } } })
+await import(process.argv[2])
+console.log('loaded')
+`)
+ const out = execFileSync(process.execPath, [script, pathToFileURL(resolve(file)).href], { encoding: 'utf8', env: { ...process.env, NODE_OPTIONS: '' } })
+ expect(out).toContain('loaded')
+ } finally { rmSync(dir, { recursive: true, force: true }) }
+}, 60_000)