Skip to content

Abstract BlurtEngine from AssemblyAI behind provider seams - #398

Merged
alexkroman merged 1 commit into
mainfrom
claude/gifted-euler-i2gjt3
Nov 25, 2026
Merged

alexkroman merged 1 commit into
mainfrom
claude/gifted-euler-i2gjt3

Conversation

@alexkroman

@alexkroman alexkroman commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

What & why

BlurtEngine no longer imports the AssemblyAI SDK. It reaches speech services only through provider protocols, so AssemblyAI works as a standalone SDK and another provider (Deepgram, say) can sit beside it.

  • AssemblyAI (the SDK, no Blurt code) takes over the generic API code that used to live in the engine:
    • DictationClient: the streamed dictation upload, the documented /v1/transcribe fallback past the live route's 120 s cap, the connection warm-up, latency logging and AssemblyAIError.
    • SpeechClient: streaming TTS.
    • GatewayChatClient: the LLM Gateway.
  • BlurtEngine exposes provider seams instead:
    • TranscriberProtocol (with TranscriberError): dictation.
    • SpeechSynthesizing: the read-aloud voice.
    • ChatCompleting, wrapped in GatewayConnection: every LLM client.
    • KeyValidation: the key check behind APIKeyModel.
    • LiveTurn: live recording.
    • KeyTermList: parsing the user's key terms.
    • SpeechServices bundles the read-aloud voice and the LLM.
  • BlurtAssemblyAI (new target) conforms the SDK to those seams and applies Blurt's policy:
    • AssemblyAITranscriber (prompt, key terms, cleanup instruction, rewrite mode, which transcript gets pasted).
    • SpeechServices.assemblyAI().
    • FileTranscriber.
    • The realtime glue.
    • The key check.
    • Sign in with AssemblyAI.

Both apps now link BlurtAssemblyAI, and the Mac project is regenerated for it. The invariant gate's file exemptions, ios-typecheck.sh, CI's iOS build step and the docs follow the moved files.

Rebased onto main after #392: the new and moved files follow its SwiftLint rules (one declaration per file, one argument per line once wrapped, SwiftLint's member order).

How it was tested

  • scripts/check.sh passes (or CI will, if I'm not on a Mac): --portable passes locally; the Swift build, tests and the macOS-only lint run on CI.
  • I read AGENTS.md and this doesn't reintroduce anything deliberately removed
  • Docs updated if behavior changed

Copy link
Copy Markdown
Collaborator Author

CI status at 10aed85: compile, lint and format-patch pass. In check, swift test passes all 1360 tests in 197 suites, and engine line coverage is 93.54% (floor 88%).

The one remaining failure is check's XcodeGen drift step: Blurt.xcodeproj/project.pbxproj is out of sync with project.yml. App/Blurt/project.yml now links the BlurtAssemblyAI product, and the committed pbxproj predates that. It was written in a sandbox without XcodeGen, and hand-editing the generated file was refused there. Fix: run xcodegen generate in App/Blurt and commit the result. The steps after the drift check (app build, UI tests, periphery) haven't run yet.


Generated by Claude Code

@alexkroman
alexkroman force-pushed the claude/gifted-euler-i2gjt3 branch from 6ae9a4f to 189de4e Compare November 25, 2026 13:30
@alexkroman
alexkroman marked this pull request as ready for review November 25, 2026 13:49
@alexkroman
alexkroman enabled auto-merge November 25, 2026 13:52
@alexkroman
alexkroman added this pull request to the merge queue Nov 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 25, 2026
@alexkroman
alexkroman added this pull request to the merge queue Nov 25, 2026
@alexkroman
alexkroman enabled auto-merge November 25, 2026 15:59
@alexkroman
alexkroman added this pull request to the merge queue Nov 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 25, 2026
@alexkroman
alexkroman enabled auto-merge November 25, 2026 17:36
@alexkroman
alexkroman force-pushed the claude/gifted-euler-i2gjt3 branch from b4b62d5 to 2f46f60 Compare November 25, 2026 18:52
@alexkroman
alexkroman added this pull request to the merge queue Nov 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 25, 2026
@alexkroman
alexkroman force-pushed the claude/gifted-euler-i2gjt3 branch from 2f46f60 to 33bf0c2 Compare November 25, 2026 19:36
@alexkroman
alexkroman enabled auto-merge November 25, 2026 19:36
@alexkroman
alexkroman force-pushed the claude/gifted-euler-i2gjt3 branch from 33bf0c2 to aca666b Compare November 25, 2026 20:06
@alexkroman
alexkroman added this pull request to the merge queue Nov 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 25, 2026
Splits the AssemblyAI integration into three library products so the SDK
can be used on its own and another provider can sit beside the engine:

- AssemblyAI: the pure SDK. DictationClient (streaming upload plus the
  413 /v1/transcribe fallback, warm-up and metrics), SpeechClient (TTS),
  GatewayChatClient (LLM Gateway), the realtime, async, OAuth and
  key-validation clients. No Blurt code.
- BlurtEngine: provider-neutral. TranscriberProtocol and
  TranscriberError, SpeechSynthesizing, ChatCompleting with ChatRequest
  and ChatReply, GatewayConnection and GatewayClient, KeyValidation,
  SpeechServices, LiveTurn and KeyTermList. Imports neither other module.
- BlurtAssemblyAI: the adapter that applies Blurt's policy to the SDK:
  AssemblyAITranscriber, AssemblyAISpeechSynthesizer, AssemblyAIChat,
  SpeechServices.assemblyAI(), FileTranscriber, the account and sign-in
  code, and UserAgent.

The Mac and iPhone apps import BlurtAssemblyAI where they compose the
provider, and BlurtEngine everywhere else; CI's ios-build builds the
BlurtAssemblyAI scheme beside BlurtEngine's. The split files follow the
all-opt-in SwiftLint rules from #392. Includes Alex's simplification of
the split (one key-term parser, one User-Agent stamp).

Also on the iPhone:
- Labels whose title can wrap use WrappingLabelStyle (BlurtDesign), so
  the consent sheet's disclosures, Settings' "How fast can you type?"
  and Home's return hint can't come out a line short at AX XXXL.
- The accessibility audit's default-size "Dynamic Type unsupported" is
  checked rather than taken on its word (ScalingCheck): it fails only if
  the same text is no taller at AX XXXL, ending the CI-only misreading of
  Settings' last rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1V4svBfswwXUrVzCKq
@alexkroman
alexkroman force-pushed the claude/gifted-euler-i2gjt3 branch from aca666b to 08fd609 Compare November 25, 2026 20:49
@alexkroman
alexkroman enabled auto-merge November 25, 2026 20:49
@alexkroman
alexkroman added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit f1466d0 Nov 25, 2026
22 checks passed
@alexkroman
alexkroman deleted the claude/gifted-euler-i2gjt3 branch November 25, 2026 21:40
alexkroman pushed a commit that referenced this pull request Nov 25, 2026
No content conflicts: #398 moved AssemblyAIAccount.swift into
BlurtAssemblyAI, and git carried this PR's comment at the early return
along with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1Vp9Andd7LBEDhGKeC
alexkroman pushed a commit that referenced this pull request Nov 25, 2026
#398 gave the iPhone audit pass a second result, the element a default-size
Dynamic Type finding is about, for its ScalingCheck. That pass and this PR's
timeout retry now live together in AccessibilityAuditTests+Pass.swift
(auditPass, renamed from +Timeout.swift): the merged pass in the suite's
body put it over SwiftLint's 250-line type budget.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1Vp9Andd7LBEDhGKeC
alexkroman pushed a commit that referenced this pull request Nov 25, 2026
One conflict, in DictationSession+Pipeline.swift: #398 renamed the
too-short check's error to the provider-neutral TranscriberError on the
line this PR made log against its own press. Kept both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1Vp9Andd7LBEDhGKeC
alexkroman pushed a commit that referenced this pull request Nov 25, 2026
One conflict, in check.yml's ios-build: #398 added a second library-only
simulator build, for BlurtAssemblyAI, beside the BlurtEngine one this PR
removed. The iPhone app links both products, so its build in the test step
compiles both (and the AssemblyAI SDK) for iOS; both separate builds go,
and the job's comment and AGENTS.md say why.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1Vp9Andd7LBEDhGKeC
alexkroman pushed a commit that referenced this pull request Nov 25, 2026
#398 made BlurtEngine provider-neutral: it imports neither the AssemblyAI
SDK nor BlurtAssemblyAI. This PR had put the shared cancellation rule in
the SDK and imported it into the engine's router, so:

- isCancellationShaped and isAbandonment move into BlurtEngine, as an
  internal extension (Error+Cancellation.swift). The router and the
  dictation pipeline, the PR's behaviour change, use them unchanged.
  Internal, so nothing that imports both modules (the tests,
  BlurtAssemblyAI) sees two definitions.
- The SDK states the one rule it needs in place: #398 moved the TTS
  request into SpeechClient, whose catch now reads a URLError.cancelled
  as a stop only when its task was cancelled, as this PR's synthesizer
  change did. AsyncTranscriptionClient and the SDK README are main's
  again: this PR never changed what it retries.
- ARCHITECTURE.md: main's text, with this PR's note that a dropped read
  fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1Vp9Andd7LBEDhGKeC
alexkroman pushed a commit that referenced this pull request Nov 25, 2026
#421 landed as a squash of the commits this branch was built on, so git
saw its RealtimeTranscriber, LiveTranscriptionSession and tests changed
twice. main's copies of those three files are exactly #421's, and this
branch's are #421's plus this PR's change, so they are kept from here;
a plain merge would have left two start() functions in the transcriber.
#398's import and TextReader lines come in unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1Vp9Andd7LBEDhGKeC
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.

2 participants