feat(macos): local ASR model manager, menu-bar polish, and release 0.5.2

Adds a bundled local ASR model catalog for the macOS app with one-click
Sherpa Qwen3 / SenseVoice downloads (pause/resume, inline actions) and a
shared model storage directory used by MLX Qwen3. Fixes the light-mode
sidebar material and makes the menu-bar icon follow the system appearance
with a refreshed status mark. Renames the built product to OSGKeyboard.app.

Bumps version to 0.5.2 (build 19).
This commit is contained in:
Rocky
2026-07-09 08:55:37 +08:00
parent c2f07bd8d2
commit 200265fbd6
50 changed files with 4666 additions and 266 deletions
@@ -0,0 +1,56 @@
// LocalASRBiasDiagnosticsStore.swift
// OSGKeyboard · Shared
//
// Persists the most recent local ASR bias diagnostics for settings / debug UI.
import Foundation
public struct LocalASRBiasDiagnosticsSnapshot: Codable, Sendable, Equatable {
public var capturedAt: Date
public var modelId: String?
public var backendLabel: String?
public var diagnostics: LocalASRBiasDiagnostics
public var hotwordCount: Int
public var promptBiasLength: Int
public init(
capturedAt: Date = Date(),
modelId: String? = nil,
backendLabel: String? = nil,
diagnostics: LocalASRBiasDiagnostics,
hotwordCount: Int = 0,
promptBiasLength: Int = 0
) {
self.capturedAt = capturedAt
self.modelId = modelId
self.backendLabel = backendLabel
self.diagnostics = diagnostics
self.hotwordCount = hotwordCount
self.promptBiasLength = promptBiasLength
}
}
public enum LocalASRBiasDiagnosticsStore {
private static let defaultsKey = "mac.localASR.lastBiasDiagnostics"
public static func save(payload: LocalASRBiasPayload, modelId: String?, backendLabel: String?) {
let snapshot = LocalASRBiasDiagnosticsSnapshot(
modelId: modelId,
backendLabel: backendLabel,
diagnostics: payload.diagnostics,
hotwordCount: payload.hardHotwords.count,
promptBiasLength: payload.promptBias?.count ?? 0
)
guard let data = try? JSONEncoder().encode(snapshot) else { return }
UserDefaults.standard.set(data, forKey: defaultsKey)
}
public static func load() -> LocalASRBiasDiagnosticsSnapshot? {
guard let data = UserDefaults.standard.data(forKey: defaultsKey) else { return nil }
return try? JSONDecoder().decode(LocalASRBiasDiagnosticsSnapshot.self, from: data)
}
public static func clear() {
UserDefaults.standard.removeObject(forKey: defaultsKey)
}
}