Skip to content

Phase 2.5: extract transcription-engine protocol seams - #48

Merged
initcore0 merged 1 commit into
mainfrom
feat/core-transcriptionengine
Jun 23, 2026
Merged

Phase 2.5: extract transcription-engine protocol seams#48
initcore0 merged 1 commit into
mainfrom
feat/core-transcriptionengine

Conversation

@initcore0

Copy link
Copy Markdown
Owner

Fifth platform extraction (after #44 #45 #46 #47). The two engines have genuinely different shapes — request/response vs. live streaming — so they get two focused protocols rather than one leaky abstraction.

Changes

  • FileTranscriptionEngine (request/response) — WhisperEngine conforms. transcribe + warmServer + stopServer + the four on… callbacks. A protocol extension supplies the deleteWhenDone = true default so the existing call site is unchanged (only the 7-arg overload matches it — verified unambiguous).
  • StreamingTranscriptionEngine (live) — AppleSpeechEngine conforms. start/stop + onPartial/onFinal/onError/onLevelChanged.
  • WhisperBackend moved to OpenWhispCore (so the protocol can name it); typealias Backend = WhisperBackend keeps the engine body and .cli/.serverAPI sites untouched.
  • AppState's whisperEngine/appleSpeechEngine are now the protocol types. AppleSpeechEngine's authorization statics and WhisperEngine.logFileURL() stay concrete — they return/encode platform specifics, so that's the correct boundary.
  • Adversarial review confirmed exact equivalence (overload resolution, Backend cases, stop(cancel:), statics, callback wiring).
  • Tests: +5 with Fake{File,Streaming}TranscriptionEngine doubles that unlock future AppState-orchestration tests. 112 → 117.
  • ROADMAP: both engines marked done under Phase 2.5.

swift test 117/117 · ./build.sh clean.

🤖 Generated with Claude Code

Fifth platform extraction (after SecretStore, LaunchAtLoginService, TextOutput,
HotkeyControlling). The two engines have genuinely different shapes, so they get
two focused protocols rather than one leaky abstraction:

- FileTranscriptionEngine (request/response): WhisperEngine conforms. transcribe
  + warmServer + stopServer + onTranscriptionComplete/Error/onProgress/
  onWorkerStatus. A protocol extension provides the deleteWhenDone=true default so
  the existing call site is unchanged (only the 7-arg overload matches it).
- StreamingTranscriptionEngine (live): AppleSpeechEngine conforms. start/stop +
  onPartial/onFinal/onError/onLevelChanged.
- WhisperEngine.Backend nested enum -> top-level WhisperBackend in OpenWhispCore
  (so the protocol can name it); kept `typealias Backend = WhisperBackend` so the
  engine body and .cli/.serverAPI sites are untouched.
- AppState's whisperEngine/appleSpeechEngine properties are now the protocol types.
  AppleSpeechEngine's authorization statics and WhisperEngine.logFileURL() stay on
  the concrete types (they return/encode platform specifics) — correct boundary.
- Adversarial review confirmed exact equivalence (overload resolution, Backend
  cases, stop(cancel:), statics, callback wiring).
- Tests: +5 with Fake{File,Streaming}TranscriptionEngine doubles that unlock
  future AppState-orchestration tests. 112 -> 117.
- ROADMAP: mark both engines done under Phase 2.5.

swift test 117/117; ./build.sh clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@initcore0
initcore0 merged commit 90ef0f9 into main Jun 23, 2026
3 checks passed
@initcore0
initcore0 deleted the feat/core-transcriptionengine branch June 23, 2026 20:28
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