Skip to content

feat(speech): main-process NeMo-Speech.cpp manager (#845) - #863

Merged
currentbits merged 1 commit into
coder/fork-execute-this-live-speech-to-text-de-e47061from
coder/fork-execute-this-live-speech-to-text-de-1bbb82
Sep 3, 2026
Merged

currentbits merged 1 commit into
coder/fork-execute-this-live-speech-to-text-de-e47061from
coder/fork-execute-this-live-speech-to-text-de-1bbb82

Conversation

@currentbits

Copy link
Copy Markdown
Owner

PR 2 of live speech-to-text (#845). Stacked on #858 (IPC namespace).

Adds electron/speech.js and wires it through registerIpc / boot / teardownServices.

  • Pinned GGUF download (.partial, SHA-256 d9a01898…, 699,872,960 bytes, atomic rename)
  • Lazy nemo-speech serve on 127.0.0.1, --no-ui, API key in NEMO_SPEECH_HTTP_API_KEY (not argv)
  • One /v1/realtime socket; delta suffixes vs transcript finals
  • Crash returns to ready (no auto-retry)
  • Windows spawn cwd is bin/ so DLLs load
  • Media permission: audio only, Solenta main frame, only while recording is requested

No Composer UI, no packaging, no sidecar binary in the tree. Tests inject fetch/spawn/WebSocket (29 locally).

Follow-up: Composer mic + AudioWorklet.

Add electron/speech.js, wire it through registerIpc/makeCtx, and
construct it at boot with teardown plus media-permission gating.
Tests inject fetch, spawn, and WebSocket so the 700 MB GGUF is never
downloaded.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-03T12:39:35.355947Z b98cfe9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@currentbits
currentbits changed the base branch from main to coder/fork-execute-this-live-speech-to-text-de-e47061 September 3, 2026 12:34
@currentbits

Copy link
Copy Markdown
Owner Author

Retargeted base to coder/fork-execute-this-live-speech-to-text-de-e47061 (#858) so this is a stack, not IPC+manager vs main.

@currentbits
currentbits merged commit 3db1131 into coder/fork-execute-this-live-speech-to-text-de-e47061 Sep 3, 2026
3 of 6 checks passed
@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review

onStatus: (status) => broadcast("speech:changed", status),

P1 Badge Keep speech transcripts out of web broadcasts

When --serve-web is enabled, this uses the process-wide broadcast, which also calls webServer.broadcast; attachWebBridge.broadcast only filters simulator channels (electron/webBridge.js lines 171-178). Consequently every speech:changed payload—including dictated delta and transcript text—is transmitted to authenticated web clients even though the wire contract declares speech pushes desktop-only. Filter speech channels at the bridge or avoid teeing this status through the web broadcaster.


solenta/electron/ipc.js

Lines 1829 to 1833 in b98cfe9

"speech:download": async (ctx) => requireSpeech(ctx).download(),
"speech:start": async (ctx) => requireSpeech(ctx).start(),
"speech:write": async (ctx, input) => requireSpeech(ctx).write(input),
"speech:stop": async (ctx, input) => requireSpeech(ctx).stop(input),
"speech:cancel": async (ctx, input) => requireSpeech(ctx).cancel(input),

P2 Badge Reject speech invocations from the web transport

With --serve-web, attachWebBridge dispatches every non-simulator entry in IPC_HANDLERS using the same registered context, which contains this speech manager. These handlers therefore let an authenticated web client trigger the 700 MB download and start or control the host sidecar despite the API being documented as desktop-only; add a ctx.transport guard like the simulator namespace or explicitly block speech: in the web bridge.


solenta/electron/speech.js

Lines 730 to 734 in b98cfe9

async function start() {
if (state === "recording" || state === "stopping" || active) {
throw new Error("Speech session already active.");
}
if (state === "downloading") {

P2 Badge Serialize concurrent speech starts

If two speech:start invocations arrive before the first ensureSidecar() await completes, both pass this guard because neither state nor active marks a start in progress. They can spawn competing children, overwrite sidecar, active, and startWait, and eventually let one timeout close the session returned successfully by the other while leaving the displaced child unmanaged. Set a starting state synchronously or share a single in-flight start promise.


solenta/src/shared/ipc.ts

Lines 4157 to 4161 in b98cfe9

write(input: {
sessionId: string;
pcm: ArrayBuffer | ArrayBufferView;
seq?: number;
}): Promise<void>;

P2 Badge Align the optional sequence field with runtime behavior

The public API declares seq optional, but speech.write() rejects every omitted value because Number.isInteger(undefined) is false. A typed Composer client can therefore follow this contract, omit seq, and have all audio rejected as invalid; either make the field required in CoderApi or accept omission and derive the expected sequence internally.


const out = fs.createWriteStream(partialPath);

P2 Badge Handle write-stream errors inside the download promise

If opening or writing the partial model fails—for example because the disk fills or the existing speech directory becomes unwritable—fs.WriteStream emits an error event, but this stream has no error listener. Even though write callbacks are wrapped in promises, Node still emits the event, producing an uncaught exception instead of a normal speech.download() failure; attach an error handler and route it through the download rejection/cleanup path.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

currentbits added a commit that referenced this pull request Sep 3, 2026
* docs: plan local speech-to-text

* feat(speech): add CoderApi speech IPC namespace (#845)

Lock status/download/start/write/stop/cancel and desktop-only
speech:changed across the six-place IPC declaration. Stub rejects
until electron/speech.js. Partials are incremental suffixes (`delta`).

* feat(speech): main-process NeMo-Speech.cpp manager (#845) (#863)

Add electron/speech.js, wire it through registerIpc/makeCtx, and
construct it at boot with teardown plus media-permission gating.
Tests inject fetch, spawn, and WebSocket so the 700 MB GGUF is never
downloaded.

Co-authored-by: Willem <[email protected]>

* feat(speech): live dictation in the composer (#845)

Mic pill next to attach, user-confirmed ~700 MB download, AudioWorklet
16 kHz PCM16, concatenated deltas, and cancel/restore on Escape, thread
switch, archive, and unmount.

* feat(speech): package NeMo-Speech.cpp runtime per OS (#845)

* docs: record native Linux/Windows live STT CI PASS (#845)

Extract the unique feasibility verdict from worktree 3b4108 / #852.
Does not take speech-spike.yml (that would undo #861).

* fix(codex): first-party MCP tools auto-approve under exec never-policy (#846)

Extract unique leftover from worktree b73e11. codex exec pins
approval_policy=never and otherwise rejects MCP tools. Same scope as
Claude --allowedTools=mcp__<name>__*: only our servers.

---------

Co-authored-by: Willem <[email protected]>
@currentbits
currentbits deleted the coder/fork-execute-this-live-speech-to-text-de-1bbb82 branch October 3, 2026 16:07
currentbits added a commit that referenced this pull request Oct 19, 2026
Add electron/speech.js, wire it through registerIpc/makeCtx, and
construct it at boot with teardown plus media-permission gating.
Tests inject fetch, spawn, and WebSocket so the 700 MB GGUF is never
downloaded.

Co-authored-by: Willem <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant