Skip to content

SedaKit: add an in-process Swift API for macOS #7

Description

@pnegahdar

Outcome

A macOS app can add Seda through Swift Package Manager and transcribe microphone audio without starting a subprocess, opening a port, or speaking the HTTP protocol.

Public API

let seda = try await Seda.install(profile: .compact) { progress in
    modelProgress = progress
}

let microphone = try await seda.microphone(language: .english)

for await revision in microphone.transcripts {
    editor.replaceTranscript(revision.text, stable: revision.isFinal)
}

let final = try await microphone.stop()
await seda.close()

Architecture

  • Add a stable, versioned C ABI with opaque runtime and session handles over the Rust core.
  • Keep installation, model verification, inference, and session state in-process.
  • Wrap the C ABI with a concurrency-safe Swift API using actors and AsyncStream.
  • Capture through AVAudioEngine, convert to 16 kHz mono in Swift, and feed bounded chunks off the audio callback.
  • Package the native core as a checksum-pinned SedaNative.xcframework; expose source-level SedaKit through Swift Package Manager.
  • Do not expose C, JSON, runtime paths, localhost URLs, bearer tokens, or model download mechanics to normal Swift callers.

Acceptance criteria

  • macOS 14+ on Apple silicon
  • .compact, .balanced, and .quality profiles share the catalog used by CLI and Node
  • automatic, resumable, checksum-verified model install with progress
  • offline transcription and buffered/true streaming capability reporting
  • microphone permission, start, stop, cancel, interruption, and device-change handling
  • deterministic cleanup of audio taps, native sessions, model handles, and tasks
  • fixture integration tests exercise the complete Swift to C to Rust path
  • a real Parakeet model integration test runs in GitHub Actions
  • XCFramework provenance, checksums, licenses, and release automation
  • DocC and README examples begin with microphone capture

Deliberate boundary

This package owns local speech and microphone lifecycle. Global shortcuts, focused-app text insertion, and product UI remain opt-in app policy.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions