Skip to content

A small, open-source Mac dictation app that uses your ChatGPT sign-in. Speak into T3 Code, your editor, or any text field.

Add local transcription history and repair Accessibility checks

Vishesh Raheja002e987183cf
diff --git a/BUILD_NUMBER b/BUILD_NUMBER
index b8626c4..7ed6ff8 100644
--- a/BUILD_NUMBER
+++ b/BUILD_NUMBER
@@ -1 +1 @@
-4
+5
diff --git a/README.md b/README.md
index 3dd88ff..a84e027 100644
--- a/README.md
+++ b/README.md
@@ -41,7 +41,11 @@ Keyboard footage: [Designed by Magnific](https://www.magnific.com/). [All media
5. Grant microphone access. Grant Accessibility access for automatic paste, or choose manual paste.
6. Choose a shortcut and try the practice recording.
-**Mac download:** Pending Apple signing and notarization. [Build from source](#build-from-source) while the release is prepared.
+**Mac download:** [v0.1.4 — Apple Silicon and Intel](https://github.com/entropyconquers/gpt-voice/releases/download/v0.1.4/GPT-Voice-0.1.4-universal.dmg). This build uses a stable Apple Development signature. It is **not notarized by Apple**, so macOS may block it on first open.
+
+If macOS says Apple cannot check or verify the app, or the developer is unidentified, use **System Settings → Privacy & Security → Open Anyway** after you decide to trust the download. If macOS says the app **will damage your computer**, do not override that warning. [Report its exact text](https://github.com/entropyconquers/gpt-voice/issues).
+
+You can review the code and [build from source](#build-from-source) instead. Open source code does not replace Apple's malware checks. Microphone and Accessibility grants are separate from this verification warning.
## A small tool that stays out of the way
@@ -51,9 +55,9 @@ Keyboard footage: [Designed by Magnific](https://www.magnific.com/). [All media
- Onboarding with permission recovery and an in-app practice step.
- System, Light and Dark themes, seven accent colors and top or bottom pill placement.
- Optional sound cues and launch at login. Launch at login starts off.
-- Short result notices that fade away. No saved transcript history.
+- Short result notices that fade away. Local transcript history with copy and delete controls.
-The app keeps the last transcript in memory for recovery until you quit.
+History saves successful transcriptions on this Mac with their date, time, and known destination app. Copy any entry, delete one, or clear all.
Audio goes to ChatGPT for transcription. This is not an offline tool. [Read the privacy notes](docs/PRIVACY.md).
## Build from source
diff --git a/Sources/GPTVoice/AccessibilityCard.swift b/Sources/GPTVoice/AccessibilityCard.swift
index 5f05a46..f74b753 100644
--- a/Sources/GPTVoice/AccessibilityCard.swift
+++ b/Sources/GPTVoice/AccessibilityCard.swift
@@ -1,11 +1,17 @@
+import AppKit
import SwiftUI
/// Accessibility row for automatic paste. Optional, so it never uses a warning tone.
+/// While access is missing, a disclosure covers a grant that macOS no longer matches to this build.
struct AccessibilityCard: View {
@ObservedObject var model: AppModel
@ObservedObject var preferences: AppPreferences
var offersManualPaste = false
+ @State private var recoveryExpanded = false
+ @FocusState private var recoveryFocused: Bool
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+
init(model: AppModel, offersManualPaste: Bool = false) {
self.model = model
self.preferences = model.preferences
@@ -41,6 +47,10 @@ struct AccessibilityCard: View {
model.refreshStatus()
}
}
+ recovery
+ .padding(.leading, 26)
+ .padding(.top, -4)
+ .padding(.bottom, offersManualPaste ? 4 : 12)
if offersManualPaste {
Button("Skip and use manual paste") { model.setAutomaticPaste(false) }
.buttonStyle(AppButtonStyle(kind: .quiet, small: true))
@@ -50,4 +60,50 @@ struct AccessibilityCard: View {
}
}
}
+
+ /// Same look and semantics as `InfoDisclosure`, with one action inside.
+ private var recovery: some View {
+ VStack(alignment: .leading, spacing: 6) {
+ Button {
+ recoveryExpanded.toggle()
+ } label: {
+ HStack(spacing: 5) {
+ Image(systemName: "chevron.right")
+ .font(.system(size: 9, weight: .semibold))
+ .rotationEffect(.degrees(recoveryExpanded ? 90 : 0))
+ Text("Already turned on?").font(AppType.caption)
+ }
+ .foregroundStyle(.secondary)
+ .padding(.vertical, 3)
+ .contentShape(Rectangle())
+ }
+ .buttonStyle(.plain)
+ .focused($recoveryFocused)
+ .overlay(
+ RoundedRectangle(cornerRadius: 4, style: .continuous)
+ .strokeBorder(Color(nsColor: .keyboardFocusIndicatorColor), lineWidth: 2)
+ .padding(-3)
+ .opacity(recoveryFocused ? 1 : 0)
+ )
+ .accessibilityValue(recoveryExpanded ? "Expanded" : "Collapsed")
+
+ if recoveryExpanded {
+ VStack(alignment: .leading, spacing: 8) {
+ Text("After an update, macOS can keep an old entry that no longer matches this app. In System Settings, remove GPT Voice with −, add this app with +, then reopen GPT Voice.")
+ .font(AppType.detail)
+ .foregroundStyle(.secondary)
+ .lineSpacing(2)
+ .fixedSize(horizontal: false, vertical: true)
+ .frame(maxWidth: 520, alignment: .leading)
+ Button("Show this app") { model.revealAppInFinder() }
+ .buttonStyle(AppButtonStyle(kind: .quiet, small: true))
+ .accessibilityLabel("Show GPT Voice in Finder")
+ .padding(.leading, -10)
+ }
+ .padding(.leading, 14)
+ .transition(.opacity)
+ }
+ }
+ .animation(AppMotion.control(reduceMotion), value: recoveryExpanded)
+ }
}
diff --git a/Sources/GPTVoice/AccessibilityPermission.swift b/Sources/GPTVoice/AccessibilityPermission.swift
new file mode 100644
index 0000000..a30ece8
--- /dev/null
+++ b/Sources/GPTVoice/AccessibilityPermission.swift
@@ -0,0 +1,20 @@
+import AppKit
+import ApplicationServices
+
+enum AccessibilityPermission {
+ /// Checks a real, read-only AX request when the trust flag has not refreshed yet.
+ /// No text, window titles, or focused content is read.
+ static func check() -> Bool {
+ guard let finder = NSRunningApplication.runningApplications(withBundleIdentifier: "com.apple.finder").first else {
+ return AXIsProcessTrustedWithOptions(nil)
+ }
+ let application = AXUIElementCreateApplication(finder.processIdentifier)
+ AXUIElementSetMessagingTimeout(application, 0.2)
+ var role: CFTypeRef?
+ switch AXUIElementCopyAttributeValue(application, kAXRoleAttribute as CFString, &role) {
+ case .success: return true
+ case .apiDisabled: return false
+ default: return AXIsProcessTrustedWithOptions(nil)
+ }
+ }
+}
diff --git a/Sources/GPTVoice/AppDelegate.swift b/Sources/GPTVoice/AppDelegate.swift
index 9d52c41..e9e0303 100644
--- a/Sources/GPTVoice/AppDelegate.swift
+++ b/Sources/GPTVoice/AppDelegate.swift
@@ -64,12 +64,12 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
/// Waits for a pending clipboard restore so the old clipboard returns before quitting.
func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply {
- guard model.isPasteLeasePending else {
+ guard model.isPasteLeasePending || model.phase == .pasting || model.history.isUpdating else {
model.cleanup()
return .terminateNow
}
Task {
- await model.waitForPasteLease()
+ await model.waitForDeliveryAndHistory()
model.cleanup()
NSApp.reply(toApplicationShouldTerminate: true)
}
diff --git a/Sources/GPTVoice/AppModel.swift b/Sources/GPTVoice/AppModel.swift
index d13a84d..8ee3577 100644
--- a/Sources/GPTVoice/AppModel.swift
+++ b/Sources/GPTVoice/AppModel.swift
@@ -8,13 +8,14 @@ import ServiceManagement
@MainActor
final class AppModel: NSObject, ObservableObject {
let preferences: AppPreferences
+ let history: TranscriptionHistory
@Published private(set) var phase: DictationPhase = .idle
@Published private(set) var connection: ConnectionStatus = .checking
@Published private(set) var cliAvailable = CodexAuthentication.cliAvailable
@Published private(set) var authError: String?
@Published private(set) var microphone = PermissionStatus(AudioCapture.microphoneStatus)
- @Published private(set) var accessibilityTrusted = AXIsProcessTrusted()
+ @Published private(set) var accessibilityTrusted = AccessibilityPermission.check()
@Published private(set) var hotkeyError: String?
/// True when the last shortcut failed because a macOS shortcut, such as Spotlight, owns it.
@Published private(set) var hotkeyBlockedBySystem = false
@@ -45,10 +46,12 @@ final class AppModel: NSObject, ObservableObject {
static let installCodexURL = URL(string: "https://developers.openai.com/codex/cli/")!
init(preferences: AppPreferences? = nil, pasteboard: NSPasteboard? = nil,
+ history: TranscriptionHistory? = nil,
transcribeAudio: @escaping @Sendable (URL) async throws -> String = {
try await TranscriptionClient().transcribe(file: $0)
}) {
self.preferences = preferences ?? AppPreferences()
+ self.history = history ?? TranscriptionHistory()
self.transcribeAudio = transcribeAudio
audio = AudioCapture()
paste = PasteCoordinator(pasteboard: pasteboard ?? .general)
@@ -100,7 +103,7 @@ final class AppModel: NSObject, ObservableObject {
cliAvailable = CodexAuthentication.cliAvailable
if signInTask == nil { connection = ConnectionStatus.current() }
microphone = PermissionStatus(AudioCapture.microphoneStatus)
- accessibilityTrusted = AXIsProcessTrusted()
+ accessibilityTrusted = AccessibilityPermission.check()
launchAtLogin = LaunchAtLoginStatus.current()
recheckPermissionsAfterReturn()
}
@@ -114,7 +117,7 @@ final class AppModel: NSObject, ObservableObject {
do { try await Task.sleep(nanoseconds: delay) } catch { return }
guard let self, !Task.isCancelled else { return }
let microphone = PermissionStatus(AudioCapture.microphoneStatus)
- let accessibility = AXIsProcessTrusted()
+ let accessibility = AccessibilityPermission.check()
if self.microphone != microphone { self.microphone = microphone }
if self.accessibilityTrusted != accessibility { self.accessibilityTrusted = accessibility }
}
@@ -245,6 +248,11 @@ final class AppModel: NSObject, ObservableObject {
}
}
+ func copyTranscript(_ text: String) {
+ guard !paste.isLeasePending else { return }
+ paste.copy(text)
+ }
+
func copyLastTranscript() {
guard let lastTranscript else { return }
paste.copy(lastTranscript)
@@ -295,9 +303,19 @@ final class AppModel: NSObject, ObservableObject {
func waitForPasteLease() async { await paste.waitForLease() }
+ func waitForDeliveryAndHistory() async {
+ if phase == .pasting { await operation?.value }
+ await paste.waitForLease()
+ await history.waitForPendingChanges()
+ }
+
func openMicrophoneSettings() { SystemSettingsLink.microphone.open() }
func openAccessibilitySettings() { SystemSettingsLink.accessibility.open() }
+ func revealAppInFinder() {
+ NSWorkspace.shared.activateFileViewerSelecting([Bundle.main.bundleURL])
+ }
+
// MARK: Permissions
/// Asks for microphone access the first time. Opens System Settings after a denial.
@@ -318,7 +336,8 @@ final class AppModel: NSObject, ObservableObject {
/// Shows the macOS Accessibility prompt. The user grants access in System Settings.
func requestAccessibility() {
let key = kAXTrustedCheckOptionPrompt.takeUnretainedValue() as String
- accessibilityTrusted = AXIsProcessTrustedWithOptions([key: true] as CFDictionary)
+ _ = AXIsProcessTrustedWithOptions([key: true] as CFDictionary)
+ accessibilityTrusted = AccessibilityPermission.check()
}
// MARK: Sign-in
@@ -527,8 +546,10 @@ final class AppModel: NSObject, ObservableObject {
phase = .finished(.previewed)
return
}
+ let completedAt = Date()
phase = .pasting
let outcome = await paste.deliver(text: text, automaticPaste: preferences.automaticPaste)
+ await history.append(HistoryEntry(text: text, createdAt: completedAt, delivery: HistoryDelivery(outcome)))
operation = nil
if current == generation { phase = .finished(outcome) }
}
diff --git a/Sources/GPTVoice/CommandLineTool.swift b/Sources/GPTVoice/CommandLineTool.swift
index e33f715..d1e6ca2 100644
--- a/Sources/GPTVoice/CommandLineTool.swift
+++ b/Sources/GPTVoice/CommandLineTool.swift
@@ -15,7 +15,7 @@ enum CommandLineTool {
var result: [String: Any] = [
"appVersion": appVersion,
"microphone": microphoneName(AVCaptureDevice.authorizationStatus(for: .audio)),
- "accessibility": AXIsProcessTrusted(),
+ "accessibility": AccessibilityPermission.check(),
"codexCLIAvailable": CodexAuthentication.cliAvailable,
"bundledFonts": FontRegistration.fontAvailability
]
diff --git a/Sources/GPTVoice/HistoryClearView.swift b/Sources/GPTVoice/HistoryClearView.swift
new file mode 100644
index 0000000..b6af490
--- /dev/null
+++ b/Sources/GPTVoice/HistoryClearView.swift
@@ -0,0 +1,33 @@
+import SwiftUI
+
+/// Clear all, beside the History title. Shown only when there is something to clear. Asks first, with the count.
+struct HistoryClearView: View {
+ @ObservedObject var history: TranscriptionHistory
+ @State private var confirming = false
+ @State private var clearing = false
+
+ var body: some View {
+ if !history.entries.isEmpty {
+ Button("Clear all") { confirming = true }
+ .buttonStyle(AppButtonStyle(kind: .quiet, isLoading: clearing, small: true))
+ .disabled(clearing)
+ .confirmationDialog(title, isPresented: $confirming, titleVisibility: .visible) {
+ Button("Delete all", role: .destructive, action: clear)
+ Button("Cancel", role: .cancel) {}
+ }
+ }
+ }
+
+ private var title: String {
+ let count = history.entries.count
+ return count == 1 ? "Delete 1 transcript?" : "Delete all \(count) transcripts?"
+ }
+
+ private func clear() {
+ clearing = true
+ Task {
+ await history.clear()
+ clearing = false
+ }
+ }
+}
diff --git a/Sources/GPTVoice/HistoryDayView.swift b/Sources/GPTVoice/HistoryDayView.swift
new file mode 100644
index 0000000..3dbbda2
--- /dev/null
+++ b/Sources/GPTVoice/HistoryDayView.swift
@@ -0,0 +1,30 @@
+import SwiftUI
+
+/// One day of history: the date as the section heading, then that day's transcripts, newest first.
+struct HistoryDayView: View {
+ let day: Date
+ let entries: [HistoryEntry]
+ let canCopy: Bool
+ let copy: (HistoryEntry) -> Bool
+ let delete: (HistoryEntry) -> Void
+
+ var body: some View {
+ SettingsGroup(title: title) {
+ ForEach(entries) { entry in
+ HistoryEntryView(entry: entry, canCopy: canCopy,
+ copy: { copy(entry) }, delete: { delete(entry) })
+ if entry.id != entries.last?.id { RowDivider() }
+ }
+ }
+ }
+
+ private var title: String {
+ let calendar = Calendar.current
+ if calendar.isDateInToday(day) { return "Today" }
+ if calendar.isDateInYesterday(day) { return "Yesterday" }
+ if calendar.isDate(day, equalTo: Date(), toGranularity: .year) {
+ return day.formatted(.dateTime.weekday(.wide).month(.wide).day())
+ }
+ return day.formatted(.dateTime.month(.wide).day().year())
+ }
+}
diff --git a/Sources/GPTVoice/HistoryDelivery.swift b/Sources/GPTVoice/HistoryDelivery.swift
new file mode 100644
index 0000000..3f56e4b
--- /dev/null
+++ b/Sources/GPTVoice/HistoryDelivery.swift
@@ -0,0 +1,16 @@
+import Foundation
+
+enum HistoryDelivery: Codable, Equatable, Sendable {
+ /// The app sent paste keystrokes. The destination can still reject them.
+ case pasted(appName: String?)
+ case copied
+ case clipboardPreserved
+
+ init(_ outcome: PasteOutcome) {
+ switch outcome {
+ case .pasted(let name): self = .pasted(appName: name)
+ case .preservedNewerClipboard: self = .clipboardPreserved
+ case .copied, .previewed: self = .copied
+ }
+ }
+}
diff --git a/Sources/GPTVoice/HistoryDocument.swift b/Sources/GPTVoice/HistoryDocument.swift
new file mode 100644
index 0000000..e68017b
--- /dev/null
+++ b/Sources/GPTVoice/HistoryDocument.swift
@@ -0,0 +1,6 @@
+import Foundation
+
+struct HistoryDocument: Codable {
+ let version: Int
+ let entries: [HistoryEntry]
+}
diff --git a/Sources/GPTVoice/HistoryEntry.swift b/Sources/GPTVoice/HistoryEntry.swift
new file mode 100644
index 0000000..274ebb8
--- /dev/null
+++ b/Sources/GPTVoice/HistoryEntry.swift
@@ -0,0 +1,15 @@
+import Foundation
+
+struct HistoryEntry: Identifiable, Codable, Equatable, Sendable {
+ let id: UUID
+ let text: String
+ let createdAt: Date
+ let delivery: HistoryDelivery
+
+ init(id: UUID = UUID(), text: String, createdAt: Date = Date(), delivery: HistoryDelivery) {
+ self.id = id
+ self.text = text
+ self.createdAt = createdAt
+ self.delivery = delivery
+ }
+}
diff --git a/Sources/GPTVoice/HistoryEntryView.swift b/Sources/GPTVoice/HistoryEntryView.swift
new file mode 100644
index 0000000..7eab0a0
--- /dev/null
+++ b/Sources/GPTVoice/HistoryEntryView.swift
@@ -0,0 +1,120 @@
+import AppKit
+import SwiftUI
+
+/// One saved transcript: time and known destination, then the selectable text.
+/// Long text stops at four lines with Show more. Copy confirms with a brief check in place.
+struct HistoryEntryView: View {
+ let entry: HistoryEntry
+ let canCopy: Bool
+ /// Returns false when nothing was copied.
+ let copy: () -> Bool
+ let delete: () -> Void
+
+ @State private var expanded = false
+ @State private var fullHeight: CGFloat = 0
+ @State private var clampedHeight: CGFloat = 0
+ @State private var copied = false
+ @State private var resetCopied: Task<Void, Never>?
+ @FocusState private var toggleFocused: Bool
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+
+ private static let collapsedLines = 4
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 6) {
+ HStack(spacing: 8) {
+ Text(meta)
+ .font(AppType.caption)
+ .monospacedDigit()
+ .foregroundStyle(.secondary)
+ .lineLimit(1)
+ // Day headings say Today or Yesterday. The tooltip keeps the exact moment.
+ .help(entry.createdAt.formatted(date: .complete, time: .standard))
+ Spacer(minLength: 8)
+ HStack(spacing: 2) {
+ QuietIconButton(symbol: copied ? "checkmark" : "doc.on.doc",
+ label: copied ? "Copied" : "Copy transcript",
+ action: performCopy)
+ .disabled(!canCopy)
+ .opacity(canCopy ? 1 : 0.4)
+ .animation(AppMotion.control(reduceMotion), value: copied)
+ QuietIconButton(symbol: "trash", label: "Delete transcript", action: delete)
+ }
+ }
+
+ Text(entry.text)
+ .font(AppType.body)
+ .lineSpacing(3)
+ .lineLimit(expanded ? nil : Self.collapsedLines)
+ .textSelection(.enabled)
+ .fixedSize(horizontal: false, vertical: true)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .background(measure { if !expanded { clampedHeight = $0 } })
+ .background(alignment: .topLeading) {
+ // Unclamped copy at the same width, to know whether Show more is needed.
+ Text(entry.text)
+ .font(AppType.body)
+ .lineSpacing(3)
+ .fixedSize(horizontal: false, vertical: true)
+ .hidden()
+ .background(measure { fullHeight = $0 })
+ .accessibilityHidden(true)
+ }
+
+ if expanded || fullHeight > clampedHeight + 1 {
+ expandToggle
+ }
+ }
+ .padding(.top, 8)
+ .padding(.bottom, 12)
+ .animation(AppMotion.control(reduceMotion), value: expanded)
+ .onDisappear { resetCopied?.cancel() }
+ }
+
+ /// Time, plus the app only when paste keystrokes went to a known one. "Sent", because the app may not accept them.
+ private var meta: String {
+ let time = entry.createdAt.formatted(date: .omitted, time: .shortened)
+ if case .pasted(let appName?) = entry.delivery, !appName.isEmpty {
+ return "\(time) · Sent to \(appName)"
+ }
+ return time
+ }
+
+ private var expandToggle: some View {
+ Button(expanded ? "Show less" : "Show more") { expanded.toggle() }
+ .buttonStyle(.plain)
+ .font(AppType.caption)
+ .foregroundStyle(.secondary)
+ .padding(.vertical, 3)
+ .contentShape(Rectangle())
+ .focused($toggleFocused)
+ .overlay(
+ RoundedRectangle(cornerRadius: 4, style: .continuous)
+ .strokeBorder(Color(nsColor: .keyboardFocusIndicatorColor), lineWidth: 2)
+ .padding(-3)
+ .opacity(toggleFocused ? 1 : 0)
+ )
+ }
+
+ private func measure(_ update: @escaping (CGFloat) -> Void) -> some View {
+ GeometryReader { proxy in
+ Color.clear
+ .onAppear { update(proxy.size.height) }
+ .onChange(of: proxy.size.height) { update($0) }
+ }
+ }
+
+ private func performCopy() {
+ guard copy() else { return }
+ copied = true
+ NSAccessibility.post(element: NSApplication.shared, notification: .announcementRequested,
+ userInfo: [.announcement: "Copied",
+ .priority: NSAccessibilityPriorityLevel.high.rawValue])
+ resetCopied?.cancel()
+ resetCopied = Task { @MainActor in
+ try? await Task.sleep(nanoseconds: 1_500_000_000)
+ guard !Task.isCancelled else { return }
+ copied = false
+ }
+ }
+}
diff --git a/Sources/GPTVoice/HistoryPage.swift b/Sources/GPTVoice/HistoryPage.swift
new file mode 100644
index 0000000..d2bf802
--- /dev/null
+++ b/Sources/GPTVoice/HistoryPage.swift
@@ -0,0 +1,91 @@
+import SwiftUI
+
+/// History: saved transcripts grouped by day, newest first. Each can be copied or deleted.
+/// Clear all sits beside the page title. Works during dictation, except Copy while a paste holds the clipboard.
+struct HistoryPage: View {
+ @ObservedObject var model: AppModel
+ @ObservedObject var history: TranscriptionHistory
+ @State private var pendingDeletion: HistoryEntry?
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+
+ init(model: AppModel) {
+ self.model = model
+ self.history = model.history
+ }
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 24) {
+ if let message = history.errorMessage {
+ HStack(alignment: .firstTextBaseline, spacing: 12) {
+ ErrorMessage(text: message)
+ Spacer(minLength: 8)
+ Button("Try again") { Task { await history.retrySave() } }
+ .buttonStyle(AppButtonStyle(kind: .secondary, isLoading: history.isUpdating, small: true))
+ .disabled(history.isUpdating)
+ }
+ }
+
+ if history.isLoading {
+ HStack(spacing: 8) {
+ ActivityIndicator(size: 11)
+ Text("Loading").font(AppType.detail).foregroundStyle(.secondary)
+ }
+ } else if history.entries.isEmpty {
+ // After a read error the message above is the whole state, so no "empty" claim.
+ if history.errorMessage == nil { empty }
+ } else {
+ LazyVStack(alignment: .leading, spacing: 24) {
+ ForEach(days, id: \.day) { day in
+ HistoryDayView(day: day.day, entries: day.entries,
+ canCopy: !model.isPasteLeasePending,
+ copy: copy, delete: { pendingDeletion = $0 })
+ }
+ }
+ }
+ }
+ .animation(AppMotion.reveal(reduceMotion), value: history.entries)
+ .confirmationDialog("Delete this transcript?",
+ isPresented: Binding(get: { pendingDeletion != nil },
+ set: { if !$0 { pendingDeletion = nil } }),
+ titleVisibility: .visible,
+ presenting: pendingDeletion) { entry in
+ Button("Delete", role: .destructive) { Task { await history.remove(id: entry.id) } }
+ Button("Cancel", role: .cancel) {}
+ }
+ }
+
+ private var empty: some View {
+ SettingsGroup {
+ VStack(alignment: .leading, spacing: 4) {
+ Text("No transcripts yet").font(AppType.rowTitle)
+ Text("Dictate with \(model.preferences.hotkey.displayLabel). Each transcript is saved here, on this Mac.")
+ .font(AppType.detail)
+ .foregroundStyle(.secondary)
+ .fixedSize(horizontal: false, vertical: true)
+ }
+ .padding(.vertical, 16)
+ }
+ }
+
+ /// Entries arrive newest first, so each day is one contiguous run.
+ private var days: [(day: Date, entries: [HistoryEntry])] {
+ let calendar = Calendar.current
+ var result: [(day: Date, entries: [HistoryEntry])] = []
+ for entry in history.entries {
+ let day = calendar.startOfDay(for: entry.createdAt)
+ if result.last?.day == day {
+ result[result.count - 1].entries.append(entry)
+ } else {
+ result.append((day, [entry]))
+ }
+ }
+ return result
+ }
+
+ /// The model also refuses during a paste lease. Checking here keeps the check mark honest.
+ private func copy(_ entry: HistoryEntry) -> Bool {
+ guard !model.isPasteLeasePending else { return false }
+ model.copyTranscript(entry.text)
+ return true
+ }
+}
diff --git a/Sources/GPTVoice/HistoryRepository.swift b/Sources/GPTVoice/HistoryRepository.swift
new file mode 100644
index 0000000..c0b8f30
--- /dev/null
+++ b/Sources/GPTVoice/HistoryRepository.swift
@@ -0,0 +1,73 @@
+import Foundation
+
+/// Serial disk owner. A failed write keeps the latest data in memory for Retry.
+actor HistoryRepository {
+ enum Change: Sendable {
+ case load
+ case append(HistoryEntry)
+ case remove(UUID)
+ case clear
+ case retry
+ }
+
+ private let fileURL: URL
+ private var entries: [HistoryEntry] = []
+ private var loaded = false
+
+ init(fileURL: URL) { self.fileURL = fileURL }
+
+ func perform(_ change: Change) -> HistorySnapshot {
+ do {
+ if !loaded {
+ if FileManager.default.fileExists(atPath: fileURL.path) {
+ let document = try JSONDecoder().decode(HistoryDocument.self, from: Data(contentsOf: fileURL))
+ guard document.version == 1 else {
+ throw CocoaError(.fileReadCorruptFile)
+ }
+ entries = document.entries.sorted { $0.createdAt > $1.createdAt }
+ }
+ loaded = true
+ }
+ } catch {
+ return HistorySnapshot(entries: entries, errorMessage: "Could not read history. The saved file was kept. Try again.")
+ }
+ switch change {
+ case .load: return HistorySnapshot(entries: entries, errorMessage: nil)
+ case .append(let entry):
+ if !entries.contains(where: { $0.id == entry.id }) {
+ entries.append(entry)
+ entries.sort { $0.createdAt > $1.createdAt }
+ }
+ case .remove(let id): entries.removeAll { $0.id == id }
+ case .clear: entries.removeAll()
+ case .retry: break
+ }
+ do {
+ try save()
+ return HistorySnapshot(entries: entries, errorMessage: nil)
+ } catch {
+ return HistorySnapshot(entries: entries, errorMessage: "Changes are not saved yet. Keep GPT Voice open and try again.")
+ }
+ }
+
+ private func save() throws {
+ let manager = FileManager.default
+ let directory = fileURL.deletingLastPathComponent()
+ try manager.createDirectory(at: directory, withIntermediateDirectories: true,
+ attributes: [.posixPermissions: 0o700])
+ let data = try JSONEncoder().encode(HistoryDocument(version: 1, entries: entries))
+ // Set permissions before replacing the file, so no transcript is briefly world-readable.
+ let temporary = directory.appendingPathComponent(".history-\(UUID().uuidString).tmp")
+ defer { try? manager.removeItem(at: temporary) }
+ guard manager.createFile(atPath: temporary.path, contents: nil, attributes: [.posixPermissions: 0o600]) else {
+ throw CocoaError(.fileWriteNoPermission)
+ }
+ try data.write(to: temporary)
+ if manager.fileExists(atPath: fileURL.path) {
+ _ = try manager.replaceItemAt(fileURL, withItemAt: temporary)
+ } else {
+ try manager.moveItem(at: temporary, to: fileURL)
+ }
+ try manager.setAttributes([.posixPermissions: 0o600], ofItemAtPath: fileURL.path)
+ }
+}
diff --git a/Sources/GPTVoice/HistorySnapshot.swift b/Sources/GPTVoice/HistorySnapshot.swift
new file mode 100644
index 0000000..dbac435
--- /dev/null
+++ b/Sources/GPTVoice/HistorySnapshot.swift
@@ -0,0 +1,6 @@
+import Foundation
+
+struct HistorySnapshot: Sendable {
+ let entries: [HistoryEntry]
+ let errorMessage: String?
+}
diff --git a/Sources/GPTVoice/OnboardingWelcomeStep.swift b/Sources/GPTVoice/OnboardingWelcomeStep.swift
index c2b75bf..03c3ae3 100644
--- a/Sources/GPTVoice/OnboardingWelcomeStep.swift
+++ b/Sources/GPTVoice/OnboardingWelcomeStep.swift
@@ -34,7 +34,7 @@ struct OnboardingWelcomeStep: View {
.font(AppType.detail)
.foregroundStyle(.secondary)
InfoDisclosure(label: "Storage and account",
- text: "Recordings are temporary files. No transcript history is saved. Sign-in is shared with Codex CLI, and this app makes no copy of your credentials.")
+ text: "Recordings are temporary files. Transcripts are saved on this Mac, and you can remove them in History. Sign-in is shared with Codex CLI, and this app makes no copy of your credentials.")
}
}
}
diff --git a/Sources/GPTVoice/PasteCoordinator.swift b/Sources/GPTVoice/PasteCoordinator.swift
index 52e6996..81b2c66 100644
--- a/Sources/GPTVoice/PasteCoordinator.swift
+++ b/Sources/GPTVoice/PasteCoordinator.swift
@@ -64,7 +64,7 @@ final class PasteCoordinator {
let reason: PasteOutcome.ManualReason?
if !automaticPaste {
reason = .automaticPasteOff
- } else if !AXIsProcessTrusted() {
+ } else if !AccessibilityPermission.check() {
reason = .accessibilityMissing
} else if target == nil || snapshot == nil {
reason = .noTarget
diff --git a/Sources/GPTVoice/PasteTarget.swift b/Sources/GPTVoice/PasteTarget.swift
index 6df99e8..14a3533 100644
--- a/Sources/GPTVoice/PasteTarget.swift
+++ b/Sources/GPTVoice/PasteTarget.swift
@@ -14,7 +14,7 @@ struct PasteTarget {
app.processIdentifier != ProcessInfo.processInfo.processIdentifier else { return nil }
let pid = app.processIdentifier
let focus: (element: AXUIElement?, window: AXUIElement?) =
- AXIsProcessTrusted() ? focusedAttributes(of: pid) : (element: nil, window: nil)
+ AccessibilityPermission.check() ? focusedAttributes(of: pid) : (element: nil, window: nil)
return PasteTarget(processID: pid, appName: app.localizedName,
focusedElement: focus.element, focusedWindow: focus.window)
}
diff --git a/Sources/GPTVoice/PrivacyPage.swift b/Sources/GPTVoice/PrivacyPage.swift
index b3b1de2..9493f21 100644
--- a/Sources/GPTVoice/PrivacyPage.swift
+++ b/Sources/GPTVoice/PrivacyPage.swift
@@ -10,7 +10,7 @@ struct PrivacyPage: View {
fact("Audio", "Sent to ChatGPT for transcription.")
fact("Recordings", "Temporary files on this Mac.",
details: "Deleted after a successful transcription or Cancel. A failed recording is kept for Retry until you quit.")
- fact("Transcripts", "Not saved. The last one stays in memory until you quit.")
+ fact("Transcripts", "Saved on this Mac. Delete any or all in History.")
fact("Sign-in", "Shared with Codex CLI.",
details: "Credentials stay in Codex CLI storage. This app makes no copy. To sign out, run “codex logout” in Terminal. This also signs out Codex CLI.",
last: true)
diff --git a/Sources/GPTVoice/SettingsPage.swift b/Sources/GPTVoice/SettingsPage.swift
index 3875460..8cf994d 100644
--- a/Sources/GPTVoice/SettingsPage.swift
+++ b/Sources/GPTVoice/SettingsPage.swift
@@ -2,6 +2,7 @@ import Foundation
enum SettingsPage: String, CaseIterable, Identifiable {
case home
+ case history
case shortcuts
case appearance
case preferences
@@ -12,6 +13,7 @@ enum SettingsPage: String, CaseIterable, Identifiable {
var title: String {
switch self {
case .home: return "Home"
+ case .history: return "History"
case .shortcuts: return "Shortcut"
case .appearance: return "Appearance"
case .preferences: return "Preferences"
@@ -22,6 +24,7 @@ enum SettingsPage: String, CaseIterable, Identifiable {
var symbol: String {
switch self {
case .home: return "house"
+ case .history: return "clock.arrow.circlepath"
case .shortcuts: return "command"
case .appearance: return "circle.lefthalf.filled"
case .preferences: return "slider.horizontal.3"
@@ -33,7 +36,7 @@ enum SettingsPage: String, CaseIterable, Identifiable {
var intro: String? {
switch self {
case .shortcuts: return "Press it once to start dictation. Press it again to stop."
- case .home, .appearance, .preferences, .privacy: return nil
+ case .home, .history, .appearance, .preferences, .privacy: return nil
}
}
}
diff --git a/Sources/GPTVoice/SettingsView.swift b/Sources/GPTVoice/SettingsView.swift
index 1c3ee36..907c428 100644
--- a/Sources/GPTVoice/SettingsView.swift
+++ b/Sources/GPTVoice/SettingsView.swift
@@ -19,8 +19,14 @@ struct SettingsView: View {
ZStack(alignment: .top) {
ScrollView {
VStack(alignment: .leading, spacing: 24) {
- PageHeader(title: page.title, intro: page.intro)
- if !model.canChangeSettings, page != .appearance {
+ HStack(alignment: .firstTextBaseline, spacing: 12) {
+ PageHeader(title: page.title, intro: page.intro)
+ if page == .history {
+ HistoryClearView(history: model.history)
+ }
+ }
+ // History stays usable during dictation, so it does not show the lock.
+ if !model.canChangeSettings, page != .appearance, page != .history {
SettingsLockBanner()
}
content
@@ -55,6 +61,7 @@ struct SettingsView: View {
@ViewBuilder private var content: some View {
switch page {
case .home: HomePage(model: model) { page = $0 }
+ case .history: HistoryPage(model: model)
case .shortcuts: ShortcutPanel(model: model)
case .appearance: AppearanceSection(preferences: preferences)
case .preferences: BehaviorSection(model: model)
diff --git a/Sources/GPTVoice/TranscriptionHistory.swift b/Sources/GPTVoice/TranscriptionHistory.swift
new file mode 100644
index 0000000..d15c3a8
--- /dev/null
+++ b/Sources/GPTVoice/TranscriptionHistory.swift
@@ -0,0 +1,47 @@
+import Foundation
+
+@MainActor
+final class TranscriptionHistory: ObservableObject {
+ @Published private(set) var entries: [HistoryEntry] = []
+ @Published private(set) var isLoading = true
+ @Published private(set) var isUpdating = false
+ @Published private(set) var errorMessage: String?
+ private let repository: HistoryRepository
+ private var pending: Task<Void, Never>?
+ private var queuedChanges = 0
+
+ static var defaultFileURL: URL {
+ FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask)[0]
+ .appendingPathComponent("GPT Voice", isDirectory: true)
+ .appendingPathComponent("history.json")
+ }
+
+ init(fileURL: URL? = nil) {
+ repository = HistoryRepository(fileURL: fileURL ?? Self.defaultFileURL)
+ enqueue(.load)
+ }
+
+ func append(_ entry: HistoryEntry) async { await enqueue(.append(entry)).value }
+ func remove(id: UUID) async { await enqueue(.remove(id)).value }
+ func clear() async { await enqueue(.clear).value }
+ func retrySave() async { await enqueue(.retry).value }
+ func waitForPendingChanges() async { await pending?.value }
+
+ @discardableResult
+ private func enqueue(_ change: HistoryRepository.Change) -> Task<Void, Never> {
+ let previous = pending
+ queuedChanges += 1
+ isUpdating = true
+ let task = Task {
+ await previous?.value
+ let snapshot = await repository.perform(change)
+ entries = snapshot.entries
+ errorMessage = snapshot.errorMessage
+ isLoading = false
+ queuedChanges -= 1
+ isUpdating = queuedChanges != 0
+ }
+ pending = task
+ return task
+ }
+}
diff --git a/Sources/GPTVoice/VerificationTrace.swift b/Sources/GPTVoice/VerificationTrace.swift
index e3d4a99..39ff09e 100644
--- a/Sources/GPTVoice/VerificationTrace.swift
+++ b/Sources/GPTVoice/VerificationTrace.swift
@@ -12,7 +12,7 @@ final class VerificationTrace {
Self.write([
"event": "start",
"targetBundleID": NSWorkspace.shared.frontmostApplication?.bundleIdentifier ?? "unknown",
- "accessibility": AXIsProcessTrusted()
+ "accessibility": AccessibilityPermission.check()
])
observer = model.$phase.sink { phase in
var fields: [String: Any] = ["event": "phase", "status": phase.statusText]
diff --git a/Tests/DictationAppTests/NoSpeechTests.swift b/Tests/DictationAppTests/NoSpeechTests.swift
index 4eaccd5..b3c19ca 100644
--- a/Tests/DictationAppTests/NoSpeechTests.swift
+++ b/Tests/DictationAppTests/NoSpeechTests.swift
@@ -11,7 +11,7 @@ final class NoSpeechTests: XCTestCase {
let defaults = UserDefaults(suiteName: suite)!
let clipboard = NSPasteboard.withUniqueName()
clipboard.setString("Keep my clipboard", forType: .string)
- let model = AppModel(preferences: AppPreferences(defaults: defaults), pasteboard: clipboard) { _ in
+ let model = AppModel(preferences: AppPreferences(defaults: defaults), pasteboard: clipboard, history: TranscriptionHistory(fileURL: FileManager.default.temporaryDirectory.appendingPathComponent("gpt-voice-test-\(UUID().uuidString)/history.json"))) { _ in
throw DictationError.emptyTranscript
}
defer {
diff --git a/Tests/DictationAppTests/OverlayLifecycleTests.swift b/Tests/DictationAppTests/OverlayLifecycleTests.swift
index 1aecfaf..19d529d 100644
--- a/Tests/DictationAppTests/OverlayLifecycleTests.swift
+++ b/Tests/DictationAppTests/OverlayLifecycleTests.swift
@@ -152,7 +152,7 @@ final class OverlayLifecycleTests: XCTestCase {
FontRegistration.registerBundledFonts()
defaults = UserDefaults(suiteName: suite)!
clipboard = NSPasteboard.withUniqueName()
- model = AppModel(preferences: AppPreferences(defaults: defaults), pasteboard: clipboard) { _ in
+ model = AppModel(preferences: AppPreferences(defaults: defaults), pasteboard: clipboard, history: TranscriptionHistory(fileURL: FileManager.default.temporaryDirectory.appendingPathComponent("gpt-voice-test-\(UUID().uuidString)/history.json"))) { _ in
"Overlay test text"
}
let timing = OverlayTiming(resize: resize, entrance: 0.02, exit: 0.2, reducedFade: 0.1,
diff --git a/Tests/DictationAppTests/PracticeDictationTests.swift b/Tests/DictationAppTests/PracticeDictationTests.swift
index 657a726..047ede5 100644
--- a/Tests/DictationAppTests/PracticeDictationTests.swift
+++ b/Tests/DictationAppTests/PracticeDictationTests.swift
@@ -11,7 +11,7 @@ final class PracticeDictationTests: XCTestCase {
preferences.automaticPaste = true
let clipboard = NSPasteboard.withUniqueName()
clipboard.setString("Keep my clipboard", forType: .string)
- let model = AppModel(preferences: preferences, pasteboard: clipboard) { _ in "A clear thought." }
+ let model = AppModel(preferences: preferences, pasteboard: clipboard, history: TranscriptionHistory(fileURL: FileManager.default.temporaryDirectory.appendingPathComponent("gpt-voice-test-\(UUID().uuidString)/history.json"))) { _ in "A clear thought." }
defer { model.cleanup(); clipboard.releaseGlobally() }
let finished = expectation(description: "Practice result is visible")
let observer = model.$phase.sink { phase in
@@ -34,7 +34,7 @@ final class PracticeDictationTests: XCTestCase {
clipboard.setString("Keep my clipboard", forType: .string)
let started = expectation(description: "Transcription started")
let returned = expectation(description: "Cancelled provider returned")
- let model = AppModel(preferences: preferences, pasteboard: clipboard) { _ in
+ let model = AppModel(preferences: preferences, pasteboard: clipboard, history: TranscriptionHistory(fileURL: FileManager.default.temporaryDirectory.appendingPathComponent("gpt-voice-test-\(UUID().uuidString)/history.json"))) { _ in
started.fulfill()
try? await Task.sleep(nanoseconds: 1_000_000_000)
returned.fulfill()
@@ -60,7 +60,7 @@ final class PracticeDictationTests: XCTestCase {
let clipboard = NSPasteboard.withUniqueName()
clipboard.setString("Keep my clipboard", forType: .string)
let attempts = AttemptCounter()
- let model = AppModel(preferences: preferences, pasteboard: clipboard) { _ in
+ let model = AppModel(preferences: preferences, pasteboard: clipboard, history: TranscriptionHistory(fileURL: FileManager.default.temporaryDirectory.appendingPathComponent("gpt-voice-test-\(UUID().uuidString)/history.json"))) { _ in
if await attempts.next() == 1 { throw URLError(.timedOut) }
return "Second try"
}
diff --git a/Tests/DictationAppTests/ShortcutReceiptTests.swift b/Tests/DictationAppTests/ShortcutReceiptTests.swift
index 7038bb7..e777497 100644
--- a/Tests/DictationAppTests/ShortcutReceiptTests.swift
+++ b/Tests/DictationAppTests/ShortcutReceiptTests.swift
@@ -11,7 +11,7 @@ final class ShortcutReceiptTests: XCTestCase {
let preferences = AppPreferences(defaults: defaults)
let clipboard = NSPasteboard.withUniqueName()
clipboard.setString("Keep my clipboard", forType: .string)
- let model = AppModel(preferences: preferences, pasteboard: clipboard)
+ let model = AppModel(preferences: preferences, pasteboard: clipboard, history: TranscriptionHistory(fileURL: FileManager.default.temporaryDirectory.appendingPathComponent("gpt-voice-test-\(UUID().uuidString)/history.json")))
defer { model.cleanup(); clipboard.releaseGlobally() }
model.activate()
guard model.hotkeyError == nil else {
diff --git a/Tests/DictationAppTests/TranscriptionHistoryTests.swift b/Tests/DictationAppTests/TranscriptionHistoryTests.swift
new file mode 100644
index 0000000..9cf1dbb
--- /dev/null
+++ b/Tests/DictationAppTests/TranscriptionHistoryTests.swift
@@ -0,0 +1,113 @@
+import AppKit
+import DictationCore
+import XCTest
+@testable import GPTVoice
+
+final class TranscriptionHistoryTests: XCTestCase {
+ @MainActor
+ func testRestoresExactTextDatesDestinationsAndDeletions() async throws {
+ let directory = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString)
+ defer { try? FileManager.default.removeItem(at: directory) }
+ let url = directory.appendingPathComponent("history.json")
+ let older = HistoryEntry(text: "Use URLSession, then await the retry.\nKeep the newline.",
+ createdAt: Date(timeIntervalSince1970: 1_000), delivery: .pasted(appName: "T3 Code"))
+ let newer = HistoryEntry(text: "A copied thought.", createdAt: Date(timeIntervalSince1970: 2_000), delivery: .copied)
+ let history = TranscriptionHistory(fileURL: url)
+ await history.append(older)
+ await history.append(newer)
+ await history.append(newer)
+ XCTAssertNil(history.errorMessage)
+ XCTAssertEqual(history.entries, [newer, older])
+ let restored = TranscriptionHistory(fileURL: url)
+ await restored.waitForPendingChanges()
+ XCTAssertEqual(restored.entries, [newer, older])
+ await restored.remove(id: newer.id)
+ let afterDelete = TranscriptionHistory(fileURL: url)
+ await afterDelete.waitForPendingChanges()
+ XCTAssertEqual(afterDelete.entries, [older])
+ await afterDelete.clear()
+ let afterClear = TranscriptionHistory(fileURL: url)
+ await afterClear.waitForPendingChanges()
+ XCTAssertTrue(afterClear.entries.isEmpty)
+ let attributes = try FileManager.default.attributesOfItem(atPath: url.path)
+ XCTAssertEqual((attributes[.posixPermissions] as? NSNumber)?.intValue, 0o600)
+ }
+
+ @MainActor
+ func testUnreadableHistoryIsNotOverwritten() async throws {
+ let directory = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString)
+ defer { try? FileManager.default.removeItem(at: directory) }
+ try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)
+ let url = directory.appendingPathComponent("history.json")
+ let original = Data("not a valid history document".utf8)
+ try original.write(to: url)
+ let history = TranscriptionHistory(fileURL: url)
+ await history.waitForPendingChanges()
+ XCTAssertNotNil(history.errorMessage)
+ await history.append(HistoryEntry(text: "Keep the original file.", delivery: .copied))
+ await history.clear()
+ XCTAssertEqual(try Data(contentsOf: url), original)
+ XCTAssertNotNil(history.errorMessage)
+ }
+
+ @MainActor
+ func testFailedWriteCanBeRetriedWithoutLosingTheEntry() async throws {
+ let directory = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString)
+ defer { try? FileManager.default.removeItem(at: directory) }
+ try Data().write(to: directory)
+ let url = directory.appendingPathComponent("history.json")
+ let history = TranscriptionHistory(fileURL: url)
+ let entry = HistoryEntry(text: "Retry this save.", delivery: .clipboardPreserved)
+ await history.append(entry)
+ XCTAssertEqual(history.entries, [entry])
+ XCTAssertNotNil(history.errorMessage)
+ try FileManager.default.removeItem(at: directory)
+ await history.retrySave()
+ XCTAssertNil(history.errorMessage)
+ let restored = TranscriptionHistory(fileURL: url)
+ await restored.waitForPendingChanges()
+ XCTAssertEqual(restored.entries, [entry])
+ }
+
+ @MainActor
+ func testActualTranscriptionsAreSavedOnceButPracticeAndNoSpeechAreNot() async throws {
+ _ = NSApplication.shared
+ let directory = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString)
+ defer { try? FileManager.default.removeItem(at: directory) }
+ let history = TranscriptionHistory(fileURL: directory.appendingPathComponent("history.json"))
+ let suite = "history-flow-\(UUID().uuidString)"
+ let defaults = UserDefaults(suiteName: suite)!
+ defer { defaults.removePersistentDomain(forName: suite) }
+ let preferences = AppPreferences(defaults: defaults)
+ preferences.automaticPaste = false
+ let clipboard = NSPasteboard.withUniqueName()
+ defer { clipboard.releaseGlobally() }
+ let model = AppModel(preferences: preferences, pasteboard: clipboard, history: history) { url in
+ if url.lastPathComponent == "empty.wav" { throw DictationError.emptyTranscript }
+ return "Make the webhook handler idempotent."
+ }
+ defer { model.cleanup() }
+ model.transcribeFile(URL(fileURLWithPath: "/practice.wav"), forPractice: true)
+ try await waitUntil { model.phase == .finished(.previewed) }
+ await history.waitForPendingChanges()
+ XCTAssertTrue(history.entries.isEmpty)
+ model.transcribeFile(URL(fileURLWithPath: "/actual.wav"))
+ try await waitUntil { model.phase == .finished(.copied(.automaticPasteOff)) }
+ XCTAssertEqual(history.entries.count, 1)
+ XCTAssertEqual(history.entries.first?.delivery, .copied)
+ model.copyLastTranscript()
+ model.copyTranscript(history.entries[0].text)
+ XCTAssertEqual(clipboard.string(forType: .string), history.entries[0].text)
+ XCTAssertEqual(history.entries.count, 1)
+ model.transcribeFile(URL(fileURLWithPath: "/empty.wav"))
+ try await waitUntil { if case .failed = model.phase { return true }; return false }
+ XCTAssertEqual(history.entries.count, 1)
+ }
+
+ @MainActor
+ private func waitUntil(_ condition: () -> Bool) async throws {
+ let limit = Date().addingTimeInterval(3)
+ while !condition(), Date() < limit { try await Task.sleep(nanoseconds: 10_000_000) }
+ XCTAssertTrue(condition())
+ }
+}
diff --git a/VERSION b/VERSION
index b1e80bb..845639e 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.3
+0.1.4
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index 454836d..aeb6f29 100644
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@ -25,3 +25,11 @@ The project does not guarantee access on every plan or for every account.
The recording pill uses short fades and animated width changes.
Reduce Motion removes the blur and resize motion.
Result notices disappear automatically. Recovery actions stay in the menu bar.
+
+## Local history
+
+`TranscriptionHistory` publishes saved transcripts to the History page. It serializes commands and delegates file access to `HistoryRepository`.
+The repository writes a versioned JSON document through a private temporary file and an atomic replacement.
+Entries contain the exact text, completion time, and delivery result. They do not contain audio, window titles, document paths, or account data.
+Normal dictation saves once after delivery. Practice, errors, and cancellation before a result do not create entries. Copying an old result does not duplicate it.
+The app waits for pending delivery and history writes before normal quit.
diff --git a/docs/PRIVACY.md b/docs/PRIVACY.md
index d5e6d2c..4f1f1fa 100644
--- a/docs/PRIVACY.md
+++ b/docs/PRIVACY.md
@@ -9,13 +9,18 @@ It does not run an offline speech model.
| Audio | A private temporary folder on your Mac, then ChatGPT for transcription |
| ChatGPT session | The existing Codex CLI configuration on your Mac |
| Transcript | The selected text field, or your clipboard for manual paste |
-| Last transcript | App memory until you quit |
+| Transcript history | `~/Library/Application Support/GPT Voice/history.json` on your Mac |
| Preferences | macOS preferences on your Mac |
The app removes owned audio files after successful transcription, cancellation, and normal cleanup.
A failed request can keep its audio for Retry until another recording starts or the app quits.
A crash can leave temporary files until macOS removes them.
-The app does not save transcript history.
+Successful transcriptions are saved on this Mac with their date, time, and delivery result.
+When paste keystrokes are sent to a known app, history includes its name. The app cannot confirm whether that app accepted the text.
+Practice transcriptions, failed requests, and cancelled recordings are not saved.
+Use **History** to copy a transcript, delete one entry, or clear all entries.
+History is not uploaded by GPT Voice. The file is readable only by your macOS user account.
+Normal Mac backups can include this file. Audio is not kept in history.
ChatGPT's handling of uploaded audio is subject to your account settings and OpenAI's policies.
Microphone access permits recording after you start dictation.
diff --git a/docs/RELEASING.md b/docs/RELEASING.md
index e34c23b..cd7acb4 100644
--- a/docs/RELEASING.md
+++ b/docs/RELEASING.md
@@ -1,6 +1,7 @@
# Releasing GPT Voice
-A public direct-download release uses **Developer ID Application** signing and Apple notarization.
+A notarized direct-download release uses **Developer ID Application** signing and Apple notarization.
+See the unnotarized release section below for the disclosed v0.1.4 exception.
An App Store Connect app record, TestFlight build and App Store listing are not required.
## Build
@@ -38,6 +39,8 @@ python3 -m venv .local/release-tools
The script requires a valid Developer ID signature, a stapled ticket and a passing Gatekeeper assessment.
It creates the themed Finder disk image with an Applications link.
+It mounts the result and checks every architecture signature and executable before marking the package ready.
+Do not add Finder metadata to the app after signing. In particular, hiding its filename extension can invalidate strict signature checks.
`--preview` permits an explicitly unnotarized local preview. It does not mark the result as verified.
Sign the DMG with Developer ID, submit it for notarization, and staple the accepted ticket.
@@ -63,3 +66,13 @@ Attach `GPT-Voice.dmg`, an app ZIP, checksums, release notes and the promo MP4 t
The website's download link must point to the uploaded release asset.
Update the README, website and launch drafts to the same version and verified release status.
Keep signing keys, credentials and local capture logs out of Git.
+
+## Explicitly disclosed unnotarized releases
+
+The v0.1.4 public download is authorized as an unnotarized build while Developer ID access is unavailable.
+It has a valid, stable Apple Development signature. It is not a notarized or Gatekeeper-approved release.
+
+Use `scripts/package-dmg.py --unnotarized` only when the website, README, and release notes state this limit.
+This mode requires a certificate signature and records `notarized_app_verified: false` in the packaging report.
+Do not label it verified or advise users to disable Gatekeeper.
+The normal packaging mode continues to require Developer ID signing, a stapled ticket, and Gatekeeper acceptance.
diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md
index d8662b2..ff4f2e5 100644
--- a/docs/TROUBLESHOOTING.md
+++ b/docs/TROUBLESHOOTING.md
@@ -24,10 +24,12 @@ If macOS did not yet list the app, select **Allow** inside GPT Voice to request
Accessibility is optional. Choose manual paste to copy text and paste it with Command–V.
For automatic paste, enable GPT Voice in **System Settings → Privacy & Security → Accessibility**.
Return to the app, or select its refresh button.
+The status check also tries a read-only Accessibility request if macOS has not refreshed its trust flag.
A local rebuild can change an ad hoc signature. macOS can keep an old switch on while rejecting the new build.
In that case, remove the old GPT Voice entry from Accessibility and add the current app again.
Quit and reopen the app after macOS applies the change.
+For repeated local builds, use the same valid signing certificate. An ad hoc signature changes with the executable.
Do not reset all privacy permissions or disable macOS protections.
Paste can fall back to copy if the destination app, focus, or clipboard changes during a recording.
@@ -60,3 +62,13 @@ Report the release version, macOS version, processor type and exact message with
Review the output before sharing it. It does not print account credentials.
A command launched from a terminal can have a different macOS privacy context from a Finder-launched app.
Check permission behavior in the actual installed app as well.
+
+## History
+
+Successful transcriptions appear in **Settings → History**, newest first.
+Copy an entry, delete one entry, or use **Clear all**. Deletion requires confirmation.
+The app saves local dates and times. It shows the destination name when paste keystrokes were sent to a known app.
+A manual paste cannot be tracked.
+
+If History reports a save error, keep GPT Voice open and select **Try again**.
+An unreadable history file is kept intact. GPT Voice does not replace it with an empty history.
diff --git a/scripts/package-dmg.py b/scripts/package-dmg.py
index 27555a7..ce337ea 100755
--- a/scripts/package-dmg.py
+++ b/scripts/package-dmg.py
@@ -16,7 +16,9 @@ def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--app', type=Path, default=Path('dist/GPT Voice.app'))
parser.add_argument('--output', type=Path, default=Path('dist/GPT-Voice.dmg'))
- parser.add_argument('--preview', action='store_true', help='Allow an unnotarized preview. Never marks it verified.')
+ mode = parser.add_mutually_exclusive_group()
+ mode.add_argument('--preview', action='store_true', help='Allow an unnotarized local preview.')
+ mode.add_argument('--unnotarized', action='store_true', help='Package an explicitly disclosed, certificate-signed unnotarized release.')
args = parser.parse_args()
app = args.app.resolve()
output = args.output.resolve()
@@ -27,7 +29,10 @@ def main():
subprocess.run(['codesign', '--verify', '--strict', str(app)], check=True)
signature = subprocess.run(['codesign', '-dvv', str(app)], capture_output=True, text=True, check=True).stderr
developer_id = 'Authority=Developer ID Application:' in signature
- if not args.preview:
+ notarized = not (args.preview or args.unnotarized)
+ if args.unnotarized and 'Authority=' not in signature:
+ parser.error('An unnotarized public build still requires a stable signing certificate.')
+ if notarized:
if not developer_id:
parser.error('A public release requires Developer ID signing. Use --preview only for an explicitly labeled preview.')
subprocess.run(['xcrun', 'stapler', 'validate', str(app)], check=True)
@@ -43,14 +48,27 @@ def main():
'window_rect': ((160, 120), (760, 560)), 'icon_size': 112, 'text_size': 13,
'show_toolbar': False, 'show_status_bar': False, 'show_pathbar': False,
'show_sidebar': False, 'default_view': 'icon-view', 'include_icon_view_settings': True,
- 'hide_extensions': ['GPT Voice.app'], 'applications_menu': False,
+ 'hide_extensions': [], 'applications_menu': False,
})
subprocess.run(['hdiutil', 'verify', str(output)], check=True)
+ mounted = plistlib.loads(subprocess.run(
+ ['hdiutil', 'attach', '-readonly', '-nobrowse', '-plist', str(output)],
+ check=True, capture_output=True).stdout)
+ mount = next(Path(entity['mount-point']) for entity in mounted['system-entities'] if 'mount-point' in entity)
+ try:
+ packaged_app = mount / app.name
+ subprocess.run(['codesign', '--verify', '--strict', '--all-architectures', str(packaged_app)], check=True)
+ if (packaged_app / 'Contents/MacOS/GPTVoice').read_bytes() != (app / 'Contents/MacOS/GPTVoice').read_bytes():
+ raise RuntimeError('The disk image executable differs from the signed app.')
+ finally:
+ subprocess.run(['hdiutil', 'detach', str(mount)], check=True)
+
info = plistlib.loads((app / 'Contents/Info.plist').read_bytes())
report = {'file': output.name, 'version': info['CFBundleShortVersionString'],
'architectures': run('lipo', '-archs', str(app / 'Contents/MacOS/GPTVoice')).strip(),
'preview': args.preview, 'developer_id': developer_id,
- 'notarized_app_verified': not args.preview,
+ 'unnotarized_release': args.unnotarized,
+ 'notarized_app_verified': notarized, 'packaged_signature_verified': True,
'sha256': hashlib.sha256(output.read_bytes()).hexdigest()}
output.with_suffix('.json').write_text(json.dumps(report, indent=2) + '\n')
print(json.dumps(report, indent=2))