Skip to content

feat(coding-agent): add Apple SpeechAnalyzer STT - #10019

Open
audreyt wants to merge 21 commits into
can1357:mainfrom
audreyt:feat/speech-analyzer-stt
Open

audreyt wants to merge 21 commits into
can1357:mainfrom
audreyt:feat/speech-analyzer-stt

Conversation

@audreyt

@audreyt audreyt commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

What

  • Add opt-in stt.modelName: macos using macOS 26 SpeechAnalyzer + SpeechTranscriber, including locale resolution, system-managed asset preparation, live partial/final results, final flushing, and bounded audio backpressure.
  • Keep Parakeet as the default and keep the native engine out of the ONNX/sherpa worker protocol.
  • Ship architecture-matched Swift sidecars in compiled Darwin binaries and npm packages, with a source-compile fallback for development installs. Darwin release jobs now run on macOS 26 so the API and packaged sidecar are exercised by the distribution smoke test.

Why

Use what we learned in StenoAI to add SpeechAnalyzer STT as a standalone, opt-in Darwin engine rather than another catalog/provider path. Apple manages the locale assets, so users selecting it do not download application-managed ASR weights.

Testing

  • vp run check — full TypeScript and Rust checks pass.
  • vp exec bun test test/apple-speech-client.test.ts test/stt-preflight.test.ts — 14 tests pass.
  • The same 14 tests pass with Bun 1.3.14, including early sidecar exit and preparation cancellation/termination regressions.
  • vp exec bun test scripts/ci-release-build-binaries.test.ts — 2 tests pass.
  • actionlint .github/workflows/ci.yml .github/workflows/bazel-cache-warm.yml passes.
  • Simulated a Mac without the macOS 26 SDK using an invalid DEVELOPER_DIR: both compiled-binary and npm-bundle builds complete, npm assets omit the optional sidecars, and the compiled CLI still passes --smoke-test through the source fallback.
  • Built a release-form Darwin arm64 binary and ran it with an isolated agent directory: --smoke-test reports smoke-test: ok.
  • Generated spoken audio locally and sent its 16 kHz mono Float32 samples through the production AppleSpeechClient; it returned Speech analyzer integration works. with 9 partial updates and one final segment.
  • bun pm pack --dry-run includes both dist/omp-speech-analyzer-arm64 and dist/omp-speech-analyzer-x64 when the macOS 26 SDK is available.

  • bun check passes
  • Tested locally
  • CHANGELOG updated (if user-facing)

@roboomp roboomp added agent Agent runtime planning and orchestration cli CLI commands and arguments feat review:p2 setup Installation and setup triaged ux User experience improvements labels Aug 28, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8bd5e70631

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/coding-agent/scripts/build-binary.ts Outdated
Comment thread packages/coding-agent/src/stt/downloader.ts Outdated

@roboomp roboomp left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 — coherent opt-in SpeechAnalyzer feature, but the new engine and Darwin release-pipeline expansion require an explicit maintainer call.
Blocking: a sidecar exit hangs stop() on supported Bun 1.3.14, and ensureSTTDependencies() drops its abort signal on Apple asset preparation.
Should-fix: document the new public STT client surface per repository convention.
Thanks for the thorough distribution work and end-to-end validation.

Comment thread packages/coding-agent/src/stt/apple-speech-client.ts Outdated
Comment thread packages/coding-agent/src/stt/downloader.ts Outdated
Comment thread packages/coding-agent/src/stt/apple-speech-client.ts
@audreyt
audreyt force-pushed the feat/speech-analyzer-stt branch from 8bd5e70 to 3f057be Compare August 28, 2026 02:19

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3f057be50f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/coding-agent/src/stt/apple-speech-client.ts Outdated
@audreyt
audreyt force-pushed the feat/speech-analyzer-stt branch from 3f057be to 99d9ae4 Compare August 28, 2026 02:35
audreyt added a commit to audreyt/oh-my-pi that referenced this pull request Aug 28, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 56801b0bee

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/coding-agent/scripts/build-binary.ts Outdated
@audreyt
audreyt force-pushed the feat/speech-analyzer-stt branch from 56801b0 to d096b97 Compare August 28, 2026 03:47
Copilot AI lite review requested due to automatic review settings September 3, 2026 09:49
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

There are a few concrete reliability/portability issues in new build/test code paths (notably a potentially hanging test helper and host/platform gating for sidecar builds) that should be addressed before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds an opt-in macOS-native Speech-to-Text engine to the coding-agent package by introducing an Apple SpeechAnalyzer/SpeechTranscriber sidecar, integrating it into STT preflight + streaming, and updating release packaging/CI so the sidecar is built and shipped correctly.

Changes:

  • Introduces a macOS 26+ “speech-analyzer” STT engine (Swift sidecar + TypeScript client) alongside existing worker-based STT models.
  • Updates STT dependency preflight + setup flows to handle locale-specific, system-managed Apple speech assets and to avoid sending Apple STT through the worker protocol.
  • Updates release/build scripts and CI workflows to build, embed, and publish the Apple sidecar artifacts; adds protocol + preflight tests.
File summaries
File Description
types/assets/index.d.ts Adds TS module typing for importing .swift sources as text.
scripts/ci-release-build-binaries.ts Builds compiled binaries; now attempts to build/embed Apple SpeechAnalyzer sidecar for Darwin targets.
packages/coding-agent/test/stt-preflight.test.ts Adds coverage for Apple locale-sensitive preflight and cancellation forwarding.
packages/coding-agent/test/apple-speech-client.test.ts New tests for the Apple sidecar protocol and SDK gating logic.
packages/coding-agent/src/stt/stt-controller.ts Integrates AppleSpeechClient into STT preflight + streaming start/stop flow.
packages/coding-agent/src/stt/speech-analyzer.swift New Swift sidecar implementing status/prepare/stream commands and JSONL protocol.
packages/coding-agent/src/stt/models.ts Extends STT registry with speech-analyzer engine + macos config key; separates worker-only keys/specs.
packages/coding-agent/src/stt/index.ts Exports Apple speech client from STT module barrel.
packages/coding-agent/src/stt/downloader.ts Adds Apple “prepare locale asset” dependency path; guards worker-only download APIs.
packages/coding-agent/src/stt/asr-worker.ts Updates worker model resolution to exclude SpeechAnalyzer engine.
packages/coding-agent/src/stt/apple-speech-compiler.ts Adds Swift toolchain probing + sidecar compilation/signing support.
packages/coding-agent/src/stt/apple-speech-client.ts New client for sidecar resolution/staging, status/prepare, and streaming with backpressure handling.
packages/coding-agent/src/config/settings-schema.ts Updates STT setting description to include Apple SpeechAnalyzer option.
packages/coding-agent/src/cli/setup-cli.ts Setup status/readiness/ensure paths now handle Apple locale assets vs downloaded worker models.
packages/coding-agent/src/cli.ts Adds smoke-test probe for packaged Apple sidecar on supported macOS hosts.
packages/coding-agent/scripts/compile-binary.ts Adds compiled-binary embed support via PI_APPLE_SPEECH_SIDECAR_BASE64.
packages/coding-agent/scripts/bundle-dist.ts Builds and retains optional sidecars in dist/ when toolchain is present; clears embed env in bundles.
packages/coding-agent/scripts/build-binary.ts Embeds Apple sidecar when building Darwin binaries on a compatible macOS/Xcode host.
packages/coding-agent/scripts/apple-speech-sidecar.ts New helper script to build sidecar binaries / base64 payload.
packages/coding-agent/package.json Ensures dist/omp-speech-analyzer-* files are included in published package.
packages/coding-agent/CHANGELOG.md Adds changelog entry for Apple SpeechAnalyzer STT on macOS 26+.
.github/workflows/ci.yml Moves Darwin release jobs to macOS 26 runners; uploads/downloads sidecar artifacts for npm publish.
.github/workflows/bazel-cache-warm.yml Updates macOS runner versions for cache warm jobs to macOS 26.
Review details

Suppressed comments (1)

packages/coding-agent/src/stt/apple-speech-client.ts:164

  • defaultExecutableResolver() caches the first resolution attempt forever, including failures. If the first attempt fails (missing SDK, temporary filesystem issue, etc.), later calls in the same process can never recover (and a late-set OMP_SPEECH_ANALYZER_PATH override would be ignored). Consider clearing the cached promise on rejection so a later attempt can succeed.
function defaultExecutableResolver(): Promise<string> {
	resolvedExecutable ??= resolveAppleSpeechExecutable();
	return resolvedExecutable;
}
  • Files reviewed: 22/23 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread scripts/ci-release-build-binaries.ts
Comment thread packages/coding-agent/test/apple-speech-client.test.ts Outdated
Comment thread packages/coding-agent/src/stt/apple-speech-client.ts Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

2 similar comments
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@audreyt
audreyt force-pushed the feat/speech-analyzer-stt branch from 2c686fa to fb1219c Compare September 3, 2026 15:26
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ea6e7e0435

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/coding-agent/src/stt/apple-speech-client.ts Outdated
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 5, 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-16T12:15:39.900585Z a12443a New commits
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 16c609fd0b

ℹ️ 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".

Comment thread packages/coding-agent/src/stt/stt-controller.ts Outdated
audreyt added a commit to audreyt/oh-my-pi that referenced this pull request Sep 5, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4c2e8049d5

ℹ️ 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".

Comment thread packages/coding-agent/src/stt/apple-speech-client.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8d16ca1fcb

ℹ️ 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".

Comment thread packages/coding-agent/CHANGELOG.md Outdated
@audreyt
audreyt force-pushed the feat/speech-analyzer-stt branch from 7f9ac5d to d72586d Compare September 16, 2026 11:50

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d72586d6c4

ℹ️ 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".

Comment thread packages/coding-agent/src/stt/apple-speech-client.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

const download = vi.spyOn(downloader, "downloadSttModel").mockReturnValue(new Promise<void>(() => {}));

P1 Badge Use Promise.withResolvers for pending test stubs

Replace this directly constructed never-settling promise with Promise.withResolvers<void>().promise; the same newly added pattern appears again at line 160. Direct new Promise(...) construction violates the repository's required promise convention.

AGENTS.md reference: AGENTS.md:L50-L50

ℹ️ 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".

Keep only this PR's Added line under Unreleased; drop stale branch
bullets that the merge unioned into released 18.1.7.
A stdout EOF that arrives before proc.exited settles no longer marks
the stream finished on timeout; the exit handler reports the eventual
outcome so a late failure cannot surface as a partial success. Adds a
late-fail fake sidecar mode and regression coverage.
Hosts without the SDK omit the optional embed instead of failing the
release, matching packages/coding-agent/scripts/build-binary.ts.
…imports

The STT client graph pulled the pi-utils barrel (eager dotenv plus
native addons) into CLI startup. Convert the client and its IPC,
atomic-file, and compiler dependencies to pi-utils subpath imports so
the smoke probe can stay a top-level import per project convention.
Preflight now uses a controller-lifetime AbortSignal so closing the
session cancels an in-flight SpeechAnalyzer prepare, and start
refuses capture if dispose wins the race. The per-stream abort
controller is unchanged.
MINIMUM_DARWIN_MAJOR is a kernel major, not a marketing version. Leave a
comment so it is not "corrected" to 26, which would disable the engine
on macOS 26.
…released sections

Collapse the two near-duplicate Unreleased bullets into one and drop merge-artifact additions to released sections.
@audreyt
audreyt force-pushed the feat/speech-analyzer-stt branch from a12443a to 178bd94 Compare September 18, 2026 10:44
# Conflicts:
#	packages/coding-agent/package.json
#	packages/coding-agent/src/cli/setup-cli.ts
#	packages/coding-agent/src/config/settings-schema.ts
#	packages/coding-agent/src/stt/downloader.ts
#	packages/coding-agent/src/stt/models.ts
#	packages/coding-agent/src/stt/stt-controller.ts
#	packages/coding-agent/test/stt-preflight.test.ts
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Agent runtime planning and orchestration cli CLI commands and arguments feat review:p2 setup Installation and setup triaged ux User experience improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants